66 7, 10, 12, 13, 15, 17, 19
128 s->crc_present =
h.crc_present;
129 s->npcmblocks =
h.npcmblocks;
130 s->frame_size =
h.frame_size;
131 s->audio_mode =
h.audio_mode;
134 s->drc_present =
h.drc_present;
135 s->ts_present =
h.ts_present;
136 s->aux_present =
h.aux_present;
137 s->ext_audio_type =
h.ext_audio_type;
138 s->ext_audio_present =
h.ext_audio_present;
139 s->sync_ssf =
h.sync_ssf;
140 s->lfe_present =
h.lfe_present;
141 s->predictor_history =
h.predictor_history;
142 s->filter_perfect =
h.filter_perfect;
144 s->es_format =
h.pcmr_code & 1;
145 s->sumdiff_front =
h.sumdiff_front;
146 s->sumdiff_surround =
h.sumdiff_surround;
154 int n, ch, nchannels, header_size = 0, header_pos =
get_bits_count(&
s->gb);
168 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);
191 if (
s->xxch_crc_present
215 if (
s->xxch_core_mask &
s->xxch_spkr_mask) {
216 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);
221 s->ch_mask =
s->xxch_core_mask |
s->xxch_spkr_mask;
225 int *coeff_ptr =
s->xxch_dmix_coeff;
239 for (ch = 0; ch < nchannels; ch++) {
241 if ((
mask &
s->xxch_core_mask) !=
mask) {
245 s->xxch_dmix_mask[ch] =
mask;
249 for (ch = 0; ch < nchannels; ch++) {
250 for (n = 0; n <
s->xxch_mask_nbits; n++) {
251 if (
s->xxch_dmix_mask[ch] & (1
U << n)) {
253 int sign = (
code >> 6) - 1;
268 s->xxch_dmix_embedded = 0;
275 for (ch = xch_base; ch <
s->nchannels; ch++) {
284 for (ch = xch_base; ch <
s->nchannels; ch++)
285 s->subband_vq_start[ch] =
get_bits(&
s->gb, 5) + 1;
288 for (ch = xch_base; ch <
s->nchannels; ch++) {
291 if (n >
s->nchannels) {
295 s->joint_intensity_index[ch] = n;
299 for (ch = xch_base; ch <
s->nchannels; ch++)
300 s->transition_mode_sel[ch] =
get_bits(&
s->gb, 2);
303 for (ch = xch_base; ch <
s->nchannels; ch++) {
304 s->scale_factor_sel[ch] =
get_bits(&
s->gb, 3);
305 if (
s->scale_factor_sel[ch] == 7) {
312 for (ch = xch_base; ch <
s->nchannels; ch++) {
313 s->bit_allocation_sel[ch] =
get_bits(&
s->gb, 3);
314 if (
s->bit_allocation_sel[ch] == 7) {
322 for (ch = xch_base; ch <
s->nchannels; ch++)
327 for (ch = xch_base; ch <
s->nchannels; ch++)
351 unsigned int scale_size;
366 *scale_index =
get_bits(&
s->gb, sel + 1);
369 if ((
unsigned int)*scale_index >= scale_size) {
410 s->nsubsubframes[sf] =
get_bits(&
s->gb, 2) + 1;
417 for (ch = xch_base; ch <
s->nchannels; ch++)
418 for (band = 0; band <
s->nsubbands[ch]; band++)
422 for (ch = xch_base; ch <
s->nchannels; ch++)
423 for (band = 0; band <
s->nsubbands[ch]; band++)
424 if (
s->prediction_mode[ch][band])
425 s->prediction_vq_index[ch][band] =
get_bits(&
s->gb, 12);
428 for (ch = xch_base; ch <
s->nchannels; ch++) {
429 int sel =
s->bit_allocation_sel[ch];
431 for (band = 0; band <
s->subband_vq_start[ch]; band++) {
444 s->bit_allocation[ch][band] = abits;
449 for (ch = xch_base; ch <
s->nchannels; ch++) {
451 memset(
s->transition_mode[sf][ch], 0,
sizeof(
s->transition_mode[0][0]));
454 if (
s->nsubsubframes[sf] > 1) {
455 int sel =
s->transition_mode_sel[ch];
456 for (band = 0; band <
s->subband_vq_start[ch]; band++)
457 if (
s->bit_allocation[ch][band])
463 for (ch = xch_base; ch <
s->nchannels; ch++) {
464 int sel =
s->scale_factor_sel[ch];
468 for (band = 0; band <
s->subband_vq_start[ch]; band++) {
469 if (
s->bit_allocation[ch][band]) {
472 s->scale_factors[ch][band][0] =
ret;
473 if (
s->transition_mode[sf][ch][band]) {
476 s->scale_factors[ch][band][1] =
ret;
479 s->scale_factors[ch][band][0] = 0;
484 for (band =
s->subband_vq_start[ch]; band < s->nsubbands[ch]; band++) {
487 s->scale_factors[ch][band][0] =
ret;
492 for (ch = xch_base; ch <
s->nchannels; ch++) {
493 if (
s->joint_intensity_index[ch]) {
495 if (
s->joint_scale_sel[ch] == 7) {
503 for (ch = xch_base; ch <
s->nchannels; ch++) {
504 int src_ch =
s->joint_intensity_index[ch] - 1;
506 int sel =
s->joint_scale_sel[ch];
507 for (band =
s->nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
510 s->joint_scale_factors[ch][band] =
ret;
526 #ifndef decode_blockcodes
529 int offset = (levels - 1) / 2;
534 audio[n] = code1 - div * levels -
offset;
539 audio[n] = code2 - div * levels -
offset;
543 return code1 | code2;
585 int sel =
s->quant_index_sel[ch][abits - 1];
602 const int16_t *vq_index,
603 const int8_t *prediction_mode,
604 int sb_start,
int sb_end,
609 for (
i = sb_start;
i < sb_end;
i++) {
610 if (prediction_mode[
i]) {
611 const int pred_id = vq_index[
i];
612 int32_t *ptr = subband_samples[
i] + ofs;
613 for (j = 0; j <
len; j++) {
615 ptr[j] =
clip23(ptr[j] + x);
623 int xch_base,
int *sub_pos,
int *lfe_pos)
626 int n, ssf, ofs, ch, band;
630 if (*sub_pos + nsamples >
s->npcmblocks) {
639 for (ch = xch_base; ch <
s->nchannels; ch++) {
642 for (band =
s->subband_vq_start[ch]; band < s->nsubbands[ch]; band++)
646 if (
s->subband_vq_start[ch] <
s->nsubbands[ch]) {
647 s->dcadsp->decode_hf(
s->subband_samples[ch], vq_index,
649 s->subband_vq_start[ch],
s->nsubbands[ch],
659 int nlfesamples = 2 *
s->lfe_present *
s->nsubsubframes[sf];
679 for (n = 0, ofs = *lfe_pos; n < nlfesamples; n++, ofs++)
687 for (ssf = 0, ofs = *sub_pos; ssf <
s->nsubsubframes[sf]; ssf++) {
688 for (ch = xch_base; ch <
s->nchannels; ch++) {
693 for (band = 0; band <
s->subband_vq_start[ch]; band++) {
694 int ret, trans_ssf, abits =
s->bit_allocation[ch][band];
703 if (
s->bit_rate == 3)
709 trans_ssf =
s->transition_mode[sf][ch][band];
712 if (trans_ssf == 0 || ssf < trans_ssf)
713 scale =
s->scale_factors[ch][band][0];
715 scale =
s->scale_factors[ch][band][1];
719 int64_t adj =
s->scale_factor_adj[ch][abits - 1];
729 if ((ssf ==
s->nsubsubframes[sf] - 1 ||
s->sync_ssf) &&
get_bits(&
s->gb, 16) != 0xffff) {
738 for (ch = xch_base; ch <
s->nchannels; ch++) {
740 s->prediction_mode[ch], 0,
s->nsubbands[ch],
745 for (ch = xch_base; ch <
s->nchannels; ch++) {
746 int src_ch =
s->joint_intensity_index[ch] - 1;
748 s->dcadsp->decode_joint(
s->subband_samples[ch],
s->subband_samples[src_ch],
749 s->joint_scale_factors[ch],
s->nsubbands[ch],
750 s->nsubbands[src_ch], *sub_pos, nsamples);
777 unsigned int size =
s->subband_size;
782 (nframesamples + nlfesamples) *
sizeof(
int32_t));
783 if (!
s->subband_buffer)
786 if (
size !=
s->subband_size) {
789 s->subband_samples[ch][band] =
s->subband_buffer +
791 s->lfe_samples =
s->subband_buffer + nframesamples;
794 if (!
s->predictor_history)
802 int sf, ch,
ret, band, sub_pos, lfe_pos;
807 for (sf = 0, sub_pos = 0, lfe_pos =
DCA_LFE_HISTORY; sf <
s->nsubframes; sf++) {
814 for (ch = xch_base; ch <
s->nchannels; ch++) {
816 int nsubbands =
s->nsubbands[ch];
817 if (
s->joint_intensity_index[ch])
818 nsubbands =
FFMAX(nsubbands,
s->nsubbands[
s->joint_intensity_index[ch] - 1]);
821 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);
1285 unsigned int size =
s->x96_subband_size;
1290 nframesamples *
sizeof(
int32_t));
1291 if (!
s->x96_subband_buffer)
1294 if (
size !=
s->x96_subband_size) {
1297 s->x96_subband_samples[ch][band] =
s->x96_subband_buffer +
1301 if (!
s->predictor_history)
1315 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1316 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++)
1320 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1321 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++)
1322 if (
s->prediction_mode[ch][band])
1323 s->prediction_vq_index[ch][band] =
get_bits(&
s->gb, 12);
1326 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1327 int sel =
s->bit_allocation_sel[ch];
1330 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1335 abits =
get_bits(&
s->gb, 3 +
s->x96_high_res);
1337 if (abits < 0 || abits > 7 + 8 *
s->x96_high_res) {
1342 s->bit_allocation[ch][band] = abits;
1347 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1348 int sel =
s->scale_factor_sel[ch];
1349 int scale_index = 0;
1353 for (band =
s->x96_subband_start; band < s->nsubbands[ch]; band++) {
1356 s->scale_factors[ch][band >> 1][band & 1] =
ret;
1361 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1362 if (
s->joint_intensity_index[ch]) {
1363 s->joint_scale_sel[ch] =
get_bits(&
s->gb, 3);
1364 if (
s->joint_scale_sel[ch] == 7) {
1372 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1373 int src_ch =
s->joint_intensity_index[ch] - 1;
1375 int sel =
s->joint_scale_sel[ch];
1376 for (band =
s->nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
1379 s->joint_scale_factors[ch][band] =
ret;
1403 if (
s->x96_crc_present
1414 if (
s->x96_rev_no < 8) {
1416 if (
s->x96_subband_start > 27) {
1417 av_log(
s->avctx,
AV_LOG_ERROR,
"Invalid X96 subband start index (%d)\n",
s->x96_subband_start);
1425 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1434 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1435 if ((n =
get_bits(&
s->gb, 3)) && xch_base)
1437 if (n >
s->x96_nchannels) {
1441 s->joint_intensity_index[ch] = n;
1445 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1446 s->scale_factor_sel[ch] =
get_bits(&
s->gb, 3);
1447 if (
s->scale_factor_sel[ch] >= 6) {
1454 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1455 s->bit_allocation_sel[ch] =
get_bits(&
s->gb, 3);
1458 for (n = 0; n < 6 + 4 *
s->x96_high_res; n++)
1459 for (ch = xch_base; ch <
s->x96_nchannels; ch++)
1480 int sf, ch,
ret, band, sub_pos;
1485 for (sf = 0, sub_pos = 0; sf <
s->nsubframes; sf++) {
1492 for (ch = xch_base; ch <
s->x96_nchannels; ch++) {
1494 int nsubbands =
s->nsubbands[ch];
1495 if (
s->joint_intensity_index[ch])
1496 nsubbands =
FFMAX(nsubbands,
s->nsubbands[
s->joint_intensity_index[ch] - 1]);
1501 if (band >=
s->x96_subband_start && band < nsubbands)
1519 if (
s->x96_rev_no < 1 ||
s->x96_rev_no > 8) {
1524 s->x96_crc_present = 0;
1525 s->x96_nchannels =
s->nchannels;
1546 int x96_nchsets, x96_base_ch;
1559 if (
ff_dca_check_crc(
s->avctx, &
s->gb, header_pos + 32, header_pos + header_size * 8)) {
1566 if (
s->x96_rev_no < 1 ||
s->x96_rev_no > 8) {
1578 for (
i = 0;
i < x96_nchsets;
i++)
1579 x96_frame_size[
i] =
get_bits(&
s->gb, 12) + 1;
1582 for (
i = 0;
i < x96_nchsets;
i++)
1597 s->x96_nchannels = 0;
1598 for (
i = 0, x96_base_ch = 0;
i < x96_nchsets;
i++) {
1601 if (x96_base_ch + x96_nchannels[
i] <=
s->nchannels) {
1602 s->x96_nchannels = x96_base_ch + x96_nchannels[
i];
1607 x96_base_ch += x96_nchannels[
i];
1659 for (
i = 0;
i < m * n;
i++) {
1661 int sign = (
code >> 8) - 1;
1701 s->prim_dmix_embedded = 0;
1704 if (
s->ext_audio_present && !dca->
core_only) {
1705 int sync_pos =
FFMIN(
s->frame_size / 4,
s->gb.size_in_bits / 32) - 1;
1708 uint32_t w1, w2 = 0;
1713 switch (
s->ext_audio_type) {
1723 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1724 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1726 size = (w2 >> 22) + 1;
1727 dist =
s->frame_size - sync_pos * 4;
1729 && (
size == dist ||
size - 1 == dist)
1730 && (w2 >> 15 & 0x7f) == 0x08) {
1731 s->xch_pos = sync_pos * 32 + 49;
1748 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1749 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1751 size = (w2 >> 20) + 1;
1752 dist =
s->frame_size - sync_pos * 4;
1754 s->x96_pos = sync_pos * 32 + 44;
1773 for (; sync_pos >= last_pos; sync_pos--, w2 = w1) {
1774 w1 =
AV_RB32(
s->gb.buffer + sync_pos * 4);
1776 size = (w2 >> 26) + 1;
1777 dist =
s->gb.size_in_bits / 8 - sync_pos * 4;
1780 (sync_pos + 1) * 4,
size - 4)) {
1781 s->xxch_pos = sync_pos * 32;
1803 s->ext_audio_mask = 0;
1804 s->xch_pos =
s->xxch_pos =
s->x96_pos = 0;
1820 if (
s->frame_size >
size)
1821 s->frame_size =
size;
1837 int ret = 0, ext = 0;
1846 }
else if (
s->xxch_pos) {
1851 }
else if (
s->xch_pos) {
1867 s->ext_audio_mask |= ext;
1894 }
else if (
s->x96_pos) {
1918 if (
s->xxch_core_mask & (1
U << spkr))
1936 if (
s->xxch_spkr_mask & (1
U << spkr))
1947 memset(
s->dcadsp_data, 0,
sizeof(
s->dcadsp_data));
1948 s->output_history_lfe_fixed = 0;
1949 s->output_history_lfe_float = 0;
1954 if (
s->filter_mode !=
mode) {
1956 s->filter_mode =
mode;
1962 int n, ch, spkr, nsamples, x96_nchannels = 0;
1971 x96_nchannels =
s->x96_nchannels;
1977 s->output_rate =
s->sample_rate << x96_synth;
1983 if (!
s->output_buffer)
1988 if (
s->ch_mask & (1
U << spkr)) {
1989 s->output_samples[spkr] = ptr;
1992 s->output_samples[spkr] =
NULL;
2002 else if (
s->filter_perfect)
2008 for (ch = 0; ch <
s->nchannels; ch++) {
2015 s->dcadsp->sub_qmf_fixed[x96_synth](
2018 s->output_samples[spkr],
2019 s->subband_samples[ch],
2020 ch < x96_nchannels ?
s->x96_subband_samples[ch] :
NULL,
2021 s->dcadsp_data[ch].u.fix.hist1,
2022 &
s->dcadsp_data[ch].offset,
2023 s->dcadsp_data[ch].u.fix.hist2,
2029 if (
s->lfe_present) {
2031 int nlfesamples =
s->npcmblocks >> 1;
2051 samples, &
s->output_history_lfe_fixed,
2058 s->lfe_samples[n] =
s->lfe_samples[nlfesamples + n];
2068 int i, n, ch,
ret, spkr, nsamples;
2078 frame->nb_samples = nsamples =
s->npcmsamples;
2094 &&
s->xxch_dmix_embedded) {
2095 int scale_inv =
s->xxch_dmix_scale_inv;
2096 int *coeff_ptr =
s->xxch_dmix_coeff;
2101 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2102 if (
s->xxch_core_mask & (1
U << spkr)) {
2103 s->dcadsp->dmix_scale_inv(
s->output_samples[spkr],
2104 scale_inv, nsamples);
2109 for (ch = xch_base; ch <
s->nchannels; ch++) {
2113 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2114 if (
s->xxch_dmix_mask[ch - xch_base] & (1
U << spkr)) {
2117 s->dcadsp->dmix_sub(
s->output_samples[spkr ],
2118 s->output_samples[src_spkr],
2144 if (
s->request_mask !=
s->ch_mask) {
2148 nsamples,
s->ch_mask);
2154 for (n = 0; n < nsamples; n++)
2164 int x96_nchannels = 0, x96_synth = 0;
2165 int i, n, ch,
ret, spkr, nsamples, nchannels;
2167 const float *filter_coeff;
2170 x96_nchannels =
s->x96_nchannels;
2184 output_samples[
s->ch_remap[
i]] = (
float *)
frame->extended_data[
i];
2188 if (nchannels > 0) {
2190 nsamples * nchannels *
sizeof(
float));
2191 if (!
s->output_buffer)
2194 ptr = (
float *)
s->output_buffer;
2196 if (!(
s->ch_mask & (1
U << spkr)))
2198 if (output_samples[spkr])
2200 output_samples[spkr] = ptr;
2211 else if (
s->filter_perfect)
2217 for (ch = 0; ch <
s->nchannels; ch++) {
2224 s->dcadsp->sub_qmf_float[x96_synth](
2226 &
s->imdct[x96_synth],
2227 output_samples[spkr],
2228 s->subband_samples[ch],
2229 ch < x96_nchannels ?
s->x96_subband_samples[ch] :
NULL,
2230 s->dcadsp_data[ch].u.flt.hist1,
2231 &
s->dcadsp_data[ch].offset,
2232 s->dcadsp_data[ch].u.flt.hist2,
2235 1.0f / (1 << (17 - x96_synth)));
2239 if (
s->lfe_present) {
2242 int nlfesamples =
s->npcmblocks >> (dec_select + 1);
2255 s->dcadsp->lfe_fir_float[dec_select](
2257 filter_coeff,
s->npcmblocks);
2263 samples, &
s->output_history_lfe_float,
2269 s->lfe_samples[n] =
s->lfe_samples[nlfesamples + n];
2285 &&
s->xxch_dmix_embedded) {
2286 float scale_inv =
s->xxch_dmix_scale_inv * (1.0f / (1 << 16));
2287 int *coeff_ptr =
s->xxch_dmix_coeff;
2292 for (ch = xch_base; ch <
s->nchannels; ch++) {
2296 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2297 if (
s->xxch_dmix_mask[ch - xch_base] & (1
U << spkr)) {
2298 int coeff = *coeff_ptr++;
2300 s->float_dsp->vector_fmac_scalar(output_samples[ spkr],
2301 output_samples[src_spkr],
2302 coeff * (-1.0
f / (1 << 15)),
2310 for (spkr = 0; spkr <
s->xxch_mask_nbits; spkr++) {
2311 if (
s->xxch_core_mask & (1
U << spkr)) {
2312 s->float_dsp->vector_fmul_scalar(output_samples[spkr],
2313 output_samples[spkr],
2314 scale_inv, nsamples);
2337 if (
s->request_mask !=
s->ch_mask) {
2340 nsamples,
s->ch_mask);
2361 s->request_mask =
s->ch_mask;
2402 if (
s->subband_buffer) {
2407 if (
s->x96_subband_buffer)
2440 s->subband_size = 0;
2443 s->x96_subband_size = 0;