63 5, 6, 7, 8, 9, 10, 11, 12, 14, 16
85 3.162275, 2.818382, 2.511886, 2.238719, 1.995261, 1.778278, 1.584893,
86 1.412536, 1.258924, 1.122018, 1.000000, 0.891251, 0.794328, 0.707946,
87 0.630957, 0.562341, 0.501187, 0.446683, 0.398107, 0.354813, 0.316227,
88 0.281838, 0.251188, 0.223872, 0.199526, 0.177828, 0.158489, 0.141253,
89 0.125892, 0.112201, 0.100000, 0.089125
97 { { 2, 7 }, { 7, 2 }, },
99 { { 2, 7 }, { 7, 2 }, },
100 { { 2, 7 }, { 5, 5 }, { 7, 2 }, },
101 { { 2, 7 }, { 7, 2 }, { 6, 6 }, },
102 { { 2, 7 }, { 5, 5 }, { 7, 2 }, { 8, 8 }, },
103 { { 2, 7 }, { 7, 2 }, { 6, 7 }, { 7, 6 }, },
104 { { 2, 7 }, { 5, 5 }, { 7, 2 }, { 6, 7 }, { 7, 6 }, },
115 return ((code - (levels >> 1)) << 24) / levels;
127 for (i = 0; i < 128; i++) {
135 for (i = 0; i < 32; i++) {
141 for (i = 0; i < 128; i++) {
153 for (i = 0; i < 7; i++) {
157 for (i = 0; i < 15; i++) {
164 for (i = 0; i < 256; i++) {
165 int v = (i >> 5) - ((i >> 7) << 3) - 5;
171 for (i = 0; i < 256; i++) {
172 int v = (i >> 4) - ((i >> 7) << 4) - 4;
211 #if FF_API_REQUEST_CHANNELS
358 }
else if (CONFIG_EAC3_DECODER) {
384 downmix_coeffs[1][0] = downmix_coeffs[1][1] = cmix;
388 downmix_coeffs[nf][0] = downmix_coeffs[nf][1] = smix *
LEVEL_MINUS_3DB;
392 downmix_coeffs[nf][0] = downmix_coeffs[nf+1][1] = smix;
398 norm0 += downmix_coeffs[i][0];
399 norm1 += downmix_coeffs[i][1];
401 norm0 = 1.0f / norm0;
402 norm1 = 1.0f / norm1;
404 downmix_coeffs[i][0] *= norm0;
405 downmix_coeffs[i][1] *= norm1;
410 downmix_coeffs[i][0] = (downmix_coeffs[i][0] +
426 int i, j, grp, group_size;
431 group_size = exp_strategy + (exp_strategy ==
EXP_D45);
432 for (grp = 0, i = 0; grp < ngrps; grp++) {
441 for (i = 0, j = 0; i < ngrps * 3; i++) {
442 prevexp += dexp[i] - 2;
445 switch (group_size) {
446 case 4: dexps[j++] = prevexp;
447 dexps[j++] = prevexp;
448 case 2: dexps[j++] = prevexp;
449 case 1: dexps[j++] = prevexp;
466 int band_start = bin;
471 for (bin = band_start; bin < band_end; bin++) {
476 for (bin = band_start; bin < band_end; bin++)
504 int end_freq = s->
end_freq[ch_index];
506 int8_t *exps = s->
dexps[ch_index];
512 for (freq = start_freq; freq < end_freq; freq++) {
513 int bap = baps[freq];
574 coeffs[freq] = mantissa >> exps[freq];
605 if (!blk && CONFIG_EAC3_DECODER)
607 for (bin = s->
start_freq[ch]; bin < s->end_freq[ch]; bin++) {
624 for (ch = 1; ch <= s->
channels; ch++) {
680 for (ch = 1; ch <= channels; ch++) {
684 for (i = 0; i < 128; i++)
688 s->
fdsp->vector_fmul_window_scaled(s->
outptr[ch - 1], s->
delay[ch - 1],
694 for (i = 0; i < 128; i++)
700 s->
fdsp->vector_fmul_window_scaled(s->
outptr[ch - 1], s->
delay[ch - 1],
716 int channel_data_size =
sizeof(s->
delay[0]);
721 memcpy(s->
delay[1], s->
delay[0], channel_data_size);
724 memset(s->
delay[3], 0, channel_data_size);
726 memset(s->
delay[2], 0, channel_data_size);
729 memset(s->
delay[4], 0, channel_data_size);
731 memset(s->
delay[3], 0, channel_data_size);
733 memcpy(s->
delay[2], s->
delay[1], channel_data_size);
734 memset(s->
delay[1], 0, channel_data_size);
756 int ecpl,
int start_subband,
int end_subband,
757 const uint8_t *default_band_struct,
758 int *num_bands,
uint8_t *band_sizes)
760 int subbnd, bnd, n_subbands, n_bands=0;
765 n_subbands = end_subband - start_subband;
769 for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) {
770 coded_band_struct[subbnd] =
get_bits1(gbc);
772 band_struct = coded_band_struct;
774 band_struct = &default_band_struct[start_subband+1];
783 if (num_bands || band_sizes ) {
784 n_bands = n_subbands;
785 bnd_sz[0] = ecpl ? 6 : 12;
786 for (bnd = 0, subbnd = 1; subbnd < n_subbands; subbnd++) {
787 int subbnd_size = (ecpl && subbnd < 4) ? 6 : 12;
788 if (band_struct[subbnd - 1]) {
790 bnd_sz[bnd] += subbnd_size;
792 bnd_sz[++bnd] = subbnd_size;
799 *num_bands = n_bands;
801 memcpy(band_sizes, bnd_sz, n_bands);
812 int different_transforms;
819 different_transforms = 0;
821 for (ch = 1; ch <= fbw_channels; ch++) {
824 different_transforms = 1;
830 for (ch = 1; ch <= fbw_channels; ch++) {
843 if (range_bits <= 127 || s->drc_scale <= 1.0)
847 }
else if (blk == 0) {
856 int dst_start_freq, dst_end_freq, src_start_freq,
857 start_subband, end_subband;
863 for (ch = 1; ch <= fbw_channels; ch++)
870 start_subband =
get_bits(gbc, 3) + 2;
871 if (start_subband > 7)
872 start_subband += start_subband - 7;
878 end_subband += end_subband - 7;
879 dst_start_freq = dst_start_freq * 12 + 25;
880 src_start_freq = start_subband * 12 + 25;
881 dst_end_freq = end_subband * 12 + 25;
884 if (start_subband >= end_subband) {
886 "range (%d >= %d)\n", start_subband, end_subband);
889 if (dst_start_freq >= src_start_freq) {
891 "copy start bin (%d >= %d)\n", dst_start_freq, src_start_freq);
901 start_subband, end_subband,
906 for (ch = 1; ch <= fbw_channels; ch++) {
915 for (ch = 1; ch <= fbw_channels; ch++) {
919 int bin, master_spx_coord;
923 master_spx_coord =
get_bits(gbc, 2) * 3;
928 int spx_coord_exp, spx_coord_mant;
935 nratio = (int)(accu >> 32);
936 nratio -= spx_blend << 18;
941 }
else if (nratio > 0x7fffff) {
946 accu = (int64_t)nblend * 1859775393;
947 nblend = (int)((accu + (1<<29)) >> 30);
955 nratio = ((float)((bin + (bandsize >> 1))) / s->
spx_dst_end_freq) - spx_blend;
956 nratio = av_clipf(nratio, 0.0f, 1.0f);
957 nblend = sqrtf(3.0f * nratio);
959 sblend = sqrtf(1.0f - nratio);
966 if (spx_coord_exp == 15) spx_coord_mant <<= 1;
967 else spx_coord_mant += 4;
968 spx_coord_mant <<= (25 - spx_coord_exp - master_spx_coord);
972 accu = (int64_t)nblend * spx_coord_mant;
974 accu = (int64_t)sblend * spx_coord_mant;
977 spx_coord = spx_coord_mant * (1.0f / (1 << 23));
996 int cpl_start_subband, cpl_end_subband;
1015 for (ch = 1; ch <= fbw_channels; ch++)
1024 cpl_start_subband =
get_bits(gbc, 4);
1027 if (cpl_start_subband >= cpl_end_subband) {
1029 cpl_start_subband, cpl_end_subband);
1041 for (ch = 1; ch <= fbw_channels; ch++) {
1048 }
else if (!s->
eac3) {
1051 "be present in block 0\n");
1061 int cpl_coords_exist = 0;
1063 for (ch = 1; ch <= fbw_channels; ch++) {
1066 int master_cpl_coord, cpl_coord_exp, cpl_coord_mant;
1068 cpl_coords_exist = 1;
1069 master_cpl_coord = 3 *
get_bits(gbc, 2);
1073 if (cpl_coord_exp == 15)
1074 s->
cpl_coords[ch][bnd] = cpl_coord_mant << 22;
1076 s->
cpl_coords[ch][bnd] = (cpl_coord_mant + 16) << 21;
1077 s->
cpl_coords[ch][bnd] >>= (cpl_coord_exp + master_cpl_coord);
1081 "be present in block 0\n");
1110 "new rematrixing strategy not present in block 0\n");
1116 for (ch = !cpl_in_use; ch <= s->
channels; ch++) {
1120 bit_alloc_stages[ch] = 3;
1124 for (ch = 1; ch <= fbw_channels; ch++) {
1134 int bandwidth_code =
get_bits(gbc, 6);
1135 if (bandwidth_code > 60) {
1139 s->
end_freq[ch] = bandwidth_code * 3 + 73;
1143 if (blk > 0 && s->
end_freq[ch] != prev)
1153 for (ch = !cpl_in_use; ch <= s->
channels; ch++) {
1175 for (ch = !cpl_in_use; ch <= s->
channels; ch++)
1176 bit_alloc_stages[ch] =
FFMAX(bit_alloc_stages[ch], 2);
1179 "be present in block 0\n");
1185 if (!s->
eac3 || !blk) {
1189 csnr = (
get_bits(gbc, 6) - 15) << 4;
1190 for (i = ch = !cpl_in_use; ch <= s->
channels; ch++) {
1193 snr = (csnr +
get_bits(gbc, 4)) << 2;
1196 bit_alloc_stages[ch] =
FFMAX(bit_alloc_stages[ch], 1);
1206 bit_alloc_stages[ch] =
FFMAX(bit_alloc_stages[ch], 2);
1209 }
else if (!s->
eac3 && !blk) {
1217 for (ch = !cpl_in_use; ch <= s->
channels; ch++) {
1222 bit_alloc_stages[ch] =
FFMAX(bit_alloc_stages[ch], 2);
1224 }
else if (s->
eac3 && !blk) {
1225 for (ch = !cpl_in_use; ch <= s->
channels; ch++)
1247 }
else if (!s->
eac3 && !blk) {
1249 "be present in block 0\n");
1258 for (ch = !cpl_in_use; ch <= fbw_channels; ch++) {
1264 bit_alloc_stages[ch] =
FFMAX(bit_alloc_stages[ch], 2);
1267 for (ch = !cpl_in_use; ch <= fbw_channels; ch++) {
1270 for (seg = 0; seg < s->
dba_nsegs[ch]; seg++) {
1276 bit_alloc_stages[ch] =
FFMAX(bit_alloc_stages[ch], 2);
1279 }
else if (blk == 0) {
1280 for (ch = 0; ch <= s->
channels; ch++) {
1286 for (ch = !cpl_in_use; ch <= s->
channels; ch++) {
1287 if (bit_alloc_stages[ch] > 2) {
1293 if (bit_alloc_stages[ch] > 1) {
1306 if (bit_alloc_stages[ch] > 0) {
1314 bap_tab, s->
bap[ch]);
1336 for (ch = 1; ch <= s->
channels; ch++) {
1337 int audio_channel = 0;
1340 audio_channel = 2-ch;
1351 gain *= 1.0 / 4194304.0f;
1368 if (different_transforms) {
1378 if (downmix_output) {
1388 if (downmix_output) {
1409 int *got_frame_ptr,
AVPacket *avpkt)
1413 int buf_size = avpkt->
size;
1423 if (buf_size >= 2 &&
AV_RB16(buf) == 0x770B) {
1427 (
const uint16_t *) buf, cnt);
1456 "skipping frame\n");
1540 output[ch] = s->
output[ch];
1543 for (ch = 0; ch < s->
channels; ch++) {
1544 if (ch < s->out_channels)
1556 output[ch] = s->
outptr[channel_map[ch]];
1558 if (!ch || channel_map[ch])
1643 #define OFFSET(x) offsetof(AC3DecodeContext, x)
1644 #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)