forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB00c1b3fTahinli2 months ago1999 commits

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