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);
773 #ifdef FF_COPY_SWAP_ZERO_USES_MMX
783 unsigned int size =
s->subband_size;
788 (nframesamples + nlfesamples) *
sizeof(
int32_t));
789 if (!
s->subband_buffer)
792 if (
size !=
s->subband_size) {
795 s->subband_samples[ch][band] =
s->subband_buffer +
797 s->lfe_samples =
s->subband_buffer + nframesamples;
800 if (!
s->predictor_history)
808 int sf, ch,
ret, band, sub_pos, lfe_pos;
813 for (sf = 0, sub_pos = 0, lfe_pos =
DCA_LFE_HISTORY; sf <
s->nsubframes; sf++) {
820 for (ch = xch_base; ch <
s->nchannels; ch++) {
822 int nsubbands =
s->nsubbands[ch];
823 if (
s->joint_intensity_index[ch])
824 nsubbands =
FFMAX(nsubbands,
s->nsubbands[
s->joint_intensity_index[ch] - 1]);
827 for (band = 0; band < nsubbands; band++) {
839 #ifdef FF_COPY_SWAP_ZERO_USES_MMX
869 int xxch_nchsets, xxch_frame_size;
882 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
893 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid number of bits for XXCH speaker mask (%d)\n",
s->xxch_mask_nbits);
899 if (xxch_nchsets > 1) {
905 xxch_frame_size =
get_bits(&
s->gb, 14) + 1;
919 if (
mask !=
s->xxch_core_mask) {
920 av_log(
s->avctx,
AV_LOG_ERROR,
"XXCH core speaker activity mask (%#x) disagrees with core (%#x)\n",
s->xxch_core_mask,
mask);
936 if (
ff_dca_seek_bits(&
s->gb, header_pos + header_size * 8 + xxch_frame_size * 8)) {
945 int *xbr_nsubbands,
int xbr_transition_mode,
int sf,
int *sub_pos)
951 int ssf, ch, band, ofs;
963 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++)
964 xbr_nabits[ch] =
get_bits(&
s->gb, 2) + 2;
967 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
968 for (band = 0; band < xbr_nsubbands[ch]; band++) {
969 xbr_bit_allocation[ch][band] =
get_bits(&
s->gb, xbr_nabits[ch]);
978 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
979 xbr_scale_nbits[ch] =
get_bits(&
s->gb, 3);
980 if (!xbr_scale_nbits[ch]) {
987 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
992 if (
s->scale_factor_sel[ch] > 5) {
1002 for (band = 0; band < xbr_nsubbands[ch]; band++) {
1003 if (xbr_bit_allocation[ch][band]) {
1004 int scale_index =
get_bits(&
s->gb, xbr_scale_nbits[ch]);
1005 if (scale_index >= scale_size) {
1009 xbr_scale_factors[ch][band][0] =
scale_table[scale_index];
1010 if (xbr_transition_mode &&
s->transition_mode[sf][ch][band]) {
1011 scale_index =
get_bits(&
s->gb, xbr_scale_nbits[ch]);
1012 if (scale_index >= scale_size) {
1016 xbr_scale_factors[ch][band][1] =
scale_table[scale_index];
1023 for (ssf = 0, ofs = *sub_pos; ssf <
s->nsubsubframes[sf]; ssf++) {
1024 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
1028 for (band = 0; band < xbr_nsubbands[ch]; band++) {
1029 int ret, trans_ssf, abits = xbr_bit_allocation[ch][band];
1036 }
else if (abits > 0) {
1049 if (xbr_transition_mode)
1050 trans_ssf =
s->transition_mode[sf][ch][band];
1055 if (trans_ssf == 0 || ssf < trans_ssf)
1056 scale = xbr_scale_factors[ch][band][0];
1058 scale = xbr_scale_factors[ch][band][1];
1066 if ((ssf ==
s->nsubsubframes[sf] - 1 ||
s->sync_ssf) &&
get_bits(&
s->gb, 16) != 0xffff) {
1084 int xbr_nchsets, xbr_transition_mode, xbr_band_nbits, xbr_base_ch;
1097 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
1106 for (
i = 0;
i < xbr_nchsets;
i++)
1107 xbr_frame_size[
i] =
get_bits(&
s->gb, 14) + 1;
1113 for (
i = 0, ch2 = 0;
i < xbr_nchsets;
i++) {
1115 xbr_band_nbits =
get_bits(&
s->gb, 2) + 5;
1116 for (ch1 = 0; ch1 < xbr_nchannels[
i]; ch1++, ch2++) {
1117 xbr_nsubbands[ch2] =
get_bits(&
s->gb, xbr_band_nbits) + 1;
1119 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid number of active XBR subbands (%d)\n", xbr_nsubbands[ch2]);
1134 for (
i = 0, xbr_base_ch = 0;
i < xbr_nchsets;
i++) {
1137 if (xbr_base_ch + xbr_nchannels[
i] <=
s->nchannels) {
1140 for (sf = 0, sub_pos = 0; sf <
s->nsubframes; sf++) {
1142 xbr_base_ch + xbr_nchannels[
i],
1143 xbr_nsubbands, xbr_transition_mode,
1149 xbr_base_ch += xbr_nchannels[
i];
1164 s->x96_rand = 1103515245
U *
s->x96_rand + 12345
U;
1165 return (
s->x96_rand & 0x7fffffff) - 0x40000000;
1170 int n, ssf, ch, band, ofs;
1174 if (*sub_pos + nsamples >
s->npcmblocks) {
1183 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1184 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1189 switch (
s->bit_allocation[ch][band]) {
1193 else for (n = 0; n < nsamples; n++)
1199 for (ssf = 0; ssf < (
s->nsubsubframes[sf] + 1) / 2; ssf++) {
1204 for (n = 0; n <
FFMIN(nsamples - ssf * 16, 16); n++)
1213 for (ssf = 0, ofs = *sub_pos; ssf <
s->nsubsubframes[sf]; ssf++) {
1214 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1218 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1219 int ret, abits =
s->bit_allocation[ch][band] - 1;
1232 if (
s->bit_rate == 3)
1238 scale =
s->scale_factors[ch][band >> 1][band & 1];
1246 if ((ssf ==
s->nsubsubframes[sf] - 1 ||
s->sync_ssf) &&
get_bits(&
s->gb, 16) != 0xffff) {
1255 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1257 s->prediction_mode[ch],
s->x96_subband_start,
s->nsubbands[ch],
1258 *sub_pos, nsamples);
1262 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1263 int src_ch =
s->joint_intensity_index[ch] - 1;
1265 s->dcadsp->decode_joint(
s->x96_subband_samples[ch],
s->x96_subband_samples[src_ch],
1266 s->joint_scale_factors[ch],
s->nsubbands[ch],
1267 s->nsubbands[src_ch], *sub_pos, nsamples);
1286 #ifdef FF_COPY_SWAP_ZERO_USES_MMX
1295 unsigned int size =
s->x96_subband_size;
1300 nframesamples *
sizeof(
int32_t));
1301 if (!
s->x96_subband_buffer)
1304 if (
size !=
s->x96_subband_size) {
1307 s->x96_subband_samples[ch][band] =
s->x96_subband_buffer +
1311 if (!
s->predictor_history)
1325 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1326 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++)
1330 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1331 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++)
1332 if (
s->prediction_mode[ch][band])
1333 s->prediction_vq_index[ch][band] =
get_bits(&
s->gb, 12);
1336 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1337 int sel =
s->bit_allocation_sel[ch];
1340 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1345 abits =
get_bits(&
s->gb, 3 +
s->x96_high_res);
1347 if (abits < 0 || abits > 7 + 8 *
s->x96_high_res) {
1352 s->bit_allocation[ch][band] = abits;
1357 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1358 int sel =
s->scale_factor_sel[ch];
1359 int scale_index = 0;
1363 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1366 s->scale_factors[ch][band >> 1][band & 1] =
ret;
1371 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1372 if (
s->joint_intensity_index[ch]) {
1373 s->joint_scale_sel[ch] =
get_bits(&
s->gb, 3);
1374 if (
s->joint_scale_sel[ch] == 7) {
1382 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1383 int src_ch =
s->joint_intensity_index[ch] - 1;
1385 int sel =
s->joint_scale_sel[ch];
1386 for (band =
s->nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
1389 s->joint_scale_factors[ch][band] =
ret;
1413 if (
s->x96_crc_present
1424 if (
s->x96_rev_no < 8) {
1426 if (
s->x96_subband_start > 27) {
1427 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid X96 subband start index (%d)\n",
s->x96_subband_start);
1435 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1444 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1445 if ((n =
get_bits(&
s->gb, 3)) && xch_base)
1447 if (n >
s->x96_nchannels) {
1451 s->joint_intensity_index[ch] = n;
1455 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1456 s->scale_factor_sel[ch] =
get_bits(&
s->gb, 3);
1457 if (
s->scale_factor_sel[ch] >= 6) {
1464 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1465 s->bit_allocation_sel[ch] =
get_bits(&
s->gb, 3);
1468 for (n = 0; n < 6 + 4 *
s->x96_high_res; n++)
1469 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1490 int sf, ch,
ret, band, sub_pos;
1495 for (sf = 0, sub_pos = 0; sf <
s->nsubframes; sf++) {
1502 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1504 int nsubbands =
s->nsubbands[ch];
1505 if (
s->joint_intensity_index[ch])
1506 nsubbands =
FFMAX(nsubbands,
s->nsubbands[
s->joint_intensity_index[ch] - 1]);
1511 if (band >=
s->x96_subband_start && band < nsubbands)
1518 #ifdef FF_COPY_SWAP_ZERO_USES_MMX
1531 if (
s->x96_rev_no < 1 ||
s->x96_rev_no > 8) {
1536 s->x96_crc_present = 0;
1537 s->x96_nchannels =
s->nchannels;
1558 int x96_nchsets, x96_base_ch;
1571 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
1578 if (
s->x96_rev_no < 1 ||
s->x96_rev_no > 8) {
1590 for (
i = 0;
i < x96_nchsets;
i++)
1591 x96_frame_size[
i] =
get_bits(&
s->gb, 12) + 1;
1594 for (
i = 0;
i < x96_nchsets;
i++)
1609 s->x96_nchannels = 0;
1610 for (
i = 0, x96_base_ch = 0;
i < x96_nchsets;
i++) {
1613 if (x96_base_ch + x96_nchannels[
i] <=
s->nchannels) {
1614 s->x96_nchannels = x96_base_ch + x96_nchannels[
i];
1619 x96_base_ch += x96_nchannels[
i];
1671 for (
i = 0;
i < m * n;
i++) {
1673 int sign = (
code >> 8) - 1;
1713 s->prim_dmix_embedded = 0;
1716 if (
s->ext_audio_present && !dca->
core_only) {
1717 int sync_pos =
FFMIN(
s->frame_size / 4,
s->gb.size_in_bits / 32) - 1;
1720 uint32_t w1, w2 = 0;
1725 switch (
s->ext_audio_type) {
1735 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1736 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1738 size = (w2 >> 22) + 1;
1739 dist =
s->frame_size - sync_pos * 4;
1741 && (
size == dist ||
size - 1 == dist)
1742 && (w2 >> 15 & 0x7f) == 0x08) {
1743 s->xch_pos = sync_pos * 32 + 49;
1760 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1761 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1763 size = (w2 >> 20) + 1;
1764 dist =
s->frame_size - sync_pos * 4;
1766 s->x96_pos = sync_pos * 32 + 44;
1785 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1786 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1788 size = (w2 >> 26) + 1;
1789 dist =
s->gb.size_in_bits / 8 - sync_pos * 4;
1792 (sync_pos + 1) * 4,
size - 4)) {
1793 s->xxch_pos = sync_pos * 32;
1815 s->ext_audio_mask = 0;
1816 s->xch_pos =
s->xxch_pos =
s->x96_pos = 0;
1832 if (
s->frame_size >
size)
1833 s->frame_size =
size;
1849 int ret = 0, ext = 0;
1858 }
else if (
s->xxch_pos) {
1863 }
else if (
s->xch_pos) {
1879 s->ext_audio_mask |= ext;
1906 }
else if (
s->x96_pos) {
1930 if (
s->xxch_core_mask & (1
U << spkr))
1948 if (
s->xxch_spkr_mask & (1
U << spkr))
1959 memset(
s->dcadsp_data, 0,
sizeof(
s->dcadsp_data));
1960 s->output_history_lfe_fixed = 0;
1961 s->output_history_lfe_float = 0;
1966 if (
s->filter_mode !=
mode) {
1968 s->filter_mode =
mode;
1974 int n, ch, spkr, nsamples, x96_nchannels = 0;
1983 x96_nchannels =
s->x96_nchannels;
1989 s->output_rate =
s->sample_rate << x96_synth;
1995 if (!
s->output_buffer)
2000 if (
s->ch_mask & (1
U << spkr)) {
2001 s->output_samples[spkr] = ptr;
2004 s->output_samples[spkr] =
NULL;
2014 else if (
s->filter_perfect)
2020 for (ch = 0; ch <
s->nchannels; ch++) {
2027 s->dcadsp->sub_qmf_fixed[x96_synth](
2030 s->output_samples[spkr],
2031 s->subband_samples[ch],
2032 ch < x96_nchannels ?
s->x96_subband_samples[ch] :
NULL,
2033 s->dcadsp_data[ch].u.fix.hist1,
2034 &
s->dcadsp_data[ch].offset,
2035 s->dcadsp_data[ch].u.fix.hist2,
2041 if (
s->lfe_present) {
2043 int nlfesamples =
s->npcmblocks >> 1;
2063 samples, &
s->output_history_lfe_fixed,
2070 s->lfe_samples[n] =
s->lfe_samples[nlfesamples + n];
2080 int i, n, ch,
ret, spkr, nsamples;
2090 frame->nb_samples = nsamples =
s->npcmsamples;
2106 &&
s->xxch_dmix_embedded) {
2107 int scale_inv =
s->xxch_dmix_scale_inv;
2108 int *coeff_ptr =
s->xxch_dmix_coeff;
2113 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2114 if (
s->xxch_core_mask & (1
U << spkr)) {
2115 s->dcadsp->dmix_scale_inv(
s->output_samples[spkr],
2116 scale_inv, nsamples);
2121 for (ch = xch_base; ch <
s->nchannels; ch++) {
2125 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2126 if (
s->xxch_dmix_mask[ch - xch_base] & (1
U << spkr)) {
2129 s->dcadsp->dmix_sub(
s->output_samples[spkr ],
2130 s->output_samples[src_spkr],
2156 if (
s->request_mask !=
s->ch_mask) {
2160 nsamples,
s->ch_mask);
2166 for (n = 0; n < nsamples; n++)
2176 int x96_nchannels = 0, x96_synth = 0;
2177 int i, n, ch,
ret, spkr, nsamples, nchannels;
2179 const float *filter_coeff;
2182 x96_nchannels =
s->x96_nchannels;
2196 output_samples[
s->ch_remap[
i]] = (
float *)
frame->extended_data[
i];
2200 if (nchannels > 0) {
2202 nsamples * nchannels *
sizeof(
float));
2203 if (!
s->output_buffer)
2206 ptr = (
float *)
s->output_buffer;
2208 if (!(
s->ch_mask & (1
U << spkr)))
2210 if (output_samples[spkr])
2212 output_samples[spkr] = ptr;
2223 else if (
s->filter_perfect)
2229 for (ch = 0; ch <
s->nchannels; ch++) {
2236 s->dcadsp->sub_qmf_float[x96_synth](
2238 s->imdct[x96_synth],
2239 s->imdct_fn[x96_synth],
2240 output_samples[spkr],
2241 s->subband_samples[ch],
2242 ch < x96_nchannels ?
s->x96_subband_samples[ch] :
NULL,
2243 s->dcadsp_data[ch].u.flt.hist1,
2244 &
s->dcadsp_data[ch].offset,
2245 s->dcadsp_data[ch].u.flt.hist2,
2248 1.0f / (1 << (17 - x96_synth)));
2252 if (
s->lfe_present) {
2255 int nlfesamples =
s->npcmblocks >> (dec_select + 1);
2268 s->dcadsp->lfe_fir_float[dec_select](
2270 filter_coeff,
s->npcmblocks);
2276 samples, &
s->output_history_lfe_float,
2282 s->lfe_samples[n] =
s->lfe_samples[nlfesamples + n];
2298 &&
s->xxch_dmix_embedded) {
2299 float scale_inv =
s->xxch_dmix_scale_inv * (1.0f / (1 << 16));
2300 int *coeff_ptr =
s->xxch_dmix_coeff;
2305 for (ch = xch_base; ch <
s->nchannels; ch++) {
2309 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2310 if (
s->xxch_dmix_mask[ch - xch_base] & (1
U << spkr)) {
2311 int coeff = *coeff_ptr++;
2313 s->float_dsp->vector_fmac_scalar(output_samples[ spkr],
2314 output_samples[src_spkr],
2315 coeff * (-1.0
f / (1 << 15)),
2323 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2324 if (
s->xxch_core_mask & (1
U << spkr)) {
2325 s->float_dsp->vector_fmul_scalar(output_samples[spkr],
2326 output_samples[spkr],
2327 scale_inv, nsamples);
2350 if (
s->request_mask !=
s->ch_mask) {
2353 nsamples,
s->ch_mask);
2374 s->request_mask =
s->ch_mask;
2415 if (
s->subband_buffer) {
2420 if (
s->x96_subband_buffer)
2439 1, 32, &
scale, 0)) < 0)
2443 1, 64, &
scale, 0)) < 0)
2461 s->subband_size = 0;
2464 s->x96_subband_size = 0;