]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blob - libavcodec/aacdectab.h
Use skip_bits_long() for large skips
[frescor/ffmpeg.git] / libavcodec / aacdectab.h
1 /*
2  * AAC decoder data
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 libavcodec/aacdectab.h
25  * AAC decoder data
26  * @author Oded Shimon  ( ods15 ods15 dyndns org )
27  * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
28  */
29
30 #ifndef AVCODEC_AACDECTAB_H
31 #define AVCODEC_AACDECTAB_H
32
33 #include "aac.h"
34
35 #include <stdint.h>
36
37 /* @name swb_offsets
38  * Sample offset into the window indicating the beginning of a scalefactor
39  * window band
40  *
41  * scalefactor window band - term for scalefactor bands within a window,
42  * given in Table 4.110 to Table 4.128.
43  *
44  * scalefactor band - a set of spectral coefficients which are scaled by one
45  * scalefactor. In case of EIGHT_SHORT_SEQUENCE and grouping a scalefactor band
46  * may contain several scalefactor window bands of corresponding frequency. For
47  * all other window_sequences scalefactor bands and scalefactor window bands are
48  * identical.
49  * @{
50  */
51
52 static const uint16_t swb_offset_1024_96[] = {
53       0,   4,   8,  12,  16,  20,  24,  28,
54      32,  36,  40,  44,  48,  52,  56,  64,
55      72,  80,  88,  96, 108, 120, 132, 144,
56     156, 172, 188, 212, 240, 276, 320, 384,
57     448, 512, 576, 640, 704, 768, 832, 896,
58     960, 1024
59 };
60
61 static const uint16_t swb_offset_128_96[] = {
62     0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128
63 };
64
65 static const uint16_t swb_offset_1024_64[] = {
66       0,   4,   8,  12,  16,  20,  24,  28,
67      32,  36,  40,  44,  48,  52,  56,  64,
68      72,  80,  88, 100, 112, 124, 140, 156,
69     172, 192, 216, 240, 268, 304, 344, 384,
70     424, 464, 504, 544, 584, 624, 664, 704,
71     744, 784, 824, 864, 904, 944, 984, 1024
72 };
73
74 static const uint16_t swb_offset_1024_48[] = {
75       0,   4,   8,  12,  16,  20,  24,  28,
76      32,  36,  40,  48,  56,  64,  72,  80,
77      88,  96, 108, 120, 132, 144, 160, 176,
78     196, 216, 240, 264, 292, 320, 352, 384,
79     416, 448, 480, 512, 544, 576, 608, 640,
80     672, 704, 736, 768, 800, 832, 864, 896,
81     928, 1024
82 };
83
84 static const uint16_t swb_offset_128_48[] = {
85      0,   4,   8,  12,  16,  20,  28,  36,
86     44,  56,  68,  80,  96, 112, 128
87 };
88
89 static const uint16_t swb_offset_1024_32[] = {
90       0,   4,   8,  12,  16,  20,  24,  28,
91      32,  36,  40,  48,  56,  64,  72,  80,
92      88,  96, 108, 120, 132, 144, 160, 176,
93     196, 216, 240, 264, 292, 320, 352, 384,
94     416, 448, 480, 512, 544, 576, 608, 640,
95     672, 704, 736, 768, 800, 832, 864, 896,
96     928, 960, 992, 1024
97 };
98
99 static const uint16_t swb_offset_1024_24[] = {
100       0,   4,   8,  12,  16,  20,  24,  28,
101      32,  36,  40,  44,  52,  60,  68,  76,
102      84,  92, 100, 108, 116, 124, 136, 148,
103     160, 172, 188, 204, 220, 240, 260, 284,
104     308, 336, 364, 396, 432, 468, 508, 552,
105     600, 652, 704, 768, 832, 896, 960, 1024
106 };
107
108 static const uint16_t swb_offset_128_24[] = {
109      0,   4,   8,  12,  16,  20,  24,  28,
110     36,  44,  52,  64,  76,  92, 108, 128
111 };
112
113 static const uint16_t swb_offset_1024_16[] = {
114       0,   8,  16,  24,  32,  40,  48,  56,
115      64,  72,  80,  88, 100, 112, 124, 136,
116     148, 160, 172, 184, 196, 212, 228, 244,
117     260, 280, 300, 320, 344, 368, 396, 424,
118     456, 492, 532, 572, 616, 664, 716, 772,
119     832, 896, 960, 1024
120 };
121
122 static const uint16_t swb_offset_128_16[] = {
123      0,   4,   8,  12,  16,  20,  24,  28,
124     32,  40,  48,  60,  72,  88, 108, 128
125 };
126
127 static const uint16_t swb_offset_1024_8[] = {
128       0,  12,  24,  36,  48,  60,  72,  84,
129      96, 108, 120, 132, 144, 156, 172, 188,
130     204, 220, 236, 252, 268, 288, 308, 328,
131     348, 372, 396, 420, 448, 476, 508, 544,
132     580, 620, 664, 712, 764, 820, 880, 944,
133     1024
134 };
135
136 static const uint16_t swb_offset_128_8[] = {
137      0,   4,   8,  12,  16,  20,  24,  28,
138     36,  44,  52,  60,  72,  88, 108, 128
139 };
140
141 static const uint16_t *swb_offset_1024[] = {
142     swb_offset_1024_96, swb_offset_1024_96, swb_offset_1024_64,
143     swb_offset_1024_48, swb_offset_1024_48, swb_offset_1024_32,
144     swb_offset_1024_24, swb_offset_1024_24, swb_offset_1024_16,
145     swb_offset_1024_16, swb_offset_1024_16, swb_offset_1024_8,
146     swb_offset_1024_8
147 };
148
149 static const uint16_t *swb_offset_128[] = {
150     /* The last entry on the following row is swb_offset_128_64 but is a
151        duplicate of swb_offset_128_96. */
152     swb_offset_128_96, swb_offset_128_96, swb_offset_128_96,
153     swb_offset_128_48, swb_offset_128_48, swb_offset_128_48,
154     swb_offset_128_24, swb_offset_128_24, swb_offset_128_16,
155     swb_offset_128_16, swb_offset_128_16, swb_offset_128_8,
156     swb_offset_128_8
157 };
158
159 // @}
160
161 /* @name tns_max_bands
162  * The maximum number of scalefactor bands on which TNS can operate for the long
163  * and short transforms respectively. The index to these tables is related to
164  * the sample rate of the audio.
165  * @{
166  */
167 static const uint8_t tns_max_bands_1024[] = {
168     31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39, 39
169 };
170
171 static const uint8_t tns_max_bands_128[] = {
172     9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14
173 };
174 // @}
175
176 /* @name tns_tmp2_map
177  * Tables of the tmp2[] arrays of LPC coefficients used for TNS.
178  * The suffix _M_N[] indicate the values of coef_compress and coef_res
179  * respectively.
180  * @{
181  */
182 static const float tns_tmp2_map_1_3[4] = {
183      0.00000000, -0.43388373,  0.64278758,  0.34202015,
184 };
185
186 static const float tns_tmp2_map_0_3[8] = {
187      0.00000000, -0.43388373, -0.78183150, -0.97492790,
188      0.98480773,  0.86602539,  0.64278758,  0.34202015,
189 };
190
191 static const float tns_tmp2_map_1_4[8] = {
192      0.00000000, -0.20791170, -0.40673664, -0.58778524,
193      0.67369562,  0.52643216,  0.36124167,  0.18374951,
194 };
195
196 static const float tns_tmp2_map_0_4[16] = {
197      0.00000000, -0.20791170, -0.40673664, -0.58778524,
198     -0.74314481, -0.86602539, -0.95105654, -0.99452192,
199      0.99573416,  0.96182561,  0.89516330,  0.79801720,
200      0.67369562,  0.52643216,  0.36124167,  0.18374951,
201 };
202
203 static const float * const tns_tmp2_map[4] = {
204     tns_tmp2_map_0_3,
205     tns_tmp2_map_0_4,
206     tns_tmp2_map_1_3,
207     tns_tmp2_map_1_4
208 };
209 // @}
210
211 #endif /* AVCODEC_AACDECTAB_H */