28 #ifndef AVCODEC_AC3ENC_H 29 #define AVCODEC_AC3ENC_H 43 #define AC3ENC_FLOAT 0 48 #define AC3_NAME(x) ff_ac3_float_ ## x 49 #define MAC_COEF(d,a,b) ((d)+=(a)*(b)) 50 #define COEF_MIN (-16777215.0/16777216.0) 51 #define COEF_MAX ( 16777215.0/16777216.0) 52 #define NEW_CPL_COORD_THRESHOLD 0.03 58 #define AC3_NAME(x) ff_ac3_fixed_ ## x 59 #define MAC_COEF(d,a,b) MAC64(d,a,b) 60 #define COEF_MIN -16777215 61 #define COEF_MAX 16777215 62 #define NEW_CPL_COORD_THRESHOLD 503317 69 #define AC3ENC_OPT_NONE -1 70 #define AC3ENC_OPT_AUTO -1 71 #define AC3ENC_OPT_OFF 0 72 #define AC3ENC_OPT_ON 1 73 #define AC3ENC_OPT_NOT_INDICATED 0 74 #define AC3ENC_OPT_MODE_ON 2 75 #define AC3ENC_OPT_MODE_OFF 1 76 #define AC3ENC_OPT_DSUREX_DPLIIZ 3 79 #define AC3ENC_OPT_LARGE_ROOM 1 80 #define AC3ENC_OPT_SMALL_ROOM 2 81 #define AC3ENC_OPT_DOWNMIX_LTRT 1 82 #define AC3ENC_OPT_DOWNMIX_LORO 2 83 #define AC3ENC_OPT_DOWNMIX_DPLII 3 // reserved value in A/52, but used by encoders to indicate DPL2 84 #define AC3ENC_OPT_ADCONV_STANDARD 0 85 #define AC3ENC_OPT_ADCONV_HDCD 1 uint8_t new_rematrixing_strategy
send new rematrixing flags in this block
int ff_ac3_encode_init(AVCodecContext *avctx)
This structure describes decoded (raw) audio or video data.
int db_per_bit_code
dB/bit code (dbpbcod)
int slow_decay_code
slow decay code (sdcycod)
Encoding Options used by AVOption.
float loro_surround_mix_level
int dolby_surround_ex_mode
static int allocate_sample_buffers(AC3EncodeContext *s)
uint8_t ** cpl_coord_exp
coupling coord exponents (cplcoexp)
int bandwidth_code
bandwidth code (0 to 60) (chbwcod)
uint8_t * grouped_exp_buffer
int16_t ** psd
psd per frequency bin
int frame_size_code
frame size code (frmsizecod)
int frame_bits
all frame bits except exponents and mantissas
const uint64_t ff_ac3_channel_layouts[19]
List of supported channel layouts.
uint8_t ** cpl_coord_mant
coupling coord mantissas (cplcomant)
uint16_t ** qmant
quantized mantissas
int ff_ac3_validate_metadata(AC3EncodeContext *s)
Validate metadata options as set by AVOption system.
PutBitContext pb
bitstream writer context
int num_cpl_channels
number of channels in coupling
AC3BitAllocParameters bit_alloc
bit allocation parameters
float ltrt_surround_mix_level
int ff_ac3_float_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
int new_cpl_leak
send new coupling leak info
int rematrixing_enabled
stereo rematrixing enabled
int ff_ac3_float_encode_init(AVCodecContext *avctx)
int channel_mode
channel mode (acmod)
int num_cpl_subbands
number of coupling subbands (ncplsubnd)
int fbw_channels
number of full-bandwidth channels (nfchans)
int slow_gain_code
slow gain code (sgaincod)
uint8_t ** exp
original exponents
int num_rematrixing_bands
number of rematrixing bands
AC3DSPContext ac3dsp
AC-3 optimized functions.
int loro_center_mix_level
Lo/Ro center mix level code.
int num_cpl_bands
number of coupling bands (ncplbnd)
int lfe_channel
channel index of the LFE channel
int ref_bap_set
indicates if ref_bap pointers have been set
int new_snr_offsets
send new SNR offsets
void(* output_frame_header)(struct AC3EncodeContext *s)
int loro_surround_mix_level
Lo/Ro surround mix level code.
CoefType ** mdct_coef
MDCT coefficients.
int num_blks_code
number of blocks code (numblkscod)
AC3EncOptions options
encoding options
int16_t ** band_psd
psd per critical band
AVClass * av_class
AVClass used for AVOption.
float ltrt_center_mix_level
int channels
total number of channels (nchans)
#define AC3_MAX_CHANNELS
maximum number of channels, including coupling channel
int cpl_on
coupling turned on for this frame
int fixed_point
indicates if fixed-point encoder is being used
int ltrt_surround_mix_level
Lt/Rt surround mix level code.
int new_cpl_strategy
send new coupling strategy
int surround_mix_level
surround mix level code
int cpl_in_use
coupling in use for this block (cplinu)
int cpl_enabled
coupling enabled for all frames
Data for a single audio block.
int floor_code
floor code (floorcod)
int bitstream_mode
bitstream mode (bsmod)
int has_surround
indicates if there are one or more surround channels
int eac3
indicates if this is E-AC-3 vs. AC-3
float loro_center_mix_level
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
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
const AVCodecDefault ff_ac3_enc_defaults[]
void ff_ac3_compute_coupling_strategy(AC3EncodeContext *s)
Set the initial coupling strategy parameters prior to coupling analysis.
int exponent_bits
number of bits used for exponents
int coarse_snr_offset
coarse SNR offsets (csnroffst)
int16_t ** mask
masking curve
FFTContext mdct
FFT context for MDCT calculation.
const SampleType * mdct_window
MDCT window function array.
SampleType ** planar_samples
int fast_decay_code
fast decay code (fdcycod)
Libavcodec external API header.
int audio_production_info
main external API structure.
int sample_rate
sampling frequency, in Hz
CoefType * mdct_coef_buffer
int ff_ac3_encode_frame_common_end(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
int has_center
indicates if there is a center channel
int bit_rate
target bit rate, in bits-per-second
const uint8_t * channel_map
channel map used to reorder channels
int frame_bits_fixed
number of non-coefficient bits for fixed parameters
int warned_alternate_bitstream
Describe the class of an AVClass context structure.
uint8_t * cpl_coord_exp_buffer
int ltrt_center_mix_level
Lt/Rt center mix level code.
int ff_ac3_fixed_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
int center_mix_level
center mix level code
AC-3 encoder private context.
SampleType * windowed_samples
int preferred_stereo_downmix
int num_blocks
number of blocks per frame
int ff_ac3_encode_close(AVCodecContext *avctx)
Finalize encoding and free any memory allocated by the encoder.
int frame_size
current frame size in bytes
uint8_t ** grouped_exp
grouped exponents
int cpl_end_freq
coupling channel end frequency bin
#define AC3_MAX_CPL_BANDS
static void mdct_end(FFTContext *s)
static void mdct_init(FFTContext **s, int nbits, int inverse, double scale)
int64_t bits_written
bit count (used to avg. bitrate)
int bitstream_id
bitstream id (bsid)
int16_t * band_psd_buffer
AVCodecContext * avctx
parent AVCodecContext
const AVOption ff_ac3_enc_options[]
int allow_per_frame_metadata
int frame_size_min
minimum frame size in case rounding is necessary
int64_t samples_written
sample count (used to avg. bitrate)
uint8_t * cpl_coord_mant_buffer
int use_frame_exp_strategy
indicates use of frame exp strategy
int cutoff
user-specified cutoff frequency, in Hz
void ff_ac3_adjust_frame_size(AC3EncodeContext *s)
Adjust the frame size to make the average bit rate match the target bit rate.
int lfe_on
indicates if there is an LFE channel (lfeon)
This structure stores compressed data.
Common code between the AC-3 encoder and decoder.
int32_t * fixed_coef_buffer
int32_t ** fixed_coef
fixed-point MDCT coefficients