forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB8dbd683Tahinli3 months ago856 commits

cdf.rs4519 lines, 166.1 KiBHistoryRawDownload
1//! The default CDF tables of spec section 9.4, in the orientation
2//! [`crate::msac`] reads: cumulative probabilities scaled to `1 << 15`, with
3//! the alphabet's total as the second-to-last entry and the adaptation counter
4//! last.
5//!
6//! Only the syntax elements the tile writer codes today are here; the rest
7//! arrive with the syntax that needs them.
8
9/// `Default_Partition_W64_Cdf` (spec 9.4): the ten partition types of a
10/// 64x64 block, indexed by the context the blocks above and left give.
11pub const PARTITION_W64: [[u16; 11]; 4] = [
12 [
13 20137, 21547, 23078, 29566, 29837, 30261, 30524, 30892, 31724, 32768, 0,
14 ],
15 [
16 6732, 7490, 9497, 27944, 28250, 28515, 28969, 29630, 30104, 32768, 0,
17 ],
18 [
19 5945, 7663, 8348, 28683, 29117, 29749, 30064, 30298, 32238, 32768, 0,
20 ],
21 [
22 870, 1212, 1487, 31198, 31394, 31574, 31743, 31881, 32332, 32768, 0,
23 ],
24];
25
26/// `Default_Skip_Cdf` (spec 9.4): indexed by how many of the blocks above
27/// and left were skipped.
28pub const SKIP: [[u16; 3]; 3] = [[31671, 32768, 0], [16515, 32768, 0], [4576, 32768, 0]];
29
30/// `Default_Intra_Frame_Y_Mode_Cdf` (spec 9.4): the thirteen luma intra
31/// modes of a key frame, indexed by the mode context of the block above and
32/// then of the block to the left.
33pub const KF_Y_MODE: [[[u16; 14]; 5]; 5] = [
34 [
35 [
36 15588, 17027, 19338, 20218, 20682, 21110, 21825, 23244, 24189, 28165, 29093, 30466,
37 32768, 0,
38 ],
39 [
40 12016, 18066, 19516, 20303, 20719, 21444, 21888, 23032, 24434, 28658, 30172, 31409,
41 32768, 0,
42 ],
43 [
44 10052, 10771, 22296, 22788, 23055, 23239, 24133, 25620, 26160, 29336, 29929, 31567,
45 32768, 0,
46 ],
47 [
48 14091, 15406, 16442, 18808, 19136, 19546, 19998, 22096, 24746, 29585, 30958, 32462,
49 32768, 0,
50 ],
51 [
52 12122, 13265, 15603, 16501, 18609, 20033, 22391, 25583, 26437, 30261, 31073, 32475,
53 32768, 0,
54 ],
55 ],
56 [
57 [
58 10023, 19585, 20848, 21440, 21832, 22760, 23089, 24023, 25381, 29014, 30482, 31436,
59 32768, 0,
60 ],
61 [
62 5983, 24099, 24560, 24886, 25066, 25795, 25913, 26423, 27610, 29905, 31276, 31794,
63 32768, 0,
64 ],
65 [
66 7444, 12781, 20177, 20728, 21077, 21607, 22170, 23405, 24469, 27915, 29090, 30492,
67 32768, 0,
68 ],
69 [
70 8537, 14689, 15432, 17087, 17408, 18172, 18408, 19825, 24649, 29153, 31096, 32210,
71 32768, 0,
72 ],
73 [
74 7543, 14231, 15496, 16195, 17905, 20717, 21984, 24516, 26001, 29675, 30981, 31994,
75 32768, 0,
76 ],
77 ],
78 [
79 [
80 12613, 13591, 21383, 22004, 22312, 22577, 23401, 25055, 25729, 29538, 30305, 32077,
81 32768, 0,
82 ],
83 [
84 9687, 13470, 18506, 19230, 19604, 20147, 20695, 22062, 23219, 27743, 29211, 30907,
85 32768, 0,
86 ],
87 [
88 6183, 6505, 26024, 26252, 26366, 26434, 27082, 28354, 28555, 30467, 30794, 32086,
89 32768, 0,
90 ],
91 [
92 10718, 11734, 14954, 17224, 17565, 17924, 18561, 21523, 23878, 28975, 30287, 32252,
93 32768, 0,
94 ],
95 [
96 9194, 9858, 16501, 17263, 18424, 19171, 21563, 25961, 26561, 30072, 30737, 32463,
97 32768, 0,
98 ],
99 ],
100 [
101 [
102 12602, 14399, 15488, 18381, 18778, 19315, 19724, 21419, 25060, 29696, 30917, 32409,
103 32768, 0,
104 ],
105 [
106 8203, 13821, 14524, 17105, 17439, 18131, 18404, 19468, 25225, 29485, 31158, 32342,
107 32768, 0,
108 ],
109 [
110 8451, 9731, 15004, 17643, 18012, 18425, 19070, 21538, 24605, 29118, 30078, 32018,
111 32768, 0,
112 ],
113 [
114 7714, 9048, 9516, 16667, 16817, 16994, 17153, 18767, 26743, 30389, 31536, 32528, 32768,
115 0,
116 ],
117 [
118 8843, 10280, 11496, 15317, 16652, 17943, 19108, 22718, 25769, 29953, 30983, 32485,
119 32768, 0,
120 ],
121 ],
122 [
123 [
124 12578, 13671, 15979, 16834, 19075, 20913, 22989, 25449, 26219, 30214, 31150, 32477,
125 32768, 0,
126 ],
127 [
128 9563, 13626, 15080, 15892, 17756, 20863, 22207, 24236, 25380, 29653, 31143, 32277,
129 32768, 0,
130 ],
131 [
132 8356, 8901, 17616, 18256, 19350, 20106, 22598, 25947, 26466, 29900, 30523, 32261,
133 32768, 0,
134 ],
135 [
136 10835, 11815, 13124, 16042, 17018, 18039, 18947, 22753, 24615, 29489, 30883, 32482,
137 32768, 0,
138 ],
139 [
140 7618, 8288, 9859, 10509, 15386, 18657, 22903, 28776, 29180, 31355, 31802, 32593, 32768,
141 0,
142 ],
143 ],
144];
145
146/// `Default_Uv_Mode_Cdf` (spec 9.4) for blocks where chroma from luma is not
147/// allowed: the thirteen chroma intra modes, indexed by the luma mode.
148pub const UV_MODE_NO_CFL: [[u16; 14]; 13] = [
149 [
150 22631, 24152, 25378, 25661, 25986, 26520, 27055, 27923, 28244, 30059, 30941, 31961, 32768,
151 0,
152 ],
153 [
154 9513, 26881, 26973, 27046, 27118, 27664, 27739, 27824, 28359, 29505, 29800, 31796, 32768, 0,
155 ],
156 [
157 9845, 9915, 28663, 28704, 28757, 28780, 29198, 29822, 29854, 30764, 31777, 32029, 32768, 0,
158 ],
159 [
160 13639, 13897, 14171, 25331, 25606, 25727, 25953, 27148, 28577, 30612, 31355, 32493, 32768,
161 0,
162 ],
163 [
164 9764, 9835, 9930, 9954, 25386, 27053, 27958, 28148, 28243, 31101, 31744, 32363, 32768, 0,
165 ],
166 [
167 11825, 13589, 13677, 13720, 15048, 29213, 29301, 29458, 29711, 31161, 31441, 32550, 32768,
168 0,
169 ],
170 [
171 14175, 14399, 16608, 16821, 17718, 17775, 28551, 30200, 30245, 31837, 32342, 32667, 32768,
172 0,
173 ],
174 [
175 12885, 13038, 14978, 15590, 15673, 15748, 16176, 29128, 29267, 30643, 31961, 32461, 32768,
176 0,
177 ],
178 [
179 12026, 13661, 13874, 15305, 15490, 15726, 15995, 16273, 28443, 30388, 30767, 32416, 32768,
180 0,
181 ],
182 [
183 19052, 19840, 20579, 20916, 21150, 21467, 21885, 22719, 23174, 28861, 30379, 32175, 32768,
184 0,
185 ],
186 [
187 18627, 19649, 20974, 21219, 21492, 21816, 22199, 23119, 23527, 27053, 31397, 32148, 32768,
188 0,
189 ],
190 [
191 17026, 19004, 19997, 20339, 20586, 21103, 21349, 21907, 22482, 25896, 26541, 31819, 32768,
192 0,
193 ],
194 [
195 12124, 13759, 14959, 14992, 15007, 15051, 15078, 15166, 15255, 15753, 16039, 16606, 32768,
196 0,
197 ],
198];
199
200// The coefficient CDFs below are the q-context-2 tables (`base_q_idx` 61..=120,
201// spec 8.3.2's `Default_..._Cdf[2]`), which is the context the frames this
202// crate writes today sit in. The other three sets arrive with the rate control
203// that can leave that band.
204
205/// `Default_Txb_Skip_Cdf[2][4][0]` (spec 9.4): the all-zero flag of a 64x64
206/// luma transform block whose block size is the transform size, so its
207/// context is 0.
208pub const TXB_SKIP_LUMA_64: [u16; 3] = [28573, 32768, 0];
209
210/// `Default_Txb_Skip_Cdf[2][3][7]` (spec 9.4): the all-zero flag of a 32x32
211/// chroma transform block that covers its whole plane block with no coded
212/// neighbour, which is context 7.
213pub const TXB_SKIP_CHROMA_32_NONE: [u16; 3] = [5124, 32768, 0];
214
215/// `Default_Eob_Pt_1024_Cdf[2][0][0]` (spec 9.4): the end-of-block position
216/// token of a luma transform block with 1024 coded coefficient positions —
217/// what a 64x64 transform has, since only its top-left 32x32 is coded.
218pub const EOB_PT_1024_LUMA: [u16; 12] = [
219 2784, 3831, 7041, 10521, 14847, 18844, 23155, 26682, 29229, 31045, 32768, 0,
220];
221
222/// `Default_Coeff_Base_Eob_Cdf[2][4][0][0]` (spec 9.4): the level of the last
223/// coefficient of a 64x64 luma transform block, less one, when that
224/// coefficient is the DC.
225pub const COEFF_BASE_EOB_LUMA_64_DC: [u16; 4] = [935, 3382, 32768, 0];
226
227/// `Default_Dc_Sign_Cdf[2][0]` (spec 9.4): the sign of a luma DC coefficient,
228/// indexed by whether the neighbouring blocks' DC signs lean negative (1),
229/// positive (2) or neither (0).
230pub const DC_SIGN_LUMA: [[u16; 3]; 3] = [[16000, 32768, 0], [13056, 32768, 0], [18816, 32768, 0]];
231
232/// `Default_Partition_W32_Cdf` (spec 9.4): the ten partition types of a
233/// 32x32 block, indexed by the context the blocks above and left give.
234pub const PARTITION_W32: [[u16; 11]; 4] = [
235 [
236 18462, 20920, 23124, 27647, 28227, 29049, 29519, 30178, 31544, 32768, 0,
237 ],
238 [
239 7689, 9060, 12056, 24992, 25660, 26182, 26951, 28041, 29052, 32768, 0,
240 ],
241 [
242 6015, 9009, 10062, 24544, 25409, 26545, 27071, 27526, 32047, 32768, 0,
243 ],
244 [
245 1394, 2208, 2796, 28614, 29061, 29466, 29840, 30185, 31899, 32768, 0,
246 ],
247];
248
249/// `Default_Uv_Mode_Cfl_Allowed_Cdf` (spec 9.4): the fourteen chroma intra
250/// modes — the thirteen the CFL-free table has, plus chroma from luma —
251/// indexed by the luma mode of the same block. A block of 32x32 or smaller is
252/// offered CFL, so it reads this table where a 64x64 block reads
253/// [`UV_MODE_NO_CFL`].
254pub const UV_MODE_CFL: [[u16; 15]; 13] = [
255 [
256 10407, 11208, 12900, 13181, 13823, 14175, 14899, 15656, 15986, 20086, 20995, 22455, 24212,
257 32768, 0,
258 ],
259 [
260 4532, 19780, 20057, 20215, 20428, 21071, 21199, 21451, 22099, 24228, 24693, 27032, 29472,
261 32768, 0,
262 ],
263 [
264 5273, 5379, 20177, 20270, 20385, 20439, 20949, 21695, 21774, 23138, 24256, 24703, 26679,
265 32768, 0,
266 ],
267 [
268 6740, 7167, 7662, 14152, 14536, 14785, 15034, 16741, 18371, 21520, 22206, 23389, 24182,
269 32768, 0,
270 ],
271 [
272 4987, 5368, 5928, 6068, 19114, 20315, 21857, 22253, 22411, 24911, 25380, 26027, 26376,
273 32768, 0,
274 ],
275 [
276 5370, 6889, 7247, 7393, 9498, 21114, 21402, 21753, 21981, 24780, 25386, 26517, 27176,
277 32768, 0,
278 ],
279 [
280 4816, 4961, 7204, 7326, 8765, 8930, 20169, 20682, 20803, 23188, 23763, 24455, 24940, 32768,
281 0,
282 ],
283 [
284 6608, 6740, 8529, 9049, 9257, 9356, 9735, 18827, 19059, 22336, 23204, 23964, 24793, 32768,
285 0,
286 ],
287 [
288 5998, 7419, 7781, 8933, 9255, 9549, 9753, 10417, 18898, 22494, 23139, 24764, 25989, 32768,
289 0,
290 ],
291 [
292 10660, 11298, 12550, 12957, 13322, 13624, 14040, 15004, 15534, 20714, 21789, 23443, 24861,
293 32768, 0,
294 ],
295 [
296 10522, 11530, 12552, 12963, 13378, 13779, 14245, 15235, 15902, 20102, 22696, 23774, 25838,
297 32768, 0,
298 ],
299 [
300 10099, 10691, 12639, 13049, 13386, 13665, 14125, 15163, 15636, 19676, 20474, 23519, 25208,
301 32768, 0,
302 ],
303 [
304 3144, 5087, 7382, 7504, 7593, 7690, 7801, 8064, 8232, 9248, 9875, 10521, 29048, 32768, 0,
305 ],
306];
307
308/// `Default_Cfl_Sign_Cdf` (spec 9.4): the joint sign of a `UV_CFL_PRED`
309/// block's U/V alpha (spec 5.11.45's `cfl_alpha_signs`) — libaom's
310/// `default_cfl_sign_cdf` (entropymode.c), whose `AOM_CDF8(a0..a6)` arguments
311/// are this convention's cumulative points verbatim (only the *storage*, not
312/// the spec's own table, is `AOM_ICDF`-inverted).
313pub const CFL_SIGN: [u16; 9] = [1418, 2123, 13340, 18405, 26972, 28343, 32294, 32768, 0];
314
315/// `default_filter_intra_cdfs` (entropymode.c), the `use_filter_intra` flag's
316/// prior, indexed by block-size class: `[0]`=4x4, `[1]`=8x8, `[2]`=16x16,
317/// `[3]`=32x32 -- the only square sizes `av1_filter_intra_allowed_bsize`
318/// (width and height both <=32) ever offers this decoder's square blocks.
319pub const FILTER_INTRA: [[u16; 3]; 4] = [
320 [4621, 32768, 0],
321 [7866, 32768, 0],
322 [12408, 32768, 0],
323 [22343, 32768, 0],
324];
325/// `default_filter_intra_mode_cdf` (entropymode.c): which of the five
326/// `FILTER_INTRA_MODES` a `use_filter_intra` block picks.
327pub const FILTER_INTRA_MODE: [u16; 6] = [8949, 12776, 17211, 29558, 32768, 0];
328
329/// `default_tx_size_cdf[0]` (entropymode.c): an 8x8 block's `tx_depth` flag
330/// (`TX8` vs `TX4`), indexed by `tx_size_context` (0..=2).
331pub const TX_SIZE_CAT0: [[u16; 3]; 3] = [[19968, 32768, 0], [19968, 32768, 0], [24320, 32768, 0]];
332/// `default_tx_size_cdf[1]` (entropymode.c): a 16x16 block's `tx_depth`
333/// (`TX16`/`TX8`/`TX4`), indexed by `tx_size_context`.
334pub const TX_SIZE_CAT1: [[u16; 4]; 3] = [
335 [12272, 30172, 32768, 0],
336 [12272, 30172, 32768, 0],
337 [18677, 30848, 32768, 0],
338];
339/// `default_tx_size_cdf[2]` (entropymode.c): a 32x32 block's `tx_depth`
340/// (`TX32`/`TX16`/`TX8`), indexed by `tx_size_context`.
341pub const TX_SIZE_CAT2: [[u16; 4]; 3] = [
342 [12986, 15180, 32768, 0],
343 [12986, 15180, 32768, 0],
344 [24302, 25602, 32768, 0],
345];
346/// `default_tx_size_cdf[3]` (entropymode.c): a 64x64 block's `tx_depth`
347/// (`TX64`/`TX32`/`TX16`), indexed by `tx_size_context`.
348pub const TX_SIZE_CAT3: [[u16; 4]; 3] = [
349 [5782, 11475, 32768, 0],
350 [5782, 11475, 32768, 0],
351 [16803, 22759, 32768, 0],
352];
353
354/// `default_switchable_interp_cdf` (spec 9.4): a `SWITCHABLE`-filter frame's
355/// per-block `interp_filter[dir]` (spec 5.11.20's `read_interpolation_filter`,
356/// three symbols -- `EIGHTTAP`/`EIGHTTAP_SMOOTH`/`EIGHTTAP_SHARP`, `BILINEAR`
357/// is never chosen this way), indexed by `av1_get_pred_context_switchable_interp`'s
358/// `ctx_offset + dir * INTER_FILTER_DIR_OFFSET + neighbour_term`
359/// (`INTER_FILTER_DIR_OFFSET` = 8; this decoder never codes a compound
360/// reference, so `ctx_offset` -- `INTER_FILTER_COMP_OFFSET` on a second
361/// reference frame -- is always 0, leaving rows 0..=3 for `dir` 0 and 8..=11
362/// for `dir` 1).
363pub const SWITCHABLE_INTERP: [[u16; 4]; 16] = [
364 [31935, 32720, 32768, 0],
365 [5568, 32719, 32768, 0],
366 [422, 2938, 32768, 0],
367 [28244, 32608, 32768, 0],
368 [31206, 31953, 32768, 0],
369 [4862, 32121, 32768, 0],
370 [770, 1152, 32768, 0],
371 [20889, 25637, 32768, 0],
372 [31910, 32724, 32768, 0],
373 [4120, 32712, 32768, 0],
374 [305, 2247, 32768, 0],
375 [27403, 32636, 32768, 0],
376 [31022, 32009, 32768, 0],
377 [2963, 32093, 32768, 0],
378 [601, 943, 32768, 0],
379 [14969, 21398, 32768, 0],
380];
381
382/// `Default_Cfl_Alpha_Cdf` (spec 9.4): a `UV_CFL_PRED` block's per-plane
383/// alpha magnitude (spec 5.11.45's `cfl_alpha_u`/`cfl_alpha_v`), indexed by
384/// the joint sign's context (`CFL_CONTEXT_U`/`CFL_CONTEXT_V`,
385/// libaom's cfl.h) — libaom's `default_cfl_alpha_cdf`.
386pub const CFL_ALPHA: [[u16; 17]; 6] = [
387 [
388 7637, 20719, 31401, 32481, 32657, 32688, 32692, 32696, 32700, 32704, 32708, 32712, 32716,
389 32720, 32724, 32768, 0,
390 ],
391 [
392 14365, 23603, 28135, 31168, 32167, 32395, 32487, 32573, 32620, 32647, 32668, 32672, 32676,
393 32680, 32684, 32768, 0,
394 ],
395 [
396 11532, 22380, 28445, 31360, 32349, 32523, 32584, 32649, 32673, 32677, 32681, 32685, 32689,
397 32693, 32697, 32768, 0,
398 ],
399 [
400 26990, 31402, 32282, 32571, 32692, 32696, 32700, 32704, 32708, 32712, 32716, 32720, 32724,
401 32728, 32732, 32768, 0,
402 ],
403 [
404 17248, 26058, 28904, 30608, 31305, 31877, 32126, 32321, 32394, 32464, 32516, 32560, 32576,
405 32593, 32622, 32768, 0,
406 ],
407 [
408 14738, 21678, 25779, 27901, 29024, 30302, 30980, 31843, 32144, 32413, 32520, 32594, 32622,
409 32656, 32660, 32768, 0,
410 ],
411];
412
413/// `Default_Txb_Skip_Cdf[2][3][0]` (spec 9.4): the all-zero flag of a 32x32
414/// luma transform block that covers its whole plane block, which is context 0.
415pub const TXB_SKIP_LUMA_32: [u16; 3] = [30669, 32768, 0];
416
417/// `Default_Coeff_Base_Cdf[2][3][0]` (spec 9.4): the level of a coefficient
418/// of a 32x32 luma transform block, capped at three, for each of the
419/// forty-two contexts its neighbours' magnitudes and its own position give.
420pub const COEFF_BASE_LUMA_32: [[u16; 5]; 42] = [
421 [4456, 11274, 15533, 32768, 0],
422 [21219, 29079, 31616, 32768, 0],
423 [11173, 23774, 28567, 32768, 0],
424 [7282, 18293, 24263, 32768, 0],
425 [4890, 13286, 19115, 32768, 0],
426 [1890, 5508, 8659, 32768, 0],
427 [26651, 32136, 32647, 32768, 0],
428 [14630, 28254, 31455, 32768, 0],
429 [8716, 21287, 27395, 32768, 0],
430 [5615, 15331, 22008, 32768, 0],
431 [2675, 7700, 12150, 32768, 0],
432 [29954, 32526, 32690, 32768, 0],
433 [16126, 28982, 31633, 32768, 0],
434 [9030, 21361, 27352, 32768, 0],
435 [5411, 14793, 21271, 32768, 0],
436 [2943, 8422, 13163, 32768, 0],
437 [29539, 32601, 32730, 32768, 0],
438 [18125, 30385, 32201, 32768, 0],
439 [10422, 24090, 29468, 32768, 0],
440 [6468, 17487, 24438, 32768, 0],
441 [2970, 8653, 13531, 32768, 0],
442 [30912, 32715, 32748, 32768, 0],
443 [20666, 31373, 32497, 32768, 0],
444 [12509, 26640, 30917, 32768, 0],
445 [8058, 20629, 27290, 32768, 0],
446 [4231, 12006, 18052, 32768, 0],
447 [8192, 16384, 24576, 32768, 0],
448 [8192, 16384, 24576, 32768, 0],
449 [8192, 16384, 24576, 32768, 0],
450 [8192, 16384, 24576, 32768, 0],
451 [8192, 16384, 24576, 32768, 0],
452 [8192, 16384, 24576, 32768, 0],
453 [8192, 16384, 24576, 32768, 0],
454 [8192, 16384, 24576, 32768, 0],
455 [8192, 16384, 24576, 32768, 0],
456 [8192, 16384, 24576, 32768, 0],
457 [8192, 16384, 24576, 32768, 0],
458 [8192, 16384, 24576, 32768, 0],
459 [8192, 16384, 24576, 32768, 0],
460 [8192, 16384, 24576, 32768, 0],
461 [8192, 16384, 24576, 32768, 0],
462 [8192, 16384, 24576, 32768, 0],
463];
464
465/// `Default_Coeff_Br_Cdf[2][3][0]` (spec 9.4): a base-range increment in a
466/// 32x32 luma transform block, for each of the twenty-one contexts.
467pub const COEFF_BR_LUMA_32: [[u16; 5]; 21] = [
468 [9040, 14786, 18360, 32768, 0],
469 [9979, 15718, 19415, 32768, 0],
470 [7913, 13918, 18311, 32768, 0],
471 [5859, 10889, 15184, 32768, 0],
472 [4593, 8677, 12510, 32768, 0],
473 [3820, 7396, 10791, 32768, 0],
474 [1730, 3471, 5192, 32768, 0],
475 [11803, 18365, 22709, 32768, 0],
476 [11419, 18058, 22225, 32768, 0],
477 [9418, 15774, 20243, 32768, 0],
478 [7539, 13325, 17657, 32768, 0],
479 [6233, 11317, 15384, 32768, 0],
480 [5137, 9656, 13545, 32768, 0],
481 [2977, 5774, 8349, 32768, 0],
482 [21207, 27246, 29640, 32768, 0],
483 [19547, 26578, 29497, 32768, 0],
484 [16169, 23871, 27690, 32768, 0],
485 [12820, 20458, 25018, 32768, 0],
486 [10224, 17332, 22214, 32768, 0],
487 [8526, 15048, 19884, 32768, 0],
488 [5037, 9410, 13118, 32768, 0],
489];
490
491/// `Default_Coeff_Base_Eob_Cdf[2][3][0]` (spec 9.4): the level of the last
492/// coefficient of a 32x32 luma transform block, less one, for each of the
493/// four contexts its position in the scan gives.
494pub const COEFF_BASE_EOB_LUMA_32: [[u16; 4]; 4] = [
495 [2809, 19301, 32768, 0],
496 [32205, 32622, 32768, 0],
497 [32338, 32730, 32768, 0],
498 [31786, 32616, 32768, 0],
499];
500
501/// `Default_Eob_Extra_Cdf[2][3][0]` (spec 9.4): the top bit of the offset
502/// into an end-of-block position group, for each group.
503pub const EOB_EXTRA_LUMA_32: [[u16; 3]; 9] = [
504 [23312, 32768, 0],
505 [21607, 32768, 0],
506 [16526, 32768, 0],
507 [18957, 32768, 0],
508 [18034, 32768, 0],
509 [18934, 32768, 0],
510 [24247, 32768, 0],
511 [16921, 32768, 0],
512 [17080, 32768, 0],
513];
514
515/// `Av1_Nz_Map_Ctx_Offset` for a 32x32 transform (the position term of the
516/// coefficient-level context, spec 8.3.2): row and column clamped to four.
517pub const NZ_MAP_CTX_OFFSET_32: [[u8; 5]; 5] = [
518 [0, 1, 6, 6, 21],
519 [1, 6, 6, 21, 21],
520 [6, 6, 21, 21, 21],
521 [6, 21, 21, 21, 21],
522 [21, 21, 21, 21, 21],
523];
524
525/// `Default_Txb_Skip_Cdf[2][2][7..10]` (spec 9.4): the all-zero flag of a
526/// 16x16 chroma transform block that covers its whole plane block, for the
527/// three contexts its coded neighbours give.
528pub const TXB_SKIP_CHROMA_16: [[u16; 3]; 3] =
529 [[3648, 32768, 0], [15690, 32768, 0], [26815, 32768, 0]];
530
531/// `Default_Coeff_Base_Cdf[2][2][1]` (spec 9.4): the level of a coefficient
532/// of a 16x16 chroma transform block, capped at three, for each of the
533/// forty-two contexts its neighbours and its position give.
534pub const COEFF_BASE_CHROMA_16: [[u16; 5]; 42] = [
535 [9185, 19694, 24688, 32768, 0],
536 [26081, 31985, 32621, 32768, 0],
537 [16015, 29000, 31787, 32768, 0],
538 [10542, 23690, 29206, 32768, 0],
539 [6732, 17945, 24677, 32768, 0],
540 [3916, 11039, 16722, 32768, 0],
541 [28224, 32566, 32744, 32768, 0],
542 [19100, 31138, 32485, 32768, 0],
543 [12528, 26620, 30879, 32768, 0],
544 [7741, 20277, 26885, 32768, 0],
545 [4566, 12845, 18990, 32768, 0],
546 [29933, 32593, 32718, 32768, 0],
547 [17670, 30333, 32155, 32768, 0],
548 [10385, 23600, 28909, 32768, 0],
549 [6243, 16236, 22407, 32768, 0],
550 [3976, 10389, 16017, 32768, 0],
551 [28377, 32561, 32738, 32768, 0],
552 [19366, 31175, 32482, 32768, 0],
553 [13327, 27175, 31094, 32768, 0],
554 [8258, 20769, 27143, 32768, 0],
555 [4703, 13198, 19527, 32768, 0],
556 [31086, 32706, 32748, 32768, 0],
557 [22853, 31902, 32583, 32768, 0],
558 [14759, 28186, 31419, 32768, 0],
559 [9284, 22382, 28348, 32768, 0],
560 [5585, 15192, 21868, 32768, 0],
561 [28291, 32652, 32746, 32768, 0],
562 [19849, 32107, 32571, 32768, 0],
563 [14834, 26818, 29214, 32768, 0],
564 [10306, 22594, 28672, 32768, 0],
565 [6615, 17384, 23384, 32768, 0],
566 [28947, 32604, 32745, 32768, 0],
567 [25625, 32289, 32646, 32768, 0],
568 [18758, 28672, 31403, 32768, 0],
569 [10017, 23430, 28523, 32768, 0],
570 [6862, 15269, 22131, 32768, 0],
571 [23933, 32509, 32739, 32768, 0],
572 [19927, 31495, 32631, 32768, 0],
573 [11903, 26023, 30621, 32768, 0],
574 [7026, 20094, 27252, 32768, 0],
575 [5998, 18106, 24437, 32768, 0],
576 [8192, 16384, 24576, 32768, 0],
577];
578
579/// `Default_Coeff_Br_Cdf[2][2][1]` (spec 9.4): a base-range increment in a
580/// 16x16 chroma transform block, for each of its twenty-one contexts.
581pub const COEFF_BR_CHROMA_16: [[u16; 5]; 21] = [
582 [13569, 19800, 23206, 32768, 0],
583 [13128, 19924, 23869, 32768, 0],
584 [8329, 14841, 19403, 32768, 0],
585 [6130, 10976, 15057, 32768, 0],
586 [4682, 8839, 12518, 32768, 0],
587 [3656, 7409, 10588, 32768, 0],
588 [2577, 5099, 7412, 32768, 0],
589 [22427, 28684, 30585, 32768, 0],
590 [20913, 27750, 30139, 32768, 0],
591 [15840, 24109, 27834, 32768, 0],
592 [12308, 20029, 24569, 32768, 0],
593 [10216, 16785, 21458, 32768, 0],
594 [8309, 14203, 19113, 32768, 0],
595 [6043, 11168, 15307, 32768, 0],
596 [23166, 28901, 30998, 32768, 0],
597 [21899, 28405, 30751, 32768, 0],
598 [18413, 26091, 29443, 32768, 0],
599 [15233, 23114, 27352, 32768, 0],
600 [12683, 20472, 25288, 32768, 0],
601 [10702, 18259, 23409, 32768, 0],
602 [8125, 14464, 19226, 32768, 0],
603];
604
605/// `Default_Coeff_Base_Eob_Cdf[2][2][1]` (spec 9.4): the level of the last
606/// coefficient of a 16x16 chroma transform block, less one, for each of the
607/// four contexts its position in the scan gives.
608pub const COEFF_BASE_EOB_CHROMA_16: [[u16; 4]; 4] = [
609 [25476, 30366, 32768, 0],
610 [32169, 32687, 32768, 0],
611 [32479, 32689, 32768, 0],
612 [31673, 32634, 32768, 0],
613];
614
615/// `Default_Eob_Extra_Cdf[2][2][1]` (spec 9.4): the top bit of the offset
616/// into an end-of-block position group of a 16x16 chroma transform block.
617pub const EOB_EXTRA_CHROMA_16: [[u16; 3]; 9] = [
618 [22041, 32768, 0],
619 [23434, 32768, 0],
620 [20001, 32768, 0],
621 [20554, 32768, 0],
622 [20951, 32768, 0],
623 [20145, 32768, 0],
624 [15562, 32768, 0],
625 [16384, 32768, 0],
626 [16384, 32768, 0],
627];
628
629/// `Default_Eob_Pt_256_Cdf[2][1][0]` (spec 9.4): the end-of-block group of a
630/// 256-coefficient chroma transform block with a two-dimensional transform.
631pub const EOB_PT_256_CHROMA: [u16; 10] = [
632 11514, 13794, 17480, 20754, 24361, 27378, 29492, 31277, 32768, 0,
633];
634
635/// `Default_Dc_Sign_Cdf[2][1]` (spec 9.4): the sign of a chroma DC
636/// coefficient, indexed the way [`DC_SIGN_LUMA`] is.
637pub const DC_SIGN_CHROMA: [[u16; 3]; 3] = [[15232, 32768, 0], [12928, 32768, 0], [17280, 32768, 0]];
638
639/// `Default_Angle_Delta_Cdf` (spec 9.4): the offset a directional intra mode
640/// is steered by, seven symbols from -3 to +3, one row per directional mode in
641/// the order they follow `V_PRED`.
642pub const ANGLE_DELTA: [[u16; 8]; 8] = [
643 [2180, 5032, 7567, 22776, 26989, 30217, 32768, 0],
644 [2301, 5608, 8801, 23487, 26974, 30330, 32768, 0],
645 [3780, 11018, 13699, 19354, 23083, 31286, 32768, 0],
646 [4581, 11226, 15147, 17138, 21834, 28397, 32768, 0],
647 [1737, 10927, 14509, 19588, 22745, 28823, 32768, 0],
648 [2664, 10176, 12485, 17650, 21600, 30495, 32768, 0],
649 [2240, 11096, 15453, 20341, 22561, 28917, 32768, 0],
650 [3605, 10428, 12459, 17676, 21244, 30655, 32768, 0],
651];
652/// `Default_Coeff_Base_Cdf[2][4][0]` (spec 9.4): the level of a coefficient of a 64x64 luma
653/// transform block, capped at three, for each of the forty-two contexts its neighbours and its
654/// position give.
655pub const COEFF_BASE_LUMA_64: [[u16; 5]; 42] = [
656 [2575, 7281, 11077, 32768, 0],
657 [14002, 20866, 25402, 32768, 0],
658 [6343, 15056, 19658, 32768, 0],
659 [4474, 11858, 17041, 32768, 0],
660 [2865, 8299, 12534, 32768, 0],
661 [1344, 3949, 6391, 32768, 0],
662 [24720, 31239, 32459, 32768, 0],
663 [12585, 25356, 29968, 32768, 0],
664 [7181, 18246, 24444, 32768, 0],
665 [5025, 13667, 19885, 32768, 0],
666 [2521, 7304, 11605, 32768, 0],
667 [29908, 32252, 32584, 32768, 0],
668 [17421, 29156, 31575, 32768, 0],
669 [9889, 22188, 27782, 32768, 0],
670 [5878, 15647, 22123, 32768, 0],
671 [2814, 8665, 13323, 32768, 0],
672 [30183, 32568, 32713, 32768, 0],
673 [18528, 30195, 32049, 32768, 0],
674 [10982, 24606, 29657, 32768, 0],
675 [6957, 18165, 25231, 32768, 0],
676 [3508, 10118, 15468, 32768, 0],
677 [31761, 32736, 32748, 32768, 0],
678 [21041, 31328, 32546, 32768, 0],
679 [12568, 26732, 31166, 32768, 0],
680 [8052, 20720, 27733, 32768, 0],
681 [4336, 12192, 18396, 32768, 0],
682 [8192, 16384, 24576, 32768, 0],
683 [8192, 16384, 24576, 32768, 0],
684 [8192, 16384, 24576, 32768, 0],
685 [8192, 16384, 24576, 32768, 0],
686 [8192, 16384, 24576, 32768, 0],
687 [8192, 16384, 24576, 32768, 0],
688 [8192, 16384, 24576, 32768, 0],
689 [8192, 16384, 24576, 32768, 0],
690 [8192, 16384, 24576, 32768, 0],
691 [8192, 16384, 24576, 32768, 0],
692 [8192, 16384, 24576, 32768, 0],
693 [8192, 16384, 24576, 32768, 0],
694 [8192, 16384, 24576, 32768, 0],
695 [8192, 16384, 24576, 32768, 0],
696 [8192, 16384, 24576, 32768, 0],
697 [8192, 16384, 24576, 32768, 0],
698];
699
700/// `Default_Coeff_Base_Eob_Cdf[2][4][0]` (spec 9.4): the level of the last coefficient of a
701/// 64x64 luma transform block, less one, for each of the four contexts its position gives.
702pub const COEFF_BASE_EOB_LUMA_64: [[u16; 4]; 4] = [
703 [935, 3382, 32768, 0],
704 [30789, 31909, 32768, 0],
705 [32466, 32756, 32768, 0],
706 [30860, 32513, 32768, 0],
707];
708
709/// `Default_Eob_Extra_Cdf[2][4][0]` (spec 9.4): the top bit of the end-of-block position of a
710/// 64x64 luma transform block, one context per end-of-block group.
711pub const EOB_EXTRA_LUMA_64: [[u16; 3]; 9] = [
712 [26998, 32768, 0],
713 [16737, 32768, 0],
714 [17838, 32768, 0],
715 [18922, 32768, 0],
716 [19515, 32768, 0],
717 [18636, 32768, 0],
718 [17333, 32768, 0],
719 [15776, 32768, 0],
720 [22658, 32768, 0],
721];
722
723/// `Default_Coeff_Base_Cdf[2][3][1]` (spec 9.4): the level of a coefficient of a 32x32 chroma
724/// transform block, capped at three, for each of the forty-two contexts its neighbours and its
725/// position give.
726pub const COEFF_BASE_CHROMA_32: [[u16; 5]; 42] = [
727 [10202, 20633, 25484, 32768, 0],
728 [27336, 31445, 32352, 32768, 0],
729 [12420, 24384, 28552, 32768, 0],
730 [7648, 18115, 23856, 32768, 0],
731 [5662, 14341, 19902, 32768, 0],
732 [3611, 10328, 15390, 32768, 0],
733 [30945, 32616, 32736, 32768, 0],
734 [18682, 30505, 32253, 32768, 0],
735 [11513, 25336, 30203, 32768, 0],
736 [7449, 19452, 26148, 32768, 0],
737 [4482, 13051, 18886, 32768, 0],
738 [32022, 32690, 32747, 32768, 0],
739 [18578, 30501, 32146, 32768, 0],
740 [11249, 23368, 28631, 32768, 0],
741 [5645, 16958, 22158, 32768, 0],
742 [5009, 11444, 16637, 32768, 0],
743 [31357, 32710, 32748, 32768, 0],
744 [21552, 31494, 32504, 32768, 0],
745 [13891, 27677, 31340, 32768, 0],
746 [9051, 22098, 28172, 32768, 0],
747 [5190, 13377, 19486, 32768, 0],
748 [32364, 32740, 32748, 32768, 0],
749 [24839, 31907, 32551, 32768, 0],
750 [17160, 28779, 31696, 32768, 0],
751 [12452, 24137, 29602, 32768, 0],
752 [6165, 15389, 22477, 32768, 0],
753 [8192, 16384, 24576, 32768, 0],
754 [8192, 16384, 24576, 32768, 0],
755 [8192, 16384, 24576, 32768, 0],
756 [8192, 16384, 24576, 32768, 0],
757 [8192, 16384, 24576, 32768, 0],
758 [8192, 16384, 24576, 32768, 0],
759 [8192, 16384, 24576, 32768, 0],
760 [8192, 16384, 24576, 32768, 0],
761 [8192, 16384, 24576, 32768, 0],
762 [8192, 16384, 24576, 32768, 0],
763 [8192, 16384, 24576, 32768, 0],
764 [8192, 16384, 24576, 32768, 0],
765 [8192, 16384, 24576, 32768, 0],
766 [8192, 16384, 24576, 32768, 0],
767 [8192, 16384, 24576, 32768, 0],
768 [8192, 16384, 24576, 32768, 0],
769];
770
771/// `Default_Coeff_Br_Cdf[2][3][1]` (spec 9.4): the base-range tail of a 32x32 chroma transform
772/// block, for each of the twenty-one contexts its neighbours and its position give.
773pub const COEFF_BR_CHROMA_32: [[u16; 5]; 21] = [
774 [12339, 17329, 20140, 32768, 0],
775 [13505, 19895, 23225, 32768, 0],
776 [9847, 16944, 21564, 32768, 0],
777 [7280, 13256, 18348, 32768, 0],
778 [4712, 10009, 14454, 32768, 0],
779 [4361, 7914, 12477, 32768, 0],
780 [2870, 5628, 7995, 32768, 0],
781 [20061, 25504, 28526, 32768, 0],
782 [15235, 22878, 26145, 32768, 0],
783 [12985, 19958, 24155, 32768, 0],
784 [9782, 16641, 21403, 32768, 0],
785 [9456, 16360, 20760, 32768, 0],
786 [6855, 12940, 18557, 32768, 0],
787 [5661, 10564, 15002, 32768, 0],
788 [25656, 30602, 31894, 32768, 0],
789 [22570, 29107, 31092, 32768, 0],
790 [18917, 26423, 29541, 32768, 0],
791 [15940, 23649, 27754, 32768, 0],
792 [12803, 20581, 25219, 32768, 0],
793 [11082, 18695, 23376, 32768, 0],
794 [7939, 14373, 19005, 32768, 0],
795];
796
797/// `Default_Coeff_Base_Eob_Cdf[2][3][1]` (spec 9.4): the level of the last coefficient of a
798/// 32x32 chroma transform block, less one, for each of the four contexts its position gives.
799pub const COEFF_BASE_EOB_CHROMA_32: [[u16; 4]; 4] = [
800 [22737, 29105, 32768, 0],
801 [30810, 32362, 32768, 0],
802 [30014, 32627, 32768, 0],
803 [30528, 32574, 32768, 0],
804];
805
806/// `Default_Eob_Extra_Cdf[2][3][1]` (spec 9.4): the top bit of the end-of-block position of a
807/// 32x32 chroma transform block, one context per end-of-block group.
808pub const EOB_EXTRA_CHROMA_32: [[u16; 3]; 9] = [
809 [26579, 32768, 0],
810 [24910, 32768, 0],
811 [18637, 32768, 0],
812 [19800, 32768, 0],
813 [20388, 32768, 0],
814 [9887, 32768, 0],
815 [15642, 32768, 0],
816 [30198, 32768, 0],
817 [24721, 32768, 0],
818];
819
820/// `Default_Txb_Skip_Cdf[2][3][7..10]` (spec 9.4): the all-zero flag of a 32x32 chroma transform
821/// block that covers its whole plane block, for the three contexts its coded neighbours give.
822pub const TXB_SKIP_CHROMA_32: [[u16; 3]; 3] =
823 [[5124, 32768, 0], [18719, 32768, 0], [28468, 32768, 0]];
824
825/// `Default_Eob_Pt_1024_Cdf[2][1][0]` (spec 9.4): the end-of-block group of a
826/// 1024-coefficient chroma transform block with a two-dimensional transform.
827pub const EOB_PT_1024_CHROMA: [u16; 12] = [
828 9577, 12466, 17739, 20750, 22061, 23215, 24601, 25483, 25843, 32056, 32768, 0,
829];
830/// `Default_Txb_Skip_Cdf[2][2][0]`: the all-zero flag of a 16x16 luma transform, whose only context is zero because the transform covers its whole block.
831pub const TXB_SKIP_LUMA_16: [u16; 3] = [32363, 32768, 0];
832
833/// `Default_Txb_Skip_Cdf[2][1][7..10]`: the all-zero flag of an 8x8 chroma transform.
834pub const TXB_SKIP_CHROMA_8: [[u16; 3]; 3] =
835 [[3050, 32768, 0], [14603, 32768, 0], [25155, 32768, 0]];
836
837/// `Default_Eob_Pt_256_Cdf[2][0][0]`: the end-of-block group of a 16x16 luma transform.
838pub const EOB_PT_256_LUMA: [u16; 10] =
839 [3089, 3920, 6038, 9460, 14266, 19881, 25766, 29176, 32768, 0];
840
841/// `Default_Eob_Pt_64_Cdf[2][1][0]`: the end-of-block group of an 8x8 chroma transform.
842pub const EOB_PT_64_CHROMA: [u16; 8] = [15050, 17126, 21410, 24886, 28156, 30726, 32768, 0];
843
844/// `Default_Eob_Extra_Cdf[2][2][0]`: the top offset bit inside a 16x16 luma transform's end-of-block group.
845pub const EOB_EXTRA_LUMA_16: [[u16; 3]; 9] = [
846 [19833, 32768, 0],
847 [21502, 32768, 0],
848 [17485, 32768, 0],
849 [20267, 32768, 0],
850 [18353, 32768, 0],
851 [23329, 32768, 0],
852 [21478, 32768, 0],
853 [16384, 32768, 0],
854 [16384, 32768, 0],
855];
856
857/// `Default_Eob_Extra_Cdf[2][1][1]`: the same, for an 8x8 chroma transform.
858pub const EOB_EXTRA_CHROMA_8: [[u16; 3]; 9] = [
859 [20536, 32768, 0],
860 [20664, 32768, 0],
861 [20625, 32768, 0],
862 [19123, 32768, 0],
863 [14862, 32768, 0],
864 [16384, 32768, 0],
865 [16384, 32768, 0],
866 [16384, 32768, 0],
867 [16384, 32768, 0],
868];
869
870/// `Default_Coeff_Base_Cdf[2][2][0]`: a 16x16 luma coefficient's base level.
871pub const COEFF_BASE_LUMA_16: [[u16; 5]; 42] = [
872 [9800, 17635, 21073, 32768, 0],
873 [26153, 31885, 32527, 32768, 0],
874 [15038, 27852, 31006, 32768, 0],
875 [8718, 20564, 26486, 32768, 0],
876 [5128, 14076, 20514, 32768, 0],
877 [2636, 7566, 11925, 32768, 0],
878 [27551, 32504, 32701, 32768, 0],
879 [18310, 30054, 32100, 32768, 0],
880 [10211, 23420, 29082, 32768, 0],
881 [6222, 16876, 23916, 32768, 0],
882 [3462, 9954, 15498, 32768, 0],
883 [29991, 32633, 32721, 32768, 0],
884 [19883, 30751, 32201, 32768, 0],
885 [11141, 24184, 29285, 32768, 0],
886 [6420, 16940, 23774, 32768, 0],
887 [3392, 9753, 15118, 32768, 0],
888 [28465, 32616, 32712, 32768, 0],
889 [19850, 30702, 32244, 32768, 0],
890 [10983, 24024, 29223, 32768, 0],
891 [6294, 16770, 23582, 32768, 0],
892 [3244, 9283, 14509, 32768, 0],
893 [30023, 32717, 32748, 32768, 0],
894 [22940, 32032, 32626, 32768, 0],
895 [14282, 27928, 31473, 32768, 0],
896 [8562, 21327, 27914, 32768, 0],
897 [4846, 13393, 19919, 32768, 0],
898 [29981, 32590, 32695, 32768, 0],
899 [20465, 30963, 32166, 32768, 0],
900 [11479, 23579, 28195, 32768, 0],
901 [5916, 15648, 22073, 32768, 0],
902 [3031, 8605, 13398, 32768, 0],
903 [31146, 32691, 32739, 32768, 0],
904 [23106, 31724, 32444, 32768, 0],
905 [13783, 26738, 30439, 32768, 0],
906 [7852, 19468, 25807, 32768, 0],
907 [3860, 11124, 16853, 32768, 0],
908 [31014, 32724, 32748, 32768, 0],
909 [23629, 32109, 32628, 32768, 0],
910 [14747, 28115, 31403, 32768, 0],
911 [8545, 21242, 27478, 32768, 0],
912 [4574, 12781, 19067, 32768, 0],
913 [8192, 16384, 24576, 32768, 0],
914];
915
916/// `Default_Coeff_Base_Cdf[2][1][1]`: an 8x8 chroma coefficient's base level.
917pub const COEFF_BASE_CHROMA_8: [[u16; 5]; 42] = [
918 [11016, 22111, 26794, 32768, 0],
919 [25946, 32357, 32677, 32768, 0],
920 [17890, 30452, 32252, 32768, 0],
921 [11678, 25142, 29816, 32768, 0],
922 [6720, 17534, 24584, 32768, 0],
923 [4230, 11665, 17820, 32768, 0],
924 [28400, 32623, 32747, 32768, 0],
925 [21164, 31668, 32575, 32768, 0],
926 [13572, 27388, 31182, 32768, 0],
927 [8234, 20750, 27358, 32768, 0],
928 [5065, 14055, 20897, 32768, 0],
929 [28981, 32547, 32705, 32768, 0],
930 [18681, 30543, 32239, 32768, 0],
931 [10919, 24075, 29286, 32768, 0],
932 [6431, 17199, 24077, 32768, 0],
933 [3819, 10464, 16618, 32768, 0],
934 [26870, 32467, 32693, 32768, 0],
935 [19041, 30831, 32347, 32768, 0],
936 [11794, 25211, 30016, 32768, 0],
937 [6888, 18019, 24970, 32768, 0],
938 [4370, 12363, 18992, 32768, 0],
939 [29578, 32670, 32744, 32768, 0],
940 [23159, 32007, 32613, 32768, 0],
941 [15315, 28669, 31676, 32768, 0],
942 [9298, 22607, 28782, 32768, 0],
943 [6144, 15913, 22968, 32768, 0],
944 [28110, 32499, 32669, 32768, 0],
945 [21574, 30937, 32015, 32768, 0],
946 [12759, 24818, 28727, 32768, 0],
947 [6545, 16761, 23042, 32768, 0],
948 [3649, 10597, 16833, 32768, 0],
949 [28163, 32552, 32728, 32768, 0],
950 [22101, 31469, 32464, 32768, 0],
951 [13160, 25472, 30143, 32768, 0],
952 [7303, 18684, 25468, 32768, 0],
953 [5241, 13975, 20955, 32768, 0],
954 [28400, 32631, 32744, 32768, 0],
955 [22104, 31793, 32603, 32768, 0],
956 [13557, 26571, 30846, 32768, 0],
957 [7749, 19861, 26675, 32768, 0],
958 [4873, 14030, 21234, 32768, 0],
959 [8192, 16384, 24576, 32768, 0],
960];
961
962/// `Default_Coeff_Base_Eob_Cdf[2][2][0]`: the base level of the last coefficient of a 16x16 luma transform.
963pub const COEFF_BASE_EOB_LUMA_16: [[u16; 4]; 4] = [
964 [12854, 29093, 32768, 0],
965 [32272, 32558, 32768, 0],
966 [32667, 32729, 32768, 0],
967 [32306, 32585, 32768, 0],
968];
969
970/// `Default_Coeff_Base_Eob_Cdf[2][1][1]`: the same, for an 8x8 chroma transform.
971pub const COEFF_BASE_EOB_CHROMA_8: [[u16; 4]; 4] = [
972 [27116, 30842, 32768, 0],
973 [31971, 32598, 32768, 0],
974 [32088, 32576, 32768, 0],
975 [32067, 32664, 32768, 0],
976];
977
978/// `Default_Coeff_Br_Cdf[2][2][0]`: the base-range tail of a 16x16 luma coefficient.
979pub const COEFF_BR_LUMA_16: [[u16; 5]; 21] = [
980 [14438, 20798, 24089, 32768, 0],
981 [12621, 19203, 23097, 32768, 0],
982 [8177, 14125, 18402, 32768, 0],
983 [5674, 10501, 14456, 32768, 0],
984 [4236, 8239, 11733, 32768, 0],
985 [3447, 6750, 9806, 32768, 0],
986 [1986, 3950, 5864, 32768, 0],
987 [16208, 22099, 24930, 32768, 0],
988 [16537, 24025, 27585, 32768, 0],
989 [12780, 20381, 24867, 32768, 0],
990 [9767, 16612, 21416, 32768, 0],
991 [7686, 13738, 18398, 32768, 0],
992 [6333, 11614, 15964, 32768, 0],
993 [3941, 7571, 10836, 32768, 0],
994 [22819, 27422, 29202, 32768, 0],
995 [22224, 28514, 30721, 32768, 0],
996 [17660, 25433, 28913, 32768, 0],
997 [13574, 21482, 26002, 32768, 0],
998 [10629, 17977, 22938, 32768, 0],
999 [8612, 15298, 20265, 32768, 0],
1000 [5607, 10491, 14596, 32768, 0],
1001];
1002
1003/// `Default_Coeff_Br_Cdf[2][1][1]`: the base-range tail of an 8x8 chroma coefficient.
1004pub const COEFF_BR_CHROMA_8: [[u16; 5]; 21] = [
1005 [14433, 21155, 24938, 32768, 0],
1006 [14658, 21716, 25545, 32768, 0],
1007 [9923, 16824, 21557, 32768, 0],
1008 [6982, 13052, 17721, 32768, 0],
1009 [5419, 10503, 15050, 32768, 0],
1010 [4852, 9162, 13014, 32768, 0],
1011 [3271, 6395, 9630, 32768, 0],
1012 [22210, 27833, 30109, 32768, 0],
1013 [20750, 27368, 29821, 32768, 0],
1014 [16894, 24828, 28573, 32768, 0],
1015 [13247, 21276, 25757, 32768, 0],
1016 [10038, 17265, 22563, 32768, 0],
1017 [8587, 14947, 20327, 32768, 0],
1018 [5645, 11371, 15252, 32768, 0],
1019 [22027, 27526, 29714, 32768, 0],
1020 [23098, 29146, 31221, 32768, 0],
1021 [19886, 27341, 30272, 32768, 0],
1022 [15609, 23747, 28046, 32768, 0],
1023 [11993, 20065, 24939, 32768, 0],
1024 [9637, 18267, 23671, 32768, 0],
1025 [7625, 13801, 19144, 32768, 0],
1026];
1027
1028/// `Default_Partition_Cdf[0..4]`, `PARTITION_W16` format (spec 5.11.4 codes an
1029/// 8x8 block's partition as a 4-symbol read that only ever terminates
1030/// `PARTITION_NONE` for this writer -- `PARTITION_SPLIT` is illegal at 8x8, so
1031/// row 4 of libaom's real (8-symbol) 8x8 table is dropped and only the shared
1032/// leading four symbols, common to every partition-symbol alphabet, are kept.
1033pub const PARTITION_W8: [[u16; 5]; 4] = [
1034 [19132, 25510, 30392, 32768, 0],
1035 [13928, 19855, 28540, 32768, 0],
1036 [12522, 23679, 28629, 32768, 0],
1037 [9896, 18783, 25853, 32768, 0],
1038];
1039
1040/// `Default_Partition_Cdf[0..4]`: the partition symbol of a 16x16 block.
1041pub const PARTITION_W16: [[u16; 11]; 4] = [
1042 [
1043 15597, 20929, 24571, 26706, 27664, 28821, 29601, 30571, 31902, 32768, 0,
1044 ],
1045 [
1046 7925, 11043, 16785, 22470, 23971, 25043, 26651, 28701, 29834, 32768, 0,
1047 ],
1048 [
1049 5414, 13269, 15111, 20488, 22360, 24500, 25537, 26336, 32117, 32768, 0,
1050 ],
1051 [
1052 2662, 6362, 8614, 20860, 23053, 24778, 26436, 27829, 31171, 32768, 0,
1053 ],
1054];
1055
1056/// The transform type of a 16x16 intra luma transform, as an index into the
1057/// spec's `Tx_Type_Intra_Inv_Set2`, indexed by the block's luma mode.
1058///
1059/// A 16x16 intra transform is the only size this writer's intra path codes
1060/// whose transform-type set holds more than one type: 32x32 and 64x64 are
1061/// DCT-only for an *intra* block by spec 5.11.48's `get_tx_set` (its
1062/// `txSzSqrUp == TX_32X32` case returns `TX_SET_DCTONLY` only in the
1063/// `!is_inter` branch). An `is_inter` 32x32 transform takes the other branch
1064/// and reads [`INTER_TX_TYPE_SET3_32`] instead.
1065pub const INTRA_TX_TYPE_SET2_16: [[u16; 6]; 13] = [
1066 [1127, 12814, 22772, 27483, 32768, 0],
1067 [145, 6761, 11980, 26667, 32768, 0],
1068 [362, 5887, 11678, 16725, 32768, 0],
1069 [385, 15213, 18587, 30693, 32768, 0],
1070 [25, 2914, 23134, 27903, 32768, 0],
1071 [60, 4470, 11749, 23991, 32768, 0],
1072 [37, 3332, 14511, 21448, 32768, 0],
1073 [157, 6320, 13036, 17439, 32768, 0],
1074 [119, 6719, 12906, 29396, 32768, 0],
1075 [47, 5537, 12576, 21499, 32768, 0],
1076 [269, 6076, 11258, 23115, 32768, 0],
1077 [83, 5615, 12001, 17228, 32768, 0],
1078 [1968, 5556, 12023, 18547, 32768, 0],
1079];
1080
1081/// `Default_Inter_Ext_Tx_Cdf`'s `TX_SET_INTER_3` row for `TX_32X32` (spec
1082/// 9.4): the transform type of an `is_inter` 32x32 luma transform, whose
1083/// `get_tx_set` (5.11.48) returns `TX_SET_INTER_3` -- `{IDTX, DCT_DCT}` --
1084/// because `txSzSqrUp == TX_32X32` takes the `is_inter` branch there, unlike
1085/// an intra block's, which is DCT-only at that size. The writer only ever
1086/// uses DCT_DCT, index one of `Tx_Type_Inter_Inv_Set3`.
1087pub const INTER_TX_TYPE_SET3_32: [u16; 3] = [748, 32768, 0];
1088
1089/// `Default_Inter_Ext_Tx_Cdf`'s `TX_SET_INTER_3` row for `TX_16X16` (spec
1090/// 9.4): the transform type of an `is_inter` 16x16 luma transform coded under
1091/// `reduced_tx_set` (spec 5.11.48's `use_reduced_set` branch forces
1092/// `TX_SET_INTER_3` for every inter size below 32x32, the same two-symbol set
1093/// [`INTER_TX_TYPE_SET3_32`] reads at 32x32) -- without `reduced_tx_set` a
1094/// 16x16 inter transform reads the twelve-symbol `TX_SET_INTER_2` instead,
1095/// which this crate does not carry a table for. The writer only ever uses
1096/// DCT_DCT, index one of `Tx_Type_Inter_Inv_Set3`, same as the 32x32 table.
1097pub const INTER_TX_TYPE_SET3_16: [u16; 3] = [1998, 32768, 0];
1098
1099/// `Default_Inter_Ext_Tx_Cdf`'s `TX_SET_INTER_3` row for `TX_8X8` (spec 9.4):
1100/// the transform type of an `is_inter` 8x8 luma transform under
1101/// `reduced_tx_set` -- an 8x8 leaf under a straddling 16x16 block
1102/// (lane-av1inter8), the same two-symbol set [`INTER_TX_TYPE_SET3_16`] and
1103/// [`INTER_TX_TYPE_SET3_32`] read at their own sizes, just its own default
1104/// probability and adaptation state (libaom `entropymode.c`'s
1105/// `default_inter_ext_tx_cdf[EXT_TX_SET_DCT_IDTX][TX_8X8]`).
1106pub const INTER_TX_TYPE_SET3_8: [u16; 3] = [4167, 32768, 0];
1107
1108/// `Default_Inter_Ext_Tx_Cdf`'s `TX_SET_INTER_2` (`EXT_TX_SET_DTT9_IDTX_1DDCT`)
1109/// row for `TX_16X16` (lane-cdffwd2, spec 9.4/5.11.48): the twelve-symbol
1110/// transform type of an `is_inter` 16x16 luma transform when `reduced_tx_set
1111/// == 0` -- `av1_get_ext_tx_set_type`'s `av1_ext_tx_set_lookup[1][1]`, not
1112/// [`INTER_TX_TYPE_SET3_16`]'s two-symbol reduced set (libaom
1113/// `entropymode.c` `default_inter_ext_tx_cdf[2][TX_16X16]`).
1114pub const INTER_TX_TYPE_SET2_16: [u16; 13] = [
1115 770, 2421, 5225, 12907, 15819, 18927, 21561, 24089, 26595, 28526, 30529, 32768, 0,
1116];
1117
1118/// `Default_Inter_Ext_Tx_Cdf`'s `TX_SET_INTER_1` (`EXT_TX_SET_ALL16`) row for
1119/// `TX_8X8` (lane-cdffwd2): the full sixteen-symbol transform type of an
1120/// `is_inter` 8x8 luma transform when `reduced_tx_set == 0`
1121/// (`av1_ext_tx_set_lookup[1][0]`, libaom `entropymode.c`
1122/// `default_inter_ext_tx_cdf[1][TX_8X8]`).
1123pub const INTER_TX_TYPE_SET1_8: [u16; 17] = [
1124 1645, 2573, 4778, 5711, 7807, 8622, 10522, 15357, 17674, 20408, 22517, 25010, 27116, 28856,
1125 30749, 32768, 0,
1126];
1127
1128// The inter-frame tables below (spec 9.4) support the syntax an inter block
1129// needs: whether it is coded as intra at all, which reference frame and
1130// motion vector it takes when it is not. The compound-reference tables
1131// (`COMP_MODE`/`COMP_REF_TYPE`/`UNI_COMP_REF`/`COMP_REF`/`COMP_BWDREF` above)
1132// read once a frame's `reference_select` header bit is set (lane-av1comp);
1133// compound *prediction* itself -- `inter_compound_mode`, compound DRL, the
1134// mvstack's dual-ref scan, and distance-weighted MC blending -- is not yet
1135// ported, so a block that actually reads `COMPOUND_REFERENCE` still refuses.
1136
1137/// `default_inter_compound_mode_cdf` (entropymode.c): which of the eight
1138/// `INTER_COMPOUND_MODES` (`NEAREST_NEARESTMV`..`NEW_NEWMV`) a compound
1139/// block takes, indexed by `av1_mode_context_analyzer`'s `comp_ctx` (spec
1140/// 5.11.24's `compound_mode`, libaom's `read_inter_compound_mode`) --
1141/// lane-av1comp, symbol read only, not yet wired into MV assignment or MC.
1142pub const INTER_COMPOUND_MODE: [[u16; 9]; 8] = [
1143 [7760, 13823, 15808, 17641, 19156, 20666, 26891, 32768, 0],
1144 [10730, 19452, 21145, 22749, 24039, 25131, 28724, 32768, 0],
1145 [10664, 20221, 21588, 22906, 24295, 25387, 28436, 32768, 0],
1146 [13298, 16984, 20471, 24182, 25067, 25736, 26422, 32768, 0],
1147 [18904, 23325, 25242, 27432, 27898, 28258, 30758, 32768, 0],
1148 [10725, 17454, 20124, 22820, 24195, 25168, 26046, 32768, 0],
1149 [17125, 24273, 25814, 27492, 28214, 28704, 30592, 32768, 0],
1150 [13046, 23214, 24505, 25942, 27435, 28442, 29330, 32768, 0],
1151];
1152
1153/// `compound_mode_ctx_map` (`mvref_common.h`): folds a compound block's
1154/// `new_mv_ctx`/`ref_mv_ctx` pair (row = `ref_mv_ctx >> 1`, column =
1155/// `min(new_mv_ctx, COMP_NEWMV_CTXS - 1)`, `COMP_NEWMV_CTXS` = 5) down to
1156/// the single `comp_ctx` [`INTER_COMPOUND_MODE`] is indexed by --
1157/// `av1_mode_context_analyzer`'s compound branch.
1158pub const COMPOUND_MODE_CTX_MAP: [[usize; 5]; 3] =
1159 [[0, 1, 1, 1, 1], [1, 2, 3, 4, 4], [4, 4, 5, 6, 7]];
1160
1161/// `Default_Intra_Inter_Cdf` (spec 9.4): whether an inter frame's block is
1162/// coded as intra, indexed by whether the block above and left are inter.
1163pub const INTRA_INTER: [[u16; 3]; 4] = [
1164 [806, 32768, 0],
1165 [16662, 32768, 0],
1166 [20186, 32768, 0],
1167 [26538, 32768, 0],
1168];
1169
1170/// `Default_Single_Ref_Cdf` (spec 9.4): the six binary decisions that narrow
1171/// an inter block's single reference frame down from the seven it can name,
1172/// indexed by the reference context of the blocks around it.
1173pub const SINGLE_REF: [[[u16; 3]; 6]; 3] = [
1174 [
1175 [4897, 32768, 0],
1176 [1555, 32768, 0],
1177 [4236, 32768, 0],
1178 [8650, 32768, 0],
1179 [904, 32768, 0],
1180 [1444, 32768, 0],
1181 ],
1182 [
1183 [16973, 32768, 0],
1184 [16751, 32768, 0],
1185 [19647, 32768, 0],
1186 [24773, 32768, 0],
1187 [11014, 32768, 0],
1188 [15087, 32768, 0],
1189 ],
1190 [
1191 [29744, 32768, 0],
1192 [30279, 32768, 0],
1193 [31194, 32768, 0],
1194 [31895, 32768, 0],
1195 [26875, 32768, 0],
1196 [30304, 32768, 0],
1197 ],
1198];
1199
1200/// `default_skip_mode_cdfs` (entropymode.c, `SKIP_MODE_CONTEXTS` = 3): whether
1201/// a block reads `skip_mode` (forced `NEAREST_NEARESTMV` compound, `skip`
1202/// forced true, no residual) -- indexed by `av1_get_skip_mode_context`
1203/// (`above.skip_mode + left.skip_mode`, `pred_common.h`), only read when this
1204/// frame's own `skip_mode_present` header bit is set and the block is at
1205/// least 8x8 both dims (`is_comp_ref_allowed`) -- lane-av1comp.
1206pub const SKIP_MODE: [[u16; 3]; 3] = [[32621, 32768, 0], [20708, 32768, 0], [8127, 32768, 0]];
1207
1208/// `Default_Comp_Mode_Cdf` (spec 9.4, `default_comp_inter_cdf`): whether an
1209/// inter block reads `SINGLE_REFERENCE` or `COMPOUND_REFERENCE` -- only
1210/// reached once `read_ref_frames` knows the frame's `reference_select`
1211/// header bit made the choice per-block instead of fixing it, indexed by
1212/// `av1_get_reference_mode_context` (lane-av1comp).
1213pub const COMP_MODE: [[u16; 3]; 5] = [
1214 [26828, 32768, 0],
1215 [24035, 32768, 0],
1216 [12031, 32768, 0],
1217 [10640, 32768, 0],
1218 [2901, 32768, 0],
1219];
1220
1221/// `Default_Comp_Ref_Type_Cdf` (spec 9.4, `default_comp_ref_type_cdf`):
1222/// unidirectional vs. bidirectional compound reference pair, indexed by
1223/// `av1_get_comp_reference_type_context`.
1224pub const COMP_REF_TYPE: [[u16; 3]; 5] = [
1225 [1198, 32768, 0],
1226 [2070, 32768, 0],
1227 [9166, 32768, 0],
1228 [7499, 32768, 0],
1229 [22475, 32768, 0],
1230];
1231
1232/// `Default_Comp_Group_Idx_Cdf` (spec 9.4, libaom `default_comp_group_idx_cdfs`):
1233/// whether a compound block's `comp_group_idx` picks masked compound (`1`)
1234/// over the plain distance-weighted/simple-average blend (`0`), indexed by
1235/// `get_comp_group_idx_context` -- only read when `seq.enable_masked_compound`
1236/// and the block size is masked-compound-eligible (lane-av1comp).
1237pub const COMP_GROUP_IDX: [[u16; 3]; 6] = [
1238 [26607, 32768, 0],
1239 [22891, 32768, 0],
1240 [18840, 32768, 0],
1241 [24594, 32768, 0],
1242 [19934, 32768, 0],
1243 [22674, 32768, 0],
1244];
1245
1246/// `Default_Compound_Idx_Cdf` (spec 9.4, libaom `default_compound_idx_cdfs`):
1247/// whether a compound block's `compound_idx` picks the simple average
1248/// (`1`) or [`crate::compound::dist_wtd_comp_weight_assign`]'s distance
1249/// weights (`0`), indexed by `get_comp_index_context` -- only read when
1250/// `seq.enable_jnt_comp` (lane-av1comp).
1251pub const COMPOUND_IDX: [[u16; 3]; 6] = [
1252 [18244, 32768, 0],
1253 [12865, 32768, 0],
1254 [7053, 32768, 0],
1255 [13259, 32768, 0],
1256 [9334, 32768, 0],
1257 [4644, 32768, 0],
1258];
1259
1260/// `Default_Uni_Comp_Ref_Cdf` (spec 9.4, `default_uni_comp_ref_cdf`): the
1261/// three binary decisions narrowing a unidirectional compound pair down to
1262/// one of `{BWDREF,ALTREF}`/`{LAST,LAST2}`/`{LAST,LAST3}`/`{LAST,GOLDEN}`.
1263pub const UNI_COMP_REF: [[[u16; 3]; 3]; 3] = [
1264 [[5284, 32768, 0], [3865, 32768, 0], [3128, 32768, 0]],
1265 [[23152, 32768, 0], [14173, 32768, 0], [15270, 32768, 0]],
1266 [[31774, 32768, 0], [25120, 32768, 0], [26710, 32768, 0]],
1267];
1268
1269/// `Default_Comp_Ref_Cdf` (spec 9.4, `default_comp_ref_cdf`): the three
1270/// binary decisions narrowing a bidirectional pair's forward reference.
1271pub const COMP_REF: [[[u16; 3]; 3]; 3] = [
1272 [[4946, 32768, 0], [9468, 32768, 0], [1503, 32768, 0]],
1273 [[19891, 32768, 0], [22441, 32768, 0], [15160, 32768, 0]],
1274 [[30731, 32768, 0], [31059, 32768, 0], [27544, 32768, 0]],
1275];
1276
1277/// `Default_Comp_Bwdref_Cdf` (spec 9.4, `default_comp_bwdref_cdf`): the two
1278/// binary decisions narrowing a bidirectional pair's backward reference.
1279pub const COMP_BWDREF: [[[u16; 3]; 2]; 3] = [
1280 [[2235, 32768, 0], [1423, 32768, 0]],
1281 [[17182, 32768, 0], [15175, 32768, 0]],
1282 [[30606, 32768, 0], [30489, 32768, 0]],
1283];
1284
1285/// `Default_Y_Mode_Cdf` (spec 9.4): the thirteen luma intra modes of an inter
1286/// frame's intra block, indexed by the block's size group -- unlike a key
1287/// frame's [`KF_Y_MODE`], which is indexed by the neighbours' modes instead.
1288pub const Y_MODE: [[u16; 14]; 4] = [
1289 [
1290 22801, 23489, 24293, 24756, 25601, 26123, 26606, 27418, 27945, 29228, 29685, 30349, 32768,
1291 0,
1292 ],
1293 [
1294 18673, 19845, 22631, 23318, 23950, 24649, 25527, 27364, 28152, 29701, 29984, 30852, 32768,
1295 0,
1296 ],
1297 [
1298 19770, 20979, 23396, 23939, 24241, 24654, 25136, 27073, 27830, 29360, 29730, 30659, 32768,
1299 0,
1300 ],
1301 [
1302 20155, 21301, 22838, 23178, 23261, 23533, 23703, 24804, 25352, 26575, 27016, 28049, 32768,
1303 0,
1304 ],
1305];
1306
1307/// `Default_New_Mv_Cdf` (spec 9.4): whether an inter block's motion vector is
1308/// coded explicitly rather than taken from a neighbour, indexed by how many
1309/// neighbours already chose a new vector.
1310pub const NEW_MV: [[u16; 3]; 6] = [
1311 [24035, 32768, 0],
1312 [16630, 32768, 0],
1313 [15339, 32768, 0],
1314 [8386, 32768, 0],
1315 [12222, 32768, 0],
1316 [4676, 32768, 0],
1317];
1318
1319/// `Default_Zero_Mv_Cdf` (spec 9.4): whether an inter block's motion vector is
1320/// the zero vector, indexed by whether the block's global motion type is
1321/// identity.
1322pub const ZERO_MV: [[u16; 3]; 2] = [[2175, 32768, 0], [1054, 32768, 0]];
1323
1324/// `Default_Ref_Mv_Cdf` (spec 9.4): which of the block's reference motion
1325/// vector candidates it takes, indexed by how many candidates are available.
1326pub const REF_MV: [[u16; 3]; 6] = [
1327 [23974, 32768, 0],
1328 [24188, 32768, 0],
1329 [17848, 32768, 0],
1330 [28622, 32768, 0],
1331 [24312, 32768, 0],
1332 [19923, 32768, 0],
1333];
1334
1335/// `Default_Drl_Mode_Cdf` (spec 9.4): the dynamic reference list index a
1336/// block's motion vector prediction is drawn from, indexed by the list's
1337/// context.
1338pub const DRL_MODE: [[u16; 3]; 3] = [[13104, 32768, 0], [24560, 32768, 0], [18945, 32768, 0]];
1339
1340// The motion vector tables below (spec 9.4's `Default_Mv_*`) are the shared
1341// defaults for both components of a vector: [`crate::cdf_state::Cdfs`] holds
1342// one owned copy of each per component, seeded from the same constant here,
1343// since the spec's default state does not distinguish them -- only adaptation
1344// does, once a tile has coded a few vectors.
1345
1346/// `Default_Mv_Joint_Cdf` (spec 9.4): which of a motion vector's two
1347/// components change at all.
1348pub const MV_JOINT: [u16; 5] = [4096, 11264, 19328, 32768, 0];
1349
1350/// `Default_Mv_Class_Cdf` (spec 9.4): the magnitude class of one motion
1351/// vector component.
1352pub const MV_CLASS: [u16; 12] = [
1353 28672, 30976, 31858, 32320, 32551, 32656, 32740, 32757, 32762, 32767, 32768, 0,
1354];
1355
1356/// `Default_Mv_Class0_Bit_Cdf` (spec 9.4): the integer bit of a small-class
1357/// motion vector's magnitude.
1358pub const MV_CLASS0_BIT: [u16; 3] = [27648, 32768, 0];
1359
1360/// `Default_Mv_Class0_Fr_Cdf` (spec 9.4): the fractional part of a
1361/// small-class motion vector's magnitude, indexed by its integer bit.
1362pub const MV_CLASS0_FR: [[u16; 5]; 2] = [
1363 [16384, 24576, 26624, 32768, 0],
1364 [12288, 21248, 24128, 32768, 0],
1365];
1366
1367/// `Default_Mv_Class0_Hp_Cdf` (spec 9.4): the half-pel bit of a small-class
1368/// motion vector's magnitude.
1369pub const MV_CLASS0_HP: [u16; 3] = [20480, 32768, 0];
1370
1371/// `Default_Mv_Bit_Cdf` (spec 9.4): one bit of a motion vector's integer
1372/// magnitude above the small-class range, indexed by the bit's position.
1373pub const MV_BIT: [[u16; 3]; 10] = [
1374 [17408, 32768, 0],
1375 [17920, 32768, 0],
1376 [18944, 32768, 0],
1377 [20480, 32768, 0],
1378 [22528, 32768, 0],
1379 [24576, 32768, 0],
1380 [28672, 32768, 0],
1381 [29952, 32768, 0],
1382 [29952, 32768, 0],
1383 [30720, 32768, 0],
1384];
1385
1386/// `Default_Mv_Fr_Cdf` (spec 9.4): the fractional part of a motion vector's
1387/// magnitude, outside the small-class range.
1388pub const MV_FR: [u16; 5] = [8192, 17408, 21248, 32768, 0];
1389
1390/// `Default_Mv_Hp_Cdf` (spec 9.4): the half-pel bit of a motion vector's
1391/// magnitude, outside the small-class range.
1392pub const MV_HP: [u16; 3] = [16384, 32768, 0];
1393
1394/// `Default_Mv_Sign_Cdf` (spec 9.4): the sign of a motion vector component.
1395pub const MV_SIGN: [u16; 3] = [16384, 32768, 0];
1396
1397// q-context 0/1/3 coefficient CDFs (spec 9.4's `Default_..._Cdf[0]`,
1398// `[1]` and `[3]`), auto-derived from the same libaom `token_cdfs.h` the
1399// q-context-2 tables above were transcribed from, and checked by reproducing
1400// every q-context-2 table above byte-for-byte with the same indexing before
1401// generating these (see the lane report for the check).
1402
1403// q-context 0: base_q_idx 0..=20.
1404
1405/// TXB_SKIP_LUMA_64, q-context 0: the same table as [`TXB_SKIP_LUMA_64`], for `base_q_idx` 0..=20.
1406pub const TXB_SKIP_LUMA_64_Q0: [u16; 3] = [6308, 32768, 0];
1407/// TXB_SKIP_LUMA_32, q-context 0: the same table as [`TXB_SKIP_LUMA_32`], for `base_q_idx` 0..=20.
1408pub const TXB_SKIP_LUMA_32_Q0: [u16; 3] = [17920, 32768, 0];
1409/// TXB_SKIP_LUMA_16, q-context 0: the same table as [`TXB_SKIP_LUMA_16`], for `base_q_idx` 0..=20.
1410pub const TXB_SKIP_LUMA_16_Q0: [u16; 3] = [29957, 32768, 0];
1411/// TXB_SKIP_CHROMA_8, q-context 0: the same table as [`TXB_SKIP_CHROMA_8`], for `base_q_idx` 0..=20.
1412pub const TXB_SKIP_CHROMA_8_Q0: [[u16; 3]; 3] =
1413 [[5403, 32768, 0], [18096, 32768, 0], [30003, 32768, 0]];
1414/// TXB_SKIP_CHROMA_16, q-context 0: the same table as [`TXB_SKIP_CHROMA_16`], for `base_q_idx` 0..=20.
1415pub const TXB_SKIP_CHROMA_16_Q0: [[u16; 3]; 3] =
1416 [[3778, 32768, 0], [15336, 32768, 0], [28981, 32768, 0]];
1417/// TXB_SKIP_CHROMA_32, q-context 0: the same table as [`TXB_SKIP_CHROMA_32`], for `base_q_idx` 0..=20.
1418pub const TXB_SKIP_CHROMA_32_Q0: [[u16; 3]; 3] =
1419 [[1366, 32768, 0], [15628, 32768, 0], [30462, 32768, 0]];
1420/// EOB_EXTRA_LUMA_16, q-context 0: the same table as [`EOB_EXTRA_LUMA_16`], for `base_q_idx` 0..=20.
1421pub const EOB_EXTRA_LUMA_16_Q0: [[u16; 3]; 9] = [
1422 [23905, 32768, 0],
1423 [17194, 32768, 0],
1424 [16170, 32768, 0],
1425 [17695, 32768, 0],
1426 [13826, 32768, 0],
1427 [15810, 32768, 0],
1428 [12036, 32768, 0],
1429 [16384, 32768, 0],
1430 [16384, 32768, 0],
1431];
1432/// EOB_EXTRA_LUMA_32, q-context 0: the same table as [`EOB_EXTRA_LUMA_32`], for `base_q_idx` 0..=20.
1433pub const EOB_EXTRA_LUMA_32_Q0: [[u16; 3]; 9] = [
1434 [27399, 32768, 0],
1435 [16327, 32768, 0],
1436 [18071, 32768, 0],
1437 [19584, 32768, 0],
1438 [20721, 32768, 0],
1439 [18432, 32768, 0],
1440 [19560, 32768, 0],
1441 [10150, 32768, 0],
1442 [8805, 32768, 0],
1443];
1444/// EOB_EXTRA_LUMA_64, q-context 0: the same table as [`EOB_EXTRA_LUMA_64`], for `base_q_idx` 0..=20.
1445pub const EOB_EXTRA_LUMA_64_Q0: [[u16; 3]; 9] = [
1446 [23406, 32768, 0],
1447 [21845, 32768, 0],
1448 [18432, 32768, 0],
1449 [16384, 32768, 0],
1450 [17096, 32768, 0],
1451 [12561, 32768, 0],
1452 [17320, 32768, 0],
1453 [22395, 32768, 0],
1454 [21370, 32768, 0],
1455];
1456/// EOB_EXTRA_CHROMA_8, q-context 0: the same table as [`EOB_EXTRA_CHROMA_8`], for `base_q_idx` 0..=20.
1457pub const EOB_EXTRA_CHROMA_8_Q0: [[u16; 3]; 9] = [
1458 [20681, 32768, 0],
1459 [20701, 32768, 0],
1460 [15250, 32768, 0],
1461 [15017, 32768, 0],
1462 [14928, 32768, 0],
1463 [16384, 32768, 0],
1464 [16384, 32768, 0],
1465 [16384, 32768, 0],
1466 [16384, 32768, 0],
1467];
1468/// EOB_EXTRA_CHROMA_16, q-context 0: the same table as [`EOB_EXTRA_CHROMA_16`], for `base_q_idx` 0..=20.
1469pub const EOB_EXTRA_CHROMA_16_Q0: [[u16; 3]; 9] = [
1470 [23959, 32768, 0],
1471 [20799, 32768, 0],
1472 [19021, 32768, 0],
1473 [16203, 32768, 0],
1474 [17886, 32768, 0],
1475 [14144, 32768, 0],
1476 [12010, 32768, 0],
1477 [16384, 32768, 0],
1478 [16384, 32768, 0],
1479];
1480/// EOB_EXTRA_CHROMA_32, q-context 0: the same table as [`EOB_EXTRA_CHROMA_32`], for `base_q_idx` 0..=20.
1481pub const EOB_EXTRA_CHROMA_32_Q0: [[u16; 3]; 9] = [
1482 [24932, 32768, 0],
1483 [20833, 32768, 0],
1484 [12027, 32768, 0],
1485 [16670, 32768, 0],
1486 [19914, 32768, 0],
1487 [15106, 32768, 0],
1488 [17662, 32768, 0],
1489 [13783, 32768, 0],
1490 [28756, 32768, 0],
1491];
1492/// EOB_PT_1024_LUMA, q-context 0: the same table as [`EOB_PT_1024_LUMA`], for `base_q_idx` 0..=20.
1493pub const EOB_PT_1024_LUMA_Q0: [u16; 12] = [
1494 393, 421, 751, 1623, 3160, 6352, 13345, 18047, 22571, 25830, 32768, 0,
1495];
1496/// EOB_PT_1024_CHROMA, q-context 0: the same table as [`EOB_PT_1024_CHROMA`], for `base_q_idx` 0..=20.
1497pub const EOB_PT_1024_CHROMA_Q0: [u16; 12] = [
1498 1865, 1988, 2930, 4242, 10533, 16538, 21354, 27255, 28546, 31784, 32768, 0,
1499];
1500/// EOB_PT_256_LUMA, q-context 0: the same table as [`EOB_PT_256_LUMA`], for `base_q_idx` 0..=20.
1501pub const EOB_PT_256_LUMA_Q0: [u16; 10] =
1502 [310, 584, 1887, 3589, 6168, 8611, 11352, 15652, 32768, 0];
1503/// EOB_PT_256_CHROMA, q-context 0: the same table as [`EOB_PT_256_CHROMA`], for `base_q_idx` 0..=20.
1504pub const EOB_PT_256_CHROMA_Q0: [u16; 10] =
1505 [2520, 3240, 5952, 8870, 12577, 17558, 19954, 24168, 32768, 0];
1506/// EOB_PT_64_CHROMA, q-context 0: the same table as [`EOB_PT_64_CHROMA`], for `base_q_idx` 0..=20.
1507pub const EOB_PT_64_CHROMA_Q0: [u16; 8] = [3505, 5304, 10086, 13814, 17684, 23370, 32768, 0];
1508/// COEFF_BASE_LUMA_16, q-context 0: the same table as [`COEFF_BASE_LUMA_16`], for `base_q_idx` 0..=20.
1509pub const COEFF_BASE_LUMA_16_Q0: [[u16; 5]; 42] = [
1510 [5487, 10460, 13708, 32768, 0],
1511 [21597, 28303, 30674, 32768, 0],
1512 [11037, 21953, 26476, 32768, 0],
1513 [8147, 17962, 22952, 32768, 0],
1514 [5242, 13061, 18532, 32768, 0],
1515 [1889, 5208, 8182, 32768, 0],
1516 [26774, 32133, 32590, 32768, 0],
1517 [17844, 29564, 31767, 32768, 0],
1518 [11690, 24438, 29171, 32768, 0],
1519 [7542, 18215, 24459, 32768, 0],
1520 [2993, 8050, 12319, 32768, 0],
1521 [28023, 32328, 32591, 32768, 0],
1522 [18651, 30126, 31954, 32768, 0],
1523 [12164, 25146, 29589, 32768, 0],
1524 [7762, 18530, 24771, 32768, 0],
1525 [3492, 9183, 13920, 32768, 0],
1526 [27591, 32008, 32491, 32768, 0],
1527 [17149, 28853, 31510, 32768, 0],
1528 [11485, 24003, 28860, 32768, 0],
1529 [7697, 18086, 24210, 32768, 0],
1530 [3075, 7999, 12218, 32768, 0],
1531 [28268, 32482, 32654, 32768, 0],
1532 [19631, 31051, 32404, 32768, 0],
1533 [13860, 27260, 31020, 32768, 0],
1534 [9605, 21613, 27594, 32768, 0],
1535 [4876, 12162, 17908, 32768, 0],
1536 [27248, 32316, 32576, 32768, 0],
1537 [18955, 30457, 32075, 32768, 0],
1538 [11824, 23997, 28795, 32768, 0],
1539 [7346, 18196, 24647, 32768, 0],
1540 [3403, 9247, 14111, 32768, 0],
1541 [29711, 32655, 32735, 32768, 0],
1542 [21169, 31394, 32417, 32768, 0],
1543 [13487, 27198, 30957, 32768, 0],
1544 [8828, 21683, 27614, 32768, 0],
1545 [4270, 11451, 17038, 32768, 0],
1546 [28708, 32578, 32731, 32768, 0],
1547 [20120, 31241, 32482, 32768, 0],
1548 [13692, 27550, 31321, 32768, 0],
1549 [9418, 22514, 28439, 32768, 0],
1550 [4999, 13283, 19462, 32768, 0],
1551 [8192, 16384, 24576, 32768, 0],
1552];
1553/// COEFF_BASE_LUMA_32, q-context 0: the same table as [`COEFF_BASE_LUMA_32`], for `base_q_idx` 0..=20.
1554pub const COEFF_BASE_LUMA_32_Q0: [[u16; 5]; 42] = [
1555 [5141, 7096, 8260, 32768, 0],
1556 [27186, 29022, 29789, 32768, 0],
1557 [6668, 12568, 15682, 32768, 0],
1558 [2172, 6181, 8638, 32768, 0],
1559 [1126, 3379, 4531, 32768, 0],
1560 [443, 1361, 2254, 32768, 0],
1561 [26083, 31153, 32436, 32768, 0],
1562 [13486, 24603, 28483, 32768, 0],
1563 [6508, 14840, 19910, 32768, 0],
1564 [3386, 8800, 13286, 32768, 0],
1565 [1530, 4322, 7054, 32768, 0],
1566 [29639, 32080, 32548, 32768, 0],
1567 [15897, 27552, 30290, 32768, 0],
1568 [8588, 20047, 25383, 32768, 0],
1569 [4889, 13339, 19269, 32768, 0],
1570 [2240, 6871, 10498, 32768, 0],
1571 [28165, 32197, 32517, 32768, 0],
1572 [20735, 30427, 31568, 32768, 0],
1573 [14325, 24671, 27692, 32768, 0],
1574 [5119, 12554, 17805, 32768, 0],
1575 [1810, 5441, 8261, 32768, 0],
1576 [31212, 32724, 32748, 32768, 0],
1577 [23352, 31766, 32545, 32768, 0],
1578 [14669, 27570, 31059, 32768, 0],
1579 [8492, 20894, 27272, 32768, 0],
1580 [3644, 10194, 15204, 32768, 0],
1581 [8192, 16384, 24576, 32768, 0],
1582 [8192, 16384, 24576, 32768, 0],
1583 [8192, 16384, 24576, 32768, 0],
1584 [8192, 16384, 24576, 32768, 0],
1585 [8192, 16384, 24576, 32768, 0],
1586 [8192, 16384, 24576, 32768, 0],
1587 [8192, 16384, 24576, 32768, 0],
1588 [8192, 16384, 24576, 32768, 0],
1589 [8192, 16384, 24576, 32768, 0],
1590 [8192, 16384, 24576, 32768, 0],
1591 [8192, 16384, 24576, 32768, 0],
1592 [8192, 16384, 24576, 32768, 0],
1593 [8192, 16384, 24576, 32768, 0],
1594 [8192, 16384, 24576, 32768, 0],
1595 [8192, 16384, 24576, 32768, 0],
1596 [8192, 16384, 24576, 32768, 0],
1597];
1598/// COEFF_BASE_LUMA_64, q-context 0: the same table as [`COEFF_BASE_LUMA_64`], for `base_q_idx` 0..=20.
1599pub const COEFF_BASE_LUMA_64_Q0: [[u16; 5]; 42] = [
1600 [601, 983, 1311, 32768, 0],
1601 [18725, 23406, 28087, 32768, 0],
1602 [5461, 8192, 10923, 32768, 0],
1603 [3781, 15124, 21425, 32768, 0],
1604 [2587, 7761, 12072, 32768, 0],
1605 [106, 458, 810, 32768, 0],
1606 [22282, 29710, 31894, 32768, 0],
1607 [8508, 20926, 25984, 32768, 0],
1608 [3726, 12713, 18083, 32768, 0],
1609 [1620, 7112, 10893, 32768, 0],
1610 [729, 2236, 3495, 32768, 0],
1611 [30163, 32474, 32684, 32768, 0],
1612 [18304, 30464, 32000, 32768, 0],
1613 [11443, 26526, 29647, 32768, 0],
1614 [6007, 15292, 21299, 32768, 0],
1615 [2234, 6703, 8937, 32768, 0],
1616 [30954, 32177, 32571, 32768, 0],
1617 [17363, 29562, 31076, 32768, 0],
1618 [9686, 22464, 27410, 32768, 0],
1619 [8192, 16384, 21390, 32768, 0],
1620 [1755, 8046, 11264, 32768, 0],
1621 [31168, 32734, 32748, 32768, 0],
1622 [22486, 31441, 32471, 32768, 0],
1623 [12833, 25627, 29738, 32768, 0],
1624 [6980, 17379, 23122, 32768, 0],
1625 [3111, 8887, 13479, 32768, 0],
1626 [8192, 16384, 24576, 32768, 0],
1627 [8192, 16384, 24576, 32768, 0],
1628 [8192, 16384, 24576, 32768, 0],
1629 [8192, 16384, 24576, 32768, 0],
1630 [8192, 16384, 24576, 32768, 0],
1631 [8192, 16384, 24576, 32768, 0],
1632 [8192, 16384, 24576, 32768, 0],
1633 [8192, 16384, 24576, 32768, 0],
1634 [8192, 16384, 24576, 32768, 0],
1635 [8192, 16384, 24576, 32768, 0],
1636 [8192, 16384, 24576, 32768, 0],
1637 [8192, 16384, 24576, 32768, 0],
1638 [8192, 16384, 24576, 32768, 0],
1639 [8192, 16384, 24576, 32768, 0],
1640 [8192, 16384, 24576, 32768, 0],
1641 [8192, 16384, 24576, 32768, 0],
1642];
1643/// COEFF_BASE_CHROMA_8, q-context 0: the same table as [`COEFF_BASE_CHROMA_8`], for `base_q_idx` 0..=20.
1644pub const COEFF_BASE_CHROMA_8_Q0: [[u16; 5]; 42] = [
1645 [6037, 16771, 21957, 32768, 0],
1646 [24774, 31704, 32426, 32768, 0],
1647 [16830, 28589, 31056, 32768, 0],
1648 [10602, 22828, 27760, 32768, 0],
1649 [6733, 16829, 23071, 32768, 0],
1650 [3250, 8914, 13556, 32768, 0],
1651 [25582, 32220, 32668, 32768, 0],
1652 [18659, 30342, 32223, 32768, 0],
1653 [12546, 26149, 30515, 32768, 0],
1654 [8420, 20451, 26801, 32768, 0],
1655 [4636, 12420, 18344, 32768, 0],
1656 [27581, 32362, 32639, 32768, 0],
1657 [18987, 30083, 31978, 32768, 0],
1658 [11327, 24248, 29084, 32768, 0],
1659 [7264, 17719, 24120, 32768, 0],
1660 [3995, 10768, 16169, 32768, 0],
1661 [25893, 31831, 32487, 32768, 0],
1662 [16577, 28587, 31379, 32768, 0],
1663 [10189, 22748, 28182, 32768, 0],
1664 [6832, 17094, 23556, 32768, 0],
1665 [3708, 10110, 15334, 32768, 0],
1666 [25904, 32282, 32656, 32768, 0],
1667 [19721, 30792, 32276, 32768, 0],
1668 [12819, 26243, 30411, 32768, 0],
1669 [8572, 20614, 26891, 32768, 0],
1670 [5364, 14059, 20467, 32768, 0],
1671 [26580, 32438, 32677, 32768, 0],
1672 [20852, 31225, 32340, 32768, 0],
1673 [12435, 25700, 29967, 32768, 0],
1674 [8691, 20825, 26976, 32768, 0],
1675 [4446, 12209, 17269, 32768, 0],
1676 [27350, 32429, 32696, 32768, 0],
1677 [21372, 30977, 32272, 32768, 0],
1678 [12673, 25270, 29853, 32768, 0],
1679 [9208, 20925, 26640, 32768, 0],
1680 [5018, 13351, 18732, 32768, 0],
1681 [27351, 32479, 32713, 32768, 0],
1682 [21398, 31209, 32387, 32768, 0],
1683 [12162, 25047, 29842, 32768, 0],
1684 [7896, 18691, 25319, 32768, 0],
1685 [4670, 12882, 18881, 32768, 0],
1686 [8192, 16384, 24576, 32768, 0],
1687];
1688/// COEFF_BASE_CHROMA_16, q-context 0: the same table as [`COEFF_BASE_CHROMA_16`], for `base_q_idx` 0..=20.
1689pub const COEFF_BASE_CHROMA_16_Q0: [[u16; 5]; 42] = [
1690 [5673, 14302, 19711, 32768, 0],
1691 [26251, 30701, 31834, 32768, 0],
1692 [12782, 23783, 27803, 32768, 0],
1693 [9127, 20657, 25808, 32768, 0],
1694 [6368, 16208, 21462, 32768, 0],
1695 [2465, 7177, 10822, 32768, 0],
1696 [29961, 32563, 32719, 32768, 0],
1697 [18318, 29891, 31949, 32768, 0],
1698 [11361, 24514, 29357, 32768, 0],
1699 [7900, 19603, 25607, 32768, 0],
1700 [4002, 10590, 15546, 32768, 0],
1701 [29637, 32310, 32595, 32768, 0],
1702 [18296, 29913, 31809, 32768, 0],
1703 [10144, 21515, 26871, 32768, 0],
1704 [5358, 14322, 20394, 32768, 0],
1705 [3067, 8362, 13346, 32768, 0],
1706 [28652, 32470, 32676, 32768, 0],
1707 [17538, 30771, 32209, 32768, 0],
1708 [13924, 26882, 30494, 32768, 0],
1709 [10496, 22837, 27869, 32768, 0],
1710 [7236, 16396, 21621, 32768, 0],
1711 [30743, 32687, 32746, 32768, 0],
1712 [23006, 31676, 32489, 32768, 0],
1713 [14494, 27828, 31120, 32768, 0],
1714 [10174, 22801, 28352, 32768, 0],
1715 [6242, 15281, 21043, 32768, 0],
1716 [25817, 32243, 32720, 32768, 0],
1717 [18618, 31367, 32325, 32768, 0],
1718 [13997, 28318, 31878, 32768, 0],
1719 [12255, 26534, 31383, 32768, 0],
1720 [9561, 21588, 28450, 32768, 0],
1721 [28188, 32635, 32724, 32768, 0],
1722 [22060, 32365, 32728, 32768, 0],
1723 [18102, 30690, 32528, 32768, 0],
1724 [14196, 28864, 31999, 32768, 0],
1725 [12262, 25792, 30865, 32768, 0],
1726 [24176, 32109, 32628, 32768, 0],
1727 [18280, 29681, 31963, 32768, 0],
1728 [10205, 23703, 29664, 32768, 0],
1729 [7889, 20025, 27676, 32768, 0],
1730 [6060, 16743, 23970, 32768, 0],
1731 [8192, 16384, 24576, 32768, 0],
1732];
1733/// COEFF_BASE_CHROMA_32, q-context 0: the same table as [`COEFF_BASE_CHROMA_32`], for `base_q_idx` 0..=20.
1734pub const COEFF_BASE_CHROMA_32_Q0: [[u16; 5]; 42] = [
1735 [2461, 7013, 9371, 32768, 0],
1736 [24749, 29600, 30986, 32768, 0],
1737 [9466, 19037, 22417, 32768, 0],
1738 [3584, 9280, 14400, 32768, 0],
1739 [1505, 3929, 5433, 32768, 0],
1740 [677, 1500, 2736, 32768, 0],
1741 [23987, 30702, 32117, 32768, 0],
1742 [13554, 24571, 29263, 32768, 0],
1743 [6211, 14556, 21155, 32768, 0],
1744 [3135, 10972, 15625, 32768, 0],
1745 [2435, 7127, 11427, 32768, 0],
1746 [31300, 32532, 32550, 32768, 0],
1747 [14757, 30365, 31954, 32768, 0],
1748 [4405, 11612, 18553, 32768, 0],
1749 [580, 4132, 7322, 32768, 0],
1750 [1695, 10169, 14124, 32768, 0],
1751 [30008, 32282, 32591, 32768, 0],
1752 [19244, 30108, 31748, 32768, 0],
1753 [11180, 24158, 29555, 32768, 0],
1754 [5650, 14972, 19209, 32768, 0],
1755 [2114, 5109, 8456, 32768, 0],
1756 [31856, 32716, 32748, 32768, 0],
1757 [23012, 31664, 32572, 32768, 0],
1758 [13694, 26656, 30636, 32768, 0],
1759 [8142, 19508, 26093, 32768, 0],
1760 [4253, 10955, 16724, 32768, 0],
1761 [8192, 16384, 24576, 32768, 0],
1762 [8192, 16384, 24576, 32768, 0],
1763 [8192, 16384, 24576, 32768, 0],
1764 [8192, 16384, 24576, 32768, 0],
1765 [8192, 16384, 24576, 32768, 0],
1766 [8192, 16384, 24576, 32768, 0],
1767 [8192, 16384, 24576, 32768, 0],
1768 [8192, 16384, 24576, 32768, 0],
1769 [8192, 16384, 24576, 32768, 0],
1770 [8192, 16384, 24576, 32768, 0],
1771 [8192, 16384, 24576, 32768, 0],
1772 [8192, 16384, 24576, 32768, 0],
1773 [8192, 16384, 24576, 32768, 0],
1774 [8192, 16384, 24576, 32768, 0],
1775 [8192, 16384, 24576, 32768, 0],
1776 [8192, 16384, 24576, 32768, 0],
1777];
1778/// COEFF_BR_LUMA_16, q-context 0: the same table as [`COEFF_BR_LUMA_16`], for `base_q_idx` 0..=20.
1779pub const COEFF_BR_LUMA_16_Q0: [[u16; 5]; 21] = [
1780 [10563, 16233, 19763, 32768, 0],
1781 [9794, 16022, 19804, 32768, 0],
1782 [6750, 11945, 15759, 32768, 0],
1783 [4963, 9186, 12752, 32768, 0],
1784 [3845, 7435, 10627, 32768, 0],
1785 [3051, 6085, 8834, 32768, 0],
1786 [1311, 2596, 3830, 32768, 0],
1787 [11246, 16404, 19689, 32768, 0],
1788 [12315, 18911, 22731, 32768, 0],
1789 [10557, 17095, 21289, 32768, 0],
1790 [8136, 14006, 18249, 32768, 0],
1791 [6348, 11474, 15565, 32768, 0],
1792 [5196, 9655, 13400, 32768, 0],
1793 [2349, 4526, 6587, 32768, 0],
1794 [13337, 18730, 21569, 32768, 0],
1795 [19306, 26071, 28882, 32768, 0],
1796 [15952, 23540, 27254, 32768, 0],
1797 [12409, 19934, 24430, 32768, 0],
1798 [9760, 16706, 21389, 32768, 0],
1799 [8004, 14220, 18818, 32768, 0],
1800 [4138, 7794, 10961, 32768, 0],
1801];
1802/// COEFF_BR_LUMA_32, q-context 0: the same table as [`COEFF_BR_LUMA_32`], for `base_q_idx` 0..=20.
1803pub const COEFF_BR_LUMA_32_Q0: [[u16; 5]; 21] = [
1804 [2331, 3662, 5244, 32768, 0],
1805 [2891, 4771, 6145, 32768, 0],
1806 [4598, 7623, 9729, 32768, 0],
1807 [3520, 6845, 9199, 32768, 0],
1808 [3417, 6119, 9324, 32768, 0],
1809 [2601, 5412, 7385, 32768, 0],
1810 [600, 1173, 1744, 32768, 0],
1811 [7672, 13286, 17469, 32768, 0],
1812 [4232, 7792, 10793, 32768, 0],
1813 [2915, 5317, 7397, 32768, 0],
1814 [2318, 4356, 6152, 32768, 0],
1815 [2127, 4000, 5554, 32768, 0],
1816 [1850, 3478, 5275, 32768, 0],
1817 [977, 1933, 2843, 32768, 0],
1818 [18280, 24387, 27989, 32768, 0],
1819 [15852, 22671, 26185, 32768, 0],
1820 [13845, 20951, 24789, 32768, 0],
1821 [11055, 17966, 22129, 32768, 0],
1822 [9138, 15422, 19801, 32768, 0],
1823 [7454, 13145, 17456, 32768, 0],
1824 [3370, 6393, 9013, 32768, 0],
1825];
1826/// COEFF_BR_CHROMA_8, q-context 0: the same table as [`COEFF_BR_CHROMA_8`], for `base_q_idx` 0..=20.
1827pub const COEFF_BR_CHROMA_8_Q0: [[u16; 5]; 21] = [
1828 [15460, 21696, 25469, 32768, 0],
1829 [12170, 19249, 23191, 32768, 0],
1830 [8723, 15027, 19332, 32768, 0],
1831 [6428, 11704, 15874, 32768, 0],
1832 [4922, 9292, 13052, 32768, 0],
1833 [4139, 7695, 11010, 32768, 0],
1834 [2291, 4508, 6598, 32768, 0],
1835 [19856, 26920, 29828, 32768, 0],
1836 [17923, 25289, 28792, 32768, 0],
1837 [14278, 21968, 26297, 32768, 0],
1838 [10910, 18136, 22950, 32768, 0],
1839 [8423, 14815, 19627, 32768, 0],
1840 [6771, 12283, 16774, 32768, 0],
1841 [4074, 7750, 11081, 32768, 0],
1842 [19852, 26074, 28672, 32768, 0],
1843 [19371, 26110, 28989, 32768, 0],
1844 [16265, 23873, 27663, 32768, 0],
1845 [12758, 20378, 24952, 32768, 0],
1846 [10095, 17098, 21961, 32768, 0],
1847 [8250, 14628, 19451, 32768, 0],
1848 [5205, 9745, 13622, 32768, 0],
1849];
1850/// COEFF_BR_CHROMA_16, q-context 0: the same table as [`COEFF_BR_CHROMA_16`], for `base_q_idx` 0..=20.
1851pub const COEFF_BR_CHROMA_16_Q0: [[u16; 5]; 21] = [
1852 [10870, 16684, 20949, 32768, 0],
1853 [9664, 15230, 18680, 32768, 0],
1854 [6886, 12109, 15408, 32768, 0],
1855 [4825, 8900, 12305, 32768, 0],
1856 [3630, 7162, 10314, 32768, 0],
1857 [3036, 6429, 9387, 32768, 0],
1858 [1671, 3296, 4940, 32768, 0],
1859 [13819, 19159, 23026, 32768, 0],
1860 [11984, 19108, 23120, 32768, 0],
1861 [10690, 17210, 21663, 32768, 0],
1862 [7984, 14154, 18333, 32768, 0],
1863 [6868, 12294, 16124, 32768, 0],
1864 [5274, 8994, 12868, 32768, 0],
1865 [2988, 5771, 8424, 32768, 0],
1866 [19736, 26647, 29141, 32768, 0],
1867 [18933, 26070, 28984, 32768, 0],
1868 [15779, 23048, 27200, 32768, 0],
1869 [12638, 20061, 24532, 32768, 0],
1870 [10692, 17545, 22220, 32768, 0],
1871 [9217, 15251, 20054, 32768, 0],
1872 [5078, 9284, 12594, 32768, 0],
1873];
1874/// COEFF_BR_CHROMA_32, q-context 0: the same table as [`COEFF_BR_CHROMA_32`], for `base_q_idx` 0..=20.
1875pub const COEFF_BR_CHROMA_32_Q0: [[u16; 5]; 21] = [
1876 [5842, 9229, 10838, 32768, 0],
1877 [2313, 3491, 4276, 32768, 0],
1878 [2998, 6104, 7496, 32768, 0],
1879 [2420, 7447, 9868, 32768, 0],
1880 [3034, 8495, 10923, 32768, 0],
1881 [4076, 8937, 10975, 32768, 0],
1882 [1086, 2370, 3299, 32768, 0],
1883 [9714, 17254, 20444, 32768, 0],
1884 [8543, 13698, 17123, 32768, 0],
1885 [4918, 9007, 11910, 32768, 0],
1886 [4129, 7532, 10553, 32768, 0],
1887 [2364, 5533, 8058, 32768, 0],
1888 [1834, 3546, 5563, 32768, 0],
1889 [1473, 2908, 4133, 32768, 0],
1890 [15405, 21193, 25619, 32768, 0],
1891 [15691, 21952, 26561, 32768, 0],
1892 [12962, 19194, 24165, 32768, 0],
1893 [10272, 17855, 22129, 32768, 0],
1894 [8588, 15270, 20718, 32768, 0],
1895 [8682, 14669, 19500, 32768, 0],
1896 [4870, 9636, 13205, 32768, 0],
1897];
1898/// COEFF_BASE_EOB_LUMA_16, q-context 0: the same table as [`COEFF_BASE_EOB_LUMA_16`], for `base_q_idx` 0..=20.
1899pub const COEFF_BASE_EOB_LUMA_16_Q0: [[u16; 4]; 4] = [
1900 [1786, 12612, 32768, 0],
1901 [30663, 31625, 32768, 0],
1902 [32339, 32468, 32768, 0],
1903 [31148, 31833, 32768, 0],
1904];
1905/// COEFF_BASE_EOB_LUMA_32, q-context 0: the same table as [`COEFF_BASE_EOB_LUMA_32`], for `base_q_idx` 0..=20.
1906pub const COEFF_BASE_EOB_LUMA_32_Q0: [[u16; 4]; 4] = [
1907 [1787, 2532, 32768, 0],
1908 [30832, 31662, 32768, 0],
1909 [31824, 32682, 32768, 0],
1910 [32133, 32569, 32768, 0],
1911];
1912/// COEFF_BASE_EOB_LUMA_64, q-context 0: the same table as [`COEFF_BASE_EOB_LUMA_64`], for `base_q_idx` 0..=20.
1913pub const COEFF_BASE_EOB_LUMA_64_Q0: [[u16; 4]; 4] = [
1914 [1725, 3449, 32768, 0],
1915 [31102, 31935, 32768, 0],
1916 [32457, 32613, 32768, 0],
1917 [32412, 32649, 32768, 0],
1918];
1919/// COEFF_BASE_EOB_CHROMA_8, q-context 0: the same table as [`COEFF_BASE_EOB_CHROMA_8`], for `base_q_idx` 0..=20.
1920pub const COEFF_BASE_EOB_CHROMA_8_Q0: [[u16; 4]; 4] = [
1921 [12608, 27820, 32768, 0],
1922 [30680, 32225, 32768, 0],
1923 [30809, 32335, 32768, 0],
1924 [31299, 32423, 32768, 0],
1925];
1926/// COEFF_BASE_EOB_CHROMA_16, q-context 0: the same table as [`COEFF_BASE_EOB_CHROMA_16`], for `base_q_idx` 0..=20.
1927pub const COEFF_BASE_EOB_CHROMA_16_Q0: [[u16; 4]; 4] = [
1928 [18857, 23865, 32768, 0],
1929 [31428, 32428, 32768, 0],
1930 [31744, 32373, 32768, 0],
1931 [31775, 32526, 32768, 0],
1932];
1933/// COEFF_BASE_EOB_CHROMA_32, q-context 0: the same table as [`COEFF_BASE_EOB_CHROMA_32`], for `base_q_idx` 0..=20.
1934pub const COEFF_BASE_EOB_CHROMA_32_Q0: [[u16; 4]; 4] = [
1935 [13751, 22235, 32768, 0],
1936 [32089, 32409, 32768, 0],
1937 [27084, 27920, 32768, 0],
1938 [29291, 32594, 32768, 0],
1939];
1940
1941// q-context 1: base_q_idx 21..=60.
1942
1943/// TXB_SKIP_LUMA_64, q-context 1: the same table as [`TXB_SKIP_LUMA_64`], for `base_q_idx` 21..=60.
1944pub const TXB_SKIP_LUMA_64_Q1: [u16; 3] = [26584, 32768, 0];
1945/// TXB_SKIP_LUMA_32, q-context 1: the same table as [`TXB_SKIP_LUMA_32`], for `base_q_idx` 21..=60.
1946pub const TXB_SKIP_LUMA_32_Q1: [u16; 3] = [26726, 32768, 0];
1947/// TXB_SKIP_LUMA_16, q-context 1: the same table as [`TXB_SKIP_LUMA_16`], for `base_q_idx` 21..=60.
1948pub const TXB_SKIP_LUMA_16_Q1: [u16; 3] = [31901, 32768, 0];
1949/// TXB_SKIP_CHROMA_8, q-context 1: the same table as [`TXB_SKIP_CHROMA_8`], for `base_q_idx` 21..=60.
1950pub const TXB_SKIP_CHROMA_8_Q1: [[u16; 3]; 3] =
1951 [[4419, 32768, 0], [16294, 32768, 0], [28345, 32768, 0]];
1952/// TXB_SKIP_CHROMA_16, q-context 1: the same table as [`TXB_SKIP_CHROMA_16`], for `base_q_idx` 21..=60.
1953pub const TXB_SKIP_CHROMA_16_Q1: [[u16; 3]; 3] =
1954 [[4215, 32768, 0], [15756, 32768, 0], [28341, 32768, 0]];
1955/// TXB_SKIP_CHROMA_32, q-context 1: the same table as [`TXB_SKIP_CHROMA_32`], for `base_q_idx` 21..=60.
1956pub const TXB_SKIP_CHROMA_32_Q1: [[u16; 3]; 3] =
1957 [[5583, 32768, 0], [21313, 32768, 0], [29390, 32768, 0]];
1958/// EOB_EXTRA_LUMA_16, q-context 1: the same table as [`EOB_EXTRA_LUMA_16`], for `base_q_idx` 21..=60.
1959pub const EOB_EXTRA_LUMA_16_Q1: [[u16; 3]; 9] = [
1960 [22409, 32768, 0],
1961 [21012, 32768, 0],
1962 [15650, 32768, 0],
1963 [17395, 32768, 0],
1964 [15469, 32768, 0],
1965 [20205, 32768, 0],
1966 [19511, 32768, 0],
1967 [16384, 32768, 0],
1968 [16384, 32768, 0],
1969];
1970/// EOB_EXTRA_LUMA_32, q-context 1: the same table as [`EOB_EXTRA_LUMA_32`], for `base_q_idx` 21..=60.
1971pub const EOB_EXTRA_LUMA_32_Q1: [[u16; 3]; 9] = [
1972 [25991, 32768, 0],
1973 [20314, 32768, 0],
1974 [17731, 32768, 0],
1975 [19678, 32768, 0],
1976 [18649, 32768, 0],
1977 [17307, 32768, 0],
1978 [21798, 32768, 0],
1979 [17549, 32768, 0],
1980 [15630, 32768, 0],
1981];
1982/// EOB_EXTRA_LUMA_64, q-context 1: the same table as [`EOB_EXTRA_LUMA_64`], for `base_q_idx` 21..=60.
1983pub const EOB_EXTRA_LUMA_64_Q1: [[u16; 3]; 9] = [
1984 [26605, 32768, 0],
1985 [11304, 32768, 0],
1986 [16726, 32768, 0],
1987 [16560, 32768, 0],
1988 [20866, 32768, 0],
1989 [23524, 32768, 0],
1990 [19878, 32768, 0],
1991 [13469, 32768, 0],
1992 [23084, 32768, 0],
1993];
1994/// EOB_EXTRA_CHROMA_8, q-context 1: the same table as [`EOB_EXTRA_CHROMA_8`], for `base_q_idx` 21..=60.
1995pub const EOB_EXTRA_CHROMA_8_Q1: [[u16; 3]; 9] = [
1996 [22117, 32768, 0],
1997 [22028, 32768, 0],
1998 [18650, 32768, 0],
1999 [16042, 32768, 0],
2000 [15885, 32768, 0],
2001 [16384, 32768, 0],
2002 [16384, 32768, 0],
2003 [16384, 32768, 0],
2004 [16384, 32768, 0],
2005];
2006/// EOB_EXTRA_CHROMA_16, q-context 1: the same table as [`EOB_EXTRA_CHROMA_16`], for `base_q_idx` 21..=60.
2007pub const EOB_EXTRA_CHROMA_16_Q1: [[u16; 3]; 9] = [
2008 [24220, 32768, 0],
2009 [22480, 32768, 0],
2010 [17737, 32768, 0],
2011 [18916, 32768, 0],
2012 [19268, 32768, 0],
2013 [18412, 32768, 0],
2014 [18844, 32768, 0],
2015 [16384, 32768, 0],
2016 [16384, 32768, 0],
2017];
2018/// EOB_EXTRA_CHROMA_32, q-context 1: the same table as [`EOB_EXTRA_CHROMA_32`], for `base_q_idx` 21..=60.
2019pub const EOB_EXTRA_CHROMA_32_Q1: [[u16; 3]; 9] = [
2020 [26585, 32768, 0],
2021 [21469, 32768, 0],
2022 [20432, 32768, 0],
2023 [17735, 32768, 0],
2024 [19280, 32768, 0],
2025 [15235, 32768, 0],
2026 [20297, 32768, 0],
2027 [22471, 32768, 0],
2028 [28997, 32768, 0],
2029];
2030/// EOB_PT_1024_LUMA, q-context 1: the same table as [`EOB_PT_1024_LUMA`], for `base_q_idx` 21..=60.
2031pub const EOB_PT_1024_LUMA_Q1: [u16; 12] = [
2032 696, 948, 3145, 5702, 9706, 13217, 17851, 21856, 25692, 28034, 32768, 0,
2033];
2034/// EOB_PT_1024_CHROMA, q-context 1: the same table as [`EOB_PT_1024_CHROMA`], for `base_q_idx` 21..=60.
2035pub const EOB_PT_1024_CHROMA_Q1: [u16; 12] = [
2036 2672, 3591, 9330, 17084, 22725, 24284, 26527, 28027, 28377, 30876, 32768, 0,
2037];
2038/// EOB_PT_256_LUMA, q-context 1: the same table as [`EOB_PT_256_LUMA`], for `base_q_idx` 21..=60.
2039pub const EOB_PT_256_LUMA_Q1: [u16; 10] =
2040 [1448, 2109, 4151, 6263, 9329, 13260, 17944, 23300, 32768, 0];
2041/// EOB_PT_256_CHROMA, q-context 1: the same table as [`EOB_PT_256_CHROMA`], for `base_q_idx` 21..=60.
2042pub const EOB_PT_256_CHROMA_Q1: [u16; 10] = [
2043 6402, 8148, 12623, 15072, 18728, 22847, 26447, 29377, 32768, 0,
2044];
2045/// EOB_PT_64_CHROMA, q-context 1: the same table as [`EOB_PT_64_CHROMA`], for `base_q_idx` 21..=60.
2046pub const EOB_PT_64_CHROMA_Q1: [u16; 8] = [8609, 10612, 14624, 18714, 22614, 29024, 32768, 0];
2047/// COEFF_BASE_LUMA_16, q-context 1: the same table as [`COEFF_BASE_LUMA_16`], for `base_q_idx` 21..=60.
2048pub const COEFF_BASE_LUMA_16_Q1: [[u16; 5]; 42] = [
2049 [7555, 14942, 18501, 32768, 0],
2050 [24410, 31178, 32287, 32768, 0],
2051 [14394, 26738, 30253, 32768, 0],
2052 [8413, 19554, 25195, 32768, 0],
2053 [4766, 12924, 18785, 32768, 0],
2054 [2029, 5806, 9207, 32768, 0],
2055 [26776, 32364, 32663, 32768, 0],
2056 [18732, 29967, 31931, 32768, 0],
2057 [11005, 23786, 28852, 32768, 0],
2058 [6466, 16909, 23510, 32768, 0],
2059 [3044, 8638, 13419, 32768, 0],
2060 [29208, 32582, 32704, 32768, 0],
2061 [20068, 30857, 32208, 32768, 0],
2062 [12003, 25085, 29595, 32768, 0],
2063 [6947, 17750, 24189, 32768, 0],
2064 [3245, 9103, 14007, 32768, 0],
2065 [27359, 32465, 32669, 32768, 0],
2066 [19421, 30614, 32174, 32768, 0],
2067 [11915, 25010, 29579, 32768, 0],
2068 [6950, 17676, 24074, 32768, 0],
2069 [3007, 8473, 13096, 32768, 0],
2070 [29002, 32676, 32735, 32768, 0],
2071 [22102, 31849, 32576, 32768, 0],
2072 [14408, 28009, 31405, 32768, 0],
2073 [9027, 21679, 27931, 32768, 0],
2074 [4694, 12678, 18748, 32768, 0],
2075 [28216, 32528, 32682, 32768, 0],
2076 [20849, 31264, 32318, 32768, 0],
2077 [12756, 25815, 29751, 32768, 0],
2078 [7565, 18801, 24923, 32768, 0],
2079 [3509, 9533, 14477, 32768, 0],
2080 [30133, 32687, 32739, 32768, 0],
2081 [23063, 31910, 32515, 32768, 0],
2082 [14588, 28051, 31132, 32768, 0],
2083 [9085, 21649, 27457, 32768, 0],
2084 [4261, 11654, 17264, 32768, 0],
2085 [29518, 32691, 32748, 32768, 0],
2086 [22451, 31959, 32613, 32768, 0],
2087 [14864, 28722, 31700, 32768, 0],
2088 [9695, 22964, 28716, 32768, 0],
2089 [4932, 13358, 19502, 32768, 0],
2090 [8192, 16384, 24576, 32768, 0],
2091];
2092/// COEFF_BASE_LUMA_32, q-context 1: the same table as [`COEFF_BASE_LUMA_32`], for `base_q_idx` 21..=60.
2093pub const COEFF_BASE_LUMA_32_Q1: [[u16; 5]; 42] = [
2094 [3078, 6839, 9890, 32768, 0],
2095 [13837, 20450, 24479, 32768, 0],
2096 [5914, 14222, 19328, 32768, 0],
2097 [3866, 10267, 14762, 32768, 0],
2098 [2612, 7208, 11042, 32768, 0],
2099 [1067, 2991, 4776, 32768, 0],
2100 [25817, 31646, 32529, 32768, 0],
2101 [13708, 26338, 30385, 32768, 0],
2102 [7328, 18585, 24870, 32768, 0],
2103 [4691, 13080, 19276, 32768, 0],
2104 [1825, 5253, 8352, 32768, 0],
2105 [29386, 32315, 32624, 32768, 0],
2106 [17160, 29001, 31360, 32768, 0],
2107 [9602, 21862, 27396, 32768, 0],
2108 [5915, 15772, 22148, 32768, 0],
2109 [2786, 7779, 12047, 32768, 0],
2110 [29246, 32450, 32663, 32768, 0],
2111 [18696, 29929, 31818, 32768, 0],
2112 [10510, 23369, 28560, 32768, 0],
2113 [6229, 16499, 23125, 32768, 0],
2114 [2608, 7448, 11705, 32768, 0],
2115 [30753, 32710, 32748, 32768, 0],
2116 [21638, 31487, 32503, 32768, 0],
2117 [12937, 26854, 30870, 32768, 0],
2118 [8182, 20596, 26970, 32768, 0],
2119 [3637, 10269, 15497, 32768, 0],
2120 [8192, 16384, 24576, 32768, 0],
2121 [8192, 16384, 24576, 32768, 0],
2122 [8192, 16384, 24576, 32768, 0],
2123 [8192, 16384, 24576, 32768, 0],
2124 [8192, 16384, 24576, 32768, 0],
2125 [8192, 16384, 24576, 32768, 0],
2126 [8192, 16384, 24576, 32768, 0],
2127 [8192, 16384, 24576, 32768, 0],
2128 [8192, 16384, 24576, 32768, 0],
2129 [8192, 16384, 24576, 32768, 0],
2130 [8192, 16384, 24576, 32768, 0],
2131 [8192, 16384, 24576, 32768, 0],
2132 [8192, 16384, 24576, 32768, 0],
2133 [8192, 16384, 24576, 32768, 0],
2134 [8192, 16384, 24576, 32768, 0],
2135 [8192, 16384, 24576, 32768, 0],
2136];
2137/// COEFF_BASE_LUMA_64, q-context 1: the same table as [`COEFF_BASE_LUMA_64`], for `base_q_idx` 21..=60.
2138pub const COEFF_BASE_LUMA_64_Q1: [[u16; 5]; 42] = [
2139 [1035, 2807, 4156, 32768, 0],
2140 [13162, 18138, 20939, 32768, 0],
2141 [2696, 6633, 8755, 32768, 0],
2142 [1373, 4161, 6853, 32768, 0],
2143 [1099, 2746, 4716, 32768, 0],
2144 [340, 1021, 1599, 32768, 0],
2145 [22826, 30419, 32135, 32768, 0],
2146 [10395, 21762, 26942, 32768, 0],
2147 [4726, 12407, 17361, 32768, 0],
2148 [2447, 7080, 10593, 32768, 0],
2149 [1227, 3717, 6011, 32768, 0],
2150 [28156, 31424, 31934, 32768, 0],
2151 [16915, 27754, 30373, 32768, 0],
2152 [9148, 20990, 26431, 32768, 0],
2153 [5950, 15515, 21148, 32768, 0],
2154 [2492, 7327, 11526, 32768, 0],
2155 [30602, 32477, 32670, 32768, 0],
2156 [20026, 29955, 31568, 32768, 0],
2157 [11220, 23628, 28105, 32768, 0],
2158 [6652, 17019, 22973, 32768, 0],
2159 [3064, 8536, 13043, 32768, 0],
2160 [31769, 32724, 32748, 32768, 0],
2161 [22230, 30887, 32373, 32768, 0],
2162 [12234, 25079, 29731, 32768, 0],
2163 [7326, 18816, 25353, 32768, 0],
2164 [3933, 10907, 16616, 32768, 0],
2165 [8192, 16384, 24576, 32768, 0],
2166 [8192, 16384, 24576, 32768, 0],
2167 [8192, 16384, 24576, 32768, 0],
2168 [8192, 16384, 24576, 32768, 0],
2169 [8192, 16384, 24576, 32768, 0],
2170 [8192, 16384, 24576, 32768, 0],
2171 [8192, 16384, 24576, 32768, 0],
2172 [8192, 16384, 24576, 32768, 0],
2173 [8192, 16384, 24576, 32768, 0],
2174 [8192, 16384, 24576, 32768, 0],
2175 [8192, 16384, 24576, 32768, 0],
2176 [8192, 16384, 24576, 32768, 0],
2177 [8192, 16384, 24576, 32768, 0],
2178 [8192, 16384, 24576, 32768, 0],
2179 [8192, 16384, 24576, 32768, 0],
2180 [8192, 16384, 24576, 32768, 0],
2181];
2182/// COEFF_BASE_CHROMA_8, q-context 1: the same table as [`COEFF_BASE_CHROMA_8`], for `base_q_idx` 21..=60.
2183pub const COEFF_BASE_CHROMA_8_Q1: [[u16; 5]; 42] = [
2184 [8639, 19339, 24429, 32768, 0],
2185 [24404, 31837, 32525, 32768, 0],
2186 [16997, 29425, 31784, 32768, 0],
2187 [11253, 24234, 29149, 32768, 0],
2188 [6751, 17394, 24028, 32768, 0],
2189 [3490, 9830, 15191, 32768, 0],
2190 [26283, 32471, 32714, 32768, 0],
2191 [19599, 31168, 32442, 32768, 0],
2192 [13146, 26954, 30893, 32768, 0],
2193 [8214, 20588, 26890, 32768, 0],
2194 [4699, 13081, 19300, 32768, 0],
2195 [28212, 32458, 32669, 32768, 0],
2196 [18594, 30316, 32100, 32768, 0],
2197 [11219, 24408, 29234, 32768, 0],
2198 [6865, 17656, 24149, 32768, 0],
2199 [3678, 10362, 16006, 32768, 0],
2200 [25825, 32136, 32616, 32768, 0],
2201 [17313, 29853, 32021, 32768, 0],
2202 [11197, 24471, 29472, 32768, 0],
2203 [6947, 17781, 24405, 32768, 0],
2204 [3768, 10660, 16261, 32768, 0],
2205 [27352, 32500, 32706, 32768, 0],
2206 [20850, 31468, 32469, 32768, 0],
2207 [14021, 27707, 31133, 32768, 0],
2208 [8964, 21748, 27838, 32768, 0],
2209 [5437, 14665, 21187, 32768, 0],
2210 [26304, 32492, 32698, 32768, 0],
2211 [20409, 31380, 32385, 32768, 0],
2212 [13682, 27222, 30632, 32768, 0],
2213 [8974, 21236, 26685, 32768, 0],
2214 [4234, 11665, 16934, 32768, 0],
2215 [26273, 32357, 32711, 32768, 0],
2216 [20672, 31242, 32441, 32768, 0],
2217 [14172, 27254, 30902, 32768, 0],
2218 [9870, 21898, 27275, 32768, 0],
2219 [5164, 13506, 19270, 32768, 0],
2220 [26725, 32459, 32728, 32768, 0],
2221 [20991, 31442, 32527, 32768, 0],
2222 [13071, 26434, 30811, 32768, 0],
2223 [8184, 20090, 26742, 32768, 0],
2224 [4803, 13255, 19895, 32768, 0],
2225 [8192, 16384, 24576, 32768, 0],
2226];
2227/// COEFF_BASE_CHROMA_16, q-context 1: the same table as [`COEFF_BASE_CHROMA_16`], for `base_q_idx` 21..=60.
2228pub const COEFF_BASE_CHROMA_16_Q1: [[u16; 5]; 42] = [
2229 [6465, 16958, 21688, 32768, 0],
2230 [25199, 31514, 32360, 32768, 0],
2231 [14774, 27149, 30607, 32768, 0],
2232 [9257, 21438, 26972, 32768, 0],
2233 [5723, 15183, 21882, 32768, 0],
2234 [3150, 8879, 13731, 32768, 0],
2235 [26989, 32262, 32682, 32768, 0],
2236 [17396, 29937, 32085, 32768, 0],
2237 [11387, 24901, 29784, 32768, 0],
2238 [7289, 18821, 25548, 32768, 0],
2239 [3734, 10577, 16086, 32768, 0],
2240 [29728, 32501, 32695, 32768, 0],
2241 [17431, 29701, 31903, 32768, 0],
2242 [9921, 22826, 28300, 32768, 0],
2243 [5896, 15434, 22068, 32768, 0],
2244 [3430, 9646, 14757, 32768, 0],
2245 [28614, 32511, 32705, 32768, 0],
2246 [19364, 30638, 32263, 32768, 0],
2247 [13129, 26254, 30402, 32768, 0],
2248 [8754, 20484, 26440, 32768, 0],
2249 [4378, 11607, 17110, 32768, 0],
2250 [30292, 32671, 32744, 32768, 0],
2251 [21780, 31603, 32501, 32768, 0],
2252 [14314, 27829, 31291, 32768, 0],
2253 [9611, 22327, 28263, 32768, 0],
2254 [4890, 13087, 19065, 32768, 0],
2255 [25862, 32567, 32733, 32768, 0],
2256 [20794, 32050, 32567, 32768, 0],
2257 [17243, 30625, 32254, 32768, 0],
2258 [13283, 27628, 31474, 32768, 0],
2259 [9669, 22532, 28918, 32768, 0],
2260 [27435, 32697, 32748, 32768, 0],
2261 [24922, 32390, 32714, 32768, 0],
2262 [21449, 31504, 32536, 32768, 0],
2263 [16392, 29729, 31832, 32768, 0],
2264 [11692, 24884, 29076, 32768, 0],
2265 [24193, 32290, 32735, 32768, 0],
2266 [18909, 31104, 32563, 32768, 0],
2267 [12236, 26841, 31403, 32768, 0],
2268 [8171, 21840, 29082, 32768, 0],
2269 [7224, 17280, 25275, 32768, 0],
2270 [8192, 16384, 24576, 32768, 0],
2271];
2272/// COEFF_BASE_CHROMA_32, q-context 1: the same table as [`COEFF_BASE_CHROMA_32`], for `base_q_idx` 21..=60.
2273pub const COEFF_BASE_CHROMA_32_Q1: [[u16; 5]; 42] = [
2274 [5244, 12150, 16906, 32768, 0],
2275 [20486, 26858, 29701, 32768, 0],
2276 [7756, 18317, 23735, 32768, 0],
2277 [3452, 9256, 13146, 32768, 0],
2278 [2020, 5206, 8229, 32768, 0],
2279 [1801, 4993, 7903, 32768, 0],
2280 [27051, 31858, 32531, 32768, 0],
2281 [15988, 27531, 30619, 32768, 0],
2282 [9188, 21484, 26719, 32768, 0],
2283 [6273, 17186, 23800, 32768, 0],
2284 [3108, 9355, 14764, 32768, 0],
2285 [31076, 32520, 32680, 32768, 0],
2286 [18119, 30037, 31850, 32768, 0],
2287 [10244, 22969, 27472, 32768, 0],
2288 [4692, 14077, 19273, 32768, 0],
2289 [3694, 11677, 17556, 32768, 0],
2290 [30060, 32581, 32720, 32768, 0],
2291 [21011, 30775, 32120, 32768, 0],
2292 [11931, 24820, 29289, 32768, 0],
2293 [7119, 17662, 24356, 32768, 0],
2294 [3833, 10706, 16304, 32768, 0],
2295 [31954, 32731, 32748, 32768, 0],
2296 [23913, 31724, 32489, 32768, 0],
2297 [15520, 28060, 31286, 32768, 0],
2298 [11517, 23008, 28571, 32768, 0],
2299 [6193, 14508, 20629, 32768, 0],
2300 [8192, 16384, 24576, 32768, 0],
2301 [8192, 16384, 24576, 32768, 0],
2302 [8192, 16384, 24576, 32768, 0],
2303 [8192, 16384, 24576, 32768, 0],
2304 [8192, 16384, 24576, 32768, 0],
2305 [8192, 16384, 24576, 32768, 0],
2306 [8192, 16384, 24576, 32768, 0],
2307 [8192, 16384, 24576, 32768, 0],
2308 [8192, 16384, 24576, 32768, 0],
2309 [8192, 16384, 24576, 32768, 0],
2310 [8192, 16384, 24576, 32768, 0],
2311 [8192, 16384, 24576, 32768, 0],
2312 [8192, 16384, 24576, 32768, 0],
2313 [8192, 16384, 24576, 32768, 0],
2314 [8192, 16384, 24576, 32768, 0],
2315 [8192, 16384, 24576, 32768, 0],
2316];
2317/// COEFF_BR_LUMA_16, q-context 1: the same table as [`COEFF_BR_LUMA_16`], for `base_q_idx` 21..=60.
2318pub const COEFF_BR_LUMA_16_Q1: [[u16; 5]; 21] = [
2319 [13549, 19724, 23158, 32768, 0],
2320 [11844, 18382, 22246, 32768, 0],
2321 [7919, 13619, 17773, 32768, 0],
2322 [5486, 10143, 13946, 32768, 0],
2323 [4166, 7983, 11324, 32768, 0],
2324 [3364, 6506, 9427, 32768, 0],
2325 [1598, 3160, 4674, 32768, 0],
2326 [15281, 20979, 23781, 32768, 0],
2327 [14939, 22119, 25952, 32768, 0],
2328 [11363, 18407, 22812, 32768, 0],
2329 [8609, 14857, 19370, 32768, 0],
2330 [6737, 12184, 16480, 32768, 0],
2331 [5506, 10263, 14262, 32768, 0],
2332 [2990, 5786, 8380, 32768, 0],
2333 [20249, 25253, 27417, 32768, 0],
2334 [21070, 27518, 30001, 32768, 0],
2335 [16854, 24469, 28074, 32768, 0],
2336 [12864, 20486, 25000, 32768, 0],
2337 [9962, 16978, 21778, 32768, 0],
2338 [8074, 14338, 19048, 32768, 0],
2339 [4494, 8479, 11906, 32768, 0],
2340];
2341/// COEFF_BR_LUMA_32, q-context 1: the same table as [`COEFF_BR_LUMA_32`], for `base_q_idx` 21..=60.
2342pub const COEFF_BR_LUMA_32_Q1: [[u16; 5]; 21] = [
2343 [5705, 10930, 15725, 32768, 0],
2344 [7946, 12765, 16115, 32768, 0],
2345 [6801, 12123, 16226, 32768, 0],
2346 [5462, 10135, 14200, 32768, 0],
2347 [4189, 8011, 11507, 32768, 0],
2348 [3191, 6229, 9408, 32768, 0],
2349 [1057, 2137, 3212, 32768, 0],
2350 [10018, 17067, 21491, 32768, 0],
2351 [7380, 12582, 16453, 32768, 0],
2352 [6068, 10845, 14339, 32768, 0],
2353 [5098, 9198, 12555, 32768, 0],
2354 [4312, 8010, 11119, 32768, 0],
2355 [3700, 6966, 9781, 32768, 0],
2356 [1693, 3326, 4887, 32768, 0],
2357 [18757, 24930, 27774, 32768, 0],
2358 [17648, 24596, 27817, 32768, 0],
2359 [14707, 22052, 26026, 32768, 0],
2360 [11720, 18852, 23292, 32768, 0],
2361 [9357, 15952, 20525, 32768, 0],
2362 [7810, 13753, 18210, 32768, 0],
2363 [3879, 7333, 10328, 32768, 0],
2364];
2365/// COEFF_BR_CHROMA_8, q-context 1: the same table as [`COEFF_BR_CHROMA_8`], for `base_q_idx` 21..=60.
2366pub const COEFF_BR_CHROMA_8_Q1: [[u16; 5]; 21] = [
2367 [14899, 21217, 24503, 32768, 0],
2368 [13519, 20283, 24047, 32768, 0],
2369 [9429, 15966, 20365, 32768, 0],
2370 [6700, 12355, 16652, 32768, 0],
2371 [5088, 9704, 13716, 32768, 0],
2372 [4243, 8154, 11731, 32768, 0],
2373 [2702, 5364, 7861, 32768, 0],
2374 [22745, 28388, 30454, 32768, 0],
2375 [20235, 27146, 29922, 32768, 0],
2376 [15896, 23715, 27637, 32768, 0],
2377 [11840, 19350, 24131, 32768, 0],
2378 [9122, 15932, 20880, 32768, 0],
2379 [7488, 13581, 18362, 32768, 0],
2380 [5114, 9568, 13370, 32768, 0],
2381 [20845, 26553, 28932, 32768, 0],
2382 [20981, 27372, 29884, 32768, 0],
2383 [17781, 25335, 28785, 32768, 0],
2384 [13760, 21708, 26297, 32768, 0],
2385 [10975, 18415, 23365, 32768, 0],
2386 [9045, 15789, 20686, 32768, 0],
2387 [6130, 11199, 15423, 32768, 0],
2388];
2389/// COEFF_BR_CHROMA_16, q-context 1: the same table as [`COEFF_BR_CHROMA_16`], for `base_q_idx` 21..=60.
2390pub const COEFF_BR_CHROMA_16_Q1: [[u16; 5]; 21] = [
2391 [13960, 19617, 22829, 32768, 0],
2392 [11150, 17341, 21228, 32768, 0],
2393 [7150, 12964, 17190, 32768, 0],
2394 [5331, 10002, 13867, 32768, 0],
2395 [4167, 7744, 11057, 32768, 0],
2396 [3480, 6629, 9646, 32768, 0],
2397 [1883, 3784, 5686, 32768, 0],
2398 [18752, 25660, 28912, 32768, 0],
2399 [16968, 24586, 28030, 32768, 0],
2400 [13520, 21055, 25313, 32768, 0],
2401 [10453, 17626, 22280, 32768, 0],
2402 [8386, 14505, 19116, 32768, 0],
2403 [6742, 12595, 17008, 32768, 0],
2404 [4273, 8140, 11499, 32768, 0],
2405 [22120, 27827, 30233, 32768, 0],
2406 [20563, 27358, 29895, 32768, 0],
2407 [17076, 24644, 28153, 32768, 0],
2408 [13362, 20942, 25309, 32768, 0],
2409 [10794, 17965, 22695, 32768, 0],
2410 [9014, 15652, 20319, 32768, 0],
2411 [5708, 10512, 14497, 32768, 0],
2412];
2413/// COEFF_BR_CHROMA_32, q-context 1: the same table as [`COEFF_BR_CHROMA_32`], for `base_q_idx` 21..=60.
2414pub const COEFF_BR_CHROMA_32_Q1: [[u16; 5]; 21] = [
2415 [8278, 13242, 15922, 32768, 0],
2416 [10547, 15867, 18919, 32768, 0],
2417 [9106, 15842, 20609, 32768, 0],
2418 [6833, 13007, 17218, 32768, 0],
2419 [4811, 9712, 13923, 32768, 0],
2420 [3985, 7352, 11128, 32768, 0],
2421 [1688, 3458, 5262, 32768, 0],
2422 [12951, 21861, 26510, 32768, 0],
2423 [9788, 16044, 20276, 32768, 0],
2424 [6309, 11244, 14870, 32768, 0],
2425 [5183, 9349, 12566, 32768, 0],
2426 [4389, 8229, 11492, 32768, 0],
2427 [3633, 6945, 10620, 32768, 0],
2428 [3600, 6847, 9907, 32768, 0],
2429 [21748, 28137, 30255, 32768, 0],
2430 [19436, 26581, 29560, 32768, 0],
2431 [16359, 24201, 27953, 32768, 0],
2432 [13961, 21693, 25871, 32768, 0],
2433 [11544, 18686, 23322, 32768, 0],
2434 [9372, 16462, 20952, 32768, 0],
2435 [6138, 11210, 15390, 32768, 0],
2436];
2437/// COEFF_BASE_EOB_LUMA_16, q-context 1: the same table as [`COEFF_BASE_EOB_LUMA_16`], for `base_q_idx` 21..=60.
2438pub const COEFF_BASE_EOB_LUMA_16_Q1: [[u16; 4]; 4] = [
2439 [2644, 25198, 32768, 0],
2440 [32038, 32451, 32768, 0],
2441 [32639, 32695, 32768, 0],
2442 [32166, 32518, 32768, 0],
2443];
2444/// COEFF_BASE_EOB_LUMA_32, q-context 1: the same table as [`COEFF_BASE_EOB_LUMA_32`], for `base_q_idx` 21..=60.
2445pub const COEFF_BASE_EOB_LUMA_32_Q1: [[u16; 4]; 4] = [
2446 [1044, 2257, 32768, 0],
2447 [30755, 31923, 32768, 0],
2448 [32208, 32693, 32768, 0],
2449 [32244, 32615, 32768, 0],
2450];
2451/// COEFF_BASE_EOB_LUMA_64, q-context 1: the same table as [`COEFF_BASE_EOB_LUMA_64`], for `base_q_idx` 21..=60.
2452pub const COEFF_BASE_EOB_LUMA_64_Q1: [[u16; 4]; 4] = [
2453 [478, 1834, 32768, 0],
2454 [31005, 31987, 32768, 0],
2455 [32317, 32724, 32768, 0],
2456 [30865, 32648, 32768, 0],
2457];
2458/// COEFF_BASE_EOB_CHROMA_8, q-context 1: the same table as [`COEFF_BASE_EOB_CHROMA_8`], for `base_q_idx` 21..=60.
2459pub const COEFF_BASE_EOB_CHROMA_8_Q1: [[u16; 4]; 4] = [
2460 [26279, 30968, 32768, 0],
2461 [31142, 32495, 32768, 0],
2462 [31713, 32540, 32768, 0],
2463 [31929, 32594, 32768, 0],
2464];
2465/// COEFF_BASE_EOB_CHROMA_16, q-context 1: the same table as [`COEFF_BASE_EOB_CHROMA_16`], for `base_q_idx` 21..=60.
2466pub const COEFF_BASE_EOB_CHROMA_16_Q1: [[u16; 4]; 4] = [
2467 [17187, 27668, 32768, 0],
2468 [31714, 32550, 32768, 0],
2469 [32283, 32678, 32768, 0],
2470 [31930, 32563, 32768, 0],
2471];
2472/// COEFF_BASE_EOB_CHROMA_32, q-context 1: the same table as [`COEFF_BASE_EOB_CHROMA_32`], for `base_q_idx` 21..=60.
2473pub const COEFF_BASE_EOB_CHROMA_32_Q1: [[u16; 4]; 4] = [
2474 [21317, 26207, 32768, 0],
2475 [29133, 30868, 32768, 0],
2476 [29311, 31231, 32768, 0],
2477 [29657, 31087, 32768, 0],
2478];
2479
2480// q-context 3: base_q_idx 121..=255.
2481
2482/// TXB_SKIP_LUMA_64, q-context 3: the same table as [`TXB_SKIP_LUMA_64`], for `base_q_idx` 121..=255.
2483pub const TXB_SKIP_LUMA_64_Q3: [u16; 3] = [31539, 32768, 0];
2484/// TXB_SKIP_LUMA_32, q-context 3: the same table as [`TXB_SKIP_LUMA_32`], for `base_q_idx` 121..=255.
2485pub const TXB_SKIP_LUMA_32_Q3: [u16; 3] = [31671, 32768, 0];
2486/// TXB_SKIP_LUMA_16, q-context 3: the same table as [`TXB_SKIP_LUMA_16`], for `base_q_idx` 121..=255.
2487pub const TXB_SKIP_LUMA_16_Q3: [u16; 3] = [32510, 32768, 0];
2488/// TXB_SKIP_CHROMA_8, q-context 3: the same table as [`TXB_SKIP_CHROMA_8`], for `base_q_idx` 121..=255.
2489pub const TXB_SKIP_CHROMA_8_Q3: [[u16; 3]; 3] =
2490 [[2786, 32768, 0], [11194, 32768, 0], [20155, 32768, 0]];
2491/// TXB_SKIP_CHROMA_16, q-context 3: the same table as [`TXB_SKIP_CHROMA_16`], for `base_q_idx` 121..=255.
2492pub const TXB_SKIP_CHROMA_16_Q3: [[u16; 3]; 3] =
2493 [[3440, 32768, 0], [13117, 32768, 0], [22702, 32768, 0]];
2494/// TXB_SKIP_CHROMA_32, q-context 3: the same table as [`TXB_SKIP_CHROMA_32`], for `base_q_idx` 121..=255.
2495pub const TXB_SKIP_CHROMA_32_Q3: [[u16; 3]; 3] =
2496 [[4656, 32768, 0], [16074, 32768, 0], [24704, 32768, 0]];
2497/// EOB_EXTRA_LUMA_16, q-context 3: the same table as [`EOB_EXTRA_LUMA_16`], for `base_q_idx` 121..=255.
2498pub const EOB_EXTRA_LUMA_16_Q3: [[u16; 3]; 9] = [
2499 [19941, 32768, 0],
2500 [20527, 32768, 0],
2501 [21470, 32768, 0],
2502 [22487, 32768, 0],
2503 [19558, 32768, 0],
2504 [22354, 32768, 0],
2505 [20331, 32768, 0],
2506 [16384, 32768, 0],
2507 [16384, 32768, 0],
2508];
2509/// EOB_EXTRA_LUMA_32, q-context 3: the same table as [`EOB_EXTRA_LUMA_32`], for `base_q_idx` 121..=255.
2510pub const EOB_EXTRA_LUMA_32_Q3: [[u16; 3]; 9] = [
2511 [21442, 32768, 0],
2512 [22358, 32768, 0],
2513 [18503, 32768, 0],
2514 [20291, 32768, 0],
2515 [19945, 32768, 0],
2516 [21294, 32768, 0],
2517 [21178, 32768, 0],
2518 [19400, 32768, 0],
2519 [10556, 32768, 0],
2520];
2521/// EOB_EXTRA_LUMA_64, q-context 3: the same table as [`EOB_EXTRA_LUMA_64`], for `base_q_idx` 121..=255.
2522pub const EOB_EXTRA_LUMA_64_Q3: [[u16; 3]; 9] = [
2523 [26064, 32768, 0],
2524 [22098, 32768, 0],
2525 [19613, 32768, 0],
2526 [20525, 32768, 0],
2527 [17595, 32768, 0],
2528 [16618, 32768, 0],
2529 [20497, 32768, 0],
2530 [18989, 32768, 0],
2531 [15513, 32768, 0],
2532];
2533/// EOB_EXTRA_CHROMA_8, q-context 3: the same table as [`EOB_EXTRA_CHROMA_8`], for `base_q_idx` 121..=255.
2534pub const EOB_EXTRA_CHROMA_8_Q3: [[u16; 3]; 9] = [
2535 [20125, 32768, 0],
2536 [20559, 32768, 0],
2537 [21707, 32768, 0],
2538 [22296, 32768, 0],
2539 [17333, 32768, 0],
2540 [16384, 32768, 0],
2541 [16384, 32768, 0],
2542 [16384, 32768, 0],
2543 [16384, 32768, 0],
2544];
2545/// EOB_EXTRA_CHROMA_16, q-context 3: the same table as [`EOB_EXTRA_CHROMA_16`], for `base_q_idx` 121..=255.
2546pub const EOB_EXTRA_CHROMA_16_Q3: [[u16; 3]; 9] = [
2547 [22752, 32768, 0],
2548 [25006, 32768, 0],
2549 [22075, 32768, 0],
2550 [21576, 32768, 0],
2551 [17740, 32768, 0],
2552 [21690, 32768, 0],
2553 [19211, 32768, 0],
2554 [16384, 32768, 0],
2555 [16384, 32768, 0],
2556];
2557/// EOB_EXTRA_CHROMA_32, q-context 3: the same table as [`EOB_EXTRA_CHROMA_32`], for `base_q_idx` 121..=255.
2558pub const EOB_EXTRA_CHROMA_32_Q3: [[u16; 3]; 9] = [
2559 [24648, 32768, 0],
2560 [24949, 32768, 0],
2561 [20708, 32768, 0],
2562 [23905, 32768, 0],
2563 [20501, 32768, 0],
2564 [9558, 32768, 0],
2565 [9423, 32768, 0],
2566 [30365, 32768, 0],
2567 [19253, 32768, 0],
2568];
2569/// EOB_PT_1024_LUMA, q-context 3: the same table as [`EOB_PT_1024_LUMA`], for `base_q_idx` 121..=255.
2570pub const EOB_PT_1024_LUMA_Q3: [u16; 12] = [
2571 6698, 8334, 11961, 15762, 20186, 23862, 27434, 29326, 31082, 32050, 32768, 0,
2572];
2573/// EOB_PT_1024_CHROMA, q-context 3: the same table as [`EOB_PT_1024_CHROMA`], for `base_q_idx` 121..=255.
2574pub const EOB_PT_1024_CHROMA_Q3: [u16; 12] = [
2575 20569, 22426, 25569, 26859, 28053, 28913, 29486, 29724, 29807, 32570, 32768, 0,
2576];
2577/// EOB_PT_256_LUMA, q-context 3: the same table as [`EOB_PT_256_LUMA`], for `base_q_idx` 121..=255.
2578pub const EOB_PT_256_LUMA_Q3: [u16; 10] = [
2579 5348, 7113, 11820, 15924, 22106, 26777, 30334, 31757, 32768, 0,
2580];
2581/// EOB_PT_256_CHROMA, q-context 3: the same table as [`EOB_PT_256_CHROMA`], for `base_q_idx` 121..=255.
2582pub const EOB_PT_256_CHROMA_Q3: [u16; 10] = [
2583 23110, 24597, 27140, 28894, 30167, 30927, 31392, 32094, 32768, 0,
2584];
2585/// EOB_PT_64_CHROMA, q-context 3: the same table as [`EOB_PT_64_CHROMA`], for `base_q_idx` 121..=255.
2586pub const EOB_PT_64_CHROMA_Q3: [u16; 8] = [24212, 25708, 28268, 30035, 31307, 32049, 32768, 0];
2587/// COEFF_BASE_LUMA_16, q-context 3: the same table as [`COEFF_BASE_LUMA_16`], for `base_q_idx` 121..=255.
2588pub const COEFF_BASE_LUMA_16_Q3: [[u16; 5]; 42] = [
2589 [7876, 16901, 21741, 32768, 0],
2590 [24001, 31898, 32625, 32768, 0],
2591 [14529, 27959, 31451, 32768, 0],
2592 [8273, 20818, 27258, 32768, 0],
2593 [5278, 14673, 21510, 32768, 0],
2594 [2983, 8843, 14039, 32768, 0],
2595 [28016, 32574, 32732, 32768, 0],
2596 [17471, 30306, 32301, 32768, 0],
2597 [10224, 24063, 29728, 32768, 0],
2598 [6602, 17954, 25052, 32768, 0],
2599 [4002, 11585, 17759, 32768, 0],
2600 [30190, 32634, 32739, 32768, 0],
2601 [17497, 30282, 32270, 32768, 0],
2602 [10229, 23729, 29538, 32768, 0],
2603 [6344, 17211, 24440, 32768, 0],
2604 [3849, 11189, 17108, 32768, 0],
2605 [28570, 32583, 32726, 32768, 0],
2606 [17521, 30161, 32238, 32768, 0],
2607 [10153, 23565, 29378, 32768, 0],
2608 [6455, 17341, 24443, 32768, 0],
2609 [3907, 11042, 17024, 32768, 0],
2610 [30689, 32715, 32748, 32768, 0],
2611 [21546, 31840, 32610, 32768, 0],
2612 [13547, 27581, 31459, 32768, 0],
2613 [8912, 21757, 28309, 32768, 0],
2614 [5548, 15080, 22046, 32768, 0],
2615 [30783, 32540, 32685, 32768, 0],
2616 [17540, 29528, 31668, 32768, 0],
2617 [10160, 21468, 26783, 32768, 0],
2618 [4724, 13393, 20054, 32768, 0],
2619 [2702, 8174, 13102, 32768, 0],
2620 [31648, 32686, 32742, 32768, 0],
2621 [20954, 31094, 32337, 32768, 0],
2622 [12420, 25698, 30179, 32768, 0],
2623 [7304, 19320, 26248, 32768, 0],
2624 [4366, 12261, 18864, 32768, 0],
2625 [31581, 32723, 32748, 32768, 0],
2626 [21373, 31586, 32525, 32768, 0],
2627 [12744, 26625, 30885, 32768, 0],
2628 [7431, 20322, 26950, 32768, 0],
2629 [4692, 13323, 20111, 32768, 0],
2630 [8192, 16384, 24576, 32768, 0],
2631];
2632/// COEFF_BASE_LUMA_32, q-context 3: the same table as [`COEFF_BASE_LUMA_32`], for `base_q_idx` 121..=255.
2633pub const COEFF_BASE_LUMA_32_Q3: [[u16; 5]; 42] = [
2634 [5992, 14304, 19765, 32768, 0],
2635 [22612, 31238, 32456, 32768, 0],
2636 [13456, 27162, 31087, 32768, 0],
2637 [8001, 20062, 26504, 32768, 0],
2638 [5168, 14105, 20764, 32768, 0],
2639 [2632, 7771, 12385, 32768, 0],
2640 [27034, 32344, 32709, 32768, 0],
2641 [15850, 29415, 31997, 32768, 0],
2642 [9494, 22776, 28841, 32768, 0],
2643 [6151, 16830, 23969, 32768, 0],
2644 [3461, 10039, 15722, 32768, 0],
2645 [30134, 32569, 32731, 32768, 0],
2646 [15638, 29422, 31945, 32768, 0],
2647 [9150, 21865, 28218, 32768, 0],
2648 [5647, 15719, 22676, 32768, 0],
2649 [3402, 9772, 15477, 32768, 0],
2650 [28530, 32586, 32735, 32768, 0],
2651 [17139, 30298, 32292, 32768, 0],
2652 [10200, 24039, 29685, 32768, 0],
2653 [6419, 17674, 24786, 32768, 0],
2654 [3544, 10225, 15824, 32768, 0],
2655 [31333, 32726, 32748, 32768, 0],
2656 [20618, 31487, 32544, 32768, 0],
2657 [12901, 27217, 31232, 32768, 0],
2658 [8624, 21734, 28171, 32768, 0],
2659 [5104, 14191, 20748, 32768, 0],
2660 [8192, 16384, 24576, 32768, 0],
2661 [8192, 16384, 24576, 32768, 0],
2662 [8192, 16384, 24576, 32768, 0],
2663 [8192, 16384, 24576, 32768, 0],
2664 [8192, 16384, 24576, 32768, 0],
2665 [8192, 16384, 24576, 32768, 0],
2666 [8192, 16384, 24576, 32768, 0],
2667 [8192, 16384, 24576, 32768, 0],
2668 [8192, 16384, 24576, 32768, 0],
2669 [8192, 16384, 24576, 32768, 0],
2670 [8192, 16384, 24576, 32768, 0],
2671 [8192, 16384, 24576, 32768, 0],
2672 [8192, 16384, 24576, 32768, 0],
2673 [8192, 16384, 24576, 32768, 0],
2674 [8192, 16384, 24576, 32768, 0],
2675 [8192, 16384, 24576, 32768, 0],
2676];
2677/// COEFF_BASE_LUMA_64, q-context 3: the same table as [`COEFF_BASE_LUMA_64`], for `base_q_idx` 121..=255.
2678pub const COEFF_BASE_LUMA_64_Q3: [[u16; 5]; 42] = [
2679 [4137, 10847, 15682, 32768, 0],
2680 [17824, 27001, 30058, 32768, 0],
2681 [10204, 22796, 28291, 32768, 0],
2682 [6076, 15935, 22125, 32768, 0],
2683 [3852, 10937, 16816, 32768, 0],
2684 [2252, 6324, 10131, 32768, 0],
2685 [25840, 32016, 32662, 32768, 0],
2686 [15109, 28268, 31531, 32768, 0],
2687 [9385, 22231, 28340, 32768, 0],
2688 [6082, 16672, 23479, 32768, 0],
2689 [3318, 9427, 14681, 32768, 0],
2690 [30594, 32574, 32718, 32768, 0],
2691 [16836, 29552, 31859, 32768, 0],
2692 [9556, 22542, 28356, 32768, 0],
2693 [6305, 16725, 23540, 32768, 0],
2694 [3376, 9895, 15184, 32768, 0],
2695 [29383, 32617, 32745, 32768, 0],
2696 [18891, 30809, 32401, 32768, 0],
2697 [11688, 25942, 30687, 32768, 0],
2698 [7468, 19469, 26651, 32768, 0],
2699 [3909, 11358, 17012, 32768, 0],
2700 [31564, 32736, 32748, 32768, 0],
2701 [20906, 31611, 32600, 32768, 0],
2702 [13191, 27621, 31537, 32768, 0],
2703 [8768, 22029, 28676, 32768, 0],
2704 [5079, 14109, 20906, 32768, 0],
2705 [8192, 16384, 24576, 32768, 0],
2706 [8192, 16384, 24576, 32768, 0],
2707 [8192, 16384, 24576, 32768, 0],
2708 [8192, 16384, 24576, 32768, 0],
2709 [8192, 16384, 24576, 32768, 0],
2710 [8192, 16384, 24576, 32768, 0],
2711 [8192, 16384, 24576, 32768, 0],
2712 [8192, 16384, 24576, 32768, 0],
2713 [8192, 16384, 24576, 32768, 0],
2714 [8192, 16384, 24576, 32768, 0],
2715 [8192, 16384, 24576, 32768, 0],
2716 [8192, 16384, 24576, 32768, 0],
2717 [8192, 16384, 24576, 32768, 0],
2718 [8192, 16384, 24576, 32768, 0],
2719 [8192, 16384, 24576, 32768, 0],
2720 [8192, 16384, 24576, 32768, 0],
2721];
2722/// COEFF_BASE_CHROMA_8, q-context 3: the same table as [`COEFF_BASE_CHROMA_8`], for `base_q_idx` 121..=255.
2723pub const COEFF_BASE_CHROMA_8_Q3: [[u16; 5]; 42] = [
2724 [8626, 20271, 26216, 32768, 0],
2725 [26707, 32406, 32711, 32768, 0],
2726 [16999, 30329, 32286, 32768, 0],
2727 [11445, 25123, 30286, 32768, 0],
2728 [6411, 18828, 25601, 32768, 0],
2729 [6801, 12458, 20248, 32768, 0],
2730 [29918, 32682, 32748, 32768, 0],
2731 [20649, 31739, 32618, 32768, 0],
2732 [12879, 27773, 31581, 32768, 0],
2733 [7896, 21751, 28244, 32768, 0],
2734 [5260, 14870, 23698, 32768, 0],
2735 [29252, 32593, 32731, 32768, 0],
2736 [17072, 30460, 32294, 32768, 0],
2737 [10653, 24143, 29365, 32768, 0],
2738 [6536, 17490, 23983, 32768, 0],
2739 [4929, 13170, 20085, 32768, 0],
2740 [28137, 32518, 32715, 32768, 0],
2741 [18171, 30784, 32407, 32768, 0],
2742 [11437, 25436, 30459, 32768, 0],
2743 [7252, 18534, 26176, 32768, 0],
2744 [4126, 13353, 20978, 32768, 0],
2745 [31162, 32726, 32748, 32768, 0],
2746 [23017, 32222, 32701, 32768, 0],
2747 [15629, 29233, 32046, 32768, 0],
2748 [9387, 22621, 29480, 32768, 0],
2749 [6922, 17616, 25010, 32768, 0],
2750 [28838, 32265, 32614, 32768, 0],
2751 [19701, 30206, 31920, 32768, 0],
2752 [11214, 22410, 27933, 32768, 0],
2753 [5320, 14177, 23034, 32768, 0],
2754 [5049, 12881, 17827, 32768, 0],
2755 [27484, 32471, 32734, 32768, 0],
2756 [21076, 31526, 32561, 32768, 0],
2757 [12707, 26303, 31211, 32768, 0],
2758 [8169, 21722, 28219, 32768, 0],
2759 [6045, 19406, 27042, 32768, 0],
2760 [27753, 32572, 32745, 32768, 0],
2761 [20832, 31878, 32653, 32768, 0],
2762 [13250, 27356, 31674, 32768, 0],
2763 [7718, 21508, 29858, 32768, 0],
2764 [7209, 18350, 25559, 32768, 0],
2765 [8192, 16384, 24576, 32768, 0],
2766];
2767/// COEFF_BASE_CHROMA_16, q-context 3: the same table as [`COEFF_BASE_CHROMA_16`], for `base_q_idx` 121..=255.
2768pub const COEFF_BASE_CHROMA_16_Q3: [[u16; 5]; 42] = [
2769 [7833, 18369, 24095, 32768, 0],
2770 [26650, 32273, 32702, 32768, 0],
2771 [16371, 29961, 32191, 32768, 0],
2772 [11055, 24082, 29629, 32768, 0],
2773 [6892, 18644, 25400, 32768, 0],
2774 [5006, 13057, 19240, 32768, 0],
2775 [29834, 32666, 32748, 32768, 0],
2776 [19577, 31335, 32570, 32768, 0],
2777 [12253, 26509, 31122, 32768, 0],
2778 [7991, 20772, 27711, 32768, 0],
2779 [5677, 15910, 23059, 32768, 0],
2780 [30109, 32532, 32720, 32768, 0],
2781 [16747, 30166, 32252, 32768, 0],
2782 [10134, 23542, 29184, 32768, 0],
2783 [5791, 16176, 23556, 32768, 0],
2784 [4362, 10414, 17284, 32768, 0],
2785 [29492, 32626, 32748, 32768, 0],
2786 [19894, 31402, 32525, 32768, 0],
2787 [12942, 27071, 30869, 32768, 0],
2788 [8346, 21216, 27405, 32768, 0],
2789 [6572, 17087, 23859, 32768, 0],
2790 [32035, 32735, 32748, 32768, 0],
2791 [22957, 31838, 32618, 32768, 0],
2792 [14724, 28572, 31772, 32768, 0],
2793 [10364, 23999, 29553, 32768, 0],
2794 [7004, 18433, 25655, 32768, 0],
2795 [27528, 32277, 32681, 32768, 0],
2796 [16959, 31171, 32096, 32768, 0],
2797 [10486, 23593, 27962, 32768, 0],
2798 [8192, 16384, 23211, 32768, 0],
2799 [8937, 17873, 20852, 32768, 0],
2800 [27715, 32002, 32615, 32768, 0],
2801 [15073, 29491, 31676, 32768, 0],
2802 [11264, 24576, 28672, 32768, 0],
2803 [2341, 18725, 23406, 32768, 0],
2804 [7282, 18204, 25486, 32768, 0],
2805 [28547, 32213, 32657, 32768, 0],
2806 [20788, 29773, 32239, 32768, 0],
2807 [6780, 21469, 30508, 32768, 0],
2808 [5958, 14895, 23831, 32768, 0],
2809 [16384, 21845, 27307, 32768, 0],
2810 [8192, 16384, 24576, 32768, 0],
2811];
2812/// COEFF_BASE_CHROMA_32, q-context 3: the same table as [`COEFF_BASE_CHROMA_32`], for `base_q_idx` 121..=255.
2813pub const COEFF_BASE_CHROMA_32_Q3: [[u16; 5]; 42] = [
2814 [11206, 21090, 26561, 32768, 0],
2815 [28759, 32279, 32671, 32768, 0],
2816 [14171, 27952, 31569, 32768, 0],
2817 [9743, 22907, 29141, 32768, 0],
2818 [6871, 17886, 24868, 32768, 0],
2819 [4960, 13152, 19315, 32768, 0],
2820 [31077, 32661, 32748, 32768, 0],
2821 [19400, 31195, 32515, 32768, 0],
2822 [12752, 26858, 31040, 32768, 0],
2823 [8370, 22098, 28591, 32768, 0],
2824 [5457, 15373, 22298, 32768, 0],
2825 [31697, 32706, 32748, 32768, 0],
2826 [17860, 30657, 32333, 32768, 0],
2827 [12510, 24812, 29261, 32768, 0],
2828 [6180, 19124, 24722, 32768, 0],
2829 [5041, 13548, 17959, 32768, 0],
2830 [31552, 32716, 32748, 32768, 0],
2831 [21908, 31769, 32623, 32768, 0],
2832 [14470, 28201, 31565, 32768, 0],
2833 [9493, 22982, 28608, 32768, 0],
2834 [6858, 17240, 24137, 32768, 0],
2835 [32543, 32752, 32756, 32768, 0],
2836 [24286, 32097, 32666, 32768, 0],
2837 [15958, 29217, 32024, 32768, 0],
2838 [10207, 24234, 29958, 32768, 0],
2839 [6929, 18305, 25652, 32768, 0],
2840 [8192, 16384, 24576, 32768, 0],
2841 [8192, 16384, 24576, 32768, 0],
2842 [8192, 16384, 24576, 32768, 0],
2843 [8192, 16384, 24576, 32768, 0],
2844 [8192, 16384, 24576, 32768, 0],
2845 [8192, 16384, 24576, 32768, 0],
2846 [8192, 16384, 24576, 32768, 0],
2847 [8192, 16384, 24576, 32768, 0],
2848 [8192, 16384, 24576, 32768, 0],
2849 [8192, 16384, 24576, 32768, 0],
2850 [8192, 16384, 24576, 32768, 0],
2851 [8192, 16384, 24576, 32768, 0],
2852 [8192, 16384, 24576, 32768, 0],
2853 [8192, 16384, 24576, 32768, 0],
2854 [8192, 16384, 24576, 32768, 0],
2855 [8192, 16384, 24576, 32768, 0],
2856];
2857/// COEFF_BR_LUMA_16, q-context 3: the same table as [`COEFF_BR_LUMA_16`], for `base_q_idx` 121..=255.
2858pub const COEFF_BR_LUMA_16_Q3: [[u16; 5]; 21] = [
2859 [17113, 23733, 27081, 32768, 0],
2860 [14139, 21406, 25452, 32768, 0],
2861 [8552, 15002, 19776, 32768, 0],
2862 [5871, 11120, 15378, 32768, 0],
2863 [4455, 8616, 12253, 32768, 0],
2864 [3469, 6910, 10386, 32768, 0],
2865 [2255, 4553, 6782, 32768, 0],
2866 [18224, 24376, 27053, 32768, 0],
2867 [19290, 26710, 29614, 32768, 0],
2868 [14936, 22991, 27184, 32768, 0],
2869 [11238, 18951, 23762, 32768, 0],
2870 [8786, 15617, 20588, 32768, 0],
2871 [7317, 13228, 18003, 32768, 0],
2872 [5101, 9512, 13493, 32768, 0],
2873 [22639, 28222, 30210, 32768, 0],
2874 [23216, 29331, 31307, 32768, 0],
2875 [19075, 26762, 29895, 32768, 0],
2876 [15014, 23113, 27457, 32768, 0],
2877 [11938, 19857, 24752, 32768, 0],
2878 [9942, 17280, 22282, 32768, 0],
2879 [7167, 13144, 17752, 32768, 0],
2880];
2881/// COEFF_BR_LUMA_32, q-context 3: the same table as [`COEFF_BR_LUMA_32`], for `base_q_idx` 121..=255.
2882pub const COEFF_BR_LUMA_32_Q3: [[u16; 5]; 21] = [
2883 [12162, 18785, 22648, 32768, 0],
2884 [12749, 19697, 23806, 32768, 0],
2885 [8580, 15297, 20346, 32768, 0],
2886 [6169, 11749, 16543, 32768, 0],
2887 [4836, 9391, 13448, 32768, 0],
2888 [3821, 7711, 11613, 32768, 0],
2889 [2228, 4601, 7070, 32768, 0],
2890 [16319, 24725, 28280, 32768, 0],
2891 [15698, 23277, 27168, 32768, 0],
2892 [12726, 20368, 25047, 32768, 0],
2893 [9912, 17015, 21976, 32768, 0],
2894 [7888, 14220, 19179, 32768, 0],
2895 [6777, 12284, 17018, 32768, 0],
2896 [4492, 8590, 12252, 32768, 0],
2897 [23249, 28904, 30947, 32768, 0],
2898 [21050, 27908, 30512, 32768, 0],
2899 [17440, 25340, 28949, 32768, 0],
2900 [14059, 22018, 26541, 32768, 0],
2901 [11288, 18903, 23898, 32768, 0],
2902 [9411, 16342, 21428, 32768, 0],
2903 [6278, 11588, 15944, 32768, 0],
2904];
2905/// COEFF_BR_CHROMA_8, q-context 3: the same table as [`COEFF_BR_CHROMA_8`], for `base_q_idx` 121..=255.
2906pub const COEFF_BR_CHROMA_8_Q3: [[u16; 5]; 21] = [
2907 [17616, 24586, 28112, 32768, 0],
2908 [15809, 23299, 27155, 32768, 0],
2909 [10767, 18890, 23793, 32768, 0],
2910 [7727, 14255, 18865, 32768, 0],
2911 [6129, 11926, 16882, 32768, 0],
2912 [4482, 9704, 14861, 32768, 0],
2913 [3277, 7452, 11522, 32768, 0],
2914 [22956, 28551, 30730, 32768, 0],
2915 [22724, 28937, 30961, 32768, 0],
2916 [18467, 26324, 29580, 32768, 0],
2917 [13234, 20713, 25649, 32768, 0],
2918 [11181, 17592, 22481, 32768, 0],
2919 [8291, 18358, 24576, 32768, 0],
2920 [7568, 11881, 14984, 32768, 0],
2921 [24948, 29001, 31147, 32768, 0],
2922 [25674, 30619, 32151, 32768, 0],
2923 [20841, 26793, 29603, 32768, 0],
2924 [14669, 24356, 28666, 32768, 0],
2925 [11334, 23593, 28219, 32768, 0],
2926 [8922, 14762, 22873, 32768, 0],
2927 [8301, 13544, 20535, 32768, 0],
2928];
2929/// COEFF_BR_CHROMA_16, q-context 3: the same table as [`COEFF_BR_CHROMA_16`], for `base_q_idx` 121..=255.
2930pub const COEFF_BR_CHROMA_16_Q3: [[u16; 5]; 21] = [
2931 [15820, 22738, 26488, 32768, 0],
2932 [13530, 20885, 25216, 32768, 0],
2933 [8395, 15530, 20452, 32768, 0],
2934 [6574, 12321, 16380, 32768, 0],
2935 [5353, 10419, 14568, 32768, 0],
2936 [4613, 8446, 12381, 32768, 0],
2937 [3440, 7158, 9903, 32768, 0],
2938 [24247, 29051, 31224, 32768, 0],
2939 [22118, 28058, 30369, 32768, 0],
2940 [16498, 24768, 28389, 32768, 0],
2941 [12920, 21175, 26137, 32768, 0],
2942 [10730, 18619, 25352, 32768, 0],
2943 [10187, 16279, 22791, 32768, 0],
2944 [9310, 14631, 22127, 32768, 0],
2945 [24970, 30558, 32057, 32768, 0],
2946 [24801, 29942, 31698, 32768, 0],
2947 [22432, 28453, 30855, 32768, 0],
2948 [19054, 25680, 29580, 32768, 0],
2949 [14392, 23036, 28109, 32768, 0],
2950 [12495, 20947, 26650, 32768, 0],
2951 [12442, 20326, 26214, 32768, 0],
2952];
2953/// COEFF_BR_CHROMA_32, q-context 3: the same table as [`COEFF_BR_CHROMA_32`], for `base_q_idx` 121..=255.
2954pub const COEFF_BR_CHROMA_32_Q3: [[u16; 5]; 21] = [
2955 [13981, 20067, 23226, 32768, 0],
2956 [16922, 23580, 26783, 32768, 0],
2957 [11005, 19039, 24487, 32768, 0],
2958 [7389, 14218, 19798, 32768, 0],
2959 [5598, 11505, 17206, 32768, 0],
2960 [6090, 11213, 15659, 32768, 0],
2961 [3820, 7371, 10119, 32768, 0],
2962 [21082, 26925, 29675, 32768, 0],
2963 [21262, 28627, 31128, 32768, 0],
2964 [18392, 26454, 30437, 32768, 0],
2965 [14870, 22910, 27096, 32768, 0],
2966 [12620, 19484, 24908, 32768, 0],
2967 [9290, 16553, 22802, 32768, 0],
2968 [6668, 14288, 20004, 32768, 0],
2969 [27704, 31055, 31949, 32768, 0],
2970 [24709, 29978, 31788, 32768, 0],
2971 [21668, 29264, 31657, 32768, 0],
2972 [18295, 26968, 30074, 32768, 0],
2973 [16399, 24422, 29313, 32768, 0],
2974 [14347, 23026, 28104, 32768, 0],
2975 [12370, 19806, 24477, 32768, 0],
2976];
2977/// COEFF_BASE_EOB_LUMA_16, q-context 3: the same table as [`COEFF_BASE_EOB_LUMA_16`], for `base_q_idx` 121..=255.
2978pub const COEFF_BASE_EOB_LUMA_16_Q3: [[u16; 4]; 4] = [
2979 [19980, 30591, 32768, 0],
2980 [32219, 32597, 32768, 0],
2981 [32581, 32706, 32768, 0],
2982 [31803, 32287, 32768, 0],
2983];
2984/// COEFF_BASE_EOB_LUMA_32, q-context 3: the same table as [`COEFF_BASE_EOB_LUMA_32`], for `base_q_idx` 121..=255.
2985pub const COEFF_BASE_EOB_LUMA_32_Q3: [[u16; 4]; 4] = [
2986 [24647, 30463, 32768, 0],
2987 [32412, 32695, 32768, 0],
2988 [32468, 32720, 32768, 0],
2989 [31269, 32523, 32768, 0],
2990];
2991/// COEFF_BASE_EOB_LUMA_64, q-context 3: the same table as [`COEFF_BASE_EOB_LUMA_64`], for `base_q_idx` 121..=255.
2992pub const COEFF_BASE_EOB_LUMA_64_Q3: [[u16; 4]; 4] = [
2993 [12358, 24977, 32768, 0],
2994 [31331, 32385, 32768, 0],
2995 [32634, 32756, 32768, 0],
2996 [30411, 32548, 32768, 0],
2997];
2998/// COEFF_BASE_EOB_CHROMA_8, q-context 3: the same table as [`COEFF_BASE_EOB_CHROMA_8`], for `base_q_idx` 121..=255.
2999pub const COEFF_BASE_EOB_CHROMA_8_Q3: [[u16; 4]; 4] = [
3000 [27558, 31151, 32768, 0],
3001 [32020, 32640, 32768, 0],
3002 [32097, 32575, 32768, 0],
3003 [32242, 32719, 32768, 0],
3004];
3005/// COEFF_BASE_EOB_CHROMA_16, q-context 3: the same table as [`COEFF_BASE_EOB_CHROMA_16`], for `base_q_idx` 121..=255.
3006pub const COEFF_BASE_EOB_CHROMA_16_Q3: [[u16; 4]; 4] = [
3007 [26473, 30507, 32768, 0],
3008 [32431, 32723, 32768, 0],
3009 [32196, 32611, 32768, 0],
3010 [31588, 32528, 32768, 0],
3011];
3012/// COEFF_BASE_EOB_CHROMA_32, q-context 3: the same table as [`COEFF_BASE_EOB_CHROMA_32`], for `base_q_idx` 121..=255.
3013pub const COEFF_BASE_EOB_CHROMA_32_Q3: [[u16; 4]; 4] = [
3014 [28482, 31505, 32768, 0],
3015 [32152, 32701, 32768, 0],
3016 [31732, 32598, 32768, 0],
3017 [31767, 32712, 32768, 0],
3018];
3019
3020#[cfg(test)]
3021mod tests {
3022 use super::*;
3023
3024 /// Every row of a CDF table is non-decreasing and ends with the
3025 /// alphabet's total (`32768`) followed by the adaptation counter (`0`),
3026 /// which is the shape [`crate::msac`] expects to read.
3027 fn assert_row_shape(row: &[u16]) {
3028 assert_eq!(row[row.len() - 2], 32768, "row does not total 32768");
3029 assert_eq!(row[row.len() - 1], 0, "row's adaptation counter is not 0");
3030 for w in row[..row.len() - 1].windows(2) {
3031 assert!(w[0] <= w[1], "row is not non-decreasing: {row:?}");
3032 }
3033 }
3034
3035 #[test]
3036 fn inter_frame_tables_are_well_formed_cdfs() {
3037 for row in INTRA_INTER {
3038 assert_row_shape(&row);
3039 }
3040 for ctx in SINGLE_REF {
3041 for row in ctx {
3042 assert_row_shape(&row);
3043 }
3044 }
3045 for row in Y_MODE {
3046 assert_row_shape(&row);
3047 }
3048 for row in NEW_MV {
3049 assert_row_shape(&row);
3050 }
3051 for row in ZERO_MV {
3052 assert_row_shape(&row);
3053 }
3054 for row in REF_MV {
3055 assert_row_shape(&row);
3056 }
3057 for row in DRL_MODE {
3058 assert_row_shape(&row);
3059 }
3060 assert_row_shape(&MV_JOINT);
3061 assert_row_shape(&MV_CLASS);
3062 assert_row_shape(&MV_CLASS0_BIT);
3063 for row in MV_CLASS0_FR {
3064 assert_row_shape(&row);
3065 }
3066 assert_row_shape(&MV_CLASS0_HP);
3067 for row in MV_BIT {
3068 assert_row_shape(&row);
3069 }
3070 assert_row_shape(&MV_FR);
3071 assert_row_shape(&MV_HP);
3072 assert_row_shape(&MV_SIGN);
3073 }
3074
3075 /// Each table's row length matches the spec's symbol count for that
3076 /// syntax element: two entries (total, counter) plus one fewer than the
3077 /// alphabet.
3078 #[test]
3079 fn inter_frame_tables_have_the_spec_alphabet_size() {
3080 assert_eq!(INTRA_INTER[0].len(), 2 + 1); // binary
3081 assert_eq!(SINGLE_REF[0][0].len(), 2 + 1); // binary
3082 assert_eq!(Y_MODE[0].len(), 2 + 13 - 1); // 13 luma intra modes
3083 assert_eq!(NEW_MV[0].len(), 2 + 1);
3084 assert_eq!(ZERO_MV[0].len(), 2 + 1);
3085 assert_eq!(REF_MV[0].len(), 2 + 1);
3086 assert_eq!(DRL_MODE[0].len(), 2 + 1);
3087 assert_eq!(MV_JOINT.len(), 2 + 3); // MV_JOINTS = 4
3088 assert_eq!(MV_CLASS.len(), 2 + 10); // MV_CLASSES = 11
3089 assert_eq!(MV_CLASS0_BIT.len(), 2 + 1);
3090 assert_eq!(MV_CLASS0_FR[0].len(), 2 + 3); // 4-way fraction
3091 assert_eq!(MV_CLASS0_HP.len(), 2 + 1);
3092 assert_eq!(MV_BIT[0].len(), 2 + 1);
3093 assert_eq!(MV_FR.len(), 2 + 3);
3094 assert_eq!(MV_HP.len(), 2 + 1);
3095 assert_eq!(MV_SIGN.len(), 2 + 1);
3096 }
3097}
3098
3099// TX_8X8/TX_4X4 tables (lane-av1-rect): the 8x8 luma and 4x4 chroma coefficient
3100// coding CDFs, extracted byte-exact from libaom's Default_*_Cdf tables, needed
3101// to let a key frame's straddling 16x16 quadrant split down to an 8x8 leaf.
3102
3103/// TXB_SKIP_LUMA_8_Q0, q-context 0: the same table as [`TXB_SKIP_LUMA_8`], for `base_q_idx` 0..=20.
3104pub const TXB_SKIP_LUMA_8_Q0: [u16; 3] = [31548, 32768, 0];
3105
3106/// TXB_SKIP_LUMA_8_Q1, q-context 1: the same table as [`TXB_SKIP_LUMA_8`], for `base_q_idx` 21..=60.
3107pub const TXB_SKIP_LUMA_8_Q1: [u16; 3] = [31782, 32768, 0];
3108
3109/// the all-zero flag of an 8x8 luma transform, whose only context is zero because the transform covers its whole block.
3110pub const TXB_SKIP_LUMA_8: [u16; 3] = [31957, 32768, 0];
3111
3112/// TXB_SKIP_LUMA_8_Q3, q-context 3: the same table as [`TXB_SKIP_LUMA_8`], for `base_q_idx` 121..=255.
3113pub const TXB_SKIP_LUMA_8_Q3: [u16; 3] = [31903, 32768, 0];
3114
3115/// TXB_SKIP_CHROMA_4_Q0, q-context 0: the same table as [`TXB_SKIP_CHROMA_4`], for `base_q_idx` 0..=20.
3116pub const TXB_SKIP_CHROMA_4_Q0: [[u16; 3]; 3] =
3117 [[7654, 32768, 0], [19473, 32768, 0], [29984, 32768, 0]];
3118
3119/// TXB_SKIP_CHROMA_4_Q1, q-context 1: the same table as [`TXB_SKIP_CHROMA_4`], for `base_q_idx` 21..=60.
3120pub const TXB_SKIP_CHROMA_4_Q1: [[u16; 3]; 3] =
3121 [[5495, 32768, 0], [17942, 32768, 0], [28280, 32768, 0]];
3122
3123/// the all-zero flag of a 4x4 chroma transform.
3124pub const TXB_SKIP_CHROMA_4: [[u16; 3]; 3] =
3125 [[4119, 32768, 0], [16026, 32768, 0], [25657, 32768, 0]];
3126
3127/// TXB_SKIP_CHROMA_4_Q3, q-context 3: the same table as [`TXB_SKIP_CHROMA_4`], for `base_q_idx` 121..=255.
3128pub const TXB_SKIP_CHROMA_4_Q3: [[u16; 3]; 3] =
3129 [[2713, 32768, 0], [11861, 32768, 0], [20773, 32768, 0]];
3130
3131/// EOB_PT_64_LUMA_Q0, q-context 0: the same table as [`EOB_PT_64_LUMA`], for `base_q_idx` 0..=20.
3132pub const EOB_PT_64_LUMA_Q0: [u16; 8] = [329, 498, 1101, 1784, 3265, 7758, 32768, 0];
3133
3134/// EOB_PT_64_LUMA_Q1, q-context 1: the same table as [`EOB_PT_64_LUMA`], for `base_q_idx` 21..=60.
3135pub const EOB_PT_64_LUMA_Q1: [u16; 8] = [1260, 1446, 2253, 3712, 6652, 13369, 32768, 0];
3136
3137/// the end-of-block group of an 8x8 luma transform.
3138pub const EOB_PT_64_LUMA: [u16; 8] = [2374, 2772, 4583, 7276, 12288, 19706, 32768, 0];
3139
3140/// EOB_PT_64_LUMA_Q3, q-context 3: the same table as [`EOB_PT_64_LUMA`], for `base_q_idx` 121..=255.
3141pub const EOB_PT_64_LUMA_Q3: [u16; 8] = [6307, 7541, 12060, 16358, 22553, 27865, 32768, 0];
3142
3143/// The `EOB_PT_64_LUMA` sibling of [`EOB_PT_16_LUMA_CLASS1`]
3144/// (`av1_default_eob_multi64_cdfs[q][0][1]`), for an 8x8 luma TU whose
3145/// `tx_type` resolves `V_DCT`/`H_DCT`.
3146pub const EOB_PT_64_LUMA_CLASS1_Q0: [u16; 8] = [335, 730, 1459, 5494, 8755, 12997, 32768, 0];
3147pub const EOB_PT_64_LUMA_CLASS1_Q1: [u16; 8] = [401, 605, 1029, 2563, 5845, 12626, 32768, 0];
3148pub const EOB_PT_64_LUMA_CLASS1: [u16; 8] = [497, 810, 1315, 3000, 7004, 15641, 32768, 0];
3149pub const EOB_PT_64_LUMA_CLASS1_Q3: [u16; 8] = [1289, 2320, 3971, 7926, 14153, 24291, 32768, 0];
3150
3151/// EOB_PT_16_CHROMA_Q0, q-context 0: the same table as [`EOB_PT_16_CHROMA`], for `base_q_idx` 0..=20.
3152pub const EOB_PT_16_CHROMA_Q0: [u16; 6] = [3247, 4950, 9688, 14563, 32768, 0];
3153
3154/// EOB_PT_16_CHROMA_Q1, q-context 1: the same table as [`EOB_PT_16_CHROMA`], for `base_q_idx` 21..=60.
3155pub const EOB_PT_16_CHROMA_Q1: [u16; 6] = [7637, 9498, 14259, 19108, 32768, 0];
3156
3157/// the end-of-block group of a 4x4 chroma transform.
3158pub const EOB_PT_16_CHROMA: [u16; 6] = [11139, 13270, 18241, 23566, 32768, 0];
3159
3160/// EOB_PT_16_CHROMA_Q3, q-context 3: the same table as [`EOB_PT_16_CHROMA`], for `base_q_idx` 121..=255.
3161pub const EOB_PT_16_CHROMA_Q3: [u16; 6] = [19575, 21766, 26044, 29709, 32768, 0];
3162
3163/// EOB_EXTRA_LUMA_8_Q0, q-context 0: the same table as [`EOB_EXTRA_LUMA_8`], for `base_q_idx` 0..=20.
3164pub const EOB_EXTRA_LUMA_8_Q0: [[u16; 3]; 9] = [
3165 [20401, 32768, 0],
3166 [17025, 32768, 0],
3167 [12845, 32768, 0],
3168 [12873, 32768, 0],
3169 [14094, 32768, 0],
3170 [16384, 32768, 0],
3171 [16384, 32768, 0],
3172 [16384, 32768, 0],
3173 [16384, 32768, 0],
3174];
3175
3176/// EOB_EXTRA_LUMA_8_Q1, q-context 1: the same table as [`EOB_EXTRA_LUMA_8`], for `base_q_idx` 21..=60.
3177pub const EOB_EXTRA_LUMA_8_Q1: [[u16; 3]; 9] = [
3178 [20430, 32768, 0],
3179 [20662, 32768, 0],
3180 [15367, 32768, 0],
3181 [16970, 32768, 0],
3182 [14657, 32768, 0],
3183 [16384, 32768, 0],
3184 [16384, 32768, 0],
3185 [16384, 32768, 0],
3186 [16384, 32768, 0],
3187];
3188
3189/// the top offset bit inside an 8x8 luma transform's end-of-block group.
3190pub const EOB_EXTRA_LUMA_8: [[u16; 3]; 9] = [
3191 [19139, 32768, 0],
3192 [21487, 32768, 0],
3193 [18959, 32768, 0],
3194 [20910, 32768, 0],
3195 [19089, 32768, 0],
3196 [16384, 32768, 0],
3197 [16384, 32768, 0],
3198 [16384, 32768, 0],
3199 [16384, 32768, 0],
3200];
3201
3202/// EOB_EXTRA_LUMA_8_Q3, q-context 3: the same table as [`EOB_EXTRA_LUMA_8`], for `base_q_idx` 121..=255.
3203pub const EOB_EXTRA_LUMA_8_Q3: [[u16; 3]; 9] = [
3204 [20238, 32768, 0],
3205 [21057, 32768, 0],
3206 [19159, 32768, 0],
3207 [22337, 32768, 0],
3208 [20159, 32768, 0],
3209 [16384, 32768, 0],
3210 [16384, 32768, 0],
3211 [16384, 32768, 0],
3212 [16384, 32768, 0],
3213];
3214
3215/// EOB_EXTRA_CHROMA_4_Q0, q-context 0: the same table as [`EOB_EXTRA_CHROMA_4`], for `base_q_idx` 0..=20.
3216pub const EOB_EXTRA_CHROMA_4_Q0: [[u16; 3]; 9] = [
3217 [19069, 32768, 0],
3218 [22525, 32768, 0],
3219 [13377, 32768, 0],
3220 [16384, 32768, 0],
3221 [16384, 32768, 0],
3222 [16384, 32768, 0],
3223 [16384, 32768, 0],
3224 [16384, 32768, 0],
3225 [16384, 32768, 0],
3226];
3227
3228/// EOB_EXTRA_CHROMA_4_Q1, q-context 1: the same table as [`EOB_EXTRA_CHROMA_4`], for `base_q_idx` 21..=60.
3229pub const EOB_EXTRA_CHROMA_4_Q1: [[u16; 3]; 9] = [
3230 [20335, 32768, 0],
3231 [21667, 32768, 0],
3232 [14818, 32768, 0],
3233 [16384, 32768, 0],
3234 [16384, 32768, 0],
3235 [16384, 32768, 0],
3236 [16384, 32768, 0],
3237 [16384, 32768, 0],
3238 [16384, 32768, 0],
3239];
3240
3241/// the same, for a 4x4 chroma transform.
3242pub const EOB_EXTRA_CHROMA_4: [[u16; 3]; 9] = [
3243 [20090, 32768, 0],
3244 [19444, 32768, 0],
3245 [17286, 32768, 0],
3246 [16384, 32768, 0],
3247 [16384, 32768, 0],
3248 [16384, 32768, 0],
3249 [16384, 32768, 0],
3250 [16384, 32768, 0],
3251 [16384, 32768, 0],
3252];
3253
3254/// EOB_EXTRA_CHROMA_4_Q3, q-context 3: the same table as [`EOB_EXTRA_CHROMA_4`], for `base_q_idx` 121..=255.
3255pub const EOB_EXTRA_CHROMA_4_Q3: [[u16; 3]; 9] = [
3256 [21416, 32768, 0],
3257 [20855, 32768, 0],
3258 [23410, 32768, 0],
3259 [16384, 32768, 0],
3260 [16384, 32768, 0],
3261 [16384, 32768, 0],
3262 [16384, 32768, 0],
3263 [16384, 32768, 0],
3264 [16384, 32768, 0],
3265];
3266
3267/// COEFF_BASE_LUMA_8_Q0, q-context 0: the same table as [`COEFF_BASE_LUMA_8`], for `base_q_idx` 0..=20.
3268pub const COEFF_BASE_LUMA_8_Q0: [[u16; 5]; 42] = [
3269 [4536, 10072, 14001, 32768, 0],
3270 [25459, 31416, 32206, 32768, 0],
3271 [16605, 28048, 30818, 32768, 0],
3272 [11008, 22857, 27719, 32768, 0],
3273 [6915, 16268, 22315, 32768, 0],
3274 [2625, 6812, 10537, 32768, 0],
3275 [24257, 31788, 32499, 32768, 0],
3276 [16880, 29454, 31879, 32768, 0],
3277 [11958, 25054, 29778, 32768, 0],
3278 [7916, 18718, 25084, 32768, 0],
3279 [3383, 8777, 13446, 32768, 0],
3280 [22720, 31603, 32393, 32768, 0],
3281 [14960, 28125, 31335, 32768, 0],
3282 [9731, 22210, 27928, 32768, 0],
3283 [6304, 15832, 22277, 32768, 0],
3284 [2910, 7818, 12166, 32768, 0],
3285 [20375, 30627, 32131, 32768, 0],
3286 [13904, 27284, 30887, 32768, 0],
3287 [9368, 21558, 27144, 32768, 0],
3288 [5937, 14966, 21119, 32768, 0],
3289 [2667, 7225, 11319, 32768, 0],
3290 [23970, 31470, 32378, 32768, 0],
3291 [17173, 29734, 32018, 32768, 0],
3292 [12795, 25441, 29965, 32768, 0],
3293 [8981, 19680, 25893, 32768, 0],
3294 [4728, 11372, 16902, 32768, 0],
3295 [24287, 31797, 32439, 32768, 0],
3296 [16703, 29145, 31696, 32768, 0],
3297 [10833, 23554, 28725, 32768, 0],
3298 [6468, 16566, 23057, 32768, 0],
3299 [2415, 6562, 10278, 32768, 0],
3300 [26610, 32395, 32659, 32768, 0],
3301 [18590, 30498, 32117, 32768, 0],
3302 [12420, 25756, 29950, 32768, 0],
3303 [7639, 18746, 24710, 32768, 0],
3304 [3001, 8086, 12347, 32768, 0],
3305 [25076, 32064, 32580, 32768, 0],
3306 [17946, 30128, 32028, 32768, 0],
3307 [12024, 24985, 29378, 32768, 0],
3308 [7517, 18390, 24304, 32768, 0],
3309 [3243, 8781, 13331, 32768, 0],
3310 [8192, 16384, 24576, 32768, 0],
3311];
3312
3313/// COEFF_BASE_LUMA_8_Q1, q-context 1: the same table as [`COEFF_BASE_LUMA_8`], for `base_q_idx` 21..=60.
3314pub const COEFF_BASE_LUMA_8_Q1: [[u16; 5]; 42] = [
3315 [6779, 13743, 17678, 32768, 0],
3316 [24806, 31797, 32457, 32768, 0],
3317 [17616, 29047, 31372, 32768, 0],
3318 [11063, 23175, 28003, 32768, 0],
3319 [6521, 16110, 22324, 32768, 0],
3320 [2764, 7504, 11654, 32768, 0],
3321 [25266, 32367, 32637, 32768, 0],
3322 [19054, 30553, 32175, 32768, 0],
3323 [12139, 25212, 29807, 32768, 0],
3324 [7311, 18162, 24704, 32768, 0],
3325 [3397, 9164, 14074, 32768, 0],
3326 [25988, 32208, 32522, 32768, 0],
3327 [16253, 28912, 31526, 32768, 0],
3328 [9151, 21387, 27372, 32768, 0],
3329 [5688, 14915, 21496, 32768, 0],
3330 [2717, 7627, 12004, 32768, 0],
3331 [23144, 31855, 32443, 32768, 0],
3332 [16070, 28491, 31325, 32768, 0],
3333 [8702, 20467, 26517, 32768, 0],
3334 [5243, 13956, 20367, 32768, 0],
3335 [2621, 7335, 11567, 32768, 0],
3336 [26636, 32340, 32630, 32768, 0],
3337 [19990, 31050, 32341, 32768, 0],
3338 [13243, 26105, 30315, 32768, 0],
3339 [8588, 19521, 25918, 32768, 0],
3340 [4717, 11585, 17304, 32768, 0],
3341 [25844, 32292, 32582, 32768, 0],
3342 [19090, 30635, 32097, 32768, 0],
3343 [11963, 24546, 28939, 32768, 0],
3344 [6218, 16087, 22354, 32768, 0],
3345 [2340, 6608, 10426, 32768, 0],
3346 [28046, 32576, 32694, 32768, 0],
3347 [21178, 31313, 32296, 32768, 0],
3348 [13486, 26184, 29870, 32768, 0],
3349 [7149, 17871, 23723, 32768, 0],
3350 [2833, 7958, 12259, 32768, 0],
3351 [27710, 32528, 32686, 32768, 0],
3352 [20674, 31076, 32268, 32768, 0],
3353 [12413, 24955, 29243, 32768, 0],
3354 [6676, 16927, 23097, 32768, 0],
3355 [2966, 8333, 12919, 32768, 0],
3356 [8192, 16384, 24576, 32768, 0],
3357];
3358
3359/// an 8x8 luma coefficient's base level.
3360pub const COEFF_BASE_LUMA_8: [[u16; 5]; 42] = [
3361 [9704, 17294, 21132, 32768, 0],
3362 [26762, 32278, 32633, 32768, 0],
3363 [18382, 29620, 31819, 32768, 0],
3364 [10891, 23475, 28723, 32768, 0],
3365 [6358, 16583, 23309, 32768, 0],
3366 [3248, 9118, 14141, 32768, 0],
3367 [27204, 32573, 32699, 32768, 0],
3368 [19818, 30824, 32329, 32768, 0],
3369 [11772, 25120, 30041, 32768, 0],
3370 [6995, 18033, 25039, 32768, 0],
3371 [3752, 10442, 16098, 32768, 0],
3372 [27222, 32256, 32559, 32768, 0],
3373 [15356, 28399, 31475, 32768, 0],
3374 [8821, 20635, 27057, 32768, 0],
3375 [5511, 14404, 21239, 32768, 0],
3376 [2935, 8222, 13051, 32768, 0],
3377 [24875, 32120, 32529, 32768, 0],
3378 [15233, 28265, 31445, 32768, 0],
3379 [8605, 20570, 26932, 32768, 0],
3380 [5431, 14413, 21196, 32768, 0],
3381 [2994, 8341, 13223, 32768, 0],
3382 [28201, 32604, 32700, 32768, 0],
3383 [21041, 31446, 32456, 32768, 0],
3384 [13221, 26213, 30475, 32768, 0],
3385 [8255, 19385, 26037, 32768, 0],
3386 [4930, 12585, 18830, 32768, 0],
3387 [28768, 32448, 32627, 32768, 0],
3388 [19705, 30561, 32021, 32768, 0],
3389 [11572, 23589, 28220, 32768, 0],
3390 [5532, 15034, 21446, 32768, 0],
3391 [2460, 7150, 11456, 32768, 0],
3392 [29874, 32619, 32699, 32768, 0],
3393 [21621, 31071, 32201, 32768, 0],
3394 [12511, 24747, 28992, 32768, 0],
3395 [6281, 16395, 22748, 32768, 0],
3396 [3246, 9278, 14497, 32768, 0],
3397 [29715, 32625, 32712, 32768, 0],
3398 [20958, 31011, 32283, 32768, 0],
3399 [11233, 23671, 28806, 32768, 0],
3400 [6012, 16128, 22868, 32768, 0],
3401 [3427, 9851, 15414, 32768, 0],
3402 [8192, 16384, 24576, 32768, 0],
3403];
3404
3405/// COEFF_BASE_LUMA_8_Q3, q-context 3: the same table as [`COEFF_BASE_LUMA_8`], for `base_q_idx` 121..=255.
3406pub const COEFF_BASE_LUMA_8_Q3: [[u16; 5]; 42] = [
3407 [7754, 16948, 22142, 32768, 0],
3408 [25670, 32330, 32691, 32768, 0],
3409 [15663, 29225, 31994, 32768, 0],
3410 [9878, 23288, 29158, 32768, 0],
3411 [6419, 17088, 24336, 32768, 0],
3412 [3859, 11003, 17039, 32768, 0],
3413 [27562, 32595, 32725, 32768, 0],
3414 [17575, 30588, 32399, 32768, 0],
3415 [10819, 24838, 30309, 32768, 0],
3416 [7124, 18686, 25916, 32768, 0],
3417 [4479, 12688, 19340, 32768, 0],
3418 [28385, 32476, 32673, 32768, 0],
3419 [15306, 29005, 31938, 32768, 0],
3420 [8937, 21615, 28322, 32768, 0],
3421 [5982, 15603, 22786, 32768, 0],
3422 [3620, 10267, 16136, 32768, 0],
3423 [27280, 32464, 32667, 32768, 0],
3424 [15607, 29160, 32004, 32768, 0],
3425 [9091, 22135, 28740, 32768, 0],
3426 [6232, 16632, 24020, 32768, 0],
3427 [4047, 11377, 17672, 32768, 0],
3428 [29220, 32630, 32718, 32768, 0],
3429 [19650, 31220, 32462, 32768, 0],
3430 [13050, 26312, 30827, 32768, 0],
3431 [9228, 20870, 27468, 32768, 0],
3432 [6146, 15149, 21971, 32768, 0],
3433 [30169, 32481, 32623, 32768, 0],
3434 [17212, 29311, 31554, 32768, 0],
3435 [9911, 21311, 26882, 32768, 0],
3436 [4487, 13314, 20372, 32768, 0],
3437 [2570, 7772, 12889, 32768, 0],
3438 [30924, 32613, 32708, 32768, 0],
3439 [19490, 30206, 32107, 32768, 0],
3440 [11232, 23998, 29276, 32768, 0],
3441 [6769, 17955, 25035, 32768, 0],
3442 [4398, 12623, 19214, 32768, 0],
3443 [30609, 32627, 32722, 32768, 0],
3444 [19370, 30582, 32287, 32768, 0],
3445 [10457, 23619, 29409, 32768, 0],
3446 [6443, 17637, 24834, 32768, 0],
3447 [4645, 13236, 20106, 32768, 0],
3448 [8192, 16384, 24576, 32768, 0],
3449];
3450
3451/// COEFF_BASE_CHROMA_4_Q0, q-context 0: the same table as [`COEFF_BASE_CHROMA_4`], for `base_q_idx` 0..=20.
3452pub const COEFF_BASE_CHROMA_4_Q0: [[u16; 5]; 42] = [
3453 [6302, 16444, 21761, 32768, 0],
3454 [23040, 31538, 32475, 32768, 0],
3455 [15196, 28452, 31496, 32768, 0],
3456 [10020, 22946, 28514, 32768, 0],
3457 [6533, 16862, 23501, 32768, 0],
3458 [3538, 9816, 15076, 32768, 0],
3459 [24444, 31875, 32525, 32768, 0],
3460 [15881, 28924, 31635, 32768, 0],
3461 [9922, 22873, 28466, 32768, 0],
3462 [6527, 16966, 23691, 32768, 0],
3463 [4114, 11303, 17220, 32768, 0],
3464 [8192, 16384, 24576, 32768, 0],
3465 [8192, 16384, 24576, 32768, 0],
3466 [8192, 16384, 24576, 32768, 0],
3467 [8192, 16384, 24576, 32768, 0],
3468 [8192, 16384, 24576, 32768, 0],
3469 [8192, 16384, 24576, 32768, 0],
3470 [8192, 16384, 24576, 32768, 0],
3471 [8192, 16384, 24576, 32768, 0],
3472 [8192, 16384, 24576, 32768, 0],
3473 [8192, 16384, 24576, 32768, 0],
3474 [20201, 30770, 32209, 32768, 0],
3475 [14754, 28071, 31258, 32768, 0],
3476 [8378, 20186, 26517, 32768, 0],
3477 [5916, 15299, 21978, 32768, 0],
3478 [4268, 11583, 17901, 32768, 0],
3479 [24361, 32025, 32581, 32768, 0],
3480 [18673, 30105, 31943, 32768, 0],
3481 [10196, 22244, 27576, 32768, 0],
3482 [5495, 14349, 20417, 32768, 0],
3483 [2676, 7415, 11498, 32768, 0],
3484 [24678, 31958, 32585, 32768, 0],
3485 [18629, 29906, 31831, 32768, 0],
3486 [9364, 20724, 26315, 32768, 0],
3487 [4641, 12318, 18094, 32768, 0],
3488 [2758, 7387, 11579, 32768, 0],
3489 [25433, 31842, 32469, 32768, 0],
3490 [18795, 29289, 31411, 32768, 0],
3491 [7644, 17584, 23592, 32768, 0],
3492 [3408, 9014, 15047, 32768, 0],
3493 [8192, 16384, 24576, 32768, 0],
3494 [8192, 16384, 24576, 32768, 0],
3495];
3496
3497/// COEFF_BASE_CHROMA_4_Q1, q-context 1: the same table as [`COEFF_BASE_CHROMA_4`], for `base_q_idx` 21..=60.
3498pub const COEFF_BASE_CHROMA_4_Q1: [[u16; 5]; 42] = [
3499 [8455, 19003, 24368, 32768, 0],
3500 [23563, 32021, 32604, 32768, 0],
3501 [16237, 29446, 31935, 32768, 0],
3502 [10724, 23999, 29358, 32768, 0],
3503 [6725, 17528, 24416, 32768, 0],
3504 [3927, 10927, 16825, 32768, 0],
3505 [26313, 32288, 32634, 32768, 0],
3506 [17430, 30095, 32095, 32768, 0],
3507 [11116, 24606, 29679, 32768, 0],
3508 [7195, 18384, 25269, 32768, 0],
3509 [4726, 12852, 19315, 32768, 0],
3510 [8192, 16384, 24576, 32768, 0],
3511 [8192, 16384, 24576, 32768, 0],
3512 [8192, 16384, 24576, 32768, 0],
3513 [8192, 16384, 24576, 32768, 0],
3514 [8192, 16384, 24576, 32768, 0],
3515 [8192, 16384, 24576, 32768, 0],
3516 [8192, 16384, 24576, 32768, 0],
3517 [8192, 16384, 24576, 32768, 0],
3518 [8192, 16384, 24576, 32768, 0],
3519 [8192, 16384, 24576, 32768, 0],
3520 [22822, 31648, 32483, 32768, 0],
3521 [16724, 29633, 31929, 32768, 0],
3522 [10261, 23033, 28725, 32768, 0],
3523 [7029, 17840, 24528, 32768, 0],
3524 [4867, 13886, 21502, 32768, 0],
3525 [25298, 31892, 32491, 32768, 0],
3526 [17809, 29330, 31512, 32768, 0],
3527 [9668, 21329, 26579, 32768, 0],
3528 [4774, 12956, 18976, 32768, 0],
3529 [2322, 7030, 11540, 32768, 0],
3530 [25472, 31920, 32543, 32768, 0],
3531 [17957, 29387, 31632, 32768, 0],
3532 [9196, 20593, 26400, 32768, 0],
3533 [4680, 12705, 19202, 32768, 0],
3534 [2917, 8456, 13436, 32768, 0],
3535 [26471, 32059, 32574, 32768, 0],
3536 [18458, 29783, 31909, 32768, 0],
3537 [8400, 19464, 25956, 32768, 0],
3538 [3812, 10973, 17206, 32768, 0],
3539 [8192, 16384, 24576, 32768, 0],
3540 [8192, 16384, 24576, 32768, 0],
3541];
3542
3543/// a 4x4 chroma coefficient's base level.
3544pub const COEFF_BASE_CHROMA_4: [[u16; 5]; 42] = [
3545 [10808, 22056, 26896, 32768, 0],
3546 [25739, 32313, 32676, 32768, 0],
3547 [17288, 30203, 32221, 32768, 0],
3548 [11359, 24878, 29896, 32768, 0],
3549 [6949, 17767, 24893, 32768, 0],
3550 [4287, 11796, 18071, 32768, 0],
3551 [27880, 32521, 32705, 32768, 0],
3552 [19038, 31004, 32414, 32768, 0],
3553 [12564, 26345, 30768, 32768, 0],
3554 [8269, 19947, 26779, 32768, 0],
3555 [5674, 14657, 21674, 32768, 0],
3556 [8192, 16384, 24576, 32768, 0],
3557 [8192, 16384, 24576, 32768, 0],
3558 [8192, 16384, 24576, 32768, 0],
3559 [8192, 16384, 24576, 32768, 0],
3560 [8192, 16384, 24576, 32768, 0],
3561 [8192, 16384, 24576, 32768, 0],
3562 [8192, 16384, 24576, 32768, 0],
3563 [8192, 16384, 24576, 32768, 0],
3564 [8192, 16384, 24576, 32768, 0],
3565 [8192, 16384, 24576, 32768, 0],
3566 [25742, 32319, 32671, 32768, 0],
3567 [19557, 31164, 32454, 32768, 0],
3568 [13381, 26381, 30755, 32768, 0],
3569 [10101, 21466, 26722, 32768, 0],
3570 [9209, 19650, 26825, 32768, 0],
3571 [27107, 31917, 32432, 32768, 0],
3572 [18056, 28893, 31203, 32768, 0],
3573 [10200, 21434, 26764, 32768, 0],
3574 [4660, 12913, 19502, 32768, 0],
3575 [2368, 6930, 12504, 32768, 0],
3576 [26960, 32158, 32613, 32768, 0],
3577 [18628, 30005, 32031, 32768, 0],
3578 [10233, 22442, 28232, 32768, 0],
3579 [5471, 14630, 21516, 32768, 0],
3580 [3235, 10767, 17109, 32768, 0],
3581 [27696, 32440, 32692, 32768, 0],
3582 [20032, 31167, 32438, 32768, 0],
3583 [8700, 21341, 28442, 32768, 0],
3584 [5662, 14831, 21795, 32768, 0],
3585 [8192, 16384, 24576, 32768, 0],
3586 [8192, 16384, 24576, 32768, 0],
3587];
3588
3589/// COEFF_BASE_CHROMA_4_Q3, q-context 3: the same table as [`COEFF_BASE_CHROMA_4`], for `base_q_idx` 121..=255.
3590pub const COEFF_BASE_CHROMA_4_Q3: [[u16; 5]; 42] = [
3591 [9320, 22102, 27840, 32768, 0],
3592 [27057, 32464, 32724, 32768, 0],
3593 [16331, 30268, 32309, 32768, 0],
3594 [10319, 23935, 29720, 32768, 0],
3595 [6189, 16448, 24106, 32768, 0],
3596 [3589, 10884, 18808, 32768, 0],
3597 [29026, 32624, 32748, 32768, 0],
3598 [19226, 31507, 32587, 32768, 0],
3599 [12692, 26921, 31203, 32768, 0],
3600 [7049, 19532, 27635, 32768, 0],
3601 [7727, 15669, 23252, 32768, 0],
3602 [8192, 16384, 24576, 32768, 0],
3603 [8192, 16384, 24576, 32768, 0],
3604 [8192, 16384, 24576, 32768, 0],
3605 [8192, 16384, 24576, 32768, 0],
3606 [8192, 16384, 24576, 32768, 0],
3607 [8192, 16384, 24576, 32768, 0],
3608 [8192, 16384, 24576, 32768, 0],
3609 [8192, 16384, 24576, 32768, 0],
3610 [8192, 16384, 24576, 32768, 0],
3611 [8192, 16384, 24576, 32768, 0],
3612 [28056, 32625, 32748, 32768, 0],
3613 [22383, 32075, 32669, 32768, 0],
3614 [15417, 27098, 31749, 32768, 0],
3615 [18127, 26493, 27190, 32768, 0],
3616 [5461, 16384, 21845, 32768, 0],
3617 [27982, 32091, 32584, 32768, 0],
3618 [19045, 29868, 31972, 32768, 0],
3619 [10397, 22266, 27932, 32768, 0],
3620 [5990, 13697, 21500, 32768, 0],
3621 [1792, 6912, 15104, 32768, 0],
3622 [28198, 32501, 32718, 32768, 0],
3623 [21534, 31521, 32569, 32768, 0],
3624 [11109, 25217, 30017, 32768, 0],
3625 [5671, 15124, 26151, 32768, 0],
3626 [4681, 14043, 18725, 32768, 0],
3627 [28688, 32580, 32741, 32768, 0],
3628 [22576, 32079, 32661, 32768, 0],
3629 [10627, 22141, 28340, 32768, 0],
3630 [9362, 14043, 28087, 32768, 0],
3631 [8192, 16384, 24576, 32768, 0],
3632 [8192, 16384, 24576, 32768, 0],
3633];
3634
3635/// COEFF_BASE_EOB_LUMA_8_Q0, q-context 0: the same table as [`COEFF_BASE_EOB_LUMA_8`], for `base_q_idx` 0..=20.
3636pub const COEFF_BASE_EOB_LUMA_8_Q0: [[u16; 4]; 4] = [
3637 [5717, 26477, 32768, 0],
3638 [30491, 31703, 32768, 0],
3639 [31550, 32158, 32768, 0],
3640 [29648, 31491, 32768, 0],
3641];
3642
3643/// COEFF_BASE_EOB_LUMA_8_Q1, q-context 1: the same table as [`COEFF_BASE_EOB_LUMA_8`], for `base_q_idx` 21..=60.
3644pub const COEFF_BASE_EOB_LUMA_8_Q1: [[u16; 4]; 4] = [
3645 [15239, 29932, 32768, 0],
3646 [31315, 32095, 32768, 0],
3647 [32130, 32434, 32768, 0],
3648 [30864, 31996, 32768, 0],
3649];
3650
3651/// the last coefficient's base level, for an 8x8 luma transform.
3652pub const COEFF_BASE_EOB_LUMA_8: [[u16; 4]; 4] = [
3653 [18049, 30489, 32768, 0],
3654 [31706, 32286, 32768, 0],
3655 [32163, 32473, 32768, 0],
3656 [31550, 32184, 32768, 0],
3657];
3658
3659/// COEFF_BASE_EOB_LUMA_8_Q3, q-context 3: the same table as [`COEFF_BASE_EOB_LUMA_8`], for `base_q_idx` 121..=255.
3660pub const COEFF_BASE_EOB_LUMA_8_Q3: [[u16; 4]; 4] = [
3661 [21457, 31043, 32768, 0],
3662 [31951, 32483, 32768, 0],
3663 [32153, 32562, 32768, 0],
3664 [31473, 32215, 32768, 0],
3665];
3666
3667/// COEFF_BASE_EOB_CHROMA_4_Q0, q-context 0: the same table as [`COEFF_BASE_EOB_CHROMA_4`], for `base_q_idx` 0..=20.
3668pub const COEFF_BASE_EOB_CHROMA_4_Q0: [[u16; 4]; 4] = [
3669 [21365, 30026, 32768, 0],
3670 [30512, 32423, 32768, 0],
3671 [31658, 32621, 32768, 0],
3672 [29630, 31881, 32768, 0],
3673];
3674
3675/// COEFF_BASE_EOB_CHROMA_4_Q1, q-context 1: the same table as [`COEFF_BASE_EOB_CHROMA_4`], for `base_q_idx` 21..=60.
3676pub const COEFF_BASE_EOB_CHROMA_4_Q1: [[u16; 4]; 4] = [
3677 [26594, 31212, 32768, 0],
3678 [31208, 32582, 32768, 0],
3679 [31835, 32637, 32768, 0],
3680 [30595, 32206, 32768, 0],
3681];
3682
3683/// the same, for a 4x4 chroma transform.
3684pub const COEFF_BASE_EOB_CHROMA_4: [[u16; 4]; 4] = [
3685 [27258, 31095, 32768, 0],
3686 [31804, 32623, 32768, 0],
3687 [31763, 32528, 32768, 0],
3688 [31438, 32506, 32768, 0],
3689];
3690
3691/// COEFF_BASE_EOB_CHROMA_4_Q3, q-context 3: the same table as [`COEFF_BASE_EOB_CHROMA_4`], for `base_q_idx` 121..=255.
3692pub const COEFF_BASE_EOB_CHROMA_4_Q3: [[u16; 4]; 4] = [
3693 [27877, 31584, 32768, 0],
3694 [32170, 32728, 32768, 0],
3695 [32155, 32688, 32768, 0],
3696 [32219, 32702, 32768, 0],
3697];
3698
3699/// COEFF_BR_LUMA_8_Q0, q-context 0: the same table as [`COEFF_BR_LUMA_8`], for `base_q_idx` 0..=20.
3700pub const COEFF_BR_LUMA_8_Q0: [[u16; 5]; 21] = [
3701 [14406, 20862, 24414, 32768, 0],
3702 [11824, 18907, 23109, 32768, 0],
3703 [8257, 14393, 18803, 32768, 0],
3704 [5860, 10747, 14778, 32768, 0],
3705 [4475, 8486, 11984, 32768, 0],
3706 [3606, 6954, 10043, 32768, 0],
3707 [1736, 3410, 5048, 32768, 0],
3708 [14430, 20046, 22882, 32768, 0],
3709 [15593, 22899, 26709, 32768, 0],
3710 [12102, 19368, 23811, 32768, 0],
3711 [9059, 15584, 20262, 32768, 0],
3712 [6999, 12603, 17048, 32768, 0],
3713 [5684, 10497, 14553, 32768, 0],
3714 [2822, 5438, 7862, 32768, 0],
3715 [15785, 21585, 24359, 32768, 0],
3716 [18347, 25229, 28266, 32768, 0],
3717 [14974, 22487, 26389, 32768, 0],
3718 [11423, 18681, 23271, 32768, 0],
3719 [8863, 15350, 20008, 32768, 0],
3720 [7153, 12852, 17278, 32768, 0],
3721 [3707, 7036, 9982, 32768, 0],
3722];
3723
3724/// COEFF_BR_LUMA_8_Q1, q-context 1: the same table as [`COEFF_BR_LUMA_8`], for `base_q_idx` 21..=60.
3725pub const COEFF_BR_LUMA_8_Q1: [[u16; 5]; 21] = [
3726 [15999, 22208, 25449, 32768, 0],
3727 [13050, 19988, 24122, 32768, 0],
3728 [8594, 14864, 19378, 32768, 0],
3729 [6033, 11079, 15238, 32768, 0],
3730 [4554, 8683, 12347, 32768, 0],
3731 [3672, 7139, 10337, 32768, 0],
3732 [1900, 3771, 5576, 32768, 0],
3733 [15788, 21340, 23949, 32768, 0],
3734 [16825, 24235, 27758, 32768, 0],
3735 [12873, 20402, 24810, 32768, 0],
3736 [9590, 16363, 21094, 32768, 0],
3737 [7352, 13209, 17733, 32768, 0],
3738 [5960, 10989, 15184, 32768, 0],
3739 [3232, 6234, 9007, 32768, 0],
3740 [15761, 20716, 23224, 32768, 0],
3741 [19318, 25989, 28759, 32768, 0],
3742 [15529, 23094, 26929, 32768, 0],
3743 [11662, 18989, 23641, 32768, 0],
3744 [8955, 15568, 20366, 32768, 0],
3745 [7281, 13106, 17708, 32768, 0],
3746 [4248, 8059, 11440, 32768, 0],
3747];
3748
3749/// the base-range tail of an 8x8 luma coefficient.
3750pub const COEFF_BR_LUMA_8: [[u16; 5]; 21] = [
3751 [16214, 22380, 25770, 32768, 0],
3752 [14213, 21304, 25295, 32768, 0],
3753 [9213, 15823, 20455, 32768, 0],
3754 [6395, 11758, 16139, 32768, 0],
3755 [4779, 9187, 13066, 32768, 0],
3756 [3821, 7501, 10953, 32768, 0],
3757 [2293, 4567, 6795, 32768, 0],
3758 [15859, 21283, 23820, 32768, 0],
3759 [18404, 25602, 28726, 32768, 0],
3760 [14325, 21980, 26206, 32768, 0],
3761 [10669, 17937, 22720, 32768, 0],
3762 [8297, 14642, 19447, 32768, 0],
3763 [6746, 12389, 16893, 32768, 0],
3764 [4324, 8251, 11770, 32768, 0],
3765 [16532, 21631, 24475, 32768, 0],
3766 [20667, 27150, 29668, 32768, 0],
3767 [16728, 24510, 28175, 32768, 0],
3768 [12861, 20645, 25332, 32768, 0],
3769 [10076, 17361, 22417, 32768, 0],
3770 [8395, 14940, 19963, 32768, 0],
3771 [5731, 10683, 14912, 32768, 0],
3772];
3773
3774/// COEFF_BR_LUMA_8_Q3, q-context 3: the same table as [`COEFF_BR_LUMA_8`], for `base_q_idx` 121..=255.
3775pub const COEFF_BR_LUMA_8_Q3: [[u16; 5]; 21] = [
3776 [18274, 24813, 27890, 32768, 0],
3777 [15537, 23149, 27003, 32768, 0],
3778 [9449, 16740, 21827, 32768, 0],
3779 [6700, 12498, 17261, 32768, 0],
3780 [4988, 9866, 14198, 32768, 0],
3781 [4236, 8147, 11902, 32768, 0],
3782 [2867, 5860, 8654, 32768, 0],
3783 [17124, 23171, 26101, 32768, 0],
3784 [20396, 27477, 30148, 32768, 0],
3785 [16573, 24629, 28492, 32768, 0],
3786 [12749, 20846, 25674, 32768, 0],
3787 [10233, 17878, 22818, 32768, 0],
3788 [8525, 15332, 20363, 32768, 0],
3789 [6283, 11632, 16255, 32768, 0],
3790 [20466, 26511, 29286, 32768, 0],
3791 [23059, 29174, 31191, 32768, 0],
3792 [19481, 27263, 30241, 32768, 0],
3793 [15458, 23631, 28137, 32768, 0],
3794 [12416, 20608, 25693, 32768, 0],
3795 [10261, 18011, 23261, 32768, 0],
3796 [8016, 14655, 19666, 32768, 0],
3797];
3798
3799/// COEFF_BR_CHROMA_4_Q0, q-context 0: the same table as [`COEFF_BR_CHROMA_4`], for `base_q_idx` 0..=20.
3800pub const COEFF_BR_CHROMA_4_Q0: [[u16; 5]; 21] = [
3801 [15967, 22905, 26286, 32768, 0],
3802 [13534, 20654, 24579, 32768, 0],
3803 [9504, 16092, 20535, 32768, 0],
3804 [6975, 12568, 16903, 32768, 0],
3805 [5364, 10091, 14020, 32768, 0],
3806 [4357, 8370, 11857, 32768, 0],
3807 [2506, 4934, 7218, 32768, 0],
3808 [23032, 28815, 30936, 32768, 0],
3809 [19540, 26704, 29719, 32768, 0],
3810 [15158, 22969, 27097, 32768, 0],
3811 [11408, 18865, 23650, 32768, 0],
3812 [8885, 15448, 20250, 32768, 0],
3813 [7108, 12853, 17416, 32768, 0],
3814 [4231, 8041, 11480, 32768, 0],
3815 [19823, 26490, 29156, 32768, 0],
3816 [18890, 25929, 28932, 32768, 0],
3817 [15660, 23491, 27433, 32768, 0],
3818 [12147, 19776, 24488, 32768, 0],
3819 [9728, 16774, 21649, 32768, 0],
3820 [7919, 14277, 19066, 32768, 0],
3821 [5440, 10170, 14185, 32768, 0],
3822];
3823
3824/// COEFF_BR_CHROMA_4_Q1, q-context 1: the same table as [`COEFF_BR_CHROMA_4`], for `base_q_idx` 21..=60.
3825pub const COEFF_BR_CHROMA_4_Q1: [[u16; 5]; 21] = [
3826 [15571, 22232, 25749, 32768, 0],
3827 [14506, 21575, 25374, 32768, 0],
3828 [10189, 17089, 21569, 32768, 0],
3829 [7316, 13301, 17915, 32768, 0],
3830 [5783, 10912, 15190, 32768, 0],
3831 [4760, 9155, 13088, 32768, 0],
3832 [2993, 5966, 8774, 32768, 0],
3833 [23424, 28903, 30778, 32768, 0],
3834 [20775, 27666, 30290, 32768, 0],
3835 [16474, 24410, 28299, 32768, 0],
3836 [12471, 20180, 24987, 32768, 0],
3837 [9410, 16487, 21439, 32768, 0],
3838 [7536, 13614, 18529, 32768, 0],
3839 [5048, 9586, 13549, 32768, 0],
3840 [21090, 27290, 29756, 32768, 0],
3841 [20796, 27402, 30026, 32768, 0],
3842 [17819, 25485, 28969, 32768, 0],
3843 [13860, 21909, 26462, 32768, 0],
3844 [11002, 18494, 23529, 32768, 0],
3845 [8953, 15929, 20897, 32768, 0],
3846 [6448, 11918, 16454, 32768, 0],
3847];
3848
3849/// the base-range tail of a 4x4 chroma coefficient.
3850pub const COEFF_BR_CHROMA_4: [[u16; 5]; 21] = [
3851 [17394, 24501, 27895, 32768, 0],
3852 [15889, 23420, 27185, 32768, 0],
3853 [11561, 19133, 23870, 32768, 0],
3854 [8285, 14812, 19844, 32768, 0],
3855 [6496, 12043, 16550, 32768, 0],
3856 [4771, 9574, 13677, 32768, 0],
3857 [3603, 6830, 10144, 32768, 0],
3858 [21656, 27704, 30200, 32768, 0],
3859 [21324, 27915, 30511, 32768, 0],
3860 [17327, 25336, 28997, 32768, 0],
3861 [13417, 21381, 26033, 32768, 0],
3862 [10132, 17425, 22338, 32768, 0],
3863 [8580, 15016, 19633, 32768, 0],
3864 [5694, 11477, 16411, 32768, 0],
3865 [24116, 29780, 31450, 32768, 0],
3866 [23853, 29695, 31591, 32768, 0],
3867 [20085, 27614, 30428, 32768, 0],
3868 [15326, 24335, 28575, 32768, 0],
3869 [11814, 19472, 24810, 32768, 0],
3870 [10221, 18611, 24767, 32768, 0],
3871 [7689, 14558, 20321, 32768, 0],
3872];
3873
3874/// COEFF_BR_CHROMA_4_Q3, q-context 3: the same table as [`COEFF_BR_CHROMA_4`], for `base_q_idx` 121..=255.
3875pub const COEFF_BR_CHROMA_4_Q3: [[u16; 5]; 21] = [
3876 [21425, 27952, 30388, 32768, 0],
3877 [18062, 25838, 29034, 32768, 0],
3878 [11956, 19881, 24808, 32768, 0],
3879 [7718, 15000, 20980, 32768, 0],
3880 [5702, 11254, 16143, 32768, 0],
3881 [4898, 9088, 16864, 32768, 0],
3882 [3679, 6776, 11907, 32768, 0],
3883 [23294, 30160, 31663, 32768, 0],
3884 [24397, 29896, 31836, 32768, 0],
3885 [19245, 27128, 30593, 32768, 0],
3886 [13202, 19825, 26404, 32768, 0],
3887 [11578, 19297, 23957, 32768, 0],
3888 [8073, 13297, 21370, 32768, 0],
3889 [5461, 10923, 19745, 32768, 0],
3890 [27367, 30521, 31934, 32768, 0],
3891 [24904, 30671, 31940, 32768, 0],
3892 [23075, 28460, 31299, 32768, 0],
3893 [14400, 23658, 30417, 32768, 0],
3894 [13885, 23882, 28325, 32768, 0],
3895 [14746, 22938, 27853, 32768, 0],
3896 [5461, 16384, 27307, 32768, 0],
3897];
3898
3899/// `Default_Intra_Ext_Tx_Cdf`'s `TX_SET_INTRA_1` (`EXT_TX_SET_DTT4_IDTX_1DDCT`)
3900/// row for `TX_8X8` (spec 9.4): the transform type of an intra 8x8 transform
3901/// when `reduced_tx_set` is false. Unused while this crate's key frames set
3902/// `reduced_tx_set: true` (`get_tx_set`'s intra branch then returns
3903/// `TX_SET_INTRA_2` -- [`INTRA_TX_TYPE_SET2_8`] -- at every size up to 16x16,
3904/// not only 16x16; r11 lane-av1-rect). Kept named for the day a non-reduced
3905/// path exists.
3906pub const INTRA_TX_TYPE_SET1_8: [[u16; 8]; 13] = [
3907 [1870, 13742, 14530, 16498, 23770, 27698, 32768, 0],
3908 [326, 8796, 14632, 15079, 19272, 27486, 32768, 0],
3909 [484, 7576, 7712, 14443, 19159, 22591, 32768, 0],
3910 [1126, 15340, 15895, 17023, 20896, 30279, 32768, 0],
3911 [655, 4854, 5249, 5913, 22099, 27138, 32768, 0],
3912 [1299, 6458, 8885, 9290, 14851, 25497, 32768, 0],
3913 [311, 5295, 5552, 6885, 16107, 22672, 32768, 0],
3914 [883, 8059, 8270, 11258, 17289, 21549, 32768, 0],
3915 [741, 7580, 9318, 10345, 16688, 29046, 32768, 0],
3916 [110, 7406, 7915, 9195, 16041, 23329, 32768, 0],
3917 [363, 7974, 9357, 10673, 15629, 24474, 32768, 0],
3918 [153, 7647, 8112, 9936, 15307, 19996, 32768, 0],
3919 [3511, 6332, 11165, 15335, 19323, 23594, 32768, 0],
3920];
3921
3922/// `Default_Intra_Ext_Tx_Cdf`'s `TX_SET_INTRA_2` (`EXT_TX_SET_DTT4_IDTX`) row
3923/// for `TX_8X8` (spec 9.4, entropymode.c's `eset==2`/`TX_8X8` slot): the
3924/// transform type of an intra 8x8 transform when `reduced_tx_set` is true,
3925/// which this crate's key frames always set. libaom leaves this exact slot
3926/// at the flat 5-way default (unlike its trained `TX_16X16` neighbour,
3927/// [`INTRA_TX_TYPE_SET2_16`]) -- every mode reads the same uniform CDF.
3928pub const INTRA_TX_TYPE_SET2_8: [[u16; 6]; 13] = [[6554, 13107, 19661, 26214, 32768, 0]; 13];
3929/// The full luma sub-range of spec `TXB_SKIP_CONTEXTS` (contexts 0..6, the
3930/// `plane_bsize != tx_size` `skip_contexts[top][left]` table plus its own
3931/// single `plane_bsize == tx_size` context 0), for a `TxMode::Select` block
3932/// whose luma transform is split into several transform units smaller than
3933/// the block itself -- the single-context `TXB_SKIP_LUMA_*` constants above
3934/// stay for every other caller, which only ever reads context 0.
3935pub const TXB_SKIP_LUMA_8_Q0_CTX: [[u16; 3]; 7] = [
3936 [31548, 32768, 0],
3937 [1549, 32768, 0],
3938 [10130, 32768, 0],
3939 [16656, 32768, 0],
3940 [18591, 32768, 0],
3941 [26308, 32768, 0],
3942 [32537, 32768, 0],
3943];
3944pub const TXB_SKIP_LUMA_8_Q1_CTX: [[u16; 3]; 7] = [
3945 [31782, 32768, 0],
3946 [1836, 32768, 0],
3947 [10689, 32768, 0],
3948 [17604, 32768, 0],
3949 [21622, 32768, 0],
3950 [27518, 32768, 0],
3951 [32399, 32768, 0],
3952];
3953pub const TXB_SKIP_LUMA_8_CTX: [[u16; 3]; 7] = [
3954 [31957, 32768, 0],
3955 [3230, 32768, 0],
3956 [11153, 32768, 0],
3957 [18123, 32768, 0],
3958 [20143, 32768, 0],
3959 [26536, 32768, 0],
3960 [31986, 32768, 0],
3961];
3962pub const TXB_SKIP_LUMA_8_Q3_CTX: [[u16; 3]; 7] = [
3963 [31903, 32768, 0],
3964 [2044, 32768, 0],
3965 [7528, 32768, 0],
3966 [14618, 32768, 0],
3967 [16182, 32768, 0],
3968 [24168, 32768, 0],
3969 [31037, 32768, 0],
3970];
3971pub const TXB_SKIP_LUMA_16_Q0_CTX: [[u16; 3]; 7] = [
3972 [29957, 32768, 0],
3973 [5391, 32768, 0],
3974 [18039, 32768, 0],
3975 [23566, 32768, 0],
3976 [22431, 32768, 0],
3977 [25822, 32768, 0],
3978 [32197, 32768, 0],
3979];
3980pub const TXB_SKIP_LUMA_16_Q1_CTX: [[u16; 3]; 7] = [
3981 [31901, 32768, 0],
3982 [10311, 32768, 0],
3983 [18047, 32768, 0],
3984 [24806, 32768, 0],
3985 [23288, 32768, 0],
3986 [27914, 32768, 0],
3987 [32296, 32768, 0],
3988];
3989pub const TXB_SKIP_LUMA_16_CTX: [[u16; 3]; 7] = [
3990 [32363, 32768, 0],
3991 [10692, 32768, 0],
3992 [19090, 32768, 0],
3993 [24357, 32768, 0],
3994 [24442, 32768, 0],
3995 [28312, 32768, 0],
3996 [32169, 32768, 0],
3997];
3998pub const TXB_SKIP_LUMA_16_Q3_CTX: [[u16; 3]; 7] = [
3999 [32510, 32768, 0],
4000 [8430, 32768, 0],
4001 [17318, 32768, 0],
4002 [24154, 32768, 0],
4003 [23674, 32768, 0],
4004 [28789, 32768, 0],
4005 [32139, 32768, 0],
4006];
4007pub const TXB_SKIP_LUMA_32_Q0_CTX: [[u16; 3]; 7] = [
4008 [17920, 32768, 0],
4009 [1818, 32768, 0],
4010 [7282, 32768, 0],
4011 [25273, 32768, 0],
4012 [10923, 32768, 0],
4013 [31554, 32768, 0],
4014 [32624, 32768, 0],
4015];
4016pub const TXB_SKIP_LUMA_32_Q1_CTX: [[u16; 3]; 7] = [
4017 [26726, 32768, 0],
4018 [1045, 32768, 0],
4019 [11703, 32768, 0],
4020 [20590, 32768, 0],
4021 [18554, 32768, 0],
4022 [25970, 32768, 0],
4023 [31938, 32768, 0],
4024];
4025pub const TXB_SKIP_LUMA_32_CTX: [[u16; 3]; 7] = [
4026 [30669, 32768, 0],
4027 [3832, 32768, 0],
4028 [11663, 32768, 0],
4029 [18889, 32768, 0],
4030 [19782, 32768, 0],
4031 [23313, 32768, 0],
4032 [31330, 32768, 0],
4033];
4034pub const TXB_SKIP_LUMA_32_Q3_CTX: [[u16; 3]; 7] = [
4035 [31671, 32768, 0],
4036 [2056, 32768, 0],
4037 [11746, 32768, 0],
4038 [16852, 32768, 0],
4039 [18635, 32768, 0],
4040 [24715, 32768, 0],
4041 [31484, 32768, 0],
4042];
4043pub const TXB_SKIP_LUMA_64_Q0_CTX: [[u16; 3]; 7] = [
4044 [6308, 32768, 0],
4045 [117, 32768, 0],
4046 [1638, 32768, 0],
4047 [2161, 32768, 0],
4048 [16384, 32768, 0],
4049 [10923, 32768, 0],
4050 [30247, 32768, 0],
4051];
4052pub const TXB_SKIP_LUMA_64_Q1_CTX: [[u16; 3]; 7] = [
4053 [26584, 32768, 0],
4054 [188, 32768, 0],
4055 [8847, 32768, 0],
4056 [24519, 32768, 0],
4057 [22938, 32768, 0],
4058 [30583, 32768, 0],
4059 [32608, 32768, 0],
4060];
4061pub const TXB_SKIP_LUMA_64_CTX: [[u16; 3]; 7] = [
4062 [28573, 32768, 0],
4063 [3183, 32768, 0],
4064 [17802, 32768, 0],
4065 [25977, 32768, 0],
4066 [26677, 32768, 0],
4067 [27832, 32768, 0],
4068 [32387, 32768, 0],
4069];
4070pub const TXB_SKIP_LUMA_64_Q3_CTX: [[u16; 3]; 7] = [
4071 [31539, 32768, 0],
4072 [8433, 32768, 0],
4073 [20576, 32768, 0],
4074 [27904, 32768, 0],
4075 [27852, 32768, 0],
4076 [30026, 32768, 0],
4077 [32441, 32768, 0],
4078];
4079
4080// The tables below extend the `_LUMA_8`/`Luma8Set1` straddling-16x16 support
4081// above to a resolved `TX4` (spec `TX_4X4`) luma transform unit: a
4082// `TxMode::Select` 8x8 leaf or 16x16 block whose `tx_depth` read exhausts
4083// down to the smallest size (lane-av1tx4). Extracted byte-exact from
4084// libaom's `token_cdfs.h` `TX_SIZES` idx0 (`TX_4X4`)/`PLANE_TYPES` idx0
4085// (luma), the same indexing method that verified the `_LUMA_8`/`COEFF_BR_LUMA_8`
4086// families above.
4087
4088/// The full luma sub-range of spec `TXB_SKIP_CONTEXTS` (contexts 0..6) for a
4089/// resolved 4x4 luma transform, same convention as [`TXB_SKIP_LUMA_8_CTX`].
4090pub const TXB_SKIP_LUMA_4_Q0_CTX: [[u16; 3]; 7] = [
4091 [31849, 32768, 0],
4092 [5892, 32768, 0],
4093 [12112, 32768, 0],
4094 [21935, 32768, 0],
4095 [20289, 32768, 0],
4096 [27473, 32768, 0],
4097 [32487, 32768, 0],
4098];
4099pub const TXB_SKIP_LUMA_4_Q1_CTX: [[u16; 3]; 7] = [
4100 [30371, 32768, 0],
4101 [7570, 32768, 0],
4102 [13155, 32768, 0],
4103 [20751, 32768, 0],
4104 [20969, 32768, 0],
4105 [27067, 32768, 0],
4106 [32013, 32768, 0],
4107];
4108pub const TXB_SKIP_LUMA_4_CTX: [[u16; 3]; 7] = [
4109 [29614, 32768, 0],
4110 [9068, 32768, 0],
4111 [12924, 32768, 0],
4112 [19538, 32768, 0],
4113 [17737, 32768, 0],
4114 [24619, 32768, 0],
4115 [30642, 32768, 0],
4116];
4117pub const TXB_SKIP_LUMA_4_Q3_CTX: [[u16; 3]; 7] = [
4118 [26887, 32768, 0],
4119 [6729, 32768, 0],
4120 [10361, 32768, 0],
4121 [17442, 32768, 0],
4122 [15045, 32768, 0],
4123 [22478, 32768, 0],
4124 [29072, 32768, 0],
4125];
4126
4127/// The end-of-block group of a 4x4 luma transform (`av1_default_eob_multi16_cdfs`,
4128/// `PLANE_TYPES` idx0 luma).
4129pub const EOB_PT_16_LUMA_Q0: [u16; 6] = [840, 1039, 1980, 4895, 32768, 0];
4130pub const EOB_PT_16_LUMA_Q1: [u16; 6] = [2125, 2551, 5165, 8946, 32768, 0];
4131pub const EOB_PT_16_LUMA: [u16; 6] = [4016, 4897, 8881, 14968, 32768, 0];
4132pub const EOB_PT_16_LUMA_Q3: [u16; 6] = [6708, 8958, 14746, 22133, 32768, 0];
4133
4134/// The `TX_CLASS_HORIZ`/`TX_CLASS_VERT` (non-2D-scan) sibling of
4135/// [`EOB_PT_16_LUMA`] (`av1_default_eob_multi16_cdfs[q][0][1]`) -- read
4136/// instead of the 2D table whenever a 4x4 luma TU's `tx_type` resolves to
4137/// `V_DCT`/`H_DCT` (lane-av1tx4 r5: the class dimension libaom always keeps,
4138/// this crate never carried at all until a real aomdec trace showed the
4139/// desync starting exactly at this read).
4140pub const EOB_PT_16_LUMA_CLASS1_Q0: [u16; 6] = [370, 671, 1883, 4471, 32768, 0];
4141pub const EOB_PT_16_LUMA_CLASS1_Q1: [u16; 6] = [513, 765, 1859, 6339, 32768, 0];
4142pub const EOB_PT_16_LUMA_CLASS1: [u16; 6] = [716, 1105, 2646, 10056, 32768, 0];
4143pub const EOB_PT_16_LUMA_CLASS1_Q3: [u16; 6] = [1222, 2074, 4783, 15410, 32768, 0];
4144
4145// EOB_EXTRA_LUMA_4
4146pub const EOB_EXTRA_LUMA_4_Q0: [[u16; 3]; 9] = [
4147 [16961, 32768, 0],
4148 [17223, 32768, 0],
4149 [7621, 32768, 0],
4150 [16384, 32768, 0],
4151 [16384, 32768, 0],
4152 [16384, 32768, 0],
4153 [16384, 32768, 0],
4154 [16384, 32768, 0],
4155 [16384, 32768, 0],
4156];
4157
4158pub const EOB_EXTRA_LUMA_4_Q1: [[u16; 3]; 9] = [
4159 [17471, 32768, 0],
4160 [20223, 32768, 0],
4161 [11357, 32768, 0],
4162 [16384, 32768, 0],
4163 [16384, 32768, 0],
4164 [16384, 32768, 0],
4165 [16384, 32768, 0],
4166 [16384, 32768, 0],
4167 [16384, 32768, 0],
4168];
4169
4170pub const EOB_EXTRA_LUMA_4: [[u16; 3]; 9] = [
4171 [18983, 32768, 0],
4172 [20512, 32768, 0],
4173 [14885, 32768, 0],
4174 [16384, 32768, 0],
4175 [16384, 32768, 0],
4176 [16384, 32768, 0],
4177 [16384, 32768, 0],
4178 [16384, 32768, 0],
4179 [16384, 32768, 0],
4180];
4181
4182pub const EOB_EXTRA_LUMA_4_Q3: [[u16; 3]; 9] = [
4183 [20177, 32768, 0],
4184 [20789, 32768, 0],
4185 [20262, 32768, 0],
4186 [16384, 32768, 0],
4187 [16384, 32768, 0],
4188 [16384, 32768, 0],
4189 [16384, 32768, 0],
4190 [16384, 32768, 0],
4191 [16384, 32768, 0],
4192];
4193
4194// COEFF_BASE_LUMA_4
4195pub const COEFF_BASE_LUMA_4_Q0: [[u16; 5]; 42] = [
4196 [4034, 8930, 12727, 32768, 0],
4197 [18082, 29741, 31877, 32768, 0],
4198 [12596, 26124, 30493, 32768, 0],
4199 [9446, 21118, 27005, 32768, 0],
4200 [6308, 15141, 21279, 32768, 0],
4201 [2463, 6357, 9783, 32768, 0],
4202 [20667, 30546, 31929, 32768, 0],
4203 [13043, 26123, 30134, 32768, 0],
4204 [8151, 18757, 24778, 32768, 0],
4205 [5255, 12839, 18632, 32768, 0],
4206 [2820, 7206, 11161, 32768, 0],
4207 [8192, 16384, 24576, 32768, 0],
4208 [8192, 16384, 24576, 32768, 0],
4209 [8192, 16384, 24576, 32768, 0],
4210 [8192, 16384, 24576, 32768, 0],
4211 [8192, 16384, 24576, 32768, 0],
4212 [8192, 16384, 24576, 32768, 0],
4213 [8192, 16384, 24576, 32768, 0],
4214 [8192, 16384, 24576, 32768, 0],
4215 [8192, 16384, 24576, 32768, 0],
4216 [8192, 16384, 24576, 32768, 0],
4217 [15736, 27553, 30604, 32768, 0],
4218 [11210, 23794, 28787, 32768, 0],
4219 [5947, 13874, 19701, 32768, 0],
4220 [4215, 9323, 13891, 32768, 0],
4221 [2833, 6462, 10059, 32768, 0],
4222 [19605, 30393, 31582, 32768, 0],
4223 [13523, 26252, 30248, 32768, 0],
4224 [8446, 18622, 24512, 32768, 0],
4225 [3818, 10343, 15974, 32768, 0],
4226 [1481, 4117, 6796, 32768, 0],
4227 [22649, 31302, 32190, 32768, 0],
4228 [14829, 27127, 30449, 32768, 0],
4229 [8313, 17702, 23304, 32768, 0],
4230 [3022, 8301, 12786, 32768, 0],
4231 [1536, 4412, 7184, 32768, 0],
4232 [22354, 29774, 31372, 32768, 0],
4233 [14723, 25472, 29214, 32768, 0],
4234 [6673, 13745, 18662, 32768, 0],
4235 [2068, 5766, 9322, 32768, 0],
4236 [8192, 16384, 24576, 32768, 0],
4237 [8192, 16384, 24576, 32768, 0],
4238];
4239
4240pub const COEFF_BASE_LUMA_4_Q1: [[u16; 5]; 42] = [
4241 [6041, 11854, 15927, 32768, 0],
4242 [20326, 30905, 32251, 32768, 0],
4243 [14164, 26831, 30725, 32768, 0],
4244 [9760, 20647, 26585, 32768, 0],
4245 [6416, 14953, 21219, 32768, 0],
4246 [2966, 7151, 10891, 32768, 0],
4247 [23567, 31374, 32254, 32768, 0],
4248 [14978, 27416, 30946, 32768, 0],
4249 [9434, 20225, 26254, 32768, 0],
4250 [6658, 14558, 20535, 32768, 0],
4251 [3916, 8677, 12989, 32768, 0],
4252 [8192, 16384, 24576, 32768, 0],
4253 [8192, 16384, 24576, 32768, 0],
4254 [8192, 16384, 24576, 32768, 0],
4255 [8192, 16384, 24576, 32768, 0],
4256 [8192, 16384, 24576, 32768, 0],
4257 [8192, 16384, 24576, 32768, 0],
4258 [8192, 16384, 24576, 32768, 0],
4259 [8192, 16384, 24576, 32768, 0],
4260 [8192, 16384, 24576, 32768, 0],
4261 [8192, 16384, 24576, 32768, 0],
4262 [18088, 29545, 31587, 32768, 0],
4263 [13062, 25843, 30073, 32768, 0],
4264 [8940, 16827, 22251, 32768, 0],
4265 [7654, 13220, 17973, 32768, 0],
4266 [5733, 10316, 14456, 32768, 0],
4267 [22879, 31388, 32114, 32768, 0],
4268 [15215, 27993, 30955, 32768, 0],
4269 [9397, 19445, 24978, 32768, 0],
4270 [3442, 9813, 15344, 32768, 0],
4271 [1368, 3936, 6532, 32768, 0],
4272 [25494, 32033, 32406, 32768, 0],
4273 [16772, 27963, 30718, 32768, 0],
4274 [9419, 18165, 23260, 32768, 0],
4275 [2677, 7501, 11797, 32768, 0],
4276 [1516, 4344, 7170, 32768, 0],
4277 [26556, 31454, 32101, 32768, 0],
4278 [17128, 27035, 30108, 32768, 0],
4279 [8324, 15344, 20249, 32768, 0],
4280 [1903, 5696, 9469, 32768, 0],
4281 [8192, 16384, 24576, 32768, 0],
4282 [8192, 16384, 24576, 32768, 0],
4283];
4284
4285pub const COEFF_BASE_LUMA_4: [[u16; 5]; 42] = [
4286 [8896, 16227, 20630, 32768, 0],
4287 [23629, 31782, 32527, 32768, 0],
4288 [15173, 27755, 31321, 32768, 0],
4289 [10158, 21233, 27382, 32768, 0],
4290 [6420, 14857, 21558, 32768, 0],
4291 [3269, 8155, 12646, 32768, 0],
4292 [24835, 32009, 32496, 32768, 0],
4293 [16509, 28421, 31579, 32768, 0],
4294 [10957, 21514, 27418, 32768, 0],
4295 [7881, 15930, 22096, 32768, 0],
4296 [5388, 10960, 15918, 32768, 0],
4297 [8192, 16384, 24576, 32768, 0],
4298 [8192, 16384, 24576, 32768, 0],
4299 [8192, 16384, 24576, 32768, 0],
4300 [8192, 16384, 24576, 32768, 0],
4301 [8192, 16384, 24576, 32768, 0],
4302 [8192, 16384, 24576, 32768, 0],
4303 [8192, 16384, 24576, 32768, 0],
4304 [8192, 16384, 24576, 32768, 0],
4305 [8192, 16384, 24576, 32768, 0],
4306 [8192, 16384, 24576, 32768, 0],
4307 [20745, 30773, 32093, 32768, 0],
4308 [15200, 27221, 30861, 32768, 0],
4309 [13032, 20873, 25667, 32768, 0],
4310 [12285, 18663, 23494, 32768, 0],
4311 [11563, 17481, 21489, 32768, 0],
4312 [26260, 31982, 32320, 32768, 0],
4313 [15397, 28083, 31100, 32768, 0],
4314 [9742, 19217, 24824, 32768, 0],
4315 [3261, 9629, 15362, 32768, 0],
4316 [1480, 4322, 7499, 32768, 0],
4317 [27599, 32256, 32460, 32768, 0],
4318 [16857, 27659, 30774, 32768, 0],
4319 [9551, 18290, 23748, 32768, 0],
4320 [3052, 8933, 14103, 32768, 0],
4321 [2021, 5910, 9787, 32768, 0],
4322 [29005, 32015, 32392, 32768, 0],
4323 [17677, 27694, 30863, 32768, 0],
4324 [9204, 17356, 23219, 32768, 0],
4325 [2403, 7516, 12814, 32768, 0],
4326 [8192, 16384, 24576, 32768, 0],
4327 [8192, 16384, 24576, 32768, 0],
4328];
4329
4330pub const COEFF_BASE_LUMA_4_Q3: [[u16; 5]; 42] = [
4331 [7062, 16472, 22319, 32768, 0],
4332 [24538, 32261, 32674, 32768, 0],
4333 [13675, 28041, 31779, 32768, 0],
4334 [8590, 20674, 27631, 32768, 0],
4335 [5685, 14675, 22013, 32768, 0],
4336 [3655, 9898, 15731, 32768, 0],
4337 [26493, 32418, 32658, 32768, 0],
4338 [16376, 29342, 32090, 32768, 0],
4339 [10594, 22649, 28970, 32768, 0],
4340 [8176, 17170, 24303, 32768, 0],
4341 [5605, 12694, 19139, 32768, 0],
4342 [8192, 16384, 24576, 32768, 0],
4343 [8192, 16384, 24576, 32768, 0],
4344 [8192, 16384, 24576, 32768, 0],
4345 [8192, 16384, 24576, 32768, 0],
4346 [8192, 16384, 24576, 32768, 0],
4347 [8192, 16384, 24576, 32768, 0],
4348 [8192, 16384, 24576, 32768, 0],
4349 [8192, 16384, 24576, 32768, 0],
4350 [8192, 16384, 24576, 32768, 0],
4351 [8192, 16384, 24576, 32768, 0],
4352 [23888, 31902, 32542, 32768, 0],
4353 [18612, 29687, 31987, 32768, 0],
4354 [16245, 24852, 29249, 32768, 0],
4355 [15765, 22608, 27559, 32768, 0],
4356 [19895, 24699, 27510, 32768, 0],
4357 [28401, 32212, 32457, 32768, 0],
4358 [15274, 27825, 30980, 32768, 0],
4359 [9364, 18128, 24332, 32768, 0],
4360 [2283, 8193, 15082, 32768, 0],
4361 [1228, 3972, 7881, 32768, 0],
4362 [29455, 32469, 32620, 32768, 0],
4363 [17981, 28245, 31388, 32768, 0],
4364 [10921, 20098, 26240, 32768, 0],
4365 [3743, 11829, 18657, 32768, 0],
4366 [2374, 9593, 15715, 32768, 0],
4367 [31068, 32466, 32635, 32768, 0],
4368 [20321, 29572, 31971, 32768, 0],
4369 [10771, 20255, 27119, 32768, 0],
4370 [2795, 10410, 17361, 32768, 0],
4371 [8192, 16384, 24576, 32768, 0],
4372 [8192, 16384, 24576, 32768, 0],
4373];
4374
4375// COEFF_BASE_EOB_LUMA_4
4376pub const COEFF_BASE_EOB_LUMA_4_Q0: [[u16; 4]; 4] = [
4377 [17837, 29055, 32768, 0],
4378 [29600, 31446, 32768, 0],
4379 [30844, 31878, 32768, 0],
4380 [24926, 28948, 32768, 0],
4381];
4382
4383pub const COEFF_BASE_EOB_LUMA_4_Q1: [[u16; 4]; 4] = [
4384 [17560, 29888, 32768, 0],
4385 [29671, 31549, 32768, 0],
4386 [31007, 32056, 32768, 0],
4387 [27286, 30006, 32768, 0],
4388];
4389
4390pub const COEFF_BASE_EOB_LUMA_4: [[u16; 4]; 4] = [
4391 [20092, 30774, 32768, 0],
4392 [30695, 32020, 32768, 0],
4393 [31131, 32103, 32768, 0],
4394 [28666, 30870, 32768, 0],
4395];
4396
4397pub const COEFF_BASE_EOB_LUMA_4_Q3: [[u16; 4]; 4] = [
4398 [22497, 31198, 32768, 0],
4399 [31715, 32495, 32768, 0],
4400 [31606, 32337, 32768, 0],
4401 [30388, 31990, 32768, 0],
4402];
4403
4404// COEFF_BR_LUMA_4
4405pub const COEFF_BR_LUMA_4_Q0: [[u16; 5]; 21] = [
4406 [14298, 20718, 24174, 32768, 0],
4407 [12536, 19601, 23789, 32768, 0],
4408 [8712, 15051, 19503, 32768, 0],
4409 [6170, 11327, 15434, 32768, 0],
4410 [4742, 8926, 12538, 32768, 0],
4411 [3803, 7317, 10546, 32768, 0],
4412 [1696, 3317, 4871, 32768, 0],
4413 [14392, 19951, 22756, 32768, 0],
4414 [15978, 23218, 26818, 32768, 0],
4415 [12187, 19474, 23889, 32768, 0],
4416 [9176, 15640, 20259, 32768, 0],
4417 [7068, 12655, 17028, 32768, 0],
4418 [5656, 10442, 14472, 32768, 0],
4419 [2580, 4992, 7244, 32768, 0],
4420 [12136, 18049, 21426, 32768, 0],
4421 [13784, 20721, 24481, 32768, 0],
4422 [10836, 17621, 21900, 32768, 0],
4423 [8372, 14444, 18847, 32768, 0],
4424 [6523, 11779, 16000, 32768, 0],
4425 [5337, 9898, 13760, 32768, 0],
4426 [3034, 5860, 8462, 32768, 0],
4427];
4428
4429pub const COEFF_BR_LUMA_4_Q1: [[u16; 5]; 21] = [
4430 [14995, 21341, 24749, 32768, 0],
4431 [13158, 20289, 24601, 32768, 0],
4432 [8941, 15326, 19876, 32768, 0],
4433 [6297, 11541, 15807, 32768, 0],
4434 [4817, 9029, 12776, 32768, 0],
4435 [3731, 7273, 10627, 32768, 0],
4436 [1847, 3617, 5354, 32768, 0],
4437 [14472, 19659, 22343, 32768, 0],
4438 [16806, 24162, 27533, 32768, 0],
4439 [12900, 20404, 24713, 32768, 0],
4440 [9411, 16112, 20797, 32768, 0],
4441 [7056, 12697, 17148, 32768, 0],
4442 [5544, 10339, 14460, 32768, 0],
4443 [2954, 5704, 8319, 32768, 0],
4444 [12464, 18071, 21354, 32768, 0],
4445 [15482, 22528, 26034, 32768, 0],
4446 [12070, 19269, 23624, 32768, 0],
4447 [8953, 15406, 20106, 32768, 0],
4448 [7027, 12730, 17220, 32768, 0],
4449 [5887, 10913, 15140, 32768, 0],
4450 [3793, 7278, 10447, 32768, 0],
4451];
4452
4453pub const COEFF_BR_LUMA_4: [[u16; 5]; 21] = [
4454 [16138, 22223, 25509, 32768, 0],
4455 [15347, 22430, 26332, 32768, 0],
4456 [9614, 16736, 21332, 32768, 0],
4457 [6600, 12275, 16907, 32768, 0],
4458 [4811, 9424, 13547, 32768, 0],
4459 [3748, 7809, 11420, 32768, 0],
4460 [2254, 4587, 6890, 32768, 0],
4461 [15196, 20284, 23177, 32768, 0],
4462 [18317, 25469, 28451, 32768, 0],
4463 [13918, 21651, 25842, 32768, 0],
4464 [10052, 17150, 21995, 32768, 0],
4465 [7499, 13630, 18587, 32768, 0],
4466 [6158, 11417, 16003, 32768, 0],
4467 [4014, 7785, 11252, 32768, 0],
4468 [15048, 21067, 24384, 32768, 0],
4469 [18202, 25346, 28553, 32768, 0],
4470 [14302, 22019, 26356, 32768, 0],
4471 [10839, 18139, 23166, 32768, 0],
4472 [8715, 15744, 20806, 32768, 0],
4473 [7536, 13576, 18544, 32768, 0],
4474 [5413, 10335, 14498, 32768, 0],
4475];
4476
4477pub const COEFF_BR_LUMA_4_Q3: [[u16; 5]; 21] = [
4478 [18315, 24289, 27551, 32768, 0],
4479 [16854, 24068, 27835, 32768, 0],
4480 [10140, 17927, 23173, 32768, 0],
4481 [6722, 12982, 18267, 32768, 0],
4482 [4661, 9826, 14706, 32768, 0],
4483 [3832, 8165, 12294, 32768, 0],
4484 [2795, 6098, 9245, 32768, 0],
4485 [17145, 23326, 26672, 32768, 0],
4486 [20733, 27680, 30308, 32768, 0],
4487 [16032, 24461, 28546, 32768, 0],
4488 [11653, 20093, 25081, 32768, 0],
4489 [9290, 16429, 22086, 32768, 0],
4490 [7796, 14598, 19982, 32768, 0],
4491 [6502, 12378, 17441, 32768, 0],
4492 [21681, 27732, 30320, 32768, 0],
4493 [22389, 29044, 31261, 32768, 0],
4494 [19027, 26731, 30087, 32768, 0],
4495 [14739, 23755, 28624, 32768, 0],
4496 [11358, 20778, 25511, 32768, 0],
4497 [10995, 18073, 24190, 32768, 0],
4498 [9162, 14990, 20617, 32768, 0],
4499];
4500
4501/// `Default_Intra_Ext_Tx_Cdf`'s `TX_SET_INTRA_1` row for `TX_4X4` (spec
4502/// 9.4): the transform type of an intra 4x4 transform when `reduced_tx_set`
4503/// is false. Same `Luma8`/`Luma8Set1` split as [`INTRA_TX_TYPE_SET1_8`],
4504/// kept named for the day a non-reduced path exists.
4505pub const INTRA_TX_TYPE_SET1_4: [[u16; 8]; 13] = [
4506 [1535, 8035, 9461, 12751, 23467, 27825, 32768, 0],
4507 [564, 3335, 9709, 10870, 18143, 28094, 32768, 0],
4508 [672, 3247, 3676, 11982, 19415, 23127, 32768, 0],
4509 [5279, 13885, 15487, 18044, 23527, 30252, 32768, 0],
4510 [4423, 6074, 7985, 10416, 25693, 29298, 32768, 0],
4511 [1486, 4241, 9460, 10662, 16456, 27694, 32768, 0],
4512 [439, 2838, 3522, 6737, 18058, 23754, 32768, 0],
4513 [1190, 4233, 4855, 11670, 20281, 24377, 32768, 0],
4514 [1045, 4312, 8647, 10159, 18644, 29335, 32768, 0],
4515 [202, 3734, 4747, 7298, 17127, 24016, 32768, 0],
4516 [447, 4312, 6819, 8884, 16010, 23858, 32768, 0],
4517 [277, 4369, 5255, 8905, 16465, 22271, 32768, 0],
4518 [3409, 5436, 10599, 15599, 19687, 24040, 32768, 0],
4519];