30 return (v >> 1) ^ -(v & 1);
42 return (v >> 1) ^ -(v & 1);
49 for (i = 0; i <
size; i++)
58 memset(array, 0,
sizeof(*array) * size);
59 else for (i = 0; i <
size; i++)
67 for (i = 0; i <
size; i++)
77 for (i = 0; i < m; i++) {
78 int code, sign,
coeff, scale, scale_inv = 0;
84 sign = (code >> 8) - 1;
99 sign = (code >> 8) - 1;
108 coeff =
mul16(scale_inv, coeff);
109 *coeff_ptr++ = (coeff ^ sign) - sign;
158 if (c->
freq > 192000) {
243 if (c->
freq > 96000) {
278 for (band = 0, b = c->
bands; band < c->nfreqbands; band++, b++) {
281 int ch_nbits = av_ceil_log2(c->
nchannels);
411 int i, j, nsamples = 0;
458 for (i = 0; i < k; i++) {
473 for (i = 0; i < k; i++) {
537 memset(part_b, 0,
sizeof(*part_b) * nsamples_part_b);
540 for (j = 0; j < nisosamples; j++) {
542 if (loc >= nsamples_part_b) {
550 for (j = 0; j < nsamples_part_b; j++) {
565 if (seg == 0 && band == 1) {
618 if (seg <= 0 && band)
640 for (j = 0; j < order; j++) {
642 for (k = 0; k < (j + 1) / 2; k++) {
643 int tmp1 = coeff[ k ];
644 int tmp2 = coeff[j - k - 1];
645 coeff[ k ] = tmp1 +
mul16(rc, tmp2);
646 coeff[j - k - 1] = tmp2 +
mul16(rc, tmp1);
651 for (j = 0; j < nsamples - order; j++) {
653 for (k = 0; k < order; k++)
654 err += (int64_t)buf[j + k] * coeff[order - k - 1];
660 for (k = 1; k < nsamples; k++)
661 buf[k] += (
unsigned)buf[k - 1];
699 else if (shift && adj)
719 for (n = 0; n < nsamples; n++)
720 msb[n] = msb[n] * (
SUINT)(1 <<
shift) + (lsb[n] << adj);
722 for (n = 0; n < nsamples; n++)
767 int stream_ver, header_size, frame_size_nbits, nframesegs_log2;
777 if (stream_ver > 1) {
880 while (++c < &s->chset[s->
nchsets])
913 for (i = 0, c = s->
chset; i < s->nchsets; i++, c++) {
926 for (i = s->
nchsets - 1, c = &s->
chset[i]; i > 0; i--, c--) {
953 int chs, seg,
band, navi_nb, navi_pos, *navi_ptr;
958 if (navi_nb > 1024) {
971 for (band = 0; band < s->
nfreqbands; band++) {
973 for (chs = 0, c = s->
chset; chs < s->nchsets; chs++, c++) {
1004 int ret, chs, seg,
band, navi_pos, *navi_ptr;
1007 for (chs = 0, c = s->
chset; chs < s->nactivechsets; chs++, c++) {
1016 for (band = 0; band < s->
nfreqbands; band++) {
1018 for (chs = 0, c = s->
chset; chs < s->nchsets; chs++, c++) {
1020 navi_pos += *navi_ptr * 8;
1025 if (chs < s->nactivechsets &&
1180 int i, j, k, nchannels = 0, *coeff_ptr = o->
dmix_coeff;
1183 for (i = 0, c = s->
chset; i < s->nactivechsets; i++, c++) {
1190 int coeff = *coeff_ptr++;
1211 int i, j, nchannels = 0;
1214 for (i = 0, c = s->
chset; i < s->nactivechsets; i++, c++) {
1221 if (scale != (1 << 15)) {
1303 round = shift > 0 ? 1 << (shift - 1) : 0;
1310 for (n = 0; n < nsamples; n++)
1314 for (n = 0; n < nsamples; n++)
1315 dst[n] += (
unsigned)((src[
n] +
round) >> shift);
1329 int i, j, k, ret,
shift, nsamples, request_mask;
1334 for (i = 0,
c = s->
chset; i < s->nchsets; i++,
c++) {
1335 if (i < s->nactivechsets)
1338 if (!
c->primary_chset)
1339 c->dmix_embedded = 0;
1348 for (i = 0,
c = s->
chset; i < s->nactivechsets; i++,
c++) {
1351 if (
c->residual_encode != (1 <<
c->nchannels) - 1
1358 if (
c->nfreqbands > 1) {
1367 for (i = 1,
c = &s->
chset[1]; i < s->nchsets; i++,
c++) {
1372 for (j = 0; j <
c->nfreqbands; j++)
1373 if (
c->bands[j].dmix_embedded)
1378 for (j = 0; j <
c->nfreqbands; j++)
1379 if (
c->bands[j].dmix_embedded)
1444 for (i = 0; i < avctx->
channels; i++) {
1448 for (k = 0; k < nsamples; k++)
1449 plane[k] = av_clip_int16(samples[k] * (
SUINT)(1 <<
shift));
1452 for (k = 0; k < nsamples; k++)
int adapt_pred_order[DCA_XLL_CHANNELS_MAX]
Adaptive predictor order.
int frame_size
Number of bytes in a lossless frame.
static int combine_residual_frame(DCAXllDecoder *s, DCAXllChSet *c)
static int ff_dca_seek_bits(GetBitContext *s, int p)
DCACoreDecoder core
Core decoder context.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int shift(int a, int b)
#define DCA_XLL_CHSETS_MAX
This structure describes decoded (raw) audio or video data.
int primary_chset
Primary channel set flag.
ptrdiff_t const GLvoid * data
int pbr_delay
Delay in frames before decoding buffered data.
static int chs_alloc_msb_band_data(DCAXllDecoder *s, DCAXllChSet *c)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t bit_rate
the average bitrate
static void skip_bits_long(GetBitContext *s, int n)
int nchannels
Number of channels in the channel set (N)
#define DCA_PACKET_RECOVERY
Sync error recovery flag.
#define DCA_XLL_PBR_BUFFER_MAX
int pbr_length
Length in bytes of data currently buffered.
static av_cold void chs_clear_band_data(DCAXllDecoder *s, DCAXllChSet *c, int band, int seg)
static int32_t mul15(int32_t a, int32_t b)
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
int freq
Original sampling frequency (max. 96000 Hz)
int dmix_scale[DCA_XLL_DMIX_SCALES_MAX]
Downmixing scales.
static int get_sbits_long(GetBitContext *s, int n)
Read 0-32 bits as a signed integer.
int bitalloc_part_a[DCA_XLL_CHANNELS_MAX]
Coding parameter for part A of segment.
static void chs_filter_band_data(DCAXllDecoder *s, DCAXllChSet *c, int band)
DCAXllBand bands[DCA_XLL_BANDS_MAX]
Frequency bands.
static int32_t norm16(int64_t a)
int rice_code_flag[DCA_XLL_CHANNELS_MAX]
Rice coding flag.
int band_crc_present
Presence of CRC16 within each frequency band.
int highest_pred_order
Highest adaptive predictor order.
int32_t * sample_buffer[DCA_XLL_SAMPLE_BUFFERS_MAX]
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static int32_t clip23(int32_t a)
static int get_rice(GetBitContext *gb, int k)
enum AVSampleFormat sample_fmt
audio sample format
static int32_t mul16(int32_t a, int32_t b)
#define FF_DCA_DMIXTABLE_OFFSET
int dmix_coeffs_present
Downmix coefficients present in stream.
int nfreqbands
Highest number of frequency bands.
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(constuint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(constint16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(constint32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(constint64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(constfloat *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(constdouble *) pi *(INT64_C(1)<< 63)))#defineFMT_PAIR_FUNC(out, in) staticconv_func_type *constfmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64),};staticvoidcpy1(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, len);}staticvoidcpy2(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 2 *len);}staticvoidcpy4(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 4 *len);}staticvoidcpy8(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, constint *ch_map, intflags){AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) returnNULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) returnNULL;if(channels==1){in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);}ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map){switch(av_get_bytes_per_sample(in_fmt)){case1:ctx->simd_f=cpy1;break;case2:ctx->simd_f=cpy2;break;case4:ctx->simd_f=cpy4;break;case8:ctx->simd_f=cpy8;break;}}if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);returnctx;}voidswri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}intswri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, intlen){intch;intoff=0;constintos=(out->planar?1:out->ch_count)*out->bps;unsignedmisaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){intplanes=in->planar?in->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;}if(ctx->out_simd_align_mask){intplanes=out->planar?out->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;}if(ctx->simd_f &&!ctx->ch_map &&!misaligned){off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){if(out->planar==in->planar){intplanes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
#define DCA_XLL_SAMPLE_BUFFERS_MAX
int ch_remap[DCA_XLL_CHANNELS_MAX]
Channel to speaker map.
static void get_rice_array(GetBitContext *gb, int32_t *array, int size, int k)
int fixed_lsb_width
Fixed LSB width.
static int ff_dca_check_crc(AVCodecContext *avctx, GetBitContext *s, int p1, int p2)
int fixed_pred_order[DCA_XLL_CHANNELS_MAX]
Fixed predictor order.
int nfreqbands
Number of frequency bands (1 or 2)
static int get_bits_count(const GetBitContext *s)
static void get_linear_array(GetBitContext *gb, int32_t *array, int size, int n)
#define AV_LOG_VERBOSE
Detailed information.
int32_t * lsb_sample_buffer[DCA_XLL_CHANNELS_MAX]
LSB sample buffer pointers or NULL.
static int chs_parse_header(DCAXllDecoder *s, DCAXllChSet *c, DCAExssAsset *asset)
DCAExssParser exss
EXSS parser context.
static av_cold void force_lossy_output(DCAXllDecoder *s, DCAXllChSet *c)
static int parse_band_data(DCAXllDecoder *s)
void ff_dca_downmix_to_stereo_fixed(DCADSPContext *dcadsp, int32_t **samples, int *coeff_l, int nsamples, int ch_mask)
int hd_stream_id
DTS-HD stream ID.
int npcmsamples
Number of PCM samples per channel.
int adapt_refl_coeff[DCA_XLL_CHANNELS_MAX][DCA_XLL_ADAPT_PRED_ORDER_MAX]
Adaptive predictor reflection coefficients.
static int get_bits_left(GetBitContext *gb)
int orig_order[DCA_XLL_CHANNELS_MAX]
Original channel order.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ff_dca_xll_filter_frame(DCAXllDecoder *s, AVFrame *frame)
int representation_type
Representation type.
static int get_linear(GetBitContext *gb, int n)
static DCAXllChSet * find_next_hier_dmix_chset(DCAXllDecoder *s, DCAXllChSet *c)
int scalable_lsbs
MSB/LSB split flag.
const uint16_t ff_dca_dmixtable[FF_DCA_DMIXTABLE_SIZE]
int nsegsamples_log2
log2(nsegsamples)
static int parse_sub_headers(DCAXllDecoder *s, DCAExssAsset *asset)
const uint32_t ff_dca_sampling_freqs[16]
int pcm_bit_res
PCM bit resolution (variable)
static av_always_inline av_const double round(double x)
int hier_chset
Whether the channel set is part of a hierarchy.
void(* assemble_freq_bands)(int32_t *dst, int32_t *src0, int32_t *src1, const int32_t *coeff, ptrdiff_t len)
static void prescale_down_mix(DCAXllChSet *c, DCAXllChSet *o)
static const uint8_t offset[127][2]
#define DCA_SPEAKER_LAYOUT_STEREO
int32_t * output_samples[DCA_SPEAKER_COUNT]
int decor_enabled
Pairwise channel decorrelation flag.
int hier_ofs
Number of preceding channels in a hierarchy (M)
int nchannels
Total number of channels in a hierarchy.
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
int seg_size_nbits
Number of bits used to read segment size.
int output_rate
Output sample rate (1x or 2x header rate)
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
static int chs_parse_band_data(DCAXllDecoder *s, DCAXllChSet *c, int band, int seg, int band_data_end)
int dmix_type
Primary channel set downmix type.
const int32_t ff_dca_xll_band_coeff[20]
int xll_offset
Offset to XLL data from start of substream.
static int ff_dca_core_map_spkr(DCACoreDecoder *core, int spkr)
int nframesamples
Samples in frame per one frequency band.
int nabits
Number of bits to read bit allocation coding parameter.
const uint8_t ff_dca_dmix_primary_nch[8]
void(* dmix_scale)(int32_t *dst, int scale, ptrdiff_t len)
const uint16_t ff_dca_xll_refl_coeff[128]
#define DCA_HAS_STEREO(mask)
#define DCA_XLL_ADAPT_PRED_ORDER_MAX
int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask)
static int get_rice_un(GetBitContext *gb, int k)
int nsegsamples
Samples in segment per one frequency band.
#define AV_EF_EXPLODE
abort decoding on minor error detection
int xll_delay_nframes
Initial XLL decoding delay in frames.
DCAExssAsset assets[1]
Audio asset descriptors.
int xll_size
Size of XLL data in extension substream.
const uint32_t ff_dca_inv_dmixtable[FF_DCA_INV_DMIXTABLE_SIZE]
int dmix_scale_inv[DCA_XLL_DMIX_SCALES_MAX]
Inverse downmixing scales.
int one_to_one_map_ch_to_spkr
One to one channel to speaker mapping flag.
int ff_side_data_update_matrix_encoding(AVFrame *frame, enum AVMatrixEncoding matrix_encoding)
Add or update AV_FRAME_DATA_MATRIXENCODING side data.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
static int parse_frame_no_pbr(DCAXllDecoder *s, uint8_t *data, int size, DCAExssAsset *asset)
int residual_encode
Residual encoding mask (0 - residual, 1 - full channel)
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 bitalloc_hybrid_linear[DCA_XLL_CHANNELS_MAX]
Binary code length for isolated samples.
int sample_rate
samples per second
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
int hd_stream_id
Previous DTS-HD stream ID for detecting changes.
main external API structure.
int lsb_section_size
Size of LSB section in any segment.
#define FF_DCA_INV_DMIXTABLE_SIZE
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
unsigned int sample_size[DCA_XLL_SAMPLE_BUFFERS_MAX]
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static int parse_frame_pbr(DCAXllDecoder *s, uint8_t *data, int size, DCAExssAsset *asset)
int nreschsets
Number of channel sets that have residual encoded channels.
#define DCA_SPEAKER_LAYOUT_5POINT1
int nframesegs
Number of segments per frame.
int32_t * output_samples[DCA_SPEAKER_COUNT]
PCM output for fixed point mode.
static int parse_navi_table(DCAXllDecoder *s)
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static int chs_get_lsb_width(DCAXllDecoder *s, DCAXllChSet *c, int band, int ch)
#define DCA_SPEAKER_LAYOUT_5POINT0
int ch_mask
Channel mask for set.
int32_t * msb_sample_buffer[DCA_XLL_CHANNELS_MAX]
MSB sample buffer pointers.
static int is_hier_dmix_chset(DCAXllChSet *c)
int nsamples_part_a[DCA_XLL_CHANNELS_MAX]
Number of samples in part A of segment.
static int parse_dmix_coeffs(DCAXllDecoder *s, DCAXllChSet *c)
#define DCA_XLL_DECI_HISTORY_MAX
static void chs_assemble_msbs_lsbs(DCAXllDecoder *s, DCAXllChSet *c, int band)
static void undo_down_mix(DCAXllDecoder *s, DCAXllChSet *o, int band)
av_cold void ff_dca_xll_flush(DCAXllDecoder *s)
static int parse_common_header(DCAXllDecoder *s)
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
int dmix_embedded
Downmix already performed by encoder.
static void clear_pbr(DCAXllDecoder *s)
int dmix_coeff[DCA_XLL_DMIX_COEFFS_MAX]
Downmixing coefficients.
int xll_sync_present
XLL sync word present flag.
int storage_bit_res
Storage bit resolution (16 or 24)
DCAXllChSet chset[DCA_XLL_CHSETS_MAX]
Channel sets.
int request_channel_layout
Converted from avctx.request_channel_layout.
static int chs_assemble_freq_bands(DCAXllDecoder *s, DCAXllChSet *c)
int32_t deci_history[DCA_XLL_CHANNELS_MAX][DCA_XLL_DECI_HISTORY_MAX]
Decimator history for frequency band 1.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
#define FF_DCA_DMIXTABLE_SIZE
av_cold void ff_dca_xll_close(DCAXllDecoder *s)
uint8_t * pbr_buffer
Peak bit rate (PBR) smoothing buffer.
int channels
number of audio channels
int seg_common
Segment type.
void(* dmix_sub)(int32_t *dst, const int32_t *src, int coeff, ptrdiff_t len)
static const double coeff[2][5]
static int chs_alloc_lsb_band_data(DCAXllDecoder *s, DCAXllChSet *c)
int ch_mask_nbits
Number of bits used to read channel mask.
#define DCA_XLL_CHANNELS_MAX
int ff_dca_xll_parse(DCAXllDecoder *s, uint8_t *data, DCAExssAsset *asset)
int bit_width_adjust[DCA_XLL_CHANNELS_MAX]
Number of bits discarded by authoring.
int nframesamples_log2
log2(nframesamples)
static int array[MAX_W *MAX_W]
int nscalablelsbs[DCA_XLL_CHANNELS_MAX]
Number of bits to represent the samples in LSB part.
#define FF_PROFILE_DTS_HD_MA
static int copy_to_pbr(DCAXllDecoder *s, uint8_t *data, int size, int delay)
static int parse_frame(DCAXllDecoder *s, uint8_t *data, int size, DCAExssAsset *asset)
uint8_t ** extended_data
pointers to the data planes/channels.
int xll_sync_offset
Number of bytes offset to XLL sync.
int nchsets
Number of channels sets per frame.
int dmix_embedded
Downmix performed by encoder in frequency band.
int decor_coeff[DCA_XLL_CHANNELS_MAX/2]
Pairwise channel coefficients.
int nb_samples
number of audio samples (per channel) described by this frame
void(* decor)(int32_t *dst, const int32_t *src, int coeff, ptrdiff_t len)
int nactivechsets
Number of active channel sets to decode.
int bitalloc_part_b[DCA_XLL_CHANNELS_MAX]
Coding parameter for part B of segment.