67 7, 10, 12, 13, 15, 17, 19
129 s->crc_present =
h.crc_present;
130 s->npcmblocks =
h.npcmblocks;
131 s->frame_size =
h.frame_size;
132 s->audio_mode =
h.audio_mode;
135 s->drc_present =
h.drc_present;
136 s->ts_present =
h.ts_present;
137 s->aux_present =
h.aux_present;
138 s->ext_audio_type =
h.ext_audio_type;
139 s->ext_audio_present =
h.ext_audio_present;
140 s->sync_ssf =
h.sync_ssf;
141 s->lfe_present =
h.lfe_present;
142 s->predictor_history =
h.predictor_history;
143 s->filter_perfect =
h.filter_perfect;
145 s->es_format =
h.pcmr_code & 1;
146 s->sumdiff_front =
h.sumdiff_front;
147 s->sumdiff_surround =
h.sumdiff_surround;
155 int n, ch, nchannels, header_size = 0, header_pos =
get_bits_count(&
s->gb);
169 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid number of primary audio channels (%d) for audio channel arrangement (%d)\n",
s->nchannels,
s->audio_mode);
192 if (
s->xxch_crc_present
216 if (
s->xxch_core_mask &
s->xxch_spkr_mask) {
217 av_log(
s->avctx,
AV_LOG_ERROR,
"XXCH speaker layout mask (%#x) overlaps with core (%#x)\n",
s->xxch_spkr_mask,
s->xxch_core_mask);
222 s->ch_mask =
s->xxch_core_mask |
s->xxch_spkr_mask;
226 int *coeff_ptr =
s->xxch_dmix_coeff;
240 for (ch = 0; ch < nchannels; ch++) {
242 if ((
mask &
s->xxch_core_mask) !=
mask) {
246 s->xxch_dmix_mask[ch] =
mask;
250 for (ch = 0; ch < nchannels; ch++) {
251 for (n = 0; n <
s->xxch_mask_nbits; n++) {
252 if (
s->xxch_dmix_mask[ch] & (1
U << n)) {
254 int sign = (
code >> 6) - 1;
269 s->xxch_dmix_embedded = 0;
276 for (ch = xch_base; ch <
s->nchannels; ch++) {
285 for (ch = xch_base; ch <
s->nchannels; ch++)
286 s->subband_vq_start[ch] =
get_bits(&
s->gb, 5) + 1;
289 for (ch = xch_base; ch <
s->nchannels; ch++) {
292 if (n >
s->nchannels) {
296 s->joint_intensity_index[ch] = n;
300 for (ch = xch_base; ch <
s->nchannels; ch++)
301 s->transition_mode_sel[ch] =
get_bits(&
s->gb, 2);
304 for (ch = xch_base; ch <
s->nchannels; ch++) {
305 s->scale_factor_sel[ch] =
get_bits(&
s->gb, 3);
306 if (
s->scale_factor_sel[ch] == 7) {
313 for (ch = xch_base; ch <
s->nchannels; ch++) {
314 s->bit_allocation_sel[ch] =
get_bits(&
s->gb, 3);
315 if (
s->bit_allocation_sel[ch] == 7) {
323 for (ch = xch_base; ch <
s->nchannels; ch++)
328 for (ch = xch_base; ch <
s->nchannels; ch++)
352 unsigned int scale_size;
367 *scale_index =
get_bits(&
s->gb, sel + 1);
370 if ((
unsigned int)*scale_index >= scale_size) {
411 s->nsubsubframes[sf] =
get_bits(&
s->gb, 2) + 1;
418 for (ch = xch_base; ch <
s->nchannels; ch++)
419 for (band = 0; band <
s->nsubbands[ch]; band++)
423 for (ch = xch_base; ch <
s->nchannels; ch++)
424 for (band = 0; band <
s->nsubbands[ch]; band++)
425 if (
s->prediction_mode[ch][band])
426 s->prediction_vq_index[ch][band] =
get_bits(&
s->gb, 12);
429 for (ch = xch_base; ch <
s->nchannels; ch++) {
430 int sel =
s->bit_allocation_sel[ch];
432 for (band = 0; band <
s->subband_vq_start[ch]; band++) {
445 s->bit_allocation[ch][band] = abits;
450 for (ch = xch_base; ch <
s->nchannels; ch++) {
452 memset(
s->transition_mode[sf][ch], 0,
sizeof(
s->transition_mode[0][0]));
455 if (
s->nsubsubframes[sf] > 1) {
456 int sel =
s->transition_mode_sel[ch];
457 for (band = 0; band <
s->subband_vq_start[ch]; band++)
458 if (
s->bit_allocation[ch][band])
464 for (ch = xch_base; ch <
s->nchannels; ch++) {
465 int sel =
s->scale_factor_sel[ch];
469 for (band = 0; band <
s->subband_vq_start[ch]; band++) {
470 if (
s->bit_allocation[ch][band]) {
473 s->scale_factors[ch][band][0] =
ret;
474 if (
s->transition_mode[sf][ch][band]) {
477 s->scale_factors[ch][band][1] =
ret;
480 s->scale_factors[ch][band][0] = 0;
485 for (band =
s->subband_vq_start[ch]; band < s->nsubbands[ch]; band++) {
488 s->scale_factors[ch][band][0] =
ret;
493 for (ch = xch_base; ch <
s->nchannels; ch++) {
494 if (
s->joint_intensity_index[ch]) {
496 if (
s->joint_scale_sel[ch] == 7) {
504 for (ch = xch_base; ch <
s->nchannels; ch++) {
505 int src_ch =
s->joint_intensity_index[ch] - 1;
507 int sel =
s->joint_scale_sel[ch];
508 for (band =
s->nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
511 s->joint_scale_factors[ch][band] =
ret;
527 #ifndef decode_blockcodes
530 int offset = (levels - 1) / 2;
535 audio[n] = code1 - div * levels -
offset;
540 audio[n] = code2 - div * levels -
offset;
544 return code1 | code2;
586 int sel =
s->quant_index_sel[ch][abits - 1];
603 const int16_t *vq_index,
604 const int8_t *prediction_mode,
605 int sb_start,
int sb_end,
610 for (
i = sb_start;
i < sb_end;
i++) {
611 if (prediction_mode[
i]) {
612 const int pred_id = vq_index[
i];
613 int32_t *ptr = subband_samples[
i] + ofs;
614 for (j = 0; j <
len; j++) {
616 ptr[j] =
clip23(ptr[j] + x);
624 int xch_base,
int *sub_pos,
int *lfe_pos)
627 int n, ssf, ofs, ch, band;
631 if (*sub_pos + nsamples >
s->npcmblocks) {
640 for (ch = xch_base; ch <
s->nchannels; ch++) {
643 for (band =
s->subband_vq_start[ch]; band < s->nsubbands[ch]; band++)
647 if (
s->subband_vq_start[ch] <
s->nsubbands[ch]) {
648 s->dcadsp->decode_hf(
s->subband_samples[ch], vq_index,
650 s->subband_vq_start[ch],
s->nsubbands[ch],
660 int nlfesamples = 2 *
s->lfe_present *
s->nsubsubframes[sf];
680 for (n = 0, ofs = *lfe_pos; n < nlfesamples; n++, ofs++)
688 for (ssf = 0, ofs = *sub_pos; ssf <
s->nsubsubframes[sf]; ssf++) {
689 for (ch = xch_base; ch <
s->nchannels; ch++) {
694 for (band = 0; band <
s->subband_vq_start[ch]; band++) {
695 int ret, trans_ssf, abits =
s->bit_allocation[ch][band];
704 if (
s->bit_rate == 3)
710 trans_ssf =
s->transition_mode[sf][ch][band];
713 if (trans_ssf == 0 || ssf < trans_ssf)
714 scale =
s->scale_factors[ch][band][0];
716 scale =
s->scale_factors[ch][band][1];
720 int64_t adj =
s->scale_factor_adj[ch][abits - 1];
730 if ((ssf ==
s->nsubsubframes[sf] - 1 ||
s->sync_ssf) &&
get_bits(&
s->gb, 16) != 0xffff) {
739 for (ch = xch_base; ch <
s->nchannels; ch++) {
741 s->prediction_mode[ch], 0,
s->nsubbands[ch],
746 for (ch = xch_base; ch <
s->nchannels; ch++) {
747 int src_ch =
s->joint_intensity_index[ch] - 1;
749 s->dcadsp->decode_joint(
s->subband_samples[ch],
s->subband_samples[src_ch],
750 s->joint_scale_factors[ch],
s->nsubbands[ch],
751 s->nsubbands[src_ch], *sub_pos, nsamples);
778 unsigned int size =
s->subband_size;
783 (nframesamples + nlfesamples) *
sizeof(
int32_t));
784 if (!
s->subband_buffer)
787 if (
size !=
s->subband_size) {
790 s->subband_samples[ch][band] =
s->subband_buffer +
792 s->lfe_samples =
s->subband_buffer + nframesamples;
795 if (!
s->predictor_history)
803 int sf, ch,
ret, band, sub_pos, lfe_pos;
808 for (sf = 0, sub_pos = 0, lfe_pos =
DCA_LFE_HISTORY; sf <
s->nsubframes; sf++) {
815 for (ch = xch_base; ch <
s->nchannels; ch++) {
817 int nsubbands =
s->nsubbands[ch];
818 if (
s->joint_intensity_index[ch])
819 nsubbands =
FFMAX(nsubbands,
s->nsubbands[
s->joint_intensity_index[ch] - 1]);
822 for (band = 0; band < nsubbands; band++) {
862 int xxch_nchsets, xxch_frame_size;
875 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
886 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid number of bits for XXCH speaker mask (%d)\n",
s->xxch_mask_nbits);
892 if (xxch_nchsets > 1) {
898 xxch_frame_size =
get_bits(&
s->gb, 14) + 1;
912 if (
mask !=
s->xxch_core_mask) {
913 av_log(
s->avctx,
AV_LOG_ERROR,
"XXCH core speaker activity mask (%#x) disagrees with core (%#x)\n",
s->xxch_core_mask,
mask);
929 if (
ff_dca_seek_bits(&
s->gb, header_pos + header_size * 8 + xxch_frame_size * 8)) {
938 int *xbr_nsubbands,
int xbr_transition_mode,
int sf,
int *sub_pos)
944 int ssf, ch, band, ofs;
956 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++)
957 xbr_nabits[ch] =
get_bits(&
s->gb, 2) + 2;
960 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
961 for (band = 0; band < xbr_nsubbands[ch]; band++) {
962 xbr_bit_allocation[ch][band] =
get_bits(&
s->gb, xbr_nabits[ch]);
971 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
972 xbr_scale_nbits[ch] =
get_bits(&
s->gb, 3);
973 if (!xbr_scale_nbits[ch]) {
980 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
985 if (
s->scale_factor_sel[ch] > 5) {
995 for (band = 0; band < xbr_nsubbands[ch]; band++) {
996 if (xbr_bit_allocation[ch][band]) {
997 int scale_index =
get_bits(&
s->gb, xbr_scale_nbits[ch]);
998 if (scale_index >= scale_size) {
1002 xbr_scale_factors[ch][band][0] =
scale_table[scale_index];
1003 if (xbr_transition_mode &&
s->transition_mode[sf][ch][band]) {
1004 scale_index =
get_bits(&
s->gb, xbr_scale_nbits[ch]);
1005 if (scale_index >= scale_size) {
1009 xbr_scale_factors[ch][band][1] =
scale_table[scale_index];
1016 for (ssf = 0, ofs = *sub_pos; ssf <
s->nsubsubframes[sf]; ssf++) {
1017 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
1021 for (band = 0; band < xbr_nsubbands[ch]; band++) {
1022 int ret, trans_ssf, abits = xbr_bit_allocation[ch][band];
1029 }
else if (abits > 0) {
1042 if (xbr_transition_mode)
1043 trans_ssf =
s->transition_mode[sf][ch][band];
1048 if (trans_ssf == 0 || ssf < trans_ssf)
1049 scale = xbr_scale_factors[ch][band][0];
1051 scale = xbr_scale_factors[ch][band][1];
1059 if ((ssf ==
s->nsubsubframes[sf] - 1 ||
s->sync_ssf) &&
get_bits(&
s->gb, 16) != 0xffff) {
1077 int xbr_nchsets, xbr_transition_mode, xbr_band_nbits, xbr_base_ch;
1090 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
1099 for (
i = 0;
i < xbr_nchsets;
i++)
1100 xbr_frame_size[
i] =
get_bits(&
s->gb, 14) + 1;
1106 for (
i = 0, ch2 = 0;
i < xbr_nchsets;
i++) {
1108 xbr_band_nbits =
get_bits(&
s->gb, 2) + 5;
1109 for (ch1 = 0; ch1 < xbr_nchannels[
i]; ch1++, ch2++) {
1110 xbr_nsubbands[ch2] =
get_bits(&
s->gb, xbr_band_nbits) + 1;
1112 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid number of active XBR subbands (%d)\n", xbr_nsubbands[ch2]);
1127 for (
i = 0, xbr_base_ch = 0;
i < xbr_nchsets;
i++) {
1130 if (xbr_base_ch + xbr_nchannels[
i] <=
s->nchannels) {
1133 for (sf = 0, sub_pos = 0; sf <
s->nsubframes; sf++) {
1135 xbr_base_ch + xbr_nchannels[
i],
1136 xbr_nsubbands, xbr_transition_mode,
1142 xbr_base_ch += xbr_nchannels[
i];
1157 s->x96_rand = 1103515245
U *
s->x96_rand + 12345
U;
1158 return (
s->x96_rand & 0x7fffffff) - 0x40000000;
1163 int n, ssf, ch, band, ofs;
1167 if (*sub_pos + nsamples >
s->npcmblocks) {
1176 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1177 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1182 switch (
s->bit_allocation[ch][band]) {
1186 else for (n = 0; n < nsamples; n++)
1192 for (ssf = 0; ssf < (
s->nsubsubframes[sf] + 1) / 2; ssf++) {
1197 for (n = 0; n <
FFMIN(nsamples - ssf * 16, 16); n++)
1206 for (ssf = 0, ofs = *sub_pos; ssf <
s->nsubsubframes[sf]; ssf++) {
1207 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1211 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1212 int ret, abits =
s->bit_allocation[ch][band] - 1;
1225 if (
s->bit_rate == 3)
1231 scale =
s->scale_factors[ch][band >> 1][band & 1];
1239 if ((ssf ==
s->nsubsubframes[sf] - 1 ||
s->sync_ssf) &&
get_bits(&
s->gb, 16) != 0xffff) {
1248 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1250 s->prediction_mode[ch],
s->x96_subband_start,
s->nsubbands[ch],
1251 *sub_pos, nsamples);
1255 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1256 int src_ch =
s->joint_intensity_index[ch] - 1;
1258 s->dcadsp->decode_joint(
s->x96_subband_samples[ch],
s->x96_subband_samples[src_ch],
1259 s->joint_scale_factors[ch],
s->nsubbands[ch],
1260 s->nsubbands[src_ch], *sub_pos, nsamples);
1286 unsigned int size =
s->x96_subband_size;
1291 nframesamples *
sizeof(
int32_t));
1292 if (!
s->x96_subband_buffer)
1295 if (
size !=
s->x96_subband_size) {
1298 s->x96_subband_samples[ch][band] =
s->x96_subband_buffer +
1302 if (!
s->predictor_history)
1316 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1317 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++)
1321 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1322 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++)
1323 if (
s->prediction_mode[ch][band])
1324 s->prediction_vq_index[ch][band] =
get_bits(&
s->gb, 12);
1327 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1328 int sel =
s->bit_allocation_sel[ch];
1331 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1336 abits =
get_bits(&
s->gb, 3 +
s->x96_high_res);
1338 if (abits < 0 || abits > 7 + 8 *
s->x96_high_res) {
1343 s->bit_allocation[ch][band] = abits;
1348 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1349 int sel =
s->scale_factor_sel[ch];
1350 int scale_index = 0;
1354 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1357 s->scale_factors[ch][band >> 1][band & 1] =
ret;
1362 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1363 if (
s->joint_intensity_index[ch]) {
1364 s->joint_scale_sel[ch] =
get_bits(&
s->gb, 3);
1365 if (
s->joint_scale_sel[ch] == 7) {
1373 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1374 int src_ch =
s->joint_intensity_index[ch] - 1;
1376 int sel =
s->joint_scale_sel[ch];
1377 for (band =
s->nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
1380 s->joint_scale_factors[ch][band] =
ret;
1404 if (
s->x96_crc_present
1415 if (
s->x96_rev_no < 8) {
1417 if (
s->x96_subband_start > 27) {
1418 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid X96 subband start index (%d)\n",
s->x96_subband_start);
1426 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1435 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1436 if ((n =
get_bits(&
s->gb, 3)) && xch_base)
1438 if (n >
s->x96_nchannels) {
1442 s->joint_intensity_index[ch] = n;
1446 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1447 s->scale_factor_sel[ch] =
get_bits(&
s->gb, 3);
1448 if (
s->scale_factor_sel[ch] >= 6) {
1455 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1456 s->bit_allocation_sel[ch] =
get_bits(&
s->gb, 3);
1459 for (n = 0; n < 6 + 4 *
s->x96_high_res; n++)
1460 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1481 int sf, ch,
ret, band, sub_pos;
1486 for (sf = 0, sub_pos = 0; sf <
s->nsubframes; sf++) {
1493 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1495 int nsubbands =
s->nsubbands[ch];
1496 if (
s->joint_intensity_index[ch])
1497 nsubbands =
FFMAX(nsubbands,
s->nsubbands[
s->joint_intensity_index[ch] - 1]);
1502 if (band >=
s->x96_subband_start && band < nsubbands)
1520 if (
s->x96_rev_no < 1 ||
s->x96_rev_no > 8) {
1525 s->x96_crc_present = 0;
1526 s->x96_nchannels =
s->nchannels;
1547 int x96_nchsets, x96_base_ch;
1560 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
1567 if (
s->x96_rev_no < 1 ||
s->x96_rev_no > 8) {
1579 for (
i = 0;
i < x96_nchsets;
i++)
1580 x96_frame_size[
i] =
get_bits(&
s->gb, 12) + 1;
1583 for (
i = 0;
i < x96_nchsets;
i++)
1598 s->x96_nchannels = 0;
1599 for (
i = 0, x96_base_ch = 0;
i < x96_nchsets;
i++) {
1602 if (x96_base_ch + x96_nchannels[
i] <=
s->nchannels) {
1603 s->x96_nchannels = x96_base_ch + x96_nchannels[
i];
1608 x96_base_ch += x96_nchannels[
i];
1660 for (
i = 0;
i < m * n;
i++) {
1662 int sign = (
code >> 8) - 1;
1702 s->prim_dmix_embedded = 0;
1705 if (
s->ext_audio_present && !dca->
core_only) {
1706 int sync_pos =
FFMIN(
s->frame_size / 4,
s->gb.size_in_bits / 32) - 1;
1709 uint32_t w1, w2 = 0;
1714 switch (
s->ext_audio_type) {
1724 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1725 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1727 size = (w2 >> 22) + 1;
1728 dist =
s->frame_size - sync_pos * 4;
1730 && (
size == dist ||
size - 1 == dist)
1731 && (w2 >> 15 & 0x7f) == 0x08) {
1732 s->xch_pos = sync_pos * 32 + 49;
1749 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1750 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1752 size = (w2 >> 20) + 1;
1753 dist =
s->frame_size - sync_pos * 4;
1755 s->x96_pos = sync_pos * 32 + 44;
1774 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1775 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1777 size = (w2 >> 26) + 1;
1778 dist =
s->gb.size_in_bits / 8 - sync_pos * 4;
1781 (sync_pos + 1) * 4,
size - 4)) {
1782 s->xxch_pos = sync_pos * 32;
1804 s->ext_audio_mask = 0;
1805 s->xch_pos =
s->xxch_pos =
s->x96_pos = 0;
1821 if (
s->frame_size >
size)
1822 s->frame_size =
size;
1838 int ret = 0, ext = 0;
1847 }
else if (
s->xxch_pos) {
1852 }
else if (
s->xch_pos) {
1868 s->ext_audio_mask |= ext;
1895 }
else if (
s->x96_pos) {
1919 if (
s->xxch_core_mask & (1
U << spkr))
1937 if (
s->xxch_spkr_mask & (1
U << spkr))
1948 memset(
s->dcadsp_data, 0,
sizeof(
s->dcadsp_data));
1949 s->output_history_lfe_fixed = 0;
1950 s->output_history_lfe_float = 0;
1955 if (
s->filter_mode !=
mode) {
1957 s->filter_mode =
mode;
1963 int n, ch, spkr, nsamples, x96_nchannels = 0;
1972 x96_nchannels =
s->x96_nchannels;
1978 s->output_rate =
s->sample_rate << x96_synth;
1984 if (!
s->output_buffer)
1989 if (
s->ch_mask & (1
U << spkr)) {
1990 s->output_samples[spkr] = ptr;
1993 s->output_samples[spkr] =
NULL;
2003 else if (
s->filter_perfect)
2009 for (ch = 0; ch <
s->nchannels; ch++) {
2016 s->dcadsp->sub_qmf_fixed[x96_synth](
2019 s->output_samples[spkr],
2020 s->subband_samples[ch],
2021 ch < x96_nchannels ?
s->x96_subband_samples[ch] :
NULL,
2022 s->dcadsp_data[ch].u.fix.hist1,
2023 &
s->dcadsp_data[ch].offset,
2024 s->dcadsp_data[ch].u.fix.hist2,
2030 if (
s->lfe_present) {
2032 int nlfesamples =
s->npcmblocks >> 1;
2052 samples, &
s->output_history_lfe_fixed,
2059 s->lfe_samples[n] =
s->lfe_samples[nlfesamples + n];
2069 int i, n, ch,
ret, spkr, nsamples;
2079 frame->nb_samples = nsamples =
s->npcmsamples;
2095 &&
s->xxch_dmix_embedded) {
2096 int scale_inv =
s->xxch_dmix_scale_inv;
2097 int *coeff_ptr =
s->xxch_dmix_coeff;
2102 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2103 if (
s->xxch_core_mask & (1
U << spkr)) {
2104 s->dcadsp->dmix_scale_inv(
s->output_samples[spkr],
2105 scale_inv, nsamples);
2110 for (ch = xch_base; ch <
s->nchannels; ch++) {
2114 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2115 if (
s->xxch_dmix_mask[ch - xch_base] & (1
U << spkr)) {
2118 s->dcadsp->dmix_sub(
s->output_samples[spkr ],
2119 s->output_samples[src_spkr],
2145 if (
s->request_mask !=
s->ch_mask) {
2149 nsamples,
s->ch_mask);
2155 for (n = 0; n < nsamples; n++)
2165 int x96_nchannels = 0, x96_synth = 0;
2166 int i, n, ch,
ret, spkr, nsamples, nchannels;
2168 const float *filter_coeff;
2171 x96_nchannels =
s->x96_nchannels;
2185 output_samples[
s->ch_remap[
i]] = (
float *)
frame->extended_data[
i];
2189 if (nchannels > 0) {
2191 nsamples * nchannels *
sizeof(
float));
2192 if (!
s->output_buffer)
2195 ptr = (
float *)
s->output_buffer;
2197 if (!(
s->ch_mask & (1
U << spkr)))
2199 if (output_samples[spkr])
2201 output_samples[spkr] = ptr;
2212 else if (
s->filter_perfect)
2218 for (ch = 0; ch <
s->nchannels; ch++) {
2225 s->dcadsp->sub_qmf_float[x96_synth](
2227 &
s->imdct[x96_synth],
2228 output_samples[spkr],
2229 s->subband_samples[ch],
2230 ch < x96_nchannels ?
s->x96_subband_samples[ch] :
NULL,
2231 s->dcadsp_data[ch].u.flt.hist1,
2232 &
s->dcadsp_data[ch].offset,
2233 s->dcadsp_data[ch].u.flt.hist2,
2236 1.0f / (1 << (17 - x96_synth)));
2240 if (
s->lfe_present) {
2243 int nlfesamples =
s->npcmblocks >> (dec_select + 1);
2256 s->dcadsp->lfe_fir_float[dec_select](
2258 filter_coeff,
s->npcmblocks);
2264 samples, &
s->output_history_lfe_float,
2270 s->lfe_samples[n] =
s->lfe_samples[nlfesamples + n];
2286 &&
s->xxch_dmix_embedded) {
2287 float scale_inv =
s->xxch_dmix_scale_inv * (1.0f / (1 << 16));
2288 int *coeff_ptr =
s->xxch_dmix_coeff;
2293 for (ch = xch_base; ch <
s->nchannels; ch++) {
2297 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2298 if (
s->xxch_dmix_mask[ch - xch_base] & (1
U << spkr)) {
2299 int coeff = *coeff_ptr++;
2301 s->float_dsp->vector_fmac_scalar(output_samples[ spkr],
2302 output_samples[src_spkr],
2303 coeff * (-1.0
f / (1 << 15)),
2311 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2312 if (
s->xxch_core_mask & (1
U << spkr)) {
2313 s->float_dsp->vector_fmul_scalar(output_samples[spkr],
2314 output_samples[spkr],
2315 scale_inv, nsamples);
2338 if (
s->request_mask !=
s->ch_mask) {
2341 nsamples,
s->ch_mask);
2362 s->request_mask =
s->ch_mask;
2403 if (
s->subband_buffer) {
2408 if (
s->x96_subband_buffer)
2441 s->subband_size = 0;
2444 s->x96_subband_size = 0;