FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dnxhddata.c
Go to the documentation of this file.
1 /*
2  * VC3/DNxHD data.
3  * Copyright (c) 2007 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
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  *
12  * FFmpeg is distributed in the hope that it will be useful,
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
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "avcodec.h"
23 #include "dnxhddata.h"
24 #include "libavutil/common.h"
25 #include "libavutil/intreadwrite.h"
26 
27 /* The quantization tables below are in zigzag order! */
28 
29 /* Used in CID 1235, 1256, 1270 */
30 static const uint8_t dnxhd_1235_luma_weight[] = {
31  0, 32, 32, 32, 33, 32, 32, 32,
32  32, 31, 32, 33, 33, 33, 33, 35,
33  36, 36, 34, 34, 36, 37, 37, 36,
34  36, 35, 36, 38, 39, 39, 37, 36,
35  37, 37, 39, 41, 42, 41, 39, 39,
36  40, 41, 42, 43, 42, 42, 41, 41,
37  41, 44, 47, 46, 46, 48, 51, 51,
38  50, 50, 53, 55, 55, 56, 60, 60,
39 };
40 
41 /* Used in CID 1235, 1256 */
43  0, 32, 33, 34, 34, 33, 34, 35,
44  37, 40, 43, 42, 39, 38, 39, 41,
45  43, 44, 47, 50, 55, 61, 63, 56,
46  48, 46, 49, 54, 59, 58, 55, 58,
47  63, 65, 67, 74, 84, 82, 75, 72,
48  70, 74, 84, 87, 87, 94, 93, 81,
49  75, 78, 83, 89, 91, 86, 82, 85,
50  90, 90, 85, 79, 73, 73, 73, 73,
51 };
52 
53 /* Used in CID 1237, 1253, 1259, 1273, 1274 */
54 static const uint8_t dnxhd_1237_luma_weight[] = {
55  0, 32, 33, 34, 34, 36, 37, 36,
56  36, 37, 38, 38, 38, 39, 41, 44,
57  43, 41, 40, 41, 46, 49, 47, 46,
58  47, 49, 51, 54, 60, 62, 59, 55,
59  54, 56, 58, 61, 65, 66, 64, 63,
60  66, 73, 78, 79, 80, 79, 78, 78,
61  82, 87, 89, 90, 93, 95, 96, 97,
62  97, 100, 104, 102, 98, 98, 99, 99,
63 };
64 
65 /* Used in CID 1237, 1253, 1259, 1273, 1274 */
67  0, 32, 36, 39, 39, 38, 39, 41,
68  45, 51, 57, 58, 53, 48, 47, 51,
69  55, 58, 66, 75, 81, 83, 82, 78,
70  73, 72, 74, 77, 83, 85, 83, 82,
71  89, 99, 96, 90, 94, 97, 99, 105,
72  109, 105, 95, 89, 92, 95, 94, 93,
73  92, 88, 89, 90, 93, 95, 96, 97,
74  97, 100, 104, 102, 98, 98, 99, 99,
75 };
76 
77 /* Used in CID 1238, 1272 */
78 static const uint8_t dnxhd_1238_luma_weight[] = {
79  0, 32, 32, 33, 34, 33, 33, 33,
80  33, 33, 33, 33, 33, 35, 37, 37,
81  36, 36, 35, 36, 38, 38, 36, 35,
82  36, 37, 38, 41, 42, 41, 39, 38,
83  38, 38, 39, 41, 42, 41, 39, 39,
84  40, 41, 43, 44, 44, 44, 44, 44,
85  45, 47, 47, 47, 49, 50, 51, 51,
86  51, 53, 55, 57, 58, 59, 57, 57,
87 };
88 
89 /* Used in CID 1238, 1272 */
91  0, 32, 35, 35, 35, 34, 34, 35,
92  39, 43, 45, 45, 41, 39, 40, 41,
93  42, 44, 48, 55, 59, 63, 65, 59,
94  53, 52, 52, 55, 61, 62, 58, 58,
95  63, 66, 66, 65, 70, 74, 70, 66,
96  65, 68, 75, 77, 74, 74, 77, 76,
97  73, 73, 73, 73, 76, 80, 89, 90,
98  82, 77, 80, 86, 84, 82, 82, 82,
99 };
100 
101 /* Used in CID 1241, 1271 */
102 static const uint8_t dnxhd_1241_luma_weight[] = {
103  0, 32, 33, 34, 34, 35, 36, 37,
104  36, 37, 38, 38, 38, 39, 39, 40,
105  40, 38, 38, 39, 38, 37, 39, 41,
106  41, 42, 43, 45, 45, 46, 47, 46,
107  45, 43, 39, 37, 37, 40, 44, 45,
108  45, 46, 46, 46, 47, 47, 46, 44,
109  42, 43, 45, 47, 48, 49, 50, 49,
110  48, 46, 47, 48, 48, 49, 49, 49,
111 };
112 
113 /* Used in CID 1241, 1271 */
115  0, 32, 36, 38, 37, 37, 40, 41,
116  40, 40, 42, 42, 41, 41, 41, 41,
117  42, 43, 44, 44, 45, 46, 46, 45,
118  44, 45, 45, 45, 45, 46, 47, 46,
119  45, 44, 42, 41, 43, 45, 45, 47,
120  48, 48, 48, 46, 47, 47, 46, 47,
121  46, 45, 45, 47, 48, 49, 50, 49,
122  48, 46, 48, 49, 48, 49, 49, 49,
123 };
124 
125 static const uint8_t dnxhd_1242_luma_weight[] = {
126  0, 32, 33, 33, 34, 35, 36, 35,
127  33, 33, 35, 36, 37, 37, 38, 37,
128  37, 37, 36, 37, 37, 37, 38, 39,
129  37, 36, 37, 40, 42, 45, 46, 44,
130  41, 42, 44, 45, 47, 49, 50, 48,
131  46, 48, 49, 50, 52, 52, 50, 49,
132  47, 48, 50, 50, 51, 51, 50, 49,
133  49, 51, 52, 51, 49, 47, 47, 47,
134 };
135 
137  0, 32, 37, 42, 45, 45, 45, 44,
138  38, 37, 40, 42, 44, 49, 51, 47,
139  41, 40, 43, 44, 46, 48, 51, 54,
140  51, 47, 47, 45, 47, 50, 51, 49,
141  46, 47, 49, 47, 50, 55, 55, 51,
142  48, 49, 51, 51, 52, 52, 54, 54,
143  49, 49, 52, 53, 54, 54, 53, 53,
144  55, 59, 63, 62, 60, 60, 60, 60,
145 };
146 
147 static const uint8_t dnxhd_1243_luma_weight[] = {
148  0, 32, 32, 33, 33, 35, 35, 35,
149  35, 35, 35, 35, 34, 35, 38, 40,
150  39, 37, 37, 37, 36, 35, 36, 38,
151  40, 41, 42, 44, 45, 44, 42, 41,
152  40, 38, 36, 36, 37, 38, 40, 43,
153  44, 45, 45, 45, 45, 45, 45, 41,
154  39, 41, 45, 47, 47, 48, 48, 48,
155  46, 44, 45, 47, 47, 48, 47, 47,
156 };
157 
159  0, 32, 36, 37, 36, 37, 39, 39,
160  41, 43, 43, 42, 41, 41, 41, 42,
161  43, 43, 43, 44, 44, 44, 46, 47,
162  46, 45, 45, 45, 45, 46, 44, 44,
163  45, 44, 42, 41, 43, 46, 45, 44,
164  45, 45, 45, 46, 46, 46, 45, 44,
165  45, 44, 45, 47, 47, 48, 49, 48,
166  46, 45, 46, 47, 47, 48, 47, 47,
167 };
168 
169 static const uint8_t dnxhd_1250_luma_weight[] = {
170  0, 32, 32, 33, 34, 35, 35, 35,
171  34, 34, 35, 36, 36, 36, 36, 36,
172  37, 38, 38, 38, 38, 38, 39, 39,
173  38, 38, 39, 41, 43, 43, 42, 41,
174  40, 40, 39, 40, 41, 41, 39, 39,
175  40, 42, 47, 50, 47, 45, 46, 46,
176  44, 45, 46, 47, 49, 54, 58, 54,
177  48, 49, 54, 57, 60, 62, 63, 63,
178 };
179 
181  0, 32, 35, 36, 36, 35, 36, 39,
182  41, 43, 45, 44, 41, 39, 40, 42,
183  43, 43, 45, 48, 49, 51, 52, 50,
184  50, 51, 51, 51, 51, 52, 53, 54,
185  51, 49, 51, 52, 52, 56, 57, 55,
186  54, 54, 55, 56, 55, 58, 58, 58,
187  60, 61, 62, 62, 59, 57, 58, 58,
188  61, 59, 59, 59, 60, 62, 63, 63,
189 };
190 
191 static const uint8_t dnxhd_1251_luma_weight[] = {
192  0, 32, 32, 34, 34, 34, 34, 35,
193  35, 35, 36, 37, 36, 36, 35, 36,
194  38, 38, 38, 38, 38, 38, 38, 38,
195  38, 38, 39, 41, 44, 43, 41, 40,
196  40, 40, 40, 39, 40, 41, 40, 39,
197  40, 43, 46, 46, 44, 44, 44, 42,
198  41, 43, 46, 48, 50, 55, 58, 53,
199  48, 50, 55, 58, 61, 62, 62, 62,
200 };
201 
203  0, 32, 35, 36, 36, 35, 36, 39,
204  41, 43, 45, 44, 41, 39, 40, 42,
205  43, 43, 45, 48, 48, 48, 50, 50,
206  50, 51, 51, 51, 51, 52, 53, 54,
207  51, 49, 51, 52, 52, 56, 57, 55,
208  54, 54, 55, 56, 55, 58, 58, 58,
209  60, 61, 62, 62, 59, 57, 58, 58,
210  61, 59, 59, 59, 61, 62, 62, 62,
211 };
212 
213 /* Used in CID 1252, 1258 */
214 static const uint8_t dnxhd_1252_luma_weight[] = {
215  0, 32, 34, 35, 36, 36, 36, 37,
216  36, 37, 39, 40, 41, 40, 40, 40,
217  41, 41, 42, 41, 41, 43, 44, 44,
218  45, 46, 48, 55, 60, 57, 52, 50,
219  49, 49, 52, 52, 53, 55, 58, 62,
220  65, 73, 82, 82, 80, 78, 73, 68,
221  71, 82, 90, 90, 88, 87, 90, 95,
222  100, 107, 103, 97, 95, 93, 99, 99,
223 };
224 
225 /* Used in CID 1252, 1258 */
227  0, 32, 35, 36, 37, 37, 38, 40,
228  42, 46, 49, 50, 50, 49, 49, 53,
229  56, 56, 57, 58, 60, 62, 64, 65,
230  63, 64, 64, 65, 66, 65, 67, 71,
231  72, 74, 74, 74, 74, 77, 81, 78,
232  72, 73, 82, 85, 89, 88, 84, 80,
233  90, 100, 90, 90, 88, 87, 90, 95,
234  114, 128, 125, 129, 134, 125, 116, 116,
235 };
236 
237 static const uint8_t dnxhd_1260_luma_weight[] = {
238  0, 32, 33, 34, 36, 37, 37, 36,
239  34, 33, 34, 35, 37, 38, 40, 41,
240  40, 39, 38, 37, 34, 33, 34, 37,
241  40, 44, 48, 52, 53, 49, 47, 45,
242  42, 38, 36, 36, 38, 41, 43, 44,
243  46, 49, 52, 54, 54, 49, 44, 44,
244  44, 47, 51, 51, 52, 51, 48, 50,
245  52, 53, 53, 50, 50, 54, 54, 54,
246 };
247 
249  0, 32, 34, 38, 42, 40, 38, 36,
250  35, 35, 38, 42, 43, 43, 42, 40,
251  38, 39, 43, 43, 42, 41, 43, 43,
252  42, 44, 46, 45, 45, 46, 47, 46,
253  44, 44, 45, 46, 46, 46, 50, 50,
254  47, 47, 49, 49, 49, 49, 51, 53,
255  51, 49, 53, 57, 56, 52, 50, 52,
256  56, 56, 53, 53, 53, 54, 58, 58,
257 };
258 
259 /* Used in CID 1235, 1236, 1241, 1250, 1256, 1257, 1270, 1271 */
260 static 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, 1236, 1241, 1250, 1256, 1257, 1270, 1271 */
265 static 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 
269 /* Used in CID 1237, 1238, 1242, 1243, 1251, 1252, 1253, 1258, 1259, 1260, 1272, 1273, 1274 */
270 static const uint8_t dnxhd_1237_dc_codes[12] = {
271  0, 12, 13, 1, 2, 3, 4, 5, 14, 30, 62, 63,
272 };
273 
274 /* Used in CID 1237, 1238, 1242, 1243, 1251, 1252, 1253, 1258, 1259, 1260, 1272, 1273, 1274 */
275 static const uint8_t dnxhd_1237_dc_bits[12] = {
276  3, 4, 4, 3, 3, 3, 3, 3, 4, 5, 6, 6,
277 };
278 
279 /* Used in CID 1237, 1242, 1253, 1259, 1260, 1273, 1274 */
280 static const uint16_t dnxhd_1237_ac_codes[257] = {
281  0, 1, 4, 5, 12, 26, 27, 56,
282  57, 58, 59, 120, 121, 244, 245, 246,
283  247, 248, 498, 499, 500, 501, 502, 1006,
284  1007, 1008, 1009, 1010, 1011, 2024, 2025, 2026,
285  2027, 2028, 2029, 2030, 2031, 4064, 4065, 4066,
286  4067, 4068, 4069, 4070, 4071, 4072, 4073, 8148,
287  8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156,
288  8157, 8158, 16318, 16319, 16320, 16321, 16322, 16323,
289  16324, 16325, 16326, 16327, 16328, 16329, 16330, 16331,
290  16332, 16333, 32668, 32669, 32670, 32671, 32672, 32673,
291  32674, 32675, 32676, 32677, 32678, 32679, 32680, 32681,
292  32682, 32683, 32684, 65370, 65371, 65372, 65373, 65374,
293  65375, 65376, 65377, 65378, 65379, 65380, 65381, 65382,
294  65383, 65384, 65385, 65386, 65387, 65388, 65389, 65390,
295  65391, 65392, 65393, 65394, 65395, 65396, 65397, 65398,
296  65399, 65400, 65401, 65402, 65403, 65404, 65405, 65406,
297  65407, 65408, 65409, 65410, 65411, 65412, 65413, 65414,
298  65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422,
299  65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430,
300  65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
301  65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
302  65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
303  65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
304  65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
305  65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
306  65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
307  65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
308  65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
309  65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
310  65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
311  65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
312  65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
313  65535,
314 };
315 
316 /* Used in CID 1237, 1242, 1253, 1259, 1260, 1273, 1274 */
317 static const uint8_t dnxhd_1237_ac_bits[257] = {
318  2, 2, 3, 3, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8,
319  8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11,
320  11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13,
321  13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14,
322  14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15,
323  15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16,
324  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
325  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
326  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
327  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
328  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
329  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
330  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
331  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
332  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
333  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
334  16,
335 };
336 
337 /* Used in CID 1237, 1242, 1253, 1259, 1260, 1273, 1274 */
338 static const uint8_t dnxhd_1237_ac_info[2*257] = {
339  3, 0, 3, 2, 5, 0, 0, 0, 7, 0, 9, 0, 5, 2, 11, 0,
340  13, 0, 15, 0, 7, 2, 17, 0, 19, 0, 21, 0, 23, 0, 25, 0,
341  9, 2, 11, 2, 27, 0, 29, 0, 31, 0, 33, 0, 13, 2, 35, 0,
342  37, 0, 39, 0, 41, 0, 43, 0, 15, 2, 45, 0, 47, 0, 49, 0,
343  51, 0, 53, 0, 55, 0, 17, 2, 19, 2, 57, 0, 59, 0, 61, 0,
344  63, 0, 65, 0, 67, 0, 69, 0, 21, 2, 23, 2, 25, 2, 71, 0,
345  73, 0, 75, 0, 77, 0, 79, 0, 81, 0, 83, 0, 27, 2, 29, 2,
346  31, 2, 33, 2, 85, 0, 87, 0, 89, 0, 91, 0, 93, 0, 95, 0,
347  97, 0, 99, 0, 101, 0, 103, 0, 105, 0, 35, 2, 37, 2, 39, 2,
348  41, 2, 43, 2, 107, 0, 109, 0, 111, 0, 113, 0, 115, 0, 117, 0,
349  119, 0, 121, 0, 123, 0, 129, 0, 3, 1, 45, 2, 47, 2, 49, 2,
350  51, 2, 53, 2, 55, 2, 125, 0, 127, 0, 5, 1, 7, 1, 9, 1,
351  11, 1, 13, 1, 15, 1, 17, 1, 19, 1, 21, 1, 23, 1, 25, 1,
352  27, 1, 29, 1, 31, 1, 33, 1, 35, 1, 37, 1, 39, 1, 41, 1,
353  43, 1, 45, 1, 47, 1, 49, 1, 51, 1, 53, 1, 55, 1, 57, 1,
354  59, 1, 61, 1, 63, 1, 65, 1, 67, 1, 69, 1, 71, 1, 73, 1,
355  75, 1, 77, 1, 79, 1, 81, 1, 83, 1, 85, 1, 87, 1, 89, 1,
356  91, 1, 93, 1, 95, 1, 97, 1, 99, 1, 101, 1, 103, 1, 105, 1,
357  107, 1, 109, 1, 111, 1, 113, 1, 115, 1, 117, 1, 119, 1, 121, 1,
358  123, 1, 125, 1, 127, 1, 129, 1, 57, 2, 59, 2, 61, 2, 63, 2,
359  65, 2, 67, 2, 69, 2, 71, 2, 73, 2, 75, 2, 77, 2, 79, 2,
360  81, 2, 83, 2, 85, 2, 87, 2, 89, 2, 91, 2, 93, 2, 95, 2,
361  97, 2, 99, 2, 101, 2, 103, 2, 105, 2, 107, 2, 109, 2, 111, 2,
362  113, 2, 115, 2, 117, 2, 119, 2, 121, 2, 123, 2, 125, 2, 127, 2,
363  129, 2, 3, 3, 5, 3, 7, 3, 9, 3, 11, 3, 13, 3, 15, 3,
364  17, 3, 19, 3, 21, 3, 23, 3, 25, 3, 27, 3, 29, 3, 31, 3,
365  33, 3, 35, 3, 37, 3, 39, 3, 41, 3, 43, 3, 45, 3, 47, 3,
366  49, 3, 51, 3, 53, 3, 55, 3, 57, 3, 59, 3, 61, 3, 63, 3,
367  65, 3, 67, 3, 69, 3, 71, 3, 73, 3, 75, 3, 77, 3, 79, 3,
368  81, 3, 83, 3, 85, 3, 87, 3, 89, 3, 91, 3, 93, 3, 95, 3,
369  97, 3, 99, 3, 101, 3, 103, 3, 105, 3, 107, 3, 109, 3, 111, 3,
370  113, 3, 115, 3, 117, 3, 119, 3, 121, 3, 123, 3, 125, 3, 127, 3,
371  129, 3,
372 };
373 
374 /* Used in CID 1238, 1240, 1243, 1272 */
375 static const uint16_t dnxhd_1238_ac_codes[257] = {
376  0, 1, 4, 10, 11, 24, 25, 26,
377  54, 55, 56, 57, 116, 117, 118, 119,
378  240, 241, 242, 243, 244, 245, 492, 493,
379  494, 495, 496, 497, 498, 499, 1000, 1001,
380  1002, 1003, 1004, 1005, 1006, 1007, 1008, 2018,
381  2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026,
382  2027, 4056, 4057, 4058, 4059, 4060, 4061, 4062,
383  4063, 4064, 4065, 4066, 4067, 4068, 4069, 8140,
384  8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148,
385  8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156,
386  16314, 16315, 16316, 16317, 16318, 16319, 16320, 16321,
387  16322, 16323, 16324, 16325, 16326, 16327, 16328, 16329,
388  16330, 16331, 16332, 16333, 16334, 16335, 16336, 16337,
389  16338, 32678, 32679, 32680, 32681, 32682, 32683, 32684,
390  32685, 32686, 32687, 32688, 32689, 32690, 32691, 32692,
391  32693, 32694, 32695, 32696, 32697, 32698, 32699, 32700,
392  32701, 32702, 32703, 32704, 32705, 65412, 65413, 65414,
393  65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422,
394  65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430,
395  65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
396  65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
397  65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
398  65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
399  65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
400  65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
401  65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
402  65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
403  65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
404  65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
405  65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
406  65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
407  65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
408  65535,
409 };
410 
411 /* Used in CID 1238, 1240, 1243, 1272 */
412 static const uint8_t dnxhd_1238_ac_bits[257] = {
413  2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
414  8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10,
415  10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11,
416  11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13,
417  13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
418  14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
419  14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15,
420  15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
421  15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
422  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
423  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
424  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
425  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
426  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
427  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
428  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
429  16,
430 };
431 
432 /* Used in CID 1238, 1240, 1243, 1272 */
433 static const uint8_t dnxhd_1238_ac_info[2*257] = {
434  3, 0, 3, 2, 5, 0, 7, 0, 0, 0, 9, 0, 11, 0, 5, 2,
435  13, 0, 15, 0, 17, 0, 7, 2, 19, 0, 21, 0, 23, 0, 9, 2,
436  25, 0, 27, 0, 29, 0, 31, 0, 33, 0, 11, 2, 35, 0, 37, 0,
437  39, 0, 41, 0, 43, 0, 45, 0, 13, 2, 15, 2, 47, 0, 49, 0,
438  51, 0, 53, 0, 55, 0, 57, 0, 59, 0, 17, 2, 19, 2, 61, 0,
439  63, 0, 65, 0, 67, 0, 69, 0, 71, 0, 73, 0, 75, 0, 21, 2,
440  23, 2, 77, 0, 79, 0, 81, 0, 83, 0, 85, 0, 87, 0, 89, 0,
441  91, 0, 93, 0, 95, 0, 97, 0, 25, 2, 27, 2, 29, 2, 99, 0,
442  101, 0, 103, 0, 105, 0, 107, 0, 109, 0, 111, 0, 113, 0, 115, 0,
443  117, 0, 119, 0, 121, 0, 123, 0, 31, 2, 33, 2, 35, 2, 37, 2,
444  125, 0, 127, 0, 129, 0, 3, 1, 5, 1, 7, 1, 9, 1, 11, 1,
445  13, 1, 15, 1, 17, 1, 19, 1, 21, 1, 23, 1, 25, 1, 27, 1,
446  29, 1, 31, 1, 33, 1, 39, 2, 41, 2, 43, 2, 45, 2, 47, 2,
447  49, 2, 35, 1, 37, 1, 39, 1, 41, 1, 43, 1, 45, 1, 47, 1,
448  49, 1, 51, 1, 53, 1, 55, 1, 57, 1, 59, 1, 61, 1, 63, 1,
449  65, 1, 67, 1, 69, 1, 71, 1, 73, 1, 75, 1, 81, 1, 51, 2,
450  53, 2, 55, 2, 57, 2, 59, 2, 61, 2, 77, 1, 79, 1, 83, 1,
451  85, 1, 87, 1, 89, 1, 91, 1, 93, 1, 95, 1, 97, 1, 99, 1,
452  101, 1, 103, 1, 105, 1, 107, 1, 109, 1, 111, 1, 113, 1, 115, 1,
453  117, 1, 119, 1, 121, 1, 123, 1, 125, 1, 127, 1, 129, 1, 63, 2,
454  65, 2, 67, 2, 69, 2, 71, 2, 73, 2, 75, 2, 77, 2, 79, 2,
455  81, 2, 83, 2, 85, 2, 87, 2, 89, 2, 91, 2, 93, 2, 95, 2,
456  97, 2, 99, 2, 101, 2, 103, 2, 105, 2, 107, 2, 109, 2, 111, 2,
457  113, 2, 115, 2, 117, 2, 119, 2, 121, 2, 123, 2, 125, 2, 127, 2,
458  129, 2, 3, 3, 5, 3, 7, 3, 9, 3, 11, 3, 13, 3, 15, 3,
459  17, 3, 19, 3, 21, 3, 23, 3, 25, 3, 27, 3, 29, 3, 31, 3,
460  33, 3, 35, 3, 37, 3, 39, 3, 41, 3, 43, 3, 45, 3, 47, 3,
461  49, 3, 51, 3, 53, 3, 55, 3, 57, 3, 59, 3, 61, 3, 63, 3,
462  65, 3, 67, 3, 69, 3, 71, 3, 73, 3, 75, 3, 77, 3, 79, 3,
463  81, 3, 83, 3, 85, 3, 87, 3, 89, 3, 91, 3, 93, 3, 95, 3,
464  97, 3, 99, 3, 101, 3, 103, 3, 105, 3, 107, 3, 109, 3, 111, 3,
465  113, 3, 115, 3, 117, 3, 119, 3, 121, 3, 123, 3, 125, 3, 127, 3,
466  129, 3,
467 }; /* 0 is EOB */
468 
469 /* Used in CID 1235, 1236, 1241, 1256, 1257, 1270, 1271 */
470 static const uint16_t dnxhd_1235_ac_codes[257] = {
471  0, 1, 4, 10, 11, 24, 25, 26,
472  54, 55, 56, 57, 116, 117, 118, 119,
473  240, 241, 242, 243, 244, 245, 492, 493,
474  494, 495, 496, 497, 498, 998, 999, 1000,
475  1001, 1002, 1003, 1004, 1005, 1006, 1007, 2016,
476  2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024,
477  2025, 2026, 4054, 4055, 4056, 4057, 4058, 4059,
478  4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067,
479  4068, 4069, 8140, 8141, 8142, 8143, 8144, 8145,
480  8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153,
481  8154, 8155, 8156, 8157, 16316, 16317, 16318, 16319,
482  16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327,
483  16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335,
484  16336, 16337, 32676, 32677, 32678, 32679, 32680, 32681,
485  32682, 32683, 32684, 32685, 32686, 32687, 32688, 32689,
486  32690, 32691, 32692, 32693, 32694, 32695, 32696, 32697,
487  32698, 32699, 32700, 32701, 32702, 32703, 32704, 32705,
488  32706, 32707, 32708, 65418, 65419, 65420, 65421, 65422,
489  65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430,
490  65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
491  65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
492  65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
493  65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
494  65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
495  65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
496  65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
497  65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
498  65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
499  65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
500  65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
501  65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
502  65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
503  65535,
504 };
505 
506 /* Used in CID 1235, 1236, 1241, 1256, 1257, 1270, 1271 */
507 static const uint8_t dnxhd_1235_ac_bits[257] = {
508  2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
509  8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10,
510  10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11,
511  11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
512  12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
513  13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
514  14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15,
515  15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
516  15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16,
517  16, 16, 16, 16, 16, 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,
525 };
526 
527 /* Used in CID 1235, 1241, 1256, 1270, 1271 */
528 static const uint8_t dnxhd_1235_ac_info[2*257] = {
529  3, 0, 3, 2, 5, 0, 7, 0, 0, 0, 9, 0, 11, 0, 5, 2,
530  13, 0, 15, 0, 17, 0, 7, 2, 19, 0, 21, 0, 23, 0, 9, 2,
531  25, 0, 27, 0, 29, 0, 31, 0, 33, 0, 11, 2, 35, 0, 37, 0,
532  39, 0, 41, 0, 43, 0, 13, 2, 15, 2, 45, 0, 47, 0, 49, 0,
533  51, 0, 53, 0, 55, 0, 57, 0, 59, 0, 17, 2, 19, 2, 61, 0,
534  63, 0, 65, 0, 67, 0, 69, 0, 71, 0, 73, 0, 75, 0, 77, 0,
535  21, 2, 23, 2, 79, 0, 81, 0, 83, 0, 85, 0, 87, 0, 89, 0,
536  91, 0, 93, 0, 95, 0, 97, 0, 99, 0, 101, 0, 25, 2, 27, 2,
537  29, 2, 31, 2, 103, 0, 105, 0, 107, 0, 109, 0, 111, 0, 113, 0,
538  115, 0, 117, 0, 119, 0, 121, 0, 123, 0, 125, 0, 127, 0, 3, 1,
539  33, 2, 35, 2, 37, 2, 39, 2, 129, 0, 5, 1, 7, 1, 9, 1,
540  11, 1, 13, 1, 15, 1, 17, 1, 19, 1, 21, 1, 23, 1, 25, 1,
541  27, 1, 29, 1, 31, 1, 33, 1, 35, 1, 41, 2, 43, 2, 45, 2,
542  47, 2, 49, 2, 37, 1, 39, 1, 41, 1, 43, 1, 45, 1, 47, 1,
543  49, 1, 51, 1, 53, 1, 55, 1, 57, 1, 59, 1, 61, 1, 63, 1,
544  65, 1, 67, 1, 69, 1, 71, 1, 73, 1, 75, 1, 77, 1, 79, 1,
545  81, 1, 83, 1, 85, 1, 51, 2, 53, 2, 55, 2, 57, 2, 59, 2,
546  61, 2, 63, 2, 65, 2, 87, 1, 89, 1, 91, 1, 93, 1, 95, 1,
547  97, 1, 99, 1, 101, 1, 103, 1, 105, 1, 107, 1, 109, 1, 111, 1,
548  113, 1, 115, 1, 117, 1, 119, 1, 121, 1, 123, 1, 125, 1, 127, 1,
549  129, 1, 67, 2, 69, 2, 71, 2, 73, 2, 75, 2, 77, 2, 79, 2,
550  81, 2, 83, 2, 85, 2, 87, 2, 89, 2, 91, 2, 93, 2, 95, 2,
551  97, 2, 99, 2, 101, 2, 103, 2, 105, 2, 107, 2, 109, 2, 111, 2,
552  113, 2, 115, 2, 117, 2, 119, 2, 121, 2, 123, 2, 125, 2, 127, 2,
553  129, 2, 3, 3, 5, 3, 7, 3, 9, 3, 11, 3, 13, 3, 15, 3,
554  17, 3, 19, 3, 21, 3, 23, 3, 25, 3, 27, 3, 29, 3, 31, 3,
555  33, 3, 35, 3, 37, 3, 39, 3, 41, 3, 43, 3, 45, 3, 47, 3,
556  49, 3, 51, 3, 53, 3, 55, 3, 57, 3, 59, 3, 61, 3, 63, 3,
557  65, 3, 67, 3, 69, 3, 71, 3, 73, 3, 75, 3, 77, 3, 79, 3,
558  81, 3, 83, 3, 85, 3, 87, 3, 89, 3, 91, 3, 93, 3, 95, 3,
559  97, 3, 99, 3, 101, 3, 103, 3, 105, 3, 107, 3, 109, 3, 111, 3,
560  113, 3, 115, 3, 117, 3, 119, 3, 121, 3, 123, 3, 125, 3, 127, 3,
561  129, 3,
562 };
563 
564 static const uint16_t dnxhd_1250_ac_codes[257] = {
565  0, 1, 4, 10, 11, 24, 25, 26,
566  54, 55, 56, 57, 116, 117, 118, 119,
567  240, 241, 242, 243, 244, 245, 492, 493,
568  494, 495, 496, 497, 498, 998, 999, 1000,
569  1001, 1002, 1003, 1004, 1005, 1006, 2014, 2015,
570  2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023,
571  2024, 2025, 4052, 4053, 4054, 4055, 4056, 4057,
572  4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065,
573  4066, 4067, 8136, 8137, 8138, 8139, 8140, 8141,
574  8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149,
575  8150, 8151, 8152, 8153, 8154, 8155, 8156, 16314,
576  16315, 16316, 16317, 16318, 16319, 16320, 16321, 16322,
577  16323, 16324, 16325, 16326, 16327, 16328, 16329, 16330,
578  16331, 16332, 16333, 16334, 16335, 16336, 16337, 16338,
579  32678, 32679, 32680, 32681, 32682, 32683, 32684, 32685,
580  32686, 32687, 32688, 32689, 32690, 32691, 32692, 32693,
581  32694, 32695, 32696, 32697, 32698, 32699, 32700, 32701,
582  32702, 32703, 32704, 32705, 32706, 32707, 32708, 32709,
583  32710, 32711, 32712, 65426, 65427, 65428, 65429, 65430,
584  65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
585  65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
586  65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
587  65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
588  65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
589  65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
590  65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
591  65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
592  65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
593  65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
594  65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
595  65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
596  65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
597  65535
598 };
599 static const uint8_t dnxhd_1250_ac_bits[257] = {
600  2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
601  8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10,
602  10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
603  11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
604  12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
605  13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14,
606  14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
607  15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
608  15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
609  15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
610  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
611  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
612  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
613  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
614  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
615  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
616  16
617 };
618 
619 static const uint8_t dnxhd_1250_ac_info[2*257] = {
620  3, 0, 3, 2, 5, 0, 7, 0, 0, 0, 9, 0, 11, 0, 5, 2,
621  13, 0, 15, 0, 17, 0, 7, 2, 19, 0, 21, 0, 23, 0, 9, 2,
622  25, 0, 27, 0, 29, 0, 31, 0, 33, 0, 11, 2, 35, 0, 37, 0,
623  39, 0, 41, 0, 43, 0, 45, 0, 13, 2, 47, 0, 49, 0, 51, 0,
624  53, 0, 55, 0, 57, 0, 59, 0, 15, 2, 17, 2, 61, 0, 63, 0,
625  65, 0, 67, 0, 69, 0, 71, 0, 73, 0, 75, 0, 77, 0, 79, 0,
626  19, 2, 21, 2, 81, 0, 83, 0, 85, 0, 87, 0, 89, 0, 91, 0,
627  93, 0, 95, 0, 97, 0, 99, 0, 101, 0, 103, 0, 105, 0, 23, 2,
628  25, 2, 27, 2, 107, 0, 109, 0, 111, 0, 113, 0, 115, 0, 117, 0,
629  119, 0, 121, 0, 123, 0, 125, 0, 127, 0, 129, 0, 3, 1, 5, 1,
630  7, 1, 9, 1, 11, 1, 29, 2, 31, 2, 33, 2, 35, 2, 13, 1,
631  15, 1, 17, 1, 19, 1, 21, 1, 23, 1, 25, 1, 27, 1, 29, 1,
632  31, 1, 33, 1, 35, 1, 37, 1, 39, 1, 41, 1, 43, 1, 45, 1,
633  47, 1, 49, 1, 51, 1, 53, 1, 37, 2, 39, 2, 41, 2, 43, 2,
634  55, 1, 57, 1, 59, 1, 61, 1, 63, 1, 65, 1, 67, 1, 69, 1,
635  71, 1, 73, 1, 75, 1, 77, 1, 79, 1, 81, 1, 83, 1, 85, 1,
636  87, 1, 89, 1, 91, 1, 93, 1, 95, 1, 97, 1, 99, 1, 101, 1,
637  103, 1, 105, 1, 107, 1, 111, 1, 113, 1, 45, 2, 47, 2, 49, 2,
638  51, 2, 53, 2, 55, 2, 109, 1, 115, 1, 117, 1, 119, 1, 121, 1,
639  123, 1, 125, 1, 127, 1, 129, 1, 57, 2, 59, 2, 61, 2, 63, 2,
640  65, 2, 67, 2, 69, 2, 71, 2, 73, 2, 75, 2, 77, 2, 79, 2,
641  81, 2, 83, 2, 85, 2, 87, 2, 89, 2, 91, 2, 93, 2, 95, 2,
642  97, 2, 99, 2, 101, 2, 103, 2, 105, 2, 107, 2, 109, 2, 111, 2,
643  113, 2, 115, 2, 117, 2, 119, 2, 121, 2, 123, 2, 125, 2, 127, 2,
644  129, 2, 3, 3, 5, 3, 7, 3, 9, 3, 11, 3, 13, 3, 15, 3,
645  17, 3, 19, 3, 21, 3, 23, 3, 25, 3, 27, 3, 29, 3, 31, 3,
646  33, 3, 35, 3, 37, 3, 39, 3, 41, 3, 43, 3, 45, 3, 47, 3,
647  49, 3, 51, 3, 53, 3, 55, 3, 57, 3, 59, 3, 61, 3, 63, 3,
648  65, 3, 67, 3, 69, 3, 71, 3, 73, 3, 75, 3, 77, 3, 79, 3,
649  81, 3, 83, 3, 85, 3, 87, 3, 89, 3, 91, 3, 93, 3, 95, 3,
650  97, 3, 99, 3, 101, 3, 103, 3, 105, 3, 107, 3, 109, 3, 111, 3,
651  113, 3, 115, 3, 117, 3, 119, 3, 121, 3, 123, 3, 125, 3, 127, 3,
652  129, 3,
653 };
654 
655 static const uint16_t dnxhd_1251_ac_codes[257] = {
656  0, 1, 4, 10, 11, 24, 25, 26,
657  54, 55, 56, 57, 116, 117, 118, 119,
658  240, 241, 242, 243, 244, 245, 492, 493,
659  494, 495, 496, 497, 996, 997, 998, 999,
660  1000, 1001, 1002, 1003, 1004, 1005, 2012, 2013,
661  2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
662  2022, 2023, 2024, 2025, 4052, 4053, 4054, 4055,
663  4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063,
664  4064, 4065, 4066, 8134, 8135, 8136, 8137, 8138,
665  8139, 8140, 8141, 8142, 8143, 8144, 8145, 8146,
666  8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154,
667  8155, 8156, 16314, 16315, 16316, 16317, 16318, 16319,
668  16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327,
669  16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335,
670  16336, 16337, 16338, 16339, 32680, 32681, 32682, 32683,
671  32684, 32685, 32686, 32687, 32688, 32689, 32690, 32691,
672  32692, 32693, 32694, 32695, 32696, 32697, 32698, 32699,
673  32700, 32701, 32702, 32703, 32704, 32705, 32706, 32707,
674  32708, 32709, 32710, 32711, 32712, 32713, 32714, 65430,
675  65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
676  65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
677  65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
678  65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
679  65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
680  65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
681  65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
682  65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
683  65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
684  65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
685  65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
686  65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
687  65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
688  65535,
689 };
690 
691 static const uint8_t dnxhd_1251_ac_bits[257] = {
692  2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
693  8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10,
694  10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
695  11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
696  12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
697  13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14,
698  14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
699  14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
700  15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
701  15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
702  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
703  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
704  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
705  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
706  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
707  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
708  16,
709 };
710 
711 static const uint8_t dnxhd_1251_ac_info[2*257] = {
712  3, 0, 3, 2, 5, 0, 7, 0, 0, 0, 9, 0, 11, 0, 5, 2,
713  13, 0, 15, 0, 17, 0, 7, 2, 19, 0, 21, 0, 23, 0, 9, 2,
714  25, 0, 27, 0, 29, 0, 31, 0, 33, 0, 11, 2, 35, 0, 37, 0,
715  39, 0, 41, 0, 43, 0, 13, 2, 45, 0, 47, 0, 49, 0, 51, 0,
716  53, 0, 55, 0, 57, 0, 59, 0, 15, 2, 17, 2, 61, 0, 63, 0,
717  65, 0, 67, 0, 69, 0, 71, 0, 73, 0, 75, 0, 77, 0, 79, 0,
718  81, 0, 19, 2, 21, 2, 23, 2, 83, 0, 85, 0, 87, 0, 89, 0,
719  91, 0, 93, 0, 95, 0, 97, 0, 99, 0, 101, 0, 103, 0, 105, 0,
720  25, 2, 27, 2, 29, 2, 107, 0, 109, 0, 111, 0, 113, 0, 115, 0,
721  117, 0, 119, 0, 121, 0, 123, 0, 125, 0, 127, 0, 129, 0, 3, 1,
722  5, 1, 7, 1, 9, 1, 11, 1, 13, 1, 15, 1, 17, 1, 31, 2,
723  33, 2, 35, 2, 19, 1, 21, 1, 23, 1, 25, 1, 27, 1, 29, 1,
724  31, 1, 33, 1, 35, 1, 37, 1, 39, 1, 41, 1, 43, 1, 45, 1,
725  47, 1, 49, 1, 51, 1, 53, 1, 55, 1, 57, 1, 59, 1, 37, 2,
726  39, 2, 41, 2, 43, 2, 45, 2, 61, 1, 63, 1, 65, 1, 67, 1,
727  69, 1, 71, 1, 73, 1, 75, 1, 77, 1, 79, 1, 81, 1, 83, 1,
728  85, 1, 87, 1, 89, 1, 91, 1, 93, 1, 95, 1, 97, 1, 99, 1,
729  101, 1, 103, 1, 105, 1, 107, 1, 109, 1, 111, 1, 113, 1, 115, 1,
730  117, 1, 47, 2, 49, 2, 51, 2, 53, 2, 55, 2, 57, 2, 119, 1,
731  121, 1, 123, 1, 125, 1, 127, 1, 129, 1, 59, 2, 61, 2, 63, 2,
732  65, 2, 67, 2, 69, 2, 71, 2, 73, 2, 75, 2, 77, 2, 79, 2,
733  81, 2, 83, 2, 85, 2, 87, 2, 89, 2, 91, 2, 93, 2, 95, 2,
734  97, 2, 99, 2, 101, 2, 103, 2, 105, 2, 107, 2, 109, 2, 111, 2,
735  113, 2, 115, 2, 117, 2, 119, 2, 121, 2, 123, 2, 125, 2, 127, 2,
736  129, 2, 3, 3, 5, 3, 7, 3, 9, 3, 11, 3, 13, 3, 15, 3,
737  17, 3, 19, 3, 21, 3, 23, 3, 25, 3, 27, 3, 29, 3, 31, 3,
738  33, 3, 35, 3, 37, 3, 39, 3, 41, 3, 43, 3, 45, 3, 47, 3,
739  49, 3, 51, 3, 53, 3, 55, 3, 57, 3, 59, 3, 61, 3, 63, 3,
740  65, 3, 67, 3, 69, 3, 71, 3, 73, 3, 75, 3, 77, 3, 79, 3,
741  81, 3, 83, 3, 85, 3, 87, 3, 89, 3, 91, 3, 93, 3, 95, 3,
742  97, 3, 99, 3, 101, 3, 103, 3, 105, 3, 107, 3, 109, 3, 111, 3,
743  113, 3, 115, 3, 117, 3, 119, 3, 121, 3, 123, 3, 125, 3, 127, 3,
744  129, 3,
745 };
746 
747 /* Used in CID 1252, 1258 */
748 static const uint16_t dnxhd_1252_ac_codes[257] = {
749  0, 1, 4, 10, 11, 12, 26, 27,
750  56, 57, 58, 118, 119, 120, 242, 243,
751  244, 245, 246, 247, 496, 497, 498, 499,
752  500, 1002, 1003, 1004, 1005, 1006, 1007, 1008,
753  1009, 2020, 2021, 2022, 2023, 2024, 2025, 2026,
754  2027, 2028, 2029, 4060, 4061, 4062, 4063, 4064,
755  4065, 4066, 4067, 4068, 4069, 4070, 4071, 8144,
756  8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152,
757  8153, 8154, 8155, 8156, 8157, 8158, 16318, 16319,
758  16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327,
759  16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335,
760  32672, 32673, 32674, 32675, 32676, 32677, 32678, 32679,
761  32680, 32681, 32682, 32683, 32684, 32685, 32686, 32687,
762  32688, 32689, 32690, 32691, 32692, 32693, 32694, 65390,
763  65391, 65392, 65393, 65394, 65395, 65396, 65397, 65398,
764  65399, 65400, 65401, 65402, 65403, 65404, 65405, 65406,
765  65407, 65408, 65409, 65410, 65411, 65412, 65413, 65414,
766  65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422,
767  65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430,
768  65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
769  65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
770  65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
771  65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
772  65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
773  65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
774  65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
775  65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
776  65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
777  65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
778  65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
779  65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
780  65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
781  65535,
782 };
783 
784 /* Used in CID 1252, 1258 */
785 static const uint8_t dnxhd_1252_ac_bits[257] = {
786  2, 2, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8,
787  8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10,
788  10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12,
789  12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13,
790  13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
791  14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
792  15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 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, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
800  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
801  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
802  16,
803 };
804 
805 /* Used in CID 1252, 1258 */
806 static const uint8_t dnxhd_1252_ac_info[2*257] = {
807  3, 0, 3, 2, 5, 0, 7, 0, 5, 2, 0, 0, 9, 0, 11, 0,
808  13, 0, 15, 0, 7, 2, 17, 0, 19, 0, 21, 0, 23, 0, 25, 0,
809  27, 0, 29, 0, 9, 2, 11, 2, 31, 0, 33, 0, 35, 0, 37, 0,
810  13, 2, 39, 0, 41, 0, 43, 0, 45, 0, 47, 0, 49, 0, 15, 2,
811  17, 2, 51, 0, 53, 0, 55, 0, 57, 0, 59, 0, 61, 0, 63, 0,
812  65, 0, 19, 2, 21, 2, 67, 0, 69, 0, 71, 0, 73, 0, 75, 0,
813  77, 0, 79, 0, 81, 0, 83, 0, 23, 2, 25, 2, 27, 2, 85, 0,
814  87, 0, 89, 0, 91, 0, 93, 0, 95, 0, 97, 0, 99, 0, 101, 0,
815  103, 0, 105, 0, 107, 0, 29, 2, 31, 2, 33, 2, 109, 0, 111, 0,
816  113, 0, 115, 0, 117, 0, 119, 0, 121, 0, 123, 0, 125, 0, 127, 0,
817  129, 0, 3, 1, 5, 1, 7, 1, 35, 2, 37, 2, 39, 2, 41, 2,
818  9, 1, 11, 1, 13, 1, 15, 1, 17, 1, 19, 1, 21, 1, 23, 1,
819  25, 1, 27, 1, 29, 1, 31, 1, 33, 1, 35, 1, 37, 1, 39, 1,
820  41, 1, 43, 1, 43, 2, 45, 2, 47, 2, 49, 2, 51, 2, 45, 1,
821  47, 1, 49, 1, 51, 1, 53, 1, 55, 1, 57, 1, 59, 1, 61, 1,
822  63, 1, 65, 1, 67, 1, 69, 1, 71, 1, 73, 1, 75, 1, 77, 1,
823  79, 1, 81, 1, 83, 1, 85, 1, 87, 1, 89, 1, 91, 1, 93, 1,
824  95, 1, 97, 1, 99, 1, 101, 1, 103, 1, 105, 1, 107, 1, 109, 1,
825  111, 1, 113, 1, 115, 1, 117, 1, 119, 1, 121, 1, 123, 1, 125, 1,
826  127, 1, 129, 1, 53, 2, 55, 2, 57, 2, 59, 2, 61, 2, 63, 2,
827  65, 2, 67, 2, 69, 2, 71, 2, 73, 2, 75, 2, 77, 2, 79, 2,
828  81, 2, 83, 2, 85, 2, 87, 2, 89, 2, 91, 2, 93, 2, 95, 2,
829  97, 2, 99, 2, 101, 2, 103, 2, 105, 2, 107, 2, 109, 2, 111, 2,
830  113, 2, 115, 2, 117, 2, 119, 2, 121, 2, 123, 2, 125, 2, 127, 2,
831  129, 2, 3, 3, 5, 3, 7, 3, 9, 3, 11, 3, 13, 3, 15, 3,
832  17, 3, 19, 3, 21, 3, 23, 3, 25, 3, 27, 3, 29, 3, 31, 3,
833  33, 3, 35, 3, 37, 3, 39, 3, 41, 3, 43, 3, 45, 3, 47, 3,
834  49, 3, 51, 3, 53, 3, 55, 3, 57, 3, 59, 3, 61, 3, 63, 3,
835  65, 3, 67, 3, 69, 3, 71, 3, 73, 3, 75, 3, 77, 3, 79, 3,
836  81, 3, 83, 3, 85, 3, 87, 3, 89, 3, 91, 3, 93, 3, 95, 3,
837  97, 3, 99, 3, 101, 3, 103, 3, 105, 3, 107, 3, 109, 3, 111, 3,
838  113, 3, 115, 3, 117, 3, 119, 3, 121, 3, 123, 3, 125, 3, 127, 3,
839  129, 3,
840 };
841 
842 /* Used in CID 1235, 1238, 1241, 1243, 1256, 1270, 1271, 1272 */
843 static const uint16_t dnxhd_1235_run_codes[62] = {
844  0, 4, 10, 11, 24, 25, 26, 27,
845  56, 57, 58, 59, 120, 242, 486, 487,
846  488, 489, 980, 981, 982, 983, 984, 985,
847  986, 987, 988, 989, 990, 991, 992, 993,
848  994, 995, 996, 997, 998, 999, 1000, 1001,
849  1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009,
850  1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017,
851  1018, 1019, 1020, 1021, 1022, 1023,
852 };
853 
854 /* Used in CID 1235, 1238, 1241, 1243, 1256, 1270, 1271, 1272 */
855 static const uint8_t dnxhd_1235_run_bits[62] = {
856  1, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 8, 9, 9,
857  9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
858  10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
859  10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
860 };
861 
862 /* Used in CID 1235, 1241, 1256, 1270, 1271 */
863 static const uint8_t dnxhd_1235_run[62] = {
864  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
865  18, 20, 17, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
866  33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
867  49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
868 };
869 
870 /* Used in CID 1237, 1242, 1253, 1259, 1260, 1273, 1274 */
871 static const uint16_t dnxhd_1237_run_codes[62] = {
872  0, 4, 10, 11, 24, 25, 26, 54,
873  55, 56, 57, 58, 118, 119, 240, 482,
874  483, 484, 485, 486, 487, 488, 489, 490,
875  491, 492, 493, 494, 990, 991, 992, 993,
876  994, 995, 996, 997, 998, 999, 1000, 1001,
877  1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009,
878  1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017,
879  1018, 1019, 1020, 1021, 1022, 1023,
880 };
881 
882 /* Used in CID 1237, 1242, 1253, 1259, 1260, 1273, 1274 */
883 static const uint8_t dnxhd_1237_run_bits[62] = {
884  1, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 8, 9,
885  9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10,
886  10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
887  10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
888 };
889 
890 /* Used in CID 1237, 1242, 1253, 1259, 1260, 1273, 1274 */
891 static const uint8_t dnxhd_1237_run[62] = {
892  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
893  17, 18, 19, 20, 21, 53, 57, 58, 59, 60, 61, 62, 22, 23, 24, 25,
894  26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
895  42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56,
896 };
897 
898 /* Used in CID 1238, 1243, 1272 */
899 static const uint8_t dnxhd_1238_run[62] = {
900  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
901  20, 21, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
902  33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
903  49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
904 };
905 
906 /* Used in CID 1250, 1251, 1252, 1258 */
907 static const uint16_t dnxhd_1250_run_codes[62] = {
908  0, 4, 5, 12, 26, 27, 28, 58,
909  118, 119, 120, 242, 486, 487, 976, 977,
910  978, 979, 980, 981, 982, 983, 984, 985,
911  986, 987, 988, 989, 990, 991, 992, 993,
912  994, 995, 996, 997, 998, 999, 1000, 1001,
913  1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009,
914  1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017,
915  1018, 1019, 1020, 1021, 1022, 1023,
916 };
917 
918 /* Used in CID 1250, 1251, 1252, 1258 */
919 static const uint8_t dnxhd_1250_run_bits[62] = {
920  1, 3, 3, 4, 5, 5, 5, 6, 7, 7, 7, 8, 9, 9, 10, 10,
921  10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
922  10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
923  10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
924 };
925 
926 /* Used in CID 1250, 1251, 1252, 1258 */
927 static const uint8_t dnxhd_1250_run[62] = {
928  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
929  17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
930  33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
931  49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
932 };
933 
935  { 1235, 1920, 1080, 917504, 917504,
936  0, 6, 10, 4,
941  { 175, 185, 365, 440 },
942  { { 24000, 1001 }, { 25, 1 }, { 50, 1 }, { 60000, 1001 } } },
943  { 1237, 1920, 1080, 606208, 606208,
944  0, 4, 8, 3,
949  { 115, 120, 145, 240, 290 },
950  { { 24000, 1001 }, { 25, 1 }, { 30000, 1001 }, { 50, 1 }, { 60000, 1001 } } },
951  { 1238, 1920, 1080, 917504, 917504,
952  0, 4, 8, 4,
957  { 175, 185, 220, 365, 440 },
958  { { 24000, 1001 }, { 25, 1 }, { 30000, 1001 }, { 50, 1 }, { 60000, 1001 } } },
959  { 1241, 1920, 1080, 917504, 458752,
960  DNXHD_INTERLACED, 6, 10, 4,
965  { 185, 220 },
966  { { 25, 1 }, { 30000, 1001 } } },
967  { 1242, 1920, 1080, 606208, 303104,
968  DNXHD_INTERLACED, 4, 8, 3,
973  { 120, 145 },
974  { { 25, 1 }, { 30000, 1001 } } },
975  { 1243, 1920, 1080, 917504, 458752,
976  DNXHD_INTERLACED, 4, 8, 4,
981  { 185, 220 },
982  { { 25, 1 }, { 30000, 1001 } } },
983  { 1250, 1280, 720, 458752, 458752,
984  0, 6, 10, 4,
989  { 90, 90, 180, 220 },
990  { { 24000, 1001 }, { 25, 1 }, { 50, 1 }, { 60000, 1001 } } },
991  { 1251, 1280, 720, 458752, 458752,
992  0, 4, 8, 4,
997  { 90, 90, 110, 180, 220 },
998  { { 24000, 1001 }, { 25, 1 }, { 30000, 1001 }, { 50, 1 }, { 60000, 1001 } } },
999  { 1252, 1280, 720, 303104, 303104,
1000  0, 4, 8, 5,
1005  { 60, 60, 75, 120, 145 },
1006  { { 24000, 1001 }, { 25, 1 }, { 30000, 1001 }, { 50, 1 }, { 60000, 1001 } } },
1007  { 1253, 1920, 1080, 188416, 188416,
1008  0, 4, 8, 3,
1013  { 36, 36, 45, 75, 90 },
1014  { { 24000, 1001 }, { 25, 1 }, { 30000, 1001 }, { 50, 1 }, { 60000, 1001 } } },
1015  { 1256, 1920, 1080, 1835008, 1835008,
1016  DNXHD_444, 6, 10, 4,
1021  { 350, 390, 440, 730, 880 },
1022  { { 24000, 1001 }, { 25, 1 }, { 30000, 1001 }, { 50, 1 }, { 60000, 1001 } } },
1023  { 1258, 960, 720, 212992, 212992,
1024  0, 4, 8, 5,
1029  { 42, 60, 75, 115 } },
1030  { 1259, 1440, 1080, 417792, 417792,
1031  0, 4, 8, 3,
1036  { 63, 84, 100, 110 } },
1037  { 1260, 1440, 1080, 835584, 417792,
1038  DNXHD_INTERLACED | DNXHD_MBAFF, 4, 8, 3,
1043  { 80, 90, 100, 110 } },
1045  DNXHD_444, 6, DNXHD_VARIABLE, 4,
1050  { 0 } },
1052  0, 6, DNXHD_VARIABLE, 4,
1057  { 0 } },
1059  0, 4, 8, 4,
1064  { 0 } },
1066  0, 4, 8, 3,
1071  { 0 } },
1073  0, 4, 8, 3,
1078  { 0 } },
1079 };
1080 
1082 {
1083  int i;
1084  for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++)
1085  if (ff_dnxhd_cid_table[i].cid == cid)
1086  return i;
1087  return -1;
1088 }
1089 
1091 {
1092  int i = ff_dnxhd_get_cid_table(cid);
1093  if (i<0)
1094  return i;
1095  return ff_dnxhd_cid_table[i].frame_size;
1096 }
1097 
1099 {
1100  int i = ff_dnxhd_get_cid_table(cid);
1101  if (i < 0)
1102  return i;
1103  return ff_dnxhd_cid_table[i].flags & DNXHD_INTERLACED ? 1 : 0;
1104 }
1105 
1107 {
1108  uint64_t prefix = AV_RB32(buf);
1109  prefix = (prefix << 16) | buf[4] << 8;
1110  return ff_dnxhd_check_header_prefix(prefix);
1111 }
1112 
1114 {
1115  int i, j;
1116  int mbs = avctx->bit_rate / 1000000;
1117  if (!mbs)
1118  return 0;
1119  for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) {
1120  const CIDEntry *cid = &ff_dnxhd_cid_table[i];
1121  int interlaced = cid->flags & DNXHD_INTERLACED ? 1 : 0;
1122  if (cid->width == avctx->width && cid->height == avctx->height &&
1123  interlaced == !!(avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) &&
1124  !(cid->flags & DNXHD_444) && cid->bit_depth == bit_depth) {
1126  cid->flags & DNXHD_MBAFF) {
1127  av_log(avctx, AV_LOG_WARNING, "Profile selected is experimental\n");
1128  continue;
1129  }
1130  for (j = 0; j < FF_ARRAY_ELEMS(cid->bit_rates); j++) {
1131  if (cid->bit_rates[j] == mbs)
1132  return cid->cid;
1133  }
1134  }
1135  }
1136  return 0;
1137 }
1138 
1139 void ff_dnxhd_print_profiles(AVCodecContext *avctx, int loglevel)
1140 {
1141  int i, j;
1142  for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) {
1143  const CIDEntry *cid = &ff_dnxhd_cid_table[i];
1144  for (j = 0; j < FF_ARRAY_ELEMS(cid->bit_rates); j++) {
1145  if (!cid->bit_rates[j])
1146  break;
1147 
1148  av_log(avctx, loglevel, "Frame size: %dx%d%c; bitrate: %dMbps; pixel format: %s; framerate: %d/%d\n",
1149  cid->width, cid->height, cid->flags & DNXHD_INTERLACED ? 'i' : 'p', cid->bit_rates[j],
1150  cid->bit_depth == 10 ? "yuv422p10" : "yuv422p", cid->frame_rates[j].num, cid->frame_rates[j].den);
1151  }
1152  }
1153 }
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
Definition: avcodec.h:2746
static const uint8_t dnxhd_1237_run_bits[62]
Definition: dnxhddata.c:883
static av_always_inline uint64_t ff_dnxhd_check_header_prefix(uint64_t prefix)
Definition: dnxhddata.h:68
AVRational frame_rates[5]
Definition: dnxhddata.h:59
static const uint8_t dnxhd_1238_chroma_weight[]
Definition: dnxhddata.c:90
#define AV_CODEC_FLAG_INTERLACED_DCT
Use interlaced DCT.
Definition: avcodec.h:775
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
int64_t bit_rate
the average bitrate
Definition: avcodec.h:1597
static const uint8_t dnxhd_1242_luma_weight[]
Definition: dnxhddata.c:125
static const uint8_t dnxhd_1250_luma_weight[]
Definition: dnxhddata.c:169
static const uint8_t dnxhd_1250_run_bits[62]
Definition: dnxhddata.c:919
int num
numerator
Definition: rational.h:44
const CIDEntry ff_dnxhd_cid_table[]
Definition: dnxhddata.c:934
int avpriv_dnxhd_get_interlaced(int cid)
Definition: dnxhddata.c:1098
static const uint8_t dnxhd_1242_chroma_weight[]
Definition: dnxhddata.c:136
static const uint16_t dnxhd_1238_ac_codes[257]
Definition: dnxhddata.c:375
static const uint8_t dnxhd_1237_run[62]
Definition: dnxhddata.c:891
static const uint8_t dnxhd_1251_ac_bits[257]
Definition: dnxhddata.c:691
static const uint8_t dnxhd_1243_chroma_weight[]
Definition: dnxhddata.c:158
int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth)
Definition: dnxhddata.c:1113
uint16_t flags
Definition: dnxhddata.h:48
static const uint8_t dnxhd_1250_ac_info[2 *257]
Definition: dnxhddata.c:619
static const uint8_t dnxhd_1238_ac_info[2 *257]
Definition: dnxhddata.c:433
uint8_t
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
Definition: bytestream.h:87
int avpriv_dnxhd_get_frame_size(int cid)
Definition: dnxhddata.c:1090
static const uint8_t dnxhd_1252_ac_bits[257]
Definition: dnxhddata.c:785
static const uint8_t dnxhd_1251_chroma_weight[]
Definition: dnxhddata.c:202
static const uint16_t dnxhd_1251_ac_codes[257]
Definition: dnxhddata.c:655
static const uint16_t dnxhd_1250_run_codes[62]
Definition: dnxhddata.c:907
#define DNXHD_INTERLACED
Additional profile info flags.
Definition: dnxhddata.h:30
#define av_log(a,...)
int ff_dnxhd_get_cid_table(int cid)
Definition: dnxhddata.c:1081
unsigned int width
Definition: dnxhddata.h:45
static const uint8_t dnxhd_1238_ac_bits[257]
Definition: dnxhddata.c:412
uint64_t avpriv_dnxhd_parse_header_prefix(const uint8_t *buf)
Definition: dnxhddata.c:1106
static const uint8_t dnxhd_1251_ac_info[2 *257]
Definition: dnxhddata.c:711
static const uint16_t dnxhd_1237_run_codes[62]
Definition: dnxhddata.c:871
int flags
AV_CODEC_FLAG_*.
Definition: avcodec.h:1627
static const uint8_t dnxhd_1241_chroma_weight[]
Definition: dnxhddata.c:114
static const uint8_t dnxhd_1252_ac_info[2 *257]
Definition: dnxhddata.c:806
static const uint16_t dnxhd_1250_ac_codes[257]
Definition: dnxhddata.c:564
static const uint8_t dnxhd_1237_dc_codes[12]
Definition: dnxhddata.c:270
static const uint8_t dnxhd_1237_luma_weight[]
Definition: dnxhddata.c:54
static const uint8_t dnxhd_1237_dc_bits[12]
Definition: dnxhddata.c:275
uint8_t interlaced
Definition: mxfenc.c:1823
#define DNXHD_MBAFF
Definition: dnxhddata.h:31
static const uint16_t dnxhd_1237_ac_codes[257]
Definition: dnxhddata.c:280
int width
picture width / height.
Definition: avcodec.h:1711
static const uint16_t dnxhd_1252_ac_codes[257]
Definition: dnxhddata.c:748
#define DNXHD_444
Definition: dnxhddata.h:32
static const uint8_t dnxhd_1238_luma_weight[]
Definition: dnxhddata.c:78
static const uint8_t dnxhd_1243_luma_weight[]
Definition: dnxhddata.c:147
void ff_dnxhd_print_profiles(AVCodecContext *avctx, int loglevel)
Definition: dnxhddata.c:1139
static const uint8_t dnxhd_1250_chroma_weight[]
Definition: dnxhddata.c:180
#define FF_ARRAY_ELEMS(a)
static const uint8_t dnxhd_1250_run[62]
Definition: dnxhddata.c:927
int bit_depth
Definition: dnxhddata.h:50
static const uint8_t dnxhd_1235_run[62]
Definition: dnxhddata.c:863
static const uint8_t dnxhd_1260_luma_weight[]
Definition: dnxhddata.c:237
Libavcodec external API header.
main external API structure.
Definition: avcodec.h:1532
void * buf
Definition: avisynth_c.h:553
static const uint8_t dnxhd_1252_luma_weight[]
Definition: dnxhddata.c:214
static const uint8_t dnxhd_1237_ac_info[2 *257]
Definition: dnxhddata.c:338
unsigned int height
Definition: dnxhddata.h:45
static const uint16_t dnxhd_1235_ac_codes[257]
Definition: dnxhddata.c:470
unsigned int frame_size
Definition: dnxhddata.h:46
static const uint8_t dnxhd_1260_chroma_weight[]
Definition: dnxhddata.c:248
static const uint8_t dnxhd_1235_dc_codes[14]
Definition: dnxhddata.c:260
#define DNXHD_VARIABLE
Indicate that a CIDEntry value must be read in the bitstream.
Definition: dnxhddata.h:41
static const uint8_t dnxhd_1235_ac_bits[257]
Definition: dnxhddata.c:507
common internal and external API header
static const uint8_t dnxhd_1235_dc_bits[14]
Definition: dnxhddata.c:265
static unsigned bit_depth(uint64_t mask)
Definition: af_astats.c:128
int den
denominator
Definition: rational.h:45
static const uint8_t dnxhd_1237_ac_bits[257]
Definition: dnxhddata.c:317
static const uint8_t dnxhd_1251_luma_weight[]
Definition: dnxhddata.c:191
static const uint8_t dnxhd_1250_ac_bits[257]
Definition: dnxhddata.c:599
int bit_rates[5]
Helper to choose variants, rounded to nearest 5Mb/s.
Definition: dnxhddata.h:58
static const uint8_t dnxhd_1241_luma_weight[]
Definition: dnxhddata.c:102
static const uint8_t dnxhd_1237_chroma_weight[]
Definition: dnxhddata.c:66
int cid
Definition: dnxhddata.h:44
static const uint8_t dnxhd_1235_chroma_weight[]
Definition: dnxhddata.c:42
static const uint8_t dnxhd_1238_run[62]
Definition: dnxhddata.c:899
static const uint8_t dnxhd_1235_run_bits[62]
Definition: dnxhddata.c:855
static const uint8_t dnxhd_1252_chroma_weight[]
Definition: dnxhddata.c:226
int strict_std_compliance
strictly follow the standard (MPEG4, ...).
Definition: avcodec.h:2741
static const uint8_t dnxhd_1235_ac_info[2 *257]
Definition: dnxhddata.c:528
static const uint16_t dnxhd_1235_run_codes[62]
Definition: dnxhddata.c:843
static const uint8_t dnxhd_1235_luma_weight[]
Definition: dnxhddata.c:30