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);
774 #ifdef FF_COPY_SWAP_ZERO_USES_MMX
784 unsigned int size =
s->subband_size;
789 (nframesamples + nlfesamples) *
sizeof(
int32_t));
790 if (!
s->subband_buffer)
793 if (
size !=
s->subband_size) {
796 s->subband_samples[ch][band] =
s->subband_buffer +
798 s->lfe_samples =
s->subband_buffer + nframesamples;
801 if (!
s->predictor_history)
809 int sf, ch,
ret, band, sub_pos, lfe_pos;
814 for (sf = 0, sub_pos = 0, lfe_pos =
DCA_LFE_HISTORY; sf <
s->nsubframes; sf++) {
821 for (ch = xch_base; ch <
s->nchannels; ch++) {
823 int nsubbands =
s->nsubbands[ch];
824 if (
s->joint_intensity_index[ch])
825 nsubbands =
FFMAX(nsubbands,
s->nsubbands[
s->joint_intensity_index[ch] - 1]);
828 for (band = 0; band < nsubbands; band++) {
840 #ifdef FF_COPY_SWAP_ZERO_USES_MMX
870 int xxch_nchsets, xxch_frame_size;
883 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
894 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid number of bits for XXCH speaker mask (%d)\n",
s->xxch_mask_nbits);
900 if (xxch_nchsets > 1) {
906 xxch_frame_size =
get_bits(&
s->gb, 14) + 1;
920 if (
mask !=
s->xxch_core_mask) {
921 av_log(
s->avctx,
AV_LOG_ERROR,
"XXCH core speaker activity mask (%#x) disagrees with core (%#x)\n",
s->xxch_core_mask,
mask);
937 if (
ff_dca_seek_bits(&
s->gb, header_pos + header_size * 8 + xxch_frame_size * 8)) {
946 int *xbr_nsubbands,
int xbr_transition_mode,
int sf,
int *sub_pos)
952 int ssf, ch, band, ofs;
964 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++)
965 xbr_nabits[ch] =
get_bits(&
s->gb, 2) + 2;
968 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
969 for (band = 0; band < xbr_nsubbands[ch]; band++) {
970 xbr_bit_allocation[ch][band] =
get_bits(&
s->gb, xbr_nabits[ch]);
979 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
980 xbr_scale_nbits[ch] =
get_bits(&
s->gb, 3);
981 if (!xbr_scale_nbits[ch]) {
988 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
993 if (
s->scale_factor_sel[ch] > 5) {
1003 for (band = 0; band < xbr_nsubbands[ch]; band++) {
1004 if (xbr_bit_allocation[ch][band]) {
1005 int scale_index =
get_bits(&
s->gb, xbr_scale_nbits[ch]);
1006 if (scale_index >= scale_size) {
1010 xbr_scale_factors[ch][band][0] =
scale_table[scale_index];
1011 if (xbr_transition_mode &&
s->transition_mode[sf][ch][band]) {
1012 scale_index =
get_bits(&
s->gb, xbr_scale_nbits[ch]);
1013 if (scale_index >= scale_size) {
1017 xbr_scale_factors[ch][band][1] =
scale_table[scale_index];
1024 for (ssf = 0, ofs = *sub_pos; ssf <
s->nsubsubframes[sf]; ssf++) {
1025 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
1029 for (band = 0; band < xbr_nsubbands[ch]; band++) {
1030 int ret, trans_ssf, abits = xbr_bit_allocation[ch][band];
1037 }
else if (abits > 0) {
1050 if (xbr_transition_mode)
1051 trans_ssf =
s->transition_mode[sf][ch][band];
1056 if (trans_ssf == 0 || ssf < trans_ssf)
1057 scale = xbr_scale_factors[ch][band][0];
1059 scale = xbr_scale_factors[ch][band][1];
1067 if ((ssf ==
s->nsubsubframes[sf] - 1 ||
s->sync_ssf) &&
get_bits(&
s->gb, 16) != 0xffff) {
1085 int xbr_nchsets, xbr_transition_mode, xbr_band_nbits, xbr_base_ch;
1098 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
1107 for (
i = 0;
i < xbr_nchsets;
i++)
1108 xbr_frame_size[
i] =
get_bits(&
s->gb, 14) + 1;
1114 for (
i = 0, ch2 = 0;
i < xbr_nchsets;
i++) {
1116 xbr_band_nbits =
get_bits(&
s->gb, 2) + 5;
1117 for (ch1 = 0; ch1 < xbr_nchannels[
i]; ch1++, ch2++) {
1118 xbr_nsubbands[ch2] =
get_bits(&
s->gb, xbr_band_nbits) + 1;
1120 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid number of active XBR subbands (%d)\n", xbr_nsubbands[ch2]);
1135 for (
i = 0, xbr_base_ch = 0;
i < xbr_nchsets;
i++) {
1138 if (xbr_base_ch + xbr_nchannels[
i] <=
s->nchannels) {
1141 for (sf = 0, sub_pos = 0; sf <
s->nsubframes; sf++) {
1143 xbr_base_ch + xbr_nchannels[
i],
1144 xbr_nsubbands, xbr_transition_mode,
1150 xbr_base_ch += xbr_nchannels[
i];
1165 s->x96_rand = 1103515245
U *
s->x96_rand + 12345
U;
1166 return (
s->x96_rand & 0x7fffffff) - 0x40000000;
1171 int n, ssf, ch, band, ofs;
1175 if (*sub_pos + nsamples >
s->npcmblocks) {
1184 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1185 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1190 switch (
s->bit_allocation[ch][band]) {
1194 else for (n = 0; n < nsamples; n++)
1200 for (ssf = 0; ssf < (
s->nsubsubframes[sf] + 1) / 2; ssf++) {
1205 for (n = 0; n <
FFMIN(nsamples - ssf * 16, 16); n++)
1214 for (ssf = 0, ofs = *sub_pos; ssf <
s->nsubsubframes[sf]; ssf++) {
1215 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1219 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1220 int ret, abits =
s->bit_allocation[ch][band] - 1;
1233 if (
s->bit_rate == 3)
1239 scale =
s->scale_factors[ch][band >> 1][band & 1];
1247 if ((ssf ==
s->nsubsubframes[sf] - 1 ||
s->sync_ssf) &&
get_bits(&
s->gb, 16) != 0xffff) {
1256 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1258 s->prediction_mode[ch],
s->x96_subband_start,
s->nsubbands[ch],
1259 *sub_pos, nsamples);
1263 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1264 int src_ch =
s->joint_intensity_index[ch] - 1;
1266 s->dcadsp->decode_joint(
s->x96_subband_samples[ch],
s->x96_subband_samples[src_ch],
1267 s->joint_scale_factors[ch],
s->nsubbands[ch],
1268 s->nsubbands[src_ch], *sub_pos, nsamples);
1287 #ifdef FF_COPY_SWAP_ZERO_USES_MMX
1296 unsigned int size =
s->x96_subband_size;
1301 nframesamples *
sizeof(
int32_t));
1302 if (!
s->x96_subband_buffer)
1305 if (
size !=
s->x96_subband_size) {
1308 s->x96_subband_samples[ch][band] =
s->x96_subband_buffer +
1312 if (!
s->predictor_history)
1326 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1327 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++)
1331 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1332 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++)
1333 if (
s->prediction_mode[ch][band])
1334 s->prediction_vq_index[ch][band] =
get_bits(&
s->gb, 12);
1337 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1338 int sel =
s->bit_allocation_sel[ch];
1341 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1346 abits =
get_bits(&
s->gb, 3 +
s->x96_high_res);
1348 if (abits < 0 || abits > 7 + 8 *
s->x96_high_res) {
1353 s->bit_allocation[ch][band] = abits;
1358 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1359 int sel =
s->scale_factor_sel[ch];
1360 int scale_index = 0;
1364 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1367 s->scale_factors[ch][band >> 1][band & 1] =
ret;
1372 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1373 if (
s->joint_intensity_index[ch]) {
1374 s->joint_scale_sel[ch] =
get_bits(&
s->gb, 3);
1375 if (
s->joint_scale_sel[ch] == 7) {
1383 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1384 int src_ch =
s->joint_intensity_index[ch] - 1;
1386 int sel =
s->joint_scale_sel[ch];
1387 for (band =
s->nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
1390 s->joint_scale_factors[ch][band] =
ret;
1414 if (
s->x96_crc_present
1425 if (
s->x96_rev_no < 8) {
1427 if (
s->x96_subband_start > 27) {
1428 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid X96 subband start index (%d)\n",
s->x96_subband_start);
1436 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1445 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1446 if ((n =
get_bits(&
s->gb, 3)) && xch_base)
1448 if (n >
s->x96_nchannels) {
1452 s->joint_intensity_index[ch] = n;
1456 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1457 s->scale_factor_sel[ch] =
get_bits(&
s->gb, 3);
1458 if (
s->scale_factor_sel[ch] >= 6) {
1465 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1466 s->bit_allocation_sel[ch] =
get_bits(&
s->gb, 3);
1469 for (n = 0; n < 6 + 4 *
s->x96_high_res; n++)
1470 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1491 int sf, ch,
ret, band, sub_pos;
1496 for (sf = 0, sub_pos = 0; sf <
s->nsubframes; sf++) {
1503 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1505 int nsubbands =
s->nsubbands[ch];
1506 if (
s->joint_intensity_index[ch])
1507 nsubbands =
FFMAX(nsubbands,
s->nsubbands[
s->joint_intensity_index[ch] - 1]);
1512 if (band >=
s->x96_subband_start && band < nsubbands)
1519 #ifdef FF_COPY_SWAP_ZERO_USES_MMX
1532 if (
s->x96_rev_no < 1 ||
s->x96_rev_no > 8) {
1537 s->x96_crc_present = 0;
1538 s->x96_nchannels =
s->nchannels;
1559 int x96_nchsets, x96_base_ch;
1572 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
1579 if (
s->x96_rev_no < 1 ||
s->x96_rev_no > 8) {
1591 for (
i = 0;
i < x96_nchsets;
i++)
1592 x96_frame_size[
i] =
get_bits(&
s->gb, 12) + 1;
1595 for (
i = 0;
i < x96_nchsets;
i++)
1610 s->x96_nchannels = 0;
1611 for (
i = 0, x96_base_ch = 0;
i < x96_nchsets;
i++) {
1614 if (x96_base_ch + x96_nchannels[
i] <=
s->nchannels) {
1615 s->x96_nchannels = x96_base_ch + x96_nchannels[
i];
1620 x96_base_ch += x96_nchannels[
i];
1672 for (
i = 0;
i < m * n;
i++) {
1674 int sign = (
code >> 8) - 1;
1714 s->prim_dmix_embedded = 0;
1717 if (
s->ext_audio_present && !dca->
core_only) {
1718 int sync_pos =
FFMIN(
s->frame_size / 4,
s->gb.size_in_bits / 32) - 1;
1721 uint32_t w1, w2 = 0;
1726 switch (
s->ext_audio_type) {
1736 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1737 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1739 size = (w2 >> 22) + 1;
1740 dist =
s->frame_size - sync_pos * 4;
1742 && (
size == dist ||
size - 1 == dist)
1743 && (w2 >> 15 & 0x7f) == 0x08) {
1744 s->xch_pos = sync_pos * 32 + 49;
1761 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1762 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1764 size = (w2 >> 20) + 1;
1765 dist =
s->frame_size - sync_pos * 4;
1767 s->x96_pos = sync_pos * 32 + 44;
1786 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1787 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1789 size = (w2 >> 26) + 1;
1790 dist =
s->gb.size_in_bits / 8 - sync_pos * 4;
1793 (sync_pos + 1) * 4,
size - 4)) {
1794 s->xxch_pos = sync_pos * 32;
1816 s->ext_audio_mask = 0;
1817 s->xch_pos =
s->xxch_pos =
s->x96_pos = 0;
1833 if (
s->frame_size >
size)
1834 s->frame_size =
size;
1850 int ret = 0, ext = 0;
1859 }
else if (
s->xxch_pos) {
1864 }
else if (
s->xch_pos) {
1880 s->ext_audio_mask |= ext;
1907 }
else if (
s->x96_pos) {
1931 if (
s->xxch_core_mask & (1
U << spkr))
1949 if (
s->xxch_spkr_mask & (1
U << spkr))
1960 memset(
s->dcadsp_data, 0,
sizeof(
s->dcadsp_data));
1961 s->output_history_lfe_fixed = 0;
1962 s->output_history_lfe_float = 0;
1967 if (
s->filter_mode !=
mode) {
1969 s->filter_mode =
mode;
1975 int n, ch, spkr, nsamples, x96_nchannels = 0;
1984 x96_nchannels =
s->x96_nchannels;
1990 s->output_rate =
s->sample_rate << x96_synth;
1996 if (!
s->output_buffer)
2001 if (
s->ch_mask & (1
U << spkr)) {
2002 s->output_samples[spkr] = ptr;
2005 s->output_samples[spkr] =
NULL;
2015 else if (
s->filter_perfect)
2021 for (ch = 0; ch <
s->nchannels; ch++) {
2028 s->dcadsp->sub_qmf_fixed[x96_synth](
2031 s->output_samples[spkr],
2032 s->subband_samples[ch],
2033 ch < x96_nchannels ?
s->x96_subband_samples[ch] :
NULL,
2034 s->dcadsp_data[ch].u.fix.hist1,
2035 &
s->dcadsp_data[ch].offset,
2036 s->dcadsp_data[ch].u.fix.hist2,
2042 if (
s->lfe_present) {
2044 int nlfesamples =
s->npcmblocks >> 1;
2064 samples, &
s->output_history_lfe_fixed,
2071 s->lfe_samples[n] =
s->lfe_samples[nlfesamples + n];
2081 int i, n, ch,
ret, spkr, nsamples;
2107 &&
s->xxch_dmix_embedded) {
2108 int scale_inv =
s->xxch_dmix_scale_inv;
2109 int *coeff_ptr =
s->xxch_dmix_coeff;
2114 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2115 if (
s->xxch_core_mask & (1
U << spkr)) {
2116 s->dcadsp->dmix_scale_inv(
s->output_samples[spkr],
2117 scale_inv, nsamples);
2122 for (ch = xch_base; ch <
s->nchannels; ch++) {
2126 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2127 if (
s->xxch_dmix_mask[ch - xch_base] & (1
U << spkr)) {
2130 s->dcadsp->dmix_sub(
s->output_samples[spkr ],
2131 s->output_samples[src_spkr],
2157 if (
s->request_mask !=
s->ch_mask) {
2161 nsamples,
s->ch_mask);
2167 for (n = 0; n < nsamples; n++)
2177 int x96_nchannels = 0, x96_synth = 0;
2178 int i, n, ch,
ret, spkr, nsamples, nchannels;
2180 const float *filter_coeff;
2183 x96_nchannels =
s->x96_nchannels;
2201 if (nchannels > 0) {
2203 nsamples * nchannels *
sizeof(
float));
2204 if (!
s->output_buffer)
2207 ptr = (
float *)
s->output_buffer;
2209 if (!(
s->ch_mask & (1
U << spkr)))
2211 if (output_samples[spkr])
2213 output_samples[spkr] = ptr;
2224 else if (
s->filter_perfect)
2230 for (ch = 0; ch <
s->nchannels; ch++) {
2237 s->dcadsp->sub_qmf_float[x96_synth](
2239 s->imdct[x96_synth],
2240 s->imdct_fn[x96_synth],
2241 output_samples[spkr],
2242 s->subband_samples[ch],
2243 ch < x96_nchannels ?
s->x96_subband_samples[ch] :
NULL,
2244 s->dcadsp_data[ch].u.flt.hist1,
2245 &
s->dcadsp_data[ch].offset,
2246 s->dcadsp_data[ch].u.flt.hist2,
2249 1.0f / (1 << (17 - x96_synth)));
2253 if (
s->lfe_present) {
2256 int nlfesamples =
s->npcmblocks >> (dec_select + 1);
2269 s->dcadsp->lfe_fir_float[dec_select](
2271 filter_coeff,
s->npcmblocks);
2277 samples, &
s->output_history_lfe_float,
2283 s->lfe_samples[n] =
s->lfe_samples[nlfesamples + n];
2299 &&
s->xxch_dmix_embedded) {
2300 float scale_inv =
s->xxch_dmix_scale_inv * (1.0f / (1 << 16));
2301 int *coeff_ptr =
s->xxch_dmix_coeff;
2306 for (ch = xch_base; ch <
s->nchannels; ch++) {
2310 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2311 if (
s->xxch_dmix_mask[ch - xch_base] & (1
U << spkr)) {
2312 int coeff = *coeff_ptr++;
2314 s->float_dsp->vector_fmac_scalar(output_samples[ spkr],
2315 output_samples[src_spkr],
2316 coeff * (-1.0
f / (1 << 15)),
2324 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2325 if (
s->xxch_core_mask & (1
U << spkr)) {
2326 s->float_dsp->vector_fmul_scalar(output_samples[spkr],
2327 output_samples[spkr],
2328 scale_inv, nsamples);
2351 if (
s->request_mask !=
s->ch_mask) {
2354 nsamples,
s->ch_mask);
2375 s->request_mask =
s->ch_mask;
2416 if (
s->subband_buffer) {
2421 if (
s->x96_subband_buffer)
2440 1, 32, &
scale, 0)) < 0)
2444 1, 64, &
scale, 0)) < 0)
2462 s->subband_size = 0;
2465 s->x96_subband_size = 0;