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