60     5, 6, 7, 8, 9, 10, 11, 12, 14, 16
 
   84     { { 2, 7 }, { 7, 2 },                               },
 
   86     { { 2, 7 }, { 7, 2 },                               },
 
   87     { { 2, 7 }, { 5, 5 }, { 7, 2 },                     },
 
   88     { { 2, 7 }, { 7, 2 }, { 6, 6 },                     },
 
   89     { { 2, 7 }, { 5, 5 }, { 7, 2 }, { 8, 8 },           },
 
   90     { { 2, 7 }, { 7, 2 }, { 6, 7 }, { 7, 6 },           },
 
   91     { { 2, 7 }, { 5, 5 }, { 7, 2 }, { 6, 7 }, { 7, 6 }, },
 
  102     return ((code - (levels >> 1)) << 24) / levels;
 
  114     for (i = 0; i < 128; i++) {
 
  122     for (i = 0; i < 32; i++) {
 
  128     for (i = 0; i < 128; i++) {
 
  140     for (i = 0; i < 7; i++) {
 
  144     for (i = 0; i < 15; i++) {
 
  151     for (i = 0; i < 256; i++) {
 
  152         int v = (i >> 5) - ((i >> 7) << 3) - 5;
 
  181     if (avctx->
channels > 0 && avctx->request_channels > 0 &&
 
  182             avctx->request_channels < avctx->
channels &&
 
  183             avctx->request_channels <= 2) {
 
  184         avctx->
channels = avctx->request_channels;
 
  288     } 
else if (CONFIG_EAC3_DECODER) {
 
  330     norm0 = 1.0f / norm0;
 
  331     norm1 = 1.0f / norm1;
 
  351     int i, j, grp, group_size;
 
  356     group_size = exp_strategy + (exp_strategy == 
EXP_D45);
 
  357     for (grp = 0, i = 0; grp < ngrps; grp++) {
 
  366     for (i = 0, j = 0; i < ngrps * 3; i++) {
 
  367         prevexp += dexp[i] - 2;
 
  370         switch (group_size) {
 
  371         case 4: dexps[j++] = prevexp;
 
  372                 dexps[j++] = prevexp;
 
  373         case 2: dexps[j++] = prevexp;
 
  374         case 1: dexps[j++] = prevexp;
 
  391         int band_start = bin;
 
  396                 for (bin = band_start; bin < band_end; bin++) {
 
  401                     for (bin = band_start; bin < band_end; bin++)
 
  429     int end_freq   = s->
end_freq[ch_index];
 
  431     int8_t *exps   = s->
dexps[ch_index];
 
  437     for (freq = start_freq; freq < end_freq; freq++) {
 
  438         int bap = baps[freq];
 
  499         coeffs[freq] = mantissa >> exps[freq];
 
  530         if (!blk && CONFIG_EAC3_DECODER)
 
  532         for (bin = s->
start_freq[ch]; bin < s->end_freq[ch]; bin++) {
 
  549     for (ch = 1; ch <= s->
channels; ch++) {
 
  605     for (ch = 1; ch <= channels; ch++) {
 
  609             for (i = 0; i < 128; i++)
 
  614             for (i = 0; i < 128; i++)
 
  631     int channel_data_size = 
sizeof(s->
delay[0]);
 
  636         memcpy(s->
delay[1], s->
delay[0], channel_data_size);
 
  639         memset(s->
delay[3], 0, channel_data_size);
 
  641         memset(s->
delay[2], 0, channel_data_size);
 
  644         memset(s->
delay[4], 0, channel_data_size);
 
  646         memset(s->
delay[3], 0, channel_data_size);
 
  648         memcpy(s->
delay[2], s->
delay[1], channel_data_size);
 
  649         memset(s->
delay[1], 0, channel_data_size);
 
  671                                   int ecpl, 
int start_subband, 
int end_subband,
 
  672                                   const uint8_t *default_band_struct,
 
  673                                   int *num_bands, 
uint8_t *band_sizes)
 
  675     int subbnd, bnd, n_subbands, n_bands=0;
 
  680     n_subbands = end_subband - start_subband;
 
  684         for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) {
 
  685             coded_band_struct[subbnd] = 
get_bits1(gbc);
 
  687         band_struct = coded_band_struct;
 
  689         band_struct = &default_band_struct[start_subband+1];
 
  698     if (num_bands || band_sizes ) {
 
  699         n_bands = n_subbands;
 
  700         bnd_sz[0] = ecpl ? 6 : 12;
 
  701         for (bnd = 0, subbnd = 1; subbnd < n_subbands; subbnd++) {
 
  702             int subbnd_size = (ecpl && subbnd < 4) ? 6 : 12;
 
  703             if (band_struct[subbnd - 1]) {
 
  705                 bnd_sz[bnd] += subbnd_size;
 
  707                 bnd_sz[++bnd] = subbnd_size;
 
  714         *num_bands = n_bands;
 
  716         memcpy(band_sizes, bnd_sz, n_bands);
 
  727     int different_transforms;
 
  734     different_transforms = 0;
 
  736         for (ch = 1; ch <= fbw_channels; ch++) {
 
  739                 different_transforms = 1;
 
  745         for (ch = 1; ch <= fbw_channels; ch++) {
 
  756         } 
else if (blk == 0) {
 
  765             int dst_start_freq, dst_end_freq, src_start_freq,
 
  766                 start_subband, end_subband;
 
  772                 for (ch = 1; ch <= fbw_channels; ch++)
 
  779             start_subband  = 
get_bits(gbc, 3) + 2;
 
  780             if (start_subband > 7)
 
  781                 start_subband += start_subband - 7;
 
  784                 end_subband   += end_subband   - 7;
 
  785             dst_start_freq = dst_start_freq * 12 + 25;
 
  786             src_start_freq = start_subband  * 12 + 25;
 
  787             dst_end_freq   = end_subband    * 12 + 25;
 
  790             if (start_subband >= end_subband) {
 
  792                        "range (%d >= %d)\n", start_subband, end_subband);
 
  795             if (dst_start_freq >= src_start_freq) {
 
  797                        "copy start bin (%d >= %d)\n", dst_start_freq, src_start_freq);
 
  806                                   start_subband, end_subband,
 
  811             for (ch = 1; ch <= fbw_channels; ch++) {
 
  820         for (ch = 1; ch <= fbw_channels; ch++) {
 
  824                     int bin, master_spx_coord;
 
  827                     spx_blend = 
get_bits(gbc, 5) * (1.0f/32);
 
  828                     master_spx_coord = 
get_bits(gbc, 2) * 3;
 
  833                         int spx_coord_exp, spx_coord_mant;
 
  834                         float nratio, sblend, nblend, spx_coord;
 
  838                         nratio = ((float)((bin + (bandsize >> 1))) / s->
spx_dst_end_freq) - spx_blend;
 
  839                         nratio = av_clipf(nratio, 0.0f, 1.0f);
 
  840                         nblend = sqrtf(3.0f * nratio); 
 
  842                         sblend = sqrtf(1.0f - nratio);
 
  848                         if (spx_coord_exp == 15) spx_coord_mant <<= 1;
 
  849                         else                     spx_coord_mant += 4;
 
  850                         spx_coord_mant <<= (25 - spx_coord_exp - master_spx_coord);
 
  851                         spx_coord = spx_coord_mant * (1.0f / (1 << 23));
 
  871             int cpl_start_subband, cpl_end_subband;
 
  890                 for (ch = 1; ch <= fbw_channels; ch++)
 
  899             cpl_start_subband = 
get_bits(gbc, 4);
 
  902             if (cpl_start_subband >= cpl_end_subband) {
 
  904                        cpl_start_subband, cpl_end_subband);
 
  916             for (ch = 1; ch <= fbw_channels; ch++) {
 
  923     } 
else if (!s->
eac3) {
 
  926                    "be present in block 0\n");
 
  936         int cpl_coords_exist = 0;
 
  938         for (ch = 1; ch <= fbw_channels; ch++) {
 
  941                     int master_cpl_coord, cpl_coord_exp, cpl_coord_mant;
 
  943                     cpl_coords_exist = 1;
 
  944                     master_cpl_coord = 3 * 
get_bits(gbc, 2);
 
  948                         if (cpl_coord_exp == 15)
 
  949                             s->
cpl_coords[ch][bnd] = cpl_coord_mant << 22;
 
  951                             s->
cpl_coords[ch][bnd] = (cpl_coord_mant + 16) << 21;
 
  952                         s->
cpl_coords[ch][bnd] >>= (cpl_coord_exp + master_cpl_coord);
 
  956                            "be present in block 0\n");
 
  985                    "new rematrixing strategy not present in block 0\n");
 
  991     for (ch = !cpl_in_use; ch <= s->
channels; ch++) {
 
  995             bit_alloc_stages[ch] = 3;
 
  999     for (ch = 1; ch <= fbw_channels; ch++) {
 
 1009                 int bandwidth_code = 
get_bits(gbc, 6);
 
 1010                 if (bandwidth_code > 60) {
 
 1014                 s->
end_freq[ch] = bandwidth_code * 3 + 73;
 
 1018             if (blk > 0 && s->
end_freq[ch] != prev)
 
 1028     for (ch = !cpl_in_use; ch <= s->
channels; ch++) {
 
 1050             for (ch = !cpl_in_use; ch <= s->
channels; ch++)
 
 1051                 bit_alloc_stages[ch] = 
FFMAX(bit_alloc_stages[ch], 2);
 
 1054                    "be present in block 0\n");
 
 1060     if (!s->
eac3 || !blk) {
 
 1064             csnr = (
get_bits(gbc, 6) - 15) << 4;
 
 1065             for (i = ch = !cpl_in_use; ch <= s->
channels; ch++) {
 
 1068                     snr = (csnr + 
get_bits(gbc, 4)) << 2;
 
 1071                     bit_alloc_stages[ch] = 
FFMAX(bit_alloc_stages[ch], 1);
 
 1081                         bit_alloc_stages[ch] = 
FFMAX(bit_alloc_stages[ch], 2);
 
 1084         } 
else if (!s->
eac3 && !blk) {
 
 1092         for (ch = !cpl_in_use; ch <= s->
channels; ch++) {
 
 1097                 bit_alloc_stages[ch] = 
FFMAX(bit_alloc_stages[ch], 2);
 
 1099     } 
else if (s->
eac3 && !blk) {
 
 1100         for (ch = !cpl_in_use; ch <= s->
channels; ch++)
 
 1122         } 
else if (!s->
eac3 && !blk) {
 
 1124                    "be present in block 0\n");
 
 1133         for (ch = !cpl_in_use; ch <= fbw_channels; ch++) {
 
 1139             bit_alloc_stages[ch] = 
FFMAX(bit_alloc_stages[ch], 2);
 
 1142         for (ch = !cpl_in_use; ch <= fbw_channels; ch++) {
 
 1145                 for (seg = 0; seg < s->
dba_nsegs[ch]; seg++) {
 
 1151                 bit_alloc_stages[ch] = 
FFMAX(bit_alloc_stages[ch], 2);
 
 1154     } 
else if (blk == 0) {
 
 1155         for (ch = 0; ch <= s->
channels; ch++) {
 
 1161     for (ch = !cpl_in_use; ch <= s->
channels; ch++) {
 
 1162         if (bit_alloc_stages[ch] > 2) {
 
 1168         if (bit_alloc_stages[ch] > 1) {
 
 1181         if (bit_alloc_stages[ch] > 0) {
 
 1189                                       bap_tab, s->
bap[ch]);
 
 1211     for (ch = 1; ch <= s->
channels; ch++) {
 
 1212         float gain = 1.0 / 4194304.0f;
 
 1233     if (different_transforms) {
 
 1243         if (downmix_output) {
 
 1248         if (downmix_output) {
 
 1269                             int *got_frame_ptr, 
AVPacket *avpkt)
 
 1273     int buf_size = avpkt->
size;
 
 1281     if (buf_size >= 2 && 
AV_RB16(buf) == 0x770B) {
 
 1313                        "skipping frame\n");
 
 1354         if (avctx->request_channels > 0 && avctx->request_channels <= 2 &&
 
 1355                 avctx->request_channels < s->
channels) {
 
 1391         output[ch] = s->
output[ch];
 
 1394     for (ch = 0; ch < s->
channels; ch++) {
 
 1395         if (ch < s->out_channels)
 
 1396             s->
outptr[channel_map[ch]] = (
float *)frame->
data[ch];
 
 1407             output[ch] = s->
outptr[channel_map[ch]];
 
 1409             if (!ch || channel_map[ch])
 
 1437 #define OFFSET(x) offsetof(AC3DecodeContext, x) 
 1438 #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM) 
 1440     { 
"drc_scale", 
"percentage of dynamic range compression to apply", 
OFFSET(drc_scale), 
AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 1.0, 
PAR },
 
 1442 {
"dmix_mode", 
"Preferred Stereo Downmix Mode", 
OFFSET(preferred_stereo_downmix), 
AV_OPT_TYPE_INT, {.i64 = -1 }, -1, 2, 0, 
"dmix_mode"},
 
 1443 {
"ltrt_cmixlev",   
"Lt/Rt Center Mix Level",   
OFFSET(ltrt_center_mix_level),    
AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
 
 1444 {
"ltrt_surmixlev", 
"Lt/Rt Surround Mix Level", 
OFFSET(ltrt_surround_mix_level),  
AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
 
 1445 {
"loro_cmixlev",   
"Lo/Ro Center Mix Level",   
OFFSET(loro_center_mix_level),    
AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
 
 1446 {
"loro_surmixlev", 
"Lo/Ro Surround Mix Level", 
OFFSET(loro_surround_mix_level),  
AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
 
 1473 #if CONFIG_EAC3_DECODER 
 1474 static const AVClass eac3_decoder_class = {
 
 1493     .priv_class     = &eac3_decoder_class,