FFmpeg  1.2.12
aac.h
Go to the documentation of this file.
1 /*
2  * AAC definitions and structures
3  * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
4  * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov 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 
30 #ifndef AVCODEC_AAC_H
31 #define AVCODEC_AAC_H
32 
33 #include "libavutil/float_dsp.h"
34 #include "avcodec.h"
35 #include "fft.h"
36 #include "mpeg4audio.h"
37 #include "sbr.h"
38 #include "fmtconvert.h"
39 
40 #include <stdint.h>
41 
42 #define MAX_CHANNELS 64
43 #define MAX_ELEM_ID 16
44 
45 #define TNS_MAX_ORDER 20
46 #define MAX_LTP_LONG_SFB 40
47 
57 };
58 
64  EXT_SBR_DATA = 0xd,
66 };
67 
73 };
74 
75 enum BandType {
76  ZERO_BT = 0,
78  ESC_BT = 11,
79  NOISE_BT = 13,
81  INTENSITY_BT = 15,
82 };
83 
84 #define IS_CODEBOOK_UNSIGNED(x) (((x) - 1) & 10)
85 
93 };
94 
102 };
103 
107 enum OCStatus {
113 };
114 
115 typedef struct OutputConfiguration {
119  int channels;
120  uint64_t channel_layout;
123 
127 typedef struct PredictorState {
128  float cor0;
129  float cor1;
130  float var0;
131  float var1;
132  float r0;
133  float r1;
135 
136 #define MAX_PREDICTORS 672
137 
138 #define SCALE_DIV_512 36
139 #define SCALE_ONE_POS 140
140 #define SCALE_MAX_POS 255
141 #define SCALE_MAX_DIFF 60
142 #define SCALE_DIFF_ZERO 60
143 
144 
147 typedef struct LongTermPrediction {
148  int8_t present;
149  int16_t lag;
150  float coef;
153 
157 typedef struct IndividualChannelStream {
164  const uint16_t *swb_offset;
166  int num_swb;
174 
178 typedef struct TemporalNoiseShaping {
179  int present;
180  int n_filt[8];
181  int length[8][4];
182  int direction[8][4];
183  int order[8][4];
184  float coef[8][4][TNS_MAX_ORDER];
186 
190 typedef struct DynamicRangeControl {
192  int dyn_rng_sgn[17];
193  int dyn_rng_ctl[17];
195  int band_incr;
197  int band_top[17];
202 
203 typedef struct Pulse {
205  int start;
206  int pos[4];
207  int amp[4];
208 } Pulse;
209 
213 typedef struct ChannelCoupling {
217  int id_select[8];
218  int ch_select[8];
221  float gain[16][120];
223 
227 typedef struct SingleChannelElement {
231  enum BandType band_type[128];
232  int band_type_run_end[120];
233  float sf[120];
234  int sf_idx[128];
236  DECLARE_ALIGNED(32, float, coeffs)[1024];
237  DECLARE_ALIGNED(32, float, saved)[1024];
238  DECLARE_ALIGNED(32, float, ret_buf)[2048];
239  DECLARE_ALIGNED(16, float, ltp_state)[3072];
241  float *ret;
243 
247 typedef struct ChannelElement {
248  // CPE specific
250  int ms_mode;
252  // shared
254  // CCE specific
258 
262 struct AACContext {
263  AVClass *class;
266 
267  int is_saved;
269 
284  DECLARE_ALIGNED(32, float, buf_mdct)[1024];
304 
313 
315  DECLARE_ALIGNED(32, float, temp)[128];
316 
319 
320  /* aacdec functions pointers */
323  void (*apply_tns)(float coef[1024], TemporalNoiseShaping *tns,
324  IndividualChannelStream *ics, int decode);
326  float *in, IndividualChannelStream *ics);
328 
329 };
330 
332 
333 #endif /* AVCODEC_AAC_H */