2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
3 ** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 ** Any non-GPL usage of this software or parts of this software is strictly
22 ** Commercial non-GPL licensing of this software is possible.
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
28 /* 2-step huffman table HCB_4 */
34 * Used to find offset into 2nd step table and number of extra bits to get
36 static hcb hcb4_1
[] = {
60 { /* 10100 */ 10, 0 },
61 { /* 10101 */ 11, 0 },
62 { /* 10110 */ 12, 0 },
63 { /* 10111 */ 13, 0 },
64 { /* 11000 */ 14, 0 },
65 { /* 11001 */ 15, 0 },
68 { /* 11010 */ 16, 2 },
69 { /* 11011 */ 20, 2 },
71 /* 7/8 bit codewords */
72 { /* 11100 */ 24, 3 },
75 { /* 11101 */ 32, 3 },
77 /* 8/9 bit codewords */
78 { /* 11110 */ 40, 4 },
80 /* 9/10/11/12 bit codewords */
86 * Gives size of codeword and actual data (x,y,v,w)
88 static hcb_2_quad hcb4_2
[] = {
101 /* 5 bit codewords */
109 /* 7 bit codewords */
110 /* first 5 bits: 11010 */
115 /* first 5 bits: 11011 */
121 /* 7/8 bit codewords */
122 /* first 5 bits: 11100 */
123 { 7, 0, 1, 2, 1 }, { 7, 0, 1, 2, 1 },
131 /* 8 bit codewords */
141 /* 8/9 bit codewords */
142 { 8, 0, 1, 2, 0 }, { 8, 0, 1, 2, 0 },
143 { 8, 0, 2, 0, 1 }, { 8, 0, 2, 0, 1 },
144 { 8, 1, 0, 0, 2 }, { 8, 1, 0, 0, 2 },
145 { 8, 0, 0, 2, 1 }, { 8, 0, 0, 2, 1 },
146 { 8, 1, 0, 2, 0 }, { 8, 1, 0, 2, 0 },
147 { 8, 2, 0, 0, 0 }, { 8, 2, 0, 0, 0 },
148 { 8, 0, 0, 0, 2 }, { 8, 0, 0, 0, 2 },
152 /* 9/10/11 bit codewords */
153 /* 9 bit codewords repeated 2^3 = 8 times */
154 { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 },
155 { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 },
156 { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 },
157 { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 },
158 { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 },
159 { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 },
160 { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 },
161 { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 },
162 { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 },
163 { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 },
164 { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 },
165 { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 },
166 /* 10 bit codewords repeated 2^2 = 4 times */
167 { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 },
168 { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 },
169 { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 },
170 { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 },
171 { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 },
172 { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 },
173 { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 },
174 { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 },
175 { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 },
176 { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 },
177 { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 },
178 { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 },
179 { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 },
180 { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 },
181 /* 11 bit codewords repeated 2^1 = 2 times */
182 { 11, 2, 1, 2, 2 }, { 11, 2, 1, 2, 2 },
183 { 11, 2, 2, 1, 2 }, { 11, 2, 2, 1, 2 },
184 { 11, 0, 2, 2, 0 }, { 11, 0, 2, 2, 0 },
185 { 11, 2, 2, 0, 0 }, { 11, 2, 2, 0, 0 },
186 { 11, 0, 0, 2, 2 }, { 11, 0, 0, 2, 2 },
187 { 11, 2, 0, 2, 0 }, { 11, 2, 0, 2, 0 },
188 { 11, 0, 2, 0, 2 }, { 11, 0, 2, 0, 2 },
189 { 11, 2, 0, 0, 2 }, { 11, 2, 0, 0, 2 },
190 { 11, 2, 2, 2, 2 }, { 11, 2, 2, 2, 2 },
191 { 11, 0, 2, 2, 2 }, { 11, 0, 2, 2, 2 },
192 { 11, 2, 2, 2, 0 }, { 11, 2, 2, 2, 0 },
193 /* 12 bit codewords */