forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

mod.rs3729 lines, 146.7 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
22/// Default CDF table `PARTITION_W64` (AV1 spec 9.4 initial probabilities).
23pub const PARTITION_W64: [[u16; 11]; 4] = [
24 [
25 20137, 21547, 23078, 29566, 29837, 30261, 30524, 30892, 31724, 32768, 0,
26 ],
27 [
28 6732, 7490, 9497, 27944, 28250, 28515, 28969, 29630, 30104, 32768, 0,
29 ],
30 [
31 5945, 7663, 8348, 28683, 29117, 29749, 30064, 30298, 32238, 32768, 0,
32 ],
33 [
34 870, 1212, 1487, 31198, 31394, 31574, 31743, 31881, 32332, 32768, 0,
35 ],
36];
37
38/// `Default_Skip_Cdf` (spec 9.4): indexed by how many of the blocks above
39/// and left were skipped.
40/// `default_txfm_partition_cdf` (entropymode.c): an inter block's
41/// `txfm_split` flag (spec 5.11.17 `read_var_tx_size`), indexed by
42/// `txfm_partition_context` -- `category * 3 + above + left`, 21 contexts.
43pub const TXFM_PARTITION: [[u16; 3]; 21] = [
44 [28581, 32768, 0],
45 [23846, 32768, 0],
46 [20847, 32768, 0],
47 [24315, 32768, 0],
48 [18196, 32768, 0],
49 [12133, 32768, 0],
50 [18791, 32768, 0],
51 [10887, 32768, 0],
52 [11005, 32768, 0],
53 [27179, 32768, 0],
54 [20004, 32768, 0],
55 [11281, 32768, 0],
56 [26549, 32768, 0],
57 [19308, 32768, 0],
58 [14224, 32768, 0],
59 [28015, 32768, 0],
60 [21546, 32768, 0],
61 [14400, 32768, 0],
62 [28165, 32768, 0],
63 [22401, 32768, 0],
64 [16088, 32768, 0],
65];
66
67/// Default CDF table `SKIP` (AV1 spec 9.4 initial probabilities).
68pub const SKIP: [[u16; 3]; 3] = [[31671, 32768, 0], [16515, 32768, 0], [4576, 32768, 0]];
69
70/// `Default_Intra_Frame_Y_Mode_Cdf` (spec 9.4): the thirteen luma intra
71/// modes of a key frame, indexed by the mode context of the block above and
72/// then of the block to the left.
73pub const KF_Y_MODE: [[[u16; 14]; 5]; 5] = [
74 [
75 [
76 15588, 17027, 19338, 20218, 20682, 21110, 21825, 23244, 24189, 28165, 29093, 30466,
77 32768, 0,
78 ],
79 [
80 12016, 18066, 19516, 20303, 20719, 21444, 21888, 23032, 24434, 28658, 30172, 31409,
81 32768, 0,
82 ],
83 [
84 10052, 10771, 22296, 22788, 23055, 23239, 24133, 25620, 26160, 29336, 29929, 31567,
85 32768, 0,
86 ],
87 [
88 14091, 15406, 16442, 18808, 19136, 19546, 19998, 22096, 24746, 29585, 30958, 32462,
89 32768, 0,
90 ],
91 [
92 12122, 13265, 15603, 16501, 18609, 20033, 22391, 25583, 26437, 30261, 31073, 32475,
93 32768, 0,
94 ],
95 ],
96 [
97 [
98 10023, 19585, 20848, 21440, 21832, 22760, 23089, 24023, 25381, 29014, 30482, 31436,
99 32768, 0,
100 ],
101 [
102 5983, 24099, 24560, 24886, 25066, 25795, 25913, 26423, 27610, 29905, 31276, 31794,
103 32768, 0,
104 ],
105 [
106 7444, 12781, 20177, 20728, 21077, 21607, 22170, 23405, 24469, 27915, 29090, 30492,
107 32768, 0,
108 ],
109 [
110 8537, 14689, 15432, 17087, 17408, 18172, 18408, 19825, 24649, 29153, 31096, 32210,
111 32768, 0,
112 ],
113 [
114 7543, 14231, 15496, 16195, 17905, 20717, 21984, 24516, 26001, 29675, 30981, 31994,
115 32768, 0,
116 ],
117 ],
118 [
119 [
120 12613, 13591, 21383, 22004, 22312, 22577, 23401, 25055, 25729, 29538, 30305, 32077,
121 32768, 0,
122 ],
123 [
124 9687, 13470, 18506, 19230, 19604, 20147, 20695, 22062, 23219, 27743, 29211, 30907,
125 32768, 0,
126 ],
127 [
128 6183, 6505, 26024, 26252, 26366, 26434, 27082, 28354, 28555, 30467, 30794, 32086,
129 32768, 0,
130 ],
131 [
132 10718, 11734, 14954, 17224, 17565, 17924, 18561, 21523, 23878, 28975, 30287, 32252,
133 32768, 0,
134 ],
135 [
136 9194, 9858, 16501, 17263, 18424, 19171, 21563, 25961, 26561, 30072, 30737, 32463,
137 32768, 0,
138 ],
139 ],
140 [
141 [
142 12602, 14399, 15488, 18381, 18778, 19315, 19724, 21419, 25060, 29696, 30917, 32409,
143 32768, 0,
144 ],
145 [
146 8203, 13821, 14524, 17105, 17439, 18131, 18404, 19468, 25225, 29485, 31158, 32342,
147 32768, 0,
148 ],
149 [
150 8451, 9731, 15004, 17643, 18012, 18425, 19070, 21538, 24605, 29118, 30078, 32018,
151 32768, 0,
152 ],
153 [
154 7714, 9048, 9516, 16667, 16817, 16994, 17153, 18767, 26743, 30389, 31536, 32528, 32768,
155 0,
156 ],
157 [
158 8843, 10280, 11496, 15317, 16652, 17943, 19108, 22718, 25769, 29953, 30983, 32485,
159 32768, 0,
160 ],
161 ],
162 [
163 [
164 12578, 13671, 15979, 16834, 19075, 20913, 22989, 25449, 26219, 30214, 31150, 32477,
165 32768, 0,
166 ],
167 [
168 9563, 13626, 15080, 15892, 17756, 20863, 22207, 24236, 25380, 29653, 31143, 32277,
169 32768, 0,
170 ],
171 [
172 8356, 8901, 17616, 18256, 19350, 20106, 22598, 25947, 26466, 29900, 30523, 32261,
173 32768, 0,
174 ],
175 [
176 10835, 11815, 13124, 16042, 17018, 18039, 18947, 22753, 24615, 29489, 30883, 32482,
177 32768, 0,
178 ],
179 [
180 7618, 8288, 9859, 10509, 15386, 18657, 22903, 28776, 29180, 31355, 31802, 32593, 32768,
181 0,
182 ],
183 ],
184];
185
186/// `Default_Uv_Mode_Cdf` (spec 9.4) for blocks where chroma from luma is not
187/// allowed: the thirteen chroma intra modes, indexed by the luma mode.
188pub const UV_MODE_NO_CFL: [[u16; 14]; 13] = [
189 [
190 22631, 24152, 25378, 25661, 25986, 26520, 27055, 27923, 28244, 30059, 30941, 31961, 32768,
191 0,
192 ],
193 [
194 9513, 26881, 26973, 27046, 27118, 27664, 27739, 27824, 28359, 29505, 29800, 31796, 32768, 0,
195 ],
196 [
197 9845, 9915, 28663, 28704, 28757, 28780, 29198, 29822, 29854, 30764, 31777, 32029, 32768, 0,
198 ],
199 [
200 13639, 13897, 14171, 25331, 25606, 25727, 25953, 27148, 28577, 30612, 31355, 32493, 32768,
201 0,
202 ],
203 [
204 9764, 9835, 9930, 9954, 25386, 27053, 27958, 28148, 28243, 31101, 31744, 32363, 32768, 0,
205 ],
206 [
207 11825, 13589, 13677, 13720, 15048, 29213, 29301, 29458, 29711, 31161, 31441, 32550, 32768,
208 0,
209 ],
210 [
211 14175, 14399, 16608, 16821, 17718, 17775, 28551, 30200, 30245, 31837, 32342, 32667, 32768,
212 0,
213 ],
214 [
215 12885, 13038, 14978, 15590, 15673, 15748, 16176, 29128, 29267, 30643, 31961, 32461, 32768,
216 0,
217 ],
218 [
219 12026, 13661, 13874, 15305, 15490, 15726, 15995, 16273, 28443, 30388, 30767, 32416, 32768,
220 0,
221 ],
222 [
223 19052, 19840, 20579, 20916, 21150, 21467, 21885, 22719, 23174, 28861, 30379, 32175, 32768,
224 0,
225 ],
226 [
227 18627, 19649, 20974, 21219, 21492, 21816, 22199, 23119, 23527, 27053, 31397, 32148, 32768,
228 0,
229 ],
230 [
231 17026, 19004, 19997, 20339, 20586, 21103, 21349, 21907, 22482, 25896, 26541, 31819, 32768,
232 0,
233 ],
234 [
235 12124, 13759, 14959, 14992, 15007, 15051, 15078, 15166, 15255, 15753, 16039, 16606, 32768,
236 0,
237 ],
238];
239
240// The coefficient CDFs below are the q-context-2 tables (`base_q_idx` 61..=120,
241// spec 8.3.2's `Default_..._Cdf[2]`), which is the context the frames this
242// crate writes today sit in. The other three sets arrive with the rate control
243// that can leave that band.
244
245/// `Default_Txb_Skip_Cdf[2][4][0]` (spec 9.4): the all-zero flag of a 64x64
246/// luma transform block whose block size is the transform size, so its
247/// context is 0.
248pub const TXB_SKIP_LUMA_64: [u16; 3] = [28573, 32768, 0];
249
250/// `Default_Txb_Skip_Cdf[2][3][7]` (spec 9.4): the all-zero flag of a 32x32
251/// chroma transform block that covers its whole plane block with no coded
252/// neighbour, which is context 7.
253pub const TXB_SKIP_CHROMA_32_NONE: [u16; 3] = [5124, 32768, 0];
254
255/// `Default_Eob_Pt_1024_Cdf[2][0][0]` (spec 9.4): the end-of-block position
256/// token of a luma transform block with 1024 coded coefficient positions —
257/// what a 64x64 transform has, since only its top-left 32x32 is coded.
258pub const EOB_PT_1024_LUMA: [u16; 12] = [
259 2784, 3831, 7041, 10521, 14847, 18844, 23155, 26682, 29229, 31045, 32768, 0,
260];
261
262/// `Default_Coeff_Base_Eob_Cdf[2][4][0][0]` (spec 9.4): the level of the last
263/// coefficient of a 64x64 luma transform block, less one, when that
264/// coefficient is the DC.
265pub const COEFF_BASE_EOB_LUMA_64_DC: [u16; 4] = [935, 3382, 32768, 0];
266
267/// `av1_default_eob_multi512_cdfs[2][0][0]` (`token_cdfs.h:829-906`,
268/// lane-rectwire): the end-of-block group of a luma transform with 512 coded
269/// positions -- what a true 32x16/16x32 rectangular transform has
270/// (`txsize_log2_minus4` = 5, `common_data.h:346`), distinct from
271/// [`EOB_PT_1024_LUMA`]'s 1024-position group a *square* 32x32 reads.
272pub const EOB_PT_512_LUMA: [u16; 11] = [
273 2624, 3936, 6480, 9686, 13979, 17726, 23267, 28410, 31078, 32768, 0,
274];
275/// [`EOB_PT_512_LUMA`], q-context 0 (`base_q_idx` 0..=20).
276pub const EOB_PT_512_LUMA_Q0: [u16; 11] = [
277 641, 983, 3707, 5430, 10234, 14958, 18788, 23412, 26061, 32768, 0,
278];
279/// [`EOB_PT_512_LUMA`], q-context 1 (`base_q_idx` 21..=60).
280pub const EOB_PT_512_LUMA_Q1: [u16; 11] = [
281 1230, 2278, 5035, 7776, 11871, 15346, 19590, 24584, 28749, 32768, 0,
282];
283/// [`EOB_PT_512_LUMA`], q-context 3 (`base_q_idx` 121..=255).
284pub const EOB_PT_512_LUMA_Q3: [u16; 11] = [
285 5927, 7809, 10923, 14597, 19439, 24135, 28456, 31142, 32060, 32768, 0,
286];
287
288/// `av1_default_eob_multi128_cdfs[2][1][0]` (`token_cdfs.h:829-906`,
289/// lane-rectwire): the end-of-block group of a chroma transform with 128
290/// coded positions -- what a true 16x8/8x16 rectangular transform has
291/// (`txsize_log2_minus4` = 3), distinct from [`EOB_PT_256_CHROMA`]'s
292/// 256-position group a *square* 16x16 reads.
293pub const EOB_PT_128_CHROMA: [u16; 9] = [13627, 16246, 20173, 24429, 27948, 30415, 31863, 32768, 0];
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/// [`EOB_PT_128_CHROMA`], q-context 1.
298pub const EOB_PT_128_CHROMA_Q1: [u16; 9] =
299 [8045, 11200, 15497, 19595, 23948, 27408, 30938, 32768, 0];
300/// [`EOB_PT_128_CHROMA`], q-context 3.
301pub const EOB_PT_128_CHROMA_Q3: [u16; 9] =
302 [24313, 26062, 28385, 30107, 31217, 31898, 32345, 32768, 0];
303
304/// `av1_default_eob_multi128_cdfs[2][0][0]` (`token_cdfs.h:830-849`,
305/// lane-rectx): the end-of-block group of a LUMA transform with 128 coded
306/// positions -- what a true 16x8/8x16 rectangular transform has
307/// (`decode_leaf_rect`'s own leaf, one level below [`EOB_PT_512_LUMA`]'s
308/// 32x16/16x32), distinct from [`EOB_PT_256_LUMA`]'s 256-position group a
309/// *square* 16x16 reads. Read straight from the plane-0 half of the same
310/// `token_cdfs.h` table [`EOB_PT_128_CHROMA`] reads its plane-1 half from.
311pub const EOB_PT_128_LUMA: [u16; 9] = [1366, 1738, 2527, 5016, 9355, 15797, 24643, 32768, 0];
312/// [`EOB_PT_128_LUMA`], q-context 0.
313pub const EOB_PT_128_LUMA_Q0: [u16; 9] = [219, 482, 1140, 2091, 3680, 6028, 12586, 32768, 0];
314/// [`EOB_PT_128_LUMA`], q-context 1.
315pub const EOB_PT_128_LUMA_Q1: [u16; 9] = [685, 933, 1488, 2714, 4766, 8562, 19254, 32768, 0];
316/// [`EOB_PT_128_LUMA`], q-context 3.
317pub const EOB_PT_128_LUMA_Q3: [u16; 9] = [3472, 4885, 7489, 12481, 18517, 24536, 29635, 32768, 0];
318
319/// `av1_default_eob_multi32_cdfs[2][1][0]` (`token_cdfs.h:792-808`,
320/// lane-rectx): the end-of-block group of a CHROMA transform with 32 coded
321/// positions -- what a true 8x4/4x8 rectangular transform has (the chroma
322/// plane of a [`decode_leaf_rect`] 16x8/8x16 luma strip), distinct from
323/// [`EOB_PT_16_CHROMA`]'s 16-position group a *square* 4x4 reads.
324pub const EOB_PT_32_CHROMA: [u16; 7] = [13468, 16303, 20361, 25105, 29281, 32768, 0];
325/// [`EOB_PT_32_CHROMA`], q-context 0.
326pub const EOB_PT_32_CHROMA_Q0: [u16; 7] = [2636, 4273, 7588, 11794, 20401, 32768, 0];
327/// [`EOB_PT_32_CHROMA`], q-context 1.
328pub const EOB_PT_32_CHROMA_Q1: [u16; 7] = [8394, 10352, 13932, 18855, 26014, 32768, 0];
329/// [`EOB_PT_32_CHROMA`], q-context 3.
330pub const EOB_PT_32_CHROMA_Q3: [u16; 7] = [22086, 24282, 27010, 29770, 31743, 32768, 0];
331
332/// `av1_default_eob_multi512_cdfs[2][1][0]` (`token_cdfs.h:874-901`,
333/// lane-part32 r4): the end-of-block group of a CHROMA transform with 512
334/// coded positions -- what a 32x16/16x32 chroma transform has (the chroma
335/// plane of an intra `PARTITION_HORZ`/`VERT` 64x32/32x64 superblock strip,
336/// whose luma coefficients truncate to the 64x64-superblock's own 32x32
337/// corner-scan (`TxbSet::Luma64`) but whose *chroma* plane, at 32x16, is
338/// small enough that no truncation applies).
339///
340/// lane-sbpart originally transcribed the `[1][1]` row -- the
341/// `TX_CLASS_HORIZ`/`VERT` (1D) sibling, whose default IS the flat
342/// `3277, 6554, ...` ramp at every q-context -- and wrote that flatness into
343/// this comment as a property of the whole table. The 2D row this decoder
344/// actually reads is q-dependent like every other `EOB_PT_*` family, so a
345/// real `--cq-level=45` stream (q-context 3) read the wrong CDF and desynced
346/// the tile at the first 32x16 chroma transform of the first SB-level
347/// HORZ/VERT strip.
348pub const EOB_PT_512_CHROMA: [u16; 11] = [
349 12015, 14769, 19588, 22052, 24222, 25812, 27300, 29219, 32114, 32768, 0,
350];
351/// [`EOB_PT_512_CHROMA`], q-context 0 (`base_q_idx` 0..=20).
352pub const EOB_PT_512_CHROMA_Q0: [u16; 11] = [
353 5095, 6446, 9996, 13354, 16017, 17986, 20919, 26129, 29140, 32768, 0,
354];
355/// [`EOB_PT_512_CHROMA`], q-context 1 (`base_q_idx` 21..=60).
356pub const EOB_PT_512_CHROMA_Q1: [u16; 11] = [
357 7265, 9979, 15819, 19250, 21780, 23846, 26478, 28396, 31811, 32768, 0,
358];
359/// [`EOB_PT_512_CHROMA`], q-context 3 (`base_q_idx` 121..=255).
360pub const EOB_PT_512_CHROMA_Q3: [u16; 11] = [
361 21093, 23043, 25742, 27658, 29097, 29716, 30073, 30820, 31956, 32768, 0,
362];
363
364/// `Default_Dc_Sign_Cdf[2][0]` (spec 9.4): the sign of a luma DC coefficient,
365/// indexed by whether the neighbouring blocks' DC signs lean negative (1),
366/// positive (2) or neither (0).
367pub const DC_SIGN_LUMA: [[u16; 3]; 3] = [[16000, 32768, 0], [13056, 32768, 0], [18816, 32768, 0]];
368
369/// `Default_Partition_W32_Cdf` (spec 9.4): the ten partition types of a
370/// 32x32 block, indexed by the context the blocks above and left give.
371pub const PARTITION_W32: [[u16; 11]; 4] = [
372 [
373 18462, 20920, 23124, 27647, 28227, 29049, 29519, 30178, 31544, 32768, 0,
374 ],
375 [
376 7689, 9060, 12056, 24992, 25660, 26182, 26951, 28041, 29052, 32768, 0,
377 ],
378 [
379 6015, 9009, 10062, 24544, 25409, 26545, 27071, 27526, 32047, 32768, 0,
380 ],
381 [
382 1394, 2208, 2796, 28614, 29061, 29466, 29840, 30185, 31899, 32768, 0,
383 ],
384];
385
386/// `Default_Uv_Mode_Cfl_Allowed_Cdf` (spec 9.4): the fourteen chroma intra
387/// modes — the thirteen the CFL-free table has, plus chroma from luma —
388/// indexed by the luma mode of the same block. A block of 32x32 or smaller is
389/// offered CFL, so it reads this table where a 64x64 block reads
390/// [`UV_MODE_NO_CFL`].
391pub const UV_MODE_CFL: [[u16; 15]; 13] = [
392 [
393 10407, 11208, 12900, 13181, 13823, 14175, 14899, 15656, 15986, 20086, 20995, 22455, 24212,
394 32768, 0,
395 ],
396 [
397 4532, 19780, 20057, 20215, 20428, 21071, 21199, 21451, 22099, 24228, 24693, 27032, 29472,
398 32768, 0,
399 ],
400 [
401 5273, 5379, 20177, 20270, 20385, 20439, 20949, 21695, 21774, 23138, 24256, 24703, 26679,
402 32768, 0,
403 ],
404 [
405 6740, 7167, 7662, 14152, 14536, 14785, 15034, 16741, 18371, 21520, 22206, 23389, 24182,
406 32768, 0,
407 ],
408 [
409 4987, 5368, 5928, 6068, 19114, 20315, 21857, 22253, 22411, 24911, 25380, 26027, 26376,
410 32768, 0,
411 ],
412 [
413 5370, 6889, 7247, 7393, 9498, 21114, 21402, 21753, 21981, 24780, 25386, 26517, 27176,
414 32768, 0,
415 ],
416 [
417 4816, 4961, 7204, 7326, 8765, 8930, 20169, 20682, 20803, 23188, 23763, 24455, 24940, 32768,
418 0,
419 ],
420 [
421 6608, 6740, 8529, 9049, 9257, 9356, 9735, 18827, 19059, 22336, 23204, 23964, 24793, 32768,
422 0,
423 ],
424 [
425 5998, 7419, 7781, 8933, 9255, 9549, 9753, 10417, 18898, 22494, 23139, 24764, 25989, 32768,
426 0,
427 ],
428 [
429 10660, 11298, 12550, 12957, 13322, 13624, 14040, 15004, 15534, 20714, 21789, 23443, 24861,
430 32768, 0,
431 ],
432 [
433 10522, 11530, 12552, 12963, 13378, 13779, 14245, 15235, 15902, 20102, 22696, 23774, 25838,
434 32768, 0,
435 ],
436 [
437 10099, 10691, 12639, 13049, 13386, 13665, 14125, 15163, 15636, 19676, 20474, 23519, 25208,
438 32768, 0,
439 ],
440 [
441 3144, 5087, 7382, 7504, 7593, 7690, 7801, 8064, 8232, 9248, 9875, 10521, 29048, 32768, 0,
442 ],
443];
444
445/// `Default_Cfl_Sign_Cdf` (spec 9.4): the joint sign of a `UV_CFL_PRED`
446/// block's U/V alpha (spec 5.11.45's `cfl_alpha_signs`) — libaom's
447/// `default_cfl_sign_cdf` (entropymode.c), whose `AOM_CDF8(a0..a6)` arguments
448/// are this convention's cumulative points verbatim (only the *storage*, not
449/// the spec's own table, is `AOM_ICDF`-inverted).
450pub const CFL_SIGN: [u16; 9] = [1418, 2123, 13340, 18405, 26972, 28343, 32294, 32768, 0];
451
452/// `default_filter_intra_cdfs` (entropymode.c), the `use_filter_intra` flag's
453/// prior, indexed by block-size class: `[0]`=4x4, `[1]`=8x8, `[2]`=16x16,
454/// `[3]`=32x32 -- the only square sizes `av1_filter_intra_allowed_bsize`
455/// (width and height both <=32) ever offers this decoder's square blocks.
456/// `[4]`/`[5]` (lane-intradisp r1) add `BLOCK_32X16`/`BLOCK_16X32`'s own rows
457/// (12756/14301, `default_filter_intra_cdfs` index 8/7) -- the two rect
458/// strips `PARTITION_HORZ`/`PARTITION_VERT` decode, each with its own
459/// distinct default probability from every square class above.
460/// `[6]`/`[7]` (lane-rectx r3) add `BLOCK_16X8`/`BLOCK_8X16`'s own rows
461/// (9394/12551, `default_filter_intra_cdfs` index 5/4) -- the 16x8/8x16
462/// strips [`crate::decode`]'s `decode_leaf_rect` codes. Missing them meant
463/// the flag was never read at that size at all (libaom reads it for every
464/// DC_PRED block whose sides are both <= 32), so every DC_PRED 16x8 strip
465/// dropped one symbol and desynced the tile from that block on.
466/// `[8]`/`[9]` (lane-fi8 r1) add `BLOCK_4X8`/`BLOCK_8X4`'s own rows
467/// (6743/5893, `default_filter_intra_cdfs` index 1/2) -- the sub-8 rect
468/// leaves [`crate::decode`]'s `decode_leaf_rect8` codes. Both are inside
469/// `av1_filter_intra_allowed_bsize`, so the flag is written for every DC_PRED
470/// one of them; before this round that read took `BLOCK_4X4`'s row (class 0),
471/// the same value with a different interval (class `wrong-alphabet-same-value`
472/// / `cdf-row-held-constant`).
473/// `[10]`/`[11]` (lane-fi32x8 r1) add `BLOCK_32X8`/`BLOCK_8X32`'s own rows
474/// (18101/20229, `default_filter_intra_cdfs` index 19/18 -- generated by
475/// `scripts/extract-filter-intra-cdfs.py`): the four 32x8 (or 8x32) strips a
476/// 32x32-level `PARTITION_HORZ_4`/`VERT_4` codes are inside
477/// `av1_filter_intra_allowed_bsize`'s "both sides <= 32" bound, so libaom
478/// reads `use_filter_intra` there too and the missing rows dropped the
479/// symbol on every DC_PRED 1:4 strip.
480pub const FILTER_INTRA: [[u16; 3]; 14] = [
481 [4621, 32768, 0],
482 [7866, 32768, 0],
483 [12408, 32768, 0],
484 [22343, 32768, 0],
485 [12756, 32768, 0],
486 [14301, 32768, 0],
487 [9394, 32768, 0],
488 [12551, 32768, 0],
489 [6743, 32768, 0],
490 [5893, 32768, 0],
491 [18101, 32768, 0],
492 [20229, 32768, 0],
493 // lane-r14: the 16x16-level 1:4 pair (`default_filter_intra_cdfs` index
494 // 17/16 -- BLOCK_16X4/BLOCK_4X16, generated by
495 // `scripts/extract-filter-intra-cdfs.py`), classes 12/13. Both sides <= 32,
496 // so libaom writes `use_filter_intra` on every DC_PRED strip of this shape.
497 [10368, 32768, 0],
498 [12770, 32768, 0],
499];
500/// `default_filter_intra_mode_cdf` (entropymode.c): which of the five
501/// `FILTER_INTRA_MODES` a `use_filter_intra` block picks.
502pub const FILTER_INTRA_MODE: [u16; 6] = [8949, 12776, 17211, 29558, 32768, 0];
503
504/// `default_palette_y_size_cdf` (entropymode.c): `PALETTE_SIZES` (2..=8),
505/// indexed by `av1_get_palette_bsize_ctx` (0..=6, `PALATTE_BSIZE_CTXS`).
506pub const PALETTE_Y_SIZE: [[u16; 8]; 7] = [
507 [7952, 13000, 18149, 21478, 25527, 29241, 32768, 0],
508 [7139, 11421, 16195, 19544, 23666, 28073, 32768, 0],
509 [7788, 12741, 17325, 20500, 24315, 28530, 32768, 0],
510 [8271, 14064, 18246, 21564, 25071, 28533, 32768, 0],
511 [12725, 19180, 21863, 24839, 27535, 30120, 32768, 0],
512 [9711, 14888, 16923, 21052, 25661, 27875, 32768, 0],
513 [14940, 20797, 21678, 24186, 27033, 28999, 32768, 0],
514];
515/// `default_palette_uv_size_cdf` (entropymode.c): as [`PALETTE_Y_SIZE`], for
516/// the chroma plane's own palette size.
517pub const PALETTE_UV_SIZE: [[u16; 8]; 7] = [
518 [8713, 19979, 27128, 29609, 31331, 32272, 32768, 0],
519 [5839, 15573, 23581, 26947, 29848, 31700, 32768, 0],
520 [4426, 11260, 17999, 21483, 25863, 29430, 32768, 0],
521 [3228, 9464, 14993, 18089, 22523, 27420, 32768, 0],
522 [3768, 8886, 13091, 17852, 22495, 27207, 32768, 0],
523 [2464, 8451, 12861, 21632, 25525, 28555, 32768, 0],
524 [1269, 5435, 10433, 18963, 21700, 25865, 32768, 0],
525];
526/// `default_palette_y_mode_cdf` (entropymode.c): whether a `DC_PRED` block
527/// uses a palette, indexed `[bsize_ctx][palette_mode_ctx]`
528/// (`palette_mode_ctx` from `av1_get_palette_mode_ctx` -- this decoder never
529/// completes a decode with a nonzero neighbour `palette_size`, so only row
530/// `[.][0]` is ever read, but the whole table is here to match libaom's
531/// adaptation shape exactly).
532pub const PALETTE_Y_MODE: [[[u16; 3]; 3]; 7] = [
533 [[31676, 32768, 0], [3419, 32768, 0], [1261, 32768, 0]],
534 [[31912, 32768, 0], [2859, 32768, 0], [980, 32768, 0]],
535 [[31823, 32768, 0], [3400, 32768, 0], [781, 32768, 0]],
536 [[32030, 32768, 0], [3561, 32768, 0], [904, 32768, 0]],
537 [[32309, 32768, 0], [7337, 32768, 0], [1462, 32768, 0]],
538 [[32265, 32768, 0], [4015, 32768, 0], [1521, 32768, 0]],
539 [[32450, 32768, 0], [7946, 32768, 0], [129, 32768, 0]],
540];
541/// `default_palette_uv_mode_cdf` (entropymode.c): whether a `UV_DC_PRED`
542/// block uses a chroma palette, indexed by `palette_uv_mode_ctx` (whether
543/// this block's own luma palette was used -- always 0 here, see
544/// [`PALETTE_Y_MODE`]'s doc).
545pub const PALETTE_UV_MODE: [[u16; 3]; 2] = [[32461, 32768, 0], [21488, 32768, 0]];
546/// `default_palette_y_color_index_cdf` (entropymode.c): the per-pixel colour
547/// index symbol for a palette-Y block, indexed `[n-2][color_ctx]` where `n`
548/// is the block's palette size (2..=8, `PALETTE_SIZES`) and `color_ctx` is
549/// `av1_get_palette_color_index_context`'s 0..=4 output
550/// (`PALETTE_COLOR_INDEX_CONTEXTS`). Each row is transcribed straight from
551/// its `AOM_CDFn` macro (`n-1` raw probs, then `32768, 0`) and zero-padded
552/// out to width 9 (the `n=8` row's real length); the call site slices
553/// `[..=n]`, which only ever touches the real prefix, so the trailing zero
554/// padding on shorter rows is never read.
555pub const PALETTE_Y_COLOR_INDEX: [[[u16; 9]; 5]; 7] = [
556 [
557 [28710, 32768, 0, 0, 0, 0, 0, 0, 0],
558 [16384, 32768, 0, 0, 0, 0, 0, 0, 0],
559 [10553, 32768, 0, 0, 0, 0, 0, 0, 0],
560 [27036, 32768, 0, 0, 0, 0, 0, 0, 0],
561 [31603, 32768, 0, 0, 0, 0, 0, 0, 0],
562 ],
563 [
564 [27877, 30490, 32768, 0, 0, 0, 0, 0, 0],
565 [11532, 25697, 32768, 0, 0, 0, 0, 0, 0],
566 [6544, 30234, 32768, 0, 0, 0, 0, 0, 0],
567 [23018, 28072, 32768, 0, 0, 0, 0, 0, 0],
568 [31915, 32385, 32768, 0, 0, 0, 0, 0, 0],
569 ],
570 [
571 [25572, 28046, 30045, 32768, 0, 0, 0, 0, 0],
572 [9478, 21590, 27256, 32768, 0, 0, 0, 0, 0],
573 [7248, 26837, 29824, 32768, 0, 0, 0, 0, 0],
574 [19167, 24486, 28349, 32768, 0, 0, 0, 0, 0],
575 [31400, 31825, 32250, 32768, 0, 0, 0, 0, 0],
576 ],
577 [
578 [24779, 26955, 28576, 30282, 32768, 0, 0, 0, 0],
579 [8669, 20364, 24073, 28093, 32768, 0, 0, 0, 0],
580 [4255, 27565, 29377, 31067, 32768, 0, 0, 0, 0],
581 [19864, 23674, 26716, 29530, 32768, 0, 0, 0, 0],
582 [31646, 31893, 32147, 32426, 32768, 0, 0, 0, 0],
583 ],
584 [
585 [23132, 25407, 26970, 28435, 30073, 32768, 0, 0, 0],
586 [7443, 17242, 20717, 24762, 27982, 32768, 0, 0, 0],
587 [6300, 24862, 26944, 28784, 30671, 32768, 0, 0, 0],
588 [18916, 22895, 25267, 27435, 29652, 32768, 0, 0, 0],
589 [31270, 31550, 31808, 32059, 32353, 32768, 0, 0, 0],
590 ],
591 [
592 [23105, 25199, 26464, 27684, 28931, 30318, 32768, 0, 0],
593 [6950, 15447, 18952, 22681, 25567, 28563, 32768, 0, 0],
594 [7560, 23474, 25490, 27203, 28921, 30708, 32768, 0, 0],
595 [18544, 22373, 24457, 26195, 28119, 30045, 32768, 0, 0],
596 [31198, 31451, 31670, 31882, 32123, 32391, 32768, 0, 0],
597 ],
598 [
599 [21689, 23883, 25163, 26352, 27506, 28827, 30195, 32768, 0],
600 [6892, 15385, 17840, 21606, 24287, 26753, 29204, 32768, 0],
601 [5651, 23182, 25042, 26518, 27982, 29392, 30900, 32768, 0],
602 [19349, 22578, 24418, 25994, 27524, 29031, 30448, 32768, 0],
603 [31028, 31270, 31504, 31705, 31927, 32153, 32392, 32768, 0],
604 ],
605];
606/// `default_palette_uv_color_index_cdf` (entropymode.c): as
607/// [`PALETTE_Y_COLOR_INDEX`], for the chroma colour-index map.
608pub const PALETTE_UV_COLOR_INDEX: [[[u16; 9]; 5]; 7] = [
609 [
610 [29089, 32768, 0, 0, 0, 0, 0, 0, 0],
611 [16384, 32768, 0, 0, 0, 0, 0, 0, 0],
612 [8713, 32768, 0, 0, 0, 0, 0, 0, 0],
613 [29257, 32768, 0, 0, 0, 0, 0, 0, 0],
614 [31610, 32768, 0, 0, 0, 0, 0, 0, 0],
615 ],
616 [
617 [25257, 29145, 32768, 0, 0, 0, 0, 0, 0],
618 [12287, 27293, 32768, 0, 0, 0, 0, 0, 0],
619 [7033, 27960, 32768, 0, 0, 0, 0, 0, 0],
620 [20145, 25405, 32768, 0, 0, 0, 0, 0, 0],
621 [30608, 31639, 32768, 0, 0, 0, 0, 0, 0],
622 ],
623 [
624 [24210, 27175, 29903, 32768, 0, 0, 0, 0, 0],
625 [9888, 22386, 27214, 32768, 0, 0, 0, 0, 0],
626 [5901, 26053, 29293, 32768, 0, 0, 0, 0, 0],
627 [18318, 22152, 28333, 32768, 0, 0, 0, 0, 0],
628 [30459, 31136, 31926, 32768, 0, 0, 0, 0, 0],
629 ],
630 [
631 [22980, 25479, 27781, 29986, 32768, 0, 0, 0, 0],
632 [8413, 21408, 24859, 28874, 32768, 0, 0, 0, 0],
633 [2257, 29449, 30594, 31598, 32768, 0, 0, 0, 0],
634 [19189, 21202, 25915, 28620, 32768, 0, 0, 0, 0],
635 [31844, 32044, 32281, 32518, 32768, 0, 0, 0, 0],
636 ],
637 [
638 [22217, 24567, 26637, 28683, 30548, 32768, 0, 0, 0],
639 [7307, 16406, 19636, 24632, 28424, 32768, 0, 0, 0],
640 [4441, 25064, 26879, 28942, 30919, 32768, 0, 0, 0],
641 [17210, 20528, 23319, 26750, 29582, 32768, 0, 0, 0],
642 [30674, 30953, 31396, 31735, 32207, 32768, 0, 0, 0],
643 ],
644 [
645 [21239, 23168, 25044, 26962, 28705, 30506, 32768, 0, 0],
646 [6545, 15012, 18004, 21817, 25503, 28701, 32768, 0, 0],
647 [3448, 26295, 27437, 28704, 30126, 31442, 32768, 0, 0],
648 [15889, 18323, 21704, 24698, 26976, 29690, 32768, 0, 0],
649 [30988, 31204, 31479, 31734, 31983, 32325, 32768, 0, 0],
650 ],
651 [
652 [21442, 23288, 24758, 26246, 27649, 28980, 30563, 32768, 0],
653 [5863, 14933, 17552, 20668, 23683, 26411, 29273, 32768, 0],
654 [3415, 25810, 26877, 27990, 29223, 30394, 31618, 32768, 0],
655 [17965, 20084, 22232, 23974, 26274, 28402, 30390, 32768, 0],
656 [31190, 31329, 31516, 31679, 31825, 32026, 32322, 32768, 0],
657 ],
658];
659/// `default_intrabc_cdf` (entropymode.c): the `use_intrabc` flag on an
660/// intra frame with `allow_intrabc` set.
661pub const INTRABC: [u16; 3] = [30531, 32768, 0];
662/// `default_wiener_restore_cdf` (entropymode.c): a `RESTORE_WIENER`-plane
663/// LR unit's own `use_wiener` flag (spec 5.11.57 `read_lr_unit`).
664pub const RESTORE_WIENER: [u16; 3] = [11570, 32768, 0];
665/// `default_sgrproj_restore_cdf`: a `RESTORE_SGRPROJ`-plane LR unit's own
666/// `use_sgrproj` flag.
667pub const RESTORE_SGRPROJ: [u16; 3] = [16855, 32768, 0];
668/// `default_switchable_restore_cdf`: a `RESTORE_SWITCHABLE`-plane LR unit's
669/// own `restoration_type` (3-way: `RESTORE_NONE`/`RESTORE_WIENER`/
670/// `RESTORE_SGRPROJ`).
671pub const RESTORE_SWITCHABLE: [u16; 4] = [9413, 22581, 32768, 0];
672
673/// `default_delta_q_cdf` (entropymode.c:840-852, lane-realworld r4): the
674/// 4-symbol `delta_q_abs` alphabet read once per superblock when
675/// `delta_q_present` is set. `default_delta_lf_cdf`/`default_delta_lf_multi_cdf`
676/// share this same value (verified against libaom's real source).
677/// `Default_Segment_Id_Cdf` (spec 9.4, libaom
678/// `default_spatial_pred_seg_tree_cdf`): the `segment_id` symbol's eight
679/// segments, indexed by the spec 5.11.8 neighbour-agreement context.
680pub const SEGMENT_ID: [[u16; 9]; 3] = [
681 [5622, 7893, 16093, 18233, 27809, 28373, 32533, 32768, 0],
682 [14274, 18230, 22557, 24935, 29980, 30851, 32344, 32768, 0],
683 [27527, 28487, 28723, 28890, 32397, 32647, 32679, 32768, 0],
684];
685
686/// `Default_Segment_Pred_Cdf` (spec 9.4, libaom `default_segment_pred_cdf`):
687/// `seg_id_predicted`, indexed by `AboveSegPredContext + LeftSegPredContext`.
688pub const SEGMENT_PRED: [[u16; 3]; 3] = [[16384, 32768, 0]; 3];
689
690/// Default CDF table `DELTA_Q` (AV1 spec 9.4 initial probabilities).
691pub const DELTA_Q: [u16; 5] = [28160, 32120, 32677, 32768, 0];
692/// `default_delta_lf_cdf` -- see [`DELTA_Q`]'s doc.
693pub const DELTA_LF: [u16; 5] = DELTA_Q;
694
695/// `default_tx_size_cdf[0]` (entropymode.c): an 8x8 block's `tx_depth` flag
696/// (`TX8` vs `TX4`), indexed by `tx_size_context` (0..=2).
697pub const TX_SIZE_CAT0: [[u16; 3]; 3] = [[19968, 32768, 0], [19968, 32768, 0], [24320, 32768, 0]];
698/// `default_tx_size_cdf[1]` (entropymode.c): a 16x16 block's `tx_depth`
699/// (`TX16`/`TX8`/`TX4`), indexed by `tx_size_context`.
700pub const TX_SIZE_CAT1: [[u16; 4]; 3] = [
701 [12272, 30172, 32768, 0],
702 [12272, 30172, 32768, 0],
703 [18677, 30848, 32768, 0],
704];
705/// `default_tx_size_cdf[2]` (entropymode.c): a 32x32 block's `tx_depth`
706/// (`TX32`/`TX16`/`TX8`), indexed by `tx_size_context`.
707pub const TX_SIZE_CAT2: [[u16; 4]; 3] = [
708 [12986, 15180, 32768, 0],
709 [12986, 15180, 32768, 0],
710 [24302, 25602, 32768, 0],
711];
712/// `default_tx_size_cdf[3]` (entropymode.c): a 64x64 block's `tx_depth`
713/// (`TX64`/`TX32`/`TX16`), indexed by `tx_size_context`.
714pub const TX_SIZE_CAT3: [[u16; 4]; 3] = [
715 [5782, 11475, 32768, 0],
716 [5782, 11475, 32768, 0],
717 [16803, 22759, 32768, 0],
718];
719
720/// `default_switchable_interp_cdf` (spec 9.4): a `SWITCHABLE`-filter frame's
721/// per-block `interp_filter[dir]` (spec 5.11.20's `read_interpolation_filter`,
722/// three symbols -- `EIGHTTAP`/`EIGHTTAP_SMOOTH`/`EIGHTTAP_SHARP`, `BILINEAR`
723/// is never chosen this way), indexed by `av1_get_pred_context_switchable_interp`'s
724/// `ctx_offset + dir * INTER_FILTER_DIR_OFFSET + neighbour_term`
725/// (`INTER_FILTER_DIR_OFFSET` = 8; this decoder never codes a compound
726/// reference, so `ctx_offset` -- `INTER_FILTER_COMP_OFFSET` on a second
727/// reference frame -- is always 0, leaving rows 0..=3 for `dir` 0 and 8..=11
728/// for `dir` 1).
729pub const SWITCHABLE_INTERP: [[u16; 4]; 16] = [
730 [31935, 32720, 32768, 0],
731 [5568, 32719, 32768, 0],
732 [422, 2938, 32768, 0],
733 [28244, 32608, 32768, 0],
734 [31206, 31953, 32768, 0],
735 [4862, 32121, 32768, 0],
736 [770, 1152, 32768, 0],
737 [20889, 25637, 32768, 0],
738 [31910, 32724, 32768, 0],
739 [4120, 32712, 32768, 0],
740 [305, 2247, 32768, 0],
741 [27403, 32636, 32768, 0],
742 [31022, 32009, 32768, 0],
743 [2963, 32093, 32768, 0],
744 [601, 943, 32768, 0],
745 [14969, 21398, 32768, 0],
746];
747
748/// `Default_Cfl_Alpha_Cdf` (spec 9.4): a `UV_CFL_PRED` block's per-plane
749/// alpha magnitude (spec 5.11.45's `cfl_alpha_u`/`cfl_alpha_v`), indexed by
750/// the joint sign's context (`CFL_CONTEXT_U`/`CFL_CONTEXT_V`,
751/// libaom's cfl.h) — libaom's `default_cfl_alpha_cdf`.
752pub const CFL_ALPHA: [[u16; 17]; 6] = [
753 [
754 7637, 20719, 31401, 32481, 32657, 32688, 32692, 32696, 32700, 32704, 32708, 32712, 32716,
755 32720, 32724, 32768, 0,
756 ],
757 [
758 14365, 23603, 28135, 31168, 32167, 32395, 32487, 32573, 32620, 32647, 32668, 32672, 32676,
759 32680, 32684, 32768, 0,
760 ],
761 [
762 11532, 22380, 28445, 31360, 32349, 32523, 32584, 32649, 32673, 32677, 32681, 32685, 32689,
763 32693, 32697, 32768, 0,
764 ],
765 [
766 26990, 31402, 32282, 32571, 32692, 32696, 32700, 32704, 32708, 32712, 32716, 32720, 32724,
767 32728, 32732, 32768, 0,
768 ],
769 [
770 17248, 26058, 28904, 30608, 31305, 31877, 32126, 32321, 32394, 32464, 32516, 32560, 32576,
771 32593, 32622, 32768, 0,
772 ],
773 [
774 14738, 21678, 25779, 27901, 29024, 30302, 30980, 31843, 32144, 32413, 32520, 32594, 32622,
775 32656, 32660, 32768, 0,
776 ],
777];
778
779/// `Default_Txb_Skip_Cdf[2][3][0]` (spec 9.4): the all-zero flag of a 32x32
780/// luma transform block that covers its whole plane block, which is context 0.
781pub const TXB_SKIP_LUMA_32: [u16; 3] = [30669, 32768, 0];
782
783/// `Default_Coeff_Base_Cdf[2][3][0]` (spec 9.4): the level of a coefficient
784/// of a 32x32 luma transform block, capped at three, for each of the
785/// forty-two contexts its neighbours' magnitudes and its own position give.
786pub const COEFF_BASE_LUMA_32: [[u16; 5]; 42] = [
787 [4456, 11274, 15533, 32768, 0],
788 [21219, 29079, 31616, 32768, 0],
789 [11173, 23774, 28567, 32768, 0],
790 [7282, 18293, 24263, 32768, 0],
791 [4890, 13286, 19115, 32768, 0],
792 [1890, 5508, 8659, 32768, 0],
793 [26651, 32136, 32647, 32768, 0],
794 [14630, 28254, 31455, 32768, 0],
795 [8716, 21287, 27395, 32768, 0],
796 [5615, 15331, 22008, 32768, 0],
797 [2675, 7700, 12150, 32768, 0],
798 [29954, 32526, 32690, 32768, 0],
799 [16126, 28982, 31633, 32768, 0],
800 [9030, 21361, 27352, 32768, 0],
801 [5411, 14793, 21271, 32768, 0],
802 [2943, 8422, 13163, 32768, 0],
803 [29539, 32601, 32730, 32768, 0],
804 [18125, 30385, 32201, 32768, 0],
805 [10422, 24090, 29468, 32768, 0],
806 [6468, 17487, 24438, 32768, 0],
807 [2970, 8653, 13531, 32768, 0],
808 [30912, 32715, 32748, 32768, 0],
809 [20666, 31373, 32497, 32768, 0],
810 [12509, 26640, 30917, 32768, 0],
811 [8058, 20629, 27290, 32768, 0],
812 [4231, 12006, 18052, 32768, 0],
813 [8192, 16384, 24576, 32768, 0],
814 [8192, 16384, 24576, 32768, 0],
815 [8192, 16384, 24576, 32768, 0],
816 [8192, 16384, 24576, 32768, 0],
817 [8192, 16384, 24576, 32768, 0],
818 [8192, 16384, 24576, 32768, 0],
819 [8192, 16384, 24576, 32768, 0],
820 [8192, 16384, 24576, 32768, 0],
821 [8192, 16384, 24576, 32768, 0],
822 [8192, 16384, 24576, 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];
830
831/// `Default_Coeff_Br_Cdf[2][3][0]` (spec 9.4): a base-range increment in a
832/// 32x32 luma transform block, for each of the twenty-one contexts.
833pub const COEFF_BR_LUMA_32: [[u16; 5]; 21] = [
834 [9040, 14786, 18360, 32768, 0],
835 [9979, 15718, 19415, 32768, 0],
836 [7913, 13918, 18311, 32768, 0],
837 [5859, 10889, 15184, 32768, 0],
838 [4593, 8677, 12510, 32768, 0],
839 [3820, 7396, 10791, 32768, 0],
840 [1730, 3471, 5192, 32768, 0],
841 [11803, 18365, 22709, 32768, 0],
842 [11419, 18058, 22225, 32768, 0],
843 [9418, 15774, 20243, 32768, 0],
844 [7539, 13325, 17657, 32768, 0],
845 [6233, 11317, 15384, 32768, 0],
846 [5137, 9656, 13545, 32768, 0],
847 [2977, 5774, 8349, 32768, 0],
848 [21207, 27246, 29640, 32768, 0],
849 [19547, 26578, 29497, 32768, 0],
850 [16169, 23871, 27690, 32768, 0],
851 [12820, 20458, 25018, 32768, 0],
852 [10224, 17332, 22214, 32768, 0],
853 [8526, 15048, 19884, 32768, 0],
854 [5037, 9410, 13118, 32768, 0],
855];
856
857/// `Default_Coeff_Base_Eob_Cdf[2][3][0]` (spec 9.4): the level of the last
858/// coefficient of a 32x32 luma transform block, less one, for each of the
859/// four contexts its position in the scan gives.
860pub const COEFF_BASE_EOB_LUMA_32: [[u16; 4]; 4] = [
861 [2809, 19301, 32768, 0],
862 [32205, 32622, 32768, 0],
863 [32338, 32730, 32768, 0],
864 [31786, 32616, 32768, 0],
865];
866
867/// `Default_Eob_Extra_Cdf[2][3][0]` (spec 9.4): the top bit of the offset
868/// into an end-of-block position group, for each group.
869pub const EOB_EXTRA_LUMA_32: [[u16; 3]; 9] = [
870 [23312, 32768, 0],
871 [21607, 32768, 0],
872 [16526, 32768, 0],
873 [18957, 32768, 0],
874 [18034, 32768, 0],
875 [18934, 32768, 0],
876 [24247, 32768, 0],
877 [16921, 32768, 0],
878 [17080, 32768, 0],
879];
880
881/// `Av1_Nz_Map_Ctx_Offset` for a 32x32 transform (the position term of the
882/// coefficient-level context, spec 8.3.2): row and column clamped to four.
883pub const NZ_MAP_CTX_OFFSET_32: [[u8; 5]; 5] = [
884 [0, 1, 6, 6, 21],
885 [1, 6, 6, 21, 21],
886 [6, 6, 21, 21, 21],
887 [6, 21, 21, 21, 21],
888 [21, 21, 21, 21, 21],
889];
890
891/// `Av1_Nz_Map_Ctx_Offset[TX_32X64]` (libaom `txb_common.c`
892/// `av1_nz_map_ctx_offset_32x64`, row and column clamped to four): the real
893/// 32-wide/64-tall transform's own table, used when a superblock-level
894/// `PARTITION_VERT` strip's luma corner is read through [`NZ_MAP_CTX_OFFSET_32`]'s
895/// scan/CDF-set but the *un-adjusted* block shape (spec `get_txsize_entropy_ctx`
896/// resolves the CDF *set* to `TX_64X64`, but `get_nz_map_ctx_from_stats` still
897/// indexes this position table by the raw, un-adjusted `tx_size` -- lane-sbpart
898/// r8 root cause) is genuinely rectangular, not square. Distinct from
899/// [`NZ_MAP_CTX_OFFSET_32`] starting at `(row=1, col=0)`.
900// lane-part32 r3: this table was TRANSPOSED (row/col swapped) as landed by
901// lane-sbpart r8 -- caught by tracing a real aomenc pin against a patched
902// aomdec (added per-symbol `EC_TRACE_COEFF` ctx prints to
903// `read_coeffs_reverse{,_2d}` in `~/.cache/aom-oracle`), which showed our own
904// `(row=2, col=0)` reading ctx-offset 11 where the real decoder's equivalent
905// position read 6. Re-derived straight from libaom's own generating
906// comment in `get_nz_map_ctx_from_stats` (`txb_common.h:199-210`): for
907// `width < height` (this table, `TX_32X64`), ctx is `11 +` for `row < 2`
908// *regardless of col* -- the old table instead special-cased `col < 2`,
909// which is the `width > height` (`TX_64X32`) branch. Confirmed against the
910// real `av1_nz_map_ctx_offset_32x64`/`_64x32` C arrays in
911// `av1/common/txb_common.c`, decoded through libaom's own col-major
912// `pos = col*32+row` raster (same convention [`SCAN_32X16`]'s doc comment
913// already documents this decoder transcribes out of).
914pub const NZ_MAP_CTX_OFFSET_32X64: [[u8; 5]; 5] = [
915 [0, 11, 6, 6, 21],
916 [11, 11, 6, 21, 21],
917 [11, 11, 21, 21, 21],
918 [11, 11, 21, 21, 21],
919 [11, 11, 21, 21, 21],
920];
921
922/// [`NZ_MAP_CTX_OFFSET_32X64`]'s `TX_64X32` counterpart (libaom
923/// `av1_nz_map_ctx_offset_64x32`): a `PARTITION_HORZ` strip's luma corner.
924/// `width > height` here, so the `col < 2` branch (offset 16) fires
925/// regardless of row -- transpose of [`NZ_MAP_CTX_OFFSET_32X64`]'s `row < 2`
926/// branch, same r3 fix (see that table's doc comment).
927pub const NZ_MAP_CTX_OFFSET_64X32: [[u8; 5]; 5] = [
928 [0, 16, 16, 16, 16],
929 [16, 16, 16, 16, 16],
930 [6, 6, 21, 21, 21],
931 [6, 21, 21, 21, 21],
932 [21, 21, 21, 21, 21],
933];
934
935/// `Default_Txb_Skip_Cdf[2][2][7..10]` (spec 9.4): the all-zero flag of a
936/// 16x16 chroma transform block that covers its whole plane block, for the
937/// three contexts its coded neighbours give.
938pub const TXB_SKIP_CHROMA_16: [[u16; 3]; 3] =
939 [[3648, 32768, 0], [15690, 32768, 0], [26815, 32768, 0]];
940
941/// `Default_Coeff_Base_Cdf[2][2][1]` (spec 9.4): the level of a coefficient
942/// of a 16x16 chroma transform block, capped at three, for each of the
943/// forty-two contexts its neighbours and its position give.
944pub const COEFF_BASE_CHROMA_16: [[u16; 5]; 42] = [
945 [9185, 19694, 24688, 32768, 0],
946 [26081, 31985, 32621, 32768, 0],
947 [16015, 29000, 31787, 32768, 0],
948 [10542, 23690, 29206, 32768, 0],
949 [6732, 17945, 24677, 32768, 0],
950 [3916, 11039, 16722, 32768, 0],
951 [28224, 32566, 32744, 32768, 0],
952 [19100, 31138, 32485, 32768, 0],
953 [12528, 26620, 30879, 32768, 0],
954 [7741, 20277, 26885, 32768, 0],
955 [4566, 12845, 18990, 32768, 0],
956 [29933, 32593, 32718, 32768, 0],
957 [17670, 30333, 32155, 32768, 0],
958 [10385, 23600, 28909, 32768, 0],
959 [6243, 16236, 22407, 32768, 0],
960 [3976, 10389, 16017, 32768, 0],
961 [28377, 32561, 32738, 32768, 0],
962 [19366, 31175, 32482, 32768, 0],
963 [13327, 27175, 31094, 32768, 0],
964 [8258, 20769, 27143, 32768, 0],
965 [4703, 13198, 19527, 32768, 0],
966 [31086, 32706, 32748, 32768, 0],
967 [22853, 31902, 32583, 32768, 0],
968 [14759, 28186, 31419, 32768, 0],
969 [9284, 22382, 28348, 32768, 0],
970 [5585, 15192, 21868, 32768, 0],
971 [28291, 32652, 32746, 32768, 0],
972 [19849, 32107, 32571, 32768, 0],
973 [14834, 26818, 29214, 32768, 0],
974 [10306, 22594, 28672, 32768, 0],
975 [6615, 17384, 23384, 32768, 0],
976 [28947, 32604, 32745, 32768, 0],
977 [25625, 32289, 32646, 32768, 0],
978 [18758, 28672, 31403, 32768, 0],
979 [10017, 23430, 28523, 32768, 0],
980 [6862, 15269, 22131, 32768, 0],
981 [23933, 32509, 32739, 32768, 0],
982 [19927, 31495, 32631, 32768, 0],
983 [11903, 26023, 30621, 32768, 0],
984 [7026, 20094, 27252, 32768, 0],
985 [5998, 18106, 24437, 32768, 0],
986 [8192, 16384, 24576, 32768, 0],
987];
988
989/// `Default_Coeff_Br_Cdf[2][2][1]` (spec 9.4): a base-range increment in a
990/// 16x16 chroma transform block, for each of its twenty-one contexts.
991pub const COEFF_BR_CHROMA_16: [[u16; 5]; 21] = [
992 [13569, 19800, 23206, 32768, 0],
993 [13128, 19924, 23869, 32768, 0],
994 [8329, 14841, 19403, 32768, 0],
995 [6130, 10976, 15057, 32768, 0],
996 [4682, 8839, 12518, 32768, 0],
997 [3656, 7409, 10588, 32768, 0],
998 [2577, 5099, 7412, 32768, 0],
999 [22427, 28684, 30585, 32768, 0],
1000 [20913, 27750, 30139, 32768, 0],
1001 [15840, 24109, 27834, 32768, 0],
1002 [12308, 20029, 24569, 32768, 0],
1003 [10216, 16785, 21458, 32768, 0],
1004 [8309, 14203, 19113, 32768, 0],
1005 [6043, 11168, 15307, 32768, 0],
1006 [23166, 28901, 30998, 32768, 0],
1007 [21899, 28405, 30751, 32768, 0],
1008 [18413, 26091, 29443, 32768, 0],
1009 [15233, 23114, 27352, 32768, 0],
1010 [12683, 20472, 25288, 32768, 0],
1011 [10702, 18259, 23409, 32768, 0],
1012 [8125, 14464, 19226, 32768, 0],
1013];
1014
1015/// `Default_Coeff_Base_Eob_Cdf[2][2][1]` (spec 9.4): the level of the last
1016/// coefficient of a 16x16 chroma transform block, less one, for each of the
1017/// four contexts its position in the scan gives.
1018pub const COEFF_BASE_EOB_CHROMA_16: [[u16; 4]; 4] = [
1019 [25476, 30366, 32768, 0],
1020 [32169, 32687, 32768, 0],
1021 [32479, 32689, 32768, 0],
1022 [31673, 32634, 32768, 0],
1023];
1024
1025/// `Default_Eob_Extra_Cdf[2][2][1]` (spec 9.4): the top bit of the offset
1026/// into an end-of-block position group of a 16x16 chroma transform block.
1027pub const EOB_EXTRA_CHROMA_16: [[u16; 3]; 9] = [
1028 [22041, 32768, 0],
1029 [23434, 32768, 0],
1030 [20001, 32768, 0],
1031 [20554, 32768, 0],
1032 [20951, 32768, 0],
1033 [20145, 32768, 0],
1034 [15562, 32768, 0],
1035 [16384, 32768, 0],
1036 [16384, 32768, 0],
1037];
1038
1039/// `Default_Eob_Pt_256_Cdf[2][1][0]` (spec 9.4): the end-of-block group of a
1040/// 256-coefficient chroma transform block with a two-dimensional transform.
1041pub const EOB_PT_256_CHROMA: [u16; 10] = [
1042 11514, 13794, 17480, 20754, 24361, 27378, 29492, 31277, 32768, 0,
1043];
1044
1045/// `Default_Dc_Sign_Cdf[2][1]` (spec 9.4): the sign of a chroma DC
1046/// coefficient, indexed the way [`DC_SIGN_LUMA`] is.
1047pub const DC_SIGN_CHROMA: [[u16; 3]; 3] = [[15232, 32768, 0], [12928, 32768, 0], [17280, 32768, 0]];
1048
1049/// `Default_Angle_Delta_Cdf` (spec 9.4): the offset a directional intra mode
1050/// is steered by, seven symbols from -3 to +3, one row per directional mode in
1051/// the order they follow `V_PRED`.
1052pub const ANGLE_DELTA: [[u16; 8]; 8] = [
1053 [2180, 5032, 7567, 22776, 26989, 30217, 32768, 0],
1054 [2301, 5608, 8801, 23487, 26974, 30330, 32768, 0],
1055 [3780, 11018, 13699, 19354, 23083, 31286, 32768, 0],
1056 [4581, 11226, 15147, 17138, 21834, 28397, 32768, 0],
1057 [1737, 10927, 14509, 19588, 22745, 28823, 32768, 0],
1058 [2664, 10176, 12485, 17650, 21600, 30495, 32768, 0],
1059 [2240, 11096, 15453, 20341, 22561, 28917, 32768, 0],
1060 [3605, 10428, 12459, 17676, 21244, 30655, 32768, 0],
1061];
1062/// `Default_Coeff_Base_Cdf[2][4][0]` (spec 9.4): the level of a coefficient of a 64x64 luma
1063/// transform block, capped at three, for each of the forty-two contexts its neighbours and its
1064/// position give.
1065pub const COEFF_BASE_LUMA_64: [[u16; 5]; 42] = [
1066 [2575, 7281, 11077, 32768, 0],
1067 [14002, 20866, 25402, 32768, 0],
1068 [6343, 15056, 19658, 32768, 0],
1069 [4474, 11858, 17041, 32768, 0],
1070 [2865, 8299, 12534, 32768, 0],
1071 [1344, 3949, 6391, 32768, 0],
1072 [24720, 31239, 32459, 32768, 0],
1073 [12585, 25356, 29968, 32768, 0],
1074 [7181, 18246, 24444, 32768, 0],
1075 [5025, 13667, 19885, 32768, 0],
1076 [2521, 7304, 11605, 32768, 0],
1077 [29908, 32252, 32584, 32768, 0],
1078 [17421, 29156, 31575, 32768, 0],
1079 [9889, 22188, 27782, 32768, 0],
1080 [5878, 15647, 22123, 32768, 0],
1081 [2814, 8665, 13323, 32768, 0],
1082 [30183, 32568, 32713, 32768, 0],
1083 [18528, 30195, 32049, 32768, 0],
1084 [10982, 24606, 29657, 32768, 0],
1085 [6957, 18165, 25231, 32768, 0],
1086 [3508, 10118, 15468, 32768, 0],
1087 [31761, 32736, 32748, 32768, 0],
1088 [21041, 31328, 32546, 32768, 0],
1089 [12568, 26732, 31166, 32768, 0],
1090 [8052, 20720, 27733, 32768, 0],
1091 [4336, 12192, 18396, 32768, 0],
1092 [8192, 16384, 24576, 32768, 0],
1093 [8192, 16384, 24576, 32768, 0],
1094 [8192, 16384, 24576, 32768, 0],
1095 [8192, 16384, 24576, 32768, 0],
1096 [8192, 16384, 24576, 32768, 0],
1097 [8192, 16384, 24576, 32768, 0],
1098 [8192, 16384, 24576, 32768, 0],
1099 [8192, 16384, 24576, 32768, 0],
1100 [8192, 16384, 24576, 32768, 0],
1101 [8192, 16384, 24576, 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];
1109
1110/// `Default_Coeff_Base_Eob_Cdf[2][4][0]` (spec 9.4): the level of the last coefficient of a
1111/// 64x64 luma transform block, less one, for each of the four contexts its position gives.
1112pub const COEFF_BASE_EOB_LUMA_64: [[u16; 4]; 4] = [
1113 [935, 3382, 32768, 0],
1114 [30789, 31909, 32768, 0],
1115 [32466, 32756, 32768, 0],
1116 [30860, 32513, 32768, 0],
1117];
1118
1119/// `Default_Eob_Extra_Cdf[2][4][0]` (spec 9.4): the top bit of the end-of-block position of a
1120/// 64x64 luma transform block, one context per end-of-block group.
1121pub const EOB_EXTRA_LUMA_64: [[u16; 3]; 9] = [
1122 [26998, 32768, 0],
1123 [16737, 32768, 0],
1124 [17838, 32768, 0],
1125 [18922, 32768, 0],
1126 [19515, 32768, 0],
1127 [18636, 32768, 0],
1128 [17333, 32768, 0],
1129 [15776, 32768, 0],
1130 [22658, 32768, 0],
1131];
1132
1133/// `Default_Coeff_Base_Cdf[2][3][1]` (spec 9.4): the level of a coefficient of a 32x32 chroma
1134/// transform block, capped at three, for each of the forty-two contexts its neighbours and its
1135/// position give.
1136pub const COEFF_BASE_CHROMA_32: [[u16; 5]; 42] = [
1137 [10202, 20633, 25484, 32768, 0],
1138 [27336, 31445, 32352, 32768, 0],
1139 [12420, 24384, 28552, 32768, 0],
1140 [7648, 18115, 23856, 32768, 0],
1141 [5662, 14341, 19902, 32768, 0],
1142 [3611, 10328, 15390, 32768, 0],
1143 [30945, 32616, 32736, 32768, 0],
1144 [18682, 30505, 32253, 32768, 0],
1145 [11513, 25336, 30203, 32768, 0],
1146 [7449, 19452, 26148, 32768, 0],
1147 [4482, 13051, 18886, 32768, 0],
1148 [32022, 32690, 32747, 32768, 0],
1149 [18578, 30501, 32146, 32768, 0],
1150 [11249, 23368, 28631, 32768, 0],
1151 [5645, 16958, 22158, 32768, 0],
1152 [5009, 11444, 16637, 32768, 0],
1153 [31357, 32710, 32748, 32768, 0],
1154 [21552, 31494, 32504, 32768, 0],
1155 [13891, 27677, 31340, 32768, 0],
1156 [9051, 22098, 28172, 32768, 0],
1157 [5190, 13377, 19486, 32768, 0],
1158 [32364, 32740, 32748, 32768, 0],
1159 [24839, 31907, 32551, 32768, 0],
1160 [17160, 28779, 31696, 32768, 0],
1161 [12452, 24137, 29602, 32768, 0],
1162 [6165, 15389, 22477, 32768, 0],
1163 [8192, 16384, 24576, 32768, 0],
1164 [8192, 16384, 24576, 32768, 0],
1165 [8192, 16384, 24576, 32768, 0],
1166 [8192, 16384, 24576, 32768, 0],
1167 [8192, 16384, 24576, 32768, 0],
1168 [8192, 16384, 24576, 32768, 0],
1169 [8192, 16384, 24576, 32768, 0],
1170 [8192, 16384, 24576, 32768, 0],
1171 [8192, 16384, 24576, 32768, 0],
1172 [8192, 16384, 24576, 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];
1180
1181/// `Default_Coeff_Br_Cdf[2][3][1]` (spec 9.4): the base-range tail of a 32x32 chroma transform
1182/// block, for each of the twenty-one contexts its neighbours and its position give.
1183pub const COEFF_BR_CHROMA_32: [[u16; 5]; 21] = [
1184 [12339, 17329, 20140, 32768, 0],
1185 [13505, 19895, 23225, 32768, 0],
1186 [9847, 16944, 21564, 32768, 0],
1187 [7280, 13256, 18348, 32768, 0],
1188 [4712, 10009, 14454, 32768, 0],
1189 [4361, 7914, 12477, 32768, 0],
1190 [2870, 5628, 7995, 32768, 0],
1191 [20061, 25504, 28526, 32768, 0],
1192 [15235, 22878, 26145, 32768, 0],
1193 [12985, 19958, 24155, 32768, 0],
1194 [9782, 16641, 21403, 32768, 0],
1195 [9456, 16360, 20760, 32768, 0],
1196 [6855, 12940, 18557, 32768, 0],
1197 [5661, 10564, 15002, 32768, 0],
1198 [25656, 30602, 31894, 32768, 0],
1199 [22570, 29107, 31092, 32768, 0],
1200 [18917, 26423, 29541, 32768, 0],
1201 [15940, 23649, 27754, 32768, 0],
1202 [12803, 20581, 25219, 32768, 0],
1203 [11082, 18695, 23376, 32768, 0],
1204 [7939, 14373, 19005, 32768, 0],
1205];
1206
1207/// `Default_Coeff_Base_Eob_Cdf[2][3][1]` (spec 9.4): the level of the last coefficient of a
1208/// 32x32 chroma transform block, less one, for each of the four contexts its position gives.
1209pub const COEFF_BASE_EOB_CHROMA_32: [[u16; 4]; 4] = [
1210 [22737, 29105, 32768, 0],
1211 [30810, 32362, 32768, 0],
1212 [30014, 32627, 32768, 0],
1213 [30528, 32574, 32768, 0],
1214];
1215
1216/// `Default_Eob_Extra_Cdf[2][3][1]` (spec 9.4): the top bit of the end-of-block position of a
1217/// 32x32 chroma transform block, one context per end-of-block group.
1218pub const EOB_EXTRA_CHROMA_32: [[u16; 3]; 9] = [
1219 [26579, 32768, 0],
1220 [24910, 32768, 0],
1221 [18637, 32768, 0],
1222 [19800, 32768, 0],
1223 [20388, 32768, 0],
1224 [9887, 32768, 0],
1225 [15642, 32768, 0],
1226 [30198, 32768, 0],
1227 [24721, 32768, 0],
1228];
1229
1230/// `Default_Txb_Skip_Cdf[2][3][7..10]` (spec 9.4): the all-zero flag of a 32x32 chroma transform
1231/// block that covers its whole plane block, for the three contexts its coded neighbours give.
1232pub const TXB_SKIP_CHROMA_32: [[u16; 3]; 3] =
1233 [[5124, 32768, 0], [18719, 32768, 0], [28468, 32768, 0]];
1234
1235/// `Default_Eob_Pt_1024_Cdf[2][1][0]` (spec 9.4): the end-of-block group of a
1236/// 1024-coefficient chroma transform block with a two-dimensional transform.
1237pub const EOB_PT_1024_CHROMA: [u16; 12] = [
1238 9577, 12466, 17739, 20750, 22061, 23215, 24601, 25483, 25843, 32056, 32768, 0,
1239];
1240/// `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.
1241pub const TXB_SKIP_LUMA_16: [u16; 3] = [32363, 32768, 0];
1242
1243/// `Default_Txb_Skip_Cdf[2][1][7..10]`: the all-zero flag of an 8x8 chroma transform.
1244pub const TXB_SKIP_CHROMA_8: [[u16; 3]; 3] =
1245 [[3050, 32768, 0], [14603, 32768, 0], [25155, 32768, 0]];
1246
1247/// `Default_Eob_Pt_256_Cdf[2][0][0]`: the end-of-block group of a 16x16 luma transform.
1248pub const EOB_PT_256_LUMA: [u16; 10] =
1249 [3089, 3920, 6038, 9460, 14266, 19881, 25766, 29176, 32768, 0];
1250
1251/// `Default_Eob_Pt_64_Cdf[2][1][0]`: the end-of-block group of an 8x8 chroma transform.
1252pub const EOB_PT_64_CHROMA: [u16; 8] = [15050, 17126, 21410, 24886, 28156, 30726, 32768, 0];
1253
1254/// `Default_Eob_Extra_Cdf[2][2][0]`: the top offset bit inside a 16x16 luma transform's end-of-block group.
1255pub const EOB_EXTRA_LUMA_16: [[u16; 3]; 9] = [
1256 [19833, 32768, 0],
1257 [21502, 32768, 0],
1258 [17485, 32768, 0],
1259 [20267, 32768, 0],
1260 [18353, 32768, 0],
1261 [23329, 32768, 0],
1262 [21478, 32768, 0],
1263 [16384, 32768, 0],
1264 [16384, 32768, 0],
1265];
1266
1267/// `Default_Eob_Extra_Cdf[2][1][1]`: the same, for an 8x8 chroma transform.
1268pub const EOB_EXTRA_CHROMA_8: [[u16; 3]; 9] = [
1269 [20536, 32768, 0],
1270 [20664, 32768, 0],
1271 [20625, 32768, 0],
1272 [19123, 32768, 0],
1273 [14862, 32768, 0],
1274 [16384, 32768, 0],
1275 [16384, 32768, 0],
1276 [16384, 32768, 0],
1277 [16384, 32768, 0],
1278];
1279
1280/// `Default_Coeff_Base_Cdf[2][2][0]`: a 16x16 luma coefficient's base level.
1281pub const COEFF_BASE_LUMA_16: [[u16; 5]; 42] = [
1282 [9800, 17635, 21073, 32768, 0],
1283 [26153, 31885, 32527, 32768, 0],
1284 [15038, 27852, 31006, 32768, 0],
1285 [8718, 20564, 26486, 32768, 0],
1286 [5128, 14076, 20514, 32768, 0],
1287 [2636, 7566, 11925, 32768, 0],
1288 [27551, 32504, 32701, 32768, 0],
1289 [18310, 30054, 32100, 32768, 0],
1290 [10211, 23420, 29082, 32768, 0],
1291 [6222, 16876, 23916, 32768, 0],
1292 [3462, 9954, 15498, 32768, 0],
1293 [29991, 32633, 32721, 32768, 0],
1294 [19883, 30751, 32201, 32768, 0],
1295 [11141, 24184, 29285, 32768, 0],
1296 [6420, 16940, 23774, 32768, 0],
1297 [3392, 9753, 15118, 32768, 0],
1298 [28465, 32616, 32712, 32768, 0],
1299 [19850, 30702, 32244, 32768, 0],
1300 [10983, 24024, 29223, 32768, 0],
1301 [6294, 16770, 23582, 32768, 0],
1302 [3244, 9283, 14509, 32768, 0],
1303 [30023, 32717, 32748, 32768, 0],
1304 [22940, 32032, 32626, 32768, 0],
1305 [14282, 27928, 31473, 32768, 0],
1306 [8562, 21327, 27914, 32768, 0],
1307 [4846, 13393, 19919, 32768, 0],
1308 [29981, 32590, 32695, 32768, 0],
1309 [20465, 30963, 32166, 32768, 0],
1310 [11479, 23579, 28195, 32768, 0],
1311 [5916, 15648, 22073, 32768, 0],
1312 [3031, 8605, 13398, 32768, 0],
1313 [31146, 32691, 32739, 32768, 0],
1314 [23106, 31724, 32444, 32768, 0],
1315 [13783, 26738, 30439, 32768, 0],
1316 [7852, 19468, 25807, 32768, 0],
1317 [3860, 11124, 16853, 32768, 0],
1318 [31014, 32724, 32748, 32768, 0],
1319 [23629, 32109, 32628, 32768, 0],
1320 [14747, 28115, 31403, 32768, 0],
1321 [8545, 21242, 27478, 32768, 0],
1322 [4574, 12781, 19067, 32768, 0],
1323 [8192, 16384, 24576, 32768, 0],
1324];
1325
1326/// `Default_Coeff_Base_Cdf[2][1][1]`: an 8x8 chroma coefficient's base level.
1327pub const COEFF_BASE_CHROMA_8: [[u16; 5]; 42] = [
1328 [11016, 22111, 26794, 32768, 0],
1329 [25946, 32357, 32677, 32768, 0],
1330 [17890, 30452, 32252, 32768, 0],
1331 [11678, 25142, 29816, 32768, 0],
1332 [6720, 17534, 24584, 32768, 0],
1333 [4230, 11665, 17820, 32768, 0],
1334 [28400, 32623, 32747, 32768, 0],
1335 [21164, 31668, 32575, 32768, 0],
1336 [13572, 27388, 31182, 32768, 0],
1337 [8234, 20750, 27358, 32768, 0],
1338 [5065, 14055, 20897, 32768, 0],
1339 [28981, 32547, 32705, 32768, 0],
1340 [18681, 30543, 32239, 32768, 0],
1341 [10919, 24075, 29286, 32768, 0],
1342 [6431, 17199, 24077, 32768, 0],
1343 [3819, 10464, 16618, 32768, 0],
1344 [26870, 32467, 32693, 32768, 0],
1345 [19041, 30831, 32347, 32768, 0],
1346 [11794, 25211, 30016, 32768, 0],
1347 [6888, 18019, 24970, 32768, 0],
1348 [4370, 12363, 18992, 32768, 0],
1349 [29578, 32670, 32744, 32768, 0],
1350 [23159, 32007, 32613, 32768, 0],
1351 [15315, 28669, 31676, 32768, 0],
1352 [9298, 22607, 28782, 32768, 0],
1353 [6144, 15913, 22968, 32768, 0],
1354 [28110, 32499, 32669, 32768, 0],
1355 [21574, 30937, 32015, 32768, 0],
1356 [12759, 24818, 28727, 32768, 0],
1357 [6545, 16761, 23042, 32768, 0],
1358 [3649, 10597, 16833, 32768, 0],
1359 [28163, 32552, 32728, 32768, 0],
1360 [22101, 31469, 32464, 32768, 0],
1361 [13160, 25472, 30143, 32768, 0],
1362 [7303, 18684, 25468, 32768, 0],
1363 [5241, 13975, 20955, 32768, 0],
1364 [28400, 32631, 32744, 32768, 0],
1365 [22104, 31793, 32603, 32768, 0],
1366 [13557, 26571, 30846, 32768, 0],
1367 [7749, 19861, 26675, 32768, 0],
1368 [4873, 14030, 21234, 32768, 0],
1369 [8192, 16384, 24576, 32768, 0],
1370];
1371
1372/// `Default_Coeff_Base_Eob_Cdf[2][2][0]`: the base level of the last coefficient of a 16x16 luma transform.
1373pub const COEFF_BASE_EOB_LUMA_16: [[u16; 4]; 4] = [
1374 [12854, 29093, 32768, 0],
1375 [32272, 32558, 32768, 0],
1376 [32667, 32729, 32768, 0],
1377 [32306, 32585, 32768, 0],
1378];
1379
1380/// `Default_Coeff_Base_Eob_Cdf[2][1][1]`: the same, for an 8x8 chroma transform.
1381pub const COEFF_BASE_EOB_CHROMA_8: [[u16; 4]; 4] = [
1382 [27116, 30842, 32768, 0],
1383 [31971, 32598, 32768, 0],
1384 [32088, 32576, 32768, 0],
1385 [32067, 32664, 32768, 0],
1386];
1387
1388/// `Default_Coeff_Br_Cdf[2][2][0]`: the base-range tail of a 16x16 luma coefficient.
1389pub const COEFF_BR_LUMA_16: [[u16; 5]; 21] = [
1390 [14438, 20798, 24089, 32768, 0],
1391 [12621, 19203, 23097, 32768, 0],
1392 [8177, 14125, 18402, 32768, 0],
1393 [5674, 10501, 14456, 32768, 0],
1394 [4236, 8239, 11733, 32768, 0],
1395 [3447, 6750, 9806, 32768, 0],
1396 [1986, 3950, 5864, 32768, 0],
1397 [16208, 22099, 24930, 32768, 0],
1398 [16537, 24025, 27585, 32768, 0],
1399 [12780, 20381, 24867, 32768, 0],
1400 [9767, 16612, 21416, 32768, 0],
1401 [7686, 13738, 18398, 32768, 0],
1402 [6333, 11614, 15964, 32768, 0],
1403 [3941, 7571, 10836, 32768, 0],
1404 [22819, 27422, 29202, 32768, 0],
1405 [22224, 28514, 30721, 32768, 0],
1406 [17660, 25433, 28913, 32768, 0],
1407 [13574, 21482, 26002, 32768, 0],
1408 [10629, 17977, 22938, 32768, 0],
1409 [8612, 15298, 20265, 32768, 0],
1410 [5607, 10491, 14596, 32768, 0],
1411];
1412
1413/// `Default_Coeff_Br_Cdf[2][1][1]`: the base-range tail of an 8x8 chroma coefficient.
1414pub const COEFF_BR_CHROMA_8: [[u16; 5]; 21] = [
1415 [14433, 21155, 24938, 32768, 0],
1416 [14658, 21716, 25545, 32768, 0],
1417 [9923, 16824, 21557, 32768, 0],
1418 [6982, 13052, 17721, 32768, 0],
1419 [5419, 10503, 15050, 32768, 0],
1420 [4852, 9162, 13014, 32768, 0],
1421 [3271, 6395, 9630, 32768, 0],
1422 [22210, 27833, 30109, 32768, 0],
1423 [20750, 27368, 29821, 32768, 0],
1424 [16894, 24828, 28573, 32768, 0],
1425 [13247, 21276, 25757, 32768, 0],
1426 [10038, 17265, 22563, 32768, 0],
1427 [8587, 14947, 20327, 32768, 0],
1428 [5645, 11371, 15252, 32768, 0],
1429 [22027, 27526, 29714, 32768, 0],
1430 [23098, 29146, 31221, 32768, 0],
1431 [19886, 27341, 30272, 32768, 0],
1432 [15609, 23747, 28046, 32768, 0],
1433 [11993, 20065, 24939, 32768, 0],
1434 [9637, 18267, 23671, 32768, 0],
1435 [7625, 13801, 19144, 32768, 0],
1436];
1437
1438/// `Default_Partition_Cdf[0..4]`, `PARTITION_W16` format (spec 5.11.4 codes an
1439/// 8x8 block's partition as a 4-symbol read that only ever terminates
1440/// `PARTITION_NONE` for this writer -- `PARTITION_SPLIT` is illegal at 8x8, so
1441/// row 4 of libaom's real (8-symbol) 8x8 table is dropped and only the shared
1442/// leading four symbols, common to every partition-symbol alphabet, are kept.
1443pub const PARTITION_W8: [[u16; 5]; 4] = [
1444 [19132, 25510, 30392, 32768, 0],
1445 [13928, 19855, 28540, 32768, 0],
1446 [12522, 23679, 28629, 32768, 0],
1447 [9896, 18783, 25853, 32768, 0],
1448];
1449
1450/// `Default_Partition_Cdf[0..4]`: the partition symbol of a 16x16 block.
1451pub const PARTITION_W16: [[u16; 11]; 4] = [
1452 [
1453 15597, 20929, 24571, 26706, 27664, 28821, 29601, 30571, 31902, 32768, 0,
1454 ],
1455 [
1456 7925, 11043, 16785, 22470, 23971, 25043, 26651, 28701, 29834, 32768, 0,
1457 ],
1458 [
1459 5414, 13269, 15111, 20488, 22360, 24500, 25537, 26336, 32117, 32768, 0,
1460 ],
1461 [
1462 2662, 6362, 8614, 20860, 23053, 24778, 26436, 27829, 31171, 32768, 0,
1463 ],
1464];
1465
1466/// The transform type of a 16x16 intra luma transform, as an index into the
1467/// spec's `Tx_Type_Intra_Inv_Set2`, indexed by the block's luma mode.
1468///
1469/// A 16x16 intra transform is the only size this writer's intra path codes
1470/// whose transform-type set holds more than one type: 32x32 and 64x64 are
1471/// DCT-only for an *intra* block by spec 5.11.48's `get_tx_set` (its
1472/// `txSzSqrUp == TX_32X32` case returns `TX_SET_DCTONLY` only in the
1473/// `!is_inter` branch). An `is_inter` 32x32 transform takes the other branch
1474/// and reads [`INTER_TX_TYPE_SET3_32`] instead.
1475pub const INTRA_TX_TYPE_SET2_16: [[u16; 6]; 13] = [
1476 [1127, 12814, 22772, 27483, 32768, 0],
1477 [145, 6761, 11980, 26667, 32768, 0],
1478 [362, 5887, 11678, 16725, 32768, 0],
1479 [385, 15213, 18587, 30693, 32768, 0],
1480 [25, 2914, 23134, 27903, 32768, 0],
1481 [60, 4470, 11749, 23991, 32768, 0],
1482 [37, 3332, 14511, 21448, 32768, 0],
1483 [157, 6320, 13036, 17439, 32768, 0],
1484 [119, 6719, 12906, 29396, 32768, 0],
1485 [47, 5537, 12576, 21499, 32768, 0],
1486 [269, 6076, 11258, 23115, 32768, 0],
1487 [83, 5615, 12001, 17228, 32768, 0],
1488 [1968, 5556, 12023, 18547, 32768, 0],
1489];
1490
1491/// `Default_Inter_Ext_Tx_Cdf`'s `TX_SET_INTER_3` row for `TX_32X32` (spec
1492/// 9.4): the transform type of an `is_inter` 32x32 luma transform, whose
1493/// `get_tx_set` (5.11.48) returns `TX_SET_INTER_3` -- `{IDTX, DCT_DCT}` --
1494/// because `txSzSqrUp == TX_32X32` takes the `is_inter` branch there, unlike
1495/// an intra block's, which is DCT-only at that size. The writer only ever
1496/// uses DCT_DCT, index one of `Tx_Type_Inter_Inv_Set3`.
1497pub const INTER_TX_TYPE_SET3_32: [u16; 3] = [748, 32768, 0];
1498
1499/// `Default_Inter_Ext_Tx_Cdf`'s `TX_SET_INTER_3` row for `TX_16X16` (spec
1500/// 9.4): the transform type of an `is_inter` 16x16 luma transform coded under
1501/// `reduced_tx_set` (spec 5.11.48's `use_reduced_set` branch forces
1502/// `TX_SET_INTER_3` for every inter size below 32x32, the same two-symbol set
1503/// [`INTER_TX_TYPE_SET3_32`] reads at 32x32) -- without `reduced_tx_set` a
1504/// 16x16 inter transform reads the twelve-symbol `TX_SET_INTER_2` instead,
1505/// which this crate does not carry a table for. The writer only ever uses
1506/// DCT_DCT, index one of `Tx_Type_Inter_Inv_Set3`, same as the 32x32 table.
1507pub const INTER_TX_TYPE_SET3_16: [u16; 3] = [1998, 32768, 0];
1508
1509/// `Default_Inter_Ext_Tx_Cdf`'s `TX_SET_INTER_3` row for `TX_8X8` (spec 9.4):
1510/// the transform type of an `is_inter` 8x8 luma transform under
1511/// `reduced_tx_set` -- an 8x8 leaf under a straddling 16x16 block
1512/// (lane-av1inter8), the same two-symbol set [`INTER_TX_TYPE_SET3_16`] and
1513/// [`INTER_TX_TYPE_SET3_32`] read at their own sizes, just its own default
1514/// probability and adaptation state (libaom `entropymode.c`'s
1515/// `default_inter_ext_tx_cdf[EXT_TX_SET_DCT_IDTX][TX_8X8]`).
1516pub const INTER_TX_TYPE_SET3_8: [u16; 3] = [4167, 32768, 0];
1517
1518/// `Default_Inter_Ext_Tx_Cdf`'s `TX_SET_INTER_2` (`EXT_TX_SET_DTT9_IDTX_1DDCT`)
1519/// row for `TX_16X16` (lane-cdffwd2, spec 9.4/5.11.48): the twelve-symbol
1520/// transform type of an `is_inter` 16x16 luma transform when `reduced_tx_set
1521/// == 0` -- `av1_get_ext_tx_set_type`'s `av1_ext_tx_set_lookup[1][1]`, not
1522/// [`INTER_TX_TYPE_SET3_16`]'s two-symbol reduced set (libaom
1523/// `entropymode.c` `default_inter_ext_tx_cdf[2][TX_16X16]`).
1524pub const INTER_TX_TYPE_SET2_16: [u16; 13] = [
1525 770, 2421, 5225, 12907, 15819, 18927, 21561, 24089, 26595, 28526, 30529, 32768, 0,
1526];
1527
1528/// `Default_Inter_Ext_Tx_Cdf`'s `TX_SET_INTER_1` (`EXT_TX_SET_ALL16`) row for
1529/// `TX_4X4` (lane-txselect): the sixteen-symbol transform type of an
1530/// `is_inter` 4x4 luma transform when `reduced_tx_set == 0` (libaom
1531/// `entropymode.c` `default_inter_ext_tx_cdf[1][TX_4X4]`).
1532pub const INTER_TX_TYPE_SET1_4: [u16; 17] = [
1533 4458, 5560, 7695, 9709, 13330, 14789, 17537, 20266, 21504, 22848, 23934, 25474, 27727, 28915,
1534 30631, 32768, 0,
1535];
1536
1537/// `Default_Inter_Ext_Tx_Cdf`'s `TX_SET_INTER_3` (`EXT_TX_SET_DCT_IDTX`) row
1538/// for `TX_4X4` (lane-txselect), the reduced two-symbol counterpart of
1539/// [`INTER_TX_TYPE_SET1_4`] (`default_inter_ext_tx_cdf[3][TX_4X4]`).
1540pub const INTER_TX_TYPE_SET3_4: [u16; 3] = [16384, 32768, 0];
1541
1542/// `Default_Inter_Ext_Tx_Cdf`'s `TX_SET_INTER_1` (`EXT_TX_SET_ALL16`) row for
1543/// `TX_8X8` (lane-cdffwd2): the full sixteen-symbol transform type of an
1544/// `is_inter` 8x8 luma transform when `reduced_tx_set == 0`
1545/// (`av1_ext_tx_set_lookup[1][0]`, libaom `entropymode.c`
1546/// `default_inter_ext_tx_cdf[1][TX_8X8]`).
1547pub const INTER_TX_TYPE_SET1_8: [u16; 17] = [
1548 1645, 2573, 4778, 5711, 7807, 8622, 10522, 15357, 17674, 20408, 22517, 25010, 27116, 28856,
1549 30749, 32768, 0,
1550];
1551
1552// The inter-frame tables below (spec 9.4) support the syntax an inter block
1553// needs: whether it is coded as intra at all, which reference frame and
1554// motion vector it takes when it is not. The compound-reference tables
1555// (`COMP_MODE`/`COMP_REF_TYPE`/`UNI_COMP_REF`/`COMP_REF`/`COMP_BWDREF` above)
1556// read once a frame's `reference_select` header bit is set (lane-av1comp);
1557// compound *prediction* itself -- `inter_compound_mode`, compound DRL, the
1558// mvstack's dual-ref scan, and distance-weighted MC blending -- is not yet
1559// ported, so a block that actually reads `COMPOUND_REFERENCE` still refuses.
1560
1561/// `default_inter_compound_mode_cdf` (entropymode.c): which of the eight
1562/// `INTER_COMPOUND_MODES` (`NEAREST_NEARESTMV`..`NEW_NEWMV`) a compound
1563/// block takes, indexed by `av1_mode_context_analyzer`'s `comp_ctx` (spec
1564/// 5.11.24's `compound_mode`, libaom's `read_inter_compound_mode`) --
1565/// lane-av1comp, symbol read only, not yet wired into MV assignment or MC.
1566pub const INTER_COMPOUND_MODE: [[u16; 9]; 8] = [
1567 [7760, 13823, 15808, 17641, 19156, 20666, 26891, 32768, 0],
1568 [10730, 19452, 21145, 22749, 24039, 25131, 28724, 32768, 0],
1569 [10664, 20221, 21588, 22906, 24295, 25387, 28436, 32768, 0],
1570 [13298, 16984, 20471, 24182, 25067, 25736, 26422, 32768, 0],
1571 [18904, 23325, 25242, 27432, 27898, 28258, 30758, 32768, 0],
1572 [10725, 17454, 20124, 22820, 24195, 25168, 26046, 32768, 0],
1573 [17125, 24273, 25814, 27492, 28214, 28704, 30592, 32768, 0],
1574 [13046, 23214, 24505, 25942, 27435, 28442, 29330, 32768, 0],
1575];
1576
1577/// `compound_mode_ctx_map` (`mvref_common.h`): folds a compound block's
1578/// `new_mv_ctx`/`ref_mv_ctx` pair (row = `ref_mv_ctx >> 1`, column =
1579/// `min(new_mv_ctx, COMP_NEWMV_CTXS - 1)`, `COMP_NEWMV_CTXS` = 5) down to
1580/// the single `comp_ctx` [`INTER_COMPOUND_MODE`] is indexed by --
1581/// `av1_mode_context_analyzer`'s compound branch.
1582pub const COMPOUND_MODE_CTX_MAP: [[usize; 5]; 3] =
1583 [[0, 1, 1, 1, 1], [1, 2, 3, 4, 4], [4, 4, 5, 6, 7]];
1584
1585/// `Default_Intra_Inter_Cdf` (spec 9.4): whether an inter frame's block is
1586/// coded as intra, indexed by whether the block above and left are inter.
1587pub const INTRA_INTER: [[u16; 3]; 4] = [
1588 [806, 32768, 0],
1589 [16662, 32768, 0],
1590 [20186, 32768, 0],
1591 [26538, 32768, 0],
1592];
1593
1594/// `Default_Single_Ref_Cdf` (spec 9.4): the six binary decisions that narrow
1595/// an inter block's single reference frame down from the seven it can name,
1596/// indexed by the reference context of the blocks around it.
1597pub const SINGLE_REF: [[[u16; 3]; 6]; 3] = [
1598 [
1599 [4897, 32768, 0],
1600 [1555, 32768, 0],
1601 [4236, 32768, 0],
1602 [8650, 32768, 0],
1603 [904, 32768, 0],
1604 [1444, 32768, 0],
1605 ],
1606 [
1607 [16973, 32768, 0],
1608 [16751, 32768, 0],
1609 [19647, 32768, 0],
1610 [24773, 32768, 0],
1611 [11014, 32768, 0],
1612 [15087, 32768, 0],
1613 ],
1614 [
1615 [29744, 32768, 0],
1616 [30279, 32768, 0],
1617 [31194, 32768, 0],
1618 [31895, 32768, 0],
1619 [26875, 32768, 0],
1620 [30304, 32768, 0],
1621 ],
1622];
1623
1624/// `default_skip_mode_cdfs` (entropymode.c, `SKIP_MODE_CONTEXTS` = 3): whether
1625/// a block reads `skip_mode` (forced `NEAREST_NEARESTMV` compound, `skip`
1626/// forced true, no residual) -- indexed by `av1_get_skip_mode_context`
1627/// (`above.skip_mode + left.skip_mode`, `pred_common.h`), only read when this
1628/// frame's own `skip_mode_present` header bit is set and the block is at
1629/// least 8x8 both dims (`is_comp_ref_allowed`) -- lane-av1comp.
1630pub const SKIP_MODE: [[u16; 3]; 3] = [[32621, 32768, 0], [20708, 32768, 0], [8127, 32768, 0]];
1631
1632/// `default_obmc_cdf` (spec 9.4): `use_obmc`, by square bsize (`BLOCK_8X8`,
1633/// `BLOCK_16X16`, `BLOCK_32X32`, `BLOCK_64X64` -- `BLOCK_SIZES_ALL` indices
1634/// 3/6/9/12, the only sizes this decoder ever codes). Read only once
1635/// `motion_mode_allowed` (spec 5.11.24's `read_motion_mode`) offers
1636/// `OBMC_CAUSAL` rather than `WARPED_CAUSAL` -- lane-motionmode round 1
1637/// never reaches the three-way `motion_mode_cdf`, see `decode.rs`.
1638pub const OBMC: [[u16; 3]; 17] = [
1639 [10437, 32768, 0],
1640 [17432, 32768, 0],
1641 [25817, 32768, 0],
1642 [30128, 32768, 0],
1643 // lane-rect r2: BLOCK_16X32 (index 7) and BLOCK_32X16 (index 8) rows --
1644 // rect strips read their own bsize row, not the square class
1645 // (rect-flake-1: the strip's motion_mode read diverged on this).
1646 [14423, 32768, 0],
1647 [15142, 32768, 0],
1648 // lane-inter4 r1: the rect rows a superblock-level HORZ/VERT/1:4 and a
1649 // 32x32-level 1:4 inter strip read -- BLOCK_32X64 (10), BLOCK_64X32 (11),
1650 // BLOCK_8X32 (18), BLOCK_32X8 (19), BLOCK_16X64 (20), BLOCK_64X16 (21) of
1651 // libaom's `default_obmc_cdf`.
1652 [22823, 32768, 0],
1653 [22083, 32768, 0],
1654 [23664, 32768, 0],
1655 [20901, 32768, 0],
1656 [24008, 32768, 0],
1657 [26879, 32768, 0],
1658 // lane-inter4 r3: the 16x16-level rect inter leaves' own rows --
1659 // BLOCK_8X16 (4) and BLOCK_16X8 (5) of libaom's `default_obmc_cdf`.
1660 [9371, 32768, 0],
1661 [9301, 32768, 0],
1662 // lane-sb128c r5: the 128-root rows -- BLOCK_64X128 (13), BLOCK_128X64
1663 // (14), BLOCK_128X128 (15) of libaom's `default_obmc_cdf`.
1664 [31014, 32768, 0],
1665 [31560, 32768, 0],
1666 [32638, 32768, 0],
1667];
1668
1669/// `default_motion_mode_cdf` (spec 9.4, `entropymode.c`), the square-bsize
1670/// rows only (`BLOCK_8X8`/`16X16`/`32X32`/`64X64` -- indices 3/6/9/12 of
1671/// libaom's `BLOCK_SIZES_ALL`, same square subset [`OBMC`] keeps): the
1672/// 3-symbol `SIMPLE_TRANSLATION`/`OBMC_CAUSAL`/`WARPED_CAUSAL` alphabet
1673/// `read_motion_mode` reads instead of [`OBMC`] whenever `motion_mode_allowed`
1674/// (spec 5.11.24) resolves to `WARPED_CAUSAL`-eligible (`num_proj_ref >= 1`
1675/// under `allow_warped_motion`) -- lane-warp round 1.
1676pub const MOTION_MODE: [[u16; 4]; 17] = [
1677 [7651, 24760, 32768, 0],
1678 [19419, 26810, 32768, 0],
1679 [26260, 29116, 32768, 0],
1680 [29516, 30701, 32768, 0],
1681 // lane-rect r2: BLOCK_16X32 / BLOCK_32X16 rows (indices 7/8).
1682 [5123, 23606, 32768, 0],
1683 [11606, 24308, 32768, 0],
1684 // lane-inter4 r1: BLOCK_32X64 / 64X32 / 8X32 / 32X8 / 16X64 / 64X16 rows
1685 // (libaom `default_motion_mode_cdf` indices 10, 11, 18, 19, 20, 21).
1686 [20360, 28062, 32768, 0],
1687 [21679, 26830, 32768, 0],
1688 [28799, 31390, 32768, 0],
1689 [26431, 30774, 32768, 0],
1690 [28973, 31594, 32768, 0],
1691 [29742, 31203, 32768, 0],
1692 // lane-inter4 r3: BLOCK_8X16 / BLOCK_16X8 rows (libaom
1693 // `default_motion_mode_cdf` indices 4 and 5).
1694 [4738, 24765, 32768, 0],
1695 [5391, 25528, 32768, 0],
1696 // lane-sb128c r5: BLOCK_64X128 / 128X64 / 128X128 rows (libaom
1697 // `default_motion_mode_cdf` indices 13, 14, 15). Without them a 128x128
1698 // inter block fell through `w == h => trailing_zeros - 3` to row 4 (the
1699 // BLOCK_16X32 row) and narrowed the msac by the wrong interval.
1700 [28898, 30397, 32768, 0],
1701 [30878, 31335, 32768, 0],
1702 [32507, 32558, 32768, 0],
1703];
1704
1705/// `default_interintra_cdf` (spec 9.4): `interintra`, indexed by
1706/// `size_group_lookup[bsize]` (0..=3) -- read only when the sequence header's
1707/// `enable_interintra_compound` is set and `is_interintra_allowed(mbmi)`
1708/// holds (single-ref, `BLOCK_8X8..=BLOCK_32X32`, mode `NEARESTMV..NEWMV`);
1709/// lane-sb128 r3: consuming this symbol (even always-refused on `interintra
1710/// == 1`) is required to stay bit-aligned with every later block once the
1711/// sequence header turns the tool on -- see decode.rs's own read site.
1712pub const INTERINTRA: [[u16; 3]; 4] = [
1713 [16384, 32768, 0],
1714 [26887, 32768, 0],
1715 [27597, 32768, 0],
1716 [30237, 32768, 0],
1717];
1718
1719/// `default_interintra_mode_cdf` (spec 9.4): `interintra_mode` (II_DC/II_V/
1720/// II_H/II_SMOOTH), indexed by `size_group_lookup[bsize]`, read right after
1721/// `interintra == 1` (lane-interintra r1).
1722pub const INTERINTRA_MODE: [[u16; 5]; 4] = [
1723 [8192, 16384, 24576, 32768, 0],
1724 [1875, 11082, 27332, 32768, 0],
1725 [2473, 9996, 26388, 32768, 0],
1726 [4238, 11537, 25926, 32768, 0],
1727];
1728
1729/// `default_wedge_interintra_cdf` (spec 9.4): `wedge_interintra`, indexed by
1730/// bsize over `BLOCK_SIZES_ALL` -- read for every interintra block whose
1731/// size `av1_is_wedge_used` allows (the 8x8..32x32 family), REGARDLESS of
1732/// the sequence header's `enable_interintra_wedge` bit (libaom
1733/// decodemv.c:1548 gates on block size alone; the seq bit constrains only
1734/// the encoder).
1735pub const WEDGE_INTERINTRA: [[u16; 3]; 22] = [
1736 [16384, 32768, 0],
1737 [16384, 32768, 0],
1738 [16384, 32768, 0],
1739 [20036, 32768, 0],
1740 [24957, 32768, 0],
1741 [26704, 32768, 0],
1742 [27530, 32768, 0],
1743 [29564, 32768, 0],
1744 [29444, 32768, 0],
1745 [26872, 32768, 0],
1746 [16384, 32768, 0],
1747 [16384, 32768, 0],
1748 [16384, 32768, 0],
1749 [16384, 32768, 0],
1750 [16384, 32768, 0],
1751 [16384, 32768, 0],
1752 [16384, 32768, 0],
1753 [16384, 32768, 0],
1754 [16384, 32768, 0],
1755 [16384, 32768, 0],
1756 [16384, 32768, 0],
1757 [16384, 32768, 0],
1758];
1759
1760/// `default_compound_type_cdf` (spec 9.4, libaom `entropymode.c`):
1761/// `compound_type` (`MASKED_COMPOUND_TYPES` == 2: `COMPOUND_WEDGE` vs
1762/// `COMPOUND_DIFFWTD`), indexed by bsize over `BLOCK_SIZES_ALL`, read only
1763/// on the `comp_group_idx == 1` (masked-compound) path -- lane-maskcomp.
1764pub const COMPOUND_TYPE: [[u16; 3]; 22] = [
1765 [16384, 32768, 0],
1766 [16384, 32768, 0],
1767 [16384, 32768, 0],
1768 [23431, 32768, 0],
1769 [13171, 32768, 0],
1770 [11470, 32768, 0],
1771 [9770, 32768, 0],
1772 [9100, 32768, 0],
1773 [8233, 32768, 0],
1774 [6172, 32768, 0],
1775 [16384, 32768, 0],
1776 [16384, 32768, 0],
1777 [16384, 32768, 0],
1778 [16384, 32768, 0],
1779 [16384, 32768, 0],
1780 [16384, 32768, 0],
1781 [16384, 32768, 0],
1782 [16384, 32768, 0],
1783 [11820, 32768, 0],
1784 [7701, 32768, 0],
1785 [16384, 32768, 0],
1786 [16384, 32768, 0],
1787];
1788
1789/// `default_wedge_idx_cdf` (spec 9.4, libaom `entropymode.c`): `wedge_index`
1790/// (16-ary, `MAX_WEDGE_TYPES`), indexed by bsize over `BLOCK_SIZES_ALL` --
1791/// read only when `interinter_comp.type == COMPOUND_WEDGE` (lane-maskcomp).
1792pub const WEDGE_IDX: [[u16; 17]; 22] = [
1793 [
1794 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
1795 28672, 30720, 32768, 0,
1796 ],
1797 [
1798 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
1799 28672, 30720, 32768, 0,
1800 ],
1801 [
1802 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
1803 28672, 30720, 32768, 0,
1804 ],
1805 [
1806 2438, 4440, 6599, 8663, 11005, 12874, 15751, 18094, 20359, 22362, 24127, 25702, 27752,
1807 29450, 31171, 32768, 0,
1808 ],
1809 [
1810 806, 3266, 6005, 6738, 7218, 7367, 7771, 14588, 16323, 17367, 18452, 19422, 22839, 26127,
1811 29629, 32768, 0,
1812 ],
1813 [
1814 2779, 3738, 4683, 7213, 7775, 8017, 8655, 14357, 17939, 21332, 24520, 27470, 29456, 30529,
1815 31656, 32768, 0,
1816 ],
1817 [
1818 1684, 3625, 5675, 7108, 9302, 11274, 14429, 17144, 19163, 20961, 22884, 24471, 26719,
1819 28714, 30877, 32768, 0,
1820 ],
1821 [
1822 1142, 3491, 6277, 7314, 8089, 8355, 9023, 13624, 15369, 16730, 18114, 19313, 22521, 26012,
1823 29550, 32768, 0,
1824 ],
1825 [
1826 2742, 4195, 5727, 8035, 8980, 9336, 10146, 14124, 17270, 20533, 23434, 25972, 27944, 29570,
1827 31416, 32768, 0,
1828 ],
1829 [
1830 1727, 3948, 6101, 7796, 9841, 12344, 15766, 18944, 20638, 22038, 23963, 25311, 26988,
1831 28766, 31012, 32768, 0,
1832 ],
1833 [
1834 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
1835 28672, 30720, 32768, 0,
1836 ],
1837 [
1838 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
1839 28672, 30720, 32768, 0,
1840 ],
1841 [
1842 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
1843 28672, 30720, 32768, 0,
1844 ],
1845 [
1846 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
1847 28672, 30720, 32768, 0,
1848 ],
1849 [
1850 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
1851 28672, 30720, 32768, 0,
1852 ],
1853 [
1854 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
1855 28672, 30720, 32768, 0,
1856 ],
1857 [
1858 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
1859 28672, 30720, 32768, 0,
1860 ],
1861 [
1862 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
1863 28672, 30720, 32768, 0,
1864 ],
1865 [
1866 154, 987, 1925, 2051, 2088, 2111, 2151, 23033, 23703, 24284, 24985, 25684, 27259, 28883,
1867 30911, 32768, 0,
1868 ],
1869 [
1870 1135, 1322, 1493, 2635, 2696, 2737, 2770, 21016, 22935, 25057, 27251, 29173, 30089, 30960,
1871 31933, 32768, 0,
1872 ],
1873 [
1874 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
1875 28672, 30720, 32768, 0,
1876 ],
1877 [
1878 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
1879 28672, 30720, 32768, 0,
1880 ],
1881];
1882
1883/// `Default_Comp_Mode_Cdf` (spec 9.4, `default_comp_inter_cdf`): whether an
1884/// inter block reads `SINGLE_REFERENCE` or `COMPOUND_REFERENCE` -- only
1885/// reached once `read_ref_frames` knows the frame's `reference_select`
1886/// header bit made the choice per-block instead of fixing it, indexed by
1887/// `av1_get_reference_mode_context` (lane-av1comp).
1888pub const COMP_MODE: [[u16; 3]; 5] = [
1889 [26828, 32768, 0],
1890 [24035, 32768, 0],
1891 [12031, 32768, 0],
1892 [10640, 32768, 0],
1893 [2901, 32768, 0],
1894];
1895
1896/// `Default_Comp_Ref_Type_Cdf` (spec 9.4, `default_comp_ref_type_cdf`):
1897/// unidirectional vs. bidirectional compound reference pair, indexed by
1898/// `av1_get_comp_reference_type_context`.
1899pub const COMP_REF_TYPE: [[u16; 3]; 5] = [
1900 [1198, 32768, 0],
1901 [2070, 32768, 0],
1902 [9166, 32768, 0],
1903 [7499, 32768, 0],
1904 [22475, 32768, 0],
1905];
1906
1907/// `Default_Comp_Group_Idx_Cdf` (spec 9.4, libaom `default_comp_group_idx_cdfs`):
1908/// whether a compound block's `comp_group_idx` picks masked compound (`1`)
1909/// over the plain distance-weighted/simple-average blend (`0`), indexed by
1910/// `get_comp_group_idx_context` -- only read when `seq.enable_masked_compound`
1911/// and the block size is masked-compound-eligible (lane-av1comp).
1912pub const COMP_GROUP_IDX: [[u16; 3]; 6] = [
1913 [26607, 32768, 0],
1914 [22891, 32768, 0],
1915 [18840, 32768, 0],
1916 [24594, 32768, 0],
1917 [19934, 32768, 0],
1918 [22674, 32768, 0],
1919];
1920
1921/// `Default_Compound_Idx_Cdf` (spec 9.4, libaom `default_compound_idx_cdfs`):
1922/// whether a compound block's `compound_idx` picks the simple average
1923/// (`1`) or [`crate::compound::dist_wtd_comp_weight_assign`]'s distance
1924/// weights (`0`), indexed by `get_comp_index_context` -- only read when
1925/// `seq.enable_jnt_comp` (lane-av1comp).
1926pub const COMPOUND_IDX: [[u16; 3]; 6] = [
1927 [18244, 32768, 0],
1928 [12865, 32768, 0],
1929 [7053, 32768, 0],
1930 [13259, 32768, 0],
1931 [9334, 32768, 0],
1932 [4644, 32768, 0],
1933];
1934
1935/// `Default_Uni_Comp_Ref_Cdf` (spec 9.4, `default_uni_comp_ref_cdf`): the
1936/// three binary decisions narrowing a unidirectional compound pair down to
1937/// one of `{BWDREF,ALTREF}`/`{LAST,LAST2}`/`{LAST,LAST3}`/`{LAST,GOLDEN}`.
1938pub const UNI_COMP_REF: [[[u16; 3]; 3]; 3] = [
1939 [[5284, 32768, 0], [3865, 32768, 0], [3128, 32768, 0]],
1940 [[23152, 32768, 0], [14173, 32768, 0], [15270, 32768, 0]],
1941 [[31774, 32768, 0], [25120, 32768, 0], [26710, 32768, 0]],
1942];
1943
1944/// `Default_Comp_Ref_Cdf` (spec 9.4, `default_comp_ref_cdf`): the three
1945/// binary decisions narrowing a bidirectional pair's forward reference.
1946pub const COMP_REF: [[[u16; 3]; 3]; 3] = [
1947 [[4946, 32768, 0], [9468, 32768, 0], [1503, 32768, 0]],
1948 [[19891, 32768, 0], [22441, 32768, 0], [15160, 32768, 0]],
1949 [[30731, 32768, 0], [31059, 32768, 0], [27544, 32768, 0]],
1950];
1951
1952/// `Default_Comp_Bwdref_Cdf` (spec 9.4, `default_comp_bwdref_cdf`): the two
1953/// binary decisions narrowing a bidirectional pair's backward reference.
1954pub const COMP_BWDREF: [[[u16; 3]; 2]; 3] = [
1955 [[2235, 32768, 0], [1423, 32768, 0]],
1956 [[17182, 32768, 0], [15175, 32768, 0]],
1957 [[30606, 32768, 0], [30489, 32768, 0]],
1958];
1959
1960/// `Default_Y_Mode_Cdf` (spec 9.4): the thirteen luma intra modes of an inter
1961/// frame's intra block, indexed by the block's size group -- unlike a key
1962/// frame's [`KF_Y_MODE`], which is indexed by the neighbours' modes instead.
1963pub const Y_MODE: [[u16; 14]; 4] = [
1964 [
1965 22801, 23489, 24293, 24756, 25601, 26123, 26606, 27418, 27945, 29228, 29685, 30349, 32768,
1966 0,
1967 ],
1968 [
1969 18673, 19845, 22631, 23318, 23950, 24649, 25527, 27364, 28152, 29701, 29984, 30852, 32768,
1970 0,
1971 ],
1972 [
1973 19770, 20979, 23396, 23939, 24241, 24654, 25136, 27073, 27830, 29360, 29730, 30659, 32768,
1974 0,
1975 ],
1976 [
1977 20155, 21301, 22838, 23178, 23261, 23533, 23703, 24804, 25352, 26575, 27016, 28049, 32768,
1978 0,
1979 ],
1980];
1981
1982/// `Default_New_Mv_Cdf` (spec 9.4): whether an inter block's motion vector is
1983/// coded explicitly rather than taken from a neighbour, indexed by how many
1984/// neighbours already chose a new vector.
1985pub const NEW_MV: [[u16; 3]; 6] = [
1986 [24035, 32768, 0],
1987 [16630, 32768, 0],
1988 [15339, 32768, 0],
1989 [8386, 32768, 0],
1990 [12222, 32768, 0],
1991 [4676, 32768, 0],
1992];
1993
1994/// `Default_Zero_Mv_Cdf` (spec 9.4): whether an inter block's motion vector is
1995/// the zero vector, indexed by whether the block's global motion type is
1996/// identity.
1997pub const ZERO_MV: [[u16; 3]; 2] = [[2175, 32768, 0], [1054, 32768, 0]];
1998
1999/// `Default_Ref_Mv_Cdf` (spec 9.4): which of the block's reference motion
2000/// vector candidates it takes, indexed by how many candidates are available.
2001pub const REF_MV: [[u16; 3]; 6] = [
2002 [23974, 32768, 0],
2003 [24188, 32768, 0],
2004 [17848, 32768, 0],
2005 [28622, 32768, 0],
2006 [24312, 32768, 0],
2007 [19923, 32768, 0],
2008];
2009
2010/// `Default_Drl_Mode_Cdf` (spec 9.4): the dynamic reference list index a
2011/// block's motion vector prediction is drawn from, indexed by the list's
2012/// context.
2013pub const DRL_MODE: [[u16; 3]; 3] = [[13104, 32768, 0], [24560, 32768, 0], [18945, 32768, 0]];
2014
2015// The motion vector tables below (spec 9.4's `Default_Mv_*`) are the shared
2016// defaults for both components of a vector: [`crate::cdf_state::Cdfs`] holds
2017// one owned copy of each per component, seeded from the same constant here,
2018// since the spec's default state does not distinguish them -- only adaptation
2019// does, once a tile has coded a few vectors.
2020
2021/// `Default_Mv_Joint_Cdf` (spec 9.4): which of a motion vector's two
2022/// components change at all.
2023pub const MV_JOINT: [u16; 5] = [4096, 11264, 19328, 32768, 0];
2024
2025/// `Default_Mv_Class_Cdf` (spec 9.4): the magnitude class of one motion
2026/// vector component.
2027pub const MV_CLASS: [u16; 12] = [
2028 28672, 30976, 31858, 32320, 32551, 32656, 32740, 32757, 32762, 32767, 32768, 0,
2029];
2030
2031/// `Default_Mv_Class0_Bit_Cdf` (spec 9.4): the integer bit of a small-class
2032/// motion vector's magnitude.
2033pub const MV_CLASS0_BIT: [u16; 3] = [27648, 32768, 0];
2034
2035/// `Default_Mv_Class0_Fr_Cdf` (spec 9.4): the fractional part of a
2036/// small-class motion vector's magnitude, indexed by its integer bit.
2037pub const MV_CLASS0_FR: [[u16; 5]; 2] = [
2038 [16384, 24576, 26624, 32768, 0],
2039 [12288, 21248, 24128, 32768, 0],
2040];
2041
2042/// `Default_Mv_Class0_Hp_Cdf` (spec 9.4): the half-pel bit of a small-class
2043/// motion vector's magnitude.
2044pub const MV_CLASS0_HP: [u16; 3] = [20480, 32768, 0];
2045
2046/// `Default_Mv_Bit_Cdf` (spec 9.4): one bit of a motion vector's integer
2047/// magnitude above the small-class range, indexed by the bit's position.
2048pub const MV_BIT: [[u16; 3]; 10] = [
2049 [17408, 32768, 0],
2050 [17920, 32768, 0],
2051 [18944, 32768, 0],
2052 [20480, 32768, 0],
2053 [22528, 32768, 0],
2054 [24576, 32768, 0],
2055 [28672, 32768, 0],
2056 [29952, 32768, 0],
2057 [29952, 32768, 0],
2058 [30720, 32768, 0],
2059];
2060
2061/// `Default_Mv_Fr_Cdf` (spec 9.4): the fractional part of a motion vector's
2062/// magnitude, outside the small-class range.
2063pub const MV_FR: [u16; 5] = [8192, 17408, 21248, 32768, 0];
2064
2065/// `Default_Mv_Hp_Cdf` (spec 9.4): the half-pel bit of a motion vector's
2066/// magnitude, outside the small-class range.
2067pub const MV_HP: [u16; 3] = [16384, 32768, 0];
2068
2069/// `Default_Mv_Sign_Cdf` (spec 9.4): the sign of a motion vector component.
2070pub const MV_SIGN: [u16; 3] = [16384, 32768, 0];
2071
2072// q-context 0/1/3 coefficient CDFs (spec 9.4's `Default_..._Cdf[0]`,
2073// `[1]` and `[3]`), auto-derived from the same libaom `token_cdfs.h` the
2074// q-context-2 tables above were transcribed from, and checked by reproducing
2075// every q-context-2 table above byte-for-byte with the same indexing before
2076// generating these (see the lane report for the check).
2077
2078// q-context 0: base_q_idx 0..=20.
2079
2080/// TXB_SKIP_LUMA_64, q-context 0: the same table as [`TXB_SKIP_LUMA_64`], for `base_q_idx` 0..=20.
2081pub const TXB_SKIP_LUMA_64_Q0: [u16; 3] = [6308, 32768, 0];
2082/// TXB_SKIP_LUMA_32, q-context 0: the same table as [`TXB_SKIP_LUMA_32`], for `base_q_idx` 0..=20.
2083pub const TXB_SKIP_LUMA_32_Q0: [u16; 3] = [17920, 32768, 0];
2084/// TXB_SKIP_LUMA_16, q-context 0: the same table as [`TXB_SKIP_LUMA_16`], for `base_q_idx` 0..=20.
2085pub const TXB_SKIP_LUMA_16_Q0: [u16; 3] = [29957, 32768, 0];
2086/// TXB_SKIP_CHROMA_8, q-context 0: the same table as [`TXB_SKIP_CHROMA_8`], for `base_q_idx` 0..=20.
2087pub const TXB_SKIP_CHROMA_8_Q0: [[u16; 3]; 3] =
2088 [[5403, 32768, 0], [18096, 32768, 0], [30003, 32768, 0]];
2089/// TXB_SKIP_CHROMA_16, q-context 0: the same table as [`TXB_SKIP_CHROMA_16`], for `base_q_idx` 0..=20.
2090pub const TXB_SKIP_CHROMA_16_Q0: [[u16; 3]; 3] =
2091 [[3778, 32768, 0], [15336, 32768, 0], [28981, 32768, 0]];
2092/// TXB_SKIP_CHROMA_32, q-context 0: the same table as [`TXB_SKIP_CHROMA_32`], for `base_q_idx` 0..=20.
2093pub const TXB_SKIP_CHROMA_32_Q0: [[u16; 3]; 3] =
2094 [[1366, 32768, 0], [15628, 32768, 0], [30462, 32768, 0]];
2095/// EOB_EXTRA_LUMA_16, q-context 0: the same table as [`EOB_EXTRA_LUMA_16`], for `base_q_idx` 0..=20.
2096pub const EOB_EXTRA_LUMA_16_Q0: [[u16; 3]; 9] = [
2097 [23905, 32768, 0],
2098 [17194, 32768, 0],
2099 [16170, 32768, 0],
2100 [17695, 32768, 0],
2101 [13826, 32768, 0],
2102 [15810, 32768, 0],
2103 [12036, 32768, 0],
2104 [16384, 32768, 0],
2105 [16384, 32768, 0],
2106];
2107/// EOB_EXTRA_LUMA_32, q-context 0: the same table as [`EOB_EXTRA_LUMA_32`], for `base_q_idx` 0..=20.
2108pub const EOB_EXTRA_LUMA_32_Q0: [[u16; 3]; 9] = [
2109 [27399, 32768, 0],
2110 [16327, 32768, 0],
2111 [18071, 32768, 0],
2112 [19584, 32768, 0],
2113 [20721, 32768, 0],
2114 [18432, 32768, 0],
2115 [19560, 32768, 0],
2116 [10150, 32768, 0],
2117 [8805, 32768, 0],
2118];
2119/// EOB_EXTRA_LUMA_64, q-context 0: the same table as [`EOB_EXTRA_LUMA_64`], for `base_q_idx` 0..=20.
2120pub const EOB_EXTRA_LUMA_64_Q0: [[u16; 3]; 9] = [
2121 [23406, 32768, 0],
2122 [21845, 32768, 0],
2123 [18432, 32768, 0],
2124 [16384, 32768, 0],
2125 [17096, 32768, 0],
2126 [12561, 32768, 0],
2127 [17320, 32768, 0],
2128 [22395, 32768, 0],
2129 [21370, 32768, 0],
2130];
2131/// EOB_EXTRA_CHROMA_8, q-context 0: the same table as [`EOB_EXTRA_CHROMA_8`], for `base_q_idx` 0..=20.
2132pub const EOB_EXTRA_CHROMA_8_Q0: [[u16; 3]; 9] = [
2133 [20681, 32768, 0],
2134 [20701, 32768, 0],
2135 [15250, 32768, 0],
2136 [15017, 32768, 0],
2137 [14928, 32768, 0],
2138 [16384, 32768, 0],
2139 [16384, 32768, 0],
2140 [16384, 32768, 0],
2141 [16384, 32768, 0],
2142];
2143/// EOB_EXTRA_CHROMA_16, q-context 0: the same table as [`EOB_EXTRA_CHROMA_16`], for `base_q_idx` 0..=20.
2144pub const EOB_EXTRA_CHROMA_16_Q0: [[u16; 3]; 9] = [
2145 [23959, 32768, 0],
2146 [20799, 32768, 0],
2147 [19021, 32768, 0],
2148 [16203, 32768, 0],
2149 [17886, 32768, 0],
2150 [14144, 32768, 0],
2151 [12010, 32768, 0],
2152 [16384, 32768, 0],
2153 [16384, 32768, 0],
2154];
2155/// EOB_EXTRA_CHROMA_32, q-context 0: the same table as [`EOB_EXTRA_CHROMA_32`], for `base_q_idx` 0..=20.
2156pub const EOB_EXTRA_CHROMA_32_Q0: [[u16; 3]; 9] = [
2157 [24932, 32768, 0],
2158 [20833, 32768, 0],
2159 [12027, 32768, 0],
2160 [16670, 32768, 0],
2161 [19914, 32768, 0],
2162 [15106, 32768, 0],
2163 [17662, 32768, 0],
2164 [13783, 32768, 0],
2165 [28756, 32768, 0],
2166];
2167/// EOB_PT_1024_LUMA, q-context 0: the same table as [`EOB_PT_1024_LUMA`], for `base_q_idx` 0..=20.
2168pub const EOB_PT_1024_LUMA_Q0: [u16; 12] = [
2169 393, 421, 751, 1623, 3160, 6352, 13345, 18047, 22571, 25830, 32768, 0,
2170];
2171/// EOB_PT_1024_CHROMA, q-context 0: the same table as [`EOB_PT_1024_CHROMA`], for `base_q_idx` 0..=20.
2172pub const EOB_PT_1024_CHROMA_Q0: [u16; 12] = [
2173 1865, 1988, 2930, 4242, 10533, 16538, 21354, 27255, 28546, 31784, 32768, 0,
2174];
2175/// EOB_PT_256_LUMA, q-context 0: the same table as [`EOB_PT_256_LUMA`], for `base_q_idx` 0..=20.
2176pub const EOB_PT_256_LUMA_Q0: [u16; 10] =
2177 [310, 584, 1887, 3589, 6168, 8611, 11352, 15652, 32768, 0];
2178/// EOB_PT_256_CHROMA, q-context 0: the same table as [`EOB_PT_256_CHROMA`], for `base_q_idx` 0..=20.
2179pub const EOB_PT_256_CHROMA_Q0: [u16; 10] =
2180 [2520, 3240, 5952, 8870, 12577, 17558, 19954, 24168, 32768, 0];
2181/// EOB_PT_64_CHROMA, q-context 0: the same table as [`EOB_PT_64_CHROMA`], for `base_q_idx` 0..=20.
2182pub const EOB_PT_64_CHROMA_Q0: [u16; 8] = [3505, 5304, 10086, 13814, 17684, 23370, 32768, 0];
2183/// COEFF_BASE_LUMA_16, q-context 0: the same table as [`COEFF_BASE_LUMA_16`], for `base_q_idx` 0..=20.
2184pub const COEFF_BASE_LUMA_16_Q0: [[u16; 5]; 42] = [
2185 [5487, 10460, 13708, 32768, 0],
2186 [21597, 28303, 30674, 32768, 0],
2187 [11037, 21953, 26476, 32768, 0],
2188 [8147, 17962, 22952, 32768, 0],
2189 [5242, 13061, 18532, 32768, 0],
2190 [1889, 5208, 8182, 32768, 0],
2191 [26774, 32133, 32590, 32768, 0],
2192 [17844, 29564, 31767, 32768, 0],
2193 [11690, 24438, 29171, 32768, 0],
2194 [7542, 18215, 24459, 32768, 0],
2195 [2993, 8050, 12319, 32768, 0],
2196 [28023, 32328, 32591, 32768, 0],
2197 [18651, 30126, 31954, 32768, 0],
2198 [12164, 25146, 29589, 32768, 0],
2199 [7762, 18530, 24771, 32768, 0],
2200 [3492, 9183, 13920, 32768, 0],
2201 [27591, 32008, 32491, 32768, 0],
2202 [17149, 28853, 31510, 32768, 0],
2203 [11485, 24003, 28860, 32768, 0],
2204 [7697, 18086, 24210, 32768, 0],
2205 [3075, 7999, 12218, 32768, 0],
2206 [28268, 32482, 32654, 32768, 0],
2207 [19631, 31051, 32404, 32768, 0],
2208 [13860, 27260, 31020, 32768, 0],
2209 [9605, 21613, 27594, 32768, 0],
2210 [4876, 12162, 17908, 32768, 0],
2211 [27248, 32316, 32576, 32768, 0],
2212 [18955, 30457, 32075, 32768, 0],
2213 [11824, 23997, 28795, 32768, 0],
2214 [7346, 18196, 24647, 32768, 0],
2215 [3403, 9247, 14111, 32768, 0],
2216 [29711, 32655, 32735, 32768, 0],
2217 [21169, 31394, 32417, 32768, 0],
2218 [13487, 27198, 30957, 32768, 0],
2219 [8828, 21683, 27614, 32768, 0],
2220 [4270, 11451, 17038, 32768, 0],
2221 [28708, 32578, 32731, 32768, 0],
2222 [20120, 31241, 32482, 32768, 0],
2223 [13692, 27550, 31321, 32768, 0],
2224 [9418, 22514, 28439, 32768, 0],
2225 [4999, 13283, 19462, 32768, 0],
2226 [8192, 16384, 24576, 32768, 0],
2227];
2228/// COEFF_BASE_LUMA_32, q-context 0: the same table as [`COEFF_BASE_LUMA_32`], for `base_q_idx` 0..=20.
2229pub const COEFF_BASE_LUMA_32_Q0: [[u16; 5]; 42] = [
2230 [5141, 7096, 8260, 32768, 0],
2231 [27186, 29022, 29789, 32768, 0],
2232 [6668, 12568, 15682, 32768, 0],
2233 [2172, 6181, 8638, 32768, 0],
2234 [1126, 3379, 4531, 32768, 0],
2235 [443, 1361, 2254, 32768, 0],
2236 [26083, 31153, 32436, 32768, 0],
2237 [13486, 24603, 28483, 32768, 0],
2238 [6508, 14840, 19910, 32768, 0],
2239 [3386, 8800, 13286, 32768, 0],
2240 [1530, 4322, 7054, 32768, 0],
2241 [29639, 32080, 32548, 32768, 0],
2242 [15897, 27552, 30290, 32768, 0],
2243 [8588, 20047, 25383, 32768, 0],
2244 [4889, 13339, 19269, 32768, 0],
2245 [2240, 6871, 10498, 32768, 0],
2246 [28165, 32197, 32517, 32768, 0],
2247 [20735, 30427, 31568, 32768, 0],
2248 [14325, 24671, 27692, 32768, 0],
2249 [5119, 12554, 17805, 32768, 0],
2250 [1810, 5441, 8261, 32768, 0],
2251 [31212, 32724, 32748, 32768, 0],
2252 [23352, 31766, 32545, 32768, 0],
2253 [14669, 27570, 31059, 32768, 0],
2254 [8492, 20894, 27272, 32768, 0],
2255 [3644, 10194, 15204, 32768, 0],
2256 [8192, 16384, 24576, 32768, 0],
2257 [8192, 16384, 24576, 32768, 0],
2258 [8192, 16384, 24576, 32768, 0],
2259 [8192, 16384, 24576, 32768, 0],
2260 [8192, 16384, 24576, 32768, 0],
2261 [8192, 16384, 24576, 32768, 0],
2262 [8192, 16384, 24576, 32768, 0],
2263 [8192, 16384, 24576, 32768, 0],
2264 [8192, 16384, 24576, 32768, 0],
2265 [8192, 16384, 24576, 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];
2273/// COEFF_BASE_LUMA_64, q-context 0: the same table as [`COEFF_BASE_LUMA_64`], for `base_q_idx` 0..=20.
2274pub const COEFF_BASE_LUMA_64_Q0: [[u16; 5]; 42] = [
2275 [601, 983, 1311, 32768, 0],
2276 [18725, 23406, 28087, 32768, 0],
2277 [5461, 8192, 10923, 32768, 0],
2278 [3781, 15124, 21425, 32768, 0],
2279 [2587, 7761, 12072, 32768, 0],
2280 [106, 458, 810, 32768, 0],
2281 [22282, 29710, 31894, 32768, 0],
2282 [8508, 20926, 25984, 32768, 0],
2283 [3726, 12713, 18083, 32768, 0],
2284 [1620, 7112, 10893, 32768, 0],
2285 [729, 2236, 3495, 32768, 0],
2286 [30163, 32474, 32684, 32768, 0],
2287 [18304, 30464, 32000, 32768, 0],
2288 [11443, 26526, 29647, 32768, 0],
2289 [6007, 15292, 21299, 32768, 0],
2290 [2234, 6703, 8937, 32768, 0],
2291 [30954, 32177, 32571, 32768, 0],
2292 [17363, 29562, 31076, 32768, 0],
2293 [9686, 22464, 27410, 32768, 0],
2294 [8192, 16384, 21390, 32768, 0],
2295 [1755, 8046, 11264, 32768, 0],
2296 [31168, 32734, 32748, 32768, 0],
2297 [22486, 31441, 32471, 32768, 0],
2298 [12833, 25627, 29738, 32768, 0],
2299 [6980, 17379, 23122, 32768, 0],
2300 [3111, 8887, 13479, 32768, 0],
2301 [8192, 16384, 24576, 32768, 0],
2302 [8192, 16384, 24576, 32768, 0],
2303 [8192, 16384, 24576, 32768, 0],
2304 [8192, 16384, 24576, 32768, 0],
2305 [8192, 16384, 24576, 32768, 0],
2306 [8192, 16384, 24576, 32768, 0],
2307 [8192, 16384, 24576, 32768, 0],
2308 [8192, 16384, 24576, 32768, 0],
2309 [8192, 16384, 24576, 32768, 0],
2310 [8192, 16384, 24576, 32768, 0],
2311 [8192, 16384, 24576, 32768, 0],
2312 [8192, 16384, 24576, 32768, 0],
2313 [8192, 16384, 24576, 32768, 0],
2314 [8192, 16384, 24576, 32768, 0],
2315 [8192, 16384, 24576, 32768, 0],
2316 [8192, 16384, 24576, 32768, 0],
2317];
2318/// COEFF_BASE_CHROMA_8, q-context 0: the same table as [`COEFF_BASE_CHROMA_8`], for `base_q_idx` 0..=20.
2319pub const COEFF_BASE_CHROMA_8_Q0: [[u16; 5]; 42] = [
2320 [6037, 16771, 21957, 32768, 0],
2321 [24774, 31704, 32426, 32768, 0],
2322 [16830, 28589, 31056, 32768, 0],
2323 [10602, 22828, 27760, 32768, 0],
2324 [6733, 16829, 23071, 32768, 0],
2325 [3250, 8914, 13556, 32768, 0],
2326 [25582, 32220, 32668, 32768, 0],
2327 [18659, 30342, 32223, 32768, 0],
2328 [12546, 26149, 30515, 32768, 0],
2329 [8420, 20451, 26801, 32768, 0],
2330 [4636, 12420, 18344, 32768, 0],
2331 [27581, 32362, 32639, 32768, 0],
2332 [18987, 30083, 31978, 32768, 0],
2333 [11327, 24248, 29084, 32768, 0],
2334 [7264, 17719, 24120, 32768, 0],
2335 [3995, 10768, 16169, 32768, 0],
2336 [25893, 31831, 32487, 32768, 0],
2337 [16577, 28587, 31379, 32768, 0],
2338 [10189, 22748, 28182, 32768, 0],
2339 [6832, 17094, 23556, 32768, 0],
2340 [3708, 10110, 15334, 32768, 0],
2341 [25904, 32282, 32656, 32768, 0],
2342 [19721, 30792, 32276, 32768, 0],
2343 [12819, 26243, 30411, 32768, 0],
2344 [8572, 20614, 26891, 32768, 0],
2345 [5364, 14059, 20467, 32768, 0],
2346 [26580, 32438, 32677, 32768, 0],
2347 [20852, 31225, 32340, 32768, 0],
2348 [12435, 25700, 29967, 32768, 0],
2349 [8691, 20825, 26976, 32768, 0],
2350 [4446, 12209, 17269, 32768, 0],
2351 [27350, 32429, 32696, 32768, 0],
2352 [21372, 30977, 32272, 32768, 0],
2353 [12673, 25270, 29853, 32768, 0],
2354 [9208, 20925, 26640, 32768, 0],
2355 [5018, 13351, 18732, 32768, 0],
2356 [27351, 32479, 32713, 32768, 0],
2357 [21398, 31209, 32387, 32768, 0],
2358 [12162, 25047, 29842, 32768, 0],
2359 [7896, 18691, 25319, 32768, 0],
2360 [4670, 12882, 18881, 32768, 0],
2361 [8192, 16384, 24576, 32768, 0],
2362];
2363/// COEFF_BASE_CHROMA_16, q-context 0: the same table as [`COEFF_BASE_CHROMA_16`], for `base_q_idx` 0..=20.
2364pub const COEFF_BASE_CHROMA_16_Q0: [[u16; 5]; 42] = [
2365 [5673, 14302, 19711, 32768, 0],
2366 [26251, 30701, 31834, 32768, 0],
2367 [12782, 23783, 27803, 32768, 0],
2368 [9127, 20657, 25808, 32768, 0],
2369 [6368, 16208, 21462, 32768, 0],
2370 [2465, 7177, 10822, 32768, 0],
2371 [29961, 32563, 32719, 32768, 0],
2372 [18318, 29891, 31949, 32768, 0],
2373 [11361, 24514, 29357, 32768, 0],
2374 [7900, 19603, 25607, 32768, 0],
2375 [4002, 10590, 15546, 32768, 0],
2376 [29637, 32310, 32595, 32768, 0],
2377 [18296, 29913, 31809, 32768, 0],
2378 [10144, 21515, 26871, 32768, 0],
2379 [5358, 14322, 20394, 32768, 0],
2380 [3067, 8362, 13346, 32768, 0],
2381 [28652, 32470, 32676, 32768, 0],
2382 [17538, 30771, 32209, 32768, 0],
2383 [13924, 26882, 30494, 32768, 0],
2384 [10496, 22837, 27869, 32768, 0],
2385 [7236, 16396, 21621, 32768, 0],
2386 [30743, 32687, 32746, 32768, 0],
2387 [23006, 31676, 32489, 32768, 0],
2388 [14494, 27828, 31120, 32768, 0],
2389 [10174, 22801, 28352, 32768, 0],
2390 [6242, 15281, 21043, 32768, 0],
2391 [25817, 32243, 32720, 32768, 0],
2392 [18618, 31367, 32325, 32768, 0],
2393 [13997, 28318, 31878, 32768, 0],
2394 [12255, 26534, 31383, 32768, 0],
2395 [9561, 21588, 28450, 32768, 0],
2396 [28188, 32635, 32724, 32768, 0],
2397 [22060, 32365, 32728, 32768, 0],
2398 [18102, 30690, 32528, 32768, 0],
2399 [14196, 28864, 31999, 32768, 0],
2400 [12262, 25792, 30865, 32768, 0],
2401 [24176, 32109, 32628, 32768, 0],
2402 [18280, 29681, 31963, 32768, 0],
2403 [10205, 23703, 29664, 32768, 0],
2404 [7889, 20025, 27676, 32768, 0],
2405 [6060, 16743, 23970, 32768, 0],
2406 [8192, 16384, 24576, 32768, 0],
2407];
2408/// COEFF_BASE_CHROMA_32, q-context 0: the same table as [`COEFF_BASE_CHROMA_32`], for `base_q_idx` 0..=20.
2409pub const COEFF_BASE_CHROMA_32_Q0: [[u16; 5]; 42] = [
2410 [2461, 7013, 9371, 32768, 0],
2411 [24749, 29600, 30986, 32768, 0],
2412 [9466, 19037, 22417, 32768, 0],
2413 [3584, 9280, 14400, 32768, 0],
2414 [1505, 3929, 5433, 32768, 0],
2415 [677, 1500, 2736, 32768, 0],
2416 [23987, 30702, 32117, 32768, 0],
2417 [13554, 24571, 29263, 32768, 0],
2418 [6211, 14556, 21155, 32768, 0],
2419 [3135, 10972, 15625, 32768, 0],
2420 [2435, 7127, 11427, 32768, 0],
2421 [31300, 32532, 32550, 32768, 0],
2422 [14757, 30365, 31954, 32768, 0],
2423 [4405, 11612, 18553, 32768, 0],
2424 [580, 4132, 7322, 32768, 0],
2425 [1695, 10169, 14124, 32768, 0],
2426 [30008, 32282, 32591, 32768, 0],
2427 [19244, 30108, 31748, 32768, 0],
2428 [11180, 24158, 29555, 32768, 0],
2429 [5650, 14972, 19209, 32768, 0],
2430 [2114, 5109, 8456, 32768, 0],
2431 [31856, 32716, 32748, 32768, 0],
2432 [23012, 31664, 32572, 32768, 0],
2433 [13694, 26656, 30636, 32768, 0],
2434 [8142, 19508, 26093, 32768, 0],
2435 [4253, 10955, 16724, 32768, 0],
2436 [8192, 16384, 24576, 32768, 0],
2437 [8192, 16384, 24576, 32768, 0],
2438 [8192, 16384, 24576, 32768, 0],
2439 [8192, 16384, 24576, 32768, 0],
2440 [8192, 16384, 24576, 32768, 0],
2441 [8192, 16384, 24576, 32768, 0],
2442 [8192, 16384, 24576, 32768, 0],
2443 [8192, 16384, 24576, 32768, 0],
2444 [8192, 16384, 24576, 32768, 0],
2445 [8192, 16384, 24576, 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];
2453/// COEFF_BR_LUMA_16, q-context 0: the same table as [`COEFF_BR_LUMA_16`], for `base_q_idx` 0..=20.
2454pub const COEFF_BR_LUMA_16_Q0: [[u16; 5]; 21] = [
2455 [10563, 16233, 19763, 32768, 0],
2456 [9794, 16022, 19804, 32768, 0],
2457 [6750, 11945, 15759, 32768, 0],
2458 [4963, 9186, 12752, 32768, 0],
2459 [3845, 7435, 10627, 32768, 0],
2460 [3051, 6085, 8834, 32768, 0],
2461 [1311, 2596, 3830, 32768, 0],
2462 [11246, 16404, 19689, 32768, 0],
2463 [12315, 18911, 22731, 32768, 0],
2464 [10557, 17095, 21289, 32768, 0],
2465 [8136, 14006, 18249, 32768, 0],
2466 [6348, 11474, 15565, 32768, 0],
2467 [5196, 9655, 13400, 32768, 0],
2468 [2349, 4526, 6587, 32768, 0],
2469 [13337, 18730, 21569, 32768, 0],
2470 [19306, 26071, 28882, 32768, 0],
2471 [15952, 23540, 27254, 32768, 0],
2472 [12409, 19934, 24430, 32768, 0],
2473 [9760, 16706, 21389, 32768, 0],
2474 [8004, 14220, 18818, 32768, 0],
2475 [4138, 7794, 10961, 32768, 0],
2476];
2477/// COEFF_BR_LUMA_32, q-context 0: the same table as [`COEFF_BR_LUMA_32`], for `base_q_idx` 0..=20.
2478pub const COEFF_BR_LUMA_32_Q0: [[u16; 5]; 21] = [
2479 [2331, 3662, 5244, 32768, 0],
2480 [2891, 4771, 6145, 32768, 0],
2481 [4598, 7623, 9729, 32768, 0],
2482 [3520, 6845, 9199, 32768, 0],
2483 [3417, 6119, 9324, 32768, 0],
2484 [2601, 5412, 7385, 32768, 0],
2485 [600, 1173, 1744, 32768, 0],
2486 [7672, 13286, 17469, 32768, 0],
2487 [4232, 7792, 10793, 32768, 0],
2488 [2915, 5317, 7397, 32768, 0],
2489 [2318, 4356, 6152, 32768, 0],
2490 [2127, 4000, 5554, 32768, 0],
2491 [1850, 3478, 5275, 32768, 0],
2492 [977, 1933, 2843, 32768, 0],
2493 [18280, 24387, 27989, 32768, 0],
2494 [15852, 22671, 26185, 32768, 0],
2495 [13845, 20951, 24789, 32768, 0],
2496 [11055, 17966, 22129, 32768, 0],
2497 [9138, 15422, 19801, 32768, 0],
2498 [7454, 13145, 17456, 32768, 0],
2499 [3370, 6393, 9013, 32768, 0],
2500];
2501/// COEFF_BR_CHROMA_8, q-context 0: the same table as [`COEFF_BR_CHROMA_8`], for `base_q_idx` 0..=20.
2502pub const COEFF_BR_CHROMA_8_Q0: [[u16; 5]; 21] = [
2503 [15460, 21696, 25469, 32768, 0],
2504 [12170, 19249, 23191, 32768, 0],
2505 [8723, 15027, 19332, 32768, 0],
2506 [6428, 11704, 15874, 32768, 0],
2507 [4922, 9292, 13052, 32768, 0],
2508 [4139, 7695, 11010, 32768, 0],
2509 [2291, 4508, 6598, 32768, 0],
2510 [19856, 26920, 29828, 32768, 0],
2511 [17923, 25289, 28792, 32768, 0],
2512 [14278, 21968, 26297, 32768, 0],
2513 [10910, 18136, 22950, 32768, 0],
2514 [8423, 14815, 19627, 32768, 0],
2515 [6771, 12283, 16774, 32768, 0],
2516 [4074, 7750, 11081, 32768, 0],
2517 [19852, 26074, 28672, 32768, 0],
2518 [19371, 26110, 28989, 32768, 0],
2519 [16265, 23873, 27663, 32768, 0],
2520 [12758, 20378, 24952, 32768, 0],
2521 [10095, 17098, 21961, 32768, 0],
2522 [8250, 14628, 19451, 32768, 0],
2523 [5205, 9745, 13622, 32768, 0],
2524];
2525/// COEFF_BR_CHROMA_16, q-context 0: the same table as [`COEFF_BR_CHROMA_16`], for `base_q_idx` 0..=20.
2526pub const COEFF_BR_CHROMA_16_Q0: [[u16; 5]; 21] = [
2527 [10870, 16684, 20949, 32768, 0],
2528 [9664, 15230, 18680, 32768, 0],
2529 [6886, 12109, 15408, 32768, 0],
2530 [4825, 8900, 12305, 32768, 0],
2531 [3630, 7162, 10314, 32768, 0],
2532 [3036, 6429, 9387, 32768, 0],
2533 [1671, 3296, 4940, 32768, 0],
2534 [13819, 19159, 23026, 32768, 0],
2535 [11984, 19108, 23120, 32768, 0],
2536 [10690, 17210, 21663, 32768, 0],
2537 [7984, 14154, 18333, 32768, 0],
2538 [6868, 12294, 16124, 32768, 0],
2539 [5274, 8994, 12868, 32768, 0],
2540 [2988, 5771, 8424, 32768, 0],
2541 [19736, 26647, 29141, 32768, 0],
2542 [18933, 26070, 28984, 32768, 0],
2543 [15779, 23048, 27200, 32768, 0],
2544 [12638, 20061, 24532, 32768, 0],
2545 [10692, 17545, 22220, 32768, 0],
2546 [9217, 15251, 20054, 32768, 0],
2547 [5078, 9284, 12594, 32768, 0],
2548];
2549/// COEFF_BR_CHROMA_32, q-context 0: the same table as [`COEFF_BR_CHROMA_32`], for `base_q_idx` 0..=20.
2550pub const COEFF_BR_CHROMA_32_Q0: [[u16; 5]; 21] = [
2551 [5842, 9229, 10838, 32768, 0],
2552 [2313, 3491, 4276, 32768, 0],
2553 [2998, 6104, 7496, 32768, 0],
2554 [2420, 7447, 9868, 32768, 0],
2555 [3034, 8495, 10923, 32768, 0],
2556 [4076, 8937, 10975, 32768, 0],
2557 [1086, 2370, 3299, 32768, 0],
2558 [9714, 17254, 20444, 32768, 0],
2559 [8543, 13698, 17123, 32768, 0],
2560 [4918, 9007, 11910, 32768, 0],
2561 [4129, 7532, 10553, 32768, 0],
2562 [2364, 5533, 8058, 32768, 0],
2563 [1834, 3546, 5563, 32768, 0],
2564 [1473, 2908, 4133, 32768, 0],
2565 [15405, 21193, 25619, 32768, 0],
2566 [15691, 21952, 26561, 32768, 0],
2567 [12962, 19194, 24165, 32768, 0],
2568 [10272, 17855, 22129, 32768, 0],
2569 [8588, 15270, 20718, 32768, 0],
2570 [8682, 14669, 19500, 32768, 0],
2571 [4870, 9636, 13205, 32768, 0],
2572];
2573/// COEFF_BASE_EOB_LUMA_16, q-context 0: the same table as [`COEFF_BASE_EOB_LUMA_16`], for `base_q_idx` 0..=20.
2574pub const COEFF_BASE_EOB_LUMA_16_Q0: [[u16; 4]; 4] = [
2575 [1786, 12612, 32768, 0],
2576 [30663, 31625, 32768, 0],
2577 [32339, 32468, 32768, 0],
2578 [31148, 31833, 32768, 0],
2579];
2580/// COEFF_BASE_EOB_LUMA_32, q-context 0: the same table as [`COEFF_BASE_EOB_LUMA_32`], for `base_q_idx` 0..=20.
2581pub const COEFF_BASE_EOB_LUMA_32_Q0: [[u16; 4]; 4] = [
2582 [1787, 2532, 32768, 0],
2583 [30832, 31662, 32768, 0],
2584 [31824, 32682, 32768, 0],
2585 [32133, 32569, 32768, 0],
2586];
2587/// COEFF_BASE_EOB_LUMA_64, q-context 0: the same table as [`COEFF_BASE_EOB_LUMA_64`], for `base_q_idx` 0..=20.
2588pub const COEFF_BASE_EOB_LUMA_64_Q0: [[u16; 4]; 4] = [
2589 [1725, 3449, 32768, 0],
2590 [31102, 31935, 32768, 0],
2591 [32457, 32613, 32768, 0],
2592 [32412, 32649, 32768, 0],
2593];
2594/// COEFF_BASE_EOB_CHROMA_8, q-context 0: the same table as [`COEFF_BASE_EOB_CHROMA_8`], for `base_q_idx` 0..=20.
2595pub const COEFF_BASE_EOB_CHROMA_8_Q0: [[u16; 4]; 4] = [
2596 [12608, 27820, 32768, 0],
2597 [30680, 32225, 32768, 0],
2598 [30809, 32335, 32768, 0],
2599 [31299, 32423, 32768, 0],
2600];
2601/// COEFF_BASE_EOB_CHROMA_16, q-context 0: the same table as [`COEFF_BASE_EOB_CHROMA_16`], for `base_q_idx` 0..=20.
2602pub const COEFF_BASE_EOB_CHROMA_16_Q0: [[u16; 4]; 4] = [
2603 [18857, 23865, 32768, 0],
2604 [31428, 32428, 32768, 0],
2605 [31744, 32373, 32768, 0],
2606 [31775, 32526, 32768, 0],
2607];
2608/// COEFF_BASE_EOB_CHROMA_32, q-context 0: the same table as [`COEFF_BASE_EOB_CHROMA_32`], for `base_q_idx` 0..=20.
2609pub const COEFF_BASE_EOB_CHROMA_32_Q0: [[u16; 4]; 4] = [
2610 [13751, 22235, 32768, 0],
2611 [32089, 32409, 32768, 0],
2612 [27084, 27920, 32768, 0],
2613 [29291, 32594, 32768, 0],
2614];
2615
2616// q-context 1: base_q_idx 21..=60.
2617
2618/// TXB_SKIP_LUMA_64, q-context 1: the same table as [`TXB_SKIP_LUMA_64`], for `base_q_idx` 21..=60.
2619pub const TXB_SKIP_LUMA_64_Q1: [u16; 3] = [26584, 32768, 0];
2620/// TXB_SKIP_LUMA_32, q-context 1: the same table as [`TXB_SKIP_LUMA_32`], for `base_q_idx` 21..=60.
2621pub const TXB_SKIP_LUMA_32_Q1: [u16; 3] = [26726, 32768, 0];
2622/// TXB_SKIP_LUMA_16, q-context 1: the same table as [`TXB_SKIP_LUMA_16`], for `base_q_idx` 21..=60.
2623pub const TXB_SKIP_LUMA_16_Q1: [u16; 3] = [31901, 32768, 0];
2624/// TXB_SKIP_CHROMA_8, q-context 1: the same table as [`TXB_SKIP_CHROMA_8`], for `base_q_idx` 21..=60.
2625pub const TXB_SKIP_CHROMA_8_Q1: [[u16; 3]; 3] =
2626 [[4419, 32768, 0], [16294, 32768, 0], [28345, 32768, 0]];
2627/// TXB_SKIP_CHROMA_16, q-context 1: the same table as [`TXB_SKIP_CHROMA_16`], for `base_q_idx` 21..=60.
2628pub const TXB_SKIP_CHROMA_16_Q1: [[u16; 3]; 3] =
2629 [[4215, 32768, 0], [15756, 32768, 0], [28341, 32768, 0]];
2630/// TXB_SKIP_CHROMA_32, q-context 1: the same table as [`TXB_SKIP_CHROMA_32`], for `base_q_idx` 21..=60.
2631pub const TXB_SKIP_CHROMA_32_Q1: [[u16; 3]; 3] =
2632 [[5583, 32768, 0], [21313, 32768, 0], [29390, 32768, 0]];
2633/// EOB_EXTRA_LUMA_16, q-context 1: the same table as [`EOB_EXTRA_LUMA_16`], for `base_q_idx` 21..=60.
2634pub const EOB_EXTRA_LUMA_16_Q1: [[u16; 3]; 9] = [
2635 [22409, 32768, 0],
2636 [21012, 32768, 0],
2637 [15650, 32768, 0],
2638 [17395, 32768, 0],
2639 [15469, 32768, 0],
2640 [20205, 32768, 0],
2641 [19511, 32768, 0],
2642 [16384, 32768, 0],
2643 [16384, 32768, 0],
2644];
2645/// EOB_EXTRA_LUMA_32, q-context 1: the same table as [`EOB_EXTRA_LUMA_32`], for `base_q_idx` 21..=60.
2646pub const EOB_EXTRA_LUMA_32_Q1: [[u16; 3]; 9] = [
2647 [25991, 32768, 0],
2648 [20314, 32768, 0],
2649 [17731, 32768, 0],
2650 [19678, 32768, 0],
2651 [18649, 32768, 0],
2652 [17307, 32768, 0],
2653 [21798, 32768, 0],
2654 [17549, 32768, 0],
2655 [15630, 32768, 0],
2656];
2657/// EOB_EXTRA_LUMA_64, q-context 1: the same table as [`EOB_EXTRA_LUMA_64`], for `base_q_idx` 21..=60.
2658pub const EOB_EXTRA_LUMA_64_Q1: [[u16; 3]; 9] = [
2659 [26605, 32768, 0],
2660 [11304, 32768, 0],
2661 [16726, 32768, 0],
2662 [16560, 32768, 0],
2663 [20866, 32768, 0],
2664 [23524, 32768, 0],
2665 [19878, 32768, 0],
2666 [13469, 32768, 0],
2667 [23084, 32768, 0],
2668];
2669/// EOB_EXTRA_CHROMA_8, q-context 1: the same table as [`EOB_EXTRA_CHROMA_8`], for `base_q_idx` 21..=60.
2670pub const EOB_EXTRA_CHROMA_8_Q1: [[u16; 3]; 9] = [
2671 [22117, 32768, 0],
2672 [22028, 32768, 0],
2673 [18650, 32768, 0],
2674 [16042, 32768, 0],
2675 [15885, 32768, 0],
2676 [16384, 32768, 0],
2677 [16384, 32768, 0],
2678 [16384, 32768, 0],
2679 [16384, 32768, 0],
2680];
2681/// EOB_EXTRA_CHROMA_16, q-context 1: the same table as [`EOB_EXTRA_CHROMA_16`], for `base_q_idx` 21..=60.
2682pub const EOB_EXTRA_CHROMA_16_Q1: [[u16; 3]; 9] = [
2683 [24220, 32768, 0],
2684 [22480, 32768, 0],
2685 [17737, 32768, 0],
2686 [18916, 32768, 0],
2687 [19268, 32768, 0],
2688 [18412, 32768, 0],
2689 [18844, 32768, 0],
2690 [16384, 32768, 0],
2691 [16384, 32768, 0],
2692];
2693/// EOB_EXTRA_CHROMA_32, q-context 1: the same table as [`EOB_EXTRA_CHROMA_32`], for `base_q_idx` 21..=60.
2694pub const EOB_EXTRA_CHROMA_32_Q1: [[u16; 3]; 9] = [
2695 [26585, 32768, 0],
2696 [21469, 32768, 0],
2697 [20432, 32768, 0],
2698 [17735, 32768, 0],
2699 [19280, 32768, 0],
2700 [15235, 32768, 0],
2701 [20297, 32768, 0],
2702 [22471, 32768, 0],
2703 [28997, 32768, 0],
2704];
2705/// EOB_PT_1024_LUMA, q-context 1: the same table as [`EOB_PT_1024_LUMA`], for `base_q_idx` 21..=60.
2706pub const EOB_PT_1024_LUMA_Q1: [u16; 12] = [
2707 696, 948, 3145, 5702, 9706, 13217, 17851, 21856, 25692, 28034, 32768, 0,
2708];
2709/// EOB_PT_1024_CHROMA, q-context 1: the same table as [`EOB_PT_1024_CHROMA`], for `base_q_idx` 21..=60.
2710pub const EOB_PT_1024_CHROMA_Q1: [u16; 12] = [
2711 2672, 3591, 9330, 17084, 22725, 24284, 26527, 28027, 28377, 30876, 32768, 0,
2712];
2713/// EOB_PT_256_LUMA, q-context 1: the same table as [`EOB_PT_256_LUMA`], for `base_q_idx` 21..=60.
2714pub const EOB_PT_256_LUMA_Q1: [u16; 10] =
2715 [1448, 2109, 4151, 6263, 9329, 13260, 17944, 23300, 32768, 0];
2716/// EOB_PT_256_CHROMA, q-context 1: the same table as [`EOB_PT_256_CHROMA`], for `base_q_idx` 21..=60.
2717pub const EOB_PT_256_CHROMA_Q1: [u16; 10] = [
2718 6402, 8148, 12623, 15072, 18728, 22847, 26447, 29377, 32768, 0,
2719];
2720/// EOB_PT_64_CHROMA, q-context 1: the same table as [`EOB_PT_64_CHROMA`], for `base_q_idx` 21..=60.
2721pub const EOB_PT_64_CHROMA_Q1: [u16; 8] = [8609, 10612, 14624, 18714, 22614, 29024, 32768, 0];
2722/// COEFF_BASE_LUMA_16, q-context 1: the same table as [`COEFF_BASE_LUMA_16`], for `base_q_idx` 21..=60.
2723pub const COEFF_BASE_LUMA_16_Q1: [[u16; 5]; 42] = [
2724 [7555, 14942, 18501, 32768, 0],
2725 [24410, 31178, 32287, 32768, 0],
2726 [14394, 26738, 30253, 32768, 0],
2727 [8413, 19554, 25195, 32768, 0],
2728 [4766, 12924, 18785, 32768, 0],
2729 [2029, 5806, 9207, 32768, 0],
2730 [26776, 32364, 32663, 32768, 0],
2731 [18732, 29967, 31931, 32768, 0],
2732 [11005, 23786, 28852, 32768, 0],
2733 [6466, 16909, 23510, 32768, 0],
2734 [3044, 8638, 13419, 32768, 0],
2735 [29208, 32582, 32704, 32768, 0],
2736 [20068, 30857, 32208, 32768, 0],
2737 [12003, 25085, 29595, 32768, 0],
2738 [6947, 17750, 24189, 32768, 0],
2739 [3245, 9103, 14007, 32768, 0],
2740 [27359, 32465, 32669, 32768, 0],
2741 [19421, 30614, 32174, 32768, 0],
2742 [11915, 25010, 29579, 32768, 0],
2743 [6950, 17676, 24074, 32768, 0],
2744 [3007, 8473, 13096, 32768, 0],
2745 [29002, 32676, 32735, 32768, 0],
2746 [22102, 31849, 32576, 32768, 0],
2747 [14408, 28009, 31405, 32768, 0],
2748 [9027, 21679, 27931, 32768, 0],
2749 [4694, 12678, 18748, 32768, 0],
2750 [28216, 32528, 32682, 32768, 0],
2751 [20849, 31264, 32318, 32768, 0],
2752 [12756, 25815, 29751, 32768, 0],
2753 [7565, 18801, 24923, 32768, 0],
2754 [3509, 9533, 14477, 32768, 0],
2755 [30133, 32687, 32739, 32768, 0],
2756 [23063, 31910, 32515, 32768, 0],
2757 [14588, 28051, 31132, 32768, 0],
2758 [9085, 21649, 27457, 32768, 0],
2759 [4261, 11654, 17264, 32768, 0],
2760 [29518, 32691, 32748, 32768, 0],
2761 [22451, 31959, 32613, 32768, 0],
2762 [14864, 28722, 31700, 32768, 0],
2763 [9695, 22964, 28716, 32768, 0],
2764 [4932, 13358, 19502, 32768, 0],
2765 [8192, 16384, 24576, 32768, 0],
2766];
2767/// COEFF_BASE_LUMA_32, q-context 1: the same table as [`COEFF_BASE_LUMA_32`], for `base_q_idx` 21..=60.
2768pub const COEFF_BASE_LUMA_32_Q1: [[u16; 5]; 42] = [
2769 [3078, 6839, 9890, 32768, 0],
2770 [13837, 20450, 24479, 32768, 0],
2771 [5914, 14222, 19328, 32768, 0],
2772 [3866, 10267, 14762, 32768, 0],
2773 [2612, 7208, 11042, 32768, 0],
2774 [1067, 2991, 4776, 32768, 0],
2775 [25817, 31646, 32529, 32768, 0],
2776 [13708, 26338, 30385, 32768, 0],
2777 [7328, 18585, 24870, 32768, 0],
2778 [4691, 13080, 19276, 32768, 0],
2779 [1825, 5253, 8352, 32768, 0],
2780 [29386, 32315, 32624, 32768, 0],
2781 [17160, 29001, 31360, 32768, 0],
2782 [9602, 21862, 27396, 32768, 0],
2783 [5915, 15772, 22148, 32768, 0],
2784 [2786, 7779, 12047, 32768, 0],
2785 [29246, 32450, 32663, 32768, 0],
2786 [18696, 29929, 31818, 32768, 0],
2787 [10510, 23369, 28560, 32768, 0],
2788 [6229, 16499, 23125, 32768, 0],
2789 [2608, 7448, 11705, 32768, 0],
2790 [30753, 32710, 32748, 32768, 0],
2791 [21638, 31487, 32503, 32768, 0],
2792 [12937, 26854, 30870, 32768, 0],
2793 [8182, 20596, 26970, 32768, 0],
2794 [3637, 10269, 15497, 32768, 0],
2795 [8192, 16384, 24576, 32768, 0],
2796 [8192, 16384, 24576, 32768, 0],
2797 [8192, 16384, 24576, 32768, 0],
2798 [8192, 16384, 24576, 32768, 0],
2799 [8192, 16384, 24576, 32768, 0],
2800 [8192, 16384, 24576, 32768, 0],
2801 [8192, 16384, 24576, 32768, 0],
2802 [8192, 16384, 24576, 32768, 0],
2803 [8192, 16384, 24576, 32768, 0],
2804 [8192, 16384, 24576, 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];
2812/// COEFF_BASE_LUMA_64, q-context 1: the same table as [`COEFF_BASE_LUMA_64`], for `base_q_idx` 21..=60.
2813pub const COEFF_BASE_LUMA_64_Q1: [[u16; 5]; 42] = [
2814 [1035, 2807, 4156, 32768, 0],
2815 [13162, 18138, 20939, 32768, 0],
2816 [2696, 6633, 8755, 32768, 0],
2817 [1373, 4161, 6853, 32768, 0],
2818 [1099, 2746, 4716, 32768, 0],
2819 [340, 1021, 1599, 32768, 0],
2820 [22826, 30419, 32135, 32768, 0],
2821 [10395, 21762, 26942, 32768, 0],
2822 [4726, 12407, 17361, 32768, 0],
2823 [2447, 7080, 10593, 32768, 0],
2824 [1227, 3717, 6011, 32768, 0],
2825 [28156, 31424, 31934, 32768, 0],
2826 [16915, 27754, 30373, 32768, 0],
2827 [9148, 20990, 26431, 32768, 0],
2828 [5950, 15515, 21148, 32768, 0],
2829 [2492, 7327, 11526, 32768, 0],
2830 [30602, 32477, 32670, 32768, 0],
2831 [20026, 29955, 31568, 32768, 0],
2832 [11220, 23628, 28105, 32768, 0],
2833 [6652, 17019, 22973, 32768, 0],
2834 [3064, 8536, 13043, 32768, 0],
2835 [31769, 32724, 32748, 32768, 0],
2836 [22230, 30887, 32373, 32768, 0],
2837 [12234, 25079, 29731, 32768, 0],
2838 [7326, 18816, 25353, 32768, 0],
2839 [3933, 10907, 16616, 32768, 0],
2840 [8192, 16384, 24576, 32768, 0],
2841 [8192, 16384, 24576, 32768, 0],
2842 [8192, 16384, 24576, 32768, 0],
2843 [8192, 16384, 24576, 32768, 0],
2844 [8192, 16384, 24576, 32768, 0],
2845 [8192, 16384, 24576, 32768, 0],
2846 [8192, 16384, 24576, 32768, 0],
2847 [8192, 16384, 24576, 32768, 0],
2848 [8192, 16384, 24576, 32768, 0],
2849 [8192, 16384, 24576, 32768, 0],
2850 [8192, 16384, 24576, 32768, 0],
2851 [8192, 16384, 24576, 32768, 0],
2852 [8192, 16384, 24576, 32768, 0],
2853 [8192, 16384, 24576, 32768, 0],
2854 [8192, 16384, 24576, 32768, 0],
2855 [8192, 16384, 24576, 32768, 0],
2856];
2857/// COEFF_BASE_CHROMA_8, q-context 1: the same table as [`COEFF_BASE_CHROMA_8`], for `base_q_idx` 21..=60.
2858pub const COEFF_BASE_CHROMA_8_Q1: [[u16; 5]; 42] = [
2859 [8639, 19339, 24429, 32768, 0],
2860 [24404, 31837, 32525, 32768, 0],
2861 [16997, 29425, 31784, 32768, 0],
2862 [11253, 24234, 29149, 32768, 0],
2863 [6751, 17394, 24028, 32768, 0],
2864 [3490, 9830, 15191, 32768, 0],
2865 [26283, 32471, 32714, 32768, 0],
2866 [19599, 31168, 32442, 32768, 0],
2867 [13146, 26954, 30893, 32768, 0],
2868 [8214, 20588, 26890, 32768, 0],
2869 [4699, 13081, 19300, 32768, 0],
2870 [28212, 32458, 32669, 32768, 0],
2871 [18594, 30316, 32100, 32768, 0],
2872 [11219, 24408, 29234, 32768, 0],
2873 [6865, 17656, 24149, 32768, 0],
2874 [3678, 10362, 16006, 32768, 0],
2875 [25825, 32136, 32616, 32768, 0],
2876 [17313, 29853, 32021, 32768, 0],
2877 [11197, 24471, 29472, 32768, 0],
2878 [6947, 17781, 24405, 32768, 0],
2879 [3768, 10660, 16261, 32768, 0],
2880 [27352, 32500, 32706, 32768, 0],
2881 [20850, 31468, 32469, 32768, 0],
2882 [14021, 27707, 31133, 32768, 0],
2883 [8964, 21748, 27838, 32768, 0],
2884 [5437, 14665, 21187, 32768, 0],
2885 [26304, 32492, 32698, 32768, 0],
2886 [20409, 31380, 32385, 32768, 0],
2887 [13682, 27222, 30632, 32768, 0],
2888 [8974, 21236, 26685, 32768, 0],
2889 [4234, 11665, 16934, 32768, 0],
2890 [26273, 32357, 32711, 32768, 0],
2891 [20672, 31242, 32441, 32768, 0],
2892 [14172, 27254, 30902, 32768, 0],
2893 [9870, 21898, 27275, 32768, 0],
2894 [5164, 13506, 19270, 32768, 0],
2895 [26725, 32459, 32728, 32768, 0],
2896 [20991, 31442, 32527, 32768, 0],
2897 [13071, 26434, 30811, 32768, 0],
2898 [8184, 20090, 26742, 32768, 0],
2899 [4803, 13255, 19895, 32768, 0],
2900 [8192, 16384, 24576, 32768, 0],
2901];
2902/// COEFF_BASE_CHROMA_16, q-context 1: the same table as [`COEFF_BASE_CHROMA_16`], for `base_q_idx` 21..=60.
2903pub const COEFF_BASE_CHROMA_16_Q1: [[u16; 5]; 42] = [
2904 [6465, 16958, 21688, 32768, 0],
2905 [25199, 31514, 32360, 32768, 0],
2906 [14774, 27149, 30607, 32768, 0],
2907 [9257, 21438, 26972, 32768, 0],
2908 [5723, 15183, 21882, 32768, 0],
2909 [3150, 8879, 13731, 32768, 0],
2910 [26989, 32262, 32682, 32768, 0],
2911 [17396, 29937, 32085, 32768, 0],
2912 [11387, 24901, 29784, 32768, 0],
2913 [7289, 18821, 25548, 32768, 0],
2914 [3734, 10577, 16086, 32768, 0],
2915 [29728, 32501, 32695, 32768, 0],
2916 [17431, 29701, 31903, 32768, 0],
2917 [9921, 22826, 28300, 32768, 0],
2918 [5896, 15434, 22068, 32768, 0],
2919 [3430, 9646, 14757, 32768, 0],
2920 [28614, 32511, 32705, 32768, 0],
2921 [19364, 30638, 32263, 32768, 0],
2922 [13129, 26254, 30402, 32768, 0],
2923 [8754, 20484, 26440, 32768, 0],
2924 [4378, 11607, 17110, 32768, 0],
2925 [30292, 32671, 32744, 32768, 0],
2926 [21780, 31603, 32501, 32768, 0],
2927 [14314, 27829, 31291, 32768, 0],
2928 [9611, 22327, 28263, 32768, 0],
2929 [4890, 13087, 19065, 32768, 0],
2930 [25862, 32567, 32733, 32768, 0],
2931 [20794, 32050, 32567, 32768, 0],
2932 [17243, 30625, 32254, 32768, 0],
2933 [13283, 27628, 31474, 32768, 0],
2934 [9669, 22532, 28918, 32768, 0],
2935 [27435, 32697, 32748, 32768, 0],
2936 [24922, 32390, 32714, 32768, 0],
2937 [21449, 31504, 32536, 32768, 0],
2938 [16392, 29729, 31832, 32768, 0],
2939 [11692, 24884, 29076, 32768, 0],
2940 [24193, 32290, 32735, 32768, 0],
2941 [18909, 31104, 32563, 32768, 0],
2942 [12236, 26841, 31403, 32768, 0],
2943 [8171, 21840, 29082, 32768, 0],
2944 [7224, 17280, 25275, 32768, 0],
2945 [8192, 16384, 24576, 32768, 0],
2946];
2947/// COEFF_BASE_CHROMA_32, q-context 1: the same table as [`COEFF_BASE_CHROMA_32`], for `base_q_idx` 21..=60.
2948pub const COEFF_BASE_CHROMA_32_Q1: [[u16; 5]; 42] = [
2949 [5244, 12150, 16906, 32768, 0],
2950 [20486, 26858, 29701, 32768, 0],
2951 [7756, 18317, 23735, 32768, 0],
2952 [3452, 9256, 13146, 32768, 0],
2953 [2020, 5206, 8229, 32768, 0],
2954 [1801, 4993, 7903, 32768, 0],
2955 [27051, 31858, 32531, 32768, 0],
2956 [15988, 27531, 30619, 32768, 0],
2957 [9188, 21484, 26719, 32768, 0],
2958 [6273, 17186, 23800, 32768, 0],
2959 [3108, 9355, 14764, 32768, 0],
2960 [31076, 32520, 32680, 32768, 0],
2961 [18119, 30037, 31850, 32768, 0],
2962 [10244, 22969, 27472, 32768, 0],
2963 [4692, 14077, 19273, 32768, 0],
2964 [3694, 11677, 17556, 32768, 0],
2965 [30060, 32581, 32720, 32768, 0],
2966 [21011, 30775, 32120, 32768, 0],
2967 [11931, 24820, 29289, 32768, 0],
2968 [7119, 17662, 24356, 32768, 0],
2969 [3833, 10706, 16304, 32768, 0],
2970 [31954, 32731, 32748, 32768, 0],
2971 [23913, 31724, 32489, 32768, 0],
2972 [15520, 28060, 31286, 32768, 0],
2973 [11517, 23008, 28571, 32768, 0],
2974 [6193, 14508, 20629, 32768, 0],
2975 [8192, 16384, 24576, 32768, 0],
2976 [8192, 16384, 24576, 32768, 0],
2977 [8192, 16384, 24576, 32768, 0],
2978 [8192, 16384, 24576, 32768, 0],
2979 [8192, 16384, 24576, 32768, 0],
2980 [8192, 16384, 24576, 32768, 0],
2981 [8192, 16384, 24576, 32768, 0],
2982 [8192, 16384, 24576, 32768, 0],
2983 [8192, 16384, 24576, 32768, 0],
2984 [8192, 16384, 24576, 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];
2992/// COEFF_BR_LUMA_16, q-context 1: the same table as [`COEFF_BR_LUMA_16`], for `base_q_idx` 21..=60.
2993pub const COEFF_BR_LUMA_16_Q1: [[u16; 5]; 21] = [
2994 [13549, 19724, 23158, 32768, 0],
2995 [11844, 18382, 22246, 32768, 0],
2996 [7919, 13619, 17773, 32768, 0],
2997 [5486, 10143, 13946, 32768, 0],
2998 [4166, 7983, 11324, 32768, 0],
2999 [3364, 6506, 9427, 32768, 0],
3000 [1598, 3160, 4674, 32768, 0],
3001 [15281, 20979, 23781, 32768, 0],
3002 [14939, 22119, 25952, 32768, 0],
3003 [11363, 18407, 22812, 32768, 0],
3004 [8609, 14857, 19370, 32768, 0],
3005 [6737, 12184, 16480, 32768, 0],
3006 [5506, 10263, 14262, 32768, 0],
3007 [2990, 5786, 8380, 32768, 0],
3008 [20249, 25253, 27417, 32768, 0],
3009 [21070, 27518, 30001, 32768, 0],
3010 [16854, 24469, 28074, 32768, 0],
3011 [12864, 20486, 25000, 32768, 0],
3012 [9962, 16978, 21778, 32768, 0],
3013 [8074, 14338, 19048, 32768, 0],
3014 [4494, 8479, 11906, 32768, 0],
3015];
3016/// COEFF_BR_LUMA_32, q-context 1: the same table as [`COEFF_BR_LUMA_32`], for `base_q_idx` 21..=60.
3017pub const COEFF_BR_LUMA_32_Q1: [[u16; 5]; 21] = [
3018 [5705, 10930, 15725, 32768, 0],
3019 [7946, 12765, 16115, 32768, 0],
3020 [6801, 12123, 16226, 32768, 0],
3021 [5462, 10135, 14200, 32768, 0],
3022 [4189, 8011, 11507, 32768, 0],
3023 [3191, 6229, 9408, 32768, 0],
3024 [1057, 2137, 3212, 32768, 0],
3025 [10018, 17067, 21491, 32768, 0],
3026 [7380, 12582, 16453, 32768, 0],
3027 [6068, 10845, 14339, 32768, 0],
3028 [5098, 9198, 12555, 32768, 0],
3029 [4312, 8010, 11119, 32768, 0],
3030 [3700, 6966, 9781, 32768, 0],
3031 [1693, 3326, 4887, 32768, 0],
3032 [18757, 24930, 27774, 32768, 0],
3033 [17648, 24596, 27817, 32768, 0],
3034 [14707, 22052, 26026, 32768, 0],
3035 [11720, 18852, 23292, 32768, 0],
3036 [9357, 15952, 20525, 32768, 0],
3037 [7810, 13753, 18210, 32768, 0],
3038 [3879, 7333, 10328, 32768, 0],
3039];
3040/// COEFF_BR_CHROMA_8, q-context 1: the same table as [`COEFF_BR_CHROMA_8`], for `base_q_idx` 21..=60.
3041pub const COEFF_BR_CHROMA_8_Q1: [[u16; 5]; 21] = [
3042 [14899, 21217, 24503, 32768, 0],
3043 [13519, 20283, 24047, 32768, 0],
3044 [9429, 15966, 20365, 32768, 0],
3045 [6700, 12355, 16652, 32768, 0],
3046 [5088, 9704, 13716, 32768, 0],
3047 [4243, 8154, 11731, 32768, 0],
3048 [2702, 5364, 7861, 32768, 0],
3049 [22745, 28388, 30454, 32768, 0],
3050 [20235, 27146, 29922, 32768, 0],
3051 [15896, 23715, 27637, 32768, 0],
3052 [11840, 19350, 24131, 32768, 0],
3053 [9122, 15932, 20880, 32768, 0],
3054 [7488, 13581, 18362, 32768, 0],
3055 [5114, 9568, 13370, 32768, 0],
3056 [20845, 26553, 28932, 32768, 0],
3057 [20981, 27372, 29884, 32768, 0],
3058 [17781, 25335, 28785, 32768, 0],
3059 [13760, 21708, 26297, 32768, 0],
3060 [10975, 18415, 23365, 32768, 0],
3061 [9045, 15789, 20686, 32768, 0],
3062 [6130, 11199, 15423, 32768, 0],
3063];
3064/// COEFF_BR_CHROMA_16, q-context 1: the same table as [`COEFF_BR_CHROMA_16`], for `base_q_idx` 21..=60.
3065pub const COEFF_BR_CHROMA_16_Q1: [[u16; 5]; 21] = [
3066 [13960, 19617, 22829, 32768, 0],
3067 [11150, 17341, 21228, 32768, 0],
3068 [7150, 12964, 17190, 32768, 0],
3069 [5331, 10002, 13867, 32768, 0],
3070 [4167, 7744, 11057, 32768, 0],
3071 [3480, 6629, 9646, 32768, 0],
3072 [1883, 3784, 5686, 32768, 0],
3073 [18752, 25660, 28912, 32768, 0],
3074 [16968, 24586, 28030, 32768, 0],
3075 [13520, 21055, 25313, 32768, 0],
3076 [10453, 17626, 22280, 32768, 0],
3077 [8386, 14505, 19116, 32768, 0],
3078 [6742, 12595, 17008, 32768, 0],
3079 [4273, 8140, 11499, 32768, 0],
3080 [22120, 27827, 30233, 32768, 0],
3081 [20563, 27358, 29895, 32768, 0],
3082 [17076, 24644, 28153, 32768, 0],
3083 [13362, 20942, 25309, 32768, 0],
3084 [10794, 17965, 22695, 32768, 0],
3085 [9014, 15652, 20319, 32768, 0],
3086 [5708, 10512, 14497, 32768, 0],
3087];
3088/// COEFF_BR_CHROMA_32, q-context 1: the same table as [`COEFF_BR_CHROMA_32`], for `base_q_idx` 21..=60.
3089pub const COEFF_BR_CHROMA_32_Q1: [[u16; 5]; 21] = [
3090 [8278, 13242, 15922, 32768, 0],
3091 [10547, 15867, 18919, 32768, 0],
3092 [9106, 15842, 20609, 32768, 0],
3093 [6833, 13007, 17218, 32768, 0],
3094 [4811, 9712, 13923, 32768, 0],
3095 [3985, 7352, 11128, 32768, 0],
3096 [1688, 3458, 5262, 32768, 0],
3097 [12951, 21861, 26510, 32768, 0],
3098 [9788, 16044, 20276, 32768, 0],
3099 [6309, 11244, 14870, 32768, 0],
3100 [5183, 9349, 12566, 32768, 0],
3101 [4389, 8229, 11492, 32768, 0],
3102 [3633, 6945, 10620, 32768, 0],
3103 [3600, 6847, 9907, 32768, 0],
3104 [21748, 28137, 30255, 32768, 0],
3105 [19436, 26581, 29560, 32768, 0],
3106 [16359, 24201, 27953, 32768, 0],
3107 [13961, 21693, 25871, 32768, 0],
3108 [11544, 18686, 23322, 32768, 0],
3109 [9372, 16462, 20952, 32768, 0],
3110 [6138, 11210, 15390, 32768, 0],
3111];
3112/// COEFF_BASE_EOB_LUMA_16, q-context 1: the same table as [`COEFF_BASE_EOB_LUMA_16`], for `base_q_idx` 21..=60.
3113pub const COEFF_BASE_EOB_LUMA_16_Q1: [[u16; 4]; 4] = [
3114 [2644, 25198, 32768, 0],
3115 [32038, 32451, 32768, 0],
3116 [32639, 32695, 32768, 0],
3117 [32166, 32518, 32768, 0],
3118];
3119/// COEFF_BASE_EOB_LUMA_32, q-context 1: the same table as [`COEFF_BASE_EOB_LUMA_32`], for `base_q_idx` 21..=60.
3120pub const COEFF_BASE_EOB_LUMA_32_Q1: [[u16; 4]; 4] = [
3121 [1044, 2257, 32768, 0],
3122 [30755, 31923, 32768, 0],
3123 [32208, 32693, 32768, 0],
3124 [32244, 32615, 32768, 0],
3125];
3126/// COEFF_BASE_EOB_LUMA_64, q-context 1: the same table as [`COEFF_BASE_EOB_LUMA_64`], for `base_q_idx` 21..=60.
3127pub const COEFF_BASE_EOB_LUMA_64_Q1: [[u16; 4]; 4] = [
3128 [478, 1834, 32768, 0],
3129 [31005, 31987, 32768, 0],
3130 [32317, 32724, 32768, 0],
3131 [30865, 32648, 32768, 0],
3132];
3133/// COEFF_BASE_EOB_CHROMA_8, q-context 1: the same table as [`COEFF_BASE_EOB_CHROMA_8`], for `base_q_idx` 21..=60.
3134pub const COEFF_BASE_EOB_CHROMA_8_Q1: [[u16; 4]; 4] = [
3135 [26279, 30968, 32768, 0],
3136 [31142, 32495, 32768, 0],
3137 [31713, 32540, 32768, 0],
3138 [31929, 32594, 32768, 0],
3139];
3140/// COEFF_BASE_EOB_CHROMA_16, q-context 1: the same table as [`COEFF_BASE_EOB_CHROMA_16`], for `base_q_idx` 21..=60.
3141pub const COEFF_BASE_EOB_CHROMA_16_Q1: [[u16; 4]; 4] = [
3142 [17187, 27668, 32768, 0],
3143 [31714, 32550, 32768, 0],
3144 [32283, 32678, 32768, 0],
3145 [31930, 32563, 32768, 0],
3146];
3147/// COEFF_BASE_EOB_CHROMA_32, q-context 1: the same table as [`COEFF_BASE_EOB_CHROMA_32`], for `base_q_idx` 21..=60.
3148pub const COEFF_BASE_EOB_CHROMA_32_Q1: [[u16; 4]; 4] = [
3149 [21317, 26207, 32768, 0],
3150 [29133, 30868, 32768, 0],
3151 [29311, 31231, 32768, 0],
3152 [29657, 31087, 32768, 0],
3153];
3154
3155// q-context 3: base_q_idx 121..=255.
3156
3157/// TXB_SKIP_LUMA_64, q-context 3: the same table as [`TXB_SKIP_LUMA_64`], for `base_q_idx` 121..=255.
3158pub const TXB_SKIP_LUMA_64_Q3: [u16; 3] = [31539, 32768, 0];
3159/// TXB_SKIP_LUMA_32, q-context 3: the same table as [`TXB_SKIP_LUMA_32`], for `base_q_idx` 121..=255.
3160pub const TXB_SKIP_LUMA_32_Q3: [u16; 3] = [31671, 32768, 0];
3161/// TXB_SKIP_LUMA_16, q-context 3: the same table as [`TXB_SKIP_LUMA_16`], for `base_q_idx` 121..=255.
3162pub const TXB_SKIP_LUMA_16_Q3: [u16; 3] = [32510, 32768, 0];
3163/// TXB_SKIP_CHROMA_8, q-context 3: the same table as [`TXB_SKIP_CHROMA_8`], for `base_q_idx` 121..=255.
3164pub const TXB_SKIP_CHROMA_8_Q3: [[u16; 3]; 3] =
3165 [[2786, 32768, 0], [11194, 32768, 0], [20155, 32768, 0]];
3166/// TXB_SKIP_CHROMA_16, q-context 3: the same table as [`TXB_SKIP_CHROMA_16`], for `base_q_idx` 121..=255.
3167pub const TXB_SKIP_CHROMA_16_Q3: [[u16; 3]; 3] =
3168 [[3440, 32768, 0], [13117, 32768, 0], [22702, 32768, 0]];
3169
3170/// `av1_default_txb_skip_cdfs[q][TX_8X8][10..13]` (token_cdfs.h): the chroma
3171/// `+10` rows of an 8x8 transform. libaom leaves every q-context at the
3172/// neutral 16384 -- its own encoder never codes an 8x8 chroma transform under
3173/// a larger plane block (4:2:0/4:4:4 always match plane to transform at this
3174/// size) -- but `get_txb_ctx`'s `+10` arm reaches them the moment a 4:2:2
3175/// frame's 16x16 luma block reads its plane's 8x16 half as two TX_8X8 units
3176/// (lane-av1-422b; aomdec seeds and adapts the same neutral rows).
3177pub const TXB_SKIP_CHROMA_8_BIG: [[u16; 3]; 3] = [[16384, 32768, 0]; 3];
3178/// `av1_default_txb_skip_cdfs[q][TX_16X16][10..13]` (token_cdfs.h): the same
3179/// neutral `+10` rows at 16x16 (libaom encoder-unreachable, 4:2:2-reachable
3180/// through a 32x32 luma block's 16x32 plane -- lane-av1-422b).
3181pub const TXB_SKIP_CHROMA_16_BIG: [[u16; 3]; 3] = [[16384, 32768, 0]; 3];
3182/// TXB_SKIP_CHROMA_32, q-context 3: the same table as [`TXB_SKIP_CHROMA_32`], for `base_q_idx` 121..=255.
3183pub const TXB_SKIP_CHROMA_32_Q3: [[u16; 3]; 3] =
3184 [[4656, 32768, 0], [16074, 32768, 0], [24704, 32768, 0]];
3185
3186/// `av1_default_txb_skip_cdfs[q][TX_32X32][10..13]` (token_cdfs.h): libaom's
3187/// chroma `txb_skip_ctx` offset is 10 instead of 7 when the plane block is
3188/// LARGER than the transform (`get_txb_ctx`), which in AV1 happens only for a
3189/// 128x128 block's four TX_32X32 chroma units -- the offset-7 rows above are
3190/// every other case (lane-sb128b r3).
3191pub const TXB_SKIP_CHROMA_32_BIG_Q0: [[u16; 3]; 3] =
3192 [[146, 32768, 0], [5132, 32768, 0], [31657, 32768, 0]];
3193/// Default CDF table `TXB_SKIP_CHROMA_32_BIG_Q1` (AV1 spec 9.4 initial probabilities).
3194pub const TXB_SKIP_CHROMA_32_BIG_Q1: [[u16; 3]; 3] =
3195 [[641, 32768, 0], [22265, 32768, 0], [31452, 32768, 0]];
3196/// Default CDF table `TXB_SKIP_CHROMA_32_BIG` (AV1 spec 9.4 initial probabilities).
3197pub const TXB_SKIP_CHROMA_32_BIG: [[u16; 3]; 3] =
3198 [[3082, 32768, 0], [20982, 32768, 0], [29443, 32768, 0]];
3199/// Default CDF table `TXB_SKIP_CHROMA_32_BIG_Q3` (AV1 spec 9.4 initial probabilities).
3200pub const TXB_SKIP_CHROMA_32_BIG_Q3: [[u16; 3]; 3] =
3201 [[1806, 32768, 0], [14645, 32768, 0], [25336, 32768, 0]];
3202/// EOB_EXTRA_LUMA_16, q-context 3: the same table as [`EOB_EXTRA_LUMA_16`], for `base_q_idx` 121..=255.
3203pub const EOB_EXTRA_LUMA_16_Q3: [[u16; 3]; 9] = [
3204 [19941, 32768, 0],
3205 [20527, 32768, 0],
3206 [21470, 32768, 0],
3207 [22487, 32768, 0],
3208 [19558, 32768, 0],
3209 [22354, 32768, 0],
3210 [20331, 32768, 0],
3211 [16384, 32768, 0],
3212 [16384, 32768, 0],
3213];
3214/// EOB_EXTRA_LUMA_32, q-context 3: the same table as [`EOB_EXTRA_LUMA_32`], for `base_q_idx` 121..=255.
3215pub const EOB_EXTRA_LUMA_32_Q3: [[u16; 3]; 9] = [
3216 [21442, 32768, 0],
3217 [22358, 32768, 0],
3218 [18503, 32768, 0],
3219 [20291, 32768, 0],
3220 [19945, 32768, 0],
3221 [21294, 32768, 0],
3222 [21178, 32768, 0],
3223 [19400, 32768, 0],
3224 [10556, 32768, 0],
3225];
3226/// EOB_EXTRA_LUMA_64, q-context 3: the same table as [`EOB_EXTRA_LUMA_64`], for `base_q_idx` 121..=255.
3227pub const EOB_EXTRA_LUMA_64_Q3: [[u16; 3]; 9] = [
3228 [26064, 32768, 0],
3229 [22098, 32768, 0],
3230 [19613, 32768, 0],
3231 [20525, 32768, 0],
3232 [17595, 32768, 0],
3233 [16618, 32768, 0],
3234 [20497, 32768, 0],
3235 [18989, 32768, 0],
3236 [15513, 32768, 0],
3237];
3238/// EOB_EXTRA_CHROMA_8, q-context 3: the same table as [`EOB_EXTRA_CHROMA_8`], for `base_q_idx` 121..=255.
3239pub const EOB_EXTRA_CHROMA_8_Q3: [[u16; 3]; 9] = [
3240 [20125, 32768, 0],
3241 [20559, 32768, 0],
3242 [21707, 32768, 0],
3243 [22296, 32768, 0],
3244 [17333, 32768, 0],
3245 [16384, 32768, 0],
3246 [16384, 32768, 0],
3247 [16384, 32768, 0],
3248 [16384, 32768, 0],
3249];
3250/// EOB_EXTRA_CHROMA_16, q-context 3: the same table as [`EOB_EXTRA_CHROMA_16`], for `base_q_idx` 121..=255.
3251pub const EOB_EXTRA_CHROMA_16_Q3: [[u16; 3]; 9] = [
3252 [22752, 32768, 0],
3253 [25006, 32768, 0],
3254 [22075, 32768, 0],
3255 [21576, 32768, 0],
3256 [17740, 32768, 0],
3257 [21690, 32768, 0],
3258 [19211, 32768, 0],
3259 [16384, 32768, 0],
3260 [16384, 32768, 0],
3261];
3262/// EOB_EXTRA_CHROMA_32, q-context 3: the same table as [`EOB_EXTRA_CHROMA_32`], for `base_q_idx` 121..=255.
3263pub const EOB_EXTRA_CHROMA_32_Q3: [[u16; 3]; 9] = [
3264 [24648, 32768, 0],
3265 [24949, 32768, 0],
3266 [20708, 32768, 0],
3267 [23905, 32768, 0],
3268 [20501, 32768, 0],
3269 [9558, 32768, 0],
3270 [9423, 32768, 0],
3271 [30365, 32768, 0],
3272 [19253, 32768, 0],
3273];
3274/// EOB_PT_1024_LUMA, q-context 3: the same table as [`EOB_PT_1024_LUMA`], for `base_q_idx` 121..=255.
3275pub const EOB_PT_1024_LUMA_Q3: [u16; 12] = [
3276 6698, 8334, 11961, 15762, 20186, 23862, 27434, 29326, 31082, 32050, 32768, 0,
3277];
3278/// EOB_PT_1024_CHROMA, q-context 3: the same table as [`EOB_PT_1024_CHROMA`], for `base_q_idx` 121..=255.
3279pub const EOB_PT_1024_CHROMA_Q3: [u16; 12] = [
3280 20569, 22426, 25569, 26859, 28053, 28913, 29486, 29724, 29807, 32570, 32768, 0,
3281];
3282/// EOB_PT_256_LUMA, q-context 3: the same table as [`EOB_PT_256_LUMA`], for `base_q_idx` 121..=255.
3283pub const EOB_PT_256_LUMA_Q3: [u16; 10] = [
3284 5348, 7113, 11820, 15924, 22106, 26777, 30334, 31757, 32768, 0,
3285];
3286/// EOB_PT_256_CHROMA, q-context 3: the same table as [`EOB_PT_256_CHROMA`], for `base_q_idx` 121..=255.
3287pub const EOB_PT_256_CHROMA_Q3: [u16; 10] = [
3288 23110, 24597, 27140, 28894, 30167, 30927, 31392, 32094, 32768, 0,
3289];
3290/// EOB_PT_64_CHROMA, q-context 3: the same table as [`EOB_PT_64_CHROMA`], for `base_q_idx` 121..=255.
3291pub const EOB_PT_64_CHROMA_Q3: [u16; 8] = [24212, 25708, 28268, 30035, 31307, 32049, 32768, 0];
3292/// COEFF_BASE_LUMA_16, q-context 3: the same table as [`COEFF_BASE_LUMA_16`], for `base_q_idx` 121..=255.
3293pub const COEFF_BASE_LUMA_16_Q3: [[u16; 5]; 42] = [
3294 [7876, 16901, 21741, 32768, 0],
3295 [24001, 31898, 32625, 32768, 0],
3296 [14529, 27959, 31451, 32768, 0],
3297 [8273, 20818, 27258, 32768, 0],
3298 [5278, 14673, 21510, 32768, 0],
3299 [2983, 8843, 14039, 32768, 0],
3300 [28016, 32574, 32732, 32768, 0],
3301 [17471, 30306, 32301, 32768, 0],
3302 [10224, 24063, 29728, 32768, 0],
3303 [6602, 17954, 25052, 32768, 0],
3304 [4002, 11585, 17759, 32768, 0],
3305 [30190, 32634, 32739, 32768, 0],
3306 [17497, 30282, 32270, 32768, 0],
3307 [10229, 23729, 29538, 32768, 0],
3308 [6344, 17211, 24440, 32768, 0],
3309 [3849, 11189, 17108, 32768, 0],
3310 [28570, 32583, 32726, 32768, 0],
3311 [17521, 30161, 32238, 32768, 0],
3312 [10153, 23565, 29378, 32768, 0],
3313 [6455, 17341, 24443, 32768, 0],
3314 [3907, 11042, 17024, 32768, 0],
3315 [30689, 32715, 32748, 32768, 0],
3316 [21546, 31840, 32610, 32768, 0],
3317 [13547, 27581, 31459, 32768, 0],
3318 [8912, 21757, 28309, 32768, 0],
3319 [5548, 15080, 22046, 32768, 0],
3320 [30783, 32540, 32685, 32768, 0],
3321 [17540, 29528, 31668, 32768, 0],
3322 [10160, 21468, 26783, 32768, 0],
3323 [4724, 13393, 20054, 32768, 0],
3324 [2702, 8174, 13102, 32768, 0],
3325 [31648, 32686, 32742, 32768, 0],
3326 [20954, 31094, 32337, 32768, 0],
3327 [12420, 25698, 30179, 32768, 0],
3328 [7304, 19320, 26248, 32768, 0],
3329 [4366, 12261, 18864, 32768, 0],
3330 [31581, 32723, 32748, 32768, 0],
3331 [21373, 31586, 32525, 32768, 0],
3332 [12744, 26625, 30885, 32768, 0],
3333 [7431, 20322, 26950, 32768, 0],
3334 [4692, 13323, 20111, 32768, 0],
3335 [8192, 16384, 24576, 32768, 0],
3336];
3337/// COEFF_BASE_LUMA_32, q-context 3: the same table as [`COEFF_BASE_LUMA_32`], for `base_q_idx` 121..=255.
3338pub const COEFF_BASE_LUMA_32_Q3: [[u16; 5]; 42] = [
3339 [5992, 14304, 19765, 32768, 0],
3340 [22612, 31238, 32456, 32768, 0],
3341 [13456, 27162, 31087, 32768, 0],
3342 [8001, 20062, 26504, 32768, 0],
3343 [5168, 14105, 20764, 32768, 0],
3344 [2632, 7771, 12385, 32768, 0],
3345 [27034, 32344, 32709, 32768, 0],
3346 [15850, 29415, 31997, 32768, 0],
3347 [9494, 22776, 28841, 32768, 0],
3348 [6151, 16830, 23969, 32768, 0],
3349 [3461, 10039, 15722, 32768, 0],
3350 [30134, 32569, 32731, 32768, 0],
3351 [15638, 29422, 31945, 32768, 0],
3352 [9150, 21865, 28218, 32768, 0],
3353 [5647, 15719, 22676, 32768, 0],
3354 [3402, 9772, 15477, 32768, 0],
3355 [28530, 32586, 32735, 32768, 0],
3356 [17139, 30298, 32292, 32768, 0],
3357 [10200, 24039, 29685, 32768, 0],
3358 [6419, 17674, 24786, 32768, 0],
3359 [3544, 10225, 15824, 32768, 0],
3360 [31333, 32726, 32748, 32768, 0],
3361 [20618, 31487, 32544, 32768, 0],
3362 [12901, 27217, 31232, 32768, 0],
3363 [8624, 21734, 28171, 32768, 0],
3364 [5104, 14191, 20748, 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 [8192, 16384, 24576, 32768, 0],
3372 [8192, 16384, 24576, 32768, 0],
3373 [8192, 16384, 24576, 32768, 0],
3374 [8192, 16384, 24576, 32768, 0],
3375 [8192, 16384, 24576, 32768, 0],
3376 [8192, 16384, 24576, 32768, 0],
3377 [8192, 16384, 24576, 32768, 0],
3378 [8192, 16384, 24576, 32768, 0],
3379 [8192, 16384, 24576, 32768, 0],
3380 [8192, 16384, 24576, 32768, 0],
3381];
3382/// COEFF_BASE_LUMA_64, q-context 3: the same table as [`COEFF_BASE_LUMA_64`], for `base_q_idx` 121..=255.
3383pub const COEFF_BASE_LUMA_64_Q3: [[u16; 5]; 42] = [
3384 [4137, 10847, 15682, 32768, 0],
3385 [17824, 27001, 30058, 32768, 0],
3386 [10204, 22796, 28291, 32768, 0],
3387 [6076, 15935, 22125, 32768, 0],
3388 [3852, 10937, 16816, 32768, 0],
3389 [2252, 6324, 10131, 32768, 0],
3390 [25840, 32016, 32662, 32768, 0],
3391 [15109, 28268, 31531, 32768, 0],
3392 [9385, 22231, 28340, 32768, 0],
3393 [6082, 16672, 23479, 32768, 0],
3394 [3318, 9427, 14681, 32768, 0],
3395 [30594, 32574, 32718, 32768, 0],
3396 [16836, 29552, 31859, 32768, 0],
3397 [9556, 22542, 28356, 32768, 0],
3398 [6305, 16725, 23540, 32768, 0],
3399 [3376, 9895, 15184, 32768, 0],
3400 [29383, 32617, 32745, 32768, 0],
3401 [18891, 30809, 32401, 32768, 0],
3402 [11688, 25942, 30687, 32768, 0],
3403 [7468, 19469, 26651, 32768, 0],
3404 [3909, 11358, 17012, 32768, 0],
3405 [31564, 32736, 32748, 32768, 0],
3406 [20906, 31611, 32600, 32768, 0],
3407 [13191, 27621, 31537, 32768, 0],
3408 [8768, 22029, 28676, 32768, 0],
3409 [5079, 14109, 20906, 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 [8192, 16384, 24576, 32768, 0],
3417 [8192, 16384, 24576, 32768, 0],
3418 [8192, 16384, 24576, 32768, 0],
3419 [8192, 16384, 24576, 32768, 0],
3420 [8192, 16384, 24576, 32768, 0],
3421 [8192, 16384, 24576, 32768, 0],
3422 [8192, 16384, 24576, 32768, 0],
3423 [8192, 16384, 24576, 32768, 0],
3424 [8192, 16384, 24576, 32768, 0],
3425 [8192, 16384, 24576, 32768, 0],
3426];
3427/// COEFF_BASE_CHROMA_8, q-context 3: the same table as [`COEFF_BASE_CHROMA_8`], for `base_q_idx` 121..=255.
3428pub const COEFF_BASE_CHROMA_8_Q3: [[u16; 5]; 42] = [
3429 [8626, 20271, 26216, 32768, 0],
3430 [26707, 32406, 32711, 32768, 0],
3431 [16999, 30329, 32286, 32768, 0],
3432 [11445, 25123, 30286, 32768, 0],
3433 [6411, 18828, 25601, 32768, 0],
3434 [6801, 12458, 20248, 32768, 0],
3435 [29918, 32682, 32748, 32768, 0],
3436 [20649, 31739, 32618, 32768, 0],
3437 [12879, 27773, 31581, 32768, 0],
3438 [7896, 21751, 28244, 32768, 0],
3439 [5260, 14870, 23698, 32768, 0],
3440 [29252, 32593, 32731, 32768, 0],
3441 [17072, 30460, 32294, 32768, 0],
3442 [10653, 24143, 29365, 32768, 0],
3443 [6536, 17490, 23983, 32768, 0],
3444 [4929, 13170, 20085, 32768, 0],
3445 [28137, 32518, 32715, 32768, 0],
3446 [18171, 30784, 32407, 32768, 0],
3447 [11437, 25436, 30459, 32768, 0],
3448 [7252, 18534, 26176, 32768, 0],
3449 [4126, 13353, 20978, 32768, 0],
3450 [31162, 32726, 32748, 32768, 0],
3451 [23017, 32222, 32701, 32768, 0],
3452 [15629, 29233, 32046, 32768, 0],
3453 [9387, 22621, 29480, 32768, 0],
3454 [6922, 17616, 25010, 32768, 0],
3455 [28838, 32265, 32614, 32768, 0],
3456 [19701, 30206, 31920, 32768, 0],
3457 [11214, 22410, 27933, 32768, 0],
3458 [5320, 14177, 23034, 32768, 0],
3459 [5049, 12881, 17827, 32768, 0],
3460 [27484, 32471, 32734, 32768, 0],
3461 [21076, 31526, 32561, 32768, 0],
3462 [12707, 26303, 31211, 32768, 0],
3463 [8169, 21722, 28219, 32768, 0],
3464 [6045, 19406, 27042, 32768, 0],
3465 [27753, 32572, 32745, 32768, 0],
3466 [20832, 31878, 32653, 32768, 0],
3467 [13250, 27356, 31674, 32768, 0],
3468 [7718, 21508, 29858, 32768, 0],
3469 [7209, 18350, 25559, 32768, 0],
3470 [8192, 16384, 24576, 32768, 0],
3471];
3472/// COEFF_BASE_CHROMA_16, q-context 3: the same table as [`COEFF_BASE_CHROMA_16`], for `base_q_idx` 121..=255.
3473pub const COEFF_BASE_CHROMA_16_Q3: [[u16; 5]; 42] = [
3474 [7833, 18369, 24095, 32768, 0],
3475 [26650, 32273, 32702, 32768, 0],
3476 [16371, 29961, 32191, 32768, 0],
3477 [11055, 24082, 29629, 32768, 0],
3478 [6892, 18644, 25400, 32768, 0],
3479 [5006, 13057, 19240, 32768, 0],
3480 [29834, 32666, 32748, 32768, 0],
3481 [19577, 31335, 32570, 32768, 0],
3482 [12253, 26509, 31122, 32768, 0],
3483 [7991, 20772, 27711, 32768, 0],
3484 [5677, 15910, 23059, 32768, 0],
3485 [30109, 32532, 32720, 32768, 0],
3486 [16747, 30166, 32252, 32768, 0],
3487 [10134, 23542, 29184, 32768, 0],
3488 [5791, 16176, 23556, 32768, 0],
3489 [4362, 10414, 17284, 32768, 0],
3490 [29492, 32626, 32748, 32768, 0],
3491 [19894, 31402, 32525, 32768, 0],
3492 [12942, 27071, 30869, 32768, 0],
3493 [8346, 21216, 27405, 32768, 0],
3494 [6572, 17087, 23859, 32768, 0],
3495 [32035, 32735, 32748, 32768, 0],
3496 [22957, 31838, 32618, 32768, 0],
3497 [14724, 28572, 31772, 32768, 0],
3498 [10364, 23999, 29553, 32768, 0],
3499 [7004, 18433, 25655, 32768, 0],
3500 [27528, 32277, 32681, 32768, 0],
3501 [16959, 31171, 32096, 32768, 0],
3502 [10486, 23593, 27962, 32768, 0],
3503 [8192, 16384, 23211, 32768, 0],
3504 [8937, 17873, 20852, 32768, 0],
3505 [27715, 32002, 32615, 32768, 0],
3506 [15073, 29491, 31676, 32768, 0],
3507 [11264, 24576, 28672, 32768, 0],
3508 [2341, 18725, 23406, 32768, 0],
3509 [7282, 18204, 25486, 32768, 0],
3510 [28547, 32213, 32657, 32768, 0],
3511 [20788, 29773, 32239, 32768, 0],
3512 [6780, 21469, 30508, 32768, 0],
3513 [5958, 14895, 23831, 32768, 0],
3514 [16384, 21845, 27307, 32768, 0],
3515 [8192, 16384, 24576, 32768, 0],
3516];
3517/// COEFF_BASE_CHROMA_32, q-context 3: the same table as [`COEFF_BASE_CHROMA_32`], for `base_q_idx` 121..=255.
3518pub const COEFF_BASE_CHROMA_32_Q3: [[u16; 5]; 42] = [
3519 [11206, 21090, 26561, 32768, 0],
3520 [28759, 32279, 32671, 32768, 0],
3521 [14171, 27952, 31569, 32768, 0],
3522 [9743, 22907, 29141, 32768, 0],
3523 [6871, 17886, 24868, 32768, 0],
3524 [4960, 13152, 19315, 32768, 0],
3525 [31077, 32661, 32748, 32768, 0],
3526 [19400, 31195, 32515, 32768, 0],
3527 [12752, 26858, 31040, 32768, 0],
3528 [8370, 22098, 28591, 32768, 0],
3529 [5457, 15373, 22298, 32768, 0],
3530 [31697, 32706, 32748, 32768, 0],
3531 [17860, 30657, 32333, 32768, 0],
3532 [12510, 24812, 29261, 32768, 0],
3533 [6180, 19124, 24722, 32768, 0],
3534 [5041, 13548, 17959, 32768, 0],
3535 [31552, 32716, 32748, 32768, 0],
3536 [21908, 31769, 32623, 32768, 0],
3537 [14470, 28201, 31565, 32768, 0],
3538 [9493, 22982, 28608, 32768, 0],
3539 [6858, 17240, 24137, 32768, 0],
3540 [32543, 32752, 32756, 32768, 0],
3541 [24286, 32097, 32666, 32768, 0],
3542 [15958, 29217, 32024, 32768, 0],
3543 [10207, 24234, 29958, 32768, 0],
3544 [6929, 18305, 25652, 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 [8192, 16384, 24576, 32768, 0],
3552 [8192, 16384, 24576, 32768, 0],
3553 [8192, 16384, 24576, 32768, 0],
3554 [8192, 16384, 24576, 32768, 0],
3555 [8192, 16384, 24576, 32768, 0],
3556 [8192, 16384, 24576, 32768, 0],
3557 [8192, 16384, 24576, 32768, 0],
3558 [8192, 16384, 24576, 32768, 0],
3559 [8192, 16384, 24576, 32768, 0],
3560 [8192, 16384, 24576, 32768, 0],
3561];
3562/// COEFF_BR_LUMA_16, q-context 3: the same table as [`COEFF_BR_LUMA_16`], for `base_q_idx` 121..=255.
3563pub const COEFF_BR_LUMA_16_Q3: [[u16; 5]; 21] = [
3564 [17113, 23733, 27081, 32768, 0],
3565 [14139, 21406, 25452, 32768, 0],
3566 [8552, 15002, 19776, 32768, 0],
3567 [5871, 11120, 15378, 32768, 0],
3568 [4455, 8616, 12253, 32768, 0],
3569 [3469, 6910, 10386, 32768, 0],
3570 [2255, 4553, 6782, 32768, 0],
3571 [18224, 24376, 27053, 32768, 0],
3572 [19290, 26710, 29614, 32768, 0],
3573 [14936, 22991, 27184, 32768, 0],
3574 [11238, 18951, 23762, 32768, 0],
3575 [8786, 15617, 20588, 32768, 0],
3576 [7317, 13228, 18003, 32768, 0],
3577 [5101, 9512, 13493, 32768, 0],
3578 [22639, 28222, 30210, 32768, 0],
3579 [23216, 29331, 31307, 32768, 0],
3580 [19075, 26762, 29895, 32768, 0],
3581 [15014, 23113, 27457, 32768, 0],
3582 [11938, 19857, 24752, 32768, 0],
3583 [9942, 17280, 22282, 32768, 0],
3584 [7167, 13144, 17752, 32768, 0],
3585];
3586/// COEFF_BR_LUMA_32, q-context 3: the same table as [`COEFF_BR_LUMA_32`], for `base_q_idx` 121..=255.
3587pub const COEFF_BR_LUMA_32_Q3: [[u16; 5]; 21] = [
3588 [12162, 18785, 22648, 32768, 0],
3589 [12749, 19697, 23806, 32768, 0],
3590 [8580, 15297, 20346, 32768, 0],
3591 [6169, 11749, 16543, 32768, 0],
3592 [4836, 9391, 13448, 32768, 0],
3593 [3821, 7711, 11613, 32768, 0],
3594 [2228, 4601, 7070, 32768, 0],
3595 [16319, 24725, 28280, 32768, 0],
3596 [15698, 23277, 27168, 32768, 0],
3597 [12726, 20368, 25047, 32768, 0],
3598 [9912, 17015, 21976, 32768, 0],
3599 [7888, 14220, 19179, 32768, 0],
3600 [6777, 12284, 17018, 32768, 0],
3601 [4492, 8590, 12252, 32768, 0],
3602 [23249, 28904, 30947, 32768, 0],
3603 [21050, 27908, 30512, 32768, 0],
3604 [17440, 25340, 28949, 32768, 0],
3605 [14059, 22018, 26541, 32768, 0],
3606 [11288, 18903, 23898, 32768, 0],
3607 [9411, 16342, 21428, 32768, 0],
3608 [6278, 11588, 15944, 32768, 0],
3609];
3610/// COEFF_BR_CHROMA_8, q-context 3: the same table as [`COEFF_BR_CHROMA_8`], for `base_q_idx` 121..=255.
3611pub const COEFF_BR_CHROMA_8_Q3: [[u16; 5]; 21] = [
3612 [17616, 24586, 28112, 32768, 0],
3613 [15809, 23299, 27155, 32768, 0],
3614 [10767, 18890, 23793, 32768, 0],
3615 [7727, 14255, 18865, 32768, 0],
3616 [6129, 11926, 16882, 32768, 0],
3617 [4482, 9704, 14861, 32768, 0],
3618 [3277, 7452, 11522, 32768, 0],
3619 [22956, 28551, 30730, 32768, 0],
3620 [22724, 28937, 30961, 32768, 0],
3621 [18467, 26324, 29580, 32768, 0],
3622 [13234, 20713, 25649, 32768, 0],
3623 [11181, 17592, 22481, 32768, 0],
3624 [8291, 18358, 24576, 32768, 0],
3625 [7568, 11881, 14984, 32768, 0],
3626 [24948, 29001, 31147, 32768, 0],
3627 [25674, 30619, 32151, 32768, 0],
3628 [20841, 26793, 29603, 32768, 0],
3629 [14669, 24356, 28666, 32768, 0],
3630 [11334, 23593, 28219, 32768, 0],
3631 [8922, 14762, 22873, 32768, 0],
3632 [8301, 13544, 20535, 32768, 0],
3633];
3634/// COEFF_BR_CHROMA_16, q-context 3: the same table as [`COEFF_BR_CHROMA_16`], for `base_q_idx` 121..=255.
3635pub const COEFF_BR_CHROMA_16_Q3: [[u16; 5]; 21] = [
3636 [15820, 22738, 26488, 32768, 0],
3637 [13530, 20885, 25216, 32768, 0],
3638 [8395, 15530, 20452, 32768, 0],
3639 [6574, 12321, 16380, 32768, 0],
3640 [5353, 10419, 14568, 32768, 0],
3641 [4613, 8446, 12381, 32768, 0],
3642 [3440, 7158, 9903, 32768, 0],
3643 [24247, 29051, 31224, 32768, 0],
3644 [22118, 28058, 30369, 32768, 0],
3645 [16498, 24768, 28389, 32768, 0],
3646 [12920, 21175, 26137, 32768, 0],
3647 [10730, 18619, 25352, 32768, 0],
3648 [10187, 16279, 22791, 32768, 0],
3649 [9310, 14631, 22127, 32768, 0],
3650 [24970, 30558, 32057, 32768, 0],
3651 [24801, 29942, 31698, 32768, 0],
3652 [22432, 28453, 30855, 32768, 0],
3653 [19054, 25680, 29580, 32768, 0],
3654 [14392, 23036, 28109, 32768, 0],
3655 [12495, 20947, 26650, 32768, 0],
3656 [12442, 20326, 26214, 32768, 0],
3657];
3658/// COEFF_BR_CHROMA_32, q-context 3: the same table as [`COEFF_BR_CHROMA_32`], for `base_q_idx` 121..=255.
3659pub const COEFF_BR_CHROMA_32_Q3: [[u16; 5]; 21] = [
3660 [13981, 20067, 23226, 32768, 0],
3661 [16922, 23580, 26783, 32768, 0],
3662 [11005, 19039, 24487, 32768, 0],
3663 [7389, 14218, 19798, 32768, 0],
3664 [5598, 11505, 17206, 32768, 0],
3665 [6090, 11213, 15659, 32768, 0],
3666 [3820, 7371, 10119, 32768, 0],
3667 [21082, 26925, 29675, 32768, 0],
3668 [21262, 28627, 31128, 32768, 0],
3669 [18392, 26454, 30437, 32768, 0],
3670 [14870, 22910, 27096, 32768, 0],
3671 [12620, 19484, 24908, 32768, 0],
3672 [9290, 16553, 22802, 32768, 0],
3673 [6668, 14288, 20004, 32768, 0],
3674 [27704, 31055, 31949, 32768, 0],
3675 [24709, 29978, 31788, 32768, 0],
3676 [21668, 29264, 31657, 32768, 0],
3677 [18295, 26968, 30074, 32768, 0],
3678 [16399, 24422, 29313, 32768, 0],
3679 [14347, 23026, 28104, 32768, 0],
3680 [12370, 19806, 24477, 32768, 0],
3681];
3682/// COEFF_BASE_EOB_LUMA_16, q-context 3: the same table as [`COEFF_BASE_EOB_LUMA_16`], for `base_q_idx` 121..=255.
3683pub const COEFF_BASE_EOB_LUMA_16_Q3: [[u16; 4]; 4] = [
3684 [19980, 30591, 32768, 0],
3685 [32219, 32597, 32768, 0],
3686 [32581, 32706, 32768, 0],
3687 [31803, 32287, 32768, 0],
3688];
3689/// COEFF_BASE_EOB_LUMA_32, q-context 3: the same table as [`COEFF_BASE_EOB_LUMA_32`], for `base_q_idx` 121..=255.
3690pub const COEFF_BASE_EOB_LUMA_32_Q3: [[u16; 4]; 4] = [
3691 [24647, 30463, 32768, 0],
3692 [32412, 32695, 32768, 0],
3693 [32468, 32720, 32768, 0],
3694 [31269, 32523, 32768, 0],
3695];
3696/// COEFF_BASE_EOB_LUMA_64, q-context 3: the same table as [`COEFF_BASE_EOB_LUMA_64`], for `base_q_idx` 121..=255.
3697pub const COEFF_BASE_EOB_LUMA_64_Q3: [[u16; 4]; 4] = [
3698 [12358, 24977, 32768, 0],
3699 [31331, 32385, 32768, 0],
3700 [32634, 32756, 32768, 0],
3701 [30411, 32548, 32768, 0],
3702];
3703/// COEFF_BASE_EOB_CHROMA_8, q-context 3: the same table as [`COEFF_BASE_EOB_CHROMA_8`], for `base_q_idx` 121..=255.
3704pub const COEFF_BASE_EOB_CHROMA_8_Q3: [[u16; 4]; 4] = [
3705 [27558, 31151, 32768, 0],
3706 [32020, 32640, 32768, 0],
3707 [32097, 32575, 32768, 0],
3708 [32242, 32719, 32768, 0],
3709];
3710/// COEFF_BASE_EOB_CHROMA_16, q-context 3: the same table as [`COEFF_BASE_EOB_CHROMA_16`], for `base_q_idx` 121..=255.
3711pub const COEFF_BASE_EOB_CHROMA_16_Q3: [[u16; 4]; 4] = [
3712 [26473, 30507, 32768, 0],
3713 [32431, 32723, 32768, 0],
3714 [32196, 32611, 32768, 0],
3715 [31588, 32528, 32768, 0],
3716];
3717/// COEFF_BASE_EOB_CHROMA_32, q-context 3: the same table as [`COEFF_BASE_EOB_CHROMA_32`], for `base_q_idx` 121..=255.
3718pub const COEFF_BASE_EOB_CHROMA_32_Q3: [[u16; 4]; 4] = [
3719 [28482, 31505, 32768, 0],
3720 [32152, 32701, 32768, 0],
3721 [31732, 32598, 32768, 0],
3722 [31767, 32712, 32768, 0],
3723];
3724
3725#[cfg(test)]
3726mod tests;
3727
3728mod tables_tail;
3729pub use self::tables_tail::*;