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
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];
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,
909 for (ch = 1; ch <= fbw_channels; ch++) {
917 for (ch = 1; ch <= fbw_channels; ch++) {
921 int bin, master_spx_coord;
925 master_spx_coord =
get_bits(gbc, 2) * 3;
930 int spx_coord_exp, spx_coord_mant;
937 nratio = (int)(accu >> 32);
938 nratio -= spx_blend << 18;
943 }
else if (nratio > 0x7fffff) {
948 accu = (int64_t)nblend * 1859775393;
949 nblend = (int)((accu + (1<<29)) >> 30);
957 nratio = ((float)((bin + (bandsize >> 1))) / s->
spx_dst_end_freq) - spx_blend;
958 nratio = av_clipf(nratio, 0.0f, 1.0f);
959 nblend = sqrtf(3.0f * nratio);
961 sblend = sqrtf(1.0f - nratio);
968 if (spx_coord_exp == 15) spx_coord_mant <<= 1;
969 else spx_coord_mant += 4;
970 spx_coord_mant <<= (25 - spx_coord_exp - master_spx_coord);
974 accu = (int64_t)nblend * spx_coord_mant;
976 accu = (int64_t)sblend * spx_coord_mant;
979 spx_coord = spx_coord_mant * (1.0f / (1 << 23));
998 int cpl_start_subband, cpl_end_subband;
1017 for (ch = 1; ch <= fbw_channels; ch++)
1026 cpl_start_subband =
get_bits(gbc, 4);
1029 if (cpl_start_subband >= cpl_end_subband) {
1031 cpl_start_subband, cpl_end_subband);
1043 for (ch = 1; ch <= fbw_channels; ch++) {
1050 }
else if (!s->
eac3) {
1053 "be present in block 0\n");
1063 int cpl_coords_exist = 0;
1065 for (ch = 1; ch <= fbw_channels; ch++) {
1068 int master_cpl_coord, cpl_coord_exp, cpl_coord_mant;
1070 cpl_coords_exist = 1;
1071 master_cpl_coord = 3 *
get_bits(gbc, 2);
1075 if (cpl_coord_exp == 15)
1076 s->
cpl_coords[ch][bnd] = cpl_coord_mant << 22;
1078 s->
cpl_coords[ch][bnd] = (cpl_coord_mant + 16) << 21;
1079 s->
cpl_coords[ch][bnd] >>= (cpl_coord_exp + master_cpl_coord);
1083 "be present in block 0\n");
1112 "new rematrixing strategy not present in block 0\n");
1118 for (ch = !cpl_in_use; ch <= s->
channels; ch++) {
1122 bit_alloc_stages[ch] = 3;
1126 for (ch = 1; ch <= fbw_channels; ch++) {
1136 int bandwidth_code =
get_bits(gbc, 6);
1137 if (bandwidth_code > 60) {
1141 s->
end_freq[ch] = bandwidth_code * 3 + 73;
1145 if (blk > 0 && s->
end_freq[ch] != prev)
1155 for (ch = !cpl_in_use; ch <= s->
channels; ch++) {
1177 for (ch = !cpl_in_use; ch <= s->
channels; ch++)
1178 bit_alloc_stages[ch] =
FFMAX(bit_alloc_stages[ch], 2);
1181 "be present in block 0\n");
1187 if (!s->
eac3 || !blk) {
1191 csnr = (
get_bits(gbc, 6) - 15) << 4;
1192 for (i = ch = !cpl_in_use; ch <= s->
channels; ch++) {
1195 snr = (csnr +
get_bits(gbc, 4)) << 2;
1198 bit_alloc_stages[ch] =
FFMAX(bit_alloc_stages[ch], 1);
1208 bit_alloc_stages[ch] =
FFMAX(bit_alloc_stages[ch], 2);
1211 }
else if (!s->
eac3 && !blk) {
1219 for (ch = !cpl_in_use; ch <= s->
channels; ch++) {
1224 bit_alloc_stages[ch] =
FFMAX(bit_alloc_stages[ch], 2);
1226 }
else if (s->
eac3 && !blk) {
1227 for (ch = !cpl_in_use; ch <= s->
channels; ch++)
1249 }
else if (!s->
eac3 && !blk) {
1251 "be present in block 0\n");
1260 for (ch = !cpl_in_use; ch <= fbw_channels; ch++) {
1266 bit_alloc_stages[ch] =
FFMAX(bit_alloc_stages[ch], 2);
1269 for (ch = !cpl_in_use; ch <= fbw_channels; ch++) {
1272 for (seg = 0; seg < s->
dba_nsegs[ch]; seg++) {
1278 bit_alloc_stages[ch] =
FFMAX(bit_alloc_stages[ch], 2);
1281 }
else if (blk == 0) {
1282 for (ch = 0; ch <= s->
channels; ch++) {
1288 for (ch = !cpl_in_use; ch <= s->
channels; ch++) {
1289 if (bit_alloc_stages[ch] > 2) {
1295 if (bit_alloc_stages[ch] > 1) {
1308 if (bit_alloc_stages[ch] > 0) {
1316 bap_tab, s->
bap[ch]);
1338 for (ch = 1; ch <= s->
channels; ch++) {
1339 int audio_channel = 0;
1342 audio_channel = 2-ch;
1353 gain *= 1.0 / 4194304.0f;
1370 if (different_transforms) {
1380 if (downmix_output) {
1390 if (downmix_output) {
1411 int *got_frame_ptr,
AVPacket *avpkt)
1415 int buf_size = avpkt->
size;
1425 if (buf_size >= 2 &&
AV_RB16(buf) == 0x770B) {
1429 (
const uint16_t *) buf, cnt);
1459 "skipping frame\n");
1543 output[ch] = s->
output[ch];
1546 for (ch = 0; ch < s->
channels; ch++) {
1547 if (ch < s->out_channels)
1559 output[ch] = s->
outptr[channel_map[ch]];
1561 if (!ch || channel_map[ch])
1646 #define OFFSET(x) offsetof(AC3DecodeContext, x)
1647 #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)