/src/theora/lib/huffenc.c
Line | Count | Source (jump to first uncovered line) |
1 | | #include <stdlib.h> |
2 | | #include <string.h> |
3 | | #include <ogg/ogg.h> |
4 | | #include "huffenc.h" |
5 | | |
6 | | |
7 | | |
8 | | /*The default Huffman codes used for VP3.1.*/ |
9 | | const th_huff_code TH_VP31_HUFF_CODES[TH_NHUFFMAN_TABLES][TH_NDCT_TOKENS]={ |
10 | | { |
11 | | {0x002D, 6},{0x0026, 7},{0x0166, 9},{0x004E, 8}, |
12 | | {0x02CE,10},{0x059E,11},{0x027D,11},{0x0008, 5}, |
13 | | {0x04F9,12},{0x000F, 4},{0x000E, 4},{0x001B, 5}, |
14 | | {0x0006, 4},{0x0008, 4},{0x0005, 4},{0x001A, 5}, |
15 | | {0x0015, 5},{0x0007, 4},{0x000C, 4},{0x0001, 3}, |
16 | | {0x0000, 3},{0x0009, 4},{0x0017, 5},{0x0029, 6}, |
17 | | {0x0028, 6},{0x00B2, 8},{0x04F8,12},{0x059F,11}, |
18 | | {0x009E, 9},{0x013F,10},{0x0012, 6},{0x0058, 7} |
19 | | }, |
20 | | { |
21 | | {0x0010, 5},{0x0047, 7},{0x01FF, 9},{0x008C, 8}, |
22 | | {0x03FC,10},{0x046A,11},{0x0469,11},{0x0022, 6}, |
23 | | {0x11A1,13},{0x000E, 4},{0x000D, 4},{0x0004, 4}, |
24 | | {0x0005, 4},{0x0009, 4},{0x0006, 4},{0x001E, 5}, |
25 | | {0x0016, 5},{0x0007, 4},{0x000C, 4},{0x0001, 3}, |
26 | | {0x0000, 3},{0x000A, 4},{0x0017, 5},{0x007D, 7}, |
27 | | {0x007E, 7},{0x011B, 9},{0x08D1,12},{0x03FD,10}, |
28 | | {0x046B,11},{0x11A0,13},{0x007C, 7},{0x00FE, 8} |
29 | | }, |
30 | | { |
31 | | {0x0016, 5},{0x0020, 6},{0x0086, 8},{0x0087, 8}, |
32 | | {0x0367,10},{0x06CC,11},{0x06CB,11},{0x006E, 7}, |
33 | | {0x366D,14},{0x000F, 4},{0x000E, 4},{0x0004, 4}, |
34 | | {0x0005, 4},{0x000A, 4},{0x0006, 4},{0x001A, 5}, |
35 | | {0x0011, 5},{0x0007, 4},{0x000C, 4},{0x0001, 3}, |
36 | | {0x0000, 3},{0x0009, 4},{0x0017, 5},{0x006F, 7}, |
37 | | {0x006D, 7},{0x0364,10},{0x0D9A,12},{0x06CA,11}, |
38 | | {0x1B37,13},{0x366C,14},{0x0042, 7},{0x00D8, 8} |
39 | | }, |
40 | | { |
41 | | {0x0000, 4},{0x002D, 6},{0x00F7, 8},{0x0058, 7}, |
42 | | {0x0167, 9},{0x02CB,10},{0x02CA,10},{0x000E, 6}, |
43 | | {0x1661,13},{0x0003, 3},{0x0002, 3},{0x0008, 4}, |
44 | | {0x0009, 4},{0x000D, 4},{0x0002, 4},{0x001F, 5}, |
45 | | {0x0017, 5},{0x0001, 4},{0x000C, 4},{0x000E, 4}, |
46 | | {0x000A, 4},{0x0006, 5},{0x0078, 7},{0x000F, 6}, |
47 | | {0x007A, 7},{0x0164, 9},{0x0599,11},{0x02CD,10}, |
48 | | {0x0B31,12},{0x1660,13},{0x0079, 7},{0x00F6, 8} |
49 | | }, |
50 | | { |
51 | | {0x0003, 4},{0x003C, 6},{0x000F, 7},{0x007A, 7}, |
52 | | {0x001D, 8},{0x0020, 9},{0x0072,10},{0x0006, 6}, |
53 | | {0x0399,13},{0x0004, 3},{0x0005, 3},{0x0005, 4}, |
54 | | {0x0006, 4},{0x000E, 4},{0x0004, 4},{0x0000, 4}, |
55 | | {0x0019, 5},{0x0002, 4},{0x000D, 4},{0x0007, 4}, |
56 | | {0x001F, 5},{0x0030, 6},{0x0011, 8},{0x0031, 6}, |
57 | | {0x0005, 6},{0x0021, 9},{0x00E7,11},{0x0038, 9}, |
58 | | {0x01CD,12},{0x0398,13},{0x007B, 7},{0x0009, 7} |
59 | | }, |
60 | | { |
61 | | {0x0009, 4},{0x0002, 5},{0x0074, 7},{0x0007, 6}, |
62 | | {0x00EC, 8},{0x00D1, 9},{0x01A6,10},{0x0006, 6}, |
63 | | {0x0D21,13},{0x0005, 3},{0x0006, 3},{0x0008, 4}, |
64 | | {0x0007, 4},{0x000F, 4},{0x0004, 4},{0x0000, 4}, |
65 | | {0x001C, 5},{0x0002, 4},{0x0005, 4},{0x0003, 4}, |
66 | | {0x000C, 5},{0x0035, 7},{0x01A7,10},{0x001B, 6}, |
67 | | {0x0077, 7},{0x01A5,10},{0x0349,11},{0x00D0, 9}, |
68 | | {0x0691,12},{0x0D20,13},{0x0075, 7},{0x00ED, 8} |
69 | | }, |
70 | | { |
71 | | {0x000A, 4},{0x000C, 5},{0x0012, 6},{0x001B, 6}, |
72 | | {0x00B7, 8},{0x016C, 9},{0x0099, 9},{0x005A, 7}, |
73 | | {0x16D8,13},{0x0007, 3},{0x0006, 3},{0x0009, 4}, |
74 | | {0x0008, 4},{0x0000, 3},{0x0005, 4},{0x0017, 5}, |
75 | | {0x000E, 5},{0x0002, 4},{0x0003, 4},{0x000F, 5}, |
76 | | {0x001A, 6},{0x004D, 8},{0x2DB3,14},{0x002C, 6}, |
77 | | {0x0011, 6},{0x02DA,10},{0x05B7,11},{0x0098, 9}, |
78 | | {0x0B6D,12},{0x2DB2,14},{0x0010, 6},{0x0027, 7} |
79 | | }, |
80 | | { |
81 | | {0x000D, 4},{0x000F, 5},{0x001D, 6},{0x0008, 5}, |
82 | | {0x0051, 7},{0x0056, 8},{0x00AF, 9},{0x002A, 7}, |
83 | | {0x148A,13},{0x0007, 3},{0x0000, 2},{0x0008, 4}, |
84 | | {0x0009, 4},{0x000C, 4},{0x0006, 4},{0x0017, 5}, |
85 | | {0x000B, 5},{0x0016, 5},{0x0015, 5},{0x0009, 5}, |
86 | | {0x0050, 7},{0x00AE, 9},{0x2917,14},{0x001C, 6}, |
87 | | {0x0014, 6},{0x0290,10},{0x0523,11},{0x0149, 9}, |
88 | | {0x0A44,12},{0x2916,14},{0x0053, 7},{0x00A5, 8} |
89 | | }, |
90 | | { |
91 | | {0x0001, 4},{0x001D, 6},{0x00F5, 8},{0x00F4, 8}, |
92 | | {0x024D,10},{0x0499,11},{0x0498,11},{0x0001, 5}, |
93 | | {0x0021, 6},{0x0006, 3},{0x0005, 3},{0x0006, 4}, |
94 | | {0x0005, 4},{0x0002, 4},{0x0007, 5},{0x0025, 6}, |
95 | | {0x007B, 7},{0x001C, 6},{0x0020, 6},{0x000D, 6}, |
96 | | {0x0048, 7},{0x0092, 8},{0x0127, 9},{0x000E, 4}, |
97 | | {0x0004, 4},{0x0011, 5},{0x000C, 6},{0x003C, 6}, |
98 | | {0x000F, 5},{0x0000, 5},{0x001F, 5},{0x0013, 5} |
99 | | }, |
100 | | { |
101 | | {0x0005, 4},{0x003C, 6},{0x0040, 7},{0x000D, 7}, |
102 | | {0x0031, 9},{0x0061,10},{0x0060,10},{0x0002, 5}, |
103 | | {0x00F5, 8},{0x0006, 3},{0x0005, 3},{0x0007, 4}, |
104 | | {0x0006, 4},{0x0002, 4},{0x0009, 5},{0x0025, 6}, |
105 | | {0x0007, 6},{0x0021, 6},{0x0024, 6},{0x0010, 6}, |
106 | | {0x0041, 7},{0x00F4, 8},{0x0019, 8},{0x000E, 4}, |
107 | | {0x0003, 4},{0x0011, 5},{0x0011, 6},{0x003F, 6}, |
108 | | {0x003E, 6},{0x007B, 7},{0x0000, 4},{0x0013, 5} |
109 | | }, |
110 | | { |
111 | | {0x000A, 4},{0x0007, 5},{0x0001, 6},{0x0009, 6}, |
112 | | {0x0131, 9},{0x0261,10},{0x0260,10},{0x0015, 6}, |
113 | | {0x0001, 7},{0x0007, 3},{0x0006, 3},{0x0008, 4}, |
114 | | {0x0007, 4},{0x0006, 4},{0x0012, 5},{0x002F, 6}, |
115 | | {0x0014, 6},{0x0027, 6},{0x002D, 6},{0x0016, 6}, |
116 | | {0x004D, 7},{0x0099, 8},{0x0000, 7},{0x0004, 4}, |
117 | | {0x0001, 4},{0x0005, 5},{0x0017, 6},{0x002E, 6}, |
118 | | {0x002C, 6},{0x0008, 6},{0x0006, 5},{0x0001, 5} |
119 | | }, |
120 | | { |
121 | | {0x0000, 3},{0x000E, 5},{0x0017, 6},{0x002A, 6}, |
122 | | {0x0010, 7},{0x00F9,10},{0x00F8,10},{0x001E, 7}, |
123 | | {0x003F, 8},{0x0007, 3},{0x0006, 3},{0x0009, 4}, |
124 | | {0x0008, 4},{0x0006, 4},{0x000F, 5},{0x0005, 5}, |
125 | | {0x0016, 6},{0x0029, 6},{0x002B, 6},{0x0015, 6}, |
126 | | {0x0050, 7},{0x0011, 7},{0x007D, 9},{0x0004, 4}, |
127 | | {0x0017, 5},{0x0006, 5},{0x0014, 6},{0x002C, 6}, |
128 | | {0x002D, 6},{0x000E, 6},{0x0009, 6},{0x0051, 7} |
129 | | }, |
130 | | { |
131 | | {0x0002, 3},{0x0018, 5},{0x002F, 6},{0x000D, 5}, |
132 | | {0x0053, 7},{0x0295,10},{0x0294,10},{0x00A4, 8}, |
133 | | {0x007C, 8},{0x0000, 2},{0x0007, 3},{0x0009, 4}, |
134 | | {0x0008, 4},{0x001B, 5},{0x000C, 5},{0x0028, 6}, |
135 | | {0x006A, 7},{0x001E, 6},{0x001D, 6},{0x0069, 7}, |
136 | | {0x00D7, 8},{0x007D, 8},{0x014B, 9},{0x0019, 5}, |
137 | | {0x0016, 5},{0x002E, 6},{0x001C, 6},{0x002B, 6}, |
138 | | {0x002A, 6},{0x0068, 7},{0x003F, 7},{0x00D6, 8} |
139 | | }, |
140 | | { |
141 | | {0x0002, 3},{0x001B, 5},{0x000C, 5},{0x0018, 5}, |
142 | | {0x0029, 6},{0x007F, 8},{0x02F0,10},{0x0198, 9}, |
143 | | {0x0179, 9},{0x0000, 2},{0x0007, 3},{0x0009, 4}, |
144 | | {0x0008, 4},{0x001A, 5},{0x000D, 5},{0x002A, 6}, |
145 | | {0x0064, 7},{0x001E, 6},{0x0067, 7},{0x005F, 7}, |
146 | | {0x00CD, 8},{0x007E, 8},{0x02F1,10},{0x0016, 5}, |
147 | | {0x000E, 5},{0x002E, 6},{0x0065, 7},{0x002B, 6}, |
148 | | {0x0028, 6},{0x003E, 7},{0x00BD, 8},{0x0199, 9} |
149 | | }, |
150 | | { |
151 | | {0x0002, 3},{0x0007, 4},{0x0016, 5},{0x0006, 4}, |
152 | | {0x0036, 6},{0x005C, 7},{0x015D, 9},{0x015C, 9}, |
153 | | {0x02BF,10},{0x0000, 2},{0x0007, 3},{0x0009, 4}, |
154 | | {0x0008, 4},{0x0018, 5},{0x0034, 6},{0x002A, 6}, |
155 | | {0x005E, 7},{0x006A, 7},{0x0064, 7},{0x005D, 7}, |
156 | | {0x00CB, 8},{0x00AD, 8},{0x02BE,10},{0x0014, 5}, |
157 | | {0x0033, 6},{0x006E, 7},{0x005F, 7},{0x006F, 7}, |
158 | | {0x006B, 7},{0x00CA, 8},{0x00AC, 8},{0x015E, 9} |
159 | | }, |
160 | | { |
161 | | {0x000F, 4},{0x001D, 5},{0x0018, 5},{0x000B, 4}, |
162 | | {0x0019, 5},{0x0029, 6},{0x00D6, 8},{0x0551,11}, |
163 | | {0x0AA1,12},{0x0001, 2},{0x0000, 2},{0x0009, 4}, |
164 | | {0x0008, 4},{0x001B, 5},{0x0038, 6},{0x0028, 6}, |
165 | | {0x0057, 7},{0x006A, 7},{0x0068, 7},{0x0056, 7}, |
166 | | {0x00E5, 8},{0x0155, 9},{0x0AA0,12},{0x0073, 7}, |
167 | | {0x0069, 7},{0x00D7, 8},{0x00AB, 8},{0x00E4, 8}, |
168 | | {0x00A9, 8},{0x0151, 9},{0x0150, 9},{0x02A9,10} |
169 | | }, |
170 | | { |
171 | | {0x0008, 5},{0x0025, 7},{0x017A, 9},{0x02F7,10}, |
172 | | {0x0BDB,12},{0x17B4,13},{0x2F6B,14},{0x001D, 5}, |
173 | | {0x2F6A,14},{0x0008, 4},{0x0007, 4},{0x0001, 4}, |
174 | | {0x0002, 4},{0x000A, 4},{0x0006, 4},{0x0000, 4}, |
175 | | {0x001C, 5},{0x0009, 4},{0x000D, 4},{0x000F, 4}, |
176 | | {0x000C, 4},{0x0003, 4},{0x000A, 5},{0x0016, 5}, |
177 | | {0x0013, 6},{0x005D, 7},{0x0024, 7},{0x00BC, 8}, |
178 | | {0x005C, 7},{0x05EC,11},{0x000B, 5},{0x005F, 7} |
179 | | }, |
180 | | { |
181 | | {0x000F, 5},{0x0010, 6},{0x004B, 8},{0x00C6, 8}, |
182 | | {0x031D,10},{0x0C71,12},{0x0C70,12},{0x0001, 4}, |
183 | | {0x0C73,12},{0x0008, 4},{0x0009, 4},{0x0002, 4}, |
184 | | {0x0003, 4},{0x000B, 4},{0x0006, 4},{0x0000, 4}, |
185 | | {0x001C, 5},{0x0005, 4},{0x000D, 4},{0x000F, 4}, |
186 | | {0x000A, 4},{0x0019, 5},{0x0013, 6},{0x001D, 5}, |
187 | | {0x0030, 6},{0x0062, 7},{0x0024, 7},{0x004A, 8}, |
188 | | {0x018F, 9},{0x0C72,12},{0x000E, 5},{0x0011, 6} |
189 | | }, |
190 | | { |
191 | | {0x001B, 5},{0x0003, 6},{0x008D, 8},{0x0040, 7}, |
192 | | {0x0239,10},{0x0471,11},{0x08E0,12},{0x0003, 4}, |
193 | | {0x11C3,13},{0x000A, 4},{0x0009, 4},{0x0004, 4}, |
194 | | {0x0005, 4},{0x000E, 4},{0x0007, 4},{0x0001, 4}, |
195 | | {0x001E, 5},{0x0006, 4},{0x000C, 4},{0x000B, 4}, |
196 | | {0x0002, 4},{0x0000, 5},{0x0041, 7},{0x001F, 5}, |
197 | | {0x0022, 6},{0x0002, 6},{0x008F, 8},{0x008C, 8}, |
198 | | {0x011D, 9},{0x11C2,13},{0x001A, 5},{0x0021, 6} |
199 | | }, |
200 | | { |
201 | | {0x001F, 5},{0x0003, 6},{0x0003, 7},{0x0043, 7}, |
202 | | {0x000B, 9},{0x0015,10},{0x0051,12},{0x0003, 4}, |
203 | | {0x0050,12},{0x000D, 4},{0x000C, 4},{0x0004, 4}, |
204 | | {0x0006, 4},{0x000E, 4},{0x000A, 4},{0x0001, 4}, |
205 | | {0x001E, 5},{0x0005, 4},{0x0009, 4},{0x0007, 4}, |
206 | | {0x0011, 5},{0x0002, 6},{0x0004, 8},{0x0002, 4}, |
207 | | {0x002D, 6},{0x0020, 6},{0x0042, 7},{0x0001, 7}, |
208 | | {0x0000, 7},{0x0029,11},{0x0017, 5},{0x002C, 6} |
209 | | }, |
210 | | { |
211 | | {0x0003, 4},{0x001F, 6},{0x003A, 7},{0x005D, 7}, |
212 | | {0x0173, 9},{0x02E4,10},{0x172D,13},{0x0004, 4}, |
213 | | {0x172C,13},{0x000F, 4},{0x000E, 4},{0x0009, 4}, |
214 | | {0x0008, 4},{0x000C, 4},{0x000A, 4},{0x0001, 4}, |
215 | | {0x0016, 5},{0x0002, 4},{0x0005, 4},{0x001A, 5}, |
216 | | {0x002F, 6},{0x0038, 7},{0x05CA,11},{0x0006, 4}, |
217 | | {0x0037, 6},{0x001E, 6},{0x003B, 7},{0x0039, 7}, |
218 | | {0x00B8, 8},{0x0B97,12},{0x0000, 4},{0x0036, 6} |
219 | | }, |
220 | | { |
221 | | {0x0006, 4},{0x0037, 6},{0x005D, 7},{0x000C, 6}, |
222 | | {0x00B9, 8},{0x02E3,10},{0x05C4,11},{0x0004, 4}, |
223 | | {0x1715,13},{0x0000, 3},{0x000F, 4},{0x0008, 4}, |
224 | | {0x0007, 4},{0x000C, 4},{0x0009, 4},{0x001D, 5}, |
225 | | {0x0016, 5},{0x001C, 5},{0x001A, 5},{0x000B, 5}, |
226 | | {0x005E, 7},{0x0170, 9},{0x1714,13},{0x000A, 4}, |
227 | | {0x000A, 5},{0x0036, 6},{0x005F, 7},{0x001B, 7}, |
228 | | {0x001A, 7},{0x0B8B,12},{0x0002, 4},{0x0007, 5} |
229 | | }, |
230 | | { |
231 | | {0x000C, 4},{0x000B, 5},{0x0079, 7},{0x0022, 6}, |
232 | | {0x00F0, 8},{0x0119, 9},{0x0230,10},{0x001D, 5}, |
233 | | {0x08C4,12},{0x0001, 3},{0x0000, 3},{0x000A, 4}, |
234 | | {0x0009, 4},{0x000B, 4},{0x0007, 4},{0x001C, 5}, |
235 | | {0x003D, 6},{0x000D, 5},{0x0008, 5},{0x0015, 6}, |
236 | | {0x008D, 8},{0x118B,13},{0x118A,13},{0x000D, 4}, |
237 | | {0x0010, 5},{0x0009, 5},{0x0014, 6},{0x0047, 7}, |
238 | | {0x00F1, 8},{0x0463,11},{0x001F, 5},{0x000C, 5} |
239 | | }, |
240 | | { |
241 | | {0x0000, 3},{0x001A, 5},{0x0033, 6},{0x000C, 5}, |
242 | | {0x0046, 7},{0x01E3, 9},{0x03C5,10},{0x0017, 5}, |
243 | | {0x1E21,13},{0x0002, 3},{0x0001, 3},{0x0009, 4}, |
244 | | {0x000A, 4},{0x0007, 4},{0x001B, 5},{0x003D, 6}, |
245 | | {0x001B, 6},{0x0022, 6},{0x0079, 7},{0x00F0, 8}, |
246 | | {0x1E20,13},{0x1E23,13},{0x1E22,13},{0x000E, 4}, |
247 | | {0x0016, 5},{0x0018, 5},{0x0032, 6},{0x001A, 6}, |
248 | | {0x0047, 7},{0x0789,11},{0x001F, 5},{0x0010, 5} |
249 | | }, |
250 | | { |
251 | | {0x001D, 5},{0x0061, 7},{0x004E, 8},{0x009E, 9}, |
252 | | {0x027C,11},{0x09F5,13},{0x09F4,13},{0x0003, 4}, |
253 | | {0x0060, 7},{0x0000, 3},{0x000F, 4},{0x000B, 4}, |
254 | | {0x000A, 4},{0x0009, 4},{0x0005, 4},{0x000D, 5}, |
255 | | {0x0031, 6},{0x0008, 5},{0x0038, 6},{0x0012, 6}, |
256 | | {0x0026, 7},{0x013F,10},{0x04FB,12},{0x000D, 4}, |
257 | | {0x0002, 4},{0x000C, 5},{0x0039, 6},{0x001C, 6}, |
258 | | {0x000F, 5},{0x001D, 6},{0x0008, 4},{0x0019, 5} |
259 | | }, |
260 | | { |
261 | | {0x0007, 4},{0x0019, 6},{0x00AB, 8},{0x00AA, 8}, |
262 | | {0x0119,10},{0x0461,12},{0x0460,12},{0x001B, 5}, |
263 | | {0x0047, 8},{0x0001, 3},{0x0000, 3},{0x000C, 4}, |
264 | | {0x000B, 4},{0x0009, 4},{0x0005, 4},{0x000D, 5}, |
265 | | {0x0035, 6},{0x003D, 6},{0x003C, 6},{0x0018, 6}, |
266 | | {0x0022, 7},{0x008D, 9},{0x0231,11},{0x000E, 4}, |
267 | | {0x001F, 5},{0x0009, 5},{0x002B, 6},{0x0010, 6}, |
268 | | {0x0034, 6},{0x0054, 7},{0x0008, 4},{0x0014, 5} |
269 | | }, |
270 | | { |
271 | | {0x000C, 4},{0x0005, 5},{0x0008, 6},{0x005B, 7}, |
272 | | {0x004D, 9},{0x0131,11},{0x0261,12},{0x001A, 5}, |
273 | | {0x0012, 7},{0x0000, 3},{0x000F, 4},{0x000A, 4}, |
274 | | {0x0009, 4},{0x0006, 4},{0x001B, 5},{0x0006, 5}, |
275 | | {0x001C, 6},{0x002C, 6},{0x0015, 6},{0x005A, 7}, |
276 | | {0x0027, 8},{0x0099,10},{0x0260,12},{0x000E, 4}, |
277 | | {0x0004, 4},{0x000F, 5},{0x0007, 5},{0x001D, 6}, |
278 | | {0x000B, 5},{0x0014, 6},{0x0008, 4},{0x0017, 5} |
279 | | }, |
280 | | { |
281 | | {0x000F, 4},{0x0013, 5},{0x0075, 7},{0x0024, 6}, |
282 | | {0x0095, 8},{0x0251,10},{0x04A0,11},{0x0010, 5}, |
283 | | {0x00C8, 8},{0x0002, 3},{0x0001, 3},{0x0001, 4}, |
284 | | {0x0000, 4},{0x001A, 5},{0x0011, 5},{0x002C, 6}, |
285 | | {0x0065, 7},{0x0074, 7},{0x004B, 7},{0x00C9, 8}, |
286 | | {0x0129, 9},{0x0943,12},{0x0942,12},{0x0003, 3}, |
287 | | {0x000A, 4},{0x001C, 5},{0x0018, 5},{0x0033, 6}, |
288 | | {0x0017, 5},{0x002D, 6},{0x001B, 5},{0x003B, 6} |
289 | | }, |
290 | | { |
291 | | {0x0003, 3},{0x001A, 5},{0x002D, 6},{0x0038, 6}, |
292 | | {0x0028, 7},{0x0395,10},{0x0E51,12},{0x0037, 6}, |
293 | | {0x00E4, 8},{0x0001, 3},{0x0000, 3},{0x001F, 5}, |
294 | | {0x001E, 5},{0x0017, 5},{0x003A, 6},{0x0073, 7}, |
295 | | {0x002A, 7},{0x002B, 7},{0x0029, 7},{0x01CB, 9}, |
296 | | {0x0729,11},{0x1CA1,13},{0x1CA0,13},{0x0004, 3}, |
297 | | {0x000A, 4},{0x0004, 4},{0x0018, 5},{0x0036, 6}, |
298 | | {0x000B, 5},{0x002C, 6},{0x0019, 5},{0x003B, 6} |
299 | | }, |
300 | | { |
301 | | {0x0004, 3},{0x0004, 4},{0x003F, 6},{0x0017, 5}, |
302 | | {0x0075, 7},{0x01F5, 9},{0x07D1,11},{0x0017, 6}, |
303 | | {0x01F6, 9},{0x0001, 3},{0x0000, 3},{0x001B, 5}, |
304 | | {0x001A, 5},{0x000A, 5},{0x0032, 6},{0x0074, 7}, |
305 | | {0x00F8, 8},{0x00F9, 8},{0x01F7, 9},{0x03E9,10}, |
306 | | {0x0FA0,12},{0x1F43,13},{0x1F42,13},{0x0003, 3}, |
307 | | {0x000A, 4},{0x001E, 5},{0x001C, 5},{0x003B, 6}, |
308 | | {0x0018, 5},{0x0016, 6},{0x0016, 5},{0x0033, 6} |
309 | | }, |
310 | | { |
311 | | {0x0004, 3},{0x0007, 4},{0x0018, 5},{0x001E, 5}, |
312 | | {0x0036, 6},{0x0031, 7},{0x0177, 9},{0x0077, 7}, |
313 | | {0x0176, 9},{0x0001, 3},{0x0000, 3},{0x001A, 5}, |
314 | | {0x0019, 5},{0x003A, 6},{0x0019, 6},{0x005C, 7}, |
315 | | {0x00BA, 8},{0x0061, 8},{0x00C1, 9},{0x0180,10}, |
316 | | {0x0302,11},{0x0607,12},{0x0606,12},{0x0002, 3}, |
317 | | {0x000A, 4},{0x001F, 5},{0x001C, 5},{0x0037, 6}, |
318 | | {0x0016, 5},{0x0076, 7},{0x000D, 5},{0x002F, 6} |
319 | | }, |
320 | | { |
321 | | {0x0000, 3},{0x000A, 4},{0x001A, 5},{0x000C, 4}, |
322 | | {0x001D, 5},{0x0039, 6},{0x0078, 7},{0x005E, 7}, |
323 | | {0x0393,11},{0x0002, 3},{0x0001, 3},{0x0016, 5}, |
324 | | {0x000F, 5},{0x002E, 6},{0x005F, 7},{0x0073, 8}, |
325 | | {0x00E5, 9},{0x01C8,10},{0x0E4A,13},{0x1C97,14}, |
326 | | {0x1C96,14},{0x0E49,13},{0x0E48,13},{0x0004, 3}, |
327 | | {0x0006, 4},{0x001F, 5},{0x001B, 5},{0x001D, 6}, |
328 | | {0x0038, 6},{0x0038, 7},{0x003D, 6},{0x0079, 7} |
329 | | }, |
330 | | { |
331 | | {0x000B, 5},{0x002B, 7},{0x0054, 8},{0x01B7, 9}, |
332 | | {0x06D9,11},{0x0DB1,12},{0x0DB0,12},{0x0002, 4}, |
333 | | {0x00AB, 9},{0x0009, 4},{0x000A, 4},{0x0007, 4}, |
334 | | {0x0008, 4},{0x000F, 4},{0x000C, 4},{0x0003, 4}, |
335 | | {0x001D, 5},{0x0004, 4},{0x000B, 4},{0x0006, 4}, |
336 | | {0x001A, 5},{0x0003, 6},{0x00AA, 9},{0x0001, 4}, |
337 | | {0x0000, 5},{0x0014, 6},{0x006C, 7},{0x00DA, 8}, |
338 | | {0x0002, 6},{0x036D,10},{0x001C, 5},{0x0037, 6} |
339 | | }, |
340 | | { |
341 | | {0x001D, 5},{0x0004, 6},{0x00B6, 8},{0x006A, 8}, |
342 | | {0x05B9,11},{0x16E1,13},{0x16E0,13},{0x0007, 4}, |
343 | | {0x016F, 9},{0x000C, 4},{0x000D, 4},{0x0009, 4}, |
344 | | {0x0008, 4},{0x000F, 4},{0x000A, 4},{0x0003, 4}, |
345 | | {0x0017, 5},{0x0002, 4},{0x0004, 4},{0x001C, 5}, |
346 | | {0x002C, 6},{0x006B, 8},{0x0B71,12},{0x0005, 4}, |
347 | | {0x0003, 5},{0x001B, 6},{0x005A, 7},{0x0034, 7}, |
348 | | {0x0005, 6},{0x02DD,10},{0x0000, 4},{0x000C, 5} |
349 | | }, |
350 | | { |
351 | | {0x0003, 4},{0x007F, 7},{0x00A1, 8},{0x00A0, 8}, |
352 | | {0x020C,10},{0x0834,12},{0x106B,13},{0x0007, 4}, |
353 | | {0x0082, 8},{0x000E, 4},{0x000D, 4},{0x000B, 4}, |
354 | | {0x000C, 4},{0x0000, 3},{0x0009, 4},{0x0002, 4}, |
355 | | {0x0011, 5},{0x001E, 5},{0x0015, 5},{0x003E, 6}, |
356 | | {0x0040, 7},{0x041B,11},{0x106A,13},{0x0006, 4}, |
357 | | {0x000A, 5},{0x0029, 6},{0x007E, 7},{0x0051, 7}, |
358 | | {0x0021, 6},{0x0107, 9},{0x0004, 4},{0x000B, 5} |
359 | | }, |
360 | | { |
361 | | {0x0007, 4},{0x001B, 6},{0x00F6, 8},{0x00E9, 8}, |
362 | | {0x03A1,10},{0x0740,11},{0x0E82,12},{0x001F, 5}, |
363 | | {0x01EF, 9},{0x0001, 3},{0x0002, 3},{0x000B, 4}, |
364 | | {0x000C, 4},{0x000D, 4},{0x0008, 4},{0x001C, 5}, |
365 | | {0x0003, 5},{0x0012, 5},{0x0002, 5},{0x0075, 7}, |
366 | | {0x01D1, 9},{0x1D07,13},{0x1D06,13},{0x000A, 4}, |
367 | | {0x0013, 5},{0x003B, 6},{0x001A, 6},{0x007A, 7}, |
368 | | {0x003C, 6},{0x01EE, 9},{0x0000, 4},{0x000C, 5} |
369 | | }, |
370 | | { |
371 | | {0x000D, 4},{0x003D, 6},{0x0042, 7},{0x0037, 7}, |
372 | | {0x00D9, 9},{0x0362,11},{0x06C6,12},{0x001F, 5}, |
373 | | {0x0086, 8},{0x0001, 3},{0x0002, 3},{0x000C, 4}, |
374 | | {0x000B, 4},{0x000A, 4},{0x0001, 4},{0x000F, 5}, |
375 | | {0x0025, 6},{0x003C, 6},{0x001A, 6},{0x0087, 8}, |
376 | | {0x01B0,10},{0x0D8F,13},{0x0D8E,13},{0x000E, 4}, |
377 | | {0x0013, 5},{0x000C, 5},{0x0024, 6},{0x0020, 6}, |
378 | | {0x0011, 5},{0x006D, 8},{0x0000, 4},{0x000E, 5} |
379 | | }, |
380 | | { |
381 | | {0x0000, 3},{0x0012, 5},{0x0076, 7},{0x0077, 7}, |
382 | | {0x014D, 9},{0x0533,11},{0x14C9,13},{0x0013, 5}, |
383 | | {0x00A5, 8},{0x0002, 3},{0x0003, 3},{0x000B, 4}, |
384 | | {0x000C, 4},{0x0008, 4},{0x001A, 5},{0x002B, 6}, |
385 | | {0x0075, 7},{0x0074, 7},{0x00A7, 8},{0x0298,10}, |
386 | | {0x14C8,13},{0x14CB,13},{0x14CA,13},{0x000F, 4}, |
387 | | {0x001C, 5},{0x0007, 5},{0x002A, 6},{0x0028, 6}, |
388 | | {0x001B, 5},{0x00A4, 8},{0x0002, 4},{0x0006, 5} |
389 | | }, |
390 | | { |
391 | | {0x0002, 3},{0x001A, 5},{0x002B, 6},{0x003A, 6}, |
392 | | {0x00ED, 8},{0x0283,10},{0x0A0A,12},{0x0004, 5}, |
393 | | {0x00A1, 8},{0x0004, 3},{0x0003, 3},{0x000B, 4}, |
394 | | {0x000C, 4},{0x001F, 5},{0x0006, 5},{0x0077, 7}, |
395 | | {0x00A3, 8},{0x00A2, 8},{0x0140, 9},{0x1417,13}, |
396 | | {0x1416,13},{0x0A09,12},{0x0A08,12},{0x0000, 3}, |
397 | | {0x001E, 5},{0x0007, 5},{0x002A, 6},{0x0029, 6}, |
398 | | {0x001C, 5},{0x00EC, 8},{0x001B, 5},{0x0005, 5} |
399 | | }, |
400 | | { |
401 | | {0x0002, 3},{0x0002, 4},{0x0018, 5},{0x001D, 5}, |
402 | | {0x0035, 6},{0x00E4, 8},{0x01CF,11},{0x001D, 7}, |
403 | | {0x0072, 9},{0x0004, 3},{0x0005, 3},{0x0006, 4}, |
404 | | {0x0007, 4},{0x0006, 5},{0x0073, 7},{0x0038, 8}, |
405 | | {0x01CE,11},{0x039B,12},{0x0398,12},{0x0733,13}, |
406 | | {0x0732,13},{0x0735,13},{0x0734,13},{0x0000, 3}, |
407 | | {0x001F, 5},{0x001B, 5},{0x0034, 6},{0x000F, 6}, |
408 | | {0x001E, 5},{0x00E5, 8},{0x0019, 5},{0x0038, 6} |
409 | | }, |
410 | | { |
411 | | {0x0016, 5},{0x0050, 7},{0x0172, 9},{0x02E7,10}, |
412 | | {0x1732,13},{0x2E67,14},{0x2E66,14},{0x0006, 4}, |
413 | | {0x0051, 7},{0x0001, 3},{0x0000, 3},{0x000D, 4}, |
414 | | {0x000C, 4},{0x0009, 4},{0x001C, 5},{0x0009, 5}, |
415 | | {0x001C, 6},{0x001D, 6},{0x005D, 7},{0x00B8, 8}, |
416 | | {0x05CD,11},{0x1731,13},{0x1730,13},{0x000F, 4}, |
417 | | {0x0005, 4},{0x000F, 5},{0x0008, 5},{0x0029, 6}, |
418 | | {0x001D, 5},{0x002F, 6},{0x0008, 4},{0x0015, 5} |
419 | | }, |
420 | | { |
421 | | {0x0009, 4},{0x0021, 6},{0x0040, 7},{0x00AD, 8}, |
422 | | {0x02B0,10},{0x1589,13},{0x1588,13},{0x001C, 5}, |
423 | | {0x005F, 7},{0x0000, 3},{0x000F, 4},{0x000D, 4}, |
424 | | {0x000C, 4},{0x0006, 4},{0x0011, 5},{0x002A, 6}, |
425 | | {0x0057, 7},{0x005E, 7},{0x0041, 7},{0x0159, 9}, |
426 | | {0x0563,11},{0x158B,13},{0x158A,13},{0x0001, 3}, |
427 | | {0x0005, 4},{0x0014, 5},{0x003B, 6},{0x002E, 6}, |
428 | | {0x0004, 4},{0x003A, 6},{0x0007, 4},{0x0016, 5} |
429 | | }, |
430 | | { |
431 | | {0x000E, 4},{0x0007, 5},{0x0046, 7},{0x0045, 7}, |
432 | | {0x0064, 9},{0x032A,12},{0x0657,13},{0x0018, 5}, |
433 | | {0x000D, 6},{0x0000, 3},{0x000F, 4},{0x000A, 4}, |
434 | | {0x000B, 4},{0x001A, 5},{0x0036, 6},{0x0047, 7}, |
435 | | {0x0044, 7},{0x0018, 7},{0x0033, 8},{0x00CB,10}, |
436 | | {0x0656,13},{0x0329,12},{0x0328,12},{0x0002, 3}, |
437 | | {0x0006, 4},{0x0019, 5},{0x000E, 5},{0x0037, 6}, |
438 | | {0x0009, 4},{0x000F, 5},{0x0002, 4},{0x0010, 5} |
439 | | }, |
440 | | { |
441 | | {0x0003, 3},{0x0018, 5},{0x0023, 6},{0x0077, 7}, |
442 | | {0x0194, 9},{0x1956,13},{0x32AF,14},{0x003A, 6}, |
443 | | {0x0076, 7},{0x0002, 3},{0x0001, 3},{0x001F, 5}, |
444 | | {0x001E, 5},{0x0014, 5},{0x0022, 6},{0x0064, 7}, |
445 | | {0x0197, 9},{0x0196, 9},{0x032B,10},{0x0654,11}, |
446 | | {0x32AE,14},{0x1955,13},{0x1954,13},{0x0000, 3}, |
447 | | {0x0009, 4},{0x001C, 5},{0x0015, 5},{0x0010, 5}, |
448 | | {0x000D, 4},{0x0017, 5},{0x0016, 5},{0x0033, 6} |
449 | | }, |
450 | | { |
451 | | {0x0005, 3},{0x0006, 4},{0x003E, 6},{0x0010, 5}, |
452 | | {0x0048, 7},{0x093F,12},{0x24FA,14},{0x0032, 6}, |
453 | | {0x0067, 7},{0x0002, 3},{0x0001, 3},{0x001B, 5}, |
454 | | {0x001E, 5},{0x0034, 6},{0x0066, 7},{0x0092, 8}, |
455 | | {0x0126, 9},{0x024E,10},{0x049E,11},{0x49F7,15}, |
456 | | {0x49F6,15},{0x24F9,14},{0x24F8,14},{0x0000, 3}, |
457 | | {0x0007, 4},{0x0018, 5},{0x0011, 5},{0x003F, 6}, |
458 | | {0x000E, 4},{0x0013, 5},{0x0035, 6},{0x0025, 6} |
459 | | }, |
460 | | { |
461 | | {0x0005, 3},{0x0008, 4},{0x0012, 5},{0x001C, 5}, |
462 | | {0x001C, 6},{0x00EA, 9},{0x1D75,14},{0x001E, 6}, |
463 | | {0x0066, 7},{0x0001, 3},{0x0002, 3},{0x001B, 5}, |
464 | | {0x001A, 5},{0x001F, 6},{0x003B, 7},{0x0074, 8}, |
465 | | {0x01D6,10},{0x03AF,11},{0x1D74,14},{0x1D77,14}, |
466 | | {0x1D76,14},{0x0EB9,13},{0x0EB8,13},{0x000F, 4}, |
467 | | {0x0006, 4},{0x0013, 5},{0x003B, 6},{0x003A, 6}, |
468 | | {0x0000, 3},{0x0018, 5},{0x0032, 6},{0x0067, 7} |
469 | | }, |
470 | | { |
471 | | {0x0004, 3},{0x000A, 4},{0x001B, 5},{0x000C, 4}, |
472 | | {0x000D, 5},{0x00E6, 8},{0x0684,11},{0x0072, 7}, |
473 | | {0x00E7, 8},{0x0002, 3},{0x0001, 3},{0x0017, 5}, |
474 | | {0x0016, 5},{0x0018, 6},{0x00D1, 8},{0x01A0, 9}, |
475 | | {0x0686,11},{0x0D0F,12},{0x0D0A,12},{0x1A17,13}, |
476 | | {0x1A16,13},{0x1A1D,13},{0x1A1C,13},{0x000F, 4}, |
477 | | {0x001D, 5},{0x000E, 5},{0x0035, 6},{0x0038, 6}, |
478 | | {0x0000, 3},{0x000F, 5},{0x0019, 6},{0x0069, 7} |
479 | | }, |
480 | | { |
481 | | {0x0003, 3},{0x000C, 4},{0x001B, 5},{0x0000, 3}, |
482 | | {0x0003, 4},{0x002E, 6},{0x0051, 9},{0x00BC, 8}, |
483 | | {0x0053, 9},{0x0004, 3},{0x0002, 3},{0x0016, 5}, |
484 | | {0x0015, 5},{0x0015, 7},{0x0050, 9},{0x00A4,10}, |
485 | | {0x0294,12},{0x052B,13},{0x052A,13},{0x052D,13}, |
486 | | {0x052C,13},{0x052F,13},{0x052E,13},{0x000E, 4}, |
487 | | {0x001A, 5},{0x0004, 5},{0x0028, 6},{0x0029, 6}, |
488 | | {0x000F, 4},{0x000B, 6},{0x005F, 7},{0x00BD, 8} |
489 | | }, |
490 | | { |
491 | | {0x0003, 4},{0x0009, 6},{0x00D0, 8},{0x01A3, 9}, |
492 | | {0x0344,10},{0x0D14,12},{0x1A2B,13},{0x0004, 4}, |
493 | | {0x0015, 7},{0x0000, 3},{0x000F, 4},{0x000B, 4}, |
494 | | {0x000C, 4},{0x000E, 4},{0x0009, 4},{0x001B, 5}, |
495 | | {0x000A, 5},{0x0014, 5},{0x000D, 5},{0x002A, 6}, |
496 | | {0x0014, 7},{0x068B,11},{0x1A2A,13},{0x0008, 4}, |
497 | | {0x000B, 5},{0x002B, 6},{0x000B, 6},{0x0069, 7}, |
498 | | {0x0035, 6},{0x0008, 6},{0x0007, 4},{0x000C, 5} |
499 | | }, |
500 | | { |
501 | | {0x000A, 4},{0x003C, 6},{0x0032, 7},{0x0030, 7}, |
502 | | {0x00C5, 9},{0x0621,12},{0x0620,12},{0x001F, 5}, |
503 | | {0x0033, 7},{0x0001, 3},{0x0000, 3},{0x000E, 4}, |
504 | | {0x000D, 4},{0x000C, 4},{0x0004, 4},{0x000D, 5}, |
505 | | {0x0026, 6},{0x0027, 6},{0x0014, 6},{0x0063, 8}, |
506 | | {0x0189,10},{0x0623,12},{0x0622,12},{0x000B, 4}, |
507 | | {0x0012, 5},{0x003D, 6},{0x0022, 6},{0x0015, 6}, |
508 | | {0x000B, 5},{0x0023, 6},{0x0007, 4},{0x0010, 5} |
509 | | }, |
510 | | { |
511 | | {0x000F, 4},{0x000C, 5},{0x0043, 7},{0x0010, 6}, |
512 | | {0x0044, 8},{0x0114,10},{0x0455,12},{0x0018, 5}, |
513 | | {0x0023, 7},{0x0001, 3},{0x0000, 3},{0x000E, 4}, |
514 | | {0x000D, 4},{0x0009, 4},{0x0019, 5},{0x0009, 5}, |
515 | | {0x0017, 6},{0x0016, 6},{0x0042, 7},{0x008B, 9}, |
516 | | {0x0454,12},{0x0457,12},{0x0456,12},{0x000B, 4}, |
517 | | {0x0015, 5},{0x000A, 5},{0x0029, 6},{0x0020, 6}, |
518 | | {0x000D, 5},{0x0028, 6},{0x0007, 4},{0x0011, 5} |
519 | | }, |
520 | | { |
521 | | {0x0001, 3},{0x001A, 5},{0x0029, 6},{0x002A, 6}, |
522 | | {0x00A0, 8},{0x0285,10},{0x1425,13},{0x0002, 5}, |
523 | | {0x0000, 7},{0x0002, 3},{0x0003, 3},{0x000C, 4}, |
524 | | {0x000B, 4},{0x0008, 4},{0x0012, 5},{0x0001, 6}, |
525 | | {0x0051, 7},{0x0001, 7},{0x0143, 9},{0x0508,11}, |
526 | | {0x1424,13},{0x1427,13},{0x1426,13},{0x000F, 4}, |
527 | | {0x001C, 5},{0x0003, 5},{0x0037, 6},{0x002B, 6}, |
528 | | {0x0013, 5},{0x0036, 6},{0x001D, 5},{0x0001, 5} |
529 | | }, |
530 | | { |
531 | | {0x0004, 3},{0x001F, 5},{0x003D, 6},{0x0006, 5}, |
532 | | {0x0016, 7},{0x0053, 9},{0x014A,11},{0x0034, 6}, |
533 | | {0x002A, 8},{0x0002, 3},{0x0003, 3},{0x000B, 4}, |
534 | | {0x000C, 4},{0x001C, 5},{0x0037, 6},{0x0017, 7}, |
535 | | {0x002B, 8},{0x0028, 8},{0x00A4,10},{0x052D,13}, |
536 | | {0x052C,13},{0x052F,13},{0x052E,13},{0x0000, 3}, |
537 | | {0x001D, 5},{0x0007, 5},{0x0004, 5},{0x0035, 6}, |
538 | | {0x0014, 5},{0x0036, 6},{0x0015, 5},{0x003C, 6} |
539 | | }, |
540 | | { |
541 | | {0x0004, 3},{0x000A, 4},{0x0007, 5},{0x001D, 5}, |
542 | | {0x0009, 6},{0x01F3, 9},{0x07C7,11},{0x0008, 6}, |
543 | | {0x01F0, 9},{0x0003, 3},{0x0002, 3},{0x000D, 4}, |
544 | | {0x000C, 4},{0x0017, 5},{0x007D, 7},{0x01F2, 9}, |
545 | | {0x07C6,11},{0x07C5,11},{0x1F12,13},{0x3E27,14}, |
546 | | {0x3E26,14},{0x1F11,13},{0x1F10,13},{0x0000, 3}, |
547 | | {0x001E, 5},{0x0006, 5},{0x0039, 6},{0x0038, 6}, |
548 | | {0x003F, 6},{0x002C, 6},{0x0005, 5},{0x002D, 6} |
549 | | }, |
550 | | { |
551 | | {0x0002, 3},{0x0007, 4},{0x0018, 5},{0x0003, 4}, |
552 | | {0x0005, 5},{0x0035, 7},{0x004F, 9},{0x0012, 7}, |
553 | | {0x04E5,13},{0x0005, 3},{0x0004, 3},{0x000D, 4}, |
554 | | {0x000E, 4},{0x0033, 6},{0x0026, 8},{0x009D,10}, |
555 | | {0x04E4,13},{0x04E7,13},{0x04E6,13},{0x04E1,13}, |
556 | | {0x04E0,13},{0x04E3,13},{0x04E2,13},{0x0000, 3}, |
557 | | {0x001F, 5},{0x000C, 5},{0x003D, 6},{0x003C, 6}, |
558 | | {0x0032, 6},{0x0034, 7},{0x001B, 6},{0x0008, 6} |
559 | | }, |
560 | | { |
561 | | {0x0000, 3},{0x0004, 4},{0x001C, 5},{0x000F, 4}, |
562 | | {0x0002, 4},{0x0007, 5},{0x0075, 7},{0x00E8, 8}, |
563 | | {0x1D2A,13},{0x0005, 3},{0x0004, 3},{0x000D, 4}, |
564 | | {0x000C, 4},{0x0077, 7},{0x0E96,12},{0x3A57,14}, |
565 | | {0x3A56,14},{0x3A5D,14},{0x3A5C,14},{0x3A5F,14}, |
566 | | {0x3A5E,14},{0x1D29,13},{0x1D28,13},{0x0003, 3}, |
567 | | {0x0006, 5},{0x000A, 5},{0x002C, 7},{0x0017, 6}, |
568 | | {0x0076, 7},{0x01D3, 9},{0x03A4,10},{0x002D, 7} |
569 | | }, |
570 | | { |
571 | | {0x000A, 4},{0x0024, 6},{0x00BF, 8},{0x0085, 8}, |
572 | | {0x0211,10},{0x0842,12},{0x1087,13},{0x0018, 5}, |
573 | | {0x0020, 6},{0x0001, 3},{0x0002, 3},{0x000E, 4}, |
574 | | {0x000D, 4},{0x0007, 4},{0x0013, 5},{0x0025, 6}, |
575 | | {0x005E, 7},{0x0043, 7},{0x00BE, 8},{0x0109, 9}, |
576 | | {0x1086,13},{0x0841,12},{0x0840,12},{0x000F, 4}, |
577 | | {0x0001, 4},{0x0011, 5},{0x0000, 5},{0x002E, 6}, |
578 | | {0x0019, 5},{0x0001, 5},{0x0006, 4},{0x0016, 5} |
579 | | }, |
580 | | { |
581 | | {0x0002, 3},{0x000F, 5},{0x006F, 7},{0x0061, 7}, |
582 | | {0x0374,10},{0x1BA8,13},{0x3753,14},{0x0012, 5}, |
583 | | {0x0036, 6},{0x0000, 3},{0x0001, 3},{0x000A, 4}, |
584 | | {0x000B, 4},{0x001A, 5},{0x0031, 6},{0x0060, 7}, |
585 | | {0x00DC, 8},{0x01BB, 9},{0x06EB,11},{0x1BAB,13}, |
586 | | {0x3752,14},{0x3755,14},{0x3754,14},{0x000E, 4}, |
587 | | {0x0006, 4},{0x0013, 5},{0x000E, 5},{0x003E, 6}, |
588 | | {0x0008, 4},{0x001E, 5},{0x0019, 5},{0x003F, 6} |
589 | | }, |
590 | | { |
591 | | {0x0003, 3},{0x001C, 5},{0x0025, 6},{0x0024, 6}, |
592 | | {0x01DA, 9},{0x1DBD,13},{0x3B7C,14},{0x003C, 6}, |
593 | | {0x003D, 6},{0x0000, 3},{0x0001, 3},{0x000B, 4}, |
594 | | {0x000A, 4},{0x000B, 5},{0x0077, 7},{0x00EC, 8}, |
595 | | {0x03B6,10},{0x076E,11},{0x1DBF,13},{0x76FB,15}, |
596 | | {0x76FA,15},{0x3B79,14},{0x3B78,14},{0x000D, 4}, |
597 | | {0x001F, 5},{0x0013, 5},{0x000A, 5},{0x0008, 5}, |
598 | | {0x000C, 4},{0x0008, 4},{0x0009, 5},{0x003A, 6} |
599 | | }, |
600 | | { |
601 | | {0x0005, 3},{0x0003, 4},{0x0004, 5},{0x0010, 5}, |
602 | | {0x008F, 8},{0x0475,11},{0x11D1,13},{0x0079, 7}, |
603 | | {0x0027, 6},{0x0002, 3},{0x0003, 3},{0x0001, 4}, |
604 | | {0x0000, 4},{0x0026, 6},{0x0046, 7},{0x011C, 9}, |
605 | | {0x0477,11},{0x08ED,12},{0x11D0,13},{0x11D3,13}, |
606 | | {0x11D2,13},{0x11D9,13},{0x11D8,13},{0x000D, 4}, |
607 | | {0x001F, 5},{0x0012, 5},{0x0005, 5},{0x003D, 6}, |
608 | | {0x000C, 4},{0x000E, 4},{0x0022, 6},{0x0078, 7} |
609 | | }, |
610 | | { |
611 | | {0x0005, 3},{0x000C, 4},{0x001B, 5},{0x0000, 4}, |
612 | | {0x0006, 6},{0x03E2,10},{0x3E3D,14},{0x000F, 7}, |
613 | | {0x0034, 6},{0x0003, 3},{0x0002, 3},{0x001E, 5}, |
614 | | {0x001D, 5},{0x007D, 7},{0x01F0, 9},{0x07C6,11}, |
615 | | {0x3E3C,14},{0x3E3F,14},{0x3E3E,14},{0x3E39,14}, |
616 | | {0x3E38,14},{0x3E3B,14},{0x3E3A,14},{0x0008, 4}, |
617 | | {0x001C, 5},{0x0002, 5},{0x003F, 6},{0x0035, 6}, |
618 | | {0x0009, 4},{0x0001, 3},{0x000E, 7},{0x00F9, 8} |
619 | | }, |
620 | | { |
621 | | {0x0004, 3},{0x000B, 4},{0x0001, 4},{0x000A, 4}, |
622 | | {0x001E, 6},{0x00E0, 9},{0x0E1E,13},{0x0071, 8}, |
623 | | {0x0039, 7},{0x0007, 3},{0x0006, 3},{0x000D, 5}, |
624 | | {0x000C, 5},{0x0020, 7},{0x01C2,10},{0x1C3F,14}, |
625 | | {0x1C3E,14},{0x0E19,13},{0x0E18,13},{0x0E1B,13}, |
626 | | {0x0E1A,13},{0x0E1D,13},{0x0E1C,13},{0x0000, 4}, |
627 | | {0x0009, 5},{0x001D, 6},{0x001F, 6},{0x0011, 6}, |
628 | | {0x0005, 4},{0x0001, 3},{0x0043, 8},{0x0042, 8} |
629 | | }, |
630 | | { |
631 | | {0x0004, 3},{0x000D, 4},{0x0007, 4},{0x0002, 3}, |
632 | | {0x0014, 5},{0x016C, 9},{0x16D1,13},{0x02DF,10}, |
633 | | {0x016E, 9},{0x0000, 2},{0x0007, 3},{0x002C, 6}, |
634 | | {0x002B, 6},{0x02DE,10},{0x16D0,13},{0x16D3,13}, |
635 | | {0x16D2,13},{0x2DB5,14},{0x2DB4,14},{0x2DB7,14}, |
636 | | {0x2DB6,14},{0x16D9,13},{0x16D8,13},{0x000C, 5}, |
637 | | {0x002A, 6},{0x005A, 7},{0x001B, 6},{0x001A, 6}, |
638 | | {0x0017, 5},{0x000C, 4},{0x05B7,11},{0x05B5,11} |
639 | | }, |
640 | | { |
641 | | {0x0002, 2},{0x000F, 4},{0x001C, 5},{0x000C, 4}, |
642 | | {0x003B, 6},{0x01AC, 9},{0x1AD8,13},{0x35B3,14}, |
643 | | {0x35B2,14},{0x0001, 2},{0x0000, 2},{0x0069, 7}, |
644 | | {0x0068, 7},{0x35BD,14},{0x35BC,14},{0x35BF,14}, |
645 | | {0x35BE,14},{0x35B9,14},{0x35B8,14},{0x35BB,14}, |
646 | | {0x35BA,14},{0x35B5,14},{0x35B4,14},{0x01A9, 9}, |
647 | | {0x01A8, 9},{0x035A,10},{0x00D7, 8},{0x00D5, 8}, |
648 | | {0x003A, 6},{0x001B, 5},{0x35B7,14},{0x35B6,14} |
649 | | }, |
650 | | { |
651 | | {0x0000, 3},{0x0010, 5},{0x0072, 7},{0x0071, 7}, |
652 | | {0x0154, 9},{0x0AAB,12},{0x0AA8,12},{0x0014, 5}, |
653 | | {0x0070, 7},{0x0002, 3},{0x0003, 3},{0x000C, 4}, |
654 | | {0x000B, 4},{0x0003, 4},{0x0011, 5},{0x0073, 7}, |
655 | | {0x0054, 7},{0x00AB, 8},{0x02AB,10},{0x1553,13}, |
656 | | {0x1552,13},{0x1555,13},{0x1554,13},{0x000D, 4}, |
657 | | {0x001E, 5},{0x0012, 5},{0x003E, 6},{0x002B, 6}, |
658 | | {0x0002, 4},{0x003F, 6},{0x001D, 5},{0x0013, 5} |
659 | | }, |
660 | | { |
661 | | {0x0003, 3},{0x001F, 5},{0x0029, 6},{0x003D, 6}, |
662 | | {0x000C, 7},{0x0069,10},{0x0345,13},{0x0002, 5}, |
663 | | {0x0028, 6},{0x0002, 3},{0x0001, 3},{0x000E, 4}, |
664 | | {0x000C, 4},{0x0015, 5},{0x0007, 6},{0x001B, 8}, |
665 | | {0x006B,10},{0x006A,10},{0x0344,13},{0x0347,13}, |
666 | | {0x0346,13},{0x01A1,12},{0x01A0,12},{0x000B, 4}, |
667 | | {0x001A, 5},{0x0012, 5},{0x0000, 5},{0x003C, 6}, |
668 | | {0x0008, 4},{0x001B, 5},{0x0013, 5},{0x0001, 5} |
669 | | }, |
670 | | { |
671 | | {0x0004, 3},{0x0004, 4},{0x003F, 6},{0x0014, 5}, |
672 | | {0x0056, 7},{0x015C, 9},{0x15D5,13},{0x003C, 6}, |
673 | | {0x002A, 6},{0x0000, 3},{0x0001, 3},{0x000E, 4}, |
674 | | {0x000D, 4},{0x000C, 5},{0x00AF, 8},{0x02BB,10}, |
675 | | {0x15D4,13},{0x15D7,13},{0x15D6,13},{0x15D1,13}, |
676 | | {0x15D0,13},{0x15D3,13},{0x15D2,13},{0x000B, 4}, |
677 | | {0x0019, 5},{0x000D, 5},{0x003E, 6},{0x0031, 6}, |
678 | | {0x0007, 4},{0x0005, 4},{0x003D, 6},{0x0030, 6} |
679 | | }, |
680 | | { |
681 | | {0x0005, 3},{0x0008, 4},{0x001A, 5},{0x0000, 4}, |
682 | | {0x0036, 6},{0x0011, 8},{0x0106,12},{0x000A, 7}, |
683 | | {0x006E, 7},{0x0002, 3},{0x0003, 3},{0x0003, 4}, |
684 | | {0x0002, 4},{0x006F, 7},{0x0021, 9},{0x020F,13}, |
685 | | {0x020E,13},{0x0101,12},{0x0100,12},{0x0103,12}, |
686 | | {0x0102,12},{0x0105,12},{0x0104,12},{0x000C, 4}, |
687 | | {0x001E, 5},{0x0003, 5},{0x003E, 6},{0x003F, 6}, |
688 | | {0x0009, 4},{0x000E, 4},{0x000B, 7},{0x0009, 7} |
689 | | }, |
690 | | { |
691 | | {0x0002, 3},{0x000E, 4},{0x001E, 5},{0x000C, 4}, |
692 | | {0x001F, 5},{0x006E, 7},{0x00AD,10},{0x00AF,10}, |
693 | | {0x0014, 7},{0x0004, 3},{0x0003, 3},{0x001A, 5}, |
694 | | {0x0017, 5},{0x002A, 8},{0x0576,13},{0x0AEF,14}, |
695 | | {0x0AEE,14},{0x0571,13},{0x0570,13},{0x0573,13}, |
696 | | {0x0572,13},{0x0575,13},{0x0574,13},{0x0003, 4}, |
697 | | {0x0016, 5},{0x0004, 5},{0x0036, 6},{0x000B, 6}, |
698 | | {0x000A, 4},{0x0000, 3},{0x006F, 7},{0x00AC,10} |
699 | | }, |
700 | | { |
701 | | {0x0004, 3},{0x0005, 4},{0x0003, 3},{0x0001, 3}, |
702 | | {0x0004, 4},{0x002F, 6},{0x0526,11},{0x1495,13}, |
703 | | {0x00A6, 8},{0x0007, 3},{0x0006, 3},{0x002D, 6}, |
704 | | {0x002C, 6},{0x1494,13},{0x1497,13},{0x1496,13}, |
705 | | {0x1491,13},{0x1490,13},{0x1493,13},{0x1492,13}, |
706 | | {0x293D,14},{0x293C,14},{0x293F,14},{0x0000, 3}, |
707 | | {0x0028, 6},{0x00A5, 8},{0x0148, 9},{0x00A7, 8}, |
708 | | {0x002E, 6},{0x0015, 5},{0x0A4E,12},{0x293E,14} |
709 | | }, |
710 | | { |
711 | | {0x0004, 3},{0x0005, 4},{0x0003, 3},{0x0001, 3}, |
712 | | {0x0004, 4},{0x002F, 6},{0x0526,11},{0x1495,13}, |
713 | | {0x00A6, 8},{0x0007, 3},{0x0006, 3},{0x002D, 6}, |
714 | | {0x002C, 6},{0x1494,13},{0x1497,13},{0x1496,13}, |
715 | | {0x1491,13},{0x1490,13},{0x1493,13},{0x1492,13}, |
716 | | {0x293D,14},{0x293C,14},{0x293F,14},{0x0000, 3}, |
717 | | {0x0028, 6},{0x00A5, 8},{0x0148, 9},{0x00A7, 8}, |
718 | | {0x002E, 6},{0x0015, 5},{0x0A4E,12},{0x293E,14} |
719 | | }, |
720 | | { |
721 | | {0x0004, 3},{0x0005, 4},{0x0003, 3},{0x0001, 3}, |
722 | | {0x0004, 4},{0x002F, 6},{0x0526,11},{0x1495,13}, |
723 | | {0x00A6, 8},{0x0007, 3},{0x0006, 3},{0x002D, 6}, |
724 | | {0x002C, 6},{0x1494,13},{0x1497,13},{0x1496,13}, |
725 | | {0x1491,13},{0x1490,13},{0x1493,13},{0x1492,13}, |
726 | | {0x293D,14},{0x293C,14},{0x293F,14},{0x0000, 3}, |
727 | | {0x0028, 6},{0x00A5, 8},{0x0148, 9},{0x00A7, 8}, |
728 | | {0x002E, 6},{0x0015, 5},{0x0A4E,12},{0x293E,14} |
729 | | }, |
730 | | { |
731 | | {0x0003, 3},{0x0011, 5},{0x0020, 6},{0x0074, 7}, |
732 | | {0x010D, 9},{0x0863,12},{0x0860,12},{0x000A, 5}, |
733 | | {0x0075, 7},{0x0001, 3},{0x0000, 3},{0x000B, 4}, |
734 | | {0x000A, 4},{0x0018, 5},{0x0038, 6},{0x0042, 7}, |
735 | | {0x010F, 9},{0x010E, 9},{0x0219,10},{0x10C3,13}, |
736 | | {0x10C2,13},{0x10C5,13},{0x10C4,13},{0x000F, 4}, |
737 | | {0x0004, 4},{0x0019, 5},{0x000B, 5},{0x0039, 6}, |
738 | | {0x0009, 4},{0x001B, 5},{0x001A, 5},{0x003B, 6} |
739 | | }, |
740 | | { |
741 | | {0x0005, 3},{0x0001, 4},{0x003E, 6},{0x0001, 5}, |
742 | | {0x00E2, 8},{0x1C6F,13},{0x38D9,14},{0x0039, 6}, |
743 | | {0x001F, 6},{0x0002, 3},{0x0001, 3},{0x0009, 4}, |
744 | | {0x0008, 4},{0x0000, 5},{0x0070, 7},{0x01C7, 9}, |
745 | | {0x038C,10},{0x071A,11},{0x38D8,14},{0x38DB,14}, |
746 | | {0x38DA,14},{0x38DD,14},{0x38DC,14},{0x000D, 4}, |
747 | | {0x001D, 5},{0x000E, 5},{0x003F, 6},{0x003C, 6}, |
748 | | {0x000C, 4},{0x0006, 4},{0x003D, 6},{0x001E, 6} |
749 | | }, |
750 | | { |
751 | | {0x0006, 3},{0x000B, 4},{0x0011, 5},{0x001E, 5}, |
752 | | {0x0074, 7},{0x03AA,10},{0x1D5C,13},{0x0001, 6}, |
753 | | {0x0021, 6},{0x0001, 3},{0x0002, 3},{0x0007, 4}, |
754 | | {0x0006, 4},{0x003E, 6},{0x00EB, 8},{0x01D4, 9}, |
755 | | {0x0EAF,12},{0x3ABB,14},{0x3ABA,14},{0x1D59,13}, |
756 | | {0x1D58,13},{0x1D5B,13},{0x1D5A,13},{0x000A, 4}, |
757 | | {0x001C, 5},{0x0001, 5},{0x003F, 6},{0x003B, 6}, |
758 | | {0x0001, 4},{0x0009, 4},{0x0020, 6},{0x0000, 6} |
759 | | }, |
760 | | { |
761 | | {0x0004, 3},{0x000A, 4},{0x0017, 5},{0x0004, 4}, |
762 | | {0x0016, 6},{0x016A, 9},{0x16B1,13},{0x0017, 7}, |
763 | | {0x005B, 7},{0x0006, 3},{0x0007, 3},{0x0001, 4}, |
764 | | {0x0000, 4},{0x000A, 6},{0x02D7,10},{0x0B5A,12}, |
765 | | {0x16B0,13},{0x16B3,13},{0x16B2,13},{0x2D6D,14}, |
766 | | {0x2D6C,14},{0x2D6F,14},{0x2D6E,14},{0x0006, 4}, |
767 | | {0x000A, 5},{0x0004, 5},{0x002C, 6},{0x0017, 6}, |
768 | | {0x0003, 4},{0x0007, 4},{0x0016, 7},{0x00B4, 8} |
769 | | }, |
770 | | { |
771 | | {0x0005, 3},{0x000D, 4},{0x0005, 4},{0x0009, 4}, |
772 | | {0x0033, 6},{0x0193, 9},{0x192C,13},{0x0061, 8}, |
773 | | {0x0031, 7},{0x0000, 2},{0x0007, 3},{0x0010, 5}, |
774 | | {0x0011, 5},{0x00C8, 8},{0x192F,13},{0x325B,14}, |
775 | | {0x325A,14},{0x1929,13},{0x1928,13},{0x192B,13}, |
776 | | {0x192A,13},{0x325D,14},{0x325C,14},{0x0018, 5}, |
777 | | {0x001A, 6},{0x001B, 6},{0x0065, 7},{0x0019, 6}, |
778 | | {0x0004, 4},{0x0007, 4},{0x0060, 8},{0x0324,10} |
779 | | }, |
780 | | { |
781 | | {0x0006, 3},{0x0000, 3},{0x0002, 4},{0x000F, 4}, |
782 | | {0x0039, 6},{0x01D9, 9},{0x1D82,13},{0x0761,11}, |
783 | | {0x03BE,10},{0x0001, 2},{0x0002, 2},{0x000F, 6}, |
784 | | {0x000E, 6},{0x0762,11},{0x3B07,14},{0x3B06,14}, |
785 | | {0x3B1D,14},{0x3B1C,14},{0x3B1F,14},{0x3B1E,14}, |
786 | | {0x3B19,14},{0x3B18,14},{0x3B1B,14},{0x0038, 6}, |
787 | | {0x01DE, 9},{0x00ED, 8},{0x03BF,10},{0x00EE, 8}, |
788 | | {0x003A, 6},{0x0006, 5},{0x0EC0,12},{0x3B1A,14} |
789 | | }, |
790 | | { |
791 | | {0x0000, 2},{0x0002, 3},{0x000F, 5},{0x0006, 4}, |
792 | | {0x001C, 6},{0x01D0,10},{0x0E8C,13},{0x1D1B,14}, |
793 | | {0x1D1A,14},{0x0003, 2},{0x0002, 2},{0x00EA, 9}, |
794 | | {0x00E9, 9},{0x0E89,13},{0x0E88,13},{0x0E8B,13}, |
795 | | {0x0E8A,13},{0x1D65,14},{0x1D64,14},{0x1D67,14}, |
796 | | {0x1D66,14},{0x1D61,14},{0x1D60,14},{0x03AD,11}, |
797 | | {0x1D63,14},{0x1D62,14},{0x1D1D,14},{0x1D1C,14}, |
798 | | {0x003B, 7},{0x01D7,10},{0x1D1F,14},{0x1D1E,14} |
799 | | }, |
800 | | { |
801 | | {0x0002, 2},{0x000F, 4},{0x001C, 5},{0x000C, 4}, |
802 | | {0x003B, 6},{0x01AC, 9},{0x1AD8,13},{0x35B3,14}, |
803 | | {0x35B2,14},{0x0001, 2},{0x0000, 2},{0x0069, 7}, |
804 | | {0x0068, 7},{0x35BD,14},{0x35BC,14},{0x35BF,14}, |
805 | | {0x35BE,14},{0x35B9,14},{0x35B8,14},{0x35BB,14}, |
806 | | {0x35BA,14},{0x35B5,14},{0x35B4,14},{0x01A9, 9}, |
807 | | {0x01A8, 9},{0x035A,10},{0x00D7, 8},{0x00D5, 8}, |
808 | | {0x003A, 6},{0x001B, 5},{0x35B7,14},{0x35B6,14} |
809 | | } |
810 | | }; |
811 | | |
812 | | |
813 | | |
814 | | /*A description of a Huffman code value used when encoding the tree.*/ |
815 | | typedef struct{ |
816 | | /*The bit pattern, left-shifted so that the MSB of all patterns is |
817 | | aligned.*/ |
818 | | ogg_uint32_t pattern; |
819 | | /*The amount the bit pattern was shifted.*/ |
820 | | int shift; |
821 | | /*The token this bit pattern represents.*/ |
822 | | int token; |
823 | | }oc_huff_entry; |
824 | | |
825 | | |
826 | | |
827 | | /*Compares two oc_huff_entry structures by their bit patterns. |
828 | | _c1: The first entry to compare. |
829 | | _c2: The second entry to compare. |
830 | | Return: <0 if _c1<_c2, >0 if _c1>_c2.*/ |
831 | 33.0M | static int huff_entry_cmp(const void *_c1,const void *_c2){ |
832 | 33.0M | ogg_uint32_t b1; |
833 | 33.0M | ogg_uint32_t b2; |
834 | 33.0M | b1=((const oc_huff_entry *)_c1)->pattern; |
835 | 33.0M | b2=((const oc_huff_entry *)_c2)->pattern; |
836 | 33.0M | return b1<b2?-1:b1>b2?1:0; |
837 | 33.0M | } |
838 | | |
839 | | /*Encodes a description of the given Huffman tables. |
840 | | Although the codes are stored in the encoder as flat arrays, in the bit |
841 | | stream and in the decoder they are structured as a tree. |
842 | | This function recovers the tree structure from the flat array and then |
843 | | writes it out. |
844 | | Note that the codes MUST form a Huffman code, and not merely a prefix-free |
845 | | code, since the binary tree is assumed to be full. |
846 | | _opb: The buffer to store the tree in. |
847 | | _codes: The Huffman tables to pack. |
848 | | Return: 0 on success, or a negative value if one of the given Huffman tables |
849 | | does not form a full, prefix-free code.*/ |
850 | | int oc_huff_codes_pack(oggpack_buffer *_opb, |
851 | 3.44k | const th_huff_code _codes[TH_NHUFFMAN_TABLES][TH_NDCT_TOKENS]){ |
852 | 3.44k | int i; |
853 | 279k | for(i=0;i<TH_NHUFFMAN_TABLES;i++){ |
854 | 275k | oc_huff_entry entries[TH_NDCT_TOKENS]; |
855 | 275k | int bpos; |
856 | 275k | int maxlen; |
857 | 275k | int mask; |
858 | 275k | int j; |
859 | | /*First, find the maximum code length so we can align all the bit |
860 | | patterns.*/ |
861 | 275k | maxlen=_codes[i][0].nbits; |
862 | 8.82M | for(j=1;j<TH_NDCT_TOKENS;j++)maxlen=OC_MAXI(_codes[i][j].nbits,maxlen); |
863 | | /*It's improbable that a code with more than 32 bits could pass the |
864 | | validation below, but abort early in any case.*/ |
865 | 275k | if(maxlen>32)return TH_EINVAL; |
866 | 275k | mask=(1<<(maxlen>>1)<<(maxlen+1>>1))-1; |
867 | | /*Copy over the codes into our temporary workspace. |
868 | | The bit patterns are aligned, and the original entry each code is from |
869 | | is stored as well.*/ |
870 | 9.09M | for(j=0;j<TH_NDCT_TOKENS;j++){ |
871 | 8.82M | entries[j].shift=maxlen-_codes[i][j].nbits; |
872 | 8.82M | entries[j].pattern=_codes[i][j].pattern<<entries[j].shift&mask; |
873 | 8.82M | entries[j].token=j; |
874 | 8.82M | } |
875 | | /*Sort the codes into ascending order. |
876 | | This is the order the leaves of the tree will be traversed.*/ |
877 | 275k | qsort(entries,TH_NDCT_TOKENS,sizeof(entries[0]),huff_entry_cmp); |
878 | | /*For each leaf of the tree:*/ |
879 | 275k | bpos=maxlen; |
880 | 9.09M | for(j=0;j<TH_NDCT_TOKENS;j++){ |
881 | 8.82M | ogg_uint32_t bit; |
882 | | /*Fail if this code has no bits at all. |
883 | | Technically a codebook with a single 0-bit entry is legal, but the |
884 | | encoder currently does not support codebooks which do not contain all |
885 | | the tokens.*/ |
886 | 8.82M | if(entries[j].shift>=maxlen)return TH_EINVAL; |
887 | | /*Descend into the tree, writing a bit for each branch.*/ |
888 | 17.3M | for(;bpos>entries[j].shift;bpos--)oggpackB_write(_opb,0,1); |
889 | | /*Mark this as a leaf node, and write its value.*/ |
890 | 8.82M | oggpackB_write(_opb,1,1); |
891 | 8.82M | oggpackB_write(_opb,entries[j].token,5); |
892 | | /*For each 1 branch we've descended, back up the tree until we reach a |
893 | | 0 branch.*/ |
894 | 8.82M | bit=(ogg_uint32_t)1<<bpos; |
895 | 17.3M | for(;entries[j].pattern&bit;bpos++)bit<<=1; |
896 | | /*Validate the code.*/ |
897 | 8.82M | if(j+1<TH_NDCT_TOKENS){ |
898 | 8.54M | mask=~(bit-1)<<1; |
899 | | /*The next entry should have a 1 bit where we had a 0, and should |
900 | | match our code above that bit. |
901 | | This verifies both fullness and prefix-freeness simultaneously.*/ |
902 | 8.54M | if(!(entries[j+1].pattern&bit)|| |
903 | 8.54M | (entries[j].pattern&mask)!=(entries[j+1].pattern&mask)){ |
904 | 0 | return TH_EINVAL; |
905 | 0 | } |
906 | 8.54M | } |
907 | | /*If there are no more codes, we should have ascended back to the top |
908 | | of the tree.*/ |
909 | 275k | else if(bpos<maxlen)return TH_EINVAL; |
910 | 8.82M | } |
911 | 275k | } |
912 | 3.44k | return 0; |
913 | 3.44k | } |
914 | | |
915 | | /*This is used to copy the configuration of an existing setup header for use by |
916 | | the encoder. |
917 | | The decoder uses a completely different data structure for the Huffman |
918 | | codebooks.*/ |
919 | | int oc_huff_codes_unpack(oc_pack_buf *_opb, |
920 | 0 | th_huff_code _codes[TH_NHUFFMAN_TABLES][TH_NDCT_TOKENS]){ |
921 | 0 | int i; |
922 | 0 | for(i=0;i<TH_NHUFFMAN_TABLES;i++){ |
923 | 0 | ogg_uint32_t code; |
924 | 0 | int len; |
925 | 0 | int nleaves; |
926 | 0 | code=0; |
927 | 0 | len=nleaves=0; |
928 | 0 | memset(_codes[i],0,TH_NDCT_TOKENS*sizeof(*_codes[i])); |
929 | 0 | for(;;){ |
930 | 0 | long bits; |
931 | 0 | bits=oc_pack_read1(_opb); |
932 | | /*Only process nodes so long as there's more bits in the buffer.*/ |
933 | 0 | if(oc_pack_bytes_left(_opb)<0)return TH_EBADHEADER; |
934 | | /*Read an internal node:*/ |
935 | 0 | if(!bits){ |
936 | 0 | len++; |
937 | | /*Don't allow codewords longer than 32 bits.*/ |
938 | 0 | if(len>32)return TH_EBADHEADER; |
939 | 0 | } |
940 | | /*Read a leaf node:*/ |
941 | 0 | else{ |
942 | 0 | ogg_uint32_t code_bit; |
943 | | /*Don't allow more than 32 tokens per codebook.*/ |
944 | 0 | if(++nleaves>32)return TH_EBADHEADER; |
945 | 0 | bits=oc_pack_read(_opb,OC_NDCT_TOKEN_BITS); |
946 | | /*The current encoder does not support codebooks that do not contain |
947 | | all of the tokens.*/ |
948 | 0 | if(_codes[i][bits].nbits>0)return TH_EINVAL; |
949 | 0 | _codes[i][bits].pattern=code>>32-len; |
950 | 0 | _codes[i][bits].nbits=len; |
951 | 0 | code_bit=0x80000000U>>len-1; |
952 | 0 | while(len>0&&(code&code_bit)){ |
953 | 0 | code^=code_bit; |
954 | 0 | code_bit<<=1; |
955 | 0 | len--; |
956 | 0 | } |
957 | 0 | if(len<=0)break; |
958 | 0 | code|=code_bit; |
959 | 0 | } |
960 | 0 | } |
961 | | /*The current encoder does not support codebooks that do not contain all of |
962 | | the tokens.*/ |
963 | 0 | if(nleaves<32)return TH_EINVAL; |
964 | 0 | } |
965 | 0 | return 0; |
966 | 0 | } |