122 enum OCStatus oc_type,
int get_new_frame);
124 #define overread_err "Input buffer exhausted before END element found\n"
129 for (i = 0; i < tags; i++) {
130 int syn_ele =
layout[i][0];
132 sum += (1 + (syn_ele ==
TYPE_CPE)) *
152 int type,
int id,
int *channels)
157 if (!ac->
che[type][
id]) {
174 if (ac->
che[type][
id])
187 for (type = 0; type < 4; type++) {
207 for (ch = 0; ch < avctx->
channels; ch++) {
224 uint64_t right,
int pos)
226 if (layout_map[offset][0] ==
TYPE_CPE) {
228 .av_position = left | right,
230 .elem_id = layout_map[
offset][1],
238 .elem_id = layout_map[
offset][1],
242 .av_position = right,
244 .elem_id = layout_map[offset + 1][1],
254 int num_pos_channels = 0;
258 for (i = *current; i < tags; i++) {
259 if (layout_map[i][2] != pos)
269 num_pos_channels += 2;
280 return num_pos_channels;
285 int i,
n, total_non_cc_elements;
287 int num_front_channels, num_side_channels, num_back_channels;
296 if (num_front_channels < 0)
300 if (num_side_channels < 0)
304 if (num_back_channels < 0)
308 if (num_front_channels & 1) {
312 .elem_id = layout_map[i][1],
316 num_front_channels--;
318 if (num_front_channels >= 4) {
323 num_front_channels -= 2;
325 if (num_front_channels >= 2) {
330 num_front_channels -= 2;
332 while (num_front_channels >= 2) {
337 num_front_channels -= 2;
340 if (num_side_channels >= 2) {
345 num_side_channels -= 2;
347 while (num_side_channels >= 2) {
352 num_side_channels -= 2;
355 while (num_back_channels >= 4) {
360 num_back_channels -= 2;
362 if (num_back_channels >= 2) {
367 num_back_channels -= 2;
369 if (num_back_channels) {
373 .elem_id = layout_map[i][1],
384 .elem_id = layout_map[i][1],
393 .elem_id = layout_map[i][1],
400 total_non_cc_elements = n = i;
403 for (i = 1; i <
n; i++)
404 if (e2c_vec[i - 1].av_position > e2c_vec[i].av_position) {
412 for (i = 0; i < total_non_cc_elements; i++) {
413 layout_map[i][0] = e2c_vec[i].
syn_ele;
414 layout_map[i][1] = e2c_vec[i].
elem_id;
416 if (e2c_vec[i].av_position != UINT64_MAX) {
429 ac->
oc[0] = ac->
oc[1];
440 ac->
oc[1] = ac->
oc[0];
455 uint8_t layout_map[MAX_ELEM_ID * 4][3],
int tags,
456 enum OCStatus oc_type,
int get_new_frame)
459 int i, channels = 0,
ret;
463 memcpy(ac->
oc[1].
layout_map, layout_map, tags *
sizeof(layout_map[0]));
471 for (i = 0; i < tags; i++) {
472 int type = layout_map[i][0];
473 int id = layout_map[i][1];
474 int position = layout_map[i][2];
481 if (ac->
oc[1].
m4ac.
ps == 1 && channels == 2) {
508 for (type = 3; type >= 0; type--) {
512 for (j = 0; j <= 1; j++) {
531 if (channel_config < 1 || channel_config > 7) {
533 "invalid default channel configuration (%d)\n",
539 *tags *
sizeof(*layout_map));
554 " instead of a spec-compliant 7.1(wide) layout, use -strict %d to decode"
572 uint8_t layout_map[MAX_ELEM_ID*4][3];
579 &layout_map_tags, 2) < 0)
591 uint8_t layout_map[MAX_ELEM_ID * 4][3];
598 &layout_map_tags, 1) < 0)
686 layout_map[0][0] = syn_ele;
688 layout_map[0][2] =
type;
702 int num_front, num_side, num_back, num_lfe, num_assoc_data, num_cc;
712 "Sample rate index in program config element does not "
713 "match the sample rate index configured by the container.\n");
730 if (
get_bits_left(gb) < 4 * (num_front + num_side + num_back + num_lfe + num_assoc_data + num_cc)) {
773 int extension_flag,
ret, ep_config, res_flags;
774 uint8_t layout_map[MAX_ELEM_ID*4][3];
790 if (channel_config == 0) {
792 tags =
decode_pce(avctx, m4ac, layout_map, gb);
797 &tags, channel_config)))
803 }
else if (m4ac->
sbr == 1 && m4ac->
ps == -1)
809 if (extension_flag) {
822 "AAC data resilience (flags %x)",
838 "epConfig %d", ep_config);
850 int ret, ep_config, res_flags;
851 uint8_t layout_map[MAX_ELEM_ID*4][3];
853 const int ELDEXT_TERM = 0;
866 "AAC data resilience (flags %x)",
877 while (
get_bits(gb, 4) != ELDEXT_TERM) {
891 &tags, channel_config)))
900 "epConfig %d", ep_config);
927 av_dlog(avctx,
"audio specific config size %d\n", bit_size >> 3);
928 for (i = 0; i < bit_size >> 3; i++)
929 av_dlog(avctx,
"%02x ", data[i]);
936 sync_extension)) < 0)
940 "invalid sampling rate index %d\n",
947 "invalid low delay sampling rate index %d\n",
971 "Audio object type %s%d",
972 m4ac->
sbr == 1 ?
"SBR+" :
"",
978 "AOT %d chan config %d sampling index %d (%d) SBR %d PS %d\n",
995 union {
unsigned u;
int s; }
v = { previous_val * 1664525
u + 1013904223 };
1018 if (92017 <= rate)
return 0;
1019 else if (75132 <= rate)
return 1;
1020 else if (55426 <= rate)
return 2;
1021 else if (46009 <= rate)
return 3;
1022 else if (37566 <= rate)
return 4;
1023 else if (27713 <= rate)
return 5;
1024 else if (23004 <= rate)
return 6;
1025 else if (18783 <= rate)
return 7;
1026 else if (13856 <= rate)
return 8;
1027 else if (11502 <= rate)
return 9;
1028 else if (9391 <= rate)
return 10;
1039 #define AAC_INIT_VLC_STATIC(num, size) \
1040 INIT_VLC_STATIC(&vlc_spectral[num], 8, ff_aac_spectral_sizes[num], \
1041 ff_aac_spectral_bits[num], sizeof(ff_aac_spectral_bits[num][0]), \
1042 sizeof(ff_aac_spectral_bits[num][0]), \
1043 ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), \
1044 sizeof(ff_aac_spectral_codes[num][0]), \
1069 uint8_t layout_map[MAX_ELEM_ID*4][3];
1070 int layout_map_tags;
1178 "Invalid Predictor Reset Group.\n");
1219 "AAC LD is only defined for ONLY_LONG_SEQUENCE but "
1232 for (i = 0; i < 7; i++) {
1271 "Prediction is not allowed in AAC-LC.\n");
1276 "LTP in ER AAC LD not yet implemented.\n");
1287 "Number of scalefactor bands in group (%d) "
1288 "exceeds limit (%d).\n",
1315 while (k < ics->max_sfb) {
1318 int sect_band_type =
get_bits(gb, 4);
1319 if (sect_band_type == 12) {
1324 sect_len_incr =
get_bits(gb, bits);
1325 sect_end += sect_len_incr;
1330 if (sect_end > ics->
max_sfb) {
1332 "Number of bands (%d) exceeds limit (%d).\n",
1336 }
while (sect_len_incr == (1 << bits) - 1);
1337 for (; k < sect_end; k++) {
1338 band_type [idx] = sect_band_type;
1339 band_type_run_end[idx++] = sect_end;
1357 unsigned int global_gain,
1360 int band_type_run_end[120])
1363 int offset[3] = { global_gain, global_gain - 90, 0 };
1367 for (i = 0; i < ics->
max_sfb;) {
1368 int run_end = band_type_run_end[idx];
1369 if (band_type[idx] ==
ZERO_BT) {
1370 for (; i < run_end; i++, idx++)
1374 for (; i < run_end; i++, idx++) {
1375 offset[2] +=
get_vlc2(gb, vlc_scalefactors.
table, 7, 3) - 60;
1376 clipped_offset = av_clip(offset[2], -155, 100);
1377 if (offset[2] != clipped_offset) {
1379 "If you heard an audible artifact, there may be a bug in the decoder. "
1380 "Clipped intensity stereo position (%d -> %d)",
1381 offset[2], clipped_offset);
1385 }
else if (band_type[idx] ==
NOISE_BT) {
1386 for (; i < run_end; i++, idx++) {
1387 if (noise_flag-- > 0)
1388 offset[1] +=
get_bits(gb, 9) - 256;
1390 offset[1] +=
get_vlc2(gb, vlc_scalefactors.
table, 7, 3) - 60;
1391 clipped_offset = av_clip(offset[1], -100, 155);
1392 if (offset[1] != clipped_offset) {
1394 "If you heard an audible artifact, there may be a bug in the decoder. "
1395 "Clipped noise gain (%d -> %d)",
1396 offset[1], clipped_offset);
1401 for (; i < run_end; i++, idx++) {
1402 offset[0] +=
get_vlc2(gb, vlc_scalefactors.
table, 7, 3) - 60;
1403 if (offset[0] > 255
U) {
1405 "Scalefactor (%d) out of range.\n", offset[0]);
1420 const uint16_t *swb_offset,
int num_swb)
1425 if (pulse_swb >= num_swb)
1427 pulse->
pos[0] = swb_offset[pulse_swb];
1429 if (pulse->
pos[0] >= swb_offset[num_swb])
1432 for (i = 1; i < pulse->
num_pulse; i++) {
1434 if (pulse->
pos[i] >= swb_offset[num_swb])
1449 int w,
filt, i, coef_len, coef_res, coef_compress;
1456 for (filt = 0; filt < tns->
n_filt[w]; filt++) {
1460 if ((tns->
order[w][filt] =
get_bits(gb, 5 - 2 * is8)) > tns_max_order) {
1462 "TNS filter order %d is greater than maximum %d.\n",
1463 tns->
order[w][filt], tns_max_order);
1467 if (tns->
order[w][filt]) {
1470 coef_len = coef_res + 3 - coef_compress;
1471 tmp2_idx = 2 * coef_compress + coef_res;
1473 for (i = 0; i < tns->
order[w][
filt]; i++)
1493 if (ms_present == 1) {
1498 }
else if (ms_present == 2) {
1504 static inline float *
VMUL2(
float *dst,
const float *
v,
unsigned idx,
1508 *dst++ = v[idx & 15] *
s;
1509 *dst++ = v[idx>>4 & 15] *
s;
1515 static inline float *
VMUL4(
float *dst,
const float *
v,
unsigned idx,
1519 *dst++ = v[idx & 3] *
s;
1520 *dst++ = v[idx>>2 & 3] *
s;
1521 *dst++ = v[idx>>4 & 3] *
s;
1522 *dst++ = v[idx>>6 & 3] *
s;
1528 static inline float *
VMUL2S(
float *dst,
const float *
v,
unsigned idx,
1529 unsigned sign,
const float *scale)
1533 s0.
f = s1.
f = *scale;
1534 s0.
i ^= sign >> 1 << 31;
1537 *dst++ = v[idx & 15] * s0.
f;
1538 *dst++ = v[idx>>4 & 15] * s1.
f;
1545 static inline float *
VMUL4S(
float *dst,
const float *
v,
unsigned idx,
1546 unsigned sign,
const float *scale)
1548 unsigned nz = idx >> 12;
1552 t.
i = s.
i ^ (sign & 1
U<<31);
1553 *dst++ = v[idx & 3] * t.
f;
1555 sign <<= nz & 1; nz >>= 1;
1556 t.
i = s.
i ^ (sign & 1
U<<31);
1557 *dst++ = v[idx>>2 & 3] * t.
f;
1559 sign <<= nz & 1; nz >>= 1;
1560 t.
i = s.
i ^ (sign & 1
U<<31);
1561 *dst++ = v[idx>>4 & 3] * t.
f;
1564 t.
i = s.
i ^ (sign & 1
U<<31);
1565 *dst++ = v[idx>>6 & 3] * t.
f;
1585 int pulse_present,
const Pulse *pulse,
1589 int i, k,
g, idx = 0;
1592 float *coef_base = coef;
1595 memset(coef + g * 128 + offsets[ics->
max_sfb], 0,
1596 sizeof(
float) * (c - offsets[ics->
max_sfb]));
1601 for (i = 0; i < ics->
max_sfb; i++, idx++) {
1602 const unsigned cbt_m1 = band_type[idx] - 1;
1603 float *cfo = coef + offsets[
i];
1604 int off_len = offsets[i + 1] - offsets[
i];
1608 for (group = 0; group < g_len; group++, cfo+=128) {
1609 memset(cfo, 0, off_len *
sizeof(
float));
1611 }
else if (cbt_m1 ==
NOISE_BT - 1) {
1612 for (group = 0; group < g_len; group++, cfo+=128) {
1616 for (k = 0; k < off_len; k++) {
1622 scale = sf[idx] / sqrtf(band_energy);
1631 switch (cbt_m1 >> 1) {
1633 for (group = 0; group < g_len; group++, cfo+=128) {
1643 cb_idx = cb_vector_idx[code];
1644 cf =
VMUL4(cf, vq, cb_idx, sf + idx);
1650 for (group = 0; group < g_len; group++, cfo+=128) {
1662 cb_idx = cb_vector_idx[code];
1663 nnz = cb_idx >> 8 & 15;
1666 cf =
VMUL4S(cf, vq, cb_idx, bits, sf + idx);
1672 for (group = 0; group < g_len; group++, cfo+=128) {
1682 cb_idx = cb_vector_idx[code];
1683 cf =
VMUL2(cf, vq, cb_idx, sf + idx);
1690 for (group = 0; group < g_len; group++, cfo+=128) {
1702 cb_idx = cb_vector_idx[code];
1703 nnz = cb_idx >> 8 & 15;
1704 sign = nnz ?
SHOW_UBITS(
re, gb, nnz) << (cb_idx >> 12) : 0;
1706 cf =
VMUL2S(cf, vq, cb_idx, sign, sf + idx);
1712 for (group = 0; group < g_len; group++, cfo+=128) {
1714 uint32_t *icf = (uint32_t *) cf;
1733 cb_idx = cb_vector_idx[code];
1739 for (j = 0; j < 2; j++) {
1761 unsigned v = ((
const uint32_t*)vq)[cb_idx & 15];
1762 *icf++ = (bits & 1
U<<31) | v;
1779 if (pulse_present) {
1781 for (i = 0; i < pulse->
num_pulse; i++) {
1782 float co = coef_base[ pulse->
pos[
i] ];
1783 while (offsets[idx + 1] <= pulse->
pos[i])
1785 if (band_type[idx] !=
NOISE_BT && sf[idx]) {
1786 float ico = -pulse->
amp[
i];
1789 ico = co / sqrtf(sqrtf(fabsf(co))) + (co > 0 ? -ico : ico);
1791 coef_base[ pulse->
pos[
i] ] =
cbrtf(fabsf(ico)) * ico * sf[idx];
1802 tmp.
i = (tmp.
i + 0x00008000
U) & 0xFFFF0000U;
1810 tmp.
i = (tmp.
i + 0x00007FFF
U + (tmp.
i & 0x00010000
U >> 16)) & 0xFFFF0000
U;
1818 pun.
i &= 0xFFFF0000
U;
1825 const float a = 0.953125;
1826 const float alpha = 0.90625;
1830 float r0 = ps->
r0, r1 = ps->
r1;
1831 float cor0 = ps->
cor0, cor1 = ps->
cor1;
1832 float var0 = ps->
var0, var1 = ps->
var1;
1834 k1 = var0 > 1 ? cor0 *
flt16_even(a / var0) : 0;
1835 k2 = var1 > 1 ? cor1 *
flt16_even(a / var1) : 0;
1870 k < sce->ics.swb_offset[sfb + 1];
1899 int global_gain, eld_syntax, er_syntax, pulse_present = 0;
1915 if (!common_window && !scale_flag) {
1929 if (!eld_syntax && (pulse_present =
get_bits1(gb))) {
1932 "Pulse tool not allowed in eight short sequence.\n");
1937 "Pulse data corrupt or invalid.\n");
1942 if (tns->
present && !er_syntax)
1951 if (tns->
present && er_syntax)
1974 int g,
i, group, idx = 0;
1977 for (i = 0; i < ics->
max_sfb; i++, idx++) {
1981 for (group = 0; group < ics->
group_len[
g]; group++) {
1983 ch1 + group * 128 + offsets[i],
1984 offsets[i+1] - offsets[i]);
2007 int g, group,
i, idx = 0;
2011 for (i = 0; i < ics->
max_sfb;) {
2015 for (; i < bt_run_end; i++, idx++) {
2016 c = -1 + 2 * (sce1->
band_type[idx] - 14);
2018 c *= 1 - 2 * cpe->
ms_mask[idx];
2019 scale = c * sce1->
sf[idx];
2020 for (group = 0; group < ics->
group_len[
g]; group++)
2022 coef0 + group * 128 + offsets[i],
2024 offsets[i + 1] - offsets[i]);
2028 idx += bt_run_end -
i;
2044 int i,
ret, common_window, ms_present = 0;
2047 common_window = eld_syntax ||
get_bits1(gb);
2048 if (common_window) {
2059 if (ms_present == 3) {
2062 }
else if (ms_present)
2065 if ((ret =
decode_ics(ac, &cpe->
ch[0], gb, common_window, 0)))
2067 if ((ret =
decode_ics(ac, &cpe->
ch[1], gb, common_window, 0)))
2070 if (common_window) {
2084 1.09050773266525765921,
2085 1.18920711500272106672,
2120 scale = cce_scale[
get_bits(gb, 2)];
2125 for (c = 0; c < num_gain; c++) {
2129 float gain_cache = 1.0;
2132 gain = cge ?
get_vlc2(gb, vlc_scalefactors.
table, 7, 3) - 60: 0;
2133 gain_cache =
powf(scale, -gain);
2136 coup->
gain[
c][0] = gain_cache;
2139 for (sfb = 0; sfb < sce->
ics.
max_sfb; sfb++, idx++) {
2150 gain_cache =
powf(scale, -t) *
s;
2153 coup->
gain[
c][idx] = gain_cache;
2171 int num_excl_chan = 0;
2174 for (i = 0; i < 7; i++)
2178 return num_excl_chan / 7;
2190 int drc_num_bands = 1;
2211 for (i = 0; i < drc_num_bands; i++) {
2224 for (i = 0; i < drc_num_bands; i++) {
2235 int i, major, minor;
2242 for(i=0; i+1<
sizeof(
buf) && len>=8; i++, len-=8)
2249 if (sscanf(buf,
"libfaac %d.%d", &major, &minor) == 2){
2330 for (filt = 0; filt < tns->
n_filt[w]; filt++) {
2342 if ((size = end - start) <= 0)
2354 for (m = 0; m <
size; m++, start += inc)
2355 for (i = 1; i <=
FFMIN(m, order); i++)
2356 coef[start] -= coef[start - i * inc] * lpc[i - 1];
2359 for (m = 0; m <
size; m++, start += inc) {
2360 tmp[0] = coef[
start];
2361 for (i = 1; i <=
FFMIN(m, order); i++)
2362 coef[start] += tmp[i] * lpc[i - 1];
2363 for (i = order; i > 0; i--)
2364 tmp[i] = tmp[i - 1];
2386 memset(in, 0, 448 *
sizeof(
float));
2393 memset(in + 1024 + 576, 0, 448 *
sizeof(
float));
2408 float *predTime = sce->
ret;
2410 int16_t num_samples = 2048;
2412 if (ltp->
lag < 1024)
2413 num_samples = ltp->
lag + 1024;
2414 for (i = 0; i < num_samples; i++)
2416 memset(&predTime[i], 0, (2048 - i) *
sizeof(
float));
2425 for (i = offsets[sfb]; i < offsets[sfb + 1]; i++)
2426 sce->
coeffs[i] += predFreq[i];
2436 float *saved = sce->
saved;
2437 float *saved_ltp = sce->
coeffs;
2443 memcpy(saved_ltp, saved, 512 *
sizeof(
float));
2444 memset(saved_ltp + 576, 0, 448 *
sizeof(
float));
2446 for (i = 0; i < 64; i++)
2447 saved_ltp[i + 512] = ac->
buf_mdct[1023 - i] * swindow[63 - i];
2449 memcpy(saved_ltp, ac->
buf_mdct + 512, 448 *
sizeof(
float));
2450 memset(saved_ltp + 576, 0, 448 *
sizeof(
float));
2452 for (i = 0; i < 64; i++)
2453 saved_ltp[i + 512] = ac->
buf_mdct[1023 - i] * swindow[63 - i];
2456 for (i = 0; i < 512; i++)
2457 saved_ltp[i + 512] = ac->
buf_mdct[1023 - i] * lwindow[511 - i];
2473 float *saved = sce->
saved;
2483 for (i = 0; i < 1024; i += 128)
2498 memcpy( out, saved, 448 *
sizeof(
float));
2506 memcpy( out + 448 + 4*128, temp, 64 *
sizeof(
float));
2509 memcpy( out + 576, buf + 64, 448 *
sizeof(
float));
2515 memcpy( saved, temp + 64, 64 *
sizeof(
float));
2519 memcpy( saved + 448, buf + 7*128 + 64, 64 *
sizeof(
float));
2521 memcpy( saved, buf + 512, 448 *
sizeof(
float));
2522 memcpy( saved + 448, buf + 7*128 + 64, 64 *
sizeof(
float));
2524 memcpy( saved, buf + 512, 512 *
sizeof(
float));
2533 float *saved = sce->
saved;
2542 memcpy(out, saved, 192 *
sizeof(
float));
2544 memcpy( out + 320, buf + 64, 192 *
sizeof(
float));
2550 memcpy(saved, buf + 256, 256 *
sizeof(
float));
2557 float *saved = sce->
saved;
2562 const int n2 = n >> 1;
2563 const int n4 = n >> 2;
2570 for (i = 0; i < n2; i+=2) {
2572 temp = in[
i ]; in[
i ] = -in[n - 1 -
i]; in[n - 1 -
i] =
temp;
2573 temp = -in[i + 1]; in[i + 1] = in[n - 2 -
i]; in[n - 2 -
i] =
temp;
2576 for (i = 0; i <
n; i+=2) {
2586 for (i = n4; i < n2; i ++) {
2587 out[i - n4] = buf[n2 - 1 -
i] * window[i - n4] +
2588 saved[ i + n2] * window[i + n - n4] +
2589 -saved[ n + n2 - 1 -
i] * window[i + 2*n - n4] +
2590 -saved[2*n + n2 +
i] * window[i + 3*n - n4];
2592 for (i = 0; i < n2; i ++) {
2593 out[n4 +
i] = buf[
i] * window[i + n2 - n4] +
2594 -saved[ n - 1 -
i] * window[i + n2 + n - n4] +
2595 -saved[ n +
i] * window[i + n2 + 2*n - n4] +
2596 saved[2*n + n - 1 -
i] * window[i + n2 + 3*n - n4];
2598 for (i = 0; i < n4; i ++) {
2599 out[n2 + n4 +
i] = buf[ i + n2] * window[i + n - n4] +
2600 -saved[ n2 - 1 -
i] * window[i + 2*n - n4] +
2601 -saved[ n + n2 +
i] * window[i + 3*n - n4];
2605 memmove(saved + n, saved, 2 * n *
sizeof(
float));
2606 memcpy( saved, buf, n *
sizeof(
float));
2620 float *dest = target->
coeffs;
2622 int g,
i, group, k, idx = 0;
2625 "Dependent coupling is not supported together with LTP\n");
2629 for (i = 0; i < ics->
max_sfb; i++, idx++) {
2632 for (group = 0; group < ics->
group_len[
g]; group++) {
2633 for (k = offsets[i]; k < offsets[i + 1]; k++) {
2635 dest[group * 128 + k] += gain * src[group * 128 + k];
2657 float *dest = target->
ret;
2660 for (i = 0; i <
len; i++)
2661 dest[i] += gain * src[i];
2684 if (coup->
type[c] == type && coup->
id_select[c] == elem_id) {
2686 apply_coupling_method(ac, &cc->
ch[0], cce, index);
2691 apply_coupling_method(ac, &cc->
ch[1], cce, index++);
2716 for (type = 3; type >= 0; type--) {
2760 uint8_t layout_map[MAX_ELEM_ID*4][3];
2761 int layout_map_tags,
ret;
2769 "More than one AAC RDB per ADTS frame");
2792 layout_map_tags = 2;
2793 layout_map[0][0] = layout_map[1][0] =
TYPE_SCE;
2795 layout_map[0][1] = 0;
2796 layout_map[1][1] = 1;
2841 if (chan_config < 0 || chan_config >= 8) {
2849 if (!(che=
get_che(ac, elem_type, elem_id))) {
2851 "channel element %d.%d is not allocated\n",
2852 elem_type, elem_id);
2857 switch (elem_type) {
2889 int samples = 0, multiplier, audio_found = 0, pce_found = 0;
2890 int is_dmono, sce_count = 0;
2919 if (!(che=
get_che(ac, elem_type, elem_id))) {
2921 elem_type, elem_id);
2928 switch (elem_type) {
2955 uint8_t layout_map[MAX_ELEM_ID*4][3];
2965 "Not evaluating a further program_config_element as this construct is dubious at best.\n");
2994 elem_type_prev = elem_type;
3009 samples <<= multiplier;
3020 if (side && side_size>=4)
3024 *got_frame_ptr = !!samples;
3030 *got_frame_ptr = !!samples;
3033 is_dmono = ac->
dmono_mode && sce_count == 2 &&
3049 int *got_frame_ptr,
AVPacket *avpkt)
3053 int buf_size = avpkt->
size;
3058 int new_extradata_size;
3061 &new_extradata_size);
3062 int jp_dualmono_size;
3067 if (new_extradata && 0) {
3074 memcpy(avctx->
extradata, new_extradata, new_extradata_size);
3085 if (jp_dualmono && jp_dualmono_size > 0)
3090 if (INT_MAX / 8 <= buf_size)
3110 for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++)
3111 if (buf[buf_offset])
3114 return buf_size > buf_offset ? buf_consumed : buf_size;
3123 for (type = 0; type < 4; type++) {
3124 if (ac->
che[type][i])
3138 #define LOAS_SYNC_WORD 0x2b7
3164 int sync_extension = 0;
3165 int bits_consumed, esize;
3173 if (config_start_bit % 8) {
3175 "Non-byte-aligned audio-specific config");
3181 gb->
buffer + (config_start_bit / 8),
3182 asclen, sync_extension);
3184 if (bits_consumed < 0)
3198 esize = (bits_consumed+7) / 8;
3213 return bits_consumed;
3222 if (audio_mux_version)
3227 if (audio_mux_version)
3247 if (!audio_mux_version) {
3278 if (audio_mux_version) {
3301 int mux_slot_length = 0;
3304 mux_slot_length += tmp;
3305 }
while (tmp == 255);
3306 return mux_slot_length;
3322 if (!use_same_mux) {
3327 "no decoder config found\n");
3335 }
else if (mux_slot_length_bytes * 8 + 256 <
get_bits_left(gb)) {
3337 "frame length mismatch %d << %d\n",
3347 int *got_frame_ptr,
AVPacket *avpkt)
3362 if (muxlength > avpkt->
size)
3386 "ADTS header detected, probably as result of configuration "
3422 #define AACDEC_FLAGS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
3424 {
"dual_mono_mode",
"Select the channel to decode for dual mono",