FFmpeg
ac3enc.h
Go to the documentation of this file.
1 /*
2  * AC-3 encoder & E-AC-3 encoder common header
3  * Copyright (c) 2000 Fabrice Bellard
4  * Copyright (c) 2006-2010 Justin Ruggles <justin.ruggles@gmail.com>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * AC-3 encoder & E-AC-3 encoder common header
26  */
27 
28 #ifndef AVCODEC_AC3ENC_H
29 #define AVCODEC_AC3ENC_H
30 
31 #include <stdint.h>
32 
33 #include "libavutil/opt.h"
34 #include "ac3.h"
35 #include "ac3defs.h"
36 #include "ac3dsp.h"
37 #include "avcodec.h"
38 #include "codec_internal.h"
39 #include "fft.h"
40 #include "mathops.h"
41 #include "me_cmp.h"
42 #include "put_bits.h"
43 #include "audiodsp.h"
44 
45 #ifndef AC3ENC_FLOAT
46 #define AC3ENC_FLOAT 0
47 #endif
48 
49 #if AC3ENC_FLOAT
50 #include "libavutil/float_dsp.h"
51 #define AC3_NAME(x) ff_ac3_float_ ## x
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
56 typedef float SampleType;
57 typedef float CoefType;
58 typedef float CoefSumType;
59 #else
60 #include "libavutil/fixed_dsp.h"
61 #define AC3_NAME(x) ff_ac3_fixed_ ## x
62 #define MAC_COEF(d,a,b) MAC64(d,a,b)
63 #define COEF_MIN -16777215
64 #define COEF_MAX 16777215
65 #define NEW_CPL_COORD_THRESHOLD 503317
67 typedef int32_t CoefType;
68 typedef int64_t CoefSumType;
69 #endif
70 
71 /* common option values */
72 #define AC3ENC_OPT_NONE -1
73 #define AC3ENC_OPT_AUTO -1
74 #define AC3ENC_OPT_OFF 0
75 #define AC3ENC_OPT_ON 1
76 #define AC3ENC_OPT_NOT_INDICATED 0
77 #define AC3ENC_OPT_MODE_ON 2
78 #define AC3ENC_OPT_MODE_OFF 1
79 #define AC3ENC_OPT_DSUREX_DPLIIZ 3
80 
81 /* specific option values */
82 #define AC3ENC_OPT_LARGE_ROOM 1
83 #define AC3ENC_OPT_SMALL_ROOM 2
84 #define AC3ENC_OPT_DOWNMIX_LTRT 1
85 #define AC3ENC_OPT_DOWNMIX_LORO 2
86 #define AC3ENC_OPT_DOWNMIX_DPLII 3 // reserved value in A/52, but used by encoders to indicate DPL2
87 #define AC3ENC_OPT_ADCONV_STANDARD 0
88 #define AC3ENC_OPT_ADCONV_HDCD 1
89 
90 
91 /**
92  * Encoding Options used by AVOption.
93  */
94 typedef struct AC3EncOptions {
95  /* AC-3 metadata options*/
105  int original;
118 
119  /* other encoding options */
124 } AC3EncOptions;
125 
126 /**
127  * Data for a single audio block.
128  */
129 typedef struct AC3Block {
130  CoefType **mdct_coef; ///< MDCT coefficients
131  int32_t **fixed_coef; ///< fixed-point MDCT coefficients
132  uint8_t **exp; ///< original exponents
133  uint8_t **grouped_exp; ///< grouped exponents
134  int16_t **psd; ///< psd per frequency bin
135  int16_t **band_psd; ///< psd per critical band
136  int16_t **mask; ///< masking curve
137  uint16_t **qmant; ///< quantized mantissas
138  uint8_t **cpl_coord_exp; ///< coupling coord exponents (cplcoexp)
139  uint8_t **cpl_coord_mant; ///< coupling coord mantissas (cplcomant)
140  uint8_t new_rematrixing_strategy; ///< send new rematrixing flags in this block
141  int num_rematrixing_bands; ///< number of rematrixing bands
142  uint8_t rematrixing_flags[4]; ///< rematrixing flags
143  int new_cpl_strategy; ///< send new coupling strategy
144  int cpl_in_use; ///< coupling in use for this block (cplinu)
145  uint8_t channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling (chincpl)
146  int num_cpl_channels; ///< number of channels in coupling
147  uint8_t new_cpl_coords[AC3_MAX_CHANNELS]; ///< send new coupling coordinates (cplcoe)
148  uint8_t cpl_master_exp[AC3_MAX_CHANNELS]; ///< coupling coord master exponents (mstrcplco)
149  int new_snr_offsets; ///< send new SNR offsets
150  int new_cpl_leak; ///< send new coupling leak info
151  int end_freq[AC3_MAX_CHANNELS]; ///< end frequency bin (endmant)
152 } AC3Block;
153 
154 /**
155  * AC-3 encoder private context.
156  */
157 typedef struct AC3EncodeContext {
158  AVClass *av_class; ///< AVClass used for AVOption
159  AC3EncOptions options; ///< encoding options
160  AVCodecContext *avctx; ///< parent AVCodecContext
161  PutBitContext pb; ///< bitstream writer context
163 #if AC3ENC_FLOAT
165 #else
167 #endif
169  AC3DSPContext ac3dsp; ///< AC-3 optimized functions
170  FFTContext mdct; ///< FFT context for MDCT calculation
171  const SampleType *mdct_window; ///< MDCT window function array
172 
173  AC3Block blocks[AC3_MAX_BLOCKS]; ///< per-block info
174 
175  int fixed_point; ///< indicates if fixed-point encoder is being used
176  int eac3; ///< indicates if this is E-AC-3 vs. AC-3
177  int bitstream_id; ///< bitstream id (bsid)
178  int bitstream_mode; ///< bitstream mode (bsmod)
179 
180  int bit_rate; ///< target bit rate, in bits-per-second
181  int sample_rate; ///< sampling frequency, in Hz
182 
183  int num_blks_code; ///< number of blocks code (numblkscod)
184  int num_blocks; ///< number of blocks per frame
185  int frame_size_min; ///< minimum frame size in case rounding is necessary
186  int frame_size; ///< current frame size in bytes
187  int frame_size_code; ///< frame size code (frmsizecod)
188  uint16_t crc_inv[2];
189  int64_t bits_written; ///< bit count (used to avg. bitrate)
190  int64_t samples_written; ///< sample count (used to avg. bitrate)
191 
192  int fbw_channels; ///< number of full-bandwidth channels (nfchans)
193  int channels; ///< total number of channels (nchans)
194  int lfe_on; ///< indicates if there is an LFE channel (lfeon)
195  int lfe_channel; ///< channel index of the LFE channel
196  int has_center; ///< indicates if there is a center channel
197  int has_surround; ///< indicates if there are one or more surround channels
198  int channel_mode; ///< channel mode (acmod)
199  const uint8_t *channel_map; ///< channel map used to reorder channels
200 
201  int center_mix_level; ///< center mix level code
202  int surround_mix_level; ///< surround mix level code
203  int ltrt_center_mix_level; ///< Lt/Rt center mix level code
204  int ltrt_surround_mix_level; ///< Lt/Rt surround mix level code
205  int loro_center_mix_level; ///< Lo/Ro center mix level code
206  int loro_surround_mix_level; ///< Lo/Ro surround mix level code
207 
208  int cutoff; ///< user-specified cutoff frequency, in Hz
209  int bandwidth_code; ///< bandwidth code (0 to 60) (chbwcod)
210  int start_freq[AC3_MAX_CHANNELS]; ///< start frequency bin (strtmant)
211  int cpl_end_freq; ///< coupling channel end frequency bin
212 
213  int cpl_on; ///< coupling turned on for this frame
214  int cpl_enabled; ///< coupling enabled for all frames
215  int num_cpl_subbands; ///< number of coupling subbands (ncplsubnd)
216  int num_cpl_bands; ///< number of coupling bands (ncplbnd)
217  uint8_t cpl_band_sizes[AC3_MAX_CPL_BANDS]; ///< number of coeffs in each coupling band
218 
219  int rematrixing_enabled; ///< stereo rematrixing enabled
220 
221  /* bitrate allocation control */
222  int slow_gain_code; ///< slow gain code (sgaincod)
223  int slow_decay_code; ///< slow decay code (sdcycod)
224  int fast_decay_code; ///< fast decay code (fdcycod)
225  int db_per_bit_code; ///< dB/bit code (dbpbcod)
226  int floor_code; ///< floor code (floorcod)
227  AC3BitAllocParameters bit_alloc; ///< bit allocation parameters
228  int coarse_snr_offset; ///< coarse SNR offsets (csnroffst)
229  int fast_gain_code[AC3_MAX_CHANNELS]; ///< fast gain codes (signal-to-mask ratio) (fgaincod)
230  int fine_snr_offset[AC3_MAX_CHANNELS]; ///< fine SNR offsets (fsnroffst)
231  int frame_bits_fixed; ///< number of non-coefficient bits for fixed parameters
232  int frame_bits; ///< all frame bits except exponents and mantissas
233  int exponent_bits; ///< number of bits used for exponents
234 
237  uint8_t *bap_buffer;
238  uint8_t *bap1_buffer;
241  uint8_t *exp_buffer;
243  int16_t *psd_buffer;
244  int16_t *band_psd_buffer;
245  int16_t *mask_buffer;
246  int16_t *qmant_buffer;
249 
250  uint8_t exp_strategy[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< exponent strategies
251  uint8_t frame_exp_strategy[AC3_MAX_CHANNELS]; ///< frame exp strategy index
252  int use_frame_exp_strategy; ///< indicates use of frame exp strategy
253  uint8_t exp_ref_block[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< reference blocks for EXP_REUSE
254  uint8_t *ref_bap [AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< bit allocation pointers (bap)
255  int ref_bap_set; ///< indicates if ref_bap pointers have been set
256 
258 
259  /* fixed vs. float function pointers */
260  void (*mdct_end)(struct AC3EncodeContext *s);
262 
263  /* fixed vs. float templated function pointers */
265 
266  /* AC-3 vs. E-AC-3 function pointers */
269 
270 #if FF_API_OLD_CHANNEL_LAYOUT
271 extern const uint64_t ff_ac3_channel_layouts[19];
272 #endif
273 extern const AVChannelLayout ff_ac3_ch_layouts[19];
274 extern const AVOption ff_ac3_enc_options[];
275 extern const AVClass ff_ac3enc_class;
276 extern const FFCodecDefault ff_ac3_enc_defaults[];
277 
280 
282 
284 
286 
288 
290  const AVFrame *frame, int *got_packet_ptr);
291 
292 /* prototypes for functions in ac3enc_template.c */
293 
295  const AVFrame *frame, int *got_packet_ptr);
297  const AVFrame *frame, int *got_packet_ptr);
298 
299 #endif /* AVCODEC_AC3ENC_H */
AC3EncodeContext::samples_written
int64_t samples_written
sample count (used to avg. bitrate)
Definition: ac3enc.h:190
AC3Block::fixed_coef
int32_t ** fixed_coef
fixed-point MDCT coefficients
Definition: ac3enc.h:131
AC3EncodeContext::db_per_bit_code
int db_per_bit_code
dB/bit code (dbpbcod)
Definition: ac3enc.h:225
AC3EncOptions::mixing_level
int mixing_level
Definition: ac3enc.h:102
AC3EncodeContext::lfe_on
int lfe_on
indicates if there is an LFE channel (lfeon)
Definition: ac3enc.h:194
opt.h
ff_ac3_encode_close
int ff_ac3_encode_close(AVCodecContext *avctx)
Finalize encoding and free any memory allocated by the encoder.
Definition: ac3enc.c:2169
AC3EncodeContext::frame_bits
int frame_bits
all frame bits except exponents and mantissas
Definition: ac3enc.h:232
AC3EncOptions::dolby_headphone_mode
int dolby_headphone_mode
Definition: ac3enc.h:114
AC3Block::exp
uint8_t ** exp
original exponents
Definition: ac3enc.h:132
AC3EncodeContext::mdct_end
void(* mdct_end)(struct AC3EncodeContext *s)
Definition: ac3enc.h:260
AC3EncodeContext::frame_size_code
int frame_size_code
frame size code (frmsizecod)
Definition: ac3enc.h:187
AC3EncodeContext::exp_strategy
uint8_t exp_strategy[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]
exponent strategies
Definition: ac3enc.h:250
AC3EncodeContext::slow_decay_code
int slow_decay_code
slow decay code (sdcycod)
Definition: ac3enc.h:223
AC3EncodeContext::pb
PutBitContext pb
bitstream writer context
Definition: ac3enc.h:161
AC3Block::grouped_exp
uint8_t ** grouped_exp
grouped exponents
Definition: ac3enc.h:133
AC3EncOptions::cpl_start
int cpl_start
Definition: ac3enc.h:123
AC3Block::channel_in_cpl
uint8_t channel_in_cpl[AC3_MAX_CHANNELS]
channel in coupling (chincpl)
Definition: ac3enc.h:145
AC3EncodeContext::bit_alloc
AC3BitAllocParameters bit_alloc
bit allocation parameters
Definition: ac3enc.h:227
AC3EncodeContext::mdct_init
int(* mdct_init)(struct AC3EncodeContext *s)
Definition: ac3enc.h:261
AC3EncOptions::ltrt_surround_mix_level
float ltrt_surround_mix_level
Definition: ac3enc.h:109
AC3EncOptions::dialogue_level
int dialogue_level
Definition: ac3enc.h:96
SampleType
int32_t SampleType
Definition: ac3enc.h:66
AC3DSPContext
Definition: ac3dsp.h:33
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:325
AC3EncOptions::dolby_surround_mode
int dolby_surround_mode
Definition: ac3enc.h:100
AVOption
AVOption.
Definition: opt.h:251
ff_ac3_validate_metadata
int ff_ac3_validate_metadata(AC3EncodeContext *s)
Validate metadata options as set by AVOption system.
Definition: ac3enc.c:1986
AC3EncodeContext::channel_mode
int channel_mode
channel mode (acmod)
Definition: ac3enc.h:198
AC3EncodeContext::bandwidth_code
int bandwidth_code
bandwidth code (0 to 60) (chbwcod)
Definition: ac3enc.h:209
AC3EncOptions::center_mix_level
float center_mix_level
Definition: ac3enc.h:98
AC3Block::end_freq
int end_freq[AC3_MAX_CHANNELS]
end frequency bin (endmant)
Definition: ac3enc.h:151
AVFixedDSPContext
Definition: fixed_dsp.h:56
AC3EncodeContext::grouped_exp_buffer
uint8_t * grouped_exp_buffer
Definition: ac3enc.h:242
AC3EncodeContext::rematrixing_enabled
int rematrixing_enabled
stereo rematrixing enabled
Definition: ac3enc.h:219
AC3_MAX_CPL_BANDS
#define AC3_MAX_CPL_BANDS
Definition: ac3defs.h:35
ff_ac3_float_encode_frame
int ff_ac3_float_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
AC3EncodeContext::start_freq
int start_freq[AC3_MAX_CHANNELS]
start frequency bin (strtmant)
Definition: ac3enc.h:210
FFCodecDefault
Definition: codec_internal.h:82
AC3Block::new_snr_offsets
int new_snr_offsets
send new SNR offsets
Definition: ac3enc.h:149
ff_ac3_float_encode_init
int ff_ac3_float_encode_init(AVCodecContext *avctx)
Definition: ac3enc_float.c:114
AC3Block::num_cpl_channels
int num_cpl_channels
number of channels in coupling
Definition: ac3enc.h:146
AC3EncOptions::stereo_rematrixing
int stereo_rematrixing
Definition: ac3enc.h:121
AC3EncodeContext::num_cpl_subbands
int num_cpl_subbands
number of coupling subbands (ncplsubnd)
Definition: ac3enc.h:215
AC3EncOptions::eac3_mixing_metadata
int eac3_mixing_metadata
Definition: ac3enc.h:116
AC3EncodeContext::fbw_channels
int fbw_channels
number of full-bandwidth channels (nfchans)
Definition: ac3enc.h:192
AC3EncodeContext::num_blks_code
int num_blks_code
number of blocks code (numblkscod)
Definition: ac3enc.h:183
AC3EncodeContext::slow_gain_code
int slow_gain_code
slow gain code (sgaincod)
Definition: ac3enc.h:222
s
#define s(width, name)
Definition: cbs_vp9.c:256
AC3EncodeContext::bap1_buffer
uint8_t * bap1_buffer
Definition: ac3enc.h:238
AC3EncodeContext::channels
int channels
total number of channels (nchans)
Definition: ac3enc.h:193
AC3EncodeContext::options
AC3EncOptions options
encoding options
Definition: ac3enc.h:159
AC3EncodeContext::ac3dsp
AC3DSPContext ac3dsp
AC-3 optimized functions.
Definition: ac3enc.h:169
AC3EncodeContext::fdsp
AVFixedDSPContext * fdsp
Definition: ac3enc.h:166
AC3EncodeContext::cpl_on
int cpl_on
coupling turned on for this frame
Definition: ac3enc.h:213
AC3EncodeContext::ref_bap_set
int ref_bap_set
indicates if ref_bap pointers have been set
Definition: ac3enc.h:255
AC3EncodeContext::crc_inv
uint16_t crc_inv[2]
Definition: ac3enc.h:188
AC3EncodeContext::loro_center_mix_level
int loro_center_mix_level
Lo/Ro center mix level code.
Definition: ac3enc.h:205
AC3EncodeContext::output_frame_header
void(* output_frame_header)(struct AC3EncodeContext *s)
Definition: ac3enc.h:267
AC3EncodeContext::lfe_channel
int lfe_channel
channel index of the LFE channel
Definition: ac3enc.h:195
AC3EncodeContext::mask_buffer
int16_t * mask_buffer
Definition: ac3enc.h:245
AC3EncodeContext::psd_buffer
int16_t * psd_buffer
Definition: ac3enc.h:243
AC3EncOptions::audio_production_info
int audio_production_info
Definition: ac3enc.h:101
AC3EncodeContext::num_cpl_bands
int num_cpl_bands
number of coupling bands (ncplbnd)
Definition: ac3enc.h:216
fixed_dsp.h
AC3EncodeContext::ltrt_surround_mix_level
int ltrt_surround_mix_level
Lt/Rt surround mix level code.
Definition: ac3enc.h:204
AC3EncOptions::bitstream_mode
int bitstream_mode
Definition: ac3enc.h:97
PutBitContext
Definition: put_bits.h:50
AC3EncodeContext::loro_surround_mix_level
int loro_surround_mix_level
Lo/Ro surround mix level code.
Definition: ac3enc.h:206
AC3EncodeContext::cpl_enabled
int cpl_enabled
coupling enabled for all frames
Definition: ac3enc.h:214
AC3EncodeContext::floor_code
int floor_code
floor code (floorcod)
Definition: ac3enc.h:226
ac3defs.h
MECmpContext
Definition: me_cmp.h:53
AC3Block::qmant
uint16_t ** qmant
quantized mantissas
Definition: ac3enc.h:137
AC3EncOptions::ad_converter_type
int ad_converter_type
Definition: ac3enc.h:115
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
ff_ac3_ch_layouts
const AVChannelLayout ff_ac3_ch_layouts[19]
List of supported channel layouts.
Definition: ac3enc.c:178
AC3EncodeContext::av_class
AVClass * av_class
AVClass used for AVOption.
Definition: ac3enc.h:158
AC3EncodeContext::frame_exp_strategy
uint8_t frame_exp_strategy[AC3_MAX_CHANNELS]
frame exp strategy index
Definition: ac3enc.h:251
CoefSumType
int64_t CoefSumType
Definition: ac3enc.h:68
AC3EncodeContext::eac3
int eac3
indicates if this is E-AC-3 vs. AC-3
Definition: ac3enc.h:176
mathops.h
AC3Block::band_psd
int16_t ** band_psd
psd per critical band
Definition: ac3enc.h:135
ac3dsp.h
AC3EncodeContext::fixed_point
int fixed_point
indicates if fixed-point encoder is being used
Definition: ac3enc.h:175
AC3EncodeContext::surround_mix_level
int surround_mix_level
surround mix level code
Definition: ac3enc.h:202
AC3EncodeContext
AC-3 encoder private context.
Definition: ac3enc.h:157
AC3_MAX_CHANNELS
#define AC3_MAX_CHANNELS
maximum number of channels, including coupling channel
Definition: ac3defs.h:26
AC3EncodeContext::coarse_snr_offset
int coarse_snr_offset
coarse SNR offsets (csnroffst)
Definition: ac3enc.h:228
AC3EncOptions::extended_bsi_1
int extended_bsi_1
Definition: ac3enc.h:106
AC3EncOptions::copyright
int copyright
Definition: ac3enc.h:104
AC3Block
Data for a single audio block.
Definition: ac3enc.h:129
AC3EncodeContext::has_surround
int has_surround
indicates if there are one or more surround channels
Definition: ac3enc.h:197
float_dsp.h
AC3EncodeContext::planar_samples
SampleType ** planar_samples
Definition: ac3enc.h:236
AC3Block::new_cpl_strategy
int new_cpl_strategy
send new coupling strategy
Definition: ac3enc.h:143
AC3EncodeContext::adsp
AudioDSPContext adsp
Definition: ac3enc.h:162
AC3EncodeContext::bitstream_mode
int bitstream_mode
bitstream mode (bsmod)
Definition: ac3enc.h:178
AC3Block::cpl_master_exp
uint8_t cpl_master_exp[AC3_MAX_CHANNELS]
coupling coord master exponents (mstrcplco)
Definition: ac3enc.h:148
AC3EncodeContext::ref_bap
uint8_t * ref_bap[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]
bit allocation pointers (bap)
Definition: ac3enc.h:254
AC3EncOptions::eac3_info_metadata
int eac3_info_metadata
Definition: ac3enc.h:117
AC3EncodeContext::fast_decay_code
int fast_decay_code
fast decay code (fdcycod)
Definition: ac3enc.h:224
AC3EncOptions::dolby_surround_ex_mode
int dolby_surround_ex_mode
Definition: ac3enc.h:113
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:290
codec_internal.h
AC3Block::mask
int16_t ** mask
masking curve
Definition: ac3enc.h:136
AC3Block::psd
int16_t ** psd
psd per frequency bin
Definition: ac3enc.h:134
AC3EncodeContext::fast_gain_code
int fast_gain_code[AC3_MAX_CHANNELS]
fast gain codes (signal-to-mask ratio) (fgaincod)
Definition: ac3enc.h:229
AC3EncodeContext::bit_rate
int bit_rate
target bit rate, in bits-per-second
Definition: ac3enc.h:180
AC3EncOptions::room_type
int room_type
Definition: ac3enc.h:103
AC3EncOptions
Encoding Options used by AVOption.
Definition: ac3enc.h:94
AVFloatDSPContext
Definition: float_dsp.h:24
AC3EncodeContext::mdct_coef_buffer
CoefType * mdct_coef_buffer
Definition: ac3enc.h:239
ff_ac3enc_class
const AVClass ff_ac3enc_class
Definition: ac3enc.c:132
AC3EncodeContext::channel_map
const uint8_t * channel_map
channel map used to reorder channels
Definition: ac3enc.h:199
AC3EncodeContext::sample_rate
int sample_rate
sampling frequency, in Hz
Definition: ac3enc.h:181
AC3EncodeContext::mdct
FFTContext mdct
FFT context for MDCT calculation.
Definition: ac3enc.h:170
AC3Block::cpl_coord_exp
uint8_t ** cpl_coord_exp
coupling coord exponents (cplcoexp)
Definition: ac3enc.h:138
AC3EncodeContext::mdct_window
const SampleType * mdct_window
MDCT window function array.
Definition: ac3enc.h:171
AC3EncodeContext::warned_alternate_bitstream
int warned_alternate_bitstream
Definition: ac3enc.h:257
AC3EncodeContext::exponent_bits
int exponent_bits
number of bits used for exponents
Definition: ac3enc.h:233
AC3Block::new_cpl_leak
int new_cpl_leak
send new coupling leak info
Definition: ac3enc.h:150
AC3EncodeContext::cpl_coord_exp_buffer
uint8_t * cpl_coord_exp_buffer
Definition: ac3enc.h:247
AC3EncodeContext::center_mix_level
int center_mix_level
center mix level code
Definition: ac3enc.h:201
AC3EncodeContext::qmant_buffer
int16_t * qmant_buffer
Definition: ac3enc.h:246
ff_ac3_compute_coupling_strategy
void ff_ac3_compute_coupling_strategy(AC3EncodeContext *s)
Set the initial coupling strategy parameters prior to coupling analysis.
Definition: ac3enc.c:325
AC3Block::cpl_coord_mant
uint8_t ** cpl_coord_mant
coupling coord mantissas (cplcomant)
Definition: ac3enc.h:139
FFTContext
Definition: fft.h:75
AC3EncodeContext::blocks
AC3Block blocks[AC3_MAX_BLOCKS]
per-block info
Definition: ac3enc.h:173
AC3EncodeContext::has_center
int has_center
indicates if there is a center channel
Definition: ac3enc.h:196
ff_ac3_fixed_encode_frame
int ff_ac3_fixed_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
AC3Block::rematrixing_flags
uint8_t rematrixing_flags[4]
rematrixing flags
Definition: ac3enc.h:142
AC3EncOptions::original
int original
Definition: ac3enc.h:105
AC3EncodeContext::num_blocks
int num_blocks
number of blocks per frame
Definition: ac3enc.h:184
AC3EncodeContext::windowed_samples
SampleType * windowed_samples
Definition: ac3enc.h:235
AC3EncodeContext::allocate_sample_buffers
int(* allocate_sample_buffers)(struct AC3EncodeContext *s)
Definition: ac3enc.h:264
AC3_MAX_BLOCKS
#define AC3_MAX_BLOCKS
Definition: ac3defs.h:31
AC3EncodeContext::cpl_band_sizes
uint8_t cpl_band_sizes[AC3_MAX_CPL_BANDS]
number of coeffs in each coupling band
Definition: ac3enc.h:217
AC3EncodeContext::ltrt_center_mix_level
int ltrt_center_mix_level
Lt/Rt center mix level code.
Definition: ac3enc.h:203
avcodec.h
AC3EncodeContext::exp_buffer
uint8_t * exp_buffer
Definition: ac3enc.h:241
AC3EncodeContext::frame_bits_fixed
int frame_bits_fixed
number of non-coefficient bits for fixed parameters
Definition: ac3enc.h:231
frame
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
Definition: filter_design.txt:264
AC3EncOptions::loro_surround_mix_level
float loro_surround_mix_level
Definition: ac3enc.h:111
AC3EncodeContext::bits_written
int64_t bits_written
bit count (used to avg. bitrate)
Definition: ac3enc.h:189
AC3EncodeContext::cpl_end_freq
int cpl_end_freq
coupling channel end frequency bin
Definition: ac3enc.h:211
AC3EncOptions::ltrt_center_mix_level
float ltrt_center_mix_level
Definition: ac3enc.h:108
ff_ac3_encode_init
int ff_ac3_encode_init(AVCodecContext *avctx)
Definition: ac3enc.c:2564
AC3Block::num_rematrixing_bands
int num_rematrixing_bands
number of rematrixing bands
Definition: ac3enc.h:141
me_cmp.h
AC3EncOptions::preferred_stereo_downmix
int preferred_stereo_downmix
Definition: ac3enc.h:107
ff_ac3_encode_frame_common_end
int ff_ac3_encode_frame_common_end(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition: ac3enc.c:1797
AC3BitAllocParameters
Definition: ac3.h:95
fft.h
AVCodecContext
main external API structure.
Definition: avcodec.h:389
AC3EncOptions::allow_per_frame_metadata
int allow_per_frame_metadata
Definition: ac3enc.h:120
AC3EncodeContext::bitstream_id
int bitstream_id
bitstream id (bsid)
Definition: ac3enc.h:177
AC3EncodeContext::frame_size
int frame_size
current frame size in bytes
Definition: ac3enc.h:186
AC3EncodeContext::band_psd_buffer
int16_t * band_psd_buffer
Definition: ac3enc.h:244
AC3EncodeContext::exp_ref_block
uint8_t exp_ref_block[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]
reference blocks for EXP_REUSE
Definition: ac3enc.h:253
CoefType
int32_t CoefType
Definition: ac3enc.h:67
AC3EncOptions::channel_coupling
int channel_coupling
Definition: ac3enc.h:122
AC3EncodeContext::mecc
MECmpContext mecc
Definition: ac3enc.h:168
audiodsp.h
AudioDSPContext
Definition: audiodsp.h:24
AVPacket
This structure stores compressed data.
Definition: packet.h:351
AC3EncodeContext::avctx
AVCodecContext * avctx
parent AVCodecContext
Definition: ac3enc.h:160
ac3.h
AC3Block::mdct_coef
CoefType ** mdct_coef
MDCT coefficients.
Definition: ac3enc.h:130
AC3EncodeContext::use_frame_exp_strategy
int use_frame_exp_strategy
indicates use of frame exp strategy
Definition: ac3enc.h:252
AC3EncodeContext::fine_snr_offset
int fine_snr_offset[AC3_MAX_CHANNELS]
fine SNR offsets (fsnroffst)
Definition: ac3enc.h:230
AC3Block::new_rematrixing_strategy
uint8_t new_rematrixing_strategy
send new rematrixing flags in this block
Definition: ac3enc.h:140
ff_ac3_enc_defaults
const FFCodecDefault ff_ac3_enc_defaults[]
Definition: ac3enc.c:139
int32_t
int32_t
Definition: audioconvert.c:56
AC3EncodeContext::frame_size_min
int frame_size_min
minimum frame size in case rounding is necessary
Definition: ac3enc.h:185
AC3EncOptions::surround_mix_level
float surround_mix_level
Definition: ac3enc.h:99
ff_ac3_adjust_frame_size
void ff_ac3_adjust_frame_size(AC3EncodeContext *s)
Adjust the frame size to make the average bit rate match the target bit rate.
Definition: ac3enc.c:307
AC3EncodeContext::fixed_coef_buffer
int32_t * fixed_coef_buffer
Definition: ac3enc.h:240
AC3EncOptions::extended_bsi_2
int extended_bsi_2
Definition: ac3enc.h:112
int
int
Definition: ffmpeg_filter.c:153
put_bits.h
AC3EncodeContext::bap_buffer
uint8_t * bap_buffer
Definition: ac3enc.h:237
AC3Block::new_cpl_coords
uint8_t new_cpl_coords[AC3_MAX_CHANNELS]
send new coupling coordinates (cplcoe)
Definition: ac3enc.h:147
AC3Block::cpl_in_use
int cpl_in_use
coupling in use for this block (cplinu)
Definition: ac3enc.h:144
ff_ac3_enc_options
const AVOption ff_ac3_enc_options[]
Definition: ac3enc.c:82
AC3EncOptions::loro_center_mix_level
float loro_center_mix_level
Definition: ac3enc.h:110
AC3EncodeContext::cutoff
int cutoff
user-specified cutoff frequency, in Hz
Definition: ac3enc.h:208
AC3EncodeContext::cpl_coord_mant_buffer
uint8_t * cpl_coord_mant_buffer
Definition: ac3enc.h:248