FFmpeg
aacenc.h
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 
26 #include "libavutil/float_dsp.h"
27 #include "libavutil/mem_internal.h"
28 
29 #include "avcodec.h"
30 #include "put_bits.h"
31 
32 #include "aac.h"
33 #include "audio_frame_queue.h"
34 #include "psymodel.h"
35 
36 #include "lpc.h"
37 
38 typedef enum AACCoder {
42 
44 }AACCoder;
45 
46 typedef struct AACEncOptions {
47  int coder;
48  int pns;
49  int tns;
50  int ltp;
51  int pce;
52  int pred;
53  int mid_side;
56 
57 struct AACEncContext;
58 
59 typedef struct AACCoefficientsEncoder {
61  SingleChannelElement *sce, const float lambda);
63  int win, int group_len, const float lambda);
64  void (*quantize_and_encode_band)(struct AACEncContext *s, PutBitContext *pb, const float *in, float *out, int size,
65  int scale_idx, int cb, const float lambda, int rtz);
67  void (*encode_ltp_info)(struct AACEncContext *s, SingleChannelElement *sce, int common_window);
79  void (*search_for_ltp)(struct AACEncContext *s, SingleChannelElement *sce, int common_window);
84 
86 
88  float rd;
89  float energy;
90  int bits;
91  char cb;
92  char rtz;
93  uint16_t generation;
95 
96 typedef struct AACPCEInfo {
97  int64_t layout;
98  int num_ele[4]; ///< front, side, back, lfe
99  int pairing[3][8]; ///< front, side, back
100  int index[4][8]; ///< front, side, back, lfe
101  uint8_t config_map[16]; ///< configs the encoder's channel specific settings
102  uint8_t reorder_map[16]; ///< maps channels from lavc to aac order
103 } AACPCEInfo;
104 
105 /**
106  * List of PCE (Program Configuration Element) for the channel layouts listed
107  * in channel_layout.h
108  *
109  * For those wishing in the future to add other layouts:
110  *
111  * - num_ele: number of elements in each group of front, side, back, lfe channels
112  * (an element is of type SCE (single channel), CPE (channel pair) for
113  * the first 3 groups; and is LFE for LFE group).
114  *
115  * - pairing: 0 for an SCE element or 1 for a CPE; does not apply to LFE group
116  *
117  * - index: there are three independent indices for SCE, CPE and LFE;
118  * they are incremented irrespective of the group to which the element belongs;
119  * they are not reset when going from one group to another
120  *
121  * Example: for 7.0 channel layout,
122  * .pairing = { { 1, 0 }, { 1 }, { 1 }, }, (3 CPE and 1 SCE in front group)
123  * .index = { { 0, 0 }, { 1 }, { 2 }, },
124  * (index is 0 for the single SCE but goes from 0 to 2 for the CPEs)
125  *
126  * The index order impacts the channel ordering. But is otherwise arbitrary
127  * (the sequence could have been 2, 0, 1 instead of 0, 1, 2).
128  *
129  * Spec allows for discontinuous indices, e.g. if one has a total of two SCE,
130  * SCE.0 SCE.15 is OK per spec; BUT it won't be decoded by our AAC decoder
131  * which at this time requires that indices fully cover some range starting
132  * from 0 (SCE.1 SCE.0 is OK but not SCE.0 SCE.15).
133  *
134  * - config_map: total number of elements and their types. Beware, the way the
135  * types are ordered impacts the final channel ordering.
136  *
137  * - reorder_map: reorders the channels.
138  *
139  */
140 static const AACPCEInfo aac_pce_configs[] = {
141  {
143  .num_ele = { 1, 0, 0, 0 },
144  .pairing = { { 0 }, },
145  .index = { { 0 }, },
146  .config_map = { 1, TYPE_SCE, },
147  .reorder_map = { 0 },
148  },
149  {
150  .layout = AV_CH_LAYOUT_STEREO,
151  .num_ele = { 1, 0, 0, 0 },
152  .pairing = { { 1 }, },
153  .index = { { 0 }, },
154  .config_map = { 1, TYPE_CPE, },
155  .reorder_map = { 0, 1 },
156  },
157  {
158  .layout = AV_CH_LAYOUT_2POINT1,
159  .num_ele = { 1, 0, 0, 1 },
160  .pairing = { { 1 }, },
161  .index = { { 0 },{ 0 },{ 0 },{ 0 } },
162  .config_map = { 2, TYPE_CPE, TYPE_LFE },
163  .reorder_map = { 0, 1, 2 },
164  },
165  {
166  .layout = AV_CH_LAYOUT_2_1,
167  .num_ele = { 1, 0, 1, 0 },
168  .pairing = { { 1 },{ 0 },{ 0 } },
169  .index = { { 0 },{ 0 },{ 0 }, },
170  .config_map = { 2, TYPE_CPE, TYPE_SCE },
171  .reorder_map = { 0, 1, 2 },
172  },
173  {
174  .layout = AV_CH_LAYOUT_SURROUND,
175  .num_ele = { 2, 0, 0, 0 },
176  .pairing = { { 1, 0 }, },
177  .index = { { 0, 0 }, },
178  .config_map = { 2, TYPE_CPE, TYPE_SCE, },
179  .reorder_map = { 0, 1, 2 },
180  },
181  {
182  .layout = AV_CH_LAYOUT_3POINT1,
183  .num_ele = { 2, 0, 0, 1 },
184  .pairing = { { 1, 0 }, },
185  .index = { { 0, 0 }, { 0 }, { 0 }, { 0 }, },
186  .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_LFE },
187  .reorder_map = { 0, 1, 2, 3 },
188  },
189  {
190  .layout = AV_CH_LAYOUT_4POINT0,
191  .num_ele = { 2, 0, 1, 0 },
192  .pairing = { { 1, 0 }, { 0 }, { 0 }, },
193  .index = { { 0, 0 }, { 0 }, { 1 } },
194  .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_SCE },
195  .reorder_map = { 0, 1, 2, 3 },
196  },
197  {
198  .layout = AV_CH_LAYOUT_4POINT1,
199  .num_ele = { 2, 1, 1, 0 },
200  .pairing = { { 1, 0 }, { 0 }, { 0 }, },
201  .index = { { 0, 0 }, { 1 }, { 2 }, { 0 } },
202  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_SCE },
203  .reorder_map = { 0, 1, 2, 3, 4 },
204  },
205  {
206  .layout = AV_CH_LAYOUT_2_2,
207  .num_ele = { 1, 1, 0, 0 },
208  .pairing = { { 1 }, { 1 }, },
209  .index = { { 0 }, { 1 }, },
210  .config_map = { 2, TYPE_CPE, TYPE_CPE },
211  .reorder_map = { 0, 1, 2, 3 },
212  },
213  {
214  .layout = AV_CH_LAYOUT_QUAD,
215  .num_ele = { 1, 0, 1, 0 },
216  .pairing = { { 1 }, { 0 }, { 1 }, },
217  .index = { { 0 }, { 0 }, { 1 } },
218  .config_map = { 2, TYPE_CPE, TYPE_CPE },
219  .reorder_map = { 0, 1, 2, 3 },
220  },
221  {
222  .layout = AV_CH_LAYOUT_5POINT0,
223  .num_ele = { 2, 1, 0, 0 },
224  .pairing = { { 1, 0 }, { 1 }, },
225  .index = { { 0, 0 }, { 1 } },
226  .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE },
227  .reorder_map = { 0, 1, 2, 3, 4 },
228  },
229  {
230  .layout = AV_CH_LAYOUT_5POINT1,
231  .num_ele = { 2, 1, 1, 0 },
232  .pairing = { { 1, 0 }, { 0 }, { 1 }, },
233  .index = { { 0, 0 }, { 1 }, { 1 } },
234  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE },
235  .reorder_map = { 0, 1, 2, 3, 4, 5 },
236  },
237  {
238  .layout = AV_CH_LAYOUT_5POINT0_BACK,
239  .num_ele = { 2, 0, 1, 0 },
240  .pairing = { { 1, 0 }, { 0 }, { 1 } },
241  .index = { { 0, 0 }, { 0 }, { 1 } },
242  .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE },
243  .reorder_map = { 0, 1, 2, 3, 4 },
244  },
245  {
246  .layout = AV_CH_LAYOUT_5POINT1_BACK,
247  .num_ele = { 2, 1, 1, 0 },
248  .pairing = { { 1, 0 }, { 0 }, { 1 }, },
249  .index = { { 0, 0 }, { 1 }, { 1 } },
250  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE },
251  .reorder_map = { 0, 1, 2, 3, 4, 5 },
252  },
253  {
254  .layout = AV_CH_LAYOUT_6POINT0,
255  .num_ele = { 2, 1, 1, 0 },
256  .pairing = { { 1, 0 }, { 1 }, { 0 }, },
257  .index = { { 0, 0 }, { 1 }, { 1 } },
258  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
259  .reorder_map = { 0, 1, 2, 3, 4, 5 },
260  },
261  {
262  .layout = AV_CH_LAYOUT_6POINT0_FRONT,
263  .num_ele = { 2, 1, 0, 0 },
264  .pairing = { { 1, 1 }, { 1 } },
265  .index = { { 1, 0 }, { 2 }, },
266  .config_map = { 3, TYPE_CPE, TYPE_CPE, TYPE_CPE, },
267  .reorder_map = { 0, 1, 2, 3, 4, 5 },
268  },
269  {
270  .layout = AV_CH_LAYOUT_HEXAGONAL,
271  .num_ele = { 2, 0, 2, 0 },
272  .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, },
273  .index = { { 0, 0 },{ 0 },{ 1, 1 } },
274  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, },
275  .reorder_map = { 0, 1, 2, 3, 4, 5 },
276  },
277  {
278  .layout = AV_CH_LAYOUT_6POINT1,
279  .num_ele = { 2, 1, 2, 0 },
280  .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, },
281  .index = { { 0, 0 },{ 1 },{ 1, 2 } },
282  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
283  .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
284  },
285  {
286  .layout = AV_CH_LAYOUT_6POINT1_BACK,
287  .num_ele = { 2, 1, 2, 0 },
288  .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, },
289  .index = { { 0, 0 }, { 1 }, { 1, 2 } },
290  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
291  .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
292  },
293  {
294  .layout = AV_CH_LAYOUT_6POINT1_FRONT,
295  .num_ele = { 2, 1, 2, 0 },
296  .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, },
297  .index = { { 0, 0 }, { 1 }, { 1, 2 } },
298  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
299  .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
300  },
301  {
302  .layout = AV_CH_LAYOUT_7POINT0,
303  .num_ele = { 2, 1, 1, 0 },
304  .pairing = { { 1, 0 }, { 1 }, { 1 }, },
305  .index = { { 0, 0 }, { 1 }, { 2 }, },
306  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
307  .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
308  },
309  {
310  .layout = AV_CH_LAYOUT_7POINT0_FRONT,
311  .num_ele = { 2, 1, 1, 0 },
312  .pairing = { { 1, 0 }, { 1 }, { 1 }, },
313  .index = { { 0, 0 }, { 1 }, { 2 }, },
314  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
315  .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
316  },
317  {
318  .layout = AV_CH_LAYOUT_7POINT1,
319  .num_ele = { 2, 1, 2, 0 },
320  .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, },
321  .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
322  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
323  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
324  },
325  {
326  .layout = AV_CH_LAYOUT_7POINT1_WIDE,
327  .num_ele = { 2, 1, 2, 0 },
328  .pairing = { { 1, 0 }, { 0 },{ 1, 1 }, },
329  .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
330  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
331  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
332  },
333  {
335  .num_ele = { 2, 1, 2, 0 },
336  .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, },
337  .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
338  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
339  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
340  },
341  {
342  .layout = AV_CH_LAYOUT_OCTAGONAL,
343  .num_ele = { 2, 1, 2, 0 },
344  .pairing = { { 1, 0 }, { 1 }, { 1, 0 }, },
345  .index = { { 0, 0 }, { 1 }, { 2, 1 } },
346  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE },
347  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
348  },
349  { /* Meant for order 2/mixed ambisonics */
351  .num_ele = { 2, 2, 2, 0 },
352  .pairing = { { 1, 0 }, { 1, 0 }, { 1, 0 }, },
353  .index = { { 0, 0 }, { 1, 1 }, { 2, 2 } },
354  .config_map = { 6, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
355  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8 },
356  },
357  { /* Meant for order 2/mixed ambisonics */
360  .num_ele = { 2, 2, 2, 0 },
361  .pairing = { { 1, 1 }, { 1, 0 }, { 1, 0 }, },
362  .index = { { 0, 1 }, { 2, 0 }, { 3, 1 } },
363  .config_map = { 6, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
364  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
365  },
366  {
367  .layout = AV_CH_LAYOUT_HEXADECAGONAL,
368  .num_ele = { 4, 2, 4, 0 },
369  .pairing = { { 1, 0, 1, 0 }, { 1, 1 }, { 1, 0, 1, 0 }, },
370  .index = { { 0, 0, 1, 1 }, { 2, 3 }, { 4, 2, 5, 3 } },
372  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
373  },
374 };
375 
376 /**
377  * AAC encoder context
378  */
379 typedef struct AACEncContext {
381  AACEncOptions options; ///< encoding options
383  FFTContext mdct1024; ///< long (1024 samples) frame transform context
384  FFTContext mdct128; ///< short (128 samples) frame transform context
386  AACPCEInfo pce; ///< PCE data, if needed
387  float *planar_samples[16]; ///< saved preprocessed input
388 
389  int profile; ///< copied from avctx
390  int needs_pce; ///< flag for non-standard layout
391  LPCContext lpc; ///< used by TNS
392  int samplerate_index; ///< MPEG-4 samplerate index
393  int channels; ///< channel count
394  const uint8_t *reorder_map; ///< lavc to aac reorder map
395  const uint8_t *chan_map; ///< channel configuration map
396 
397  ChannelElement *cpe; ///< channel elements
401  int cur_channel; ///< current channel for coder context
403  float lambda;
404  int last_frame_pb_count; ///< number of bits for the previous frame
405  float lambda_sum; ///< sum(lambda), for Qvg reporting
406  int lambda_count; ///< count(lambda), for Qvg reporting
407  enum RawDataBlockType cur_type; ///< channel group type cur_channel belongs to
408 
410  DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients
411  DECLARE_ALIGNED(32, float, scoefs)[1024]; ///< scaled coefficients
412 
414  AACQuantizeBandCostCacheEntry quantize_band_cost_cache[256][128]; ///< memoization area for quantize_band_cost
415 
416  void (*abs_pow34)(float *out, const float *in, const int size);
417  void (*quant_bands)(int *out, const float *in, const float *scaled,
418  int size, int is_signed, int maxval, const float Q34,
419  const float rounding);
420 
421  struct {
422  float *samples;
423  } buffer;
424 } AACEncContext;
425 
429 
430 
431 #endif /* AVCODEC_AACENC_H */
AV_CH_LAYOUT_7POINT0
#define AV_CH_LAYOUT_7POINT0
Definition: channel_layout.h:110
AACQuantizeBandCostCacheEntry
Definition: aacenc.h:87
AV_CH_LAYOUT_6POINT1
#define AV_CH_LAYOUT_6POINT1
Definition: channel_layout.h:107
AACCoefficientsEncoder::apply_tns_filt
void(* apply_tns_filt)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:72
AV_CH_LAYOUT_7POINT1_WIDE_BACK
#define AV_CH_LAYOUT_7POINT1_WIDE_BACK
Definition: channel_layout.h:114
AACEncOptions::ltp
int ltp
Definition: aacenc.h:50
AACCoefficientsEncoder::encode_window_bands_info
void(* encode_window_bands_info)(struct AACEncContext *s, SingleChannelElement *sce, int win, int group_len, const float lambda)
Definition: aacenc.h:62
AV_CH_LAYOUT_5POINT0_BACK
#define AV_CH_LAYOUT_5POINT0_BACK
Definition: channel_layout.h:102
AACEncContext::planar_samples
float * planar_samples[16]
saved preprocessed input
Definition: aacenc.h:387
AACCoefficientsEncoder::search_for_quantizers
void(* search_for_quantizers)(AVCodecContext *avctx, struct AACEncContext *s, SingleChannelElement *sce, const float lambda)
Definition: aacenc.h:60
AACQuantizeBandCostCacheEntry::cb
char cb
Definition: aacenc.h:91
AACEncContext::needs_pce
int needs_pce
flag for non-standard layout
Definition: aacenc.h:390
mem_internal.h
AACEncOptions::coder
int coder
Definition: aacenc.h:47
out
FILE * out
Definition: movenc.c:54
cb
static double cb(void *priv, double x, double y)
Definition: vf_geq.c:215
AV_CH_LAYOUT_HEXADECAGONAL
#define AV_CH_LAYOUT_HEXADECAGONAL
Definition: channel_layout.h:116
AACEncContext::av_class
AVClass * av_class
Definition: aacenc.h:380
AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_MONO
Definition: channel_layout.h:90
AACEncContext::abs_pow34
void(* abs_pow34)(float *out, const float *in, const int size)
Definition: aacenc.h:416
AACCoefficientsEncoder::search_for_pns
void(* search_for_pns)(struct AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
Definition: aacenc.h:76
AACCoefficientsEncoder::search_for_ms
void(* search_for_ms)(struct AACEncContext *s, ChannelElement *cpe)
Definition: aacenc.h:80
AV_CH_LAYOUT_HEXAGONAL
#define AV_CH_LAYOUT_HEXAGONAL
Definition: channel_layout.h:106
AACEncContext::samplerate_index
int samplerate_index
MPEG-4 samplerate index.
Definition: aacenc.h:392
AV_CH_LAYOUT_6POINT0_FRONT
#define AV_CH_LAYOUT_6POINT0_FRONT
Definition: channel_layout.h:105
AV_CH_LAYOUT_6POINT1_FRONT
#define AV_CH_LAYOUT_6POINT1_FRONT
Definition: channel_layout.h:109
AACCoefficientsEncoder::search_for_tns
void(* search_for_tns)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:78
AAC_CODER_NB
@ AAC_CODER_NB
Definition: aacenc.h:43
lpc.h
AACQuantizeBandCostCacheEntry::generation
uint16_t generation
Definition: aacenc.h:93
AACCoefficientsEncoder::update_ltp
void(* update_ltp)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:73
AACPCEInfo::layout
int64_t layout
Definition: aacenc.h:97
AACEncContext::chan_map
const uint8_t * chan_map
channel configuration map
Definition: aacenc.h:395
AAC_CODER_FAST
@ AAC_CODER_FAST
Definition: aacenc.h:41
win
static float win(SuperEqualizerContext *s, float n, int N)
Definition: af_superequalizer.c:119
AV_CH_LAYOUT_6POINT0
#define AV_CH_LAYOUT_6POINT0
Definition: channel_layout.h:104
LPCContext
Definition: lpc.h:52
ff_quantize_band_cost_cache_init
void ff_quantize_band_cost_cache_init(struct AACEncContext *s)
Definition: aacenc.c:126
AACEncContext::psy
FFPsyContext psy
Definition: aacenc.h:398
TYPE_CPE
@ TYPE_CPE
Definition: aac.h:58
audio_frame_queue.h
AV_CH_BACK_LEFT
#define AV_CH_BACK_LEFT
Definition: channel_layout.h:53
AACEncContext::options
AACEncOptions options
encoding options
Definition: aacenc.h:381
AACEncOptions::pce
int pce
Definition: aacenc.h:51
AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_STEREO
Definition: channel_layout.h:91
AACPCEInfo::num_ele
int num_ele[4]
front, side, back, lfe
Definition: aacenc.h:98
AACEncContext::fdsp
AVFloatDSPContext * fdsp
Definition: aacenc.h:385
AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_QUAD
Definition: channel_layout.h:99
AACEncContext::lambda_count
int lambda_count
count(lambda), for Qvg reporting
Definition: aacenc.h:406
AACEncContext::lambda_sum
float lambda_sum
sum(lambda), for Qvg reporting
Definition: aacenc.h:405
ff_aac_coders
const AACCoefficientsEncoder ff_aac_coders[]
Definition: aaccoder.c:897
s
#define s(width, name)
Definition: cbs_vp9.c:257
AV_CH_LAYOUT_7POINT0_FRONT
#define AV_CH_LAYOUT_7POINT0_FRONT
Definition: channel_layout.h:111
AACEncContext::mdct1024
FFTContext mdct1024
long (1024 samples) frame transform context
Definition: aacenc.h:383
AudioFrameQueue
Definition: audio_frame_queue.h:32
AACEncContext::reorder_map
const uint8_t * reorder_map
lavc to aac reorder map
Definition: aacenc.h:394
AACCoefficientsEncoder::adjust_common_ltp
void(* adjust_common_ltp)(struct AACEncContext *s, ChannelElement *cpe)
Definition: aacenc.h:70
AACPCEInfo::reorder_map
uint8_t reorder_map[16]
maps channels from lavc to aac order
Definition: aacenc.h:102
AACQuantizeBandCostCacheEntry::energy
float energy
Definition: aacenc.h:89
AACCoefficientsEncoder::encode_ltp_info
void(* encode_ltp_info)(struct AACEncContext *s, SingleChannelElement *sce, int common_window)
Definition: aacenc.h:67
PutBitContext
Definition: put_bits.h:49
AV_CH_LAYOUT_2_1
#define AV_CH_LAYOUT_2_1
Definition: channel_layout.h:93
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
aac_pce_configs
static const AACPCEInfo aac_pce_configs[]
List of PCE (Program Configuration Element) for the channel layouts listed in channel_layout....
Definition: aacenc.h:140
AV_CH_TOP_CENTER
#define AV_CH_TOP_CENTER
Definition: channel_layout.h:60
AACEncContext::cur_type
enum RawDataBlockType cur_type
channel group type cur_channel belongs to
Definition: aacenc.h:407
AACCoefficientsEncoder::search_for_pred
void(* search_for_pred)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:82
AV_CH_LAYOUT_5POINT1
#define AV_CH_LAYOUT_5POINT1
Definition: channel_layout.h:101
aac.h
AACEncContext::random_state
int random_state
Definition: aacenc.h:402
AACCoefficientsEncoder::ltp_insert_new_frame
void(* ltp_insert_new_frame)(struct AACEncContext *s)
Definition: aacenc.h:74
AACEncContext::quantize_band_cost_cache_generation
uint16_t quantize_band_cost_cache_generation
Definition: aacenc.h:413
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
AACCoefficientsEncoder::adjust_common_pred
void(* adjust_common_pred)(struct AACEncContext *s, ChannelElement *cpe)
Definition: aacenc.h:69
AACEncContext::qcoefs
int qcoefs[96]
quantized coefficients
Definition: aacenc.h:410
float_dsp.h
AACCoefficientsEncoder::apply_main_pred
void(* apply_main_pred)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:71
AACEncOptions::tns
int tns
Definition: aacenc.h:49
AACPCEInfo
Definition: aacenc.h:96
AACEncContext::samples
float * samples
Definition: aacenc.h:422
AAC_CODER_ANMR
@ AAC_CODER_ANMR
Definition: aacenc.h:39
AACCoefficientsEncoder::set_special_band_scalefactors
void(* set_special_band_scalefactors)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:75
AACEncContext::channels
int channels
channel count
Definition: aacenc.h:393
size
int size
Definition: twinvq_data.h:10344
AACCoefficientsEncoder::quantize_and_encode_band
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)
Definition: aacenc.h:64
FFPsyPreprocessContext
Definition: psymodel.c:93
AVFloatDSPContext
Definition: float_dsp.h:24
AACEncContext::quant_bands
void(* quant_bands)(int *out, const float *in, const float *scaled, int size, int is_signed, int maxval, const float Q34, const float rounding)
Definition: aacenc.h:417
AAC_CODER_TWOLOOP
@ AAC_CODER_TWOLOOP
Definition: aacenc.h:40
ff_aac_coder_init_mips
void ff_aac_coder_init_mips(AACEncContext *c)
Definition: aaccoder_mips.c:2484
AACCoefficientsEncoder::mark_pns
void(* mark_pns)(struct AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
Definition: aacenc.h:77
AV_CH_LAYOUT_5POINT1_BACK
#define AV_CH_LAYOUT_5POINT1_BACK
Definition: channel_layout.h:103
AACPCEInfo::index
int index[4][8]
front, side, back, lfe
Definition: aacenc.h:100
AV_CH_LAYOUT_3POINT1
#define AV_CH_LAYOUT_3POINT1
Definition: channel_layout.h:95
AACEncContext::cur_channel
int cur_channel
current channel for coder context
Definition: aacenc.h:401
AACCoder
AACCoder
Definition: aacenc.h:38
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem.h:116
AV_CH_LAYOUT_OCTAGONAL
#define AV_CH_LAYOUT_OCTAGONAL
Definition: channel_layout.h:115
AV_CH_LAYOUT_5POINT0
#define AV_CH_LAYOUT_5POINT0
Definition: channel_layout.h:100
AACPCEInfo::config_map
uint8_t config_map[16]
configs the encoder's channel specific settings
Definition: aacenc.h:101
FFTContext
Definition: fft.h:83
AACEncOptions::intensity_stereo
int intensity_stereo
Definition: aacenc.h:54
AACCoefficientsEncoder::encode_main_pred
void(* encode_main_pred)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:68
RawDataBlockType
RawDataBlockType
Definition: aac.h:56
SingleChannelElement
Single Channel Element - used for both SCE and LFE elements.
Definition: aac.h:249
AACEncContext::mdct128
FFTContext mdct128
short (128 samples) frame transform context
Definition: aacenc.h:384
AV_CH_LAYOUT_2POINT1
#define AV_CH_LAYOUT_2POINT1
Definition: channel_layout.h:92
AACQuantizeBandCostCacheEntry::rd
float rd
Definition: aacenc.h:88
AACCoefficientsEncoder::search_for_is
void(* search_for_is)(struct AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe)
Definition: aacenc.h:81
ChannelElement
channel element - generic struct for SCE/CPE/CCE/LFE
Definition: aac.h:276
AACPCEInfo::pairing
int pairing[3][8]
front, side, back
Definition: aacenc.h:99
AV_CH_LAYOUT_7POINT1
#define AV_CH_LAYOUT_7POINT1
Definition: channel_layout.h:112
AV_CH_LAYOUT_4POINT1
#define AV_CH_LAYOUT_4POINT1
Definition: channel_layout.h:97
AACQuantizeBandCostCacheEntry::bits
int bits
Definition: aacenc.h:90
AV_CH_BACK_CENTER
#define AV_CH_BACK_CENTER
Definition: channel_layout.h:57
AV_CH_LAYOUT_7POINT1_WIDE
#define AV_CH_LAYOUT_7POINT1_WIDE
Definition: channel_layout.h:113
TYPE_LFE
@ TYPE_LFE
Definition: aac.h:60
ff_aac_dsp_init_x86
void ff_aac_dsp_init_x86(AACEncContext *s)
Definition: aacencdsp_init.c:35
TYPE_SCE
@ TYPE_SCE
Definition: aac.h:57
AACEncContext::quantize_band_cost_cache
AACQuantizeBandCostCacheEntry quantize_band_cost_cache[256][128]
memoization area for quantize_band_cost
Definition: aacenc.h:414
AACEncContext::psypp
struct FFPsyPreprocessContext * psypp
Definition: aacenc.h:399
AACCoefficientsEncoder
Definition: aacenc.h:59
AACEncOptions::pns
int pns
Definition: aacenc.h:48
avcodec.h
AACEncOptions::mid_side
int mid_side
Definition: aacenc.h:53
AACEncContext::profile
int profile
copied from avctx
Definition: aacenc.h:389
AACEncContext::lpc
LPCContext lpc
used by TNS
Definition: aacenc.h:391
AACEncContext::buffer
struct AACEncContext::@6 buffer
AV_CH_LAYOUT_SURROUND
#define AV_CH_LAYOUT_SURROUND
Definition: channel_layout.h:94
AACEncContext::afq
AudioFrameQueue afq
Definition: aacenc.h:409
AACEncContext::pce
AACPCEInfo pce
PCE data, if needed.
Definition: aacenc.h:386
AACEncContext
AAC encoder context.
Definition: aacenc.h:379
AACQuantizeBandCostCacheEntry::rtz
char rtz
Definition: aacenc.h:92
AACCoefficientsEncoder::encode_tns_info
void(* encode_tns_info)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:66
AACEncContext::last_frame_pb_count
int last_frame_pb_count
number of bits for the previous frame
Definition: aacenc.h:404
AVCodecContext
main external API structure.
Definition: avcodec.h:379
AACCoefficientsEncoder::search_for_ltp
void(* search_for_ltp)(struct AACEncContext *s, SingleChannelElement *sce, int common_window)
Definition: aacenc.h:79
AACEncContext::scoefs
float scoefs[1024]
scaled coefficients
Definition: aacenc.h:411
channel_layout.h
AACEncContext::coder
const AACCoefficientsEncoder * coder
Definition: aacenc.h:400
AACEncContext::pb
PutBitContext pb
Definition: aacenc.h:382
AV_CH_LAYOUT_4POINT0
#define AV_CH_LAYOUT_4POINT0
Definition: channel_layout.h:96
AV_CH_LAYOUT_6POINT1_BACK
#define AV_CH_LAYOUT_6POINT1_BACK
Definition: channel_layout.h:108
AACEncOptions::pred
int pred
Definition: aacenc.h:52
AV_CH_BACK_RIGHT
#define AV_CH_BACK_RIGHT
Definition: channel_layout.h:54
AACEncContext::lambda
float lambda
Definition: aacenc.h:403
put_bits.h
FFPsyContext
context used by psychoacoustic model
Definition: psymodel.h:89
AACEncOptions
Definition: aacenc.h:46
psymodel.h
AV_CH_LAYOUT_2_2
#define AV_CH_LAYOUT_2_2
Definition: channel_layout.h:98
AACEncContext::cpe
ChannelElement * cpe
channel elements
Definition: aacenc.h:397