21 #ifndef AVCODEC_DCA_CORE_H
22 #define AVCODEC_DCA_CORE_H
41 #define DCA_CHANNELS 7
42 #define DCA_SUBBANDS 32
43 #define DCA_SUBBANDS_X96 64
44 #define DCA_SUBFRAMES 16
45 #define DCA_SUBBAND_SAMPLES 8
46 #define DCA_PCMBLOCK_SAMPLES 32
47 #define DCA_LFE_HISTORY 8
48 #define DCA_ABITS_MAX 26
50 #define DCA_CORE_CHANNELS_MAX 6
51 #define DCA_DMIX_CHANNELS_MAX 4
52 #define DCA_XXCH_CHANNELS_MAX 2
53 #define DCA_EXSS_CHANNELS_MAX 8
54 #define DCA_EXSS_CHSETS_MAX 4
56 #define DCA_FILTER_MODE_X96 0x01
57 #define DCA_FILTER_MODE_FIXED 0x02
231 int64_t step_scale = (int64_t)step_size * scale;
235 if (step_scale > (1 << 23)) {
236 shift =
av_log2(step_scale >> 23) + 1;
237 step_scale >>=
shift;
242 for (n = 0; n <
len; n++)
243 output[n] +=
clip23(
norm__(input[n] * step_scale, 22 - shift));
245 for (n = 0; n <
len; n++)
246 output[n] =
clip23(
norm__(input[n] * step_scale, 22 - shift));
int audio_mode
Audio channel arrangement.
int16_t prediction_vq_index[DCA_CHANNELS][DCA_SUBBANDS_X96]
Prediction coefficients VQ address.
int xxch_mask_nbits
Number of bits for loudspeaker mask.
static int shift(int a, int b)
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
Memory handling functions.
int xxch_dmix_embedded
Downmix already performed by encoder.
int ext_audio_type
Extension audio descriptor flag.
int frame_size
Primary frame byte size.
int8_t joint_scale_sel[DCA_CHANNELS]
Joint subband codebook select.
int8_t joint_intensity_index[DCA_CHANNELS]
Joint intensity coding index.
int filter_perfect
Multirate interpolator switch.
float output_history_lfe_float
LFE PCM history for X96 filter.
#define DCA_CORE_CHANNELS_MAX
unsigned int x96_subband_size
int nsubframes
Number of subframes.
DCADSPData dcadsp_data[DCA_CHANNELS]
FIR history buffers.
int32_t scale_factor_adj[DCA_CHANNELS][DCA_CODE_BOOKS]
Scale factor adjustment.
static int32_t clip23(int32_t a)
int x96_rand
Random seed for generating samples for unallocated X96 subbands.
int8_t prediction_mode[DCA_CHANNELS][DCA_SUBBANDS_X96]
Prediction mode.
int source_pcm_res
Source PCM resolution.
int xxch_dmix_scale_inv
Downmix scale factor.
int32_t * subband_samples[DCA_CHANNELS][DCA_SUBBANDS]
Subband samples.
#define DCA_DMIX_CHANNELS_MAX
int filter_mode
Previous filtering mode for detecting changes.
void * output_buffer
PCM output buffer base.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
int prim_dmix_type
Auxiliary primary channel downmix type.
bitstream reader API header.
int32_t * x96_subband_buffer
X96 subband sample buffer base.
static void ff_dca_core_dequantize(int32_t *output, const int32_t *input, int32_t step_size, int32_t scale, int residual, int len)
int ff_dca_core_parse_exss(DCACoreDecoder *s, uint8_t *data, DCAExssAsset *asset)
av_cold void ff_dca_core_flush(DCACoreDecoder *s)
int sync_ssf
Audio sync word insertion flag.
int32_t * subband_buffer
Subband sample buffer base.
int npcmsamples
Number of PCM samples per channel.
int8_t subband_vq_start[DCA_CHANNELS]
High frequency VQ start subband.
int8_t nsubbands[DCA_CHANNELS]
Subband activity count.
int sumdiff_front
Front sum/difference flag.
int8_t nsubsubframes[DCA_SUBFRAMES]
Subsubframe count for each subframe.
int8_t transition_mode_sel[DCA_CHANNELS]
Transient mode code book.
int bit_rate
Transmission bit rate.
int ff_dca_core_parse(DCACoreDecoder *s, uint8_t *data, int size)
int xxch_crc_present
CRC presence flag for XXCH channel set header.
AVFloatDSPContext * float_dsp
int ff_dca_core_filter_fixed(DCACoreDecoder *s, int x96_synth)
int aux_present
Auxiliary data flag.
int32_t * lfe_samples
Decimated LFE samples.
struct DCADSPData::@55::@56 flt
int prim_dmix_embedded
Auxiliary dynamic downmix flag.
int sample_rate
Core audio sampling frequency.
int request_mask
Requested channel layout (for stereo downmix)
int output_rate
Output sample rate (1x or 2x header rate)
int nchannels
Number of primary audio channels (incl. extension channels)
static int ff_dca_core_map_spkr(DCACoreDecoder *core, int spkr)
int xxch_pos
Bit position of XXCH frame in core substream.
int sumdiff_surround
Surround sum/difference flag.
int x96_crc_present
CRC presence flag for X96 channel set header.
av_cold int ff_dca_core_init(DCACoreDecoder *s)
int xxch_core_mask
Core loudspeaker activity mask.
Libavcodec external API header.
int ts_present
Embedded time stamp flag.
int xxch_spkr_mask
Loudspeaker layout mask.
int crc_present
CRC present flag.
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 x96_subband_start
First encoded subband in X96 extension.
int xxch_dmix_coeff[DCA_XXCH_CHANNELS_MAX *DCA_CORE_CHANNELS_MAX]
Downmix coefficients.
int x96_pos
Bit position of X96 frame in core substream.
int xch_pos
Bit position of XCH frame in core substream.
int xxch_dmix_mask[DCA_XXCH_CHANNELS_MAX]
Downmix channel mapping mask.
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.
int x96_rev_no
X96 revision number.
int8_t transition_mode[DCA_SUBFRAMES][DCA_CHANNELS][DCA_SUBBANDS]
Transition mode.
int32_t * output_samples[DCA_SPEAKER_COUNT]
PCM output for fixed point mode.
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.
unsigned int subband_size
int lfe_present
Low frequency effects flag.
int8_t scale_factor_sel[DCA_CHANNELS]
Scale factor code book.
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.
common internal api header.
#define DCA_XXCH_CHANNELS_MAX
common internal and external API header
AVFixedDSPContext * fixed_dsp
struct DCADSPData::@55::@57 fix
static int32_t norm__(int64_t a, int bits)
int ch_mask
Speaker layout mask (incl. LFE and extension channels)
av_cold void ff_dca_core_close(DCACoreDecoder *s)
int drc_present
Embedded dynamic range flag.
int ff_dca_core_filter_frame(DCACoreDecoder *s, AVFrame *frame)
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.
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.
int npcmblocks
Number of PCM sample blocks.