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