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