summaryrefslogtreecommitdiff
path: root/audio_codec/libfaad/codebook/hcb_4.h (plain)
blob: 0e5e06efbfbba2ed167f699adb46329c143135fa
1/*
2** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
3** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
4**
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.
9**
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.
14**
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.
18**
19** Any non-GPL usage of this software or parts of this software is strictly
20** forbidden.
21**
22** The "appropriate copyright message" mentioned in section 2c of the GPLv2
23** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
24**
25** Commercial non-GPL licensing of this software is possible.
26** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
27**
28** $Id: hcb_4.h,v 1.5 2007/11/01 12:34:11 menno Exp $
29**/
30
31/* 2-step huffman table HCB_4 */
32
33
34/* 1st step: 5 bits
35 * 2^5 = 32 entries
36 *
37 * Used to find offset into 2nd step table and number of extra bits to get
38 */
39static hcb hcb4_1[] = {
40 /* 4 bit codewords */
41 { /* 00000 */ 0, 0 },
42 { /* */ 0, 0 },
43 { /* 00010 */ 1, 0 },
44 { /* */ 1, 0 },
45 { /* 00100 */ 2, 0 },
46 { /* */ 2, 0 },
47 { /* 00110 */ 3, 0 },
48 { /* */ 3, 0 },
49 { /* 01000 */ 4, 0 },
50 { /* */ 4, 0 },
51 { /* 01010 */ 5, 0 },
52 { /* */ 5, 0 },
53 { /* 01100 */ 6, 0 },
54 { /* */ 6, 0 },
55 { /* 01110 */ 7, 0 },
56 { /* */ 7, 0 },
57 { /* 10000 */ 8, 0 },
58 { /* */ 8, 0 },
59 { /* 10010 */ 9, 0 },
60 { /* */ 9, 0 },
61
62 /* 5 bit codewords */
63 { /* 10100 */ 10, 0 },
64 { /* 10101 */ 11, 0 },
65 { /* 10110 */ 12, 0 },
66 { /* 10111 */ 13, 0 },
67 { /* 11000 */ 14, 0 },
68 { /* 11001 */ 15, 0 },
69
70 /* 7 bit codewords */
71 { /* 11010 */ 16, 2 },
72 { /* 11011 */ 20, 2 },
73
74 /* 7/8 bit codewords */
75 { /* 11100 */ 24, 3 },
76
77 /* 8 bit codewords */
78 { /* 11101 */ 32, 3 },
79
80 /* 8/9 bit codewords */
81 { /* 11110 */ 40, 4 },
82
83 /* 9/10/11/12 bit codewords */
84 { /* 11111 */ 56, 7 }
85};
86
87/* 2nd step table
88 *
89 * Gives size of codeword and actual data (x,y,v,w)
90 */
91static hcb_2_quad hcb4_2[] = {
92 /* 4 bit codewords */
93 { 4, 1, 1, 1, 1 },
94 { 4, 0, 1, 1, 1 },
95 { 4, 1, 1, 0, 1 },
96 { 4, 1, 1, 1, 0 },
97 { 4, 1, 0, 1, 1 },
98 { 4, 1, 0, 0, 0 },
99 { 4, 1, 1, 0, 0 },
100 { 4, 0, 0, 0, 0 },
101 { 4, 0, 0, 1, 1 },
102 { 4, 1, 0, 1, 0 },
103
104 /* 5 bit codewords */
105 { 5, 1, 0, 0, 1 },
106 { 5, 0, 1, 1, 0 },
107 { 5, 0, 0, 0, 1 },
108 { 5, 0, 1, 0, 1 },
109 { 5, 0, 0, 1, 0 },
110 { 5, 0, 1, 0, 0 },
111
112 /* 7 bit codewords */
113 /* first 5 bits: 11010 */
114 { 7, 2, 1, 1, 1 },
115 { 7, 1, 1, 2, 1 },
116 { 7, 1, 2, 1, 1 },
117 { 7, 1, 1, 1, 2 },
118 /* first 5 bits: 11011 */
119 { 7, 2, 1, 1, 0 },
120 { 7, 2, 1, 0, 1 },
121 { 7, 1, 2, 1, 0 },
122 { 7, 2, 0, 1, 1 },
123
124 /* 7/8 bit codewords */
125 /* first 5 bits: 11100 */
126 { 7, 0, 1, 2, 1 }, { 7, 0, 1, 2, 1 },
127 { 8, 0, 1, 1, 2 },
128 { 8, 1, 1, 2, 0 },
129 { 8, 0, 2, 1, 1 },
130 { 8, 1, 0, 1, 2 },
131 { 8, 1, 2, 0, 1 },
132 { 8, 1, 1, 0, 2 },
133
134 /* 8 bit codewords */
135 { 8, 1, 0, 2, 1 },
136 { 8, 2, 1, 0, 0 },
137 { 8, 2, 0, 1, 0 },
138 { 8, 1, 2, 0, 0 },
139 { 8, 2, 0, 0, 1 },
140 { 8, 0, 1, 0, 2 },
141 { 8, 0, 2, 1, 0 },
142 { 8, 0, 0, 1, 2 },
143
144 /* 8/9 bit codewords */
145 { 8, 0, 1, 2, 0 }, { 8, 0, 1, 2, 0 },
146 { 8, 0, 2, 0, 1 }, { 8, 0, 2, 0, 1 },
147 { 8, 1, 0, 0, 2 }, { 8, 1, 0, 0, 2 },
148 { 8, 0, 0, 2, 1 }, { 8, 0, 0, 2, 1 },
149 { 8, 1, 0, 2, 0 }, { 8, 1, 0, 2, 0 },
150 { 8, 2, 0, 0, 0 }, { 8, 2, 0, 0, 0 },
151 { 8, 0, 0, 0, 2 }, { 8, 0, 0, 0, 2 },
152 { 9, 0, 2, 0, 0 },
153 { 9, 0, 0, 2, 0 },
154
155 /* 9/10/11 bit codewords */
156 /* 9 bit codewords repeated 2^3 = 8 times */
157 { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 },
158 { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 },
159 { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 },
160 { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 },
161 { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 },
162 { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 },
163 { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 },
164 { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 },
165 { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 },
166 { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 },
167 { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 },
168 { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 },
169 /* 10 bit codewords repeated 2^2 = 4 times */
170 { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 },
171 { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 },
172 { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 },
173 { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 },
174 { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 },
175 { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 },
176 { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 },
177 { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 },
178 { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 },
179 { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 },
180 { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 },
181 { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 },
182 { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 },
183 { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 },
184 /* 11 bit codewords repeated 2^1 = 2 times */
185 { 11, 2, 1, 2, 2 }, { 11, 2, 1, 2, 2 },
186 { 11, 2, 2, 1, 2 }, { 11, 2, 2, 1, 2 },
187 { 11, 0, 2, 2, 0 }, { 11, 0, 2, 2, 0 },
188 { 11, 2, 2, 0, 0 }, { 11, 2, 2, 0, 0 },
189 { 11, 0, 0, 2, 2 }, { 11, 0, 0, 2, 2 },
190 { 11, 2, 0, 2, 0 }, { 11, 2, 0, 2, 0 },
191 { 11, 0, 2, 0, 2 }, { 11, 0, 2, 0, 2 },
192 { 11, 2, 0, 0, 2 }, { 11, 2, 0, 0, 2 },
193 { 11, 2, 2, 2, 2 }, { 11, 2, 2, 2, 2 },
194 { 11, 0, 2, 2, 2 }, { 11, 0, 2, 2, 2 },
195 { 11, 2, 2, 2, 0 }, { 11, 2, 2, 2, 0 },
196 /* 12 bit codewords */
197 { 12, 2, 2, 0, 2 },
198 { 12, 2, 0, 2, 2 },
199};
200