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;
368 *scale_index =
get_bits(&
s->gb, sel + 1);
371 if ((
unsigned int)*scale_index >= scale_size) {
413 s->nsubsubframes[sf] =
get_bits(&
s->gb, 2) + 1;
420 for (ch = xch_base; ch <
s->nchannels; ch++)
421 for (band = 0; band <
s->nsubbands[ch]; band++)
425 for (ch = xch_base; ch <
s->nchannels; ch++)
426 for (band = 0; band <
s->nsubbands[ch]; band++)
427 if (
s->prediction_mode[ch][band])
428 s->prediction_vq_index[ch][band] =
get_bits(&
s->gb, 12);
431 for (ch = xch_base; ch <
s->nchannels; ch++) {
432 int sel =
s->bit_allocation_sel[ch];
434 for (band = 0; band <
s->subband_vq_start[ch]; band++) {
447 s->bit_allocation[ch][band] = abits;
452 for (ch = xch_base; ch <
s->nchannels; ch++) {
454 memset(
s->transition_mode[sf][ch], 0,
sizeof(
s->transition_mode[0][0]));
457 if (
s->nsubsubframes[sf] > 1) {
458 int sel =
s->transition_mode_sel[ch];
459 for (band = 0; band <
s->subband_vq_start[ch]; band++)
460 if (
s->bit_allocation[ch][band])
467 for (ch = xch_base; ch <
s->nchannels; ch++) {
468 int sel =
s->scale_factor_sel[ch];
472 for (band = 0; band <
s->subband_vq_start[ch]; band++) {
473 if (
s->bit_allocation[ch][band]) {
476 s->scale_factors[ch][band][0] =
ret;
477 if (
s->transition_mode[sf][ch][band]) {
480 s->scale_factors[ch][band][1] =
ret;
483 s->scale_factors[ch][band][0] = 0;
488 for (band =
s->subband_vq_start[ch]; band < s->nsubbands[ch]; band++) {
491 s->scale_factors[ch][band][0] =
ret;
496 for (ch = xch_base; ch <
s->nchannels; ch++) {
497 if (
s->joint_intensity_index[ch]) {
499 if (
s->joint_scale_sel[ch] == 7) {
507 for (ch = xch_base; ch <
s->nchannels; ch++) {
508 int src_ch =
s->joint_intensity_index[ch] - 1;
510 int sel =
s->joint_scale_sel[ch];
511 for (band =
s->nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
514 s->joint_scale_factors[ch][band] =
ret;
530 #ifndef decode_blockcodes
533 int offset = (levels - 1) / 2;
538 audio[n] = code1 - div * levels -
offset;
543 audio[n] = code2 - div * levels -
offset;
547 return code1 | code2;
589 int sel =
s->quant_index_sel[ch][abits - 1];
606 const int16_t *vq_index,
607 const int8_t *prediction_mode,
608 int sb_start,
int sb_end,
613 for (
i = sb_start;
i < sb_end;
i++) {
614 if (prediction_mode[
i]) {
615 const int pred_id = vq_index[
i];
616 int32_t *ptr = subband_samples[
i] + ofs;
617 for (j = 0; j <
len; j++) {
619 ptr[j] =
clip23(ptr[j] + x);
627 int xch_base,
int *sub_pos,
int *lfe_pos)
630 int n, ssf, ofs, ch, band;
634 if (*sub_pos + nsamples >
s->npcmblocks) {
643 for (ch = xch_base; ch <
s->nchannels; ch++) {
646 for (band =
s->subband_vq_start[ch]; band < s->nsubbands[ch]; band++)
650 if (
s->subband_vq_start[ch] <
s->nsubbands[ch]) {
651 s->dcadsp->decode_hf(
s->subband_samples[ch], vq_index,
653 s->subband_vq_start[ch],
s->nsubbands[ch],
663 int nlfesamples = 2 *
s->lfe_present *
s->nsubsubframes[sf];
683 for (n = 0, ofs = *lfe_pos; n < nlfesamples; n++, ofs++)
691 for (ssf = 0, ofs = *sub_pos; ssf <
s->nsubsubframes[sf]; ssf++) {
692 for (ch = xch_base; ch <
s->nchannels; ch++) {
697 for (band = 0; band <
s->subband_vq_start[ch]; band++) {
698 int ret, trans_ssf, abits =
s->bit_allocation[ch][band];
707 if (
s->bit_rate == 3)
713 trans_ssf =
s->transition_mode[sf][ch][band];
716 if (trans_ssf == 0 || ssf < trans_ssf)
717 scale =
s->scale_factors[ch][band][0];
719 scale =
s->scale_factors[ch][band][1];
723 int64_t adj =
s->scale_factor_adj[ch][abits - 1];
733 if ((ssf ==
s->nsubsubframes[sf] - 1 ||
s->sync_ssf) &&
get_bits(&
s->gb, 16) != 0xffff) {
742 for (ch = xch_base; ch <
s->nchannels; ch++) {
744 s->prediction_mode[ch], 0,
s->nsubbands[ch],
749 for (ch = xch_base; ch <
s->nchannels; ch++) {
750 int src_ch =
s->joint_intensity_index[ch] - 1;
752 s->dcadsp->decode_joint(
s->subband_samples[ch],
s->subband_samples[src_ch],
753 s->joint_scale_factors[ch],
s->nsubbands[ch],
754 s->nsubbands[src_ch], *sub_pos, nsamples);
779 unsigned int size =
s->subband_size;
784 (nframesamples + nlfesamples) *
sizeof(
int32_t));
785 if (!
s->subband_buffer)
788 if (
size !=
s->subband_size) {
791 s->subband_samples[ch][band] =
s->subband_buffer +
793 s->lfe_samples =
s->subband_buffer + nframesamples;
796 if (!
s->predictor_history)
804 int sf, ch,
ret, band, sub_pos, lfe_pos;
809 for (sf = 0, sub_pos = 0, lfe_pos =
DCA_LFE_HISTORY; sf <
s->nsubframes; sf++) {
816 for (ch = xch_base; ch <
s->nchannels; ch++) {
818 int nsubbands =
s->nsubbands[ch];
819 if (
s->joint_intensity_index[ch])
820 nsubbands =
FFMAX(nsubbands,
s->nsubbands[
s->joint_intensity_index[ch] - 1]);
823 for (band = 0; band < nsubbands; band++) {
861 int xxch_nchsets, xxch_frame_size;
874 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
885 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid number of bits for XXCH speaker mask (%d)\n",
s->xxch_mask_nbits);
891 if (xxch_nchsets > 1) {
897 xxch_frame_size =
get_bits(&
s->gb, 14) + 1;
911 if (
mask !=
s->xxch_core_mask) {
912 av_log(
s->avctx,
AV_LOG_ERROR,
"XXCH core speaker activity mask (%#x) disagrees with core (%#x)\n",
s->xxch_core_mask,
mask);
928 if (
ff_dca_seek_bits(&
s->gb, header_pos + header_size * 8 + xxch_frame_size * 8)) {
937 int *xbr_nsubbands,
int xbr_transition_mode,
int sf,
int *sub_pos)
943 int ssf, ch, band, ofs;
955 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++)
956 xbr_nabits[ch] =
get_bits(&
s->gb, 2) + 2;
959 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
960 for (band = 0; band < xbr_nsubbands[ch]; band++) {
961 xbr_bit_allocation[ch][band] =
get_bits(&
s->gb, xbr_nabits[ch]);
970 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
971 xbr_scale_nbits[ch] =
get_bits(&
s->gb, 3);
972 if (!xbr_scale_nbits[ch]) {
979 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
984 if (
s->scale_factor_sel[ch] > 5) {
994 for (band = 0; band < xbr_nsubbands[ch]; band++) {
995 if (xbr_bit_allocation[ch][band]) {
996 int scale_index =
get_bits(&
s->gb, xbr_scale_nbits[ch]);
997 if (scale_index >= scale_size) {
1001 xbr_scale_factors[ch][band][0] =
scale_table[scale_index];
1002 if (xbr_transition_mode &&
s->transition_mode[sf][ch][band]) {
1003 scale_index =
get_bits(&
s->gb, xbr_scale_nbits[ch]);
1004 if (scale_index >= scale_size) {
1008 xbr_scale_factors[ch][band][1] =
scale_table[scale_index];
1015 for (ssf = 0, ofs = *sub_pos; ssf <
s->nsubsubframes[sf]; ssf++) {
1016 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
1020 for (band = 0; band < xbr_nsubbands[ch]; band++) {
1021 int ret, trans_ssf, abits = xbr_bit_allocation[ch][band];
1028 }
else if (abits > 0) {
1041 if (xbr_transition_mode)
1042 trans_ssf =
s->transition_mode[sf][ch][band];
1047 if (trans_ssf == 0 || ssf < trans_ssf)
1048 scale = xbr_scale_factors[ch][band][0];
1050 scale = xbr_scale_factors[ch][band][1];
1058 if ((ssf ==
s->nsubsubframes[sf] - 1 ||
s->sync_ssf) &&
get_bits(&
s->gb, 16) != 0xffff) {
1076 int xbr_nchsets, xbr_transition_mode, xbr_band_nbits, xbr_base_ch;
1089 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
1098 for (
i = 0;
i < xbr_nchsets;
i++)
1099 xbr_frame_size[
i] =
get_bits(&
s->gb, 14) + 1;
1105 for (
i = 0, ch2 = 0;
i < xbr_nchsets;
i++) {
1107 xbr_band_nbits =
get_bits(&
s->gb, 2) + 5;
1108 for (ch1 = 0; ch1 < xbr_nchannels[
i]; ch1++, ch2++) {
1109 xbr_nsubbands[ch2] =
get_bits(&
s->gb, xbr_band_nbits) + 1;
1111 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid number of active XBR subbands (%d)\n", xbr_nsubbands[ch2]);
1126 for (
i = 0, xbr_base_ch = 0;
i < xbr_nchsets;
i++) {
1129 if (xbr_base_ch + xbr_nchannels[
i] <=
s->nchannels) {
1132 for (sf = 0, sub_pos = 0; sf <
s->nsubframes; sf++) {
1134 xbr_base_ch + xbr_nchannels[
i],
1135 xbr_nsubbands, xbr_transition_mode,
1141 xbr_base_ch += xbr_nchannels[
i];
1156 s->x96_rand = 1103515245
U *
s->x96_rand + 12345
U;
1157 return (
s->x96_rand & 0x7fffffff) - 0x40000000;
1162 int n, ssf, ch, band, ofs;
1166 if (*sub_pos + nsamples >
s->npcmblocks) {
1175 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1176 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1181 switch (
s->bit_allocation[ch][band]) {
1185 else for (n = 0; n < nsamples; n++)
1191 for (ssf = 0; ssf < (
s->nsubsubframes[sf] + 1) / 2; ssf++) {
1196 for (n = 0; n <
FFMIN(nsamples - ssf * 16, 16); n++)
1205 for (ssf = 0, ofs = *sub_pos; ssf <
s->nsubsubframes[sf]; ssf++) {
1206 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1210 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1211 int ret, abits =
s->bit_allocation[ch][band] - 1;
1224 if (
s->bit_rate == 3)
1230 scale =
s->scale_factors[ch][band >> 1][band & 1];
1238 if ((ssf ==
s->nsubsubframes[sf] - 1 ||
s->sync_ssf) &&
get_bits(&
s->gb, 16) != 0xffff) {
1247 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1249 s->prediction_mode[ch],
s->x96_subband_start,
s->nsubbands[ch],
1250 *sub_pos, nsamples);
1254 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1255 int src_ch =
s->joint_intensity_index[ch] - 1;
1257 s->dcadsp->decode_joint(
s->x96_subband_samples[ch],
s->x96_subband_samples[src_ch],
1258 s->joint_scale_factors[ch],
s->nsubbands[ch],
1259 s->nsubbands[src_ch], *sub_pos, nsamples);
1283 unsigned int size =
s->x96_subband_size;
1288 nframesamples *
sizeof(
int32_t));
1289 if (!
s->x96_subband_buffer)
1292 if (
size !=
s->x96_subband_size) {
1295 s->x96_subband_samples[ch][band] =
s->x96_subband_buffer +
1299 if (!
s->predictor_history)
1313 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1314 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++)
1318 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1319 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++)
1320 if (
s->prediction_mode[ch][band])
1321 s->prediction_vq_index[ch][band] =
get_bits(&
s->gb, 12);
1324 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1325 int sel =
s->bit_allocation_sel[ch];
1328 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1333 abits =
get_bits(&
s->gb, 3 +
s->x96_high_res);
1335 if (abits < 0 || abits > 7 + 8 *
s->x96_high_res) {
1340 s->bit_allocation[ch][band] = abits;
1345 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1346 int sel =
s->scale_factor_sel[ch];
1347 int scale_index = 0;
1351 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1354 s->scale_factors[ch][band >> 1][band & 1] =
ret;
1359 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1360 if (
s->joint_intensity_index[ch]) {
1361 s->joint_scale_sel[ch] =
get_bits(&
s->gb, 3);
1362 if (
s->joint_scale_sel[ch] == 7) {
1370 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1371 int src_ch =
s->joint_intensity_index[ch] - 1;
1373 int sel =
s->joint_scale_sel[ch];
1374 for (band =
s->nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
1377 s->joint_scale_factors[ch][band] =
ret;
1401 if (
s->x96_crc_present
1412 if (
s->x96_rev_no < 8) {
1414 if (
s->x96_subband_start > 27) {
1415 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid X96 subband start index (%d)\n",
s->x96_subband_start);
1423 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1432 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1433 if ((n =
get_bits(&
s->gb, 3)) && xch_base)
1435 if (n >
s->x96_nchannels) {
1439 s->joint_intensity_index[ch] = n;
1443 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1444 s->scale_factor_sel[ch] =
get_bits(&
s->gb, 3);
1445 if (
s->scale_factor_sel[ch] >= 6) {
1452 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1453 s->bit_allocation_sel[ch] =
get_bits(&
s->gb, 3);
1456 for (n = 0; n < 6 + 4 *
s->x96_high_res; n++)
1457 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1478 int sf, ch,
ret, band, sub_pos;
1483 for (sf = 0, sub_pos = 0; sf <
s->nsubframes; sf++) {
1490 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1492 int nsubbands =
s->nsubbands[ch];
1493 if (
s->joint_intensity_index[ch])
1494 nsubbands =
FFMAX(nsubbands,
s->nsubbands[
s->joint_intensity_index[ch] - 1]);
1499 if (band >=
s->x96_subband_start && band < nsubbands)
1515 if (
s->x96_rev_no < 1 ||
s->x96_rev_no > 8) {
1520 s->x96_crc_present = 0;
1521 s->x96_nchannels =
s->nchannels;
1542 int x96_nchsets, x96_base_ch;
1555 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
1562 if (
s->x96_rev_no < 1 ||
s->x96_rev_no > 8) {
1574 for (
i = 0;
i < x96_nchsets;
i++)
1575 x96_frame_size[
i] =
get_bits(&
s->gb, 12) + 1;
1578 for (
i = 0;
i < x96_nchsets;
i++)
1593 s->x96_nchannels = 0;
1594 for (
i = 0, x96_base_ch = 0;
i < x96_nchsets;
i++) {
1597 if (x96_base_ch + x96_nchannels[
i] <=
s->nchannels) {
1598 s->x96_nchannels = x96_base_ch + x96_nchannels[
i];
1603 x96_base_ch += x96_nchannels[
i];
1655 for (
i = 0;
i < m * n;
i++) {
1657 int sign = (
code >> 8) - 1;
1697 s->prim_dmix_embedded = 0;
1700 if (
s->ext_audio_present && !dca->
core_only) {
1701 int sync_pos =
FFMIN(
s->frame_size / 4,
s->gb.size_in_bits / 32) - 1;
1704 uint32_t w1, w2 = 0;
1709 switch (
s->ext_audio_type) {
1719 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1720 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1722 size = (w2 >> 22) + 1;
1723 dist =
s->frame_size - sync_pos * 4;
1725 && (
size == dist ||
size - 1 == dist)
1726 && (w2 >> 15 & 0x7f) == 0x08) {
1727 s->xch_pos = sync_pos * 32 + 49;
1744 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1745 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1747 size = (w2 >> 20) + 1;
1748 dist =
s->frame_size - sync_pos * 4;
1750 s->x96_pos = sync_pos * 32 + 44;
1769 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1770 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1772 size = (w2 >> 26) + 1;
1773 dist =
s->gb.size_in_bits / 8 - sync_pos * 4;
1776 (sync_pos + 1) * 4,
size - 4)) {
1777 s->xxch_pos = sync_pos * 32;
1799 s->ext_audio_mask = 0;
1800 s->xch_pos =
s->xxch_pos =
s->x96_pos = 0;
1816 if (
s->frame_size >
size)
1817 s->frame_size =
size;
1833 int ret = 0, ext = 0;
1842 }
else if (
s->xxch_pos) {
1847 }
else if (
s->xch_pos) {
1863 s->ext_audio_mask |= ext;
1890 }
else if (
s->x96_pos) {
1914 if (
s->xxch_core_mask & (1
U << spkr))
1932 if (
s->xxch_spkr_mask & (1
U << spkr))
1943 memset(
s->dcadsp_data, 0,
sizeof(
s->dcadsp_data));
1944 s->output_history_lfe_fixed = 0;
1945 s->output_history_lfe_float = 0;
1950 if (
s->filter_mode !=
mode) {
1952 s->filter_mode =
mode;
1958 int n, ch, spkr, nsamples, x96_nchannels = 0;
1967 x96_nchannels =
s->x96_nchannels;
1973 s->output_rate =
s->sample_rate << x96_synth;
1979 if (!
s->output_buffer)
1984 if (
s->ch_mask & (1
U << spkr)) {
1985 s->output_samples[spkr] = ptr;
1988 s->output_samples[spkr] =
NULL;
1998 else if (
s->filter_perfect)
2004 for (ch = 0; ch <
s->nchannels; ch++) {
2011 s->dcadsp->sub_qmf_fixed[x96_synth](
2014 s->output_samples[spkr],
2015 s->subband_samples[ch],
2016 ch < x96_nchannels ?
s->x96_subband_samples[ch] :
NULL,
2017 s->dcadsp_data[ch].u.fix.hist1,
2018 &
s->dcadsp_data[ch].offset,
2019 s->dcadsp_data[ch].u.fix.hist2,
2025 if (
s->lfe_present) {
2027 int nlfesamples =
s->npcmblocks >> 1;
2047 samples, &
s->output_history_lfe_fixed,
2054 s->lfe_samples[n] =
s->lfe_samples[nlfesamples + n];
2064 int i, n, ch,
ret, spkr, nsamples;
2090 &&
s->xxch_dmix_embedded) {
2091 int scale_inv =
s->xxch_dmix_scale_inv;
2092 int *coeff_ptr =
s->xxch_dmix_coeff;
2097 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2098 if (
s->xxch_core_mask & (1
U << spkr)) {
2099 s->dcadsp->dmix_scale_inv(
s->output_samples[spkr],
2100 scale_inv, nsamples);
2105 for (ch = xch_base; ch <
s->nchannels; ch++) {
2109 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2110 if (
s->xxch_dmix_mask[ch - xch_base] & (1
U << spkr)) {
2113 s->dcadsp->dmix_sub(
s->output_samples[spkr ],
2114 s->output_samples[src_spkr],
2140 if (
s->request_mask !=
s->ch_mask) {
2144 nsamples,
s->ch_mask);
2150 for (n = 0; n < nsamples; n++)
2160 int x96_nchannels = 0, x96_synth = 0;
2161 int i, n, ch,
ret, spkr, nsamples, nchannels;
2163 const float *filter_coeff;
2166 x96_nchannels =
s->x96_nchannels;
2184 if (nchannels > 0) {
2186 nsamples * nchannels *
sizeof(
float));
2187 if (!
s->output_buffer)
2190 ptr = (
float *)
s->output_buffer;
2192 if (!(
s->ch_mask & (1
U << spkr)))
2194 if (output_samples[spkr])
2196 output_samples[spkr] = ptr;
2207 else if (
s->filter_perfect)
2213 for (ch = 0; ch <
s->nchannels; ch++) {
2220 s->dcadsp->sub_qmf_float[x96_synth](
2222 s->imdct[x96_synth],
2223 s->imdct_fn[x96_synth],
2224 output_samples[spkr],
2225 s->subband_samples[ch],
2226 ch < x96_nchannels ?
s->x96_subband_samples[ch] :
NULL,
2227 s->dcadsp_data[ch].u.flt.hist1,
2228 &
s->dcadsp_data[ch].offset,
2229 s->dcadsp_data[ch].u.flt.hist2,
2232 1.0f / (1 << (17 - x96_synth)));
2236 if (
s->lfe_present) {
2239 int nlfesamples =
s->npcmblocks >> (dec_select + 1);
2252 s->dcadsp->lfe_fir_float[dec_select](
2254 filter_coeff,
s->npcmblocks);
2260 samples, &
s->output_history_lfe_float,
2266 s->lfe_samples[n] =
s->lfe_samples[nlfesamples + n];
2282 &&
s->xxch_dmix_embedded) {
2283 float scale_inv =
s->xxch_dmix_scale_inv * (1.0f / (1 << 16));
2284 int *coeff_ptr =
s->xxch_dmix_coeff;
2289 for (ch = xch_base; ch <
s->nchannels; ch++) {
2293 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2294 if (
s->xxch_dmix_mask[ch - xch_base] & (1
U << spkr)) {
2295 int coeff = *coeff_ptr++;
2297 s->float_dsp->vector_fmac_scalar(output_samples[ spkr],
2298 output_samples[src_spkr],
2299 coeff * (-1.0
f / (1 << 15)),
2307 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2308 if (
s->xxch_core_mask & (1
U << spkr)) {
2309 s->float_dsp->vector_fmul_scalar(output_samples[spkr],
2310 output_samples[spkr],
2311 scale_inv, nsamples);
2334 if (
s->request_mask !=
s->ch_mask) {
2337 nsamples,
s->ch_mask);
2358 s->request_mask =
s->ch_mask;
2399 if (
s->subband_buffer) {
2404 if (
s->x96_subband_buffer)
2423 1, 32, &
scale, 0)) < 0)
2427 1, 64, &
scale, 0)) < 0)
2445 s->subband_size = 0;
2448 s->x96_subband_size = 0;