FFmpeg
dcahuff.c
Go to the documentation of this file.
1 /*
2  * DCA compatible decoder - huffman tables
3  * Copyright (C) 2004 Gildas Bazin
4  * Copyright (C) 2007 Konstantin Shishkov
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 #include <stddef.h>
24 
25 #include "libavutil/avassert.h"
26 #include "libavutil/common.h"
27 
28 #include "dcahuff.h"
29 #include "put_bits.h"
30 
31 #define TMODE_COUNT 4
32 static const uint8_t tmode_vlc_bits[TMODE_COUNT] = { 3, 3, 3, 2 };
33 static const uint16_t tmode_codes[TMODE_COUNT][4] = {
34  { 0x0000, 0x0002, 0x0006, 0x0007 },
35  { 0x0002, 0x0006, 0x0007, 0x0000 },
36  { 0x0006, 0x0007, 0x0000, 0x0002 },
37  { 0x0000, 0x0001, 0x0002, 0x0003 }
38 };
39 
40 static const uint8_t tmode_bits[TMODE_COUNT][4] = {
41  { 1, 2, 3, 3 },
42  { 2, 3, 3, 1 },
43  { 3, 3, 1, 2 },
44  { 2, 2, 2, 2 }
45 };
46 
47 #define BITALLOC_12_VLC_BITS 9
49  9, 7, 7, 9, 9
50 };
51 
52 static const uint16_t bitalloc_12_codes[DCA_BITALLOC_12_COUNT][12] = {
53  { 0x0000, 0x0002, 0x0006, 0x000E, 0x001E, 0x003E, 0x00FF, 0x00FE,
54  0x01FB, 0x01FA, 0x01F9, 0x01F8, },
55  { 0x0001, 0x0000, 0x0002, 0x000F, 0x000C, 0x001D, 0x0039, 0x0038,
56  0x0037, 0x0036, 0x0035, 0x0034, },
57  { 0x0000, 0x0007, 0x0005, 0x0004, 0x0002, 0x000D, 0x000C, 0x0006,
58  0x000F, 0x001D, 0x0039, 0x0038, },
59  { 0x0003, 0x0002, 0x0000, 0x0002, 0x0006, 0x000E, 0x001E, 0x003E,
60  0x007E, 0x00FE, 0x01FF, 0x01FE, },
61  { 0x0001, 0x0000, 0x0002, 0x0006, 0x000E, 0x003F, 0x003D, 0x007C,
62  0x0079, 0x0078, 0x00FB, 0x00FA, }
63 };
64 
65 static const uint8_t bitalloc_12_bits[DCA_BITALLOC_12_COUNT][12] = {
66  { 1, 2, 3, 4, 5, 6, 8, 8, 9, 9, 9, 9 },
67  { 1, 2, 3, 5, 5, 6, 7, 7, 7, 7, 7, 7 },
68  { 2, 3, 3, 3, 3, 4, 4, 4, 5, 6, 7, 7 },
69  { 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10 },
70  { 1, 2, 3, 4, 5, 7, 7, 8, 8, 8, 9, 9 }
71 };
72 
73 #define SCALES_COUNT 5
74 #define SCALES_VLC_BITS 9
75 static const uint16_t scales_codes[SCALES_COUNT][129] = {
76  { 0x3AB0, 0x3AB2, 0x3AB4, 0x3AB6, 0x3AB8, 0x3ABA, 0x3ABC, 0x3ABE,
77  0x3AC0, 0x3AC2, 0x3AC4, 0x3AC6, 0x3AC8, 0x3ACA, 0x3ACC, 0x3ACE,
78  0x3AD0, 0x3AD2, 0x3AD4, 0x3AD6, 0x3AD8, 0x3ADA, 0x3ADC, 0x3ADE,
79  0x3AE0, 0x3AE2, 0x3AE4, 0x3AE6, 0x3AE8, 0x3AEA, 0x3AEC, 0x3AEE,
80  0x3AF0, 0x3AF2, 0x3AF4, 0x3AF6, 0x3AF8, 0x3AFA, 0x3AFC, 0x3AFE,
81  0x0540, 0x0542, 0x0544, 0x0546, 0x0548, 0x054A, 0x054C, 0x054E,
82  0x0558, 0x055E, 0x02AD, 0x0154, 0x0754, 0x03A8, 0x0056, 0x0028,
83  0x00E8, 0x004A, 0x000B, 0x003B, 0x0013, 0x0003, 0x000F, 0x0005,
84  0x0001, 0x0006, 0x0000, 0x0008, 0x001C, 0x0004, 0x0024, 0x004B,
85  0x00E9, 0x0029, 0x0057, 0x03A9, 0x0755, 0x0155, 0x02AE, 0x055F,
86  0x0559, 0x054F, 0x054D, 0x054B, 0x0549, 0x0547, 0x0545, 0x0543,
87  0x0541, 0x3AFF, 0x3AFD, 0x3AFB, 0x3AF9, 0x3AF7, 0x3AF5, 0x3AF3,
88  0x3AF1, 0x3AEF, 0x3AED, 0x3AEB, 0x3AE9, 0x3AE7, 0x3AE5, 0x3AE3,
89  0x3AE1, 0x3ADF, 0x3ADD, 0x3ADB, 0x3AD9, 0x3AD7, 0x3AD5, 0x3AD3,
90  0x3AD1, 0x3ACF, 0x3ACD, 0x3ACB, 0x3AC9, 0x3AC7, 0x3AC5, 0x3AC3,
91  0x3AC1, 0x3ABF, 0x3ABD, 0x3ABB, 0x3AB9, 0x3AB7, 0x3AB5, 0x3AB3,
92  0x3AB1, },
93  { 0x0F60, 0x0F62, 0x0F64, 0x0F66, 0x0F68, 0x0F6A, 0x0F6C, 0x0F6E,
94  0x0F70, 0x0F72, 0x0F74, 0x0F76, 0x0F78, 0x0F7A, 0x0F7C, 0x0F7E,
95  0x0F80, 0x0F82, 0x0F84, 0x0F86, 0x0F88, 0x0F8A, 0x0F8C, 0x0F8E,
96  0x0F90, 0x0F92, 0x0F94, 0x0F96, 0x0F98, 0x0F9A, 0x0F9C, 0x0F9E,
97  0x0FA0, 0x0FA2, 0x0FA4, 0x0FA6, 0x0FA8, 0x0FAA, 0x0FAC, 0x0FAE,
98  0x0FB0, 0x0FB2, 0x0FB4, 0x0FB6, 0x0FB8, 0x0FBA, 0x0FBC, 0x0FBE,
99  0x07A0, 0x07A2, 0x03D2, 0x01EA, 0x00FC, 0x007F, 0x001C, 0x000C,
100  0x0004, 0x0034, 0x0010, 0x001B, 0x0009, 0x000B, 0x000E, 0x0001,
101  0x0003, 0x0002, 0x000F, 0x000C, 0x000A, 0x0000, 0x0011, 0x0035,
102  0x0005, 0x000D, 0x001D, 0x003C, 0x00FD, 0x01EB, 0x03D3, 0x07A3,
103  0x07A1, 0x0FBF, 0x0FBD, 0x0FBB, 0x0FB9, 0x0FB7, 0x0FB5, 0x0FB3,
104  0x0FB1, 0x0FAF, 0x0FAD, 0x0FAB, 0x0FA9, 0x0FA7, 0x0FA5, 0x0FA3,
105  0x0FA1, 0x0F9F, 0x0F9D, 0x0F9B, 0x0F99, 0x0F97, 0x0F95, 0x0F93,
106  0x0F91, 0x0F8F, 0x0F8D, 0x0F8B, 0x0F89, 0x0F87, 0x0F85, 0x0F83,
107  0x0F81, 0x0F7F, 0x0F7D, 0x0F7B, 0x0F79, 0x0F77, 0x0F75, 0x0F73,
108  0x0F71, 0x0F6F, 0x0F6D, 0x0F6B, 0x0F69, 0x0F67, 0x0F65, 0x0F63,
109  0x0F61, },
110  { 0x51D0, 0x51D2, 0x51D4, 0x51D6, 0x51D8, 0x51DA, 0x51DC, 0x51DE,
111  0x51E0, 0x51E2, 0x51E4, 0x51E6, 0x51E8, 0x51EA, 0x51EC, 0x51EE,
112  0x51F0, 0x51F2, 0x51F4, 0x51F6, 0x51F8, 0x51FA, 0x51FC, 0x51FE,
113  0x70C0, 0x70C2, 0x70C4, 0x70C6, 0x70C8, 0x70CA, 0x70CC, 0x70CE,
114  0x70EC, 0x10EA, 0x3868, 0x3877, 0x0876, 0x1C35, 0x0434, 0x0A34,
115  0x0E1B, 0x021B, 0x051B, 0x070F, 0x010F, 0x0380, 0x0080, 0x0140,
116  0x01C1, 0x0041, 0x00A1, 0x00E2, 0x0022, 0x0052, 0x0072, 0x0012,
117  0x002A, 0x003A, 0x000A, 0x0016, 0x001E, 0x0006, 0x000C, 0x0000,
118  0x0004, 0x0001, 0x000D, 0x0007, 0x001F, 0x0017, 0x000B, 0x003B,
119  0x002B, 0x0013, 0x0073, 0x0053, 0x0023, 0x00E3, 0x00A2, 0x0042,
120  0x01C2, 0x0141, 0x0081, 0x0381, 0x028C, 0x010C, 0x051C, 0x021C,
121  0x0E1C, 0x0A35, 0x0435, 0x1C3A, 0x0877, 0x0874, 0x3869, 0x10EB,
122  0x70ED, 0x70CF, 0x70CD, 0x70CB, 0x70C9, 0x70C7, 0x70C5, 0x70C3,
123  0x70C1, 0x51FF, 0x51FD, 0x51FB, 0x51F9, 0x51F7, 0x51F5, 0x51F3,
124  0x51F1, 0x51EF, 0x51ED, 0x51EB, 0x51E9, 0x51E7, 0x51E5, 0x51E3,
125  0x51E1, 0x51DF, 0x51DD, 0x51DB, 0x51D9, 0x51D7, 0x51D5, 0x51D3,
126  0x51D1, },
127  { 0x6F64, 0x6F66, 0x6F68, 0x6F6A, 0x6F6C, 0x6F6E, 0x6F70, 0x6F72,
128  0x6F74, 0x6F76, 0x6F78, 0x6F7A, 0x6F7C, 0x6F7E, 0x6F80, 0x6F82,
129  0x6F84, 0x6F86, 0x6F88, 0x6F8A, 0x6F8C, 0x6F8E, 0x6F90, 0x6F92,
130  0x6F94, 0x6F96, 0x6F98, 0x6F9A, 0x6F9C, 0x6F9E, 0x6FA0, 0x6FA2,
131  0x6FA4, 0x6FA6, 0x6FA8, 0x6FAA, 0x6FAC, 0x6FAE, 0x6FB0, 0x6FB2,
132  0x6FB4, 0x6FB6, 0x17B4, 0x37DC, 0x0BDB, 0x1BEF, 0x05EE, 0x0DF8,
133  0x02F8, 0x06FD, 0x017D, 0x037F, 0x00BF, 0x0040, 0x00C0, 0x0021,
134  0x0061, 0x0011, 0x0031, 0x0009, 0x0019, 0x0006, 0x000E, 0x0004,
135  0x0000, 0x0005, 0x000F, 0x0007, 0x001A, 0x000A, 0x0036, 0x0016,
136  0x006E, 0x002E, 0x00C1, 0x0041, 0x01BC, 0x00BC, 0x037A, 0x017A,
137  0x02F9, 0x0DF9, 0x05EF, 0x05EC, 0x1BD8, 0x37DD, 0x17B5, 0x6FB7,
138  0x6FB5, 0x6FB3, 0x6FB1, 0x6FAF, 0x6FAD, 0x6FAB, 0x6FA9, 0x6FA7,
139  0x6FA5, 0x6FA3, 0x6FA1, 0x6F9F, 0x6F9D, 0x6F9B, 0x6F99, 0x6F97,
140  0x6F95, 0x6F93, 0x6F91, 0x6F8F, 0x6F8D, 0x6F8B, 0x6F89, 0x6F87,
141  0x6F85, 0x6F83, 0x6F81, 0x6F7F, 0x6F7D, 0x6F7B, 0x6F79, 0x6F77,
142  0x6F75, 0x6F73, 0x6F71, 0x6F6F, 0x6F6D, 0x6F6B, 0x6F69, 0x6F67,
143  0x6F65, },
144  { 0xDF54, 0xDF56, 0xDFC8, 0xDFCA, 0xDFCC, 0xDFCE, 0xDFD0, 0xDFD2,
145  0xDFD4, 0xDFD6, 0xDFD8, 0xDFDA, 0xDFDC, 0xDFDE, 0xDFE0, 0xDFE2,
146  0x0FE8, 0x2FEA, 0x6FA8, 0x6FF6, 0x07F5, 0x07F7, 0x37D2, 0x37F9,
147  0x03F8, 0x0BF8, 0x0BFB, 0x1BEB, 0x01FA, 0x05FA, 0x09FA, 0x0DFA,
148  0x0DFF, 0x00FF, 0x02FF, 0x06FB, 0x007C, 0x017C, 0x027C, 0x027F,
149  0x003C, 0x00BC, 0x013C, 0x01BC, 0x001C, 0x005C, 0x009C, 0x00DC,
150  0x000C, 0x002C, 0x004C, 0x006C, 0x0004, 0x0014, 0x0024, 0x0034,
151  0x0000, 0x0008, 0x0010, 0x0018, 0x001E, 0x0002, 0x0006, 0x000A,
152  0x000E, 0x000B, 0x0007, 0x0003, 0x001F, 0x0019, 0x0011, 0x0009,
153  0x0001, 0x0035, 0x0025, 0x0015, 0x0005, 0x006D, 0x004D, 0x002D,
154  0x000D, 0x00DD, 0x009D, 0x005D, 0x001D, 0x01BD, 0x013D, 0x00BD,
155  0x003D, 0x037C, 0x027D, 0x017D, 0x007D, 0x06FC, 0x04FC, 0x02FC,
156  0x00FC, 0x0DFB, 0x09FB, 0x05FB, 0x01FB, 0x1BF8, 0x1BE8, 0x0BF9,
157  0x03F9, 0x37FA, 0x37D3, 0x17F4, 0x07F6, 0x6FF7, 0x6FA9, 0x2FEB,
158  0x0FE9, 0xDFE3, 0xDFE1, 0xDFDF, 0xDFDD, 0xDFDB, 0xDFD9, 0xDFD7,
159  0xDFD5, 0xDFD3, 0xDFD1, 0xDFCF, 0xDFCD, 0xDFCB, 0xDFC9, 0xDF57,
160  0xDF55, }
161 };
162 
163 static const uint8_t scales_bits[SCALES_COUNT][129] = {
164  { 14, 14, 14, 14, 14, 14, 14, 14,
165  14, 14, 14, 14, 14, 14, 14, 14,
166  14, 14, 14, 14, 14, 14, 14, 14,
167  14, 14, 14, 14, 14, 14, 14, 14,
168  14, 14, 14, 14, 14, 14, 14, 14,
169  13, 13, 13, 13, 13, 13, 13, 13,
170  13, 13, 12, 11, 11, 10, 9, 8,
171  8, 7, 6, 6, 5, 4, 4, 3,
172  2, 3, 3, 4, 5, 5, 6, 7,
173  8, 8, 9, 10, 11, 11, 12, 13,
174  13, 13, 13, 13, 13, 13, 13, 13,
175  13, 14, 14, 14, 14, 14, 14, 14,
176  14, 14, 14, 14, 14, 14, 14, 14,
177  14, 14, 14, 14, 14, 14, 14, 14,
178  14, 14, 14, 14, 14, 14, 14, 14,
179  14, 14, 14, 14, 14, 14, 14, 14,
180  14, },
181  { 15, 15, 15, 15, 15, 15, 15, 15,
182  15, 15, 15, 15, 15, 15, 15, 15,
183  15, 15, 15, 15, 15, 15, 15, 15,
184  15, 15, 15, 15, 15, 15, 15, 15,
185  15, 15, 15, 15, 15, 15, 15, 15,
186  15, 15, 15, 15, 15, 15, 15, 15,
187  14, 14, 13, 12, 11, 10, 8, 7,
188  6, 6, 5, 5, 4, 4, 4, 3,
189  3, 3, 4, 4, 4, 4, 5, 6,
190  6, 7, 8, 9, 11, 12, 13, 14,
191  14, 15, 15, 15, 15, 15, 15, 15,
192  15, 15, 15, 15, 15, 15, 15, 15,
193  15, 15, 15, 15, 15, 15, 15, 15,
194  15, 15, 15, 15, 15, 15, 15, 15,
195  15, 15, 15, 15, 15, 15, 15, 15,
196  15, 15, 15, 15, 15, 15, 15, 15,
197  15, },
198  { 15, 15, 15, 15, 15, 15, 15, 15,
199  15, 15, 15, 15, 15, 15, 15, 15,
200  15, 15, 15, 15, 15, 15, 15, 15,
201  15, 15, 15, 15, 15, 15, 15, 15,
202  15, 14, 14, 14, 13, 13, 12, 12,
203  12, 11, 11, 11, 10, 10, 9, 9,
204  9, 8, 8, 8, 7, 7, 7, 6,
205  6, 6, 5, 5, 5, 4, 4, 3,
206  3, 3, 4, 4, 5, 5, 5, 6,
207  6, 6, 7, 7, 7, 8, 8, 8,
208  9, 9, 9, 10, 10, 10, 11, 11,
209  12, 12, 12, 13, 13, 13, 14, 14,
210  15, 15, 15, 15, 15, 15, 15, 15,
211  15, 15, 15, 15, 15, 15, 15, 15,
212  15, 15, 15, 15, 15, 15, 15, 15,
213  15, 15, 15, 15, 15, 15, 15, 15,
214  15, },
215  { 15, 15, 15, 15, 15, 15, 15, 15,
216  15, 15, 15, 15, 15, 15, 15, 15,
217  15, 15, 15, 15, 15, 15, 15, 15,
218  15, 15, 15, 15, 15, 15, 15, 15,
219  15, 15, 15, 15, 15, 15, 15, 15,
220  15, 15, 14, 14, 13, 13, 12, 12,
221  11, 11, 10, 10, 9, 8, 8, 7,
222  7, 6, 6, 5, 5, 4, 4, 3,
223  2, 3, 4, 4, 5, 5, 6, 6,
224  7, 7, 8, 8, 9, 9, 10, 10,
225  11, 12, 12, 12, 13, 14, 14, 15,
226  15, 15, 15, 15, 15, 15, 15, 15,
227  15, 15, 15, 15, 15, 15, 15, 15,
228  15, 15, 15, 15, 15, 15, 15, 15,
229  15, 15, 15, 15, 15, 15, 15, 15,
230  15, 15, 15, 15, 15, 15, 15, 15,
231  15, },
232  { 16, 16, 16, 16, 16, 16, 16, 16,
233  16, 16, 16, 16, 16, 16, 16, 16,
234  15, 15, 15, 15, 14, 14, 14, 14,
235  13, 13, 13, 13, 12, 12, 12, 12,
236  12, 11, 11, 11, 10, 10, 10, 10,
237  9, 9, 9, 9, 8, 8, 8, 8,
238  7, 7, 7, 7, 6, 6, 6, 6,
239  5, 5, 5, 5, 5, 4, 4, 4,
240  4, 4, 4, 4, 5, 5, 5, 5,
241  5, 6, 6, 6, 6, 7, 7, 7,
242  7, 8, 8, 8, 8, 9, 9, 9,
243  9, 10, 10, 10, 10, 11, 11, 11,
244  11, 12, 12, 12, 12, 13, 13, 13,
245  13, 14, 14, 14, 14, 15, 15, 15,
246  15, 16, 16, 16, 16, 16, 16, 16,
247  16, 16, 16, 16, 16, 16, 16, 16,
248  16,
249  }
250 };
251 
252 static const uint16_t bitalloc_3_codes[3] = {
253  0x0003, 0x0000, 0x0002,
254 };
255 
256 static const uint8_t bitalloc_3_bits[3] = {
257  2, 1, 2,
258 };
259 
260 static const uint16_t bitalloc_5_codes_a[5] = {
261  0x000F, 0x0006, 0x0000, 0x0002, 0x000E,
262 };
263 
264 static const uint16_t bitalloc_5_codes_b[5] = {
265  0x0007, 0x0001, 0x0002, 0x0000, 0x0006,
266 };
267 
268 static const uint16_t bitalloc_5_codes_c[5] = {
269  0x0007, 0x0005, 0x0000, 0x0004, 0x0006,
270 };
271 
272 static const uint8_t bitalloc_5_bits_a[5] = {
273  4, 3, 1, 2, 4,
274 };
275 
276 static const uint8_t bitalloc_5_bits_b[5] = {
277  3, 2, 2, 2, 3,
278 };
279 
280 static const uint8_t bitalloc_5_bits_c[5] = {
281  3, 3, 1, 3, 3,
282 };
283 
284 static const uint16_t bitalloc_7_codes_a[7] = {
285  0x001E, 0x000E, 0x0005, 0x0000, 0x0006, 0x0004, 0x001F,
286 };
287 
288 static const uint16_t bitalloc_7_codes_b[7] = {
289  0x0014, 0x000B, 0x0000, 0x0003, 0x0001, 0x0004, 0x0015,
290 };
291 
292 static const uint16_t bitalloc_7_codes_c[7] = {
293  0x0000, 0x0002, 0x0001, 0x0003, 0x0002, 0x0003, 0x0001,
294 };
295 
296 static const uint8_t bitalloc_7_bits_a[7] = {
297  5, 4, 3, 1, 3, 3, 5,
298 };
299 
300 static const uint8_t bitalloc_7_bits_b[7] = {
301  5, 4, 2, 2, 2, 3, 5,
302 };
303 
304 static const uint8_t bitalloc_7_bits_c[7] = {
305  4, 4, 2, 2, 2, 4, 4,
306 };
307 
308 static const uint16_t bitalloc_9_codes_a[9] = {
309  0x0030, 0x0019, 0x0009, 0x0005, 0x0000, 0x0007, 0x000D, 0x0008,
310  0x0031,
311 };
312 
313 static const uint16_t bitalloc_9_codes_b[9] = {
314  0x0018, 0x001A, 0x0002, 0x0007, 0x0002, 0x0000, 0x0003, 0x001B,
315  0x0019,
316 };
317 
318 static const uint16_t bitalloc_9_codes_c[9] = {
319  0x001C, 0x000F, 0x0002, 0x0007, 0x0002, 0x0000, 0x0006, 0x0006,
320  0x001D,
321 };
322 
323 static const uint8_t bitalloc_9_bits_a[9] = {
324  6, 5, 4, 3, 1, 3, 4, 4, 6,
325 };
326 
327 static const uint8_t bitalloc_9_bits_b[9] = {
328  5, 5, 3, 3, 2, 2, 3, 5, 5,
329 };
330 
331 static const uint8_t bitalloc_9_bits_c[9] = {
332  6, 5, 3, 3, 2, 2, 3, 4, 6,
333 };
334 
335 static const uint16_t bitalloc_13_codes_a[13] = {
336  0x0070, 0x002E, 0x0039, 0x001D, 0x000C, 0x000F, 0x0000, 0x0004,
337  0x000D, 0x000A, 0x0016, 0x002F, 0x0071,
338 };
339 
340 static const uint16_t bitalloc_13_codes_b[13] = {
341  0x0038, 0x0010, 0x001D, 0x0007, 0x000F, 0x0005, 0x0000, 0x0006,
342  0x0002, 0x0009, 0x0006, 0x0011, 0x0039,
343 };
344 
345 static const uint16_t bitalloc_13_codes_c[13] = {
346  0x0004, 0x001A, 0x0003, 0x000E, 0x0000, 0x0003, 0x0005, 0x0004,
347  0x0002, 0x000F, 0x000C, 0x001B, 0x0005,
348 };
349 
350 static const uint8_t bitalloc_13_bits_a[13] = {
351  7, 6, 6, 5, 4, 4, 1, 3, 4, 4, 5, 6, 7,
352 };
353 
354 static const uint8_t bitalloc_13_bits_b[13] = {
355  6, 5, 5, 4, 4, 3, 2, 3, 3, 4, 4, 5, 6,
356 };
357 
358 static const uint8_t bitalloc_13_bits_c[13] = {
359  5, 5, 4, 4, 3, 3, 3, 3, 3, 4, 4, 5, 5,
360 };
361 
362 static const uint16_t bitalloc_17_codes_a[17] = {
363  0x0154, 0x00AB, 0x002B, 0x000B, 0x0003, 0x000A, 0x0001, 0x0006,
364  0x0001, 0x0007, 0x0004, 0x000B, 0x0000, 0x0004, 0x0014, 0x0054,
365  0x0155,
366 };
367 
368 static const uint16_t bitalloc_17_codes_b[17] = {
369  0x007C, 0x003F, 0x0019, 0x000D, 0x001C, 0x0008, 0x000F, 0x0005,
370  0x0000, 0x0006, 0x0002, 0x0009, 0x001D, 0x000E, 0x001E, 0x0018,
371  0x007D,
372 };
373 
374 static const uint16_t bitalloc_17_codes_c[17] = {
375  0x002C, 0x0017, 0x0005, 0x001C, 0x0003, 0x000A, 0x000F, 0x0003,
376  0x0006, 0x0004, 0x0000, 0x000B, 0x0004, 0x001D, 0x000A, 0x0004,
377  0x002D,
378 };
379 
380 static const uint16_t bitalloc_17_codes_d[17] = {
381  0x0100, 0x0102, 0x0082, 0x0042, 0x0022, 0x0012, 0x000A, 0x0006,
382  0x0000, 0x0007, 0x000B, 0x0013, 0x0023, 0x0043, 0x0083, 0x0103,
383  0x0101,
384 };
385 
386 static const uint16_t bitalloc_17_codes_e[17] = {
387  0x00E8, 0x00F6, 0x0075, 0x0034, 0x003B, 0x001B, 0x001F, 0x0004,
388  0x0000, 0x0005, 0x000C, 0x001C, 0x003C, 0x0035, 0x007A, 0x00F7,
389  0x00E9,
390 };
391 
392 static const uint16_t bitalloc_17_codes_f[17] = {
393  0x0004, 0x0003, 0x001E, 0x0001, 0x0001, 0x000E, 0x0001, 0x0004,
394  0x0006, 0x0005, 0x0002, 0x000F, 0x0006, 0x000E, 0x001F, 0x0000,
395  0x0005,
396 };
397 
398 static const uint16_t bitalloc_17_codes_g[17] = {
399  0x0060, 0x007E, 0x0031, 0x0019, 0x000D, 0x0004, 0x0000, 0x0006,
400  0x0002, 0x0007, 0x0001, 0x0005, 0x000E, 0x001E, 0x003E, 0x007F,
401  0x0061,
402 };
403 
404 static const uint8_t bitalloc_17_bits_a[17] = {
405  12, 11, 9, 7, 5, 4, 3, 3, 2, 3, 3, 4, 4, 6, 8, 10,
406  12,
407 };
408 
409 static const uint8_t bitalloc_17_bits_b[17] = {
410  8, 7, 6, 5, 5, 4, 4, 3, 2, 3, 3, 4, 5, 5, 6, 6,
411  8,
412 };
413 
414 static const uint8_t bitalloc_17_bits_c[17] = {
415  7, 6, 5, 5, 4, 4, 4, 3, 3, 3, 3, 4, 4, 5, 5, 5,
416  7,
417 };
418 
419 static const uint8_t bitalloc_17_bits_d[17] = {
420  9, 9, 8, 7, 6, 5, 4, 3, 1, 3, 4, 5, 6, 7, 8, 9,
421  9,
422 };
423 
424 static const uint8_t bitalloc_17_bits_e[17] = {
425  8, 8, 7, 6, 6, 5, 5, 3, 1, 3, 4, 5, 6, 6, 7, 8,
426  8,
427 };
428 
429 static const uint8_t bitalloc_17_bits_f[17] = {
430  8, 7, 6, 5, 4, 4, 3, 3, 3, 3, 3, 4, 4, 5, 6, 6,
431  8,
432 };
433 
434 static const uint8_t bitalloc_17_bits_g[17] = {
435  8, 8, 7, 6, 5, 4, 3, 3, 2, 3, 3, 4, 5, 6, 7, 8,
436  8,
437 };
438 
439 static const uint16_t bitalloc_25_codes_a[25] = {
440  0x2854, 0x142B, 0x050B, 0x0143, 0x00A2, 0x0052, 0x002E, 0x0015,
441  0x0004, 0x000E, 0x0000, 0x0003, 0x0006, 0x0004, 0x0001, 0x000F,
442  0x0005, 0x0016, 0x002F, 0x0053, 0x00A3, 0x00A0, 0x0284, 0x0A14,
443  0x2855,
444 };
445 
446 static const uint16_t bitalloc_25_codes_b[25] = {
447  0x001C, 0x000F, 0x0005, 0x0000, 0x0030, 0x0036, 0x000E, 0x0019,
448  0x0001, 0x0008, 0x000E, 0x0001, 0x0005, 0x0002, 0x000F, 0x0009,
449  0x0006, 0x001A, 0x000F, 0x0037, 0x0031, 0x0001, 0x0006, 0x0004,
450  0x001D,
451 };
452 
453 static const uint16_t bitalloc_25_codes_c[25] = {
454  0x004C, 0x0027, 0x006D, 0x0028, 0x0037, 0x000E, 0x0015, 0x0000,
455  0x0005, 0x0008, 0x000B, 0x000E, 0x0001, 0x000F, 0x000C, 0x0009,
456  0x0006, 0x0001, 0x001A, 0x000F, 0x0008, 0x0029, 0x0012, 0x006C,
457  0x004D,
458 };
459 
460 static const uint16_t bitalloc_25_codes_d[25] = {
461  0x0780, 0x0782, 0x03C2, 0x01E2, 0x00FE, 0x0079, 0x003D, 0x001C,
462  0x000C, 0x0004, 0x0000, 0x0006, 0x0002, 0x0007, 0x0001, 0x0005,
463  0x000D, 0x001D, 0x003E, 0x007E, 0x00FF, 0x01E3, 0x03C3, 0x0783,
464  0x0781,
465 };
466 
467 static const uint16_t bitalloc_25_codes_e[25] = {
468  0x003C, 0x0092, 0x0018, 0x001F, 0x004E, 0x000D, 0x0025, 0x0004,
469  0x0010, 0x0000, 0x000A, 0x0002, 0x0003, 0x0003, 0x000B, 0x0001,
470  0x0011, 0x0005, 0x0026, 0x000E, 0x004F, 0x0048, 0x0019, 0x0093,
471  0x003D,
472 };
473 
474 static const uint16_t bitalloc_25_codes_f[25] = {
475  0x0324, 0x0193, 0x00CE, 0x0065, 0x0024, 0x000C, 0x0013, 0x0004,
476  0x0007, 0x000A, 0x000D, 0x000F, 0x0001, 0x0000, 0x000E, 0x000B,
477  0x0008, 0x0005, 0x0018, 0x000D, 0x0025, 0x0066, 0x00CF, 0x00C8,
478  0x0325,
479 };
480 
481 static const uint16_t bitalloc_25_codes_g[25] = {
482  0x03A8, 0x03AE, 0x01D5, 0x0094, 0x0014, 0x004B, 0x000B, 0x003B,
483  0x0013, 0x0003, 0x000F, 0x0005, 0x0001, 0x0006, 0x0000, 0x0008,
484  0x001C, 0x0004, 0x0024, 0x0074, 0x0015, 0x0095, 0x01D6, 0x03AF,
485  0x03A9,
486 };
487 
488 static const uint8_t bitalloc_25_bits_a[25] = {
489  14, 13, 11, 9, 8, 7, 6, 5, 4, 4, 3, 3, 3, 3, 3, 4,
490  4, 5, 6, 7, 8, 8, 10, 12, 14,
491 };
492 
493 static const uint8_t bitalloc_25_bits_b[25] = {
494  9, 8, 7, 6, 6, 6, 5, 5, 4, 4, 4, 3, 3, 3, 4, 4,
495  4, 5, 5, 6, 6, 6, 7, 7, 9,
496 };
497 
498 static const uint8_t bitalloc_25_bits_c[25] = {
499  8, 7, 7, 6, 6, 5, 5, 4, 4, 4, 4, 4, 3, 4, 4, 4,
500  4, 4, 5, 5, 5, 6, 6, 7, 8,
501 };
502 
503 static const uint8_t bitalloc_25_bits_d[25] = {
504  12, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 3, 2, 3, 3, 4,
505  5, 6, 7, 8, 9, 10, 11, 12, 12,
506 };
507 
508 static const uint8_t bitalloc_25_bits_e[25] = {
509  8, 8, 7, 7, 7, 6, 6, 5, 5, 4, 4, 3, 2, 3, 4, 4,
510  5, 5, 6, 6, 7, 7, 7, 8, 8,
511 };
512 
513 static const uint8_t bitalloc_25_bits_f[25] = {
514  10, 9, 8, 7, 6, 5, 5, 4, 4, 4, 4, 4, 3, 3, 4, 4,
515  4, 4, 5, 5, 6, 7, 8, 8, 10,
516 };
517 
518 static const uint8_t bitalloc_25_bits_g[25] = {
519  10, 10, 9, 8, 7, 7, 6, 6, 5, 4, 4, 3, 2, 3, 3, 4,
520  5, 5, 6, 7, 7, 8, 9, 10, 10,
521 };
522 
523 static const uint16_t bitalloc_33_codes_a[33] = {
524  0x1580, 0x1582, 0x0AC2, 0x0562, 0x02B2, 0x015E, 0x00AD, 0x0054,
525  0x001C, 0x003C, 0x000F, 0x001F, 0x0008, 0x000B, 0x000D, 0x0000,
526  0x0002, 0x0001, 0x000E, 0x000C, 0x0009, 0x0006, 0x0014, 0x003D,
527  0x001D, 0x0055, 0x00AE, 0x015F, 0x02B3, 0x0563, 0x0AC3, 0x1583,
528  0x1581,
529 };
530 
531 static const uint16_t bitalloc_33_codes_b[33] = {
532  0x030C, 0x0187, 0x006D, 0x0028, 0x0037, 0x0066, 0x0015, 0x0031,
533  0x0000, 0x000B, 0x0012, 0x001A, 0x0001, 0x0007, 0x000A, 0x000E,
534  0x0001, 0x000F, 0x000B, 0x0008, 0x0004, 0x001B, 0x0013, 0x000C,
535  0x0001, 0x0032, 0x001A, 0x0067, 0x0060, 0x0029, 0x00C2, 0x006C,
536  0x030D,
537 };
538 
539 static const uint16_t bitalloc_33_codes_c[33] = {
540  0x00CC, 0x0067, 0x0005, 0x0070, 0x0003, 0x001A, 0x0039, 0x003F,
541  0x000A, 0x0012, 0x0018, 0x001D, 0x0001, 0x0003, 0x0007, 0x000A,
542  0x000D, 0x000B, 0x0008, 0x0004, 0x0002, 0x001E, 0x0019, 0x0013,
543  0x000B, 0x0000, 0x003E, 0x001B, 0x0018, 0x0071, 0x0032, 0x0004,
544  0x00CD,
545 };
546 
547 static const uint16_t bitalloc_33_codes_d[33] = {
548  0x3AF8, 0x3AFA, 0x1D7E, 0x0EBC, 0x075C, 0x03AC, 0x01D4, 0x0094,
549  0x0014, 0x004B, 0x000B, 0x003B, 0x0013, 0x0003, 0x000F, 0x0005,
550  0x0001, 0x0006, 0x0000, 0x0008, 0x001C, 0x0004, 0x0024, 0x0074,
551  0x0015, 0x0095, 0x01D5, 0x03AD, 0x075D, 0x0EBD, 0x1D7F, 0x3AFB,
552  0x3AF9,
553 };
554 
555 static const uint16_t bitalloc_33_codes_e[33] = {
556  0x01C8, 0x01E6, 0x0064, 0x00E2, 0x00E5, 0x0030, 0x0033, 0x0073,
557  0x007A, 0x001A, 0x003A, 0x0002, 0x001A, 0x001F, 0x0007, 0x0001,
558  0x0002, 0x0002, 0x000C, 0x0000, 0x001B, 0x0003, 0x003B, 0x001B,
559  0x007B, 0x0078, 0x0070, 0x0031, 0x00F2, 0x00E3, 0x0065, 0x01E7,
560  0x01C9,
561 };
562 
563 static const uint16_t bitalloc_33_codes_f[33] = {
564  0x0724, 0x0393, 0x01CE, 0x00E5, 0x002C, 0x0008, 0x0017, 0x003E,
565  0x0005, 0x0014, 0x001D, 0x0000, 0x0003, 0x0006, 0x0008, 0x000B,
566  0x000D, 0x000C, 0x0009, 0x0007, 0x0004, 0x0001, 0x001E, 0x0015,
567  0x000A, 0x003F, 0x0038, 0x0009, 0x002D, 0x00E6, 0x01CF, 0x01C8,
568  0x0725,
569 };
570 
571 static const uint16_t bitalloc_33_codes_g[33] = {
572  0x0284, 0x0042, 0x0140, 0x0143, 0x003E, 0x00BE, 0x0011, 0x0051,
573  0x0009, 0x0029, 0x0005, 0x0015, 0x0000, 0x0008, 0x000E, 0x0002,
574  0x0006, 0x0003, 0x000F, 0x0009, 0x0001, 0x0016, 0x0006, 0x002E,
575  0x000E, 0x005E, 0x001E, 0x00BF, 0x003F, 0x0020, 0x0141, 0x0043,
576  0x0285,
577 };
578 
579 static const uint8_t bitalloc_33_bits_a[33] = {
580  13, 13, 12, 11, 10, 9, 8, 7, 6, 6, 5, 5, 4, 4, 4, 3,
581  3, 3, 4, 4, 4, 4, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13,
582  13,
583 };
584 
585 static const uint8_t bitalloc_33_bits_b[33] = {
586  10, 9, 8, 7, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
587  3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8,
588  10,
589 };
590 
591 static const uint8_t bitalloc_33_bits_c[33] = {
592  9, 8, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4,
593  4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7,
594  9,
595 };
596 
597 static const uint8_t bitalloc_33_bits_d[33] = {
598  14, 14, 13, 12, 11, 10, 9, 8, 7, 7, 6, 6, 5, 4, 4, 3,
599  2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14,
600  14,
601 };
602 
603 static const uint8_t bitalloc_33_bits_e[33] = {
604  9, 9, 8, 8, 8, 7, 7, 7, 7, 6, 6, 5, 5, 5, 4, 3,
605  2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9,
606  9,
607 };
608 
609 static const uint8_t bitalloc_33_bits_f[33] = {
610  11, 10, 9, 8, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 4, 4,
611  4, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 9, 9,
612  11,
613 };
614 
615 static const uint8_t bitalloc_33_bits_g[33] = {
616  10, 9, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 4, 3,
617  3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9,
618  10,
619 };
620 
621 static const uint16_t bitalloc_65_codes_a[65] = {
622  0x9E5C, 0x9E5E, 0x4F2C, 0x2794, 0x13C4, 0x1E44, 0x09E3, 0x0F23,
623  0x04F3, 0x0792, 0x027E, 0x03CE, 0x013D, 0x01E5, 0x009C, 0x00CC,
624  0x0040, 0x0058, 0x0067, 0x001E, 0x0021, 0x002D, 0x003D, 0x0007,
625  0x0011, 0x0014, 0x0017, 0x001A, 0x001C, 0x001F, 0x0001, 0x0004,
626  0x0006, 0x0005, 0x0002, 0x0000, 0x001D, 0x001B, 0x0018, 0x0015,
627  0x0012, 0x000E, 0x0006, 0x0032, 0x0026, 0x001F, 0x0078, 0x0059,
628  0x0041, 0x00CD, 0x009D, 0x01E6, 0x013E, 0x03CF, 0x027F, 0x0793,
629  0x0790, 0x04F0, 0x09E4, 0x1E45, 0x13C5, 0x2795, 0x4F2D, 0x9E5F,
630  0x9E5D,
631 };
632 
633 static const uint16_t bitalloc_65_codes_b[65] = {
634  0x0A8C, 0x0547, 0x01B5, 0x0008, 0x00DB, 0x0152, 0x0005, 0x000B,
635  0x008E, 0x00AE, 0x00E4, 0x0003, 0x0037, 0x0039, 0x0055, 0x006C,
636  0x0073, 0x0003, 0x0015, 0x001D, 0x0028, 0x0030, 0x0037, 0x003E,
637  0x0006, 0x000B, 0x000F, 0x0012, 0x0016, 0x0019, 0x001D, 0x0001,
638  0x0004, 0x0002, 0x001E, 0x001A, 0x0017, 0x0013, 0x0010, 0x000C,
639  0x0007, 0x003F, 0x0038, 0x0031, 0x0029, 0x0022, 0x001A, 0x0014,
640  0x0000, 0x006D, 0x0056, 0x0046, 0x0038, 0x0004, 0x00E5, 0x00AF,
641  0x008F, 0x006C, 0x000A, 0x0153, 0x0150, 0x0009, 0x02A2, 0x01B4,
642  0x0A8D,
643 };
644 
645 static const uint16_t bitalloc_65_codes_c[65] = {
646  0x045C, 0x022F, 0x03F5, 0x01BC, 0x01FB, 0x0059, 0x00D0, 0x00DF,
647  0x000A, 0x002D, 0x002F, 0x0052, 0x0069, 0x0078, 0x007F, 0x000A,
648  0x0010, 0x001C, 0x0023, 0x002A, 0x0035, 0x003A, 0x003D, 0x0000,
649  0x0003, 0x0006, 0x0009, 0x000C, 0x000F, 0x0012, 0x0016, 0x0018,
650  0x001C, 0x0019, 0x0017, 0x0013, 0x0010, 0x000D, 0x000A, 0x0007,
651  0x0004, 0x0001, 0x003E, 0x003B, 0x0036, 0x002B, 0x0028, 0x001D,
652  0x0011, 0x000B, 0x0004, 0x0079, 0x006E, 0x0053, 0x0044, 0x002E,
653  0x000B, 0x00FC, 0x00D1, 0x008A, 0x0058, 0x01BD, 0x0116, 0x03F4,
654  0x045D,
655 };
656 
657 static const uint16_t bitalloc_65_codes_d[65] = {
658  0x70B0, 0x70B2, 0x70B4, 0x2852, 0x385B, 0x142E, 0x1C2E, 0x0A15,
659  0x0E14, 0x0214, 0x0704, 0x0104, 0x010B, 0x0383, 0x0083, 0x0143,
660  0x01C3, 0x0043, 0x00A2, 0x00E2, 0x0022, 0x0052, 0x0072, 0x0012,
661  0x002A, 0x003A, 0x000A, 0x0016, 0x001E, 0x0006, 0x000C, 0x0000,
662  0x0004, 0x0001, 0x000D, 0x0007, 0x001F, 0x0017, 0x000B, 0x003B,
663  0x002B, 0x0013, 0x0073, 0x0053, 0x0023, 0x00E3, 0x00A3, 0x00A0,
664  0x0040, 0x01C0, 0x0084, 0x0384, 0x0284, 0x0105, 0x0705, 0x0215,
665  0x0E15, 0x0A16, 0x1C2F, 0x142F, 0x1428, 0x2853, 0x70B5, 0x70B3,
666  0x70B1,
667 };
668 
669 static const uint16_t bitalloc_65_codes_e[65] = {
670  0x032C, 0x0332, 0x0378, 0x037E, 0x008C, 0x014A, 0x0188, 0x0197,
671  0x019E, 0x01BD, 0x0044, 0x0047, 0x00AA, 0x00C5, 0x00CD, 0x00DC,
672  0x001C, 0x002C, 0x0053, 0x0063, 0x0068, 0x0008, 0x000F, 0x0017,
673  0x002B, 0x0035, 0x0005, 0x0009, 0x0016, 0x001C, 0x0006, 0x000F,
674  0x0004, 0x0000, 0x0007, 0x001D, 0x0017, 0x000A, 0x0006, 0x0036,
675  0x0030, 0x0028, 0x0010, 0x0009, 0x0069, 0x0064, 0x0054, 0x002D,
676  0x001D, 0x00DD, 0x00CE, 0x00CA, 0x00AB, 0x00A4, 0x0045, 0x01BE,
677  0x019F, 0x0198, 0x0189, 0x014B, 0x008D, 0x037F, 0x0379, 0x0333,
678  0x032D,
679 };
680 
681 static const uint16_t bitalloc_65_codes_f[65] = {
682  0x0FE0, 0x0FE2, 0x0FE8, 0x0FEA, 0x0FEC, 0x0FEE, 0x0FF0, 0x0FF2,
683  0x0FF4, 0x2FF2, 0x07F2, 0x07FB, 0x03F6, 0x0BFA, 0x0BFD, 0x01FF,
684  0x05FF, 0x02FC, 0x007C, 0x017C, 0x003C, 0x00BC, 0x001C, 0x005C,
685  0x000C, 0x002C, 0x0004, 0x0014, 0x0000, 0x0008, 0x000E, 0x0002,
686  0x0006, 0x0003, 0x000F, 0x0009, 0x0001, 0x0015, 0x0005, 0x002D,
687  0x000D, 0x005D, 0x001D, 0x00BD, 0x003D, 0x017D, 0x007D, 0x02FD,
688  0x00FC, 0x05FC, 0x01FA, 0x0BFB, 0x03F7, 0x17F8, 0x07F3, 0x2FF3,
689  0x0FF5, 0x0FF3, 0x0FF1, 0x0FEF, 0x0FED, 0x0FEB, 0x0FE9, 0x0FE3,
690  0x0FE1,
691 };
692 
693 static const uint16_t bitalloc_65_codes_g[65] = {
694  0x010C, 0x038A, 0x0608, 0x0786, 0x0084, 0x0087, 0x0302, 0x0305,
695  0x0040, 0x00E0, 0x00E3, 0x0183, 0x001E, 0x005E, 0x009E, 0x00DE,
696  0x00F1, 0x0011, 0x0039, 0x0061, 0x0079, 0x0009, 0x001D, 0x0031,
697  0x003D, 0x0005, 0x000F, 0x0019, 0x001F, 0x0003, 0x0006, 0x000A,
698  0x000E, 0x000B, 0x0008, 0x0004, 0x0000, 0x001A, 0x0012, 0x000A,
699  0x0002, 0x0036, 0x0026, 0x0016, 0x0006, 0x006E, 0x004E, 0x002E,
700  0x000E, 0x00DF, 0x009F, 0x005F, 0x001F, 0x01E0, 0x0180, 0x00E1,
701  0x0041, 0x03C2, 0x0303, 0x01C4, 0x0085, 0x0787, 0x0609, 0x038B,
702  0x010D,
703 };
704 
705 static const uint8_t bitalloc_65_bits_a[65] = {
706  16, 16, 15, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8,
707  7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 4, 4,
708  4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 7, 7,
709  7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 13, 13, 14, 15, 16,
710  16,
711 };
712 
713 static const uint8_t bitalloc_65_bits_b[65] = {
714  12, 11, 10, 9, 9, 9, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7,
715  7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 4,
716  4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6,
717  6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 10, 10,
718  12,
719 };
720 
721 static const uint8_t bitalloc_65_bits_c[65] = {
722  11, 10, 10, 9, 9, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 6,
723  6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5,
724  5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
725  6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 10,
726  11,
727 };
728 
729 static const uint8_t bitalloc_65_bits_d[65] = {
730  15, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 10, 9, 9,
731  9, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 3,
732  3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8,
733  8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 15, 15,
734  15,
735 };
736 
737 static const uint8_t bitalloc_65_bits_e[65] = {
738  10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8,
739  7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4,
740  3, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7,
741  7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10,
742  10,
743 };
744 
745 static const uint8_t bitalloc_65_bits_f[65] = {
746  14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 13, 12, 12, 12, 11,
747  11, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 4, 3,
748  3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10,
749  10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14,
750  14,
751 };
752 
753 static const uint8_t bitalloc_65_bits_g[65] = {
754  11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8,
755  8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4,
756  4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7,
757  7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11,
758  11,
759 };
760 
761 static const uint16_t bitalloc_129_codes_a[129] = {
762  0x0660, 0x0666, 0x06EC, 0x0722, 0x0760, 0x076E, 0x004C, 0x004E,
763  0x00F4, 0x010A, 0x0148, 0x0156, 0x01D4, 0x01F2, 0x0331, 0x0370,
764  0x0377, 0x0396, 0x03B1, 0x0024, 0x0064, 0x007B, 0x008A, 0x00A5,
765  0x00D4, 0x00EB, 0x00FA, 0x019A, 0x01B9, 0x01C9, 0x01D9, 0x0010,
766  0x0030, 0x0033, 0x0043, 0x0053, 0x006B, 0x007A, 0x00CA, 0x00D2,
767  0x00DE, 0x00E6, 0x00F6, 0x000E, 0x001F, 0x0023, 0x002B, 0x003B,
768  0x003F, 0x0067, 0x0070, 0x0077, 0x0005, 0x000D, 0x0012, 0x001B,
769  0x002C, 0x0035, 0x003A, 0x0004, 0x000B, 0x0017, 0x001F, 0x0009,
770  0x0008, 0x000A, 0x0000, 0x0018, 0x000C, 0x0005, 0x003C, 0x0036,
771  0x002D, 0x001C, 0x0013, 0x000E, 0x0006, 0x007A, 0x0071, 0x0068,
772  0x0064, 0x003C, 0x0034, 0x0028, 0x0020, 0x000F, 0x00F7, 0x00E7,
773  0x00DF, 0x00D3, 0x00CB, 0x007B, 0x0074, 0x0054, 0x0044, 0x003C,
774  0x0031, 0x0011, 0x01DA, 0x01CA, 0x01BA, 0x019B, 0x00FB, 0x00F8,
775  0x00D5, 0x00AA, 0x008B, 0x0084, 0x0065, 0x0025, 0x03B6, 0x0397,
776  0x0390, 0x0371, 0x0332, 0x01F3, 0x01D5, 0x0157, 0x0149, 0x010B,
777  0x00F5, 0x004F, 0x004D, 0x076F, 0x0761, 0x0723, 0x06ED, 0x0667,
778  0x0661,
779 };
780 
781 static const uint16_t bitalloc_129_codes_b[129] = {
782  0x29DC, 0x14EF, 0x0455, 0x0E9C, 0x022B, 0x0489, 0x0740, 0x074F,
783  0x0172, 0x0245, 0x0247, 0x030A, 0x03A1, 0x001C, 0x008B, 0x00D6,
784  0x010C, 0x0148, 0x014F, 0x0186, 0x01D1, 0x0008, 0x000F, 0x0046,
785  0x005D, 0x0078, 0x0087, 0x0096, 0x00A5, 0x00BC, 0x00D8, 0x00DE,
786  0x00F6, 0x0005, 0x0014, 0x0024, 0x002F, 0x003A, 0x003D, 0x0049,
787  0x0050, 0x0058, 0x005F, 0x0066, 0x006D, 0x0075, 0x007C, 0x0004,
788  0x000B, 0x0013, 0x0018, 0x001B, 0x001F, 0x0022, 0x0026, 0x002A,
789  0x002D, 0x0031, 0x0034, 0x0038, 0x003B, 0x003F, 0x0003, 0x0006,
790  0x000A, 0x0007, 0x0004, 0x0000, 0x003C, 0x0039, 0x0035, 0x0032,
791  0x002E, 0x002B, 0x0027, 0x0023, 0x0020, 0x001C, 0x0019, 0x0016,
792  0x0010, 0x0005, 0x007D, 0x007A, 0x006E, 0x0067, 0x0060, 0x0059,
793  0x0051, 0x004A, 0x0042, 0x003B, 0x0034, 0x0025, 0x0015, 0x0006,
794  0x00F7, 0x00DF, 0x00D9, 0x00BD, 0x00A6, 0x0097, 0x0090, 0x0079,
795  0x006A, 0x0047, 0x0044, 0x0009, 0x01D2, 0x0187, 0x0184, 0x0149,
796  0x010D, 0x00D7, 0x00B8, 0x001D, 0x03A6, 0x030B, 0x029C, 0x0246,
797  0x0173, 0x0114, 0x0741, 0x053A, 0x0488, 0x0E9D, 0x0A76, 0x0454,
798  0x29DD,
799 };
800 
801 static const uint16_t bitalloc_129_codes_c[129] = {
802  0x0E5C, 0x072F, 0x001D, 0x0724, 0x000F, 0x010D, 0x0324, 0x0393,
803  0x03E9, 0x0080, 0x0087, 0x00FA, 0x0164, 0x0193, 0x01DE, 0x01F5,
804  0x0010, 0x002A, 0x0041, 0x0064, 0x0073, 0x008E, 0x00A4, 0x00B3,
805  0x00D6, 0x00E5, 0x00F4, 0x00FB, 0x0002, 0x0009, 0x0013, 0x001E,
806  0x0026, 0x002C, 0x0033, 0x003F, 0x0041, 0x004C, 0x0053, 0x005E,
807  0x0065, 0x0070, 0x0073, 0x0078, 0x007B, 0x007E, 0x0002, 0x0005,
808  0x0007, 0x000B, 0x000D, 0x0011, 0x0014, 0x0017, 0x001A, 0x001D,
809  0x0021, 0x0024, 0x0027, 0x002A, 0x002D, 0x0030, 0x0033, 0x0036,
810  0x003A, 0x0037, 0x0034, 0x0031, 0x002E, 0x002B, 0x0028, 0x0025,
811  0x0022, 0x001E, 0x001B, 0x0018, 0x0015, 0x0012, 0x000E, 0x000C,
812  0x0008, 0x0006, 0x0003, 0x007F, 0x007C, 0x0079, 0x0076, 0x0071,
813  0x006A, 0x005F, 0x0058, 0x004D, 0x0046, 0x0040, 0x0038, 0x002D,
814  0x0027, 0x001F, 0x0014, 0x0012, 0x0003, 0x0000, 0x00F5, 0x00EE,
815  0x00D7, 0x00C8, 0x00A5, 0x008F, 0x007C, 0x0065, 0x0042, 0x002B,
816  0x0011, 0x0002, 0x01DF, 0x01C8, 0x0165, 0x00FB, 0x00E4, 0x0081,
817  0x0006, 0x03E8, 0x0325, 0x01CA, 0x010C, 0x0725, 0x0396, 0x001C,
818  0x0E5D,
819 };
820 
821 static const uint16_t bitalloc_129_codes_d[129] = {
822  0xA598, 0xA59A, 0xA59C, 0xA59E, 0xC598, 0xE586, 0x3ACC, 0x52CA,
823  0x62CD, 0x0D48, 0x1D67, 0x2978, 0x3167, 0x3966, 0x06A5, 0x0EBC,
824  0x14BD, 0x1CB1, 0x0350, 0x0353, 0x075F, 0x0A5F, 0x0C5E, 0x0E5E,
825  0x01AE, 0x03AD, 0x052D, 0x062D, 0x072D, 0x00D5, 0x01D4, 0x0294,
826  0x0314, 0x0394, 0x0014, 0x0094, 0x0114, 0x0174, 0x01B4, 0x01F4,
827  0x000B, 0x004B, 0x008B, 0x00BB, 0x00DB, 0x00FB, 0x001B, 0x003B,
828  0x0053, 0x0063, 0x0073, 0x0003, 0x0013, 0x0023, 0x002F, 0x0037,
829  0x003F, 0x0007, 0x000F, 0x0015, 0x0019, 0x001D, 0x0001, 0x0005,
830  0x0009, 0x0006, 0x0002, 0x001E, 0x001A, 0x0016, 0x0010, 0x0008,
831  0x0000, 0x0038, 0x0030, 0x0028, 0x001C, 0x000C, 0x007C, 0x006C,
832  0x005C, 0x0044, 0x0024, 0x0004, 0x00E4, 0x00C4, 0x00A4, 0x0074,
833  0x0034, 0x01F5, 0x01B5, 0x0175, 0x0115, 0x0095, 0x0015, 0x0395,
834  0x0315, 0x0295, 0x01D5, 0x00D6, 0x072E, 0x062E, 0x052E, 0x03AE,
835  0x01AF, 0x0E5F, 0x0C5F, 0x0C58, 0x0A58, 0x0758, 0x0351, 0x1CB2,
836  0x18B2, 0x0EBD, 0x0EB2, 0x3967, 0x3960, 0x2979, 0x2964, 0x0D49,
837  0x72C2, 0x52CB, 0x3ACD, 0xE587, 0xC599, 0xA59F, 0xA59D, 0xA59B,
838  0xA599,
839 };
840 
841 static const uint16_t bitalloc_129_codes_e[129] = {
842  0xA13C, 0xC720, 0xA13F, 0xA13E, 0xA13D, 0xE722, 0x5090, 0x6393,
843  0x7392, 0x2849, 0x31CE, 0x39CE, 0x1425, 0x18E5, 0x1CE5, 0x0844,
844  0x0A1C, 0x0C7C, 0x036C, 0x0423, 0x050F, 0x063F, 0x01B7, 0x0216,
845  0x0285, 0x031D, 0x039D, 0x0109, 0x0140, 0x0180, 0x01C8, 0x01CF,
846  0x007A, 0x008A, 0x00A2, 0x00C1, 0x00E5, 0x0014, 0x0037, 0x0043,
847  0x004E, 0x0056, 0x0061, 0x006C, 0x007C, 0x000B, 0x001C, 0x001F,
848  0x0023, 0x0025, 0x0029, 0x002C, 0x002E, 0x0032, 0x0034, 0x0037,
849  0x003A, 0x003C, 0x003F, 0x0001, 0x0003, 0x0006, 0x0008, 0x000A,
850  0x000C, 0x000B, 0x0009, 0x0007, 0x0004, 0x0002, 0x0000, 0x003D,
851  0x003B, 0x0038, 0x0035, 0x0033, 0x002F, 0x002D, 0x002A, 0x0026,
852  0x0024, 0x0020, 0x001D, 0x001A, 0x007D, 0x006D, 0x0062, 0x0057,
853  0x004F, 0x0044, 0x003C, 0x0015, 0x00E6, 0x00C6, 0x00A3, 0x008B,
854  0x007B, 0x006C, 0x01C9, 0x0181, 0x0141, 0x010A, 0x00DA, 0x031E,
855  0x0286, 0x0217, 0x0210, 0x0738, 0x0638, 0x0508, 0x036D, 0x0C7D,
856  0x0A1D, 0x0845, 0x1CE6, 0x18E6, 0x1426, 0x39CF, 0x31CF, 0x284E,
857  0x7393, 0x7390, 0x5091, 0xE723, 0xC724, 0xC725, 0xC722, 0xC723,
858  0xC721,
859 };
860 
861 static const uint16_t bitalloc_129_codes_f[129] = {
862  0x762C, 0x3B17, 0x1555, 0x0608, 0x0AAB, 0x0FF2, 0x0305, 0x0307,
863  0x0763, 0x0046, 0x010C, 0x01BC, 0x02AB, 0x03B6, 0x03FD, 0x0080,
864  0x0087, 0x00DF, 0x0156, 0x01D9, 0x01F8, 0x01FF, 0x002A, 0x0041,
865  0x0061, 0x0094, 0x00D4, 0x00EA, 0x00F2, 0x00FD, 0x0009, 0x000B,
866  0x001A, 0x0026, 0x0031, 0x0040, 0x004B, 0x006B, 0x0073, 0x0077,
867  0x007A, 0x007C, 0x0000, 0x0002, 0x0006, 0x0008, 0x000B, 0x000E,
868  0x0011, 0x0014, 0x0016, 0x0019, 0x001C, 0x001E, 0x0021, 0x0023,
869  0x0026, 0x0028, 0x002B, 0x002D, 0x002F, 0x0031, 0x0033, 0x0036,
870  0x0038, 0x0037, 0x0034, 0x0032, 0x0030, 0x002E, 0x002C, 0x0029,
871  0x0027, 0x0024, 0x0022, 0x001F, 0x001D, 0x001A, 0x0017, 0x0015,
872  0x0012, 0x000F, 0x000C, 0x0009, 0x0007, 0x0003, 0x0001, 0x007D,
873  0x007B, 0x0078, 0x0074, 0x0072, 0x0054, 0x0041, 0x0036, 0x0027,
874  0x001B, 0x0014, 0x000A, 0x00FE, 0x00F3, 0x00EB, 0x00D5, 0x0095,
875  0x006E, 0x0042, 0x002B, 0x0010, 0x01F9, 0x01DA, 0x0157, 0x0154,
876  0x00C0, 0x0081, 0x0022, 0x03B7, 0x03B0, 0x01BD, 0x010D, 0x0047,
877  0x07F8, 0x0554, 0x0306, 0x0FF3, 0x0EC4, 0x0609, 0x1D8A, 0x1554,
878  0x762D,
879 };
880 
881 static const uint16_t bitalloc_129_codes_g[129] = {
882  0x1E20, 0x1E5E, 0x031C, 0x051A, 0x0718, 0x0916, 0x0B14, 0x0D12,
883  0x0F11, 0x0090, 0x018F, 0x028E, 0x038D, 0x048C, 0x058B, 0x068A,
884  0x0789, 0x0049, 0x00C8, 0x0148, 0x01C7, 0x0247, 0x02C6, 0x0346,
885  0x03C5, 0x0025, 0x0065, 0x00A5, 0x00E4, 0x0124, 0x0164, 0x01A4,
886  0x01E3, 0x0013, 0x0033, 0x0053, 0x0073, 0x0093, 0x00B3, 0x00D3,
887  0x00F3, 0x000A, 0x001A, 0x002A, 0x003A, 0x004A, 0x005A, 0x006A,
888  0x007A, 0x0006, 0x000E, 0x0016, 0x001E, 0x0026, 0x002E, 0x0036,
889  0x003E, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C,
890  0x0000, 0x001D, 0x0019, 0x0015, 0x0011, 0x000D, 0x0009, 0x0005,
891  0x003F, 0x0037, 0x002F, 0x0027, 0x001F, 0x0017, 0x000F, 0x0007,
892  0x007B, 0x006B, 0x005B, 0x004B, 0x003B, 0x002B, 0x001B, 0x000B,
893  0x0008, 0x00F0, 0x00D0, 0x00B0, 0x0090, 0x0070, 0x0050, 0x0030,
894  0x01E4, 0x01A5, 0x0165, 0x0125, 0x00E5, 0x00E2, 0x00A2, 0x0062,
895  0x03CA, 0x0347, 0x02C7, 0x02C4, 0x0244, 0x0149, 0x00C9, 0x00C6,
896  0x0796, 0x068B, 0x0688, 0x048D, 0x048A, 0x028F, 0x028C, 0x0091,
897  0x0F2E, 0x0D13, 0x0B15, 0x0917, 0x0719, 0x051B, 0x031D, 0x1E5F,
898  0x1E21,
899 };
900 
901 static const uint8_t bitalloc_129_bits_a[129] = {
902  11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
903  10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8,
904  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7,
905  7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 4,
906  4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7,
907  7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
908  8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10,
909  10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11,
910  11,
911 };
912 
913 static const uint8_t bitalloc_129_bits_b[129] = {
914  14, 13, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 10, 9, 9, 9,
915  9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
916  8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6,
917  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5,
918  5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
919  6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
920  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9,
921  9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12,
922  14,
923 };
924 
925 static const uint8_t bitalloc_129_bits_c[129] = {
926  13, 12, 11, 11, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9,
927  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7,
928  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6,
929  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
930  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
931  6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
932  7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
933  8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11,
934  13,
935 };
936 
937 static const uint8_t bitalloc_129_bits_d[129] = {
938  16, 16, 16, 16, 16, 16, 15, 15, 15, 14, 14, 14, 14, 14, 13, 13,
939  13, 13, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 10, 10, 10,
940  10, 10, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 7, 7,
941  7, 7, 7, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4,
942  4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7,
943  7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10,
944  10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13,
945  13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 16,
946  16,
947 };
948 
949 static const uint8_t bitalloc_129_bits_e[129] = {
950  16, 16, 16, 16, 16, 16, 15, 15, 15, 14, 14, 14, 13, 13, 13, 12,
951  12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9,
952  8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6,
953  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5,
954  5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6,
955  6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
956  8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12,
957  12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 16,
958  16,
959 };
960 
961 static const uint8_t bitalloc_129_bits_f[129] = {
962  15, 14, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 10, 10, 10, 9,
963  9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7,
964  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6,
965  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
966  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
967  6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7,
968  7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9,
969  9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13,
970  15,
971 };
972 
973 static const uint8_t bitalloc_129_bits_g[129] = {
974  13, 13, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11,
975  11, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9,
976  9, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7,
977  7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5,
978  4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6,
979  7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8,
980  9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
981  11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 13,
982  13,
983 };
984 
985 static const uint8_t bitalloc_sizes[DCA_CODE_BOOKS] = {
986  3, 5, 7, 9, 13, 17, 25, 33, 65, 129
987 };
988 
989 static const int8_t bitalloc_offsets[DCA_CODE_BOOKS] = {
990  -1, -2, -3, -4, -6, -8, -12, -16, -32, -64
991 };
992 
993 static const uint8_t bitalloc_maxbits[DCA_CODE_BOOKS][7] = {
994  { 2 },
995  { 4, 3, 3 },
996  { 5, 5, 4 },
997  { 6, 5, 6 },
998  { 7, 6, 5 },
999  { 9, 8, 7, 9, 8, 8, 8 },
1000  { 9, 9, 8, 9, 8, 9, 9 },
1001  { 9, 9, 9, 9, 9, 9, 9 },
1002  { 9, 9, 9, 9, 9, 9, 9 },
1003  { 9, 9, 9, 9, 9, 9, 9 }
1004 };
1005 
1006 static const uint16_t *const bitalloc_codes[DCA_CODE_BOOKS][8] = {
1007  { bitalloc_3_codes, NULL },
1022 };
1023 
1024 static const uint8_t *const bitalloc_bits[DCA_CODE_BOOKS][8] = {
1025  { bitalloc_3_bits, NULL },
1040 };
1041 
1042 static const uint16_t tnl_grp_0_codes[37] = {
1043  0x0000, 0x0003, 0x0004, 0x0007, 0x0001, 0x0009, 0x000a, 0x000d,
1044  0x000e, 0x0006, 0x0012, 0x0005, 0x0015, 0x0016, 0x0022, 0x0025,
1045  0x0035, 0x0076, 0x0002, 0x0042, 0x00b6, 0x0036, 0x00c2, 0x0136,
1046  0x0182, 0x01c2, 0x03c2, 0x0482, 0x0682, 0x0082, 0x0882, 0x0a82,
1047  0x0282, 0x2282, 0x3282, 0x1282, 0x5282,
1048 };
1049 
1050 static const uint16_t tnl_grp_1_codes[34] = {
1051  0x0001, 0x0003, 0x0006, 0x0000, 0x0002, 0x0004, 0x0005, 0x0007,
1052  0x0008, 0x000f, 0x001a, 0x001c, 0x001d, 0x000a, 0x002c, 0x002d,
1053  0x000d, 0x002a, 0x004c, 0x004d, 0x006a, 0x008c, 0x00cd, 0x00ea,
1054  0x000c, 0x010c, 0x01ea, 0x020c, 0x030c, 0x07ea, 0x0bea, 0x03ea,
1055  0x13ea, 0x33ea,
1056 };
1057 
1058 static const uint16_t tnl_grp_2_codes[31] = {
1059  0x0001, 0x0003, 0x0006, 0x0007, 0x0004, 0x0008, 0x000c, 0x0010,
1060  0x0012, 0x001a, 0x0022, 0x0000, 0x000a, 0x0020, 0x0040, 0x004a,
1061  0x006a, 0x0002, 0x002a, 0x0042, 0x0082, 0x00aa, 0x00e0, 0x0060,
1062  0x00c2, 0x01c2, 0x0160, 0x0360, 0x0f60, 0x0760, 0x1760,
1063 };
1064 
1065 static const uint16_t tnl_grp_3_codes[28] = {
1066  0x0001, 0x0006, 0x0008, 0x0014, 0x001c, 0x0000, 0x0002, 0x0004,
1067  0x000a, 0x000c, 0x0010, 0x0012, 0x001a, 0x0020, 0x002a, 0x002c,
1068  0x0032, 0x003a, 0x0022, 0x0030, 0x0062, 0x0064, 0x0070, 0x0024,
1069  0x00a4, 0x01a4, 0x03a4, 0x07a4,
1070 };
1071 
1072 static const uint16_t tnl_grp_4_codes[23] = {
1073  0x0001, 0x0000, 0x000a, 0x0006, 0x0012, 0x001e, 0x0022, 0x002e,
1074  0x0036, 0x003e, 0x0002, 0x0016, 0x0032, 0x004e, 0x0056, 0x000e,
1075  0x0042, 0x0072, 0x00c2, 0x00f2, 0x008e, 0x018e, 0x038e,
1076 };
1077 
1078 static const uint16_t tnl_scf_codes[20] = {
1079  0x0000, 0x0001, 0x0002, 0x0005, 0x0006, 0x0007, 0x000b, 0x000c,
1080  0x0013, 0x0014, 0x0003, 0x0004, 0x0023, 0x0064, 0x00a4, 0x0024,
1081  0x0124, 0x0324, 0x0724, 0x0f24,
1082 };
1083 
1084 static const uint16_t damp_codes[7] = {
1085  0x0001, 0x0000, 0x0002, 0x0006, 0x000e, 0x001e, 0x003e,
1086 };
1087 
1088 static const uint16_t dph_codes[9] = {
1089  0x0000, 0x0002, 0x0003, 0x0001, 0x0009, 0x000d, 0x0005, 0x0015,
1090  0x0035,
1091 };
1092 
1093 static const uint16_t fst_rsd_amp_codes[24] = {
1094  0x0003, 0x0005, 0x0006, 0x0007, 0x0000, 0x0001, 0x0002, 0x0008,
1095  0x0009, 0x000a, 0x0014, 0x0004, 0x001a, 0x001c, 0x0024, 0x002c,
1096  0x003a, 0x000c, 0x003c, 0x004c, 0x00fc, 0x007c, 0x017c, 0x037c,
1097 };
1098 
1099 static const uint16_t rsd_apprx_codes[6] = {
1100  0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f,
1101 };
1102 
1103 static const uint16_t rsd_amp_codes[33] = {
1104  0x0001, 0x0000, 0x0002, 0x0003, 0x0004, 0x000e, 0x000f, 0x0016,
1105  0x0007, 0x0027, 0x0037, 0x0026, 0x0066, 0x0006, 0x0017, 0x0046,
1106  0x0097, 0x00d7, 0x0086, 0x00c6, 0x01c6, 0x0157, 0x0186, 0x0257,
1107  0x0357, 0x0057, 0x0786, 0x0386, 0x0b86, 0x0457, 0x0c57, 0x1457,
1108  0x1c57,
1109 };
1110 
1111 static const uint16_t avg_g3_codes[18] = {
1112  0x0001, 0x0002, 0x0003, 0x0000, 0x000c, 0x0014, 0x0018, 0x0004,
1113  0x0008, 0x0028, 0x0068, 0x0024, 0x00a4, 0x00e4, 0x0164, 0x0064,
1114  0x0264, 0x0664,
1115 };
1116 
1117 static const uint16_t st_grid_codes[22] = {
1118  0x0001, 0x0002, 0x0000, 0x0004, 0x0008, 0x001c, 0x004c, 0x006c,
1119  0x000c, 0x002c, 0x008c, 0x00ac, 0x012c, 0x018c, 0x01ac, 0x038c,
1120  0x03ac, 0x032c, 0x072c, 0x0f2c, 0x172c, 0x1f2c,
1121 };
1122 
1123 static const uint16_t grid_2_codes[20] = {
1124  0x0000, 0x0002, 0x0003, 0x0001, 0x0005, 0x000d, 0x003d, 0x005d,
1125  0x009d, 0x011d, 0x001d, 0x061d, 0x041d, 0x0c1d, 0x0a1d, 0x121d,
1126  0x021d, 0x1a1d, 0x221d, 0x3a1d,
1127 };
1128 
1129 static const uint16_t grid_3_codes[13] = {
1130  0x0001, 0x0002, 0x0000, 0x0004, 0x000c, 0x001c, 0x007c, 0x003c,
1131  0x01bc, 0x00bc, 0x06bc, 0x02bc, 0x0abc,
1132 };
1133 
1134 static const uint16_t rsd_codes[9] = {
1135  0x0001, 0x0003, 0x0000, 0x0002, 0x0006, 0x0004, 0x000c, 0x001c,
1136  0x003c,
1137 };
1138 
1139 static const uint8_t tnl_grp_0_bitvals[74] = {
1140  3, 5, 3, 9, 3, 4, 3, 6, 4, 10, 4, 13, 4, 7, 4, 11,
1141  4, 8, 5, 12, 5, 14, 6, 15, 6, 18, 6, 1, 6, 17, 6, 16,
1142  6, 21, 7, 20, 8, 19, 8, 22, 8, 25, 9, 26, 9, 23, 9, 3,
1143  9, 24, 10, 29, 10, 27, 11, 28, 11, 30, 12, 33, 12, 31, 12, 32,
1144  14, 34, 14, 37, 14, 36, 15, 35, 15, 0,
1145 };
1146 
1147 static const uint8_t tnl_grp_1_bitvals[68] = {
1148  3, 9, 3, 6, 3, 5, 4, 4, 4, 8, 4, 10, 4, 1, 4, 11,
1149  4, 7, 4, 13, 5, 12, 5, 14, 5, 17, 6, 16, 6, 15, 6, 18,
1150  7, 20, 7, 19, 7, 21, 8, 25, 8, 23, 8, 22, 8, 24, 9, 26,
1151  10, 3, 10, 29, 10, 30, 10, 27, 10, 28, 11, 31, 12, 32, 13, 33,
1152  14, 34, 14, 0,
1153 };
1154 
1155 static const uint8_t tnl_grp_2_bitvals[62] = {
1156  2, 1, 3, 6, 3, 5, 3, 7, 4, 9, 4, 8, 4, 4, 5, 10,
1157  5, 11, 5, 13, 6, 12, 7, 14, 7, 16, 7, 15, 7, 17, 7, 18,
1158  7, 19, 8, 22, 8, 20, 8, 21, 8, 3, 8, 24, 8, 25, 9, 23,
1159  9, 26, 9, 27, 10, 28, 11, 29, 12, 31, 13, 30, 13, 0,
1160 };
1161 
1162 static const uint8_t tnl_grp_3_bitvals[56] = {
1163  1, 1, 3, 6, 4, 5, 5, 9, 5, 4, 6, 8, 6, 14, 6, 10,
1164  6, 21, 6, 13, 6, 7, 6, 3, 6, 16, 6, 2, 6, 18, 6, 17,
1165  6, 11, 6, 15, 7, 19, 7, 23, 7, 24, 7, 22, 7, 12, 8, 20,
1166  9, 25, 10, 26, 11, 27, 11, 0,
1167 };
1168 
1169 static const uint8_t tnl_grp_4_bitvals[46] = {
1170  1, 1, 2, 2, 4, 4, 5, 5, 6, 6, 6, 8, 6, 3, 6, 19,
1171  6, 20, 6, 9, 7, 7, 7, 11, 7, 13, 7, 17, 7, 10, 8, 12,
1172  8, 15, 8, 14, 8, 21, 8, 18, 9, 16, 10, 22, 10, 0,
1173 };
1174 
1175 static const uint8_t tnl_scf_bitvals[40] = {
1176  3, 3, 3, 1, 3, 2, 3, 5, 3, 4, 3, 6, 4, 8, 4, 7,
1177  5, 10, 5, 9, 6, 12, 6, 11, 6, 13, 7, 14, 8, 15, 9, 16,
1178  10, 17, 11, 18, 12, 19, 12, 0,
1179 };
1180 
1181 static const uint8_t damp_bitvals[14] = {
1182  1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 0,
1183 };
1184 
1185 static const uint8_t dph_bitvals[18] = {
1186  2, 2, 2, 1, 2, 8, 4, 3, 4, 7, 4, 4, 5, 6, 6, 5,
1187  6, 0,
1188 };
1189 
1190 static const uint8_t fst_rsd_amp_bitvals[48] = {
1191  3, 13, 3, 15, 3, 16, 3, 14, 4, 12, 4, 10, 4, 11, 4, 17,
1192  4, 18, 5, 19, 5, 9, 6, 1, 6, 7, 6, 6, 6, 8, 6, 5,
1193  6, 4, 7, 20, 7, 2, 7, 3, 8, 21, 9, 22, 10, 23, 10, 0,
1194 };
1195 
1196 static const uint8_t rsd_apprx_bitvals[12] = {
1197  1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 0,
1198 };
1199 
1200 static const uint8_t rsd_amp_bitvals[66] = {
1201  2, 3, 3, 2, 3, 5, 3, 4, 3, 1, 4, 7, 4, 6, 5, 9,
1202  6, 8, 6, 11, 6, 10, 7, 12, 7, 13, 8, 14, 8, 18, 8, 16,
1203  8, 15, 8, 22, 9, 20, 9, 24, 9, 17, 10, 28, 10, 26, 10, 21,
1204  10, 23, 11, 30, 11, 19, 12, 25, 12, 32, 13, 36, 13, 29, 13, 34,
1205  13, 0,
1206 };
1207 
1208 static const uint8_t avg_g3_bitvals[36] = {
1209  2, 15, 2, 16, 2, 17, 4, 14, 4, 18, 5, 12, 5, 13, 6, 10,
1210  6, 11, 7, 19, 7, 9, 8, 20, 8, 8, 8, 7, 9, 21, 10, 6,
1211  11, 23, 11, 0,
1212 };
1213 
1214 static const uint8_t st_grid_bitvals[44] = {
1215  1, 6, 2, 1, 4, 4, 4, 8, 4, 3, 5, 10, 7, 12, 7, 5,
1216  8, 14, 9, 16, 9, 7, 9, 18, 10, 11, 10, 9, 10, 20, 10, 22,
1217  10, 2, 11, 13, 13, 17, 13, 24, 13, 15, 13, 0,
1218 };
1219 
1220 static const uint8_t grid_2_bitvals[40] = {
1221  2, 3, 2, 2, 2, 1, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8,
1222  8, 9, 9, 10, 11, 11, 11, 12, 12, 13, 12, 17, 13, 15, 13, 18,
1223  14, 19, 14, 16, 14, 14, 14, 0,
1224 };
1225 
1226 static const uint8_t grid_3_bitvals[26] = {
1227  1, 17, 2, 16, 3, 18, 4, 15, 5, 19, 6, 14, 7, 20, 8, 13,
1228  9, 21, 10, 12, 11, 22, 12, 11, 12, 0,
1229 };
1230 
1231 static const uint8_t rsd_bitvals[18] = {
1232  2, 2, 2, 3, 3, 1, 3, 4, 3, 0, 4, 5, 5, 6, 6, 7,
1233  6, 4,
1234 };
1235 
1236 static const uint16_t vlc_offs[80] = {
1237  0, 512, 640, 768, 1282, 1794, 2436, 3080, 3770, 4454, 5364,
1238  5372, 5380, 5388, 5392, 5396, 5412, 5420, 5428, 5460, 5492, 5508,
1239  5572, 5604, 5668, 5796, 5860, 5892, 6412, 6668, 6796, 7308, 7564,
1240  7820, 8076, 8620, 9132, 9388, 9910, 10166, 10680, 11196, 11726, 12240,
1241  12752, 13298, 13810, 14326, 14840, 15500, 16022, 16540, 17158, 17678, 18264,
1242  18796, 19352, 19926, 20468, 21472, 22398, 23014, 23622, 24200, 24748, 25276,
1243  25792, 26306, 26826, 26890, 26954, 27468, 27500, 28038, 28554, 29086, 29630,
1244  30150, 30214
1245 };
1246 
1251 
1264 
1266 {
1267  static VLC_TYPE dca_table[30214][2];
1268  int i, j, k = 0;
1269 
1270 #define DCA_INIT_VLC(vlc, a, b, c, d) \
1271  do { \
1272  vlc.table = &dca_table[vlc_offs[k]]; \
1273  vlc.table_allocated = vlc_offs[k + 1] - vlc_offs[k]; \
1274  init_vlc(&vlc, a, b, c, 1, 1, d, 2, 2, INIT_VLC_USE_NEW_STATIC); \
1275  k++; \
1276  } while (0)
1277 
1280  for (i = 0; i < 5; i++)
1283 
1286  for (i = 0; i < 5; i++)
1289 
1292  for (i = 0; i < 4; i++)
1294  tmode_bits[i], tmode_codes[i]);
1295 
1296  for (i = 0; i < DCA_CODE_BOOKS; i++) {
1298  ff_dca_vlc_quant_index[i].max_depth = 1 + (i > 4);
1299  for (j = 0; bitalloc_codes[i][j]; j++)
1302  }
1303 
1304 #define LBR_INIT_VLC(vlc, tab, nb_bits) \
1305  do { \
1306  vlc.table = &dca_table[vlc_offs[k]]; \
1307  vlc.table_allocated = vlc_offs[k + 1] - vlc_offs[k]; \
1308  ff_init_vlc_sparse(&vlc, nb_bits, FF_ARRAY_ELEMS(tab##_codes), \
1309  &tab##_bitvals[0], 2, 1, \
1310  tab##_codes, 2, 2, \
1311  &tab##_bitvals[1], 2, 1, \
1312  INIT_VLC_LE | INIT_VLC_USE_NEW_STATIC); \
1313  k++; \
1314  } while (0)
1315 
1316  LBR_INIT_VLC(ff_dca_vlc_tnl_grp[0], tnl_grp_0, 9);
1317  LBR_INIT_VLC(ff_dca_vlc_tnl_grp[1], tnl_grp_1, 9);
1318  LBR_INIT_VLC(ff_dca_vlc_tnl_grp[2], tnl_grp_2, 9);
1319  LBR_INIT_VLC(ff_dca_vlc_tnl_grp[3], tnl_grp_3, 9);
1320  LBR_INIT_VLC(ff_dca_vlc_tnl_grp[4], tnl_grp_4, 9);
1321  LBR_INIT_VLC(ff_dca_vlc_tnl_scf, tnl_scf, 9);
1322  LBR_INIT_VLC(ff_dca_vlc_damp, damp, 6);
1323  LBR_INIT_VLC(ff_dca_vlc_dph, dph, 6);
1324  LBR_INIT_VLC(ff_dca_vlc_fst_rsd_amp, fst_rsd_amp, 9);
1325  LBR_INIT_VLC(ff_dca_vlc_rsd_apprx, rsd_apprx, 5);
1326  LBR_INIT_VLC(ff_dca_vlc_rsd_amp, rsd_amp, 9);
1327  LBR_INIT_VLC(ff_dca_vlc_avg_g3, avg_g3, 9);
1328  LBR_INIT_VLC(ff_dca_vlc_st_grid, st_grid, 9);
1329  LBR_INIT_VLC(ff_dca_vlc_grid_2, grid_2, 9);
1330  LBR_INIT_VLC(ff_dca_vlc_grid_3, grid_3, 9);
1331  LBR_INIT_VLC(ff_dca_vlc_rsd, rsd, 6);
1332 }
1333 
1334 uint32_t ff_dca_vlc_calc_quant_bits(int *values, uint8_t n, uint8_t sel, uint8_t table)
1335 {
1336  uint8_t i, id;
1337  uint32_t sum = 0;
1338  for (i = 0; i < n; i++) {
1339  id = values[i] - bitalloc_offsets[table];
1341  sum += bitalloc_bits[table][sel][id];
1342  }
1343  return sum;
1344 }
1345 
1346 void ff_dca_vlc_enc_quant(PutBitContext *pb, int *values, uint8_t n, uint8_t sel, uint8_t table)
1347 {
1348  uint8_t i, id;
1349  for (i = 0; i < n; i++) {
1350  id = values[i] - bitalloc_offsets[table];
1352  put_bits(pb, bitalloc_bits[table][sel][id], bitalloc_codes[table][sel][id]);
1353  }
1354 }
1355 
1356 uint32_t ff_dca_vlc_calc_alloc_bits(int *values, uint8_t n, uint8_t sel)
1357 {
1358  uint8_t i, id;
1359  uint32_t sum = 0;
1360  for (i = 0; i < n; i++) {
1361  id = values[i] - 1;
1362  sum += bitalloc_12_bits[sel][id];
1363  }
1364  return sum;
1365 }
1366 
1367 void ff_dca_vlc_enc_alloc(PutBitContext *pb, int *values, uint8_t n, uint8_t sel)
1368 {
1369  uint8_t i, id;
1370  for (i = 0; i < n; i++) {
1371  id = values[i] - 1;
1372  put_bits(pb, bitalloc_12_bits[sel][id], bitalloc_12_codes[sel][id]);
1373  }
1374 }
bitalloc_65_bits_f
static const uint8_t bitalloc_65_bits_f[65]
Definition: dcahuff.c:745
avg_g3_bitvals
static const uint8_t avg_g3_bitvals[36]
Definition: dcahuff.c:1208
rsd_bitvals
static const uint8_t rsd_bitvals[18]
Definition: dcahuff.c:1231
scales_bits
static const uint8_t scales_bits[SCALES_COUNT][129]
Definition: dcahuff.c:163
tnl_grp_4_bitvals
static const uint8_t tnl_grp_4_bitvals[46]
Definition: dcahuff.c:1169
bitalloc_25_codes_d
static const uint16_t bitalloc_25_codes_d[25]
Definition: dcahuff.c:460
bitalloc_5_bits_a
static const uint8_t bitalloc_5_bits_a[5]
Definition: dcahuff.c:272
st_grid_bitvals
static const uint8_t st_grid_bitvals[44]
Definition: dcahuff.c:1214
avg_g3_codes
static const uint16_t avg_g3_codes[18]
Definition: dcahuff.c:1111
ff_dca_vlc_rsd_apprx
VLC ff_dca_vlc_rsd_apprx
Definition: dcahuff.c:1257
bitalloc_9_codes_a
static const uint16_t bitalloc_9_codes_a[9]
Definition: dcahuff.c:308
bitalloc_7_codes_a
static const uint16_t bitalloc_7_codes_a[7]
Definition: dcahuff.c:284
bitalloc_129_bits_e
static const uint8_t bitalloc_129_bits_e[129]
Definition: dcahuff.c:949
TMODE_COUNT
#define TMODE_COUNT
Definition: dcahuff.c:31
bitalloc_9_bits_b
static const uint8_t bitalloc_9_bits_b[9]
Definition: dcahuff.c:327
ff_dca_vlc_st_grid
VLC ff_dca_vlc_st_grid
Definition: dcahuff.c:1260
bitalloc_65_codes_e
static const uint16_t bitalloc_65_codes_e[65]
Definition: dcahuff.c:669
bitalloc_129_codes_b
static const uint16_t bitalloc_129_codes_b[129]
Definition: dcahuff.c:781
bitalloc_65_bits_e
static const uint8_t bitalloc_65_bits_e[65]
Definition: dcahuff.c:737
tnl_grp_1_codes
static const uint16_t tnl_grp_1_codes[34]
Definition: dcahuff.c:1050
bitalloc_33_bits_a
static const uint8_t bitalloc_33_bits_a[33]
Definition: dcahuff.c:579
DCAVLC::offset
int offset
Code values offset.
Definition: dcahuff.h:37
bitalloc_9_codes_c
static const uint16_t bitalloc_9_codes_c[9]
Definition: dcahuff.c:318
bitalloc_offsets
static const int8_t bitalloc_offsets[DCA_CODE_BOOKS]
Definition: dcahuff.c:989
bitalloc_65_codes_f
static const uint16_t bitalloc_65_codes_f[65]
Definition: dcahuff.c:681
bitalloc_25_bits_a
static const uint8_t bitalloc_25_bits_a[25]
Definition: dcahuff.c:488
bitalloc_5_bits_b
static const uint8_t bitalloc_5_bits_b[5]
Definition: dcahuff.c:276
bitalloc_25_codes_a
static const uint16_t bitalloc_25_codes_a[25]
Definition: dcahuff.c:439
bitalloc_13_codes_a
static const uint16_t bitalloc_13_codes_a[13]
Definition: dcahuff.c:335
put_bits
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition: j2kenc.c:220
rsd_amp_codes
static const uint16_t rsd_amp_codes[33]
Definition: dcahuff.c:1103
ff_dca_vlc_grid_3
VLC ff_dca_vlc_grid_3
Definition: dcahuff.c:1262
bitalloc_33_codes_a
static const uint16_t bitalloc_33_codes_a[33]
Definition: dcahuff.c:523
bitalloc_17_codes_c
static const uint16_t bitalloc_17_codes_c[17]
Definition: dcahuff.c:374
table
static const uint16_t table[]
Definition: prosumer.c:206
bitalloc_129_bits_c
static const uint8_t bitalloc_129_bits_c[129]
Definition: dcahuff.c:925
bitalloc_17_bits_b
static const uint8_t bitalloc_17_bits_b[17]
Definition: dcahuff.c:409
bitalloc_25_bits_d
static const uint8_t bitalloc_25_bits_d[25]
Definition: dcahuff.c:503
bitalloc_129_bits_f
static const uint8_t bitalloc_129_bits_f[129]
Definition: dcahuff.c:961
bitalloc_13_codes_c
static const uint16_t bitalloc_13_codes_c[13]
Definition: dcahuff.c:345
bitalloc_5_codes_a
static const uint16_t bitalloc_5_codes_a[5]
Definition: dcahuff.c:260
ff_dca_vlc_calc_alloc_bits
uint32_t ff_dca_vlc_calc_alloc_bits(int *values, uint8_t n, uint8_t sel)
Definition: dcahuff.c:1356
bitalloc_17_bits_f
static const uint8_t bitalloc_17_bits_f[17]
Definition: dcahuff.c:429
ff_dca_vlc_transition_mode
DCAVLC ff_dca_vlc_transition_mode
Definition: dcahuff.c:1248
bitalloc_17_codes_d
static const uint16_t bitalloc_17_codes_d[17]
Definition: dcahuff.c:380
VLC_TYPE
#define VLC_TYPE
Definition: vlc.h:24
DCA_INIT_VLC
#define DCA_INIT_VLC(vlc, a, b, c, d)
vlc_offs
static const uint16_t vlc_offs[80]
Definition: dcahuff.c:1236
bitalloc_33_codes_c
static const uint16_t bitalloc_33_codes_c[33]
Definition: dcahuff.c:539
bitalloc_33_codes_b
static const uint16_t bitalloc_33_codes_b[33]
Definition: dcahuff.c:531
bitalloc_5_codes_c
static const uint16_t bitalloc_5_codes_c[5]
Definition: dcahuff.c:268
bitalloc_33_codes_d
static const uint16_t bitalloc_33_codes_d[33]
Definition: dcahuff.c:547
bitalloc_65_codes_c
static const uint16_t bitalloc_65_codes_c[65]
Definition: dcahuff.c:645
bitalloc_65_bits_a
static const uint8_t bitalloc_65_bits_a[65]
Definition: dcahuff.c:705
SCALES_COUNT
#define SCALES_COUNT
Definition: dcahuff.c:73
bitalloc_17_codes_g
static const uint16_t bitalloc_17_codes_g[17]
Definition: dcahuff.c:398
bitalloc_129_codes_d
static const uint16_t bitalloc_129_codes_d[129]
Definition: dcahuff.c:821
bitalloc_33_bits_f
static const uint8_t bitalloc_33_bits_f[33]
Definition: dcahuff.c:609
bitalloc_65_codes_b
static const uint16_t bitalloc_65_codes_b[65]
Definition: dcahuff.c:633
bitalloc_25_bits_f
static const uint8_t bitalloc_25_bits_f[25]
Definition: dcahuff.c:513
bitalloc_12_vlc_bits
static const uint8_t bitalloc_12_vlc_bits[DCA_BITALLOC_12_COUNT]
Definition: dcahuff.c:48
avassert.h
grid_2_bitvals
static const uint8_t grid_2_bitvals[40]
Definition: dcahuff.c:1220
av_cold
#define av_cold
Definition: attributes.h:90
grid_3_bitvals
static const uint8_t grid_3_bitvals[26]
Definition: dcahuff.c:1226
bitalloc_65_codes_g
static const uint16_t bitalloc_65_codes_g[65]
Definition: dcahuff.c:693
DCAVLC::max_depth
int max_depth
Parameter for get_vlc2()
Definition: dcahuff.h:38
damp_codes
static const uint16_t damp_codes[7]
Definition: dcahuff.c:1084
bitalloc_17_codes_a
static const uint16_t bitalloc_17_codes_a[17]
Definition: dcahuff.c:362
bitalloc_3_bits
static const uint8_t bitalloc_3_bits[3]
Definition: dcahuff.c:256
scales_codes
static const uint16_t scales_codes[SCALES_COUNT][129]
Definition: dcahuff.c:75
bitalloc_65_codes_a
static const uint16_t bitalloc_65_codes_a[65]
Definition: dcahuff.c:621
damp_bitvals
static const uint8_t damp_bitvals[14]
Definition: dcahuff.c:1181
tnl_scf_bitvals
static const uint8_t tnl_scf_bitvals[40]
Definition: dcahuff.c:1175
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
tnl_grp_0_codes
static const uint16_t tnl_grp_0_codes[37]
Definition: dcahuff.c:1042
fst_rsd_amp_bitvals
static const uint8_t fst_rsd_amp_bitvals[48]
Definition: dcahuff.c:1190
bitalloc_7_bits_c
static const uint8_t bitalloc_7_bits_c[7]
Definition: dcahuff.c:304
tmode_bits
static const uint8_t tmode_bits[TMODE_COUNT][4]
Definition: dcahuff.c:40
bitalloc_3_codes
static const uint16_t bitalloc_3_codes[3]
Definition: dcahuff.c:252
PutBitContext
Definition: put_bits.h:49
SCALES_VLC_BITS
#define SCALES_VLC_BITS
Definition: dcahuff.c:74
bitalloc_bits
static const uint8_t *const bitalloc_bits[DCA_CODE_BOOKS][8]
Definition: dcahuff.c:1024
tmode_codes
static const uint16_t tmode_codes[TMODE_COUNT][4]
Definition: dcahuff.c:33
tnl_grp_2_codes
static const uint16_t tnl_grp_2_codes[31]
Definition: dcahuff.c:1058
tnl_grp_0_bitvals
static const uint8_t tnl_grp_0_bitvals[74]
Definition: dcahuff.c:1139
NULL
#define NULL
Definition: coverity.c:32
bitalloc_13_bits_c
static const uint8_t bitalloc_13_bits_c[13]
Definition: dcahuff.c:358
ff_dca_vlc_calc_quant_bits
uint32_t ff_dca_vlc_calc_quant_bits(int *values, uint8_t n, uint8_t sel, uint8_t table)
Definition: dcahuff.c:1334
ff_dca_init_vlcs
av_cold void ff_dca_init_vlcs(void)
Definition: dcahuff.c:1265
DCAVLC::vlc
VLC vlc[7]
Actual codes.
Definition: dcahuff.h:39
bitalloc_7_codes_b
static const uint16_t bitalloc_7_codes_b[7]
Definition: dcahuff.c:288
bitalloc_13_bits_a
static const uint8_t bitalloc_13_bits_a[13]
Definition: dcahuff.c:350
bitalloc_7_bits_a
static const uint8_t bitalloc_7_bits_a[7]
Definition: dcahuff.c:296
grid_2_codes
static const uint16_t grid_2_codes[20]
Definition: dcahuff.c:1123
bitalloc_25_bits_b
static const uint8_t bitalloc_25_bits_b[25]
Definition: dcahuff.c:493
tnl_grp_2_bitvals
static const uint8_t tnl_grp_2_bitvals[62]
Definition: dcahuff.c:1155
tmode_vlc_bits
static const uint8_t tmode_vlc_bits[TMODE_COUNT]
Definition: dcahuff.c:32
bitalloc_9_bits_a
static const uint8_t bitalloc_9_bits_a[9]
Definition: dcahuff.c:323
bitalloc_25_bits_g
static const uint8_t bitalloc_25_bits_g[25]
Definition: dcahuff.c:518
bitalloc_33_bits_e
static const uint8_t bitalloc_33_bits_e[33]
Definition: dcahuff.c:603
dcahuff.h
id
enum AVCodecID id
Definition: extract_extradata_bsf.c:325
bitalloc_129_bits_a
static const uint8_t bitalloc_129_bits_a[129]
Definition: dcahuff.c:901
bitalloc_129_bits_b
static const uint8_t bitalloc_129_bits_b[129]
Definition: dcahuff.c:913
bitalloc_9_codes_b
static const uint16_t bitalloc_9_codes_b[9]
Definition: dcahuff.c:313
LBR_INIT_VLC
#define LBR_INIT_VLC(vlc, tab, nb_bits)
bitalloc_25_bits_c
static const uint8_t bitalloc_25_bits_c[25]
Definition: dcahuff.c:498
bitalloc_codes
static const uint16_t *const bitalloc_codes[DCA_CODE_BOOKS][8]
Definition: dcahuff.c:1006
DCA_CODE_BOOKS
#define DCA_CODE_BOOKS
Definition: dcahuff.h:33
DCA_BITALLOC_12_COUNT
#define DCA_BITALLOC_12_COUNT
Definition: dcahuff.h:34
bitalloc_17_codes_e
static const uint16_t bitalloc_17_codes_e[17]
Definition: dcahuff.c:386
bitalloc_12_bits
static const uint8_t bitalloc_12_bits[DCA_BITALLOC_12_COUNT][12]
Definition: dcahuff.c:65
bitalloc_13_bits_b
static const uint8_t bitalloc_13_bits_b[13]
Definition: dcahuff.c:354
bitalloc_9_bits_c
static const uint8_t bitalloc_9_bits_c[9]
Definition: dcahuff.c:331
st_grid_codes
static const uint16_t st_grid_codes[22]
Definition: dcahuff.c:1117
rsd_apprx_codes
static const uint16_t rsd_apprx_codes[6]
Definition: dcahuff.c:1099
tnl_grp_3_bitvals
static const uint8_t tnl_grp_3_bitvals[56]
Definition: dcahuff.c:1162
bitalloc_129_codes_e
static const uint16_t bitalloc_129_codes_e[129]
Definition: dcahuff.c:841
bitalloc_65_codes_d
static const uint16_t bitalloc_65_codes_d[65]
Definition: dcahuff.c:657
bitalloc_7_bits_b
static const uint8_t bitalloc_7_bits_b[7]
Definition: dcahuff.c:300
ff_dca_vlc_grid_2
VLC ff_dca_vlc_grid_2
Definition: dcahuff.c:1261
ff_dca_vlc_scale_factor
DCAVLC ff_dca_vlc_scale_factor
Definition: dcahuff.c:1249
ff_dca_vlc_tnl_grp
VLC ff_dca_vlc_tnl_grp[5]
Definition: dcahuff.c:1252
bitalloc_17_codes_f
static const uint16_t bitalloc_17_codes_f[17]
Definition: dcahuff.c:392
tnl_grp_1_bitvals
static const uint8_t tnl_grp_1_bitvals[68]
Definition: dcahuff.c:1147
ff_dca_vlc_tnl_scf
VLC ff_dca_vlc_tnl_scf
Definition: dcahuff.c:1253
ff_dca_vlc_enc_quant
void ff_dca_vlc_enc_quant(PutBitContext *pb, int *values, uint8_t n, uint8_t sel, uint8_t table)
Definition: dcahuff.c:1346
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
bitalloc_13_codes_b
static const uint16_t bitalloc_13_codes_b[13]
Definition: dcahuff.c:340
ff_dca_vlc_quant_index
DCAVLC ff_dca_vlc_quant_index[DCA_CODE_BOOKS]
Definition: dcahuff.c:1250
bitalloc_7_codes_c
static const uint16_t bitalloc_7_codes_c[7]
Definition: dcahuff.c:292
ff_dca_vlc_fst_rsd_amp
VLC ff_dca_vlc_fst_rsd_amp
Definition: dcahuff.c:1256
common.h
dph_bitvals
static const uint8_t dph_bitvals[18]
Definition: dcahuff.c:1185
bitalloc_5_codes_b
static const uint16_t bitalloc_5_codes_b[5]
Definition: dcahuff.c:264
bitalloc_25_codes_g
static const uint16_t bitalloc_25_codes_g[25]
Definition: dcahuff.c:481
bitalloc_33_bits_c
static const uint8_t bitalloc_33_bits_c[33]
Definition: dcahuff.c:591
dph_codes
static const uint16_t dph_codes[9]
Definition: dcahuff.c:1088
tnl_grp_4_codes
static const uint16_t tnl_grp_4_codes[23]
Definition: dcahuff.c:1072
bitalloc_25_bits_e
static const uint8_t bitalloc_25_bits_e[25]
Definition: dcahuff.c:508
bitalloc_129_codes_a
static const uint16_t bitalloc_129_codes_a[129]
Definition: dcahuff.c:761
rsd_apprx_bitvals
static const uint8_t rsd_apprx_bitvals[12]
Definition: dcahuff.c:1196
tnl_grp_3_codes
static const uint16_t tnl_grp_3_codes[28]
Definition: dcahuff.c:1065
bitalloc_33_bits_g
static const uint8_t bitalloc_33_bits_g[33]
Definition: dcahuff.c:615
bitalloc_17_bits_e
static const uint8_t bitalloc_17_bits_e[17]
Definition: dcahuff.c:424
bitalloc_33_codes_g
static const uint16_t bitalloc_33_codes_g[33]
Definition: dcahuff.c:571
bitalloc_65_bits_b
static const uint8_t bitalloc_65_bits_b[65]
Definition: dcahuff.c:713
bitalloc_33_bits_b
static const uint8_t bitalloc_33_bits_b[33]
Definition: dcahuff.c:585
bitalloc_33_codes_e
static const uint16_t bitalloc_33_codes_e[33]
Definition: dcahuff.c:555
bitalloc_sizes
static const uint8_t bitalloc_sizes[DCA_CODE_BOOKS]
Definition: dcahuff.c:985
bitalloc_5_bits_c
static const uint8_t bitalloc_5_bits_c[5]
Definition: dcahuff.c:280
bitalloc_17_bits_d
static const uint8_t bitalloc_17_bits_d[17]
Definition: dcahuff.c:419
bitalloc_129_bits_g
static const uint8_t bitalloc_129_bits_g[129]
Definition: dcahuff.c:973
bitalloc_33_codes_f
static const uint16_t bitalloc_33_codes_f[33]
Definition: dcahuff.c:563
VLC
Definition: vlc.h:26
bitalloc_17_bits_c
static const uint8_t bitalloc_17_bits_c[17]
Definition: dcahuff.c:414
bitalloc_129_codes_c
static const uint16_t bitalloc_129_codes_c[129]
Definition: dcahuff.c:801
bitalloc_17_bits_g
static const uint8_t bitalloc_17_bits_g[17]
Definition: dcahuff.c:434
values
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return values
Definition: filter_design.txt:263
rsd_amp_bitvals
static const uint8_t rsd_amp_bitvals[66]
Definition: dcahuff.c:1200
bitalloc_129_bits_d
static const uint8_t bitalloc_129_bits_d[129]
Definition: dcahuff.c:937
ff_dca_vlc_avg_g3
VLC ff_dca_vlc_avg_g3
Definition: dcahuff.c:1259
bitalloc_33_bits_d
static const uint8_t bitalloc_33_bits_d[33]
Definition: dcahuff.c:597
DCAVLC
Definition: dcahuff.h:36
bitalloc_25_codes_b
static const uint16_t bitalloc_25_codes_b[25]
Definition: dcahuff.c:446
bitalloc_12_codes
static const uint16_t bitalloc_12_codes[DCA_BITALLOC_12_COUNT][12]
Definition: dcahuff.c:52
ff_dca_vlc_bit_allocation
DCAVLC ff_dca_vlc_bit_allocation
Definition: dcahuff.c:1247
bitalloc_25_codes_f
static const uint16_t bitalloc_25_codes_f[25]
Definition: dcahuff.c:474
bitalloc_maxbits
static const uint8_t bitalloc_maxbits[DCA_CODE_BOOKS][7]
Definition: dcahuff.c:993
ff_dca_vlc_rsd_amp
VLC ff_dca_vlc_rsd_amp
Definition: dcahuff.c:1258
bitalloc_65_bits_d
static const uint8_t bitalloc_65_bits_d[65]
Definition: dcahuff.c:729
bitalloc_129_codes_g
static const uint16_t bitalloc_129_codes_g[129]
Definition: dcahuff.c:881
ff_dca_vlc_dph
VLC ff_dca_vlc_dph
Definition: dcahuff.c:1255
ff_dca_vlc_enc_alloc
void ff_dca_vlc_enc_alloc(PutBitContext *pb, int *values, uint8_t n, uint8_t sel)
Definition: dcahuff.c:1367
ff_dca_vlc_rsd
VLC ff_dca_vlc_rsd
Definition: dcahuff.c:1263
bitalloc_129_codes_f
static const uint16_t bitalloc_129_codes_f[129]
Definition: dcahuff.c:861
bitalloc_25_codes_c
static const uint16_t bitalloc_25_codes_c[25]
Definition: dcahuff.c:453
bitalloc_25_codes_e
static const uint16_t bitalloc_25_codes_e[25]
Definition: dcahuff.c:467
bitalloc_17_codes_b
static const uint16_t bitalloc_17_codes_b[17]
Definition: dcahuff.c:368
bitalloc_65_bits_g
static const uint8_t bitalloc_65_bits_g[65]
Definition: dcahuff.c:753
rsd_codes
static const uint16_t rsd_codes[9]
Definition: dcahuff.c:1134
ff_dca_vlc_damp
VLC ff_dca_vlc_damp
Definition: dcahuff.c:1254
fst_rsd_amp_codes
static const uint16_t fst_rsd_amp_codes[24]
Definition: dcahuff.c:1093
bitalloc_65_bits_c
static const uint8_t bitalloc_65_bits_c[65]
Definition: dcahuff.c:721
put_bits.h
tnl_scf_codes
static const uint16_t tnl_scf_codes[20]
Definition: dcahuff.c:1078
bitalloc_17_bits_a
static const uint8_t bitalloc_17_bits_a[17]
Definition: dcahuff.c:404
grid_3_codes
static const uint16_t grid_3_codes[13]
Definition: dcahuff.c:1129