Commit 45cc62f0 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'f5c48f5a'

* commit 'f5c48f5a':
  wmavoice: use init_static_data
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 5698f6bd f5c48f5a
......@@ -302,6 +302,20 @@ typedef struct {
* @return 0 on success, <0 on error.
*/
static av_cold int decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25])
{
int cntr[8] = { 0 }, n, res;
memset(vbm_tree, 0xff, sizeof(vbm_tree[0]) * 25);
for (n = 0; n < 17; n++) {
res = get_bits(gb, 3);
if (cntr[res] > 3) // should be >= 3 + (res == 7))
return -1;
vbm_tree[res * 3 + cntr[res]++] = n;
}
return 0;
}
static av_cold void wmavoice_init_static_data(AVCodec *codec)
{
static const uint8_t bits[] = {
2, 2, 2, 4, 4, 4,
......@@ -318,18 +332,9 @@ static av_cold int decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25])
0x0ffc, 0x0ffd, 0x0ffe, // 1111111111+00/01/10
0x3ffc, 0x3ffd, 0x3ffe, 0x3fff // 111111111111+xx
};
int cntr[8] = { 0 }, n, res;
memset(vbm_tree, 0xff, sizeof(vbm_tree[0]) * 25);
for (n = 0; n < 17; n++) {
res = get_bits(gb, 3);
if (cntr[res] > 3) // should be >= 3 + (res == 7))
return -1;
vbm_tree[res * 3 + cntr[res]++] = n;
}
INIT_VLC_STATIC(&frame_type_vlc, VLC_NBITS, sizeof(bits),
bits, 1, 1, codes, 2, 2, 132);
return 0;
}
/**
......@@ -2048,6 +2053,7 @@ AVCodec ff_wmavoice_decoder = {
.id = AV_CODEC_ID_WMAVOICE,
.priv_data_size = sizeof(WMAVoiceContext),
.init = wmavoice_decode_init,
.init_static_data = wmavoice_init_static_data,
.close = wmavoice_decode_end,
.decode = wmavoice_decode_packet,
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment