35 float **plevel_table, uint16_t **pint_table,
40 const uint32_t *table_codes = vlc_table->
huffcodes;
41 const uint16_t *levels_table = vlc_table->
levels;
42 uint16_t *run_table, *level_table, *int_table;
44 int i, l, j, k,
level;
48 run_table =
av_malloc(n *
sizeof(uint16_t));
49 level_table =
av_malloc(n *
sizeof(uint16_t));
50 flevel_table=
av_malloc(n *
sizeof(*flevel_table));
51 int_table =
av_malloc(n *
sizeof(uint16_t));
57 l = levels_table[k++];
58 for (j = 0; j < l; j++) {
60 level_table[i] =
level;
61 flevel_table[i]=
level;
66 *prun_table = run_table;
67 *plevel_table = flevel_table;
68 *pint_table = int_table;
76 float bps1, high_freq;
105 nb = ((flags2 >> 3) & 3) + 1;
123 if (sample_rate1 >= 44100) {
124 sample_rate1 = 44100;
125 }
else if (sample_rate1 >= 22050) {
126 sample_rate1 = 22050;
127 }
else if (sample_rate1 >= 16000) {
128 sample_rate1 = 16000;
129 }
else if (sample_rate1 >= 11025) {
130 sample_rate1 = 11025;
131 }
else if (sample_rate1 >= 8000) {
148 if (sample_rate1 == 44100) {
152 high_freq = high_freq * 0.4;
154 }
else if (sample_rate1 == 22050) {
157 }
else if (bps1 >= 0.72) {
158 high_freq = high_freq * 0.7;
160 high_freq = high_freq * 0.6;
162 }
else if (sample_rate1 == 16000) {
164 high_freq = high_freq * 0.5;
166 high_freq = high_freq * 0.3;
168 }
else if (sample_rate1 == 11025) {
169 high_freq = high_freq * 0.7;
170 }
else if (sample_rate1 == 8000) {
172 high_freq = high_freq * 0.5;
173 }
else if (bps > 0.75) {
176 high_freq = high_freq * 0.65;
180 high_freq = high_freq * 0.75;
181 }
else if (bps >= 0.6) {
182 high_freq = high_freq * 0.6;
184 high_freq = high_freq * 0.5;
188 av_dlog(s->
avctx,
"version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n",
191 av_dlog(s->
avctx,
"bps=%f bps1=%f high_freq=%f bitoffset=%d\n",
193 av_dlog(s->
avctx,
"use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n",
198 int a,
b, pos, lpos, k, block_len, i, j,
n;
211 for (i = 0; i < 25; i++) {
214 pos = ((block_len * 2 *
a) + (b >> 1)) / b;
218 if (pos >= block_len) {
240 for (i = 0; i <
n; i++)
246 for (i = 0; i < 25; i++) {
249 pos = ((block_len * 2 *
a) + (b << 1)) / (4 * b);
255 if (pos >= block_len)
271 for (i = 0; i <
n; i++) {
276 if (start < s->high_band_start[k])
285 tprintf(s->
avctx,
"%5d: coefs_end=%d high_band_start=%d nb_high_bands=%d: ",
336 norm = (1.0 / (
float)(1LL << 31)) * sqrt(3) * s->
noise_mult;
347 if (avctx->sample_rate >= 32000) {
350 }
else if (bps1 < 1.16) {
354 s->coef_vlcs[0]= &
coef_vlcs[coef_vlc_table * 2 ];
355 s->coef_vlcs[1]= &
coef_vlcs[coef_vlc_table * 2 + 1];
356 init_coef_vlc(&
s->coef_vlc[0], &
s->run_table[0], &
s->level_table[0], &
s->int_table[0],
358 init_coef_vlc(&
s->coef_vlc[1], &
s->run_table[1], &
s->level_table[1], &
s->int_table[1],
366 if (total_gain < 15)
return 13;
367 else if (total_gain < 32)
return 12;
368 else if (total_gain < 40)
return 11;
369 else if (total_gain < 45)
return 10;
387 for (i = 0; i < 2; i++) {
437 const float *level_table,
const uint16_t *run_table,
439 int num_coefs,
int block_len,
int frame_len_bits,
442 int code,
level, sign;
443 const uint32_t *ilvl = (
const uint32_t*)level_table;
444 uint32_t *iptr = (uint32_t*)ptr;
445 const unsigned int coef_mask = block_len - 1;
446 for (; offset < num_coefs; offset++) {
450 offset += run_table[code];
452 iptr[offset & coef_mask] = ilvl[code] ^ sign<<31;
453 }
else if (code == 1) {
462 offset +=
get_bits(gb, frame_len_bits);
470 "broken escape sequence\n");
473 offset +=
get_bits(gb, frame_len_bits) + 4;
479 ptr[offset & coef_mask] = (level^sign) - sign;
483 if (offset > num_coefs) {