FFmpeg
libavcodec
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
34
#include "
aac_defines.h
"
35
36
#define MAX_CHANNELS 64
37
#define MAX_ELEM_ID 16
38
39
#define TNS_MAX_ORDER 20
40
#define MAX_LTP_LONG_SFB 40
41
42
enum
RawDataBlockType
{
43
TYPE_SCE
,
44
TYPE_CPE
,
45
TYPE_CCE
,
46
TYPE_LFE
,
47
TYPE_DSE
,
48
TYPE_PCE
,
49
TYPE_FIL
,
50
TYPE_END
,
51
};
52
53
enum
ExtensionPayloadID
{
54
EXT_FILL
,
55
EXT_FILL_DATA
,
56
EXT_DATA_ELEMENT
,
57
EXT_DYNAMIC_RANGE
= 0xb,
58
EXT_SBR_DATA
= 0xd,
59
EXT_SBR_DATA_CRC
= 0xe,
60
};
61
62
enum
WindowSequence
{
63
ONLY_LONG_SEQUENCE
,
64
LONG_START_SEQUENCE
,
65
EIGHT_SHORT_SEQUENCE
,
66
LONG_STOP_SEQUENCE
,
67
};
68
69
enum
BandType
{
70
ZERO_BT
= 0,
///< Scalefactors and spectral data are all zero.
71
FIRST_PAIR_BT
= 5,
///< This and later band types encode two values (rather than four) with one code word.
72
ESC_BT
= 11,
///< Spectral data are coded with an escape sequence.
73
RESERVED_BT
= 12,
///< Band types following are encoded differently from others.
74
NOISE_BT
= 13,
///< Spectral data are scaled white noise not coded in the bitstream.
75
INTENSITY_BT2
= 14,
///< Scalefactor data are intensity stereo positions (out of phase).
76
INTENSITY_BT
= 15,
///< Scalefactor data are intensity stereo positions (in phase).
77
};
78
79
enum
ChannelPosition
{
80
AAC_CHANNEL_OFF
= 0,
81
AAC_CHANNEL_FRONT
= 1,
82
AAC_CHANNEL_SIDE
= 2,
83
AAC_CHANNEL_BACK
= 3,
84
AAC_CHANNEL_LFE
= 4,
85
AAC_CHANNEL_CC
= 5,
86
};
87
88
/**
89
* Predictor State
90
*/
91
typedef
struct
PredictorState
{
92
AAC_FLOAT
cor0
;
93
AAC_FLOAT
cor1
;
94
AAC_FLOAT
var0
;
95
AAC_FLOAT
var1
;
96
AAC_FLOAT
r0
;
97
AAC_FLOAT
r1
;
98
AAC_FLOAT
k1
;
99
AAC_FLOAT
x_est
;
100
}
PredictorState
;
101
102
#define MAX_PREDICTORS 672
103
104
#define SCALE_DIV_512 36
///< scalefactor difference that corresponds to scale difference in 512 times
105
#define SCALE_ONE_POS 140
///< scalefactor index that corresponds to scale=1.0
106
#define SCALE_MAX_POS 255
///< scalefactor index maximum value
107
#define SCALE_MAX_DIFF 60
///< maximum scalefactor difference allowed by standard
108
#define SCALE_DIFF_ZERO 60
///< codebook index corresponding to zero scalefactor indices difference
109
110
#define POW_SF2_ZERO 200
///< ff_aac_pow2sf_tab index corresponding to pow(2, 0);
111
112
#define NOISE_PRE 256
///< preamble for NOISE_BT, put in bitstream with the first noise band
113
#define NOISE_PRE_BITS 9
///< length of preamble
114
#define NOISE_OFFSET 90
///< subtracted from global gain, used as offset for the preamble
115
116
typedef
struct
Pulse
{
117
int
num_pulse
;
118
int
start
;
119
int
pos
[4];
120
int
amp
[4];
121
}
Pulse
;
122
123
#endif
/* AVCODEC_AAC_H */
AAC_CHANNEL_BACK
@ AAC_CHANNEL_BACK
Definition:
aac.h:83
TYPE_FIL
@ TYPE_FIL
Definition:
aac.h:49
EXT_FILL
@ EXT_FILL
Definition:
aac.h:54
Pulse::num_pulse
int num_pulse
Definition:
aac.h:117
PredictorState::var1
AAC_FLOAT var1
Definition:
aac.h:95
PredictorState::var0
AAC_FLOAT var0
Definition:
aac.h:94
TYPE_PCE
@ TYPE_PCE
Definition:
aac.h:48
EXT_DYNAMIC_RANGE
@ EXT_DYNAMIC_RANGE
Definition:
aac.h:57
TYPE_CPE
@ TYPE_CPE
Definition:
aac.h:44
Pulse::amp
int amp[4]
Definition:
aac.h:120
Pulse::pos
int pos[4]
Definition:
aac.h:119
Pulse::start
int start
Definition:
aac.h:118
PredictorState::r0
AAC_FLOAT r0
Definition:
aac.h:96
ZERO_BT
@ ZERO_BT
Scalefactors and spectral data are all zero.
Definition:
aac.h:70
NOISE_BT
@ NOISE_BT
Spectral data are scaled white noise not coded in the bitstream.
Definition:
aac.h:74
EIGHT_SHORT_SEQUENCE
@ EIGHT_SHORT_SEQUENCE
Definition:
aac.h:65
INTENSITY_BT2
@ INTENSITY_BT2
Scalefactor data are intensity stereo positions (out of phase).
Definition:
aac.h:75
TYPE_DSE
@ TYPE_DSE
Definition:
aac.h:47
PredictorState
Predictor State.
Definition:
aac.h:91
ChannelPosition
ChannelPosition
Definition:
aac.h:79
INTENSITY_BT
@ INTENSITY_BT
Scalefactor data are intensity stereo positions (in phase).
Definition:
aac.h:76
AAC_CHANNEL_SIDE
@ AAC_CHANNEL_SIDE
Definition:
aac.h:82
AAC_CHANNEL_FRONT
@ AAC_CHANNEL_FRONT
Definition:
aac.h:81
PredictorState::k1
AAC_FLOAT k1
Definition:
aac.h:98
AAC_CHANNEL_OFF
@ AAC_CHANNEL_OFF
Definition:
aac.h:80
PredictorState::r1
AAC_FLOAT r1
Definition:
aac.h:97
ONLY_LONG_SEQUENCE
@ ONLY_LONG_SEQUENCE
Definition:
aac.h:63
TYPE_END
@ TYPE_END
Definition:
aac.h:50
BandType
BandType
Definition:
aac.h:69
ESC_BT
@ ESC_BT
Spectral data are coded with an escape sequence.
Definition:
aac.h:72
EXT_FILL_DATA
@ EXT_FILL_DATA
Definition:
aac.h:55
RawDataBlockType
RawDataBlockType
Definition:
aac.h:42
LONG_STOP_SEQUENCE
@ LONG_STOP_SEQUENCE
Definition:
aac.h:66
PredictorState::x_est
AAC_FLOAT x_est
Definition:
aac.h:99
TYPE_LFE
@ TYPE_LFE
Definition:
aac.h:46
TYPE_SCE
@ TYPE_SCE
Definition:
aac.h:43
AAC_CHANNEL_LFE
@ AAC_CHANNEL_LFE
Definition:
aac.h:84
RESERVED_BT
@ RESERVED_BT
Band types following are encoded differently from others.
Definition:
aac.h:73
LONG_START_SEQUENCE
@ LONG_START_SEQUENCE
Definition:
aac.h:64
EXT_SBR_DATA_CRC
@ EXT_SBR_DATA_CRC
Definition:
aac.h:59
EXT_SBR_DATA
@ EXT_SBR_DATA
Definition:
aac.h:58
FIRST_PAIR_BT
@ FIRST_PAIR_BT
This and later band types encode two values (rather than four) with one code word.
Definition:
aac.h:71
TYPE_CCE
@ TYPE_CCE
Definition:
aac.h:45
PredictorState::cor1
AAC_FLOAT cor1
Definition:
aac.h:93
AAC_FLOAT
float AAC_FLOAT
Definition:
aac_defines.h:92
ExtensionPayloadID
ExtensionPayloadID
Definition:
aac.h:53
EXT_DATA_ELEMENT
@ EXT_DATA_ELEMENT
Definition:
aac.h:56
aac_defines.h
Pulse
Definition:
aac.h:116
AAC_CHANNEL_CC
@ AAC_CHANNEL_CC
Definition:
aac.h:85
WindowSequence
WindowSequence
Definition:
aac.h:62
PredictorState::cor0
AAC_FLOAT cor0
Definition:
aac.h:92
Generated on Thu Sep 26 2024 23:14:46 for FFmpeg by
1.8.17