FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 
25 #include "libavutil/float_dsp.h"
26 #include "avcodec.h"
27 #include "put_bits.h"
28 
29 #include "aac.h"
30 #include "audio_frame_queue.h"
31 #include "psymodel.h"
32 
33 #include "lpc.h"
34 
35 typedef enum AACCoder {
39 
41 }AACCoder;
42 
43 typedef struct AACEncOptions {
44  int coder;
45  int pns;
46  int tns;
47  int ltp;
48  int pce;
49  int pred;
50  int mid_side;
53 
54 struct AACEncContext;
55 
56 typedef struct AACCoefficientsEncoder {
58  SingleChannelElement *sce, const float lambda);
60  int win, int group_len, const float lambda);
61  void (*quantize_and_encode_band)(struct AACEncContext *s, PutBitContext *pb, const float *in, float *out, int size,
62  int scale_idx, int cb, const float lambda, int rtz);
64  void (*encode_ltp_info)(struct AACEncContext *s, SingleChannelElement *sce, int common_window);
76  void (*search_for_ltp)(struct AACEncContext *s, SingleChannelElement *sce, int common_window);
81 
83 
85  float rd;
86  float energy;
87  int bits;
88  char cb;
89  char rtz;
90  uint16_t generation;
92 
93 typedef struct AACPCEInfo {
94  int64_t layout;
95  int num_ele[4]; ///< front, side, back, lfe
96  int pairing[3][8]; ///< front, side, back
97  int index[4][8]; ///< front, side, back, lfe
98  uint8_t config_map[16]; ///< configs the encoder's channel specific settings
99  uint8_t reorder_map[16]; ///< maps channels from lavc to aac order
100 } AACPCEInfo;
101 
102 /**
103  * List of PCE (Program Configuration Element) for the channel layouts listed
104  * in channel_layout.h
105  *
106  * For those wishing in the future to add other layouts:
107  *
108  * - num_ele: number of elements in each group of front, side, back, lfe channels
109  * (an element is of type SCE (single channel), CPE (channel pair) for
110  * the first 3 groups; and is LFE for LFE group).
111  *
112  * - pairing: 0 for an SCE element or 1 for a CPE; does not apply to LFE group
113  *
114  * - index: there are three independent indices for SCE, CPE and LFE;
115  * they are incremented irrespective of the group to which the element belongs;
116  * they are not reset when going from one group to another
117  *
118  * Example: for 7.0 channel layout,
119  * .pairing = { { 1, 0 }, { 1 }, { 1 }, }, (3 CPE and 1 SCE in front group)
120  * .index = { { 0, 0 }, { 1 }, { 2 }, },
121  * (index is 0 for the single SCE but goes from 0 to 2 for the CPEs)
122  *
123  * The index order impacts the channel ordering. But is otherwise arbitrary
124  * (the sequence could have been 2, 0, 1 instead of 0, 1, 2).
125  *
126  * Spec allows for discontinuous indices, e.g. if one has a total of two SCE,
127  * SCE.0 SCE.15 is OK per spec; BUT it won't be decoded by our AAC decoder
128  * which at this time requires that indices fully cover some range starting
129  * from 0 (SCE.1 SCE.0 is OK but not SCE.0 SCE.15).
130  *
131  * - config_map: total number of elements and their types. Beware, the way the
132  * types are ordered impacts the final channel ordering.
133  *
134  * - reorder_map: reorders the channels.
135  *
136  */
137 static const AACPCEInfo aac_pce_configs[] = {
138  {
140  .num_ele = { 1, 0, 0, 0 },
141  .pairing = { { 0 }, },
142  .index = { { 0 }, },
143  .config_map = { 1, TYPE_SCE, },
144  .reorder_map = { 0 },
145  },
146  {
147  .layout = AV_CH_LAYOUT_STEREO,
148  .num_ele = { 1, 0, 0, 0 },
149  .pairing = { { 1 }, },
150  .index = { { 0 }, },
151  .config_map = { 1, TYPE_CPE, },
152  .reorder_map = { 0, 1 },
153  },
154  {
155  .layout = AV_CH_LAYOUT_2POINT1,
156  .num_ele = { 1, 0, 0, 1 },
157  .pairing = { { 1 }, },
158  .index = { { 0 },{ 0 },{ 0 },{ 0 } },
159  .config_map = { 2, TYPE_CPE, TYPE_LFE },
160  .reorder_map = { 0, 1, 2 },
161  },
162  {
163  .layout = AV_CH_LAYOUT_2_1,
164  .num_ele = { 1, 0, 1, 0 },
165  .pairing = { { 1 },{ 0 },{ 0 } },
166  .index = { { 0 },{ 0 },{ 0 }, },
167  .config_map = { 2, TYPE_CPE, TYPE_SCE },
168  .reorder_map = { 0, 1, 2 },
169  },
170  {
171  .layout = AV_CH_LAYOUT_SURROUND,
172  .num_ele = { 2, 0, 0, 0 },
173  .pairing = { { 1, 0 }, },
174  .index = { { 0, 0 }, },
175  .config_map = { 2, TYPE_CPE, TYPE_SCE, },
176  .reorder_map = { 0, 1, 2 },
177  },
178  {
179  .layout = AV_CH_LAYOUT_3POINT1,
180  .num_ele = { 2, 0, 0, 1 },
181  .pairing = { { 1, 0 }, },
182  .index = { { 0, 0 }, { 0 }, { 0 }, { 0 }, },
183  .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_LFE },
184  .reorder_map = { 0, 1, 2, 3 },
185  },
186  {
187  .layout = AV_CH_LAYOUT_4POINT0,
188  .num_ele = { 2, 0, 1, 0 },
189  .pairing = { { 1, 0 }, { 0 }, { 0 }, },
190  .index = { { 0, 0 }, { 0 }, { 1 } },
191  .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_SCE },
192  .reorder_map = { 0, 1, 2, 3 },
193  },
194  {
195  .layout = AV_CH_LAYOUT_4POINT1,
196  .num_ele = { 2, 1, 1, 0 },
197  .pairing = { { 1, 0 }, { 0 }, { 0 }, },
198  .index = { { 0, 0 }, { 1 }, { 2 }, { 0 } },
199  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_SCE },
200  .reorder_map = { 0, 1, 2, 3, 4 },
201  },
202  {
203  .layout = AV_CH_LAYOUT_2_2,
204  .num_ele = { 1, 1, 0, 0 },
205  .pairing = { { 1 }, { 1 }, },
206  .index = { { 0 }, { 1 }, },
207  .config_map = { 2, TYPE_CPE, TYPE_CPE },
208  .reorder_map = { 0, 1, 2, 3 },
209  },
210  {
211  .layout = AV_CH_LAYOUT_QUAD,
212  .num_ele = { 1, 0, 1, 0 },
213  .pairing = { { 1 }, { 0 }, { 1 }, },
214  .index = { { 0 }, { 0 }, { 1 } },
215  .config_map = { 2, TYPE_CPE, TYPE_CPE },
216  .reorder_map = { 0, 1, 2, 3 },
217  },
218  {
219  .layout = AV_CH_LAYOUT_5POINT0,
220  .num_ele = { 2, 1, 0, 0 },
221  .pairing = { { 1, 0 }, { 1 }, },
222  .index = { { 0, 0 }, { 1 } },
223  .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE },
224  .reorder_map = { 0, 1, 2, 3, 4 },
225  },
226  {
227  .layout = AV_CH_LAYOUT_5POINT1,
228  .num_ele = { 2, 1, 1, 0 },
229  .pairing = { { 1, 0 }, { 0 }, { 1 }, },
230  .index = { { 0, 0 }, { 1 }, { 1 } },
231  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE },
232  .reorder_map = { 0, 1, 2, 3, 4, 5 },
233  },
234  {
235  .layout = AV_CH_LAYOUT_5POINT0_BACK,
236  .num_ele = { 2, 0, 1, 0 },
237  .pairing = { { 1, 0 }, { 0 }, { 1 } },
238  .index = { { 0, 0 }, { 0 }, { 1 } },
239  .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE },
240  .reorder_map = { 0, 1, 2, 3, 4 },
241  },
242  {
243  .layout = AV_CH_LAYOUT_5POINT1_BACK,
244  .num_ele = { 2, 1, 1, 0 },
245  .pairing = { { 1, 0 }, { 0 }, { 1 }, },
246  .index = { { 0, 0 }, { 1 }, { 1 } },
247  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE },
248  .reorder_map = { 0, 1, 2, 3, 4, 5 },
249  },
250  {
251  .layout = AV_CH_LAYOUT_6POINT0,
252  .num_ele = { 2, 1, 1, 0 },
253  .pairing = { { 1, 0 }, { 1 }, { 0 }, },
254  .index = { { 0, 0 }, { 1 }, { 1 } },
255  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
256  .reorder_map = { 0, 1, 2, 3, 4, 5 },
257  },
258  {
259  .layout = AV_CH_LAYOUT_6POINT0_FRONT,
260  .num_ele = { 2, 1, 0, 0 },
261  .pairing = { { 1, 1 }, { 1 } },
262  .index = { { 1, 0 }, { 2 }, },
263  .config_map = { 3, TYPE_CPE, TYPE_CPE, TYPE_CPE, },
264  .reorder_map = { 0, 1, 2, 3, 4, 5 },
265  },
266  {
267  .layout = AV_CH_LAYOUT_HEXAGONAL,
268  .num_ele = { 2, 0, 2, 0 },
269  .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, },
270  .index = { { 0, 0 },{ 0 },{ 1, 1 } },
271  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, },
272  .reorder_map = { 0, 1, 2, 3, 4, 5 },
273  },
274  {
275  .layout = AV_CH_LAYOUT_6POINT1,
276  .num_ele = { 2, 1, 2, 0 },
277  .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, },
278  .index = { { 0, 0 },{ 1 },{ 1, 2 } },
279  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
280  .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
281  },
282  {
283  .layout = AV_CH_LAYOUT_6POINT1_BACK,
284  .num_ele = { 2, 1, 2, 0 },
285  .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, },
286  .index = { { 0, 0 }, { 1 }, { 1, 2 } },
287  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
288  .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
289  },
290  {
291  .layout = AV_CH_LAYOUT_6POINT1_FRONT,
292  .num_ele = { 2, 1, 2, 0 },
293  .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, },
294  .index = { { 0, 0 }, { 1 }, { 1, 2 } },
295  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
296  .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
297  },
298  {
299  .layout = AV_CH_LAYOUT_7POINT0,
300  .num_ele = { 2, 1, 1, 0 },
301  .pairing = { { 1, 0 }, { 1 }, { 1 }, },
302  .index = { { 0, 0 }, { 1 }, { 2 }, },
303  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
304  .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
305  },
306  {
307  .layout = AV_CH_LAYOUT_7POINT0_FRONT,
308  .num_ele = { 2, 1, 1, 0 },
309  .pairing = { { 1, 0 }, { 1 }, { 1 }, },
310  .index = { { 0, 0 }, { 1 }, { 2 }, },
311  .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
312  .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
313  },
314  {
315  .layout = AV_CH_LAYOUT_7POINT1,
316  .num_ele = { 2, 1, 2, 0 },
317  .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, },
318  .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
319  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
320  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
321  },
322  {
323  .layout = AV_CH_LAYOUT_7POINT1_WIDE,
324  .num_ele = { 2, 1, 2, 0 },
325  .pairing = { { 1, 0 }, { 0 },{ 1, 1 }, },
326  .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
327  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
328  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
329  },
330  {
332  .num_ele = { 2, 1, 2, 0 },
333  .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, },
334  .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
335  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
336  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
337  },
338  {
339  .layout = AV_CH_LAYOUT_OCTAGONAL,
340  .num_ele = { 2, 1, 2, 0 },
341  .pairing = { { 1, 0 }, { 1 }, { 1, 0 }, },
342  .index = { { 0, 0 }, { 1 }, { 2, 1 } },
343  .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE },
344  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
345  },
346  { /* Meant for order 2/mixed ambisonics */
348  .num_ele = { 2, 2, 2, 0 },
349  .pairing = { { 1, 0 }, { 1, 0 }, { 1, 0 }, },
350  .index = { { 0, 0 }, { 1, 1 }, { 2, 2 } },
351  .config_map = { 6, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
352  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8 },
353  },
354  { /* Meant for order 2/mixed ambisonics */
357  .num_ele = { 2, 2, 2, 0 },
358  .pairing = { { 1, 1 }, { 1, 0 }, { 1, 0 }, },
359  .index = { { 0, 1 }, { 2, 0 }, { 3, 1 } },
360  .config_map = { 6, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
361  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
362  },
363  {
364  .layout = AV_CH_LAYOUT_HEXADECAGONAL,
365  .num_ele = { 4, 2, 4, 0 },
366  .pairing = { { 1, 0, 1, 0 }, { 1, 1 }, { 1, 0, 1, 0 }, },
367  .index = { { 0, 0, 1, 1 }, { 2, 3 }, { 4, 2, 5, 3 } },
368  .config_map = { 10, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
369  .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
370  },
371 };
372 
373 /**
374  * AAC encoder context
375  */
376 typedef struct AACEncContext {
378  AACEncOptions options; ///< encoding options
380  FFTContext mdct1024; ///< long (1024 samples) frame transform context
381  FFTContext mdct128; ///< short (128 samples) frame transform context
383  AACPCEInfo pce; ///< PCE data, if needed
384  float *planar_samples[16]; ///< saved preprocessed input
385 
386  int profile; ///< copied from avctx
387  int needs_pce; ///< flag for non-standard layout
388  LPCContext lpc; ///< used by TNS
389  int samplerate_index; ///< MPEG-4 samplerate index
390  int channels; ///< channel count
391  const uint8_t *reorder_map; ///< lavc to aac reorder map
392  const uint8_t *chan_map; ///< channel configuration map
393 
394  ChannelElement *cpe; ///< channel elements
398  int cur_channel; ///< current channel for coder context
400  float lambda;
401  int last_frame_pb_count; ///< number of bits for the previous frame
402  float lambda_sum; ///< sum(lambda), for Qvg reporting
403  int lambda_count; ///< count(lambda), for Qvg reporting
404  enum RawDataBlockType cur_type; ///< channel group type cur_channel belongs to
405 
407  DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients
408  DECLARE_ALIGNED(32, float, scoefs)[1024]; ///< scaled coefficients
409 
411  AACQuantizeBandCostCacheEntry quantize_band_cost_cache[256][128]; ///< memoization area for quantize_band_cost
412 
413  void (*abs_pow34)(float *out, const float *in, const int size);
414  void (*quant_bands)(int *out, const float *in, const float *scaled,
415  int size, int is_signed, int maxval, const float Q34,
416  const float rounding);
417 
418  struct {
419  float *samples;
420  } buffer;
421 } AACEncContext;
422 
426 
427 
428 #endif /* AVCODEC_AACENC_H */
#define AV_CH_LAYOUT_7POINT1
#define AV_CH_LAYOUT_4POINT1
const char * s
Definition: avisynth_c.h:768
void(* search_for_pns)(struct AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
Definition: aacenc.h:73
const AACCoefficientsEncoder * coder
Definition: aacenc.h:397
#define AV_CH_LAYOUT_HEXADECAGONAL
int coder
Definition: aacenc.h:44
enum RawDataBlockType cur_type
channel group type cur_channel belongs to
Definition: aacenc.h:404
#define AV_CH_LAYOUT_6POINT1
Definition: lpc.h:52
AACQuantizeBandCostCacheEntry quantize_band_cost_cache[256][128]
memoization area for quantize_band_cost
Definition: aacenc.h:411
#define AV_CH_LAYOUT_6POINT0
#define AV_CH_LAYOUT_SURROUND
static float win(SuperEqualizerContext *s, float n, int N)
void(* encode_ltp_info)(struct AACEncContext *s, SingleChannelElement *sce, int common_window)
Definition: aacenc.h:64
Definition: aac.h:56
Definition: aac.h:57
#define AV_CH_LAYOUT_7POINT0_FRONT
int lambda_count
count(lambda), for Qvg reporting
Definition: aacenc.h:403
#define AV_CH_LAYOUT_4POINT0
#define AV_CH_LAYOUT_7POINT0
float lambda
Definition: aacenc.h:400
#define AV_CH_LAYOUT_STEREO
void(* search_for_tns)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:75
#define AV_CH_LAYOUT_5POINT0
static double cb(void *priv, double x, double y)
Definition: vf_geq.c:112
AACEncOptions options
encoding options
Definition: aacenc.h:378
AAC encoder context.
Definition: aacenc.h:376
int num_ele[4]
front, side, back, lfe
Definition: aacenc.h:95
uint8_t
void ff_quantize_band_cost_cache_init(struct AACEncContext *s)
Definition: aacenc.c:126
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:414
int intensity_stereo
Definition: aacenc.h:51
LPCContext lpc
used by TNS
Definition: aacenc.h:388
void ff_aac_coder_init_mips(AACEncContext *c)
int samplerate_index
MPEG-4 samplerate index.
Definition: aacenc.h:389
Definition: aac.h:59
const uint8_t * chan_map
channel configuration map
Definition: aacenc.h:392
#define AV_CH_LAYOUT_HEXAGONAL
int qcoefs[96]
quantized coefficients
Definition: aacenc.h:407
AudioFrameQueue afq
Definition: aacenc.h:406
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
Definition: mem.h:112
context used by psychoacoustic model
Definition: psymodel.h:89
#define AV_CH_BACK_LEFT
int profile
copied from avctx
Definition: aacenc.h:386
ptrdiff_t size
Definition: opengl_enc.c:101
uint8_t reorder_map[16]
maps channels from lavc to aac order
Definition: aacenc.h:99
#define AV_CH_LAYOUT_5POINT1
int64_t layout
Definition: aacenc.h:94
const uint8_t * reorder_map
lavc to aac reorder map
Definition: aacenc.h:391
AACCoder
Definition: aacenc.h:35
static const AACPCEInfo aac_pce_configs[]
List of PCE (Program Configuration Element) for the channel layouts listed in channel_layout.h.
Definition: aacenc.h:137
#define AV_CH_LAYOUT_QUAD
void(* set_special_band_scalefactors)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:72
void(* search_for_quantizers)(AVCodecContext *avctx, struct AACEncContext *s, SingleChannelElement *sce, const float lambda)
Definition: aacenc.h:57
int index[4][8]
front, side, back, lfe
Definition: aacenc.h:97
#define AV_CH_LAYOUT_2_1
#define AV_CH_LAYOUT_2_2
#define AV_CH_LAYOUT_6POINT0_FRONT
void(* search_for_is)(struct AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe)
Definition: aacenc.h:78
void(* abs_pow34)(float *out, const float *in, const int size)
Definition: aacenc.h:413
#define AV_CH_TOP_CENTER
Definition: fft.h:88
AVClass * av_class
Definition: aacenc.h:377
int cur_channel
current channel for coder context
Definition: aacenc.h:398
int last_frame_pb_count
number of bits for the previous frame
Definition: aacenc.h:401
#define AV_CH_LAYOUT_3POINT1
void(* apply_tns_filt)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:69
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
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:61
int channels
channel count
Definition: aacenc.h:390
void(* encode_main_pred)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:65
AAC definitions and structures.
void(* search_for_ltp)(struct AACEncContext *s, SingleChannelElement *sce, int common_window)
Definition: aacenc.h:76
FFTContext mdct128
short (128 samples) frame transform context
Definition: aacenc.h:381
PutBitContext pb
Definition: aacenc.h:379
void(* search_for_pred)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:79
#define AV_CH_LAYOUT_5POINT1_BACK
AVFloatDSPContext * fdsp
Definition: aacenc.h:382
int mid_side
Definition: aacenc.h:50
#define AV_CH_LAYOUT_6POINT1_BACK
const AACCoefficientsEncoder ff_aac_coders[]
Definition: aaccoder.c:897
void(* adjust_common_pred)(struct AACEncContext *s, ChannelElement *cpe)
Definition: aacenc.h:66
void ff_aac_dsp_init_x86(AACEncContext *s)
Libavcodec external API header.
void(* search_for_ms)(struct AACEncContext *s, ChannelElement *cpe)
Definition: aacenc.h:77
void(* apply_main_pred)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:68
main external API structure.
Definition: avcodec.h:1518
int pairing[3][8]
front, side, back
Definition: aacenc.h:96
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
void(* encode_window_bands_info)(struct AACEncContext *s, SingleChannelElement *sce, int win, int group_len, const float lambda)
Definition: aacenc.h:59
void(* mark_pns)(struct AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
Definition: aacenc.h:74
float lambda_sum
sum(lambda), for Qvg reporting
Definition: aacenc.h:402
Describe the class of an AVClass context structure.
Definition: log.h:67
#define AV_CH_LAYOUT_7POINT1_WIDE_BACK
#define AV_CH_LAYOUT_5POINT0_BACK
uint16_t quantize_band_cost_cache_generation
Definition: aacenc.h:410
#define AV_CH_LAYOUT_OCTAGONAL
FFPsyContext psy
Definition: aacenc.h:395
int needs_pce
flag for non-standard layout
Definition: aacenc.h:387
struct AACEncContext::@28 buffer
struct FFPsyPreprocessContext * psypp
Definition: aacenc.h:396
void(* encode_tns_info)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:63
#define AV_CH_BACK_CENTER
#define AV_CH_LAYOUT_7POINT1_WIDE
float * samples
Definition: aacenc.h:419
AACPCEInfo pce
PCE data, if needed.
Definition: aacenc.h:383
Single Channel Element - used for both SCE and LFE elements.
Definition: aac.h:248
#define AV_CH_LAYOUT_2POINT1
static double c[64]
uint8_t config_map[16]
configs the encoder's channel specific settings
Definition: aacenc.h:98
float * planar_samples[16]
saved preprocessed input
Definition: aacenc.h:384
ChannelElement * cpe
channel elements
Definition: aacenc.h:394
void(* ltp_insert_new_frame)(struct AACEncContext *s)
Definition: aacenc.h:71
channel element - generic struct for SCE/CPE/CCE/LFE
Definition: aac.h:275
FFTContext mdct1024
long (1024 samples) frame transform context
Definition: aacenc.h:380
int random_state
Definition: aacenc.h:399
#define AV_CH_LAYOUT_6POINT1_FRONT
FILE * out
Definition: movenc.c:54
void(* adjust_common_ltp)(struct AACEncContext *s, ChannelElement *cpe)
Definition: aacenc.h:67
#define AV_CH_LAYOUT_MONO
float scoefs[1024]
scaled coefficients
Definition: aacenc.h:408
void(* update_ltp)(struct AACEncContext *s, SingleChannelElement *sce)
Definition: aacenc.h:70
int pred
Definition: aacenc.h:49
#define AV_CH_BACK_RIGHT
RawDataBlockType
Definition: aac.h:55
bitstream writer API