92 7, 10, 12, 13, 15, 17, 19
96 1, 2, 2, 2, 2, 3, 3, 3, 3, 3
100 1, 3, 3, 3, 3, 7, 7, 7, 7, 7
116 static VLC_TYPE dca_table[23622][2];
117 static int vlcs_initialized = 0;
120 if (vlcs_initialized)
123 #define DCA_INIT_VLC(vlc, a, b, c, d) \
125 vlc.table = &dca_table[ff_dca_vlc_offs[k]]; \
126 vlc.table_allocated = ff_dca_vlc_offs[k + 1] - ff_dca_vlc_offs[k]; \
127 init_vlc(&vlc, a, b, c, 1, 1, d, 2, 2, INIT_VLC_USE_NEW_STATIC); \
130 vlc_bit_allocation.
offset = 1;
132 for (i = 0, k = 0; i < 5; i++, k++)
136 vlc_scale_factor.
offset = -64;
138 for (i = 0; i < 5; i++, k++)
142 vlc_transition_mode.
offset = 0;
144 for (i = 0; i < 4; i++, k++)
150 vlc_quant_index[i].
max_depth = 1 + (i > 4);
156 vlcs_initialized = 1;
168 for (i = 0; i <
size; i++)
175 int normal_frame, pcmr_index;
376 for (ch = 0; ch < nchannels; ch++) {
386 for (ch = 0; ch < nchannels; ch++) {
390 int sign = (code >> 6) - 1;
392 index = code * 4 - 3;
412 for (ch = xch_base; ch < s->
nchannels; ch++) {
421 for (ch = xch_base; ch < s->
nchannels; ch++)
425 for (ch = xch_base; ch < s->
nchannels; ch++) {
436 for (ch = xch_base; ch < s->
nchannels; ch++)
440 for (ch = xch_base; ch < s->
nchannels; ch++) {
449 for (ch = xch_base; ch < s->
nchannels; ch++) {
459 for (ch = xch_base; ch < s->
nchannels; ch++)
464 for (ch = xch_base; ch < s->
nchannels; ch++)
487 const uint32_t *scale_table;
488 unsigned int scale_size;
506 if ((
unsigned int)*scale_index >= scale_size) {
511 return scale_table[*scale_index];
554 for (ch = xch_base; ch < s->
nchannels; ch++)
555 for (band = 0; band < s->
nsubbands[ch]; band++)
559 for (ch = xch_base; ch < s->
nchannels; ch++)
560 for (band = 0; band < s->
nsubbands[ch]; band++)
565 for (ch = xch_base; ch < s->
nchannels; ch++) {
586 for (ch = xch_base; ch < s->
nchannels; ch++) {
600 for (ch = xch_base; ch < s->
nchannels; ch++) {
629 for (ch = xch_base; ch < s->
nchannels; ch++) {
640 for (ch = xch_base; ch < s->
nchannels; ch++) {
644 for (band = s->
nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
663 #ifndef decode_blockcodes
666 int offset = (levels - 1) / 2;
671 audio[
n] = code1 - div * levels -
offset;
676 audio[
n] = code2 - div * levels -
offset;
680 return code1 | code2;
706 audio[i] =
dca_get_vlc(&s->
gb, &vlc_quant_index[abits - 1], sel);
742 int64_t step_scale = (int64_t)step_size * scale;
746 if (step_scale > (1 << 23)) {
747 shift =
av_log2(step_scale >> 23) + 1;
748 step_scale >>=
shift;
754 output[n] +=
clip23(
norm__(input[n] * step_scale, 22 - shift));
757 output[n] =
clip23(
norm__(input[n] * step_scale, 22 - shift));
762 const int16_t *vq_index,
763 const int8_t *prediction_mode,
764 int sb_start,
int sb_end,
769 for (i = sb_start; i < sb_end; i++) {
770 if (prediction_mode[i]) {
772 int32_t *ptr = subband_samples[i] + ofs;
773 for (j = 0; j <
len; j++) {
776 err += (int64_t)ptr[j - k - 1] * coeff[k];
785 int xch_base,
int *sub_pos,
int *lfe_pos)
788 int n, ssf, ofs, ch,
band;
801 for (ch = xch_base; ch < s->
nchannels; ch++) {
838 scale =
mul23(4697620 , scale);
841 for (n = 0, ofs = *lfe_pos; n < nlfesamples; n++, ofs++)
849 for (ssf = 0, ofs = *sub_pos; ssf < s->
nsubsubframes[sf]; ssf++) {
850 for (ch = xch_base; ch < s->
nchannels; ch++) {
874 if (trans_ssf == 0 || ssf < trans_ssf)
882 scale =
clip23(adj * scale >> 22);
886 audio, step_size, scale, 0);
900 for (ch = xch_base; ch < s->
nchannels; ch++) {
907 for (ch = xch_base; ch < s->
nchannels; ch++) {
912 s->
nsubbands[src_ch], *sub_pos, nsamples);
944 (nframesamples + nlfesamples) *
sizeof(
int32_t));
964 int sf, ch, ret,
band, sub_pos, lfe_pos;
976 for (ch = xch_base; ch < s->
nchannels; ch++) {
983 for (band = 0; band < nsubbands; band++) {
1023 int xxch_nchsets, xxch_frame_size;
1054 if (xxch_nchsets > 1) {
1100 int *xbr_nsubbands,
int xbr_transition_mode,
int sf,
int *sub_pos)
1106 int ssf, ch,
band, ofs;
1118 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++)
1122 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
1123 for (band = 0; band < xbr_nsubbands[ch]; band++) {
1133 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
1135 if (!xbr_scale_nbits[ch]) {
1142 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
1143 const uint32_t *scale_table;
1157 for (band = 0; band < xbr_nsubbands[ch]; band++) {
1158 if (xbr_bit_allocation[ch][band]) {
1159 int scale_index =
get_bits(&s->
gb, xbr_scale_nbits[ch]);
1160 if (scale_index >= scale_size) {
1164 xbr_scale_factors[ch][
band][0] = scale_table[scale_index];
1166 scale_index =
get_bits(&s->
gb, xbr_scale_nbits[ch]);
1167 if (scale_index >= scale_size) {
1171 xbr_scale_factors[ch][
band][1] = scale_table[scale_index];
1178 for (ssf = 0, ofs = *sub_pos; ssf < s->
nsubsubframes[sf]; ssf++) {
1179 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
1183 for (band = 0; band < xbr_nsubbands[ch]; band++) {
1184 int ret, trans_ssf, abits = xbr_bit_allocation[ch][
band];
1191 }
else if (abits > 0) {
1204 if (xbr_transition_mode)
1210 if (trans_ssf == 0 || ssf < trans_ssf)
1211 scale = xbr_scale_factors[ch][
band][0];
1213 scale = xbr_scale_factors[ch][
band][1];
1216 audio, step_size, scale, 1);
1239 int xbr_nchsets, xbr_transition_mode, xbr_band_nbits, xbr_base_ch;
1262 for (i = 0; i < xbr_nchsets; i++)
1263 xbr_frame_size[i] =
get_bits(&s->
gb, 14) + 1;
1269 for (i = 0, ch2 = 0; i < xbr_nchsets; i++) {
1272 for (ch1 = 0; ch1 < xbr_nchannels[i]; ch1++, ch2++) {
1273 xbr_nsubbands[ch2] =
get_bits(&s->
gb, xbr_band_nbits) + 1;
1290 for (i = 0, xbr_base_ch = 0; i < xbr_nchsets; i++) {
1293 if (xbr_base_ch + xbr_nchannels[i] <= s->
nchannels) {
1296 for (sf = 0, sub_pos = 0; sf < s->
nsubframes; sf++) {
1298 xbr_base_ch + xbr_nchannels[i],
1299 xbr_nsubbands, xbr_transition_mode,
1305 xbr_base_ch += xbr_nchannels[i];
1321 return (s->
x96_rand & 0x7fffffff) - 0x40000000;
1326 int n, ssf, ch,
band, ofs;
1348 memset(samples, 0, nsamples *
sizeof(
int32_t));
1349 else for (n = 0; n < nsamples; n++)
1355 for (ssf = 0; ssf < (s->
nsubsubframes[sf] + 1) / 2; ssf++) {
1360 for (n = 0; n <
FFMIN(nsamples - ssf * 16, 16); n++)
1361 *samples++ =
clip23(vq_samples[n] * scale + (1 << 3) >> 4);
1369 for (ssf = 0, ofs = *sub_pos; ssf < s->
nsubsubframes[sf]; ssf++) {
1397 audio, step_size, scale, 0);
1414 *sub_pos, nsamples);
1423 s->
nsubbands[src_ch], *sub_pos, nsamples);
1454 nframesamples *
sizeof(
int32_t));
1513 int scale_index = 0;
1518 if ((ret =
parse_scale(s, &scale_index, sel)) < 0)
1540 for (band = s->
nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
1645 int sf, ch, ret,
band, sub_pos;
1650 for (sf = 0, sub_pos = 0; sf < s->
nsubframes; sf++) {
1711 int x96_nchsets, x96_base_ch;
1744 for (i = 0; i < x96_nchsets; i++)
1745 x96_frame_size[i] =
get_bits(&s->
gb, 12) + 1;
1748 for (i = 0; i < x96_nchsets; i++)
1763 for (i = 0, x96_base_ch = 0; i < x96_nchsets; i++) {
1766 if (x96_base_ch + x96_nchannels[i] <= s->
nchannels) {
1772 x96_base_ch += x96_nchannels[i];
1824 for (i = 0; i < m *
n; i++) {
1826 int sign = (code >> 8) - 1;
1827 unsigned int index = code & 0xff;
1888 for (; sync_pos >= last_pos; sync_pos--) {
1890 s->
gb.
index = (sync_pos + 1) * 32;
1894 && (size == dist || size - 1 == dist)
1912 for (; sync_pos >= last_pos; sync_pos--) {
1914 s->
gb.
index = (sync_pos + 1) * 32;
1917 if (size >= 96 && size == dist) {
1936 for (; sync_pos >= last_pos; sync_pos--) {
1938 s->
gb.
index = (sync_pos + 1) * 32;
1942 sync_pos * 32 + size * 8)) {
2001 int ret = 0, ext = 0;
2124 int n, ch, spkr, nsamples, x96_nchannels = 0;
2203 samples += nsamples / 2;
2230 int i,
n, ch, ret, spkr, nsamples;
2266 scale_inv, nsamples);
2271 for (ch = xch_base; ch < s->
nchannels; ch++) {
2313 for (i = 0; i < avctx->
channels; i++) {
2316 for (n = 0; n < nsamples; n++)
2317 plane[n] =
clip23(samples[n]) * (1 << 8);
2326 int x96_nchannels = 0, x96_synth = 0;
2327 int i,
n, ch, ret, spkr, nsamples, nchannels;
2329 const float *filter_coeff;
2345 for (i = 0; i < avctx->
channels; i++)
2350 if (nchannels > 0) {
2352 nsamples * nchannels *
sizeof(
float));
2360 if (output_samples[spkr])
2362 output_samples[spkr] = ptr;
2388 &s->
imdct[x96_synth],
2389 output_samples[spkr],
2397 1.0f / (1 << (17 - x96_synth)));
2404 int nlfesamples = s->
npcmblocks >> (dec_select + 1);
2408 samples += nsamples / 2;
2441 output_samples[DCA_SPEAKER_Cs],
2454 for (ch = xch_base; ch < s->
nchannels; ch++) {
2460 int coeff = *coeff_ptr++;
2463 output_samples[src_spkr],
2464 coeff * (-1.0f / (1 << 15)),
2475 output_samples[spkr],
2476 scale_inv, nsamples);
int audio_mode
Audio channel arrangement.
int ff_dca_core_filter_fixed(DCACoreDecoder *s, int x96_synth)
static int decode_blockcodes(int code1, int code2, int levels, int32_t *audio)
int16_t prediction_vq_index[DCA_CHANNELS][DCA_SUBBANDS_X96]
Prediction coefficients VQ address.
void(* lfe_fir_fixed)(int32_t *pcm_samples, int32_t *lfe_samples, const int32_t *filter_coeff, ptrdiff_t npcmblocks)
int xxch_mask_nbits
Number of bits for loudspeaker mask.
static const int8_t bitalloc_offsets[10]
static int ff_dca_seek_bits(GetBitContext *s, int p)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static DCAVLC vlc_scale_factor
static int shift(int a, int b)
static const uint8_t quant_index_sel_nbits[DCA_CODE_BOOKS]
int prim_dmix_coeff[DCA_DMIX_CHANNELS_MAX *DCA_CORE_CHANNELS_MAX]
Dynamic downmix code coefficients.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static const uint16_t tmode_codes[TMODE_COUNT][4]
int ff_dca_check_crc(GetBitContext *s, int p1, int p2)
void(* sub_qmf_float[2])(SynthFilterContext *synth, FFTContext *imdct, float *pcm_samples, int32_t **subband_samples_lo, int32_t **subband_samples_hi, float *hist1, int *offset, float *hist2, const float *filter_coeff, ptrdiff_t npcmblocks, float scale)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
const uint32_t ff_dca_lossy_quant[32]
int64_t bit_rate
the average bitrate
int xxch_dmix_embedded
Downmix already performed by encoder.
static void skip_bits_long(GetBitContext *s, int n)
int ext_audio_type
Extension audio descriptor flag.
#define FF_PROFILE_DTS_HD_HRA
int ff_dca_core_parse_exss(DCACoreDecoder *s, uint8_t *data, DCAExssAsset *asset)
#define DCA_SPEAKER_LAYOUT_3_0
int frame_size
Primary frame byte size.
static int parse_frame_header(DCACoreDecoder *s)
static int alloc_x96_sample_buffer(DCACoreDecoder *s)
int8_t joint_scale_sel[DCA_CHANNELS]
Joint subband codebook select.
static void set_filter_mode(DCACoreDecoder *s, int mode)
static int filter_frame_float(DCACoreDecoder *s, AVFrame *frame)
static const int8_t prm_ch_to_spkr_map[AMODE_COUNT][5]
av_cold void ff_dca_core_close(DCACoreDecoder *s)
int8_t joint_intensity_index[DCA_CHANNELS]
Joint intensity coding index.
static int parse_coding_header(DCACoreDecoder *s, enum HeaderType header, int xch_base)
int core_only
Core only decoding flag.
#define DCA_FILTER_MODE_FIXED
int filter_perfect
Multirate interpolator switch.
void(* dmix_scale_inv)(int32_t *dst, int scale_inv, ptrdiff_t len)
float output_history_lfe_float
LFE PCM history for X96 filter.
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
static int map_prm_ch_to_spkr(DCACoreDecoder *s, int ch)
unsigned int x96_subband_size
int nsubframes
Number of subframes.
static int get_sbits(GetBitContext *s, int n)
av_cold void ff_synth_filter_init(SynthFilterContext *c)
static int parse_xch_frame(DCACoreDecoder *s)
const float ff_dca_fir_32bands_nonperfect[512]
const int8_t ff_dca_high_freq_vq[1024][32]
#define DCA_EXSS_CHANNELS_MAX
static int parse_xbr_frame(DCACoreDecoder *s)
const float ff_dca_fir_64bands[1024]
void(* vector_fmac_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float and add to destination vector.
static int parse_frame_data(DCACoreDecoder *s, enum HeaderType header, int xch_base)
static int parse_subframe_header(DCACoreDecoder *s, int sf, enum HeaderType header, int xch_base)
DCADSPData dcadsp_data[DCA_CHANNELS]
FIR history buffers.
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
int32_t scale_factor_adj[DCA_CHANNELS][DCA_CODE_BOOKS]
Scale factor adjustment.
static int32_t clip23(int32_t a)
static int32_t mul23(int32_t a, int32_t b)
int x96_rand
Random seed for generating samples for unallocated X96 subbands.
const uint32_t ff_dca_bit_rates[32]
enum AVSampleFormat sample_fmt
audio sample format
int8_t prediction_mode[DCA_CHANNELS][DCA_SUBBANDS_X96]
Prediction mode.
static int32_t mul16(int32_t a, int32_t b)
int ff_dca_core_parse(DCACoreDecoder *s, uint8_t *data, int size)
int source_pcm_res
Source PCM resolution.
#define FF_DCA_DMIXTABLE_OFFSET
int xxch_dmix_scale_inv
Downmix scale factor.
int32_t * subband_samples[DCA_CHANNELS][DCA_SUBBANDS]
Subband samples.
static int extract_audio(DCACoreDecoder *s, int32_t *audio, int abits, int ch)
void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
int filter_mode
Previous filtering mode for detecting changes.
const int32_t ff_dca_lfe_fir_64_fixed[256]
int extension_mask
Coding components used in asset.
void * output_buffer
PCM output buffer base.
static int alloc_sample_buffer(DCACoreDecoder *s)
static int get_bits_count(const GetBitContext *s)
int prim_dmix_type
Auxiliary primary channel downmix type.
int32_t * x96_subband_buffer
X96 subband sample buffer base.
AVFixedDSPContext * avpriv_alloc_fixed_dsp(int bit_exact)
Allocate and initialize a fixed DSP context.
static const uint8_t header[24]
static int parse_aux_data(DCACoreDecoder *s)
static const uint8_t bitalloc_sizes[10]
static void inverse_adpcm(int32_t **subband_samples, const int16_t *vq_index, const int8_t *prediction_mode, int sb_start, int sb_end, int ofs, int len)
static int parse_xbr_subframe(DCACoreDecoder *s, int xbr_base_ch, int xbr_nchannels, int *xbr_nsubbands, int xbr_transition_mode, int sf, int *sub_pos)
int sync_ssf
Audio sync word insertion flag.
static int parse_x96_subframe_audio(DCACoreDecoder *s, int sf, int xch_base, int *sub_pos)
DCAExssParser exss
EXSS parser context.
static int parse_x96_frame_data(DCACoreDecoder *s, int exss, int xch_base)
const int32_t ff_dca_fir_64bands_fixed[1024]
int32_t * subband_buffer
Subband sample buffer base.
static void dequantize(int32_t *output, const int32_t *input, int32_t step_size, int32_t scale, int residual)
void ff_dca_downmix_to_stereo_fixed(DCADSPContext *dcadsp, int32_t **samples, int *coeff_l, int nsamples, int ch_mask)
static int parse_x96_frame_exss(DCACoreDecoder *s)
int npcmsamples
Number of PCM samples per channel.
int8_t subband_vq_start[DCA_CHANNELS]
High frequency VQ start subband.
static int get_bits_left(GetBitContext *gb)
int8_t nsubbands[DCA_CHANNELS]
Subband activity count.
int xxch_offset
Offset to XXCH extension from start of substream.
void(* lfe_fir_float[2])(float *pcm_samples, int32_t *lfe_samples, const float *filter_coeff, ptrdiff_t npcmblocks)
int sumdiff_front
Front sum/difference flag.
int8_t nsubsubframes[DCA_SUBFRAMES]
Subsubframe count for each subframe.
#define DCA_PCMBLOCK_SAMPLES
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int8_t transition_mode_sel[DCA_CHANNELS]
Transient mode code book.
static int rand_x96(DCACoreDecoder *s)
int bit_rate
Transmission bit rate.
const float ff_dca_lfe_fir_128[256]
static DCAVLC vlc_bit_allocation
static const uint16_t mask[17]
int xxch_crc_present
CRC presence flag for XXCH channel set header.
AVFloatDSPContext * float_dsp
static const uint16_t bitalloc_12_codes[BITALLOC_12_COUNT][12]
int offset
Code values offset.
const uint32_t ff_dca_lossless_quant[32]
static int32_t mul31(int32_t a, int32_t b)
const uint16_t ff_dca_dmixtable[FF_DCA_DMIXTABLE_SIZE]
void(* butterflies_float)(float *av_restrict v1, float *av_restrict v2, int len)
Calculate the sum and difference of two vectors of floats.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
const float ff_dca_lfe_fir_64[256]
#define FF_PROFILE_DTS_ES
int flags
AV_CODEC_FLAG_*.
void(* butterflies_fixed)(int *av_restrict v1, int *av_restrict v2, int len)
Calculate the sum and difference of two vectors of integers.
static int parse_subframe_audio(DCACoreDecoder *s, int sf, enum HeaderType header, int xch_base, int *sub_pos, int *lfe_pos)
#define DCA_SPEAKER_LAYOUT_3_1
static const uint8_t bitalloc_12_bits[BITALLOC_12_COUNT][12]
int aux_present
Auxiliary data flag.
const uint32_t ff_dca_quant_levels[32]
static const uint8_t offset[127][2]
#define DCA_SPEAKER_LAYOUT_STEREO
int32_t * lfe_samples
Decimated LFE samples.
int xbr_offset
Offset to XBR extension from start of substream.
int prim_dmix_embedded
Auxiliary dynamic downmix flag.
static const uint8_t tmode_bits[TMODE_COUNT][4]
int sample_rate
Core audio sampling frequency.
int request_mask
Requested channel layout (for stereo downmix)
static int parse_huffman_codes(DCACoreDecoder *s, int32_t *audio, int abits, int sel)
int output_rate
Output sample rate (1x or 2x header rate)
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
int nchannels
Number of primary audio channels (incl. extension channels)
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 dca_get_vlc(GetBitContext *s, DCAVLC *v, int i)
static DCAVLC vlc_quant_index[DCA_CODE_BOOKS]
const uint8_t ff_dca_dmix_primary_nch[8]
int xxch_pos
Bit position of XXCH frame in core substream.
static int parse_joint_scale(DCACoreDecoder *s, int sel)
int sumdiff_surround
Surround sum/difference flag.
#define DCA_SPEAKER_LAYOUT_2_1
static int parse_optional_info(DCACoreDecoder *s)
static const uint8_t scales_bits[SCALES_COUNT][129]
static int parse_block_codes(DCACoreDecoder *s, int32_t *audio, int abits)
int x96_crc_present
CRC presence flag for X96 channel set header.
int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask)
static const uint16_t *const bitalloc_codes[10][8]
void(* lfe_x96_float)(float *dst, const float *src, float *hist, ptrdiff_t len)
#define DCA_SPEAKER_LAYOUT_2_2
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static void get_array(GetBitContext *s, int32_t *array, int size, int n)
void(* vector_fmul_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float.
static const uint8_t block_code_nbits[7]
av_cold void ff_dca_core_flush(DCACoreDecoder *s)
#define AV_EF_EXPLODE
abort decoding on minor error detection
const uint32_t avpriv_dca_sample_rates[16]
DCAExssAsset assets[1]
Audio asset descriptors.
static int parse_scale(DCACoreDecoder *s, int *scale_index, int sel)
static void erase_x96_adpcm_history(DCACoreDecoder *s)
static const uint8_t *const bitalloc_bits[10][8]
const uint32_t ff_dca_inv_dmixtable[FF_DCA_INV_DMIXTABLE_SIZE]
static int parse_x96_frame(DCACoreDecoder *s)
#define FF_ARRAY_ELEMS(a)
int ff_side_data_update_matrix_encoding(AVFrame *frame, enum AVMatrixEncoding matrix_encoding)
Add or update AV_FRAME_DATA_MATRIXENCODING side data.
const int16_t ff_dca_adpcm_vb[4096][4]
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
const uint32_t ff_dca_scale_factor_quant7[128]
int xxch_core_mask
Core loudspeaker activity mask.
#define FF_PROFILE_DTS_96_24
const uint8_t ff_dca_channels[16]
void(* decode_hf)(int32_t **dst, const int32_t *vq_index, const int8_t hf_vq[1024][32], int32_t scale_factors[32][2], ptrdiff_t sb_start, ptrdiff_t sb_end, ptrdiff_t ofs, ptrdiff_t len)
void ff_dca_downmix_to_stereo_float(AVFloatDSPContext *fdsp, float **samples, int *coeff_l, int nsamples, int ch_mask)
static av_cold void dca_init_vlcs(void)
int ts_present
Embedded time stamp flag.
int xxch_spkr_mask
Loudspeaker layout mask.
void(* decode_joint)(int32_t **dst, int32_t **src, const int32_t *scale_factors, ptrdiff_t sb_start, ptrdiff_t sb_end, ptrdiff_t ofs, ptrdiff_t len)
int crc_present
CRC present flag.
int sample_rate
samples per second
const uint8_t ff_dca_bits_per_sample[8]
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static void erase_dsp_history(DCACoreDecoder *s)
main external API structure.
int8_t bit_allocation_sel[DCA_CHANNELS]
Bit allocation quantizer select.
int ext_audio_present
Extended coding flag.
int es_format
Extended surround (ES) mastering flag.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define FF_DCA_INV_DMIXTABLE_SIZE
static int filter_frame_fixed(DCACoreDecoder *s, AVFrame *frame)
static int parse_x96_subframe_header(DCACoreDecoder *s, int xch_base)
int x96_subband_start
First encoded subband in X96 extension.
#define AV_EF_CAREFUL
consider things that violate the spec, are fast to calculate and have not been seen in the wild as er...
int xxch_dmix_coeff[DCA_XXCH_CHANNELS_MAX *DCA_CORE_CHANNELS_MAX]
Downmix coefficients.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
int x96_pos
Bit position of X96 frame in core substream.
const uint32_t ff_dca_scale_factor_quant6[64]
int xch_pos
Bit position of XCH frame in core substream.
int x96_size
Size of X96 extension in extension substream.
int xxch_dmix_mask[DCA_XXCH_CHANNELS_MAX]
Downmix channel mapping mask.
av_cold int ff_dca_core_init(DCACoreDecoder *s)
int32_t * x96_subband_samples[DCA_CHANNELS][DCA_SUBBANDS_X96]
X96 subband samples.
int8_t bit_allocation[DCA_CHANNELS][DCA_SUBBANDS_X96]
Bit allocation index.
static const uint8_t audio_mode_ch_mask[AMODE_COUNT]
av_cold void ff_dcadct_init(DCADCTContext *c)
int x96_rev_no
X96 revision number.
static DCAVLC vlc_transition_mode
int8_t transition_mode[DCA_SUBFRAMES][DCA_CHANNELS][DCA_SUBBANDS]
Transition mode.
#define AV_EF_CRCCHECK
Verify checksums embedded in the bitstream (could be of either encoded or decoded data...
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
int32_t * output_samples[DCA_SPEAKER_COUNT]
PCM output for fixed point mode.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
int x96_nchannels
Number of primary channels in X96 extension.
int32_t joint_scale_factors[DCA_CHANNELS][DCA_SUBBANDS_X96]
Scale factors for joint subband coding.
#define DCA_SPEAKER_LAYOUT_5POINT0
static int parse_xxch_frame(DCACoreDecoder *s)
#define DCA_SYNCWORD_REV1AUX
struct DCADSPData::@39::@41 fix
void(* sub_qmf_fixed[2])(SynthFilterContext *synth, DCADCTContext *imdct, int32_t *pcm_samples, int32_t **subband_samples_lo, int32_t **subband_samples_hi, int32_t *hist1, int *offset, int32_t *hist2, const int32_t *filter_coeff, ptrdiff_t npcmblocks)
#define DCA_EXSS_CHSETS_MAX
unsigned int subband_size
int lfe_present
Low frequency effects flag.
int xbr_size
Size of XBR extension in extension substream.
int8_t scale_factor_sel[DCA_CHANNELS]
Scale factor code book.
int ff_dca_core_filter_frame(DCACoreDecoder *s, AVFrame *frame)
#define DCA_SYNCWORD_XXCH
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
int32_t scale_factors[DCA_CHANNELS][DCA_SUBBANDS][2]
Scale factors (2x for transients and X96)
int ch_remap[DCA_SPEAKER_COUNT]
Channel to speaker map.
#define DCA_XXCH_CHANNELS_MAX
#define DCA_SPEAKER_LAYOUT_MONO
static const uint16_t scales_codes[SCALES_COUNT][129]
int max_depth
Parameter for get_vlc2()
int request_channel_layout
Converted from avctx.request_channel_layout.
const uint32_t ff_dca_joint_scale_factors[129]
static int parse_x96_coding_header(DCACoreDecoder *s, int exss, int xch_base)
#define FF_DCA_DMIXTABLE_SIZE
static const uint8_t quant_index_group_size[DCA_CODE_BOOKS]
struct DCADSPData::@39::@40 flt
static const uint8_t bitalloc_maxbits[10][7]
AVFixedDSPContext * fixed_dsp
int xxch_size
Size of XXCH extension in extension substream.
static void erase_adpcm_history(DCACoreDecoder *s)
void(* dmix_sub_xch)(int32_t *dst1, int32_t *dst2, const int32_t *src, ptrdiff_t len)
#define DCA_INIT_VLC(vlc, a, b, c, d)
int channels
number of audio channels
static int32_t norm__(int64_t a, int bits)
VLC_TYPE(* table)[2]
code, bits
int ch_mask
Speaker layout mask (incl. LFE and extension channels)
void(* dmix_sub)(int32_t *dst, const int32_t *src, int coeff, ptrdiff_t len)
static const double coeff[2][5]
int x96_offset
Offset to X96 extension from start of substream.
int drc_present
Embedded dynamic range flag.
const int32_t ff_dca_fir_32bands_nonperfect_fixed[512]
#define DCA_SUBBAND_SAMPLES
void(* lfe_x96_fixed)(int32_t *dst, const int32_t *src, int32_t *hist, ptrdiff_t len)
int x96_high_res
X96 high resolution flag.
int ext_audio_mask
Bit mask of fully decoded core extensions.
int predictor_history
Predictor history flag switch.
const int32_t ff_dca_fir_32bands_perfect_fixed[512]
int32_t output_history_lfe_fixed
LFE PCM history for X96 filter.
int8_t quant_index_sel[DCA_CHANNELS][DCA_CODE_BOOKS]
Quantization index codebook select.
static const uint8_t bitalloc_12_vlc_bits[BITALLOC_12_COUNT]
const float ff_dca_fir_32bands_perfect[512]
uint8_t ** extended_data
pointers to the data planes/channels.
const uint32_t ff_dca_scale_factor_adj[4]
int nb_samples
number of audio samples (per channel) described by this frame
static int32_t norm13(int64_t a)
int npcmblocks
Number of PCM sample blocks.
static const uint8_t tmode_vlc_bits[TMODE_COUNT]