summaryrefslogtreecommitdiff
path: root/audio_codec/libfaad/codebook/hcb_1.h (plain)
blob: 86c7159ad89eb7e233290dab4813369e66097285
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_1.h,v 1.5 2007/11/01 12:34:11 menno Exp $
29**/
30
31/* 2-step huffman table HCB_1 */
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 hcb1_1[] = {
40 { /* 00000 */ 0, 0 },
41 { /* */ 0, 0 },
42 { /* */ 0, 0 },
43 { /* */ 0, 0 },
44 { /* */ 0, 0 },
45 { /* */ 0, 0 },
46 { /* */ 0, 0 },
47 { /* */ 0, 0 },
48 { /* */ 0, 0 },
49 { /* */ 0, 0 },
50 { /* */ 0, 0 },
51 { /* */ 0, 0 },
52 { /* */ 0, 0 },
53 { /* */ 0, 0 },
54 { /* */ 0, 0 },
55 { /* */ 0, 0 },
56 { /* 10000 */ 1, 0 },
57 { /* 10001 */ 2, 0 },
58 { /* 10010 */ 3, 0 },
59 { /* 10011 */ 4, 0 },
60 { /* 10100 */ 5, 0 },
61 { /* 10101 */ 6, 0 },
62 { /* 10110 */ 7, 0 },
63 { /* 10111 */ 8, 0 },
64
65 /* 7 bit codewords */
66 { /* 11000 */ 9, 2 },
67 { /* 11001 */ 13, 2 },
68 { /* 11010 */ 17, 2 },
69 { /* 11011 */ 21, 2 },
70 { /* 11100 */ 25, 2 },
71 { /* 11101 */ 29, 2 },
72
73 /* 9 bit codewords */
74 { /* 11110 */ 33, 4 },
75
76 /* 9/10/11 bit codewords */
77 { /* 11111 */ 49, 6 }
78};
79
80/* 2nd step table
81 *
82 * Gives size of codeword and actual data (x,y,v,w)
83 */
84static hcb_2_quad hcb1_2[] = {
85 /* 1 bit codeword */
86 { 1, 0, 0, 0, 0 },
87
88 /* 5 bit codewords */
89 { 5, 1, 0, 0, 0 },
90 { 5, -1, 0, 0, 0 },
91 { 5, 0, 0, 0, -1 },
92 { 5, 0, 1, 0, 0 },
93 { 5, 0, 0, 0, 1 },
94 { 5, 0, 0, -1, 0 },
95 { 5, 0, 0, 1, 0 },
96 { 5, 0, -1, 0, 0 },
97
98 /* 7 bit codewords */
99 /* first 5 bits: 11000 */
100 { 7, 1, -1, 0, 0 },
101 { 7, -1, 1, 0, 0 },
102 { 7, 0, 0, -1, 1 },
103 { 7, 0, 1, -1, 0 },
104 /* first 5 bits: 11001 */
105 { 7, 0, -1, 1, 0 },
106 { 7, 0, 0, 1, -1 },
107 { 7, 1, 1, 0, 0 },
108 { 7, 0, 0, -1, -1 },
109 /* first 5 bits: 11010 */
110 { 7, -1, -1, 0, 0 },
111 { 7, 0, -1, -1, 0 },
112 { 7, 1, 0, -1, 0 },
113 { 7, 0, 1, 0, -1 },
114 /* first 5 bits: 11011 */
115 { 7, -1, 0, 1, 0 },
116 { 7, 0, 0, 1, 1 },
117 { 7, 1, 0, 1, 0 },
118 { 7, 0, -1, 0, 1 },
119 /* first 5 bits: 11100 */
120 { 7, 0, 1, 1, 0 },
121 { 7, 0, 1, 0, 1 },
122 { 7, -1, 0, -1, 0 },
123 { 7, 1, 0, 0, 1 },
124 /* first 5 bits: 11101 */
125 { 7, -1, 0, 0, -1 },
126 { 7, 1, 0, 0, -1 },
127 { 7, -1, 0, 0, 1 },
128 { 7, 0, -1, 0, -1 },
129
130 /* 9 bit codeword */
131 /* first 5 bits: 11110 */
132 { 9, 1, 1, -1, 0 },
133 { 9, -1, 1, -1, 0 },
134 { 9, 1, -1, 1, 0 },
135 { 9, 0, 1, 1, -1 },
136 { 9, 0, 1, -1, 1 },
137 { 9, 0, -1, 1, 1 },
138 { 9, 0, -1, 1, -1 },
139 { 9, 1, -1, -1, 0 },
140 { 9, 1, 0, -1, 1 },
141 { 9, 0, 1, -1, -1 },
142 { 9, -1, 1, 1, 0 },
143 { 9, -1, 0, 1, -1 },
144 { 9, -1, -1, 1, 0 },
145 { 9, 0, -1, -1, 1 },
146 { 9, 1, -1, 0, 1 },
147 { 9, 1, -1, 0, -1 },
148
149 /* 9/10/11 bit codewords */
150 /* first 5 bits: 11111 */
151 /* 9 bit: reading 11 bits -> 2 too much so 4 entries for each codeword */
152 { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 },
153 { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 },
154 { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 },
155 { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 },
156 { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 },
157 { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 },
158 { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 },
159 { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 },
160 /* 10 bit: reading 11 bits -> 1 too much so 2 entries for each codeword */
161 { 10, -1, -1, 0, 1 }, { 10, -1, -1, 0, 1 },
162 { 10, -1, 0, -1, -1 }, { 10, -1, 0, -1, -1 },
163 { 10, 1, 1, 0, -1 }, { 10, 1, 1, 0, -1 },
164 { 10, 1, 0, -1, -1 }, { 10, 1, 0, -1, -1 },
165 { 10, -1, 0, -1, 1 }, { 10, -1, 0, -1, 1 },
166 { 10, -1, -1, 0, -1 }, { 10, -1, -1, 0, -1 },
167 { 10, -1, 0, 1, 1 }, { 10, -1, 0, 1, 1 },
168 { 10, 1, 0, 1, 1 }, { 10, 1, 0, 1, 1 },
169 /* 11 bit */
170 { 11, 1, -1, 1, -1 },
171 { 11, -1, 1, -1, 1 },
172 { 11, -1, 1, 1, -1 },
173 { 11, 1, -1, -1, 1 },
174 { 11, 1, 1, 1, 1 },
175 { 11, -1, -1, 1, 1 },
176 { 11, 1, 1, -1, -1 },
177 { 11, -1, -1, 1, -1 },
178 { 11, -1, -1, -1, -1 },
179 { 11, 1, 1, -1, 1 },
180 { 11, 1, -1, 1, 1 },
181 { 11, -1, 1, 1, 1 },
182 { 11, -1, 1, -1, -1 },
183 { 11, -1, -1, -1, 1 },
184 { 11, 1, -1, -1, -1 },
185 { 11, 1, 1, 1, -1 }
186};
187