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
112 for (i = 0; i <
size; i++)
119 int normal_frame, pcmr_index;
319 for (ch = 0; ch < nchannels; ch++) {
329 for (ch = 0; ch < nchannels; ch++) {
333 int sign = (code >> 6) - 1;
335 index = code * 4 - 3;
355 for (ch = xch_base; ch < s->
nchannels; ch++) {
364 for (ch = xch_base; ch < s->
nchannels; ch++)
368 for (ch = xch_base; ch < s->
nchannels; ch++) {
379 for (ch = xch_base; ch < s->
nchannels; ch++)
383 for (ch = xch_base; ch < s->
nchannels; ch++) {
392 for (ch = xch_base; ch < s->
nchannels; ch++) {
402 for (ch = xch_base; ch < s->
nchannels; ch++)
407 for (ch = xch_base; ch < s->
nchannels; ch++)
430 const uint32_t *scale_table;
431 unsigned int scale_size;
449 if ((
unsigned int)*scale_index >= scale_size) {
454 return scale_table[*scale_index];
497 for (ch = xch_base; ch < s->
nchannels; ch++)
498 for (band = 0; band < s->
nsubbands[ch]; band++)
502 for (ch = xch_base; ch < s->
nchannels; ch++)
503 for (band = 0; band < s->
nsubbands[ch]; band++)
508 for (ch = xch_base; ch < s->
nchannels; ch++) {
529 for (ch = xch_base; ch < s->
nchannels; ch++) {
543 for (ch = xch_base; ch < s->
nchannels; ch++) {
572 for (ch = xch_base; ch < s->
nchannels; ch++) {
583 for (ch = xch_base; ch < s->
nchannels; ch++) {
587 for (band = s->
nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
606 #ifndef decode_blockcodes
609 int offset = (levels - 1) / 2;
614 audio[
n] = code1 - div * levels -
offset;
619 audio[
n] = code2 - div * levels -
offset;
623 return code1 | code2;
685 int64_t step_scale = (int64_t)step_size * scale;
689 if (step_scale > (1 << 23)) {
690 shift =
av_log2(step_scale >> 23) + 1;
691 step_scale >>=
shift;
697 output[n] +=
clip23(
norm__(input[n] * step_scale, 22 - shift));
700 output[n] =
clip23(
norm__(input[n] * step_scale, 22 - shift));
705 const int16_t *vq_index,
706 const int8_t *prediction_mode,
707 int sb_start,
int sb_end,
712 for (i = sb_start; i < sb_end; i++) {
713 if (prediction_mode[i]) {
715 int32_t *ptr = subband_samples[i] + ofs;
716 for (j = 0; j <
len; j++) {
719 err += (int64_t)ptr[j - k - 1] * coeff[k];
728 int xch_base,
int *sub_pos,
int *lfe_pos)
731 int n, ssf, ofs, ch,
band;
744 for (ch = xch_base; ch < s->
nchannels; ch++) {
781 scale =
mul23(4697620 , scale);
784 for (n = 0, ofs = *lfe_pos; n < nlfesamples; n++, ofs++)
792 for (ssf = 0, ofs = *sub_pos; ssf < s->
nsubsubframes[sf]; ssf++) {
793 for (ch = xch_base; ch < s->
nchannels; ch++) {
817 if (trans_ssf == 0 || ssf < trans_ssf)
825 scale =
clip23(adj * scale >> 22);
829 audio, step_size, scale, 0);
843 for (ch = xch_base; ch < s->
nchannels; ch++) {
850 for (ch = xch_base; ch < s->
nchannels; ch++) {
855 s->
nsubbands[src_ch], *sub_pos, nsamples);
887 (nframesamples + nlfesamples) *
sizeof(
int32_t));
907 int sf, ch, ret,
band, sub_pos, lfe_pos;
919 for (ch = xch_base; ch < s->
nchannels; ch++) {
926 for (band = 0; band < nsubbands; band++) {
966 int xxch_nchsets, xxch_frame_size;
996 if (xxch_nchsets > 1) {
1042 int *xbr_nsubbands,
int xbr_transition_mode,
int sf,
int *sub_pos)
1048 int ssf, ch,
band, ofs;
1060 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++)
1064 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
1065 for (band = 0; band < xbr_nsubbands[ch]; band++) {
1075 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
1077 if (!xbr_scale_nbits[ch]) {
1084 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
1085 const uint32_t *scale_table;
1099 for (band = 0; band < xbr_nsubbands[ch]; band++) {
1100 if (xbr_bit_allocation[ch][band]) {
1101 int scale_index =
get_bits(&s->
gb, xbr_scale_nbits[ch]);
1102 if (scale_index >= scale_size) {
1106 xbr_scale_factors[ch][
band][0] = scale_table[scale_index];
1108 scale_index =
get_bits(&s->
gb, xbr_scale_nbits[ch]);
1109 if (scale_index >= scale_size) {
1113 xbr_scale_factors[ch][
band][1] = scale_table[scale_index];
1120 for (ssf = 0, ofs = *sub_pos; ssf < s->
nsubsubframes[sf]; ssf++) {
1121 for (ch = xbr_base_ch; ch < xbr_nchannels; ch++) {
1125 for (band = 0; band < xbr_nsubbands[ch]; band++) {
1126 int ret, trans_ssf, abits = xbr_bit_allocation[ch][
band];
1133 }
else if (abits > 0) {
1146 if (xbr_transition_mode)
1152 if (trans_ssf == 0 || ssf < trans_ssf)
1153 scale = xbr_scale_factors[ch][
band][0];
1155 scale = xbr_scale_factors[ch][
band][1];
1158 audio, step_size, scale, 1);
1181 int xbr_nchsets, xbr_transition_mode, xbr_band_nbits, xbr_base_ch;
1203 for (i = 0; i < xbr_nchsets; i++)
1204 xbr_frame_size[i] =
get_bits(&s->
gb, 14) + 1;
1210 for (i = 0, ch2 = 0; i < xbr_nchsets; i++) {
1213 for (ch1 = 0; ch1 < xbr_nchannels[i]; ch1++, ch2++) {
1214 xbr_nsubbands[ch2] =
get_bits(&s->
gb, xbr_band_nbits) + 1;
1231 for (i = 0, xbr_base_ch = 0; i < xbr_nchsets; i++) {
1234 if (xbr_base_ch + xbr_nchannels[i] <= s->
nchannels) {
1237 for (sf = 0, sub_pos = 0; sf < s->
nsubframes; sf++) {
1239 xbr_base_ch + xbr_nchannels[i],
1240 xbr_nsubbands, xbr_transition_mode,
1246 xbr_base_ch += xbr_nchannels[i];
1262 return (s->
x96_rand & 0x7fffffff) - 0x40000000;
1267 int n, ssf, ch,
band, ofs;
1289 memset(samples, 0, nsamples *
sizeof(
int32_t));
1290 else for (n = 0; n < nsamples; n++)
1296 for (ssf = 0; ssf < (s->
nsubsubframes[sf] + 1) / 2; ssf++) {
1301 for (n = 0; n <
FFMIN(nsamples - ssf * 16, 16); n++)
1302 *samples++ =
clip23(vq_samples[n] * scale + (1 << 3) >> 4);
1310 for (ssf = 0, ofs = *sub_pos; ssf < s->
nsubsubframes[sf]; ssf++) {
1338 audio, step_size, scale, 0);
1355 *sub_pos, nsamples);
1364 s->
nsubbands[src_ch], *sub_pos, nsamples);
1395 nframesamples *
sizeof(
int32_t));
1454 int scale_index = 0;
1459 if ((ret =
parse_scale(s, &scale_index, sel)) < 0)
1481 for (band = s->
nsubbands[ch]; band < s->nsubbands[src_ch]; band++) {
1585 int sf, ch, ret,
band, sub_pos;
1590 for (sf = 0, sub_pos = 0; sf < s->
nsubframes; sf++) {
1651 int x96_nchsets, x96_base_ch;
1683 for (i = 0; i < x96_nchsets; i++)
1684 x96_frame_size[i] =
get_bits(&s->
gb, 12) + 1;
1687 for (i = 0; i < x96_nchsets; i++)
1703 for (i = 0, x96_base_ch = 0; i < x96_nchsets; i++) {
1706 if (x96_base_ch + x96_nchannels[i] <= s->
nchannels) {
1712 x96_base_ch += x96_nchannels[i];
1764 for (i = 0; i < m *
n; i++) {
1766 int sign = (code >> 8) - 1;
1767 unsigned int index = code & 0xff;
1827 for (; sync_pos >= last_pos; sync_pos--) {
1829 s->
gb.
index = (sync_pos + 1) * 32;
1833 && (size == dist || size - 1 == dist)
1852 for (; sync_pos >= last_pos; sync_pos--) {
1854 s->
gb.
index = (sync_pos + 1) * 32;
1857 if (size >= 96 && size == dist) {
1877 for (; sync_pos >= last_pos; sync_pos--) {
1879 s->
gb.
index = (sync_pos + 1) * 32;
1882 if (size >= 11 && size <= dist &&
1884 (sync_pos + 1) * 4, size - 4)) {
1942 int ret = 0, ext = 0;
2065 int n, ch, spkr, nsamples, x96_nchannels = 0;
2144 samples += nsamples / 2;
2171 int i,
n, ch, ret, spkr, nsamples;
2207 scale_inv, nsamples);
2212 for (ch = xch_base; ch < s->
nchannels; ch++) {
2254 for (i = 0; i < avctx->
channels; i++) {
2257 for (n = 0; n < nsamples; n++)
2258 plane[n] =
clip23(samples[n]) * (1 << 8);
2267 int x96_nchannels = 0, x96_synth = 0;
2268 int i,
n, ch, ret, spkr, nsamples, nchannels;
2270 const float *filter_coeff;
2286 for (i = 0; i < avctx->
channels; i++)
2291 if (nchannels > 0) {
2293 nsamples * nchannels *
sizeof(
float));
2301 if (output_samples[spkr])
2303 output_samples[spkr] = ptr;
2329 &s->
imdct[x96_synth],
2330 output_samples[spkr],
2338 1.0f / (1 << (17 - x96_synth)));
2345 int nlfesamples = s->
npcmblocks >> (dec_select + 1);
2349 samples += nsamples / 2;
2382 output_samples[DCA_SPEAKER_Cs],
2395 for (ch = xch_base; ch < s->
nchannels; ch++) {
2401 int coeff = *coeff_ptr++;
2404 output_samples[src_spkr],
2405 coeff * (-1.0f / (1 << 15)),
2416 output_samples[spkr],
2417 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 int ff_dca_seek_bits(GetBitContext *s, int p)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int shift(int a, int b)
static const uint8_t quant_index_sel_nbits[DCA_CODE_BOOKS]
DCAVLC ff_dca_vlc_bit_allocation
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
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 ff_dca_check_crc(AVCodecContext *avctx, GetBitContext *s, int p1, int p2)
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 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]
DCAVLC ff_dca_vlc_transition_mode
static const uint16_t mask[17]
int xxch_crc_present
CRC presence flag for XXCH channel set header.
AVFloatDSPContext * float_dsp
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.
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
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.
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)
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)
struct DCADSPData::@40::@42 fix
int sumdiff_surround
Surround sum/difference flag.
#define DCA_SPEAKER_LAYOUT_2_1
struct DCADSPData::@40::@41 flt
static int parse_optional_info(DCACoreDecoder *s)
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
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)
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)
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)
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.
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.
int8_t transition_mode[DCA_SUBFRAMES][DCA_CHANNELS][DCA_SUBBANDS]
Transition mode.
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
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)
DCAVLC ff_dca_vlc_scale_factor
#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
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]
DCAVLC ff_dca_vlc_quant_index[DCA_CODE_BOOKS]
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]
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)
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.
static int array[MAX_W *MAX_W]
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.
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.