FFmpeg
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 
23 /**
24  * @file
25  * AAC definitions and structures
26  * @author Oded Shimon ( ods15 ods15 dyndns org )
27  * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
28  */
29 
30 #ifndef AVCODEC_AAC_H
31 #define AVCODEC_AAC_H
32 
33 #define MAX_CHANNELS 64
34 #define MAX_ELEM_ID 64
35 
36 #define TNS_MAX_ORDER 20
37 #define MAX_LTP_LONG_SFB 40
38 
39 #define MPS_MAX_PARAM_SETS 9
40 #define MPS_MAX_PARAM_BANDS 28
41 #define MPS_MAX_TIME_SLOTS 16 /* 64 in non-AAC MPEG Surround */
42 
52 };
53 
59  EXT_SBR_DATA = 0xd,
61 };
62 
68 };
69 
70 enum BandType {
71  ZERO_BT = 0, ///< Scalefactors and spectral data are all zero.
72  FIRST_PAIR_BT = 5, ///< This and later band types encode two values (rather than four) with one code word.
73  ESC_BT = 11, ///< Spectral data are coded with an escape sequence.
74  RESERVED_BT = 12, ///< Band types following are encoded differently from others.
75  NOISE_BT = 13, ///< Spectral data are scaled white noise not coded in the bitstream.
76  INTENSITY_BT2 = 14, ///< Scalefactor data are intensity stereo positions (out of phase).
77  INTENSITY_BT = 15, ///< Scalefactor data are intensity stereo positions (in phase).
78 };
79 
87 };
88 
89 #define MAX_PREDICTORS 672
90 
91 #define SCALE_DIV_512 36 ///< scalefactor difference that corresponds to scale difference in 512 times
92 #define SCALE_ONE_POS 140 ///< scalefactor index that corresponds to scale=1.0
93 #define SCALE_MAX_POS 255 ///< scalefactor index maximum value
94 #define SCALE_MAX_DIFF 60 ///< maximum scalefactor difference allowed by standard
95 #define SCALE_DIFF_ZERO 60 ///< codebook index corresponding to zero scalefactor indices difference
96 
97 #define POW_SF2_ZERO 200 ///< ff_aac_pow2sf_tab index corresponding to pow(2, 0);
98 
99 #define NOISE_PRE 256 ///< preamble for NOISE_BT, put in bitstream with the first noise band
100 #define NOISE_PRE_BITS 9 ///< length of preamble
101 #define NOISE_OFFSET 90 ///< subtracted from global gain, used as offset for the preamble
102 
103 typedef struct Pulse {
105  int start;
106  int pos[4];
107  int amp[4];
108 } Pulse;
109 
110 static inline int ff_aac_sample_rate_idx(int rate)
111 {
112  if (92017 <= rate) return 0;
113  else if (75132 <= rate) return 1;
114  else if (55426 <= rate) return 2;
115  else if (46009 <= rate) return 3;
116  else if (37566 <= rate) return 4;
117  else if (27713 <= rate) return 5;
118  else if (23004 <= rate) return 6;
119  else if (18783 <= rate) return 7;
120  else if (13856 <= rate) return 8;
121  else if (11502 <= rate) return 9;
122  else if (9391 <= rate) return 10;
123  else return 11;
124 }
125 
126 #endif /* AVCODEC_AAC_H */
AAC_CHANNEL_BACK
@ AAC_CHANNEL_BACK
Definition: aac.h:84
TYPE_FIL
@ TYPE_FIL
Definition: aac.h:50
EXT_FILL
@ EXT_FILL
Definition: aac.h:55
Pulse::num_pulse
int num_pulse
Definition: aac.h:104
TYPE_PCE
@ TYPE_PCE
Definition: aac.h:49
ff_aac_sample_rate_idx
static int ff_aac_sample_rate_idx(int rate)
Definition: aac.h:110
EXT_DYNAMIC_RANGE
@ EXT_DYNAMIC_RANGE
Definition: aac.h:58
TYPE_CPE
@ TYPE_CPE
Definition: aac.h:45
Pulse::amp
int amp[4]
Definition: aac.h:107
Pulse::pos
int pos[4]
Definition: aac.h:106
Pulse::start
int start
Definition: aac.h:105
ZERO_BT
@ ZERO_BT
Scalefactors and spectral data are all zero.
Definition: aac.h:71
NOISE_BT
@ NOISE_BT
Spectral data are scaled white noise not coded in the bitstream.
Definition: aac.h:75
EIGHT_SHORT_SEQUENCE
@ EIGHT_SHORT_SEQUENCE
Definition: aac.h:66
INTENSITY_BT2
@ INTENSITY_BT2
Scalefactor data are intensity stereo positions (out of phase).
Definition: aac.h:76
TYPE_DSE
@ TYPE_DSE
Definition: aac.h:48
ChannelPosition
ChannelPosition
Definition: aac.h:80
INTENSITY_BT
@ INTENSITY_BT
Scalefactor data are intensity stereo positions (in phase).
Definition: aac.h:77
AAC_CHANNEL_SIDE
@ AAC_CHANNEL_SIDE
Definition: aac.h:83
AAC_CHANNEL_FRONT
@ AAC_CHANNEL_FRONT
Definition: aac.h:82
AAC_CHANNEL_OFF
@ AAC_CHANNEL_OFF
Definition: aac.h:81
ONLY_LONG_SEQUENCE
@ ONLY_LONG_SEQUENCE
Definition: aac.h:64
TYPE_END
@ TYPE_END
Definition: aac.h:51
BandType
BandType
Definition: aac.h:70
ESC_BT
@ ESC_BT
Spectral data are coded with an escape sequence.
Definition: aac.h:73
EXT_FILL_DATA
@ EXT_FILL_DATA
Definition: aac.h:56
RawDataBlockType
RawDataBlockType
Definition: aac.h:43
LONG_STOP_SEQUENCE
@ LONG_STOP_SEQUENCE
Definition: aac.h:67
TYPE_LFE
@ TYPE_LFE
Definition: aac.h:47
TYPE_SCE
@ TYPE_SCE
Definition: aac.h:44
AAC_CHANNEL_LFE
@ AAC_CHANNEL_LFE
Definition: aac.h:85
RESERVED_BT
@ RESERVED_BT
Band types following are encoded differently from others.
Definition: aac.h:74
LONG_START_SEQUENCE
@ LONG_START_SEQUENCE
Definition: aac.h:65
EXT_SBR_DATA_CRC
@ EXT_SBR_DATA_CRC
Definition: aac.h:60
EXT_SBR_DATA
@ EXT_SBR_DATA
Definition: aac.h:59
FIRST_PAIR_BT
@ FIRST_PAIR_BT
This and later band types encode two values (rather than four) with one code word.
Definition: aac.h:72
TYPE_CCE
@ TYPE_CCE
Definition: aac.h:46
ExtensionPayloadID
ExtensionPayloadID
Definition: aac.h:54
EXT_DATA_ELEMENT
@ EXT_DATA_ELEMENT
Definition: aac.h:57
Pulse
Definition: aac.h:103
AAC_CHANNEL_CC
@ AAC_CHANNEL_CC
Definition: aac.h:86
WindowSequence
WindowSequence
Definition: aac.h:63