FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 
31 #include "aac.h"
32 
33 /** Total number of usable codebooks **/
34 #define CB_TOT 12
35 
36 /** Total number of codebooks, including special ones **/
37 #define CB_TOT_ALL 15
38 
39 #define AAC_MAX_CHANNELS 8
40 
41 extern const uint8_t *ff_aac_swb_size_1024[];
42 extern const int ff_aac_swb_size_1024_len;
43 extern const uint8_t *ff_aac_swb_size_128[];
44 extern const int ff_aac_swb_size_128_len;
45 
46 /** default channel configurations */
48  {1, TYPE_SCE}, // 1 channel - single channel element
49  {1, TYPE_CPE}, // 2 channels - channel pair
50  {2, TYPE_SCE, TYPE_CPE}, // 3 channels - center + stereo
51  {3, TYPE_SCE, TYPE_CPE, TYPE_SCE}, // 4 channels - front center + stereo + back center
52  {3, TYPE_SCE, TYPE_CPE, TYPE_CPE}, // 5 channels - front center + stereo + back stereo
53  {4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_LFE}, // 6 channels - front center + stereo + back stereo + LFE
54  {0}, // 7 channels - invalid without PCE
55  {5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_LFE}, // 8 channels - front center + front stereo + side stereo + back stereo + LFE
56 };
57 
58 /**
59  * Table to remap channels from libavcodec's default order to AAC order.
60  */
62  { 0 },
63  { 0, 1 },
64  { 2, 0, 1 },
65  { 2, 0, 1, 3 },
66  { 2, 0, 1, 3, 4 },
67  { 2, 0, 1, 4, 5, 3 },
68  { 0 },
69  { 2, 0, 1, 6, 7, 4, 5, 3 },
70 };
71 
72 /* duplicated from avpriv_mpeg4audio_sample_rates to avoid shared build
73  * failures */
74 static const int mpeg4audio_sample_rates[16] = {
75  96000, 88200, 64000, 48000, 44100, 32000,
76  24000, 22050, 16000, 12000, 11025, 8000, 7350
77 };
78 
79 /** bits needed to code codebook run value for long windows */
80 static const uint8_t run_value_bits_long[64] = {
81  5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
82  5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10,
83  10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
84  10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 15
85 };
86 
87 /** bits needed to code codebook run value for short windows */
88 static const uint8_t run_value_bits_short[16] = {
89  3, 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 9
90 };
91 
92 /* TNS starting SFBs for long and short windows */
93 static const uint8_t tns_min_sfb_short[16] = {
94  2, 2, 2, 3, 3, 4, 6, 6, 8, 10, 10, 12, 12, 12, 12, 12
95 };
96 
97 static const uint8_t tns_min_sfb_long[16] = {
98  12, 13, 15, 16, 17, 20, 25, 26, 24, 28, 30, 31, 31, 31, 31, 31
99 };
100 
101 static const uint8_t * const tns_min_sfb[2] = {
103 };
104 
105 static const uint8_t * const run_value_bits[2] = {
107 };
108 
109 /** Map to convert values from BandCodingPath index to a codebook index **/
110 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};
111 /** Inverse map to convert from codebooks to BandCodingPath indices **/
112 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};
113 
114 static const uint8_t aac_cb_range [12] = {0, 3, 3, 3, 3, 9, 9, 8, 8, 13, 13, 17};
115 static const uint8_t aac_cb_maxval[12] = {0, 1, 1, 2, 2, 4, 4, 7, 7, 12, 12, 16};
116 
117 static const unsigned char aac_maxval_cb[] = {
118  0, 1, 3, 5, 5, 7, 7, 7, 9, 9, 9, 9, 9, 11
119 };
120 
121 static const int aacenc_profiles[] = {
126 };
127 
128 #endif /* AVCODEC_AACENCTAB_H */
static const uint8_t *const tns_min_sfb[2]
Definition: aacenctab.h:101
static const uint8_t *const run_value_bits[2]
Definition: aacenctab.h:105
static const uint8_t aac_chan_configs[AAC_MAX_CHANNELS][6]
default channel configurations
Definition: aacenctab.h:47
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:110
const uint8_t * ff_aac_swb_size_1024[]
Definition: aacenctab.c:99
Definition: aac.h:56
Definition: aac.h:57
static const uint8_t tns_min_sfb_short[16]
Definition: aacenctab.h:93
#define FF_PROFILE_AAC_MAIN
Definition: avcodec.h:3157
uint8_t
Definition: aac.h:59
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:61
#define FF_PROFILE_AAC_LTP
Definition: avcodec.h:3160
const uint8_t * ff_aac_swb_size_128[]
Definition: aacenctab.c:91
static const uint8_t aac_cb_in_map[CB_TOT_ALL+1]
Inverse map to convert from codebooks to BandCodingPath indices.
Definition: aacenctab.h:112
static const uint8_t run_value_bits_short[16]
bits needed to code codebook run value for short windows
Definition: aacenctab.h:88
#define FF_PROFILE_MPEG2_AAC_LOW
Definition: avcodec.h:3165
static const int mpeg4audio_sample_rates[16]
Definition: aacenctab.h:74
static const uint8_t tns_min_sfb_long[16]
Definition: aacenctab.h:97
#define FF_PROFILE_AAC_LOW
Definition: avcodec.h:3158
AAC definitions and structures.
static const uint8_t aac_cb_range[12]
Definition: aacenctab.h:114
const int ff_aac_swb_size_128_len
Definition: aacenctab.c:107
static const unsigned char aac_maxval_cb[]
Definition: aacenctab.h:117
#define AAC_MAX_CHANNELS
Definition: aacenctab.h:39
#define CB_TOT_ALL
Total number of codebooks, including special ones.
Definition: aacenctab.h:37
static const uint8_t aac_cb_maxval[12]
Definition: aacenctab.h:115
static const uint8_t run_value_bits_long[64]
bits needed to code codebook run value for long windows
Definition: aacenctab.h:80
static const int aacenc_profiles[]
Definition: aacenctab.h:121
const int ff_aac_swb_size_1024_len
Definition: aacenctab.c:108