Go to the documentation of this file.
   31     return (v >> 1) ^ -(v & 1);
 
   43     return (v >> 1) ^ -(v & 1);
 
   76     int i, j, *coeff_ptr = 
c->dmix_coeff;
 
   78     for (
i = 0; 
i < m; 
i++) {
 
   83         if (!
c->primary_chset) {
 
   85             sign = (
code >> 8) - 1;
 
   93             c->dmix_scale[
i] = (
scale ^ sign) - sign;
 
   94             c->dmix_scale_inv[
i] = (scale_inv ^ sign) - sign;
 
   98         for (j = 0; j < 
c->nchannels; j++) {
 
  100             sign = (
code >> 8) - 1;
 
  107             if (!
c->primary_chset)
 
  110             *coeff_ptr++ = (
coeff ^ sign) - sign;
 
  140     c->residual_encode = 
get_bits(&
s->gb, 
c->nchannels);
 
  147     if (
c->storage_bit_res != 16 && 
c->storage_bit_res != 20 && 
c->storage_bit_res != 24) {
 
  152     if (
c->pcm_bit_res > 
c->storage_bit_res) {
 
  153         av_log(
s->avctx, 
AV_LOG_ERROR, 
"Invalid PCM bit resolution for XLL channel set (%d > %d)\n", 
c->pcm_bit_res, 
c->storage_bit_res);
 
  159     if (
c->freq > 192000) {
 
  179         if (
c->primary_chset != (
c == p)) {
 
  188         c->dmix_embedded = 
c->dmix_coeffs_present && 
get_bits1(&
s->gb);
 
  191         if (
c->dmix_coeffs_present && 
c->primary_chset) {
 
  201         if (!
c->hier_chset && 
s->nchsets != 1) {
 
  224         for (
i = 0, j = 0; 
i < 
s->ch_mask_nbits; 
i++)
 
  225             if (
c->ch_mask & (1
U << 
i))
 
  226                 c->ch_remap[j++] = 
i;
 
  229         if (
c->nchannels != 2 || 
s->nchsets != 1 || 
get_bits1(&
s->gb)) {
 
  235         c->primary_chset = 1;
 
  236         c->dmix_coeffs_present = 0;
 
  237         c->dmix_embedded = 0;
 
  244     if (
c->freq > 96000) {
 
  257     c->freq >>= 
c->nfreqbands - 1;
 
  268     if (
c->storage_bit_res > 16)
 
  270     else if (
c->storage_bit_res > 8)
 
  276     if ((
s->nchsets > 1 || 
c->nfreqbands > 1) && 
c->nabits < 5)
 
  279     for (band = 0, 
b = 
c->bands; band < c->nfreqbands; band++, 
b++) {
 
  281         if ((
b->decor_enabled = 
get_bits1(&
s->gb)) && 
c->nchannels > 1) {
 
  285             for (
i = 0; 
i < 
c->nchannels; 
i++) {
 
  287                 if (
b->orig_order[
i] >= 
c->nchannels) {
 
  294             for (
i = 0; 
i < 
c->nchannels / 2; 
i++)
 
  297             for (
i = 0; 
i < 
c->nchannels; 
i++)
 
  298                 b->orig_order[
i] = 
i;
 
  299             for (
i = 0; 
i < 
c->nchannels / 2; 
i++)
 
  300                 b->decor_coeff[
i] = 0;
 
  304         b->highest_pred_order = 0;
 
  305         for (
i = 0; 
i < 
c->nchannels; 
i++) {
 
  307             if (
b->adapt_pred_order[
i] > 
b->highest_pred_order)
 
  308                 b->highest_pred_order = 
b->adapt_pred_order[
i];
 
  310         if (
b->highest_pred_order > 
s->nsegsamples) {
 
  316         for (
i = 0; 
i < 
c->nchannels; 
i++)
 
  317             b->fixed_pred_order[
i] = 
b->adapt_pred_order[
i] ? 0 : 
get_bits(&
s->gb, 2);
 
  320         for (
i = 0; 
i < 
c->nchannels; 
i++) {
 
  321             for (j = 0; j < 
b->adapt_pred_order[
i]; j++) {
 
  335         b->dmix_embedded = 
c->dmix_embedded && (band == 0 || 
get_bits1(&
s->gb));
 
  338         if ((band == 0 && 
s->scalable_lsbs) || (band != 0 && 
get_bits1(&
s->gb))) {
 
  341             if (
b->lsb_section_size < 0 || 
b->lsb_section_size > 
s->frame_size) {
 
  347             if (
b->lsb_section_size && (
s->band_crc_present > 2 ||
 
  348                                         (band == 0 && 
s->band_crc_present > 1)))
 
  349                 b->lsb_section_size += 2;
 
  352             for (
i = 0; 
i < 
c->nchannels; 
i++) {
 
  354                 if (
b->nscalablelsbs[
i] && !
b->lsb_section_size) {
 
  360             b->lsb_section_size = 0;
 
  361             for (
i = 0; 
i < 
c->nchannels; 
i++)
 
  362                 b->nscalablelsbs[
i] = 0;
 
  366         if ((band == 0 && 
s->scalable_lsbs) || (band != 0 && 
get_bits1(&
s->gb))) {
 
  368             for (
i = 0; 
i < 
c->nchannels; 
i++)
 
  371             for (
i = 0; 
i < 
c->nchannels; 
i++)
 
  372                 b->bit_width_adjust[
i] = 0;
 
  390     int nchsamples = 
s->nframesamples + ndecisamples;
 
  391     int i, j, nsamples = nchsamples * 
c->nchannels * 
c->nfreqbands;
 
  396     if (!
c->sample_buffer[0])
 
  399     ptr = 
c->sample_buffer[0] + ndecisamples;
 
  400     for (
i = 0; 
i < 
c->nfreqbands; 
i++) {
 
  401         for (j = 0; j < 
c->nchannels; j++) {
 
  402             c->bands[
i].msb_sample_buffer[j] = ptr;
 
  412     int i, j, nsamples = 0;
 
  416     for (
i = 0; 
i < 
c->nfreqbands; 
i++)
 
  417         if (
c->bands[
i].lsb_section_size)
 
  418             nsamples += 
s->nframesamples * 
c->nchannels;
 
  424     if (!
c->sample_buffer[1])
 
  427     ptr = 
c->sample_buffer[1];
 
  428     for (
i = 0; 
i < 
c->nfreqbands; 
i++) {
 
  429         if (
c->bands[
i].lsb_section_size) {
 
  430             for (j = 0; j < 
c->nchannels; j++) {
 
  431                 c->bands[
i].lsb_sample_buffer[j] = ptr;
 
  432                 ptr += 
s->nframesamples;
 
  435             for (j = 0; j < 
c->nchannels; j++)
 
  436                 c->bands[
i].lsb_sample_buffer[j] = 
NULL;
 
  456         k = 
c->seg_common ? 1 : 
c->nchannels;
 
  459         for (
i = 0; 
i < k; 
i++) {
 
  465             if (!
c->seg_common && 
c->rice_code_flag[
i] && 
get_bits1(&
s->gb))
 
  467                 c->bitalloc_hybrid_linear[
i] = 
get_bits(&
s->gb, 
c->nabits) + 1;
 
  470                 c->bitalloc_hybrid_linear[
i] = 0;
 
  474         for (
i = 0; 
i < k; 
i++) {
 
  480                 if (!
c->rice_code_flag[
i] && 
c->bitalloc_part_a[
i])
 
  481                     c->bitalloc_part_a[
i]++;
 
  484                     c->nsamples_part_a[
i] = 
b->adapt_pred_order[
i];
 
  486                     c->nsamples_part_a[
i] = 
b->highest_pred_order;
 
  488                 c->bitalloc_part_a[
i] = 0;
 
  489                 c->nsamples_part_a[
i] = 0;
 
  496             if (!
c->rice_code_flag[
i] && 
c->bitalloc_part_b[
i])
 
  497                 c->bitalloc_part_b[
i]++;
 
  502     for (
i = 0; 
i < 
c->nchannels; 
i++) {
 
  507         k = 
c->seg_common ? 0 : 
i;
 
  510         part_a = 
b->msb_sample_buffer[
i] + seg * 
s->nsegsamples;
 
  511         part_b = part_a + 
c->nsamples_part_a[k];
 
  512         nsamples_part_b = 
s->nsegsamples - 
c->nsamples_part_a[k];
 
  517         if (!
c->rice_code_flag[k]) {
 
  521                              c->bitalloc_part_a[k]);
 
  525                              c->bitalloc_part_b[k]);
 
  530                            c->bitalloc_part_a[k]);
 
  532             if (
c->bitalloc_hybrid_linear[k]) {
 
  535                 int nisosamples = 
get_bits(&
s->gb, 
s->nsegsamples_log2);
 
  538                 memset(part_b, 0, 
sizeof(*part_b) * nsamples_part_b);
 
  541                 for (j = 0; j < nisosamples; j++) {
 
  542                     int loc = 
get_bits(&
s->gb, 
s->nsegsamples_log2);
 
  543                     if (loc >= nsamples_part_b) {
 
  551                 for (j = 0; j < nsamples_part_b; j++) {
 
  553                         part_b[j] = 
get_linear(&
s->gb, 
c->bitalloc_hybrid_linear[k]);
 
  555                         part_b[j] = 
get_rice(&
s->gb, 
c->bitalloc_part_b[k]);
 
  566     if (seg == 0 && band == 1) {
 
  568         for (
i = 0; 
i < 
c->nchannels; 
i++)
 
  574     if (
b->lsb_section_size) {
 
  582         for (
i = 0; 
i < 
c->nchannels; 
i++) {
 
  583             if (
b->nscalablelsbs[
i]) {
 
  585                           b->lsb_sample_buffer[
i] + seg * 
s->nsegsamples,
 
  586                           s->nsegsamples, 
b->nscalablelsbs[
i]);
 
  607         nsamples = 
s->nframesamples;
 
  610         nsamples = 
s->nsegsamples;
 
  613     for (
i = 0; 
i < 
c->nchannels; 
i++) {
 
  614         memset(
b->msb_sample_buffer[
i] + 
offset, 0, nsamples * 
sizeof(
int32_t));
 
  615         if (
b->lsb_section_size)
 
  616             memset(
b->lsb_sample_buffer[
i] + 
offset, 0, nsamples * 
sizeof(
int32_t));
 
  619     if (seg <= 0 && band)
 
  620         memset(
c->deci_history, 0, 
sizeof(
c->deci_history));
 
  623         memset(
b->nscalablelsbs, 0, 
sizeof(
b->nscalablelsbs));
 
  624         memset(
b->bit_width_adjust, 0, 
sizeof(
b->bit_width_adjust));
 
  631     int nsamples = 
s->nframesamples;
 
  635     for (
i = 0; 
i < 
c->nchannels; 
i++) {
 
  637         int order = 
b->adapt_pred_order[
i];
 
  641             for (j = 0; j < order; j++) {
 
  642                 int rc = 
b->adapt_refl_coeff[
i][j];
 
  643                 for (k = 0; k < (j + 1) / 2; k++) {
 
  644                     int tmp1 = 
coeff[    k    ];
 
  645                     int tmp2 = 
coeff[j - k - 1];
 
  652             for (j = 0; j < nsamples - order; j++) {
 
  654                 for (k = 0; k < order; k++)
 
  655                     err += (int64_t)buf[j + k] * 
coeff[order - k - 1];
 
  660             for (j = 0; j < 
b->fixed_pred_order[
i]; j++)
 
  661                 for (k = 1; k < nsamples; k++)
 
  662                     buf[k] += (
unsigned)buf[k - 1];
 
  667     if (
b->decor_enabled) {
 
  670         for (
i = 0; 
i < 
c->nchannels / 2; 
i++) {
 
  673                 s->dcadsp->decor(
b->msb_sample_buffer[
i * 2 + 1],
 
  674                                  b->msb_sample_buffer[
i * 2    ],
 
  680         for (
i = 0; 
i < 
c->nchannels; 
i++)
 
  681             tmp[
i] = 
b->msb_sample_buffer[
i];
 
  683         for (
i = 0; 
i < 
c->nchannels; 
i++)
 
  684             b->msb_sample_buffer[
b->orig_order[
i]] = 
tmp[
i];
 
  688     if (
c->nfreqbands == 1)
 
  689         for (
i = 0; 
i < 
c->nchannels; 
i++)
 
  690             s->output_samples[
c->ch_remap[
i]] = 
b->msb_sample_buffer[
i];
 
  695     int adj = 
c->bands[band].bit_width_adjust[ch];
 
  696     int shift = 
c->bands[band].nscalablelsbs[ch];
 
  698     if (
s->fixed_lsb_width)
 
  699         shift = 
s->fixed_lsb_width;
 
  700     else if (
shift && adj)
 
  711     int n, ch, nsamples = 
s->nframesamples;
 
  713     for (ch = 0; ch < 
c->nchannels; ch++) {
 
  716             int32_t *msb = 
b->msb_sample_buffer[ch];
 
  717             if (
b->nscalablelsbs[ch]) {
 
  718                 int32_t *lsb = 
b->lsb_sample_buffer[ch];
 
  719                 int adj = 
b->bit_width_adjust[ch];
 
  720                 for (n = 0; n < nsamples; n++)
 
  721                     msb[n] = msb[n] * (
SUINT)(1 << 
shift) + (lsb[n] << adj);
 
  723                 for (n = 0; n < nsamples; n++)
 
  732     int ch, nsamples = 
s->nframesamples;
 
  739                    2 * nsamples * 
c->nchannels * 
sizeof(
int32_t));
 
  740     if (!
c->sample_buffer[2])
 
  744     ptr = 
c->sample_buffer[2];
 
  745     for (ch = 0; ch < 
c->nchannels; ch++) {
 
  746         int32_t *band0 = 
c->bands[0].msb_sample_buffer[ch];
 
  747         int32_t *band1 = 
c->bands[1].msb_sample_buffer[ch];
 
  751                c->deci_history[ch], 
sizeof(
c->deci_history[0]));
 
  754         s->dcadsp->assemble_freq_bands(ptr, band0, band1,
 
  759         s->output_samples[
c->ch_remap[ch]] = ptr;
 
  768     int stream_ver, header_size, frame_size_nbits, nframesegs_log2;
 
  778     if (stream_ver > 1) {
 
  793     frame_size_nbits = 
get_bits(&
s->gb, 5) + 1;
 
  812     s->nframesegs = 1 << nframesegs_log2;
 
  813     if (
s->nframesegs > 1024) {
 
  822     if (!
s->nsegsamples_log2) {
 
  826     s->nsegsamples = 1 << 
s->nsegsamples_log2;
 
  827     if (
s->nsegsamples > 512) {
 
  833     s->nframesamples_log2 = 
s->nsegsamples_log2 + nframesegs_log2;
 
  834     s->nframesamples = 1 << 
s->nframesamples_log2;
 
  835     if (
s->nframesamples > 65536) {
 
  857     if (
s->scalable_lsbs)
 
  860         s->fixed_lsb_width = 0;
 
  875     return !
c->primary_chset && 
c->dmix_embedded && 
c->hier_chset;
 
  881         while (++c < &s->chset[
s->nchsets])
 
  890     int i, j, *coeff_ptr = 
c->dmix_coeff;
 
  892     for (
i = 0; 
i < 
c->hier_ofs; 
i++) {
 
  896         c->dmix_scale_inv[
i] = 
mul16(
c->dmix_scale_inv[
i], scale_inv);
 
  897         for (j = 0; j < 
c->nchannels; j++) {
 
  914     for (
i = 0, 
c = 
s->chset; i < s->nchsets; 
i++, 
c++) {
 
  915         c->hier_ofs = 
s->nchannels;
 
  918         if (
c->nfreqbands > 
s->nfreqbands)
 
  919             s->nfreqbands = 
c->nfreqbands;
 
  921             s->nchannels += 
c->nchannels;
 
  922         if (
c->residual_encode != (1 << 
c->nchannels) - 1)
 
  927     for (
i = 
s->nchsets - 1, 
c = &
s->chset[
i]; 
i > 0; 
i--, 
c--) {
 
  938         s->nactivechsets = 1;
 
  942         s->nactivechsets = (
s->chset[0].nchannels < 5 && 
s->nchsets > 1) ? 2 : 1;
 
  945         s->nactivechsets = 
s->nchsets;
 
  954     int chs, seg, band, navi_nb, navi_pos, *navi_ptr;
 
  958     navi_nb = 
s->nfreqbands * 
s->nframesegs * 
s->nchsets;
 
  959     if (navi_nb > 1024) {
 
  972     for (band = 0; band < 
s->nfreqbands; band++) {
 
  973         for (seg = 0; seg < 
s->nframesegs; seg++) {
 
  974             for (chs = 0, 
c = 
s->chset; chs < s->nchsets; chs++, 
c++) {
 
  976                 if (
c->nfreqbands > band) {
 
  978                     if (size < 0 || size >= 
s->frame_size) {
 
 1005     int ret, chs, seg, band, navi_pos, *navi_ptr;
 
 1008     for (chs = 0, 
c = 
s->chset; chs < s->nactivechsets; chs++, 
c++) {
 
 1017     for (band = 0; band < 
s->nfreqbands; band++) {
 
 1018         for (seg = 0; seg < 
s->nframesegs; seg++) {
 
 1019             for (chs = 0, 
c = 
s->chset; chs < s->nchsets; chs++, 
c++) {
 
 1020                 if (
c->nfreqbands > band) {
 
 1021                     navi_pos += *navi_ptr * 8;
 
 1022                     if (navi_pos > 
s->gb.size_in_bits) {
 
 1026                     if (chs < s->nactivechsets &&
 
 1078     s->pbr_length = 
size;
 
 1079     s->pbr_delay = delay;
 
 1110     if (
s->frame_size > 
size)
 
 1114     if (
s->frame_size < 
size)
 
 1130     memcpy(
s->pbr_buffer + 
s->pbr_length, 
data, 
size);
 
 1131     s->pbr_length += 
size;
 
 1134     if (
s->pbr_delay > 0 && --
s->pbr_delay)
 
 1140     if (
s->frame_size > 
s->pbr_length) {
 
 1145     if (
s->frame_size == 
s->pbr_length) {
 
 1149         s->pbr_length -= 
s->frame_size;
 
 1150         memmove(
s->pbr_buffer, 
s->pbr_buffer + 
s->frame_size, 
s->pbr_length);
 
 1181     int i, j, k, nchannels = 0, *coeff_ptr = o->
dmix_coeff;
 
 1184     for (
i = 0, 
c = 
s->chset; i < s->nactivechsets; 
i++, 
c++) {
 
 1189         for (j = 0; j < 
c->nchannels; j++) {
 
 1191                 int coeff = *coeff_ptr++;
 
 1193                     s->dcadsp->dmix_sub(
c->bands[band].msb_sample_buffer[j],
 
 1195                                         coeff, 
s->nframesamples);
 
 1197                         s->dcadsp->dmix_sub(
c->deci_history[j],
 
 1204         nchannels += 
c->nchannels;
 
 1212     int i, j, nchannels = 0;
 
 1215     for (
i = 0, 
c = 
s->chset; i < s->nactivechsets; 
i++, 
c++) {
 
 1220         for (j = 0; j < 
c->nchannels; j++) {
 
 1222             if (
scale != (1 << 15)) {
 
 1223                 s->dcadsp->dmix_scale(
c->bands[band].msb_sample_buffer[j],
 
 1224                                       scale, 
s->nframesamples);
 
 1226                     s->dcadsp->dmix_scale(
c->deci_history[j],
 
 1243     for (band = 0; band < 
c->nfreqbands; band++)
 
 1246     for (ch = 0; ch < 
c->nchannels; ch++) {
 
 1247         if (!(
c->residual_encode & (1 << ch)))
 
 1251         c->residual_encode &= ~(1 << ch);
 
 1258     int ch, nsamples = 
s->nframesamples;
 
 1283     for (ch = 0; ch < 
c->nchannels; ch++) {
 
 1287         if (
c->residual_encode & (1 << ch))
 
 1293             av_log(
s->avctx, 
AV_LOG_WARNING, 
"Residual encoded channel (%d) references unavailable core channel\n", 
c->ch_remap[ch]);
 
 1307         dst = 
c->bands[0].msb_sample_buffer[ch];
 
 1311             for (n = 0; n < nsamples; n++)
 
 1315             for (n = 0; n < nsamples; n++)
 
 1330     int i, j, k, 
ret, 
shift, nsamples, request_mask;
 
 1335         for (
i = 0, 
c = 
s->chset; i < s->nchsets; 
i++, 
c++) {
 
 1336             if (i < s->nactivechsets)
 
 1339             if (!
c->primary_chset)
 
 1340                 c->dmix_embedded = 0;
 
 1343         s->scalable_lsbs = 0;
 
 1344         s->fixed_lsb_width = 0;
 
 1349     for (
i = 0, 
c = 
s->chset; i < s->nactivechsets; 
i++, 
c++) {
 
 1352         if (
c->residual_encode != (1 << 
c->nchannels) - 1
 
 1356         if (
s->scalable_lsbs)
 
 1359         if (
c->nfreqbands > 1) {
 
 1364         s->output_mask |= 
c->ch_mask;
 
 1368     for (
i = 1, 
c = &
s->chset[1]; i < s->nchsets; 
i++, 
c++) {
 
 1372         if (
i >= 
s->nactivechsets) {
 
 1373             for (j = 0; j < 
c->nfreqbands; j++)
 
 1374                 if (
c->bands[j].dmix_embedded)
 
 1379         for (j = 0; j < 
c->nfreqbands; j++)
 
 1380             if (
c->bands[j].dmix_embedded)
 
 1385     if (
s->nfreqbands > 1) {
 
 1386         for (
i = 0; 
i < 
s->nactivechsets; 
i++)
 
 1410         request_mask = 
s->output_mask;
 
 1434     frame->nb_samples = nsamples = 
s->nframesamples << (
s->nfreqbands - 1);
 
 1439     if (request_mask != 
s->output_mask) {
 
 1448             int16_t *plane = (int16_t *)
frame->extended_data[
i];
 
 1449             for (k = 0; k < nsamples; k++)
 
 1453             for (k = 0; k < nsamples; k++)
 
 1485             c->sample_size[j] = 0;
 
  
static DCAXllChSet * find_next_hier_dmix_chset(DCAXllDecoder *s, DCAXllChSet *c)
 
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
 
#define AV_LOG_WARNING
Something somehow does not look correct.
 
static int get_bits_left(GetBitContext *gb)
 
static int parse_dmix_coeffs(DCAXllDecoder *s, DCAXllChSet *c)
 
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
 
#define DCA_XLL_DECI_HISTORY_MAX
 
int sample_rate
samples per second
 
static int32_t norm16(int64_t a)
 
#define DCA_SPEAKER_LAYOUT_5POINT0
 
int npcmsamples
Number of PCM samples per channel.
 
static int32_t mul15(int32_t a, int32_t b)
 
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
 
static int chs_assemble_freq_bands(DCAXllDecoder *s, DCAXllChSet *c)
 
static void get_array(GetBitContext *gb, int32_t *array, int size, int n)
 
static int get_bits_count(const GetBitContext *s)
 
static void scale_down_mix(DCAXllDecoder *s, DCAXllChSet *o, int band)
 
int ff_dca_xll_parse(DCAXllDecoder *s, uint8_t *data, DCAExssAsset *asset)
 
This structure describes decoded (raw) audio or video data.
 
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
 
#define DCA_SPEAKER_LAYOUT_STEREO
 
static int is_hier_dmix_chset(DCAXllChSet *c)
 
int request_channel_layout
Converted from avctx.request_channel_layout.
 
static int ff_dca_seek_bits(GetBitContext *s, int p)
 
#define AV_LOG_VERBOSE
Detailed information.
 
int xll_size
Size of XLL data in extension substream.
 
static void chs_assemble_msbs_lsbs(DCAXllDecoder *s, DCAXllChSet *c, int band)
 
static int ff_dca_check_crc(AVCodecContext *avctx, GetBitContext *s, int p1, int p2)
 
int hier_ofs
Number of preceding channels in a hierarchy (M)
 
#define FF_DCA_DMIXTABLE_OFFSET
 
int one_to_one_map_ch_to_spkr
One to one channel to speaker mapping flag.
 
static int parse_navi_table(DCAXllDecoder *s)
 
#define DCA_XLL_PBR_BUFFER_MAX
 
#define DCA_PACKET_RECOVERY
Sync error recovery flag.
 
static void skip_bits(GetBitContext *s, int n)
 
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
 
static void undo_down_mix(DCAXllDecoder *s, DCAXllChSet *o, int band)
 
int dmix_coeff[DCA_XLL_DMIX_COEFFS_MAX]
Downmixing coefficients.
 
static av_always_inline float scale(float x, float s)
 
static int parse_common_header(DCAXllDecoder *s)
 
static int chs_alloc_msb_band_data(DCAXllDecoder *s, DCAXllChSet *c)
 
static int32_t clip23(int32_t a)
 
int nchannels
Number of channels in the channel set (N)
 
DCAExssParser exss
EXSS parser context.
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
 
@ AV_MATRIX_ENCODING_DOLBY
 
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
 
int output_rate
Output sample rate (1x or 2x header rate)
 
void ff_dca_downmix_to_stereo_fixed(DCADSPContext *dcadsp, int32_t **samples, int *coeff_l, int nsamples, int ch_mask)
 
#define DCA_XLL_ADAPT_PRED_ORDER_MAX
 
#define DCA_SPEAKER_LAYOUT_5POINT1
 
static int chs_get_lsb_width(DCAXllDecoder *s, DCAXllChSet *c, int band, int ch)
 
const uint16_t ff_dca_xll_refl_coeff[128]
 
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
 
int storage_bit_res
Storage bit resolution (16 or 24)
 
static int32_t mul16(int32_t a, int32_t b)
 
int dmix_type
Primary channel set downmix type.
 
int dmix_embedded
Downmix already performed by encoder.
 
static int parse_frame(DCAXllDecoder *s, uint8_t *data, int size, DCAExssAsset *asset)
 
static int chs_alloc_lsb_band_data(DCAXllDecoder *s, DCAXllChSet *c)
 
int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask)
 
@ AV_MATRIX_ENCODING_DOLBYHEADPHONE
 
static int parse_frame_pbr(DCAXllDecoder *s, uint8_t *data, int size, DCAExssAsset *asset)
 
static void clear_pbr(DCAXllDecoder *s)
 
#define DCA_HAS_STEREO(mask)
 
int32_t * output_samples[DCA_SPEAKER_COUNT]
PCM output for fixed point mode.
 
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
 
const uint8_t ff_dca_dmix_primary_nch[8]
 
int64_t bit_rate
the average bitrate
 
static unsigned int get_bits1(GetBitContext *s)
 
#define DCA_XLL_SAMPLE_BUFFERS_MAX
 
static int get_rice(GetBitContext *gb, int k)
 
static int parse_frame_no_pbr(DCAXllDecoder *s, uint8_t *data, int size, DCAExssAsset *asset)
 
#define AV_EF_EXPLODE
abort decoding on minor error detection
 
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
 
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
 
int xll_offset
Offset to XLL data from start of substream.
 
const uint32_t ff_dca_inv_dmixtable[FF_DCA_INV_DMIXTABLE_SIZE]
 
static int combine_residual_frame(DCAXllDecoder *s, DCAXllChSet *c)
 
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
 
const uint16_t ff_dca_dmixtable[FF_DCA_DMIXTABLE_SIZE]
 
const int32_t ff_dca_xll_band_coeff[20]
 
static int copy_to_pbr(DCAXllDecoder *s, uint8_t *data, int size, int delay)
 
@ AV_MATRIX_ENCODING_NONE
 
enum AVSampleFormat sample_fmt
audio sample format
 
static int chs_parse_band_data(DCAXllDecoder *s, DCAXllChSet *c, int band, int seg, int band_data_end)
 
int xll_delay_nframes
Initial XLL decoding delay in frames.
 
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
 
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
 
int channels
number of audio channels
 
static void chs_filter_band_data(DCAXllDecoder *s, DCAXllChSet *c, int band)
 
#define i(width, name, range_min, range_max)
 
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
 
static av_always_inline av_const double round(double x)
 
#define DCA_XLL_CHANNELS_MAX
 
int32_t * msb_sample_buffer[DCA_XLL_CHANNELS_MAX]
MSB sample buffer pointers.
 
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
 
int pcm_bit_res
PCM bit resolution (variable)
 
int xll_sync_offset
Number of bytes offset to XLL sync.
 
DCAExssAsset assets[1]
Audio asset descriptors.
 
int32_t deci_history[DCA_XLL_CHANNELS_MAX][DCA_XLL_DECI_HISTORY_MAX]
Decimator history for frequency band 1.
 
int ff_dca_xll_filter_frame(DCAXllDecoder *s, AVFrame *frame)
 
static int ff_dca_core_map_spkr(DCACoreDecoder *core, int spkr)
 
int dmix_scale_inv[DCA_XLL_DMIX_SCALES_MAX]
Inverse downmixing scales.
 
static int array[MAX_W *MAX_W]
 
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
 
int nfreqbands
Number of frequency bands (1 or 2)
 
DCAXllBand bands[DCA_XLL_BANDS_MAX]
Frequency bands.
 
#define DCA_XLL_CHSETS_MAX
 
#define AV_INPUT_BUFFER_PADDING_SIZE
 
main external API structure.
 
int xll_sync_present
XLL sync word present flag.
 
#define FF_DCA_DMIXTABLE_SIZE
 
int dmix_scale[DCA_XLL_DMIX_SCALES_MAX]
Downmixing scales.
 
const uint32_t ff_dca_sampling_freqs[16]
 
static int get_rice_un(GetBitContext *gb, int k)
 
#define FF_DCA_INV_DMIXTABLE_SIZE
 
static void prescale_down_mix(DCAXllChSet *c, DCAXllChSet *o)
 
static int chs_parse_header(DCAXllDecoder *s, DCAXllChSet *c, DCAExssAsset *asset)
 
static void get_linear_array(GetBitContext *gb, int32_t *array, int size, int n)
 
Filter the word “frame” indicates either a video frame or a group of audio samples
 
static int parse_sub_headers(DCAXllDecoder *s, DCAExssAsset *asset)
 
int freq
Original sampling frequency (max. 96000 Hz)
 
static int shift(int a, int b)
 
static void get_rice_array(GetBitContext *gb, int32_t *array, int size, int k)
 
int ff_side_data_update_matrix_encoding(AVFrame *frame, enum AVMatrixEncoding matrix_encoding)
Add or update AV_FRAME_DATA_MATRIXENCODING side data.
 
#define avpriv_request_sample(...)
 
#define FF_PROFILE_DTS_HD_MA
 
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
 
av_cold void ff_dca_xll_flush(DCAXllDecoder *s)
 
static av_cold void force_lossy_output(DCAXllDecoder *s, DCAXllChSet *c)
 
DCACoreDecoder core
Core decoder context.
 
static const double coeff[2][5]
 
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
 
static int get_sbits_long(GetBitContext *s, int n)
Read 0-32 bits as a signed integer.
 
static av_cold void chs_clear_band_data(DCAXllDecoder *s, DCAXllChSet *c, int band, int seg)
 
static int get_linear(GetBitContext *gb, int n)
 
int representation_type
Representation type.
 
int hd_stream_id
DTS-HD stream ID.
 
static int parse_band_data(DCAXllDecoder *s)
 
av_cold void ff_dca_xll_close(DCAXllDecoder *s)