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 Libav.
7  *
8  * Libav 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  * Libav 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 Libav; 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 "dsputil.h"
36 #include "fft.h"
37 #include "mpeg4audio.h"
38 #include "sbr.h"
39 #include "fmtconvert.h"
40 
41 #include <stdint.h>
42 
43 #define MAX_CHANNELS 64
44 #define MAX_ELEM_ID 16
45 
46 #define TNS_MAX_ORDER 20
47 #define MAX_LTP_LONG_SFB 40
48 
58 };
59 
65  EXT_SBR_DATA = 0xd,
67 };
68 
74 };
75 
76 enum BandType {
77  ZERO_BT = 0,
79  ESC_BT = 11,
80  NOISE_BT = 13,
82  INTENSITY_BT = 15,
83 };
84 
85 #define IS_CODEBOOK_UNSIGNED(x) ((x - 1) & 10)
86 
94 };
95 
103 };
104 
108 enum OCStatus {
114 };
115 
116 typedef struct OutputConfiguration {
120  int channels;
121  uint64_t channel_layout;
124 
128 typedef struct PredictorState {
129  float cor0;
130  float cor1;
131  float var0;
132  float var1;
133  float r0;
134  float r1;
136 
137 #define MAX_PREDICTORS 672
138 
139 #define SCALE_DIV_512 36
140 #define SCALE_ONE_POS 140
141 #define SCALE_MAX_POS 255
142 #define SCALE_MAX_DIFF 60
143 #define SCALE_DIFF_ZERO 60
144 
145 
148 typedef struct LongTermPrediction {
149  int8_t present;
150  int16_t lag;
151  float coef;
154 
158 typedef struct IndividualChannelStream {
165  const uint16_t *swb_offset;
167  int num_swb;
175 
179 typedef struct TemporalNoiseShaping {
180  int present;
181  int n_filt[8];
182  int length[8][4];
183  int direction[8][4];
184  int order[8][4];
185  float coef[8][4][TNS_MAX_ORDER];
187 
191 typedef struct DynamicRangeControl {
193  int dyn_rng_sgn[17];
194  int dyn_rng_ctl[17];
196  int band_incr;
198  int band_top[17];
203 
204 typedef struct Pulse {
206  int start;
207  int pos[4];
208  int amp[4];
209 } Pulse;
210 
214 typedef struct ChannelCoupling {
218  int id_select[8];
219  int ch_select[8];
222  float gain[16][120];
224 
228 typedef struct SingleChannelElement {
232  enum BandType band_type[128];
233  int band_type_run_end[120];
234  float sf[120];
235  int sf_idx[128];
237  DECLARE_ALIGNED(32, float, coeffs)[1024];
238  DECLARE_ALIGNED(32, float, saved)[1024];
239  DECLARE_ALIGNED(32, float, ret_buf)[2048];
240  DECLARE_ALIGNED(16, float, ltp_state)[3072];
242  float *ret;
244 
248 typedef struct ChannelElement {
249  // CPE specific
251  int ms_mode;
253  // shared
255  // CCE specific
259 
263 typedef struct AACContext {
266 
267  int is_saved;
269 
284  DECLARE_ALIGNED(32, float, buf_mdct)[1024];
305 
307  DECLARE_ALIGNED(32, float, temp)[128];
308 
310 } AACContext;
311 
312 #endif /* AVCODEC_AAC_H */