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;
51 if (!run_table || !level_table || !flevel_table || !int_table) {
63 l = levels_table[k++];
64 for (j = 0; j < l; j++) {
66 level_table[i] =
level;
67 flevel_table[i] =
level;
72 *prun_table = run_table;
73 *plevel_table = flevel_table;
74 *pint_table = int_table;
84 float bps1, high_freq;
110 nb = ((flags2 >> 3) & 3) + 1;
127 if (sample_rate1 >= 44100)
128 sample_rate1 = 44100;
129 else if (sample_rate1 >= 22050)
130 sample_rate1 = 22050;
131 else if (sample_rate1 >= 16000)
132 sample_rate1 = 16000;
133 else if (sample_rate1 >= 11025)
134 sample_rate1 = 11025;
135 else if (sample_rate1 >= 8000)
152 if (sample_rate1 == 44100) {
156 high_freq = high_freq * 0.4;
157 }
else if (sample_rate1 == 22050) {
160 else if (bps1 >= 0.72)
161 high_freq = high_freq * 0.7;
163 high_freq = high_freq * 0.6;
164 }
else if (sample_rate1 == 16000) {
166 high_freq = high_freq * 0.5;
168 high_freq = high_freq * 0.3;
169 }
else if (sample_rate1 == 11025)
170 high_freq = high_freq * 0.7;
171 else if (sample_rate1 == 8000) {
173 high_freq = high_freq * 0.5;
177 high_freq = high_freq * 0.65;
180 high_freq = high_freq * 0.75;
182 high_freq = high_freq * 0.6;
184 high_freq = high_freq * 0.5;
187 av_dlog(s->
avctx,
"version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n",
190 av_dlog(s->
avctx,
"bps=%f bps1=%f high_freq=%f bitoffset=%d\n",
192 av_dlog(s->
avctx,
"use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n",
197 int a,
b, pos, lpos, k, block_len, i, j,
n;
209 for (i = 0; i < 25; i++) {
212 pos = ((block_len * 2 *
a) + (b >> 1)) / b;
216 if (pos >= block_len) {
237 for (i = 0; i <
n; i++)
243 for (i = 0; i < 25; i++) {
246 pos = ((block_len * 2 *
a) + (b << 1)) / (4 * b);
252 if (pos >= block_len)
268 for (i = 0; i <
n; i++) {
273 if (start < s->high_band_start[k])
282 tprintf(s->
avctx,
"%5d: coefs_end=%d high_band_start=%d nb_high_bands=%d: ",
331 norm = (1.0 / (
float) (1LL << 31)) * sqrt(3) * s->
noise_mult;
346 if (avctx->sample_rate >= 32000) {
349 else if (bps1 < 1.16)
352 s->coef_vlcs[0] = &
coef_vlcs[coef_vlc_table * 2];
353 s->coef_vlcs[1] = &
coef_vlcs[coef_vlc_table * 2 + 1];
355 &
s->int_table[0],
s->coef_vlcs[0]);
360 &
s->int_table[1],
s->coef_vlcs[1]);
367 else if (total_gain < 32)
369 else if (total_gain < 40)
371 else if (total_gain < 45)
389 for (i = 0; i < 2; i++) {
438 VLC *vlc,
const float *level_table,
439 const uint16_t *run_table,
int version,
441 int block_len,
int frame_len_bits,
444 int code,
level, sign;
445 const uint32_t *ilvl = (
const uint32_t *) level_table;
446 uint32_t *iptr = (uint32_t *) ptr;
447 const unsigned int coef_mask = block_len - 1;
448 for (; offset < num_coefs; offset++) {
452 offset += run_table[code];
454 iptr[offset & coef_mask] = ilvl[code] ^ sign << 31;
455 }
else if (code == 1) {
464 offset +=
get_bits(gb, frame_len_bits);
472 "broken escape sequence\n");
475 offset +=
get_bits(gb, frame_len_bits) + 4;
481 ptr[offset & coef_mask] = (level ^ sign) - sign;
485 if (offset > num_coefs) {
487 "overflow (%d > %d) in spectral RLE, ignoring\n",