34 float **plevel_table, uint16_t **pint_table,
39 const uint32_t *table_codes = vlc_table->
huffcodes;
40 const uint16_t *levels_table = vlc_table->
levels;
41 uint16_t *run_table, *level_table, *int_table;
43 int i, l, j, k,
level;
47 run_table =
av_malloc(n *
sizeof(uint16_t));
48 level_table =
av_malloc(n *
sizeof(uint16_t));
49 flevel_table=
av_malloc(n *
sizeof(*flevel_table));
50 int_table =
av_malloc(n *
sizeof(uint16_t));
56 l = levels_table[k++];
57 for (j = 0; j < l; j++) {
59 level_table[i] =
level;
60 flevel_table[i]=
level;
65 *prun_table = run_table;
66 *plevel_table = flevel_table;
67 *pint_table = int_table;
75 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) {
144 if (sample_rate1 == 44100) {
148 high_freq = high_freq * 0.4;
150 }
else if (sample_rate1 == 22050) {
153 }
else if (bps1 >= 0.72) {
154 high_freq = high_freq * 0.7;
156 high_freq = high_freq * 0.6;
158 }
else if (sample_rate1 == 16000) {
160 high_freq = high_freq * 0.5;
162 high_freq = high_freq * 0.3;
164 }
else if (sample_rate1 == 11025) {
165 high_freq = high_freq * 0.7;
166 }
else if (sample_rate1 == 8000) {
168 high_freq = high_freq * 0.5;
169 }
else if (bps > 0.75) {
172 high_freq = high_freq * 0.65;
176 high_freq = high_freq * 0.75;
177 }
else if (bps >= 0.6) {
178 high_freq = high_freq * 0.6;
180 high_freq = high_freq * 0.5;
184 av_dlog(s->
avctx,
"version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n",
187 av_dlog(s->
avctx,
"bps=%f bps1=%f high_freq=%f bitoffset=%d\n",
189 av_dlog(s->
avctx,
"use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n",
194 int a,
b, pos, lpos, k, block_len, i, j, n;
207 for (i = 0; i < 25; i++) {
210 pos = ((block_len * 2 *
a) + (b >> 1)) / b;
214 if (pos >= block_len) {
236 for (i = 0; i < n; i++)
242 for (i = 0; i < 25; i++) {
245 pos = ((block_len * 2 *
a) + (b << 1)) / (4 * b);
251 if (pos >= block_len)
267 for (i = 0; i < n; i++) {
272 if (start < s->high_band_start[k])
281 tprintf(s->
avctx,
"%5d: coefs_end=%d high_band_start=%d nb_high_bands=%d: ",
332 norm = (1.0 / (
float)(1LL << 31)) * sqrt(3) * s->
noise_mult;
343 if (avctx->sample_rate >= 32000) {
346 }
else if (bps1 < 1.16) {
350 s->coef_vlcs[0]= &
coef_vlcs[coef_vlc_table * 2 ];
351 s->coef_vlcs[1]= &
coef_vlcs[coef_vlc_table * 2 + 1];
352 init_coef_vlc(&s->coef_vlc[0], &s->run_table[0], &s->level_table[0], &s->int_table[0],
354 init_coef_vlc(&s->coef_vlc[1], &s->run_table[1], &s->level_table[1], &s->int_table[1],
362 if (total_gain < 15)
return 13;
363 else if (total_gain < 32)
return 12;
364 else if (total_gain < 40)
return 11;
365 else if (total_gain < 45)
return 10;
383 for (i = 0; i < 2; i++) {
433 const float *level_table,
const uint16_t *run_table,
435 int num_coefs,
int block_len,
int frame_len_bits,
438 int code,
level, sign;
439 const uint32_t *ilvl = (
const uint32_t*)level_table;
440 uint32_t *iptr = (uint32_t*)ptr;
441 const unsigned int coef_mask = block_len - 1;
442 for (; offset < num_coefs; offset++) {
446 offset += run_table[code];
448 iptr[offset & coef_mask] = ilvl[code] ^ sign<<31;
449 }
else if (code == 1) {
458 offset +=
get_bits(gb, frame_len_bits);
466 "broken escape sequence\n");
469 offset +=
get_bits(gb, frame_len_bits) + 4;
475 ptr[offset & coef_mask] = (level^sign) - sign;
479 if (offset > num_coefs) {