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.
struct DCADSPData::@51::@53 fix
int xxch_mask_nbits
Number of bits for loudspeaker mask.
static int shift(int a, int b)
This structure describes decoded (raw) audio or video 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.
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.
static int32_t clip23(int32_t a)
int x96_rand
Random seed for generating samples for unallocated X96 subbands.
int source_pcm_res
Source PCM resolution.
int xxch_dmix_scale_inv
Downmix scale factor.
#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.
int sumdiff_front
Front sum/difference flag.
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
struct DCADSPData::@51::@52 flt
int ff_dca_core_filter_fixed(DCACoreDecoder *s, int x96_synth)
int aux_present
Auxiliary data flag.
int32_t * lfe_samples
Decimated LFE samples.
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.
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 x96_pos
Bit position of X96 frame in core substream.
int xch_pos
Bit position of XCH frame in core substream.
int x96_rev_no
X96 revision number.
int x96_nchannels
Number of primary channels in X96 extension.
unsigned int subband_size
int lfe_present
Low frequency effects flag.
common internal api header.
#define DCA_XXCH_CHANNELS_MAX
common internal and external API header
static int bit_allocation(IMCContext *q, IMCChannel *chctx, int stream_format_code, int freebits, int flag)
Perform bit allocation depending on bits available.
AVFixedDSPContext * fixed_dsp
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.
int npcmblocks
Number of PCM sample blocks.