88 if((t << 1) > size) mask = ~mask;
94 0, 640, 1184, 1748, 2298, 2426, 2554, 3066, 3578, 4106, 4618, 5196, 5708
102 static int vlc_initialized = 0;
110 static VLC_TYPE dscf0_table[560][2];
111 static VLC_TYPE dscf1_table[598][2];
114 static VLC_TYPE codes_table[5708][2];
150 if(vlc_initialized)
return 0;
153 band_vlc.
table = band_table;
159 q1_vlc.
table = q1_table;
164 q9up_vlc.
table = q9up_table;
170 scfi_vlc[0].
table = scfi0_table;
175 scfi_vlc[1].
table = scfi1_table;
181 dscf_vlc[0].
table = dscf0_table;
186 dscf_vlc[1].
table = dscf1_table;
192 q3_vlc[0].
table = q3_0_table;
198 q3_vlc[1].
table = q3_1_table;
205 for(i = 0; i < 2; i++){
212 q2_vlc[i].
table = &codes_table[vlc_offsets[2+i]];
218 quant_vlc[0][i].
table = &codes_table[vlc_offsets[4+i]];
223 quant_vlc[1][i].
table = &codes_table[vlc_offsets[6+i]];
228 quant_vlc[2][i].
table = &codes_table[vlc_offsets[8+i]];
233 quant_vlc[3][i].
table = &codes_table[vlc_offsets[10+i]];
234 quant_vlc[3][i].
table_allocated = vlc_offsets[11+i] - vlc_offsets[10+i];
245 int *got_frame_ptr,
AVPacket *avpkt)
248 int buf_size = avpkt->
size;
251 int i, j, k, ch, cnt, res,
t;
254 int maxband, keyframe;
267 memset(c->
Q, 0,
sizeof(c->
Q));
277 if(maxband > 32) maxband -= 33;
288 last[0] = last[1] = 0;
289 for(i = maxband - 1; i >= 0; i--){
290 for(ch = 0; ch < 2; ch++){
292 if(last[ch] > 15) last[ch] -= 17;
293 bands[i].
res[ch] = last[ch];
300 for(i = 0; i < maxband; i++)
301 if(bands[i].res[0] || bands[i].res[1])
305 for(i = maxband - 1; i >= 0; i--)
306 if(bands[i].res[0] || bands[i].res[1]){
307 bands[i].
msf = mask & 1;
312 for(i = maxband; i < c->
maxbands; i++)
313 bands[i].res[0] = bands[i].res[1] = 0;
316 for(i = 0; i < 32; i++)
320 for(i = 0; i < maxband; i++){
321 if(bands[i].res[0] || bands[i].res[1]){
322 cnt = !!bands[i].
res[0] + !!bands[i].
res[1] - 1;
325 if(bands[i].res[0]) bands[i].
scfi[0] = t >> (2 * cnt);
326 if(bands[i].res[1]) bands[i].
scfi[1] = t & 3;
331 for(i = 0; i < maxband; i++){
332 for(ch = 0; ch < 2; ch++){
333 if(!bands[i].res[ch])
continue;
342 bands[i].
scf_idx[ch][0] = ((bands[i].
scf_idx[ch][2] + t - 25) & 0x7F) - 6;
344 for(j = 0; j < 2; j++){
345 if((bands[i].scfi[ch] << j) & 2)
346 bands[i].scf_idx[ch][j + 1] = bands[i].scf_idx[ch][j];
351 bands[i].
scf_idx[ch][j + 1] = ((bands[i].
scf_idx[ch][j] + t - 25) & 0x7F) - 6;
358 for(ch = 0; ch < 2; ch++){
359 res = bands[i].
res[ch];
371 for(k = 0; k < SAMPLES_PER_BAND / 2; k++, t <<= 1)
372 c->
Q[ch][off + j + k] = (t & 0x20000) ? (
get_bits1(gb) << 1) - 1 : 0;
389 c->
Q[ch][off + j + 1] = t >> 4;
390 c->
Q[ch][off + j + 0] = (t & 8) ? (t & 0xF) - 16 : (t & 0xF);
400 c->
Q[ch][off + j] =
t;
401 cnt = (cnt >> 1) +
FFABS(c->
Q[ch][off + j]);
408 c->
Q[ch][off + j] <<= res - 9;
409 c->
Q[ch][off + j] |=
get_bits(gb, res - 9);
411 c->
Q[ch][off + j] -= (1 << (res - 2)) - 1;