30 return (v >> 1) ^ -(v & 1);
42 return (v >> 1) ^ -(v & 1);
79 int i, j, *coeff_ptr =
c->dmix_coeff;
81 for (
i = 0;
i < m;
i++) {
82 int code, sign,
coeff, scale, scale_inv = 0;
86 if (!
c->primary_chset) {
88 sign = (
code >> 8) - 1;
96 c->dmix_scale[
i] = (scale ^ sign) - sign;
97 c->dmix_scale_inv[
i] = (scale_inv ^ sign) - sign;
101 for (j = 0; j <
c->nchannels; j++) {
103 sign = (
code >> 8) - 1;
110 if (!
c->primary_chset)
113 *coeff_ptr++ = (
coeff ^ sign) - sign;
143 c->residual_encode =
get_bits(&
s->gb,
c->nchannels);
150 if (
c->storage_bit_res != 16 &&
c->storage_bit_res != 20 &&
c->storage_bit_res != 24) {
155 if (
c->pcm_bit_res >
c->storage_bit_res) {
156 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);
162 if (
c->freq > 192000) {
182 if (
c->primary_chset != (
c == p)) {
191 c->dmix_embedded =
c->dmix_coeffs_present &&
get_bits1(&
s->gb);
194 if (
c->dmix_coeffs_present &&
c->primary_chset) {
204 if (!
c->hier_chset &&
s->nchsets != 1) {
227 for (
i = 0, j = 0;
i <
s->ch_mask_nbits;
i++)
228 if (
c->ch_mask & (1U <<
i))
229 c->ch_remap[j++] =
i;
232 if (
c->nchannels != 2 ||
s->nchsets != 1 ||
get_bits1(&
s->gb)) {
238 c->primary_chset = 1;
239 c->dmix_coeffs_present = 0;
240 c->dmix_embedded = 0;
247 if (
c->freq > 96000) {
260 c->freq >>=
c->nfreqbands - 1;
271 if (
c->storage_bit_res > 16)
273 else if (
c->storage_bit_res > 8)
279 if ((
s->nchsets > 1 ||
c->nfreqbands > 1) &&
c->nabits < 5)
282 for (band = 0,
b =
c->bands; band < c->nfreqbands; band++,
b++) {
284 if ((
b->decor_enabled =
get_bits1(&
s->gb)) &&
c->nchannels > 1) {
288 for (
i = 0;
i <
c->nchannels;
i++) {
290 if (
b->orig_order[
i] >=
c->nchannels) {
297 for (
i = 0;
i <
c->nchannels / 2;
i++)
300 for (
i = 0;
i <
c->nchannels;
i++)
301 b->orig_order[
i] =
i;
302 for (
i = 0;
i <
c->nchannels / 2;
i++)
303 b->decor_coeff[
i] = 0;
307 b->highest_pred_order = 0;
308 for (
i = 0;
i <
c->nchannels;
i++) {
310 if (
b->adapt_pred_order[
i] >
b->highest_pred_order)
311 b->highest_pred_order =
b->adapt_pred_order[
i];
313 if (
b->highest_pred_order >
s->nsegsamples) {
319 for (
i = 0;
i <
c->nchannels;
i++)
320 b->fixed_pred_order[
i] =
b->adapt_pred_order[
i] ? 0 :
get_bits(&
s->gb, 2);
323 for (
i = 0;
i <
c->nchannels;
i++) {
324 for (j = 0; j <
b->adapt_pred_order[
i]; j++) {
338 b->dmix_embedded =
c->dmix_embedded && (band == 0 ||
get_bits1(&
s->gb));
341 if ((band == 0 &&
s->scalable_lsbs) || (band != 0 &&
get_bits1(&
s->gb))) {
344 if (
b->lsb_section_size < 0 ||
b->lsb_section_size >
s->frame_size) {
350 if (
b->lsb_section_size && (
s->band_crc_present > 2 ||
351 (band == 0 &&
s->band_crc_present > 1)))
352 b->lsb_section_size += 2;
355 for (
i = 0;
i <
c->nchannels;
i++) {
357 if (
b->nscalablelsbs[
i] && !
b->lsb_section_size) {
363 b->lsb_section_size = 0;
364 for (
i = 0;
i <
c->nchannels;
i++)
365 b->nscalablelsbs[
i] = 0;
369 if ((band == 0 &&
s->scalable_lsbs) || (band != 0 &&
get_bits1(&
s->gb))) {
371 for (
i = 0;
i <
c->nchannels;
i++)
374 for (
i = 0;
i <
c->nchannels;
i++)
375 b->bit_width_adjust[
i] = 0;
393 int nchsamples =
s->nframesamples + ndecisamples;
394 int i, j, nsamples = nchsamples *
c->nchannels *
c->nfreqbands;
399 if (!
c->sample_buffer[0])
402 ptr =
c->sample_buffer[0] + ndecisamples;
403 for (
i = 0;
i <
c->nfreqbands;
i++) {
404 for (j = 0; j <
c->nchannels; j++) {
405 c->bands[
i].msb_sample_buffer[j] = ptr;
415 int i, j, nsamples = 0;
419 for (
i = 0;
i <
c->nfreqbands;
i++)
420 if (
c->bands[
i].lsb_section_size)
421 nsamples +=
s->nframesamples *
c->nchannels;
427 if (!
c->sample_buffer[1])
430 ptr =
c->sample_buffer[1];
431 for (
i = 0;
i <
c->nfreqbands;
i++) {
432 if (
c->bands[
i].lsb_section_size) {
433 for (j = 0; j <
c->nchannels; j++) {
434 c->bands[
i].lsb_sample_buffer[j] = ptr;
435 ptr +=
s->nframesamples;
438 for (j = 0; j <
c->nchannels; j++)
439 c->bands[
i].lsb_sample_buffer[j] =
NULL;
459 k =
c->seg_common ? 1 :
c->nchannels;
462 for (
i = 0;
i < k;
i++) {
468 if (!
c->seg_common &&
c->rice_code_flag[
i] &&
get_bits1(&
s->gb))
470 c->bitalloc_hybrid_linear[
i] =
get_bits(&
s->gb,
c->nabits) + 1;
473 c->bitalloc_hybrid_linear[
i] = 0;
477 for (
i = 0;
i < k;
i++) {
483 if (!
c->rice_code_flag[
i] &&
c->bitalloc_part_a[
i])
484 c->bitalloc_part_a[
i]++;
487 c->nsamples_part_a[
i] =
b->adapt_pred_order[
i];
489 c->nsamples_part_a[
i] =
b->highest_pred_order;
491 c->bitalloc_part_a[
i] = 0;
492 c->nsamples_part_a[
i] = 0;
499 if (!
c->rice_code_flag[
i] &&
c->bitalloc_part_b[
i])
500 c->bitalloc_part_b[
i]++;
505 for (
i = 0;
i <
c->nchannels;
i++) {
510 k =
c->seg_common ? 0 :
i;
513 part_a =
b->msb_sample_buffer[
i] + seg *
s->nsegsamples;
514 part_b = part_a +
c->nsamples_part_a[k];
515 nsamples_part_b =
s->nsegsamples -
c->nsamples_part_a[k];
520 if (!
c->rice_code_flag[k]) {
524 c->bitalloc_part_a[k]);
528 c->bitalloc_part_b[k]);
533 c->bitalloc_part_a[k]);
537 if (
c->bitalloc_hybrid_linear[k]) {
540 int nisosamples =
get_bits(&
s->gb,
s->nsegsamples_log2);
543 memset(part_b, 0,
sizeof(*part_b) * nsamples_part_b);
546 for (j = 0; j < nisosamples; j++) {
547 int loc =
get_bits(&
s->gb,
s->nsegsamples_log2);
548 if (loc >= nsamples_part_b) {
556 for (j = 0; j < nsamples_part_b; j++) {
558 part_b[j] =
get_linear(&
s->gb,
c->bitalloc_hybrid_linear[k]);
560 part_b[j] =
get_rice(&
s->gb,
c->bitalloc_part_b[k]);
565 ret =
get_rice_array(&
s->gb, part_b, nsamples_part_b,
c->bitalloc_part_b[k]);
573 if (seg == 0 && band == 1) {
575 for (
i = 0;
i <
c->nchannels;
i++)
581 if (
b->lsb_section_size) {
589 for (
i = 0;
i <
c->nchannels;
i++) {
590 if (
b->nscalablelsbs[
i]) {
592 b->lsb_sample_buffer[
i] + seg *
s->nsegsamples,
593 s->nsegsamples,
b->nscalablelsbs[
i]);
614 nsamples =
s->nframesamples;
617 nsamples =
s->nsegsamples;
620 for (
i = 0;
i <
c->nchannels;
i++) {
621 memset(
b->msb_sample_buffer[
i] +
offset, 0, nsamples *
sizeof(
int32_t));
622 if (
b->lsb_section_size)
623 memset(
b->lsb_sample_buffer[
i] +
offset, 0, nsamples *
sizeof(
int32_t));
626 if (seg <= 0 && band)
627 memset(
c->deci_history, 0,
sizeof(
c->deci_history));
630 memset(
b->nscalablelsbs, 0,
sizeof(
b->nscalablelsbs));
631 memset(
b->bit_width_adjust, 0,
sizeof(
b->bit_width_adjust));
638 int nsamples =
s->nframesamples;
642 for (
i = 0;
i <
c->nchannels;
i++) {
644 int order =
b->adapt_pred_order[
i];
648 for (j = 0; j < order; j++) {
649 int rc =
b->adapt_refl_coeff[
i][j];
650 for (k = 0; k < (j + 1) / 2; k++) {
651 int tmp1 =
coeff[ k ];
652 int tmp2 =
coeff[j - k - 1];
659 for (j = 0; j < nsamples - order; j++) {
661 for (k = 0; k < order; k++)
667 for (j = 0; j <
b->fixed_pred_order[
i]; j++)
668 for (k = 1; k < nsamples; k++)
669 buf[k] += (
unsigned)buf[k - 1];
674 if (
b->decor_enabled) {
677 for (
i = 0;
i <
c->nchannels / 2;
i++) {
680 s->dcadsp->decor(
b->msb_sample_buffer[
i * 2 + 1],
681 b->msb_sample_buffer[
i * 2 ],
687 for (
i = 0;
i <
c->nchannels;
i++)
688 tmp[
i] =
b->msb_sample_buffer[
i];
690 for (
i = 0;
i <
c->nchannels;
i++)
691 b->msb_sample_buffer[
b->orig_order[
i]] =
tmp[
i];
695 if (
c->nfreqbands == 1)
696 for (
i = 0;
i <
c->nchannels;
i++)
697 s->output_samples[
c->ch_remap[
i]] =
b->msb_sample_buffer[
i];
702 int adj =
c->bands[band].bit_width_adjust[ch];
703 int shift =
c->bands[band].nscalablelsbs[ch];
705 if (
s->fixed_lsb_width)
706 shift =
s->fixed_lsb_width;
707 else if (
shift && adj)
718 int n, ch, nsamples =
s->nframesamples;
720 for (ch = 0; ch <
c->nchannels; ch++) {
723 int32_t *msb =
b->msb_sample_buffer[ch];
724 if (
b->nscalablelsbs[ch]) {
725 int32_t *lsb =
b->lsb_sample_buffer[ch];
726 int adj =
b->bit_width_adjust[ch];
727 for (n = 0; n < nsamples; n++)
728 msb[n] = msb[n] * (
SUINT)(1 <<
shift) + (lsb[n] << adj);
730 for (n = 0; n < nsamples; n++)
739 int ch, nsamples =
s->nframesamples;
746 2 * nsamples *
c->nchannels *
sizeof(
int32_t));
747 if (!
c->sample_buffer[2])
751 ptr =
c->sample_buffer[2];
752 for (ch = 0; ch <
c->nchannels; ch++) {
753 int32_t *band0 =
c->bands[0].msb_sample_buffer[ch];
754 int32_t *band1 =
c->bands[1].msb_sample_buffer[ch];
758 c->deci_history[ch],
sizeof(
c->deci_history[0]));
761 s->dcadsp->assemble_freq_bands(ptr, band0, band1,
766 s->output_samples[
c->ch_remap[ch]] = ptr;
775 int stream_ver, header_size, frame_size_nbits, nframesegs_log2;
785 if (stream_ver > 1) {
800 frame_size_nbits =
get_bits(&
s->gb, 5) + 1;
819 s->nframesegs = 1 << nframesegs_log2;
820 if (
s->nframesegs > 1024) {
829 if (!
s->nsegsamples_log2) {
833 s->nsegsamples = 1 <<
s->nsegsamples_log2;
834 if (
s->nsegsamples > 512) {
840 s->nframesamples_log2 =
s->nsegsamples_log2 + nframesegs_log2;
841 s->nframesamples = 1 <<
s->nframesamples_log2;
842 if (
s->nframesamples > 65536) {
864 if (
s->scalable_lsbs)
867 s->fixed_lsb_width = 0;
882 return !
c->primary_chset &&
c->dmix_embedded &&
c->hier_chset;
888 while (++c < &s->chset[
s->nchsets])
897 int i, j, *coeff_ptr =
c->dmix_coeff;
899 for (
i = 0;
i <
c->hier_ofs;
i++) {
902 c->dmix_scale[
i] =
mul15(
c->dmix_scale[
i], scale);
903 c->dmix_scale_inv[
i] =
mul16(
c->dmix_scale_inv[
i], scale_inv);
904 for (j = 0; j <
c->nchannels; j++) {
921 for (
i = 0,
c =
s->chset; i < s->nchsets;
i++,
c++) {
922 c->hier_ofs =
s->nchannels;
925 if (
c->nfreqbands >
s->nfreqbands)
926 s->nfreqbands =
c->nfreqbands;
928 s->nchannels +=
c->nchannels;
929 if (
c->residual_encode != (1 <<
c->nchannels) - 1)
934 for (
i =
s->nchsets - 1,
c = &
s->chset[
i];
i > 0;
i--,
c--) {
945 s->nactivechsets = 1;
949 s->nactivechsets = (
s->chset[0].nchannels < 5 &&
s->nchsets > 1) ? 2 : 1;
952 s->nactivechsets =
s->nchsets;
961 int chs, seg, band, navi_nb, navi_pos, *navi_ptr;
965 navi_nb =
s->nfreqbands *
s->nframesegs *
s->nchsets;
966 if (navi_nb > 1024) {
979 for (band = 0; band <
s->nfreqbands; band++) {
980 for (seg = 0; seg <
s->nframesegs; seg++) {
981 for (chs = 0,
c =
s->chset; chs < s->nchsets; chs++,
c++) {
983 if (
c->nfreqbands > band) {
985 if (size < 0 || size >=
s->frame_size) {
1012 int ret, chs, seg, band, navi_pos, *navi_ptr;
1015 for (chs = 0,
c =
s->chset; chs < s->nactivechsets; chs++,
c++) {
1024 for (band = 0; band <
s->nfreqbands; band++) {
1025 for (seg = 0; seg <
s->nframesegs; seg++) {
1026 for (chs = 0,
c =
s->chset; chs < s->nchsets; chs++,
c++) {
1027 if (
c->nfreqbands > band) {
1028 navi_pos += *navi_ptr * 8;
1029 if (navi_pos >
s->gb.size_in_bits) {
1033 if (chs < s->nactivechsets &&
1086 s->pbr_length =
size;
1087 s->pbr_delay = delay;
1118 if (
s->frame_size >
size)
1122 if (
s->frame_size <
size)
1138 memcpy(
s->pbr_buffer +
s->pbr_length,
data,
size);
1139 s->pbr_length +=
size;
1143 if (
s->pbr_delay > 0 && --
s->pbr_delay)
1146 if ((ret =
parse_frame(
s,
s->pbr_buffer,
s->pbr_length, asset)) < 0)
1149 if (
s->frame_size >
s->pbr_length) {
1154 if (
s->frame_size ==
s->pbr_length) {
1158 s->pbr_length -=
s->frame_size;
1159 memmove(
s->pbr_buffer,
s->pbr_buffer +
s->frame_size,
s->pbr_length);
1190 int i, j, k, nchannels = 0, *coeff_ptr = o->
dmix_coeff;
1193 for (
i = 0,
c =
s->chset; i < s->nactivechsets;
i++,
c++) {
1198 for (j = 0; j <
c->nchannels; j++) {
1200 int coeff = *coeff_ptr++;
1202 s->dcadsp->dmix_sub(
c->bands[band].msb_sample_buffer[j],
1204 coeff,
s->nframesamples);
1206 s->dcadsp->dmix_sub(
c->deci_history[j],
1213 nchannels +=
c->nchannels;
1221 int i, j, nchannels = 0;
1224 for (
i = 0,
c =
s->chset; i < s->nactivechsets;
i++,
c++) {
1229 for (j = 0; j <
c->nchannels; j++) {
1231 if (scale != (1 << 15)) {
1232 s->dcadsp->dmix_scale(
c->bands[band].msb_sample_buffer[j],
1233 scale,
s->nframesamples);
1235 s->dcadsp->dmix_scale(
c->deci_history[j],
1252 for (band = 0; band <
c->nfreqbands; band++)
1255 for (ch = 0; ch <
c->nchannels; ch++) {
1256 if (!(
c->residual_encode & (1 << ch)))
1260 c->residual_encode &= ~(1 << ch);
1267 int ch, nsamples =
s->nframesamples;
1292 for (ch = 0; ch <
c->nchannels; ch++) {
1296 if (
c->residual_encode & (1 << ch))
1302 av_log(
s->avctx,
AV_LOG_WARNING,
"Residual encoded channel (%d) references unavailable core channel\n",
c->ch_remap[ch]);
1316 dst =
c->bands[0].msb_sample_buffer[ch];
1320 for (n = 0; n < nsamples; n++)
1324 for (n = 0; n < nsamples; n++)
1339 int i, j, k, ret,
shift, nsamples, request_mask;
1344 for (
i = 0,
c =
s->chset; i < s->nchsets;
i++,
c++) {
1345 if (i < s->nactivechsets)
1348 if (!
c->primary_chset)
1349 c->dmix_embedded = 0;
1352 s->scalable_lsbs = 0;
1353 s->fixed_lsb_width = 0;
1358 for (
i = 0,
c =
s->chset; i < s->nactivechsets;
i++,
c++) {
1361 if (
c->residual_encode != (1 <<
c->nchannels) - 1
1365 if (
s->scalable_lsbs)
1368 if (
c->nfreqbands > 1) {
1373 s->output_mask |=
c->ch_mask;
1377 for (
i = 1,
c = &
s->chset[1]; i < s->nchsets;
i++,
c++) {
1381 if (
i >=
s->nactivechsets) {
1382 for (j = 0; j <
c->nfreqbands; j++)
1383 if (
c->bands[j].dmix_embedded)
1388 for (j = 0; j <
c->nfreqbands; j++)
1389 if (
c->bands[j].dmix_embedded)
1394 if (
s->nfreqbands > 1) {
1395 for (
i = 0;
i <
s->nactivechsets;
i++)
1419 request_mask =
s->output_mask;
1448 if (request_mask !=
s->output_mask) {
1455 int32_t *samples =
s->output_samples[ch_remap[
i]];
1458 for (k = 0; k < nsamples; k++)
1462 for (k = 0; k < nsamples; k++)
1494 c->sample_size[j] = 0;
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define AV_EF_EXPLODE
abort decoding on minor error detection
#define FF_PROFILE_DTS_HD_MA
const uint32_t ff_dca_sampling_freqs[16]
#define DCA_SPEAKER_LAYOUT_5POINT0
#define DCA_SPEAKER_LAYOUT_STEREO
#define DCA_HAS_STEREO(mask)
#define DCA_SPEAKER_LAYOUT_5POINT1
static int ff_dca_core_map_spkr(DCACoreDecoder *core, int spkr)
static int combine_residual_frame(DCAXllDecoder *s, DCAXllChSet *c)
static int parse_frame(DCAXllDecoder *s, uint8_t *data, int size, DCAExssAsset *asset)
static int get_rice(GetBitContext *gb, int k)
static int parse_navi_table(DCAXllDecoder *s)
static int parse_frame_no_pbr(DCAXllDecoder *s, uint8_t *data, int size, DCAExssAsset *asset)
int ff_dca_xll_filter_frame(DCAXllDecoder *s, AVFrame *frame)
static int parse_sub_headers(DCAXllDecoder *s, DCAExssAsset *asset)
static void prescale_down_mix(DCAXllChSet *c, DCAXllChSet *o)
static int get_rice_array(GetBitContext *gb, int32_t *array, int size, int k)
static void chs_filter_band_data(DCAXllDecoder *s, DCAXllChSet *c, int band)
static int chs_assemble_freq_bands(DCAXllDecoder *s, DCAXllChSet *c)
static int parse_dmix_coeffs(DCAXllDecoder *s, DCAXllChSet *c)
static int chs_parse_header(DCAXllDecoder *s, DCAXllChSet *c, DCAExssAsset *asset)
static void clear_pbr(DCAXllDecoder *s)
static int chs_alloc_msb_band_data(DCAXllDecoder *s, DCAXllChSet *c)
static int get_linear(GetBitContext *gb, int n)
static int get_rice_un(GetBitContext *gb, int k)
av_cold void ff_dca_xll_flush(DCAXllDecoder *s)
static void get_linear_array(GetBitContext *gb, int32_t *array, int size, int n)
static int copy_to_pbr(DCAXllDecoder *s, uint8_t *data, int size, int delay)
static DCAXllChSet * find_next_hier_dmix_chset(DCAXllDecoder *s, DCAXllChSet *c)
static av_cold void chs_clear_band_data(DCAXllDecoder *s, DCAXllChSet *c, int band, int seg)
static int chs_get_lsb_width(DCAXllDecoder *s, DCAXllChSet *c, int band, int ch)
static void scale_down_mix(DCAXllDecoder *s, DCAXllChSet *o, int band)
static void get_array(GetBitContext *gb, int32_t *array, int size, int n)
int ff_dca_xll_parse(DCAXllDecoder *s, uint8_t *data, DCAExssAsset *asset)
static void undo_down_mix(DCAXllDecoder *s, DCAXllChSet *o, int band)
static int parse_common_header(DCAXllDecoder *s)
static av_cold void force_lossy_output(DCAXllDecoder *s, DCAXllChSet *c)
static void chs_assemble_msbs_lsbs(DCAXllDecoder *s, DCAXllChSet *c, int band)
static int is_hier_dmix_chset(DCAXllChSet *c)
static int chs_alloc_lsb_band_data(DCAXllDecoder *s, DCAXllChSet *c)
static int parse_frame_pbr(DCAXllDecoder *s, uint8_t *data, int size, DCAExssAsset *asset)
static int parse_band_data(DCAXllDecoder *s)
av_cold void ff_dca_xll_close(DCAXllDecoder *s)
static int chs_parse_band_data(DCAXllDecoder *s, DCAXllChSet *c, int band, int seg, int band_data_end)
#define DCA_XLL_CHANNELS_MAX
#define DCA_XLL_DECI_HISTORY_MAX
#define DCA_XLL_CHSETS_MAX
#define DCA_XLL_SAMPLE_BUFFERS_MAX
#define DCA_XLL_PBR_BUFFER_MAX
#define DCA_XLL_ADAPT_PRED_ORDER_MAX
const uint16_t ff_dca_dmixtable[FF_DCA_DMIXTABLE_SIZE]
const uint16_t ff_dca_xll_refl_coeff[128]
const int32_t ff_dca_xll_band_coeff[20]
const uint8_t ff_dca_dmix_primary_nch[8]
const uint32_t ff_dca_inv_dmixtable[FF_DCA_INV_DMIXTABLE_SIZE]
#define FF_DCA_INV_DMIXTABLE_SIZE
#define FF_DCA_DMIXTABLE_SIZE
#define FF_DCA_DMIXTABLE_OFFSET
int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask)
void ff_dca_downmix_to_stereo_fixed(DCADSPContext *dcadsp, int32_t **samples, int *coeff_l, int nsamples, int ch_mask)
#define DCA_PACKET_RECOVERY
Sync error recovery flag.
static int ff_dca_check_crc(AVCodecContext *avctx, GetBitContext *s, int p1, int p2)
static int ff_dca_seek_bits(GetBitContext *s, int p)
static int32_t mul16(int32_t a, int32_t b)
static int32_t norm16(int64_t a)
static int32_t clip23(int32_t a)
static int32_t mul15(int32_t a, int32_t b)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static int get_sbits_long(GetBitContext *s, int n)
Read 0-32 bits as a signed integer.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static int get_bits_left(GetBitContext *gb)
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static int get_bits_count(const GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
@ AV_MATRIX_ENCODING_NONE
@ AV_MATRIX_ENCODING_DOLBY
@ AV_MATRIX_ENCODING_DOLBYHEADPHONE
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
int ff_side_data_update_matrix_encoding(AVFrame *frame, enum AVMatrixEncoding matrix_encoding)
Add or update AV_FRAME_DATA_MATRIXENCODING side data.
static av_always_inline av_const double round(double x)
static int shift(int a, int b)
main external API structure.
enum AVSampleFormat sample_fmt
audio sample format
int64_t bit_rate
the average bitrate
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
int sample_rate
samples per second
int channels
number of audio channels
This structure describes decoded (raw) audio or video data.
int nb_samples
number of audio samples (per channel) described by this frame
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
uint8_t ** extended_data
pointers to the data planes/channels.
DCACoreDecoder core
Core decoder context.
DCAExssParser exss
EXSS parser context.
int request_channel_layout
Converted from avctx.request_channel_layout.
int npcmsamples
Number of PCM samples per channel.
int output_rate
Output sample rate (1x or 2x header rate)
int32_t * output_samples[DCA_SPEAKER_COUNT]
PCM output for fixed point mode.
int xll_offset
Offset to XLL data from start of substream.
int hd_stream_id
DTS-HD stream ID.
int xll_sync_present
XLL sync word present flag.
int xll_size
Size of XLL data in extension substream.
int xll_delay_nframes
Initial XLL decoding delay in frames.
int representation_type
Representation type.
int xll_sync_offset
Number of bytes offset to XLL sync.
int one_to_one_map_ch_to_spkr
One to one channel to speaker mapping flag.
DCAExssAsset assets[1]
Audio asset descriptors.
int32_t * msb_sample_buffer[DCA_XLL_CHANNELS_MAX]
MSB sample buffer pointers.
int nfreqbands
Number of frequency bands (1 or 2)
int32_t deci_history[DCA_XLL_CHANNELS_MAX][DCA_XLL_DECI_HISTORY_MAX]
Decimator history for frequency band 1.
int freq
Original sampling frequency (max. 96000 Hz)
int dmix_type
Primary channel set downmix type.
int nchannels
Number of channels in the channel set (N)
int pcm_bit_res
PCM bit resolution (variable)
int dmix_embedded
Downmix already performed by encoder.
int storage_bit_res
Storage bit resolution (16 or 24)
DCAXllBand bands[DCA_XLL_BANDS_MAX]
Frequency bands.
int dmix_scale[DCA_XLL_DMIX_SCALES_MAX]
Downmixing scales.
int dmix_coeff[DCA_XLL_DMIX_COEFFS_MAX]
Downmixing coefficients.
int dmix_scale_inv[DCA_XLL_DMIX_SCALES_MAX]
Inverse downmixing scales.
int hier_ofs
Number of preceding channels in a hierarchy (M)
#define avpriv_request_sample(...)
static int array[MAX_W *MAX_W]
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
static const double coeff[2][5]
static const uint8_t offset[127][2]