68 7, 10, 12, 13, 15, 17, 19
130 s->crc_present =
h.crc_present;
131 s->npcmblocks =
h.npcmblocks;
132 s->frame_size =
h.frame_size;
133 s->audio_mode =
h.audio_mode;
136 s->drc_present =
h.drc_present;
137 s->ts_present =
h.ts_present;
138 s->aux_present =
h.aux_present;
139 s->ext_audio_type =
h.ext_audio_type;
140 s->ext_audio_present =
h.ext_audio_present;
141 s->sync_ssf =
h.sync_ssf;
142 s->lfe_present =
h.lfe_present;
143 s->predictor_history =
h.predictor_history;
144 s->filter_perfect =
h.filter_perfect;
146 s->es_format =
h.pcmr_code & 1;
147 s->sumdiff_front =
h.sumdiff_front;
148 s->sumdiff_surround =
h.sumdiff_surround;
156 int n, ch, nchannels, header_size = 0, header_pos =
get_bits_count(&
s->gb);
170 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);
193 if (
s->xxch_crc_present
217 if (
s->xxch_core_mask &
s->xxch_spkr_mask) {
218 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);
223 s->ch_mask =
s->xxch_core_mask |
s->xxch_spkr_mask;
227 int *coeff_ptr =
s->xxch_dmix_coeff;
241 for (ch = 0; ch < nchannels; ch++) {
243 if ((
mask &
s->xxch_core_mask) !=
mask) {
247 s->xxch_dmix_mask[ch] =
mask;
251 for (ch = 0; ch < nchannels; ch++) {
252 for (n = 0; n <
s->xxch_mask_nbits; n++) {
253 if (
s->xxch_dmix_mask[ch] & (1
U << n)) {
255 int sign = (
code >> 6) - 1;
270 s->xxch_dmix_embedded = 0;
277 for (ch = xch_base; ch <
s->nchannels; ch++) {
286 for (ch = xch_base; ch <
s->nchannels; ch++)
287 s->subband_vq_start[ch] =
get_bits(&
s->gb, 5) + 1;
290 for (ch = xch_base; ch <
s->nchannels; ch++) {
293 if (n >
s->nchannels) {
297 s->joint_intensity_index[ch] = n;
301 for (ch = xch_base; ch <
s->nchannels; ch++)
302 s->transition_mode_sel[ch] =
get_bits(&
s->gb, 2);
305 for (ch = xch_base; ch <
s->nchannels; ch++) {
306 s->scale_factor_sel[ch] =
get_bits(&
s->gb, 3);
307 if (
s->scale_factor_sel[ch] == 7) {
314 for (ch = xch_base; ch <
s->nchannels; ch++) {
315 s->bit_allocation_sel[ch] =
get_bits(&
s->gb, 3);
316 if (
s->bit_allocation_sel[ch] == 7) {
324 for (ch = xch_base; ch <
s->nchannels; ch++)
329 for (ch = xch_base; ch <
s->nchannels; ch++)
353 unsigned int scale_size;
369 *scale_index =
get_bits(&
s->gb, sel + 1);
372 if ((
unsigned int)*scale_index >= scale_size) {
414 s->nsubsubframes[sf] =
get_bits(&
s->gb, 2) + 1;
421 for (ch = xch_base; ch <
s->nchannels; ch++)
422 for (band = 0; band <
s->nsubbands[ch]; band++)
426 for (ch = xch_base; ch <
s->nchannels; ch++)
427 for (band = 0; band <
s->nsubbands[ch]; band++)
428 if (
s->prediction_mode[ch][band])
429 s->prediction_vq_index[ch][band] =
get_bits(&
s->gb, 12);
432 for (ch = xch_base; ch <
s->nchannels; ch++) {
433 int sel =
s->bit_allocation_sel[ch];
435 for (band = 0; band <
s->subband_vq_start[ch]; band++) {
448 s->bit_allocation[ch][band] = abits;
453 for (ch = xch_base; ch <
s->nchannels; ch++) {
455 memset(
s->transition_mode[sf][ch], 0,
sizeof(
s->transition_mode[0][0]));
458 if (
s->nsubsubframes[sf] > 1) {
459 int sel =
s->transition_mode_sel[ch];
460 for (band = 0; band <
s->subband_vq_start[ch]; band++)
461 if (
s->bit_allocation[ch][band])
468 for (ch = xch_base; ch <
s->nchannels; ch++) {
469 int sel =
s->scale_factor_sel[ch];
473 for (band = 0; band <
s->subband_vq_start[ch]; band++) {
474 if (
s->bit_allocation[ch][band]) {
477 s->scale_factors[ch][band][0] =
ret;
478 if (
s->transition_mode[sf][ch][band]) {
481 s->scale_factors[ch][band][1] =
ret;
484 s->scale_factors[ch][band][0] = 0;
489 for (band =
s->subband_vq_start[ch]; band < s->nsubbands[ch]; band++) {
492 s->scale_factors[ch][band][0] =
ret;
497 for (ch = xch_base; ch <
s->nchannels; ch++) {
498 if (
s->joint_intensity_index[ch]) {
500 if (
s->joint_scale_sel[ch] == 7) {
508 for (ch = xch_base; ch <
s->nchannels; ch++) {
509 int src_ch =
s->joint_intensity_index[ch] - 1;
511 int sel =
s->joint_scale_sel[ch];
512 for (band =
s->nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
515 s->joint_scale_factors[ch][band] =
ret;
531 #ifndef decode_blockcodes
534 int offset = (levels - 1) / 2;
539 audio[n] = code1 - div * levels -
offset;
544 audio[n] = code2 - div * levels -
offset;
548 return code1 | code2;
590 int sel =
s->quant_index_sel[ch][abits - 1];
607 const int16_t *vq_index,
608 const int8_t *prediction_mode,
609 int sb_start,
int sb_end,
614 for (
i = sb_start;
i < sb_end;
i++) {
615 if (prediction_mode[
i]) {
616 const int pred_id = vq_index[
i];
617 int32_t *ptr = subband_samples[
i] + ofs;
618 for (j = 0; j <
len; j++) {
620 ptr[j] =
clip23(ptr[j] + x);
628 int xch_base,
int *sub_pos,
int *lfe_pos)
631 int n, ssf, ofs, ch, band;
635 if (*sub_pos + nsamples >
s->npcmblocks) {
644 for (ch = xch_base; ch <
s->nchannels; ch++) {
647 for (band =
s->subband_vq_start[ch]; band < s->nsubbands[ch]; band++)
651 if (
s->subband_vq_start[ch] <
s->nsubbands[ch]) {
652 s->dcadsp->decode_hf(
s->subband_samples[ch], vq_index,
654 s->subband_vq_start[ch],
s->nsubbands[ch],
664 int nlfesamples = 2 *
s->lfe_present *
s->nsubsubframes[sf];
684 for (n = 0, ofs = *lfe_pos; n < nlfesamples; n++, ofs++)
692 for (ssf = 0, ofs = *sub_pos; ssf <
s->nsubsubframes[sf]; ssf++) {
693 for (ch = xch_base; ch <
s->nchannels; ch++) {
698 for (band = 0; band <
s->subband_vq_start[ch]; band++) {
699 int ret, trans_ssf, abits =
s->bit_allocation[ch][band];
708 if (
s->bit_rate == 3)
714 trans_ssf =
s->transition_mode[sf][ch][band];
717 if (trans_ssf == 0 || ssf < trans_ssf)
718 scale =
s->scale_factors[ch][band][0];
720 scale =
s->scale_factors[ch][band][1];
724 int64_t adj =
s->scale_factor_adj[ch][abits - 1];
734 if ((ssf ==
s->nsubsubframes[sf] - 1 ||
s->sync_ssf) &&
get_bits(&
s->gb, 16) != 0xffff) {
743 for (ch = xch_base; ch <
s->nchannels; ch++) {
745 s->prediction_mode[ch], 0,
s->nsubbands[ch],
750 for (ch = xch_base; ch <
s->nchannels; ch++) {
751 int src_ch =
s->joint_intensity_index[ch] - 1;
753 s->dcadsp->decode_joint(
s->subband_samples[ch],
s->subband_samples[src_ch],
754 s->joint_scale_factors[ch],
s->nsubbands[ch],
755 s->nsubbands[src_ch], *sub_pos, nsamples);
780 unsigned int size =
s->subband_size;
785 (nframesamples + nlfesamples) *
sizeof(
int32_t));
786 if (!
s->subband_buffer)
789 if (
size !=
s->subband_size) {
792 s->subband_samples[ch][band] =
s->subband_buffer +
794 s->lfe_samples =
s->subband_buffer + nframesamples;
797 if (!
s->predictor_history)
805 int sf, ch,
ret, band, sub_pos, lfe_pos;
810 for (sf = 0, sub_pos = 0, lfe_pos =
DCA_LFE_HISTORY; sf <
s->nsubframes; sf++) {
817 for (ch = xch_base; ch <
s->nchannels; ch++) {
819 int nsubbands =
s->nsubbands[ch];
820 if (
s->joint_intensity_index[ch])
821 nsubbands =
FFMAX(nsubbands,
s->nsubbands[
s->joint_intensity_index[ch] - 1]);
824 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);
1284 unsigned int size =
s->x96_subband_size;
1289 nframesamples *
sizeof(
int32_t));
1290 if (!
s->x96_subband_buffer)
1293 if (
size !=
s->x96_subband_size) {
1296 s->x96_subband_samples[ch][band] =
s->x96_subband_buffer +
1300 if (!
s->predictor_history)
1314 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1315 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++)
1319 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1320 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++)
1321 if (
s->prediction_mode[ch][band])
1322 s->prediction_vq_index[ch][band] =
get_bits(&
s->gb, 12);
1325 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1326 int sel =
s->bit_allocation_sel[ch];
1329 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1334 abits =
get_bits(&
s->gb, 3 +
s->x96_high_res);
1336 if (abits < 0 || abits > 7 + 8 *
s->x96_high_res) {
1341 s->bit_allocation[ch][band] = abits;
1346 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1347 int sel =
s->scale_factor_sel[ch];
1348 int scale_index = 0;
1352 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1355 s->scale_factors[ch][band >> 1][band & 1] =
ret;
1360 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1361 if (
s->joint_intensity_index[ch]) {
1362 s->joint_scale_sel[ch] =
get_bits(&
s->gb, 3);
1363 if (
s->joint_scale_sel[ch] == 7) {
1371 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1372 int src_ch =
s->joint_intensity_index[ch] - 1;
1374 int sel =
s->joint_scale_sel[ch];
1375 for (band =
s->nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
1378 s->joint_scale_factors[ch][band] =
ret;
1402 if (
s->x96_crc_present
1413 if (
s->x96_rev_no < 8) {
1415 if (
s->x96_subband_start > 27) {
1416 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid X96 subband start index (%d)\n",
s->x96_subband_start);
1424 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1433 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1434 if ((n =
get_bits(&
s->gb, 3)) && xch_base)
1436 if (n >
s->x96_nchannels) {
1440 s->joint_intensity_index[ch] = n;
1444 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1445 s->scale_factor_sel[ch] =
get_bits(&
s->gb, 3);
1446 if (
s->scale_factor_sel[ch] >= 6) {
1453 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1454 s->bit_allocation_sel[ch] =
get_bits(&
s->gb, 3);
1457 for (n = 0; n < 6 + 4 *
s->x96_high_res; n++)
1458 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1479 int sf, ch,
ret, band, sub_pos;
1484 for (sf = 0, sub_pos = 0; sf <
s->nsubframes; sf++) {
1491 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1493 int nsubbands =
s->nsubbands[ch];
1494 if (
s->joint_intensity_index[ch])
1495 nsubbands =
FFMAX(nsubbands,
s->nsubbands[
s->joint_intensity_index[ch] - 1]);
1500 if (band >=
s->x96_subband_start && band < nsubbands)
1516 if (
s->x96_rev_no < 1 ||
s->x96_rev_no > 8) {
1521 s->x96_crc_present = 0;
1522 s->x96_nchannels =
s->nchannels;
1543 int x96_nchsets, x96_base_ch;
1556 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
1563 if (
s->x96_rev_no < 1 ||
s->x96_rev_no > 8) {
1575 for (
i = 0;
i < x96_nchsets;
i++)
1576 x96_frame_size[
i] =
get_bits(&
s->gb, 12) + 1;
1579 for (
i = 0;
i < x96_nchsets;
i++)
1594 s->x96_nchannels = 0;
1595 for (
i = 0, x96_base_ch = 0;
i < x96_nchsets;
i++) {
1598 if (x96_base_ch + x96_nchannels[
i] <=
s->nchannels) {
1599 s->x96_nchannels = x96_base_ch + x96_nchannels[
i];
1604 x96_base_ch += x96_nchannels[
i];
1656 for (
i = 0;
i < m * n;
i++) {
1658 int sign = (
code >> 8) - 1;
1698 s->prim_dmix_embedded = 0;
1701 if (
s->ext_audio_present && !dca->
core_only) {
1702 int sync_pos =
FFMIN(
s->frame_size / 4,
s->gb.size_in_bits / 32) - 1;
1705 uint32_t w1, w2 = 0;
1710 switch (
s->ext_audio_type) {
1720 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1721 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1723 size = (w2 >> 22) + 1;
1724 dist =
s->frame_size - sync_pos * 4;
1726 && (
size == dist ||
size - 1 == dist)
1727 && (w2 >> 15 & 0x7f) == 0x08) {
1728 s->xch_pos = sync_pos * 32 + 49;
1745 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1746 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1748 size = (w2 >> 20) + 1;
1749 dist =
s->frame_size - sync_pos * 4;
1751 s->x96_pos = sync_pos * 32 + 44;
1770 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1771 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1773 size = (w2 >> 26) + 1;
1774 dist =
s->gb.size_in_bits / 8 - sync_pos * 4;
1777 (sync_pos + 1) * 4,
size - 4)) {
1778 s->xxch_pos = sync_pos * 32;
1800 s->ext_audio_mask = 0;
1801 s->xch_pos =
s->xxch_pos =
s->x96_pos = 0;
1817 if (
s->frame_size >
size)
1818 s->frame_size =
size;
1834 int ret = 0, ext = 0;
1843 }
else if (
s->xxch_pos) {
1848 }
else if (
s->xch_pos) {
1864 s->ext_audio_mask |= ext;
1891 }
else if (
s->x96_pos) {
1915 if (
s->xxch_core_mask & (1
U << spkr))
1933 if (
s->xxch_spkr_mask & (1
U << spkr))
1944 memset(
s->dcadsp_data, 0,
sizeof(
s->dcadsp_data));
1945 s->output_history_lfe_fixed = 0;
1946 s->output_history_lfe_float = 0;
1951 if (
s->filter_mode !=
mode) {
1953 s->filter_mode =
mode;
1959 int n, ch, spkr, nsamples, x96_nchannels = 0;
1968 x96_nchannels =
s->x96_nchannels;
1974 s->output_rate =
s->sample_rate << x96_synth;
1980 if (!
s->output_buffer)
1985 if (
s->ch_mask & (1
U << spkr)) {
1986 s->output_samples[spkr] = ptr;
1989 s->output_samples[spkr] =
NULL;
1999 else if (
s->filter_perfect)
2005 for (ch = 0; ch <
s->nchannels; ch++) {
2012 s->dcadsp->sub_qmf_fixed[x96_synth](
2015 s->output_samples[spkr],
2016 s->subband_samples[ch],
2017 ch < x96_nchannels ?
s->x96_subband_samples[ch] :
NULL,
2018 s->dcadsp_data[ch].u.fix.hist1,
2019 &
s->dcadsp_data[ch].offset,
2020 s->dcadsp_data[ch].u.fix.hist2,
2026 if (
s->lfe_present) {
2028 int nlfesamples =
s->npcmblocks >> 1;
2048 samples, &
s->output_history_lfe_fixed,
2055 s->lfe_samples[n] =
s->lfe_samples[nlfesamples + n];
2065 int i, n, ch,
ret, spkr, nsamples;
2075 frame->nb_samples = nsamples =
s->npcmsamples;
2091 &&
s->xxch_dmix_embedded) {
2092 int scale_inv =
s->xxch_dmix_scale_inv;
2093 int *coeff_ptr =
s->xxch_dmix_coeff;
2098 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2099 if (
s->xxch_core_mask & (1
U << spkr)) {
2100 s->dcadsp->dmix_scale_inv(
s->output_samples[spkr],
2101 scale_inv, nsamples);
2106 for (ch = xch_base; ch <
s->nchannels; ch++) {
2110 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2111 if (
s->xxch_dmix_mask[ch - xch_base] & (1
U << spkr)) {
2114 s->dcadsp->dmix_sub(
s->output_samples[spkr ],
2115 s->output_samples[src_spkr],
2141 if (
s->request_mask !=
s->ch_mask) {
2145 nsamples,
s->ch_mask);
2151 for (n = 0; n < nsamples; n++)
2161 int x96_nchannels = 0, x96_synth = 0;
2162 int i, n, ch,
ret, spkr, nsamples, nchannels;
2164 const float *filter_coeff;
2167 x96_nchannels =
s->x96_nchannels;
2181 output_samples[
s->ch_remap[
i]] = (
float *)
frame->extended_data[
i];
2185 if (nchannels > 0) {
2187 nsamples * nchannels *
sizeof(
float));
2188 if (!
s->output_buffer)
2191 ptr = (
float *)
s->output_buffer;
2193 if (!(
s->ch_mask & (1
U << spkr)))
2195 if (output_samples[spkr])
2197 output_samples[spkr] = ptr;
2208 else if (
s->filter_perfect)
2214 for (ch = 0; ch <
s->nchannels; ch++) {
2221 s->dcadsp->sub_qmf_float[x96_synth](
2223 s->imdct[x96_synth],
2224 s->imdct_fn[x96_synth],
2225 output_samples[spkr],
2226 s->subband_samples[ch],
2227 ch < x96_nchannels ?
s->x96_subband_samples[ch] :
NULL,
2228 s->dcadsp_data[ch].u.flt.hist1,
2229 &
s->dcadsp_data[ch].offset,
2230 s->dcadsp_data[ch].u.flt.hist2,
2233 1.0f / (1 << (17 - x96_synth)));
2237 if (
s->lfe_present) {
2240 int nlfesamples =
s->npcmblocks >> (dec_select + 1);
2253 s->dcadsp->lfe_fir_float[dec_select](
2255 filter_coeff,
s->npcmblocks);
2261 samples, &
s->output_history_lfe_float,
2267 s->lfe_samples[n] =
s->lfe_samples[nlfesamples + n];
2283 &&
s->xxch_dmix_embedded) {
2284 float scale_inv =
s->xxch_dmix_scale_inv * (1.0f / (1 << 16));
2285 int *coeff_ptr =
s->xxch_dmix_coeff;
2290 for (ch = xch_base; ch <
s->nchannels; ch++) {
2294 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2295 if (
s->xxch_dmix_mask[ch - xch_base] & (1
U << spkr)) {
2296 int coeff = *coeff_ptr++;
2298 s->float_dsp->vector_fmac_scalar(output_samples[ spkr],
2299 output_samples[src_spkr],
2300 coeff * (-1.0
f / (1 << 15)),
2308 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2309 if (
s->xxch_core_mask & (1
U << spkr)) {
2310 s->float_dsp->vector_fmul_scalar(output_samples[spkr],
2311 output_samples[spkr],
2312 scale_inv, nsamples);
2335 if (
s->request_mask !=
s->ch_mask) {
2338 nsamples,
s->ch_mask);
2359 s->request_mask =
s->ch_mask;
2400 if (
s->subband_buffer) {
2405 if (
s->x96_subband_buffer)
2424 1, 32, &
scale, 0)) < 0)
2428 1, 64, &
scale, 0)) < 0)
2446 s->subband_size = 0;
2449 s->x96_subband_size = 0;