FFmpeg
aacenctab.h
Go to the documentation of this file.
1 /*
2  * AAC encoder data
3  * Copyright (c) 2015 Rostislav Pehlivanov ( atomnuker gmail com )
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 /**
23  * @file
24  * AAC encoder data
25  * @author Rostislav Pehlivanov ( atomnuker gmail com )
26  */
27 
28 #ifndef AVCODEC_AACENCTAB_H
29 #define AVCODEC_AACENCTAB_H
30 
32 #include "aac.h"
33 #include "defs.h"
34 
35 /** Total number of usable codebooks **/
36 #define CB_TOT 12
37 
38 /** Total number of codebooks, including special ones **/
39 #define CB_TOT_ALL 15
40 
41 #define AAC_MAX_CHANNELS 16
42 
43 extern const uint8_t *const ff_aac_swb_size_1024[];
44 extern const int ff_aac_swb_size_1024_len;
45 extern const uint8_t *const ff_aac_swb_size_128[];
46 extern const int ff_aac_swb_size_128_len;
47 
48 /* Supported layouts without using a PCE */
57 };
58 
59 /** default channel configurations */
60 static const uint8_t aac_chan_configs[AAC_MAX_CHANNELS][6] = {
61  {1, TYPE_SCE}, // 1 channel - single channel element
62  {1, TYPE_CPE}, // 2 channels - channel pair
63  {2, TYPE_SCE, TYPE_CPE}, // 3 channels - center + stereo
64  {3, TYPE_SCE, TYPE_CPE, TYPE_SCE}, // 4 channels - front center + stereo + back center
65  {3, TYPE_SCE, TYPE_CPE, TYPE_CPE}, // 5 channels - front center + stereo + back stereo
66  {4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_LFE}, // 6 channels - front center + stereo + back stereo + LFE
67  {0}, // 7 channels - invalid without PCE
68  {5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_LFE}, // 8 channels - front center + front stereo + side stereo + back stereo + LFE
69 };
70 
71 /**
72  * Table to remap channels from libavcodec's default order to AAC order.
73  */
75  { 0 },
76  { 0, 1 },
77  { 2, 0, 1 },
78  { 2, 0, 1, 3 },
79  { 2, 0, 1, 3, 4 },
80  { 2, 0, 1, 4, 5, 3 },
81  { 0 },
82  { 2, 0, 1, 6, 7, 4, 5, 3 },
83 };
84 
85 /** bits needed to code codebook run value for long windows */
86 static const uint8_t run_value_bits_long[64] = {
87  5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
88  5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10,
89  10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
90  10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 15
91 };
92 
93 /** bits needed to code codebook run value for short windows */
94 static const uint8_t run_value_bits_short[16] = {
95  3, 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 9
96 };
97 
98 /* TNS starting SFBs for long and short windows */
99 static const uint8_t tns_min_sfb_short[16] = {
100  2, 2, 2, 3, 3, 4, 6, 6, 8, 10, 10, 12, 12, 12, 12, 12
101 };
102 
103 static const uint8_t tns_min_sfb_long[16] = {
104  12, 13, 15, 16, 17, 20, 25, 26, 24, 28, 30, 31, 31, 31, 31, 31
105 };
106 
107 static const uint8_t * const tns_min_sfb[2] = {
109 };
110 
111 static const uint8_t * const run_value_bits[2] = {
113 };
114 
115 /** Map to convert values from BandCodingPath index to a codebook index **/
116 static const uint8_t aac_cb_out_map[CB_TOT_ALL] = {0,1,2,3,4,5,6,7,8,9,10,11,13,14,15};
117 /** Inverse map to convert from codebooks to BandCodingPath indices **/
118 static const uint8_t aac_cb_in_map[CB_TOT_ALL+1] = {0,1,2,3,4,5,6,7,8,9,10,11,0,12,13,14};
119 
120 static const uint8_t aac_cb_range [12] = {0, 3, 3, 3, 3, 9, 9, 8, 8, 13, 13, 17};
121 static const uint8_t aac_cb_maxval[12] = {0, 1, 1, 2, 2, 4, 4, 7, 7, 12, 12, 16};
122 
123 static const unsigned char aac_maxval_cb[] = {
124  0, 1, 3, 5, 5, 7, 7, 7, 9, 9, 9, 9, 9, 11
125 };
126 
127 static const int aacenc_profiles[] = {
132 };
133 
134 #endif /* AVCODEC_AACENCTAB_H */
AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_STEREO
Definition: channel_layout.h:387
CB_TOT_ALL
#define CB_TOT_ALL
Total number of codebooks, including special ones.
Definition: aacenctab.h:39
aacenc_profiles
static const int aacenc_profiles[]
Definition: aacenctab.h:127
AV_PROFILE_MPEG2_AAC_LOW
#define AV_PROFILE_MPEG2_AAC_LOW
Definition: defs.h:77
aac_chan_configs
static const uint8_t aac_chan_configs[AAC_MAX_CHANNELS][6]
default channel configurations
Definition: aacenctab.h:60
ff_aac_swb_size_128_len
const int ff_aac_swb_size_128_len
Definition: aacenctab.c:107
aac_cb_maxval
static const uint8_t aac_cb_maxval[12]
Definition: aacenctab.h:121
ff_aac_swb_size_1024
const uint8_t *const ff_aac_swb_size_1024[]
Definition: aacenctab.c:99
TYPE_CPE
@ TYPE_CPE
Definition: aac.h:41
AV_CHANNEL_LAYOUT_SURROUND
#define AV_CHANNEL_LAYOUT_SURROUND
Definition: channel_layout.h:390
tns_min_sfb_long
static const uint8_t tns_min_sfb_long[16]
Definition: aacenctab.h:103
AV_CHANNEL_LAYOUT_4POINT0
#define AV_CHANNEL_LAYOUT_4POINT0
Definition: channel_layout.h:392
AV_CHANNEL_LAYOUT_7POINT1
#define AV_CHANNEL_LAYOUT_7POINT1
Definition: channel_layout.h:409
AV_PROFILE_AAC_LTP
#define AV_PROFILE_AAC_LTP
Definition: defs.h:71
AV_CHANNEL_LAYOUT_5POINT0_BACK
#define AV_CHANNEL_LAYOUT_5POINT0_BACK
Definition: channel_layout.h:398
run_value_bits_long
static const uint8_t run_value_bits_long[64]
bits needed to code codebook run value for long windows
Definition: aacenctab.h:86
aac_chan_maps
static const uint8_t aac_chan_maps[AAC_MAX_CHANNELS][AAC_MAX_CHANNELS]
Table to remap channels from libavcodec's default order to AAC order.
Definition: aacenctab.h:74
AAC_MAX_CHANNELS
#define AAC_MAX_CHANNELS
Definition: aacenctab.h:41
aac_normal_chan_layouts
static const AVChannelLayout aac_normal_chan_layouts[7]
Definition: aacenctab.h:49
aac_cb_range
static const uint8_t aac_cb_range[12]
Definition: aacenctab.h:120
aac.h
run_value_bits
static const uint8_t *const run_value_bits[2]
Definition: aacenctab.h:111
aac_cb_out_map
static const uint8_t aac_cb_out_map[CB_TOT_ALL]
Map to convert values from BandCodingPath index to a codebook index.
Definition: aacenctab.h:116
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:311
tns_min_sfb
static const uint8_t *const tns_min_sfb[2]
Definition: aacenctab.h:107
aac_cb_in_map
static const uint8_t aac_cb_in_map[CB_TOT_ALL+1]
Inverse map to convert from codebooks to BandCodingPath indices.
Definition: aacenctab.h:118
run_value_bits_short
static const uint8_t run_value_bits_short[16]
bits needed to code codebook run value for short windows
Definition: aacenctab.h:94
TYPE_LFE
@ TYPE_LFE
Definition: aac.h:43
ff_aac_swb_size_128
const uint8_t *const ff_aac_swb_size_128[]
Definition: aacenctab.c:91
TYPE_SCE
@ TYPE_SCE
Definition: aac.h:40
AV_PROFILE_AAC_LOW
#define AV_PROFILE_AAC_LOW
Definition: defs.h:69
aac_maxval_cb
static const unsigned char aac_maxval_cb[]
Definition: aacenctab.h:123
channel_layout.h
defs.h
tns_min_sfb_short
static const uint8_t tns_min_sfb_short[16]
Definition: aacenctab.h:99
AV_PROFILE_AAC_MAIN
#define AV_PROFILE_AAC_MAIN
Definition: defs.h:68
ff_aac_swb_size_1024_len
const int ff_aac_swb_size_1024_len
Definition: aacenctab.c:108
AV_CHANNEL_LAYOUT_MONO
#define AV_CHANNEL_LAYOUT_MONO
Definition: channel_layout.h:386
AV_CHANNEL_LAYOUT_5POINT1_BACK
#define AV_CHANNEL_LAYOUT_5POINT1_BACK
Definition: channel_layout.h:399