dnxhddata: Group together DC-related tables
[libav.git] / libavcodec / dnxhddata.c
CommitLineData
d3dc629c
BC
1/*
2 * VC3/DNxHD data.
406792e7 3 * Copyright (c) 2007 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
d3dc629c 4 *
2912e87a 5 * This file is part of Libav.
d3dc629c 6 *
2912e87a 7 * Libav is free software; you can redistribute it and/or
d3dc629c
BC
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
2912e87a 12 * Libav is distributed in the hope that it will be useful,
d3dc629c
BC
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
2912e87a 18 * License along with Libav; if not, write to the Free Software
d3dc629c
BC
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
0c39c38b 22#include "avcodec.h"
d3dc629c 23#include "dnxhddata.h"
1d9c2dc8 24#include "libavutil/common.h"
d3dc629c 25
d3ae4c65 26/* Used in CID 1235, 1256 */
5ab21439
JA
27static const uint8_t dnxhd_1235_luma_weight[] = {
28 0, 32, 32, 32, 33, 35, 38, 39,
29 32, 33, 32, 33, 36, 36, 39, 42,
30 32, 32, 33, 36, 35, 37, 41, 43,
31 31, 33, 34, 36, 36, 40, 42, 48,
32 32, 34, 36, 37, 39, 42, 46, 51,
33 36, 37, 37, 39, 41, 46, 51, 55,
34 37, 39, 41, 41, 47, 50, 55, 56,
35 41, 42, 41, 44, 50, 53, 60, 60
36};
37
38static const uint8_t dnxhd_1235_chroma_weight[] = {
39 0, 32, 33, 34, 39, 41, 54, 59,
40 33, 34, 35, 38, 43, 49, 58, 84,
41 34, 37, 39, 44, 46, 55, 74, 87,
42 40, 42, 47, 48, 58, 70, 87, 86,
43 43, 50, 56, 63, 72, 94, 91, 82,
44 55, 63, 65, 75, 93, 89, 85, 73,
45 61, 67, 82, 81, 83, 90, 79, 73,
46 74, 84, 75, 78, 90, 85, 73, 73
47};
48
d3ae4c65 49/* Used in CID 1237, 1253 */
6cb1d361 50static const uint8_t dnxhd_1237_luma_weight[] = {
d3dc629c
BC
51 0, 32, 33, 34, 34, 36, 37, 36,
52 36, 37, 38, 38, 38, 39, 41, 44,
53 43, 41, 40, 41, 46, 49, 47, 46,
54 47, 49, 51, 54, 60, 62, 59, 55,
55 54, 56, 58, 61, 65, 66, 64, 63,
56 66, 73, 78, 79, 80, 79, 78, 78,
57 82, 87, 89, 90, 93, 95, 96, 97,
58 97, 100, 104, 102, 98, 98, 99, 99,
59};
60
d3ae4c65 61/* Used in CID 1237, 1253 */
6cb1d361 62static const uint8_t dnxhd_1237_chroma_weight[] = {
d3dc629c
BC
63 0, 32, 36, 39, 39, 38, 39, 41,
64 45, 51, 57, 58, 53, 48, 47, 51,
65 55, 58, 66, 75, 81, 83, 82, 78,
66 73, 72, 74, 77, 83, 85, 83, 82,
67 89, 99, 96, 90, 94, 97, 99, 105,
68 109, 105, 95, 89, 92, 95, 94, 93,
69 92, 88, 89, 90, 93, 95, 96, 97,
70 97, 100, 104, 102, 98, 98, 99, 99,
71};
72
6cb1d361 73static const uint8_t dnxhd_1238_luma_weight[] = {
d3dc629c
BC
74 0, 32, 32, 33, 34, 33, 33, 33,
75 33, 33, 33, 33, 33, 35, 37, 37,
76 36, 36, 35, 36, 38, 38, 36, 35,
77 36, 37, 38, 41, 42, 41, 39, 38,
78 38, 38, 39, 41, 42, 41, 39, 39,
79 40, 41, 43, 44, 44, 44, 44, 44,
80 45, 47, 47, 47, 49, 50, 51, 51,
81 51, 53, 55, 57, 58, 59, 57, 57,
82};
83
6cb1d361 84static const uint8_t dnxhd_1238_chroma_weight[] = {
d3dc629c
BC
85 0, 32, 35, 35, 35, 34, 34, 35,
86 39, 43, 45, 45, 41, 39, 40, 41,
87 42, 44, 48, 55, 59, 63, 65, 59,
88 53, 52, 52, 55, 61, 62, 58, 58,
89 63, 66, 66, 65, 70, 74, 70, 66,
90 65, 68, 75, 77, 74, 74, 77, 76,
91 73, 73, 73, 73, 76, 80, 89, 90,
92 82, 77, 80, 86, 84, 82, 82, 82,
93};
94
cd52a9ca
BC
95static const uint8_t dnxhd_1241_luma_weight[] = {
96 0, 32, 33, 34, 34, 35, 36, 37,
97 36, 37, 38, 38, 38, 39, 39, 40,
98 40, 38, 38, 39, 38, 37, 39, 41,
99 41, 42, 43, 45, 45, 46, 47, 46,
100 45, 43, 39, 37, 37, 40, 44, 45,
101 45, 46, 46, 46, 47, 47, 46, 44,
102 42, 43, 45, 47, 48, 49, 50, 49,
103 48, 46, 47, 48, 48, 49, 49, 49,
104};
105
106static const uint8_t dnxhd_1241_chroma_weight[] = {
107 0, 32, 36, 38, 37, 37, 40, 41,
108 40, 40, 42, 42, 41, 41, 41, 41,
109 42, 43, 44, 44, 45, 46, 46, 45,
110 44, 45, 45, 45, 45, 46, 47, 46,
111 45, 44, 42, 41, 43, 45, 45, 47,
112 48, 48, 48, 46, 47, 47, 46, 47,
113 46, 45, 45, 47, 48, 49, 50, 49,
114 48, 46, 48, 49, 48, 49, 49, 49,
115};
116
6cb1d361 117static const uint8_t dnxhd_1242_luma_weight[] = {
6aacfd22
BC
118 0, 32, 33, 33, 34, 35, 36, 35,
119 33, 33, 35, 36, 37, 37, 38, 37,
120 37, 37, 36, 37, 37, 37, 38, 39,
121 37, 36, 37, 40, 42, 45, 46, 44,
122 41, 42, 44, 45, 47, 49, 50, 48,
123 46, 48, 49, 50, 52, 52, 50, 49,
124 47, 48, 50, 50, 51, 51, 50, 49,
125 49, 51, 52, 51, 49, 47, 47, 47,
126};
127
6cb1d361 128static const uint8_t dnxhd_1242_chroma_weight[] = {
6aacfd22
BC
129 0, 32, 37, 42, 45, 45, 45, 44,
130 38, 37, 40, 42, 44, 49, 51, 47,
131 41, 40, 43, 44, 46, 48, 51, 54,
132 51, 47, 47, 45, 47, 50, 51, 49,
133 46, 47, 49, 47, 50, 55, 55, 51,
134 48, 49, 51, 51, 52, 52, 54, 54,
135 49, 49, 52, 53, 54, 54, 53, 53,
136 55, 59, 63, 62, 60, 60, 60, 60,
ecf86e1a 137};
6aacfd22 138
6cb1d361 139static const uint8_t dnxhd_1243_luma_weight[] = {
d3dc629c
BC
140 0, 32, 32, 33, 33, 35, 35, 35,
141 35, 35, 35, 35, 34, 35, 38, 40,
142 39, 37, 37, 37, 36, 35, 36, 38,
143 40, 41, 42, 44, 45, 44, 42, 41,
144 40, 38, 36, 36, 37, 38, 40, 43,
145 44, 45, 45, 45, 45, 45, 45, 41,
146 39, 41, 45, 47, 47, 48, 48, 48,
147 46, 44, 45, 47, 47, 48, 47, 47,
148};
149
6cb1d361 150static const uint8_t dnxhd_1243_chroma_weight[] = {
d3dc629c
BC
151 0, 32, 36, 37, 36, 37, 39, 39,
152 41, 43, 43, 42, 41, 41, 41, 42,
153 43, 43, 43, 44, 44, 44, 46, 47,
154 46, 45, 45, 45, 45, 46, 44, 44,
155 45, 44, 42, 41, 43, 46, 45, 44,
156 45, 45, 45, 46, 46, 46, 45, 44,
157 45, 44, 45, 47, 47, 48, 49, 48,
158 46, 45, 46, 47, 47, 48, 47, 47,
159};
160
5ab21439
JA
161static const uint8_t dnxhd_1250_luma_weight[] = {
162 0, 32, 35, 35, 36, 36, 41, 43,
163 32, 34, 35, 36, 37, 39, 43, 47,
164 33, 34, 36, 38, 38, 42, 42, 50,
165 34, 36, 38, 38, 41, 40, 47, 54,
166 35, 38, 39, 40, 39, 45, 49, 58,
167 38, 39, 40, 39, 46, 47, 54, 60,
168 38, 39, 41, 46, 46, 48, 57, 62,
169 40, 41, 44, 45, 49, 54, 63, 63
170};
171
172static const uint8_t dnxhd_1250_chroma_weight[] = {
173 0, 32, 35, 36, 40, 42, 51, 51,
174 35, 36, 39, 39, 43, 51, 52, 55,
175 36, 41, 41, 43, 51, 53, 54, 56,
176 43, 44, 45, 50, 54, 54, 55, 57,
177 45, 48, 50, 51, 55, 58, 59, 58,
178 49, 52, 49, 57, 58, 62, 58, 60,
179 51, 51, 56, 58, 62, 61, 59, 62,
180 52, 52, 60, 61, 59, 59, 63, 63
181};
182
cc3a9708
BC
183static const uint8_t dnxhd_1251_luma_weight[] = {
184 0, 32, 32, 34, 34, 34, 34, 35,
185 35, 35, 36, 37, 36, 36, 35, 36,
186 38, 38, 38, 38, 38, 38, 38, 38,
187 38, 38, 39, 41, 44, 43, 41, 40,
188 40, 40, 40, 39, 40, 41, 40, 39,
189 40, 43, 46, 46, 44, 44, 44, 42,
190 41, 43, 46, 48, 50, 55, 58, 53,
191 48, 50, 55, 58, 61, 62, 62, 62,
192};
193
194static const uint8_t dnxhd_1251_chroma_weight[] = {
195 0, 32, 35, 36, 36, 35, 36, 39,
196 41, 43, 45, 44, 41, 39, 40, 42,
197 43, 43, 45, 48, 48, 48, 50, 50,
198 50, 51, 51, 51, 51, 52, 53, 54,
199 51, 49, 51, 52, 52, 56, 57, 55,
200 54, 54, 55, 56, 55, 58, 58, 58,
201 60, 61, 62, 62, 59, 57, 58, 58,
202 61, 59, 59, 59, 61, 62, 62, 62,
203};
204
205static const uint8_t dnxhd_1252_luma_weight[] = {
206 0, 32, 34, 35, 36, 36, 36, 37,
207 36, 37, 39, 40, 41, 40, 40, 40,
208 41, 41, 42, 41, 41, 43, 44, 44,
209 45, 46, 48, 55, 60, 57, 52, 50,
210 49, 49, 52, 52, 53, 55, 58, 62,
211 65, 73, 82, 82, 80, 78, 73, 68,
212 71, 82, 90, 90, 88, 87, 90, 95,
213 100, 107, 103, 97, 95, 93, 99, 99,
214};
215static const uint8_t dnxhd_1252_chroma_weight[] = {
216 0, 32, 35, 36, 37, 37, 38, 40,
217 42, 46, 49, 50, 50, 49, 49, 53,
218 56, 56, 57, 58, 60, 62, 64, 65,
219 63, 64, 64, 65, 66, 65, 67, 71,
220 72, 74, 74, 74, 74, 77, 81, 78,
221 72, 73, 82, 85, 89, 88, 84, 80,
222 90, 100, 90, 90, 88, 87, 90, 95,
223 114, 128, 125, 129, 134, 125, 116, 116,
224};
225
e95018b6
KS
226static const uint8_t dnxhd_1256_chroma_weight[] = {
227 0, 32, 32, 32, 32, 32, 32, 33,
228 32, 32, 32, 32, 32, 32, 32, 34,
229 32, 32, 32, 32, 32, 32, 33, 37,
230 32, 32, 32, 32, 32, 32, 36, 39,
231 32, 32, 32, 32, 32, 34, 39, 44,
232 32, 37, 32, 32, 35, 40, 43, 49,
233 32, 33, 36, 36, 40, 43, 50, 60,
234 34, 37, 39, 44, 51, 56, 61, 70,
235};
236
1a07df31
VG
237static const uint8_t dnxhd_1258_luma_weight[] = {
238 0, 32, 36, 36, 40, 40, 55, 60,
239 34, 36, 37, 40, 41, 48, 57, 82,
240 35, 36, 41, 41, 46, 52, 73, 82,
241 37, 40, 42, 45, 50, 65, 80, 87,
242 39, 41, 44, 49, 62, 78, 88, 90,
243 41, 44, 49, 58, 73, 90, 95, 95,
244 43, 52, 55, 68, 90, 100, 97, 93,
245 52, 53, 71, 82, 107, 103, 99, 99,
246};
247
248static const uint8_t dnxhd_1258_chroma_weight[] = {
249 0, 32, 37, 38, 49, 53, 65, 66,
250 35, 37, 40, 49, 56, 64, 65, 82,
251 36, 42, 50, 56, 64, 67, 73, 85,
252 46, 50, 57, 63, 71, 72, 89, 87,
253 49, 58, 65, 72, 78, 88, 88, 90,
254 60, 64, 74, 81, 84, 90, 95, 134,
255 62, 74, 77, 80, 90, 114, 129, 125,
256 74, 74, 90, 100, 128, 125, 116, 116,
257};
258
5e129ed6
VG
259/* Used in CID 1235, 1241, 1256 */
260static const uint8_t dnxhd_1235_dc_codes[14] = {
261 10, 62, 11, 12, 13, 0, 1, 2, 3, 4, 14, 30, 126, 127,
262};
263
264/* Used in CID 1235, 1241, 1256 */
265static const uint8_t dnxhd_1235_dc_bits[14] = {
266 4, 6, 4, 4, 4, 3, 3, 3, 3, 3, 4, 5, 7, 7,
267};
268
d3ae4c65 269/* Used in CID 1237, 1242, 1253 */
d3dc629c
BC
270static const uint8_t dnxhd_1237_dc_codes[12] = {
271 0, 12, 13, 1, 2, 3, 4, 5, 14, 30, 62, 63,
272};
273
d3ae4c65 274/* Used in CID 1237, 1242, 1253 */
d3dc629c
BC
275static const uint8_t dnxhd_1237_dc_bits[12] = {
276 3, 4, 4, 3, 3, 3, 3, 3, 4, 5, 6, 6,
277};
278
5e129ed6
VG
279/* Used in CID 1238, 1243 */
280static const uint8_t dnxhd_1238_dc_codes[12] = {
281 0, 12, 13, 1, 2, 3, 4, 5, 14, 30, 62, 63,
282};
283
284/* Used in CID 1238, 1243 */
285static const uint8_t dnxhd_1238_dc_bits[12] = {
286 3, 4, 4, 3, 3, 3, 3, 3, 4, 5, 6, 6,
287};
288
289static const uint8_t dnxhd_1250_dc_codes[14] = {
290 10, 62, 11, 12, 13, 0, 1, 2, 3, 4, 14, 30, 126, 127
291};
292
293static const uint8_t dnxhd_1250_dc_bits[14] = {
294 4, 6, 4, 4, 4, 3, 3, 3, 3, 3, 4, 5, 7, 7
295};
296
297static const uint8_t dnxhd_1251_dc_codes[12] = {
298 0, 12, 13, 1, 2, 3, 4, 5, 14, 30, 62, 63,
299};
300
301static const uint8_t dnxhd_1251_dc_bits[12] = {
302 3, 4, 4, 3, 3, 3, 3, 3, 4, 5, 6, 6,
303};
304
305static const uint8_t dnxhd_1252_dc_codes[12] = {
306 0, 12, 13, 1, 2, 3, 4, 5, 14, 30, 62, 63,
307};
308
309static const uint8_t dnxhd_1252_dc_bits[12] = {
310 3, 4, 4, 3, 3, 3, 3, 3, 4, 5, 6, 6,
311};
312
313static const uint8_t dnxhd_1258_dc_codes[14] = {
314 0, 12, 13, 1, 2, 3, 4, 5, 14, 30, 62, 63, 0, 0,
315};
316
317static const uint8_t dnxhd_1258_dc_bits[14] = {
318 3, 4, 4, 3, 3, 3, 3, 3, 4, 5, 6, 6, 0, 0,
319};
320
d3ae4c65 321/* Used in CID 1237, 1242, 1253 */
d3dc629c 322static const uint16_t dnxhd_1237_ac_codes[257] = {
ecf86e1a
MR
323 0, 1, 4, 5, 12, 26, 27, 56,
324 57, 58, 59, 120, 121, 244, 245, 246,
325 247, 248, 498, 499, 500, 501, 502, 1006,
326 1007, 1008, 1009, 1010, 1011, 2024, 2025, 2026,
327 2027, 2028, 2029, 2030, 2031, 4064, 4065, 4066,
328 4067, 4068, 4069, 4070, 4071, 4072, 4073, 8148,
329 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156,
330 8157, 8158, 16318, 16319, 16320, 16321, 16322, 16323,
331 16324, 16325, 16326, 16327, 16328, 16329, 16330, 16331,
332 16332, 16333, 32668, 32669, 32670, 32671, 32672, 32673,
333 32674, 32675, 32676, 32677, 32678, 32679, 32680, 32681,
334 32682, 32683, 32684, 65370, 65371, 65372, 65373, 65374,
335 65375, 65376, 65377, 65378, 65379, 65380, 65381, 65382,
336 65383, 65384, 65385, 65386, 65387, 65388, 65389, 65390,
337 65391, 65392, 65393, 65394, 65395, 65396, 65397, 65398,
338 65399, 65400, 65401, 65402, 65403, 65404, 65405, 65406,
339 65407, 65408, 65409, 65410, 65411, 65412, 65413, 65414,
340 65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422,
341 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430,
342 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
343 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
344 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
345 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
346 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
347 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
348 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
349 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
350 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
351 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
352 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
353 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
354 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
355 65535,
d3dc629c
BC
356};
357
d3ae4c65 358/* Used in CID 1237, 1242, 1253 */
d3dc629c 359static const uint8_t dnxhd_1237_ac_bits[257] = {
ecf86e1a
MR
360 2, 2, 3, 3, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8,
361 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11,
362 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13,
363 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14,
364 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15,
365 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16,
366 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
367 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
368 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
369 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
370 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
371 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
372 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
373 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
374 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
375 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
376 16,
d3dc629c
BC
377};
378
d3ae4c65 379/* Used in CID 1237, 1242, 1253 */
d3dc629c 380static const uint8_t dnxhd_1237_ac_level[257] = {
ecf86e1a
MR
381 1, 1, 2, 0, 3, 4, 2, 5, 6, 7, 3, 8, 9, 10, 11, 12,
382 4, 5, 13, 14, 15, 16, 6, 17, 18, 19, 20, 21, 7, 22, 23, 24,
383 25, 26, 27, 8, 9, 28, 29, 30, 31, 32, 33, 34, 10, 11, 12, 35,
384 36, 37, 38, 39, 40, 41, 13, 14, 15, 16, 42, 43, 44, 45, 46, 47,
385 48, 49, 50, 51, 52, 17, 18, 19, 20, 21, 53, 54, 55, 56, 57, 58,
386 59, 60, 61, 64, 1, 22, 23, 24, 25, 26, 27, 62, 63, 2, 3, 4,
387 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
388 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
389 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
390 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 28, 29, 30, 31,
391 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
392 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
393 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
394 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
395 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
396 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
397 64,
d3dc629c
BC
398};
399
d3ae4c65 400/* Used in CID 1237, 1242, 1253 */
d3dc629c 401static const uint8_t dnxhd_1237_ac_run_flag[257] = {
ecf86e1a
MR
402 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
403 1, 1, 0, 0, 0, 0, 1, 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
427 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
428 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
432 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
433 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
434 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
435 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
436 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
437 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
438 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
439 1,
d3dc629c
BC
440};
441
d3ae4c65 442/* Used in CID 1237, 1242, 1253 */
d3dc629c 443static const uint16_t dnxhd_1237_run_codes[62] = {
ecf86e1a
MR
444 0, 4, 10, 11, 24, 25, 26, 54,
445 55, 56, 57, 58, 118, 119, 240, 482,
446 483, 484, 485, 486, 487, 488, 489, 490,
447 491, 492, 493, 494, 990, 991, 992, 993,
448 994, 995, 996, 997, 998, 999, 1000, 1001,
449 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009,
450 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017,
451 1018, 1019, 1020, 1021, 1022, 1023,
d3dc629c
BC
452};
453
d3ae4c65 454/* Used in CID 1237, 1242, 1253 */
d3dc629c 455static const uint8_t dnxhd_1237_run_bits[62] = {
ecf86e1a
MR
456 1, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 8, 9,
457 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10,
458 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
459 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
d3dc629c
BC
460};
461
d3ae4c65 462/* Used in CID 1237, 1242, 1253 */
d3dc629c 463static const uint8_t dnxhd_1237_run[62] = {
ecf86e1a
MR
464 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
465 17, 18, 19, 20, 21, 53, 57, 58, 59, 60, 61, 62, 22, 23, 24, 25,
466 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
467 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56,
d3dc629c
BC
468};
469
d3ae4c65 470/* Used in CID 1238, 1243 */
d3dc629c 471static const uint16_t dnxhd_1238_ac_codes[257] = {
ecf86e1a
MR
472 0, 1, 4, 10, 11, 24, 25, 26,
473 54, 55, 56, 57, 116, 117, 118, 119,
474 240, 241, 242, 243, 244, 245, 492, 493,
475 494, 495, 496, 497, 498, 499, 1000, 1001,
476 1002, 1003, 1004, 1005, 1006, 1007, 1008, 2018,
477 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026,
478 2027, 4056, 4057, 4058, 4059, 4060, 4061, 4062,
479 4063, 4064, 4065, 4066, 4067, 4068, 4069, 8140,
480 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148,
481 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156,
482 16314, 16315, 16316, 16317, 16318, 16319, 16320, 16321,
483 16322, 16323, 16324, 16325, 16326, 16327, 16328, 16329,
484 16330, 16331, 16332, 16333, 16334, 16335, 16336, 16337,
485 16338, 32678, 32679, 32680, 32681, 32682, 32683, 32684,
486 32685, 32686, 32687, 32688, 32689, 32690, 32691, 32692,
487 32693, 32694, 32695, 32696, 32697, 32698, 32699, 32700,
488 32701, 32702, 32703, 32704, 32705, 65412, 65413, 65414,
489 65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422,
490 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430,
491 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
492 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
493 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
494 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
495 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
496 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
497 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
498 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
499 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
500 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
501 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
502 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
503 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
504 65535,
d3dc629c
BC
505};
506
d3ae4c65 507/* Used in CID 1238, 1243 */
d3dc629c 508static const uint8_t dnxhd_1238_ac_bits[257] = {
ecf86e1a
MR
509 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
510 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10,
511 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11,
512 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13,
513 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
514 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
515 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15,
516 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
517 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
518 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
519 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
520 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
521 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
522 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
523 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
524 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
525 16,
d3dc629c
BC
526};
527
d3ae4c65 528/* Used in CID 1238, 1243 */
d3dc629c 529static const uint8_t dnxhd_1238_ac_level[257] = {
ecf86e1a
MR
530 1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4,
531 12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 22, 6, 7, 23, 24,
532 25, 26, 27, 28, 29, 8, 9, 30, 31, 32, 33, 34, 35, 36, 37, 10,
533 11, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 12, 13, 14, 49,
534 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 15, 16, 17, 18,
535 62, 63, 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
536 14, 15, 16, 19, 20, 21, 22, 23, 24, 17, 18, 19, 20, 21, 22, 23,
537 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 40, 25,
538 26, 27, 28, 29, 30, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49,
539 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 31,
540 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
541 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
542 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
543 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
544 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
545 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
546 64,
d3dc629c
BC
547}; /* 0 is EOB */
548
d3ae4c65 549/* Used in CID 1238, 1243 */
d3dc629c 550static const uint8_t dnxhd_1238_ac_run_flag[257] = {
ecf86e1a
MR
551 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
552 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0,
553 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
554 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
555 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
556 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
557 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
558 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
559 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
560 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
561 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
562 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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1, 1, 1, 1, 1, 1, 1,
587 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
588 1,
d3dc629c
BC
589};
590
d3ae4c65 591/* Used in CID 1235, 1238, 1241, 1256 */
fdd02188 592static const uint16_t dnxhd_1235_run_codes[62] = {
ecf86e1a
MR
593 0, 4, 10, 11, 24, 25, 26, 27,
594 56, 57, 58, 59, 120, 242, 486, 487,
595 488, 489, 980, 981, 982, 983, 984, 985,
596 986, 987, 988, 989, 990, 991, 992, 993,
597 994, 995, 996, 997, 998, 999, 1000, 1001,
598 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009,
599 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017,
600 1018, 1019, 1020, 1021, 1022, 1023,
d3dc629c
BC
601};
602
d3ae4c65 603/* Used in CID 1235, 1238, 1241, 1243, 1256 */
fdd02188 604static const uint8_t dnxhd_1235_run_bits[62] = {
ecf86e1a
MR
605 1, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 8, 9, 9,
606 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
607 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
608 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
d3dc629c
BC
609};
610
611static const uint8_t dnxhd_1238_run[62] = {
ecf86e1a
MR
612 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
613 20, 21, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
614 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
615 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
d3dc629c
BC
616};
617
d3ae4c65 618/* Used in CID 1235, 1241, 1256 */
fdd02188 619static const uint16_t dnxhd_1235_ac_codes[257] = {
ecf86e1a
MR
620 0, 1, 4, 10, 11, 24, 25, 26,
621 54, 55, 56, 57, 116, 117, 118, 119,
622 240, 241, 242, 243, 244, 245, 492, 493,
623 494, 495, 496, 497, 498, 998, 999, 1000,
624 1001, 1002, 1003, 1004, 1005, 1006, 1007, 2016,
625 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024,
626 2025, 2026, 4054, 4055, 4056, 4057, 4058, 4059,
627 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067,
628 4068, 4069, 8140, 8141, 8142, 8143, 8144, 8145,
629 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153,
630 8154, 8155, 8156, 8157, 16316, 16317, 16318, 16319,
631 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327,
632 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335,
633 16336, 16337, 32676, 32677, 32678, 32679, 32680, 32681,
634 32682, 32683, 32684, 32685, 32686, 32687, 32688, 32689,
635 32690, 32691, 32692, 32693, 32694, 32695, 32696, 32697,
636 32698, 32699, 32700, 32701, 32702, 32703, 32704, 32705,
637 32706, 32707, 32708, 65418, 65419, 65420, 65421, 65422,
638 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430,
639 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
640 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
641 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
642 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
643 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
644 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
645 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
646 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
647 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
648 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
649 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
650 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
651 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
652 65535,
cd52a9ca
BC
653};
654
d3ae4c65 655/* Used in CID 1235, 1241, 1256 */
fdd02188 656static const uint8_t dnxhd_1235_ac_bits[257] = {
ecf86e1a
MR
657 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
658 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10,
659 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11,
660 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
661 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
662 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
663 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15,
664 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
665 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16,
666 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
667 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
668 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
669 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
670 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
671 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
672 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
673 16,
cd52a9ca
BC
674};
675
d3ae4c65 676/* Used in CID 1235, 1241, 1256 */
fdd02188 677static const uint8_t dnxhd_1235_ac_level[257] = {
ecf86e1a
MR
678 1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4,
679 12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 6, 7, 22, 23, 24,
680 25, 26, 27, 28, 29, 8, 9, 30, 31, 32, 33, 34, 35, 36, 37, 38,
681 10, 11, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 12, 13,
682 14, 15, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 1,
683 16, 17, 18, 19, 64, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
684 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 18, 19, 20, 21, 22, 23,
685 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
686 40, 41, 42, 25, 26, 27, 28, 29, 30, 31, 32, 43, 44, 45, 46, 47,
687 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
688 64, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
689 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
690 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
691 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
692 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
693 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
694 64,
cd52a9ca
BC
695};
696
d3ae4c65 697/* Used in CID 1235, 1241, 1256 */
fdd02188 698static const uint8_t dnxhd_1235_ac_run_flag[257] = {
ecf86e1a
MR
699 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
700 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
701 0, 0, 0, 0, 0, 1, 1, 0, 0, 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0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
726 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
727 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
728 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
729 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
730 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
731 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
732 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
733 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
734 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
735 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
736 1,
cd52a9ca
BC
737};
738
d3ae4c65 739/* Used in CID 1235, 1241, 1256 */
fdd02188 740static const uint8_t dnxhd_1235_run[62] = {
ecf86e1a
MR
741 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
742 18, 20, 17, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
743 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
744 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
cd52a9ca
BC
745};
746
5ab21439
JA
747static const uint16_t dnxhd_1250_ac_codes[257] = {
748 0, 1, 4, 10, 11, 24, 25, 26,
749 54, 55, 56, 57, 116, 117, 118, 119,
750 240, 241, 242, 243, 244, 245, 492, 493,
751 494, 495, 496, 497, 498, 998, 999, 1000,
752 1001, 1002, 1003, 1004, 1005, 1006, 2014, 2015,
753 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023,
754 2024, 2025, 4052, 4053, 4054, 4055, 4056, 4057,
755 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065,
756 4066, 4067, 8136, 8137, 8138, 8139, 8140, 8141,
757 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149,
758 8150, 8151, 8152, 8153, 8154, 8155, 8156, 16314,
759 16315, 16316, 16317, 16318, 16319, 16320, 16321, 16322,
760 16323, 16324, 16325, 16326, 16327, 16328, 16329, 16330,
761 16331, 16332, 16333, 16334, 16335, 16336, 16337, 16338,
762 32678, 32679, 32680, 32681, 32682, 32683, 32684, 32685,
763 32686, 32687, 32688, 32689, 32690, 32691, 32692, 32693,
764 32694, 32695, 32696, 32697, 32698, 32699, 32700, 32701,
765 32702, 32703, 32704, 32705, 32706, 32707, 32708, 32709,
766 32710, 32711, 32712, 65426, 65427, 65428, 65429, 65430,
767 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
768 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
769 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
770 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
771 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
772 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
773 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
774 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
775 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
776 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
777 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
778 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
779 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
780 65535
781};
782static const uint8_t dnxhd_1250_ac_bits[257] = {
783 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
784 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10,
785 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
786 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
787 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
788 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14,
789 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
790 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
791 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
792 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
793 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
794 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
795 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
796 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
797 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
798 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
799 16
800};
801static const uint8_t dnxhd_1250_ac_level[257] = {
802 1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4,
803 12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 22, 6, 23, 24, 25,
804 26, 27, 28, 29, 7, 8, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
805 9, 10, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 11,
806 12, 13, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1, 2,
807 3, 4, 5, 14, 15, 16, 17, 6, 7, 8, 9, 10, 11, 12, 13, 14,
808 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 18, 19, 20, 21,
809 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
810 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 22, 23, 24,
811 25, 26, 27, 54, 57, 58, 59, 60, 61, 62, 63, 64, 28, 29, 30, 31,
812 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
813 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
814 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
815 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
816 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
817 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
818 64
819};
820static const uint8_t dnxhd_1250_ac_run_flag[257] = {
821 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
822 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
823 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
824 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
825 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
826 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
827 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
828 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
829 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1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1, 1, 1, 1, 1,
853 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
854 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
855 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
856 1
857};
858static const uint16_t dnxhd_1250_run_codes[62] = {
859 0, 4, 5, 12, 26, 27, 28, 58,
860 118, 119, 120, 242, 486, 487, 976, 977,
861 978, 979, 980, 981, 982, 983, 984, 985,
862 986, 987, 988, 989, 990, 991, 992, 993,
863 994, 995, 996, 997, 998, 999, 1000, 1001,
864 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009,
865 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017,
866 1018, 1019, 1020, 1021, 1022, 1023
867};
868static const uint8_t dnxhd_1250_run_bits[62] = {
869 1, 3, 3, 4, 5, 5, 5, 6, 7, 7, 7, 8, 9, 9, 10, 10,
870 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
871 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
872 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
873};
874static const uint8_t dnxhd_1250_run[62] = {
875 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
876 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
877 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
878 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62
879};
880
cc3a9708 881static const uint16_t dnxhd_1251_ac_codes[257] = {
ecf86e1a
MR
882 0, 1, 4, 10, 11, 24, 25, 26,
883 54, 55, 56, 57, 116, 117, 118, 119,
884 240, 241, 242, 243, 244, 245, 492, 493,
885 494, 495, 496, 497, 996, 997, 998, 999,
886 1000, 1001, 1002, 1003, 1004, 1005, 2012, 2013,
887 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
888 2022, 2023, 2024, 2025, 4052, 4053, 4054, 4055,
889 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063,
890 4064, 4065, 4066, 8134, 8135, 8136, 8137, 8138,
891 8139, 8140, 8141, 8142, 8143, 8144, 8145, 8146,
892 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154,
893 8155, 8156, 16314, 16315, 16316, 16317, 16318, 16319,
894 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327,
895 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335,
896 16336, 16337, 16338, 16339, 32680, 32681, 32682, 32683,
897 32684, 32685, 32686, 32687, 32688, 32689, 32690, 32691,
898 32692, 32693, 32694, 32695, 32696, 32697, 32698, 32699,
899 32700, 32701, 32702, 32703, 32704, 32705, 32706, 32707,
900 32708, 32709, 32710, 32711, 32712, 32713, 32714, 65430,
901 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
902 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
903 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
904 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
905 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
906 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
907 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
908 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
909 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
910 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
911 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
912 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
913 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
914 65535,
cc3a9708 915};
ecf86e1a 916
cc3a9708 917static const uint8_t dnxhd_1251_ac_bits[257] = {
ecf86e1a
MR
918 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
919 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10,
920 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
921 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
922 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
923 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14,
924 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
925 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
926 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
927 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
928 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
929 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
930 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
931 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
932 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
933 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
934 16,
cc3a9708 935};
ecf86e1a 936
cc3a9708 937static const uint8_t dnxhd_1251_ac_level[257] = {
ecf86e1a
MR
938 1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4,
939 12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 6, 22, 23, 24, 25,
940 26, 27, 28, 29, 7, 8, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
941 40, 9, 10, 11, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
942 12, 13, 14, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1,
943 2, 3, 4, 5, 6, 7, 8, 15, 16, 17, 9, 10, 11, 12, 13, 14,
944 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 18,
945 19, 20, 21, 22, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
946 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
947 58, 23, 24, 25, 26, 27, 28, 59, 60, 61, 62, 63, 64, 29, 30, 31,
948 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
949 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
950 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
951 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
952 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
953 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
954 64,
cc3a9708 955};
ecf86e1a 956
cc3a9708 957static const uint8_t dnxhd_1251_ac_run_flag[257] = {
ecf86e1a
MR
958 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
959 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
960 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
961 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
962 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
963 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
964 0, 0,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0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0,
988 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
989 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
990 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
991 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
992 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
993 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
994 1,
cc3a9708 995};
ecf86e1a 996
d3ae4c65 997/* Used in CID 1251, 1252, 1258 */
cc3a9708 998static const uint16_t dnxhd_1251_run_codes[62] = {
ecf86e1a
MR
999 0, 4, 5, 12, 26, 27, 28, 58,
1000 118, 119, 120, 242, 486, 487, 976, 977,
1001 978, 979, 980, 981, 982, 983, 984, 985,
1002 986, 987, 988, 989, 990, 991, 992, 993,
1003 994, 995, 996, 997, 998, 999, 1000, 1001,
1004 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009,
1005 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017,
1006 1018, 1019, 1020, 1021, 1022, 1023,
cc3a9708 1007};
ecf86e1a 1008
d3ae4c65 1009/* Used in CID 1251, 1252, 1258 */
cc3a9708 1010static const uint8_t dnxhd_1251_run_bits[62] = {
ecf86e1a
MR
1011 1, 3, 3, 4, 5, 5, 5, 6, 7, 7, 7, 8, 9, 9, 10, 10,
1012 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
1013 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
1014 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
cc3a9708 1015};
ecf86e1a 1016
d3ae4c65 1017/* Used in CID 1251, 1252, 1258 */
cc3a9708 1018static const uint8_t dnxhd_1251_run[62] = {
ecf86e1a
MR
1019 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1020 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1021 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
1022 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
cc3a9708
BC
1023};
1024
d3ae4c65 1025/* Used in CID 1252, 1258 */
cc3a9708 1026static const uint16_t dnxhd_1252_ac_codes[257] = {
ecf86e1a
MR
1027 0, 1, 4, 10, 11, 12, 26, 27,
1028 56, 57, 58, 118, 119, 120, 242, 243,
1029 244, 245, 246, 247, 496, 497, 498, 499,
1030 500, 1002, 1003, 1004, 1005, 1006, 1007, 1008,
1031 1009, 2020, 2021, 2022, 2023, 2024, 2025, 2026,
1032 2027, 2028, 2029, 4060, 4061, 4062, 4063, 4064,
1033 4065, 4066, 4067, 4068, 4069, 4070, 4071, 8144,
1034 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152,
1035 8153, 8154, 8155, 8156, 8157, 8158, 16318, 16319,
1036 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327,
1037 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335,
1038 32672, 32673, 32674, 32675, 32676, 32677, 32678, 32679,
1039 32680, 32681, 32682, 32683, 32684, 32685, 32686, 32687,
1040 32688, 32689, 32690, 32691, 32692, 32693, 32694, 65390,
1041 65391, 65392, 65393, 65394, 65395, 65396, 65397, 65398,
1042 65399, 65400, 65401, 65402, 65403, 65404, 65405, 65406,
1043 65407, 65408, 65409, 65410, 65411, 65412, 65413, 65414,
1044 65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422,
1045 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430,
1046 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
1047 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
1048 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
1049 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
1050 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
1051 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
1052 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
1053 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
1054 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
1055 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
1056 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
1057 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
1058 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
1059 65535,
cc3a9708 1060};
ecf86e1a 1061
d3ae4c65 1062/* Used in CID 1252, 1258 */
cc3a9708 1063static const uint8_t dnxhd_1252_ac_bits[257] = {
ecf86e1a
MR
1064 2, 2, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8,
1065 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10,
1066 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12,
1067 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13,
1068 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
1069 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
1070 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16,
1071 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1072 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1073 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1074 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1075 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1076 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1077 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1078 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1079 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1080 16,
cc3a9708 1081};
ecf86e1a 1082
d3ae4c65 1083/* Used in CID 1252, 1258 */
cc3a9708 1084static const uint8_t dnxhd_1252_ac_level[257] = {
ecf86e1a
MR
1085 1, 1, 2, 3, 2, 0, 4, 5, 6, 7, 3, 8, 9, 10, 11, 12,
1086 13, 14, 4, 5, 15, 16, 17, 18, 6, 19, 20, 21, 22, 23, 24, 7,
1087 8, 25, 26, 27, 28, 29, 30, 31, 32, 9, 10, 33, 34, 35, 36, 37,
1088 38, 39, 40, 41, 11, 12, 13, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1089 51, 52, 53, 14, 15, 16, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
1090 64, 1, 2, 3, 17, 18, 19, 20, 4, 5, 6, 7, 8, 9, 10, 11,
1091 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 22,
1092 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
1093 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1094 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 26, 27, 28, 29, 30, 31,
1095 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1096 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
1097 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1098 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1099 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1100 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
1101 64,
cc3a9708 1102};
ecf86e1a 1103
d3ae4c65 1104/* Used in CID 1252, 1258 */
cc3a9708 1105static const uint8_t dnxhd_1252_ac_run_flag[257] = {
ecf86e1a
MR
1106 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
1107 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1,
1108 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
1109 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1110 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1111 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
1112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0,
1113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1114 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
1116 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1117 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1118 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1119 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1120 1, 1, 1, 1,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
cc3a9708 1145
d3dc629c 1146const CIDEntry ff_dnxhd_cid_table[] = {
5ab21439
JA
1147 { 1235, 1920, 1080, 0, 917504, 917504, 6, 10,
1148 dnxhd_1235_luma_weight, dnxhd_1235_chroma_weight,
fdd02188
VG
1149 dnxhd_1235_dc_codes, dnxhd_1235_dc_bits,
1150 dnxhd_1235_ac_codes, dnxhd_1235_ac_bits, dnxhd_1235_ac_level,
1151 dnxhd_1235_ac_run_flag, dnxhd_1235_ac_index_flag,
1152 dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1235_run,
5ab21439 1153 { 175, 185, 365, 440 } },
d3dc629c 1154 { 1237, 1920, 1080, 0, 606208, 606208, 4, 8,
6cb1d361 1155 dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight,
d3dc629c
BC
1156 dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
1157 dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
1158 dnxhd_1237_ac_run_flag, dnxhd_1237_ac_index_flag,
0c39c38b
BC
1159 dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
1160 { 115, 120, 145, 240, 290 } },
d3dc629c 1161 { 1238, 1920, 1080, 0, 917504, 917504, 4, 8,
6cb1d361 1162 dnxhd_1238_luma_weight, dnxhd_1238_chroma_weight,
d3dc629c
BC
1163 dnxhd_1238_dc_codes, dnxhd_1238_dc_bits,
1164 dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level,
1165 dnxhd_1238_ac_run_flag, dnxhd_1238_ac_index_flag,
fdd02188 1166 dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1238_run,
0c39c38b 1167 { 175, 185, 220, 365, 440 } },
cd52a9ca
BC
1168 { 1241, 1920, 1080, 1, 917504, 458752, 6, 10,
1169 dnxhd_1241_luma_weight, dnxhd_1241_chroma_weight,
fdd02188
VG
1170 dnxhd_1235_dc_codes, dnxhd_1235_dc_bits,
1171 dnxhd_1235_ac_codes, dnxhd_1235_ac_bits, dnxhd_1235_ac_level,
1172 dnxhd_1235_ac_run_flag, dnxhd_1235_ac_index_flag,
1173 dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1235_run,
0c39c38b 1174 { 185, 220 } },
6aacfd22 1175 { 1242, 1920, 1080, 1, 606208, 303104, 4, 8,
6cb1d361 1176 dnxhd_1242_luma_weight, dnxhd_1242_chroma_weight,
6aacfd22
BC
1177 dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
1178 dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
1179 dnxhd_1237_ac_run_flag, dnxhd_1237_ac_index_flag,
0c39c38b
BC
1180 dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
1181 { 120, 145 } },
d3dc629c 1182 { 1243, 1920, 1080, 1, 917504, 458752, 4, 8,
6cb1d361 1183 dnxhd_1243_luma_weight, dnxhd_1243_chroma_weight,
d3dc629c
BC
1184 dnxhd_1238_dc_codes, dnxhd_1238_dc_bits,
1185 dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level,
1186 dnxhd_1238_ac_run_flag, dnxhd_1238_ac_index_flag,
fdd02188 1187 dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1238_run,
0c39c38b 1188 { 185, 220 } },
5ab21439
JA
1189 { 1250, 1280, 720, 0, 458752, 458752, 6, 10,
1190 dnxhd_1250_luma_weight, dnxhd_1250_chroma_weight,
1191 dnxhd_1250_dc_codes, dnxhd_1250_dc_bits,
1192 dnxhd_1250_ac_codes, dnxhd_1250_ac_bits, dnxhd_1250_ac_level,
1193 dnxhd_1250_ac_run_flag, dnxhd_1250_ac_index_flag,
1194 dnxhd_1250_run_codes, dnxhd_1250_run_bits, dnxhd_1250_run,
1195 { 90, 180, 220 } },
cc3a9708
BC
1196 { 1251, 1280, 720, 0, 458752, 458752, 4, 8,
1197 dnxhd_1251_luma_weight, dnxhd_1251_chroma_weight,
1198 dnxhd_1251_dc_codes, dnxhd_1251_dc_bits,
1199 dnxhd_1251_ac_codes, dnxhd_1251_ac_bits, dnxhd_1251_ac_level,
1200 dnxhd_1251_ac_run_flag, dnxhd_1251_ac_index_flag,
0c39c38b
BC
1201 dnxhd_1251_run_codes, dnxhd_1251_run_bits, dnxhd_1251_run,
1202 { 90, 110, 175, 220 } },
cc3a9708
BC
1203 { 1252, 1280, 720, 0, 303104, 303104, 4, 8,
1204 dnxhd_1252_luma_weight, dnxhd_1252_chroma_weight,
1205 dnxhd_1252_dc_codes, dnxhd_1252_dc_bits,
1206 dnxhd_1252_ac_codes, dnxhd_1252_ac_bits, dnxhd_1252_ac_level,
1207 dnxhd_1252_ac_run_flag, dnxhd_1252_ac_index_flag,
439c6503 1208 dnxhd_1251_run_codes, dnxhd_1251_run_bits, dnxhd_1251_run,
0c39c38b 1209 { 60, 75, 115, 145 } },
2e85b344
BC
1210 { 1253, 1920, 1080, 0, 188416, 188416, 4, 8,
1211 dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight,
1212 dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
1213 dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
1214 dnxhd_1237_ac_run_flag, dnxhd_1237_ac_index_flag,
0c39c38b
BC
1215 dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
1216 { 36, 45, 75, 90 } },
e95018b6
KS
1217 { 1256, 1920, 1080, 0, 1835008, 1835008, 6, 10,
1218 dnxhd_1235_luma_weight, dnxhd_1256_chroma_weight,
fdd02188
VG
1219 dnxhd_1235_dc_codes, dnxhd_1235_dc_bits,
1220 dnxhd_1235_ac_codes, dnxhd_1235_ac_bits, dnxhd_1235_ac_level,
1221 dnxhd_1235_ac_run_flag, dnxhd_1235_ac_index_flag,
1222 dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1235_run,
e95018b6 1223 { 350, 390, 440, 730, 880 } },
1a07df31
VG
1224 { 1258, 960, 720, 0, 212992, 212992, 4, 8,
1225 dnxhd_1258_luma_weight, dnxhd_1258_chroma_weight,
1226 dnxhd_1258_dc_codes, dnxhd_1258_dc_bits,
1227 dnxhd_1252_ac_codes, dnxhd_1252_ac_bits, dnxhd_1252_ac_level,
1228 dnxhd_1252_ac_run_flag, dnxhd_1252_ac_index_flag,
1229 dnxhd_1251_run_codes, dnxhd_1251_run_bits, dnxhd_1251_run,
1230 { 42, 60, 75, 115 } },
d3dc629c
BC
1231};
1232
1233int ff_dnxhd_get_cid_table(int cid)
1234{
1235 int i;
37d3e066 1236 for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++)
d3dc629c
BC
1237 if (ff_dnxhd_cid_table[i].cid == cid)
1238 return i;
1239 return -1;
1240}
0c39c38b 1241
5ab21439 1242int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth)
0c39c38b
BC
1243{
1244 int i, j;
89ef08c9 1245 int mbs = avctx->bit_rate / 1000000;
892d2268
BC
1246 if (!mbs)
1247 return 0;
37d3e066 1248 for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) {
0c39c38b
BC
1249 const CIDEntry *cid = &ff_dnxhd_cid_table[i];
1250 if (cid->width == avctx->width && cid->height == avctx->height &&
7c6eb0a1 1251 cid->interlaced == !!(avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) &&
5ab21439 1252 cid->bit_depth == bit_depth) {
0c39c38b
BC
1253 for (j = 0; j < sizeof(cid->bit_rates); j++) {
1254 if (cid->bit_rates[j] == mbs)
1255 return cid->cid;
1256 }
1257 }
1258 }
1259 return 0;
1260}