FFmpeg: libavcodec/aacenc.h Source File
Go to the documentation of this file. 1 /*
2 * AAC encoder
3 * Copyright (C) 2008 Konstantin Shishkov
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #ifndef AVCODEC_AACENC_H
23 #define AVCODEC_AACENC_H
24
25 #include <stdint.h>
26
31
34
39
41
42 #define CLIP_AVOIDANCE_FACTOR 0.95f
43
48
51
52 /**
53 * Predictor State
54 */
65
76
77 /**
78 * Long Term Prediction
79 */
87
88 /**
89 * Individual Channel Stream
90 */
92 uint8_t
max_sfb;
///< number of scalefactor bands per group
94 uint8_t
use_kb_window[2];
///< If set, use Kaiser-Bessel window, otherwise use a sine window.
97 const uint16_t *
swb_offset;
///< table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular window
98 const uint8_t *
swb_sizes;
///< table of scalefactor band sizes for a particular window
99 int num_swb;
///< number of scalefactor window bands
107 uint8_t
window_clipping[8];
///< set if a certain window is near clipping
108 float clip_avoidance_factor;
///< set if any window is near clipping to the necessary atennuation factor to avoid it
110
111 /**
112 * Temporal Noise Shaping
113 */
123
124 /**
125 * Single Channel Element - used for both SCE and LFE elements.
126 */
133 int sf_idx[128];
///< scalefactor indices
134 uint8_t
zeroes[128];
///< band is not coded
135 uint8_t
can_pns[128];
///< band is allowed to PNS (informative)
146
147 /**
148 * channel element - generic struct for SCE/CPE/CCE/LFE
149 */
151 // CPE specific
152 int common_window;
///< Set if channels share a common 'IndividualChannelStream' in bitstream.
153 int ms_mode;
///< Signals mid/side stereo flags coding mode
154 uint8_t
is_mode;
///< Set if any bands have been encoded using intensity stereo
155 uint8_t
ms_mask[128];
///< Set if mid/side stereo is used for each scalefactor window band
156 uint8_t
is_mask[128];
///< Set if intensity stereo is used
157 // shared
160
162
167 int win,
int group_len,
const float lambda);
169 int scale_idx,
int cb,
const float lambda,
int rtz);
188
190
199
204 int index[4][8];
///< front, side, back, lfe
205 uint8_t
config_map[16];
///< configs the encoder's channel specific settings
206 uint8_t
reorder_map[16];
///< maps channels from lavc to aac order
208
209 /**
210 * AAC encoder context
211 */
223
230 const uint8_t *
chan_map;
///< channel configuration map
231
243
247
250
252
253 struct {
257
259
260
261 #endif /* AVCODEC_AACENC_H */
enum BandType band_alt[128]
alternative band type
void(* apply_tns_filt)(struct AACEncContext *s, SingleChannelElement *sce)
void(* encode_window_bands_info)(struct AACEncContext *s, SingleChannelElement *sce, int win, int group_len, const float lambda)
float lcoeffs[1024]
MDCT of LTP coefficients.
float * planar_samples[16]
saved preprocessed input
void(* search_for_quantizers)(AVCodecContext *avctx, struct AACEncContext *s, SingleChannelElement *sce, const float lambda)
struct PredictorState * predictor_state
uint8_t can_pns[128]
band is allowed to PNS (informative)
int needs_pce
flag for non-standard layout
static double cb(void *priv, double x, double y)
uint8_t zeroes[128]
band is not coded
int8_t used[MAX_LTP_LONG_SFB]
int coef_idx[8][4][TNS_MAX_ORDER]
void(* search_for_pns)(struct AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
void(* search_for_ms)(struct AACEncContext *s, ChannelElement *cpe)
int samplerate_index
MPEG-4 samplerate index.
void(* search_for_tns)(struct AACEncContext *s, SingleChannelElement *sce)
void(* update_ltp)(struct AACEncContext *s, SingleChannelElement *sce)
SingleChannelElement ch[2]
const uint8_t * chan_map
channel configuration map
static float win(SuperEqualizerContext *s, float n, int N)
int num_swb
number of scalefactor window bands
void ff_quantize_band_cost_cache_init(struct AACEncContext *s)
float coeffs[1024]
coefficients for IMDCT, maybe processed
float ret_buf[2048]
PCM output buffer.
int ms_mode
Signals mid/side stereo flags coding mode.
uint8_t window_clipping[8]
set if a certain window is near clipping
AACEncOptions options
encoding options
int num_ele[4]
front, side, back, lfe
IndividualChannelStream ics
float prcoeffs[1024]
Main prediction coefs.
int predictor_reset_count[31]
used to count prediction resets
int lambda_count
count(lambda), for Qvg reporting
float clip_avoidance_factor
set if any window is near clipping to the necessary atennuation factor to avoid it
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
float ltp_state[3072]
time signal for LTP
float lambda_sum
sum(lambda), for Qvg reporting
const AACCoefficientsEncoder ff_aac_coders[]
const uint8_t * swb_sizes
table of scalefactor band sizes for a particular window
const uint8_t * reorder_map
lavc to aac reorder map
Individual Channel Stream.
void(* adjust_common_ltp)(struct AACEncContext *s, ChannelElement *cpe)
uint8_t reorder_map[16]
maps channels from lavc to aac order
void(* encode_ltp_info)(struct AACEncContext *s, SingleChannelElement *sce, int common_window)
Describe the class of an AVClass context structure.
uint8_t is_mask[128]
Set if intensity stereo is used.
float is_ener[128]
Intensity stereo pos.
uint8_t use_kb_window[2]
If set, use Kaiser-Bessel window, otherwise use a sine window.
enum RawDataBlockType cur_type
channel group type cur_channel belongs to
void(* search_for_pred)(struct AACEncContext *s, SingleChannelElement *sce)
uint8_t ms_mask[128]
Set if mid/side stereo is used for each scalefactor window band.
void(* ltp_insert_new_frame)(struct AACEncContext *s)
uint16_t quantize_band_cost_cache_generation
void(* adjust_common_pred)(struct AACEncContext *s, ChannelElement *cpe)
int sf_idx[128]
scalefactor indices
int qcoefs[96]
quantized coefficients
void(* apply_main_pred)(struct AACEncContext *s, SingleChannelElement *sce)
enum WindowSequence window_sequence[2]
void(* set_special_band_scalefactors)(struct AACEncContext *s, SingleChannelElement *sce)
int channels
channel count
An AVChannelLayout holds information about the channel layout of audio data.
#define DECLARE_ALIGNED(n, t, v)
void(* quantize_and_encode_band)(struct AACEncContext *s, PutBitContext *pb, const float *in, float *out, int size, int scale_idx, int cb, const float lambda, int rtz)
int common_window
Set if channels share a common 'IndividualChannelStream' in bitstream.
void(* mark_pns)(struct AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
int index[4][8]
front, side, back, lfe
AVTXContext * mdct1024
long (1024 samples) frame transform context
enum BandType band_type[128]
band types
float pns_ener[128]
Noise energy values.
int cur_channel
current channel for coder context
uint8_t config_map[16]
configs the encoder's channel specific settings
void(* encode_main_pred)(struct AACEncContext *s, SingleChannelElement *sce)
Single Channel Element - used for both SCE and LFE elements.
void(* search_for_is)(struct AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe)
float pcoeffs[1024]
coefficients for IMDCT, pristine
channel element - generic struct for SCE/CPE/CCE/LFE
const uint16_t * swb_offset
table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular wind...
int pairing[3][8]
front, side, back
AACQuantizeBandCostCacheEntry quantize_band_cost_cache[256][128]
memoization area for quantize_band_cost
struct FFPsyPreprocessContext * psypp
int profile
copied from avctx
LPCContext lpc
used by TNS
float coef[8][4][TNS_MAX_ORDER]
AACPCEInfo pce
PCE data, if needed.
void(* encode_tns_info)(struct AACEncContext *s, SingleChannelElement *sce)
int last_frame_pb_count
number of bits for the previous frame
main external API structure.
void(* search_for_ltp)(struct AACEncContext *s, SingleChannelElement *sce, int common_window)
AVTXContext * mdct128
short (128 samples) frame transform context
float scoefs[1024]
scaled coefficients
uint8_t prediction_used[41]
uint8_t is_mode
Set if any bands have been encoded using intensity stereo.
const AACCoefficientsEncoder * coder
uint8_t max_sfb
number of scalefactor bands per group
context used by psychoacoustic model
int predictor_reset_group
ChannelElement * cpe
channel elements
struct AACEncContext::@31 buffer
int predictor_initialized
Generated on Fri Aug 22 2025 13:58:06 for FFmpeg by
doxygen
1.8.17