Go to the documentation of this file.
28 #ifndef AVCODEC_AC3ENC_H
29 #define AVCODEC_AC3ENC_H
47 #define AC3ENC_FLOAT 0
52 #define MAC_COEF(d,a,b) ((d)+=(a)*(b))
53 #define COEF_MIN (-16777215.0/16777216.0)
54 #define COEF_MAX ( 16777215.0/16777216.0)
55 #define NEW_CPL_COORD_THRESHOLD 0.03
61 #define MAC_COEF(d,a,b) MAC64(d,a,b)
62 #define COEF_MIN -16777215
63 #define COEF_MAX 16777215
64 #define NEW_CPL_COORD_THRESHOLD 503317
71 #define AC3ENC_OPT_NONE -1
72 #define AC3ENC_OPT_AUTO -1
73 #define AC3ENC_OPT_OFF 0
74 #define AC3ENC_OPT_ON 1
75 #define AC3ENC_OPT_NOT_INDICATED 0
76 #define AC3ENC_OPT_MODE_ON 2
77 #define AC3ENC_OPT_MODE_OFF 1
78 #define AC3ENC_OPT_DSUREX_DPLIIZ 3
81 #define AC3ENC_OPT_LARGE_ROOM 1
82 #define AC3ENC_OPT_SMALL_ROOM 2
83 #define AC3ENC_OPT_DOWNMIX_LTRT 1
84 #define AC3ENC_OPT_DOWNMIX_LORO 2
85 #define AC3ENC_OPT_DOWNMIX_DPLII 3 // reserved value in A/52, but used by encoders to indicate DPL2
86 #define AC3ENC_OPT_ADCONV_STANDARD 0
87 #define AC3ENC_OPT_ADCONV_HDCD 1
int64_t samples_written
sample count (used to avg. bitrate)
int db_per_bit_code
dB/bit code (dbpbcod)
int ff_ac3_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
int lfe_on
indicates if there is an LFE channel (lfeon)
CoefType * mdct_coef[AC3_MAX_CHANNELS]
MDCT coefficients.
int ff_ac3_encode_close(AVCodecContext *avctx)
Finalize encoding and free any memory allocated by the encoder.
int frame_bits
all frame bits except exponents and mantissas
int frame_size_code
frame size code (frmsizecod)
uint8_t exp_strategy[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]
exponent strategies
int slow_decay_code
slow decay code (sdcycod)
uint8_t channel_in_cpl[AC3_MAX_CHANNELS]
channel in coupling (chincpl)
AC3BitAllocParameters bit_alloc
bit allocation parameters
float ltrt_surround_mix_level
This structure describes decoded (raw) audio or video data.
int channel_mode
channel mode (acmod)
int bandwidth_code
bandwidth code (0 to 60) (chbwcod)
uint8_t * planar_samples[AC3_MAX_CHANNELS - 1]
int end_freq[AC3_MAX_CHANNELS]
end frequency bin (endmant)
uint8_t * grouped_exp_buffer
int rematrixing_enabled
stereo rematrixing enabled
#define AC3_MAX_CPL_BANDS
int start_freq[AC3_MAX_CHANNELS]
start frequency bin (strtmant)
uint8_t * exp[AC3_MAX_CHANNELS]
original exponents
int new_snr_offsets
send new SNR offsets
int ff_ac3_float_encode_init(AVCodecContext *avctx)
int num_cpl_channels
number of channels in coupling
int num_cpl_subbands
number of coupling subbands (ncplsubnd)
int fbw_channels
number of full-bandwidth channels (nfchans)
int num_blks_code
number of blocks code (numblkscod)
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
int32_t windowed_samples_fixed[AC3_WINDOW_SIZE]
void(* encode_frame)(struct AC3EncodeContext *s, uint8_t *const *samples)
fixed vs.
int slow_gain_code
slow gain code (sgaincod)
int channels
total number of channels (nchans)
AC3EncOptions options
encoding options
AC3DSPContext ac3dsp
AC-3 optimized functions.
uint8_t * grouped_exp[AC3_MAX_CHANNELS]
grouped exponents
int cpl_on
coupling turned on for this frame
int ref_bap_set
indicates if ref_bap pointers have been set
int loro_center_mix_level
Lo/Ro center mix level code.
int lfe_channel
channel index of the LFE channel
AVTXContext * tx
FFT context for MDCT calculation.
int audio_production_info
int num_cpl_bands
number of coupling bands (ncplbnd)
int ltrt_surround_mix_level
Lt/Rt surround mix level code.
uint8_t * cpl_coord_exp[AC3_MAX_CHANNELS]
coupling coord exponents (cplcoexp)
int loro_surround_mix_level
Lo/Ro surround mix level code.
int cpl_enabled
coupling enabled for all frames
int floor_code
floor code (floorcod)
Describe the class of an AVClass context structure.
const AVChannelLayout ff_ac3_ch_layouts[19]
List of supported channel layouts.
AVClass * av_class
AVClass used for AVOption.
uint8_t frame_exp_strategy[AC3_MAX_CHANNELS]
frame exp strategy index
uint16_t * qmant[AC3_MAX_CHANNELS]
quantized mantissas
int eac3
indicates if this is E-AC-3 vs. AC-3
uint8_t * cpl_coord_buffer
int fixed_point
indicates if fixed-point encoder is being used
int surround_mix_level
surround mix level code
AC-3 encoder private context.
#define AC3_MAX_CHANNELS
maximum number of channels, including coupling channel
uint8_t * cpl_coord_mant[AC3_MAX_CHANNELS]
coupling coord mantissas (cplcomant)
int coarse_snr_offset
coarse SNR offsets (csnroffst)
Data for a single audio block.
int16_t * band_psd[AC3_MAX_CHANNELS]
psd per critical band
int has_surround
indicates if there are one or more surround channels
int new_cpl_strategy
send new coupling strategy
int bitstream_mode
bitstream mode (bsmod)
uint8_t cpl_master_exp[AC3_MAX_CHANNELS]
coupling coord master exponents (mstrcplco)
uint8_t * ref_bap[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]
bit allocation pointers (bap)
int fast_decay_code
fast decay code (fdcycod)
int dolby_surround_ex_mode
An AVChannelLayout holds information about the channel layout of audio data.
#define DECLARE_ALIGNED(n, t, v)
float mdct_window_float[AC3_BLOCK_SIZE]
int fast_gain_code[AC3_MAX_CHANNELS]
fast gain codes (signal-to-mask ratio) (fgaincod)
int bit_rate
target bit rate, in bits-per-second
int16_t * psd[AC3_MAX_CHANNELS]
psd per frequency bin
Encoding Options used by AVOption.
CoefType * mdct_coef_buffer
const AVClass ff_ac3enc_class
const uint8_t * channel_map
channel map used to reorder channels
int sample_rate
sampling frequency, in Hz
int32_t mdct_window_fixed[AC3_BLOCK_SIZE]
int exponent_bits
number of bits used for exponents
int new_cpl_leak
send new coupling leak info
int center_mix_level
center mix level code
void ff_ac3_compute_coupling_strategy(AC3EncodeContext *s)
Set the initial coupling strategy parameters prior to coupling analysis.
AC3Block blocks[AC3_MAX_BLOCKS]
per-block info
int has_center
indicates if there is a center channel
uint8_t rematrixing_flags[4]
rematrixing flags
int num_blocks
number of blocks per frame
uint8_t cpl_band_sizes[AC3_MAX_CPL_BANDS]
number of coeffs in each coupling band
int ltrt_center_mix_level
Lt/Rt center mix level code.
int frame_bits_fixed
number of non-coefficient bits for fixed parameters
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
float loro_surround_mix_level
int64_t bits_written
bit count (used to avg. bitrate)
int cpl_end_freq
coupling channel end frequency bin
float ltrt_center_mix_level
int ff_ac3_encode_init(AVCodecContext *avctx)
int num_rematrixing_bands
number of rematrixing bands
int preferred_stereo_downmix
main external API structure.
int allow_per_frame_metadata
int bitstream_id
bitstream id (bsid)
int frame_size
current frame size in bytes
int16_t * band_psd_buffer
uint8_t exp_ref_block[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]
reference blocks for EXP_REUSE
void(* output_frame_header)(struct AC3EncodeContext *s, struct PutBitContext *pb)
Filter the word “frame” indicates either a video frame or a group of audio samples
float windowed_samples_float[AC3_WINDOW_SIZE]
This structure stores compressed data.
AVCodecContext * avctx
parent AVCodecContext
int use_frame_exp_strategy
indicates use of frame exp strategy
int fine_snr_offset[AC3_MAX_CHANNELS]
fine SNR offsets (fsnroffst)
uint8_t new_rematrixing_strategy
send new rematrixing flags in this block
const FFCodecDefault ff_ac3_enc_defaults[]
int frame_size_min
minimum frame size in case rounding is necessary
int32_t * fixed_coef[AC3_MAX_CHANNELS]
fixed-point MDCT coefficients
int32_t * fixed_coef_buffer
uint8_t new_cpl_coords[AC3_MAX_CHANNELS]
send new coupling coordinates (cplcoe)
int16_t * mask[AC3_MAX_CHANNELS]
masking curve
int cpl_in_use
coupling in use for this block (cplinu)
const AVOption ff_ac3_enc_options[]
float loro_center_mix_level
int cutoff
user-specified cutoff frequency, in Hz