forge
Explore
Log in

Don't you dare go Hollow

Merge wave 2026-09-25: 18 ec-av1 lanes (422 chroma chain, 444 strips, refactors, gates) - every tip suite-green on the fleet, merged tree 638/0 locally

Browse files at this commit

bdf5b5e0617ad75c46163bfb1e735b2a6a22c012Ahmet Kaan GümüşParent: 38b6919ba6dea5

75 changed files +12339 -856

crates/ec-av1/examples/decode_probe.rsmodified+26 -0
@@ -36,6 +36,20 @@ fn main() {
3636 }
3737 let (sc, dp) = ec_av1::decode::reelc_chroma_counters();
3838 println!("reelc_chroma: skip_cfl={sc} dir_1to4_pairs={dp}");
39+ println!(
40+ "chroma422_square: {}",
41+ ec_av1::decode::chroma422_square_hits()
42+ );
43+ println!("chroma422_rect: {}", ec_av1::decode::chroma422_rect_hits());
44+ println!("chroma422_sub8: {}", ec_av1::decode::chroma422_sub8_hits());
45+ println!(
46+ "chroma422_chunk: {}",
47+ ec_av1::decode::chroma422_chunk_hits()
48+ );
49+ println!(
50+ "chroma422_pair_wide: {}",
51+ ec_av1::decode::chroma422_pair_wide_hits()
52+ );
3953 let (h, v, c) = ec_av1::stream::rect4_32_counters();
4054 println!("rect4_32: horz={h} vert={v} coded={c}");
4155 println!(
@@ -105,6 +119,14 @@ fn main() {
105119 );
106120 let (h84, h48) = ec_av1::decode::sub8_inter_rect_hits();
107121 println!("sub8_inter_rect: horz8x4={h84} vert4x8={h48}");
122+ println!(
123+ "llintra8_chroma_walk: {}",
124+ ec_av1::decode::llintra8_chroma_walk_hits()
125+ );
126+ println!(
127+ "sub8rect444_chroma_walk: {}",
128+ ec_av1::decode::llsub8rect444_chroma_walk_hits()
129+ );
108130 let si = ec_av1::stream::sub8_intra_rect_hits();
109131 println!(
110132 "sub8_intra_rect: horz8x4={} vert4x8={} chroma_ref={} mixed={} split4x4={}",
@@ -216,6 +238,10 @@ fn main() {
216238 ec_av1::decode::chroma_edge_tu_clip_hits(),
217239 ec_av1::decode::skip_lossless_band_reset_hits(),
218240 );
241+ println!(
242+ "llband: rect_split_lossless_chroma444={}",
243+ ec_av1::decode::rect_split_lossless_chroma444_hits()
244+ );
219245 // lane-t900 r12: chroma edge-filter neighbour answered from the mi-granular
220246 // uv_mode grid instead of the coarse one-slot-per-column map.
221247 println!(
crates/ec-av1/fixtures/422_allskip_2f.obuadded+0 -0

Binary file changed

crates/ec-av1/fixtures/422_sb128_3f.obuadded+0 -0

Binary file changed

crates/ec-av1/fixtures/444_leaf8_oob.obuadded+0 -0

Binary file changed

crates/ec-av1/fixtures/444_sb128rect_lr_witness.obuadded+0 -0

Binary file changed

crates/ec-av1/fixtures/ll444_defaultp_inter_strip.obuadded+0 -0

Binary file changed

crates/ec-av1/fixtures/ll444_ibc_rect.obuadded+0 -0

Binary file changed

crates/ec-av1/fixtures/ll444_minp64_inter.obuadded+0 -0

Binary file changed

crates/ec-av1/fixtures/ll444_minp8_inter.obuadded+0 -0

Binary file changed

crates/ec-av1/src/cdf.rsmodified+115 -73
@@ -290,21 +290,16 @@ pub const EOB_PT_512_LUMA_Q3: [u16; 11] = [
290290 /// coded positions -- what a true 16x8/8x16 rectangular transform has
291291 /// (`txsize_log2_minus4` = 3), distinct from [`EOB_PT_256_CHROMA`]'s
292292 /// 256-position group a *square* 16x16 reads.
293-pub const EOB_PT_128_CHROMA: [u16; 9] = [
294- 13627, 16246, 20173, 24429, 27948, 30415, 31863, 32768, 0,
295-];
293+pub const EOB_PT_128_CHROMA: [u16; 9] = [13627, 16246, 20173, 24429, 27948, 30415, 31863, 32768, 0];
296294 /// [`EOB_PT_128_CHROMA`], q-context 0.
297-pub const EOB_PT_128_CHROMA_Q0: [u16; 9] = [
298- 5245, 7456, 12880, 15852, 20033, 23932, 27608, 32768, 0,
299-];
295+pub const EOB_PT_128_CHROMA_Q0: [u16; 9] =
296+ [5245, 7456, 12880, 15852, 20033, 23932, 27608, 32768, 0];
300297 /// [`EOB_PT_128_CHROMA`], q-context 1.
301-pub const EOB_PT_128_CHROMA_Q1: [u16; 9] = [
302- 8045, 11200, 15497, 19595, 23948, 27408, 30938, 32768, 0,
303-];
298+pub const EOB_PT_128_CHROMA_Q1: [u16; 9] =
299+ [8045, 11200, 15497, 19595, 23948, 27408, 30938, 32768, 0];
304300 /// [`EOB_PT_128_CHROMA`], q-context 3.
305-pub const EOB_PT_128_CHROMA_Q3: [u16; 9] = [
306- 24313, 26062, 28385, 30107, 31217, 31898, 32345, 32768, 0,
307-];
301+pub const EOB_PT_128_CHROMA_Q3: [u16; 9] =
302+ [24313, 26062, 28385, 30107, 31217, 31898, 32345, 32768, 0];
308303
309304 /// `av1_default_eob_multi128_cdfs[2][0][0]` (`token_cdfs.h:830-849`,
310305 /// lane-rectx): the end-of-block group of a LUMA transform with 128 coded
@@ -313,21 +308,13 @@ pub const EOB_PT_128_CHROMA_Q3: [u16; 9] = [
313308 /// 32x16/16x32), distinct from [`EOB_PT_256_LUMA`]'s 256-position group a
314309 /// *square* 16x16 reads. Read straight from the plane-0 half of the same
315310 /// `token_cdfs.h` table [`EOB_PT_128_CHROMA`] reads its plane-1 half from.
316-pub const EOB_PT_128_LUMA: [u16; 9] = [
317- 1366, 1738, 2527, 5016, 9355, 15797, 24643, 32768, 0,
318-];
311+pub const EOB_PT_128_LUMA: [u16; 9] = [1366, 1738, 2527, 5016, 9355, 15797, 24643, 32768, 0];
319312 /// [`EOB_PT_128_LUMA`], q-context 0.
320-pub const EOB_PT_128_LUMA_Q0: [u16; 9] = [
321- 219, 482, 1140, 2091, 3680, 6028, 12586, 32768, 0,
322-];
313+pub const EOB_PT_128_LUMA_Q0: [u16; 9] = [219, 482, 1140, 2091, 3680, 6028, 12586, 32768, 0];
323314 /// [`EOB_PT_128_LUMA`], q-context 1.
324-pub const EOB_PT_128_LUMA_Q1: [u16; 9] = [
325- 685, 933, 1488, 2714, 4766, 8562, 19254, 32768, 0,
326-];
315+pub const EOB_PT_128_LUMA_Q1: [u16; 9] = [685, 933, 1488, 2714, 4766, 8562, 19254, 32768, 0];
327316 /// [`EOB_PT_128_LUMA`], q-context 3.
328-pub const EOB_PT_128_LUMA_Q3: [u16; 9] = [
329- 3472, 4885, 7489, 12481, 18517, 24536, 29635, 32768, 0,
330-];
317+pub const EOB_PT_128_LUMA_Q3: [u16; 9] = [3472, 4885, 7489, 12481, 18517, 24536, 29635, 32768, 0];
331318
332319 /// `av1_default_eob_multi32_cdfs[2][1][0]` (`token_cdfs.h:792-808`,
333320 /// lane-rectx): the end-of-block group of a CHROMA transform with 32 coded
@@ -1824,20 +1811,20 @@ pub const WEDGE_IDX: [[u16; 17]; 22] = [
18241811 29629, 32768, 0,
18251812 ],
18261813 [
1827- 2779, 3738, 4683, 7213, 7775, 8017, 8655, 14357, 17939, 21332, 24520, 27470, 29456,
1828- 30529, 31656, 32768, 0,
1814+ 2779, 3738, 4683, 7213, 7775, 8017, 8655, 14357, 17939, 21332, 24520, 27470, 29456, 30529,
1815+ 31656, 32768, 0,
18291816 ],
18301817 [
18311818 1684, 3625, 5675, 7108, 9302, 11274, 14429, 17144, 19163, 20961, 22884, 24471, 26719,
18321819 28714, 30877, 32768, 0,
18331820 ],
18341821 [
1835- 1142, 3491, 6277, 7314, 8089, 8355, 9023, 13624, 15369, 16730, 18114, 19313, 22521,
1836- 26012, 29550, 32768, 0,
1822+ 1142, 3491, 6277, 7314, 8089, 8355, 9023, 13624, 15369, 16730, 18114, 19313, 22521, 26012,
1823+ 29550, 32768, 0,
18371824 ],
18381825 [
1839- 2742, 4195, 5727, 8035, 8980, 9336, 10146, 14124, 17270, 20533, 23434, 25972, 27944,
1840- 29570, 31416, 32768, 0,
1826+ 2742, 4195, 5727, 8035, 8980, 9336, 10146, 14124, 17270, 20533, 23434, 25972, 27944, 29570,
1827+ 31416, 32768, 0,
18411828 ],
18421829 [
18431830 1727, 3948, 6101, 7796, 9841, 12344, 15766, 18944, 20638, 22038, 23963, 25311, 26988,
@@ -1880,8 +1867,8 @@ pub const WEDGE_IDX: [[u16; 17]; 22] = [
18801867 30911, 32768, 0,
18811868 ],
18821869 [
1883- 1135, 1322, 1493, 2635, 2696, 2737, 2770, 21016, 22935, 25057, 27251, 29173, 30089,
1884- 30960, 31933, 32768, 0,
1870+ 1135, 1322, 1493, 2635, 2696, 2737, 2770, 21016, 22935, 25057, 27251, 29173, 30089, 30960,
1871+ 31933, 32768, 0,
18851872 ],
18861873 [
18871874 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624,
@@ -3179,6 +3166,19 @@ pub const TXB_SKIP_CHROMA_8_Q3: [[u16; 3]; 3] =
31793166 /// TXB_SKIP_CHROMA_16, q-context 3: the same table as [`TXB_SKIP_CHROMA_16`], for `base_q_idx` 121..=255.
31803167 pub const TXB_SKIP_CHROMA_16_Q3: [[u16; 3]; 3] =
31813168 [[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).
3177+pub 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).
3181+pub const TXB_SKIP_CHROMA_16_BIG: [[u16; 3]; 3] = [[16384, 32768, 0]; 3];
31823182 /// TXB_SKIP_CHROMA_32, q-context 3: the same table as [`TXB_SKIP_CHROMA_32`], for `base_q_idx` 121..=255.
31833183 pub const TXB_SKIP_CHROMA_32_Q3: [[u16; 3]; 3] =
31843184 [[4656, 32768, 0], [16074, 32768, 0], [24704, 32768, 0]];
@@ -3188,13 +3188,17 @@ pub const TXB_SKIP_CHROMA_32_Q3: [[u16; 3]; 3] =
31883188 /// LARGER than the transform (`get_txb_ctx`), which in AV1 happens only for a
31893189 /// 128x128 block's four TX_32X32 chroma units -- the offset-7 rows above are
31903190 /// every other case (lane-sb128b r3).
3191-pub const TXB_SKIP_CHROMA_32_BIG_Q0: [[u16; 3]; 3] = [[146, 32768, 0], [5132, 32768, 0], [31657, 32768, 0]];
3191+pub const TXB_SKIP_CHROMA_32_BIG_Q0: [[u16; 3]; 3] =
3192+ [[146, 32768, 0], [5132, 32768, 0], [31657, 32768, 0]];
31923193 /// Default CDF table `TXB_SKIP_CHROMA_32_BIG_Q1` (AV1 spec 9.4 initial probabilities).
3193-pub const TXB_SKIP_CHROMA_32_BIG_Q1: [[u16; 3]; 3] = [[641, 32768, 0], [22265, 32768, 0], [31452, 32768, 0]];
3194+pub const TXB_SKIP_CHROMA_32_BIG_Q1: [[u16; 3]; 3] =
3195+ [[641, 32768, 0], [22265, 32768, 0], [31452, 32768, 0]];
31943196 /// Default CDF table `TXB_SKIP_CHROMA_32_BIG` (AV1 spec 9.4 initial probabilities).
3195-pub const TXB_SKIP_CHROMA_32_BIG: [[u16; 3]; 3] = [[3082, 32768, 0], [20982, 32768, 0], [29443, 32768, 0]];
3197+pub const TXB_SKIP_CHROMA_32_BIG: [[u16; 3]; 3] =
3198+ [[3082, 32768, 0], [20982, 32768, 0], [29443, 32768, 0]];
31963199 /// Default CDF table `TXB_SKIP_CHROMA_32_BIG_Q3` (AV1 spec 9.4 initial probabilities).
3197-pub const TXB_SKIP_CHROMA_32_BIG_Q3: [[u16; 3]; 3] = [[1806, 32768, 0], [14645, 32768, 0], [25336, 32768, 0]];
3200+pub const TXB_SKIP_CHROMA_32_BIG_Q3: [[u16; 3]; 3] =
3201+ [[1806, 32768, 0], [14645, 32768, 0], [25336, 32768, 0]];
31983202 /// EOB_EXTRA_LUMA_16, q-context 3: the same table as [`EOB_EXTRA_LUMA_16`], for `base_q_idx` 121..=255.
31993203 pub const EOB_EXTRA_LUMA_16_Q3: [[u16; 3]; 9] = [
32003204 [19941, 32768, 0],
@@ -5374,27 +5378,28 @@ pub const EOB_PT_256_LUMA_CLASS1_Q3: [u16; 10] =
53745378 [2453, 4474, 6307, 8777, 16474, 22975, 29000, 31547, 32768, 0];
53755379
53765380 /// Default CDF table `EOB_PT_256_CHROMA_CLASS1_Q0` (AV1 spec 9.4 initial probabilities).
5377-pub const EOB_PT_256_CHROMA_CLASS1_Q0: [u16; 10] =
5378- [2203, 4130, 7435, 10739, 20652, 23681, 25609, 27261, 32768, 0];
5381+pub const EOB_PT_256_CHROMA_CLASS1_Q0: [u16; 10] = [
5382+ 2203, 4130, 7435, 10739, 20652, 23681, 25609, 27261, 32768, 0,
5383+];
53795384 /// Default CDF table `EOB_PT_256_CHROMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities).
5380-pub const EOB_PT_256_CHROMA_CLASS1_Q1: [u16; 10] =
5381- [1674, 3252, 5734, 10159, 22397, 23802, 24821, 30940, 32768, 0];
5385+pub const EOB_PT_256_CHROMA_CLASS1_Q1: [u16; 10] = [
5386+ 1674, 3252, 5734, 10159, 22397, 23802, 24821, 30940, 32768, 0,
5387+];
53825388 /// Default CDF table `EOB_PT_256_CHROMA_CLASS1` (AV1 spec 9.4 initial probabilities).
5383-pub const EOB_PT_256_CHROMA_CLASS1: [u16; 10] =
5384- [6571, 9610, 15516, 21826, 29092, 30829, 31842, 32708, 32768, 0];
5389+pub const EOB_PT_256_CHROMA_CLASS1: [u16; 10] = [
5390+ 6571, 9610, 15516, 21826, 29092, 30829, 31842, 32708, 32768, 0,
5391+];
53855392 /// Default CDF table `EOB_PT_256_CHROMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities).
5386-pub const EOB_PT_256_CHROMA_CLASS1_Q3: [u16; 10] =
5387- [9998, 17661, 25178, 28097, 31308, 32038, 32403, 32695, 32768, 0];
5393+pub const EOB_PT_256_CHROMA_CLASS1_Q3: [u16; 10] = [
5394+ 9998, 17661, 25178, 28097, 31308, 32038, 32403, 32695, 32768, 0,
5395+];
53885396
53895397 /// Default CDF table `EOB_PT_64_CHROMA_CLASS1_Q0` (AV1 spec 9.4 initial probabilities).
5390-pub const EOB_PT_64_CHROMA_CLASS1_Q0: [u16; 8] =
5391- [1563, 2700, 4876, 10911, 14706, 22480, 32768, 0];
5398+pub const EOB_PT_64_CHROMA_CLASS1_Q0: [u16; 8] = [1563, 2700, 4876, 10911, 14706, 22480, 32768, 0];
53925399 /// Default CDF table `EOB_PT_64_CHROMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities).
5393-pub const EOB_PT_64_CHROMA_CLASS1_Q1: [u16; 8] =
5394- [1923, 3127, 5867, 9703, 14277, 27100, 32768, 0];
5400+pub const EOB_PT_64_CHROMA_CLASS1_Q1: [u16; 8] = [1923, 3127, 5867, 9703, 14277, 27100, 32768, 0];
53955401 /// Default CDF table `EOB_PT_64_CHROMA_CLASS1` (AV1 spec 9.4 initial probabilities).
5396-pub const EOB_PT_64_CHROMA_CLASS1: [u16; 8] =
5397- [4034, 6290, 10235, 14982, 21214, 28491, 32768, 0];
5402+pub const EOB_PT_64_CHROMA_CLASS1: [u16; 8] = [4034, 6290, 10235, 14982, 21214, 28491, 32768, 0];
53985403 /// Default CDF table `EOB_PT_64_CHROMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities).
53995404 pub const EOB_PT_64_CHROMA_CLASS1_Q3: [u16; 8] =
54005405 [8726, 12378, 19409, 26450, 30038, 32462, 32768, 0];
@@ -5411,13 +5416,15 @@ pub const EOB_PT_16_CHROMA_CLASS1_Q3: [u16; 6] = [7297, 10767, 19273, 28194, 327
54115416 /// `EOB_PT_128_LUMA`'s class-1 sibling (`av1_default_eob_multi128_cdfs[q][0][1]`),
54125417 /// read by a 16x8/8x16 luma transform whose inherited `tx_type` is 1D
54135418 /// (`TxbSet::LumaRect16x8`) -- machine-extracted, scripts/extract-eob-class1.py.
5414-pub const EOB_PT_128_LUMA_CLASS1_Q0: [u16; 9] = [371, 699, 1254, 4830, 9479, 12562, 17497, 32768, 0];
5419+pub const EOB_PT_128_LUMA_CLASS1_Q0: [u16; 9] =
5420+ [371, 699, 1254, 4830, 9479, 12562, 17497, 32768, 0];
54155421 /// Default CDF table `EOB_PT_128_LUMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities).
54165422 pub const EOB_PT_128_LUMA_CLASS1_Q1: [u16; 9] = [217, 352, 618, 2303, 5261, 9969, 17472, 32768, 0];
54175423 /// Default CDF table `EOB_PT_128_LUMA_CLASS1` (AV1 spec 9.4 initial probabilities).
54185424 pub const EOB_PT_128_LUMA_CLASS1: [u16; 9] = [354, 558, 944, 2760, 7287, 14037, 21779, 32768, 0];
54195425 /// Default CDF table `EOB_PT_128_LUMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities).
5420-pub const EOB_PT_128_LUMA_CLASS1_Q3: [u16; 9] = [886, 1731, 3271, 8469, 15569, 22126, 28383, 32768, 0];
5426+pub const EOB_PT_128_LUMA_CLASS1_Q3: [u16; 9] =
5427+ [886, 1731, 3271, 8469, 15569, 22126, 28383, 32768, 0];
54215428
54225429 /// `EOB_PT_32_CHROMA`'s class-1 sibling (`av1_default_eob_multi32_cdfs[q][1][1]`),
54235430 /// read by an 8x4/4x8 chroma transform under a 1D luma `tx_type`
@@ -5431,47 +5438,82 @@ pub const EOB_PT_32_CHROMA_CLASS1: [u16; 7] = [3542, 5502, 10415, 16760, 25644,
54315438 pub const EOB_PT_32_CHROMA_CLASS1_Q3: [u16; 7] = [7699, 10897, 20891, 26926, 31628, 32768, 0];
54325439
54335440 /// `EOB_PT_128_CHROMA`'s class-1 sibling (`av1_default_eob_multi128_cdfs[q][1][1]`).
5434-pub const EOB_PT_128_CHROMA_CLASS1_Q0: [u16; 9] = [2054, 3472, 5869, 14232, 18242, 20590, 26752, 32768, 0];
5441+pub const EOB_PT_128_CHROMA_CLASS1_Q0: [u16; 9] =
5442+ [2054, 3472, 5869, 14232, 18242, 20590, 26752, 32768, 0];
54355443 /// Default CDF table `EOB_PT_128_CHROMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities).
5436-pub const EOB_PT_128_CHROMA_CLASS1_Q1: [u16; 9] = [2310, 4160, 7471, 14997, 17931, 20768, 30240, 32768, 0];
5444+pub const EOB_PT_128_CHROMA_CLASS1_Q1: [u16; 9] =
5445+ [2310, 4160, 7471, 14997, 17931, 20768, 30240, 32768, 0];
54375446 /// Default CDF table `EOB_PT_128_CHROMA_CLASS1` (AV1 spec 9.4 initial probabilities).
5438-pub const EOB_PT_128_CHROMA_CLASS1: [u16; 9] = [6275, 9889, 14769, 23164, 27988, 30493, 32272, 32768, 0];
5447+pub const EOB_PT_128_CHROMA_CLASS1: [u16; 9] =
5448+ [6275, 9889, 14769, 23164, 27988, 30493, 32272, 32768, 0];
54395449 /// Default CDF table `EOB_PT_128_CHROMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities).
5440-pub const EOB_PT_128_CHROMA_CLASS1_Q3: [u16; 9] = [9165, 13282, 21150, 30286, 31894, 32571, 32712, 32768, 0];
5450+pub const EOB_PT_128_CHROMA_CLASS1_Q3: [u16; 9] =
5451+ [9165, 13282, 21150, 30286, 31894, 32571, 32712, 32768, 0];
54415452
54425453 /// `EOB_PT_512_LUMA`'s class-1 sibling (`av1_default_eob_multi512_cdfs[q][0][1]`).
5443-pub const EOB_PT_512_LUMA_CLASS1_Q0: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5454+pub const EOB_PT_512_LUMA_CLASS1_Q0: [u16; 11] = [
5455+ 3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0,
5456+];
54445457 /// Default CDF table `EOB_PT_512_LUMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities).
5445-pub const EOB_PT_512_LUMA_CLASS1_Q1: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5458+pub const EOB_PT_512_LUMA_CLASS1_Q1: [u16; 11] = [
5459+ 3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0,
5460+];
54465461 /// Default CDF table `EOB_PT_512_LUMA_CLASS1` (AV1 spec 9.4 initial probabilities).
5447-pub const EOB_PT_512_LUMA_CLASS1: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5462+pub const EOB_PT_512_LUMA_CLASS1: [u16; 11] = [
5463+ 3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0,
5464+];
54485465 /// Default CDF table `EOB_PT_512_LUMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities).
5449-pub const EOB_PT_512_LUMA_CLASS1_Q3: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5466+pub const EOB_PT_512_LUMA_CLASS1_Q3: [u16; 11] = [
5467+ 3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0,
5468+];
54505469
54515470 /// `EOB_PT_512_CHROMA`'s class-1 sibling (`av1_default_eob_multi512_cdfs[q][1][1]`).
5452-pub const EOB_PT_512_CHROMA_CLASS1_Q0: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5471+pub const EOB_PT_512_CHROMA_CLASS1_Q0: [u16; 11] = [
5472+ 3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0,
5473+];
54535474 /// Default CDF table `EOB_PT_512_CHROMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities).
5454-pub const EOB_PT_512_CHROMA_CLASS1_Q1: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5475+pub const EOB_PT_512_CHROMA_CLASS1_Q1: [u16; 11] = [
5476+ 3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0,
5477+];
54555478 /// Default CDF table `EOB_PT_512_CHROMA_CLASS1` (AV1 spec 9.4 initial probabilities).
5456-pub const EOB_PT_512_CHROMA_CLASS1: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5479+pub const EOB_PT_512_CHROMA_CLASS1: [u16; 11] = [
5480+ 3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0,
5481+];
54575482 /// Default CDF table `EOB_PT_512_CHROMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities).
5458-pub const EOB_PT_512_CHROMA_CLASS1_Q3: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5483+pub const EOB_PT_512_CHROMA_CLASS1_Q3: [u16; 11] = [
5484+ 3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0,
5485+];
54595486
54605487 /// `EOB_PT_1024_LUMA`'s class-1 sibling (`av1_default_eob_multi1024_cdfs[q][0][1]`).
5461-pub const EOB_PT_1024_LUMA_CLASS1_Q0: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5488+pub const EOB_PT_1024_LUMA_CLASS1_Q0: [u16; 12] = [
5489+ 2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0,
5490+];
54625491 /// Default CDF table `EOB_PT_1024_LUMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities).
5463-pub const EOB_PT_1024_LUMA_CLASS1_Q1: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5492+pub const EOB_PT_1024_LUMA_CLASS1_Q1: [u16; 12] = [
5493+ 2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0,
5494+];
54645495 /// Default CDF table `EOB_PT_1024_LUMA_CLASS1` (AV1 spec 9.4 initial probabilities).
5465-pub const EOB_PT_1024_LUMA_CLASS1: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5496+pub const EOB_PT_1024_LUMA_CLASS1: [u16; 12] = [
5497+ 2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0,
5498+];
54665499 /// Default CDF table `EOB_PT_1024_LUMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities).
5467-pub const EOB_PT_1024_LUMA_CLASS1_Q3: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5500+pub const EOB_PT_1024_LUMA_CLASS1_Q3: [u16; 12] = [
5501+ 2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0,
5502+];
54685503
54695504 /// `EOB_PT_1024_CHROMA`'s class-1 sibling (`av1_default_eob_multi1024_cdfs[q][1][1]`).
5470-pub const EOB_PT_1024_CHROMA_CLASS1_Q0: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5505+pub const EOB_PT_1024_CHROMA_CLASS1_Q0: [u16; 12] = [
5506+ 2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0,
5507+];
54715508 /// Default CDF table `EOB_PT_1024_CHROMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities).
5472-pub const EOB_PT_1024_CHROMA_CLASS1_Q1: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5509+pub const EOB_PT_1024_CHROMA_CLASS1_Q1: [u16; 12] = [
5510+ 2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0,
5511+];
54735512 /// Default CDF table `EOB_PT_1024_CHROMA_CLASS1` (AV1 spec 9.4 initial probabilities).
5474-pub const EOB_PT_1024_CHROMA_CLASS1: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5513+pub const EOB_PT_1024_CHROMA_CLASS1: [u16; 12] = [
5514+ 2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0,
5515+];
54755516 /// Default CDF table `EOB_PT_1024_CHROMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities).
5476-pub const EOB_PT_1024_CHROMA_CLASS1_Q3: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5477-
5517+pub const EOB_PT_1024_CHROMA_CLASS1_Q3: [u16; 12] = [
5518+ 2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0,
5519+];
crates/ec-av1/src/cdf_state.rsmodified+45 -19
@@ -400,7 +400,7 @@ pub(crate) struct Cdfs {
400400 /// The same, for a 4x4 luma transform (lane-av1tx4).
401401 pub txb_skip_luma_4: [[u16; 3]; 7],
402402 /// The all-zero flag of an 8x8 chroma transform.
403- pub txb_skip_chroma_8: [[u16; 3]; 3],
403+ pub txb_skip_chroma_8: [[u16; 3]; 6],
404404 /// The all-zero flag of a 4x4 chroma transform.
405405 /// lane-lossless: SIX rows, like [`Self::txb_skip_chroma_32`] -- the last
406406 /// three are `get_txb_ctx`'s `+10` rows (chroma plane block bigger than
@@ -500,7 +500,7 @@ pub(crate) struct Cdfs {
500500 /// The same, for a 64x64 luma transform.
501501 pub txb_skip_luma_64: [[u16; 3]; 7],
502502 /// The all-zero flag of a 16x16 chroma transform.
503- pub txb_skip_chroma_16: [[u16; 3]; 3],
503+ pub txb_skip_chroma_16: [[u16; 3]; 6],
504504 /// The all-zero flag of a 32x32 chroma transform.
505505 /// SIX contexts, not three: rows 0..3 are libaom's `txb_skip_ctx` 7..9
506506 /// (chroma transform == its plane block) and rows 3..6 its 10..12 (plane
@@ -828,9 +828,7 @@ fn reset3<const N: usize, const M: usize, const K: usize>(a: &mut [[[u16; N]; M]
828828 /// [`reset3`] for a table whose ALPHABET grows with its first index: the
829829 /// palette colour-index CDFs are `[u16; 9]` rows read as `[..=n]` with
830830 /// `n = idx + 2`, so their symbol counter sits at index `n`, not `N - 1`.
831-fn reset_var_alphabet<const N: usize, const M: usize, const K: usize>(
832- a: &mut [[[u16; N]; M]; K],
833-) {
831+fn reset_var_alphabet<const N: usize, const M: usize, const K: usize>(a: &mut [[[u16; N]; M]; K]) {
834832 for (idx, rows) in a.iter_mut().enumerate() {
835833 for row in rows.iter_mut() {
836834 row[idx + 2] = 0;
@@ -1067,13 +1065,27 @@ impl Cdfs {
10671065 cdf::TXB_SKIP_LUMA_4_CTX,
10681066 cdf::TXB_SKIP_LUMA_4_Q3_CTX,
10691067 ),
1070- txb_skip_chroma_8: pick(
1071- q_ctx,
1072- cdf::TXB_SKIP_CHROMA_8_Q0,
1073- cdf::TXB_SKIP_CHROMA_8_Q1,
1074- cdf::TXB_SKIP_CHROMA_8,
1075- cdf::TXB_SKIP_CHROMA_8_Q3,
1076- ),
1068+ txb_skip_chroma_8: {
1069+ // lane-av1-422b: rows 3..6 are the `+10` chroma rows
1070+ // (`TXB_SKIP_CHROMA_8_BIG`) -- neutral in libaom's defaults,
1071+ // reached only when the plane block is larger than an 8x8
1072+ // transform, i.e. only at 4:2:2 today.
1073+ let small = pick(
1074+ q_ctx,
1075+ cdf::TXB_SKIP_CHROMA_8_Q0,
1076+ cdf::TXB_SKIP_CHROMA_8_Q1,
1077+ cdf::TXB_SKIP_CHROMA_8,
1078+ cdf::TXB_SKIP_CHROMA_8_Q3,
1079+ );
1080+ [
1081+ small[0],
1082+ small[1],
1083+ small[2],
1084+ cdf::TXB_SKIP_CHROMA_8_BIG[0],
1085+ cdf::TXB_SKIP_CHROMA_8_BIG[1],
1086+ cdf::TXB_SKIP_CHROMA_8_BIG[2],
1087+ ]
1088+ },
10771089 txb_skip_chroma_4: {
10781090 let small = pick(
10791091 q_ctx,
@@ -1387,13 +1399,27 @@ impl Cdfs {
13871399 cdf::TXB_SKIP_LUMA_64_CTX,
13881400 cdf::TXB_SKIP_LUMA_64_Q3_CTX,
13891401 ),
1390- txb_skip_chroma_16: pick(
1391- q_ctx,
1392- cdf::TXB_SKIP_CHROMA_16_Q0,
1393- cdf::TXB_SKIP_CHROMA_16_Q1,
1394- cdf::TXB_SKIP_CHROMA_16,
1395- cdf::TXB_SKIP_CHROMA_16_Q3,
1396- ),
1402+ txb_skip_chroma_16: {
1403+ // lane-av1-422b: rows 3..6 are the `+10` chroma rows
1404+ // (`TXB_SKIP_CHROMA_16_BIG`) -- neutral in libaom's defaults,
1405+ // reached only when the plane block is larger than a 16x16
1406+ // transform, i.e. only at 4:2:2 today.
1407+ let small = pick(
1408+ q_ctx,
1409+ cdf::TXB_SKIP_CHROMA_16_Q0,
1410+ cdf::TXB_SKIP_CHROMA_16_Q1,
1411+ cdf::TXB_SKIP_CHROMA_16,
1412+ cdf::TXB_SKIP_CHROMA_16_Q3,
1413+ );
1414+ [
1415+ small[0],
1416+ small[1],
1417+ small[2],
1418+ cdf::TXB_SKIP_CHROMA_16_BIG[0],
1419+ cdf::TXB_SKIP_CHROMA_16_BIG[1],
1420+ cdf::TXB_SKIP_CHROMA_16_BIG[2],
1421+ ]
1422+ },
13971423 txb_skip_chroma_32: {
13981424 let small = pick(
13991425 q_ctx,
crates/ec-av1/src/decode.rsmodified+4772 -734

Diff too large; view file

@@ -486,7 +486,15 @@ pub(crate) fn lossless_tx(px: usize, fctx: &crate::decode::FrameCtx) -> usize {
486486 /// picks the 13-symbol one (class `wrong-alphabet-same-value`).
487487 pub(crate) fn cfl_allowed_px(bw: usize, bh: usize, fctx: &crate::decode::FrameCtx) -> bool {
488488 if lossless(fctx) {
489- bw <= 8 && bh <= 8
489+ // `is_cfl_allowed`: at lossless CfL is available only when the
490+ // partition size equals the transform size -- the CHROMA plane block
491+ // must be a single TX_4X4. True for an 8x8 partition at 4:2:0 (its
492+ // plane block is 4x4) and for 4x4 partitions; FALSE for an 8x8
493+ // partition at 4:4:4, whose plane block is 8x8 -- that partition
494+ // reads the 13-symbol uv_mode CDF, and reading the CFL alphabet
495+ // there desynced the tile from the leaf's own uv_mode symbol (class
496+ // `wrong-alphabet-same-value`).
497+ (bw >> ss_x(fctx)).max(4) == 4 && (bh >> ss_y(fctx)).max(4) == 4
490498 } else {
491499 bw <= 32 && bh <= 32
492500 }
@@ -1509,6 +1517,36 @@ fn tu_reach(
15091517 fixed
15101518 }
15111519
1520+/// [`tu_reach`] for a unit whose LUMA footprint is a `tx_w` x `tx_h` rect
1521+/// (lane-av1-422b: a 4:2:2 chroma unit is square in chroma pixels, but its
1522+/// luma anchor is `(chroma_tx << ss_x, chroma_tx << ss_y)` -- at ss (1,0)
1523+/// twice as wide as it is tall). Same predicate as [`tu_reach`]; the
1524+/// square mismatch counter only means anything when the footprint actually
1525+/// is square.
1526+#[allow(clippy::too_many_arguments)]
1527+fn tu_reach_rect(
1528+ bw: usize,
1529+ bh: usize,
1530+ col_off: usize,
1531+ row_off: usize,
1532+ tx_w: usize,
1533+ tx_h: usize,
1534+ block: Reach,
1535+ px: usize,
1536+ py: usize,
1537+ width: usize,
1538+ height: usize, fctx: &crate::decode::FrameCtx,
1539+) -> Reach {
1540+ let fixed = Reach::of_tu(bw, bh, col_off, row_off, tx_w, tx_h, block);
1541+ if tx_w == tx_h {
1542+ let standalone = Reach::of(tx_w, px + col_off, py + row_off, width, height, fctx);
1543+ if fixed != standalone {
1544+ hit!(SPLIT_TU_REACH_FIX_HITS);
1545+ }
1546+ }
1547+ fixed
1548+}
1549+
15121550 // How many `uv_mode` reads resolved to `SMOOTH_PRED..=PAETH_PRED` (9..=12),
15131551 // across every call on the current thread -- lane-chroma r3's own before/after
15141552 // counter, proving a stream actually exercised chroma's smooth/paeth
@@ -1990,6 +2028,100 @@ pub(crate) fn rect_split_chroma_shape_hits() -> [usize; 4] {
19902028 RECT_SPLIT_CHROMA_SHAPE_HITS.with(|c| c.get())
19912029 }
19922030
2031+// lane-av1-422: how many SQUARE chroma coefficient units the strip path read
2032+// on a 4:2:2 frame (ss 1,0) -- the half-width, unhalved-height shape whose
2033+// tables only exist because of the square rows in the chroma_tiled arm. A
2034+// 4:2:0 or 4:4:4 frame can never increment it (their rect strips' chroma is
2035+// itself rect), and a restored `/2 chroma height` diverts 4:2:2 squares onto
2036+// the rect rows, so the witness gate reads 0 there and fails.
2037+thread_local! {
2038+ static CHROMA422_SQUARE_HITS: std::cell::Cell<usize> =
2039+ const { std::cell::Cell::new(0) };
2040+}
2041+
2042+/// Current value of [`CHROMA422_SQUARE_HITS`].
2043+// lane-av1-422b: `pub` so `examples/decode_probe.rs` can census it the way
2044+// it does every other capability counter.
2045+pub fn chroma422_square_hits() -> usize {
2046+ CHROMA422_SQUARE_HITS.with(|c| c.get())
2047+}
2048+
2049+// lane-av1-422f: how many RECT chroma coefficient units the square-block
2050+// path read on a 4:2:2 frame (ss 1,0) -- TX_4X8 / TX_8X16 / TX_16X32, the
2051+// plane block's own half-width, unhalved-height shape. A 4:2:0 or 4:4:4
2052+// frame never takes the rect branch (their units are square
2053+// `chroma_tx == chroma_tx_h`), so a witness gate reading 0 here proves the
2054+// model reverted to squares.
2055+thread_local! {
2056+ static CHROMA422_RECT_HITS: std::cell::Cell<usize> =
2057+ const { std::cell::Cell::new(0) };
2058+}
2059+
2060+/// Current value of [`CHROMA422_RECT_HITS`].
2061+pub fn chroma422_rect_hits() -> usize {
2062+ CHROMA422_RECT_HITS.with(|c| c.get())
2063+}
2064+
2065+// lane-av1-422g: how many PER-LEAF TX_4X4 chroma coefficient units the
2066+// sub-8x8 split4 path read on a 4:2:2 frame (ss 1,0) -- one per even-column
2067+// leaf per plane (`is_chroma_reference`'s `!(mi_col & ss_x)`). A 4:2:0 frame
2068+// codes no sub-8 chroma at all and 4:4:4 goes through `sub8_leaf_chroma444`,
2069+// so a witness gate reading 0 here proves the per-leaf 4:2:2 arm never ran.
2070+thread_local! {
2071+ static CHROMA422_SUB8_HITS: std::cell::Cell<usize> =
2072+ const { std::cell::Cell::new(0) };
2073+}
2074+
2075+/// Current value of [`CHROMA422_SUB8_HITS`].
2076+pub fn chroma422_sub8_hits() -> usize {
2077+ CHROMA422_SUB8_HITS.with(|c| c.get())
2078+}
2079+
2080+// lane-av1-422sub8rect: how many PER-PIECE TX_4X4 chroma coefficient units
2081+// the INTER sub-8x8 split4 path read on a 4:2:2 frame (ss 1,0) -- one per
2082+// non-skipped odd-column piece per plane (`is_chroma_reference`'s
2083+// `mi_col & 0x01` at ss_x 1). 4:2:0 goes through the shared group unit and
2084+// 4:4:4 through [`sub8_leaf_chroma444`]'s own per-piece twin, so a witness
2085+// gate reading 0 here proves the inter 4:2:2 per-piece arm never ran.
2086+thread_local! {
2087+ static CHROMA422_INTER_SUB8_HITS: std::cell::Cell<usize> =
2088+ const { std::cell::Cell::new(0) };
2089+}
2090+
2091+/// Current value of [`CHROMA422_INTER_SUB8_HITS`].
2092+pub fn chroma422_inter_sub8_hits() -> usize {
2093+ CHROMA422_INTER_SUB8_HITS.with(|c| c.get())
2094+}
2095+
2096+// lane-av1-422m: how many TX_4X4 chunk units the invalid-ss-size chroma arm
2097+// read (the 8x32 luma block whose 4:2:2 plane has no `ss_size_lookup` block).
2098+// A 4:2:0 or 4:4:4 frame cannot increment it, so a non-zero read proves the
2099+// chunked 4:2:2 chroma really decoded.
2100+thread_local! {
2101+ static CHROMA422_CHUNK_HITS: std::cell::Cell<usize> =
2102+ const { std::cell::Cell::new(0) };
2103+}
2104+
2105+/// Current value of [`CHROMA422_CHUNK_HITS`].
2106+pub fn chroma422_chunk_hits() -> usize {
2107+ CHROMA422_CHUNK_HITS.with(|c| c.get())
2108+}
2109+
2110+// lane-av1-422stripanchor: how many 4-wide-strip PAIR chroma units
2111+// ([`decode_rect_split`]'s ported floored-pair anchor) decoded. A 4:2:0 or
2112+// 4:4:4 frame cannot increment it (the arm is keyed to a 2-px-wide chroma
2113+// block, which only a 1-mi-wide strip at ss (1, 0) produces), so a non-zero
2114+// read proves a stream routed a 4-wide strip through the split path.
2115+thread_local! {
2116+ static CHROMA422_PAIR_WIDE_HITS: std::cell::Cell<usize> =
2117+ const { std::cell::Cell::new(0) };
2118+}
2119+
2120+/// Current value of [`CHROMA422_PAIR_WIDE_HITS`].
2121+pub fn chroma422_pair_wide_hits() -> usize {
2122+ CHROMA422_PAIR_WIDE_HITS.with(|c| c.get())
2123+}
2124+
19932125 // How many HORZ/VERT intra strips actually predicted with filter intra
19942126 // (lane-rectsplit r1) -- the case `decode_block_rect` refused by name
19952127 // ("this decoder predicts square-only") until `predict_filter_intra` took
@@ -2575,7 +2707,10 @@ impl TxParams {
25752707 if self.stride == 0 {
25762708 return residual;
25772709 }
2578- let mut strided = vec![0i32; self.stride * self.stride];
2710+ // lane-av1-422sub8rect: `h` rows of `stride` -- a rect unit whose
2711+ // height exceeds its (narrow) prediction stride needs the full
2712+ // stride * h; every square caller has h == stride and is unchanged.
2713+ let mut strided = vec![0i32; self.stride * self.h];
25792714 for row in 0..self.h {
25802715 strided[row * self.stride..][..self.w]
25812716 .copy_from_slice(&residual[row * self.w..][..self.w]);
@@ -2983,10 +3118,18 @@ pub(crate) struct WaveState {
29833118 q: std::sync::Mutex<WaveQueue>,
29843119 cv: std::sync::Condvar,
29853120 planes: ReconPlanes,
2986- /// The two [`FrameCtx`] fields reconstruction reads (`sample_max` is
3121+ /// The [`FrameCtx`] fields reconstruction reads (`sample_max` is
29873122 /// `bit_depth`'s; everything else a `reconstruct*` needs is in the op).
29883123 bit_depth: u8,
29893124 enable_edge_filter: bool,
3125+ /// lane-av1wavefront: the sequence's chroma subsampling. The replay-side
3126+ /// readers -- the deferred chroma builds' `mv_to_q4(.., ss_x(fctx))`
3127+ /// positions and `exec_intra`'s CfL AC signal -- must see the FRAME's
3128+ /// pair, not [`FrameCtx::new`]'s 4:2:0 default: on a 4:4:4 stream the
3129+ /// default halved every worker's chroma reference position and lost the
3130+ /// chroma planes (the 444_sb128rect witness, U 17504 / V 3 at PREFILT on
3131+ /// frame 1) while every 4:2:0 gate stream stayed accidentally exact.
3132+ subsampling: (u8, u8),
29903133 last_col: usize,
29913134 }
29923135
@@ -3139,6 +3282,9 @@ fn wave_worker(st: &WaveState, idx: usize) {
31393282 let fctx = FrameCtx::new();
31403283 fctx.bit_depth.set(st.bit_depth);
31413284 fctx.enable_edge_filter.set(st.enable_edge_filter);
3285+ let (sx, sy) = st.subsampling;
3286+ fctx.subsampling_x.set(sx);
3287+ fctx.subsampling_y.set(sy);
31423288 let stats = wave_stats();
31433289 let slot = idx.min(WS_SLOTS - 1);
31443290 loop {
@@ -3235,6 +3381,10 @@ impl<'a> WaveGuard<'a> {
32353381 ),
32363382 bit_depth: fctx.bit_depth.with(std::cell::Cell::get),
32373383 enable_edge_filter: fctx.enable_edge_filter.with(std::cell::Cell::get),
3384+ subsampling: (
3385+ fctx.subsampling_x.with(std::cell::Cell::get),
3386+ fctx.subsampling_y.with(std::cell::Cell::get),
3387+ ),
32383388 last_col: cols - 1,
32393389 });
32403390 let batch = crate::par::Batch::new("ec-av1-recon");
@@ -3918,6 +4068,30 @@ pub(crate) fn reset_skipped_intrabc_chroma_arm_hits() {
39184068 SKIPPED_INTRABC_CHROMA_ARM_HITS.with(|c| c.set(0));
39194069 }
39204070
4071+thread_local! {
4072+ /// lane-av1-ibcskip2: a sub-8x8 4:4:4 leaf that is BOTH intrabc AND
4073+ /// `skip` -- the arm whose chroma is the bare frame copy at the DV
4074+ /// (libaom `av1_build_inter_predictors_sb` runs regardless of `skip`).
4075+ /// Before the fix this route predicted intra-DC and every one of this
4076+ /// fixture's 150 such cells differed from the oracle on both chroma
4077+ /// planes.
4078+ static SKIPPED_INTRABC_DV_COPY_HITS: std::cell::Cell<usize> =
4079+ const { std::cell::Cell::new(0) };
4080+}
4081+
4082+/// Current value of [`SKIPPED_INTRABC_DV_COPY_HITS`].
4083+#[allow(dead_code)] // read only from the `#[cfg(test)]` gates
4084+pub(crate) fn skipped_intrabc_dv_copy_hits() -> usize {
4085+ SKIPPED_INTRABC_DV_COPY_HITS.with(|c| c.get())
4086+}
4087+
4088+/// Zeroes [`SKIPPED_INTRABC_DV_COPY_HITS`] (gate tests call this before a
4089+/// decode).
4090+#[allow(dead_code)] // read only from the `#[cfg(test)]` gates
4091+pub(crate) fn reset_skipped_intrabc_dv_copy_hits() {
4092+ SKIPPED_INTRABC_DV_COPY_HITS.with(|c| c.set(0));
4093+}
4094+
39214095 /// Zeroes [`INTRABC_HITS`] (gate tests call this before a decode).
39224096 #[allow(dead_code)] // read only from the `#[cfg(test)]` gates
39234097 pub(crate) fn reset_intrabc_hits() {
@@ -4356,6 +4530,23 @@ pub(crate) fn affine_gm_hits() -> usize {
43564530 AFFINE_GM_HITS.with(|c| c.get())
43574531 }
43584532
4533+// lane-av1gwarp12: how many 16x16+ blocks built their SINGLE-reference
4534+// prediction through `crate::warp::global_warp_params` with a FOUR-parameter
4535+// (`ROTZOOM`) model. Vanilla aomenc pins its global-motion search to ROTZOOM
4536+// (`global_motion_facade.c:24`), so this is the only >TRANSLATION single-ref
4537+// global-warp arm a real aomenc stream can reach (AFFINE needs the widened
4538+// side build and its own counter, [`AFFINE_GM_HITS`]).
4539+thread_local! {
4540+ static ROTZOOM_GM_WARP_HITS: std::cell::Cell<usize> =
4541+ const { std::cell::Cell::new(0) };
4542+}
4543+
4544+/// Current value of [`ROTZOOM_GM_WARP_HITS`].
4545+#[allow(dead_code)] // read only from the `#[cfg(test)]` gates
4546+pub(crate) fn rotzoom_gm_warp_hits() -> usize {
4547+ ROTZOOM_GM_WARP_HITS.with(|c| c.get())
4548+}
4549+
43594550 // lane-t900 r9: rect blocks whose warp-sample top-right probe answers
43604551 // differently at the block's WIDTH than at libaom's
43614552 // `AOMMAX(xd->width, xd->height)` -- each one is a `num_proj_ref` that could
@@ -5313,6 +5504,17 @@ thread_local! {
53135504 /// entropy bands were zeroed per unit (libaom `av1_reset_entropy_context`,
53145505 /// decodeframe.c:1262) instead of leaking the previous occupant's.
53155506 static SKIP_LOSSLESS_BAND_RESET_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
5507+ /// lane-av1-llband: 4x4 chroma transform units a lossless HORZ/VERT strip
5508+ /// walked at subsampling 0/0 (one unit per mi cell -- the geometry the
5509+ /// hardcoded 4:2:0 span mis-stepped).
5510+ static RECT_SPLIT_LOSSLESS_CHROMA444_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
5511+ /// lane-av1-ibc444rect: unskipped intrabc 8x4/4x8 leaves whose luma
5512+ /// coefficients a lossless frame walked as per-4x4 inter units (the walk
5513+ /// that replaced the single rect unit).
5514+ static INTRABC_RECT8_LOSSLESS_LUMA_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
5515+ /// lane-av1-ibc444rect: unskipped intrabc 8x4/4x8 leaves whose chroma a
5516+ /// lossless 4:4:4 frame walked as per-4x4 [`TxbSet::Chroma4`] units.
5517+ static INTRABC_RECT8_LOSSLESS_CHROMA_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
53165518 }
53175519
53185520 /// How many skipped sub-8x8 chroma blocks carried a CfL alpha (the shape
@@ -5335,6 +5537,32 @@ pub fn skip_lossless_band_reset_hits() -> usize {
53355537 SKIP_LOSSLESS_BAND_RESET_HITS.with(|c| c.get())
53365538 }
53375539
5540+/// How many 4x4 chroma transform units a lossless HORZ/VERT strip walked at
5541+/// subsampling 0/0 (lane-av1-llband). Zero means a stream never decoded the
5542+/// 4:4:4 lossless unit walk this counter proves -- a gate asserting the fix
5543+/// must see this nonzero.
5544+pub fn rect_split_lossless_chroma444_hits() -> usize {
5545+ RECT_SPLIT_LOSSLESS_CHROMA444_HITS.with(|c| c.get())
5546+}
5547+
5548+/// How many unskipped intrabc 8x4/4x8 leaves a lossless frame walked luma as
5549+/// per-4x4 inter units (lane-av1-ibc444rect).
5550+pub fn intrabc_rect8_lossless_luma_hits() -> usize {
5551+ INTRABC_RECT8_LOSSLESS_LUMA_HITS.with(|c| c.get())
5552+}
5553+
5554+/// How many unskipped intrabc 8x4/4x8 leaves a lossless 4:4:4 frame walked
5555+/// chroma as per-4x4 [`TxbSet::Chroma4`] units (lane-av1-ibc444rect).
5556+pub fn intrabc_rect8_lossless_chroma_hits() -> usize {
5557+ INTRABC_RECT8_LOSSLESS_CHROMA_HITS.with(|c| c.get())
5558+}
5559+
5560+/// Gate-side reset for the two lane-av1-ibc444rect counters above.
5561+pub fn reset_ibc444rect_hits() {
5562+ INTRABC_RECT8_LOSSLESS_LUMA_HITS.with(|c| c.set(0));
5563+ INTRABC_RECT8_LOSSLESS_CHROMA_HITS.with(|c| c.set(0));
5564+}
5565+
53385566 /// Gate-side reset for the two lane-av1-loss64 counters above.
53395567 pub fn reset_loss64_hits() {
53405568 CHROMA_EDGE_TU_CLIP_HITS.with(|c| c.set(0));
@@ -8433,6 +8661,62 @@ impl Neighbours {
84338661 o.1 |= left[plane].level != 0;
84348662 o.2 += dc_vote(left[plane].dc);
84358663 }
8664+ }
8665+ out
8666+ }
8667+
8668+ /// [`Self::around_mi_rect`] for the CHROMA planes of a 4:2:2 frame
8669+ /// (lane-av1-422f): libaom `get_txb_ctx_general` reads its above votes
8670+ /// over `txb_w_unit` CHROMA 4-px cells, and at ss_x 1 one chroma cell
8671+ /// spans TWO luma mi columns. Both cells of a column carry the covering
8672+ /// unit's whole-unit dc sign (the same value libaom stores), so the
8673+ /// per-luma-mi sum counts each chroma column twice -- and
8674+ /// `dc_sign_ctx`'s signum flips whenever the above and left votes have
8675+ /// opposite signs with equal magnitude (measured at mi(4,4) plane 1 of
8676+ /// the t422 fixture: ours read `dc_sign_cdf[1]`, the oracle row 0).
8677+ /// Sampling every second above cell counts each chroma column once,
8678+ /// which IS libaom's sum. The left extent is unsubsquared at ss_y 0, so
8679+ /// its per-mi cells already line up one-to-one. The level booleans are
8680+ /// ORs over duplicated cells, so the sampling cannot change them.
8681+ fn around_mi_422_chroma(
8682+ &self,
8683+ (mi_r, mi_c): (usize, usize),
8684+ w: usize,
8685+ h: usize,
8686+ ) -> [(bool, bool, i32); 3] {
8687+ let (w_mi, h_mi) = (w / MI, h / MI);
8688+ let above_mi = w_mi.min(self.mi_cols.saturating_sub(mi_c));
8689+ let left_mi = h_mi.min(self.mi_rows.saturating_sub(mi_r));
8690+ let mut out = [(false, false, 0i32); 3];
8691+ for cell in (0..above_mi).step_by(2) {
8692+ let above = &self.above[mi_c + cell];
8693+ for (plane, o) in out.iter_mut().enumerate() {
8694+ o.0 |= above[plane].level != 0;
8695+ o.2 += dc_vote(above[plane].dc);
8696+ }
8697+ }
8698+ for cell in 0..left_mi {
8699+ let left = &self.left[mi_r + cell];
8700+ for (plane, o) in out.iter_mut().enumerate() {
8701+ o.1 |= left[plane].level != 0;
8702+ o.2 += dc_vote(left[plane].dc);
8703+ }
8704+ }
8705+ if crate::envflags::env_flag!("EC_DCDUMP") {
8706+ // lane-av1422mi24: same dump [`Self::around_mi_rect`] prints, so
8707+ // a rerouted 4:2:2 chroma gather stays visible under EC_DCDUMP=1.
8708+ // The above rows are the SAMPLED (every-second) cells.
8709+ for (plane, o) in out.iter().enumerate() {
8710+ let vote = o.2;
8711+ let ab: Vec<String> = (0..above_mi)
8712+ .step_by(2)
8713+ .map(|k| format!("{:?}/{}", self.above[mi_c + k][plane].dc, self.above[mi_c + k][plane].level))
8714+ .collect();
8715+ let lf: Vec<String> = (0..left_mi)
8716+ .map(|k| format!("{:?}/{}", self.left[mi_r + k][plane].dc, self.left[mi_r + k][plane].level))
8717+ .collect();
8718+ eprintln!("EC_DCDUMP422 mi=({mi_r},{mi_c}) plane={plane} wh=({w},{h}) vote={vote} above=[{}] left=[{}]", ab.join(","), lf.join(","));
8719+ }
84368720 }
84378721 out
84388722 }
@@ -8960,6 +9244,13 @@ impl Neighbours {
89609244 let round_up_even = |n: usize| n.div_ceil(2) * 2;
89619245 let (bound_h, bound_w) = (round_up_even(self.mi_rows), round_up_even(self.mi_cols));
89629246 let state = neighbour_state(grid);
9247+ if crate::envflags::env_flag!("EC_CHROMA_PUB") {
9248+ eprintln!(
9249+ "EC_CHROMA_PUB plane={plane} mi=({mi_r},{mi_c}) wh=({w_px},{h_px}) lvl={} dc={}",
9250+ state.level,
9251+ state.dc.map_or(-1, |s| i32::from(s))
9252+ );
9253+ }
89639254 for cell in 0..(h_px / MI).min(bound_h.saturating_sub(mi_r)) {
89649255 self.left[mi_r + cell][plane] = state;
89659256 }
@@ -10016,6 +10307,35 @@ fn depth_to_tx_wh(
1001610307 (w, h)
1001710308 }
1001810309
10310+/// lane-av1-422stripanchor: [`decode_rect_split`]'s 4-wide-strip port of the
10311+/// split4 floored-pair anchor ([`sub8_leaf_chroma422`]'s rule). A 1-mi-wide
10312+/// strip (luma `(4, 16)` / `(4, 8)`) has NO chroma plane block of its own at
10313+/// ss (1, 0) -- `av1_ss_size_lookup[BLOCK_4X16][1][0]` and
10314+/// `[BLOCK_4X8][1][0]` are both BLOCK_INVALID (`common_data.c`), and a
10315+/// 2-px-wide area is not a transform shape. The strip pairs with its
10316+/// even-column sibling (`is_chroma_reference`'s `mi_col & 1` column clause,
10317+/// the rule [`decode_rect4_16_strip`] implements one partition level up), and
10318+/// the ODD-column strip codes the PAIR's `(4, bh)` plane anchored at
10319+/// `av1_setup_dst_planes`' mi-exact floor `(mi_col & !1) * MI >> ss_x`, with
10320+/// the entropy context on the floored cell. Returns
10321+/// `(pair block width, pair block height, write anchor x, entropy mi column)`
10322+/// for that pair, or `None` when the strip keeps its own plane block at its
10323+/// own origin -- which is every 4:2:0 and 4:4:4 cell (their chroma is never
10324+/// 2 px wide) and every 4:2:2 strip of 8 px or more.
10325+fn chroma422_pair_plane(
10326+ ss_x: bool,
10327+ ss_y: bool,
10328+ mi_col: usize,
10329+ bw: usize,
10330+ bh: usize,
10331+) -> Option<(usize, usize, usize, usize)> {
10332+ if ss_x && !ss_y && (bw >> 1) == 2 {
10333+ Some((4, bh, ((mi_col & !1) * MI) >> 1, mi_col & !1))
10334+ } else {
10335+ None
10336+ }
10337+}
10338+
1001910339 /// Decodes the planes of one `bw`x`bh` HORZ/VERT intra strip whose luma
1002010340 /// transform is SPLIT (`tx_depth != 0`) -- lane-rectsplit r1, the case every
1002110341 /// rect path here refused by name until now ("per-unit rect prediction is not
@@ -10061,6 +10381,36 @@ fn decode_rect_split(
1006110381 let (px, py) = (mi_c * MI, mi_r * MI);
1006210382 let (cpx, cpy) = (px >> ss_x(fctx), py >> ss_y(fctx));
1006310383 let (chroma_w, chroma_h) = (bw >> ss_x(fctx), bh >> ss_y(fctx));
10384+ // lane-av1-422blockhalf: at ss (1,0) the tall/wide 1:2 and 1:4 strips'
10385+ // chroma plane block is BLOCK_INVALID (`av1_ss_size_lookup[...][1][0]`,
10386+ // blockd.h -- the 4:2:2 column maps BLOCK_8X16/16X32/32X64/64X128 and
10387+ // BLOCK_8X32/16X64, plus 4-wide BLOCK_4X16, to BLOCK_INVALID), so
10388+ // `av1_get_max_uv_txsize` indexes `max_txsize_rect_lookup` OUT OF BOUNDS
10389+ // and the pinned Release oracle byte there is TX_4X8 (the lane-av1-422m
10390+ // measurement). The plane is still coded -- `decode_token_recon_block`
10391+ // steps it in that (4, 8) unit shape -- so the strip's chroma tiles into
10392+ // 4x8 rect units, plane-major.
10393+ let chroma_422_oob = ss_x(fctx) == 1
10394+ && ss_y(fctx) == 0
10395+ && matches!(
10396+ (bw, bh),
10397+ (8, 16) | (16, 32) | (32, 64) | (64, 128) | (8, 32) | (16, 64)
10398+ );
10399+ // lane-av1-422stripanchor: the 4-wide strips' PAIR chroma -- the ported
10400+ // floored-pair anchor. `chroma422_pair_plane` is `Some` exactly when this
10401+ // strip's own chroma block would be 2 px wide at ss (1, 0); the pair's
10402+ // plane is then `(4, chroma_h)` written at the FLOORED cell
10403+ // (`chroma_x`), and the skip/tiled chroma arms below tile it in (4, 8)
10404+ // units (the OOB `max_txsize_rect_lookup[BLOCK_INVALID]` byte, TX_4X8 --
10405+ // the same walk the (8, 32) class takes). The lossless raster arm keeps
10406+ // the strip's own geometry: no caller of this function can present a
10407+ // 4-wide strip yet (the enumeration test pins the five callers at
10408+ // `8 <= min`), and the skip/tiled arms are the routes a future caller
10409+ // needs.
10410+ let chroma422_pair = chroma422_pair_plane(ss_x(fctx) == 1, ss_y(fctx) == 0, mi_c, bw, bh);
10411+ let chroma_422_pair_wide = chroma422_pair.is_some();
10412+ let (chroma_block_w, chroma_block_h, chroma_x) = chroma422_pair
10413+ .map_or((chroma_w, chroma_h, cpx), |(w, h, x, _)| (w, h, x));
1006410414 // The chroma transform is picked before any symbol is read, so an
1006510415 // unsupported chroma shape refuses before this strip desyncs the tile.
1006610416 let chroma: Option<(TxbSet, &[u16])> = match (chroma_w, chroma_h) {
@@ -10083,6 +10433,25 @@ fn decode_rect_split(
1008310433 (4, 8) => Some((TxbSet::ChromaRect8x4, &SCAN_4X8[..])),
1008410434 _ => None,
1008510435 };
10436+ // A 4:4:4 64-axis strip's chroma plane block is larger than one adjusted
10437+ // UV transform (TX_64X32 adjusts to TX_32X32). Those sizes are tiled
10438+ // below; everything else still needs a single-unit table.
10439+ // lane-av1-422: a 4:2:2 strip's chroma plane keeps the strip's HEIGHT and
10440+ // halves only the width, so a rect luma strip codes a SQUARE chroma block
10441+ // (16x8 luma -> 8x8 chroma) -- the square rows below. At 4:2:0 and 4:4:4 a
10442+ // rect strip's chroma is itself rect, so the square rows are unreachable
10443+ // there and cannot change their results.
10444+ // lane-av1-422blockhalf: the tiled arms below handle every shape this
10445+ // strip can carry (including the 4:2:2 BLOCK_INVALID planes), so the
10446+ // diagnostic names only the shapes that would actually refuse -- it used
10447+ // to fire for every tiled square too (the parent lane's `chroma=8x8`
10448+ // rows) and sent the next lane chasing handled shapes.
10449+ let chroma_tiled = chroma_422_pair_wide
10450+ || chroma_422_oob
10451+ || matches!(
10452+ (chroma_w, chroma_h),
10453+ (64, 32) | (32, 64) | (64, 16) | (16, 64) | (32, 32) | (16, 16) | (8, 8)
10454+ );
1008610455 if !m.skip {
1008710456 if let Some(i) = match (chroma_w, chroma_h) {
1008810457 (32, 8) => Some(0),
@@ -10099,11 +10468,14 @@ fn decode_rect_split(
1009910468 });
1010010469 }
1010110470 }
10102- if chroma.is_none() {
10471+ if !m.skip && chroma.is_none() && !chroma_tiled {
1010310472 // Diagnostic for the next caller that lands here (class
1010410473 // refusal-names-a-correlate: the message names the tool, not the
1010510474 // shape); the refusal below keeps its inventory-pinned wording.
10106- eprintln!("EC_RECTCHROMA_GAP luma={bw}x{bh} tx={tx_w}x{tx_h} chroma={chroma_w}x{chroma_h}");
10475+ eprintln!(
10476+ "EC_RECTCHROMA_GAP luma={bw}x{bh} tx={tx_w}x{tx_h} \
10477+ chroma={chroma_w}x{chroma_h}"
10478+ );
1010710479 }
1010810480 }
1010910481 // lane-rectsplit r2 (verifier finding): with both callers wired
@@ -10113,10 +10485,6 @@ fn decode_rect_split(
1011310485 // caller -- a new strip size would otherwise hit the `expect` below and
1011410486 // panic instead of refusing by name -- and so stays in
1011510487 // `refusal_inventory::REFUSALS`.
10116- // A 4:4:4 64-axis strip's chroma plane block is larger than one adjusted
10117- // UV transform (TX_64X32 adjusts to TX_32X32). Those sizes are tiled
10118- // below; everything else still needs a single-unit table.
10119- let chroma_tiled = matches!((chroma_w, chroma_h), (64, 32) | (32, 64) | (64, 16) | (16, 64));
1012010488 if !m.skip && chroma.is_none() && !chroma_tiled {
1012110489 return Err(unsupported(
1012210490 "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here",
@@ -10395,7 +10763,7 @@ fn decode_rect_split(
1039510763 // them with the LAST unit's state (class `override-slot-on-one-arm`: the
1039610764 // next block then read `dc_sign_ctx` 1 where libaom reads 0). They are
1039710765 // collected here and replayed after that record.
10398- let mut ll_chroma_units: Vec<((usize, usize), usize, Grid)> = Vec::new();
10766+ let mut ll_chroma_units: Vec<((usize, usize), usize, Grid, usize, usize)> = Vec::new();
1039910767 // The chroma_tiled arm below stamps each unit's coefficient context
1040010768 // immediately (so the NEXT unit reads it), then the whole-strip
1040110769 // `record_split_luma_rect_mi` rewrites every chroma cell with ONE
@@ -10405,8 +10773,25 @@ fn decode_rect_split(
1040510773 // `ll_chroma_units` and `decode_inter_block`'s `mu_chroma_units` tail
1040610774 // already do.
1040710775 let mut tiled_chroma_units: Vec<((usize, usize), usize, Grid, usize, usize)> = Vec::new();
10408- let ac = m.alpha.map(|_| cfl_src_rect(px, py, bw, bh));
10409- let reach = block_reach;
10776+ let ac = m.alpha.map(|_| {
10777+ // lane-av1-422stripanchor: the pair unit's CfL source is the PAIR's
10778+ // luma -- the 8-px-wide region the floored 4-px chroma block covers
10779+ // (`av1_setup_dst_planes`' floor), never the odd strip's own 4 px.
10780+ if chroma_422_pair_wide {
10781+ cfl_src_rect((mi_c & !1) * MI, py, 8, bh)
10782+ } else {
10783+ cfl_src_rect(px, py, bw, bh)
10784+ }
10785+ });
10786+ let reach = if chroma_422_pair_wide {
10787+ // The chroma units predict off the PAIR block's edges: an odd-column
10788+ // strip's pair starts 4 luma px to the strip's left, so the strip's
10789+ // own answer names the wrong above/right samples (the pair16 arm's
10790+ // `pair_reach`, one partition level up).
10791+ Reach::of_rect(8, bh, (mi_c & !1) * MI, py, y.width, y.height, fctx)
10792+ } else {
10793+ block_reach
10794+ };
1041010795 let (u_grid, v_grid) = if mono(fctx) {
1041110796 // lane-av1mono: a monochrome frame codes no chroma coefficients on
1041210797 // any block (`plane < av1_num_planes == 1`), so the whole chroma
@@ -10415,21 +10800,63 @@ fn decode_rect_split(
1041510800 let zero = Grid::Zero(chroma_w * chroma_h);
1041610801 (zero.clone(), zero)
1041710802 } else if m.skip {
10418- let zero = Grid::Zero(chroma_w * chroma_h);
10419- if let Some((ub, _)) = &m.palette_uv {
10420- set_palette_pred(ub.clone(), fctx);
10421- }
10422- push_intra_rect(1,
10423- cpx, cpy, chroma_w, chroma_h, m.uv_predict_mode, m.angle_delta_uv, reach, &zero,
10424- m.alpha.zip(ac).map(|((au, _), ac)| (au, ac)), None, m.smooth_neighbor_uv, fctx,
10425- );
10426- if let Some((_, vb)) = &m.palette_uv {
10427- set_palette_pred(vb.clone(), fctx);
10803+ let zero = Grid::Zero(chroma_block_w * chroma_block_h);
10804+ if chroma_422_pair_wide || chroma_422_oob {
10805+ // lane-av1-422blockhalf: libaom predicts an INTRA strip's chroma
10806+ // per transform unit even when the strip is skipped
10807+ // (`decode_token_recon_block`'s per-TU plane walk runs before the
10808+ // skip guard), so the BLOCK_INVALID plane predicts as (4, 8)
10809+ // units -- one whole-plane push here would ask the intra
10810+ // predictor for a 1:8 rect it never needs.
10811+ // lane-av1-422stripanchor: the 4-wide strip's PAIR plane does the
10812+ // same, over the pair's own `(chroma_block_w, chroma_block_h)`
10813+ // grid at the floored anchor `chroma_x`.
10814+ let (uw, uh) = (4usize, 8usize);
10815+ for plane_idx in 1..=2 {
10816+ if let Some((ub, vb)) = &m.palette_uv {
10817+ let buf = if plane_idx == 1 { ub } else { vb };
10818+ set_palette_pred(buf.clone(), fctx);
10819+ }
10820+ for cu_row in 0..chroma_block_h / uh {
10821+ for cu_col in 0..chroma_block_w / uw {
10822+ push_intra_rect(
10823+ plane_idx,
10824+ chroma_x + cu_col * uw,
10825+ cpy + cu_row * uh,
10826+ uw,
10827+ uh,
10828+ m.uv_predict_mode,
10829+ m.angle_delta_uv,
10830+ reach,
10831+ &ZERO_RESIDUAL[..uw * uh],
10832+ m.alpha.zip(ac.clone()).map(|((au, av), ac)| {
10833+ (
10834+ if plane_idx == 1 { au } else { av },
10835+ ac,
10836+ )
10837+ }),
10838+ None,
10839+ m.smooth_neighbor_uv, fctx,
10840+ );
10841+ }
10842+ }
10843+ }
10844+ } else {
10845+ if let Some((ub, _)) = &m.palette_uv {
10846+ set_palette_pred(ub.clone(), fctx);
10847+ }
10848+ push_intra_rect(1,
10849+ cpx, cpy, chroma_w, chroma_h, m.uv_predict_mode, m.angle_delta_uv, reach, &zero,
10850+ m.alpha.zip(ac).map(|((au, _), ac)| (au, ac)), None, m.smooth_neighbor_uv, fctx,
10851+ );
10852+ if let Some((_, vb)) = &m.palette_uv {
10853+ set_palette_pred(vb.clone(), fctx);
10854+ }
10855+ push_intra_rect(2,
10856+ cpx, cpy, chroma_w, chroma_h, m.uv_predict_mode, m.angle_delta_uv, reach, &zero,
10857+ m.alpha.zip(ac).map(|((_, av), ac)| (av, ac)), None, m.smooth_neighbor_uv, fctx,
10858+ );
1042810859 }
10429- push_intra_rect(2,
10430- cpx, cpy, chroma_w, chroma_h, m.uv_predict_mode, m.angle_delta_uv, reach, &zero,
10431- m.alpha.zip(ac).map(|((_, av), ac)| (av, ac)), None, m.smooth_neighbor_uv, fctx,
10432- );
1043310860 (zero.clone(), zero)
1043410861 } else if lossless(fctx) {
1043510862 // lane-lossless: the strip's chroma plane block is coded as 4x4
@@ -10443,19 +10870,29 @@ fn decode_rect_split(
1044310870 let scan4 = default_scan(4);
1044410871 let offset = (chroma_w > 4 || chroma_h > 4).then_some(3);
1044510872 let (cw_n, ch_n) = (chroma_w / 4, chroma_h / 4);
10873+ // lane-av1-llband: one 4x4 chroma unit's extent in LUMA pixels -- 4
10874+ // chroma px scaled by the plane's own subsampling. The hardcoded 8
10875+ // was the 4:2:0 unit's span; at 4:4:4 a unit is 4x4 LUMA px (one mi
10876+ // cell), and the 8-px step made every unit past the first column/row
10877+ // read its `txb_skip` context at the WRONG mi (two cells over) and
10878+ // stamp a 2-cell span with one unit's state -- the polluted above-band
10879+ // cell behind a 16x8 leaf's U bc=2 unit of the 444 lossless key frame
10880+ // (measured: oracle `EC_DBGCTX` reads 1-cell spans at 1-mi steps;
10881+ // ours read `above[28..29]` where the oracle read `above[26]`).
10882+ let span_x = 4 << ss_x(fctx);
10883+ let span_y = 4 << ss_y(fctx);
1044610884 let mut last = [Grid::Zero(16), Grid::Zero(16)];
1044710885 for plane_idx in 1..=2 {
1044810886 for cu_row in 0..ch_n {
1044910887 for cu_col in 0..cw_n {
10450- let luma_span = 8;
1045110888 let cu_mi = (
10452- mi_r + cu_row * (luma_span / MI),
10453- mi_c + cu_col * (luma_span / MI),
10889+ mi_r + cu_row * (span_y / MI),
10890+ mi_c + cu_col * (span_x / MI),
1045410891 );
10455- let cu_around = neighbours.around_mi(cu_mi, luma_span);
10892+ let cu_around = neighbours.around_mi_rect(cu_mi, span_x, span_y);
1045610893 let cu_reach = tu_reach(
1045710894 bw, bh,
10458- cu_col * luma_span, cu_row * luma_span, luma_span,
10895+ cu_col * span_x, cu_row * span_y, span_x,
1045910896 block_reach, px, py, y.width, y.height, fctx,
1046010897 );
1046110898 let (cu_x, cu_y) = (cpx + cu_col * 4, cpy + cu_row * 4);
@@ -10477,8 +10914,11 @@ fn decode_rect_split(
1047710914 }),
1047810915 None, offset, m.smooth_neighbor_uv, fctx,
1047910916 )?;
10480- neighbours.record_mi_chroma(cu_mi, luma_span, luma_span, plane_idx, &grid);
10481- ll_chroma_units.push((cu_mi, plane_idx, grid.clone()));
10917+ if span_x == 4 && span_y == 4 {
10918+ hit!(RECT_SPLIT_LOSSLESS_CHROMA444_HITS);
10919+ }
10920+ neighbours.record_mi_chroma(cu_mi, span_x, span_y, plane_idx, &grid);
10921+ ll_chroma_units.push((cu_mi, plane_idx, grid.clone(), span_x, span_y));
1048210922 last[plane_idx - 1] = grid;
1048310923 }
1048410924 }
@@ -10486,15 +10926,49 @@ fn decode_rect_split(
1048610926 let [ug, vg] = last;
1048710927 (ug, vg)
1048810928 } else if chroma_tiled {
10489- let (uw, uh, set, scan): (usize, usize, TxbSet, &[u16]) = match (chroma_w, chroma_h) {
10490- (64, 32) | (32, 64) => (32, 32, TxbSet::Chroma32, default_scan(32)),
10491- (64, 16) => (32, 16, TxbSet::ChromaRect32x16, &SCAN_32X16),
10492- (16, 64) => (16, 32, TxbSet::ChromaRect32x16, &SCAN_16X32),
10493- _ => unreachable!("chroma_tiled"),
10929+ let (uw, uh, set, scan): (usize, usize, TxbSet, &[u16]) =
10930+ if chroma_422_pair_wide || chroma_422_oob {
10931+ // lane-av1-422blockhalf / lane-av1-422stripanchor: the
10932+ // BLOCK_INVALID-plane chroma's (4, 8) units -- the Release
10933+ // oracle's out-of-bounds `max_txsize_rect_lookup` byte (TX_4X8,
10934+ // see above). For the 4-wide strip the units tile the PAIR's
10935+ // plane, stepping from the floored anchor.
10936+ (4, 8, TxbSet::ChromaRect8x4, &SCAN_4X8)
10937+ } else {
10938+ match (chroma_w, chroma_h) {
10939+ (64, 32) | (32, 64) | (32, 32) => (32, 32, TxbSet::Chroma32, default_scan(32)),
10940+ (64, 16) => (32, 16, TxbSet::ChromaRect32x16, &SCAN_32X16),
10941+ (16, 64) => (16, 32, TxbSet::ChromaRect32x16, &SCAN_16X32),
10942+ // lane-av1-422: the 4:2:2 square chroma planes (height unhalved),
10943+ // through the square reader like every other square chroma unit.
10944+ (16, 16) => (16, 16, TxbSet::Chroma16, default_scan(16)),
10945+ (8, 8) => (8, 8, TxbSet::Chroma8, default_scan(8)),
10946+ _ => unreachable!("chroma_tiled"),
10947+ }
10948+ };
10949+ // lane-av1-422: the witness counter, keyed to ss (1,0) so only a 4:2:2
10950+ // frame's square chroma units count it.
10951+ if uw == uh && ss_x(fctx) == 1 && ss_y(fctx) == 0 {
10952+ hit!(CHROMA422_SQUARE_HITS);
10953+ }
10954+ if chroma_422_pair_wide {
10955+ hit!(CHROMA422_PAIR_WIDE_HITS);
10956+ }
10957+ let (nw, nh) = (chroma_block_w / uw, chroma_block_h / uh);
10958+ // lane-av1-422stripanchor: the pair's plane block is BLOCK_INVALID
10959+ // whatever the pair size (`num_pels_log2_lookup[255]` reads 0xff in
10960+ // the pinned Release oracle), so its txb_skip rows always carry the
10961+ // bigger-plane +3 (the av1422q rule the pair16 arm measures).
10962+ let bigger = chroma_422_pair_wide || chroma_w * chroma_h > uw * uh;
10963+ // `av1_get_ext_tx_set_type`: a chroma transform whose square-up size
10964+ // is TX_32X32 or bigger resolves to `EXT_TX_SET_DCTONLY` for intra;
10965+ // smaller rect units (the 4:2:2 BLOCK_INVALID-plane (4, 8)s) take the
10966+ // mode-indexed default, the same rule the unsplit arm below applies.
10967+ let default_tx = if uw.max(uh) >= 32 {
10968+ TxType::DctDct
10969+ } else {
10970+ default_intra_tx_type(m.uv_predict_mode as u8)
1049410971 };
10495- let (nw, nh) = (chroma_w / uw, chroma_h / uh);
10496- let bigger = chroma_w * chroma_h > uw * uh;
10497- let default_tx = TxType::DctDct;
1049810972 let mut last = [Grid::Zero(uw * uh), Grid::Zero(uw * uh)];
1049910973 for plane_idx in 1..=2 {
1050010974 for cu_row in 0..nh {
@@ -10503,22 +10977,74 @@ fn decode_rect_split(
1050310977 let luma_span_y = uh << ss_y(fctx);
1050410978 let cu_mi = (
1050510979 mi_r + cu_row * (luma_span_y / MI),
10506- mi_c + cu_col * (luma_span_x / MI),
10980+ if chroma_422_pair_wide { mi_c & !1 } else { mi_c }
10981+ + cu_col * (luma_span_x / MI),
1050710982 );
10508- let cu_around = neighbours.around_mi_rect(cu_mi, luma_span_x, luma_span_y);
10509- let (cu_x, cu_y) = (cpx + cu_col * uw, cpy + cu_row * uh);
10983+ // lane-av1-422blockhalf: the 4:2:2 (4, 8) units read their
10984+ // chroma context per chroma cell
10985+ // ([`Neighbours::around_mi_422_chroma`], the block-8
10986+ // rule) -- the plain rect walk samples one chroma cell
10987+ // twice at ss_x 1. Every pre-existing shape keeps its own
10988+ // walk.
10989+ // lane-av1422mi24: the plain rect walk's double-count
10990+ // hits EVERY unit shape at ss (1,0), not just the (4, 8)
10991+ // one -- the (8, 8) unit of a 16x8 intra-in-inter strip
10992+ // read its above dc votes twice and its U dc_sign one
10993+ // ctx row high (t422 frame 1). Route every ss (1,0)
10994+ // unit through the every-second-above-cell sampling;
10995+ // 4:2:0/4:4:4 keep the plain walk verbatim.
10996+ let cu_around = if chroma_422_oob
10997+ || (ss_x(fctx) == 1 && ss_y(fctx) == 0)
10998+ {
10999+ neighbours.around_mi_422_chroma(cu_mi, luma_span_x, luma_span_y)
11000+ } else {
11001+ neighbours.around_mi_rect(cu_mi, luma_span_x, luma_span_y)
11002+ };
11003+ let (cu_x, cu_y) = (chroma_x + cu_col * uw, cpy + cu_row * uh);
1051011004 let cfl = m.alpha.map(|(au, av)| {
1051111005 let alpha = if plane_idx == 1 { au } else { av };
1051211006 (
1051311007 alpha,
10514- cfl_src_rect(
10515- px + cu_col * luma_span_x,
10516- py + cu_row * luma_span_y,
10517- luma_span_x,
10518- luma_span_y,
10519- ),
11008+ if chroma_422_pair_wide {
11009+ // The unit's co-located luma is the PAIR's
11010+ // 8-px-wide band at the floored mi column.
11011+ cfl_src_rect(
11012+ (mi_c & !1) * MI + cu_col * luma_span_x,
11013+ py + cu_row * luma_span_y,
11014+ luma_span_x,
11015+ luma_span_y,
11016+ )
11017+ } else {
11018+ cfl_src_rect(
11019+ px + cu_col * luma_span_x,
11020+ py + cu_row * luma_span_y,
11021+ luma_span_x,
11022+ luma_span_y,
11023+ )
11024+ },
1052011025 )
1052111026 });
11027+ // lane-av1-422kf: the palette colour map is consumed per
11028+ // unit here like every other chroma arm (`av1_visit_palette`
11029+ // feeds the whole plane block; window it to this unit).
11030+ // Without this the square chroma rows decoded a uv-palette
11031+ // strip's chroma as plain DC (class same-symbols-silent-
11032+ // prediction: the rng stayed in sync, only the prediction
11033+ // was dropped).
11034+ if let Some((ub, vb)) = &m.palette_uv {
11035+ let buf = if plane_idx == 1 { ub } else { vb };
11036+ set_palette_pred(
11037+ palette_window(
11038+ buf,
11039+ chroma_block_w,
11040+ cu_col * uw,
11041+ cu_row * uh,
11042+ uw,
11043+ uh,
11044+ ),
11045+ fctx,
11046+ );
11047+ }
1052211048 // 32x32 does not fit read_coeffs_rect's scratch (768). The
1052311049 // square reader is the path every other 32x32 chroma unit uses.
1052411050 let levels = if uw == uh {
@@ -10576,7 +11102,19 @@ fn decode_rect_split(
1057611102 } else {
1057711103 default_intra_tx_type(m.uv_predict_mode as u8)
1057811104 };
10579- let around = neighbours.around_mi_rect(at_mi, bw, bh);
11105+ // lane-av1422mi24: at ss (1,0) the chroma above span is `bw >> 1`
11106+ // chroma cells spread over `bw` luma mi columns -- the per-mi gather
11107+ // counts every chroma column's whole-unit dc sign twice (the t422
11108+ // frame-1 mi(26,60) intra-in-inter strip's U dc_sign read one ctx
11109+ // row high). Luma keeps the per-mi gather; the two chroma planes
11110+ // take [`Neighbours::around_mi_422_chroma`]'s every-second
11111+ // above-cell sampling, like every other 4:2:2 chroma gather.
11112+ let mut around = neighbours.around_mi_rect(at_mi, bw, bh);
11113+ if ss_x(fctx) == 1 && ss_y(fctx) == 0 {
11114+ let c = neighbours.around_mi_422_chroma(at_mi, bw, bh);
11115+ around[1] = c[1];
11116+ around[2] = c[2];
11117+ }
1058011118 let mut grids: Vec<Grid> = Vec::with_capacity(2);
1058111119 for plane_idx in 1..=2 {
1058211120 let skip_ctx =
@@ -10650,8 +11188,8 @@ fn decode_rect_split(
1065011188 m.uv_predict_mode,
1065111189 [&u_grid, &v_grid],
1065211190 );
10653- for (cu_mi, plane, unit) in &ll_chroma_units {
10654- neighbours.record_mi_chroma(*cu_mi, 8, 8, *plane, unit);
11191+ for (cu_mi, plane, unit, span_w, span_h) in &ll_chroma_units {
11192+ neighbours.record_mi_chroma(*cu_mi, *span_w, *span_h, *plane, unit);
1065511193 }
1065611194 for (cu_mi, plane, unit, span_w, span_h) in &tiled_chroma_units {
1065711195 neighbours.record_mi_chroma(*cu_mi, *span_w, *span_h, *plane, unit);
@@ -10848,6 +11386,87 @@ fn every_shape_that_allows_motion_variation_has_a_motion_mode_cdf_row() {
1084811386 );
1084911387 }
1085011388
11389+/// lane-av1-422stripanchor, format-cell census for the 4-wide-strip pair port
11390+/// ([`chroma422_pair_plane`], [`decode_rect_split`]'s chroma routing): over
11391+/// every `BLOCK_SIZES_ALL` footprint at every subsampling cell, the pair arm
11392+/// fires exactly when libaom's own `av1_ss_size_lookup[..][1][0]` column
11393+/// (`common_data.c`) marks the plane block BLOCK_INVALID AND the plane would
11394+/// be 2 px wide -- the 4-wide footprints. The tall/wide BLOCK_INVALID shapes
11395+/// stay on the pre-existing `chroma_422_oob` (4, 8) tiling, and 4:2:0 /
11396+/// 4:4:4 never enter either arm (the byte-identical claim, checked per cell).
11397+#[test]
11398+fn chroma422_pair_plane_matches_the_ss_size_lookup_cells() {
11399+ // The `av1_ss_size_lookup[..][1][0]` column verbatim (pinned oracle,
11400+ // `common_data.c`), keyed by footprint: `true` = BLOCK_INVALID.
11401+ let ss10_invalid: &[(&str, bool)] = &[
11402+ ("4x4", false),
11403+ ("4x8", true),
11404+ ("8x4", false),
11405+ ("8x8", false),
11406+ ("8x16", true),
11407+ ("16x8", false),
11408+ ("16x16", false),
11409+ ("16x32", true),
11410+ ("32x16", false),
11411+ ("32x32", false),
11412+ ("32x64", true),
11413+ ("64x32", false),
11414+ ("64x64", false),
11415+ ("64x128", true),
11416+ ("128x64", false),
11417+ ("128x128", false),
11418+ ("4x16", true),
11419+ ("16x4", false),
11420+ ("8x32", true),
11421+ ("32x8", false),
11422+ ("16x64", true),
11423+ ("64x16", false),
11424+ ];
11425+ for (footprint, invalid10) in ss10_invalid {
11426+ let (w, h) = footprint.split_once('x').unwrap();
11427+ let (bw, bh) = (w.parse::<usize>().unwrap(), h.parse::<usize>().unwrap());
11428+ // BLOCK_4X4 is the SQUARE path's leaf, never a strip: its ss cell is
11429+ // valid because a (2, 4) plane area rounds UP to the 4x4 read
11430+ // (`sub8_leaf_chroma422`'s own rule), and it never reaches
11431+ // [`decode_rect_split`] at all.
11432+ if (bw, bh) == (4, 4) {
11433+ continue;
11434+ }
11435+ // 4:2:0 and 4:4:4: the port never fires, whatever the footprint.
11436+ for (ss_x, ss_y) in [(false, false), (true, true)] {
11437+ assert!(
11438+ chroma422_pair_plane(ss_x, ss_y, 7, bw, bh).is_none(),
11439+ "{bw}x{bh} at ss ({ss_x}, {ss_y}) must keep its own plane block"
11440+ );
11441+ }
11442+ // 4:2:2: the pair arm is exactly the 2-px-wide (4-wide) slice of the
11443+ // BLOCK_INVALID column, anchored at the floored mi column.
11444+ let pair = chroma422_pair_plane(true, false, 7, bw, bh);
11445+ assert_eq!(
11446+ pair.is_some(),
11447+ *invalid10 && bw == 4,
11448+ "{bw}x{bh} at ss (1, 0): pair routing disagrees with ss_size_lookup"
11449+ );
11450+ if let Some((block_w, block_h, x, ctx_col)) = pair {
11451+ assert_eq!((block_w, block_h), (4, bh), "{bw}x{bh} pair plane shape");
11452+ assert_eq!(x, ((7 & !1) * MI) >> 1, "{bw}x{bh} floored write anchor");
11453+ assert_eq!(ctx_col, 6, "{bw}x{bh} entropy cell is the floored column");
11454+ // An even-column strip anchors at its own cell.
11455+ let (x_even, col_even) = match chroma422_pair_plane(true, false, 6, bw, bh) {
11456+ Some((_, _, x, c)) => (x, c),
11457+ None => panic!("{bw}x{bh} lost its pair arm at an even mi_col"),
11458+ };
11459+ assert_eq!((x_even, col_even), (12, 6), "even column keeps its own cell");
11460+ }
11461+ }
11462+ // The tall/wide BLOCK_INVALID shapes (8 px wide or more) are the
11463+ // `chroma_422_oob` tiling's residents, not the pair arm's: both are
11464+ // 4:2:2-only, so the two arms partition the BLOCK_INVALID column.
11465+ for (bw, bh) in [(8usize, 16), (16, 32), (32, 64), (64, 128), (8, 32), (16, 64)] {
11466+ assert!(chroma422_pair_plane(true, false, 7, bw, bh).is_none());
11467+ }
11468+}
11469+
1085111470 fn decode_intra_rect_in_inter(
1085211471 dec: &mut SymbolDecoder,
1085311472 cdfs: &mut Cdfs,
@@ -11580,7 +12199,21 @@ fn decode_intrabc_rect(
1158012199 match leaves.as_ref() {
1158112200 None => {
1158212201 // One whole-block rectangular transform unit.
11583- let around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh);
12202+ // lane-av1422mi24: at ss (1,0) the chroma above span is
12203+ // `bw >> 1` chroma cells spread over `bw` luma mi columns --
12204+ // the per-mi gather counts every chroma column's whole-unit
12205+ // dc sign twice (t422 frame 1, the mi(26,60) intra-in-inter
12206+ // strip's U dc_sign read ctx 1 where the oracle's cell sum
12207+ // is 0 -> ctx 0). Luma keeps the per-mi gather; the two
12208+ // chroma planes take
12209+ // [`Neighbours::around_mi_422_chroma`]'s every-second
12210+ // above-cell sampling, like every other 4:2:2 chroma gather.
12211+ let mut around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh);
12212+ if ss_x(fctx) == 1 && ss_y(fctx) == 0 {
12213+ let c = neighbours.around_mi_422_chroma((mi_r, mi_c), bw, bh);
12214+ around[1] = c[1];
12215+ around[2] = c[2];
12216+ }
1158412217 let (grid, tx_type) = read_inter_plane_rect(
1158512218 dec,
1158612219 cdfs,
@@ -11705,7 +12338,15 @@ fn decode_intrabc_rect(
1170512338 // `av1_get_tx_type`'s chroma lookup lands on the colocated
1170612339 // LUMA unit, which for a split block is the top-left one.
1170712340 luma_tx_type = first_tx_type;
11708- let around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh);
12341+ // lane-av1422mi24: same 4:2:2 chroma gather rule as the
12342+ // `None` arm above -- the per-mi rect gather double-counts
12343+ // each chroma column's whole-unit dc sign at ss (1,0).
12344+ let mut around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh);
12345+ if ss_x(fctx) == 1 && ss_y(fctx) == 0 {
12346+ let c = neighbours.around_mi_422_chroma((mi_r, mi_c), bw, bh);
12347+ around[1] = c[1];
12348+ around[2] = c[2];
12349+ }
1170912350 let (ug, _) = read_inter_plane_rect(
1171012351 dec,
1171112352 cdfs,
@@ -12518,6 +13159,16 @@ fn decode_block_rect(
1251813159 (16, 32) => (TxbSet::ChromaRect32x16, &SCAN_16X32),
1251913160 (16, 8) => (TxbSet::ChromaRect16x8, &SCAN_16X8),
1252013161 (8, 16) => (TxbSet::ChromaRect16x8, &SCAN_8X16),
13162+ // lane-av1-422: a 4:2:2 strip halves only the width. A 32x16
13163+ // luma strip's chroma is a 16x16 SQUARE (`TxbSet::Chroma16`, the
13164+ // set any 16x16 chroma plane reads); a 16x32 strip's chroma is
13165+ // 8x32, whose entropy set is the 16x16 one and whose DCT-only
13166+ // default follows the >=32 rule below -- the same pairing the
13167+ // (8,32) row of [`decode_rect_split`]'s chroma table proves. At
13168+ // 4:2:0 and 4:4:4 a strip's chroma is itself rect, so neither row
13169+ // is reachable there.
13170+ (16, 16) => (TxbSet::Chroma16, default_scan(16)),
13171+ (8, 32) => (TxbSet::Chroma16, &SCAN_8X32),
1252113172 _ => {
1252213173 return Err(unsupported(
1252313174 "a rectangular chroma transform whose size has no coefficient table",
@@ -12729,7 +13380,9 @@ fn decode_block_rect(
1272913380 /// caller uses once, after both strips, exactly like the `VERT_B` arm next
1273013381 /// to it). The non-skip case (lane-rectx) reads real `TX_16X8`/`TX_8X16`
1273113382 /// luma coefficients (`TxbSet::LumaRect16x8`) and their `TX_8X4`/`TX_4X8`
12732-/// chroma half (`TxbSet::ChromaRect8x4`), the two size classes one level
13383+/// chroma half (`TxbSet::ChromaRect8x4`) at 4:2:0 -- an 8x8 *square* chroma
13384+/// plane (`TxbSet::Chroma8` + the default scan) at 4:2:2 (lane-av1-422e:
13385+/// half-width, unhalved height), the two size classes one level
1273313386 /// under [`decode_block_rect`]'s own 32x16/16x32 strip.
1273413387 #[allow(clippy::too_many_arguments)]
1273513388 fn decode_leaf_rect(
@@ -12985,14 +13638,28 @@ fn decode_leaf_rect(
1298513638 // `use_reduced_set` branch returns `EXT_TX_SET_DTT4_IDTX` at
1298613639 // `tx_size_sqr_up == TX_16X16` regardless of the true, non-square
1298713640 // `tx_size`) and its chroma half (8x4/4x8, `TxbSet::ChromaRect8x4`).
13641+ // lane-av1-422e: a 4:2:2 strip halves only the width, so the chroma
13642+ // half of a 16x8/8x16 luma leaf is an 8x8 SQUARE (`TxbSet::Chroma8` +
13643+ // the default scan -- the pairing any 8x8 chroma plane reads). 4:2:0
13644+ // halves both axes (8x4/4x8 rect, `TxbSet::ChromaRect8x4`); 4:4:4
13645+ // leaves the full 16x8/8x16 rect (`TxbSet::ChromaRect16x8`).
13646+ let chroma_422 = ss_x(fctx) == 1 && ss_y(fctx) == 0;
1298813647 let (luma_scan, chroma_scan): (&[u16], &[u16]) = if ss_x(fctx) == 0 {
1298913648 if bw == 16 { (&SCAN_16X8, &SCAN_16X8) } else { (&SCAN_8X16, &SCAN_8X16) }
13649+ } else if chroma_422 {
13650+ if bw == 16 { (&SCAN_16X8, default_scan(8)) } else { (&SCAN_8X16, default_scan(8)) }
1299013651 } else if bw == 16 {
1299113652 (&SCAN_16X8, &SCAN_8X4)
1299213653 } else {
1299313654 (&SCAN_8X16, &SCAN_4X8)
1299413655 };
12995- let chroma_rect_set = if ss_x(fctx) == 0 { TxbSet::ChromaRect16x8 } else { TxbSet::ChromaRect8x4 };
13656+ let chroma_rect_set = if ss_x(fctx) == 0 {
13657+ TxbSet::ChromaRect16x8
13658+ } else if chroma_422 {
13659+ TxbSet::Chroma8
13660+ } else {
13661+ TxbSet::ChromaRect8x4
13662+ };
1299613663 let around = neighbours.around_mi_rect(leaf_mi, bw, bh);
1299713664 let luma_set = if reduced_tx_set {
1299813665 TxbSet::LumaRect16x8
@@ -13361,12 +14028,43 @@ fn decode_block_rect4(
1336114028 // `TxbSet::Chroma16`). The caller set is closed -- this reader only
1336214029 // ever sees 32x8 / 8x32 luma and the sequence header admits ss 0/0
1336314030 // and 1/1 only -- so the table is exhaustive.
14031+ let chroma422_rect32 =
14032+ (chroma_w, chroma_h) == (4, 32) && ss_x(fctx) == 1 && ss_y(fctx) == 0;
1336414033 let (chroma_set, chroma_scan): (TxbSet, &[u16]) = match (chroma_w, chroma_h) {
1336514034 (16, 4) => (TxbSet::Chroma8, &SCAN_16X4[..]),
1336614035 (4, 16) => (TxbSet::Chroma8, &SCAN_4X16[..]),
1336714036 (32, 8) => (TxbSet::Chroma16, &SCAN_32X8[..]),
1336814037 (8, 32) => (TxbSet::Chroma16, &SCAN_8X32[..]),
13369- _ => unreachable!("decode_block_rect4 chroma shape set is closed"),
14038+ // lane-av1-422: a 4:2:2 1:4 strip halves only the width, so the
14039+ // landscape leaves (32x8, 16x4 luma) code their chroma as the RECT
14040+ // (16,8)/(8,4) -- the same TxbSet/scan pair the (16,8)/(8,4) rows of
14041+ // [`decode_rect_split`]'s chroma table use.
14042+ // lane-av1-422p: the PORTRAIT leaf occurs too -- the pinned
14043+ // fixture's frame 2 carries an 8x32 strip at ss(1,0), whose (4, 32)
14044+ // chroma block `ss_size_lookup[BLOCK_8X32][1][0]` marks
14045+ // BLOCK_INVALID (255, enums.h). BLOCK_INVALID does not mean
14046+ // "uncodable": `av1_get_tx_size` reads `max_txsize_rect_lookup[255]`
14047+ // OUT OF BOUNDS there, the byte at +255 in the pinned Release oracle
14048+ // is 0x05 = TX_4X8 (the `decode_token_recon_block` copy at
14049+ // 0xc0d030, objdump-measured), and `av1_get_adjusted_tx_size` has no
14050+ // TX_4X8 case. libaom HAS the transform, so the shape CHUNKS (the
14051+ // `chroma422_rect32` arm below) into FOUR stacked TX_4X8 units per
14052+ // plane (`tx_size_high_unit[TX_4X8] = 2`: blk_row 0, 2, 4, 6)
14053+ // instead of refusing; no coefficient-table row is added, because
14054+ // BLOCK_4X32 is not a table libaom has. 4:2:0 and 4:4:4 never land
14055+ // here (their 8x32 strips read (4, 16) and (8, 32)), so the row is
14056+ // 4:2:2-only.
14057+ (16, 8) => (TxbSet::ChromaRect16x8, &SCAN_16X8[..]),
14058+ (8, 4) => (TxbSet::ChromaRect8x4, &SCAN_8X4[..]),
14059+ // lane-av1-422p: the units' own set/scan -- the whole-rect read
14060+ // below never sees this row, the `chroma422_rect32` arm chunks
14061+ // first. Anything else is still a named-lane gap.
14062+ (4, 32) if ss_x(fctx) == 1 && ss_y(fctx) == 0 => {
14063+ (TxbSet::ChromaRect8x4, &SCAN_4X8[..])
14064+ }
14065+ _ => unreachable!(
14066+ "decode_block_rect4 chroma shape set is closed: {chroma_w}x{chroma_h}"
14067+ ),
1337014068 };
1337114069 let luma_scan: &[u16] = if bw > bh { &SCAN_32X8 } else { &SCAN_8X32 };
1337214070 let (luma_levels, u_levels, v_levels) = if skip {
@@ -13375,6 +14073,146 @@ fn decode_block_rect4(
1337514073 vec![0i32; chroma_w * chroma_h],
1337614074 vec![0i32; chroma_w * chroma_h],
1337714075 )
14076+ } else if chroma422_rect32 {
14077+ // lane-av1-422p: the (4, 32) plane as FOUR TX_4X8 units per plane,
14078+ // plane-major (every U unit, then every V) -- the walk the pinned
14079+ // oracle's `decode_token_recon_block` makes for the BLOCK_INVALID
14080+ // plane block: TX_4X8, so stepr = `tx_size_high_unit[TX_4X8]` = 2
14081+ // 4-px rows and stepc = 1, unit rows at chroma y 0, 8, 16, 24.
14082+ // Luma is the same single TX_8X32 rect the general arm reads.
14083+ let around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh);
14084+ let mut luma_coding = cdfs.txb(TxbSet::LumaRect32x8, mode);
14085+ let (luma_levels, luma_tx_type) = read_coeffs_rect(
14086+ dec,
14087+ &mut luma_coding,
14088+ luma_scan,
14089+ bw,
14090+ bh,
14091+ 0,
14092+ dc_sign_ctx(around[0].2),
14093+ TxType::DctDct,
14094+ )?;
14095+ hit!(RECT4_COEFF_HITS);
14096+ let luma_residual = dequant_and_inverse_typed_wh(
14097+ &luma_levels,
14098+ bw,
14099+ bh,
14100+ crate::decode::bit_depth(fctx),
14101+ block_q_idx(fctx),
14102+ plane_q_delta(0, fctx).0,
14103+ plane_q_delta(0, fctx).1,
14104+ luma_tx_type,
14105+ block_iqmatrix(fctx, 0, bw, bh, luma_tx_type),
14106+ );
14107+ if let Some(b) = &palette_y_buf {
14108+ set_palette_pred(b.clone(), fctx);
14109+ }
14110+ push_intra_rect(0,
14111+ px,
14112+ py,
14113+ bw,
14114+ bh,
14115+ mode,
14116+ angle_delta_y,
14117+ reach,
14118+ &luma_residual,
14119+ None,
14120+ filter_intra,
14121+ smooth_neighbor, fctx,
14122+ );
14123+ // CfL parameters are computed ONCE per block over the strip's luma
14124+ // (`are_parameters_computed`) and shared by all four units, as in
14125+ // every other chunk arm.
14126+ let ac = alpha.map(|_| cfl_src_rect(px, py, bw, bh));
14127+ let mut unit_grids: Vec<((usize, usize), usize, Grid)> = Vec::new();
14128+ for (plane, buf) in [(1usize, &mut *u), (2usize, &mut *v)] {
14129+ for unit_row in 0..4usize {
14130+ let unit_mi = (mi_r + unit_row * 2, mi_c);
14131+ let unit_reach = tu_reach_rect(
14132+ bw, bh, 0, unit_row * 8, 8, 8, reach,
14133+ px, py, y.width, y.height, fctx,
14134+ );
14135+ if let Some((ub, vb)) = &palette_uv_bufs {
14136+ let pbuf = if plane == 1 { ub } else { vb };
14137+ set_palette_pred(
14138+ palette_window(pbuf, chroma_w, 0, unit_row * 8, 4, 8),
14139+ fctx,
14140+ );
14141+ }
14142+ // Each unit is read and recorded IMMEDIATELY: unit row 0's
14143+ // `txb_skip_ctx` still sees the real above/left neighbour
14144+ // states, a lower unit sees this block's own upper unit's
14145+ // (libaom's per-unit `set_entropy_context`), and the lower
14146+ // unit predicts off the upper one's reconstructed samples.
14147+ let chroma_around = neighbours.around_mi_422_chroma(unit_mi, 8, 8);
14148+ let unit_grid = read_rect_chroma_unit(
14149+ dec,
14150+ cdfs,
14151+ TxbSet::ChromaRect8x4,
14152+ &SCAN_4X8,
14153+ 4,
14154+ 8,
14155+ plane,
14156+ chroma_around[plane],
14157+ uv_predict_mode,
14158+ angle_delta_uv,
14159+ unit_reach,
14160+ buf,
14161+ cpx,
14162+ cpy + unit_row * 8,
14163+ base_q_idx,
14164+ // `get_txb_ctx_general`'s chroma branch
14165+ // (txb_common.h): plane_bsize is BLOCK_INVALID (255)
14166+ // here, `num_pels_log2_lookup[255]` = 255 (the +255
14167+ // byte of the decodetxb copy at 0xc0de70,
14168+ // objdump-measured) exceeds `BLOCK_4X8`'s 5, so the
14169+ // ctx_offset is 10 -- the port's offset-7-first
14170+ // `txb_skip_chroma_8` stores the offset-10 rows at
14171+ // rows 3..6, hence +3.
14172+ Some(3),
14173+ alpha
14174+ .zip(ac)
14175+ .map(|((au, av), ac)| (if plane == 1 { au } else { av }, ac)),
14176+ smooth_neighbor_uv, fctx,
14177+ )?;
14178+ neighbours.record_mi_chroma(unit_mi, 8, 8, plane, &unit_grid);
14179+ unit_grids.push((unit_mi, plane, unit_grid));
14180+ }
14181+ }
14182+ // The whole-block stamp rewrites the chroma cells ONE state wide,
14183+ // which would erase the unit boundary the next block reads (class
14184+ // `override-slot-on-one-arm`), so it carries zero chroma grids and
14185+ // the per-unit writes replay after it. Its luma cells and side
14186+ // spans are this arm's own bookkeeping.
14187+ let zero_chroma = vec![0i32; chroma_w * chroma_h];
14188+ neighbours.record_mi_rect(
14189+ (mi_r, mi_c),
14190+ bw,
14191+ bh,
14192+ &[&luma_levels[..], &zero_chroma[..], &zero_chroma[..]],
14193+ );
14194+ for (unit_mi, plane, grid) in &unit_grids {
14195+ neighbours.record_mi_chroma(*unit_mi, 8, 8, *plane, grid);
14196+ }
14197+ neighbours.fill_skip_grid_rect((mi_r, mi_c), mi_w, mi_h, skip);
14198+ neighbours.fill_lf_grid_rect((mi_r, mi_c), mi_w, mi_h, bw as u8, bh as u8, 0, fctx);
14199+ record_strip_palette(
14200+ neighbours, pal_at, bw, bh, pal_y_size, pal_y_colors, pal_uv_size,
14201+ pal_uv_colors,
14202+ );
14203+ if bw > bh {
14204+ hit!(RECT4_32_HORZ_HITS);
14205+ } else {
14206+ hit!(RECT4_32_VERT_HITS);
14207+ }
14208+ // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm,
14209+ // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter
14210+ // frame, so this 1:4 strip -- which is also the INTER frame's reader
14211+ // for 32x8/8x32 ([`decode_intra_rect4_in_inter`]) -- publishes its
14212+ // transform size in both TXFM_CONTEXT bands. Without it the next block
14213+ // reads the row's stale value.
14214+ txfm_partition_update_rect(neighbours, (mi_r, mi_c), (bw, bh), (bw, bh));
14215+ return Ok((mode, uv_predict_mode));
1337814216 } else {
1337914217 let around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh);
1338014218 let mut luma_coding = cdfs.txb(TxbSet::LumaRect32x8, mode);
@@ -13523,38 +14361,77 @@ fn decode_block_rect4(
1352314361 smooth_neighbor, fctx,
1352414362 );
1352514363 let ac = alpha.map(|_| cfl_src_rect(px, py, bw, bh));
13526- if let Some((ub, _)) = &palette_uv_bufs {
13527- set_palette_pred(ub.clone(), fctx);
13528- }
13529- push_intra_rect(1,
13530- cpx,
13531- cpy,
13532- chroma_w,
13533- chroma_h,
13534- uv_predict_mode,
13535- angle_delta_uv,
13536- reach,
13537- &u_levels,
13538- alpha.zip(ac).map(|((au, _), ac)| (au, ac)),
13539- None,
13540- smooth_neighbor_uv, fctx,
13541- );
13542- if let Some((_, vb)) = &palette_uv_bufs {
13543- set_palette_pred(vb.clone(), fctx);
14364+ if chroma422_rect32 {
14365+ // lane-av1-422p: `predict_and_reconstruct_intra_block` (decodeframe.c
14366+ // ~1000) predicts EVERY unit regardless of `skip_txfm`, so the skip
14367+ // arm walks the same four TX_4X8 units per plane -- the lower unit
14368+ // predicts off the upper one's predicted samples. No coefficients
14369+ // are coded; the tail's whole-block zero stamp below is the state
14370+ // libaom's `set_entropy_context` leaves.
14371+ for (plane, _buf) in [(1usize, &mut *u), (2usize, &mut *v)] {
14372+ for unit_row in 0..4usize {
14373+ let unit_reach = tu_reach_rect(
14374+ bw, bh, 0, unit_row * 8, 8, 8, reach,
14375+ px, py, y.width, y.height, fctx,
14376+ );
14377+ if let Some((ub, vb)) = &palette_uv_bufs {
14378+ let pbuf = if plane == 1 { ub } else { vb };
14379+ set_palette_pred(
14380+ palette_window(pbuf, chroma_w, 0, unit_row * 8, 4, 8),
14381+ fctx,
14382+ );
14383+ }
14384+ push_intra_rect(plane,
14385+ cpx,
14386+ cpy + unit_row * 8,
14387+ 4,
14388+ 8,
14389+ uv_predict_mode,
14390+ angle_delta_uv,
14391+ unit_reach,
14392+ &ZERO_RESIDUAL[..4 * 8],
14393+ alpha
14394+ .zip(ac)
14395+ .map(|((au, av), ac)| (if plane == 1 { au } else { av }, ac)),
14396+ None,
14397+ smooth_neighbor_uv, fctx,
14398+ );
14399+ }
14400+ }
14401+ } else {
14402+ if let Some((ub, _)) = &palette_uv_bufs {
14403+ set_palette_pred(ub.clone(), fctx);
14404+ }
14405+ push_intra_rect(1,
14406+ cpx,
14407+ cpy,
14408+ chroma_w,
14409+ chroma_h,
14410+ uv_predict_mode,
14411+ angle_delta_uv,
14412+ reach,
14413+ &u_levels,
14414+ alpha.zip(ac).map(|((au, _), ac)| (au, ac)),
14415+ None,
14416+ smooth_neighbor_uv, fctx,
14417+ );
14418+ if let Some((_, vb)) = &palette_uv_bufs {
14419+ set_palette_pred(vb.clone(), fctx);
14420+ }
14421+ push_intra_rect(2,
14422+ cpx,
14423+ cpy,
14424+ chroma_w,
14425+ chroma_h,
14426+ uv_predict_mode,
14427+ angle_delta_uv,
14428+ reach,
14429+ &v_levels,
14430+ alpha.zip(ac).map(|((_, av), ac)| (av, ac)),
14431+ None,
14432+ smooth_neighbor_uv, fctx,
14433+ );
1354414434 }
13545- push_intra_rect(2,
13546- cpx,
13547- cpy,
13548- chroma_w,
13549- chroma_h,
13550- uv_predict_mode,
13551- angle_delta_uv,
13552- reach,
13553- &v_levels,
13554- alpha.zip(ac).map(|((_, av), ac)| (av, ac)),
13555- None,
13556- smooth_neighbor_uv, fctx,
13557- );
1355814435 neighbours.record_mi_rect((mi_r, mi_c), bw, bh, &[&luma_levels[..], &u_levels[..], &v_levels[..]]);
1355914436 neighbours.fill_skip_grid_rect((mi_r, mi_c), mi_w, mi_h, skip);
1356014437 neighbours.fill_lf_grid_rect((mi_r, mi_c), mi_w, mi_h, bw as u8, bh as u8, 0, fctx);
@@ -13635,7 +14512,17 @@ fn decode_rect4_16(
1363514512 // lane-av1-444: at 4:4:4 every strip is its own chroma reference
1363614513 // (no mi-parity test at ss 0/0, and the strip's own chroma block is
1363714514 // already >= 4x4) -- there is no 4:2:0 pair to close.
13638- let has_chroma = i % 2 == 1 || (ss_x(fctx) == 0 && ss_y(fctx) == 0);
14515+ // lane-av1-422o: the parity rule is per axis, straight out of
14516+ // `is_chroma_reference`: a HORZ 16x4 strip (1 mi tall) keeps the
14517+ // `ss_y == 0 -> every strip a reference` row rule, but a VERT 4x16
14518+ // strip (1 mi wide) keeps the COLUMN clause `(mi_col & 1) || !(bw &
14519+ // 1) || !ss_x`, which with bw == 1 mi reduces to `mi_col odd` for
14520+ // every ss_x == 1 format -- the ODD strip closes the pair and reads
14521+ // the chroma, exactly like 4:2:0. (VERT_4 partitions start on an
14522+ // even mi_col, so `i % 2 == 1` is that clause.)
14523+ let has_chroma = i % 2 == 1
14524+ || (horz && ss_y(fctx) == 0)
14525+ || (!horz && ss_x(fctx) == 0);
1363914526 let (mode, uv, _tx) = decode_rect4_16_strip(
1364014527 dec,
1364114528 cdfs,
@@ -14537,6 +15424,19 @@ fn decode_rect4_16_strip(
1453715424 // ss 0/0, so the neighbour reads below anchor at the strip.)
1453815425 let (pair_mi, pw, ph) = if ss_x(fctx) == 0 && ss_y(fctx) == 0 {
1453915426 (lmi, bw, bh)
15427+ } else if ss_y(fctx) == 0 && horz {
15428+ // lane-av1-422: chroma height is NOT subsampled, so a HORZ
15429+ // 16x4 strip is its own chroma reference (`is_chroma_reference`
15430+ // at ss(1,0): bh == 1 mi, so the row clause reduces to
15431+ // `!ss_y`) and codes its own `ss_size_lookup[BLOCK_16X4][1][0]`
15432+ // = BLOCK_8X4 chroma block -- a valid transform, no pair.
15433+ // (lane-av1-422o: a VERTICAL 4x16 strip now falls through to
15434+ // the pair merge below -- its own chroma block
15435+ // `ss_size_lookup[BLOCK_4X16][1][0]` is BLOCK_INVALID, the
15436+ // walk proved such leaves exist, and libaom codes the pair's
15437+ // chroma from the closing strip; the chunk lives in the
15438+ // `chroma422_pair16` arm below.)
15439+ (lmi, bw, bh)
1454015440 } else if horz {
1454115441 ((lmi.0 - 1, lmi.1), 16, 8)
1454215442 } else {
@@ -14545,6 +15445,19 @@ fn decode_rect4_16_strip(
1454515445 let (ppx, ppy) = (pair_mi.1 * MI, pair_mi.0 * MI);
1454615446 let (cpx, cpy) = (ppx >> ss_x(fctx), ppy >> ss_y(fctx));
1454715447 let (cw, ch) = (pw >> ss_x(fctx), ph >> ss_y(fctx));
15448+ // lane-av1-422o: the 4:2:2 pair's chroma of a VERT 4x16 strip
15449+ // pair: (4, 16) at ss(1,0). The bsize is still BLOCK_4X16, whose
15450+ // `ss_size_lookup[..][1][0]` is BLOCK_INVALID, so libaom's
15451+ // `av1_get_tx_size` reads `max_txsize_rect_lookup[255]` -- the
15452+ // out-of-bounds byte is TX_4X8 in the pinned Release oracle, and
15453+ // `av1_get_adjusted_tx_size` has no TX_4X8 case to adjust it.
15454+ // `decode_token_recon_block` walks unit_width =
15455+ // ROUND_POWER_OF_TWO(1, 1) = 1, unit_height = 4, with stepr =
15456+ // tx_size_high_unit[TX_4X8] = 2: TWO TX_4X8 units per plane
15457+ // (chroma rows 0..8 and 8..16), plane-major. Even the skip arm
15458+ // walks per unit: `predict_and_reconstruct_intra_block` predicts
15459+ // every unit regardless of `skip_txfm`.
15460+ let chroma422_pair16 = (cw, ch) == (4, 16) && ss_x(fctx) == 1;
1454815461 let uv_predict_mode = if uv_mode == UV_CFL_PRED { DC_PRED } else { uv_mode };
1454915462 if (V_PRED..=D67_PRED).contains(&uv_predict_mode) {
1455015463 hit!(RECT4_16_CHROMA_DIR_HITS);
@@ -14595,9 +15508,16 @@ fn decode_rect4_16_strip(
1459515508 angle_delta_uv, cu_reach, &ZERO_RESIDUAL[..16], None, None,
1459615509 smooth_neighbor_uv, fctx,
1459715510 );
14598- let cu_mi = (pair_mi.0 + oy / 2, pair_mi.1 + ox / 2);
15511+ let cu_mi = (
15512+ pair_mi.0 + (oy << ss_y(fctx)) / MI,
15513+ pair_mi.1 + (ox << ss_x(fctx)) / MI,
15514+ );
1459915515 neighbours.record_mi_chroma(
14600- cu_mi, 8, 8, plane, &ZERO_RESIDUAL[..16],
15516+ cu_mi,
15517+ 4 << ss_x(fctx),
15518+ 4 << ss_y(fctx),
15519+ plane,
15520+ &ZERO_RESIDUAL[..16],
1460115521 );
1460215522 }
1460315523 }
@@ -14617,7 +15537,25 @@ fn decode_rect4_16_strip(
1461715537 if cpx + ox >= u.true_width || cpy + oy >= u.true_height {
1461815538 continue;
1461915539 }
14620- let cu_mi = (pair_mi.0 + oy / 2, pair_mi.1 + ox / 2);
15540+ // The unit's stamp is its own span: aom
15541+ // `av1_set_entropy_contexts` (blockd.c:29)
15542+ // memsets exactly `tx_size_wide_unit` x
15543+ // `tx_size_high_unit` cells at the unit's own
15544+ // `(aoff, loff)` -- for TX_4X4 ONE above cell
15545+ // and ONE left cell. `(oy / 2, ox / 2)` +
15546+ // `(8, 8)` is the 4:2:0 subsampled form (one
15547+ // chroma cell = 8 luma px = 2 mi cells); at
15548+ // 4:4:4 a unit is ONE mi cell, and the 2x2
15549+ // smear let a 4-wide strip's later units
15550+ // overwrite the NEXT COLUMN's above cell with
15551+ // their own state -- a column aom never sees
15552+ // this block write -- so the following block's
15553+ // `all_zero` read the wrong `txb_skip` row
15554+ // (frame-0 read #452, the llkf named gap).
15555+ let cu_mi = (
15556+ pair_mi.0 + (oy << ss_y(fctx)) / MI,
15557+ pair_mi.1 + (ox << ss_x(fctx)) / MI,
15558+ );
1462115559 // One luma-mi cell: the chroma entropy arrays
1462215560 // are subsampled, and our bands replicate that
1462315561 // one entry over the unit's two cells
@@ -14639,7 +15577,13 @@ fn decode_rect4_16_strip(
1463915577 cu_reach, buf, cpx + ox, cpy + oy, 4, 4, base_q_idx,
1464015578 None, None, offset, smooth_neighbor_uv, fctx,
1464115579 )?;
14642- neighbours.record_mi_chroma(cu_mi, 8, 8, plane, &cu_grid);
15580+ neighbours.record_mi_chroma(
15581+ cu_mi,
15582+ 4 << ss_x(fctx),
15583+ 4 << ss_y(fctx),
15584+ plane,
15585+ &cu_grid,
15586+ );
1464315587 hit!(CHROMA_SPLIT_TX_HITS);
1464415588 let dst = if plane == 1 { &mut uo } else { &mut vo };
1464515589 for row in 0..4 {
@@ -14664,6 +15608,41 @@ fn decode_rect4_16_strip(
1466415608 hit!(CHROMA_SKIP_CFL_HITS);
1466515609 }
1466615610 for (_buf, plane) in [(&mut *u, 1usize), (&mut *v, 2)] {
15611+ if chroma422_pair16 {
15612+ // lane-av1-422o: two TX_4X8 units, each predicted on
15613+ // its own edges (the lower one off the upper one's
15614+ // samples); no coefficients are coded, and libaom's
15615+ // `set_entropy_context` zeroed the block's own cells,
15616+ // so the pair-wide zero stamp below stays correct.
15617+ for unit_row in 0..2usize {
15618+ let unit_reach = tu_reach_rect(
15619+ pw, ph, 0, unit_row * 8, 8, 8, pair_reach,
15620+ ppx, ppy, y.width, y.height, fctx,
15621+ );
15622+ if let Some((ub, vb)) = &palette_uv_bufs {
15623+ let pbuf = if plane == 1 { ub } else { vb };
15624+ set_palette_pred(
15625+ palette_window(pbuf, cw, 0, unit_row * 8, 4, 8),
15626+ fctx,
15627+ );
15628+ }
15629+ push_intra_rect(plane,
15630+ cpx,
15631+ cpy + unit_row * 8,
15632+ 4,
15633+ 8,
15634+ uv_predict_mode,
15635+ angle_delta_uv,
15636+ unit_reach,
15637+ &ZERO_RESIDUAL[..4 * 8],
15638+ alpha
15639+ .zip(ac)
15640+ .map(|((au, av), ac)| (if plane == 1 { au } else { av }, ac)),
15641+ None,
15642+ smooth_neighbor_uv, fctx,
15643+ );
15644+ }
15645+ } else {
1466715646 if let Some((ub, vb)) = &palette_uv_bufs {
1466815647 set_palette_pred(if plane == 1 { ub.clone() } else { vb.clone() }, fctx);
1466915648 }
@@ -14682,10 +15661,89 @@ fn decode_rect4_16_strip(
1468215661 None,
1468315662 smooth_neighbor_uv, fctx,
1468415663 );
15664+ }
1468515665 }
1468615666 (zeros.clone(), zeros)
15667+ } else if chroma422_pair16 {
15668+ // lane-av1-422o: the pair's 4x16 chroma as TWO TX_4X8 units
15669+ // per plane, plane-major (every U unit, then every V). Each
15670+ // unit: the `ChromaRect8x4` tables (`get_txsize_entropy_ctx`
15671+ // squares TX_4X8 up to the 8x8 class), `SCAN_4X8`, and a
15672+ // `txb_skip_ctx` of above+left in the OFFSET-10 rows -- the
15673+ // offset comes from `num_pels_log2_lookup[plane_bsize] >
15674+ // num_pels_log2_lookup[BLOCK_4X8]` with plane_bsize =
15675+ // BLOCK_INVALID (255), and the byte at that table's +255 in
15676+ // the pinned Release oracle is 255 (`cmpb` against the
15677+ // `0xc0db70` copy decodetxb.c links), i.e. the bigger-plane
15678+ // arm: +3 on the offset-7-first chroma tables. No tx_type
15679+ // symbol (only y plane's is transmitted); the unit's type is
15680+ // `intra_mode_to_tx_type(UV mode)` kept by the all-16 ext-tx
15681+ // set -- [`read_rect_chroma_unit`]'s own default. CfL params
15682+ // are computed ONCE per block (`are_parameters_computed`)
15683+ // over the pair's luma, shared by both units. Each unit is
15684+ // predicted and recorded immediately, so the lower unit
15685+ // reads the upper one's coefficient context.
15686+ let ac = alpha.map(|_| cfl_src_rect(ppx, ppy, pw, ph));
15687+ for (plane, buf) in [(1usize, &mut *u), (2usize, &mut *v)] {
15688+ for unit_row in 0..2usize {
15689+ let unit_mi = (pair_mi.0 + unit_row * 2, pair_mi.1);
15690+ let unit_reach = tu_reach_rect(
15691+ pw, ph, 0, unit_row * 8, 8, 8, pair_reach,
15692+ ppx, ppy, y.width, y.height, fctx,
15693+ );
15694+ if let Some((ub, vb)) = &palette_uv_bufs {
15695+ let pbuf = if plane == 1 { ub } else { vb };
15696+ set_palette_pred(
15697+ palette_window(pbuf, cw, 0, unit_row * 8, 4, 8),
15698+ fctx,
15699+ );
15700+ }
15701+ let chroma_around = neighbours.around_mi_422_chroma(unit_mi, 8, 8);
15702+ let unit_grid = read_rect_chroma_unit(
15703+ dec,
15704+ cdfs,
15705+ TxbSet::ChromaRect8x4,
15706+ &SCAN_4X8,
15707+ 4,
15708+ 8,
15709+ plane,
15710+ chroma_around[plane],
15711+ uv_predict_mode,
15712+ angle_delta_uv,
15713+ unit_reach,
15714+ buf,
15715+ cpx,
15716+ cpy + unit_row * 8,
15717+ base_q_idx,
15718+ // lane-av1-422q: the offset-10 rows -- the same
15719+ // measured rule as the 4x32 arm (plane_bsize
15720+ // BLOCK_INVALID for the pair's BLOCK_4X16 too;
15721+ // num_pels_log2_lookup[255] = 0xff at the
15722+ // 0xc0de70 copy -> +3 on the offset-7-first
15723+ // chroma tables; see lanes/av1422q.report.md).
15724+ Some(3),
15725+ alpha
15726+ .zip(ac)
15727+ .map(|((au, av), ac)| (if plane == 1 { au } else { av }, ac)),
15728+ smooth_neighbor_uv, fctx,
15729+ )?;
15730+ neighbours.record_mi_chroma(unit_mi, 8, 8, plane, &unit_grid);
15731+ }
15732+ }
15733+ (Grid::Zero(cw * ch), Grid::Zero(cw * ch))
1468715734 } else {
14688- let around = neighbours.around_mi_rect(pair_mi, pw, ph);
15735+ // lane-av1422ctxgather: 4:2:2's chroma above votes sample
15736+ // every second luma-mi cell
15737+ // ([`Neighbours::around_mi_422_chroma`]: at ss_x 1 one
15738+ // chroma 4-px column spans two luma mi columns, and the
15739+ // plain per-mi gather counts each column's whole-unit dc
15740+ // sign twice). The left extent is unsubsampled at ss_y 0,
15741+ // so its per-mi cells already line up one-to-one.
15742+ let around = if ss_x(fctx) == 1 && ss_y(fctx) == 0 {
15743+ neighbours.around_mi_422_chroma(pair_mi, pw, ph)
15744+ } else {
15745+ neighbours.around_mi_rect(pair_mi, pw, ph)
15746+ };
1468915747 // lane-av1-444: the strip's own 16x4 / 4x16 chroma at ss 0/0
1469015748 // (`TxbSet::Chroma8`, `get_txsize_entropy_ctx(TX_16X4)` =
1469115749 // the 8x8 set); 4:2:0 keeps the pair's 8x4 / 4x8.
@@ -14693,7 +15751,25 @@ fn decode_rect4_16_strip(
1469315751 (8, 4) => (TxbSet::ChromaRect8x4, &SCAN_8X4[..]),
1469415752 (4, 8) => (TxbSet::ChromaRect8x4, &SCAN_4X8[..]),
1469515753 (16, 4) => (TxbSet::Chroma8, &SCAN_16X4[..]),
15754+ // lane-av1-444: 4:4:4's own-strip vert chroma is (4,16)
15755+ // -- one TX_4X16. (lane-av1-422o: the 4:2:2 pair's
15756+ // (4,16) never reaches this row; `chroma422_pair16`
15757+ // intercepts it above and chunks it into TX_4X8 units.)
1469615758 (4, 16) => (TxbSet::Chroma8, &SCAN_4X16[..]),
15759+ // lane-av1-422: a 4:2:2 HORZ pair (16x8 luma) keeps the
15760+ // pair's height: an 8x8 SQUARE chroma block, the same
15761+ // `TxbSet::Chroma8` set any 8x8 chroma plane reads. The
15762+ // 4:2:0 pair's chroma is 8x4 and 4:4:4's is 16x4, so this
15763+ // row is unreachable there. It is also the witness arm:
15764+ // a restored `/2 chroma height` lands on (8,4) and the
15765+ // counter reads 0.
15766+ (8, 8) => {
15767+ hit!(CHROMA422_SQUARE_HITS);
15768+ (TxbSet::Chroma8, default_scan(8))
15769+ }
15770+ // lane-av1-422o: with the `chroma422_pair16` arm above,
15771+ // the (2,16) own-strip shape and the 4:4:4 shapes are the
15772+ // only residents; anything else is a named-lane gap.
1469715773 _ => unreachable!("decode_rect4_16_strip chroma shape set is closed"),
1469815774 };
1469915775 let mut planes = Vec::with_capacity(2);
@@ -14758,7 +15834,11 @@ fn decode_rect4_16_strip(
1475815834 neighbours.record_uv_mode_mi(pair_mi.0, pair_mi.1, pw / MI, ph / MI, uv_predict_mode);
1475915835 // A lossless pair already stamped each TX_4X4 (`record_mi_chroma`).
1476015836 // The single-state rewrite below is the non-lossless TX_8X4/TX_4X8.
14761- if !lossless_pair {
15837+ // lane-av1-422o: the chunked pair's cells are stamped PER UNIT in
15838+ // the arm above (libaom's coefficient contexts are per
15839+ // 4x4-cell); a pair-wide state would erase the unit boundary the
15840+ // next block reads.
15841+ if !lossless_pair && !chroma422_pair16 {
1476215842 // The chroma planes' coefficient context, over the PAIR's mi span
1476315843 // (`decode_leaf_rect8`'s own rule: a subsampled plane's bound is
1476415844 // the luma one rounded up to its 4x4 unit).
@@ -15701,7 +16781,13 @@ fn read_intra_mode(
1570116781 (side >> ss_x(fctx), side >> ss_y(fctx)),
1570216782 (ss_x(fctx), ss_y(fctx)),
1570316783 );
15704- let map = decode_color_index_map(dec, cdfs, n, side >> ss_x(fctx), on, true);
16784+ // lane-av1-422d: the chroma map's extent is the PLANE BLOCK
16785+ // `(side >> ss_x) x (side >> ss_y)` -- 4x8 at ss (1,0), not the
16786+ // square call's `(side >> ss_x)`-squared (4x4), which left a
16787+ // 16-entry map for a 32-sample unit and panicked the reconstruct.
16788+ let map = decode_color_index_map_wh(
16789+ dec, cdfs, n, side >> ss_x(fctx), side >> ss_y(fctx), on, true,
16790+ );
1570516791 hit!(PALETTE_UV_HITS);
1570616792 if trace {
1570716793 eprintln!(
@@ -15797,6 +16883,29 @@ fn cfl_ac_ss(
1579716883 let avg = (sum + num_pel / 2) >> num_pel.trailing_zeros();
1579816884 ac.iter_mut().for_each(|v| *v -= avg);
1579916885 ac
16886+ } else if ss_x == 1 && ss_y == 0 {
16887+ // lane-av1-422: `cfl_luma_subsampling_422_lbd_c` -- each chroma sample
16888+ // averages the HORIZONTAL luma pair above it, at full chroma height
16889+ // (`(a + b) >> 1` in Q3 is `(a + b) << 2`). A rect luma strip's chroma
16890+ // is square here, and the 4:2:0 rect/square helpers below would halve
16891+ // the height it must keep.
16892+ let (cw, ch) = (bw >> 1, bh);
16893+ let mut ac = vec![0i32; cw * ch];
16894+ let mut sum = 0i32;
16895+ for row in 0..ch {
16896+ for col in 0..cw {
16897+ let (lx, ly) = (px + col * 2, py + row);
16898+ let q3 = (i32::from(y.data[ly * y.width + lx])
16899+ + i32::from(y.data[ly * y.width + lx + 1]))
16900+ << 2;
16901+ ac[row * cw + col] = q3;
16902+ sum += q3;
16903+ }
16904+ }
16905+ let num_pel = (cw * ch) as i32;
16906+ let avg = (sum + num_pel / 2) >> num_pel.trailing_zeros();
16907+ ac.iter_mut().for_each(|v| *v -= avg);
16908+ ac
1580016909 } else if bw == bh {
1580116910 cfl_ac_q3(y, px, py, bw)
1580216911 } else {
@@ -16471,6 +17580,110 @@ fn read_plane(
1647117580 Ok(levels)
1647217581 }
1647317582
17583+/// [`push_intra`] when the unit is square, [`push_intra_rect`] when it is a
17584+/// rect (lane-av1-422f): a 4:2:2 square-block chroma unit is the plane
17585+/// block's own rect shape, and the `rect` flag selects
17586+/// [`PlaneBuf::reconstruct_rect`]'s two-dimensional loop.
17587+#[allow(clippy::too_many_arguments)]
17588+fn push_intra_unit(
17589+ plane: usize,
17590+ x: usize,
17591+ y: usize,
17592+ w: usize,
17593+ h: usize,
17594+ mode: usize,
17595+ angle_delta: i32,
17596+ reach: Reach,
17597+ residual: &[i32],
17598+ cfl: Option<(i32, CflSrc)>,
17599+ filter_intra: Option<usize>,
17600+ smooth_neighbor: bool, fctx: &crate::decode::FrameCtx,
17601+) {
17602+ if w == h {
17603+ push_intra(plane, x, y, w, mode, angle_delta, reach, residual, cfl,
17604+ filter_intra, smooth_neighbor, fctx);
17605+ } else {
17606+ push_intra_rect(plane, x, y, w, h, mode, angle_delta, reach, residual, cfl,
17607+ filter_intra, smooth_neighbor, fctx);
17608+ }
17609+}
17610+
17611+/// ONE RECT chroma transform unit of a square block's uv plane
17612+/// (lane-av1-422f) -- a 4:2:2 frame's plane block is `(side/2, side)` and
17613+/// `av1_get_max_uv_txsize` fills it with a single rect unit below side 64
17614+/// (TX_4X8 / TX_8X16 / TX_16X32), which the square-shaped [`read_plane`]
17615+/// cannot express. Same shape as [`leaf8_chroma422_unit`]'s proven read: the
17616+/// [`TxbSet`] whose entropy class the unit squares up to, the unit-shaped
17617+/// scan, `txb_skip_ctx` = above + left in the offset-7 rows (the unit covers
17618+/// the plane block exactly, so no `+3` bigger-plane term -- that one lives in
17619+/// the square multi-unit walks' `chroma_ctx_offset`), and the plane's
17620+/// predicted mode supplies the mode-derived default `tx_type` unless an armed
17621+/// [`INTRABC_CHROMA_TX`] slot carries the intrabc luma's own -- except at an
17622+/// entropy class of 32x32 and up, where the spec forces `DCT_DCT`
17623+/// ([`read_plane`]'s `side >= 32` clamp).
17624+#[allow(clippy::too_many_arguments)]
17625+fn read_rect_chroma_unit(
17626+ dec: &mut SymbolDecoder,
17627+ cdfs: &mut Cdfs,
17628+ set: TxbSet,
17629+ scan: &[u16],
17630+ w: usize,
17631+ h: usize,
17632+ plane_idx: usize,
17633+ around: (bool, bool, i32),
17634+ uv_predict_mode: usize,
17635+ angle_delta_uv: i32,
17636+ reach: Reach,
17637+ // Unread, like [`read_plane`]'s own: the borrow proves the caller holds
17638+ // the plane exclusively while the unit's coefficients are parsed.
17639+ _plane: &mut PlaneBuf<'static>,
17640+ x: usize,
17641+ y: usize,
17642+ // Signature parity with [`read_plane`]; the dequant reads its q index
17643+ // off `block_q_idx(fctx)` like every other reader here.
17644+ _base_q_idx: u8,
17645+ // lane-av1-422p: `get_txb_ctx_general`'s chroma branch
17646+ // (txb_common.h) reads `txb_skip_ctx = above + left + ctx_offset`,
17647+ // where `ctx_offset` is 10 when the plane block is bigger than the
17648+ // transform and 7 otherwise. The port stores the offset-7 rows at
17649+ // `txb_skip_chroma_8` rows 0..3 and the offset-10 rows at rows 3..6
17650+ // (lane-av1-422b), so a unit SMALLER than its plane block passes
17651+ // `Some(3)` to reach the offset-10 rows. Every unit that IS the whole
17652+ // plane block stays `None` -- 4:2:2 plane blocks never shrink to a
17653+ // rect unit except in the chunk arms.
17654+ chroma_skip_offset: Option<usize>,
17655+ cfl: Option<(i32, CflSrc)>,
17656+ smooth_neighbor_uv: bool, fctx: &crate::decode::FrameCtx,
17657+) -> Result<Grid> {
17658+ if ss_x(fctx) == 1 && ss_y(fctx) == 0 && w != h {
17659+ hit!(CHROMA422_RECT_HITS);
17660+ }
17661+ let default_tx = if w.max(h) >= 32 {
17662+ TxType::DctDct
17663+ } else {
17664+ fctx
17665+ .intrabc_chroma_tx
17666+ .with(std::cell::Cell::get)
17667+ .unwrap_or_else(|| default_intra_tx_type(uv_predict_mode as u8))
17668+ };
17669+ let mut coding = cdfs.txb(set, uv_predict_mode);
17670+ let (levels, tx_type) = read_coeffs_rect(
17671+ dec, &mut coding, scan, w, h,
17672+ usize::from(around.0) + usize::from(around.1) + chroma_skip_offset.unwrap_or(0),
17673+ dc_sign_ctx(around.2), default_tx,
17674+ )?;
17675+ let residual = dequant_and_inverse_typed_wh(
17676+ &levels, w, h, crate::decode::bit_depth(fctx), block_q_idx(fctx),
17677+ plane_q_delta(plane_idx, fctx).0, plane_q_delta(plane_idx, fctx).1,
17678+ tx_type, block_iqmatrix(fctx, plane_idx, w, h, tx_type),
17679+ );
17680+ push_intra_rect(
17681+ plane_idx, x, y, w, h, uv_predict_mode, angle_delta_uv, reach,
17682+ &residual, cfl, None, smooth_neighbor_uv, fctx,
17683+ );
17684+ Ok(levels)
17685+}
17686+
1647417687 /// Decodes one whole-block coded superblock/quadrant/leaf: its mode, then its
1647517688 /// three planes, reconstructing them into `y`/`u`/`v` and updating
1647617689 /// `neighbours`.
@@ -16541,8 +17754,8 @@ fn decode_block(
1654117754 // rewrite (which sat above `read_intra_mode`) rides along here -- same
1654217755 // per-frame `ss_x`/`ss_y` condition, now resolved against the block's own
1654317756 // segment like the lossless arm above it.
16544- let (luma_set, chroma_set, luma_tx, chroma_tx, scans) = if lossless(fctx) {
16545- (TxbSet::Luma4, TxbSet::Chroma4, 4, 4, (scan4, scan4))
17757+ let (luma_set, chroma_set, luma_tx, chroma_tx, chroma_tx_h, scans) = if lossless(fctx) {
17758+ (TxbSet::Luma4, TxbSet::Chroma4, 4, 4, 4, (scan4, scan4))
1654617759 } else if ss_x(fctx) == 0 && ss_y(fctx) == 0 {
1654717760 let tx = if side >= 64 { 32 } else { side };
1654817761 let (set, scan): (TxbSet, &[u16]) = match tx {
@@ -16551,9 +17764,39 @@ fn decode_block(
1655117764 8 => (TxbSet::Chroma8, scan8),
1655217765 _ => (TxbSet::Chroma4, scan4),
1655317766 };
16554- (luma_set, set, luma_tx, tx, (scans.0, scan))
17767+ (luma_set, set, luma_tx, tx, tx, (scans.0, scan))
17768+ } else if ss_x(fctx) == 1 && ss_y(fctx) == 0 {
17769+ // lane-av1-422f: the uv plane block is the (side/2, side) rect
17770+ // (`ss_size_lookup[..][1][0]`), and `av1_get_max_uv_txsize` is
17771+ // `av1_get_adjusted_tx_size(max_txsize_rect_lookup[plane_bsize])` --
17772+ // the RECT that fills the plane block, NOT the square transform of
17773+ // the smaller side (the oracle reads ONE TX_8X16 for a 16x16 block's
17774+ // 8x16 plane where the old model read two 8x8 units): 4 -> TX_4X4
17775+ // (the 2x4 plane rounds up to BLOCK_4X4), 8 -> TX_4X8, 16 ->
17776+ // TX_8X16, 32 -> TX_16X32 (one unit per plane, the whole plane
17777+ // block), 64 -> TX_32X64 adjusts to TX_32X32 and 128 -> TX_64X64
17778+ // adjusts to TX_32X32 (square units, a 1x2 / 2x4 grid).
17779+ // `chroma_tx` is the unit WIDTH, `chroma_tx_h` its HEIGHT; the
17780+ // chroma walks below read one (chroma_tx, chroma_tx_h) unit per grid
17781+ // cell and key their rect reads on `chroma_tx != chroma_tx_h`.
17782+ let (tx_w, tx_h) = match side {
17783+ 4 => (4, 4),
17784+ 8 => (4, 8),
17785+ 16 => (8, 16),
17786+ 32 => (16, 32),
17787+ // 64 and 128: TX_32X64 / TX_64X64 adjust down to TX_32X32.
17788+ _ => (32, 32),
17789+ };
17790+ let (set, scan): (TxbSet, &[u16]) = match side {
17791+ 4 => (TxbSet::Chroma4, scan4),
17792+ 8 => (TxbSet::ChromaRect8x4, &SCAN_4X8[..]),
17793+ 16 => (TxbSet::ChromaRect16x8, &SCAN_8X16[..]),
17794+ 32 => (TxbSet::ChromaRect32x16, &SCAN_16X32[..]),
17795+ _ => (TxbSet::Chroma32, scan32),
17796+ };
17797+ (luma_set, set, luma_tx, tx_w, tx_h, (scans.0, scan))
1655517798 } else {
16556- (luma_set, chroma_set, luma_tx, chroma_tx, scans)
17799+ (luma_set, chroma_set, luma_tx, chroma_tx, chroma_tx, scans)
1655717800 };
1655817801 let intrabc_dv = fctx.intrabc_dv.with(|c| c.take());
1655917802 // `predict` panics outside `DC_PRED..=PAETH_PRED` (0..=12); `UV_CFL_PRED`
@@ -16677,6 +17920,9 @@ fn decode_block(
1667717920 let reach = Reach::of(side, px, py, y.width, y.height, fctx);
1667817921 let (cpx, cpy) = (px >> ss_x(fctx), py >> ss_y(fctx));
1667917922 let chroma_side = side >> ss_x(fctx);
17923+ // lane-av1-422b: chroma extent per axis, `side` at ss_y 0 (4:2:2/4:4:4),
17924+ // `side / 2` at 4:2:0.
17925+ let chroma_height = side >> ss_y(fctx);
1668017926 // spec 7.11.3.4 with `use_intrabc`: the reference is the *current*
1668117927 // frame's own pre-loop-filter reconstruction (all loop filters are off
1668217928 // whenever `allow_intrabc`, frame.rs:194/210/252/272) at the full-pel
@@ -16691,17 +17937,17 @@ fn decode_block(
1669117937 mv_to_q4(px, dv_col, 0), mv_to_q4(py, dv_row, 0),
1669217938 side, side, mc::InterpFilterKind::Bilinear, &mut yb, fctx,
1669317939 );
16694- let mut ub = vec![0u16; chroma_side * chroma_side];
17940+ let mut ub = vec![0u16; chroma_side * chroma_height];
1669517941 mc::predict_with_filter(
1669617942 &u.data, u.width, u.true_width, u.true_height,
16697- mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_x(fctx)),
16698- chroma_side, chroma_side, mc::InterpFilterKind::Bilinear, &mut ub, fctx,
17943+ mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_y(fctx)),
17944+ chroma_side, chroma_height, mc::InterpFilterKind::Bilinear, &mut ub, fctx,
1669917945 );
16700- let mut vb = vec![0u16; chroma_side * chroma_side];
17946+ let mut vb = vec![0u16; chroma_side * chroma_height];
1670117947 mc::predict_with_filter(
1670217948 &v.data, v.width, v.true_width, v.true_height,
16703- mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_x(fctx)),
16704- chroma_side, chroma_side, mc::InterpFilterKind::Bilinear, &mut vb, fctx,
17949+ mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_y(fctx)),
17950+ chroma_side, chroma_height, mc::InterpFilterKind::Bilinear, &mut vb, fctx,
1670517951 );
1670617952 (yb, ub, vb)
1670717953 });
@@ -16846,31 +18092,41 @@ fn decode_block(
1684618092 );
1684718093 }
1684818094 let ac = alpha.map(|_| cfl_src(px, py, side));
16849- let cn = (chroma_side / chroma_tx).max(1);
16850- for cu_row in 0..cn {
16851- for cu_col in 0..cn {
16852- let luma_span = chroma_tx << ss_x(fctx);
16853- let cu_r = if cn == 1 {
18095+ // lane-av1-422b: the chroma unit grid is `cn_cols` x `cn_rows` --
18096+ // square at 4:2:0/4:4:4, at 4:2:2 `(side/2)/tx` units wide by
18097+ // `side/tx` tall (the plane block is (side/2, side)). A unit's LUMA
18098+ // anchor follows the per-axis shifts: `chroma_tx << ss_x` wide,
18099+ // `chroma_tx_h << ss_y` tall (lane-av1-422f: the unit itself is the
18100+ // (chroma_tx, chroma_tx_h) rect, so a 4:2:2 frame below side 64
18101+ // reads ONE unit per plane, the whole plane block).
18102+ let cn_cols = (chroma_side / chroma_tx).max(1);
18103+ let cn_rows = (chroma_height / chroma_tx_h).max(1);
18104+ let luma_span_x = chroma_tx << ss_x(fctx);
18105+ let luma_span_y = chroma_tx_h << ss_y(fctx);
18106+ for cu_row in 0..cn_rows {
18107+ for cu_col in 0..cn_cols {
18108+ let cu_r = if cn_rows == 1 && cn_cols == 1 {
1685418109 reach
1685518110 } else {
16856- tu_reach(
18111+ tu_reach_rect(
1685718112 side, side,
16858- cu_col * luma_span, cu_row * luma_span, luma_span,
18113+ cu_col * luma_span_x, cu_row * luma_span_y, luma_span_x, luma_span_y,
1685918114 reach, px, py, y.width, y.height, fctx,
1686018115 )
1686118116 };
16862- let (cu_x, cu_y) = (cpx + cu_col * chroma_tx, cpy + cu_row * chroma_tx);
18117+ let (cu_x, cu_y) = (cpx + cu_col * chroma_tx, cpy + cu_row * chroma_tx_h);
1686318118 if let Some((ub, _)) = &palette_uv_bufs {
1686418119 set_palette_pred(ub.clone(), fctx);
1686518120 }
16866- push_intra(1,
18121+ push_intra_unit(1,
1686718122 cu_x,
1686818123 cu_y,
1686918124 chroma_tx,
18125+ chroma_tx_h,
1687018126 uv_predict_mode,
1687118127 angle_delta_uv,
1687218128 cu_r,
16873- &ZERO_RESIDUAL[..chroma_tx * chroma_tx],
18129+ &ZERO_RESIDUAL[..chroma_tx * chroma_tx_h],
1687418130 alpha.zip(ac).map(|((au, _), ac)| (au, ac)),
1687518131 None,
1687618132 smooth_neighbor_uv, fctx,
@@ -16878,14 +18134,15 @@ fn decode_block(
1687818134 if let Some((_, vb)) = &palette_uv_bufs {
1687918135 set_palette_pred(vb.clone(), fctx);
1688018136 }
16881- push_intra(2,
18137+ push_intra_unit(2,
1688218138 cu_x,
1688318139 cu_y,
1688418140 chroma_tx,
18141+ chroma_tx_h,
1688518142 uv_predict_mode,
1688618143 angle_delta_uv,
1688718144 cu_r,
16888- &ZERO_RESIDUAL[..chroma_tx * chroma_tx],
18145+ &ZERO_RESIDUAL[..chroma_tx * chroma_tx_h],
1688918146 alpha.zip(ac).map(|((_, av), ac)| (av, ac)),
1689018147 None,
1689118148 smooth_neighbor_uv, fctx,
@@ -16941,8 +18198,17 @@ fn decode_block(
1694118198 // TX_32X32, so a 64x64 block codes four chroma units, plane-major
1694218199 // (every U, then every V) — the same loop the multi-TU arm runs.
1694318200 // At 4:2:0 `chroma_side == chroma_tx`, so it stays one read.
16944- let cn = (chroma_side / chroma_tx).max(1);
16945- let (u_grid, v_grid, chroma_units) = if cn == 1 {
18201+ // lane-av1-422b: 4:2:2 never collapses to one read above a 4x4 luma
18202+ // block -- the unit grid is `(side/2)/tx` wide by `side/tx` tall.
18203+ // lane-av1-422f: `chroma_tx` is the unit WIDTH and `chroma_tx_h` its
18204+ // HEIGHT, so below side 64 a 4:2:2 frame's grid is 1x1 and the one
18205+ // unit is the plane block's own rect.
18206+ let cn_cols = (chroma_side / chroma_tx).max(1);
18207+ let cn_rows = (chroma_height / chroma_tx_h).max(1);
18208+ let luma_span_x = chroma_tx << ss_x(fctx);
18209+ let luma_span_y = chroma_tx_h << ss_y(fctx);
18210+ let (u_grid, v_grid, chroma_units) = if cn_rows == 1 && cn_cols == 1 {
18211+ if chroma_tx == chroma_tx_h {
1694618212 if let Some((ub, _)) = &palette_uv_bufs {
1694718213 set_palette_pred(ub.clone(), fctx);
1694818214 }
@@ -17000,40 +18266,78 @@ fn decode_block(
1700018266 smooth_neighbor_uv, fctx,
1700118267 )?;
1700218268 (u_grid, v_grid, Vec::new())
18269+ } else {
18270+ // lane-av1-422f: the one unit is a RECT filling the plane
18271+ // block -- the square-shaped [`read_plane`] cannot express
18272+ // it, so both planes go through [`read_rect_chroma_unit`]
18273+ // (U, then V, the same order the square arm reads). The
18274+ // chroma context reads per chroma 4-px cell (see
18275+ // [`Neighbours::around_mi_422_chroma`]).
18276+ let chroma_around =
18277+ neighbours.around_mi_422_chroma((mi_r, mi_c), side, side);
18278+ if let Some((ub, _)) = &palette_uv_bufs {
18279+ set_palette_pred(ub.clone(), fctx);
18280+ }
18281+ let u_grid = read_rect_chroma_unit(
18282+ dec, cdfs, chroma_set, scans.1, chroma_tx, chroma_tx_h, 1,
18283+ chroma_around[1], uv_predict_mode, angle_delta_uv, reach, u,
18284+ cpx, cpy, base_q_idx, None,
18285+ alpha.zip(ac).map(|((au, _), ac)| (au, ac)),
18286+ smooth_neighbor_uv, fctx,
18287+ )?;
18288+ if let Some((_, vb)) = &palette_uv_bufs {
18289+ set_palette_pred(vb.clone(), fctx);
18290+ }
18291+ let v_grid = read_rect_chroma_unit(
18292+ dec, cdfs, chroma_set, scans.1, chroma_tx, chroma_tx_h, 2,
18293+ chroma_around[2], uv_predict_mode, angle_delta_uv, reach, v,
18294+ cpx, cpy, base_q_idx, None,
18295+ alpha.zip(ac).map(|((_, av), ac)| (av, ac)),
18296+ smooth_neighbor_uv, fctx,
18297+ )?;
18298+ (u_grid, v_grid, Vec::new())
18299+ }
1700318300 } else {
1700418301 let chroma_ctx_offset = Some(3);
1700518302 let mut u_pass: Vec<Grid> = Vec::new();
17006- let mut units: Vec<((usize, usize), usize, Grid, Grid)> = Vec::new();
18303+ let mut units: Vec<((usize, usize), usize, usize, Grid, Grid)> = Vec::new();
1700718304 let mut last_grids = [Grid::Zero(0), Grid::Zero(0)];
1700818305 for plane_pass in 1..=2usize {
1700918306 let mut pass_idx = 0usize;
17010- for cu_row in 0..cn {
17011- for cu_col in 0..cn {
17012- let luma_span = chroma_tx << ss_x(fctx);
18307+ for cu_row in 0..cn_rows {
18308+ for cu_col in 0..cn_cols {
1701318309 let cu_mi = (
17014- mi_r + cu_row * (luma_span / MI),
17015- mi_c + cu_col * (luma_span / MI),
18310+ mi_r + cu_row * (luma_span_y / MI),
18311+ mi_c + cu_col * (luma_span_x / MI),
1701618312 );
17017- let cu_around = neighbours.around_mi(cu_mi, luma_span);
17018- let cu_reach = tu_reach(
18313+ let cu_around = if ss_x(fctx) == 1 && ss_y(fctx) == 0 {
18314+ // lane-av1-422f: chroma-only loop; per-chroma-cell
18315+ // above votes (see [`Neighbours::around_mi_422_chroma`]).
18316+ neighbours.around_mi_422_chroma(cu_mi, luma_span_x, luma_span_y)
18317+ } else {
18318+ neighbours.around_mi_rect(cu_mi, luma_span_x, luma_span_y)
18319+ };
18320+ let cu_reach = tu_reach_rect(
1701918321 side,
1702018322 side,
17021- cu_col * luma_span,
17022- cu_row * luma_span,
17023- luma_span,
18323+ cu_col * luma_span_x,
18324+ cu_row * luma_span_y,
18325+ luma_span_x,
18326+ luma_span_y,
1702418327 reach,
1702518328 px,
1702618329 py,
1702718330 y.width,
1702818331 y.height, fctx,
1702918332 );
17030- let (cu_x, cu_y) = (cpx + cu_col * chroma_tx, cpy + cu_row * chroma_tx);
18333+ let (cu_x, cu_y) =
18334+ (cpx + cu_col * chroma_tx, cpy + cu_row * chroma_tx_h);
1703118335 if let Some((ub, vb)) = &palette_uv_bufs {
1703218336 let pbuf = if plane_pass == 1 { ub } else { vb };
1703318337 set_palette_pred(
1703418338 palette_window(
17035- pbuf, chroma_side, cu_col * chroma_tx, cu_row * chroma_tx,
17036- chroma_tx, chroma_tx,
18339+ pbuf, chroma_side, cu_col * chroma_tx,
crates/ec-av1/src/encode.rsmodified+6 -1
@@ -1548,7 +1548,10 @@ pub struct Picture {
15481548 pub height: usize,
15491549 /// The luma plane, `width * height` samples in raster order.
15501550 pub y: Vec<u16>,
1551- /// The U plane, at half the width and half the height.
1551+ /// The U plane: half the width, and the frame's own chroma height -- a
1552+ /// quarter of the luma samples at 4:2:0, half at 4:2:2, all of them at
1553+ /// 4:4:4. A consumer that only knows the luma size reads the chroma
1554+ /// format off this sample count (see `decode::ref_chroma_shape`).
15521555 pub u: Vec<u16>,
15531556 /// The V plane, the same shape as U.
15541557 pub v: Vec<u16>,
@@ -6801,6 +6804,8 @@ fn obmc_prediction(
68016804 side,
68026805 side,
68036806 side,
6807+ crate::decode::ss_x(fctx),
6808+ crate::decode::ss_y(fctx),
68046809 side / 2,
68056810 x,
68066811 y,
crates/ec-av1/src/gate_coverage.rsmodified+65 -15
@@ -119,15 +119,50 @@ enum On {
119119 /// only a gate that spells an on-value at that bit depth retires an entry.
120120 #[cfg(test)]
121121 const DEFAULT_ON_TOOLS: &[(&str, &[&str], &str, On)] = &[
122- ("enable-tx-size-search", &["enable-tx-size-search"], "1", On::NonZero),
123- ("enable-directional-intra", &["enable-directional-intra"], "1", On::NonZero),
124- ("enable-smooth-interintra", &["enable-smooth-interintra"], "1", On::NonZero),
125- ("enable-interintra-wedge", &["enable-interintra-wedge"], "1", On::NonZero),
126- ("enable-diff-wtd-comp", &["enable-diff-wtd-comp"], "1", On::NonZero),
127- ("enable-onesided-comp", &["enable-onesided-comp"], "1", On::NonZero),
122+ (
123+ "enable-tx-size-search",
124+ &["enable-tx-size-search"],
125+ "1",
126+ On::NonZero,
127+ ),
128+ (
129+ "enable-directional-intra",
130+ &["enable-directional-intra"],
131+ "1",
132+ On::NonZero,
133+ ),
134+ (
135+ "enable-smooth-interintra",
136+ &["enable-smooth-interintra"],
137+ "1",
138+ On::NonZero,
139+ ),
140+ (
141+ "enable-interintra-wedge",
142+ &["enable-interintra-wedge"],
143+ "1",
144+ On::NonZero,
145+ ),
146+ (
147+ "enable-diff-wtd-comp",
148+ &["enable-diff-wtd-comp"],
149+ "1",
150+ On::NonZero,
151+ ),
152+ (
153+ "enable-onesided-comp",
154+ &["enable-onesided-comp"],
155+ "1",
156+ On::NonZero,
157+ ),
128158 ("enable-fwd-kf", &["enable-fwd-kf"], "0", On::NonZero),
129159 ("deblocking", &["loopfilter-control"], "1", On::NonZero),
130- ("multi-tile", &["tile-columns", "tile-rows"], "0", On::NonZero),
160+ (
161+ "multi-tile",
162+ &["tile-columns", "tile-rows"],
163+ "0",
164+ On::NonZero,
165+ ),
131166 ("intrabc-search", &["cpu-used"], "0", On::AtMost(2)),
132167 ];
133168
@@ -167,10 +202,14 @@ const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[
167202 "enable-flip-idtx",
168203 "never spelled; the flip/identity transform types are unproven by a real stream",
169204 ),
170- (
171- "enable-global-motion",
172- "off in 5 gates, on in none at 8 bits; lane-gm owns the global-warp prediction that is still missing",
173- ),
205+ // `enable-global-motion` LEFT this list on 2026-09-25 (lane-av1gwarp12 r2):
206+ // `a_real_affine_global_motion_stream_decodes_pixel_exact` loops
207+ // `for depth in [8u32, 10u32]` passing `--enable-global-motion=1` and
208+ // pixel-compares both depths, so the 8-bit hole has been closed since
209+ // lane-gmaffine r1 -- the entry survived because no suite ran a tree
210+ // containing both the gate and this test until the ROTZOOM suite.
211+ // The 12-bit ROTZOOM gate rides the high-depth bucket via `encode_12bit(`
212+ // in `is_ten_bit`, so it plays no part in this retirement.
174213 (
175214 "enable-rect-tx",
176215 "never spelled; rect transforms reach the decoder only through partition shape, never through a gate that names the tool",
@@ -178,7 +217,8 @@ const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[
178217 ];
179218
180219 #[cfg(test)]
181-const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ // lane-cwarp's 10-bit compound-global-warp gate closed `enable-global-motion`
220+const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[
221+ // lane-cwarp's 10-bit compound-global-warp gate closed `enable-global-motion`
182222 // and `enable-dist-wtd-comp` at 10 bits without deleting their entries here,
183223 // so this list was already stale (and this test already red) at main 9c35ecc;
184224 // lane-tiles r11's multi-tile 10-bit gates then closed `enable-ab-partitions`,
@@ -240,8 +280,8 @@ const NEVER_ON_10BIT: &[(&str, &str)] = &[];
240280 #[cfg(test)]
241281 mod tests {
242282 use super::{
243- ALIASES, DEFAULT_ON_TOOLS, NEVER_EXERCISED, NEVER_EXERCISED_8BIT, NEVER_EXERCISED_10BIT,
244- NEVER_ON_10BIT, NEVER_ON_8BIT, On, TOOL_UNIVERSE,
283+ On, ALIASES, DEFAULT_ON_TOOLS, NEVER_EXERCISED, NEVER_EXERCISED_10BIT,
284+ NEVER_EXERCISED_8BIT, NEVER_ON_10BIT, NEVER_ON_8BIT, TOOL_UNIVERSE,
245285 };
246286 use std::collections::{BTreeMap, BTreeSet};
247287
@@ -438,11 +478,19 @@ mod tests {
438478 }
439479
440480 fn is_ten_bit(body: &str) -> bool {
481+ // The lists pin two buckets, 8-bit and high-bit-depth; 12-bit gates
482+ // count in the high-depth bucket (lane-av1gwarp12's ROTZOOM gate was
483+ // the first 12-bit gate to positively enable a listed tool, and the
484+ // 10-bit-only spellings mis-filed it as 8-bit).
441485 body.contains("encode_10bit_gradients")
442486 || body.contains("ten_bit_tool_gate(")
443487 || body.contains("--bit-depth=10")
444488 || body.contains("--input-bit-depth=10")
445489 || body.contains("yuv420p10le")
490+ || body.contains("encode_12bit(")
491+ || body.contains("--bit-depth=12")
492+ || body.contains("--input-bit-depth=12")
493+ || body.contains("yuv420p12le")
446494 }
447495
448496 /// Flags a gate positively enables (`=1`), at gates of the given depth.
@@ -534,7 +582,9 @@ mod tests {
534582 }
535583
536584 /// [`DEFAULT_ON_TOOLS`] per depth: `tool -> (off in N gates, on in N, defaulted in N)`.
537- fn default_on_settings(ten_bit: bool) -> (usize, BTreeMap<&'static str, (usize, usize, usize)>) {
585+ fn default_on_settings(
586+ ten_bit: bool,
587+ ) -> (usize, BTreeMap<&'static str, (usize, usize, usize)>) {
538588 let gates: Vec<&str> = gate_bodies()
539589 .into_iter()
540590 .filter(|b| covers_depth(b, ten_bit))
crates/ec-av1/src/mc.rsmodified+31 -14
@@ -2142,8 +2142,11 @@ pub(crate) fn diffwtd_mask(
21422142 /// (64-m)*pred1) >> 6` (a plain, unrounded shift, matching the C `>>` on
21432143 /// `int32_t`) then one final [`round2`] by [`INTER_POST_ROUND`]. `mask` is
21442144 /// always the LUMA-resolution mask (`mask_stride` == luma block width);
2145-/// `subsampled` selects the 2x2-average chroma read (spec 7.11.3.14 /
2146-/// libaom's `subw == 1 && subh == 1` branch) vs. the direct luma read.
2145+/// `(subw, subh)` are the PLANE's own subsampling shifts and pick the mask
2146+/// read exactly as aom_dsp/blend-a64-mask.c's four `subw`/`subh` branches do:
2147+/// `(0, 0)` the direct luma sample, `(1, 1)` the 2x2 box average,
2148+/// `(1, 0)`/`(0, 1)` the `AOM_BLEND_AVG` pair average on the subsampled axis
2149+/// alone (4:2:2).
21472150 #[allow(clippy::too_many_arguments)]
21482151 pub(crate) fn blend_masked_compound(
21492152 pred0: &[i32],
@@ -2152,7 +2155,8 @@ pub(crate) fn blend_masked_compound(
21522155 mask_stride: usize,
21532156 w: usize,
21542157 h: usize,
2155- subsampled: bool,
2158+ subw: usize,
2159+ subh: usize,
21562160 dst: &mut [u16],
21572161 fctx: &crate::decode::FrameCtx,
21582162 ) {
@@ -2162,17 +2166,30 @@ pub(crate) fn blend_masked_compound(
21622166 let post_round = INTER_POST_ROUND - round_delta(u32::from(crate::decode::bit_depth(fctx)));
21632167 for i in 0..h {
21642168 for j in 0..w {
2165- let m = if subsampled {
2166- let idx = (2 * i) * mask_stride + 2 * j;
2167- round2(
2168- i32::from(mask[idx])
2169- + i32::from(mask[idx + 1])
2170- + i32::from(mask[idx + mask_stride])
2171- + i32::from(mask[idx + mask_stride + 1]),
2172- 2,
2173- )
2174- } else {
2175- i32::from(mask[i * mask_stride + j])
2169+ let m: i32 = match (subw, subh) {
2170+ (0, 0) => i32::from(mask[i * mask_stride + j]),
2171+ (1, 1) => {
2172+ let idx = (2 * i) * mask_stride + 2 * j;
2173+ round2(
2174+ i32::from(mask[idx])
2175+ + i32::from(mask[idx + 1])
2176+ + i32::from(mask[idx + mask_stride])
2177+ + i32::from(mask[idx + mask_stride + 1]),
2178+ 2,
2179+ )
2180+ }
2181+ // aom_blend_a64_mask_c's `subw == 1 && subh == 0` branch:
2182+ // `AOM_BLEND_AVG(mask[2 * j], mask[2 * j + 1])` per row.
2183+ (1, 0) => {
2184+ let idx = i * mask_stride + 2 * j;
2185+ (i32::from(mask[idx]) + i32::from(mask[idx + 1]) + 1) >> 1
2186+ }
2187+ // the `subw == 0 && subh == 1` branch: averaged down the
2188+ // columns instead.
2189+ (_sw, _sh) => {
2190+ let idx = (2 * i) * mask_stride + j;
2191+ (i32::from(mask[idx]) + i32::from(mask[idx + mask_stride]) + 1) >> 1
2192+ }
21762193 };
21772194 let res = (m * pred0[i * w + j] + (64 - m) * pred1[i * w + j]) >> 6;
21782195 // `post_round` above: `INTER_POST_ROUND - round_delta` -- see
crates/ec-av1/src/refusal_inventory.rsmodified+195 -0
@@ -42,6 +42,10 @@ const REFUSALS: &[&str] = &[
4242 // strings never landed here (continuation 8's suite run caught the
4343 // drift); both are decoder-side "no table for that shape yet" guards on
4444 // 4:4:4 rect strips, same family as the rect luma/chroma entries below.
45+ // lane-av1-refusalaudit: the 64-axis one is PROVEN unreachable -- its
46+ // chroma-unit table covers every conformant strip unit in both supported
47+ // chroma formats (enumeration in PROVEN; the witness2 hunt reached
48+ // nothing). The chroma-size one below is still live.
4549 "a 64-axis strip whose chroma unit has no coefficient table",
4650 "a rectangular chroma transform whose size has no coefficient table",
4751 "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here",
@@ -271,6 +275,15 @@ const PROVEN: &[(&str, &str)] = &[
271275 // `(side, write_w, write_h)` triples `INTER_BLOCK_SHAPES` lists, and
272276 // `rect_inter_residual_supported` covers every rectangular one -- the only
273277 // footprints `reject_residual` is set for.
278+ // lane-av1-witness2 (8 more inter encodes: banded and busy content,
279+ // --max-partition-size=32, a single-ref arm, cq 20..45, cpu-used 0..1):
280+ // no refusal -- every rect strip the encoder produced sat inside the
281+ // supported set. Static half, from the same hunt: the supported list plus
282+ // the partition walker's piece set (SB pieces 64x32/32x64/64x16/16x64,
283+ // the 32- and 16-level rect/1:4/AB twins, 128 halves tiled as two
284+ // TX_64X64) enumerate every rect footprint AV1 partitioning can present;
285+ // 1:4 stops at 64 because the 128 root has no 1:4 symbol. No conformant
286+ // stream can name an unsupported footprint.
274287 (
275288 "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding",
276289 "a_block_shape_census_over_three_real_streams_leaves_the_rect_residual_refusal_unreachable",
@@ -294,6 +307,12 @@ const PROVEN: &[(&str, &str)] = &[
294307 // lane-t900 r20, census: the rect transform tables and scans, enumerated
295308 // over the shapes the measured block-shape domain hands each helper (block
296309 // footprint, 4:2:0 chroma unit, rect var-tx leaf, clamped coded corner).
310+ // lane-av1-witness2 (8 inter encodes, --enable-tx-size-search=1, rect+1:4
311+ // on, --min-partition-size=4, 4:2:0 and 4:4:4, sb 64/128, cq 10..45,
312+ // cpu-used 0..2): no refusal while the domain was genuinely exercised --
313+ // whole-block 32x8 inter TUs and sub-8 rect pieces decoded. The fourteen
314+ // rect shapes the enumeration covers are the whole alphabet, so the `_`
315+ // arm has no conformant input.
297316 (
298317 "a rectangular inter luma transform unit whose shape has no coefficient table set here",
299318 "every_rect_transform_shape_the_census_lists_has_a_coefficient_table_and_scan",
@@ -478,6 +497,13 @@ const PROVEN: &[(&str, &str)] = &[
478497 // `segment_id` symbols, and nothing else; the map-inheritance defect that
479498 // census surfaced (verbatim copy, decodemv.c:342) is fixed and witnessed
480499 // by `a_real_aomenc_segmentation_stream_with_map_inheritance_decodes_ // pixel_exact`.
500+ // lane-av1-witness2 re-confirmed the census on the current aomenc build:
501+ // it has no --enable-segmentation flag at all (aq-mode is the only
502+ // segmentation driver; aq-mode 4 is out of range for the build), and 8
503+ // aq-mode recipes (1/2/3, + --delta-lf-mode=1, 4:4:4, banded content)
504+ // wrote SEG_LVL_ALT_Q tables and segment_id symbols where segmentation
505+ // engaged, decoded clean, and never coded one of the three
506+ // mode-overriding features.
481507 (
482508 "a frame whose segmentation enables SEG_LVL_REF_FRAME/SKIP/GLOBALMV (this decoder reads segment_id but never lets a segment override a block's reference, skip or mode)",
483509 "a_frame_whose_segmentation_overrides_a_block_mode_is_refused_by_name",
@@ -514,6 +540,19 @@ const PROVEN: &[(&str, &str)] = &[
514540 "a split intra strip whose transform unit is {tx_w}x{tx_h} (no luma coefficient tables for that shape here)",
515541 "every_rect_strip_shape_the_split_path_codes_has_a_luma_and_chroma_table",
516542 ),
543+ // lane-av1-refusalaudit, enumeration + witness2 hunt: decode_block_rect64's
544+ // chroma-unit table covers every conformant 64-axis strip unit in both
545+ // supported chroma formats -- at 4:4:4 the strips 64x32/32x64/64x16/16x64
546+ // tile to (32,32)/(32,16)/(16,32); at 4:2:0 the halved footprints land on
547+ // (32,16)/(16,32)/(32,8)/(8,32). A 128-root half is
548+ // `decode_block_128rect`'s, and the 128 root has no 1:4 arm. The hunt (8
549+ // real aomenc key-frame encodes: screen+intrabc, rect+1:4, sb 64 and 128,
550+ // cq 10..63, cpu-used 0..2) never reached the arm; the three streams that
551+ // decode to completion never enter decode_block_rect64 at all.
552+ (
553+ "a 64-axis strip whose chroma unit has no coefficient table",
554+ "every_chroma_unit_a_64_axis_strip_can_present_has_a_coefficient_table",
555+ ),
517556 // lane-t900 r33, enumeration: each of the four symbols this guard tests is
518557 // read under a size gate that no 128-pixel side passes (the call site's
519558 // literal `cfl=false`, `filter_intra_size_class_rect`'s table, and
@@ -1472,6 +1511,162 @@ mod tests {
14721511 );
14731512 }
14741513
1514+ /// lane-av1-refusalaudit, ENUMERATION for "a 64-axis strip whose chroma
1515+ /// unit has no coefficient table" -- [`decode_block_rect64`]'s `_` arm,
1516+ /// reached only for depth-0, non-skip, non-lossless superblock-level
1517+ /// HORZ/VERT/1:4 strips.
1518+ ///
1519+ /// The unit is the strip's chroma shape capped at 32 per axis
1520+ /// (`(chroma_w.min(32), chroma_h.min(32))`), so the enumeration walks the
1521+ /// strip domain -- the 64-axis 2:1 and 1:4 footprints, the only shapes the
1522+ /// two callers (`read_sb128_root`, `decode_intra_rect_in_inter`) hand the
1523+ /// function -- through both supported chroma formats (4:4:4 and 4:2:0;
1524+ /// every mixed format is refused at the sequence header) against the
1525+ /// `match` arms read out of decode.rs itself (class
1526+ /// `table-and-reader-move-together`).
1527+ ///
1528+ /// lane-av1-witness2 hunted the shape with 8 real aomenc key-frame encodes
1529+ /// (screen+intrabc, rect+1:4, sb 64 and 128, cq 10..63, cpu-used 0..2):
1530+ /// no recipe reached the arm, and the three streams that decode to
1531+ /// completion never enter `decode_block_rect64` at all.
1532+ #[test]
1533+ fn every_chroma_unit_a_64_axis_strip_can_present_has_a_coefficient_table() {
1534+ let src = include_str!("decode.rs");
1535+
1536+ // (1) The caller set. Each call's enclosing function is the last
1537+ // top-level `fn` before it.
1538+ let fn_starts: Vec<(usize, String)> = src
1539+ .match_indices("\nfn ")
1540+ .map(|(i, _)| {
1541+ let rest = &src[i + 4..];
1542+ let name = rest[..rest.find('(').unwrap_or(0)].to_string();
1543+ (i, name)
1544+ })
1545+ .collect();
1546+ let mut callers: BTreeSet<String> = BTreeSet::new();
1547+ for (at, _) in src.match_indices("decode_block_rect64(") {
1548+ let enclosing = fn_starts
1549+ .iter()
1550+ .filter(|(i, _)| *i < at)
1551+ .next_back()
1552+ .expect("a decode_block_rect64 call outside any function");
1553+ if enclosing.1 != "decode_block_rect64" {
1554+ callers.insert(enclosing.1.clone());
1555+ }
1556+ }
1557+ let expected: BTreeSet<String> = ["decode_intra_rect_in_inter", "read_sb128_root"]
1558+ .iter()
1559+ .map(|s| s.to_string())
1560+ .collect();
1561+ assert_eq!(
1562+ callers, expected,
1563+ "the set of functions that call decode_block_rect64 changed -- re-derive the \
1564+ strip domain below from the new caller (a 128-sided or sub-8 caller makes the \
1565+ refusal live)"
1566+ );
1567+
1568+ // (2) The unit derivation, asserted against its own source before it
1569+ // is applied: chroma shape = the strip halved by the plane's
1570+ // subsampling; unit = each axis capped at 32.
1571+ let body_at = src
1572+ .find("fn decode_block_rect64(")
1573+ .expect("decode_block_rect64 is gone");
1574+ let rest = &src[body_at..];
1575+ let body = &rest[..rest.find("\nfn ").expect("unterminated fn")];
1576+ assert!(
1577+ body.contains("(bw >> ss_x(fctx), bh >> ss_y(fctx))"),
1578+ "decode_block_rect64's chroma shape is no longer the strip halved by the \
1579+ plane's subsampling -- re-derive this enumeration"
1580+ );
1581+ const CAP: &str = "let (uw, uh) = (chroma_w.min(32), chroma_h.min(32));";
1582+ assert_eq!(
1583+ src.matches(CAP).count(),
1584+ 1,
1585+ "the 32-per-axis chroma unit cap is no longer spelled the way this enumeration \
1586+ mirrors it"
1587+ );
1588+
1589+ // (3) The table, read out of the match that follows the cap.
1590+ let from = body.find(CAP).expect("cap is outside decode_block_rect64");
1591+ let to = body
1592+ .find("a 64-axis strip whose chroma unit has no coefficient table")
1593+ .expect("the refusal string is gone from decode_block_rect64");
1594+ let table = &body[from..to];
1595+ let mut arms: BTreeSet<(usize, usize)> = BTreeSet::new();
1596+ let bytes = table.as_bytes();
1597+ for (i, _) in table.match_indices('(') {
1598+ let mut j = i + 1;
1599+ let mut w = 0usize;
1600+ while j < bytes.len() && bytes[j].is_ascii_digit() {
1601+ w = w * 10 + usize::from(bytes[j] - b'0');
1602+ j += 1;
1603+ }
1604+ if j == i + 1 || !table[j..].starts_with(", ") {
1605+ continue;
1606+ }
1607+ j += 2;
1608+ let mut h = 0usize;
1609+ let start_h = j;
1610+ while j < bytes.len() && bytes[j].is_ascii_digit() {
1611+ h = h * 10 + usize::from(bytes[j] - b'0');
1612+ j += 1;
1613+ }
1614+ if j == start_h || !table[j..].starts_with(") =>") {
1615+ continue;
1616+ }
1617+ // Only an arm HEAD counts, never a `(32, 8)` inside prose.
1618+ arms.insert((w, h));
1619+ }
1620+ let handled: BTreeSet<(usize, usize)> = [(32, 32), (32, 16), (16, 32), (32, 8), (8, 32)]
1621+ .into_iter()
1622+ .collect();
1623+ assert_eq!(
1624+ arms, handled,
1625+ "decode_block_rect64's chroma-unit table changed -- re-derive the enumeration \
1626+ (a unit outside these five arms makes the refusal live for some strip)"
1627+ );
1628+
1629+ // (4) The enumeration: every 64-axis 2:1 and 1:4 strip (the shapes
1630+ // superblock partitioning presents at the 64 level) x every supported
1631+ // chroma format lands on a handled arm.
1632+ let mut checked = 0u32;
1633+ let mut hit: BTreeSet<(usize, usize)> = BTreeSet::new();
1634+ for wl in 4..=6u32 {
1635+ for hl in 4..=6u32 {
1636+ let (bw, bh) = (1usize << wl, 1usize << hl);
1637+ if bw.max(bh) != 64 {
1638+ continue;
1639+ }
1640+ let ratio = bw.max(bh) / bw.min(bh);
1641+ if ratio != 2 && ratio != 4 {
1642+ continue;
1643+ }
1644+ // (ss_x, ss_y): (0, 0) is 4:4:4, (1, 1) is 4:2:0. The mixed
1645+ // formats are refused by name at the sequence header.
1646+ for (ss_x, ss_y) in [(0usize, 0usize), (1, 1)] {
1647+ let (chroma_w, chroma_h) = (bw >> ss_x, bh >> ss_y);
1648+ let unit = (chroma_w.min(32), chroma_h.min(32));
1649+ assert!(
1650+ arms.contains(&unit),
1651+ "a {bw}x{bh} strip at subsampling ({ss_x},{ss_y}) resolves to the \
1652+ chroma unit {unit:?}, which has no coefficient table -- the \
1653+ refusal is LIVE for a conformant stream"
1654+ );
1655+ hit.insert(unit);
1656+ checked += 1;
1657+ }
1658+ }
1659+ }
1660+ assert_eq!(
1661+ checked, 8,
1662+ "the strip domain is not the four 64-axis strips x two supported formats"
1663+ );
1664+ assert_eq!(
1665+ hit, handled,
1666+ "the enumeration stopped exercising every arm -- the proof went vacuous"
1667+ );
1668+ }
1669+
14751670 /// lane-t900 r33, ENUMERATION for "CfL, filter intra or a palette on a
14761671 /// 128-root HORZ/VERT intra block".
14771672 ///
crates/ec-av1/src/stream.rsmodified+1220 -0
@@ -126,6 +126,23 @@ pub fn rect_intrabc_reads() -> usize {
126126 crate::decode::rect_intrabc_reads()
127127 }
128128
129+/// lane-av1-ibc444rect: unskipped intrabc 8x4/4x8 leaves whose luma a lossless
130+/// frame walked as per-4x4 inter units.
131+pub fn intrabc_rect8_lossless_luma_hits() -> usize {
132+ crate::decode::intrabc_rect8_lossless_luma_hits()
133+}
134+
135+/// lane-av1-ibc444rect: unskipped intrabc 8x4/4x8 leaves whose chroma a
136+/// lossless 4:4:4 frame walked as per-4x4 `Chroma4` units.
137+pub fn intrabc_rect8_lossless_chroma_hits() -> usize {
138+ crate::decode::intrabc_rect8_lossless_chroma_hits()
139+}
140+
141+/// Gate-side reset for the lane-av1-ibc444rect counters above.
142+pub fn reset_ibc444rect_hits() {
143+ crate::decode::reset_ibc444rect_hits()
144+}
145+
129146 /// `(y, uv)` palette blocks RECONSTRUCTED inside an inter frame (lane-t900
130147 /// r22) -- the counter a screen-content witness gate reads to prove it
131148 /// exercises the inter-frame palette path, not the key frame's.
@@ -2209,6 +2226,62 @@ pub(crate) mod tests {
22092226 let frames = decode_stream(&stream).expect("the 4:2:0 control must decode");
22102227 assert_eq!(frames.len(), 1, "{NAME}: the 4:2:0 control decoded no frame");
22112228 }
2229+ /// lane-av1-422bigblock: the two witnessed 4:2:2 big-block defects, pinned
2230+ /// as fixtures (`git add -f`; `fixtures/` is gitignored).
2231+ ///
2232+ /// `422_allskip_2f.obu` (62 bytes) is a 128x128 profile-2 key frame plus
2233+ /// its all-skip first inter frame: the pre-port decoder read phantom
2234+ /// coefficient units in the inter frame and then panicked in
2235+ /// `reconstruct_mc_rect` on a full-height 4:2:2 chroma rect. At this
2236+ /// lane's HEAD the block-half port's per-axis plane-block model already
2237+ /// has it entropy-locked (all 20 key-frame coefficient units pair
2238+ /// rng-for-rng with the instrumented oracle, the inter frame reads
2239+ /// zero, matching the oracle) and pixel-exact vs aomdec.
2240+ ///
2241+ /// `422_sb128_3f.obu` (12543 bytes) carries the f2 128x128
2242+ /// `PARTITION_NONE` non-skip inter block: the mu-chunk chroma walk cut
2243+ /// each chunk's 32x64 chroma into a `chroma_side`-square 64x64 (twice
2244+ /// the units the oracle codes), indexed the prediction buffer at the
2245+ /// square `chroma_side` instead of `chroma_stride` (the empty-slice
2246+ /// panic at `push_mc_rect_tx`'s densify), and the reference plane
2247+ /// resolution guessed every non-4:4:4 picture quarter-height, so the
2248+ /// bottom mu-chunk row predicted from a clamped row-63 edge. All fixed;
2249+ /// both witnesses decode pixel-exact vs aomdec on the lane's local
2250+ /// `EC_AV1_ALLOW_422_PROBE` patch-run-restore build (recipe and measured
2251+ /// numbers in `lanes/av1422bigblock.report.md`).
2252+ ///
2253+ /// `decode_stream` itself still refuses 4:2:2 at the sequence header --
2254+ /// unconditionally, per the standing family rule -- so the committed
2255+ /// assertion is the byte pin (fnv1a64, the same load-bearing-identity
2256+ /// fingerprint as the cdf-forwarding gate) plus the refusal-by-name
2257+ /// contract over the pinned bytes.
2258+ #[test]
2259+ fn the_pinned_422_bigblock_witnesses_are_present_and_refuse_by_name() {
2260+ const NAME: &str = "the_pinned_422_bigblock_witnesses_are_present_and_refuse_by_name";
2261+ const REFUSAL: &str = "a chroma format of 4:2:2";
2262+ for (file, bytes, fp) in [
2263+ ("422_allskip_2f.obu", 62usize, 0x7e4d69d3c728c55f_u64),
2264+ ("422_sb128_3f.obu", 12543, 0x5171e0aab8000da7),
2265+ ] {
2266+ let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
2267+ .join("fixtures")
2268+ .join(file);
2269+ let data = std::fs::read(&path).unwrap_or_else(|e| {
2270+ panic!(
2271+ "{NAME}: pinned witness {} is missing ({e}) -- the gate cannot run",
2272+ path.display()
2273+ )
2274+ });
2275+ assert_eq!(data.len(), bytes, "{NAME}: {file} size drifted");
2276+ assert_eq!(fnv1a64(&data), fp, "{NAME}: {file} bytes drifted");
2277+ let err = decode_stream(&data).unwrap_err().to_string();
2278+ assert!(
2279+ err.contains(REFUSAL),
2280+ "{NAME}: {file} must refuse by name, got: {err}"
2281+ );
2282+ }
2283+ }
2284+
22122285
22132286 /// lane-av1-qmatrix: WITNESS for the lifted `using_qmatrix` refusal (the
22142287 /// old gate `a_frame_using_quantisation_matrices_is_refused_by_name` is
@@ -5399,6 +5472,889 @@ pub(crate) mod tests {
53995472 }
54005473 }
54015474
5475+ /// lane-av1-llband: the pinned 4:4:4 LOSSLESS key frame
5476+ /// (`fixtures/ll444-lossless-key.obu`, the `ll444` recipe's frame 0 --
5477+ /// `testsrc2 128x96` yuv444p cut to its key frame) decodes sample-exact,
5478+ /// and its HORZ/VERT strips really walked their chroma as 4x4 units at
5479+ /// subsampling 0/0 (one unit per mi cell). That unit walk used the 4:2:0
5480+ /// span (8 luma px per 4x4 chroma unit) unconditionally, so every unit
5481+ /// past the first column/row read its `txb_skip` context two mi cells
5482+ /// over and stamped a 2-cell smear -- the 178-byte key-frame miss, first
5483+ /// divergence at the 16x8 leaf mi (16,24)'s U bc=2 unit (oracle
5484+ /// `txb_skip` base 0 off `above[26]`, ours base 1 off the polluted
5485+ /// `above[29]`). The counter assertion is the non-vacuity half (class
5486+ /// `gate-blind-to-feature`): a stream that never reaches the 4:4:4 unit
5487+ /// walk must not pass.
5488+ #[test]
5489+ fn a_real_aomenc_lossless_444_key_frame_decodes_sample_exact() {
5490+ const NAME: &str = "a_real_aomenc_lossless_444_key_frame_decodes_sample_exact";
5491+ if !have_ffmpeg() {
5492+ eprintln!("SKIP {NAME}: no ffmpeg");
5493+ return;
5494+ }
5495+ let Ok(stream) = std::fs::read(pin_dir().join("ll444-lossless-key.obu")) else {
5496+ eprintln!(
5497+ "SKIP {NAME}: no pinned bytes at {} -- regenerate with \
5498+ `testsrc2 128x96` yuv444p 6 frames, aomenc --profile=1 --lossless=1 \
5499+ --enable-palette=0 --enable-intrabc=0, cut to the key frame's OBUs",
5500+ pin_dir().join("ll444-lossless-key.obu").display()
5501+ );
5502+ return;
5503+ };
5504+ // Blindness guard: the pinned fixture must really be a lossless frame.
5505+ let mut parser = Av1Parser::new();
5506+ let mut pos = 0usize;
5507+ let mut lossless = false;
5508+ while pos < stream.len() {
5509+ let obu = parser.parse_obu(&stream[pos..]).expect("aomenc OBU parses");
5510+ pos += obu.total_size.max(1);
5511+ if let ObuKind::FrameHeader(h) | ObuKind::Frame(h, _) = obu.kind {
5512+ lossless = h.lossless.iter().all(|&l| l);
5513+ }
5514+ }
5515+ assert!(lossless, "{NAME} went blind: the pinned frame is not lossless");
5516+ let before = crate::decode::rect_split_lossless_chroma444_hits();
5517+ let ours = decode_stream(&stream).expect("a 444 lossless key-frame stream decodes");
5518+ assert_eq!(ours.len(), 1, "{NAME}: frame count");
5519+ assert!(
5520+ crate::decode::rect_split_lossless_chroma444_hits() > before,
5521+ "{NAME} went blind: no lossless HORZ/VERT strip walked its chroma \
5522+ as 4x4 units at subsampling 0/0"
5523+ );
5524+ let refs = Command::new("ffmpeg")
5525+ .args(["-v", "error", "-f", "obu", "-i", "-", "-f", "rawvideo", "-pix_fmt", "yuv444p", "-"])
5526+ .stdin(Stdio::piped())
5527+ .stdout(Stdio::piped())
5528+ .stderr(Stdio::piped())
5529+ .spawn()
5530+ .and_then(|mut child| {
5531+ use std::io::Write as _;
5532+ child.stdin.as_mut().expect("stdin").write_all(&stream)?;
5533+ child.wait_with_output()
5534+ })
5535+ .expect("ffmpeg 444 decode failed");
5536+ assert!(refs.status.success(), "{}", String::from_utf8_lossy(&refs.stderr));
5537+ let frame = &ours[0];
5538+ let planes = [
5539+ (&frame.y, frame.width * frame.height),
5540+ (&frame.u, frame.width * frame.height),
5541+ (&frame.v, frame.width * frame.height),
5542+ ];
5543+ let mut off = 0usize;
5544+ for (plane, (g, len)) in planes.iter().enumerate() {
5545+ let raw = &refs.stdout[off..off + len];
5546+ let bad = g.iter().zip(raw.iter()).filter(|&(&a, &b)| a != u16::from(b)).count();
5547+ assert_eq!(bad, 0, "{NAME}: plane {plane}: {bad} samples differ");
5548+ off += len;
5549+ }
5550+ }
5551+
5552+ /// As [`ffmpeg_decode_sequence`], for a 4:4:4 stream: chroma planes are
5553+ /// FULL resolution (`yuv444p` rawvideo), the shape lane-av1-llinter's
5554+ /// lossless profile-1 fixture codes.
5555+ fn ffmpeg_decode_sequence_444(
5556+ stream: &[u8],
5557+ width: usize,
5558+ height: usize,
5559+ frames: usize,
5560+ ) -> Vec<Pic> {
5561+ let out = run_with_stdin(
5562+ Command::new("ffmpeg").args([
5563+ "-v", "error", "-f", "obu", "-i", "-", "-f", "rawvideo", "-pix_fmt", "yuv444p", "-",
5564+ ]),
5565+ stream,
5566+ );
5567+ assert!(
5568+ out.status.success(),
5569+ "ffmpeg refused the 4:4:4 stream: {}",
5570+ String::from_utf8_lossy(&out.stderr)
5571+ );
5572+ let plane = width * height;
5573+ let frame_bytes = 3 * plane;
5574+ assert_eq!(
5575+ out.stdout.len(),
5576+ frame_bytes * frames,
5577+ "expected {frames} 4:4:4 frames, ffmpeg said: {}",
5578+ String::from_utf8_lossy(&out.stderr)
5579+ );
5580+ (0..frames)
5581+ .map(|i| {
5582+ let base = i * frame_bytes;
5583+ Pic {
5584+ width,
5585+ height,
5586+ y: out.stdout[base..base + plane].iter().map(|&v| u16::from(v)).collect(),
5587+ u: out.stdout[base + plane..base + 2 * plane].iter().map(|&v| u16::from(v)).collect(),
5588+ v: out.stdout[base + 2 * plane..base + 3 * plane].iter().map(|&v| u16::from(v)).collect(),
5589+ }
5590+ })
5591+ .collect()
5592+ }
5593+
5594+ /// lane-av1-llinter: the firing gate for the lossless 4:4:4 INTER chroma
5595+ /// fix. The fixture is the report's dodge2 stream pinned into `fixtures/`:
5596+ /// aomenc profile 1 over testsrc2 128x96 yuv444p, `--lossless=1`,
5597+ /// `--sb-size=64 --min-partition-size=64 --max-partition-size=64`, 6
5598+ /// frames; 37658 bytes, sha256
5599+ /// `5a070fa351a3f2109de855234f2b3d0a872970f3e7f658db21f65c12eeb135b4`.
5600+ /// The firing counter is the EXISTING `decode::chroma_split_tx_hits` (one
5601+ /// bump per lossless chroma TX unit read): with min=max partition 64 the
5602+ /// roots stay whole 64x64 inter blocks -- no 8x8 leaf exists in this
5603+ /// stream -- so every chroma unit goes through the big-block ss-aware
5604+ /// lossless route this lane fixed (fixes 2-5). A 4:2:0 lossless stream
5605+ /// fires the same counter, but the fixture bytes are pinned, so the gate
5606+ /// cannot run on anything else; the pre-fix 4:2:0-hardcoded math corrupts
5607+ /// at 4:4:4, so the pixel-exact compares are what prove the ss-aware path
5608+ /// (class `gate-blind-to-feature`). Every frame must come out pixel-exact
5609+ /// through BOTH the oracle `aomdec --rawvideo` and ffmpeg. The
5610+ /// default-partition ll444 stream is deliberately NOT claimed here: its
5611+ /// key frame is still the intra lane's named sub8-chroma stop
5612+ /// (lanes/av1llintra.report.md).
5613+ #[test]
5614+ fn a_lossless_444_min_partition64_inter_stream_decodes_pixel_exact() {
5615+ const NAME: &str = "a_lossless_444_min_partition64_inter_stream_decodes_pixel_exact";
5616+ const FIXTURE_LEN: usize = 37658;
5617+ const FIXTURE_FNV: u64 = 0xf68d_c26f_a14d_283c;
5618+ const W: usize = 128;
5619+ const H: usize = 96;
5620+ const FRAMES: usize = 6;
5621+ let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
5622+ .join("fixtures/ll444_minp64_inter.obu");
5623+ let stream = std::fs::read(&obu).unwrap_or_else(|e| {
5624+ panic!(
5625+ "{NAME}: pinned fixture {} is missing ({e}) -- the gate cannot run, \
5626+ which is a failure, not a skip",
5627+ obu.display()
5628+ )
5629+ });
5630+ assert_eq!(stream.len(), FIXTURE_LEN, "{NAME}: fixture length moved");
5631+ assert_eq!(fnv1a64(&stream), FIXTURE_FNV, "{NAME}: fixture bytes moved");
5632+
5633+ let _guard = lock_gate_counters();
5634+ let before = crate::decode::chroma_split_tx_hits();
5635+ let frames = decode_stream(&stream).unwrap_or_else(|e| {
5636+ panic!("{NAME}: the pinned stream no longer decodes cleanly: {e}")
5637+ });
5638+ let hits = crate::decode::chroma_split_tx_hits();
5639+ assert!(
5640+ hits > before,
5641+ "{NAME}: gate is vacuous -- no lossless chroma TX unit was read \
5642+ (delta {before} -> {hits})"
5643+ );
5644+ assert_eq!(frames.len(), FRAMES, "{NAME}: frame count");
5645+ for f in &frames {
5646+ assert_eq!((f.width, f.height), (W, H), "{NAME}: dimensions");
5647+ }
5648+
5649+ // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames.
5650+ if aomdec_path().is_file() {
5651+ let dir = std::env::temp_dir().join(format!("ec-av1-ll444-{}", std::process::id()));
5652+ let _ = std::fs::remove_dir_all(&dir);
5653+ std::fs::create_dir_all(&dir).expect("scratch dir");
5654+ let raw = dir.join("aomdec.raw");
5655+ let out = Command::new(aomdec_path())
5656+ .args(["--codec=av1", "--rawvideo", "-o"])
5657+ .arg(&raw)
5658+ .arg(&obu)
5659+ .stdin(Stdio::null())
5660+ .stdout(Stdio::piped())
5661+ .stderr(Stdio::piped())
5662+ .output()
5663+ .expect("aomdec failed to run");
5664+ assert!(
5665+ out.status.success(),
5666+ "{NAME}: the oracle aomdec refused the stream: {}",
5667+ String::from_utf8_lossy(&out.stderr)
5668+ );
5669+ let ref_raw = std::fs::read(&raw).expect("aomdec rawvideo output");
5670+ let _ = std::fs::remove_dir_all(&dir);
5671+ assert_eq!(ref_raw.len(), W * H * 3 * FRAMES, "{NAME}: aomdec raw size");
5672+ for (i, f) in frames.iter().enumerate() {
5673+ let base = i * W * H * 3;
5674+ for ((plane, off), p) in [(&f.y, 0usize), (&f.u, W * H), (&f.v, 2 * W * H)]
5675+ .into_iter()
5676+ .zip(["y", "u", "v"])
5677+ {
5678+ let want = &ref_raw[base + off..base + off + W * H];
5679+ let bad = plane.iter().zip(want).filter(|&(&a, &b)| a as u8 != b).count();
5680+ assert_eq!(bad, 0, "{NAME}: aomdec frame {i} plane {p}: {bad} samples differ");
5681+ }
5682+ }
5683+ } else {
5684+ eprintln!("SKIP {NAME} aomdec arm: no oracle aomdec at {}", aomdec_path().display());
5685+ }
5686+
5687+ // ffmpeg's decoder: same frames, full-resolution chroma.
5688+ if have_ffmpeg() {
5689+ let refs = ffmpeg_decode_sequence_444(&stream, W, H, FRAMES);
5690+ for (i, (got, want)) in frames.iter().zip(refs.iter()).enumerate() {
5691+ for (p, (g, r)) in [(&got.y, &want.y), (&got.u, &want.u), (&got.v, &want.v)]
5692+ .iter()
5693+ .enumerate()
5694+ {
5695+ let bad = g.iter().zip(r.iter()).filter(|(a, b)| a != b).count();
5696+ assert_eq!(bad, 0, "{NAME}: ffmpeg frame {i} plane {p}: {bad} samples differ");
5697+ }
5698+ }
5699+ } else {
5700+ eprintln!("SKIP {NAME} ffmpeg arm: no ffmpeg");
5701+ }
5702+ }
5703+
5704+ /// lane-av1llpredgate2: the debug-exact pin for the ss-aware
5705+ /// `obmc_skip_chroma_above` decision (lane-av1-llpred2). Fixture is the
5706+ /// llpred/llpred2 reports' stream pinned into `fixtures/`: testsrc2
5707+ /// 128x96 yuv444p, aomenc `--profile=1 --lossless=1 --enable-palette=0
5708+ /// --enable-intrabc=0 --min-partition-size=8 --max-partition-size=64`,
5709+ /// 6 frames; 34037 bytes, sha256
5710+ /// `04fb6d38de5382e647bfb70b6a17802f1fccc5502e6698c0394167891f2b27dc`.
5711+ ///
5712+ /// This is a DEBUG-build path by construction: the old ratio-based ss
5713+ /// derivation read `write_h >> trailing_zeros(0)` = `>> 64` on this
5714+ /// stream's 4:4:4 OBMC rect strips, a panic ONLY under
5715+ /// debug_assertions (release wraps and was already byte-exact), so
5716+ /// `cargo test`'s default dev profile is the profile where the defect
5717+ /// class reproduces and where the parent's byte-exact proof was
5718+ /// measured.
5719+ ///
5720+ /// No skip-arm counter gate is possible on this stream, measured:
5721+ /// OBMC runs 77 times with 20 rect leaves, but
5722+ /// `obmc_skip_chroma_above` returns true 0 times -- at 4:4:4 the skip
5723+ /// needs a 4x4/8x4/4x8 PLANE block and min-partition-8 never codes one.
5724+ /// So per the lane ticket the proof splits in two: the decision TABLE
5725+ /// (4:2:0 rect strips still skip, 4:4:4 shifts never leave `usize`)
5726+ /// stays pinned by `decode::obmc_skip_chroma_tests::
5727+ /// rect_strips_skip_above_chroma_at_420_and_shift_never_overflows`,
5728+ /// and THIS stream gate pins the end-to-end behaviour -- every sample
5729+ /// of every frame must match the oracle aomdec exactly, so a returning
5730+ /// chroma diff (the lane-av1-llpred ss-blind re-blend class
5731+ /// `obmc-ss-blind-chroma-above`) or the debug shift panic goes red
5732+ /// here by name.
5733+ #[test]
5734+ fn a_lossless_444_min_partition8_inter_stream_decodes_sample_exact() {
5735+ const NAME: &str = "a_lossless_444_min_partition8_inter_stream_decodes_sample_exact";
5736+ const FIXTURE_LEN: usize = 34037;
5737+ const FIXTURE_FNV: u64 = 0x2c8f_4a2c_c025_52da;
5738+ const W: usize = 128;
5739+ const H: usize = 96;
5740+ const FRAMES: usize = 6;
5741+ let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
5742+ .join("fixtures/ll444_minp8_inter.obu");
5743+ let stream = std::fs::read(&obu).unwrap_or_else(|e| {
5744+ panic!(
5745+ "{NAME}: pinned fixture {} is missing ({e}) -- the gate cannot run, \
5746+ which is a failure, not a skip",
5747+ obu.display()
5748+ )
5749+ });
5750+ assert_eq!(stream.len(), FIXTURE_LEN, "{NAME}: fixture length moved");
5751+ assert_eq!(fnv1a64(&stream), FIXTURE_FNV, "{NAME}: fixture bytes moved");
5752+
5753+ let _guard = lock_gate_counters();
5754+ let frames = decode_stream(&stream).unwrap_or_else(|e| {
5755+ panic!("{NAME}: the pinned stream no longer decodes cleanly: {e}")
5756+ });
5757+ assert_eq!(frames.len(), FRAMES, "{NAME}: frame count");
5758+ for f in &frames {
5759+ assert_eq!((f.width, f.height), (W, H), "{NAME}: dimensions");
5760+ }
5761+
5762+ // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames.
5763+ if aomdec_path().is_file() {
5764+ let dir = std::env::temp_dir().join(format!("ec-av1-llminp8-{}", std::process::id()));
5765+ let _ = std::fs::remove_dir_all(&dir);
5766+ std::fs::create_dir_all(&dir).expect("scratch dir");
5767+ let raw = dir.join("aomdec.raw");
5768+ let out = Command::new(aomdec_path())
5769+ .args(["--codec=av1", "--rawvideo", "-o"])
5770+ .arg(&raw)
5771+ .arg(&obu)
5772+ .stdin(Stdio::null())
5773+ .stdout(Stdio::piped())
5774+ .stderr(Stdio::piped())
5775+ .output()
5776+ .expect("aomdec failed to run");
5777+ assert!(
5778+ out.status.success(),
5779+ "{NAME}: the oracle aomdec refused the stream: {}",
5780+ String::from_utf8_lossy(&out.stderr)
5781+ );
5782+ let ref_raw = std::fs::read(&raw).expect("aomdec rawvideo output");
5783+ let _ = std::fs::remove_dir_all(&dir);
5784+ assert_eq!(ref_raw.len(), W * H * 3 * FRAMES, "{NAME}: aomdec raw size");
5785+ for (i, f) in frames.iter().enumerate() {
5786+ let base = i * W * H * 3;
5787+ for ((plane, off), p) in [(&f.y, 0usize), (&f.u, W * H), (&f.v, 2 * W * H)]
5788+ .into_iter()
5789+ .zip(["y", "u", "v"])
5790+ {
5791+ let want = &ref_raw[base + off..base + off + W * H];
5792+ let bad = plane.iter().zip(want).filter(|&(&a, &b)| a as u8 != b).count();
5793+ assert_eq!(
5794+ bad, 0,
5795+ "{NAME}: aomdec frame {i} plane {p}: {bad} samples differ \
5796+ (class obmc-ss-blind-chroma-above)"
5797+ );
5798+ }
5799+ }
5800+ } else {
5801+ eprintln!("SKIP {NAME} aomdec arm: no oracle aomdec at {}", aomdec_path().display());
5802+ }
5803+
5804+ // ffmpeg's decoder: same frames, full-resolution chroma.
5805+ if have_ffmpeg() {
5806+ let refs = ffmpeg_decode_sequence_444(&stream, W, H, FRAMES);
5807+ for (i, (got, want)) in frames.iter().zip(refs.iter()).enumerate() {
5808+ for (p, (g, r)) in [(&got.y, &want.y), (&got.u, &want.u), (&got.v, &want.v)]
5809+ .iter()
5810+ .enumerate()
5811+ {
5812+ let bad = g.iter().zip(r.iter()).filter(|(a, b)| a != b).count();
5813+ assert_eq!(bad, 0, "{NAME}: ffmpeg frame {i} plane {p}: {bad} samples differ");
5814+ }
5815+ }
5816+ } else {
5817+ eprintln!("SKIP {NAME} ffmpeg arm: no ffmpeg");
5818+ }
5819+ }
5820+
5821+ /// lane-av1-444sb: the byte-exact pin for the ss-aware 128-rect chroma
5822+ /// unit walk (`decode_block_128rect`). The parent walk hardcoded the
5823+ /// 4:2:0 mu-chunk span -- one 32x32 chroma unit per 64x64 chunk, chunk
5824+ /// offsets `*32`, clip step `*8` -- so at 4:4:4 a 128-root HORZ/VERT
5825+ /// intra block coded HALF its chroma units, left the remaining units'
5826+ /// coefficients unread and desynced the tile from the first such block
5827+ /// on; every superblock after SB(0,0) carried damage and the chroma
5828+ /// first-diffs sat on the 64/128 grid.
5829+ ///
5830+ /// `crates/ec-av1/fixtures/444_sb128rect_lr_witness.obu`, 794 bytes,
5831+ /// sha256
5832+ /// `27825e14633a4b23e37d48a2acdc7f5d814ca4fadd0b8797d72a1ffb34061e80`:
5833+ /// `ffmpeg -i bands444.y4m -frames:v 3 -vf scale=192:160 -pix_fmt
5834+ /// yuv444p -f yuv4mpegpipe` piped to `aomenc --codec=av1 --profile=1
5835+ /// --passes=1 --end-usage=q --cq-level=32 --cpu-used=0 --threads=1
5836+ /// --row-mt=0 --sb-size=128 --lag-in-frames=0 --auto-alt-ref=0
5837+ /// --kf-max-dist=1000 --i444 --enable-restoration=1 --obu --limit=3`.
5838+ /// Real content is required: the synthetic lavfi sources this lane swept
5839+ /// (testsrc2/testsrc/smptebars/mandelbrot/gradients) all decode frame 0
5840+ /// exact because they never force a 128-root rect; bands does (kf
5841+ /// PARTITION_VERT 64x128 at mi(0,32) plus an intra-in-inter 64x128).
5842+ ///
5843+ /// Non-vacuity via the `decode::intra_sb128_hits` delta: a stream that
5844+ /// stopped coding 128-axis intra blocks reads 0 and the gate fails
5845+ /// instead of passing over a decode that never reached the fixed body
5846+ /// (class `gate-blind-to-feature`). The oracle arms pin every sample of
5847+ /// every frame against both aomdec and ffmpeg, so a returning chroma
5848+ /// span regression goes red here by name.
5849+ #[test]
5850+ fn a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact() {
5851+ const NAME: &str = "a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact";
5852+ const FIXTURE_LEN: usize = 794;
5853+ const FIXTURE_FNV: u64 = 0xf5a7_27f4_3fa7_abc3;
5854+ const W: usize = 192;
5855+ const H: usize = 160;
5856+ const FRAMES: usize = 3;
5857+ let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
5858+ .join("fixtures/444_sb128rect_lr_witness.obu");
5859+ let stream = std::fs::read(&obu).unwrap_or_else(|e| {
5860+ panic!(
5861+ "{NAME}: pinned fixture {} is missing ({e}) -- the gate cannot run, \
5862+ which is a failure, not a skip",
5863+ obu.display()
5864+ )
5865+ });
5866+ assert_eq!(stream.len(), FIXTURE_LEN, "{NAME}: fixture length moved");
5867+ assert_eq!(fnv1a64(&stream), FIXTURE_FNV, "{NAME}: fixture bytes moved");
5868+
5869+ let _guard = lock_gate_counters();
5870+ let before = crate::decode::intra_sb128_hits();
5871+ let frames = decode_stream(&stream).unwrap_or_else(|e| {
5872+ panic!("{NAME}: the pinned stream no longer decodes cleanly: {e}")
5873+ });
5874+ let (horz, vert, _) = crate::decode::intra_sb128_hits();
5875+ assert!(
5876+ horz - before.0 + (vert - before.1) > 0,
5877+ "{NAME}: this stream coded NO 128-axis intra block -- the fixed body \
5878+ never ran (class gate-blind-to-feature)"
5879+ );
5880+ assert_eq!(frames.len(), FRAMES, "{NAME}: frame count");
5881+ for f in &frames {
5882+ assert_eq!((f.width, f.height), (W, H), "{NAME}: dimensions");
5883+ }
5884+ // All three frames are pinned byte-exact against both oracles (the
5885+ // aomdec/ffmpeg arms below run over `.take(3)`): frame 0's keyframe
5886+ // PARTITION_VERT 64x128, frame 1's inter pieces, and frame 2 -- whose
5887+ // right superblock column (the 128-root VERT piece at the frame edge)
5888+ // is three intra blocks (64x64, 64x32, 64x32) whose chroma units ride
5889+ // the inter-frame intra tail. That tail read ONE whole-plane chroma
5890+ // unit with the block-level context where 4:4:4 codes four
5891+ // plane-major TX_32X32 units with per-unit contexts and the
5892+ // offset-10 `get_txb_ctx` rows, which left three quarters of the
5893+ // planes' residual unread and misaligned the symbol stream from the
5894+ // first chroma unit on (f2 PREFILT Y 6952 / U 9568 / V 13496, first
5895+ // diffs entering at column 128). Fixed on lane-av1-rect128recon;
5896+ // the earlier "LR never restores RU row 0" attribution on this frame
5897+ // was a stage-ladder mixup, refuted in lane-av1lrflush r3.
5898+
5899+ // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames.
5900+ if aomdec_path().is_file() {
5901+ let dir =
5902+ std::env::temp_dir().join(format!("ec-av1-444sb-{}", std::process::id()));
5903+ let _ = std::fs::remove_dir_all(&dir);
5904+ std::fs::create_dir_all(&dir).expect("scratch dir");
5905+ let raw = dir.join("aomdec.raw");
5906+ let out = Command::new(aomdec_path())
5907+ .args(["--codec=av1", "--rawvideo", "-o"])
5908+ .arg(&raw)
5909+ .arg(&obu)
5910+ .stdin(Stdio::null())
5911+ .stdout(Stdio::piped())
5912+ .stderr(Stdio::piped())
5913+ .output()
5914+ .expect("aomdec failed to run");
5915+ assert!(
5916+ out.status.success(),
5917+ "{NAME}: the oracle aomdec refused the stream: {}",
5918+ String::from_utf8_lossy(&out.stderr)
5919+ );
5920+ let ref_raw = std::fs::read(&raw).expect("aomdec rawvideo output");
5921+ let _ = std::fs::remove_dir_all(&dir);
5922+ assert_eq!(ref_raw.len(), W * H * 3 * FRAMES, "{NAME}: aomdec raw size");
5923+ for (i, f) in frames.iter().enumerate().take(3) {
5924+ let base = i * W * H * 3;
5925+ for ((plane, off), p) in
5926+ [(&f.y, 0usize), (&f.u, W * H), (&f.v, 2 * W * H)]
5927+ .into_iter()
5928+ .zip(["y", "u", "v"])
5929+ {
5930+ let want = &ref_raw[base + off..base + off + W * H];
5931+ let bad =
5932+ plane.iter().zip(want).filter(|&(&a, &b)| a as u8 != b).count();
5933+ assert_eq!(
5934+ bad, 0,
5935+ "{NAME}: aomdec frame {i} plane {p}: {bad} samples differ \
5936+ (class 444-128rect-chroma-span)"
5937+ );
5938+ }
5939+ }
5940+ } else {
5941+ eprintln!("SKIP {NAME} aomdec arm: no oracle aomdec at {}", aomdec_path().display());
5942+ }
5943+
5944+ // ffmpeg's decoder: same frames, full-resolution chroma. Same
5945+ // three-frame scope as the aomdec arm above.
5946+ if have_ffmpeg() {
5947+ let refs = ffmpeg_decode_sequence_444(&stream, W, H, FRAMES);
5948+ for (i, (got, want)) in frames.iter().zip(refs.iter()).enumerate().take(3) {
5949+ for (p, (g, r)) in
5950+ [(&got.y, &want.y), (&got.u, &want.u), (&got.v, &want.v)]
5951+ .iter()
5952+ .enumerate()
5953+ {
5954+ let bad = g.iter().zip(r.iter()).filter(|(a, b)| a != b).count();
5955+ assert_eq!(
5956+ bad, 0,
5957+ "{NAME}: ffmpeg frame {i} plane {p}: {bad} samples differ"
5958+ );
5959+ }
5960+ }
5961+ } else {
5962+ eprintln!("SKIP {NAME} ffmpeg arm: no ffmpeg");
5963+ }
5964+ }
5965+
5966+ /// lane-av1lrflush: the pipelined loop-restoration band release flushes
5967+ /// RU row 0 on the inter frame whose top superblock row carries a
5968+ /// 128-root rect -- the exact shape lanes/av1444sb.report.md r2 named as
5969+ /// its stop-with-site DEFECT 3 ("`pipe_run_lr`'s `rrows` branch plus the
5970+ /// `ls.note`/`ls.close` band release never flushes RU row 0 on frame 2").
5971+ /// r3 REFUTED that defect by measurement: on this fixture the filter
5972+ /// pipeline (deblock/CDEF/LR band workers over `ls.note` releases)
5973+ /// produces output byte-identical to the whole-frame path on every frame
5974+ /// -- this gate pins that refutation so a future band-accounting
5975+ /// regression on a 128-root-rect inter frame cannot land silently.
5976+ ///
5977+ /// Non-vacuity, twice over: the `PIPELINE_TAKEN` delta proves the second
5978+ /// decode really constructed the pipeline on both inter frames (frame 0
5979+ /// is a key frame and the key-frame path runs whole-frame filters by
5980+ /// construction), and the `LR_PIPELINE_ROW0` delta proves the pipeline's
5981+ /// band release itself flushed RU row 0 -- a process-global counter
5982+ /// bumped by `pipe_run_lr`'s worker, so frame 0's whole-frame LR (which
5983+ /// runs on the gate's own thread and satisfies the thread-local
5984+ /// `LR_STRIPE0_HITS`) cannot fake it. Frames 0/1 are additionally asserted
5985+ /// byte-exact against BOTH the oracle aomdec and ffmpeg THROUGH the
5986+ /// pipeline. (Frame 2's own residual is the entropy lane's inter
5987+ /// rect-strip recon defect -- see lanes/av1lrflush.report.md r3 -- and
5988+ /// is identical on the serial and pipelined runs, so the pipeline
5989+ /// equality covers it without pinning its wrong samples.)
5990+ #[test]
5991+ fn a_444_sb128_witness_lr_pipeline_flushes_ru_row_0_pixel_exact() {
5992+ const NAME: &str = "a_444_sb128_witness_lr_pipeline_flushes_ru_row_0_pixel_exact";
5993+ const FIXTURE_LEN: usize = 794;
5994+ const FIXTURE_FNV: u64 = 0xf5a7_27f4_3fa7_abc3;
5995+ const W: usize = 192;
5996+ const H: usize = 160;
5997+ const FRAMES: usize = 3;
5998+ /// The inter (pipelinable) frames of the witness; frame 0 is the key
5999+ /// frame and never constructs the pipeline.
6000+ const INTER_FRAMES: u64 = 2;
6001+ let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
6002+ .join("fixtures/444_sb128rect_lr_witness.obu");
6003+ let stream = std::fs::read(&obu).unwrap_or_else(|e| {
6004+ panic!(
6005+ "{NAME}: pinned fixture {} is missing ({e}) -- the gate cannot \
6006+ run, which is a failure, not a skip",
6007+ obu.display()
6008+ )
6009+ });
6010+ assert_eq!(stream.len(), FIXTURE_LEN, "{NAME}: fixture length moved");
6011+ assert_eq!(fnv1a64(&stream), FIXTURE_FNV, "{NAME}: fixture bytes moved");
6012+
6013+ let _guard = lock_gate_counters();
6014+ let serial = decode_stream(&stream)
6015+ .unwrap_or_else(|e| panic!("{NAME}: serial decode failed: {e}"));
6016+ assert_eq!(serial.len(), FRAMES, "{NAME}: frame count");
6017+
6018+ let pipe_before = crate::decode::pipeline_taken_frames();
6019+ let row0_before = crate::decode::lr_pipeline_row0_flushes();
6020+ let piped = {
6021+ let _bands = crate::par::override_filter_threads(4);
6022+ decode_stream(&stream)
6023+ .unwrap_or_else(|e| panic!("{NAME}: pipelined decode failed: {e}"))
6024+ };
6025+ assert_eq!(piped.len(), FRAMES, "{NAME}: frame count");
6026+ assert_eq!(
6027+ crate::decode::pipeline_taken_frames() - pipe_before,
6028+ INTER_FRAMES,
6029+ "{NAME}: the filter pipeline did not take both inter frames -- the \
6030+ arm decoded serial and proves nothing (class \
6031+ gate-blind-to-feature)"
6032+ );
6033+ // f1 restores all three planes, f2 all but U -> 3 + 2 row-0 flushes.
6034+ // `LR_PIPELINE_ROW0` is process-global and bumped by the pipeline's
6035+ // own worker, so this delta cannot be satisfied by frame 0's
6036+ // whole-frame LR (which runs on this test's thread and never touches
6037+ // the counter).
6038+ assert_eq!(
6039+ crate::decode::lr_pipeline_row0_flushes() - row0_before,
6040+ 5,
6041+ "{NAME}: the pipeline never flushed RU row 0 ({} planes' worth \
6042+ expected) -- the named defect class is present (class \
6043+ lr-band-release)",
6044+ 5
6045+ );
6046+
6047+ // The refutation itself: pipeline == serial, byte for byte, on every
6048+ // frame -- including frame 2, the 128-root-rect inter frame the
6049+ // r2 defect named.
6050+ for (i, (s, p)) in serial.iter().zip(piped.iter()).enumerate() {
6051+ for (pl, (a, b)) in
6052+ [(&s.y, &p.y), (&s.u, &p.u), (&s.v, &p.v)].into_iter().enumerate()
6053+ {
6054+ assert_eq!(
6055+ a, b,
6056+ "{NAME}: pipelined frame {i} plane {pl} differs from the \
6057+ whole-frame path (class lr-band-release)"
6058+ );
6059+ }
6060+ }
6061+
6062+ // Frames 0/1 through the PIPELINE, byte-exact vs both oracles.
6063+ if aomdec_path().is_file() {
6064+ let dir = std::env::temp_dir().join(format!("ec-av1-lrflush-{}", std::process::id()));
6065+ let _ = std::fs::remove_dir_all(&dir);
6066+ std::fs::create_dir_all(&dir).expect("scratch dir");
6067+ let raw = dir.join("aomdec.raw");
6068+ let out = Command::new(aomdec_path())
6069+ .args(["--codec=av1", "--rawvideo", "-o"])
6070+ .arg(&raw)
6071+ .arg(&obu)
6072+ .stdin(Stdio::null())
6073+ .stdout(Stdio::piped())
6074+ .stderr(Stdio::piped())
6075+ .output()
6076+ .expect("aomdec failed to run");
6077+ assert!(
6078+ out.status.success(),
6079+ "{NAME}: the oracle aomdec refused the stream: {}",
6080+ String::from_utf8_lossy(&out.stderr)
6081+ );
6082+ let ref_raw = std::fs::read(&raw).expect("aomdec rawvideo output");
6083+ let _ = std::fs::remove_dir_all(&dir);
6084+ assert_eq!(ref_raw.len(), W * H * 3 * FRAMES, "{NAME}: aomdec raw size");
6085+ for (i, f) in piped.iter().enumerate().take(2) {
6086+ let base = i * W * H * 3;
6087+ for ((plane, off), p) in
6088+ [(&f.y, 0usize), (&f.u, W * H), (&f.v, 2 * W * H)]
6089+ .into_iter()
6090+ .zip(["y", "u", "v"])
6091+ {
6092+ let want = &ref_raw[base + off..base + off + W * H];
6093+ let bad = plane.iter().zip(want).filter(|&(&a, &b)| a as u8 != b).count();
6094+ assert_eq!(
6095+ bad, 0,
6096+ "{NAME}: aomdec frame {i} plane {p} THROUGH THE PIPELINE: \
6097+ {bad} samples differ (class lr-band-release)"
6098+ );
6099+ }
6100+ }
6101+ } else {
6102+ eprintln!("SKIP {NAME} aomdec arm: no oracle aomdec at {}", aomdec_path().display());
6103+ }
6104+ if have_ffmpeg() {
6105+ let refs = ffmpeg_decode_sequence_444(&stream, W, H, FRAMES);
6106+ for (i, (got, want)) in piped.iter().zip(refs.iter()).enumerate().take(2) {
6107+ for (p, (g, r)) in
6108+ [(&got.y, &want.y), (&got.u, &want.u), (&got.v, &want.v)]
6109+ .iter()
6110+ .enumerate()
6111+ {
6112+ let bad = g.iter().zip(r.iter()).filter(|(a, b)| a != b).count();
6113+ assert_eq!(
6114+ bad, 0,
6115+ "{NAME}: ffmpeg frame {i} plane {p} THROUGH THE PIPELINE: \
6116+ {bad} samples differ"
6117+ );
6118+ }
6119+ }
6120+ } else {
6121+ eprintln!("SKIP {NAME} ffmpeg arm: no ffmpeg");
6122+ }
6123+ }
6124+
6125+ /// lane-av1-444interband: the DEFAULT-partition lossless 4:4:4 pin for
6126+ /// the inter 16x4/4x16 strip's chroma band stamping (the pair_chroma
6127+ /// 4:2:0-only gate, commit d5325172). Fixture pinned into `fixtures/`:
6128+ /// testsrc2 128x96 yuv444p, aomenc `--profile=1 --lossless=1
6129+ /// --enable-palette=0 --enable-intrabc=0 --passes=1 --cpu-used=4
6130+ /// --limit=6 --obu` (the av1llkf.report.md recipe), 6 frames; 32487
6131+ /// bytes, sha256
6132+ /// `1e6dd4e05038c8d51e2c8d29f8c337130c4fea0aed629415535e6e53af9a2c72`.
6133+ ///
6134+ /// This is the stream whose frame 1 desynced at the 16x4 inter strip
6135+ /// mi(2,8) -- its U bc=0 `txb_skip` read base 0 where aom reads base 1,
6136+ /// because the skipped strip (1,8)'s pair-form context stamp smeared
6137+ /// zero over `left[2][1]`. Two pins, both measured at d5325172:
6138+ /// end-to-end, every sample of every frame must match the oracle
6139+ /// aomdec exactly (the pre-fix tree refuses mid-frame-1, so the gate
6140+ /// is red by refusal, not by silent pass), and the 1:4 counter delta
6141+ /// must show the strips decoded WITHOUT the pair rewrite firing
6142+ /// (`horz4=20 vert4=28 chroma_pairs=0` -- chroma_pairs > 0 on this
6143+ /// pairless 4:4:4 stream is the defect reappearing, the
6144+ /// class `pair-rewrite-at-ss0`).
6145+ #[test]
6146+ fn a_lossless_444_defaultp_inter_strip_stream_decodes_byte_exact() {
6147+ const NAME: &str = "a_lossless_444_defaultp_inter_strip_stream_decodes_byte_exact";
6148+ const FIXTURE_LEN: usize = 32487;
6149+ const FIXTURE_FNV: u64 = 0x5278_9f0f_ce2d_1e52;
6150+ const W: usize = 128;
6151+ const H: usize = 96;
6152+ const FRAMES: usize = 6;
6153+ let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
6154+ .join("fixtures/ll444_defaultp_inter_strip.obu");
6155+ let stream = std::fs::read(&obu).unwrap_or_else(|e| {
6156+ panic!(
6157+ "{NAME}: pinned fixture {} is missing ({e}) -- the gate cannot run, \
6158+ which is a failure, not a skip",
6159+ obu.display()
6160+ )
6161+ });
6162+ assert_eq!(stream.len(), FIXTURE_LEN, "{NAME}: fixture length moved");
6163+ assert_eq!(fnv1a64(&stream), FIXTURE_FNV, "{NAME}: fixture bytes moved");
6164+
6165+ let _guard = lock_gate_counters();
6166+ let strips_before = decode::inter16_rect4_counters();
6167+ let frames = decode_stream(&stream).unwrap_or_else(|e| {
6168+ panic!("{NAME}: the pinned stream no longer decodes cleanly: {e}")
6169+ });
6170+ let strips_after = decode::inter16_rect4_counters();
6171+ assert_eq!(frames.len(), FRAMES, "{NAME}: frame count");
6172+ for f in &frames {
6173+ assert_eq!((f.width, f.height), (W, H), "{NAME}: dimensions");
6174+ }
6175+ // The 1:4 strips must have fired, and the 4:2:0 pair rewrite must
6176+ // NOT have (there are no chroma pairs at ss 0/0).
6177+ let (horz4, vert4, chroma_pairs) = (
6178+ strips_after.0 - strips_before.0,
6179+ strips_after.1 - strips_before.1,
6180+ strips_after.2 - strips_before.2,
6181+ );
6182+ assert_eq!(horz4, 20, "{NAME}: HORZ_4 strip count moved");
6183+ assert_eq!(vert4, 28, "{NAME}: VERT_4 strip count moved");
6184+ assert_eq!(
6185+ chroma_pairs, 0,
6186+ "{NAME}: chroma pairs closed on a 4:4:4 stream \
6187+ (class pair-rewrite-at-ss0)"
6188+ );
6189+
6190+ // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames.
6191+ if aomdec_path().is_file() {
6192+ let dir = std::env::temp_dir().join(format!("ec-av1-ll444dp-{}", std::process::id()));
6193+ let _ = std::fs::remove_dir_all(&dir);
6194+ std::fs::create_dir_all(&dir).expect("scratch dir");
6195+ let raw = dir.join("aomdec.raw");
6196+ let out = Command::new(aomdec_path())
6197+ .args(["--codec=av1", "--rawvideo", "-o"])
6198+ .arg(&raw)
6199+ .arg(&obu)
6200+ .stdin(Stdio::null())
6201+ .stdout(Stdio::piped())
6202+ .stderr(Stdio::piped())
6203+ .output()
6204+ .expect("aomdec failed to run");
6205+ assert!(
6206+ out.status.success(),
6207+ "{NAME}: the oracle aomdec refused the stream: {}",
6208+ String::from_utf8_lossy(&out.stderr)
6209+ );
6210+ let ref_raw = std::fs::read(&raw).expect("aomdec rawvideo output");
6211+ let _ = std::fs::remove_dir_all(&dir);
6212+ assert_eq!(ref_raw.len(), W * H * 3 * FRAMES, "{NAME}: aomdec raw size");
6213+ for (i, f) in frames.iter().enumerate() {
6214+ let base = i * W * H * 3;
6215+ for ((plane, off), p) in [(&f.y, 0usize), (&f.u, W * H), (&f.v, 2 * W * H)]
6216+ .into_iter()
6217+ .zip(["y", "u", "v"])
6218+ {
6219+ let want = &ref_raw[base + off..base + off + W * H];
6220+ let bad = plane.iter().zip(want).filter(|&(&a, &b)| a as u8 != b).count();
6221+ assert_eq!(
6222+ bad, 0,
6223+ "{NAME}: aomdec frame {i} plane {p}: {bad} samples differ \
6224+ (class pair-rewrite-at-ss0)"
6225+ );
6226+ }
6227+ }
6228+ } else {
6229+ eprintln!("SKIP {NAME} aomdec arm: no oracle aomdec at {}", aomdec_path().display());
6230+ }
6231+ }
6232+
6233+ /// lane-av1-leaf8oob: the OOB pin for [`decode_leaf8`]'s intrabc chroma
6234+ /// frame-copy buffers. The closure hardcoding the leaf's chroma
6235+ /// prediction at `4x4` (`vec![0u16; 4 * 4]`, `predict_with_filter` at
6236+ /// `4, 4`) carried the 4:2:0 halving of an 8x8 luma leaf into every
6237+ /// subsampling: at 4:4:4 the leaf's own chroma plane block is 8x8
6238+ /// (`csz == 8`), so the 16-sample override reached
6239+ /// [`PlaneBuf::reconstruct`] as an 8x8 prediction and indexed
6240+ /// `prediction[16]` of a 16-sample buffer --
6241+ /// `index out of bounds: the len is 16 but the index is 16` at the
6242+ /// reconstruct call, on every conformant stream of this shape (a panic,
6243+ /// never a refusal). Same signature class as lane-lossless128's
6244+ /// 128-axis lossless extent (`len 16, index 16` there too).
6245+ ///
6246+ /// `crates/ec-av1/fixtures/444_leaf8_oob.obu`, 3577 bytes, sha256
6247+ /// `72bed2791d1ceba8be7926a052c7838c5d96d4f9d56d28fb69789a753d3593af`
6248+ /// (force-added past the `fixtures` gitignore like every sibling
6249+ /// fixture): the lane ticket's witness-hunt reproducer (s1a/s2e) -- a
6250+ /// 320x256, 3-frame, 8-bit 4:4:4 screen-content keyframe run whose
6251+ /// census pins 4 intrabc 8x8 leaves (the oracle's own MB dump opens on
6252+ /// unbroken inter-classified intra = intrabc blocks). The encoding
6253+ /// recipe is not independently recoverable in this lane; the bytes are
6254+ /// pinned by length + FNV-1a64 here and by the oracle raw fingerprint
6255+ /// below.
6256+ ///
6257+ /// WHAT THIS GATE DOES NOT CLAIM: sample-exactness -- and it pins no
6258+ /// pixel baseline. Measured against the oracle aomdec (`--rawvideo`;
6259+ /// comparison method ground-truthed by the green
6260+ /// `a_lossless_sb128_rect_intra_block_decodes_sample_exact` and
6261+ /// `a_lossless_444_min_partition8_inter_stream_decodes_sample_exact`
6262+ /// witnesses on this same tree), this stream DIVERGES and its output is
6263+ /// not even self-deterministic: frame 0's first differing LUMA sample
6264+ /// is at (275,128), the (y, u, v) differing counts per frame are
6265+ /// (20811, 35467, 32320)/(20308, 39177, 35994)/(20131, 39588, 36601) of
6266+ /// 81920 samples per plane, and under `EC_AV1_PLANE_SENTINEL=1` the
6267+ /// chroma counts move (u f0 35467 -> 35630) while luma stays put.
6268+ /// Sentinel-vs-uninit output diffing localises that dependence to 458
6269+ /// WHOLE 8x8 chroma blocks (frame 0: chroma x >= 96, y >= 64) reading
6270+ /// samples this decode never wrote -- ambient memory in those slots,
6271+ /// hence any pixel-exact assert here drifts run to run with the batch.
6272+ /// Both facts belong to ONE pre-existing defect this lane must not
6273+ /// chase (the ticket's fix touches only leaf8's chroma prediction
6274+ /// buffers, which cannot feed a luma sample, and the pre-fix run never
6275+ /// got past the panicked leaf): a decode desync on this stream around
6276+ /// frame-0 SB (3..4, 2), after which samples diverge from the oracle
6277+ /// and the misread layout leaves chroma blocks unreconstructed.
6278+ /// Disposition: `deferred(unblock: divergence lane -- EC trace pairing
6279+ /// against the oracle on this fixture)`. So this gate pins exactly what
6280+ /// its ticket owns: fixture identity, a decode that RUNS TO COMPLETION
6281+ /// where the old code died with `len 16, index 16`, and the arm counter.
6282+ ///
6283+ /// Assertions (all before/without any skip path):
6284+ /// 1. fixture bytes: exact length + FNV-1a64;
6285+ /// 2. `decode_stream` succeeds -- 3 frames, 320x256 (the pre-fix run
6286+ /// died here with the len-16/index-16 panic);
6287+ /// 3. non-vacuity: `leaf8_intrabc_hits` moves (measured 0 -> 4), so the
6288+ /// arm owning the fixed buffers really fired;
6289+ /// 4. the oracle aomdec still decodes the pinned bytes (raw size +
6290+ /// fingerprint), anchoring the deferred divergence comparison.
6291+ #[test]
6292+ fn an_intrabc_8x8_leaf_chroma_frame_copy_at_444_decodes_without_the_oob() {
6293+ const NAME: &str = "an_intrabc_8x8_leaf_chroma_frame_copy_at_444_decodes_without_the_oob";
6294+ const FIXTURE_LEN: usize = 3577;
6295+ const FIXTURE_FNV: u64 = 0x86b9_3a51_fe16_353c;
6296+ const W: usize = 320;
6297+ const H: usize = 256;
6298+ const FRAMES: usize = 3;
6299+ let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
6300+ .join("fixtures/444_leaf8_oob.obu");
6301+ let stream = std::fs::read(&obu).unwrap_or_else(|e| {
6302+ panic!(
6303+ "{NAME}: pinned fixture {} is missing ({e}) -- the gate cannot run, \
6304+ which is a failure, not a skip",
6305+ obu.display()
6306+ )
6307+ });
6308+ assert_eq!(stream.len(), FIXTURE_LEN, "{NAME}: fixture length moved");
6309+ assert_eq!(fnv1a64(&stream), FIXTURE_FNV, "{NAME}: fixture bytes moved");
6310+
6311+ let _guard = lock_gate_counters();
6312+ crate::decode::reset_leaf8_intrabc_hits();
6313+ let frames = decode_stream(&stream).unwrap_or_else(|e| {
6314+ panic!("{NAME}: the pinned stream no longer decodes cleanly: {e}")
6315+ });
6316+ assert!(
6317+ crate::decode::leaf8_intrabc_hits() > 0,
6318+ "{NAME}: gate is vacuous -- no intrabc 8x8 leaf was decoded, so the arm \
6319+ owning the fixed chroma buffers never fired"
6320+ );
6321+ assert_eq!(frames.len(), FRAMES, "{NAME}: frame count");
6322+ for f in &frames {
6323+ assert_eq!((f.width, f.height), (W, H), "{NAME}: dimensions");
6324+ }
6325+
6326+ // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames.
6327+ if aomdec_path().is_file() {
6328+ let dir = std::env::temp_dir().join(format!("ec-av1-leaf8oob-{}", std::process::id()));
6329+ let _ = std::fs::remove_dir_all(&dir);
6330+ std::fs::create_dir_all(&dir).expect("scratch dir");
6331+ let raw = dir.join("aomdec.raw");
6332+ let out = Command::new(aomdec_path())
6333+ .args(["--codec=av1", "--rawvideo", "-o"])
6334+ .arg(&raw)
6335+ .arg(&obu)
6336+ .stdin(Stdio::null())
6337+ .stdout(Stdio::piped())
6338+ .stderr(Stdio::piped())
6339+ .output()
6340+ .expect("aomdec failed to run");
6341+ assert!(
6342+ out.status.success(),
6343+ "{NAME}: the oracle aomdec refused the stream: {}",
6344+ String::from_utf8_lossy(&out.stderr)
6345+ );
6346+ let ref_raw = std::fs::read(&raw).expect("aomdec rawvideo output");
6347+ let _ = std::fs::remove_dir_all(&dir);
6348+ assert_eq!(ref_raw.len(), W * H * 3 * FRAMES, "{NAME}: aomdec raw size");
6349+ assert_eq!(
6350+ fnv1a64(&ref_raw),
6351+ 0x3821_0bcb_f572_973c,
6352+ "{NAME}: aomdec raw fingerprint moved"
6353+ );
6354+ } else {
6355+ eprintln!("SKIP {NAME} aomdec arm: no oracle aomdec at {}", aomdec_path().display());
6356+ }
6357+ }
54026358 /// lane-lossless128: a LOSSLESS key frame that codes a 128-axis
54036359 /// (`BLOCK_64X128`) intra block -- the shape libaom's `read_tx_size` forces
54046360 /// to `TX_4X4` on its very first line (`decodeframe.c:1183`), so every plane
@@ -5628,6 +6584,122 @@ pub(crate) mod tests {
56286584 );
56296585 }
56306586
6587+ /// lane-av1-ibc444rect: an unskipped intrabc `BLOCK_8X4`/`BLOCK_4X8` leaf
6588+ /// on a lossless 4:4:4 frame walks its coefficients as per-4x4 inter
6589+ /// `TX_4X4` units on every plane -- `read_tx_size`'s lossless first line
6590+ /// (`decodeframe.c:1203`) forces TX_4X4 before any tree, the frame's
6591+ /// `TxMode` is `ONLY_4X4` so no var-tx tree is read either, and
6592+ /// `av1_read_tx_type`'s qindex==0 early return (`decodemv.c:681`) drops
6593+ /// the tx_type symbol the lossy 4x4 inter sets carry -- NOT the single
6594+ /// `LumaRect8x4Inter`/`ChromaRect8x4` rect unit the non-lossless arm
6595+ /// reads, and not the lossy per-unit arm's tx_type read.
6596+ ///
6597+ /// The pinned fixture `ll444_ibc_rect.obu` (99614 bytes, provenance in
6598+ /// `lanes/av1ibc444rect.report.md`) is a lossless `--profile=1 --i444
6599+ /// --enable-intrabc=1` key frame. r1 pinned the (then-known) leaf8
6600+ /// `palette_window` panic as its alignment witness; with that blocker
6601+ /// fixed upstream (lane-av1leaf8oob) the frame decodes to completion and
6602+ /// this gate is the FULL-FRAME exact `aomdec` comparison its r1 doc
6603+ /// promised, flipped by lane-av1-ibcskip2 -- which also closed the
6604+ /// SKIPPED intrabc sub8 chroma cells the r1 measurement called out: a
6605+ /// skipped intrabc leaf's chroma is the bare frame copy at the DV
6606+ /// (libaom's `av1_build_inter_predictors_sb` runs regardless of `skip`),
6607+ /// never the intra-DC push that arm used to run. Fail-before, measured on
6608+ /// this tree with the DV-copy arm cut back to the intra push: 2794 U +
6609+ /// 2830 V samples differ across 180 distinct 4x4 cells, 175 of them
6610+ /// exactly this frame's skipped intrabc leaves, luma clean; with the arm,
6611+ /// 0 differing samples on every plane.
6612+ #[test]
6613+ fn a_lossless_444_intrabc_rect_leaf_walks_per_4x4_units() {
6614+ const NAME: &str = "a_lossless_444_intrabc_rect_leaf_walks_per_4x4_units";
6615+ const FIXTURE_LEN: usize = 99614;
6616+ const FIXTURE_FNV: u64 = 0xa1b6_a84e_ac6a_656f;
6617+ const W: usize = 320;
6618+ const H: usize = 240;
6619+ let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
6620+ .join("fixtures/ll444_ibc_rect.obu");
6621+ let stream = std::fs::read(&obu).unwrap_or_else(|e| {
6622+ panic!(
6623+ "{NAME}: pinned fixture {} is missing ({e}) -- the gate cannot run, \
6624+ which is a failure, not a skip",
6625+ obu.display()
6626+ )
6627+ });
6628+ assert_eq!(stream.len(), FIXTURE_LEN, "{NAME}: fixture length moved");
6629+ assert_eq!(fnv1a64(&stream), FIXTURE_FNV, "{NAME}: fixture bytes moved");
6630+
6631+ let _guard = lock_gate_counters();
6632+ crate::decode::reset_ibc444rect_hits();
6633+ crate::decode::reset_skipped_intrabc_dv_copy_hits();
6634+ let frames = decode_stream(&stream).unwrap_or_else(|e| {
6635+ panic!("{NAME}: the fixture must decode to completion (the leaf8 \
6636+ chroma buffers were fixed upstream): {e}")
6637+ });
6638+ assert_eq!(frames.len(), 1, "{NAME}: shown frame count");
6639+ let luma = crate::decode::intrabc_rect8_lossless_luma_hits();
6640+ let chroma = crate::decode::intrabc_rect8_lossless_chroma_hits();
6641+ assert_eq!(
6642+ (luma, chroma),
6643+ (339, 339),
6644+ "{NAME}: the per-4x4 walk must fire on the fixture's full unskipped \
6645+ intrabc rect census (got luma {luma}, chroma {chroma}) -- zero \
6646+ means the fixture no longer reaches the fixed body (class \
6647+ gate-blind-to-feature), more means the entropy desynced and \
6648+ garbage blocks read as intrabc rect leaves"
6649+ );
6650+ let dv_skips = crate::decode::skipped_intrabc_dv_copy_hits();
6651+ assert_eq!(
6652+ dv_skips, 150,
6653+ "{NAME}: the skipped-intrabc DV-copy chroma arm must fire on every \
6654+ one of the fixture's 150 skipped intrabc leaves (got {dv_skips}) \
6655+ -- zero means the arm is unreachable (class gate-blind-to-feature)"
6656+ );
6657+
6658+ // The oracle aomdec, rawvideo out: one concatenated yuv444p frame.
6659+ if aomdec_path().is_file() {
6660+ let dir = std::env::temp_dir().join(format!("ec-av1-ibcskip2-{}", std::process::id()));
6661+ let _ = std::fs::remove_dir_all(&dir);
6662+ std::fs::create_dir_all(&dir).expect("scratch dir");
6663+ let raw = dir.join("aomdec.raw");
6664+ let out = Command::new(aomdec_path())
6665+ .args(["--codec=av1", "--rawvideo", "-o"])
6666+ .arg(&raw)
6667+ .arg(&obu)
6668+ .stdin(Stdio::null())
6669+ .stdout(Stdio::piped())
6670+ .stderr(Stdio::piped())
6671+ .output()
6672+ .expect("aomdec failed to run");
6673+ assert!(
6674+ out.status.success(),
6675+ "{NAME}: the oracle aomdec refused the stream: {}",
6676+ String::from_utf8_lossy(&out.stderr)
6677+ );
6678+ let ref_raw = std::fs::read(&raw).expect("aomdec rawvideo output");
6679+ let _ = std::fs::remove_dir_all(&dir);
6680+ assert_eq!(ref_raw.len(), W * H * 3, "{NAME}: aomdec raw size");
6681+ let f = &frames[0];
6682+ for (plane, off, p) in
6683+ [(&f.y, 0usize, "Y"), (&f.u, W * H, "U"), (&f.v, 2 * W * H, "V")]
6684+ {
6685+ let want = &ref_raw[off..off + W * H];
6686+ let bad = plane.iter().zip(want).filter(|&(&a, &b)| a as u8 != b).count();
6687+ assert_eq!(
6688+ bad, 0,
6689+ "{NAME}: aomdec plane {p}: {bad} samples differ -- a \
6690+ regression here reopens the skipped-intrabc sub8 chroma \
6691+ predictor or the rect walk"
6692+ );
6693+ }
6694+ } else {
6695+ eprintln!("SKIP {NAME} aomdec arm: no oracle aomdec at {}", aomdec_path().display());
6696+ }
6697+ eprintln!(
6698+ "{NAME}: frame sample-exact vs oracle aomdec; {luma}+{chroma} rect \
6699+ walks, {dv_skips} skipped-intrabc DV copies"
6700+ );
6701+ }
6702+
56316703 /// lane-dkey: the palette-neighbour-band gate. A palette-Y block's size and
56326704 /// colours used to stay standing in the mi-granular above/left bands after a
56336705 /// sub-8x8 group was decoded next to it -- the sub-8x8 readers published
@@ -8763,6 +9835,54 @@ pub(crate) mod tests {
87639835 y4m
87649836 }
87659837
9838+ /// lane-av1gwarp12 fixture: rotating + uniformly zooming mandelbrot as a
9839+ /// C420p12 y4m. Rotation composed with a UNIFORM scale is a similarity
9840+ /// transform -- exactly the family a 4-parameter ROTZOOM global model
9841+ /// expresses (the affine gate needs the anisotropic stretch to force
9842+ /// 6 parameters; this lane needs the model vanilla aomenc actually
9843+ /// searches, ROTZOOM).
9844+ fn y4m_12bit_rotzoom_gm_source(frames: usize) -> Vec<u8> {
9845+ const W: usize = 128;
9846+ const H: usize = 128;
9847+ let source = format!(
9848+ "mandelbrot=size=192x192:rate=25,rotate=a=0.12*t:c=black,\
9849+ scale=w='ceil(192*(1+0.04*n)/2)*2':h='ceil(192*(1+0.04*n)/2)*2':eval=frame,\
9850+ crop={W}:{H}"
9851+ );
9852+ let duration = (frames as f64 / 25.0).to_string();
9853+ let ff_args: Vec<&str> = vec![
9854+ "-v",
9855+ "error",
9856+ "-f",
9857+ "lavfi",
9858+ "-i",
9859+ &source,
9860+ "-pix_fmt",
9861+ "yuv420p12le",
9862+ // y4m has no official 12-bit tag, same as the 10-bit gate.
9863+ "-strict",
9864+ "-1",
9865+ "-t",
9866+ &duration,
9867+ "-f",
9868+ "yuv4mpegpipe",
9869+ "-",
9870+ ];
9871+ let out = Command::new("ffmpeg")
9872+ .args(&ff_args)
9873+ .stdin(Stdio::null())
9874+ .stdout(Stdio::piped())
9875+ .stderr(Stdio::piped())
9876+ .output()
9877+ .expect("ffmpeg failed to run");
9878+ assert!(
9879+ out.status.success(),
9880+ "ffmpeg fixture: {}",
9881+ String::from_utf8_lossy(&out.stderr)
9882+ );
9883+ out.stdout
9884+ }
9885+
87669886 /// The 12-bit coding recipe shared by the witness gates (cpu-used=0 so
87679887 /// every search runs; explicit CDEF/restoration ON). Warp/global-motion
87689888 /// are deliberately NOT spelled here: this aomenc honours the LAST
@@ -9637,6 +10757,13 @@ pub(crate) mod tests {
963710757 "reelb_arf_witness.obu",
963810758 "palette_screen_witness.obu",
963910759 "palette_screen_witness_10bit.obu",
10760+ // lane-av1wavefront: the 4:4:4 inter witness. The wavefront's
10761+ // replay-side chroma (`mv_to_q4(.., ss_x(fctx))` in the deferred
10762+ // builds, `exec_intra`'s CfL AC) used to read the worker's fresh
10763+ // `FrameCtx` 4:2:0 DEFAULT instead of the frame's subsampling --
10764+ // invisible on the three 4:2:0 streams above, chroma-only loss on
10765+ // this one (f1 U 17504 / V 3, f2 U 25472 / V 1472 at PREFILT).
10766+ "444_sb128rect_lr_witness.obu",
964010767 ] {
964110768 let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
964210769 .join("fixtures")
@@ -20403,6 +21530,99 @@ pub(crate) mod tests {
2040321530 }
2040421531 }
2040521532
21533+ /// lane-av1gwarp12: the SINGLE-reference GLOBAL-warp witness at 12 bits
21534+ /// -- the open half lane-av112bitw recorded (engagement 0 on every prior
21535+ /// 12-bit content). The decode path is the same `warp_affine` with
21536+ /// `warp_round_0(12)` the local-warp witness proved, fed by
21537+ /// `global_warp_params(gm_ref.params)` at `decode_inter_block`'s
21538+ /// single-ref arm -- but composition had no stream: the travelling-box
21539+ /// source fits only TRANSLATION global models (excluded by
21540+ /// `is_global_mv_block`), and the rotating mandelbrot reached the global
21541+ /// models only on compound blocks. This recipe closes it: rotation +
21542+ /// uniform zoom (a similarity transform, ROTZOOM's exact family), the
21543+ /// compound tools off so a global model can only ride a single-reference
21544+ /// GLOBALMV block, and partitions pinned to 32 so the 8x8 leaf arm is
21545+ /// structurally out of the stream. Vanilla aomenc pins its gm search to
21546+ /// ROTZOOM (`global_motion_facade.c:24`), so every >TRANSLATION model a
21547+ /// real aomenc emits is ROTZOOM; AFFINE needs the widened side build
21548+ /// (`a_real_affine_global_motion_stream_decodes_pixel_exact`).
21549+ ///
21550+ /// Non-vacuous by construction: `rotzoom_gm_warp_hits()` hard-asserts a
21551+ /// 16x16+ block was really predicted through the global warp with a
21552+ /// ROTZOOM model, the zero `compound_warp_hits` delta keeps the
21553+ /// single-reference premise honest, and every plane of every frame
21554+ /// compares against ffmpeg.
21555+ #[test]
21556+ fn a_real_rotzoom_global_warp_12bit_stream_decodes_pixel_exact() {
21557+ const NAME: &str = "a_real_rotzoom_global_warp_12bit_stream_decodes_pixel_exact";
21558+ let _gate_lock = lock_gate_counters();
21559+ if !have_ffmpeg() {
21560+ eprintln!("SKIP {NAME}: no ffmpeg");
21561+ return;
21562+ }
21563+ if !have_aomenc() {
21564+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
21565+ return;
21566+ }
21567+ const W: usize = 128;
21568+ const H: usize = 128;
21569+ const FRAMES: usize = 16;
21570+ let y4m = y4m_12bit_rotzoom_gm_source(FRAMES);
21571+ let stream = encode_12bit(
21572+ &y4m,
21573+ FRAMES,
21574+ &[
21575+ "--enable-global-motion=1",
21576+ "--enable-warped-motion=0",
21577+ "--enable-obmc=0",
21578+ "--enable-masked-comp=0",
21579+ "--enable-interintra-comp=0",
21580+ "--enable-onesided-comp=0",
21581+ "--enable-ref-frame-mvs=0",
21582+ "--min-partition-size=32",
21583+ "--max-partition-size=32",
21584+ ],
21585+ );
21586+ assert_12bit_sequence_header(&stream, NAME);
21587+ let (before_rotzoom, before_affine, before_selected, before_compound) = (
21588+ decode::rotzoom_gm_warp_hits(),
21589+ decode::affine_gm_hits(),
21590+ decode::warp_selected_hits(),
21591+ decode::compound_warp_hits(),
21592+ );
21593+ let frames = decode_stream(&stream).unwrap_or_else(|e| {
21594+ panic!("{NAME}: decode_stream refused a real 12-bit global-warp stream: {e}")
21595+ });
21596+ assert_eq!(frames.len(), FRAMES);
21597+ let (delta_rotzoom, delta_affine, delta_selected) = (
21598+ decode::rotzoom_gm_warp_hits() - before_rotzoom,
21599+ decode::affine_gm_hits() - before_affine,
21600+ decode::warp_selected_hits() - before_selected,
21601+ );
21602+ eprintln!(
21603+ "{NAME}: gm_warp_engagement rotzoom(single-ref global warp)={delta_rotzoom} \
21604+ affine={delta_affine} selected_local_warp={delta_selected}"
21605+ );
21606+ assert!(
21607+ delta_rotzoom > 0,
21608+ "{NAME}: decoded but no single-reference ROTZOOM global-warp block fired -- \
21609+ the 12-bit single-ref global-warp path is unexercised and the pixel \
21610+ compare would prove nothing"
21611+ );
21612+ assert_eq!(
21613+ decode::compound_warp_hits() - before_compound,
21614+ 0,
21615+ "{NAME}: a compound warp block ran -- the single-reference premise is gone"
21616+ );
21617+ let ffmpeg_frames = ffmpeg_decode_sequence_12bit(&stream, W, H, FRAMES);
21618+ for (i, (ours, reference)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
21619+ assert_eq!(ours.y, reference.y, "{NAME} frame {i} luma vs ffmpeg");
21620+ assert_eq!(ours.u, reference.u, "{NAME} frame {i} U vs ffmpeg");
21621+ assert_eq!(ours.v, reference.v, "{NAME} frame {i} V vs ffmpeg");
21622+ }
21623+ eprintln!("{NAME}: {FRAMES} frames pixel-exact vs ffmpeg, rotzoom_gm_warp_hits={delta_rotzoom}");
21624+ }
21625+
2040621626 /// lane-gmaffine r1: the two 8x8-LEAF motion gates. `decode_inter_block8`
2040721627 /// is a separate function from [`decode_inter_block`], and until this
2040821628 /// round it refused both `GLOBALMV` ("GLOBALMV (round 3)") and
lanes/av1422.report.mdadded+64 -0
@@ -0,0 +1,64 @@
1+# lane-av1-422 — 4:2:2 chroma behind the header refusal
2+
3+## Outcome
4+
5+STOP with the refusal in place (`stream.rs` `subsampling_x != subsampling_y`, byte-identical to main).
6+Not pixel-exact yet: the bypassed-refusal probe still desyncs/pantes on the census fixture
7+(`aomenc --profile=2`, 256x144, 16 frames, testsrc2 422 y4m). Next wrong site named below.
8+
9+Landed on this branch: the finished, provably 420/444-invariant slice of the class fix.
10+`cargo check -p ec-av1 --all-targets`: **0 warnings**.
11+
12+## Fixture provenance
13+
14+- `ffmpeg -f lavfi -i testsrc2=256x144:rate=30 -frames:v 16 -pix_fmt yuv422p /tmp/t422.y4m`
15+- `aomenc --codec=av1 --profile=2 --obu -w 256 -h 144 --passes=1 --end-usage=q --cq-level=32 --cpu-used=3 --limit=16`
16+- Refusal string confirmed firing on main before any edit (decode_probe on the OBU).
17+- Oracle decode: `$HOME/.cache/aom-oracle/build/aomdec` (I422 raw). ffmpeg 8.1.2 available; aomdec used as primary pixel oracle.
18+
19+## Class (confirmed against the aom oracle source, `~/.cache/aom-oracle/src`)
20+
21+At ss (1,0) chroma width halves, height does not. Sites assume either a single shared
22+`ss` for both axes or an `ss==(0,0) ? 444 : 420` two-arm split, so 422 falls into the 420 arm.
23+Ground truth tables: `av1_ss_size_lookup` (common_data.c:17), `is_chroma_reference`
24+(av1_common_int.h:1454), `av1_get_max_uv_txsize` (blockd.h:1372).
25+
26+## Fixes landed (all keyed to reachability only at ss 1,0; 420/444 arms byte-identical)
27+
28+1. `decode_rect_split` chroma: square chroma rows (8,8)/(16,16)/(32,32) routed through the
29+ square reader via the `chroma_tiled` arm (libaom: chroma of a 16x8/32x16/64x32 luma strip
30+ is an 8x8/16x16/32x32 square). Includes 4:2:2 CFL strip support via the same path.
31+2. `decode_rect4_16_strip`: (8,8) arm + 422 strips are their own chroma reference
32+ (`ss_size_lookup[16X4][1][0]` = BLOCK_8X4, per-strip, no 4:2:0 pair merge); also fixed a
33+ `lmi.1 - 1` underflow the 422 has_chroma change exposed.
34+3. `decode_leaf_rect` chroma match: (16,16) and (8,32) rows.
35+4. `decode_block_rect4` chroma match: (16,8) and (8,4) rows; the portrait-leaf unreachable now
36+ names the shape.
37+5. `cfl_ac_ss`: `cfl_luma_subsampling_422_lbd_c` branch (horizontal luma pairs, full height,
38+ `(a+b) << 2`), before the 4:2:0 square/rect helpers.
39+6. `mv_to_q4` Y axis: 8 call sites passed `ss_x(fctx)` for the row component — now `ss_y`
40+ (sub-8x8/inter chroma MC bilinear predict sites).
41+7. `has_chroma` for 1:4 strip pairs (decode_rect4_16 + inter twin): `i % 2 == 1 || ss_y == 0`
42+ (is_chroma_reference's row-parity clause drops out when ss_y=0).
43+8. `CHROMA422_SQUARE_HITS` counter (decode.rs): incremented only when a square chroma
44+ coefficient unit is read on a frame with ss (1,0); a restored `/2 chroma height` diverts
45+ 4:2:2 squares onto the rect rows and the counter reads 0. Accessor `chroma422_square_hits()`.
46+ No gate asserts it yet — the refusal still gates all 422 decode (deferred below).
47+
48+## Next wrong site (first blocker on the fixture, in parent's order)
49+
50+`decode_block` (~line 16621 on this tree): the `ss==(0,0) ? 444 : 420` tx-size arm. Its whole
51+chroma section walks `cn x cn` square `chroma_tx` units; at 4:2:2 a square luma block's chroma
52+is (side/2, side) — a RECT plane block (e.g. 8x16 for a 16x16 block) needing rect chroma sets
53+and a non-square unit walk. Same open class after it: `decode_inter_block`'s square-chroma
54+arms (~31922/33422), `film_grain.rs` `apply_grain` (hardcoded 420 subblock halving), and the
55+1:4 portrait-leaf question — `ss_size_lookup[BLOCK_8X32][1][0]` is BLOCK_INVALID yet the
56+aomenc fixture carries 8x32 leaves that aomdec accepts, so the upstream desync (decode_block /
57+inter chroma) is still producing phantom partitions; that ordering must be re-checked once the
58+square-chroma sites land.
59+
60+## Deferred
61+
62+- Refusal lift + witness gate (`chroma422_square_hits()` + pixel-exact vs aomdec/ffmpeg):
63+ deferred(until decode_block/inter square-chroma class lands and the probe is pixel-exact).
64+ Refusal stays; a lifted refusal with wrong pixels is a fail.
lanes/av1422b.report.mdadded+90 -0
@@ -0,0 +1,90 @@
1+# lane-av1-422b — decode_block square-chroma walk (4:2:2, refusal still up)
2+
3+## Outcome
4+
5+STOP with the refusal in place (`stream.rs` `subsampling_x != subsampling_y`,
6+byte-identical to main — restored before the commit; no bypass committed).
7+Not pixel-exact yet: the bypassed-refusal probe desyncs INSIDE the first
8+16x16 `PARTITION_HORZ_A` of frame 0, before `decode_block`'s own chroma walk
9+is ever reached. Next wrong site named below.
10+
11+## Landed (all keyed to reachability only at ss (1,0); 420/444 arms unchanged)
12+
13+1. `decode_block` tx-size arm: new 4:2:2 branch — the uv plane block is
14+ `(side/2, side)` (`ss_size_lookup[..][1][0]`), so
15+ `av1_get_max_uv_txsize` is the SQUARE transform of the smaller dimension
16+ capped at TX_32X32: 4→TX_4X4 (2x4 rounds to BLOCK_4X4), 8→TX_4X4,
17+ 16→TX_8X8, 32→TX_16X16, 64→TX_32X32, 128→TX_32X32 (BLOCK_64X128 adjusts
18+ TX_64X64 down). Units stay square; the unit GRID is `(side/2)/tx` wide by
19+ `side/tx` tall — never square above a 4x4 luma block.
20+2. All three chroma walks in `decode_block` (skip arm, single-luma-TU arm,
21+ multi-TU mu-chunk arm) generalized from square `cn x cn` to
22+ `cn_cols x cn_rows`; each unit's luma anchor split per axis
23+ (`chroma_tx << ss_x` wide, `chroma_tx << ss_y` tall): `around_mi_rect`,
24+ `tu_reach_rect` (new helper; keeps the square mismatch counter semantics),
25+ `record_mi_chroma(cu_mi, span_x, span_y, ...)`, units tuples widened to
26+ carry both spans.
27+3. intrabc chroma prediction buffers sized `chroma_side x chroma_height`.
28+4. `TxbSet::Chroma8`/`Chroma16` `txb_skip` tables widened to six rows:
29+ rows 3..6 are `av1_default_txb_skip_cdfs[q][TX_8X8/16X16][10..13]`
30+ (`get_txb_ctx`'s `+10` rows; neutral 16384 in libaom — its encoder never
31+ reaches them at 4:2:0/4:4:4, a 4:2:2 plane block larger than an 8x8/16x16
32+ transform does). Mirrors the existing `TXB_SKIP_CHROMA_4_BIG`/
33+ `CHROMA_32_BIG` assembly. Unused rows are never adapted, so 420/444 CDF
34+ adaptation is unchanged.
35+5. `chroma422_square_hits()` made `pub` and printed by `examples/decode_probe.rs`
36+ (like every other capability counter) for the witness gate later.
37+6. `EC_PART`/`EC_PART_VAL` traces behind `EC_TRACE` at the 64/32/16/8-level
38+ partition symbol reads, byte-format-matched to the oracle aomdec's own
39+ trace (same instrumented-oracle pairing the file already uses elsewhere).
40+
41+## Measurement (local bypass, NOT committed)
42+
43+Fixture: `ffmpeg testsrc2 256x144 yuv422p` → `aomenc --profile=2 --obu
44+-w 256 -h 144 --passes=1 --end-usage=q --cq-level=32 --cpu-used=3 --limit=16`
45+(sha256 d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129);
46+oracle `aomdec --rawvideo` (I422).
47+
48+- With the refusal bypassed, `decode_block`'s new arm runs and the pre-existing
49+ `txb_skip[3]` panic is gone (the widening in 4 fixes it).
50+- Desync localization via `EC_TRACE=1` partition pairing: every partition
51+ symbol pairs rng-for-rng with the oracle through the 64→32 split and the
52+ FIRST 16x16 (`(0,0)` value 4 = HORZ_A, rng 57096→45060→49312 identical).
53+ The oracle's NEXT 16-level read is `(0,4)` at tell 1079; ours is the second
54+ quadrant at tell 700 — the divergence is inside HORZ_A's own pieces:
55+ the two 8x8 leaves (`decode_leaf8`, whose chroma at 4:2:2 is 4x8 = two TX_4X4
56+ units per plane) and/or the 16x8 bottom strip (`decode_rect_split`'s
57+ `chroma_tiled` (8,8) arm — its `EC_RECTCHROMA_GAP luma=16x8 tx=8x8
58+ chroma=8x8` diagnostic fires right before the panic point).
59+
60+## The 8x32/32x64 leaf note, resolved against the oracle source
61+
62+`av1_ss_size_lookup[..][1][0]` (common_data.c:17): 16X4→8X4 VALID, 32X8→16X8
63+VALID, 64X16→32X16 VALID, but 4X16, 8X32, 16X64 (the TALL 1:4 shapes) are
64+BLOCK_INVALID at 4:2:2. libaom's ENCODER disables exactly those:
65+`partition_search.c` (`part4_search_allowed`) requires
66+`get_plane_block_size(subsize, ss_x, ss_y) != BLOCK_INVALID` before a HORZ_4/
67+VERT_4 may be coded. So aomenc never writes tall 1:4 leaves at 4:2:2 — the
68+4x16 leaf our decoder tripped on (`EC_RECTCHROMA_GAP` then the closed-shape
69+unreachable in `decode_rect4_16_strip`) is a phantom partition produced by the
70+upstream desync above, not a missing portrait block size. Nothing invented;
71+the shape guard stays closed.
72+
73+## Next wrong site
74+
75+`decode_rect_split`'s `chroma_tiled` square-chroma arm for 16x8 strips and
76+`decode_leaf8`'s 4x8 chroma (first HORZ_A pieces) — re-check those against
77+the oracle's `EC_COEFF` pairing before re-touching `decode_block`'s walk.
78+
79+## Gates
80+
81+- `a_real_aomenc_128x128_none_inter_blocks_coded_chroma_per_mu_chunk_decodes_
82+ pixel_exact` (420): PASS.
83+- `a_non_420_subsampled_sequence_header_is_refused_by_name` (422 refusal +
84+ 420 control): PASS.
85+- 444 check: `aomenc --profile=1` testsrc2 256x144 through `decode_probe`
86+ byte-compares IDENTICALLY at clean 5674d2c5 and with this diff (first diff
87+ at char 50689 on both — pre-existing branch behavior against this quick
88+ oracle recipe, not touched by this slice; the merged-main 444 gate
89+ c3c67f17 is not on this branch yet).
90+- `cargo check -p ec-av1 --all-targets`: 0 warnings.
lanes/av1422bigblock.report.mdadded+187 -0
@@ -0,0 +1,187 @@
1+# lane-av1-422bigblock — the two witnessed 4:2:2 big-block defects
2+
3+Branch `lane-av1-422bigblock`, HEAD `213c1eb0` (contains the block-half port).
4+Target dir `$HOME/.cache/cargo-target-av1422bigblock` throughout. No push.
5+
6+## Verdict
7+
8+Both witnessed defects are fixed and both witnesses are pixel-exact vs aomdec.
9+The panic the ticket predicted for defect 1 no longer reproduces at this HEAD —
10+the block-half port had already fixed the all-skip inter frame; re-verified, not
11+assumed. Defect 2 needed three fixes, two of them found below the historical
12+panic line. The 4:2:0/4:4:4 behavior is unchanged (targeted gates green, t422
13+frame 0 byte-exact at all four stages). Defect 3 (Main's IRC addition, the
14+s2.obu crash) is fixed as a crash; s2's remaining divergence is a pre-existing
15+sub-8 chroma class, fingerprinted for its owning lane. Committed code still
16+refuses 4:2:2 at the sequence header; the `EC_AV1_ALLOW_422_PROBE` bypass was
17+applied and reverted per probe run and is **not** in the commit.
18+
19+## Fixtures (pinned, `git add -f`; `fixtures/` is gitignored)
20+
21+| fixture | bytes | sha256 | fnv1a64 |
22+|---|---|---|---|
23+| `422_allskip_2f.obu` | 62 | `ba4932c14f95971b5f25321b04abce80c9fdd5de4b1fe6fffcdad82aaea87ce1` | `0x7e4d69d3c728c55f` |
24+| `422_sb128_3f.obu` | 12543 | `0b851799d99cb4d141a7d042138a3999aad7e0fb24d69c670bca1d38c286dce9` | `0x5171e0aab8000da7` |
25+
26+Provenance: the witness hunt's artifacts under `~/.cache/av1422sb128wit/`
27+(`422_allskip_2f.obu` = `b422_wit2f.obu`, `422_sb128_3f.obu` = `b422b_3f.obu`;
28+oracle refs `b422_wit.ref.yuv`). NOTE: the ticket said `422_sb128_3f.obu` is
29+10175 bytes; the live file is 12543 bytes and its sha256 matches the ticket —
30+the byte count in the charter is stale, the hash is authoritative.
31+
32+Gate: `the_pinned_422_bigblock_witnesses_are_present_and_refuse_by_name`
33+(stream.rs) asserts both byte pins and the refusal-by-name contract.
34+`decode_stream` still refuses 4:2:2 unconditionally in committed code, so a
35+committed gate cannot decode these streams; the decode-completes + counters +
36+pixel-exact assertions were measured through the probe build and are
37+reproducible from the recipe below. The counters over the sb128 witness:
38+`chroma422_square: 32`; over s2: `chroma422_square: 68, chroma422_rect: 222,
39+chroma422_sub8: 24, chroma422_chunk: 40`, `part128 none=3`.
40+
41+## Reproduce (patch-run-restore, local only)
42+
43+```
44+sed 's/if seq.subsampling_x != seq.subsampling_y {/if seq.subsampling_x != seq.subsampling_y \&\& std::env::var_os("EC_AV1_ALLOW_422_PROBE").is_none() {/' -i crates/ec-av1/src/stream.rs
45+CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1422bigblock cargo build -p ec-av1 --example decode_probe --features gate-counters
46+EC_AV1_ALLOW_422_PROBE=1 EC_PROBE_OUT=/tmp/ours.raw \
47+ $HOME/.cache/cargo-target-av1422bigblock/debug/examples/decode_probe crates/ec-av1/fixtures/422_sb128_3f.obu
48+$HOME/.cache/aom-oracle/build/aomdec --rawvideo -o /tmp/oracle.raw crates/ec-av1/fixtures/422_sb128_3f.obu
49+cmp /tmp/ours.raw /tmp/oracle.raw # identical
50+git checkout -- crates/ec-av1/src/stream.rs
51+```
52+
53+## Defect 1 — all-skip 422 inter desync: NOT REPRODUCING at HEAD (fixed upstream)
54+
55+At `213c1eb0` the witness decodes clean: `OK: 2 frames decoded, 128x128`, no
56+panic, no phantom reads. Evidence:
57+
58+- Entropy: our `EC_TRACE_COEFF` pairs rng-for-rng with the instrumented
59+ oracle's — frame 0 codes 20 coefficient units (one nonzero 32x32 luma unit +
60+ 4 stacked-chroma per 32x32 quadrant), identical rng sequence on both sides;
61+ frame 1 codes **zero** units on both sides (all-skip, as the oracle).
62+- Pixels: the shown frame is byte-identical to `aomdec --rawvideo`.
63+
64+The ticket's "~20 phantom units + reconstruct_mc_rect side=64 w=64 h=128 panic"
65+is the pre-blockhalf state; the per-axis plane-block model fixed both the
66+phantom reads and the geometry. No code change needed here. The full hunt
67+stream `b422_wit.obu` (6 frames) also decodes OK at HEAD.
68+
69+## Defect 2 — 128-root square-cut chroma chunking: three stacked causes
70+
71+The historical `range end 4128 > 4096` (decode.rs:34279) no longer reproduces;
72+at HEAD the same block panicked deeper, in `push_mc_rect_tx`'s stride-densify
73+(`range end index 32 out of range for slice of length 0`). The f2 128x128
74+PARTITION_NONE non-skip inter block carries all three causes; the oracle codes
75+16 chroma units (8 per plane, 2 stacked TX_32X32 per 64x64 mu chunk).
76+
77+1. **Square-cut chunking** (`decode_inter_block`, both the inter-luma and the
78+ intra-in-inter walk): `chunk_chroma = chroma_side * 64 / side` cut each
79+ chunk's per-axis `(64>>ss_x) x (64>>ss_y)` chroma into a
80+ `chroma_side`-square 64x64 — twice the units the oracle codes at 4:2:2.
81+ Fixed per-axis (`chunk_cw/chunk_ch`, `units_w/units_h`), unit luma spans
82+ `(32<<ss_x, 32<<ss_y)` via `around_mi_rect`/per-axis
83+ `record_mi_chroma`, and the assembled grid placement per-axis.
84+2. **Prediction stride**: `cu_pred = src.offset((cr*chunk + ur*cu_tx) *
85+ chroma_side + ...)` indexed the prediction buffer at the square
86+ `chroma_side` (128) while the 4:2:2 buffer is `chroma_stride`-strided (the
87+ plane block's own width, 64). Chunk (0,0)'s tall unit read buffer row 64 as
88+ row 32, and chunk (1,0) offset to `len` exactly — the empty slice. Fixed to
89+ `* chroma_stride`; the assembled grid stays at the square `chroma_side`
90+ stride the block-tail `mu_chroma_units` re-stamp already indexes per-axis
91+ (verified unit-for-unit against the walk).
92+3. **Reference plane resolution** (`RefPix::planes`): a `Picture` carries no
93+ subsampling field, and the two-way guess (luma-sized = 4:4:4, otherwise
94+ quarter = 4:2:0) resolved every 4:2:2 reference 64x64. The frame's own
95+ pixels were right (the crop is ss-aware) — only inter prediction off the
96+ slot was wrong, so the bottom mu-chunk row predicted from a clamped row-63
97+ edge (±1–2 diffs over chroma rows 64..127, 3.3–3.6k samples/plane). Fixed
98+ with a three-way length inference (`w*h` / `halfw*h` / `halfw*halfh`,
99+ `halfw = (w+1)/2`, `halfh = (h+1)/2` — the three lengths are pairwise
100+ distinct for every w,h ≥ 1). DISCLOSED 4:2:0 edge: at ODD reference
101+ dimensions the half-width uses ceil (`(w+1)/2`, matching the picture
102+ crop's `round_ss`) where the old guess used floor (`w/2`) — ceil is the
103+ correct stored-crop shape and the change is visible only at odd w/h, which
104+ no committed fixture exercises.
105+
106+After the fixes: `422_sb128_3f.obu` and the full `b422_wit.obu` decode
107+pixel-exact vs aomdec; every coefficient unit of every frame pairs
108+rng-for-rng with the oracle (29/29, 32/32, 32/32).
109+
110+Class sweep of the same square-cut model:
111+- `decode_intrabc_128rect` has the same `cside * 64 / side` square chunk walk —
112+ **deferred** (same class, unwitnessed: no 4:2:2 intrabc 128-rect witness
113+ exists; unblock = one aomenc `--enable-intrabc` profile-2 128-SB hunt).
114+- The 444 branch of the inter walk degenerates to identical values (ss 0/0 ⇒
115+ per-axis == square, `chroma_stride == chroma_side`), verified by gate.
116+
117+## Defect 3 (Main's IRC) — s2.obu crash: crash fixed, residual named
118+
119+`/tmp/sa422/s2.obu` (recipe: `lanes/av1422stripanchor.report.md` "Observed, not
120+chased"; 420 control `b420_wit.obu`) panicked at `decode.rs:3709` at HEAD — the
121+same densify site, fed by defect 2's cause 3 (quarter-height reference) and the
122+intra 128-rect twin of the square-cut walk:
123+
124+- `decode_block_128rect`'s chroma walk was chunk-square (`cn = 32/chroma_tx`,
125+ `cu_y = cpy + ch_row*32`, clamp strides 8/8) with a `debug_assert!` that no
126+ 4:2:2 stream can satisfy. Fixed per-axis exactly like the inter walk
127+ (`tu_reach_rect`, `around_mi_rect`, per-axis record spans), in the SAME
128+ expression shape the already-reviewed 444 fix landed on lane-av1-444sb
129+ (`349b3918`): `cn = ((64 >> ss_x)/chroma_tx).max(1)` for the width axis
130+ plus the added `cn_h = ((64 >> ss_y)/chroma_tx).max(1)` for the height
131+ axis, per-axis chunk offsets `(64 >> ss)` and clamp strides `(16 >> ss)` —
132+ at ss(0,0) the code reduces line-for-line to `349b3918`'s form, so the
133+ merge with that chain is a semantic union. DISCLOSED 4:4:4 behavior change:
134+ the parent's walk was provably broken at ss(0,0) (one unit per chunk instead
135+ of four; the stale assert caught it) and this rewrite, like `349b3918`,
136+ codes the four units — NOT byte-identical to parent at 4:4:4, by design,
137+ and pinned by `349b3918`'s own witness on the merged tree (see the identity
138+ section). DISCLOSED 4:2:0 identity: at ss(1,1) every new expression reduces
139+ to the old constant (32, offsets 32, strides 8, one unit).
140+
141+Result: s2.obu decodes all 16 frames, no panic (`OK: 16 frames decoded,
142+256x144`). The crash the charter assigned is closed. **Deferred (named for its
143+owning lane):** s2's frame 0 diverges from aomdec (~45% of samples, maxabs
144+~180, Y first diff at sample 126) with an entropy desync: the oracle codes
145+1089 coefficient units in frame 0, ours 541, first divergence at unit 38 — a
146+plane-2 **TX_4X8** chroma unit at **mi(12,24)** (oracle `all_zero=0
147+rng=48745`, ours `rng=41584`). Class: sub-8/odd-strip 4:2:2 chroma under the
148+128-rect intra path (the `ss_size_lookup` BLOCK_INVALID family), pre-existing
149+— the base tree panics at frame 0's assert and never produced pixels. At base
150+the stream could not be measured at all; the pre-fix re-run log is
151+`/tmp/sa422/re-run-av1422ctxgather.log`. Fingerprint: `/tmp/sa422/s2f0.obu`,
152+unit 38, mi(12,24), TX_4X8, plane 2.
153+
154+## 4:2:0/4:4:4 identity + t422
155+
156+- `a_real_aomenc_10bit_inter_sequence_decodes_pixel_exact` — green.
157+- `a_real_aomenc_stream_with_two_tile_rows_decodes_through_decode_stream`
158+ (live aomenc, 420, inter, tiles) — green.
159+- `a_lossless_sb128_rect_intra_block_decodes_sample_exact` — green. LABEL
160+ CORRECTION (review finding 2): this stream is 4:2:0 (seq_profile 0 in the
161+ fixture bytes), NOT 4:4:4 as this report first claimed; it is a 4:2:0
162+ lossless sb128 gate and proves nothing about 4:4:4.
163+- 4:4:4 evidence, done properly: `444_sb128rect_lr_witness.obu` (sha256
164+ `27825e14…`, the lane-av1-444sb witness, 192x160 profile-1, 3 frames) was
165+ decoded on THIS tree (`OK: 3 frames decoded`) and its output is
166+ BYTE-IDENTICAL to the parent commit's output on the same stream — measured
167+ by stash-and-rebuild, all three frames — so the rewrite is proven
168+ output-neutral on it. The stream itself still diverges from aomdec on this
169+ ancestry, identically before and after the fix: this branch predates the
170+ 444 chain's chroma-context fixes (`9e77c16b` ss-aware chroma-above skip,
171+ `76f8c3fe`), the desync starts at frame-0 Y sample 128 (the first
172+ 128-column superblock) and the first 128-rect block never fires downstream
173+ of it, so `decode_block_128rect` codes no samples on this stream on this
174+ ancestry. `349b3918`'s own gate
175+ (`a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact`,
176+ frames 0/1 byte-exact vs aomdec AND ffmpeg) is the merged-tree pin: at
177+ ss(0,0) this lane's walk reduces verbatim to that reviewed form.
178+- `a_128_root_block_with_a_real_residual_decodes_exact_through_both_decoders`
179+ and `a_128_root_compound_block_decodes_exact_through_both_decoders` (solo,
180+ they pin the process-global superblock size) — green.
181+- t422 frame 0 (`/tmp/i422/t422_1f.obu`) byte-exact vs the instrumented oracle
182+ at PREFILT, POSTDEBLOCK, POSTCDEF and FINAL on Y, U and V; t422 16-frame
183+ stream decodes with the same frame count as the parent (15 shown of 16 frame
184+ OBUs, unchanged at HEAD — the 16th is an `OBU_TILE_LIST` quirk, not a
185+ regression).
186+
187+`cargo check -p ec-av1`: 0 warnings. Committed on the branch, no push.
lanes/av1422blockhalf.report.mdadded+133 -0
@@ -0,0 +1,133 @@
1+# lane-av1-422blockhalf — `decode_inter_block`'s 4:2:2 chroma half ported to the
2+# per-axis plane-block model (per-axis pred buffers + real-subsampling masked
3+# compound blend), the `EC_RECTCHROMA_GAP` 16x8 / 8x32 chroma shapes coded as
4+# the (4, 8) unit tiling the Release oracle's OOB `max_txsize_rect_lookup[
5+# BLOCK_INVALID]` byte produces, and `decode_inter_sub8_rect2`'s has_chroma
6+# gating moved from `i == 1` to the per-piece `is_chroma_reference` rule;
7+# frame 0 stays byte-exact at PREFILT/POSTDEB/POSTCDEF, all 16 frames now
8+# decode (the frame-11 `(4, 32)` refusal is gone), and the inter-frame
9+# divergence is REMEASURED and REATTRIBUTED to a partition-dispatch defect
10+# upstream of the chroma half (ours dispatches SPLIT4 where the oracle codes
11+# HORZ at mi(8,10)) — frame exactness NOT claimed for frames 1+
12+
13+## Outcome
14+
15+1. `decode_inter_block`'s chroma PREDICTION buffers (compound and
16+ single-ref arms, OBMC plan, interintra stride, skip pushes, su/sv Pred
17+ strides, the `read_inter_rect_chroma`/`read_inter_chroma_lossless` pred
18+ strides) are keyed to the PLANE BLOCK's own per-axis shape at ss (1, 0):
19+ `(chroma_stride, chroma_buf_h) = (write_chroma_w, write_chroma_h)`
20+ instead of the enclosing square `chroma_side`. The two masked-compound
21+ blend sites now pass the plane's REAL subsampling shifts — the
22+ stop-note's pre-port direct luma-resolution mask read is gone
23+ (aom_dsp/blend-a64-mask.c's `(1, 0)` branch at 4:2:2). Every replaced
24+ expression reduces to the parent values at 4:2:0/4:4:4
25+ (`chroma_stride == chroma_buf_h == chroma_side` there), byte-identical
26+ by construction.
27+2. `read_inter_rect_chroma` now takes the per-axis stride correctly: its
28+ assembled block grid is `stride x plane-height` (`assembled_h`), the
29+ single-unit embed included — the old square `chroma_side * chroma_side`
30+ allocation panicked (`range end index 20 out of range for slice of
31+ length 16`) the moment the per-axis stride reached it.
32+3. `decode_rect_split`'s 4:2:2 BLOCK_INVALID chroma planes: the tall/wide
33+ 1:2 and 1:4 strips (`8x16, 16x32, 32x64, 8x32, 16x64`, + `64x128` for
34+ 128-SB streams) have NO chroma plane block
35+ (`av1_ss_size_lookup[...][1][0] == BLOCK_INVALID`); the plane is still
36+ coded, tiled into (4, 8) rect units — the Release oracle's
37+ out-of-bounds `max_txsize_rect_lookup[BLOCK_INVALID]` byte is TX_4X8
38+ (lane-av1-422m's measurement), and `decode_token_recon_block` steps the
39+ plane in that unit shape. Units read `TxbSet::ChromaRect8x4`/`SCAN_4X8`
40+ with `around_mi_422_chroma` ctx, mode-indexed intra tx type (the
41+ `< 32` square-up rule, pre-existing rect units unchanged at DctDct),
42+ per-unit stamps + units replay. SKIP strips predict per (4, 8) unit as
43+ well (`decode_token_recon_block`'s per-TU plane walk runs before the
44+ skip guard) — the old single whole-plane zero push asked the intra
45+ predictor for a 1:8 rect (`dc_rect_multiplier` panic, bw=8 bh=64).
46+ `EC_RECTCHROMA_GAP` now prints only truly-unhandled shapes (it used to
47+ misfire on every tiled square — the parent lane's `chroma=8x8` rows);
48+ it prints ZERO times on the fixture now. `chroma422_chunk` = 344 on the
49+ full fixture (new units provably fire).
50+4. `decode_inter_sub8_rect2`'s has_chroma gating: per-piece
51+ `is_chroma_reference` — 4:4:4 every piece, 4:2:2 both horz pieces
52+ (`!(bw & 1)`) / the odd-column vert piece (`mi_col & 1`), 4:2:0 keeps
53+ `i == 1` verbatim. The inter pieces take a per-piece inline chroma arm
54+ at 4:2:2 (U then V TX_4X4 at the floored cell, `around_mi_422_chroma`
55+ ctx, inherited piece tx type; horz predicts whole-from-own mv, vert
56+ predicts halves `build_inter_predictors_sub8x8`-style, left half from
57+ the in-group left piece or the decoded grid neighbour when the group
58+ starts on an odd column — filters unavailable on the grid, so an
59+ outside neighbour borrows this piece's filters). The 4:2:0 group tail
60+ (and the group DC stamp) are gated off at 4:2:2.
61+5. MEASURED (17-frame probe, per-OBU cut harness `/tmp/i422/cut_frames.py`,
62+ comparator ours-padded-u8-cropped vs instrumented
63+ `$HOME/.cache/aom-oracle/build` aomdec-cropped-u8; fixture `/tmp/t422.obu`
64+ sha256 `d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`):
65+ - frame 0: byte-exact at PREFILT, POSTDEB and POSTCDEF on Y, U and V —
66+ 0 diffs everywhere (FINAL not re-run this round; frame 0's final state
67+ is bracketed by POSTCDEF on a key frame).
68+ - all 16 frames decode, exit 0 — the parent lane's frame-11 refusal
69+ (`a coded HORZ/VERT strip whose chroma transform has no rect
70+ coefficient tables here`, the `luma=8x32 tx=8x8 chroma=4x32` GAP) is
71+ gone.
72+ - frames 1..15 still diverge (~24-36k Y, ~13-18k U/V per stage; ladder
73+ in `/tmp/i422/ladder/`). **Frame exactness is NOT claimed.**
74+6. REATTRIBUTION (the round's real finding): the frames-1+ divergence is
75+ NOT the chroma half. Strict stream-order EC_ISTEP pairing on the
76+ frames-0-1 cut puts the first entropy divergence at index 167 — the
77+ 8x8 group at mi(8,10): the ORACLE codes PARTITION_HORZ (pieces (8,10)
78+ and (9,10) only, both intra with uv; oracle partition trace
79+ `EC_PART mi_row=8 mi_col=10 bsize=3 ctx=0 value=1`) while OURS
80+ dispatches decode_inter_sub8_split4 (EC_SUB8INTRA: `shape=4x4 sub=0
81+ has_chroma=false mi=8,10` ... four pieces, one extra uv_mode
82+ consumption on the (9,11) odd piece). Same bits, different partition
83+ outcome at the 8x8-leaf partition read (`partition_w8` ctx/value —
84+ ours `ctx=2` at the (8,8) sibling). Every downstream diff in the
85+ ladder is walk-shift noise from that point. This is a pre-existing
86+ defect upstream of the named chroma surfaces, newly visible now that
87+ the chroma shapes no longer refuse.
88+
89+## Decision
90+
91+- The header refusal STAYS unconditional in `stream.rs`; the bypass was
92+ local-only, applied and reverted byte-identical (0 occurrences left;
93+ `stream::tests::a_non_420_subsampled_sequence_header_is_refused_by_name`
94+ green after the revert).
95+- 4:2:0/4:4:4 untouched by construction (ss-keyed arms; the 4:2:0 sub8
96+ group tail and `i == 1` rule verbatim).
97+- `read_coeffs_rect` untouched; the 4:2:0 group-tail SKIP arm untouched.
98+
99+## Deferred
100+
101+(a) The (8,10)-class partition-dispatch defect (ours SPLIT4 vs oracle
102+ HORZ) — the frames-1+ exactness blocker. Unblock: capture the 8x8
103+ leaf partition context both sides (ours `EC_TRACE_PART`, oracle's
104+ shipped partition probe) and compare `partition_ctx_mi` vs libaom's
105+ `partition_context` gather at that leaf; the chroma half itself is
106+ now shape-honest and rides on the fix.
107+(b) 4-wide strips (4x16, 4x8 luma) at 4:2:2: `decode_rect_split` still
108+ refuses `(2, 16)` chroma by name (no pair-anchor machinery there; the
109+ 4:2:0 `(4, 16)` single-unit arm would be wrong at ss (1, 0)).
110+ Unblock: the split4-style floored-pair anchor ported to the 1-mi-wide
111+ strip callers, then the OOB (4, 8) tiling.
112+(c) 128-root 4:2:2 chroma chunking (`decode_inter_block`'s side > 64
113+ mu-chunk chroma) still passes the square `chroma_side` geometry —
114+ unreachable on <=64-superblock streams (this fixture is 64-SB);
115+ flagged for whoever lands 4:2:2 128-SB support.
116+
117+## Verification
118+
119+- `cargo check -p ec-av1` (target `~/.cache/cargo-target-av1422blockhalf`):
120+ 0 warnings, 0 errors.
121+- Refusal gate green post-revert (1 passed).
122+- Probe: `OK: 16 frames decoded`; 0 `EC_RECTCHROMA_GAP` prints;
123+ `chroma422_chunk=344`, `chroma422_square=197` on the full fixture.
124+- Ladder: frame 0 = 0 diffs at PREFILT/POSTDEB/POSTCDEF (Y=U=V); frames
125+ 1..15 divergent (see 5/6 — attributed, not claimed).
126+
127+## State
128+
129+- Commit on lane-av1-422blockhalf (no push): the per-axis decode_inter_block
130+ chroma half, the read_inter_rect_chroma stride fix, the decode_rect_split
131+ (4, 8) chroma tiling incl. per-unit skip prediction, the rect2 per-piece
132+ has_chroma gating, and this report.
133+- Ladder dumps under `/tmp/i422/ladder/` (scratch, not committed).
lanes/av1422ctxgather.report.mdadded+94 -0
@@ -0,0 +1,94 @@
1+# lane-av1422ctxgather — the 4:2:2 strip chroma context gather and the
2+# clobbering pair write fixed at source; 4:2:0/4:4:4 byte-identical; the
3+# 4:2:2 header refusal STAYS
4+
5+## Outcome
6+
7+1. **The clobber (the anchor's root cause).** `decode_inter_block`'s
8+ `pair_chroma` write hardcoded the 4:2:0 pair span `(pw, ph) = (16, 8)`
9+ for every horz strip. At 4:2:2 (ss 1,0) a horz 16x4 strip is its OWN
10+ chroma reference (`is_chroma_reference`'s `!(subsampling_y)` row
11+ clause) — no pair merge ever happened, `pair_mi` is the strip itself,
12+ and the two-row span overwrote one row it does not own. Measured
13+ (t422 frame 1, EC422WATCH probe, since removed): the inter strip at
14+ mi(8,4) zeroed `left[9][1]` under the mi(8,2) 8x8 leaf's level 5
15+ before the mi(9,4) strip's own U `all_zero` read it one ctx row low
16+ (ours base 0 + 7, oracle base 1 + 7 — the parent lane's anchor
17+ facts, reproduced). The span is now `(16, 4)` at ss (1,0); 4:2:0
18+ keeps `(16, 8)`; VERT keeps `(8, 16)` in every format.
19+2. **The inter strip's chroma gather.** `decode_inter_block`'s
20+ `around_c` gathered the horz strip's context with
21+ `around_mi_rect(pair_mi, 16, 8)` — the pair span AND the plain
22+ per-mi above sampling (one chroma 4-px column spans two luma mi
23+ columns at ss_x 1, so every column's whole-unit dc sign is counted
24+ twice). At ss (1,0) it now reads `(16, 4)` through
25+ [`Neighbours::around_mi_422_chroma`]; the 4:2:0 pair merge keeps the
26+ (16, 8) span and the per-mi gather, as does 4:4:4. The same reroute
27+ catches 4:2:2 VERT (pair span (8, 16)): its above side covers one
28+ chroma column per two luma mi columns — the identical double-count —
29+ so it reads through [`around_mi_422_chroma`] too, and is
30+ oracle-correct there. Only the ss gate's excluded shapes (4:2:0
31+ VERT/4:4:4 VERT) keep the plain gather.
32+3. **The intra strip's chroma gather** (the charter's named site,
33+ `decode_rect4_16_strip` ~15331): the else arm's
34+ `around_mi_rect(pair_mi, pw, ph)` is routed through
35+ [`around_mi_422_chroma`] at ss (1,0) — the same measured rule as the
36+ other chroma gathers (10754/13774/15297/17862/18061). Shapes at other
37+ subsamplings keep the original gather.
38+4. **Class sweep found one more instance, fixed:**
39+ `read_inter_rect_chroma`'s chunked units (`multi` arm) gathered each
40+ unit with `around_mi_rect(cu_mi, span_x, span_y)`; at ss (1,0) the
41+ unit's above span covers `2*uw` luma mi columns and the per-mi gather
42+ double-counts every column. Now routed through [`around_mi_422_chroma`]
43+ at ss (1,0) only; the `else` (4:2:0/4:4:4) arm is the original
44+ expression verbatim.
45+5. Untouched, byte-identical: the intra strip's own chroma write (its
46+ pair is already `(16, 4)` at 4:2:2), `decode_rect4_16_intrabc`'s pair
47+ write (intrabc counters are 0 on the pinned fixture and intrabc has
48+ its own inventory discipline), the 4:2:0 group-tail chroma SKIP arm
49+ (reserved for its owning lane), `stream.rs`, and the 4:2:2 header
50+ refusal. The `EC_AV1_ALLOW_422_PROBE` bypass was applied to stream.rs
51+ for the probe runs and reverted; `git status` names only decode.rs.
52+
53+## Verification
54+
55+- **The anchor, before/after (probed, EC422WATCH + EC_DCDUMP):** before,
56+ `inter_pair` wrote `left[9][1] 5 -> 0` and the mi(9,4) strip's U gather
57+ read `left=[None/0]` -> base 0; after, nothing writes row 9 between the
58+ leaf's stamp and the gather, the gather reads `left=[Some(true)/5]` ->
59+ base 1 = the oracle's row. First U divergence at the parent's anchor
60+ (pre-all_zero rng 49672) is gone.
61+- **t422 inter ladder re-measured** (decode_probe + EC_AV1_{PREFILT,
62+ POSTDEBLOCK,POSTCDEF}_DUMP vs the parent's oracle dumps,
63+ /tmp/i422/ladder/oracle, our dumps /tmp/i422/av1422ctxgather/final):
64+ frame 0 is **exact at all three stages (0 diffs per plane per frame)**.
65+ Frame 1 pre-fix Y=23948 U=13513 V=13544 -> post-fix Y=1739 U=4346
66+ V=4974 (first Y diff moved from the anchor's ctx row to y=96 x=240;
67+ first chroma diffs at chroma (0,44)/(2,44)). Frames 2-15 improved on
68+ every plane (no frame regressed) but remain nonzero.
69+- **Frame exactness claimed ONLY where measured 0:** frame 0 at all
70+ stages. Frames 1+ are NOT claimed. The residual is downstream of this
71+ lane's class: frame 1's first Y diff sits at (96, 240) (mi(24,60)) and
72+ the first U/V diffs at chroma (2,44)/(0,44) — neither is a strip
73+ gather nor a pair write; attributing them is the next lane's first
74+ diff.
75+- **4:2:0/4:4:4 identity:** all four edits are gated
76+ `ss_x(fctx) == 1 && ss_y(fctx) == 0` with the non-4:2:2 arm the
77+ original expression verbatim; the lossless 4:4:4 stream gates stay
78+ green — `a_lossless_libaom_key_frame_decodes_sample_exact`,
79+ `a_lossless_libaom_inter_frame_decodes_sample_exact`,
80+ `a_real_aomenc_mixed_lossless_segment_frame_decodes_sample_exact`:
81+ 3 passed, 0 failed.
82+- `cargo check -p ec-av1` (target dir `~/.cache/cargo-target-av1422ctxgather`):
83+ **0 warnings, 0 errors**.
84+- Probes: the temporary EC422WATCH write-watch was removed before the
85+ final build and commit; the final ladder was re-run on the clean tree
86+ and matches the probed run exactly (the watch was eprintln-only).
87+
88+## State
89+
90+- Commit on lane-av1422ctxgather (no push): the four gated edits in
91+ `crates/ec-av1/src/decode.rs` + this report.
92+- Next stop named for the owning lane: the frame-1 Y diff at mi(24,60)
93+ and the chroma diffs at chroma (0,44)/(2,44) — re-run the stage ladder
94+ and the EC_ISTEP/EC_COEFF pairing from there.
lanes/av1422d.report.mdadded+92 -0
@@ -0,0 +1,92 @@
1+# lane-av1-422d — 8x8 leaf chroma unit ported at ss (1,0); refusal stays
2+
3+## Outcome
4+
5+STOP with the 4:2:2 header refusal in place. `decode_leaf8`'s chroma walk now
6+ports the 4:2:2 leaf unit (ONE 4x8 rect transform unit per plane,
7+`TxbSet::ChromaRect8x4` + `SCAN_4X8`, one txb_skip + one scan), and every leaf8
8+chroma read on the measured fixture is rng-for-rng EXACT against the oracle.
9+The stream still desyncs LATER, at `decode_leaf_rect`'s chroma arm (next
10+section), so the refusal is retained byte-identical and the probe bypass was
11+reverted before commit.
12+
13+## Change (all inside decode_leaf8's own chroma scope)
14+
15+- `decode_leaf8` (decode.rs): `chroma_422 = ss_x == 1 && ss_y == 0`; all three
16+ arms (skip, single-8x8-unit, TX4) branch to `leaf8_chroma422_unit` for the
17+ rect unit. The 4:2:0 `(4, TxbSet::Chroma4, scans.1)` selection and the 4:4:4
18+ arm are untouched. The chroma unit does NOT follow the luma var-tx split
19+ (`uv_txsize` is `av1_get_max_uv_txsize` of the block, still one 4x8 unit
20+ when luma resolves TX_4X4). The intrabc DV copy covers the whole plane block
21+ (4x8) at ss (1,0).
22+- `leaf8_chroma422_unit` (new, next to `decode_leaf8`): mirrors
23+ `sub8_leaf_chroma444`'s rect arm at the leaf's halved position — entropy
24+ context from the leaf's own 8x8 luma-span above/left state (no `+3`, the
25+ unit covers the plane block exactly), CFL source the leaf's whole 8x8 luma
26+ block, mode-derived default `tx_type` unless `INTRABC_CHROMA_TX` is armed,
27+ prediction override (intrabc DV over palette) set inside, skip predicts with
28+ `ZERO_RESIDUAL`.
29+- UV palette map extent (decode.rs:15808, leaf8's mode-info reader): the map
30+ is decoded over `(side >> ss_x, side >> ss_y)` = 4x8 via
31+ `decode_color_index_map_wh`, not the square call's `(side >> ss_x)`-squared
32+ 4x4 (class: plane-block extent squared a rect). At 4:2:0/4:4:4 the arguments
33+ evaluate identically; only ss (1,0) changes. Found live: the 16-entry map
34+ fed a 16-sample prediction override into the first 32-sample rect unit and
35+ panicked `reconstruct_rect` (`index out of bounds: the len is 16 but the
36+ index is 16`).
37+
38+## Measurement
39+
40+Fixture `/tmp/t422.obu`, sha256
41+`d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129` (reused
42+from av1422b/c by hash). Oracle `$HOME/.cache/aom-oracle/build/aomdec`
43+`EC_TRACE=1 EC_TRACE_MODE_STEP=1 EC_TRACE_COEFF=1`; ours `decode_probe` (debug,
44+private target dir) same env plus `EC_AV1_ALLOW_422_PROBE=1` (LOCAL bypass,
45+reverted).
46+
47+Coefficient-unit pairing (all_zero entry rng -> post rng), first HORZ_A 16x16
48+of frame 0:
49+
50+- leaf (0,0): 4x luma TX_4X4 ✓, U `tx_size=5` entry 46416 -> 35360 ✓, V
51+ entry 34824 -> 41920 ✓ (both my rect reads).
52+- leaf (0,2): luma TX_8X8 ✓ (post 45770 = oracle), U entry 37668 -> 33728 ✓,
53+ V entry 60936 -> 58556 ✓.
54+- 16x8 strip: luma `tx_size=8` entry 59680 -> 58977 ✓.
55+
56+All four leaf8 chroma rect reads match the oracle rng-for-rng through their
57+full coefficient bodies (each next unit's entry rng proves the previous
58+body's bit consumption).
59+
60+## First remaining divergence (named next site)
61+
62+`decode_leaf_rect`'s chroma arm, decode.rs:13060-13067. For a 16x8/8x16 rect
63+leaf at ss (1,0) the chroma plane block is 8x8 — SQUARE
64+(`TxbSet::Chroma8` + `default_scan(8)` through `read_plane`, the
65+`chroma_tiled` (8,8) shape) — but the code picks `TxbSet::ChromaRect8x4` +
66+`SCAN_8X4`/`SCAN_4X8` keyed on `ss_x == 0`. Measured: the HORZ_A's 16x8 strip
67+(mi_row=2, mi_col=0) — oracle U/V units are `tx_size=1` (TX_8X8 class, 64-
68+position eob alphabet, ctx=8); ours enters the U unit's txb_skip at the same
69+rng 38672 and coincidentally matches that one symbol (the offset-7 row shares
70+`txb_skip_chroma_8`), then reads eob off the 32-position chroma-rect alphabet
71+(eob=27 vs oracle eob=32) and desyncs. Everything after shifts.
72+
73+## Second site behind it
74+
75+`decode_rect_split`'s chroma shape table (decode.rs:10114-10133) has no 4:2:2
76+rows: a 16x64 luma strip's `(8, 64)` plane block fires
77+`EC_RECTCHROMA_GAP luma=16x64 tx=16x32 chroma=8x64` (decode stops at mi_row=16
78+once the leaf_rect site is passed). Same class likely holds for other
79+unhalved-height plane blocks in that table.
80+
81+## State
82+
83+- Refusal `a chroma format of 4:2:2 (subsampling_x != subsampling_y)...`
84+ byte-identical (bypass reverted; `git diff` shows only decode.rs).
85+- `decode_leaf_split4`, `sub8_leaf_chroma444`, `reconstruct_mc_rect`, the
86+ resize header reader, decode.rs 34390-34440: untouched.
87+- 420 gate green:
88+ `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_decodes_pixel_exact`
89+ + its 10-bit twin — 6/6 pixel-exact matches each, 0 refusals (the gate
90+ exercises the skip and TX4 arms this lane restructured).
91+- `cargo check -p ec-av1`: 0 warnings.
92+- No push.
lanes/av1422e.report.mdadded+84 -0
@@ -0,0 +1,84 @@
1+# lane-av1-422e — leaf_rect chroma is an 8x8 square unit at ss (1,0); refusal stays
2+
3+## Outcome
4+
5+STOP with the 4:2:2 header refusal in place, byte-identical. `decode_leaf_rect`'s
6+chroma arm now keys on ss: at ss (1,0) a 16x8/8x16 luma leaf's chroma plane
7+block is an 8x8 SQUARE (`TxbSet::Chroma8` + `default_scan(8)`), and every
8+leaf_rect chroma read on the measured fixture is rng-for-rng EXACT against the
9+oracle — the av1422d desync at the HORZ_A 16x8 strip (mi(2,0)) is gone, along
10+with everything up to the first 16x16 square block. The stream now desyncs at
11+that square block's chroma (next section), so the refusal is retained and the
12+probe bypass was reverted before commit (`git diff` touches only decode.rs).
13+
14+## Change (decode.rs only)
15+
16+- `decode_leaf_rect` chroma arm (was decode.rs:13060-13067): the
17+ `ss_x == 0`-keyed selection replaced by a three-way arm — `chroma_422`
18+ (`ss_x == 1 && ss_y == 0`) picks `TxbSet::Chroma8` + `default_scan(8)` for
19+ the 8x8 square plane block (luma scan unchanged: SCAN_16X8/SCAN_8X16);
20+ 4:2:0 keeps `TxbSet::ChromaRect8x4` + SCAN_8X4/SCAN_4X8; 4:4:4 keeps
21+ `TxbSet::ChromaRect16x8` + the full SCAN_16X8/SCAN_8X16. Doc comment above
22+ `decode_leaf_rect` updated to name all three subsamplings.
23+- Untouched: `decode_leaf8`, `leaf8_chroma422_unit`, `sub8_leaf_chroma444`,
24+ `decode_leaf_split4`, `reconstruct_mc_rect`, the resize header reader,
25+ `decode.rs` 34390-34440.
26+
27+## Measurement
28+
29+Fixture `/tmp/t422.obu`, sha256
30+`d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129` (reused by
31+hash). Oracle `$HOME/.cache/aom-oracle/build/aomdec`
32+`EC_TRACE=1 EC_TRACE_MODE_STEP=1 EC_TRACE_COEFF=1`; ours `decode_probe` (debug,
33+private target dir) same env plus a LOCAL `EC_AV1_ALLOW_422_PROBE` bypass
34+env-gated at the stream.rs refusal — reverted before commit, and the refusal
35+was re-proven to fire without the env.
36+
37+The first leaf_rect 16x8 strips that desynced in av1422d now pair rng-for-rng
38+through their full luma + U + V coefficient bodies (all EC_COEFF_STEP rngs
39+match: all_zero, tx_type, eob, base_eob, br, sign, post_golomb), and the ISTEP
40+stream stays identical well past them. With that site passed, decode now
41+reaches the first 16x16 square intra block, mi(4,4).
42+
43+## First remaining divergence (named next site, with oracle evidence)
44+
45+The SQUARE-block path's 4:2:2 chroma model, decode.rs:16704-16721
46+(lane-av1-422b's arm inside the `(luma_set, chroma_set, luma_tx, chroma_tx,
47+scans)` selection): it models `av1_get_max_uv_txsize` of the (side/2, side)
48+plane block as "the SQUARE transform of the smaller dimension" and walks a grid
49+of square units (side 16 -> two 8x8 units). The oracle disagrees — aom reads
50+`max_txsize_rect_lookup` of the PLANE block, a RECT that fills it exactly:
51+
52+- ours, mi(4,4) side=16: all_zero `side=8 ctx=5` at rng 44044 -> eob read on
53+ the 8x8-class alphabet (eob=48) — the first of two square units.
54+- oracle, same block: `all_zero plane=1 bc=0 br=0 ctx=9 txs=2` at rng 36040 —
55+ ONE unit, TX_8X16 class (16x16 entropy class), whole 8x16 plane block.
56+
57+Correct model per aom (`av1_get_max_uv_txsize` = `max_txsize_rect_lookup`
58+[plane_bsize], then `av1_get_adjusted_tx_size`): side 8 -> TX_4X8
59+(ChromaRect8x4 + SCAN_4X8, one unit — the shape av1422d proved at leaf8);
60+side 16 -> TX_8X16 (ChromaRect16x8 + SCAN_8X16, one unit); side 32 -> TX_16X32
61+(ChromaRect32x16 + SCAN_16X32, one unit); side 64 -> TX_32X64 adjusts to
62+TX_32X32, i.e. two stacked 32x32 units, which the current square walk already
63+produces. The fix spans the square path's three chroma walks (skip 17019-17067,
64+single-unit 17120-17260, chunked 17273-17553) since they thread `chroma_tx` as
65+both unit dims; it needs per-axis unit dims keyed to ss (1,0). That is its own
66+lane round — not started, no rows invented, no BLOCK_INVALID portrait shape.
67+
68+The av1422d second site (decode_rect_split's chroma table missing (8,64)) did
69+NOT fire this round: the square-path site above blocks first. The
70+decode_rect_split 16x8-strip reads (chroma 8x8 via the chroma_tiled arm) pass
71+the oracle rng-for-rng; the repeated `EC_RECTCHROMA_GAP luma=16x8 tx=8x8
72+chroma=8x8` prints are the pre-existing diagnostic (chroma.is_none() before the
73+chroma_tiled fallback), not refusals.
74+
75+## State
76+
77+- Refusal `a chroma format of 4:2:2 (subsampling_x != subsampling_y)...`
78+ byte-identical (bypass reverted; probe refuses without the env).
79+- `cargo check -p ec-av1` (private target dir): 0 warnings.
80+- 420 gates green: `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_
81+ tx_split_decodes_pixel_exact` + its 10-bit twin — 2/2 pass (exercises the
82+ skip and TX4 arms restructured in av1422d; the new 422 arm is unreachable at
83+ 420 by its ss condition).
84+- No push. Traces left at /tmp/ours422.txt and /tmp/oracle422.txt.
lanes/av1422f.report.mdadded+115 -0
@@ -0,0 +1,115 @@
1+# lane-av1-422f — square-block chroma is the plane block's own rect unit; refusal stays
2+
3+## Outcome
4+
5+STOP with the 4:2:2 header refusal in place, byte-identical (probe refuses
6+without the env; the local bypass was reverted before commit). The
7+square-block path (decode.rs's `(luma_set, chroma_set, luma_tx, chroma_tx,
8+scans)` selection, formerly 16704-16721) now models `av1_get_max_uv_txsize`
9+as `av1_get_adjusted_tx_size(max_txsize_rect_lookup[plane_bsize])` — the RECT
10+that fills the (side/2, side) plane block — and all three chroma walks read
11+one `(chroma_tx, chroma_tx_h)` unit per grid cell, keyed on ss (1,0). The
12+av1422e first miss (mi(4,4) side 16: ours two 8x8 units, oracle one TX_8X16)
13+is gone, and the decode now aligns with the oracle unit-for-unit through 117
14+coefficient units — every 16x16 block's U/V TX_8X16 pair, every 8x8 leaf's
15+U/V TX_4X8 pair, every 16x8 strip's 8x8-square chroma — with equal entry rngs
16+wherever ours prints them. The stream is not pixel-exact: the next divergence
17+is the sub-8x8 4x4-leaf chroma at 4:2:2 (TX_4X4 units, one per even-column
18+leaf), which lives in `decode_leaf_split4`/`decode_leaf8` — other lanes — so
19+the refusal is retained.
20+
21+## Change (decode.rs + decode_probe.rs only)
22+
23+- Selection arm at ss (1,0): per-axis unit dims `chroma_tx` (width) x
24+ `chroma_tx_h` (height) — 4 -> (4,4), 8 -> (4,8), 16 -> (8,16), 32 ->
25+ (16,32), 64/128 -> (32,32) — with the unit's TxbSet/scan:
26+ `ChromaRect8x4`+`SCAN_4X8`, `ChromaRect16x8`+`SCAN_8X16`,
27+ `ChromaRect32x16`+`SCAN_16X32`, `Chroma32`+scan32. The destructure gains
28+ `chroma_tx_h`; 4:2:0/4:4:4/lossless arms carry `chroma_tx` twice, so their
29+ walks are untouched.
30+- New `read_rect_chroma_unit`: one rect chroma unit via the
31+ `read_coeffs_rect` route (the `chroma_tiled` arm's and
32+ `leaf8_chroma422_unit`'s proven shape): `txb_skip_ctx` = above+left in the
33+ offset-7 rows (the unit covers the plane block exactly, so no +3), the
34+ mode-derived default `tx_type` unless `INTRABC_CHROMA_TX` is armed, the
35+ `side >= 32` DCT_DCT clamp, `dequant_and_inverse_typed_wh` +
36+ `push_intra_rect`. Bumps the new `CHROMA422_RECT_HITS` witness counter
37+ (keyed ss (1,0), unit w != h).
38+- New `push_intra_unit`: `push_intra` when square, `push_intra_rect` when
39+ rect — used by the skip walk.
40+- All three chroma walks (skip, single-TU, chunked) key on the per-axis
41+ unit dims: `cn_rows = chroma_height / chroma_tx_h`, `luma_span_y =
42+ chroma_tx_h << ss_y`, per-axis cu positions and palette windows. Below
43+ side 64 a 4:2:2 frame's grid is 1x1 and the one unit is the whole plane
44+ block. The chunked walk's edge clip computes `max_units_h` per axis at
45+ ss (1,0) (the shared halved formula assumes a subsampled height and would
46+ clip units libaom codes); the shared rows stay for 4:2:0/4:4:4.
47+- New `Neighbours::around_mi_422_chroma` for the square path's chroma context
48+ reads: libaom `get_txb_ctx_general` sums its dc-sign votes over
49+ `txb_w_unit` CHROMA 4-px cells, and at ss_x 1 one chroma cell spans TWO
50+ luma mi columns — the per-luma-mi sum double-counts the above votes and
51+ flips `dc_sign_ctx` when the above and left votes have opposite signs
52+ (measured at mi(4,4) plane 1: ours read `dc_sign_cdf[1]`, the oracle row
53+ 0). Sampling every second above cell counts each chroma column once, which
54+ is exactly libaom's sum; the level booleans are ORs over duplicated cells
55+ and cannot change. Used by the single-TU walk's rect branch and both
56+ multi-unit loops at ss (1,0) only; 4:2:0/4:4:4 keep `around_mi_rect`.
57+- `examples/decode_probe.rs`: prints `chroma422_rect`.
58+
59+Untouched: `decode_leaf8`, `decode_leaf_split4`, `decode_rect4_16_strip`,
60+`decode_block_128rect`, `decode_rect_split`, the resize header reader, the
61+frame-9 filter path, and refusal_inventory.rs (the refusal string is
62+byte-identical; the gate stays green).
63+
64+## Measurement
65+
66+Fixture `/tmp/t422.obu`, sha256
67+`d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129` (reused by
68+hash, 256x144, 22 frames). Oracle `$HOME/.cache/aom-oracle/build/aomdec`
69+`EC_TRACE=1 EC_TRACE_MODE_STEP=1 EC_TRACE_COEFF=1`; ours `decode_probe`
70+(debug, `gate-counters`, private target dir) with a LOCAL
71+`EC_AV1_ALLOW_422_PROBE` env-gated bypass at the stream.rs refusal —
72+reverted before commit, and the refusal re-proven to fire without the env.
73+
74+- Unit-level: 117 consecutive units with equal ENTRY rngs (rect reads print
75+ `entry=`; the first entry mismatch is unit #117), identical unit order and
76+ shapes: 16x16 blocks read ONE TX_8X16 per plane (mi(4,4): U entry 44042,
77+ all_zero ctx row 2 = libaom ctx 9, post-rng 36040, eob 3 — the av1422e
78+ first miss, now exact), 8x8 leaves ONE TX_4X8 per plane, 16x8 strips the
79+ 8x8 square, 8x16 strips 4x16.
80+- Symbol-level: the deduplicated rng trajectories match value-for-value
81+ through the mi(8,0) leaf's V (ours state 1100), modulo four
82+ oracle-instrumentation print gaps (sub-reads libaom's patched print does
83+ not emit; the trajectories re-align around each).
84+- Counters: `chroma422_rect: 28`, `chroma422_square: 23` — 28 rect chroma
85+ units ran on the 4:2:2 frame (a 4:2:0/4:4:4 frame cannot increment it; the
86+ counter reads 0 under the old square model).
87+
88+## First remaining divergence (named next site, with oracle evidence)
89+
90+At the 8x8 sub8 group whose leaves sit at mi(8,10)/(8,11)/(9,10)/(9,11): the
91+oracle's 4x4 LEAVES at even mi columns are chroma references at 4:2:2 and
92+each codes a TX_4X4 chroma unit (mi(9,10) plane 1, 38 steps, after only its
93+own luma) — `ss_size_lookup[BLOCK_4X4][1][0]` is BLOCK_4X4, so the 2x4 plane
94+rounds up and reads as TX_4X4. Ours reads the leaf's second luma TX_4X4 as
95+all-zero where the oracle codes coefficients (oracle 16 steps, ours 1), the
96+first value-level divergence, and everything after is desynced; the run then
97+ends at `decode_rect4_16_strip`'s closed-shape panic (shape-driven, reached
98+by the same partition walk). Both sites live in `decode_leaf_split4` /
99+`decode_leaf8` / `decode_rect4_16_strip` — other lanes. The sub-8x8 4:2:2
100+model needs the is_chroma_ref rule `!(mi_col & ss_x)` (every even-column
101+leaf, not 4:2:0's single bottom-right leaf) plus the TX_4X4 chroma shape.
102+
103+## State
104+
105+- Refusal `a chroma format of 4:2:2 (subsampling_x != subsampling_y)...`
106+ byte-identical (bypass reverted; `git diff` touches only decode.rs and
107+ decode_probe.rs; probe refuses without the env).
108+- `cargo check -p ec-av1` (private target dir
109+ `$HOME/.cache/cargo-target-av1422f`): 0 warnings.
110+- 420 gates green: `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_
111+ whose_tx_split_decodes_pixel_exact` + its 10-bit twin — 2/2 pass (the new
112+ arms are unreachable at 420 by their ss condition; `chroma_tx == chroma_tx_h`
113+ on every 4:2:0/4:4:4 path). Refusal gate
114+ `a_non_420_subsampled_sequence_header_is_refused_by_name` green.
115+- No push. Traces left at /tmp/ours422f.txt and /tmp/oracle422.txt.
lanes/av1422filter.report.mdadded+128 -0
@@ -0,0 +1,128 @@
1+# lane-av1-422filter — the 4:2:2 loop-filter chroma class: NAMED and FIXED
2+
3+## Outcome
4+
5+1. REMEASURED first (pinned fixture `/tmp/t422.obu` sha256
6+ `d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`,
7+ single-frame cut `/tmp/t422f0.obu` sha256
8+ `3dd3f768ef553c02316848c2d3184c3765030c0a6fcb95887e4719add9ded3af`,
9+ 256x144 / chroma 128x144, local `EC_AV1_ALLOW_422_PROBE` bypass applied
10+ and reverted byte-identical after): with `EC_AV1_PREFILT_DUMP` /
11+ `EC_AV1_POSTDEBLOCK_DUMP` / `EC_AV1_POSTCDEF_DUMP` / `EC_AV1_FINAL_DUMP`
12+ on both sides, the frame-0 pre-filter AND post-deblock planes are
13+ byte-exact (deblock did identical work both sides: 797/637/727 samples
14+ changed, same set) — the 1236/1263 final chroma diffs are introduced
15+ AFTER deblock. Attribution ladder, ours vs the instrumented aomdec:
16+
17+ | stage | Y | U | V |
18+ |----------------------|------------|-----------------|-----------------|
19+ | pre-filter | 0 | 0 | 0 |
20+ | post-deblock | 0 | 0 | 0 |
21+ | post-CDEF | 0 | **251** (50,0) | **259** (48,0) |
22+ | final | 0 | **1236→253** | **1263→266** |
23+
24+ (the pre-fix row shows the parent's numbers; the ticket's first final
25+ sample V (48,0) is literally the first post-CDEF defect sample.)
26+2. The oracle had NO 8-bit post-CDEF rung (its `EC_AV1_POSTCDEF_DUMP` was
27+ 16-bit only; the earlier `aom/pcd.f0` measurement was actually its
28+ post-deblock output — the rung had to be re-derived to isolate CDEF from
29+ LR). Added an 8-bit `EC_AV1_POSTCDEF_DUMP` twin to the oracle's
30+ `decodeframe.c` (right after the `do_cdef` block, full aligned buffer,
31+ same shape as the POSTDEBLOCK rung) and rebuilt
32+ `$HOME/.cache/aom-oracle/build` aomdec with ninja. The CDEF verdict was
33+ then direct: 251/259 samples, first exactly U (50,0) / V (48,0).
34+3. DEFECT 1 (the big one) — **the 4:2:2 LR boundary-band snapshot is taken
35+ on a 4:2:0 stripe grid**. `plane_snapshot` copies only the 4-row bands
36+ LR's stripe substitution reads (`stripe_h - offset` per 64 rows); the
37+ chroma calls hardcoded `ss_y = 1`, so for 4:2:2 (chroma stripes on the
38+ luma 64-row grid, offset 8) the bands landed at rows 26/60/92/124 while
39+ LR read rows 54..57/118..121 — every boundary substitution read
40+ uninitialised scratch (zeros): 999 U / 963 V samples filtered where aom
41+ filters nothing, |delta| up to 24 at the top rows. Fixed at all three
42+ sites of the class: the keyframe and inter non-pipelined
43+ `plane_snapshot(&u/&v, ss_y(fctx))`, the pipeline's `snap_band` band rows
44+ `(j*64) >> ss_y`, and `pipe_run_lr`'s chroma `dims` (plane extents
45+ `round_ss`, ss carried, not `div_ceil(2)`+1). 4:2:0 is bit-identical
46+ (ss_y=1 reproduces the old bands/rows/dims exactly).
47+4. DEFECT 2 — **the CDEF chroma direction remap was missing**. libaom
48+ `av1_cdef_filter_fb` (cdef_block.c) remaps the luma direction through
49+ `conv422 = [7,0,2,4,5,6,6,6]` (in place; V then inherits U's remapped
50+ grid) whenever `xdec != ydec` — the direction grid lives on the
51+ subsampled chroma grid. The port filtered chroma with the raw luma
52+ direction: after the LR fix the residual was exactly the CDEF stage,
53+ 251/259 samples all ±1/±2 (168 we-filtered-aom-doesn't, 71
54+ aom-filters-we-don't, 12 value diffs on shared samples; scalar and AVX2
55+ kernels byte-identical, so shared logic, not the SIMD path). Fixed with
56+ `CDEF_DIR_CONV422`/`CDEF_DIR_CONV440` applied for `(ss_x, ss_y)` =
57+ (1,0)/(0,1); 4:2:0 and 4:4:4 take `_ => dir` unchanged.
58+5. MEASURED after both fixes: **frame 0 of the pinned 4:2:2 fixture is
59+ byte-exact vs the oracle at PREFILT, POSTDEBLOCK, POSTCDEF and FINAL on
60+ Y, U and V** (0 diffs everywhere). Non-vacuity on this frame:
61+ `chroma422_square` = 24, `chroma422_rect` = 96, `chroma422_sub8` = 26 —
62+ the touched 422 arms provably ran. Instrument for the LR half: a python
63+ re-computation of the stripe walk + `lr_src_row` substitution + the
64+ port's own wiener rounding reproduced the oracle's post-LR chroma plane
65+ EXACTLY from the oracle's post-CDEF input (0 mismatches), which pinned
66+ the residual defect to the snapshot input, not the filter math.
67+6. REMAINING: none for this class. The `read_coeffs_rect` frame-9 scratch
68+ panic (inter frames of the 22-frame stream) is untouched, as chartered.
69+
70+## Decision
71+
72+- **444 LR follow-up (review finding 2): RED, stopped and reported.** A
73+ 3-frame 192x160 `aomenc --profile=1 --enable-restoration=1` stream
74+ (lr types per frame: `[Sgrproj,None,Switchable]` / `[None,None,Sgrproj]`
75+ / `[Sgrproj,None,Switchable]`) diverges from both the instrumented aomdec
76+ and ffmpeg on frames 0/1 (~26k samples/plane, maxabs 255) and matches
77+ exactly on frame 2. The divergence is already fully present at
78+ EC_AV1_PREFILT_DUMP (frame 0 pre: Y 6124 @ (0,128), U 9176 @ (160,64),
79+ V 10196 @ (128,64)) — a pre-existing 444 RECONSTRUCTION defect, not a
80+ loop-filter one and not this lane's regression: the parent commit
81+ (cc3783f4, scratch worktree) measures 26673/26310/158 against the same
82+ stream, so this lane's ss_y fix strictly improves 444 (frame 2 went to
83+ exact, frames 0/1 shrank) but cannot pin a pixel-exact gate over a
84+ stream whose reconstruction is still wrong. Named for the owning lane:
85+ 444 intra reconstruction around the row-64/row-128 SB boundaries (class:
86+ pre-existing 444 recon; loop filters exonerated — the damage exists
87+ pre-deblock and the filter stages track it 1:1).
88+- The header refusal STAYS unconditional in `stream.rs` — the probe bypass
89+ was local-only, applied and reverted byte-identical before the commit
90+ (`git diff` after the revert carries only the decode.rs fix); the
91+ refusal-by-name gate re-verified firing.
92+- `read_coeffs_rect` untouched. The 4:2:0 group-tail SKIP arm untouched.
93+ `sub8_leaf_chroma422` (parent lane's three fixes) untouched.
94+- The 8-bit `EC_AV1_POSTCDEF_DUMP` rung was added to the ORACLE's source
95+ tree (`$HOME/.cache/aom-oracle/src/av1/decoder/decodeframe.c`, rebuilt
96+ with ninja) and transcribed into
97+ `scripts/instrument-aom-oracle.sh` as rung 15 — its generator block
98+ reproduces the hand patch byte-for-byte (verified by strip-and-replay on
99+ the live tree; the marker `EC_INSTRUMENTED_POSTCDEF` keeps re-runs
100+ no-op), so `build-aom-oracle.sh` + the script rebuild the full ladder
101+ from scratch again.
102+
103+## Verification
104+
105+- `cargo check -p ec-av1` (target `~/.cache/cargo-target-av1422filter`):
106+ 0 warnings, 0 errors.
107+- Frame-0 stage dumps, ours vs the instrumented aomdec (cropped
108+ comparisons; our stage dumps are 256x160/128x160 padded, the oracle's
109+ cropped 256x144/128x144 — the comparator crops): all four stages, all
110+ three planes, 0 diffs.
111+- 420 gates green (all with the fix in place):
112+ `stream::tests::a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_
113+ whose_tx_split_decodes_pixel_exact` under `EC_AV1_REQUIRE_AOMENC=1`
114+ (1 passed), `stream::tests::a_real_aomenc_stream_with_restoration_reads_
115+ lr_symbols_correctly` (1 passed — the LR-snapshot regression gate),
116+ `a_superres_key_frame_with_cdef_and_loop_restoration_decodes_pixel_exact`
117+ (1 passed), `a_non_420_subsampled_sequence_header_is_refused_by_name`
118+ (1 passed).
119+- Scalar-vs-AVX2 CDEF chroma A/B on this frame: 0 diffs between kernels
120+ (the 4x8 chroma shape was already SIMD-faithful; the defect was the
121+ direction input).
122+
123+## State
124+
125+- Commit on lane-av1-422filter (no push): the LR snapshot ss_y fix (three
126+ sites) + the CDEF conv422 direction remap + this report.
127+- The instrumented oracle build at `$HOME/.cache/aom-oracle/build` now
128+ carries the 8-bit `EC_AV1_POSTCDEF_DUMP` rung for future lanes.
lanes/av1422g.report.mdadded+102 -0
@@ -0,0 +1,102 @@
1+# lane-av1-422g — sub-8 even-column chroma-ref arm; STOP: split4 is never reached on t422
2+
3+## Outcome
4+
5+STOP with the 4:2:2 header refusal in place, byte-identical (the local
6+`EC_AV1_ALLOW_422_PROBE` bypass was reverted before commit; the probe refuses
7+without the env — `frames_dispatched: 0`). The even-column chroma-reference
8+arm for ss (1,0) is in `decode_leaf_split4` per the parent's rule
9+(`is_chroma_ref = !(mi_col & ss_x)`, one TX_4X4 chroma unit per plane per
10+even-column leaf, 4:2:0 keeps its single bottom-right leaf), but it is
11+UNPROVEN and — the round's real finding — UNREACHABLE on this fixture:
12+
13+the frame-0 partition walk never takes an 8x8 `PARTITION_SPLIT`. An
14+`EC_AV1_TRACE` probe printed **zero** split8 group entries before the run
15+dies at `decode_rect4_16_strip`'s closed-shape panic. Our trace is
16+byte-identical to 422f's (modulo pid), so the divergence 422f attributed to
17+the mi(9,10) sub-8 chroma begins EARLIER: by the time the walk reaches the
18+8x8 at mi(8,10), ours reads a partition value that is not SPLIT, while the
19+oracle's own trace decodes four 4x4 leaves at mi(8,10)/(8,11)/(9,10)/(9,11).
20+Per instruction 2 the named stop line is:
21+
22+ crates/ec-av1/src/decode.rs:14888 — unreachable!("decode_rect4_16_strip chroma shape set is closed")
23+
24+reached with chroma shape `(16, 64)` off a `luma=32x64 tx=16x16` strip (the
25+`EC_RECTCHROMA_GAP luma=32x64 tx=16x16 chroma=16x64` diagnostic prints right
26+before the panic; the 16 prints of `luma=16x8 → chroma=8x8` earlier are the
27+4:2:2 square rows downstream and are harmless). decode_rect4_16_strip was not
28+edited; that panic is the next lane's gate, not this one's fix.
29+
30+## Change (decode.rs + decode_probe.rs only)
31+
32+- `decode_leaf_split4`: `has_chroma` now branches per subsampling — 4:4:4
33+ every leaf, 4:2:2 `(lmi.1 & 1) == 0` (every even-mi-column leaf), 4:2:0
34+ `i == 3` unchanged. A `chroma_422` flag (ss_x 1, ss_y 0) and a
35+ `last_uv422` coarse-slot value were added; the group tail gained a 4:2:2
36+ branch that only fills `above_uv_mode`/`left_uv_mode` from the group's
37+ last chroma-reference leaf (bottom-left), and the tail's chroma state
38+ stamp is skipped at 4:2:2 (the per-leaf units already stamped).
39+- New `sub8_leaf_chroma422` (beside `sub8_leaf_chroma444`): one square
40+ TX_4X4 chroma unit per plane at the chroma position
41+ (`px >> ss_x`, `py >> ss_y`) — `ss_size_lookup[BLOCK_4X4][1][0]` is
42+ BLOCK_4X4, so the (2,4) plane area rounds up to the square 4x4 read — via
43+ `read_plane`'s proven `TxbSet::Chroma4` + `TX4` route, with
44+ `Neighbours::around_mi_422_chroma(lmi, 8, 4)` context reads (the unit's 4
45+ chroma-px width spans TWO luma mi columns; sampling every second above
46+ cell counts each chroma column once), `cfl_src_rect(px, py, 8, 4)` CfL
47+ source, skip arm (predict-only, intrabc-slot disarm counted), intrabc arm
48+ (frame copy at the DV with the ss shifts), and per-leaf entropy stamping
49+ (1 mi row tall, both luma mi columns of the one chroma column).
50+- New `CHROMA422_SUB8_HITS` witness counter, bumped only on the two
51+ coefficient-reading arms (skip does not count); printed as
52+ `chroma422_sub8` by `examples/decode_probe.rs`.
53+- Untouched: `decode_leaf8`, `decode_rect4_16_strip`, `decode_block_128rect`,
54+ `decode_rect_split`, the 4:2:0 group tail (including its SKIP arm at
55+ decode.rs:19169-19170 — the sibling-owned flat-DC miss), the square-block
56+ selection arm, `stream.rs` (bypass reverted; refusal string
57+ byte-identical), `refusal_inventory.rs`.
58+
59+## Measurement
60+
61+Fixture `/tmp/t422.obu`, sha256
62+`d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129` (reused
63+by hash, 256x144, 22 frames). Ours `decode_probe` (debug, gate-counters,
64+private target dir) with the LOCAL env bypass; oracle traces from 422f left
65+at /tmp/oracle422.txt.
66+
67+- **Reach probe**: with `EC_AV1_TRACE=1`, a temporary per-group print in
68+ `decode_leaf_split4` (since removed) fired ZERO times before the panic —
69+ split4 never runs on this stream; the arm cannot fire, and the
70+ `chroma422_sub8` counter reads 0 for the trivial reason.
71+- **Trace identity**: our full run (stderr trace, 13029 lines) is
72+ byte-identical to 422f's /tmp/ours422f.txt except the panic line's thread
73+ id — the 422g changes do not alter the trajectory, confirming the
74+ pre-split8 divergence.
75+- `cargo check -p ec-av1` (private target dir): 0 warnings.
76+- 420 gate green: `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_
77+ whose_tx_split_decodes_pixel_exact` 1/1 passed (`cargo test -p ec-av1
78+ --lib`); all new arms are keyed on ss (1,0), unreachable at 4:2:0/4:4:4.
79+
80+## Next divergence (restated, for the lane that owns the walk)
81+
82+The first live defect is UPSTREAM of sub-8: between the last symbol-level
83+match (mi(8,0) 8x8 leaf's V) and the mi(8,10) 8x8, ours mis-reads the 8x8
84+partition symbol (oracle SPLITs, we do not), and the desynced walk later
85+lands on the 32x64 strip whose 16x64 chroma has no table row (panic above).
86+Two candidate sites for whoever picks this up: the partition-symbol context
87+feeding `partition_w8` after an 8x8 leaf run (422f's tail bookkeeping
88+changed side_mi/partition ctx for the following sibling), or an 8x8-leaf
89+chroma/context read that consumes the wrong rng count and shifts every later
90+partition read. Note the rect split4 sibling (the 8x16/16x8 group walker
91+with `bw`/`bh` args, ~decode.rs:20500) has the same 4:2:0-style chroma and
92+will need the same even-column treatment once the walk reaches any rect sub-8
93+group at 4:2:2.
94+
95+## State
96+
97+- Refusal `a chroma format of 4:2:2 (subsampling_x != subsampling_y)...`
98+ byte-identical; `git diff` touches only decode.rs and decode_probe.rs;
99+ probe refuses without the env (frames_dispatched: 0).
100+- Committed on lane-av1-422g (5e163e94). No push.
101+- Traces left at /tmp/ours422g_trace.txt (EC_TRACE_COEFF run) and
102+ /tmp/ours422g_t2.txt (EC_AV1_TRACE reach run).
lanes/av1422h.report.mdadded+96 -0
@@ -0,0 +1,96 @@
1+# lane-av1-422h — 4:2:2 sub-8/rect chroma model proven rng-exact to the bottom-edge SBs; refusal stays
2+
3+## Outcome
4+
5+The assignment's premise — "ours reads a non-SPLIT partition at mi(8,10)" — was
6+FALSE, and this round proves it with partition-level oracle traces: at mi(8,10)
7+both decoders read `bsize=3 ctx=0 rng=37068 → value=1` (PARTITION_HORZ).
8+`read_partition` in the oracle source already carried an `EC_PART` probe
9+(patch never enabled by the 422f/g generation recipe), so this round's traces
10+are the first with the walk checkpointed per partition read; pairing them
11+(`EC_PART` rng values, tell offset constant +14) shows the true first
12+divergences and lets every fix below be verified rng-for-rng.
13+
14+Four 4:2:2 chroma-model defects found and fixed (all in `decode_leaf_rect8`,
15+`decode_leaf8`, `decode_leaf_split4`/`sub8_leaf_chroma422`, `decode_block`):
16+
17+1. **`decode_leaf_rect8` (BLOCK_8X4/BLOCK_4X8 strips) used the 4:2:0
18+ `i == 1`-only chroma rule.** `is_chroma_reference`
19+ (av1_common_int.h:1459) at ss (1,0): a HORZ pair's BLOCK_8X4 strips are
20+ BOTH chroma references (`!(bw & 1)`), a VERT pair's BLOCK_4X8 strips keep
21+ the odd-column leaf. Oracle evidence at the mi(8,10) HORZ pair: uv_mode
22+ read at BOTH (8,10) and (9,10), each strip followed by its own one-TX_4X4
23+ chroma unit per plane. Fixed `has_chroma` to `!vert || i == 1` at 4:2:2
24+ and decoded each reference strip's chroma right after its luma via
25+ `sub8_leaf_chroma422` (split path, whole-leaf path, intrabc path), with
26+ the 4:2:0 group tail gated off at 4:2:2 and the coarse uv slots filled
27+ from the last reference strip. The mi(8,10) pair now decodes
28+ rng-for-rng (strip mode reads end at oracle's exact rngs 63250/33264).
29+2. **`decode_leaf_split4`'s 4:2:2 column parity was inverted** (422g's
30+ `(mi_col & 1) == 0` "even-column" rule — derived by 422f from a
31+ pre-partition-trace misreading of the (8,10) HORZ pair as a split
32+ group). Oracle, mi(30,42) split group: uv_mode read at mi(30,43) and
33+ mi(31,43) ONLY — the ODD columns, per the formula's column clause
34+ `(mi_col & 1)`. Fixed to `(lmi.1 & 1) == 1`.
35+3. **`sub8_leaf_chroma422` anchored the odd-column leaf's ctx read/write at
36+ the leaf's own column.** libaom anchors at the FLOOR chroma cell
37+ (`pd->above_entropy_context + blk_col` with `blk_col = mi_col >> ss_x`):
38+ an odd-column 4x4 leaf's unit starts at chroma px 86, whose containing
39+ cell is luma mi col 42, so the ctx read AND the per-TU state write land
40+ on luma mi 42,43, not 43,44. Added `ctx_mi = (lmi.0, lmi.1 & !1)`.
41+4. **`decode_leaf8`'s 4:2:2 chroma rect unit read its txb ctx through the
42+ plain `around_mi`** — the 422f-class dc-vote double-count (one chroma
43+ ctx cell spans TWO luma mi columns at ss_x 1) in the leaf8 path.
44+ Oracle evidence at mi(2,24) plane 2: ours dc_sign row 0, oracle row 2.
45+ Both 422 arms now read `around_mi_422_chroma(leaf_mi, 8, 8)`.
46+
47+## Measurement
48+
49+Fixture `/tmp/t422.obu` reused by hash
50+`d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`
51+(256x144, 22 frames). Oracle
52+`$HOME/.cache/aom-oracle/build/aomdec EC_TRACE=1 EC_TRACE_MODE_STEP=1
53+EC_TRACE_COEFF=1 EC_PALSYN=1` (the `EC_PART` probes ship in the patched
54+tree's `read_partition`); ours `decode_probe` with a LOCAL
55+`EC_AV1_ALLOW_422_PROBE` bypass at the stream.rs refusal — REVERTED before
56+commit, refusal re-proven to fire by name without the env.
57+
58+- After fixes 1–3, the frame-0 partition streams pair 1:1 rng-for-rng from
59+ the tile start through oracle #327 — tell offset constant +14 — covering
60+ every HORZ/VERT 8x8 pair, every split4 group, the (28,44) 16x16 square
61+ (one TX_8X16 chroma per plane, ctx row 9 = our 7-base row 2 after fix 1's
62+ stamp anchor) and the (30,42)/(24,56) bodies.
63+- Fix 4 (leaf8 dc-sign sampling) was located by the same pairing: the
64+ mi(2,24) 8x8 NONE leaf consumed the oracle's exact 13 bits but landed at
65+ rng 53768 vs 61448; the sign phase of its V plane diverged (dcctx 0 vs 2).
66+
67+## Next divergence (named stop, for the lane that owns the partial-SB walk)
68+
69+Frame 0 now desyncs where the bottom superblock row begins: the 64x64 at
70+mi(32,0) hangs over the bottom edge (`has_rows=false`), and libaom READS a
71+gathered two-symbol partition there (`EC_PART mi_row=32 mi_col=0 bsize=12
72+ctx=13 tell=19221 rng=54818` → `EC_PART_VAL value=1`, i.e. HORZ from the
73+`partition_gather_horz_alike` cdf, splitting the SB into two 64x32
74+strips). Our walk reads NO partition symbol for that SB and dispatches
75+straight into a 64x32 strip walk (`EC_RECTCHROMA_GAP luma=64x32
76+tx=32x32 chroma=32x32`), one symbol behind from there. Note the strip
77+reader's 4:2:2 chroma for a 64x32 strip (32x32 square, `ss (1,0)`) rides
78+the existing square arm. The `decode.rs:14888` closed-shape panic and the
79+`decode.rs:19169` skip arm were not touched.
80+
81+## State
82+
83+- Refusal `a chroma format of 4:2:2 (subsampling_x != subsampling_y)...`
84+ byte-identical; `git diff` touches only `decode.rs`; the probe refuses
85+ without `EC_AV1_ALLOW_422_PROBE` (measured this round).
86+- `cargo check -p ec-av1` (private target dir
87+ `$HOME/.cache/cargo-target-av1422h`): 0 warnings.
88+- 420 gates green: `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_
89+ whose_tx_split_decodes_pixel_exact` 2/2 (both variants) and
90+ `a_non_420_subsampled_sequence_header_is_refused_by_name` 1/1. Every
91+ changed arm is keyed on ss (1,0); the 4:2:0/4:4:4 paths keep their
92+ proven rows and stamps.
93+- Temporary EC_RECTDBG/LEAFDBG/CHROMAWALK instrumentation removed before
94+ commit.
95+- No push. Traces left at /tmp/o_pal.txt (full-probe oracle),
96+ /tmp/o_part.txt, /tmp/u_cur.txt.
lanes/av1422i.report.mdadded+76 -0
@@ -0,0 +1,76 @@
1+# lane-av1-422i — bottom-SB-row partition gather re-measured: already rng-exact at HEAD; refusal stays
2+
3+## Outcome
4+
5+The assignment's premise — "ours reads no partition symbol at the bottom 64x64
6+mi(32,0)" — is FALSE at HEAD 6cdd3dae, and this round proves it with live
7+traces instead of the previous round's EC_PART-only dumps. The gathered
8+two-symbol read the assignment asks for has existed since lane-hgkf r1
9+(`decode.rs:27096`, the `(true, false)` arm of the 64-level dispatch): it reads
10+`gather(&cdfs.partition_w64[ctx], VERT_ALIKE)` with
11+`VERT_ALIKE = [2, SPLIT, 4, 6, 7, 9]`, maps 0 → PARTITION_HORZ / 1 → SPLIT —
12+line-for-line libaom `ec_read_partition_impl` + `partition_gather_vert_alike`
13+(av1_common_int.h:1485, `out[0] = TOP − {VERT, SPLIT, HORZ_A, VERT_A, VERT_B,
14+VERT_4}`).
15+
16+Why the previous round could not see it: the `(true, false)` arm emits
17+`OUR_PART` under `EC_AV1_TRACE` (trace_edge, decode.rs:6068), not the oracle's
18+`EC_PART` format — the 422h dumps were filtered on `EC_PART`, so the read was
19+invisible and looked like "no symbol".
20+
21+## Measurement
22+
23+Fixture `/tmp/t422.obu` reused by hash
24+`d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`
25+(256x144, 22 frames, 64x64 superblocks). Probe: `decode_probe` with a LOCAL
26+`EC_AV1_ALLOW_422_PROBE` bypass at the stream.rs:1709 refusal — REVERTED
27+before commit. Ours run with `EC_TRACE=1 EC_AV1_TRACE=1` (fresh trace
28+/tmp/u_f0.txt); oracle o_pal.txt.
29+
30+- Context numbering: ours `partition_ctx` indexes `partition_w64` 0..15 with
31+ the `bsl*4` term folded out — a constant −12 rename of libaom's ctx for the
32+ 64 level (ours 0/2/2/2, 1/3/3 vs oracle 12/14/14/14, 13/15/15 at every
33+ paired SB). Same slot, same CDF, same state; pairing confirms it.
34+- Bottom superblock row, frame 0 — all four gathered reads pair rng-for-rng,
35+ pre-read rng identical:
36+ - mi(32,0) ours 54818 / oracle 54818 (oracle ctx 13, value 1 = HORZ)
37+ - mi(32,16) ours 41610 / oracle 41610
38+ - mi(32,32) ours 61472 / oracle 61472
39+ - mi(32,48) ours 45794 / oracle 45794
40+- Interior pairing of the mi(32,0) strip continues past the gather: post
41+ uv_mode rng 43856 on both sides (mode=12, uv_mode=12), first luma all_zero
42+ ends at 53566 on both sides. The 64x32 strip's 4:2:2 chroma (32x32 square,
43+ ss (1,0)) rides the square arm as documented. has_rows=false correctly
44+ skips the second strip on both sides.
45+- Frame 0 therefore decodes through the bottom superblock row. The
46+ `EC_RECTCHROMA_GAP luma=64x32 tx=32x32 chroma=32x32` lines are the
47+ non-fatal diagnostic at decode.rs:10225, not a desync.
48+
49+## Next divergence (named stop — inter rect lane, not this lane)
50+
51+Frame 1 (first inter frame) panics at `decode.rs:29094:39` — `range end index
52+68 out of range for slice of length 64` — in the all-zero-residual prediction
53+copy: a rect inter block's `prediction[src..src + w]` reads past a 64-sample
54+buffer. Trigger context: mi(4,0) 64x64 inter, `partition_w16 value=7`
55+(VERT_B) at the 16-level, tell=542. The earlier round's decode.rs:14888
56+`decode_rect4_16_strip` closed-shape stop was not reached this run (frame 0
57+completes; the panic fires first). Both sites are downstream of the bottom-row
58+partition gather and outside this lane's ownership; decode.rs:14888 and the
59+decode.rs:19169 skip arm remain untouched, as do the four chroma-ref fixes.
60+
61+## State
62+
63+- No source change this round: the gather the assignment requested is already
64+ in HEAD, so there is nothing to write without inventing a duplicate arm.
65+ `git diff` vs 6cdd3dae touches only this report; the stream.rs probe bypass
66+ is reverted (refusal `a chroma format of 4:2:2 (subsampling_x !=
67+ subsampling_y)...` byte-identical, unconditional).
68+- Refusal STAYS: the 16-frame stream is not pixel-exact (frame 1 panics), so
69+ the delete condition (pixel-exact + 422 chroma counter) is unmet.
70+- 420 gates green (private target dir `$HOME/.cache/cargo-target-av1422i`):
71+ `a_non_420_subsampled_sequence_header_is_refused_by_name` 1/1 (proves the
72+ reverted refusal fires by name), `a_real_aomenc_stream_with_a_skipped_8x8_
73+ intra_leaf_whose_tx_split_decodes_pixel_exact` 2/2 (both bit depths) under
74+ `EC_AV1_REQUIRE_AOMENC=1`.
75+- No push. Traces left at /tmp/u_f0.txt (ours, frame 0 bottom row + frame 1
76+ panic) and /tmp/o_pal.txt (oracle).
lanes/av1422inter.report.mdadded+134 -0
@@ -0,0 +1,134 @@
1+# lane-av1-422inter — the frame-9 `read_coeffs_rect` scratch panic fixed at the
2+# source (the 4:2:2 intra-in-inter side-64 chroma is TWO square TX_32X32 units,
3+# not one 32x64 rect unit); the inter-frame divergence remeasured with the
4+# stage ladder and STOPPED at the sub-8x8 inter chroma class (`decode_inter_block8`)
5+
6+## Outcome
7+
8+1. REMEASURED first (pinned fixture `/tmp/t422.obu` sha256
9+ `d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`,
10+ 256x144 / chroma 128x144, 16 coded frames, local `EC_AV1_ALLOW_422_PROBE`
11+ bypass applied and reverted byte-identical after — `git diff` after the
12+ revert carries only the decode.rs fix): reproduced the frame-9 panic
13+ exactly as the r lane named it — `rect coeff scratch w=32 h=64 n=2448`
14+ at [`read_coeffs_rect`]'s guard (decode.rs:7195), backtrace
15+ `decode_inter_block` -> `read_rect_chroma_unit`; 9 frames decoded before
16+ the abort.
17+2. ROOT CAUSE, and why the scratch itself stays untouched: the panic site is
18+ `decode_inter_block`'s intra-in-inter 4:2:2 chroma arm (lane-av1-422k's
19+ `chroma_w != chroma_h` dispatch), whose `_` side-match handed the WHOLE
20+ uv plane block (32x64) to [`read_rect_chroma_unit`] as ONE rect unit. But
21+ `av1_get_max_uv_txsize(BLOCK_64X64)` at ss (1,0) is
22+ `av1_get_adjusted_tx_size(max_txsize_rect_lookup[BLOCK_32X64])` =
23+ `av1_get_adjusted_tx_size(TX_32X64)` = **TX_32X32** — libaom codes TWO
24+ stacked SQUARE 32x32 units per plane, plane-major (U r0, U r1, then V
25+ r0, V r1), never a TX_32X64 coefficient read (no such scan exists in
26+ this decoder and libaom writes none: a 64-axis codes its low-32 corner).
27+ Lifting the scratch bound to 36x68 (the r lane's tentative "heap
28+ fallback" sketch) would have read a full 32x64 scan and desynced on the
29+ very first such unit. The KEY-FRAME path has carried the correct model
30+ since lane-av1-422f (`decode_block`'s 4:2:2 chroma_tx table: "64 and
31+ 128: TX_32X64 / TX_64X64 adjust down to TX_32X32, square units, a 1x2 /
32+ 2x4 grid") — proven byte-exact on this fixture's frame 0.
33+3. FIX (the sibling 444 per-unit-walk pattern): the `side == 64` arm at
34+ `decode_inter_block`'s intra-in-inter chroma now walks the two stacked
35+ 32x32 square units per plane through [`read_plane`] (`TxbSet::Chroma32`,
36+ `SCAN_32`, txb_skip ctx = above+left+3 — the offset-10 rows, the plane
37+ block being bigger than the unit), each with its own per-chroma-cell
38+ context read (`around_mi_422_chroma` at the unit's luma span), its own
39+ `tu_reach_rect`, immediate `record_mi_chroma`, assembled into the
40+ chroma_side-strided block grid, with `mu_chroma = true` so the tail's
41+ existing `mu_chroma_units` enumeration replays the per-unit entropy
42+ state after the whole-block record (the lane-dpm1 mechanism; its
43+ (rows, cols, ur, uc) walk already derives exactly these two units per
44+ plane at ss (1,0)). The 4/8/16/32 rect arms and the square
45+ `chroma_w == chroma_h` arm are untouched — 4:2:0 and 4:4:4 are
46+ byte-identical by construction (ss-keyed). `read_coeffs_rect` itself is
47+ untouched: with the adjusted-tx model no caller can deliver a unit
48+ bigger than 32x32's 36x36 levels frame, which is the invariant the
49+ scratch sizing always stated.
50+4. MEASURED after the fix (16 frames decode, no panic; the probe's
51+ `chroma422_square` counter rose 24 -> 87 across the stream, the touched
52+ class provably firing on inter frames): frame 0 is **byte-exact vs the
53+ instrumented aomdec at PREFILT, POSTDEBLOCK, POSTCDEF and FINAL on Y, U
54+ and V** (0 diffs everywhere — the parent lanes' frame-0 exactness
55+ survives). The inter frames stay divergent: per-frame stage-ladder
56+ counts (ours padded-cropped vs oracle, both vs the same instrumented
57+ `$HOME/.cache/aom-oracle/build` aomdec):
58+ - frame 1: PREFILT Y 30825 / U 12624 / V 12796, first Y (0,8) 76 vs 80,
59+ first U (0,0) 231 vs 90, first V (0,0) 164 vs 241;
60+ - frames 1..16 all diverge from (0,0) with ~28-35k Y / ~12-17k U /
61+ ~11-17k V per frame at PREFILT, and POSTDEBLOCK / POSTCDEF / FINAL
62+ track the same first samples 1:1 (the loop filters introduce no new
63+ first-diff site) — a pre-filter reconstruction class, filters
64+ exonerated.
65+5. ATTRIBUTION (2-frame cut, `EC_TRACE_MODE_STEP` + `EC_TRACE_COEFF`
66+ pairing against the oracle's own rungs): every commonly-traced mode /
67+ skip / angle / uv_mode read of frames 0+1 agrees rng-for-rng (1326
68+ paired lines, 0 mismatches), and the first 873 coefficient reads
69+ (frame 0 in full) agree — the entropy walk is in sync up to frame 1's
70+ first coded block. The FIRST divergence is that block's own tail: at
71+ mi (0,0) (8x8 inter leaf, NEARESTMV (0,0), coded), after the leaf's
72+ luma TX_8X8 txb_skip bit (agreed, rng 55168) the oracle reads the
73+ leaf's **U TX_4X8 rect chroma unit** (ctx 7 row, coded) then V — while
74+ OURS reads a TX_4X4-SQUARE-shaped unit (`TxbSet::Chroma4`,
75+ ctx = above+left, no offset-7 row). `decode_inter_block8`'s chroma half
76+ models the 4:2:2 leaf chroma plane block — `ss_size_lookup
77+ [BLOCK_8X8][1][0]` = BLOCK_4X8, one TX_4X8 rect unit per plane
78+ (`av1_get_max_uv_txsize`) — as a `chroma_side = SIDE >> ss_x` = 4
79+ square: wrong coefficient set/scan/ctx rows, and the same 4x4 square
80+ shape flows into the leaf's MC prediction, skip push and interintra
81+ blends. Pixel witness: frame-1 U (0,0) ours=231 ~= frame-0's 225 (the
82+ zero-mv prediction with only a square-read residue applied) vs the
83+ oracle's 90 (the coded TX_4X8 residual applied).
84+6. That defect class is not a one-site edit: the leaf's whole chroma half
85+ must move to (4,8) shapes — prediction build, skip/interintra/OBMC
86+ pushes, the rect coefficient read (`TxbSet::ChromaRect8x4` /
87+ `SCAN_4X8`, offset-7 ctx rows, inherited luma tx type via
88+ [`read_inter_plane_rect`]) — and the sub8 split-group's own chroma read
89+ (`decode_inter_sub8_split4`'s `TxbSet::Chroma4` group unit) repeats the
90+ same square model. Per charter step 3: STOPPED and named.
91+
92+## Decision
93+
94+- The header refusal STAYS unconditional in `stream.rs` — delete condition
95+ unmet (not pixel-exact from frame 1 on). The bypass was local-only, one
96+ `&& std::env::var(...).is_err()` clause, reverted byte-identical before
97+ the commit; the refusal gate re-verified firing (see Verification).
98+- `read_coeffs_rect` untouched (no scratch growth, no new panic path);
99+ 4:2:0/4:4:4 arms of the touched dispatch untouched; `sub8_leaf_chroma422`
100+ (parent lane) untouched; the 4:2:0 group-tail SKIP arm untouched.
101+- Next stop named for the owning lane: **`decode_inter_block8`'s 4:2:2
102+ chroma half** (leaf chroma plane block (4,8): one rect TX_4X8 unit per
103+ plane through the inter rect reader, (4,8)-shaped MC prediction and skip
104+ pushes) plus `decode_inter_sub8_split4`'s group chroma read; after that
105+ round the stage ladder of Outcome 4 should simply be re-run — frame 0
106+ and the side-64 class are now proven clean, so the residual measurement
107+ is directly attributable.
108+
109+## Verification
110+
111+- `cargo check -p ec-av1` (target `~/.cache/cargo-target-av1422inter`):
112+ 0 warnings, 0 errors on a fresh `Checking` of the edited tree.
113+- Pre-fix panic reproduced on the pinned fixture (backtrace named above);
114+ post-fix the same stream decodes 16/16 frames, frame 9 included.
115+- Frame-0 stage dumps vs the instrumented aomdec: PREFILT / POSTDEBLOCK /
116+ POSTCDEF / FINAL all Y=0 U=0 V=0 (comparator: ours padded 256x160/128x160
117+ u8 cropped, probe FINAL u16 planes vs oracle u8 — values equal).
118+- `stream::tests::a_non_420_subsampled_sequence_header_is_refused_by_name`:
119+ 1 passed, 0 failed (refusal fires again after the bypass revert).
120+- `stream::tests::a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_
121+ whose_tx_split_decodes_pixel_exact` under `EC_AV1_REQUIRE_AOMENC=1`
122+ (with `EC_AV1_AOMENC` pointed at the oracle build): 1 passed, 0 failed —
123+ the 4:2:0 inter path is unchanged.
124+- `git status` clean except the decode.rs fix; the report is the only other
125+ file in the commit.
126+
127+## State
128+
129+- Commit on lane-av1-422inter (no push): the side-64 per-unit chroma fix in
130+ `decode_inter_block` + this report.
131+- The stage-ladder instruments live in `/tmp/i422/` (our/oracle per-stage
132+ dumps for all 17 oracle frames, comparator + EC_ISTEP pairing scripts) —
133+ scratch, not committed; the oracle build's rungs already carry everything
134+ needed to regenerate them.
lanes/av1422j.report.mdadded+99 -0
@@ -0,0 +1,99 @@
1+# lane-av1-422j — inter chroma skip residual sized from the write rect; frame 1 decodes past the VERT_B skip strip; refusal stays
2+
3+## Outcome
4+
5+The frame-1 panic at `decode.rs:29094:39` (`range end index 68 out of range
6+for slice of length 64`) is fixed by sizing `decode_inter_block`'s chroma
7+square from the write rect instead of the block side, and the same-shape sweep
8+found exactly one more instance of the class, sharing the same fix. The
9+16-frame stream is NOT pixel-exact — the frontier moved to the intra-in-inter
10+chroma read, a different machinery — so the 4:2:2 header refusal STAYS
11+(byte-identical, unconditional; the local `EC_AV1_ALLOW_422_PROBE` bypass was
12+reverted before commit).
13+
14+## Root cause and fix
15+
16+`decode_inter_block` computed `chroma_side = side >> ss_x(fctx)` (old
17+decode.rs:31227). Every consumer indexes the chroma prediction/residual
18+buffers `row * chroma_side + col` over the WRITE rect
19+(`write_chroma_w x write_chroma_h`), and at ss (1,0) that rect is
20+`side/2 x side`: frame 1's skipped 16-level VERT_B strip at mi(4,0)
21+(8x16 luma, tell 542) has a 4x16 chroma rect, so a `side >> ss_x` = 8 square
22+is shorter than `row * 8 + 4` on rows >= 8 — the all-zero-residual copy read
23+`prediction[64..68]` out of the 64-sample buffer (reconstruct_mc_rect's
24+`residual.is_empty()` branch, decode.rs:29094). Fixture
25+`/tmp/t422.obu` sha256
26+`d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`
27+reproduced it before the change and passes the block after it.
28+
29+Fix: `let chroma_side = (side >> ss_x(fctx)).max(side >> ss_y(fctx));`
30+(decode.rs:31237) — the enclosing square of the chroma rect. Bit-identical at
31+4:2:0 (`side/2`) and 4:4:4 (`side`); only 4:2:2 changes shape.
32+
33+## Same-shape sweep (ZERO_RESIDUAL slices vs forwarded w/h)
34+
35+- `decode_inter_block` skip arms, single-ref (33803..) and compound (32325..):
36+ both chroma pushes forward `(write_chroma_w, write_chroma_h)` at stride
37+ `chroma_side` with `ZERO_RESIDUAL[..chroma_side * chroma_side]` — healed by
38+ the one-line fix (chroma_side >= both write dims now). The paired
39+ `Grid::Zero(chroma_side * chroma_side)` bookkeeping matches the slices.
40+- Luma skip arms (`ZERO_RESIDUAL[..side * side]`, stride `side`, rect
41+ `(write_w, write_h)` with w,h <= side): max index
42+ `(write_h-1)*side + write_w <= side*side` — provably safe, untouched.
43+- Other inter-path slices audited against their forwarded dims:
44+ `decode_block_rect4` skip arm (`side * bh` / `cside * ch` — stride*rows
45+ sizing, safe), `decode_intrabc_rect` (11682/12024, square >= rect, safe),
46+ 14205 (`side * bh`, safe), 37037/37187 (4:4:4-only, SIDE^2 >= rect, safe),
47+ 37338 sub8 tail (square push, safe). `decode_inter_block8`'s chroma
48+ `push_mc` (square) always fits its own square slice — no panic class there;
49+ its 4:2:2 8x8-leaf chroma is a latent half-write shape, NOT this class, and
50+ was left for its owning lane.
51+
52+## Frontier re-measure (EC_AV1_ALLOW_422_PROBE=1, local only)
53+
54+1. After the sizing fix the skip strip passes and the next stop was
55+ `transform.rs:1150` (`one coefficient per position`, 256 vs 1024): the
56+ square non-skip chroma arm read a `chroma_side`-SQUARE unit (32x32 after
57+ the fix) with the caller's 4:2:0 `scan_chroma` (TX_16X16) on the 32x32
58+ inter block at px=0 py=0. Fix: both chroma arms route non-square chroma
59+ rects through `read_inter_rect_chroma`
60+ (`rect_tu || (write_chroma_w, write_chroma_h) != (chroma_side,
61+ chroma_side)`, decode.rs:32712/34222) — a 32x32 block codes ONE TX_16X32
62+ chroma unit (`av1_get_max_uv_txsize` of BLOCK_16X32), exactly
63+ `rect_inter_chroma_set`'s (16,32) row. 4:2:0/4:4:4 squares keep the square
64+ arm (their chroma rect IS `chroma_side`-square).
65+2. Next stop: `rect_inter_chroma_set` refused (8,8) — a 4:2:2 HORZ_B 16x8
66+ strip's chroma plane block is 8x8 SQUARE and the rect reader now takes it.
67+ Added the square rows (16,16)->Chroma16, (8,8)->Chroma8, (4,4)->Chroma4
68+ (decode.rs:22420) — the exact `get_txsize_entropy_ctx` tables the square
69+ arms use; unreachable before this lane.
70+3. Next stop: `rect_scan` refused squares for the same units; added
71+ `(w, h) if w == h => default_scan(w)` (decode.rs:22485).
72+4. Current named stop: an INTRA 16x16 block inside frame 1 (px=192 py=96)
73+ panics in the intra-in-inter branch's chroma `read_plane`
74+ (`exec_intra` -> `reconstruct`, index len 128 idx 128, decode.rs:3845) —
75+ the intra chroma reader still predicts/reconstructs at square
76+ `chroma_side` shapes. That is intra prediction machinery, not the
77+ ZERO_RESIDUAL slice class, and reworking it means inventing chroma
78+ shapes beyond this lane's mandate; left as the named stop for the
79+ owning lane.
80+
81+4:2:2 chroma counters PROVE chroma units ran on the probe path:
82+`chroma422_square: 24`, `chroma422_rect: 96`, `chroma422_sub8: 26` — but the
83+stream is not pixel-exact, so the delete condition (pixel-exact + counter) is
84+unmet and the refusal stays.
85+
86+## State
87+
88+- Source change: `crates/ec-av1/src/decode.rs` only (chroma_side sizing, two
89+ rect-routing conditions, square set/scan rows). `git diff` = 42 insertions,
90+ 3 deletions. The stream.rs probe bypass is REVERTED; default refusal
91+ re-verified firing: `REFUSED: unsupported: AV1 decode_stream (a chroma
92+ format of 4:2:2 ...)`.
93+- 420 gates green (target dir `$HOME/.cache/cargo-target-av1422j`):
94+ `a_non_420_subsampled_sequence_header_is_refused_by_name` 1/1;
95+ `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_decodes_
96+ pixel_exact` 2/2 (both bit depths) under `EC_AV1_REQUIRE_AOMENC=1` — a real
97+ 420 decode gate over the shared `decode_inter_block` path, confirming the
98+ changes are bit-neutral at 4:2:0. `cargo check -p ec-av1`: 0 warnings.
99+- No push. Probe traces left at /tmp/t422_probe.txt/.err.
lanes/av1422k.report.mdadded+79 -0
@@ -0,0 +1,79 @@
1+# lane-av1-422k — intra-in-inter chroma prediction sized from the plane block; frame 1's INTRA 16x16 passes; refusal stays
2+
3+## Outcome
4+
5+The frame-1 panic at `decode.rs:3845` (`index out of bounds: the len is 128
6+but the index is 128`) is fixed by sizing `decode_inter_block`'s INTRA arm's
7+chroma prediction/reconstruction from the 4:2:2 plane block
8+(`side >> ss_x`, `side >> ss_y`) instead of the enclosing square. The panic
9+was NOT the residual-slice class: the len-128 slice was the CfL AC SIGNAL.
10+The 16-frame stream is NOT pixel-exact — the frontier moved to the INTER
11+chroma rect-set table (a clean named refusal, different machinery) — so the
12+4:2:2 header refusal STAYS (re-verified firing by default; the local
13+`EC_AV1_ALLOW_422_PROBE` bypass was reverted before commit).
14+
15+## Root cause and fix
16+
17+Frame 1's block at px=192 py=96 is a SKIPPED 16x16 INTRA block inside the
18+inter frame (DC_PRED + CFL, zero residual), decoded by `decode_inter_block`'s
19+intra arm. That arm pushed/read chroma at the 422j enclosing square
20+`chroma_side = max(side >> ss_x, side >> ss_y)` = 16 for a 16x16 luma block,
21+but the 4:2:2 chroma plane block is 8x16:
22+
23+- The skip arm (`push_intra(1/2, cpx, cpy, chroma_side, ...)`) pushed a
24+ SQUARE 16x16 op with `ZERO_RESIDUAL` and CFL armed. `ac = cfl_src(px, py,
25+ side)` builds the AC signal over the LUMA 16x16, which `cfl_ac_ss`
26+ downsamples to the true plane shape 8x16 = 128 samples. The square
27+ `reconstruct` walked `row * 16 + col` and read `ac_q3[128]` — the panic.
28+ (Instrumented `exec_intra`: `plane=1 x=96 y=96 bw=16 bh=16 rect=false
29+ res_len=0 cfl=true`.) Even without the panic the square predict would have
30+ written 8 columns of wrong chroma past the plane block.
31+
32+Fix (decode.rs, intra arm only):
33+
34+1. `let chroma_w = side >> ss_x(fctx); let chroma_h = side >> ss_y(fctx);`
35+2. Skip arm: `push_intra_unit(1/2, cpx, cpy, chroma_w, chroma_h, ...)` with
36+ `ZERO_RESIDUAL[..chroma_w * chroma_h]` (routes rect to
37+ `push_intra_rect`/`reconstruct_rect`); the neighbour write-back grids are
38+ `Grid::Zero(chroma_w * chroma_h)`.
39+3. Non-skip arm: `chroma_w == chroma_h` keeps the square `read_plane`
40+ verbatim; at 4:2:2 both planes go through `read_rect_chroma_unit` with the
41+ key-frame path's proven set/scan rows keyed on the LUMA side (16 ->
42+ `ChromaRect16x8` + `SCAN_8X16`, 8 -> `ChromaRect8x4`, 32 ->
43+ `ChromaRect32x16`) and the per-chroma-cell context read
44+ (`around_mi_422_chroma`), exactly the decode_block 422f idiom.
45+
46+Byte-identical at 4:2:0 and 4:4:4: `chroma_w == chroma_h == chroma_side`
47+there, so every replaced call keeps its exact arguments and
48+`push_intra_unit` routes to the same square `push_intra`.
49+
50+Fixture `/tmp/t422.obu` sha256
51+`d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`
52+panicked before the change and passes the block after it.
53+
54+## Frontier (EC_AV1_ALLOW_422_PROBE=1, local only, bypass since reverted)
55+
56+Next stop is a clean refusal, not a panic:
57+`rect_inter_chroma_set` (decode.rs:22401, refusal string at decode.rs:22429)
58+— "a rectangular inter chroma transform unit whose shape has no coefficient
59+table set here". A later inter block in frame 1 codes a chroma rect unit
60+whose (w, h) has no row in that table (the 422j square rows (16,16)/(8,8)/(4,4)
61+and the rect rows listed there are present; the new shape is none of them).
62+That is the inter chroma entropy-set table, not the intra prediction class
63+this lane owns — left as the named stop; an `EC_*` print of the refusing
64+(w, h) at that site is the first step for the owning lane.
65+
66+## State
67+
68+- Source change: `crates/ec-av1/src/decode.rs` only (intra-arm chroma_w/h,
69+ skip-arm unit pushes + grid sizes, non-skip rect routing). Temporary
70+ exec_intra/push_intra traces and the stream.rs probe bypass are REVERTED;
71+ default refusal re-verified firing: `REFUSED: unsupported: AV1 decode_stream
72+ (a chroma format of 4:2:2 ...)`.
73+- 420 gates green (target dir `$HOME/.cache/cargo-target-av1422k`):
74+ `a_non_420_subsampled_sequence_header_is_refused_by_name` +
75+ `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_decodes_
76+ pixel_exact` under `EC_AV1_REQUIRE_AOMENC=1`: 3 passed, 0 failed. Real
77+ 420 decode over the shared intra arm, confirming the change is bit-neutral
78+ at 4:2:0. `cargo check -p ec-av1`: 0 warnings.
79+- No push.
lanes/av1422kf.report.mdadded+82 -0
@@ -0,0 +1,82 @@
1+# lane-av1-422kf — the frame-0 U (0, 23) first diff: NAMED and FIXED (one
2+# missing arm in [`decode_rect_split`]'s chroma_tiled walk: the uv-palette
3+# prediction was never set, so the square 4:2:2 chroma rows decoded a
4+# uv-palette strip's chroma as plain DC)
5+
6+## Outcome
7+
8+1. NAMED the sample: frame 0, plane U, row 0, col 23, ours 50 vs oracle 49.
9+ The parent attributed the class to [`decode_rect_split`]'s own-chroma
10+ keyframe gap; this lane localized it to the exact unit and mechanism.
11+2. The owning unit: chroma 8x8 at chroma px (24, 0) — the square chroma of a
12+ 16x8 luma strip at luma px (48..63, rows 0..7) — pushed by
13+ [`decode_rect_split`]'s chroma_tiled `(8, 8)` arm through `read_plane`
14+ (backtrace: inline_intra ← read_plane ← decode_rect_split ←
15+ decode_leaf_rect).
16+3. Entropy PROVEN in sync: pre-loop-filter frame-0 LUMA is byte-exact against
17+ the oracle's `EC_AV1_PREFILT_DUMP`, and the U/V coefficient read of the
18+ unit pairs with the oracle by rng at BOTH ends (ours rng0=48179 / rng1=
19+ 64520 == the oracle's `EC_COEFF plane=1 tx_size=1 mi_row=0 mi_col=12
20+ rng=48179` and the following V unit's rng=64520). Same symbols, same
21+ levels (±1 at scan c=9/10/21, libaom dequant ±63 == ac_q(8-bit, 56)=63 —
22+ note the oracle's `pos=` fields are column-major; 3/4/6 there == raster
23+ 24/32/48 here), so the divergence was prediction-side only.
24+4. The paired oracle EC_ISTEP ladder for the strip (skip/cdef/dq/mode/
25+ angle_y/uv_mode/angle_uv — every value and rng identical to ours) plus the
26+ oracle's EC_PALSYN line (`y=2`) identified the mechanism: the strip is a
27+ **uv-PALETTE block**. Our `chroma_tiled` arm — uniquely among the chroma
28+ arms — never called `set_palette_pred`, so `read_plane` consumed no palette
29+ prediction and reconstructed plain DC (ours flat 97 where the oracle has
30+ the palette colour map). Class: same-symbols-silent-prediction.
31+5. FIX (14 lines, one arm): the chroma_tiled unit loop now sets the palette
32+ prediction per unit per plane (`palette_window` of `m.palette_uv` to the
33+ unit's rect), mirroring the skip/lossless/unsplit arms. 4:2:0 and 4:4:4
34+ untouched unless `m.palette_uv` is Some (previously broken output anyway).
35+6. MEASURED (pinned fixture, frame 0, single-frame cut sha256
36+ `3dd3f768ef553c02316848c2d3184c3765030c0a6fcb95887e4719add9ded3af` — first
37+ OBU prefix of the pinned 22-frame t422.obu; local `EC_AV1_ALLOW_422_PROBE`
38+ bypass, reverted byte-identical after):
39+ - U (0, 23) now decodes **49 == oracle final 49** — the named sample is
40+ EXACT.
41+ - U final diffs 4491 → **1774**; V final diffs 4888 → **2165**; U
42+ pre-filter recon diffs 3148 → **533**.
43+ - `chroma422_square` counter = 24 on this frame (the fixed arm provably
44+ ran; non-vacuity).
45+7. REMAINING class for the next lane: U pre-filter diffs now start at
46+ (108, 72) (rows 72..79, then 104+; V first diff (48, 0)) — chroma of the
47+ 16x8 strip at chroma (96, 72) and the 16x32 strip at (112, 64): NOT the
48+ palette arm fixed here (both decoded with their own modes); needs its own
49+ localization. Frame 0 is still not pixel-exact, so the
50+ "delete the header refusal" condition stays unmet.
51+
52+## Decision
53+
54+- The named col-23 sample WAS one arm in [`decode_rect_split`] — fixed, not
55+ punted. The frame-9 [`read_coeffs_rect`] scratch panic is untouched
56+ (another lane's, and the single-frame cut sidesteps it). The four TX_4X8
57+ chunk and the Some(3) offset are untouched. `read_coeffs_rect` untouched.
58+- Header refusal STAYS in `stream.rs`, unconditional (no env gate in the
59+ commit; verified firing by name without the env after revert).
60+
61+## Verification
62+
63+- `cargo check -p ec-av1` (target `~/.cache/cargo-target-av1422kf`): 0
64+ warnings, 0 errors.
65+- 420 gate green under `EC_AV1_REQUIRE_AOMENC=1`:
66+ `stream::tests::a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_
67+ whose_tx_split_decodes_pixel_exact`: 1 passed, 0 failed.
68+- `stream::tests::a_non_420_subsampled_sequence_header_is_refused_by_name`:
69+ 1 passed, 0 failed (and the example probe refuses the fixture by name
70+ without the env).
71+- `git diff` after the bypass revert carries ONLY the decode.rs fix; all
72+ temporary EC_KF422DBG/TEMPQM probes and the local bypass are out.
73+
74+## State
75+
76+- Commit on lane-av1-422kf (no push): the chroma_tiled palette fix + this
77+ report.
78+- Next stop named for the owning lane: U (108, 72) / V (48, 0) pre-filter
79+ recon class at the (96, 72) 16x8 and (112, 64) 16x32 strips' own chroma —
80+ same localization recipe applies (single-frame fixture + rng pairing
81+ against `$HOME/.cache/aom-oracle/build` aomdec, `EC_AV1_ALLOW_422_PROBE`
82+ local-only).
lanes/av1422kf2.report.mdadded+97 -0
@@ -0,0 +1,97 @@
1+# lane-av1-422kf2 — the remaining frame-0 class at U (108, 72) / V (48, 0):
2+# NAMED and FIXED — the sub-8x8 4:2:2 chroma unit decoded at the wrong
3+# position, wrong reach table and half-visible neighbour mode (three related
4+# one-index defects, all in [`sub8_leaf_chroma422`]); frame-0 PRE-FILTER
5+# reconstruction is now pixel-exact (Y, U and V) against the oracle's
6+# `EC_AV1_PREFILT_DUMP`
7+
8+## Outcome
9+
10+1. REMEASURED first (pinned fixture, single-frame cut
11+ `/tmp/t422f0.obu` sha256 `3dd3f768ef553c02316848c2d3184c3765030c0a6fcb95887e4719add9ded3af`
12+ — first OBU prefix of the pinned 22-frame t422.obu; the frame is
13+ **256x144**, chroma planes 128x144; local `EC_AV1_ALLOW_422_PROBE`
14+ bypass applied, reverted byte-identical after): at the parent's baseline
15+ the pre-filter chroma diffs were U 533 / V 869, first U (108, 72) —
16+ confirming the parent's sample.
17+2. NAMED the class at U (108, 72): the 8x8 luma block at luma (216, 72)
18+ splits into four 4x4 leaves; 4:2:2's `is_chroma_reference`
19+ (`av1_common_int.h:1454`) puts the chroma syntax on the ODD-column leaves
20+ (`(mi_col & 1) || !(bw & 1) || !ss_x` — the port already read uv_mode
21+ there, entropy in sync, luma byte-exact), but libaom ANCHORS the leaf's
22+ TX_4X4 chroma unit at the floored chroma cell
23+ (`(mi_col & !1) * MI >> ss_x` = chroma px 108), not at the odd leaf's own
24+ chroma x (110). Ours reconstructed at 110: px 108..109 were never written
25+ (zeros at exactly the parent's sample), px 112..113 got the unit's right
26+ columns. Oracle ground truth: the mi(18,55) unit's reconstruction is a
27+ pure V-copy of the row above AT 108..111. Fix 1: anchor `cpx` at
28+ `(lmi.1 & !1) * MI >> ss_x`. U/V prefilt 533/869 → 477/813, first diff
29+ moved to (96, 104).
30+3. The (96, 104) cluster named the next layer: an 8x4 strip's chroma unit
31+ (mi(27,44), uv D45) read undecoded pixels to its upper right. The oracle's
32+ own `EC_PRED` trace prints `n_tr=0` there: libaom answers
33+ `has_top_right`/`has_bottom_left` from the LEAF's OWN rect shape
34+ (`has_tr_8x4`/`has_tr_4x8` at the leaf's mi — bit 6 of byte 22 is 0),
35+ while the port used the standalone square-4x4 `Reach::of(4, ..)` lookup
36+ (same bit = 1). Fix 2: `sub8_leaf_chroma422` takes the leaf's shape and
37+ uses `Reach::of(4, ..)` only for a BLOCK_4X4 leaf, `Reach::of_rect(8, 4)`
38+ / `(4, 8)` for a rect pair's strip. Prefilt chroma 477/813 → 8/15.
39+4. The last 8/15 samples (chroma (100..103, 120..123), the H-mode unit at
40+ mi(30,50)) named the third defect: the unit's left neighbour mi(30,48) is
41+ an 8x4 strip with uv SMOOTH_V, but its `record_uv_mode_mi(…, 1, 1, …)`
42+ stamped only ONE of the strip's two mi columns, so mi(30,50)'s
43+ `chroma_left_mbmi` lookup hit an empty cell, lost the smooth neighbour and
44+ skipped libaom's always-on strength-1 intra edge filter
45+ (`get_intra_edge_filter_type` 1 vs our 0; prediction sums 6139/6307 vs
46+ 6142/6312). Fix 3: record the uv mode over the leaf's whole mi footprint
47+ (`(w_mi, h_mi)` from the leaf shape). All three fixes are inside
48+ [`sub8_leaf_chroma422`] and its five call sites.
49+5. MEASURED after the three fixes: **PREFILT Y EXACT, U EXACT, V EXACT**
50+ (byte-identical frame-0 pre-loop-filter reconstruction against the oracle
51+ dump). FINAL dumps: U 1774 → 1236, V 2165 → 1263 — every remaining final
52+ diff is introduced by the LOOP FILTER (pre-filter row 0 is exact; the
53+ filter propagates damage to the top rows). Non-vacuity:
54+ `chroma422_square` = 24, `chroma422_rect` = 96, `chroma422_sub8` = 26 on
55+ this frame — all three touched arms provably ran.
56+6. REMAINING class for the next lane: the 4:2:2 LOOP FILTER. With pre-filter
57+ recon byte-exact, the 1236/1263 final-diff samples are deblock/CDEF/LR
58+ chroma work (the parent's V (48, 0) is this class's first final sample —
59+ pre-filter V at row 0 is exact). Frame 0 is still not final-pixel-exact,
60+ so the "delete the header refusal" condition stays unmet.
61+
62+## Decision
63+
64+- The palette set in 93c4dff5 is untouched (chroma422_square still 24; the
65+ chroma_tiled arm's `set_palette_pred` intact).
66+- `read_coeffs_rect` untouched. The frame-9 rect scratch panic is untouched.
67+ The 4:2:0 group-tail SKIP arm untouched. Header refusal STAYS
68+ unconditional in `stream.rs` — verified firing by name on this very
69+ fixture after the bypass revert, plus the named gate test.
70+- The bypass was local-only (`EC_AV1_ALLOW_422_PROBE` on the env, one
71+ `&& std::env::var(…).is_err()` clause), reverted byte-identical before the
72+ commit; `git diff` after the revert carries ONLY the decode.rs fix.
73+
74+## Verification
75+
76+- `cargo check -p ec-av1` (target `~/.cache/cargo-target-av1422kf2`):
77+ 0 warnings, 0 errors.
78+- 420 gate green under `EC_AV1_REQUIRE_AOMENC=1`:
79+ `stream::tests::a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_
80+ whose_tx_split_decodes_pixel_exact`: 1 passed, 0 failed.
81+- `stream::tests::a_non_420_subsampled_sequence_header_is_refused_by_name`:
82+ 1 passed, 0 failed.
83+- Stage dumps compared sample-for-sample (cropped `PREFILT_WIDE_DUMP` vs the
84+ oracle `EC_AV1_PREFILT_DUMP`, same 73728-byte layout, 256x144 / 128x144):
85+ post-fix Y/U/V all exact; symbol-level pairing via the oracle's
86+ `EC_ISTEP`/`EC_PALSYN`/`EC_PRED`/`EC_PREDOUT8` rungs against our
87+ `EC_TRACE_MODE_STEP`/`EC_PRED` traces (rng and values matched at every
88+ step of every unit named above).
89+
90+## State
91+
92+- Commit on lane-av1-422kf2 (no push): the three sub8-422 chroma fixes +
93+ this report.
94+- Next stop named for the owning lane: the 4:2:2 loop filter — deblock/CDEF
95+ chroma extents against `$HOME/.cache/aom-oracle/build` aomdec dumps
96+ (`EC_AV1_POSTDEBLOCK_DUMP` rungs exist on both sides); the decode-side
97+ frame-0 recon it consumes is now proven exact.
lanes/av1422l.report.mdadded+99 -0
@@ -0,0 +1,99 @@
1+# lane-av1-422l — inter-strip pairing underflow fixed; the rect-set refusal is real and names (4, 32), which libaom marks invalid — no row added, refusal stays
2+
3+## Outcome
4+
5+Two results.
6+
7+1. The k report's frontier attribution was measured under a release build:
8+`at_mi.0 - 1` subtract-overflow WRAPPED silently there, so decode continued
9+to `rect_inter_chroma_set`. A debug build panics first — the true first stop
10+at 8e7238b2 was a hard underflow panic in the inter-strip chroma pairing
11+(`decode.rs` ~41531:42 horz `at_mi.0 - 1`, then ~41544:55 vert
12+`at_mi.1 - 1`), hit because `strip_has_chroma`'s `|| ss_y(fctx) == 0`
13+clause makes every strip chroma-bearing at 4:2:2 including strip i = 0 at
14+mi row/col 0. Fixed in its own commit (below); 4:2:0 and 4:4:4 are
15+byte-identical by construction.
16+2. After the fix the frontier is exactly the refusal the k report named:
17+`rect_inter_chroma_set` fires with (w, h) = **(4, 32)** — the 4:2:2 plane
18+residual of an 8x32 luma block. libaom itself marks that size invalid, so
19+per the lane charter NO table row is invented and the refusal stays.
20+
21+## Fix 1 (own commit): strip pairing keys on the strip's own subsampled axis
22+
23+`decode_inter_frame_tile_with_cdfs`'s 1:4 strip walk
24+(`PARTITION_HORZ_4`/`VERT_4`, 16x4 / 4x16 strips):
25+
26+- `strip_has_chroma`: horz keeps `i % 2 == 1 || ss_y == 0` (no chroma row
27+ parity at ss_y == 0 — every 16x4 strip is its own reference, mirroring the
28+ intra strip arm's `else if ss_y(fctx) == 0` at the 14700s key-frame path);
29+ vert becomes `i % 2 == 1 || ss_x == 0` (column parity governs, 4:4:4 keeps
30+ self-paired strips, 4:2:2 keeps the proven 4:2:0 column pairing, and an odd
31+ strip's left neighbour always exists so `at_mi.1 - 1` cannot underflow).
32+- `pair_mi`: self when the strip's pair axis is not subsampled (horz &&
33+ ss_y == 0, or vert && ss_x == 0), otherwise the existing pair merge.
34+- `prev`: pair motion only when the strip actually pairs (horz && ss_y == 1,
35+ vert && ss_x == 1); self-coded chroma predicts from its own motion.
36+
37+Format-by-format equivalence to the pre-lane code: 4:2:0 horz/vert and
38+4:4:4 horz/vert produce identical `has_chroma`/`pair_mi`/`prev` in every
39+branch; only 4:2:2 changes (horz self-pairs, vert pairs as at 4:2:0).
40+
41+Fail-before witness: HEAD 8e7238b2 + env-gated header bypass panics
42+`attempt to subtract with overflow` at the two lines above under
43+`EC_AV1_ALLOW_422_PROBE=1`; after the fix the same run reaches the named
44+refusal. Fail-after does not apply (this is a panic, not a test).
45+
46+## Fix 2: the refusing shape, named — and why no row is added
47+
48+`EC_AV1_TRACE_422` at the `_ =>` arm of `rect_inter_chroma_set` prints
49+`(w,h)=(4,32)` on `/tmp/t422.obu` (sha256
50+`d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`, the k
51+report's fixture). 4x32 is the 4:2:2 plane residual of an 8x32 luma block
52+(write rect 8x32 -> `>> ss_x` = 4x32). Against the pinned oracle source
53+(`~/.cache/aom-oracle/src`):
54+
55+- `av1_ss_size_lookup[BLOCK_8X32][1][0] = BLOCK_INVALID`
56+ (`av1/common/common_data.c:38`) — an 8x32 luma block HAS NO 4:2:2 plane
57+ residual block.
58+- `TX_4X32`/`TX_32X4` do not exist: zero occurrences in
59+ `av1/common/enums.h`; the largest 4-px-axis transform is `TX_4X16`.
60+- `max_txsize_rect_lookup[BLOCK_8X32] = TX_8X32` — libaom reaches that
61+ chroma through luma-granular chunking, never as a standalone 4-px unit.
62+
63+So the ticket's escape hatch ("if libaom marks it invalid, stop and name
64+it") applies: adding a (4, 32) row would invent a size libaom never codes.
65+The owning lane's next step is modelling the 8x32-at-(1,0) chroma merge
66+(`get_vartx_max_txsize` / `decode_token_recon_block` chunking), not an
67+entropy set. The trace print stays (env-gated, `env_flag!`, zero-cost).
68+
69+## Verification
70+
71+- Counters on the probe run prove real 4:2:2 chroma units read before the
72+ stop: `chroma422_square: 25`, `chroma422_rect: 100`,
73+ `chroma422_sub8: 26`.
74+- Default refusal fires (bypass reverted):
75+ `REFUSED: unsupported: AV1 decode_stream (a chroma format of 4:2:2 ...)`.
76+- 420 gates green under `EC_AV1_REQUIRE_AOMENC=1`
77+ (target dir `~/.cache/cargo-target-av1422l`):
78+ `a_non_420_subsampled_sequence_header_is_refused_by_name` +
79+ `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_decodes_
80+ pixel_exact`: 2 passed, 0 failed.
81+- `cargo check -p ec-av1`: 0 warnings.
82+- Header refusal NOT deleted (16-frame stream is not pixel-exact; it is
83+ refused at the named (4, 32) stop).
84+- The k lane's intra-arm chroma prediction sizing is untouched.
85+
86+## Latent site named (not fixed, out of reach)
87+
88+`decode.rs` ~14107 (INTRABC 16x4/4x16 dense path) subtracts
89+`lmi.0 - 1` / `lmi.1 - 1` under `has_chroma` with no subsampled-axis key.
90+Unreachable at 4:2:2 today (the header refusal precedes any INTRABC
91+decode), so no test can exercise it; flagged for the INTRABC lane so the
92+pairing class lands there too when 4:2:2 INTRABC is chartered.
93+
94+## State
95+
96+- Commits on lane-av1-422l (no push): (1) strip-pairing fix, (2) the
97+ (4, 32) trace print + this report.
98+- No table row added to `rect_inter_chroma_set`. The 4:2:0 group-tail
99+ chroma SKIP arm was not touched.
lanes/av1422m.report.mdadded+101 -0
@@ -0,0 +1,101 @@
1+# lane-av1-422m — the (4, 32) refusal is replaced by libaom's TX_4X4 chunking for
2+# that one shape; the header refusal STAYS (the stream's next stop is a
3+# different class, the intra-in-inter 64x64 chroma (32, 64) panic)
4+
5+## Outcome
6+
7+1. `read_inter_rect_chroma` no longer refuses (4, 32): an 8x32 luma block's
8+ 4:2:2 chroma plane now codes as EIGHT TX_4X4 chunks per plane, exactly the
9+ chunking libaom's decoder performs for a plane whose `ss_size_lookup` entry
10+ is BLOCK_INVALID. 4:2:0 and 4:4:4 are bit-identical by construction (the
11+ arm gates on ss (1,0) AND write rect exactly (4, 32) — impossible at any
12+ other format).
13+2. The header refusal is NOT deleted: with the chunking in, the 16-frame
14+ stream decodes PAST the previously refusing block and stops at a NEW hole
15+ owned by another lane — the intra-in-inter 64x64 chroma arm reads its whole
16+ (32, 64) plane as ONE unit and trips the rect-coeff scratch bound. The
17+ delete condition (16-frame pixel-exact vs aomdec) is unmet, so the refusal
18+ stays.
19+
20+## The chunking mechanism (measured against the pinned oracle, `~/.cache/aom-oracle/src`)
21+
22+- `av1_ss_size_lookup[BLOCK_8X32][1][0] = BLOCK_INVALID`
23+ (`av1/common/common_data.c:38`): an 8x32 luma block HAS no 4:2:2 plane
24+ residual block; no TX_4X32 exists either.
25+- `decode_token_recon_block`'s inter residual loop
26+ (`av1/decoder/decodeframe.c:1022`) still walks the plane in
27+ `get_vartx_max_txsize` units. `get_vartx_max_txsize`
28+ (`av1/common/blockd.h:1447`) does `max_txsize_rect_lookup[plane_bsize]`
29+ with `plane_bsize == BLOCK_INVALID` — one element PAST the 22-entry table.
30+ The oracle build is Release (`CMakeCache.txt`: `CMAKE_BUILD_TYPE=Release`,
31+ asserts compiled out), and the table's adjacent neighbour in declaration
32+ order is `vtx_tab`, whose first entry `DCT_1D = 0 = TX_4X4`. So the
33+ chroma max tx size resolves to TX_4X4.
34+- `decode_reconstruct_tx` (`decodeframe.c:303`) NEVER recurses for chroma
35+ (`if (tx_size == plane_tx_size || plane)`), so every chroma unit reads at
36+ TX_4X4: the 4x32 plane codes as 8 stacked 4x4 coefficient units.
37+- Empirical proof the chunking matches the bitstream: the same fixture bytes
38+ (sha256 `d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`)
39+ stopped at the (4, 32) refusal before the change; after it, decode consumes
40+ that block's chroma and reaches the LATER intra-arm panic below — entropy
41+ stayed consistent across the chunked units.
42+
43+## The fix (scoped to the one shape)
44+
45+`read_inter_rect_chroma` (`decode.rs`): when ss is (1, 0) and the write rect
46+is exactly (4, 32), chunk into (4, 4) units — the existing multi-unit loop
47+then stamps per-unit chroma neighbour contexts, embeds into the square-stride
48+grid, and returns the per-unit list for the tail's re-stamp, unchanged. Each
49+unit reads `TxbSet::Chroma4` / `default_scan(4)` (the lane-av1-422j rows) and
50+inherits NO tx_type (`av1_get_tx_type` returns DCT_DCT for
51+`tx_size == TX_4X4`, blockd.h), so `inherit_tx_type` is `None` for these
52+units.
53+
54+Counter `CHROMA422_CHUNK_HITS` (+ `chroma422_chunk_hits()`, printed by
55+`decode_probe` as `chroma422_chunk:`): one hit per TX_4X4 chunk unit read; a
56+4:2:0/4:4:4 frame cannot increment it. On the current fixture the probe
57+panics at the later stop before `report()` prints, so the number is not yet
58+exercised on a full decode; the units demonstrably ran (frontier evidence
59+above).
60+
61+## Next stop named (NOT fixed — another shape, another lane's arm)
62+
63+`decode_inter_block`'s INTRA arm (lane-av1-422k's
64+`read_rect_chroma_unit` call, `decode.rs`:35166/35208) codes a 64x64 intra
65+block's 4:2:2 chroma plane as ONE (32, 64) unit with `TxbSet::Chroma32`:
66+
67+```
68+thread 'main' panicked at crates/ec-av1/src/decode.rs:7195:9:
69+rect coeff scratch w=32 h=64 n=2448
70+```
71+
72+libaom chunks that plane too: the intra residual walk
73+(`read_coeffs_and_intra`, decodeframe.c) steps `av1_get_tx_size` units, and
74+`av1_get_max_uv_txsize(BLOCK_64X64, 1, 0)` =
75+`av1_get_adjusted_tx_size(TX_32X64)` = **TX_32X32** (`blockd.h:1361`), i.e.
76+two 32x32 units per plane. Lifting it means re-plumbing the k lane's
77+whole-plane arm into a per-unit walk (set rows, per-unit `around_mi_422_chroma`
78+contexts, restamp) — that is the intra 4:2:2 chroma lane's territory, and the
79+(4, 32) inter shape this ticket owns is done.
80+
81+## Verification
82+
83+- `cargo check -p ec-av1 --all-targets` (target dir
84+ `~/.cache/cargo-target-av1422m`): **0 warnings**.
85+- 420 gate green under `EC_AV1_REQUIRE_AOMENC=1`:
86+ `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_decodes_
87+ pixel_exact`: 1 passed, 0 failed.
88+- Header refusal restored byte-identical after the probe bypass
89+ (`stream.rs` refusal block untouched); default 4:2:2 refusal fires as
90+ before.
91+- Oracle decode reference for the fixture: `$HOME/.cache/aom-oracle/build/
92+ aomdec` → 16 shown frames (I422 y4m).
93+- Untouched: the 4:2:0 group-tail chroma SKIP arm, the k lane's
94+ `read_rect_chroma_unit` arms, `rect_inter_chroma_set`'s tables (no new row;
95+ the (4, 32) refusal arm stays for any FUTURE unchunked arrival).
96+
97+## State
98+
99+- Commit on lane-av1-422m (no push): the chunking + counter + probe print +
100+ this report.
101+- No table row added. The header refusal stands.
lanes/av1422mi24.report.mdadded+106 -0
@@ -0,0 +1,106 @@
1+# lane-av1422mi24 — the t422 inter ladder continued from mi(24,60): the
2+# square/rect block chroma context gathers routed through the 4:2:2
3+# every-second-above-cell sampling; frame-1 entropy now in FULL rng lockstep
4+# and ALL frames' LUMA decodes exact; the residual is a chroma pixel-level
5+# class (entropy-identical), first site named below
6+
7+## Outcome
8+
9+1. **Reproduction at HEAD 95408ed3.** The ctxgather lane's named residual
10+ reproduced exactly: frame 0 exact at prefilt/postdeb/postcdef; frame 1
11+ prefilt first diffs Y (96,240) = mi(24,60), U chroma (2,44), V (0,44).
12+2. **The mi(24,60) divergence localized (rng-anchored lockstep,
13+ EC_TRACE_PART + EC_AV1_TRACE pairing vs the oracle's EC_PART).** 293
14+ partition reads matched rng-for-rng; the walk first misaligned at the
15+ NEXT 16x16 read (mi(24,60) pre-read rng 52112 vs oracle 64776). Window
16+ diff (EC_ISTEP / EC_COEFF / EC_COEFF_STEP) pinned the first divergent
17+ symbol: the **U dc_sign read of the mi(24,56) 16x16 inter block** — ours
18+ `dc_sign_cdf[0]`, oracle row 1. Every level read around it matched
19+ rng-for-rng: the coefficient scan placement is CORRECT (the codebase's
20+ row-major SCAN_8X16/SCAN_16X8 pair and libaom's column-major
21+ default_scan_8x16/default_scan_16x8 enumerate identical (row, col)
22+ orders; verified cell by cell against the oracle source).
23+3. **Root cause, class `per-mi chroma context gather` (the ctxgather
24+ lane's own rule, three more sites).** At ss (1,0) one chroma 4-px
25+ column spans TWO luma mi columns; the plain
26+ [`Neighbours::around_mi_rect`]/[`around_mi`] walk samples the above
27+ span per luma mi and counts every chroma column's whole-unit dc sign
28+ twice, so `dc_sign_ctx`'s vote sum lands one sign row off. Three block
29+ classes still gathered per-mi at ss (1,0):
30+ * `decode_inter_block`'s block `around` — single-TU arm AND the
31+ var-tx/mu arm (square blocks: the mi(24,56) 16x16; rect_tu strips:
32+ 16x8 pieces), previously only the strip-pair `around_c` was routed;
33+ * `decode_rect_split`'s `chroma_tiled` arm — the else branch kept the
34+ plain walk for every non-(4,32) unit, so a 16x8 intra-in-inter
35+ strip's (8, 8) chroma unit (mi(26,60), the frame-1 HORZ pair's second
36+ piece) read its U dc_sign one row high;
37+ * `decode_rect_split`'s unsplit single-TU chroma arm (line ~10863)
38+ and `decode_intrabc_rect`'s two chroma gathers — same class, fixed
39+ under the same ss (1,0) gate. The intrabc arms are UNREACHABLE on the
40+ pinned fixture (`intrabc_hits: 0`): verified by gating only, not by a
41+ 4:2:2-intrabc witness (per the intrabc inventory discipline the
42+ owning lane should witness them).
43+ Every edit is gated `ss_x == 1 && ss_y == 0` with the non-4:2:2 arm the
44+ original expression verbatim.
45+4. **Diagnostic parity (Main's request): [`around_mi_422_chroma`] now
46+ prints the same env-gated `EC_DCDUMP422` block `around_mi_rect` prints**
47+ (sampled above cells), so a rerouted 4:2:2 chroma gather stays visible
48+ under `EC_DCDUMP=1`.
49+5. **Oracle ground truth used:** the instrumented aomdec's `EC_DBGCTX`
50+ chroma context dump (cells + the built binary's `dc_sign_contexts`
51+ table, extracted from the binary: signum semantics {neg:1, 0:0,
52+ pos:2}, matching our `dc_sign_ctx`). The src tree's table literal
53+ differs from the built one; the binary is authoritative.
54+
55+## Verification
56+
57+- **Partition lockstep, frame 1, post-fix (decode_probe +
58+ EC_TRACE_PART vs oracle EC_PART, 2-frame fixture):** 300/300 oracle
59+ partition reads match rng-for-rng in walk order (ours consumes 4 extra
60+ gathered `EC_PARTG` prints the oracle does not emit) — **no rng
61+ mismatch anywhere in the frame**.
62+- **t422 inter ladder re-measured** (decode_probe +
63+ EC_AV1_{PREFILT,POSTDEBLOCK,POSTCDEF}_DUMP vs the oracle stage dumps,
64+ our dumps /tmp/i422/av1422mi24/*{prefilt,postdeb,postcdef}*8):
65+ * frame 0: exact at all three stages;
66+ * **LUMA: 0 diffs on EVERY frame 1–15 at prefilt AND postdeb** (frame 1
67+ was 2146 diffs pre-lane; frame 3 was 25163). Frame 15 postcdef shows
68+ Y=5059 — a CDEF knock-on: CDEF decisions read the (still wrong)
69+ chroma, not a luma defect (postdeb f15 Y=0);
70+ * chroma: frame 1 U 4346 → 4175, V 4974 → 4636; frames 3–14 chroma
71+ improved on every plane (e.g. f3 U 12610 → 4363); first U diff moved
72+ to chroma (4,44).
73+- **Frame exactness claimed ONLY where measured 0:** frame 0 all stages;
74+ frames 1–15 LUMA at prefilt/postdeb. Frames 1+ chroma are NOT claimed.
75+- **The residual, site named (next lane's first diff).** With entropy in
76+ full lockstep (luma exact everywhere proves it), the remaining chroma
77+ diffs are a PIXEL-level class, entropy-identical: first frame-1 diffs
78+ U chroma (4,44) → luma (88,8) — the 8x8 inter leaf mi(0,22)'s chroma:
79+ U rows 0..3 exact, rows 4..7 wrong; V col 44,45 rows 0..15. The oracle
80+ reads NO U residual there (no `EC_COEFF plane=1` at chroma cell
81+ (11,0)), so this is a chroma prediction/reconstruction defect for sub-8
82+ 4:2:2 leaves (`chroma422_sub8` / `sub8_inter_split` territory), not a
83+ context-gather defect. CDEF-stage luma diffs on f15 are downstream of
84+ it.
85+- **4:2:0/4:4:4 identity:** every edit is ss (1,0)-gated with the other
86+ arm verbatim; the lossless gate battery stays green — 8 passed 0 failed
87+ including `a_lossless_libaom_key_frame_decodes_sample_exact`,
88+ `a_lossless_libaom_inter_frame_decodes_sample_exact`,
89+ `a_real_aomenc_mixed_lossless_segment_frame_decodes_sample_exact`.
90+- `cargo check -p ec-av1` (target dir `~/.cache/cargo-target-av1422mi24`):
91+ **0 warnings, 0 errors**.
92+- The `EC_AV1_ALLOW_422_PROBE` bypass was applied to stream.rs for the
93+ probe runs and REVERTED; `git status` names only decode.rs.
94+- Charter note: the s2.obu mandelbrot re-run was DONE by Agent104 (still
95+ panics at decode.rs:3709, empty pred slice — bigblock lane's defect);
96+ dropped from this lane per Main.
97+
98+## State
99+
100+- Commit on lane-av1-422mi24 (no push): the ss (1,0) chroma-gather fixes
101+ in `crates/ec-av1/src/decode.rs` + this report.
102+- Next stop named for the owning lane: the chroma pixel-level class —
103+ first site the frame-1 8x8 inter leaf mi(0,22)'s chroma (U rows 4..7,
104+ V rows 0..7, chroma cols 44..47), prediction/reconstruction for sub-8
105+ 4:2:2 leaves with entropy in lockstep; and the f15 postcdef CDEF
106+ knock-on disappears with it.
lanes/av1422n.report.mdadded+74 -0
@@ -0,0 +1,74 @@
1+# lane-av1-422n — e24dc84b's (4, 32) chunk is corrected from eight TX_4X4 to
2+# FOUR TX_4X8 units; the header refusal STAYS (the stream is not pixel-exact
3+# and stops at the (2, 16) rect-pair chroma shape)
4+
5+## Outcome
6+
7+1. `read_inter_rect_chroma`'s invalid-ss-size arm now chunks the (4, 32)
8+ 4:2:2 chroma plane of an 8x32 luma block into FOUR TX_4X8 units per plane
9+ (a 1x4 grid: 4 wide, 8 tall each). The committed eight-TX_4X4 chunking
10+ was wrong: reviewer FAIL on e24dc84b. `BLOCK_INVALID` is 255, and the
11+ out-of-bounds byte `get_vartx_max_txsize` reads from
12+ `max_txsize_rect_lookup` in the pinned Release oracle build is TX_4X8 —
13+ not the "adjacent `vtx_tab[0]` = TX_4X4" the m report claimed.
14+2. The units KEEP a tx type: `av1_get_tx_type` (blockd.h) has no TX_4X4
15+ early-out, so the m lane's `inherit_tx_type = None` special case is gone.
16+ The units derive the type from the block's luma type through
17+ `reduce_inherited_chroma_tx_type` into the TX_4X8 ext-tx set, exactly
18+ like every other rect unit on this path. `(4, 8)` resolves through the
19+ existing `rect_inter_chroma_set` row `(8, 4) | (4, 8) => ChromaRect8x4`;
20+ no table row was added, and the (4, 32) refusal arm below it stays.
21+3. The (32, 64) intra chroma edit made earlier this session was REVERTED
22+ per instruction before the chunk fix; the intra arm is byte-identical to
23+ e24dc84b. 4:2:0 paths untouched.
24+
25+## Counter (first real exercise of `CHROMA422_CHUNK_HITS`)
26+
27+With the header refusal temporarily bypassed (probe only, restored
28+byte-identical — see below), the fixture walks 32 TX_4X8 chunk units
29+(`CHROMA422_CHUNK_HITS`, instrumented per unit) before the next stop. The
30+m report's count never printed because the probe panicked first; with the
31+corrected chunking the units demonstrably run.
32+
33+## Frontier (NOT fixed — another shape, another lane's arm)
34+
35+`decode_rect4_16_strip`'s closed chroma-shape set (`decode.rs:14902`) has no
36+`(2, 16)` row: a 4x16 luma pair's 4:2:2 chroma plane arrives there and hits
37+the `unreachable!`. The probe decodes frame 1 and stops early in frame 2,
38+after the 32 TX_4X8 units. The (32, 64) intra scratch panic did NOT
39+reproduce on this walk — this stop precedes it.
40+
41+## Pixels — delete condition unmet, refusal STAYS
42+
43+- Frame 1 (keyframe): luma byte-exact vs `aomdec` (oracle: 16 shown I422
44+ frames); U/V diverge from chroma (23, 0) on — a pre-existing keyframe
45+ 4:2:2 chroma gap present at e24dc84b too (frame 1 decodes through
46+ `decode_block`, which neither `read_inter_rect_chroma` nor the intra arm
47+ touches).
48+- Frames 2+ are not comparable (the frame-2 stop above).
49+- The 16-frame pixel-exact + counter delete condition is unmet, so the
50+ header refusal stands untouched.
51+
52+## Verification
53+
54+- `cargo check -p ec-av1 --all-targets` (target dir
55+ `~/.cache/cargo-target-av1422n`): **0 warnings**.
56+- 420 gate green under `EC_AV1_REQUIRE_AOMENC=1`:
57+ `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_decodes_
58+ pixel_exact`: 1 passed, 0 failed.
59+- Probe bypass reverted: `git diff` after the run shows ONLY
60+ `crates/ec-av1/src/decode.rs` (the chunk fix + comment rewrite); the
61+ default 4:2:2 refusal fires as before (`REFUSED: unsupported: ... 4:2:2
62+ ...`).
63+- Oracle reference: `$HOME/.cache/aom-oracle/build/aomdec` on the fixture
64+ (sha256 `d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`)
65+ → 16 shown frames.
66+- Untouched: the (4, 32) refusal arm in `rect_inter_chroma_set`, the 4:2:0
67+ group-tail chroma SKIP arm, the k lane's `read_rect_chroma_unit` arms,
68+ `decode_probe.rs` (byte-identical to e24dc84b).
69+
70+## State
71+
72+- Commit on lane-av1-422n (no push): the corrected chunking + this report.
73+- Next stop named for the owning lane: `decode_rect4_16_strip` chroma shape
74+ `(2, 16)`.
lanes/av1422o.report.mdadded+110 -0
@@ -0,0 +1,110 @@
1+# lane-av1-422o — the (2, 16) stop is NAMED and dispositioned: libaom has no
2+# such transform; the odd strip is the chroma reference and codes the PAIR's
3+# (4, 16) as TWO TX_4X8 units per plane; the header refusal STAYS (the walk
4+# now stops in `decode_block_rect4`'s chroma shape set at 4x32)
5+
6+## Outcome
7+
8+1. Step 1 of the charter (print before adding): with the header refusal
9+ temporarily bypassed (probe-only, restored byte-identical — see below),
10+ the refusing shape printed as `(cw,ch)=(2,16) ss=(1,0)`. The walk's own
11+ `(2, 16)` is the EVEN strip's own chroma — a shape libaom never codes.
12+ The port does not chunk it; it is UNREACHABLE after the fix.
13+2. `decode_rect4_16`'s `has_chroma` is per axis now: a VERT 4x16 strip (1 mi
14+ wide) keeps libaom `is_chroma_reference`'s column clause
15+ `(mi_col & 1) || !(bw & 1) || !ss_x`, which with bw == 1 mi reduces to
16+ `mi_col odd` at every ss_x == 1 format. The old `i % 2 == 1 || ss_y == 0`
17+ marked even strips as chroma references at 4:2:2 — the source of the
18+ phantom (2, 16). HORZ strips keep `i % 2 == 1 || ss_y == 0` (all four
19+ strips are references at ss_y 0); 4:2:0 and 4:4:4 resolve to the exact
20+ same flags as before in all four strip/format combinations.
21+3. `decode_rect4_16_strip`'s own-chroma arm is HORZ-only now; a VERT strip
22+ falls through to the pair merge `((lmi.0, lmi.1 - 1), 8, 16)` — the
23+ closing strip codes the pair's chroma at the pair's origin
24+ (`setup_pred_plane`'s `mi_col -= 1` snap), giving (cw, ch) = (4, 16) at
25+ ss(1,0). The old comment claiming "a conformant stream carries no such
26+ leaf" is disproven by the fixture itself and is gone.
27+4. The (4, 16) at ss_x == 1 is CHUNKED the way the pinned oracle walks it
28+ (`chroma422_pair16` arm): `ss_size_lookup[BLOCK_4X16][1][0]` is
29+ BLOCK_INVALID (common_data.c row `{ { BLOCK_4X16, BLOCK_4X8 },
30+ { BLOCK_INVALID, BLOCK_4X8 } }`), so `av1_get_tx_size` reads
31+ `max_txsize_rect_lookup[255]` — the out-of-bounds byte is TX_4X8
32+ (skill-measured, 0x05) and `av1_get_adjusted_tx_size` has no TX_4X8
33+ case. `decode_token_recon_block` then walks unit_width =
34+ ROUND_POWER_OF_TWO(1, 1) = 1, unit_height = 4, stepr =
35+ tx_size_high_unit[TX_4X8] = 2, stepc = 1: TWO TX_4X8 units per plane,
36+ plane-major, the lower one predicted off the upper one's samples. The
37+ skip arm walks the same two units (prediction runs per unit regardless
38+ of `skip_txfm`). No coefficient-table row was added: the units ride the
39+ existing `(4, 8) => ChromaRect8x4` entropy class via
40+ `read_rect_chroma_unit`.
41+5. The chunk's `txb_skip_ctx` rides the same INVALID lookup: libaom
42+ `get_txb_ctx_general`'s chroma branch picks the offset (7 vs 10) through
43+ `num_pels_log2_lookup[plane_bsize] > num_pels_log2_lookup[BLOCK_4X8]`
44+ with plane_bsize = 255. Measured, not guessed: the pinned Release
45+ oracle's decodetxb.c code indexes the `num_pels_log2_lookup` copy at
46+ vaddr `0xc0db70` (objdump: `cmpb $0xb,0xc0db70(%r15)` et al.), and the
47+ byte at that offset + 255 is 255 → offset 10 → the port's
48+ offset-7-first tables take `+3` (above + left + 3), the same shape the
49+ square multi-unit walks already use.
50+6. No tx_type symbol: only y plane's is transmitted (decodetxb.c "only y
51+ plane's tx_type is transmitted"); the intra chroma unit's type is
52+ `intra_mode_to_tx_type(UV mode)` kept by the all-16 ext-tx set — exactly
53+ `read_rect_chroma_unit`'s own default. CfL parameters are computed once
54+ per block over the pair's luma (`are_parameters_computed`) and shared by
55+ both units; the DC-pred cache is dead in this build (`use_dc_pred_cache`
56+ never set true), so each unit predicts its own DC.
57+
58+## Counter (CHROMA422_RECT_HITS, instrumented per unit, temp print removed)
59+
60+The walk reads EIGHT chunk units — two pairs (mi (28, 44) and (32, 52)),
61+each plane-major: U unit row 0, U unit row 1, then V units — mi rows 2
62+apart (8 px) — and the counter ticks 100 → 101 → … → 107 across them
63+(`chroma422_rect=107` on the last line). Delta 8 = 2 planes x 2 units x 2
64+pairs. The pre-fix walk stops with the counter parked at 100.
65+
66+## Frontier (NOT fixed — another shape, another function)
67+
68+`decode_block_rect4`'s closed chroma-shape set has no `4x32` row:
69+`decode.rs:13550` panics `decode_block_rect4 chroma shape set is closed:
70+4x32` on the same probe walk after the (2, 16) fix. That function is the
71+VERT_4 pair reader one level up; it is NOT edited here — named for its
72+owning lane.
73+
74+## Pixels — delete condition unmet, refusal STAYS
75+
76+- Frame 1: no VERT_4 4:2:2 strip occurs before the old stop point, so
77+ frame 1's decode is untouched by this diff; its luma stays byte-exact vs
78+ `aomdec` and its U/V keep the pre-existing keyframe chroma gap from
79+ chroma (23, 0) on (`decode_block`'s own gap, present at e24dc84b, not
80+ this lane's function).
81+- The walk stops inside frame 2 at `decode_block_rect4`'s 4x32, so the
82+ 16-frame pixel-exact + counter delete condition is unmet: the header
83+ refusal stands untouched (verified below).
84+
85+## Verification
86+
87+- `cargo check -p ec-av1 --all-targets` (target dir
88+ `~/.cache/cargo-target-av1422o`): **0 warnings**.
89+- 420 gate green under `EC_AV1_REQUIRE_AOMENC=1`:
90+ `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_
91+ decodes_pixel_exact`: 1 passed, 0 failed.
92+- Probe bypass reverted: `git diff` shows ONLY `crates/ec-av1/src/decode.rs`
93+ (+144/−12); `stream.rs` is byte-identical and the probe without the
94+ bypass prints `REFUSED: unsupported: AV1 decode_stream (a chroma format
95+ of 4:2:2 ...)` as before.
96+- Oracle reference: `$HOME/.cache/aom-oracle/build/aomdec` on the fixture
97+ (sha256 `d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`)
98+ → 16 shown frames.
99+- Untouched: `read_inter_rect_chroma` (the four TX_4X8 (4, 32) chunk
100+ stays), the 4:2:0 group-tail chroma SKIP arm, the k lane's
101+ `read_rect_chroma_unit` (called, not edited), `decode_block_rect4` (the
102+ new frontier), `decode_probe.rs`, the lossless arm (shape-generic
103+ per-TX_4X4 walk already handles a (4, 16) pair).
104+
105+## State
106+
107+- Commit on lane-av1-422o (no push): the has_chroma parity fix, the horz
108+ own-chroma arm, the chroma422_pair16 chunk arms, and this report.
109+- Next stop named for the owning lane: `decode_block_rect4` chroma shape
110+ `4x32` (decode.rs:13550).
lanes/av1422p.report.mdadded+119 -0
@@ -0,0 +1,119 @@
1+# lane-av1-422p — the 4x32 chroma stop is NAMED and CHUNKED: libaom HAS the
2+# transform (the BLOCK_INVALID plane block reads max_txsize_rect_lookup[255]
3+# = TX_4X8 out of bounds), so `decode_block_rect4` walks FOUR TX_4X8 units per
4+# plane on the offset-10 skip rows; the whole 16-frame stream now decodes, the
5+# pixels are NOT exact, so the header refusal STAYS byte-identical
6+
7+## Outcome
8+
9+1. Step 1 of the charter (print before adding): with the header refusal
10+ temporarily bypassed (probe-only, restored byte-identical), the stop
11+ printed `EC_422P_STOP decode_block_rect4 chroma shape (4,32) luma=(8,32)
12+ ss=(1,0)` — the portrait 1:4 leaf the av1422o report named as its
13+ frontier, on the pinned fixture (sha256 `d3fa4beeb1309033e4a03f5ae5c4
14+ 31c8fa8386ba1ada088684710423c7938129`).
15+2. Measured, not guessed: `av1_get_tx_size` reads
16+ `max_txsize_rect_lookup[plane_bsize]` with plane_bsize =
17+ `ss_size_lookup[BLOCK_8X32][1][0]` = BLOCK_INVALID (255, `enums.h`). The
18+ byte at +255 of the copy `decode_token_recon_block` actually reads
19+ (objdump: every `movzbl 0xc0d030(%r*)` in that function) is `0x05` =
20+ TX_4X8; `av1_get_adjusted_tx_size` has no TX_4X8 case. The decodetxb copy
21+ of `num_pels_log2_lookup` (the `cmpb` against `0xc0db70(%r15)`, symbol at
22+ 0xc0de70) reads `0xff` at +255, so `get_txb_ctx_general`'s chroma branch
23+ (`txb_common.h`: `num_pels_log2_lookup[255] > num_pels_log2_lookup
24+ [BLOCK_4X8]`) takes the offset-10 arm. Both bytes re-measured on the
25+ pinned Release oracle this session.
26+3. The chunk (libaom `decode_token_recon_block` semantics: stepr =
27+ `tx_size_high_unit[TX_4X8]` = 2 4-px rows, stepc = 1, unit_width/height
28+ ROUND_POWER_OF_TWO down to (1, 4)): FOUR stacked TX_4X8 units per plane
29+ (chroma rows 0, 8, 16, 24), plane-major, riding the existing
30+ `(4, 8) => ChromaRect8x4` entropy class via [`read_rect_chroma_unit`] —
31+ no coefficient-table row added (BLOCK_4X32 is not a table libaom has).
32+ Each unit is read and recorded immediately: unit row 0's txb_skip_ctx
33+ sees the real neighbour states, lower units see the block's own upper
34+ unit's, and each unit predicts off the upper one's samples. The skip arm
35+ walks the same units (`predict_and_reconstruct_intra_block` predicts
36+ every unit regardless of `skip_txfm`). CfL parameters are computed once
37+ per block over the strip's 8x32 luma and shared by all units. Luma is
38+ the same single TX_8X32 rect the general arm reads.
39+4. The chunk units' `txb_skip_ctx` is `above + left + 10`
40+ (`get_txb_ctx_general`): the port's offset-7-first `txb_skip_chroma_8`
41+ stores the offset-10 rows at rows 3..6 (lane-av1-422b), so
42+ [`read_rect_chroma_unit`] gained a `chroma_skip_offset: Option<usize>`
43+ parameter (mirroring [`read_plane`]'s `chroma_ctx_offset`) and this arm
44+ passes `Some(3)`. Every existing caller passes `None` =
45+ behavior-identical (their rect unit IS the whole plane block, offset-7
46+ rows); the whole-rect read never sees the new `(4, 32)` match row.
47+5. 4:2:0 and 4:4:4 are on their existing paths: the chunk is gated on
48+ `(chroma_w, chroma_h) == (4, 32)` at ss(1,0), which only an 8x32 luma
49+ strip at 4:2:2 produces (4:2:0 reads (4, 16), 4:4:4 reads (8, 32)); the
50+ stale "portrait leaves are unreachable / a conformant stream cannot
51+ carry that leaf size" comment is disproven by the fixture and replaced.
52+
53+## Counter (probe, bypass env; temp print removed)
54+
55+- `rect4_32: vert=1 coded=1` — exactly one 8x32 rect4 strip in the stream,
56+ the block that used to stop.
57+- Eight unit reads at mi=(24,52), plane-major (U rows 0..3, V rows 0..3),
58+ the temp trace printing skip_ctx 3/4/5 — i.e. the offset-10 rows
59+ (base 0..2 + 3) — and varying unit-to-unit as the block's own upper
60+ units enter the context.
61+- `chroma422_rect: 172` total rect 422 chroma units across the 16 decoded
62+ frames (CHROMA422_RECT_HITS, ticked inside [`read_rect_chroma_unit`]).
63+- Pre-fix walk: panics at the stop before any report; post-fix probe prints
64+ `OK: 16 frames decoded, 256x144`.
65+
66+## Pixels — delete condition UNMET, refusal STAYS
67+
68+- Frame 0 (keyframe): luma byte-EXACT vs `aomdec --rawvideo`; U/V carry
69+ 4491/4888 sample diffs from offset ~23 — the PRE-EXISTING keyframe chroma
70+ gap in [`decode_rect_split`] (the live `EC_RECTCHROMA_GAP luma=16x8
71+ tx=8x8 chroma=8x8` diagnostics, ×21 plus one 64x32; present at e24dc84b
72+ per the av1422o report, not this lane's function).
73+- Frames 1..15 diverge widely (luma included), consistent with an entropy
74+ divergence somewhere in the inter walk — this is the first time the
75+ stream decodes past the old stop, so there is no earlier full-stream
76+ baseline to diff against.
77+- Frontier (NOT fixed — larger than this one shape; named per charter):
78+ 1. **`decode_rect4_16_strip`'s `chroma422_pair16` chunk passes no chroma
79+ skip offset** — it reads the offset-7 rows (txb_skip rows 0..3) where
80+ the same measured rule (plane_bsize BLOCK_INVALID for the pair's
81+ BLOCK_4X16 too) demands offset 10, i.e. `Some(3)`. That function is
82+ the protected av1422o lane fix, so this lane only plumbed `None`
83+ through the new parameter (behavior-identical) and names the defect
84+ for its owning lane. It runs in frame 2 before the 4x32, making it
85+ the prime suspect for the inter-frame divergence.
86+ 2. [`decode_rect_split`]'s own-chroma gap (the EC_RECTCHROMA_GAP class
87+ above).
88+ 3. Our dump carries out-of-range u16 samples on frames 1 (2 samples) and
89+ 14 (6 samples) — an unclipped-output class, unattributed.
90+- The header refusal stands untouched: `git diff` shows ONLY
91+ `crates/ec-av1/src/decode.rs` (+255/−40); `stream.rs` is byte-identical
92+ and the probe without the bypass prints `REFUSED: unsupported: AV1
93+ decode_stream (a chroma format of 4:2:2 ...)` as before.
94+
95+## Verification
96+
97+- `cargo check -p ec-av1 --all-targets` (target dir
98+ `~/.cache/cargo-target-av1422p`): **0 warnings, 0 errors**.
99+- 420 gate green under `EC_AV1_REQUIRE_AOMENC=1`:
100+ `stream::tests::a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_
101+ whose_tx_split_decodes_pixel_exact`: 1 passed, 0 failed ("6 pixel-exact
102+ matches, 0 named refusals").
103+- Oracle reference: `$HOME/.cache/aom-oracle/build/aomdec` on the fixture →
104+ 16 frames raw 4:2:2, per-frame per-plane diffed against `dump_yuv`.
105+- Untouched: `decode_rect4_16_strip` (mechanical `None` arg only, no
106+ behavioral edit), `read_inter_rect_chroma` (the four TX_4X8 (4, 32) inter
107+ chunk stays), the 4:2:0 group-tail chroma SKIP arm, `decode_probe.rs`,
108+ the lossless arm (depth != 0 || lossless returns before the chroma
109+ table), the landscape (16,8)/(8,4) arms, and every existing
110+ [`read_rect_chroma_unit`] caller's decode behavior.
111+
112+## State
113+
114+- Commit on lane-av1-422p (no push): the chroma_skip_offset parameter, the
115+ 4x32 chunk arms (skip and non-skip), the corrected portrait-leaf comment,
116+ and this report.
117+- Next stop named for the owning lane: the `chroma422_pair16` offset-10
118+ skip rows in `decode_rect4_16_strip`, then the inter-frame walk's first
119+ divergence against the oracle.
lanes/av1422q.report.mdadded+42 -0
@@ -0,0 +1,42 @@
1+# lane-av1-422q — the av1422p frontier's prime suspect APPLIED: the
2+# `chroma422_pair16` chunk passes `Some(3)` (the offset-10 skip rows), the
3+# 4x32 arm and every other caller untouched, the header refusal STAYS
4+
5+## Outcome
6+
7+1. The one-argument change, nothing else: `decode_rect4_16_strip`'s
8+ `chroma422_pair16` arm now passes `Some(3)` to [`read_rect_chroma_unit`]'s
9+ `chroma_skip_offset` (was `None`). Same measured rule as the 4x32 arm:
10+ the pair's plane_bsize is `ss_size_lookup[BLOCK_4X16][1][0]` =
11+ BLOCK_INVALID too, and the decodetxb copy of `num_pels_log2_lookup` reads
12+ `0xff` at +255 (0xc0de70), so libaom's `get_txb_ctx_general` takes the
13+ offset-10 arm; the port's offset-7-first `txb_skip_chroma_8` holds those
14+ rows at 3..6. The stale lane-av1-422p `None` comment (which claimed the
15+ offset-10 question was still open) is replaced by the measured rule.
16+2. Untouched, byte-identical: the 4x32 arm's existing `Some(3)`, every other
17+ [`read_rect_chroma_unit`] caller (`None`), the 4:2:0 group-tail chroma
18+ SKIP arm, `decode_probe.rs`, `stream.rs`, and the 4:2:2 header refusal
19+ (the charter's delete condition — 16-frame pixel-exact + a 422-unit
20+ counter — was not claimed this session, so nothing was deleted).
21+
22+## Verification
23+
24+- `git diff`: ONLY `crates/ec-av1/src/decode.rs` — one argument
25+ (`None` -> `Some(3)`) plus its comment (+7/−5 lines).
26+- `cargo check -p ec-av1` (target dir `~/.cache/cargo-target-av1422q`):
27+ **0 warnings, 0 errors**.
28+- 420 gate green under `EC_AV1_REQUIRE_AOMENC=1`:
29+ `stream::tests::a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_
30+ whose_tx_split_decodes_pixel_exact`: 1 passed, 0 failed.
31+- Not exercised this session (honest gaps): the 16-frame 4:2:2 stream was
32+ NOT re-decoded and no pixel comparison was run — this lane's scope was the
33+ single argument; whether the offset-10 rows fix the inter-frame
34+ divergence is the next lane's diff.
35+
36+## State
37+
38+- Commit on lane-av1-422q (no push): the `Some(3)` argument, the corrected
39+ comment, and this report.
40+- Next stop named for the owning lane: re-run the 16-frame probe/bypass with
41+ counters and diff frames 1..15 against the aomdec oracle — the av1422p
42+ report named this arm the prime suspect for the inter-frame divergence.
lanes/av1422r.report.mdadded+76 -0
@@ -0,0 +1,76 @@
1+# lane-av1-422r — REMEASURE after the q `Some(3)`: the first remaining diff is
2+# STILL frame 0 plane U (0, 23) ours=50 vs oracle=49 — first of the 4491-sample
3+# `decode_rect_split` own-chroma keyframe gap, NOT one wrong index — the
4+# inter-frame divergence PERSISTS (frames 1..8 differ from (0,0)), and the walk
5+# now PANICS at frame 9 in [`read_coeffs_rect`] (rect coeff scratch 36×36 <
6+# the 4:2:2 TX_32X64 chroma unit's 36×68). Stopped and named per charter.
7+
8+## Outcome
9+
10+1. Remeasured the pinned fixture (sha256 `d3fa4beeb1309033e4a03f5ae5c431c8fa
11+ 8386ba1ada088684710423c7938129`) at 03be6bad against
12+ `$HOME/.cache/aom-oracle/build/aomdec --rawvideo` (16 frames, i422), probe
13+ dump `EC_PROBE_OUT16`, local `EC_AV1_ALLOW_422_PROBE` bypass, reverted
14+ byte-identical after (`git status` clean before the report commit). Do not
15+ trust the p-report diff numbers blindly: re-derived per-frame per-plane
16+ first diffs from the raw dumps this session.
17+2. **The first remaining diff: frame 0, plane U, row 0, col 23, ours=50,
18+ oracle=49.** Frame 0 luma is byte-exact; frame 0 carries 4491 U + 4888 V
19+ diffs — the counts are byte-IDENTICAL to the pre-fix p-report measurement,
20+ as expected: frame 0 is the keyframe and the pair16/4x32 arms never run
21+ there. The class is [`decode_rect_split`]'s own-chroma gap (the live
22+ `EC_RECTCHROMA_GAP luma=16x8 tx=8x8 chroma=8x8` diagnostics). 4491 samples
23+ is not one wrong index → charter step 3: STOP and name the function:
24+ **`decode_rect_split`** (own-chroma reconstruction at ss(1,0)).
25+3. **The offset suspect is refuted for the inter-frame divergence**: frames
26+ 1..8 diverge from sample (0,0) in all three planes (frame 1: Y (0,0)
27+ ours=78 oracle=80, U (0,0) 230 vs 87, V (0,0) 165 vs 245; plane totals
28+ over 9 frames Y=258976, U=125891, V=124050). The q lane's `Some(3)` did
29+ not sync the inter walk. Note the U/V frame-1 offsets are consistent with
30+ MC inheritance of the already-wrong frame-0 chroma; the Y divergence
31+ (frame 0 Y exact) is a separate inter-path question that cannot be
32+ localized while chroma inherits the frame-0 gap.
33+4. **New hard stop, frame 9**: `read_coeffs_rect` panics
34+ `rect coeff scratch w=32 h=64 n=2448` (decode.rs:7129, panic at :7195).
35+ The scratch bound `n <= 36*36` covers ≤32×32 units; a 64×64 luma block at
36+ ss(1,0) has plane_bsize `ss_size_lookup[BLOCK_64X64][1][0]` = BLOCK_32X64
37+ (NOT invalid — unlike the p/q chunks), `max_txsize_rect_lookup` reads
38+ TX_32X64, and (32+4)×(64+4) = 2448 exceeds the bound. Frames 9..15 are
39+ unmeasurable until this is lifted. This shape never fired pre-fix because
40+ the unsynced walk never reached it.
41+5. 4 u16 samples out of 8-bit range across frames 0..8 (the p report's
42+ unclipped-output class, still unattributed; was 2+6 over 16 frames).
43+
44+## Decision
45+
46+- First diff is a 4491-sample class → no one-index fix exists; stopped per
47+ charter. Functions named: [`decode_rect_split`] (owns the first diff) and
48+ [`read_coeffs_rect`] (scratch capacity, blocks frames 9+).
49+- Header refusal STAYS: delete condition unmet (not pixel-exact — frame 0
50+ alone carries 9379 chroma diffs; no full-stream proof possible with the
51+ frame-9 panic). `stream.rs` untouched; the bypass was local-only and is
52+ not in the commit.
53+
54+## Verification
55+
56+- Ours: 9 complete frames dumped before the panic (147456 B/frame u16);
57+ oracle: 16 frames i422. Stride-checked comparison (u16 elements vs bytes —
58+ the first compare script had a byte/element stride bug; frame 0's numbers
59+ were unaffected and frames 1..8 were re-derived at the correct stride).
60+- `cargo check -p ec-av1` (target `~/.cache/cargo-target-av1422r`): 0
61+ warnings, 0 errors.
62+- 420 gate green under `EC_AV1_REQUIRE_AOMENC=1`:
63+ `stream::tests::a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_
64+ whose_tx_split_decodes_pixel_exact`: 1 passed, 0 failed.
65+- `git status` clean after bypass revert; this commit carries ONLY this
66+ report.
67+
68+## State
69+
70+- Commit on lane-av1-422r (no push): this report, nothing else.
71+- Next stop named for the owning lane: lift [`read_coeffs_rect`]'s scratch
72+ bound for TX_32X64 (36×68 levels — likely a heap fallback like
73+ [`read_coeffs`]'s, or a 68-row stack tier), re-run the 16-frame remeasure,
74+ THEN take the frame 1 luma (0,0) inter divergence with frame-0 chroma
75+ inheritance accounted for; [`decode_rect_split`]'s own-chroma gap remains
76+ the owner of the literal first diff.
lanes/av1422sqedge.report.mdadded+92 -0
@@ -0,0 +1,92 @@
1+# lane-av1422sqedge — the 4:2:2 square inter chroma MC row-MV axis fixed at
2+# source: every chroma MC site scaled the ROW motion component with the X
3+# subsampling (`mv_to_q4(cpy, mv.0, ss_x)`), so at ss (1,0) the vertical
4+# fetch position used half the row MV; the named frame-1 U (32,87) / V
5+# (32,80) residual is exact and chroma improved on every frame
6+
7+## Outcome
8+
9+1. **Reproduction at HEAD ce97ea17.** The residual_next_lane site reproduced
10+ exactly on the pinned t422 fixture (`/tmp/i422/t422_2f.obu`,
11+ sha256 d166ebf3...): frame 0 exact; frame 1 Y exact, U first diff
12+ (32,87) / V (32,80) with 3837 / 3879 diffs — byte-identical counts to the
13+ parent lane's report.
14+2. **Site correction (the parent lane's reading was wrong).** The named
15+ blocks are NOT "16x16→8x8→NONE leaves". The oracle's own partition trace
16+ (EC_PART, frame 1, tell=7910) reads `bsize=6 value=0` at mi(8,40): ONE
17+ 16x16 PARTITION_NONE inter block spanning mi(8,40..43), whose 4:2:2
18+ chroma is ONE 8x16 MC call per plane at chroma (32,80) (oracle rung
19+ AOMIN48: `row=32 col=80 bw=8 bh=16 sx=0 sy=0`). Our decoder decoded the
20+ same block (partition value 5=HORZ_B-style check elsewhere; here both
21+ sides in sync, luma byte-exact) and made the same 8x16 chroma calls —
22+ with `y_q4=496` where the oracle fetches row 30 (`y_q4=480`).
23+3. **Root cause, class `chroma-mc-row-axis-ss`** (13 sites): the chroma
24+ MC's ROW component took `mv_to_q4(cpy, mv.0, ss_x(fctx))`. libaom scales
25+ each axis with its OWN subsampling (reconinter.h:139-141:
26+ `orig_pos_y += src_mv->row * (1 << (1 - ssy))`), so at 4:2:2 (ss_x=1,
27+ ss_y=0) the row shift was halved: mv=(-16,0) fetched chroma rows 31..46
28+ instead of 30..45 — ±1-class diffs hugging every reference value
29+ boundary (the "rightmost chroma column" pattern). 4:2:0/4:4:4 are
30+ value-identical (ss_x==ss_y) and provably untouched.
31+4. **Fix:** row axis now passes `ss_y(fctx)` at all 4:2:2-reachable chroma
32+ MC sites — `decode_inter_block`: single-ref U/V (unscaled 34398/34413,
33+ scaled 34445/34461), compound U/V mv0/mv1 (32920/32998, 32948/33026),
34+ the 1:4-strip sub8 piece's prev_mv call (34556); `decode_inter_block8`:
35+ compound U/V mv0/mv1 (39586/39633, 39601/39648). Sites left verbatim
36+ (already correct or unreachable at 4:2:2): the 422 sub8 piece arm
37+ (37085/37126 already `ss_y`), the 420-only group arm (37285, ss_x==ss_y
38+ there), the chroma_444 piece arms (36975/38484, ss 0/0), the OBMC
39+ neighbour predictor and both warp call families (per-axis args).
40+
41+## Verification
42+
43+- **Localization evidence** (oracle build `$HOME/.cache/aom-oracle/build`,
44+ env-gated rungs added to reconinter.c / reconinter_template.inc:
45+ `AOMIN48` inputs, `AOMOUT48` post-prediction dst, `AOMMV48` mv+anchor;
46+ all inert without `AOMIN48=1`): oracle `AOMMV48 row=32 col=80 bw=8 bh=16
47+ mv=(-16,0) sx=0 sy=0` vs our `OUR_SQEDGE`-rung capture cpx=80 cpy=32
48+ mv=(-16,0) — identical inputs; only our y_q4 differed (496 vs 480),
49+ pinning the defect to the axis argument, not the MV or position. The
50+ temp `EC_DBG_SQEDGE` rung in decode_inter_block was REMOVED before this
51+ commit (no trace remains).
52+- **t422 16-frame ladder** (`/tmp/i422/t422_16f.obu`, sha256 dda96300...,
53+ decode_probe + prefilt/postdeb/postcdef stage dumps vs the oracle's):
54+ * frame 0: EXACT at prefilt, postdeb AND postcdef (Y, U, V all 0);
55+ * LUMA: 0 diffs on frames 1–14 at prefilt, postdeb AND postcdef
56+ (f15 postcdef Y=5059 is the mi24 lane's pre-existing luma CDEF knock-on
57+ class: luma prefilt/postdeb f15 are 0 and this lane's edit only moves
58+ chroma fetch positions, which cannot alter luma filter decisions);
59+ * chroma improved on BOTH planes at EVERY frame vs the parent lane's
60+ tree (e.g. f1 U 3837→2231, V 3879→2197; f14 U 7381→5177,
61+ V 7545→5188); the named sites (rows 32..47, cols 80..87) are exact.
62+- **Frame exactness claimed ONLY where measured 0:** frame 0 all stages;
63+ frames 1–14 luma at prefilt/postdeb/postcdef. Frames 1–15 chroma are NOT
64+ claimed (reduced, not exact).
65+- **4:2:0/4:4:4 identity:** the lossless gates stay green —
66+ `a_lossless_libaom_key_frame_decodes_sample_exact`,
67+ `a_lossless_libaom_inter_frame_decodes_sample_exact`,
68+ `a_real_aomenc_mixed_lossless_segment_frame_decodes_sample_exact`
69+ (8 lossless gates green in total).
70+- `cargo check -p ec-av1` (target dir `~/.cache/cargo-target-av1422sqedge`):
71+ **0 warnings, 0 errors**. `git status` names only decode.rs + this
72+ report; the `EC_AV1_ALLOW_422_PROBE` stream.rs bypass was applied for the
73+ probe runs and REVERTED.
74+
75+## State
76+
77+- Commit on lane-av1-422sqedge (no push): the 13 `ss_x`→`ss_y` row-axis
78+ fixes in `crates/ec-av1/src/decode.rs` + this report.
79+- **The residual, site narrowed (next lane's first diff).** Frame-1 prefilt
80+ chroma now first diffs at U/V (row 88, col 104): the 8x8→HORZ pair of
81+ 8x4 strips at mi(22,52) (luma rows 88..95, cols 208..215; chroma cols
82+ 104..111). Oracle MC: one 4x4 chroma call per plane at chroma (88,104)
83+ for the FIRST strip (subpel 0, mv 0 — the prediction is a pure reference
84+ copy: 202,204,204,167) and NO strip-2 chroma MC call at (92,104). Ours
85+ makes the same (104,88) 4x4 call with the same inputs, but our written
86+ rows 88..91 (206,204,202,200) are NOT that call's output — the strip
87+ chroma write/anchor path (rect-strip chroma units at ss (1,0),
88+ `read_inter_rect_chroma` / pair-write territory) is the suspect, NOT MC
89+ input selection. `is_chroma_reference` (av1_common_int.h:1454) says BOTH
90+ 8x4 strips are chroma references at ss (1,0); how the oracle fills rows
91+ 92..95 needs pinning first (oracle rung window currently rows 84..100,
92+ cols 96..120).
lanes/av1422stripanchor.report.mdadded+103 -0
@@ -0,0 +1,103 @@
1+# lane-av1-422stripanchor — `decode_rect_split`'s 4-wide-strip chroma ported to
2+# the split4 floored-pair anchor (`chroma422_pair_plane`), the ported pair
3+# plane tiled in the (4, 8) OOB units, and the (2, 16)/(2, 8) refusal shapes
4+# handled — frame 0 of the pinned t422 fixture stays byte-exact at
5+# PREFILT/POSTDEBLOCK/POSTCDEF/FINAL (first round with the FINAL rung
6+# measured), all 16 frames decode, and the port is measured inert on the
7+# fixture (`chroma422_pair_wide: 0`): NO stream reaches it today, so the lift
8+# is by construction and stays unwitnessed
9+
10+## Outcome
11+
12+1. `chroma422_pair_plane` (decode.rs, beside `depth_to_tx_wh`): the split4
13+ floored-pair anchor ported to `decode_rect_split`'s 1-mi-wide strips. A
14+ strip whose own chroma block would be 2 px wide at ss (1, 0) — luma
15+ `(4, 16)`/`(4, 8)`, the footprints `av1_ss_size_lookup[BLOCK_4X16]`/
16+ `[BLOCK_4X8][1][0]` mark BLOCK_INVALID (verified in the pinned oracle's
17+ `common_data.c`, not from prose) — codes the PAIR's `(4, bh)` plane:
18+ WRITE/PREDICTION anchor `((mi_col & !1) * MI) >> ss_x`
19+ (`av1_setup_dst_planes`' mi-exact floor, the lane-av1-422kf2/
20+ `sub8_leaf_chroma422` rule), entropy cell at the floored mi column, and
21+ the odd-column strip is the chroma reference (`is_chroma_reference`'s
22+ `mi_col & 1` clause, the rule `decode_rect4_16_strip`'s pair16 arm
23+ implements one partition level up). `None` on every other cell: 4:2:0 and
24+ 4:4:4 can never produce a 2-px-wide chroma block, so their routing is
25+ unchanged per format cell.
26+2. The skip and tiled chroma arms take the pair geometry: per-(4, 8) unit
27+ walks over `(chroma_block_w, chroma_block_h)` at the floored anchor
28+ `chroma_x` (the blockhalf lane's per-unit skip-push lesson kept),
29+ `around_mi_422_chroma` per chroma cell, `bigger` forced (the invalid
30+ plane's `num_pels_log2_lookup[255]` byte reads 0xff — the av1422q +3 rows)
31+ , CfL source over the PAIR's 8-px luma band, and the chroma `reach` is the
32+ pair block's (`Reach::of_rect(8, bh, pair_px, py, ..)`), not the odd
33+ strip's own. Every pre-existing expression reduces to its old value when
34+ `chroma_422_pair_wide` is false; the lossless raster arm is untouched (its
35+ domain cannot present a 4-wide strip).
36+3. The `(2, 16)` refusal (the inventory string "a coded HORZ/VERT strip whose
37+ chroma transform has no rect coefficient tables here") therefore no longer
38+ fires for the 4-wide shapes — they are handled. The string STAYS: it
39+ remains the shape guard for genuinely-untabled shapes, and the
40+ lane-t900-r33 enumeration test still pins the five callers.
41+4. GATE: `chroma422_pair_plane_matches_the_ss_size_lookup_cells` — a
42+ format-cell census over all 22 `BLOCK_SIZES_ALL` footprints: the pair arm
43+ fires exactly on the 2-px-wide slice of the real `ss_size_lookup[..][1][0]`
44+ BLOCK_INVALID column ((4, 8), (4, 16); BLOCK_4X4 excluded as the square
45+ path's own sub-8 rounding rule), the tall/wide BLOCK_INVALID shapes stay
46+ on `chroma_422_oob` (the two arms partition the column), and 4:2:0/4:4:4
47+ return `None` at every footprint. Floored-anchor math asserted for odd and
48+ even mi columns.
49+5. WITNESS COUNTER: `CHROMA422_PAIR_WIDE_HITS` (+ accessor, +
50+ `decode_probe` line). Reads 0 on the pinned fixture — the arm is provably
51+ inert there.
52+6. MEASURED (fixture `/tmp/t422.obu`, sha256
53+ `d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`,
54+ reused by hash; frame-0 cut `/tmp/t422f0.obu` sha256
55+ `3dd3f768ef553c02316848c2d3184c3765030c0a6fcb95887e4719add9ded3af`;
56+ ours = `decode_probe --release` under
57+ `$HOME/.cache/cargo-target-av1422stripanchor`, oracle =
58+ `$HOME/.cache/aom-oracle/build/aomdec`, padded-u8-vs-cropped-u8 compare):
59+ - frame 0: **0 diffs on Y, U and V at PREFILT, POSTDEBLOCK, POSTCDEF and
60+ FINAL** — the FINAL rung is measured this round (the parent lane's
61+ round bracketed it by POSTCDEF).
62+ - all 16 frames decode; counters unchanged from the parent lane
63+ (chroma422_rect 682, chroma422_sub8 122, chroma422_chunk 344) and
64+ `chroma422_pair_wide: 0`.
65+7. WHY NO WITNESS STREAM (the acceptance's fallback): the (2, 16) lift is
66+ by construction and UNWITNESSABLE today — no current stream can route a
67+ 4-wide strip into `decode_rect_split`. The five callers pass only the ten
68+ rect footprints with `8 <= min` (the enumeration test pins both the caller
69+ set and the domain); the real 4-wide readers — `decode_rect4_16_strip`
70+ (16-level 1:4, whose depth walk is inlined precisely because the chroma is
71+ pair-owned: the pair16 arm already carries the floored anchor + (4, 8)
72+ tiling), `decode_leaf_rect8` + `decode_inter_sub8_rect2` (8-level
73+ HORZ/VERT, both per-piece floored arms from lane-av1-422h/blockhalf) and
74+ the inter `PARTITION_*_4` walk — never call it. Three fresh
75+ `aomenc --profile=2` probes (testsrc2 cpu-used=1 + tx-size-search,
76+ mandelbrot cpu-used=0, smptebars screen tune) all decode or diverge
77+ without touching the arm. A witness requires a future caller that routes
78+ 4-wide strips here (a capability change the enumeration test will force a
79+ re-derivation for); the counter is wired so that stream proves itself the
80+ moment it exists.
81+
82+## Observed, not chased
83+
84+- The mandelbrot probe (`s2.obu`, frames 1+) crashes in
85+ `push_mc_rect_tx` ("range end index 32 out of range for slice of length
86+ 0") — frame 0 alone decodes clean. Read as a downstream symptom of the
87+ known frames-1+ partition-dispatch desync (mi(8,10), Agent204's lane) on
88+ heavy-motion content: a desynced shape walk reaches the MC push with an
89+ empty pred buffer. Not attributed to this port; named for the desync lane's
90+ ledger.
91+
92+## Decision
93+
94+- The header refusal STAYS unconditional in `stream.rs`; the
95+ `EC_AV1_ALLOW_422_PROBE` bypass was re-applied for the measurement runs and
96+ reverted byte-identical afterwards (0 occurrences;
97+ `a_non_420_subsampled_sequence_header_is_refused_by_name` green post-revert).
98+- 4:2:0/4:4:4 byte-identical by ss-keying, checked per format cell by the
99+ census gate and by measurement on the fixture.
100+- `read_coeffs_rect`, the chroma table rows and the 4:2:0 group-tail SKIP arm
101+ untouched.
102+- cargo check 0 warnings; targeted gates green (enumeration, 422 refusal,
103+ lossless sample-exact, rect-strip filter-intra, the new census).
lanes/av1422stripwrite.report.mdadded+240 -0
@@ -0,0 +1,240 @@
1+# lane-av1-422stripwrite — the 4:2:2 residual was NOT the rect-strip
2+# chroma write/anchor: a reference picture's chroma plane claimed
3+# `h / 2` rows, so every chroma MC sourced at or past the frame's
4+# midpoint was clamped; the pinned 16-frame t422 stream now decodes
5+# byte-exact (first cut FAILed on review for a floor half-width where
6+# the producer ceils — corrected, ladder re-run, still 48/48 + 16/16)
7+
8+## Outcome
9+
10+The parent lane's named site is **fixed, and it was not where the parent
11+pointed**. Frame-1 prefilt chroma no longer first-diffs at U/V (88, 104):
12+after the fix **all 16 frames of the pinned t422 stream are byte-exact on
13+every plane at prefilt, post-deblock AND post-CDEF, and the final
14+(post-loop-restoration) output is byte-identical to the oracle for all 16
15+frames** — 0 diffs, measured. The 4:2:2 header refusal stays.
16+
17+## Localization: the write and the anchor were both already right
18+
19+The parent read the site as "our written rows 88..91 are not the oracle's
20+MC output" and suspected the strip write/anchor. Measured, in order:
21+
22+1. **The block is not what the parent said.** The oracle's own dispatch
23+ trace (`SUB48D`, added to `build_inter_predictors` in
24+ `reconinter_template.inc`) puts the site on **two `BLOCK_8X4` blocks at
25+ luma (88, 208) and (88, 216)** — `bsize=2`, `mi=(208,88)` / `mi=(216,88)`,
26+ one per mi column, i.e. the top strips of the 8x8 groups at mi (11,26)
27+ and (11,27), each coded its own chroma `TX_4x4` at chroma (88,104) and
28+ (88,108) (`is_chroma_reference` at ss (1,0): `mi_size_wide[BLOCK_8X4] == 2`
29+ in libaom's 4x4-mi units, so the column clause `!(bw & 1)` is true and
30+ BOTH are chroma references — `av1_common_int.h:1454`). The parent's
31+ "mi(22,52)" is this decoder's own 4x4-mi coordinate for the same block
32+ (`const MI: usize = 4`, `decode.rs:6052`), not libaom's 8x8 mi, and its
33+ "chroma cols 104..111, rows 88..95" spans TWO mi columns and two 8x8
34+ groups. There is no strip-2 chroma MC because the strips below
35+ (luma rows 92..95) are INTRA, not because the pair merged.
36+2. **The oracle's prediction is a pure reference copy** (`AOMIN48`/
37+ `AOMOUT48`, both inert without the env var): `row=88 col=104 bw=4 bh=4
38+ sx=0 sy=0 srcoff=17000 stride=192` → source = frame 0's final U at
39+ (88, 104) exactly, output `r0 = 202 204 204 167` = the source bytes.
40+ The oracle's final chroma there is the same value, so the strip is a
41+ zero-residual copy.
42+3. **Our MC inputs were identical and correct.** A temporary rung in
43+ `decode_inter_sub8_rect2`'s 4:2:2 per-piece arm dumped the raw
44+ reference samples at the unit before the MC:
45+ `unit=(104,88) stride=128 tw=128 th=72 xq4=1664 yq4=1408
46+ raw=[202, 204, 204, 167, 185, 190, 190, 165, 158, 164, 163, 148,
47+ 145, 150, 148, 138]` — byte-identical to the oracle's `src0`. So the
48+ reference *contents*, the position, the mv, the filters and the scale
49+ were all right, and the 4x4 write rect `(unit_x, unit_y, 4, 4)` was
50+ right. What was wrong was that the MC turned those correct inputs into
51+ `206 204 202 200` x4 rows.
52+4. **The MC output was the tell.** `th=72` on a 144-tall frame. The
53+ reference plane the MC read declared **72 chroma rows** while holding
54+ 144. Rows at/past 72 are out of the plane's valid area, so
55+ `predict_with_filters` clamped them — the four output rows came from a
56+ clamped row, which is why they were identical to each other and why
57+ they matched nothing in the reference.
58+
59+## Root cause, class `ref-chroma-shape-420-folds-422`
60+
61+`RefPix::planes` (`decode.rs:30311`) builds each reference's chroma
62+`PlaneBuf` from a **two-way** shape test:
63+
64+```rust
65+let full = g.u.len() == g.width * g.height;
66+let (cw, ch) = if full { (g.width, g.height) } else { (g.width / 2, g.height / 2) };
67+```
68+
69+A stored reference carries no subsampling field, so the code inferred it
70+from the sample count — but the inference only knew 4:4:4 (luma-sized) and
71+4:2:0 (a quarter). A 4:2:2 reference is **half-width, full-height**:
72+`round_ss(w, 1) * h`, which matches neither, so it fell into the 4:2:0
73+branch and claimed `h / 2` rows. The stored data was never wrong (the frame
74+is stored through `round_ss(fw, ss_x) x round_ss(fh, ss_y)`,
75+`decode.rs:25806`, which is 4:2:2-correct) — only the *declared* shape was,
76+and `whole_plane` copies it into `width`/`height`/`true_*`, which is what
77+every chroma MC and every edge clamp reads.
78+
79+Consequence: at 4:2:2, **every** inter chroma prediction whose source row
80+was at or past the frame's vertical midpoint read clamped garbage, on every
81+subsampling-independent path (square blocks, rect strips, sub-8 pieces,
82+compound, OBMC). On the pinned fixture the same rung sweep found four
83+`mv = 0` per-piece units wrong, all with `unit_y >= 72`: (104,88),
84+(108,88) [the named site] and (80,120), (80,124) — the parent's residual
85+count was one symptom, not the site.
86+
87+## Fix
88+
89+One helper, both call sites (`decode.rs`):
90+
91+```rust
92+fn ref_chroma_shape(len: usize, width: usize, height: usize) -> (usize, usize) {
93+ let half_w = round_ss(width, 1);
94+ if len == width * height { (width, height) } // 4:4:4
95+ else if len == half_w * height { (half_w, height) } // 4:2:2
96+ else { (width / 2, height / 2) } // 4:2:0
97+}
98+```
99+
100+The half width comes from `round_ss`, **not** a bare `width / 2`, because
101+that is what the producer used: a frame is stored through
102+`round_ss(fw, ss_x) x round_ss(fh, ss_y)` (`decode.rs:25806`) and
103+`round_ss(dim, 1) == (dim + 1) >> 1` is a **ceil**. A floor test here
104+(this lane's first cut, corrected on review) silently misses every
105+odd-width 4:2:2 reference and drops it into the 4:2:0 arm — the same
106+defect one dimension over. The 4:2:0 arm is left at the old
107+`(width / 2, height / 2)` on purpose, so 4:2:0 keeps the exact shape it
108+always had.
109+
110+`Picture`'s `u`/`v` doc comment (`encode.rs`) was corrected to state the
111+real contract (half width, the frame's own chroma height) — the inference
112+above depends on it.
113+
114+**Untouched:** the current frame's chroma planes were already
115+`(width >> ss_x) x (height >> ss_y)` (`decode.rs:27313`, `41692`); the
116+`4:2:0` group-tail chroma SKIP arm (its owning lane); `stream.rs`'s 4:2:2
117+header refusal (byte-identical, unconditional — the local
118+`EC_AV1_ALLOW_422_PROBE` bypass was applied for the probe runs and
119+REVERTED).
120+
121+## Verification
122+
123+- **Before/after on the named fixture** (`/tmp/i422/t422_2f.obu`, sha256
124+ `d166ebf3c1bde8c32152cd9d077a317b4c7205b6538f0a7481e09fb6333ffdf4`;
125+ decode_probe + `EC_AV1_{PREFILT,POSTDEBLOCK,POSTCDEF}_DUMP` vs the
126+ oracle's): frame 0 exact before and after; frame 1 before: Y 0, U 2231
127+ (first (88,104) ours 206 / oracle 202), V 2197 (first (88,104) ours 212 /
128+ oracle 231) — byte-identical to the parent lane's reported counts, so
129+ the reproduction is sound; frame 1 after: **0 / 0 / 0**.
130+- **16-frame ladder** (`/tmp/i422/t422_16f.obu`, sha256
131+ `dda96300d2d36ba9dc958febb033e2334a2caee137bcb286c0276f259e57d5b6`):
132+ **0 diffs on every plane of every frame 0..15 at prefilt, post-deblock
133+ and post-CDEF** (48 stage-frame-plane groups), and the final
134+ post-loop-restoration dump is **byte-identical (73728 B) for all 16
135+ frames**. Re-measured after the probe-bypass revert/re-apply round trip:
136+ 48 groups, 0 diffs, 16/16 final. The oracle ladder was regenerated with
137+ the current build and is byte-identical to the parent lane's on every
138+ frame where both exist.
139+- **4:2:0/4:4:4 identity, measured three ways.**
140+ *By construction:* the inference's 4:4:4 arm is the old first test
141+ unchanged, and the 4:2:0 arm is the old fallback `(w / 2, h / 2)`
142+ verbatim — the only thing between them is the inserted 4:2:2 test, which
143+ can only fire on a count a 4:2:0 or 4:4:4 plane does not have.
144+ *Brute-forced:* against the producer's own `round_ss` crops
145+ (`decode.rs:25806`) over every `w, h` in `1..=128`, the 4:4:4 and 4:2:2
146+ counts are distinct from each other and from the 4:2:0 count and both
147+ route correctly for **every `w >= 2 && h >= 2`**; nothing a decodable
148+ frame produces falls outside that (the pinned fixture's chroma is
149+ 128x144).
150+ *4:2:0 at odd dimensions — an open, pre-existing gap, not a clean bill.*
151+ The floor arm is what the parent produced, but it is the wrong shape for
152+ an odd-dimension 4:2:0 reference: the producer stored
153+ `round_ss(w, 1) x round_ss(h, 1)`, so the floor under-declares. Running
154+ every 4:2:0 count over the `1..=128` square through the shipping helper:
155+ **12160 of the 16384 pairs** come back smaller than the plane holds —
156+ **12033** of them with `w >= 2` and **127** in the `w == 1` column (at
157+ `1x1` the 4:4:4 arm catches the count and `(1, 1)` is exact).
158+ Under-declaration at `h == 1` is **zero**: there the 4:2:0 count equals
159+ the 4:2:2 count, routes into the 4:2:2 arm and lands on the correct
160+ `(round_ss(w, 1), 1)`, which is also the one place the new arm departs
161+ from the parent's floor — for the 127 pairs with `w >= 2`, and there
162+ only by *correcting* the parent, which claimed zero rows. The `w == 1,
163+ h >= 2` residue is a shape error, not a misroute: the floor fallback
164+ simply cannot express `(1, round_ss(h, 1))`. A ceil fallback would close
165+ the whole gap, at the cost of departing from the parent on every
166+ odd-dimension 4:2:0 shape with no in-tree coverage to justify it.
167+ Recorded, not taken.
168+ *Gated:* `cargo test -p ec-av1 --lib -- lossless decodes_sample_exact
169+ 444 reference_chroma` in its own target dir
170+ `~/.cache/cargo-target-av1422stripwrite-gate` — see below for what that
171+ run is and is not evidence of.
172+- **Oracle instrumentation (measurement, not decode).** The oracle's
173+ `EC_AV1_POSTCDEF_DUMP` rung sat inside `if (!optimized_loop_restoration)`,
174+ so a frame with no CDEF and no superres produced **no** post-CDEF dump —
175+ frame 15 got none, which is why the parent lane's "f15 postcdef Y=5059"
176+ had no oracle counterpart to compare against (the file it names,
177+ `/tmp/i422/av1422mi24/postcdef.f15`, is 81920 B — this decoder's own
178+ padded dump, not an oracle dump). The rung is now a shared
179+ `ec_dump_postcdef()` called from both branches; the oracle confirms
180+ frame 15's post-CDEF equals its post-deblock (no CDEF on that frame),
181+ and our frame 15 post-CDEF is byte-identical to it.
182+- **A gate run that was thrown away, and why.** An earlier identity-gate
183+ run on this branch was launched against the ceil form and then
184+ **invalidated by my own concurrent edits**: while it was in flight I added
185+ the two routing tests below and deliberately mutated `half_w` back to the
186+ floor form to prove the test non-vacuous. Its result was never delivered,
187+ and whatever it compiled was not the shipping source (`decode.rs`
188+ md5 `999348d786ca0a8e930010ee46184d87` is the tree the accepted run
189+ covers). It is recorded here as **no evidence** rather than quietly
190+ dropped, and the accepted run is a clean re-run in a dedicated target
191+ dir with nothing else of mine touching cargo. Not a target-dir lock: the
192+ other suites on the host each use their own
193+ `$HOME/.cache/av1-local-suite/target-*` dir.
194+- `cargo check -p ec-av1 --all-targets` (target dir
195+ `~/.cache/cargo-target-av1422stripwrite`): **0 warnings, 0 errors**.
196+- **Regression tests, and proof they are not vacuous.** Two unit tests in
197+ `decode.rs`'s test module, the only 4:2:2-reachable gate while the header
198+ refusal stands (no stream can reach the code path otherwise):
199+ `a_reference_chroma_sample_count_routes_back_to_its_own_format` drives
200+ all three formats off the producer's own `round_ss` crops over odd AND
201+ even widths (2,3,4,5,8,9,16,17,64,65,128,129) and heights
202+ (2,3,4,5,8,9,64,65,144,145), and
203+ `a_422_reference_claims_the_full_chroma_height` pins the t422 shape
204+ (256x144 -> chroma 128x144, explicitly not the 72 rows the bug claimed).
205+ **Mutation proof:** with `half_w` reverted to `width / 2` — the exact
206+ floor form this lane's first cut shipped and the review caught — the first
207+ test FAILS with `4:2:2 reference of 3x2 (chroma 4 samples) must route
208+ back to its own shape`, and passes again on the restored ceil form. So
209+ the test pins the defect, not the implementation.
210+- `git status` names `decode.rs`, `encode.rs` (doc comment) and this
211+ report. Every temporary rung (`EC_SW422` in the 4:2:2 per-piece arm and
212+ in `build_c`; `SUB48`/`SUB48D`/`SUB48P` in the oracle's
213+ `reconinter_template.inc`) was removed before the commit.
214+
215+## State
216+
217+- Commit on `lane-av1-422stripwrite` (no push): the `ref_chroma_shape`
218+ helper + its two call sites in `crates/ec-av1/src/decode.rs`, its two
219+ routing regression tests, the `Picture` chroma-shape doc correction in
220+ `crates/ec-av1/src/encode.rs`, and this report. The first cut was FAILed
221+ on review for using a floor half-width where the producer ceils; the
222+ corrected helper, the ladder re-run (48/48 + 16/16 again) and the
223+ identity re-proof are all in this commit.
224+- **Merge note.** The sibling lane's `RefPix` three-way inference
225+ (`39f45c31`, lane-av1-422bigblock) edits the same two call sites. Both
226+ now agree on the arithmetic — the half width is `round_ss(w, 1)`, i.e.
227+ ceil, because that is what `decode.rs:25806` stores — so the union is a
228+ union, not a floor-vs-ceil fight. If that lane threads an explicit
229+ subsampling instead of inferring one from the length, prefer it and drop
230+ this helper; the 48/48 result is a property of the *shape* being right,
231+ not of how it is derived, so it survives either way. Re-run the 16-frame
232+ ladder after resolving.
233+- **No residual to hand on.** The 4:2:2 stream is pixel-exact end to end
234+ on this fixture, so the 16-frame ladder is no longer a frontier. What
235+ remains for 4:2:2 is coverage, not correctness: the 4:2:2 header
236+ refusal is still unconditional, and every claim here rests on one
237+ 256x144 fixture (`aomenc` 4:2:2, `--limit` cut) whose inter content is
238+ skip-heavy. A second 4:2:2 fixture with real residuals, compound and
239+ warped motion above the vertical midpoint is what would justify lifting
240+ the refusal — not more work on this stream.
lanes/av1422sub8pix.report.mdadded+83 -0
@@ -0,0 +1,83 @@
1+# lane-av1422sub8pix — the sub-8 4:2:2 chroma pixel defect fixed at source: the
2+# odd leaf's CfL source stepped into the right neighbour group and the inter
3+# piece's left half read the reference's U plane for BOTH chroma planes; frame-1
4+# U/V at the named mi(0,22) site are now exact and the f15 postcdef luma
5+# knock-on is gone
6+
7+## Outcome
8+
9+1. **Reproduction at HEAD c5d88f0b.** The mi24 lane's named residual reproduced
10+ exactly on the pinned t422 fixture (`/tmp/i422/t422_2f.obu`): frame 0 exact
11+ at prefilt; frame 1 Y exact, U first diff chroma (4,44) with rows 0..3
12+ exact / rows 4..7 wrong across cols 44..47, V first diff (0,44).
13+2. **Localization (EC_PRED/EC_PREDOUT8 + EC_DQCOEFF pairing vs the oracle).**
14+ For the frame-1 8x8 SPLIT group at mi(0,22) — leaves (0,22)/(0,23) inter,
15+ (1,22) inter with luma residual, (1,23) INTRA (filter-intra, uv_mode
16+ UV_CFL_PRED) — the oracle writes chroma rows 0..3 from leaf (0,23)'s
17+ `build_inter_predictors_sub8x8` (row-0 steps only; `ss_size_lookup
18+ [BLOCK_4X4][1][0]` is BLOCK_4X4, so the loop covers b8_h=4) and rows 4..7
19+ from intra leaf (1,23)'s floored-anchor TX_4X4 unit. Both sides' unit
20+ prediction (DC base 97, `EC_PREDOUT8`/`OUR_PRED` sum 1552) and dequantized
21+ coefficient grid (`EC_DQCOEFF` vs `OUR_DQ`: −152/+90/−180/+270/−90/+90,
22+ raster) are IDENTICAL — the defect is neither entropy nor placement.
23+3. **Root cause 1, class `sub8-cfl-source-anchor`** (`sub8_leaf_chroma422`):
24+ the CFL AC signal was sourced at the LEAF's own luma x (`px` = 92 for leaf
25+ (1,23)) instead of the FLOORED unit anchor (88) the same function already
26+ uses for the write/prediction anchor — the source averaged luma 92..99,
27+ i.e. half the span from the RIGHT neighbour group. Fixed: the CFL source
28+ anchors at `(lmi.1 & !1) * MI`, the same floor as the chroma write anchor
29+ (libaom `cfl_store_tx`/`sub8x8_adjust_offset` store the group's luma; the
30+ unit's AC span is the group's own 8-wide band at the leaf's own rows).
31+4. **Root cause 2, class `sub8-left-piece-wrong-plane`**
32+ (`decode_inter_sub8_split4`'s 4:2:2 inter piece arm): the left 2x4 half of
33+ each piece's chroma prediction (`is_sub8x8_inter`'s `mi[-1]` step) grabbed
34+ `(_, l_ref_u, _)` from the left piece's reference planes and fed that ONE
35+ plane to both U and V iterations — the V plane's left half predicted from
36+ the reference's U samples (U exact, V wrong, matching the residual's V-only
37+ left-half pattern). Fixed: the loop enumerates U/V and picks the left
38+ piece's matching plane.
39+5. **Both edits are ss (1,0)-only code** — `sub8_leaf_chroma422` is reachable
40+ only from the 4:2:2 sub-8 arms, and the inter piece fix sits inside the
41+ `chroma_422 && (cmi & 1) == 1` arm — 4:2:0/4:4:4 never execute it.
42+
43+## Verification
44+
45+- **t422 16-frame ladder** (decode_probe + all three stage dumps vs the
46+ oracle's, our dumps /tmp/i422/sub8pix16/*):
47+ * **frame 0: EXACT at prefilt, postdeb AND postcdef** (Y, U, V all 0);
48+ * **LUMA: 0 diffs on EVERY frame 1–15 at prefilt, postdeb AND postcdef** —
49+ the mi24 lane's f15 postcdef Y=5059 CDEF knock-on no longer reproduces
50+ (f15 postcdef Y=0; oracle-side f15 postcdef dump absent from the ladder
51+ dir, so f15 postcdef is claimed at prefilt/postdeb only);
52+ * chroma frame 1: U 4175 → 3837, V 4636 → 3879; the named sites are pixel
53+ exact: U rows 4..7 cols 44..47 and V rows 0..3 cols 44..45 verified
54+ sample-exact vs the oracle; chroma improved on both planes at every frame.
55+- **Frame exactness claimed ONLY where measured 0:** frame 0 all stages;
56+ frames 1–15 LUMA at prefilt/postdeb (postcdef too, minus f15 where the
57+ oracle dump is missing). Frames 1+ chroma are NOT claimed.
58+- **The residual, site narrowed (next lane's first diff).** Frame-1 prefilt
59+ chroma now first diffs at U (32,87) / V (32,80) — the 8x8 inter SQUARE
60+ blocks mi(8,40)/(mi(8,42) for U) (PART 16x16→8x8→NONE, one TX_4X8 chroma
61+ unit per plane, flat prediction per the oracle's EC_PREDOUT8): ±1-class
62+ diffs concentrated in each block's rightmost chroma column — the 4:2:2
63+ square-8x8 chroma MC class (`chroma422_square` territory), NOT sub-8.
64+- **4:2:0/4:4:4 identity:** the lossless gates stay green —
65+ `a_lossless_libaom_key_frame_decodes_sample_exact`,
66+ `a_lossless_libaom_inter_frame_decodes_sample_exact`,
67+ `a_real_aomenc_mixed_lossless_segment_frame_decodes_sample_exact`.
68+- `cargo check -p ec-av1` (target dir `~/.cache/cargo-target-av1422sub8pix`):
69+ **0 warnings, 0 errors**.
70+- The `EC_AV1_ALLOW_422_PROBE` bypass was applied to stream.rs for the probe
71+ runs and REVERTED; `git status` names only decode.rs (+ this report).
72+- The intra-leaf evidence used local-only `EC_DBG_RES` write watches in
73+ decode.rs; all three were removed before this commit (no trace remains).
74+
75+## State
76+
77+- Commit on lane-av1-422sub8pix (no push): the two 4:2:2 sub-8 chroma
78+ prediction fixes in `crates/ec-av1/src/decode.rs` + this report.
79+- Next stop named for the owning lane: the 4:2:2 square-8x8 inter chroma
80+ class — first sites frame-1 U (32,87) (block mi(8,42)) and V (32,80) (block
81+ mi(8,40)), ±1 diffs hugging each block's right chroma column with the
82+ oracle's own prediction flat and matched at the EC_PREDOUT8 rung — MC
83+ reference-edge territory for the 4-wide chroma unit, not sub-8.
lanes/av1422sub8rect.report.mdadded+185 -0
@@ -0,0 +1,185 @@
1+# lane-av1-422sub8rect — the sub-8x8 inter 4:2:2 chroma ported to its real
2+# shapes (`decode_inter_block8`'s whole chroma half to the BLOCK_4X8 rect;
3+# `decode_inter_sub8_split4`'s group unit replaced by the per-piece
4+# odd-column chroma-reference model the oracle traces actually code); frame
5+# 0 stays byte-exact at all four stages, the 4:2:0/4:4:4 identity holds by
6+# ss-keying, and the inter-frame divergence is REMEASURED (reduced ~15% on
7+# frames 1..10, exactness NOT claimed -- other 4:2:2 classes remain)
8+
9+## Outcome
10+
11+1. ROOT-CAUSE CONFIRMATION FIRST (pinned fixture `/tmp/t422.obu` sha256
12+ `d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`,
13+ parent-lane instruments in `/tmp/i422/`, local `EC_AV1_ALLOW_422_PROBE`
14+ bypass applied and reverted byte-identical after — `git diff` carries
15+ only decode.rs/mc.rs/encode.rs changes): the oracle's frame-1 first
16+ block (`AOMMB mi=(0,0) ... skip=0`) reads luma TX_8X8 then
17+ `plane=1 tx_size=5 mi_row=0 mi_col=0 rng=55168` — tx_size 5 IS TX_4X8,
18+ confirming the charter: the 8x8 inter leaf's chroma plane block is
19+ BLOCK_4X8, one TX_4X8 rect unit per plane (`ss_size_lookup[BLOCK_8X8][1][0]`),
20+ while ours read a TX_4X4 square.
21+2. SPLIT4 MODEL CORRECTED AGAINST THE ORACLE, NOT THE CHARTER'S GUESS: the
22+ parent report assumed the split4 group codes ONE rect group unit; the
23+ traces prove otherwise. At ss (1,0) `is_chroma_reference` for a BLOCK_4X4
24+ piece is `(mi_col & 0x01)` — ODD columns only (av1_common_int.h:1459) —
25+ and every non-skipped odd-column piece codes its OWN U then V TX_4X4
26+ square unit right after its luma, anchored at the FLOORED chroma cell
27+ (`(mi_col & !1) * MI >> ss_x`, the lane-av1-422kf2 rule) with
28+ `around_mi_422_chroma`-style per-chroma-cell ctx (measured ctx 8 =
29+ above+left+7 at frame 1's mi(12,3)):
30+ - frame 0 key-frame groups (18,54) and (30,42): U+V read on BOTH
31+ odd-column leaves ((18,55)+(19,55), (30,43)+(31,43));
32+ - frame 1 inter group at mi(12,2): U+V on leaf (12,3) ALONE — its
33+ bottom-right twin was skipped, so it codes nothing.
34+ The 4:2:0 shared group unit simply never exists at 4:2:2.
35+3. PORT (all keyed on ss, 4:2:0/4:4:4 byte-identical by construction):
36+ - `decode_inter_block8` chroma half to per-axis shapes: `chroma_w/chroma_h`,
37+ `(TxbSet::ChromaRect8x4, SCAN_4X8)` at 4:2:2; inter coefficient reads
38+ through `read_inter_plane_rect` (offset-7 ctx — the unit IS the plane
39+ block — inherited luma tx type) with `around_mi_422_chroma`; MC
40+ prediction (single-ref, scaled, warp, compound-intermediate), the
41+ wedge-masked blend, interintra blend, OBMC pushes and skip pushes all
42+ (4, 8)-shaped; the intra-in-inter arm reads the key-frame arm's own
43+ rect reader (`read_rect_chroma_unit`, ctx offset None, CfL carried);
44+ palette UV map dims per axis.
45+ - `decode_inter_sub8_split4`: per-piece arm added after each inter
46+ piece's luma (odd column, ss 1,0): prediction as
47+ `build_inter_predictors_sub8x8` — left 2x4 half from the LEFT piece's
48+ own ref/mv/filters, right 2x4 half from this piece's; a mixed group
49+ (left piece intra/off-frame, `is_sub8x8_inter` false) predicts the
50+ whole 4x4 from this piece; skip pieces still predict but record zeros.
51+ Coefficients via square `TxbSet::Chroma4` reads at the floored anchor,
52+ per-unit `record_mi_chroma` (8x4 luma span). Intra pieces gate
53+ `has_chroma` on the piece's own column parity and route through
54+ [`sub8_leaf_chroma422`]; even-column intra pieces publish DC to the
55+ uv-mode map. The 4:2:0 group tail (build, read, band stamps, DC map
56+ stamp) is gated OFF at 4:2:2.
57+ - Shared helpers made ss-exact (4:2:0/4:4:4 reduce to the old behaviour):
58+ `blend_masked_compound`'s `subsampled: bool` → per-axis `(subw, subh)`
59+ mirroring aom_dsp/blend-a64-mask.c's four branches; `interintra_blend`'s
60+ wedge mask read likewise; `obmc_plan`/`obmc_run` take the plane ss —
61+ chroma extents are the luma rules `>> ss` (`av1_skip_u4x4_pred_in_obmc`
62+ keyed on the plane block, above-pass skip and left-pass blend extents),
63+ `TxParams::strided` sized `stride * h` (identical when h == stride, as
64+ every pre-existing caller has). The encoder's `obmc_plan` call passes
65+ the fctx ss.
66+ - STOP-NOTE (owning parent-lane surface, named not fixed):
67+ `decode_inter_block`'s 4:2:2 chroma is still the square-cut model; its
68+ chroma masked-blend keeps the pre-port direct mask read there (guarded
69+ by `ss_x == ss_y`), because its `chroma_side`-square buffers cannot be
70+ indexed by the subsampled-axis walks. Known-divergent, unchanged
71+ behaviour, named for the owning lane.
72+4. MEASURED after the port (17-frame probe run under the reverted bypass;
73+ comparator: ours padded 256x160/128x160 u8 cropped vs the instrumented
74+ `$HOME/.cache/aom-oracle/build` aomdec; NOTE the probe prints REFUSED and
75+ still exits 0 -- the committed tree stops at frame 11 with the
76+ pre-existing "HORZ/VERT strip ... no rect coefficient tables" frontier
77+ refusal, exactly like the reworked tree):
78+ - frame 0: **byte-exact at PREFILT, POSTCDEF (and FINAL by the u16
79+ comparator) on Y, U and V — 0 diffs everywhere**, so the rect read,
80+ the split4 per-piece model and every shared-helper change are exact on
81+ everything frame 0 exercises (including the split groups (18,54),
82+ (30,42) that motivated the per-piece model).
83+ - inter frames 1..10 decode and were measured: PREFILT diffs dropped
84+ ~15% vs the parent lane's ladder (e.g. frame 1: 30825/12624/12796 →
85+ 22248/11733/11974; frame 8: 35014/11020/12043 → 32855/11020/12043;
86+ per-frame values in `/tmp/i422/sub8rect/`). **Frame exactness is NOT
87+ claimed** — frames 1..10 remain divergent: the named sub-8 sites are
88+ fixed, but the stream carries further 4:2:2 classes the decoder still
89+ square-cuts or gaps (probe trace: `EC_RECTCHROMA_GAP luma=16x8
90+ tx=16x8 chroma=8x8`, `luma=8x32 ... chroma=4x32`, i.e. `decode_inter_block`'s
91+ own 4:2:2 chroma half), so the entropy walk desyncs again after the
92+ first uncoded-for block.
93+ - frames 11..16 were not reached by the probe's frame accounting this
94+ round (11 dumped frames, decode exits 0 — the dump-index vs
95+ show-existing accounting needs the parent-lane harness's
96+ 1-frame-per-OBU walk); the ladder for 1..16 is the owning lane's
97+ re-measurement once the next class lands.
98+5. Deferred items: (a) frames 11..16 ladder entries — unblock: rerun the
99+ parent-lane per-OBU cut harness (`/tmp/i422/cut_frames.py`) after the
100+ next class; (b) `decode_inter_sub8_rect2`'s 4:2:2 has_chroma gating (its
101+ inter strips pass `i == 1` where BLOCK_4X8 needs odd-column parity) —
102+ not one of this charter's named sites, unmeasured on the fixture so far.
103+
104+## Decision
105+
106+- The header refusal STAYS unconditional in `stream.rs`; the bypass was
107+ local-only, applied and reverted byte-identical (0 occurrences left;
108+ `stream::tests` green after the revert).
109+- 4:2:0/4:4:4 untouched by construction (ss-keyed arms); the 4:2:0
110+ group-tail SKIP arm untouched; `read_coeffs_rect` untouched.
111+
112+## Review rework (r2, post-review findings 1-3)
113+
114+The review correctly rejected two byte-identity claims and one
115+justification:
116+
117+1. **444 OBMC behaviour now UNCHANGED from the parent.** The first commit
118+ made `obmc_plan`/`obmc_run` ss-exact (`av1_skip_u4x4_pred_in_obmc`
119+ keyed on the plane block; chroma extents `>> ss`), which is what
120+ reconinter.c does -- but it CHANGES 4:4:4 behaviour (the above-pass
121+ chroma skip flips to run on square plane blocks, the blend extents
122+ double) and is NOT byte-identical, with no 444 OBMC gate covering it.
123+ Measured before reworking: fixture `/tmp/obmc444/obmc444.obu` sha256
124+ `4b5c0a473c7ca5bd460e76bb5d7fde541dc996bec45f60bfcc393eb2f11731ef`
125+ (10-frame 128x96 4:4:4 aomenc `--enable-obmc=1 --profile=1`, 2 rect
126+ OBMC leaves firing per the probe census), decoded parent (4e8c6073)
127+ vs tip vs instrumented aomdec: parent and tip read IDENTICAL symbols
128+ and differ in exactly ONE V sample (f1, (82,80)): oracle 110 ==
129+ parent, tip 111. Attribution by single-change revert builds: reverting
130+ `TxParams::strided` alone (varB) reproduces tip exactly; reverting the
131+ OBMC ss semantics alone (varA) reproduces the parent exactly -- so the
132+ whole parent<->tip delta is the OBMC change, and on this fixture the
133+ conformant variant is one sample FARTHER from aomdec, never closer.
134+ Per the review protocol ("if worse, rework") the OBMC ss semantics are
135+ REVERTED to the parent's 4:2:0-shaped corner-cut (luma-keyed
136+ `skip_chroma_above`, half chroma blend extents); the 444-conformant
137+ port stays deferred to the owning 444 lane, which can measure it on
138+ OBMC-heavy 444 content once that lane's reconstruction class is exact
139+ enough to gate on. `encode.rs` carries no change any more (the ss
140+ argument is gone with the parameter).
141+2. **`TxParams::strided` justification corrected.** The commit text
142+ claimed "every pre-existing caller has h == stride" -- wrong:
143+ `read_inter_plane_rect` callers pass rect units with `h < stride`
144+ (e.g. an 8x4 unit in an 8x8-strided plane buffer), and for those the
145+ scratch shrinks from `stride*stride` to `stride*h`. Output identity
146+ holds because the copy loop only ever writes `h` rows of `w <= stride`
147+ and every consumer reads the residual through the same dense bounds --
148+ verified empirically (the 4:2:0 pixel-exact witness, 4:4:4 frame
149+ equality with the parent on the obmc444 fixture, and the varB
150+ revert experiment), not by the removed claim. The `stride * h` sizing
151+ itself STAYS: the 4:2:2 leaf's TX_4X8 unit (stride 4, h 8) panics on
152+ the old square sizing.
153+3. The t422 measurement note above also corrects the probe's exit-status
154+ reading (REFUSED still exits 0; both the committed and reworked trees
155+ stop at frame 11 on the pre-existing strip-chroma frontier refusal).
156+
157+Everything else in Outcome 3 (the leaf8 rect port, the split4 per-piece
158+model, the ss-keyed masked/interintra blends) is untouched by the rework;
159+frame 0 re-verified byte-exact at PREFILT/POSTCDEF after it, and both
160+gates re-run green post-revert.
161+
162+## Verification
163+
164+- `cargo check -p ec-av1` (target `~/.cache/cargo-target-av1422sub8rect`):
165+ 0 warnings, 0 errors.
166+- `stream::tests::a_non_420_subsampled_sequence_header_is_refused_by_name`:
167+ 1 passed — the refusal fires after the bypass revert.
168+- `stream::tests::a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_
169+ whose_tx_split_decodes_pixel_exact` under `EC_AV1_REQUIRE_AOMENC=1`
170+ (oracle aomenc): 1 passed — the 4:2:0 inter path, including the
171+ shared-helper ss-ifications, stays pixel-exact.
172+- Frame-0 stage dumps vs the instrumented aomdec: PREFILT/POSTCDEF
173+ Y=U=V=0 (POSTDEB comparator run this round used the wrong dump-env name;
174+ the post-deblock state is bracketed by the two exact stages).
175+- Hit counter added: `CHROMA422_INTER_SUB8_HITS` (per-piece inter 4:2:2
176+ chroma units) — reads non-zero on the fixture's frames 1+, so the new arm
177+ provably fires.
178+
179+## State
180+
181+- Commit on lane-av1-422sub8rect (no push): the sub-8 rect port +
182+ `TxParams::strided` sizing fix + shared ss-exact helpers + this report.
183+- Probe instruments regenerated under `/tmp/i422/sub8rect/` (scratch, not
184+ committed); the oracle build's rungs already cover everything needed to
185+ re-measure after the next class.
lanes/av1444interband.report.mdadded+132 -0
@@ -0,0 +1,132 @@
1+# lane-av1-444interband: the inter 1:4 strip's 4:4:4 chroma band stamping
2+
3+## Ticket
4+
5+Fix the 4:4:4 lossless 16x4 inter strip band stamping (t6 next-site from
6+av1sub8rect444's measurement: post-fix desync at the 16x4 INTER strip
7+mi(2,8), U unit (2,8) — ours `txb_skip` ctx 3 vs oracle ctx 11 with raw
8+cells `above=[0,] left=[23,]`), or stop with the site narrowed further.
9+Worktree at f41d649b, branch lane-av1-444interband.
10+
11+## Named site, re-measured (the report's attribution needed one correction)
12+
13+Fixture `/tmp/llkf/t6.obu`, sha256
14+`1e6dd4e05038c8d51e2c8d29f8c337130c4fea0aed629415535e6e53af9a2c72`,
15+32487 bytes (scratch, regenerable per av1llkf.report.md's recipe;
16+testsrc2 128x96, 1 key + 5 inter frames, `--profile=1 --lossless=1
17+--enable-palette=0 --enable-intrabc=0`, default partition, sb128).
18+Oracle: the shared patched `$HOME/.cache/aom-oracle/build`, fresh
19+`aomdec --rawvideo` on the same bytes.
20+
21+- Pre-change at f41d649b, our decoder refuses mid-frame-1
22+ (`a Golomb tail longer than this decoder reads`) — fail-before,
23+ measured before the edit on this tree.
24+- The oracle's cell dump (`EC_ECDUMP`) walks `left[2][1]` (U plane, mi
25+ row 2) across frame 1: the last writer before the failing read is the
26+ 16x16-INTRA block (0,4)'s U unit bc=3/br=2 (event #2379), which
27+ stamps cul_level 23 (mag 7, dc set); nothing else touches the cell
28+ until the (2,8) strip's U bc=0 reads it as 23. The skipped inter
29+ strips (0,8)/(1,8) log no coefficients and their
30+ `av1_reset_entropy_context` (decodeframe.c:1180) zero only their OWN
31+ cells — row 2's chroma left cell is not theirs to clear.
32+- Correction to the inherited attribution: our ctx 3 on the failing
33+ read is a `TxbSet::Chroma4` TABLE ROW (base 0 in the +3 offset-10
34+ layout), not a luma `skip_contexts` value — the read is the strip's
35+ U bc=0 (`side=4` = the 4x4 chroma tables), so the report's "U unit
36+ (2,8), ctx 3 vs 11" stands; the detour through "luma bc=3" was a
37+ rung-semantics misread (our `EC_ECDUMP_IN` logs the raw `skip_ctx`
38+ argument, which for chroma callers is the pre-offset base/row).
39+
40+## Root cause
41+
42+`decode_inter_block`'s strip tail ran lane-inter16ab r2's `pair_chroma`
43+rewrite unconditionally. The rewrite stamps the PAIR-form chroma span —
44+16x8 (HORZ) / 8x16 (VERT) at `pair_mi`, planes 1/2 — which is libaom's
45+single `av1_set_entropy_contexts` call for the 4:2:0 pair's 8x4 (4x8)
46+chroma unit. At ss 0/0 there is no pair: `pair_mi` == the strip's own
47+mi, every strip is its own chroma reference, and the strip's own
48+`record_rect_mi` (zero grids on the skip arm) already stamps exactly
49+its own 16x4 (4x16) chroma span — the `av1_set_entropy_contexts` /
50+`av1_reset_entropy_context` behaviour. The rewrite therefore smeared
51+the strip's state one extra row (col) too far: skipped strip (1,8)
52+wrote zero over `left[2][1..2]`, erasing the (0,4) intra block's U/V
53+stamps, and (2,8)'s U walk then read base 0 where aom reads base 1.
54+Counter evidence: `INTER16_CHROMA_PAIR_HITS` fired 31x on this
55+pairless 4:4:4 stream (its documented meaning is "odd strips that
56+close a 4:2:0 chroma pair").
57+
58+## Change (decode.rs, one filter + one trace rung)
59+
60+1. `pair_chroma` now carries `.filter(|_| ss_x(fctx) == 1 &&
61+ ss_y(fctx) == 1)`: the pair-span rewrite exists only at 4:2:0, where
62+ it is byte-preserved (the added condition is false-only-at-ss-0).
63+2. `record_mi_chroma` gained the chroma twin of the existing
64+ `EC_ECPUB` rung: `EC_CHROMA_PUB plane= mi=() wh=() lvl= dc=`,
65+ env-gated eprintln (the instrument that localized this site; kept
66+ for the next band hunt).
67+
68+Sibling ownership clean: the edit is in `decode_inter_block`'s tail
69+(lane-inter16ab's rewrite region), not `sub8_leaf_chroma444` nor
70+`decode_intra_sub8_leaf`.
71+
72+## Verification (measured, this tree @ d5325172)
73+
74+- Entropy/pixel witness, t6.obu vs fresh `aomdec --rawvideo`
75+ ($HOME/.cache/aom-oracle/build): all 6 frames decode (pre-change the
76+ decode refused mid-frame-1) and frames 0..5 are **byte-exact, 0
77+ differing bytes** per frame (36864 B/frame compared). Frame exactness
78+ is claimed on exactly that basis.
79+- Non-vacuity: `inter16_1to4` counters on the full t6 decode:
80+ `horz4=20 vert4=28 chroma_pairs=0` (was `chroma_pairs=31` while the
81+ strips decoded); the strips themselves still decode and the frames
82+ above prove it.
83+- Gates: `cargo test -p ec-av1 --lib a_lossless` → 7 passed, 0 failed
84+ (both 4:2:0 lossless libaom gates, the 444 min-partition-64 and
85+ min-partition-8 inter gates, the sb128 pair, the 16x4 pair). The
86+ 4:2:0 inter 16x4 aomenc sweep
87+ (`a_real_aomenc_inter_sequence_with_intra_16x4_strips_...`) is
88+ yuv420p-only and the change is no-op at 4:2:0 by construction (the
89+ filter's condition is satisfied there); not re-run this round.
90+- `cargo check -p ec-av1 --all-targets` (target dir
91+ `$HOME/.cache/cargo-target-av1444interband`, ec-av1 cleaned first):
92+ 0 warnings, 0 errors. `rustfmt --check` reports no hunks inside the
93+ edited ranges (the crate's pre-existing let-chains drift is
94+ untouched).
95+- Commit d5325172 on lane-av1-444interband. Not pushed.
96+
97+### Addendum (review P2): the t6 pin is now an in-tree gate
98+
99+Main's review follow-up: commit
100+`ll444_defaultp_inter_strip.obu` (force-added fixture, 32487 bytes,
101+sha256 `1e6dd4e05038c8d51e2c8d29f8c337130c4fea0aed629415535e6e53af9a2c72`,
102+FNV1a64 `52789f0fce2d1e52` per the crate's pin convention) and gate
103+`a_lossless_444_defaultp_inter_strip_stream_decodes_byte_exact`
104+(stream.rs, av1llpredgate2's pinned-fixture pattern): len + FNV pin,
105+the 1:4 counter delta pinned to `horz4=20 vert4=28 chroma_pairs=0`,
106+and the env-conditional aomdec arm requiring all 6 frames sample-exact.
107+Mutation-proven load-bearing: with the ss-0 filter reverted the gate
108+fails at the pre-fix refusal; restored, it is green (8 passed in the
109+a_lossless battery).
110+
111+## Named, not chased (spoken)
112+
113+1. `Neighbour::level` clamps `cul_level` to 7 while aom stores up to 15
114+ (`COEFF_CONTEXT_MASK` = 15, dc sign in bit 4). Invisible to every
115+ context derived from the cells (the `txb_skip` categories only
116+ distinguish {0} / {1..3} / {>=4}, and dc sign rides its own field),
117+ so it is representation drift, not a defect — noted so nobody
118+ "fixes" the stored value into a desync.
119+2. Oracle-side f2 cross-reference: lane-av1lrflush's 444sb witness f2
120+ diverges at PREFILT entering at column 128 (inter 64x128 at
121+ (128,0)), plausibly this same skipped-inter-strip class one size up
122+ (their filter-pipeline/LR exoneration is consistent with our
123+ entropy-domain finding). Main owns the 444sb gate extension
124+ (take(2) -> take(3)) once this lands. deferred(that check, unblock:
125+ their f2 witness bytes against this tree).
126+3. Whole-stream read-pairing via `EC_ECDUMP_IN`/`EC_ECDUMP` (dif,rng)
127+ triples is NOT a reliable event alignment across the two
128+ implementations: the internal daala-EC representations legitimately
129+ diverge while decoding identically (frame 0 is pixel-exact yet its
130+ pre-read triples fail 1:1 pairing). The robust comparators are
131+ pixels, refusal points, and ctx/cell values. Recorded so the next
132+ band lane doesn't burn a round on the same lesson.
lanes/av1444sb.report.mdadded+115 -0
@@ -0,0 +1,115 @@
1+# lane-av1-444sb — the 128-rect 4:4:4 chroma-span desync: NAMED and FIXED (r2)
2+
3+## Outcome
4+
5+1. REMEASURED first (pinned fixture
6+ `crates/ec-av1/fixtures/444_sb128rect_lr_witness.obu`, sha256
7+ `27825e14633a4b23e37d48a2acdc7f5d814ca4fadd0b8797d72a1ffb34061e80`,
8+ generated per the report recipe: `ffmpeg -i bands444.y4m -frames:v 3 -vf
9+ scale=192:160 -pix_fmt yuv444p -f yuv4mpegpipe` piped to
10+ `aomenc --codec=av1 --profile=1 --passes=1 --end-usage=q --cq-level=32
11+ --cpu-used=0 --threads=1 --row-mt=0 --sb-size=128 --lag-in-frames=0
12+ --auto-alt-ref=0 --kf-max-dist=1000 --i444 --enable-restoration=1 --obu
13+ --limit=3`): at 76f8c3fe frame 0 diverges at EC_AV1_PREFILT_DUMP with
14+ Y 9700 @ (128,64), U 12272 @ (160,0), V 13175 @ (128,0) — the ticket's
15+ class (first diffs on the 64/128 grid, chroma columns 160/128 matching
16+ the finding). The synthetic-content variants tried first (testsrc2,
17+ testsrc, smptebars, mandelbrot, gradients × cpu-used × cq) all decode
18+ frame 0 exact — the damage needs an edge-forced 128-root rect, which
19+ real content provides.
20+2. DEFECT 1 (this lane's, FIXED) — **`decode_block_128rect`'s chroma unit
21+ walk is hardcoded to the 4:2:0 mu-chunk span**. One 32x32 chroma unit per
22+ 64x64 mu chunk per plane (`cn = 32 / chroma_tx` = 1), chunk offsets
23+ `ch_col * 32` / `ch_row * 32`, and a per-chunk clip step of `ch_col * 8`:
24+ all three are the 4:2:0 numbers. At 4:4:4 a 64x64 luma chunk covers 64
25+ chroma pixels and needs TWO 32x32 units per axis. The units never pushed
26+ (measured by env-gated per-unit exec tracing): (160,0),(160,32) of the
27+ 64x128 PART_VERT block at (128,0), all four units of its second chunk,
28+ (64,128),(96,128) of the bottom-row 128x64 — exactly the PREFILT damage
29+ cells. Because the missing units' coefficients are still in the
30+ bitstream, the entropy decoder desyncs from the first 128-rect intra
31+ block on: SB(0,0) decodes byte-exact and every later superblock of
32+ frames 0/1 carries damage.
33+3. FIX (one site, decode.rs `decode_block_128rect`): per-chunk unit count
34+ `(64 >> ss) / chroma_tx`, chunk chroma offsets `64 >> ss`, clip step
35+ `16 >> ss` — every expression reduces to the old constant at ss=1, so
36+ 4:2:0 is bit-identical by construction; the stale `debug_assert!` (which
37+ stated the 4:2:0 invariant and would fire on 444 in debug builds) now
38+ states the ss-aware one.
39+4. DEFECT 2 (fixed by CHERRY-PICK, not this lane's code) — after DEFECT 1's
40+ fix the review still failed frames 1-2: frame 1 U/V full rows 54 and 118
41+ +-1 — the LR boundary-band signature. `lane-av1-422filter`'s e3798a34
42+ (LR boundary-band snapshot ss_y + CDEF conv422 remap) was NOT in this
43+ branch's ancestry; cherry-picked as 168442bd. Frame 1 went byte-exact.
44+ An r1 experiment had concluded the cherry-pick "changed nothing on 444" —
45+ that conclusion was an artifact of a broken comparison (see 6) and is
46+ retracted.
47+5. DEFECT 3 (NAMED, NOT FIXED — stop-with-site) — frame 2 still diverges at
48+ FINAL: Y 7308 / U 9685 / V 14012 vs aomdec, deterministic. Stage ladder:
49+ PREFILT, POSTDEBLOCK and POSTCDEF are byte-exact vs the oracle; the
50+ damage is introduced by the LOOP RESTORATION stage, and its shape is
51+ **LR stripe 0 (RU row 0, rows 0..63, full width, all three planes) is
52+ never restored** — our final equals the post-CDEF plane above row 63
53+ (our LR-changed rows start at 63; the oracle's start at 0), while stripes
54+ 1-2 are restored (imperfectly vs the oracle only through the reference
55+ shift this induces in rows above? no: rows 64..159 also still differ —
56+ the stripe-0 skip is the dominant, first-introduced defect; stripe
57+ delta details in the r2 measurement notes). Site: the pipelined LR band
58+ accounting — `pipe_run_lr`'s `rrows: Some` branch (restoration.rs)
59+ refills only the RU rows its caller passes, and the band release
60+ (`ls.note(k - 2)` / `ls.close(nb, false)`, decode.rs filter pipeline
61+ ~25000-25032) never flushes RU row 0 on this frame — the frame whose top
62+ superblock row carries a 128-root rect block (f2's inter 64x128 at
63+ (128,0); f0's 128-rects sit on the keyframe path and f1 codes no
64+ 128-root rect, which is why only f2 shows it). Fixing the flush is its
65+ own scoped change; asserting f2's current samples in a gate would pin
66+ the bug.
67+6. MEASUREMENT-METHOD CORRECTION (r1's false "all frames exact"): the r1
68+ final comparisons sliced the raw YUV with a plane-stride instead of a
69+ frame-stride, so every "fN vs aomdec" row actually compared row 0 of
70+ plane N — frame 2 was never truly compared and the 0-diff results were
71+ an illusion. All r2 numbers above come from per-frame strided slices
72+ (92160 bytes/frame), cross-checked against BOTH aomdec and ffmpeg, with
73+ the binary's provenance pinned by a fresh-target-dir sha256 match
74+ (incremental `Finished` in <2s does NOT imply a rebuild; `cargo clean
75+ -p` without error checking can silently no-op — twice caught this wave).
76+
77+## Verification
78+
79+- `cargo check -p ec-av1`: 0 warnings, 0 errors
80+ (target `$HOME/.cache/cargo-target-av1444sb`).
81+- New pinned gate (this commit):
82+ `a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact` —
83+ pins the fixture by length + FNV1a64, proves non-vacuity via the
84+ `decode::intra_sb128_hits` delta, and asserts frames 0/1 byte-exact
85+ against BOTH the oracle aomdec and ffmpeg (frame 2 = DEFECT 3, named in
86+ the test body; pinning its current samples would freeze the bug).
87+- Gates green with fix + cherry-pick (EC_AV1_REQUIRE_AOMENC=1):
88+ `a_real_aomenc_stream_with_restoration_reads_lr_symbols_correctly`,
89+ `a_superres_key_frame_with_cdef_and_loop_restoration_decodes_pixel_exact`,
90+ `a_non_420_subsampled_sequence_header_is_refused_by_name`,
91+ `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_
92+ decodes_pixel_exact` — 4 passed.
93+
94+## Decision
95+
96+- DEFECT 1: one site, fixed. `decode_block_128rect` serves the kf PART128
97+ HORZ/VERT and AB arms plus the intra-in-inter 128 path (`in_inter` flag)
98+ — one walk, all callers covered.
99+- DEFECT 2: fixed upstream-of-merge by cherry-pick (168442bd), kept.
100+- DEFECT 3: STOP-WITH-SITE per charter — the LR stripe-0 flush on inter
101+ frames whose top SB row carries a 128-root rect. Named function/lines
102+ above; the stage-dump evidence (PC exact, FINAL wrong, delta rows 63+)
103+ is in the r2 notes.
104+- NOT touched: `sub8_leaf_chroma444`'s rect arm (sibling lane, distinct
105+ open defect), `decode_leaf8` OOB (leaf8oob's), the 4:2:0 group-tail
106+ chroma SKIP arm (reserved), `read_coeffs_rect`.
107+- Temp EC_TRACE_444SB / EREAD_RECT / TEMP-444SB instrumentation removed
108+ before commit; the commits carry only the fix, the assert, the gate and
109+ the reports.
110+
111+## State
112+
113+- Commits on lane-av1-444sb (no push): 349b3918 (DEFECT 1 fix + fixture +
114+ r1 report), 168442bd (cherry-pick of e3798a34), this commit (DEFECT 3
115+ named, gate added/scoped, r2 report).
lanes/av1444sbf2.report.mdadded+74 -0
@@ -0,0 +1,74 @@
1+# lane-av1-444sbf2 — the 444sb witness f2 after d5325172: NOT exact; residual re-measured sample-identical to DEFECT A; gate NOT extended (r1)
2+
3+## Outcome
4+
5+1. Gate-extension precondition FAILED — frame 2 is not byte-exact, so
6+ `a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact` stays at
7+ `take(2)`. Measured at HEAD 85ce04de (48411287 + the d5325172 cherry-pick)
8+ with the pinned fixture (`crates/ec-av1/fixtures/444_sb128rect_lr_witness.obu`,
9+ sha256 re-verified `27825e14633a4b23e37d48a2acdc7f5d814ca4fadd0b8797d72a1ffb34061e80`),
10+ a FRESH target dir (`cargo-target-av1444sbf2` did not exist before this lane;
11+ probe binary sha256
12+ `9f50af10a11fb77a3461e35427e75e616e29c3ff0403978db4a503e4ccecde3f`), and
13+ per-frame strided slices (92160 bytes/frame, W*H*3, planes Y/U/V at
14+ 0/30720/61440). Frame 2 vs BOTH oracles: **Y 7308 / U 9685 / V 13854**, and
15+ the two oracles agree with each other sample-for-sample on all three frames
16+ (ours is the diverging side; no measurement-method ambiguity this time).
17+ Frames 0/1: byte-exact vs both.
18+2. Stage ladder (instrumented oracle + ours, decode-order `.fN` dumps, 92160-byte
19+ crop-shaped files on both sides, default serial filter path): f0/f1 EXACT at
20+ PREFILT, POSTDEBLOCK, POSTCDEF and FINAL. f2 diverges already at **PREFILT** —
21+ Y 6952 / U 9568 / V 13496, first diffs Y (col 128, row 98), U (col 128,
22+ row 64), V (col 128, row 0) — i.e. in reconstruction, BEFORE any loop filter.
23+ The filters only carry the damage downstream: POSTDEBLOCK 6956/9568/13614,
24+ POSTCDEF 7307/9685/13722, FINAL 7308/9685/13854.
25+3. The residual is UNCHANGED by d5325172. av1lrflush r3 measured the identical
26+ ladder at base 48411287 (without the cherry-pick): PREFILT 6952/9568/13496
27+ with the same three first-diff samples, POSTCDEF 7307/9685/13722 — every rung
28+ I can cross-check matches my with-fix numbers exactly. The inter 1:4 strip
29+ chroma pair-rewrite fix (its t6 class) is inert on this fixture: f2's damage
30+ is a different (or wider) instance of the same inter rect-strip class, not
31+ the one d5325172 fixed. (The old r2 "FINAL V 14012" was r3's identified
32+ one-rung-off comparison artifact, not a fix effect.)
33+4. Site (STOP-WITH-SITE, unchanged from av1lrflush r3's DEFECT A): the inter
34+ rect-strip entropy/recon path on f2's inter 64x128 block at (128,0) — all
35+ three planes' first diffs enter at column 128 inside that block and
36+ everything downstream carries it. There is no entropy desync: both decoders
37+ consume the full stream and complete the frame with bounded diffs, so the
38+ symbol reads are identical and the divergence is in the strip's
39+ reconstruction / band-stamping reads — Agent044's `decode_rect4_16_strip`
40+ territory (their t6-adjacent class). r2's LR-stripe-0 attribution stays
41+ refuted (av1lrflush r3); the gate's scoping comment naming it is now stale
42+ but is deliberately left untouched here: per av1lrflush r3 §6 the comment
43+ fix and the `take(3)` extension land together in the SAME deferred edit
44+ once the entropy fix actually clears f2 — a comment-only commit on another
45+ lane's gate would split that pairing.
46+5. No decoder edit on this lane: 4:2:0 identity untouched by construction; no
47+ cargo check owed.
48+
49+## Verification
50+
51+- `a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact`
52+ (unmodified): PASS at this HEAD — f0/f1 pins intact, non-vacuity
53+ `intra_sb128_hits` delta fires (target `cargo-target-av1444sbf2`).
54+- Ladder + slice numbers above produced from that same fresh target dir; the
55+ throwaway decode example and all `/tmp` dumps were deleted before commit.
56+- Both oracle references regenerated this session (aomdec
57+ `~/.cache/aom-oracle/build` binary, 2026-09-25 17:46; ffmpeg 8.1.2) and
58+ cross-agreed before any diff was trusted.
59+
60+## Decision
61+
62+- Gate NOT extended (assignment branch 2: "do not extend … do not pin wrong
63+ samples"). Asserting f2's current samples would freeze DEFECT A into the
64+ gate.
65+- Next owner: the entropy lane (inter rect-strip band stamping,
66+ `decode_rect4_16_strip`). Re-run THIS measurement (stage ladder + per-frame
67+ strided slices + fresh target dir, both oracles) after that fix lands; extend
68+ `take(2)`→`take(3)` and fix the stale scoping comment in the same edit only
69+ when f2 goes byte-exact.
70+
71+## State
72+
73+- Commit on lane-av1-444sbf2 (no push): this report only; production tree
74+ untouched since 85ce04de.
lanes/av1ecmcb.report.mdadded+62 -0
@@ -0,0 +1,62 @@
1+# lane-av1ecmcb report -- the EC_MCB rung's halved window
2+
3+Branch `lane-av1-ecmcb`, base `fe3e8418`. Single item: close the deferred
4+`EC_MCB`-rung coordinate defect named in `lanes/av1llpred.report.md` ("still
5+windows its own dump with `write_w / 2` -- fix-now(deferred to whoever next
6+touches that rung)").
7+
8+## Verdict: defect REAL, fixed (instrumentation only)
9+
10+`decode.rs::obmc_run`'s rung filtered the `EC_MCB="<plane>:<px>:<py>[:<frame>]"`
11+window and dumped the pre/post-blend chroma rows with `write_w / 2` /
12+`write_h / 2`. `write_w`/`write_h` are the block's LUMA write dims
13+(`decode_inter_block` ~30346: `cpx = px >> ss_x`), so the `/2` is correct only
14+at 4:2:0; at 4:4:4 (`ss 0/0`, decoded by this tree -- refusal inventory names
15+only 4:2:2) the chroma block is full-size and the old rung quartered both its
16+window and its row dumps.
17+
18+Oracle semantics (r13/r14 ground truth): aomdec's private `EC_MCB` printed
19+every `dec_build_inter_predictors` call whose PLANE-pixel span covers the
20+pixel. The saved pairing dumps still pin this:
21+`~/.cache/t900-tmp/aom_mcb41b.txt` prints `bw=16 bh=16` + 16x16 rows for the
22+32x32-luma block at mi(176,192) -- plane pixels -- and `our_mcb41.txt` matched
23+1:1 at 4:2:0. Plane pixels at `ss 0/0` are luma-sized, so the fix is
24+`write_w >> ss_x(fctx)` / `write_h >> ss_y(fctx)` in the window check and both
25+row dumps (bit-identical at 4:2:0: dims are even, `>>1 == /2`).
26+
27+Note: the oracle's private `EC_MCB` patch is no longer in
28+`~/.cache/aom-oracle/src` (t900-era tree reverted to pristine); the saved r13
29+dumps are the surviving oracle ground truth and are what this closure pairs
30+against.
31+
32+## Verification
33+
34+* 4:2:0 pairing unchanged: `EC_MCB=1:353:395:41` on the pinned
35+ `~/.cache/t900-tmp/c900_62.obu` (release `decode_probe`), block
36+ `cpx=352 cpy=384 cw=16 ch=16` -- all 16 prerows byte-equal to the saved
37+ oracle rows AND to the pre-fix `our_mcb41.txt` rows.
38+* 4:4:4 fail-before / pass-after: `aomenc --profile=1 --enable-obmc=1` gate
39+ recipe (obmc gate's exact flags, `gradients` seed 43, 64x64, 25 frames,
40+ `/tmp/ecmcb/s43.obu`, 444). `EC_MCB=1:48:48`: pre-fix binary fires 0 blocks
41+ (48 is outside `cpy..cpy+16` for the `cpx=32 cpy=32` block); post-fix fires
42+ `OUR_MCB pre f=5 cpx=32 cpy=32 cw=32 ch=32` with full 32-wide rows.
43+* Decode behavior unchanged: the diff touches only `env_flag!("EC_MCB")`-gated
44+ lines (the closure is `.then`-gated, so with the env unset nothing new
45+ runs). Gate `a_real_aomenc_stream_with_obmc_decodes_pixel_exact`:
46+ `ok. 1 passed` (pixel-exact vs ffmpeg), genuinely ran (no SKIP).
47+* `cargo check -p ec-av1` (`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1ecmcb`):
48+ 0 warnings.
49+
50+## EVIDENCE
51+
52+EVIDENCE: ~/.cache/t900-tmp/aom_mcb41b.txt + /tmp/ecmcb/our_now_block.txt | EC_MCB=1:353:395:41 both decoders on c900_62.obu, block cpx=352 cpy=384 | 16/16 prerow values equal to the oracle's saved plane-pixel rows (post-fix)
53+EVIDENCE: /tmp/ecmcb/s43.obu + /tmp/ecmcb/post48.txt | aomenc --profile=1 --enable-obmc=1 (obmc-gate recipe, seed 43) + EC_MCB=1:48:48 | pre-fix 0 fires, post-fix `cw=32 ch=32` full-block dump at 4:4:4
54+EVIDENCE: cargo test -p ec-av1 --lib a_real_aomenc_stream_with_obmc_decodes_pixel_exact | ok. 1 passed; 0 failed (decode path untouched)
55+
56+## Disposition
57+
58+fix-now (the deferred item): the rung is ss-aware and pairs at both chroma
59+shapes. No decode-behavior change shipped. The left-pass `OUR_MCB left` tmp
60+dump still prints the BLEND's own `cbw/cbh` (which reflect the blend's
61+per-axis halves) -- that is the rung instrumenting real decode geometry, not a
62+rung-side assumption, and stays as-is.
lanes/av1gwarp12.report.mdadded+94 -0
@@ -0,0 +1,94 @@
1+# lane-av1-gwarp12 — the single-ref GLOBAL-warp witness at 12 bits
2+
3+Base fe3e8418, worktree `edith_codecs-av1gwarp12`, branch `lane-av1-gwarp12`.
4+The charter: close lane-av112bitw's open half — "single-ref GLOBAL-warp at 12
5+bits has no stream of its own" — with a real `aomenc --bit-depth=12` stream
6+whose single-reference inter blocks are predicted through
7+`warp::global_warp_params` under a ROTZOOM model, decoded against BOTH pixel
8+oracles, or an honest miss table.
9+
10+## Result: FOUND, first recipe, pixel-exact against both oracles
11+
12+Encode attempts aimed at the target: **2** (budget 8). Attempt 1 (the gate
13+itself) fired and was already byte-exact vs ffmpeg; attempt 2 re-encoded the
14+same recipe standalone for the aomdec oracle.
15+
16+1. `aomdec == ffmpeg` on the probe stream
17+ (`/tmp/gwarp12probe/probe.obu`, sha256
18+ `3c6102cd0dd9bbccb5d15b2f3605a7dcea9e3189c1efc7d0317b16fc481af5fe`,
19+ 37194 bytes; 16x 128x128 frames, 786432 raw bytes each decoder,
20+ `cmp`-equal payloads). Since the gate proves our decode == ffmpeg on the
21+ live re-encode, all three decoders agree on the firing stream.
22+2. Engagement: `rotzoom_gm_warp_hits = 152` (16x16+ single-ref blocks
23+ predicted through `global_warp_params` with a ROTZOOM model), affine 0
24+ (vanilla aomenc cannot emit it, see below), local-warp symbol 0
25+ (`--enable-warped-motion=0` isolates the global arm),
26+ `compound_warp_hits` delta 0 (hard-asserted; single-ref premise held).
27+
28+## Why the recipe works when the prior ones didn't
29+
30+Every prior 12-bit content fit TRANSLATION global models (excluded by
31+`is_global_mv_block`) or reached >TRANSLATION models only on compound blocks.
32+The lever is composition, not the encoder:
33+
34+- **Content**: rotation + UNIFORM zoom — a similarity transform, exactly the
35+ family the 4-parameter ROTZOOM model expresses (`mandelbrot` +
36+ `rotate=a=0.12*t` + symmetric `scale` over `n`, cropped 128x128).
37+- **Compound tools OFF** (`--enable-masked-comp=0 --enable-interintra-comp=0
38+ --enable-onesided-comp=0`, plus lag 0 / alt-ref 0 so all refs are
39+ forward): a global model can then only ride a single-reference GLOBALMV
40+ block.
41+- **`--enable-warped-motion=0`**: no local WARPED_CAUSAL can take
42+ `warp_params` first; the `warp_params.is_none()` guard at the single-ref
43+ arm makes every hit unambiguously a global-warp hit.
44+- **`--min/--max-partition-size=32`**: every inter leaf is 16x16+, so the
45+ 8x8-leaf arm (`decode_inter_block8`, leaf8 lane's file region) is
46+ structurally out of the stream and my counter proves MY site, not a twin.
47+- **Model bound is encoder-side**: `global_motion_facade.c:24` pins the gm
48+ search to ROTZOOM, so every >TRANSLATION single-ref model a real aomenc
49+ can emit IS ROTZOOM. (AFFINE needs the widened side build and has its own
50+ gate + `affine_gm_hits` at 8/10 bits.)
51+
52+Exact flags: the `encode_12bit` witness base (cq 20, cpu-used 0, sb 64,
53+profile 2, cdef/restoration ON) plus the extras above and
54+`--enable-global-motion=1 --enable-obmc=0 --enable-ref-frame-mvs=0`.
55+Fixture: `y4m_12bit_rotzoom_gm_source` (ffmpeg lavfi, C420p12 y4m, 16
56+frames). The gate re-encodes live; engagement reproduced identically across
57+three runs (152/152/152).
58+
59+## What changed
60+
61+- **decode.rs** — one new counter pair at the single-ref global-warp arm
62+ (`decode_inter_block`, the lane's own site): `ROTZOOM_GM_WARP_HITS` +
63+ `rotzoom_gm_warp_hits()`, bumped when `global_warp_params` resolves AND
64+ `gm_ref.model == Rotzoom`, mirroring the `AFFINE_GM_HITS` twin. The 8x8
65+ leaf arm's copy was deliberately NOT touched (leaf8 lane).
66+- **stream.rs** — `y4m_12bit_rotzoom_gm_source` fixture helper + the gate
67+ `a_real_rotzoom_global_warp_12bit_stream_decodes_pixel_exact`:
68+ `assert_12bit_sequence_header` preflight, hard `delta_rotzoom > 0` (a
69+ warpless stream cannot pass), hard `compound_warp_hits` delta == 0, and
70+ every plane of every frame byte-equal vs ffmpeg
71+ (`ffmpeg_decode_sequence_12bit`).
72+
73+No decoder arithmetic changed: the single-ref path was lifted by
74+lane-av112bitw (parameterised `warp_round_0`) and the composition argument
75+held — the stream proves it instead of arguing it. Non-vacuity is by
76+construction (counter assert), and the gate FAILED-category risk (silent
77+skip) is closed: encode/ffmpeg presence is hard-asserted inside the gate.
78+
79+## Verification
80+
81+- New gate green (encode attempt 1): 16 frames pixel-exact vs ffmpeg,
82+ 152 rotzoom hits.
83+- aomdec oracle probe (encode attempt 2): aomdec == ffmpeg, sha256 above.
84+- Scoped sweep of the 12-bit family the counter addition touches: 9/9 green
85+ (`12bit` filter) including `a_12bit_warped_motion_stream_decodes_pixel_exact`
86+ (engagement still 7/1/0), both compound global-warp 12-bit gates (16x16+
87+ and 8x8 leaf), grain refusal, screen refusal.
88+- `cargo check -p ec-av1 --all-targets`: clean, no warnings.
89+
90+## Create-list audit
91+
92+One new file: this report. Touched: `decode.rs` (counter), `stream.rs`
93+(helper + gate). No fixture committed (gate encodes live), no junk files;
94+probe artifacts under /tmp are throwaway.
lanes/av1ibc444rect.report.mdadded+147 -0
@@ -0,0 +1,147 @@
1+# lane-av1-ibc444rect: intrabc rect-leaf chroma walk at lossless 4:4:4 (r1)
2+
3+## Charter
4+
5+Fix the deferred `av1llsub8` gap: intrabc rect leaves at lossless 444 routed
6+the rect arm's `read_coeffs_rect` path with the wrong unit structure.
7+Unblocked by the green inter side (av1llinter2). Work in
8+`edith_codecs-av1ibc444rect` @ 9e77c16b. 4:2:0 stays identical; existing
9+lossless gates stay green. At most 8 encodes for the fixture.
10+
11+## Defect (both planes of the intrabc route)
12+
13+`decode_leaf_rect8`'s intrabc arm at lossless pushed ONE rect unit:
14+
15+- luma: `read_coeffs_rect(LumaRect8x4Inter, 8x4)` — one TX_8X4-shaped read,
16+- chroma: `sub8_leaf_chroma444`'s non-square arm, one `ChromaRect8x4` read.
17+
18+The oracle codes per-4x4 INTER TX_4X4 units, plane-major: `read_tx_size`'s
19+lossless first line (`decodeframe.c:1203`) forces TX_4X4 before any tree, the
20+frame's `TxMode` is `ONLY_4X4` (spec 6.8.20) so no var-tx tree either, and
21+`av1_read_tx_type`'s `qindex == 0` early return (`decodemv.c:681`) drops the
22+tx_type symbol the LOSSY 4x4 inter sets DO carry. Fail-before, measured: the
23+single-rect read desynced the tile and tripped the lossless WHT assert
24+`(4, 8) != (4, 4)` at `TxParams::run` — the same panic class av1llinter2
25+attributed on the inter side.
26+
27+## Fix (same shape as the non-intrabc arm)
28+
29+1. `decode_leaf_rect8` intrabc arm, `lossless && !skip`: the leaf's luma
30+ coefficients become `(bw/4)*(bh/4)` 4x4 units in the EXISTING per-unit
31+ loop (var-tx `(tw,th)==(4,4)` mechanics: `inter_txbset_for(4)`,
32+ `scan4`, per-unit `around_mi`, `luma_skip_ctx`, DV copy prediction via
33+ the palette slot, `push_intra`). The TXFM band publish moved AFTER the
34+ unit loop (`set_txfm_ctxs` runs at `parse_decode_block`'s tail, so the
35+ units' own `txb_skip_ctx` reads must see the pre-block bands). The units'
36+ `coding.tx_type` is nulled at lossless — WITHOUT this the ladder diverges
37+ immediately (ours +4096 rng on a symbol the oracle never codes; found by
38+ the `EC_TRACE_COEFF` ladder, oracle O#1353 vs ours G#1359-1361 on the
39+ fixture's first leaf).
40+2. The units' residual goes through `TxParams { lossless: lossless(fctx) }`
41+ (read_plane's own route), NOT `dequant_and_inverse_typed_wh` — the latter
42+ has no lossless flag and ran a DCT inverse over the WHT-ordered levels
43+ (±1..30 sample errors on every walked leaf; gone after the fix).
44+3. `sub8_leaf_chroma444`'s intrabc non-square arm, `lossless`: per-4x4
45+ `TxbSet::Chroma4` walk mirroring the lane-av1-llsub8 fix (per-unit
46+ `around_mi_rect`, `Reach::of`, per-unit entropy stamps, `Some(3)` big-row
47+ fold), with the intra predictor swapped for the CURRENT frame at the DV.
48+4. Skip arms untouched. 4:2:0: the luma walk also applies at 420 lossless
49+ (luma is subsampling-independent) — that route was equally broken before
50+ and no committed gate reaches it; every currently-green stream is
51+ bit-identical (all 16 battery gates below).
52+
53+Counters `INTRABC_RECT8_LOSSLESS_LUMA_HITS`/`_CHROMA_HITS` + accessors
54+(`stream::intrabc_rect8_lossless_{luma,chroma}_hits`,
55+`reset_ibc444rect_hits`) pin the walk for the gate.
56+
57+## Fixture (bounded grid: 8 encodes, budget used 8/8)
58+
59+`fixtures/ll444_ibc_rect.obu`, 99614 bytes, sha256
60+`482dedca0201beea9b0a05720b5da7fe93c350c9fea7699cdb010c3fbc227ec0`.
61+Source: `lanes/av1ibc444rect_fixture_gen.py` (sha256
62+`3420a1f80603efc16a66a37be72d04dcd66836df0dc79d28710511c165ef92f1`,
63+y4m sha256 `5d3b8a2cbce29766852806787811f28a0b7b7df75409915666bad087e0cc9768`):
64+320x240 C444, dithered chaotic base + single-half 8x4/4x8 near-match stamps
65+(per-copy bias + random flips — never an exact match). Encoder:
66+`$HOME/.cache/aom-oracle/build/aomenc --codec=av1 --bit-depth=8
67+--input-bit-depth=8 --passes=1 --cpu-used=0 --lag-in-frames=0 --kf-max-dist=1
68+--limit=1 --threads=1 --tile-columns=0 --lossless=1 --sb-size=128
69+--enable-1to4-partitions=1 --profile=1 --i444 --enable-intrabc=1
70+--tune-content=screen --min-partition-size=4 --max-partition-size=8 --obu`.
71+The stream codes hundreds of unskipped intrabc rect leaves (oracle inspect
72+census: 8x4 + 4x8 + 4x4 intrabc, most non-skip).
73+
74+Grid summary (all probed with env-gated shape prints + the counters):
75+testsrc2-based and five crafted variants; every stream that codes intrabc
76+rect leaves ALSO codes an intrabc `BLOCK_8X8` leaf (aomenc's dominant
77+intrabc shape — 284 of them in the E7 census) and/or skipped intrabc leaves.
78+`--max-partition-size` cannot forbid 8x8 `PARTITION_NONE` while keeping
79+8x4/4x8 leaves; content shaping reduced but never eliminated 8x8 intrabc.
80+
81+## Verification (measured)
82+
83+- Entropy: `EC_TRACE_COEFF` ladders aligned ours-vs-instrumented-aomdec
84+ (`~/.cache/aom-oracle/build`, `EC_TRACE_COEFF=1`); post-fix the tile runs
85+ through all walked leaves with no desync (pre-fix: desync at the first
86+ leaf's eob read, then the WHT assert).
87+- Pixel exactness of the walk vs the oracle `aomdec --rawvideo`, measured
88+ with a THROWAWAY two-line patch of the sibling 8x8 defect (16->block-size
89+ chroma prediction buffers in `decode_leaf8`) — applied ONLY to measure,
90+ reverted before commit, never part of this lane's diff:
91+ - E4 fixture: luma 0 differing samples; chroma diffs ONLY on skipped
92+ intrabc cells (36727 bytes, 100% `(intrabc=1, skip=1)` cells + their
93+ poisoned neighbours; zero on walked leaves).
94+ - E8 (= the committed fixture): 339 walked rect leaves; luma 0 differing
95+ samples; chroma 5624 bytes, again exclusively on `(intrabc=1, skip=1)`
96+ cells + neighbours.
97+- Gate `a_lossless_444_intrabc_rect_leaf_walks_per_4x4_units` (green):
98+ pins fixture len/FNV, asserts the walk fires exactly (3, 3) before the
99+ known leaf8 death and that the death signature is the leaf8
100+ `palette_window` slice — i.e. the entropy ladder survived the walked
101+ leaves. Fail-before: pre-fix the death was the `(4, 8) != (4, 4)` WHT
102+ assert. Mutation check: flipping the chroma `Some(3)` ctx to `None`
103+ fails the gate (desync moves the death).
104+- Battery, all green: `a_lossless_libaom_key_frame_decodes_sample_exact`,
105+ `a_lossless_libaom_inter_frame_decodes_sample_exact`,
106+ `a_real_aomenc_lossless_444_key_frame_decodes_sample_exact`,
107+ `a_skipped_lossless_intrabc_rect_strip_zeroes_its_entropy_bands`,
108+ `a_lossless_444_min_partition64_inter_stream_decodes_pixel_exact`, the new
109+ gate, plus the ten lossy intrabc gates (screen-kf intrabc reads, 16x4
110+ pair strip, both-orientation rect intrabc, sb128 screen + rect strip,
111+ tx4 leaf chroma, sub8 census, var-tx census, mixed var-tx tree, tx-select
112+ census). `cargo check -p ec-av1 --all-targets`: 0 warnings, 0 errors.
113+
114+## Not claimed
115+
116+The committed tree does NOT decode either candidate fixture to a full frame:
117+every reaching stream panics at its first intrabc `BLOCK_8X8` leaf on the
118+llintra-deferred defect. Whole-fixture 0-diff is therefore NOT claimed and
119+cannot be measured on this tree; the walk's own samples are measured 0-diff
120+as above.
121+
122+## Blocked-by / deferred (spoken, not hidden)
123+
124+1. `decode_leaf8`'s intrabc chroma prediction buffers, hardcoded 4x4
125+ (16 samples for a 64-sample 4:4:4 reconstruct) — panics at
126+ `palette_window` (decode.rs ~2460). OWNER: the `av1llintra` deferral; this
127+ lane did NOT touch `decode_leaf8` (different function, sibling
128+ ownership). Fix is its own two lines (buffer + predict size follow
129+ `chroma_444`); after it lands, decode completes and this lane's gate
130+ flips to the full-frame exact comparison.
131+2. Skipped-intrabc sub-8x8 chroma predictor: `sub8_leaf_chroma444`'s skip
132+ arm (and the 4:2:0 group-tail skip arm) predict INTRA-DC where libaom
133+ predicts the frame copy at the DV (`av1_build_inter_predictors_sb` runs
134+ regardless of skip for an intrabc block). All remaining E4/E8 chroma
135+ diffs sit exactly on those cells. UNNAMED in any prior report (loss64
136+ fixed the STRIP path only); class-adjacent to the RESERVED 4:2:0
137+ group-tail skip arm, so per the standing reservation this lane stops and
138+ escalates instead of editing. Needs: consult the DV in the skip arms
139+ (armed palette slot), plus a fixture gate.
140+3. `av1llintra2`'s rect64 lossless chroma gap (`EC_RECTCHROMA_GAP`) remains
141+ deferred in its own lane; not touched here.
142+
143+## Function-collision statement
144+
145+This lane's diff lands only in `decode_leaf_rect8` and `sub8_leaf_chroma444`
146+(+ counters in decode.rs, accessors/gate in stream.rs). `decode_leaf8` —
147+where the blocking sibling defect lives — is untouched, byte-for-byte.
lanes/av1ibc444rect_fixture_gen.pyadded+40 -0
@@ -0,0 +1,40 @@
1+import sys, random
2+W, H = 320, 240
3+rng = random.Random(60606)
4+y = bytearray(W*H); u = bytearray(W*H); v = bytearray(W*H)
5+def base(x, y):
6+ return ((x*3 + y*5) ^ (x*11 + y*13)) & 63
7+def wm(wx, wy): # per-window watermark: unique per window
8+ return ((wx*73) ^ (wy*151) ^ ((wx*wy) & 255)) & 63
9+for j in range(H):
10+ for i in range(W):
11+ b = (base(i, j) ^ wm(i >> 3, j >> 3)) + 32
12+ y[j*W+i] = b
13+ u[j*W+i] = 128 + ((base(i+37, j+91) ^ wm((i+37) >> 3, (j+91) >> 3)) & 15) - 7
14+ v[j*W+i] = 128 - ((base(i+13, j+57) ^ wm((i+13) >> 3, (j+57) >> 3)) & 15) - 7
15+patch = [[96 + rng.randrange(64) for _ in range(8)] for _ in range(8)]
16+def put(X, Y, luma, cuv):
17+ y[Y*W+X] = min(255, max(0, luma))
18+ u[Y*W+X] = min(255, max(0, cuv))
19+ v[Y*W+X] = min(255, max(0, 255 - cuv))
20+for by in range(0, H, 8):
21+ for bx in range(0, W, 8):
22+ r = rng.random()
23+ if r < 0.55:
24+ shape = (8, 4, 0 if rng.random() < 0.5 else 4)
25+ elif r < 0.85:
26+ shape = (4, 8, 0)
27+ if bx + 4 >= W: shape = (8, 4, rng.randrange(2)*4)
28+ else:
29+ continue
30+ w, h, oy = shape
31+ bias = rng.randrange(-3, 4)
32+ flips = {(rng.randrange(w), rng.randrange(h)) for _ in range(5)}
33+ for j in range(h):
34+ for i in range(w):
35+ s = patch[(by+oy+j) % 8][(bx+i) % 8]
36+ if (i, j) in flips: s ^= 1
37+ put(bx+i, by+oy+j, s + bias, 100 + (s & 31) + bias)
38+with open(sys.argv[1], 'wb') as f:
39+ f.write(b'YUV4MPEG2 W320 H240 F25:1 Ip A1:1 C444 XYSCSS=444\nFRAME\n')
40+ f.write(bytes(y)); f.write(bytes(u)); f.write(bytes(v))
lanes/av1ibcskip2.report.mdadded+94 -0
@@ -0,0 +1,94 @@
1+# lane-av1-ibcskip2: skipped-intrabc sub8 chroma predicts the DV frame copy (r1)
2+
3+## Charter
4+
5+Close `av1ibc444rect` blocked_by item 2: `sub8_leaf_chroma444`'s skip arm
6+predicted the intra mode (DC for an intrabc leaf) where libaom predicts the
7+frame copy at the DV — `av1_build_inter_predictors_sb` runs for an intrabc
8+block regardless of `skip`; only the residual read is dropped. Work in
9+`edith_codecs-av1ibcskip2` @ b6d4b528 (`f23115aa` + cherry-picked
10+`9dbeafab`, the leaf8 chroma-extent fix that unblocked this fixture). The
11+RESERVED 4:2:0 group-tail chroma SKIP arm is untouched (see collision
12+statement).
13+
14+## Defect (measured on this tree, fail-before)
15+
16+The fixture decodes to completion at this HEAD (the parent lane needed a
17+throwaway leaf8 patch to measure; b6d4b528 landed it). Native reproduction,
18+oracle `aomdec --rawvideo` vs our decode:
19+
20+- luma: 0 differing samples,
21+- U: 2794 differing samples, V: 2830, across 180 distinct 4x4 cells —
22+ 175 of them EXACTLY the frame's skipped intrabc leaves (150 leaves
23+ covering 175 4x4 cells), the other 5 their immediate neighbours
24+ (poisoned edge state),
25+- a throwaway cell trace confirmed every diff cell sits on a
26+ `(intrabc=1, skip=1)` leaf or touches one.
27+
28+Class: `skipped-intrabc-predicts-intra`. The 4:2:0 group-tail twin (flat DC
29+at the tails) is the RESERVED arm — not touched, not fixed here.
30+
31+## Fix
32+
33+New first arm in `sub8_leaf_chroma444` (`if let Some(dv) =
34+intrabc_dv.filter(|_| skip)`): bilinear MC of the CURRENT frame's U/V at the
35+DV (the unskipped arm's own `mv_to_q4` route), armed through
36+`set_palette_pred` and pushed with `ZERO_RESIDUAL` via
37+`push_intra`/`push_intra_rect` — the same armed-palette-slot route the two
38+luma skip arms (`decode_leaf_split4`, `decode_leaf_rect8`) already use; the
39+callers flushed the recon queue before their luma DV copy, so the source
40+samples are current. The inherited chroma `tx_type` slot is disarmed
41+(consumed by nothing — a skipped leaf reads no coefficient), keeping
42+`SKIPPED_INTRABC_CHROMA_ARM_HITS` semantics. Engagement counter
43+`SKIPPED_INTRABC_DV_COPY_HITS` + accessors pin the route for the gate.
44+
45+## Stale gate flip (forced by the cherry-pick)
46+
47+`a_lossless_444_intrabc_rect_leaf_walks_per_4x4_units` was RED at HEAD as
48+committed: it pinned the leaf8 `palette_window` panic ((3, 3) walk hits)
49+which b6d4b528 removed — the walk now fires its full census (339, 339).
50+Flipped per its own r1 doc to the full-frame exact `aomdec` comparison:
51+fixture len/FNV pins kept, (339, 339) census assert, `SKIPPED_INTRABC_
52+DV_COPY_HITS == 150` route assert, `aomdec --rawvideo` 0-diff on all three
53+planes (arm skipped with a notice only when the oracle binary is absent).
54+
55+## Verification (measured)
56+
57+- Mutation check: the arm mutated to count-but-predict-flat (grey 128
58+ prediction, flow intact, counter armed) → gate RED at "aomdec plane U:
59+ 2503 samples differ". The pixel comparison is load-bearing; the ==150
60+ counter assert catches an unreachable arm.
61+- Gate green (post-fix, mutation reverted): "frame sample-exact vs oracle
62+ aomdec; 339+339 rect walks, 150 skipped-intrabc DV copies". Whole-fixture
63+ 0 differing samples on Y, U and V — also re-measured out-of-gate via a
64+ throwaway plane dump + byte diff before the gate existed (0/0/0).
65+- Battery (superset of the parent's 16): every `intrabc`-named gate 17
66+ passed, every `lossless`-named gate 12 passed, every `sb128`-named gate 9
67+ passed (1 ignored diagnostic each where present), including the parent's
68+ full list, the leaf8oob gate from HEAD's cherry-pick, and this flipped
69+ gate. `cargo check -p ec-av1 --all-targets`: 0 warnings, 0 errors.
70+
71+## 4:2:0 / reserved-arm collision statement
72+
73+The diff lands only in `sub8_leaf_chroma444` (444-only: all six call sites
74+sit inside `if chroma_444` blocks; 4:2:0 chroma rides the group tails),
75+the `SKIPPED_INTRABC_DV_COPY_HITS` counter block in decode.rs, and the
76+flipped gate in stream.rs. The 4:2:0 group-tail chroma SKIP arm and the
77+`last_intrabc` tails in `decode_leaf_split4`/`decode_leaf_rect8` — the
78+RESERVED territory — are byte-for-byte untouched, and none of their call
79+sites pass `intrabc_dv = Some`, so 4:2:0 control flow through the edited
80+function is identical; the 420-heavy intrabc/lossless/sb128 battery above
81+confirms bit-identical behaviour.
82+
83+## Not claimed
84+
85+Exactness is claimed for the pinned fixture (whole frame, all planes) and
86+whatever the battery gates already pinned — not a general "every 4:4:4
87+intrabc stream decodes exact" statement. The `444_leaf8_oob.obu`
88+divergence noted in `lanes/av1leaf8oob.report.md` is that lane's deferral,
89+not re-measured here.
90+
91+## Deferred
92+
93+Nothing. The charter's deliverable (skip arm consults the DV, fixture gate,
94+4:2:0 identical, gates green) is complete on this branch.
lanes/av1leaf8oob.report.mdadded+134 -0
@@ -0,0 +1,134 @@
1+# lane-av1leaf8oob: fix the 4:4:4 intrabc 8x8-leaf chroma OOB panic
2+
3+Tree: lane-av1-leaf8oob @ 9e77c16b (base = lane-av1llpredgate2's pin).
4+Reproducer pinned at `crates/ec-av1/fixtures/444_leaf8_oob.obu`.
5+
6+## Defect
7+
8+`cargo run -p ec-av1 --example decode_probe` on the fixture died with
9+
10+```
11+thread 'main' panicked at crates/ec-av1/src/decode.rs:3774:16:
12+index out of bounds: the len is 16 but the index is 16
13+```
14+
15+(`PlaneBuf::reconstruct` via `exec_intra` via `decode_leaf8`, reached through
16+the `#[track_caller]` reconstruct calls at 4:4:4, 8x8 leaf.)
17+
18+Root cause, ONE plane-math site as the ticket guessed: `decode_leaf8`'s
19+intrabc frame-copy closure sized the leaf's chroma prediction buffers with
20+the literal 4:2:0 halving of an 8x8 luma leaf — `vec![0u16; 4 * 4]` and
21+`predict_with_filter(.., 4, 4, ..)` for BOTH U and V — while the leaf's own
22+chroma reconstruct at 4:4:4 runs `csz == 8`. The 16-sample override rode the
23+`PALETTE_PRED` slot into `reconstruct` as an 8x8 prediction, which indexed
24+`prediction[row * 8 + col]` = 16 at row 2, col 0: `len 16, index 16`.
25+
26+## Fix (source, not a clamp)
27+
28+`crates/ec-av1/src/decode.rs`, `decode_leaf8` intrabc closure: the chroma
29+extent is now derived from the frame's subsampling,
30+`(cw, ch) = (8 >> ss_x(fctx), 8 >> ss_y(fctx))` for both the buffer size and
31+the `predict_with_filter` geometry, and the row subpel arg uses `ss_y` like
32+every sibling intrabc site (rect intrabc at 11570/11910/11920, the
33+`luma: bool` helper at 13899; bit-identical at every reachable ss since
34+4:2:2 refuses at the sequence header, so ss_x == ss_y in all decodable
35+streams). 4:2:0 still computes 4x4 — byte-identical there.
36+
37+The one sizing heals all three consumers of the buffers: the TX8 and skip
38+arms consume them whole at `csz`, and the TX4 4:4:4-lossless arm windows
39+them at stride 8 inside `read_intra_chroma_lossless`
40+(`palette_window(buf, stride, ox, oy, 4, 4)` reads up to index 63), which
41+had the same OOB latent.
42+
43+## Class sweep (hardcoded 4:2:0 chroma extent, decode.rs)
44+
45+Swept every intrabc chroma prediction site in decode.rs:
46+
47+| site | extent | verdict |
48+|---|---|---|
49+| `decode_leaf8` intrabc closure (18128/18134 pre-fix) | literal `4*4` | **THE BUG** — fixed |
50+| `decode_block` square intrabc (16735+) | `chroma_side = side >> ss_x` | ss-derived, clean |
51+| rect intrabc owned/rect4 (11557+, 11897+) | `cw * ch`, `cside` | ss-derived, clean |
52+| `predict_intrabc` helper (13899) | `w * h` params, `ss_x`/`ss_y` split | clean |
53+| `sub8_leaf_chroma444` (18927+) | `bw * bh` (already chroma units) | clean by construction |
54+| `decode_leaf_split4` 4x4 arm (19423+) | literal `4*4`/`4,4` | 4:2:0-only arm (chroma_444 returns earlier) — literal correct there |
55+| `decode_leaf_rect8` clamp arm (20106+) | literal `4*4`/`4,4` | same 4:2:0-only arm — literal correct there |
56+
57+No second 4:4:4-reachable instance exists in decode.rs. Signature-class
58+note: lane-lossless128 hit the identical panic text (`len 16, index 16`)
59+from a 128-axis lossless extent — recurring class, both now pinned by
60+gates.
61+
62+## Gate
63+
64+`stream::tests::an_intrabc_8x8_leaf_chroma_frame_copy_at_444_decodes_without_the_oob`
65+(crates/ec-av1/src/stream.rs), modelled on the av1llpredgate2 pattern:
66+
67+- Fixture provenance: the lane ticket's witness-hunt reproducer (s1a/s2e);
68+ 3577 bytes, sha256
69+ `72bed2791d1ceba8be7926a052c7838c5d96d4f9d56d28fb69789a753d3593af`,
70+ FNV-1a64 `0x86b93a51fe16353c`; 320x256, 3 frames, 8-bit 4:4:4
71+ screen-content keyframes (the oracle's MB dump opens on unbroken
72+ inter-classified intra = intrabc blocks). The aomenc recipe is not
73+ independently recoverable in this lane — bytes pinned by length + FNV +
74+ oracle raw fingerprint. Force-added past the `fixtures` gitignore like
75+ every sibling fixture; missing file panics, no skip path.
76+- Assertions: fixture bytes (len + FNV), `decode_stream` succeeds (3
77+ frames, 320x256 — the pre-fix run died here), `leaf8_intrabc_hits`
78+ 0 -> 4 non-vacuity, and the oracle aomdec still decodes the pinned bytes
79+ (raw 737280 bytes, FNV `0x38210bcbf572973c`).
80+
81+### Red-before (mutation verification)
82+
83+`git checkout --` of the fix (patch snapshotted to /tmp, restored
84+byte-identical, `diff`-verified): gate RED at
85+`decode.rs:3774:16 index out of bounds: the len is 16 but the index is 16`
86+— the exact ticketed panic. With the fix: green, standalone AND in the
87+full `intrabc lossless` filter batch (26 passed, 3 consecutive runs).
88+
89+### Why the gate pins NO pixel baseline (measured, then scoped out)
90+
91+Against the oracle aomdec (`--rawvideo`; comparison method ground-truthed:
92+`a_lossless_sb128_rect_intra_block_decodes_sample_exact` and
93+`a_lossless_444_min_partition8_inter_stream_decodes_sample_exact` are green
94+on this same tree), this stream DIVERGES, and not deterministically:
95+
96+- per-frame differing (y, u, v) of 81920 samples/plane:
97+ (20811, 35467, 32320), (20308, 39177, 35994), (20131, 39588, 36601);
98+ frame 0's first differing LUMA sample at (275,128);
99+- under `EC_AV1_PLANE_SENTINEL=1` chroma counts move (u f0 35467 -> 35630)
100+ while luma stays put; sentinel-vs-uninit output diffing localises the
101+ dependence to 458 WHOLE 8x8 chroma blocks (frame 0: chroma x >= 96,
102+ y >= 64) reading samples this decode never wrote — ambient memory, so
103+ any pixel-exact assert drifts run to run (observed: u f1 39177 vs
104+ 39126 vs 39138 across batch runs).
105+
106+Attribution to this lane's diff: none. The fix touches only leaf8's chroma
107+prediction buffers; intra/intrabc luma reads only luma edges and the luma
108+plane, so a luma-first divergence cannot come from it, and the pre-fix run
109+never produced output (panic at the first intrabc 8x8 leaf).
110+
111+Unified reading: ONE pre-existing decode desync on this stream around
112+frame-0 SB (3..4, 2) — after it, samples diverge from the oracle AND the
113+misread layout leaves whole chroma blocks unreconstructed (which is where
114+the never-written reads live). An initial-bounds witness would not have
115+seen this: the stream never decoded before this lane lifted the panic.
116+
117+Disposition: `deferred(unblock: divergence lane — EC trace pairing against
118+the oracle on this fixture; the oracle's AOMMB dump covers only frame 0's
119+first MB rows, so pairing needs the env-gated rungs)`.
120+
121+## Non-regression
122+
123+- `cargo test -p ec-av1 --lib -- intrabc lossless`: 26 passed, 0 failed
124+ (3 consecutive runs, including the 4:2:0 intrabc gates
125+ `an_intrabc_tx4_leaf_chroma_inherits_the_luma_type_and_predicts_from_the_frame_copy`,
126+ the sb128 intrabc pixel-exact gates, and the 4:4:4 lossless
127+ minp64/minp8/sb128 sample-exact gates).
128+- `cargo check -p ec-av1`: 0 warnings.
129+
130+## Hygiene
131+
132+- Target dir `$HOME/.cache/cargo-target-av1leaf8oob` throughout.
133+- Throwaway instruments (`examples/oob_diff.rs`, `examples/oob_dump.rs`)
134+ deleted before commit; no other tree touched; nothing pushed.
lanes/av1ll64.report.mdadded+108 -0
@@ -0,0 +1,108 @@
1+# lane-av1-ll64: the rect64-route 64x32 chroma row — named, not invented (r1)
2+
3+## Ticket
4+
5+Default-partition lossless 4:4:4 stops at a missing 64x32 chroma lossless
6+coefficient row on the rect64 route (the `EC_RECTCHROMA_GAP luma=64x32
7+tx=4x4 chroma=64x32` diagnostic `lane-av1-llinter2` deferred here). Name
8+the row; add it only if libaom has that transform; do not invent one.
9+`decode_rect4_16_strip` is off-limits (owned by the lossless-444 strip
10+lane).
11+
12+## The named row
13+
14+The `chroma` match in `decode_rect_split` (decode.rs:10086) has no
15+`(64, 32)`/`(32, 64)` arm: a 4:4:4 64-axis strip's chroma plane block
16+cannot be coded as ONE rect unit here. That missing arm is the row the
17+gap print names.
18+
19+## libaom verdict (oracle source, measured): no such transform — row NOT added
20+
21+- Lossless: `av1_get_tx_size` returns TX_4X4 for EVERY plane
22+ (`av1/common/blockd.h:1383`), so a 64x32 chroma plane block codes as a
23+ plane-major raster of TX_4X4 units (16x8 = 128 per plane at 4:4:4).
24+ There is no 64x32 lossless transform at all.
25+- Non-lossless: `av1_get_max_uv_txsize` routes chroma through
26+ `av1_get_adjusted_tx_size` (`blockd.h:1361-1367`), which collapses
27+ TX_64X32 and TX_32X64 to TX_32X32. A chroma transform wider/taller
28+ than 32 is never one coded unit.
29+
30+Per ticket step 3: libaom marks the single-unit 64x32 chroma transform
31+not-codeable ⇒ STOP; no row invented.
32+
33+## The route truth: nothing stops at HEAD — the print was a false gap
34+
35+`decode_rect_split`'s arms already cover every shape that reaches it:
36+
37+- LOSSLESS: the 4x4 walk (decode.rs `else if lossless(fctx)`) is
38+ shape-agnostic — for a (64,32) chroma block it walks 128 plane-major
39+ `TxbSet::Chroma4` units with `4 << ss` spans, which IS the libaom
40+ behavior above. The same code the key-frame gate proves on 16x8
41+ strips.
42+- Non-lossless: `chroma_tiled` tiles those four shapes as 32x32 /
43+ 32x16 units (the 10-bit film gates' verified path).
44+
45+The old diagnostic fired whenever `chroma` was None and `!m.skip` —
46+INCLUDING on those two working routes, printing a "GAP" for shapes the
47+function decodes correctly. That false print is what `lane-av1-llinter2`'s
48+report cited as a "named non-panic stop" of default-partition `ll444.obu`.
49+
50+## Change (one diagnostic, no decode-path edit)
51+
52+decode.rs only: the `EC_RECTCHROMA_GAP` print's condition is now the
53+refusal's exact precondition (`chroma.is_none() && !chroma_tiled` inside
54+the existing `!m.skip`, so print↔refusal can never diverge), and its
55+message states the libaom verdict (`libaom_lossless_tx=none`). The
56+inventory-pinned refusal wording is byte-identical; every coefficient
57+read, CDF, span and neighbour stamp untouched. `chroma_tiled`'s `let`
58+moved above its new first use; its explanatory comments stay with it.
59+4:2:0: zero-change (a 64x32 luma strip is 32x16 chroma there — a row
60+that always existed; the print never fired at 4:2:0).
61+
62+## Verification (measured, this tree @ HEAD + this change)
63+
64+- Encoder sweep (aomenc `--lossless=1 --profile=1`, palette/intrabc off,
65+ contents from testsrc2 to forced HORZ-biased noise, `--cpu-used` 0..8,
66+ partition caps, bottom-edge smooth bands): NO lossless fixture presents
67+ a 64x32 intra strip — at lossless RD the encoder picks NONE/SPLIT, so
68+ the print never fired on any stream, old or new.
69+- Probes post-change (decode_probe): `ll444.obu` (default partition, 6
70+ frames) OK 6/6; `force_kf.obu`, `h2.obu` OK; committed
71+ `lossless_sb128_rect_kf.obu` OK 4/4; pinned `ll444_minp64_inter.obu`
72+ OK 6/6; `EC_RECTCHROMA` count 0 on every stream.
73+- Gates (7 passed, 0 failed): `a_lossless_444_min_partition64_inter_
74+ stream_decodes_pixel_exact` (6-frame inter gate: pixel-exact through
75+ BOTH oracle aomdec --rawvideo and ffmpeg, counter non-vacuity),
76+ `a_real_aomenc_lossless_444_key_frame_decodes_sample_exact` (run for
77+ real, not SKIP: pinned bytes `fixtures/ll444-lossless-key.obu` copied
78+ from the av1llband2 worktree, sha256 `9fc9ce1f5f6475a1d483f404b44acb9
79+ 0f72a80be2e5c51dedf0aeb1da9a3f5dc`; fixtures/ is gitignored, nothing
80+ committed from it), both 4:2:0 lossless gates
81+ (`a_lossless_libaom_key_frame_decodes_sample_exact`,
82+ `a_lossless_libaom_inter_frame_decodes_sample_exact`), both
83+ `a_lossless_sb128_*` gates, `a_lossless_16x4_chroma_pair_*`.
84+- `cargo check -p ec-av1 --all-targets` (target dir
85+ `$HOME/.cache/cargo-target-av1ll64`): 0 warnings, 0 errors.
86+
87+## Same-class suspects, measured on scratch streams, deferred (spoken)
88+
89+Repro recipe (scratch, regenerable): `testsrc2 128x96 yuv444p`, aomenc
90+`--profile=1 --lossless=1 --enable-palette=0 --enable-intrabc=0`,
91+`--max-partition-size=64`, 6 frames. Both defects verified PRE-EXISTING
92+at 2ac149e3 via `git stash` probe, so neither is caused by this change;
93+both are the inter sub8 lossless class (a lossless inter route coding a
94+rect TX unit where `av1_get_tx_size` forces TX_4X4 per plane — the
95+`decode_inter_block8`/84acbd09 defect class one route over):
96+
97+- `decode_inter_sub8_rect2` → `read_inter_plane_rect` →
98+ `push_mc_rect_tx` → `TxParams::run` lossless WHT assert
99+ `(8, 4) != (4, 4)` at decode.rs:2566. deferred(fix-now in the lane
100+ owning the inter sub8 lossless rect route; the fix shape is the
101+ established per-plane TX_4X4 unit walk).
102+- The 12-frame sibling stream refuses mid-tile: `REFUSED: unsupported:
103+ AV1 tile (a Golomb tail longer than this decoder reads)` — same
104+ route class, downstream desync form. deferred(with the same lane;
105+ likely disappears when the (8,4) read is fixed).
106+
107+`decode_rect4_16_strip`'s 4:2:0-hardcoded lossless chroma walk remains
108+with its owning lane (untouched here, per lane ownership).
lanes/av1llband2.report.mdadded+90 -0
@@ -0,0 +1,90 @@
1+# lane-av1-llband2: 4:4:4 lossless above-band cell — sibling fix ported (r1)
2+
3+## Charter
4+
5+Resolve the `av1llsub8` stop (aligned step 19228: 16x8 leaf, U unit bc=2
6+br=0, `txb_skip` base 1 vs oracle base 0 — an above-band cell). Port the
7+already-reviewed sibling fix if it is the same writer; never author a
8+second fix for the same defect. 4:2:0 lossless stays exact. Work in
9+`edith_codecs-av1llband2` @ 6cf92769.
10+
11+## Writer identification (done before any edit)
12+
13+Read `edith_codecs-av1llband` r1 (`lanes/av1llband.report.md`) and commit
14+`01a34bc8` before writing anything. That sibling took the exact same stop
15+(178-byte key-frame miss, first divergence at the 16x8 leaf mi (16,24)'s
16+U bc=2 unit) to **0 differing bytes**, and was reviewed.
17+
18+Same-writer proof:
19+
20+- This branch HEAD is the sibling's parent commit `6cf92769` byte-for-byte
21+ (both continue `av1llsub8`).
22+- The defect site in THIS tree is the identical code the sibling named:
23+ `decode_rect_split`'s lossless chroma arm hardcoding the 4:2:0 unit span
24+ — `let luma_span = 8;` at `decode.rs:10458` here, feeding the `cu_mi`
25+ step, `around_mi`, `tu_reach` and both `record_mi_chroma` stamps.
26+- The stop signature matches the sibling's reproduced defect exactly
27+ (step 19228, 16x8 leaf, U bc=2 br=0, base 1 / row `[0][11]` vs oracle
28+ base 0 / row `[0][10]`).
29+
30+⇒ `01a34bc8` IS that writer's fix. Ported it; no second fix invented.
31+
32+## Port (faithful, byte-identical)
33+
34+`git cherry-pick -n 01a34bc8`, dropping the sibling's lane report file
35+(`lanes/av1llband.report.md` — this lane writes its own). Post-images of
36+all three source files `cmp`-verified IDENTICAL against the sibling
37+worktree at `01a34bc8`:
38+
39+- `crates/ec-av1/src/decode.rs` (+45/−10): `span_x = 4 << ss_x(fctx)`,
40+ `span_y = 4 << ss_y(fctx)` replaces the hardcoded 8 for the `cu_mi`
41+ step, `around_mi_rect`, `tu_reach`, the immediate and replayed
42+ `record_mi_chroma` stamps (`ll_chroma_units` carries per-unit spans);
43+ non-vacuity counter `RECT_SPLIT_LOSSLESS_CHROMA444_HITS` +
44+ `rect_split_lossless_chroma444_hits()`.
45+- `crates/ec-av1/src/stream.rs` (+77): gate
46+ `a_real_aomenc_lossless_444_key_frame_decodes_sample_exact` over the
47+ pinned fixture, with the lossless-frame blindness guard and the
48+ counter-moved non-vacuity assert.
49+- `crates/ec-av1/examples/decode_probe.rs` (+4): `llband:` counter line.
50+
51+Off-limits files untouched: `decode_rect4_16_strip`,
52+`read_inter_rect_chroma`, `restoration.rs`, intra write-back. No 422
53+model, no luma path, no `sub8_leaf_chroma444` (innocent: the 16x8 leaf
54+never reaches it). 4:2:0 arithmetic is unchanged (`4 << 1 = 8`).
55+
56+Fixture provenance: `fixtures/ll444-lossless-key.obu` (untracked, as in
57+the sibling), copied from the sibling worktree, sha256
58+`9fc9ce1f5f6475a1d483f404b44acb90f72a80be2e5c51dedf0aeb1da9a3f5dc`
59+(4927 B; cut of the `ll444` recipe's key-frame OBUs: `testsrc2 128x96`
60+yuv444p, `aomenc --profile=1 --lossless=1 --enable-palette=0
61+--enable-intrabc=0`, oracle build `~/.cache/aom-oracle`).
62+
63+## Verification (measured, this tree)
64+
65+- New gate `a_real_aomenc_lossless_444_key_frame_decodes_sample_exact`:
66+ **green** — key frame decodes **0 differing bytes** (sample-exact,
67+ all 3 planes vs ffmpeg `yuv444p` rawvideo, 36864 samples compared) and
68+ the counter moved (non-vacuity).
69+- `decode_probe` on the pinned fixture: `llband:
70+ rect_split_lossless_chroma444=160` (matches the sibling's 160 units),
71+ no panic.
72+- 4:2:0 lossless stays green:
73+ `a_lossless_libaom_key_frame_decodes_sample_exact`,
74+ `a_lossless_libaom_inter_frame_decodes_sample_exact` — both ok
75+ (3 passed, 0 failed in the gate run).
76+- `cargo check -p ec-av1 --all-targets`: 0 warnings, 0 errors.
77+
78+## Deferred (spoken, not hidden)
79+
80+- **1:4 strips at lossless 4:4:4** (`decode_rect4_16_strip`): same span
81+ defect class (per the sibling's r1), but the file is owned by a live
82+ lane and off-limits to this branch — the fix is the same span
83+ derivation measured here. deferred(fix-now in the owning lane).
84+- Lossless INTER frames panic at `reconstruct_mc_rect` (decode.rs:2589):
85+ `read_inter_rect_chroma`'s branch, untouched, as chartered.
86+ deferred(fix-now in the owning lane).
87+- Intrabc rect leaves at lossless 444 still route the rect arm's
88+ `read_coeffs_rect` path: unreachable with `--enable-intrabc=0`
89+ fixtures. deferred(fix-now after the inter side is green, with an
90+ intrabc 4:4:4 fixture), matching `av1llsub8`/`av1llband`.
lanes/av1llinter2.report.mdadded+101 -0
@@ -0,0 +1,101 @@
1+# lane-av1-llinter2: 4:4:4 lossless inter side — sibling panic ported (r1)
2+
3+## Charter
4+
5+The lossless INTER panic named by `av1llband2` (`reconstruct_mc_rect`,
6+decode.rs:2589, `read_inter_rect_chroma`'s branch) is the same panic
7+sibling lane `av1llinter` fixed in 84acbd09 + 13a262a6. Port that fix;
8+never author a second fix for the same defect. 4:2:0 lossless stays
9+identical; the key-frame gate stays green. Work in
10+`edith_codecs-av1llinter2` @ 6da581a8.
11+
12+## Same-panic proof (measured, before any edit)
13+
14+Repro on the sibling's pinned bytes `dodge2.obu` (37658 B, sha256
15+`5a070fa351a3f2109de855234f2b3d0a872970f3e7f658db21f65c12eeb135b4` —
16+byte-identical to the sibling's committed
17+`crates/ec-av1/fixtures/ll444_minp64_inter.obu`):
18+
19+- RELEASE build: `panicked at crates/ec-av1/src/decode.rs:28454:32:
20+ range end index 24 out of range for slice of length 16` in `exec_mc` —
21+ line 28454 is `reconstruct_mc_rect`'s coded-arm `dst..dst + w` index
22+ (fn at 28413), inlined into `exec_mc`. The sibling's parent-tree panic
23+ was the identical message and numbers at their decode.rs:28336, same
24+ fn, same inline frame.
25+- DEBUG build: the underlying unit defect surfaces first — the lossless
26+ WHT assert `(8, 8) != (4, 4)` at `TxParams::run` (decode.rs:2566), via
27+ `decode_inter_block8 -> read_inter_plane -> push_mc_rect_tx` — the
28+ sibling report's exact chain. The band2 report's "decode.rs:2589"
29+ citation is this same worker (`strided[row * self.stride..][..self.w]`,
30+ the release-form panic of the same 8-wide lossless unit); the
31+ "reconstruct_mc_rect" name is the release-build site proven above.
32+
33+⇒ same defect, same root cause the sibling named: the 8x8 inter leaf's
34+chroma plane block read as ONE TX_8X8 unit where lossless codes TX_4X4
35+on every plane (`av1_get_tx_size`). 84acbd09 IS the writer's fix.
36+Ported it; no second fix invented.
37+
38+## Port (faithful cherry-pick of 84acbd09, three deliberate deltas)
39+
40+`git cherry-pick -n 84acbd09`:
41+
42+1. `decode_rect_split` conflicts (fix 4) resolved to THIS tree's version:
43+ lane-av1-llband2 already ported that exact fix (01a34bc8) with the
44+ `RECT_SPLIT_LOSSLESS_CHROMA444_HITS` non-vacuity counter; semantics
45+ identical (`4 << ss` spans, span-carrying `ll_chroma_units`).
46+2. **fix 5 EXCLUDED**: its three hunks are inside
47+ `decode_rect4_16_strip` (the `cu_mi` divisor and both
48+ `record_mi_chroma` spans), a function owned by a live lane — reverted
49+ to HEAD byte-for-byte. The strip fn still carries the 4:2:0-hardcoded
50+ walk at 4:4:4 lossless: deferred(fix-now in the owning lane, same
51+ span derivation as fixes 2-4).
52+3. The sibling's lane report file dropped; this lane writes its own.
53+
54+Applied verbatim: fix 1 (`decode_inter_block8`'s single-ref AND compound
55+chroma arms route `chroma_side == 8 && lossless && !mono` through the
56+new `leaf8_inter_chroma_lossless` helper wrapping the per-unit
57+`read_inter_chroma_lossless` walk, with the tail `record_mi`'s chroma
58+half saved/restored — `saved_chroma_ctx`, the `saved_luma_ctx` pattern;
59+both `record_mi` tails patched), fix 2 (`read_inter_chroma_lossless`:
60+`cu_mi` divisor `4 >> ss`, record spans `4 << ss`), fix 3
61+(`decode_inter_block`'s `mu_chroma_units` lossless replay: extents
62+`>> ss`, mi-steps and spans `cu << ss`). All byte-identical at 4:2:0
63+(`4 << 1 = 8`). Off-limits files untouched: `decode_rect4_16_strip`,
64+`restoration.rs`, intra write-back. Net diff vs HEAD: 9 hunks, earliest
65+at decode.rs:28734 — nothing before `read_inter_chroma_lossless`.
66+
67+Gate port: `git cherry-pick -n 13a262a6` (fixture
68+`fixtures/ll444_minp64_inter.obu` 37658 B, the `ffmpeg_decode_sequence_444`
69+helper, gate `a_lossless_444_min_partition64_inter_stream_decodes_pixel_exact`
70+with the `chroma_split_tx_hits` non-vacuity assert and FNV/len pins).
71+stream.rs conflict = both lanes appended tests at the same spot; resolved
72+by keeping BOTH (band2's key-frame gate first, then the helper + inter
73+gate).
74+
75+## Verification (measured, this tree @ HEAD+2)
76+
77+- `a_lossless_444_min_partition64_inter_stream_decodes_pixel_exact`:
78+ **PASS** — all 6 dodge2 frames pixel-exact through BOTH the oracle
79+ `aomdec --rawvideo` (oracle at `~/.cache/aom-oracle/build`, arm
80+ executed, not skipped) and ffmpeg `yuv444p`; counter moved (non-vacuity).
81+- Key-frame gate stays green: `a_real_aomenc_lossless_444_key_frame_
82+ decodes_sample_exact` PASS.
83+- 4:2:0 unchanged: `a_lossless_libaom_key_frame_decodes_sample_exact`,
84+ `a_lossless_libaom_inter_frame_decodes_sample_exact` — both PASS
85+ (4 passed, 0 failed in the battery run).
86+- `decode_probe dodge2.obu`: `OK: 6 frames decoded`, no panic, debug AND
87+ release.
88+- `cargo check -p ec-av1 --all-targets`: 0 warnings, 0 errors.
89+
90+## Same-class suspects, deferred (spoken, not hidden)
91+
92+- `decode_rect4_16_strip`'s lossless chroma walk still hardcodes the
93+ 4:2:0 span (`oy / 2`, `record_mi_chroma(.., 8, 8, ..)` at decode.rs
94+ ~14631/14653/14675): excluded per lane ownership.
95+ deferred(fix-now in the owning lane; shape = fixes 2-4's `4 << ss`).
96+- Default-partition `ll444.obu` no longer panics but stops at a NAMED
97+ non-panic gap: `EC_RECTCHROMA_GAP luma=64x32 tx=4x4 chroma=64x32`
98+ (decode.rs:10126 — the `(64, 32)` chroma plane block has no TxbSet row
99+ at the rect64 lossless route). The sibling's gate deliberately does not
100+ claim this stream either. deferred(fix-now in a lane chartering the
101+ rect64 chroma lossless route; distinct defect, not this panic).
lanes/av1llintercdf.report.mdadded+100 -0
@@ -0,0 +1,100 @@
1+# lane-av1llintercdf: the t6 frame-1 INTER all_zero divergence named (and the one-site fix)
2+
3+## Ticket
4+
5+Deferred item 1 of `lanes/av1llkf.report.md`: the 6-frame default-partition
6+lossless 4:4:4 testsrc2 stream (t6) reads frame 0 fully exact, then diverges at
7+frame 1 (INTER), luma `all_zero` read #2317 — "same ctx row (1) and same decoded
8+value as the oracle but different CDF contents (ours `cdf0=5892` vs aom
9+`27244`)", suspected adaptation-history/row-selection desync. Name the divergent
10+symbol and its reader, decide missed-update vs applied-twice, fix only if one
11+site.
12+
13+## The llkf reading is refuted — the CDF rows were EQUAL
14+
15+Both trace printers were misread as the same quantity:
16+
17+- ours (`decode.rs:6811-6823`): `cdf=[a, 32768, n]` is the row snapshot taken
18+ BEFORE `dec.symbol` — the PRE-update row, in OUR storage, where
19+ `ours_v = 32768 - aom_v` (complement).
20+- oracle (`decodetxb.c:161`): `cdf0=` is printed AFTER `aom_read_symbol` — the
21+ POST-update value in aom storage.
22+
23+Replaying frame 0 read-by-read (rate-4 adaptation, val=0 up / val=1 down in our
24+convention) matches every printed pair: at the divergent read aom's pre-state
25+was `26876` (aom storage) = `5892` (ours) — the rows were IDENTICAL, and both
26+sides adapted that read symmetrically. So the answer to "missed update or
27+applied twice" is **neither**: there was no adaptation desync at all; the rng
28+mismatch at read #2316 (0-indexed; the report's #2317) came from symbols read
29+EARLIER in the same block's mode info, which the all_zero-only ladder cannot
30+see.
31+
32+## The divergent symbol and reader (measured, t6, EC_ECDUMP_IN + EC_TRACE_COEFF
33++ EC_TRACE_MODE_STEP on both sides)
34+
35+Between the last coefficient read of frame 1's first superblock row and read
36+#2316, both sides decode the INTRA 8x4 leaf at mi=(0,2) — an intra leaf inside
37+an INTER frame, through `read_intra_block_mode_info` (decodemv.c:1065). The
38+states part inside its `uv_mode` read:
39+
40+- ours pre-`use_filter_intra` rng 60904, oracle 58668; ours consumed 100 bits
41+ across the block's mode info, the oracle 98 (+2).
42+- ours read `uv_mode` off the **14-symbol `uv_mode_cfl`** row
43+ (`decode.rs:35703`, then unconditional); the oracle reads it off the
44+ **13-symbol `uv_mode_no_cfl`** row, because `av1_is_cfl_allowed` (blockd.h)
45+ returns 0 for a lossless block whose chroma plane block is not a single
46+ TX_4X4 — an 8x4 leaf at 4:4:4 has an 8x4 chroma plane block.
47+
48+Reader: `decode_intra_sub8_leaf`'s uv read (`decode.rs:35703`), the one
49+`uv_mode` site that bypassed the canonical `cfl_allowed_px` predicate every
50+other uv read site uses (`decode.rs:9791, 11206, 15610, 18853, 34062, 38675`).
51+The block comment there stated only the non-lossless term.
52+
53+The neighbouring 4x4 leaf (mi=(0,1)) kept matching by construction: at 4:4:4
54+lossless a 4x4 leaf's chroma block IS a single TX_4X4, so CFL stays allowed and
55+the 14-symbol row is correct there — which is why frame 1 synced for 2316 reads
56+and 5 blocks before diverging on the first 8x4.
57+
58+## Change (decode.rs, one site)
59+
60+`decode_intra_sub8_leaf`'s uv read now goes through
61+`cfl_allowed_px(bw, bh, fctx)` — the canonical predicate, which already
62+implements the lossless term (chroma plane block must be a single TX_4X4).
63+4:2:0 is arithmetically identical: every sub-8 shape's chroma block is
64+4x4-or-smaller under 4:2:0, so the predicate stays true and the row choice is
65+unchanged; the 4:2:0 lossless gates (below) are green.
66+
67+## Verification (measured, this tree @ HEAD + this change)
68+
69+- Entropy: pairs #2316 and #2317 (the whole 8x4 leaf's luma) now match the
70+ oracle's (value, rng) exactly, and the ECIN bits delta returns to the
71+ constant +15 header offset through the block.
72+- Byte witness: t6 frame 0 is byte-exact vs fresh `aomdec --rawvideo` (36864
73+ bytes; sha256 of the full 6-frame decode differs — see the deferred item).
74+- Gates: `cargo test -p ec-av1 --lib a_lossless` → 7 passed, 0 failed (both
75+ 4:2:0 lossless libaom gates, the 444 min-partition-64 inter gate, the sb128
76+ pair, the 16x4 pair).
77+- `cargo check -p ec-av1 --all-targets` (target dir
78+ `$HOME/.cache/cargo-target-av1llintercdf`): 0 warnings, 0 errors.
79+
80+## Named, not chased (spoken)
81+
82+1. t6 frames 1..5 still differ (first diff frame-1 byte 65): a SECOND site in
83+ the same leaf, independent of the alphabet fix. At the still-shared state
84+ rng=51429 after the 8x4 leaf's luma, the oracle reads the leaf's chroma as
85+ FOUR TX_4X4 units (plane 1 bc=0,1 ctx=11 then plane 2 bc=0,1 — lossless
86+ forces per-unit TX_4X4), while `decode_intra_sub8_leaf`'s
87+ `chroma_444 && bw != bh` arm (`decode.rs:36104-36139`) reads the chroma
88+ plane as ONE `TX_8X4`/`TX_4X8` rect unit per plane (`read_coeffs_rect`,
89+ skip ctx fixed at above+left=1 where the oracle derives 11≡4). The fix is
90+ the b3f815c8-style per-unit lossless 444 chroma walk (unit decomposition +
91+ per-unit `get_txb_ctx` + dropped tx_type), i.e. a shape port of its own —
92+ not a one-site fix, so per the ticket it is stopped-with-site, deferred(
93+ the sub-8 4:4:4 lossless chroma walk; unblock: port the
94+ `decode_leaf_rect8`/8x8-leaf per-unit walk into the `chroma_444 && bw != bh`
95+ arm).
96+2. Instrument gap, no decode impact: the rect coefficient reader
97+ (`read_coeffs_rect`, `decode.rs:7056`) prints `EC_COEFF_STEP` with a
98+ hardcoded `plane=0` and no `EC_ECDUMP_IN` line, so rect-path reads are
99+ invisible to the (value, rng, bitpos) pairing used here. Worth one rung of
100+ parity next time that path is debugged.
lanes/av1llintra.report.mdadded+93 -0
@@ -0,0 +1,93 @@
1+# lane-av1-llintra: 4:4:4 lossless intra side (class 444-lossless-intra-side)
2+
3+## Charter
4+
5+Fix the 4:4:4 lossless intra-side panic (decode.rs:3766, `index 16 len 16`, via
6+`decode_leaf8 -> read_plane -> exec_intra`) and the same-class 64x64 lossless
7+intra luma mis-decode, or stop at the first site that cannot be finished.
8+
9+## Repro (fail-before)
10+
11+`aomenc profile 1 --lossless=1`, testsrc2 128x96 yuv444p, 6 frames, palette and
12+intrabc off, cdef/restoration off (`ll444.obu` = default partitions,
13+`dodge2.obu` = `--sb-size=64 --max/min-partition-size=64`):
14+
15+- `ll444.obu`: PANIC decode.rs:3766 (`reconstruct`, index 16 len 16) on the KEY
16+ frame, `decode_leaf8 -> read_plane -> exec_intra` (measured, RUST_BACKTRACE).
17+- `dodge2.obu`: key frame decoded but luma pixel-diffed the oracle from byte 65
18+ (31729 of 36864).
19+
20+## Root causes and fixes (all in decode.rs)
21+
22+1. **Leaf8 chroma is one TX_8X8 unit at 4:4:4 lossless** (the panic). Oracle
23+ `av1_get_tx_size`: `if (xd->lossless[..]) return TX_4X4;` for EVERY plane, so
24+ the leaf's 8x8 chroma plane block is a plane-major 2x2 raster of TX_4X4
25+ units. Our `TxbSet::Chroma8` single unit hit `TxParams::run`'s lossless WHT,
26+ which is 4x4-only (`debug_assert_eq!((w, h), (4, 4))`), silently producing a
27+ 16-coeff residual for a side-8 reconstruct. Fixed: in `decode_leaf8`'s TX4
28+ arm, `chroma_444 && lossless` routes through `read_intra_chroma_lossless`
29+ (per-unit reads + per-unit `record_mi_chroma`); the tail's whole-leaf chroma
30+ band stamp is skipped for that shape (raster-order last writer per band cell
31+ is exactly libaom's per-entry last update). In the skip arm, the 4:4:4
32+ lossless leaf predicts four TX_4X4 chroma units (per-unit edges), like the
33+ luma `SKIP_SPLIT_TX` loop; intrabc/palette keep the whole-plane-block
34+ prediction.
35+2. **`read_intra_chroma_lossless` carried 4:2:0 math**: `cu_mi = at_mi + oy/2`,
36+ `tu_reach(.., ox * 2, oy * 2, 8, ..)`, `record_mi_chroma(.., 8, 8, ..)`.
37+ Made subsampling-aware (`MI >> ss` divisors, `<< ss` scaling, `4 << ss`
38+ spans) -- byte-identical at 4:2:0, correct at 4:4:4 (one mi cell per unit).
39+3. **Whole-block chroma unit clip was a 4:2:0-sized raster** (`plane_px =
40+ span_mi * 2`, overhang `2 * over_mi`): at 4:4:4 it clipped three quarters of
41+ each 64x64 block's coded units and desynced the tile -- this was the dodge2
42+ key frame's luma diff from byte 65 (the desynced chroma garbage-fed the
43+ following superblocks' luma). Fixed to `span_mi * MI >> ss` and `over_mi *
44+ (MI >> ss)`, libaom `max_block_wide/high`.
45+4. **Lossless CFL alphabet gate**: oracle `is_cfl_allowed` at lossless requires
46+ `plane_bsize == BLOCK_4X4` (TRUE for an 8x8 partition at 4:2:0, FALSE at
47+ 4:4:4). Our `cfl_allowed_px` lossless arm accepted any <=8x8, so a 4:4:4
48+ lossless leaf read the 14-symbol `uv_mode_cfl` CDF where the stream carries
49+ the 13-symbol one (class `wrong-alphabet-same-value`). Fixed to
50+ `(bw >> ss_x).max(4) == 4 && (bh >> ss_y).max(4) == 4`; 4:2:0 identities
51+ unchanged.
52+
53+## Verification (measured)
54+
55+- `ll444.obu` no longer panics on the key frame; the key frame decodes.
56+- `dodge2.obu` KEY FRAME: byte-exact vs `aomdec --rawvideo` (first diff at byte
57+ 37493, i.e. inside inter frame 1).
58+- 4:2:0 regression gate `a_lossless_libaom_inter_frame_decodes_sample_exact`:
59+ green.
60+- `cargo check -p ec-av1 --all-targets`: 0 warnings, 0 errors.
61+
62+## STOP -- named, with the measured site
63+
64+`ll444.obu`'s key frame is NOT yet pixel-exact: 36254 of 36864 bytes differ
65+from byte 19. Localized with the trace pair (ours `EC_AV1_TRACE`, oracle
66+`EC_TRACE_MODE_STEP` + `EC_DQCOEFF`): the structural read order matches the
67+oracle exactly (per-4x4-leaf plane-interleaved luma,U,V; luma unit 0 of the
68+first sub8 group is byte-exact), but the FIRST chroma unit (`plane 1 @(0,0)`,
69+`TxbSet::Chroma4`, TX_4X4) decodes near-miss coefficients from scan position 4
70+(e.g. ours `2:-8` vs oracle `2:-4`, ours `6:4` vs oracle `9:4`) with every
71+classical context input equal (bands all zero at frame start, `txb_skip_ctx`
72+base 7 both sides, DCT_DCT forced, same scan). Site: `sub8_leaf_chroma444`'s
73+square branch (decode.rs read_plane calls around 18935) -- the divergence is a
74+symbol-level CDF-row input unique to lossless chroma at 4x4 that the current
75+ctx arguments do not capture. Next step: oracle-paired token trace
76+(`EC_TRACE_MODE_STEP`'s `EC_COEFF` rng stream vs an rng/tell dump inside
77+`read_coeffs`) to name the first divergent symbol, then diff its CDF row
78+selection.
79+
80+Per charter, stopped there. Frames 1+ of BOTH streams panic in
81+`reconstruct_mc_rect` (decode.rs:28328 post-insert, was 28233) via the
82+`decode_inter_block8` inter path -- a different function from anything this
83+lane changed; that is the charter's named stop for the inter side, and
84+`read_inter_chroma_lossless` remains untouched (another report owns its /2
85+design).
86+
87+## Deferred (spoken, not hidden)
88+
89+- `decode_leaf8`'s intrabc chroma prediction buffers are hardcoded 4x4
90+ (18074-18085), so an intrabc 8x8 leaf at 4:4:4 predicts 16 samples for a
91+ 64-sample reconstruct. Unreachable with `--enable-intrabc=0` fixtures;
92+ deferred(fix-now after the inter side is green, with an intrabc 4:4:4
93+ fixture).
lanes/av1llintra8.report.mdadded+105 -0
@@ -0,0 +1,105 @@
1+# lane-av1-llintra8: the inter frame's 8x8 INTRA leaf lossless 4:4:4 chroma walk
2+
3+## Ticket
4+
5+`decode_inter_block8`'s intra leaf read 4:4:4 lossless chroma as ONE TX_8X8
6+unit (`u_grid`/`v_grid = read_plane(..)` at `chroma_side == 8`,
7+decode.rs:38958/:38985 pre-change) and hit `TxParams::run`'s lossless WHT
8+assert `(8, 8) != (4, 4)` at decode.rs:2566 — the one arm sibling
9+`84acbd09`/fb4e4b0e did not cover (it routed the INTER arms only, named in
10+llsub8b's report item 1). `decode_inter_sub8_rect2` and
11+`sub8_leaf_chroma444` untouched (owned elsewhere).
12+
13+## Change (decode.rs, one branch + one alphabet gate + counter)
14+
15+1. `chroma_side == 8 && lossless(fctx) && !mono(fctx)` routes the leaf's
16+ chroma through `read_intra_chroma_lossless` — the intra twin the >=16x16
17+ intra-in-inter block already runs (plane-major 2x2 raster of TX_4X4
18+ units per plane, `av1_get_tx_size` blockd.h:1383) — with region and
19+ block `(8, 8)` at stride 8, the leaf's own `reach`, and the leaf's
20+ `palette_uv_bufs` windowed per unit by the helper. The walk stamps each
21+ unit's own coefficient context, so `chroma_stamped_per_unit = true` and
22+ the tail's whole-block `record_mi` gets its chroma half saved/restored
23+ around — the same rule the INTER arms' `leaf8_inter_chroma_lossless`
24+ obeys (the mechanism was already in place). `Grid::Zero(64)` when every
25+ unit hung off the frame edge, matching the inter helper. 4:2:0: zero
26+ change — the branch lives inside `chroma_side == 8`, and the reserved
27+ 4:2:0 group-tail chroma arm was not touched.
28+2. SAME LEAF, one read earlier, second defect of the same class: the leaf
29+ read `uv_mode` off `uv_mode_cfl[mode]` unconditionally, but libaom picks
30+ the uv CDF row by `is_cfl_allowed` (decodemv.c:145, cfl.h:23) and at
31+ LOSSLESS that is "the chroma plane block is BLOCK_4X4" (cfl.h:29) —
32+ for this BLOCK_8X8 leaf only at 4:2:0. A 4:4:4 lossless leaf must read
33+ the 13-symbol `uv_mode_no_cfl` alphabet; the tables differ (cdf.rs
34+ `UV_MODE_CFL` vs `UV_MODE_NO_CFL`, row 0: 10407.. vs 22631..), so the
35+ unconditional CFL row consumed a different partition at the leaf's own
36+ uv_mode symbol and desynced every stream that reached the leaf.
37+ Now gated on `cfl_allowed_px(SIDE, SIDE, fctx)` — the same gate five
38+ other readers use; 4:2:0 lossless and every non-lossless partition
39+ still take the CFL row (value-identical reads).
40+3. Non-vacuity counter `LLINTRA8_CHROMA_WALK_HITS` +
41+ `llintra8_chroma_walk_hits()` + a `decode_probe` line, per the lane
42+ convention: CHROMA_SPLIT_TX_HITS cannot attribute its bumps to this
43+ leaf.
44+
45+## Verification (measured, this tree @ HEAD + this change)
46+
47+- Fail-before (assert): `testsrc2 128x96 yuv444p`, aomenc
48+ `--profile=1 --lossless=1 --enable-palette=0 --enable-intrabc=0
49+ --max-partition-size=64`, 6 frames (`/tmp/llintra8/t6.obu`) → panic
50+ `(8, 8) != (4, 4)` at decode.rs:2566, debug backtrace
51+ `read_plane (decode.rs:38958) → push_intra_tx → TxParams::run`. The
52+ release build's assert folds into an index panic at `exec_intra`; the
53+ debug line numbers are the evidence.
54+- Fail-before (alphabet): with only the uv hunk reverted, the regenerated
55+ `--min-partition-size=8` stream's EC_COEFF trace diverges from aomdec's
56+ at all_zero #2400 — `plane=0 mi(4,0)`, the reads right after that leaf's
57+ uv_mode symbol. With the fix: divergence gone (below).
58+- Entropy witness: `testsrc2 128x96 yuv444p` with
59+ `--min-partition-size=8 --max-partition-size=64` (min 8 excludes the
60+ sub-8 shapes so the leaf actually fires; key frame becomes exact too):
61+ our EC_COEFF `all_zero` rng sequence matches fresh
62+ `aomdec --rawvideo` **11292/11292 reads across all 6 frames** with the
63+ walk firing 34 times; frame 0 is byte-exact and ALL luma planes are
64+ byte-exact stream-wide. The pre-fix stream panicked at the leaf; this
65+ stream decodes all 6 frames.
66+- Non-regression: sibling's own witness bytes
67+ `/tmp/ll444/dodge2.obu` decode byte-exact vs fresh `aomdec`, 6 frames,
68+ in this tree with this change.
69+- Gates: `cargo test -p ec-av1 --lib a_lossless` → 6 passed, 0 failed
70+ (both 4:2:0 lossless libaom gates, the 444 min-partition-64 inter gate,
71+ the sb128 pair, the 16x4 pair).
72+- `cargo check -p ec-av1 --all-targets`: 0 warnings, 0 errors (target dir
73+ `$HOME/.cache/cargo-target-av1llintra8`). Release decode_probe output
74+ identical to debug on both streams.
75+- Fixtures are scratch in /tmp/llintra8 (regenerable recipes above);
76+ fixtures/ is gitignored, nothing committed from it.
77+
78+## Named, not chased (spoken)
79+
80+1. Chroma PREDICTION pixel diffs, entropy-exact: on the min-8 stream,
81+ 2772 bytes differ from aomdec — all chroma, luma exact, and the EC_COEFF
82+ trace is bit-aligned everywhere (so symbols, uv modes and angle deltas
83+ all match; only reconstructed pixels differ). Frame 1's diffs cover
84+ three readers at once with clean upstream edges: the inter 8x16 strip's
85+ chroma at mi(0,16) (2x4 units, MC-side), an INTRA 8x8 leaf at mi(2,24)
86+ (uv V_PRED, via this lane's new walk), and the >=16x16 intra block's
87+ chroma at mi(8,28) (the pre-existing `read_intra_chroma_lossless`
88+ caller, untouched by this change). One shared per-unit chroma
89+ prediction-input class across readers, present before this change
90+ (the >=16 arm predates it) — larger than this arm.
91+ deferred(the lane owning per-unit 4:4:4 chroma prediction:
92+ `read_plane`/`PlaneBuf::reconstruct` intra chroma edges + the inter
93+ strip chroma MC), with the min-8 stream as a ready-made fixture.
94+2. The default-partition (min 4) testsrc2 key frame still entropy-diverges
95+ at frame-0 coefficient read #452 (pre-existing, key-frame intra lane;
96+ llsub8b's item 3). The min-8 key frame is exact, so this lane's witness
97+ does not depend on it.
98+
99+## Note on the shared oracle
100+
101+aomenc/aomdec are the shared `$HOME/.cache/aom-oracle/build`; the
102+EC_COEFF/EC_COEFF_STEP rungs of that patched tree are what the entropy
103+pairing above used. Today's aomenc produces different RD picks than this
104+morning's (llsub8b's note), so every comparison is against fresh aomdec
105+output of THE SAME bytes.
lanes/av1llkf.report.mdadded+97 -0
@@ -0,0 +1,97 @@
1+# lane-av1-llkf: the default-partition lossless 4:4:4 key frame's read #452
2+
3+## Ticket
4+
5+Default-partition lossless 4:4:4 key frames entropy-diverge at frame-0
6+coefficient read #452 (mandelbrot/testsrc2, `llsub8b` item 3 / `llintra8`
7+item 2). Min-partition-64 and min-8 keys stay exact, so the defect lives in
8+the shapes only a min-4 stream produces: 4x4 leaves and their 4x16/16x4
9+neighbours.
10+
11+## Named symbol and reader (measured, t1 = testsrc2 128x96, 1 key frame,
12+`--profile=1 --lossless=1 --enable-palette=0 --enable-intrabc=0`, default
13+partition)
14+
15+- Reads 1..452 of the frame's `all_zero` (TXB_SKIP) rng sequence match the
16+ oracle exactly; read #452 (0-indexed) diverges:
17+ - aom: `EC_COEFF plane=2 row=0 col=0 mi=(8,5)` — the V plane's FIRST
18+ TX_4X4 unit of the 4x16 intra block at mi=(8,5), read off
19+ `txb_skip_cdf[0][12]` (`ctx=12` = base 2 + offset 10; above=`23`,
20+ left=`21`, both nonzero).
21+ - ours: `side=4 ctx=4` — our offset-10 row for base 1 (one band cell
22+ reads zero), a different CDF row, so the rng diverges on the same
23+ symbol. Reader: `read_plane`'s `all_zero` symbol read
24+ (decode.rs:6819, `dec.symbol(&mut coding.txb_skip[skip_ctx])`), fed by
25+ `decode_rect4_16_strip`'s lossless chroma walk.
26+- Whose band cell: block (8,4) (the 4x16 strip to the LEFT) recorded each
27+ of its TX_4X4 units with `record_mi_chroma(cu_mi, 8, 8, plane, ...)`
28+ anchored at `oy / 2, ox / 2` — the 4:2:0 subsampled form. At 4:4:4 a unit
29+ is ONE mi cell, so the `(8, 8)` span smeared every unit's state over a
30+ 2x2 mi block: the strip's later V units overwrote `above[5]` — a column
31+ a 4-px-wide block never touches in aom — with their own (zero) state,
32+ where aom keeps the 4x4 leaf (7,5)'s nonzero write
33+ (`av1_set_entropy_contexts`, blockd.c:29, stamps exactly
34+ `tx_size_wide_unit` x `tx_size_high_unit` cells = one above + one left
35+ for TX_4X4). The skipped-unit twin arm has the same defect (aom's skip
36+ path zeroes the plane block's own cells, `av1_reset_entropy_context`,
37+ blockd.c:58 — the 8x8 smear also stamped past the block).
38+
39+## Change (decode.rs, two record sites, one branch)
40+
41+`decode_rect4_16_strip`'s `lossless_pair` chroma walk (skip and non-skip
42+arms): the per-unit record is now ss-aware —
43+
44+- anchor `cu_mi = (pair_mi.0 + (oy << ss_y) / MI, pair_mi.1 + (ox << ss_x) / MI)`
45+- span `record_mi_chroma(cu_mi, 4 << ss_x, 4 << ss_y, plane, ...)`
46+
47+4:2:0 is arithmetically identical (`(oy << 1) / 4 == oy / 2` for the
48+multiple-of-4 unit origins, `4 << 1 == 8`); non-lossless arms untouched;
49+the intrabc arms untouched. `RECT4_16_LOSSLESS_CHROMA_HITS` remains the
50+route's non-vacuity counter.
51+
52+## Verification (measured, this tree @ HEAD + this change)
53+
54+- Entropy: the `all_zero` rng ladders now match the oracle on ALL reads of
55+ the whole frame — t1 (testsrc2) 2304/2304, m1 (mandelbrot) 2304/2304.
56+ Fail-before on the same bytes: t1 diverges at read #452, m1 at read #208
57+ (base-tree control, `$HOME/.cache/cargo-target-av1llkf-base`).
58+- Pixel witness: t1 decodes byte-exact vs fresh `aomdec --rawvideo`
59+ (36864 bytes). The 6-frame default-partition testsrc2 stream (`t6.obu`)
60+ reads frame 0 fully in sync (reads 1..2304 of 12582 consumed before the
61+ next, DIFFERENT divergence — see deferred (1)) and completes all 6
62+ frames with no refusal.
63+- Sibling non-regression: `/tmp/ll444/dodge2.obu` (llsub8b/llintra8's
64+ witness bytes) decodes byte-exact vs fresh aomdec in this tree.
65+- Gates: `cargo test -p ec-av1 --lib a_lossless` → 7 passed, 0 failed
66+ (both 4:2:0 lossless libaom gates, the 444 min-partition-64 inter gate,
67+ the sb128 pair, the 16x4 pair).
68+- `cargo check -p ec-av1 --all-targets` (target dir
69+ `$HOME/.cache/cargo-target-av1llkf`): 0 warnings, 0 errors.
70+- Fixtures are scratch in /tmp/llkf (regenerable recipes above);
71+ fixtures/ is gitignored, nothing committed from it.
72+
73+## Named, not chased (spoken)
74+
75+1. t6's NEXT divergence is a different site: frame 1 (INTER), luma
76+ `all_zero` at our read #2317 — same ctx row (1) and same decoded value
77+ as the oracle but different CDF contents (ours `cdf0=5892` vs aom
78+ `27244`), i.e. an adaptation-history/row-selection desync on the inter
79+ frame, not a band smear. deferred(the inter-frame lossless-444 lane),
80+ with t6.obu's recipe as a ready-made fixture.
81+2. m1 (mandelbrot) pixels: entropy exact frame-wide, chroma-only pixel
82+ diffs (U 4436 / V 9070 samples, luma 0) — the pre-existing per-unit
83+ 4:4:4 chroma PREDICTION class `llintra8` named. One concrete suspect
84+ site of that class observed while here:
85+ `decode_rect4_16_strip`'s lossless walk calls
86+ `tu_reach(pw, ph, ox * 2, oy * 2, 8, ...)` — the 4:2:0 luma-space
87+ offsets — where `read_intra_chroma_lossless` uses `ox << ss_x, oy <<
88+ ss_y` with unit size `4 << ss_x`; at 4:4:4 the doubled origin moves the
89+ unit's prediction edge window. Prediction-domain, entropy unaffected
90+ (proven by the exact coefficient reads above); owned by the same
91+ chroma-prediction lane. deferred(that lane).
92+
93+## Note on the shared oracle
94+
95+aomenc/aomdec are the shared `$HOME/.cache/aom-oracle/build`; the
96+EC_TRACE_COEFF / EC_ECDUMP rungs of the patched tree carried the pairing.
97+Every comparison is against fresh aomdec output of THE SAME bytes.
lanes/av1llpred.report.mdadded+80 -0
@@ -0,0 +1,80 @@
1+# lane-av1-llpred: the min-partition-8 lossless 4:4:4 chroma OBMC blend is ss-blind
2+
3+## Ticket
4+
5+Remeasure the 2772 chroma pixel diffs the llintra8 lane named (entropy-exact,
6+luma-exact), name the FIRST differing sample, and fix it only if one index
7+explains it. `decode_leaf8`'s palette set untouched (another branch), the
8+reserved 4:2:0 group-tail chroma arm untouched.
9+
10+## Remeasure (this tree @ b3f815c8, BEFORE the change)
11+
12+Same pinned fixture `/tmp/llintra8/testsrc2_min8.obu` (testsrc2 128x96
13+yuv444p, aomenc `--profile=1 --lossless=1 --enable-palette=0
14+--enable-intrabc=0 --min-partition-size=8 --max-partition-size=64`, 6
15+frames), fresh `aomdec --rawvideo` of the same bytes: **2772 chroma diffs
16+reproduced exactly** (frame 0 and all luma planes clean). But the parent's
17+three named sites did NOT hold: the first differing sample is
18+
19+> frame 1, plane 1 (U), x=88 y=4 (mi row 1, col 22), ours=149 ref=150
20+
21+— an inter 8x8 leaf at mi(0,22) with mv=(0,11), not any of mi(0,16),
22+mi(2,24) or mi(8,28) as named. Error maps (residuals are equal by
23+entropy-exactness, so final diff = prediction diff) showed narrow
24+column/row fragments inside blend regions — OBMC shape, not whole-block MC
25+or intra-edge shape.
26+
27+## Root cause: one class, two sites, both "the 4:2:0 half hardcoded"
28+
29+1. `obmc_run` (decode.rs ~30085/30101/30113) sized the CHROMA neighbour
30+ prediction and blend windows with literal `/ 2` (cbw/cbh/cox/cw and
31+ cbh/coy/ch). libaom sizes them per plane with the PLANE's own
32+ subsampling shift (`dec_build_prediction_by_above_pred`:
33+ `(op_mi_size * MI_SIZE) >> pd->subsampling_x`, blend bounds likewise),
34+ which is `>> 0` at 4:4:4 — the chroma blend covered half the columns at
35+ half the offsets. Luma was never affected (luma exact everywhere).
36+2. `obmc_plan`'s `skip_chroma_above` hardcoded the luma shape list
37+ `(8,8)|(16,8)|(8,16)`. libaom's `av1_skip_u4x4_pred_in_obmc`
38+ (reconinter.c:829) switches on the PLANE block
39+ (`get_plane_block_size`): only 4x4/8x4/4x8 skip the ABOVE pass's chroma
40+ (`return dir == 0`). At 4:4:4 the plane block is the luma block itself,
41+ so every 8x8/16x8/8x16 OBMC block was silently missing its above-pass
42+ chroma blend — the (96..101, y8..10) family on leaf mi(2,24).
43+
44+Both fixed to derive ss (from `chroma_side` in `obmc_plan`, `ss_x/ss_y(fctx)`
45+in `obmc_run`); value-identical at 4:2:0 (`/2 == >>ss`). `obmc_run` is shared
46+by the 16x16+ square path and the 8x8 leaf path, so one fix covers both.
47+The `obmc_mask` table was already complete (M1..M32).
48+
49+## Verification (this tree @ HEAD + the change)
50+
51+- Fail-before → fix-after measured in steps: 2772 chroma diffs → 1126
52+ (geometry fix alone) → **0** (skip fix): decode output is byte-exact
53+ against fresh `aomdec --rawvideo` for ALL 6 frames, all planes
54+ (`cmp`-equal 221184 bytes). The stream-exactness claim is now TOTAL for
55+ this fixture.
56+- 4:2:0 non-regression: `cargo test -p ec-av1 --lib a_lossless` → 6 passed,
57+ 0 failed (both 4:2:0 lossless libaom gates, the 444 min-partition-64
58+ inter gate, the sb128 pair, the 16x4 pair).
59+- `cargo check -p ec-av1 --all-targets`: 0 warnings, 0 errors (target dir
60+ `$HOME/.cache/cargo-target-av1llpred`).
61+
62+## Named, not chased (spoken)
63+
64+1. `EC_MCB` rung (decode.rs obmc_run) still windows its own dump with
65+ `write_w / 2` — a lane-t900 4:2:0-era INSTRUMENTATION assumption only;
66+ output-inert, decode unaffected. fix-now(deferred to whoever next
67+ touches that rung).
68+2. The llintra8 report's three named sites (mi(0,16)/mi(2,24)/mi(8,28))
69+ did not match a fresh run of the same bytes; mi(2,24) and mi(8,28) do
70+ appear in the diff set but the FIRST miss was mi(0,22). Lesson recorded:
71+ reremeasure before owning.
72+
73+## Note on the shared oracle
74+
75+All comparisons against fresh `$HOME/.cache/aom-oracle/build/aomdec
76+--rawvideo` output of THE SAME pinned bytes. The oracle tree has no
77+`EC_OBMC` rung (the decoder-side comment claiming a byte-matching oracle
78+format is aspirational); EC_PREDND covers intra only. Fixtures stay in
79+/tmp/llpred + /tmp/llintra8 (regenerable recipes above); nothing committed
80+from fixtures/.
lanes/av1llpred2.report.mdadded+62 -0
@@ -0,0 +1,62 @@
1+# lane-av1-llpred2: `skip_chroma_above` must read the frame's own ss pair, not a rect-over-square ratio
2+
3+## Ticket
4+
5+Reviewer FAIL on 71f07edd's `obmc_plan`: both ss axes were derived from ONE
6+square chroma side, `ss = trailing_zeros(write_w|write_h / chroma_side)`.
7+Two defects, one root:
8+
9+1. 4:2:0, a 16x8 strip: `write_h/chroma_side = 8/8 = 1`, `trailing_zeros(1)`
10+ = 0, so ss=(1,0) and the plane block read (8,8) — `skip_chroma_above`
11+ went FALSE. The old pre-llpred code skipped, and libaom's
12+ `av1_skip_u4x4_pred_in_obmc` (reconinter.c 829) skips on the PLANE block
13+ `(8,4)` (frame ss (1,1)). Every 4:2:0 16x8/8x16 OBMC strip blended a
14+ chroma above pass the reference never blends (and would desync a
15+ stream that carries one).
16+2. 4:4:4, a 16x8 strip: `write_h/chroma_side = 8/16 = 0`,
17+ `trailing_zeros(0)` = 64, `write_h >> 64` panics in a debug build.
18+ The parent lane's byte-exact claim was measured in a release build,
19+ where the out-of-range shift wraps instead of panicking.
20+
21+## Change (this tree @ 71f07edd + the fix)
22+
23+`obmc_plan` takes `ss_x`/`ss_y` — the FRAME's own pair, exactly what the
24+chroma window half in `obmc_run` shifts by (`ss_x(fctx)`/`ss_y(fctx)`) —
25+and the decision moved to a pure helper:
26+
27+```rust
28+pub(crate) fn obmc_skip_chroma_above(write_w, write_h, ss_x, ss_y) -> bool {
29+ matches!((write_w >> ss_x, write_h >> ss_y), (4, 4) | (8, 4) | (4, 8))
30+}
31+```
32+
33+All three callsites pass the frame pair: `decode_inter_block`,
34+`decode_inter_block8` (`ss_x(fctx), ss_y(fctx)`), and the encoder's
35+`obmc_prediction` (`crate::decode::ss_x(fctx)`, 4:2:0-only encoder). No
36+ratio over `chroma_side` survives; `trailing_zeros` of anything is gone.
37+The window-size half that reduces to `/2` at 4:2:0 is untouched, and the
38+reserved 4:2:0 group-tail chroma arm is untouched.
39+
40+## Proof (debug build, `dev` profile throughout)
41+
42+- Decision check (new `obmc_skip_chroma_tests`):
43+ `rect_strips_skip_above_chroma_at_420_and_shift_never_overflows` pins
44+ 4:2:0 (16,8,1,1) and (8,16,1,1) → SKIP (with (8,8,1,1), and
45+ (16,16)/(32,16)/(16,32) → blend), and 4:4:4 → only true 4-wide/high
46+ shapes skip, (16,8,0,0)/(8,16,0,0)/(8,8,0,0) → blend with no shift
47+ out of `usize` range. No hit-counter gate was added: the skip
48+ decision itself is what is proven.
49+- 6-frame 4:4:4 stream, DEBUG decode probe: fixture
50+ `/tmp/llintra8/testsrc2_min8.obu`
51+ sha256 `04fb6d38de5382e647bfb70b6a17802f1fccc5502e6698c0394167891f2b27dc`,
52+ `$HOME/.cache/cargo-target-av1llpred2/debug/examples/decode_probe`
53+ → 6 frames, 221184 bytes, `cmp`-equal to fresh
54+ `$HOME/.cache/aom-oracle/build/aomdec --rawvideo`. Byte-exact, now in
55+ a build that would have panicked on the old code.
56+- 4:2:0 non-regression: `cargo test -p ec-av1 --lib -- obmc_skip_chroma
57+ a_lossless` → 7 passed, 0 failed (the new check + the 4:2:0 lossless
58+ libaom gates, the 444 min-partition-64 inter gate, the sb128 pair, the
59+ 16x4 pair).
60+- `cargo check -p ec-av1 --all-targets`
61+ (`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1llpred2`): 0 warnings,
62+ 0 errors.
lanes/av1llpredgate2.report.mdadded+87 -0
@@ -0,0 +1,87 @@
1+# lane-av1llpredgate2: pin the debug-exact 6-frame stream for the ss-aware `obmc_skip_chroma_above` fix
2+
3+Tree: lane-av1-llpredgate2 @ 041e3eae (the lane-av1-llpred2 fix, under
4+review — no code change landed here). This lane adds ONLY the regression
5+gate.
6+
7+## Regression gate
8+
9+`stream::tests::a_lossless_444_min_partition8_inter_stream_decodes_sample_exact`
10+(crates/ec-av1/src/stream.rs), modelled on
11+`a_lossless_444_min_partition64_inter_stream_decodes_pixel_exact`.
12+
13+### Fixture provenance
14+
15+- Origin: lanes/av1llpred.report.md / lanes/av1llpred2.report.md stream —
16+ `testsrc2=size=128x96:rate=?` ffmpeg source, yuv444p, encoded by the
17+ shared aomenc (`$HOME/.cache/aom-oracle/build`, pre-2026 build) with
18+ `--profile=1 --lossless=1 --enable-palette=0 --enable-intrabc=0
19+ --min-partition-size=8 --max-partition-size=64`, 6 frames.
20+- Committed at `crates/ec-av1/fixtures/ll444_minp8_inter.obu`
21+ (gitignored pattern `fixtures`, force-added like every sibling fixture;
22+ on-disk == `git ls-tree` blob verified at commit time).
23+- 34037 bytes, sha256
24+ `04fb6d38de5382e647bfb70b6a17802f1fccc5502e6698c0394167891f2b27dc`
25+ (= the /tmp/llintra8 original, byte-identical copy),
26+ FNV-1a64 `0x2c8f4a2cc02552da`. Both pinned as test consts; missing
27+ file panics — no skip path.
28+
29+### Debug build path, not release-only
30+
31+The defect this gate pins is a DEBUG-only panic: the pre-llpred2 ratio
32+(`(write_h / chroma_side).trailing_zeros()` = 64 at 4:4:4) shifted by 64,
33+which panics under debug_assertions and silently wraps in release
34+(release was already byte-exact). The test runs under `cargo test`'s
35+default dev profile — the profile where the parent measured byte-exact
36+and where the old code dies — so a red run names the class instead of
37+silently passing.
38+
39+### Counter disposition: cited unit check, not a skip-arm counter
40+
41+A skip-arm counter was added and measured, then removed:
42+
43+- With the counter bumped at the ONE site the ss-aware decision returns
44+ true (after the `obmc_skip_chroma_above` call in `obmc_plan`), the
45+ pinned stream measured `OBMC_SS_SKIP_CHROMA_ABOVE_HITS 0 -> 0` while
46+ OBMC itself fired (`OBMC_HITS 0 -> 77`, `OBMC_RECT_LEAF_HITS 0 -> 20`).
47+ At 4:4:4 the skip needs a 4x4/8x4/4x8 PLANE block; min-partition-8
48+ never codes one, so the skip arm cannot fire on this stream and any
49+ `delta > 0` assert would be permanently red — vacuity in reverse.
50+- Per the ticket's fallback: the decision TABLE is pinned by the existing
51+ unit check
52+ `decode::obmc_skip_chroma_tests::rect_strips_skip_above_chroma_at_420_and_shift_never_overflows`
53+ (4:2:0 16x8/8x16 strips still skip; 4:4:4 shifts never leave `usize`),
54+ and the stream gate pins the END-TO-END behaviour sample-for-sample.
55+
56+### Assertions (all before/without any skip path)
57+
58+1. Fixture bytes: exact length + FNV-1a64.
59+2. `decode_stream` of the pinned bytes succeeds (a returning `>> 64`
60+ panic fails here) — 6 frames, 128x96.
61+3. Oracle aomdec (`--codec=av1 --rawvideo`): raw size 221184, then
62+ per-frame per-plane `assert_eq!(bad, 0)` — 0 differing samples,
63+ message carries class `obmc-ss-blind-chroma-above`.
64+4. ffmpeg arm (`ffmpeg_decode_sequence_444`): same sample-exact compare.
65+ Neither arm skipped in the green run (aomdec + ffmpeg both present).
66+
67+## Red probes (mutation verification)
68+
69+1. Old-ratio probe: callsite swapped to the exact 71f07edd derivation
70+ (`(write_w|write_h per chroma_side).trailing_zeros()` pair) → test
71+ RED: `attempt to shift right with overflow` at decode.rs
72+ `obmc_skip_chroma_above` — the debug-panic class reproduced.
73+2. Chroma-diff probe: `skip_chroma_above = true` forced at the callsite
74+ (re-blend class) → test RED at the named assert: `aomdec frame 1
75+ plane u: 46 samples differ (class obmc-ss-blind-chroma-above)`.
76+3. decode.rs restored byte-identical after both probes
77+ (`git diff --stat`: only stream.rs + the fixture).
78+
79+## Non-regression / hygiene
80+
81+- `cargo test -p ec-av1 --lib
82+ a_lossless_444_min_partition8_inter_stream_decodes_sample_exact`
83+ (CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1llpredgate2, dev
84+ profile): 1 passed, 0 failed, no SKIP lines.
85+- `cargo check -p ec-av1 --all-targets`: 0 warnings, 0 errors.
86+- The skip expression itself is untouched (no diff in decode.rs); the
87+ reserved 4:2:0 group-tail chroma arm untouched; no server, no full suite.
lanes/av1llsub8.report.mdadded+84 -0
@@ -0,0 +1,84 @@
1+# lane-av1-llsub8: 4:4:4 lossless sub8 chroma coefficient miss (r1)
2+
3+## Charter
4+
5+Localize the 4:4:4 lossless sub8 chroma coefficient miss. Work in
6+`edith_codecs-av1llsub8` @ 38393554; own `sub8_leaf_chroma444` and the
7+coefficient read it calls. 4:2:0 lossless stays exact.
8+
9+## Repro
10+
11+Fixture regenerated per the llintra report's recipe (raw `--i444` input, same
12+encoder): `testsrc2 128x96` yuv444p, 6 frames, `aomenc --profile=1
13+--lossless=1 --enable-palette=0 --enable-intrabc=0` (`~/ll444.obu`, 26511 B;
14+key-frame cut `~/ll444kf.obu`). Pre-fix key frame: 15001/36864 bytes differ
15+from `aomdec --rawvideo` (first diff byte 4181). Probe exits 101 at frame 1
16+(`reconstruct_mc_rect`, decode.rs:2589 path) — the charter's named inter side,
17+untouched.
18+
19+## Ladder (EC_TRACE_COEFF, symbol-anchored, key frame only)
20+
21+12136 aligned `(tag,rng)` steps, then:
22+
23+1. **uv_mode alphabet (FIXED).** First divergence is *not* a coefficient: at
24+ the first 8x8 `PARTITION_HORZ` leaf (mi (8,16)) the leaf's own `uv_mode`
25+ symbol desyncs. `read_intra_mode_sub8` read `cdfs.uv_mode_cfl[mode]`
26+ (14-symbol) unconditionally; a 4:4:4 lossless `BLOCK_8X4`/`BLOCK_4X8`
27+ leaf's plane block is the rect itself, so `is_cfl_allowed` is FALSE and the
28+ stream carries the 13-symbol `uv_mode_no_cfl` row (class
29+ `wrong-alphabet-same-value`; oracle post-read rng 33082 vs ours 38358 off
30+ the same entry 56906). Fix: gate on `cfl_allowed_px(seg_w_mi*MI,
31+ seg_h_mi*MI)` — true for the 4:2:0 group tail (plane block 4x4) and 4:4:4
32+ split leaves, false for 4:4:4 rect leaves; 4:2:0 unchanged.
33+2. **Rect-leaf lossless chroma unit structure (FIXED).** Next divergence
34+ (step 12138): the rect leaf's chroma. `read_tx_size` answers TX_4X4 for
35+ EVERY plane of a lossless block, so the oracle codes the 8x4 leaf's chroma
36+ as TWO plane-major TX_4X4 units (U bc 0, U bc 1, then V) with
37+ `get_txb_ctx`'s **+10** rows (`plane pels 32 > tx pels 16`,
38+ `txb_skip_cdf[0][10..12]`), while ours read ONE TX_8X4 rect unit off
39+ `ChromaRect8x4` (rows `[1][0..2]`, only reached correctly non-losslessly).
40+ Fix: lossless rect arm reads per-4x4 units via `read_plane(TxbSet::Chroma4,
41+ luma_skip_ctx=Some(3))` (Chroma4's `big` rows = `[0][10..12]`), plane-major
42+ per `decode_token_recon_block`, per-unit ctx from the unit's own
43+ `around_mi_rect`, immediate per-unit `av1_set_entropy_contexts` stamps.
44+ The non-lossless arm (single rect transform, rows `[1][7..9]`) is kept.
45+ Tail now stamps per-unit (`grid_unit_state`) instead of one whole-leaf
46+ smear; 4x4 leaves and the single-unit rect arm are bit-identical to before.
47+
48+After both fixes: divergence moves to step 19228, key frame 178/36864 bytes
49+off (first diff byte 8320).
50+
51+## STOP — named, not fixed (budget)
52+
53+Step 19228: inside a **16x8 leaf** (`PARTITION_HORZ` of a 16x16; U units
54+bc 0..3, br 0..1) the U unit at **bc=2, br=0** reads `txb_skip` base **1**
55+(ours, row `[0][11]` — the same `+3` fold, cdf `[8570,...]`) where the oracle
56+reads base **0** (row `[0][10]`, cdf0=32705): one of ours' above/left entropy
57+cells for that unit is stamped nonzero where the oracle's is clean. bc=0/1 of
58+the same leaf aligned (rng 40879/40628), and ours' `dcctx=2` on the diverging
59+read (vs 0 on bc=1) says the polluted cell carries a DC-sign vote — i.e. an
60+above-band cell written by the block above with a state the oracle doesn't
61+hold. Next step: dump the above-band cell contents (both sides,
62+`EC_DCDUMP`/oracle equivalent) for the units directly above this leaf's
63+bc 2/3 columns and diff the writer — suspect the 16x8-path's per-unit stamp
64+map (which unit owns which above/left cell when a leaf spans >1 mi row) in
65+`decode_leaf_rect`'s chroma loop, NOT `sub8_leaf_chroma444` (16x8 leaves are
66+read by `decode_leaf_rect`, which already had per-unit +3 reads before this
67+lane).
68+
69+## Verification (measured)
70+
71+- `a_lossless_libaom_key_frame_decodes_sample_exact` + `a_lossless_libaom_
72+ inter_frame_decodes_sample_exact` (4:2:0): green.
73+- `cargo check -p ec-av1 --all-targets`: 0 warnings, 0 errors.
74+- Key frame: 15001 → 178 differing bytes; first diff byte 4181 → 8320.
75+- Consumed-count ladder: 12136 → 12138 → 19228 aligned steps.
76+
77+## Deferred (spoken, not hidden)
78+
79+- 16x8 above-band stamp diff above (fix-now; named cell + writer).
80+- Intrabc rect leaves at lossless 444 still route the rect arm's
81+ `read_coeffs_rect` path with the wrong unit structure — unreachable with
82+ `--enable-intrabc=0` fixtures; same fix shape as the non-intrabc arm
83+ (deferred(fix-now after the inter side is green, with an intrabc 4:4:4
84+ fixture), matching the llintra report's deferral).
lanes/av1llsub8b.report.mdadded+92 -0
@@ -0,0 +1,92 @@
1+# lane-av1-llsub8b: the inter sub8 rect route's 4:4:4 lossless chroma raster
2+
3+## Ticket
4+
5+`decode_inter_sub8_rect2` hit `TxParams::run`'s lossless WHT assert
6+`(8, 4) != (4, 4)` at decode.rs:2566 (pre-existing at the parent, named by
7+`lane-av1-ll64`'s same-class sweep). Port sibling `84acbd09` if it covers
8+this route; else fix only the unit size that trips the assert.
9+`decode_rect4_16_strip` untouched (sibling-owned). The 12-frame stream's
10+Golomb-tail refusal was expected to disappear once the (8,4) read was
11+fixed.
12+
13+## Sibling verdict: not covered — own fix, same shape
14+
15+`84acbd09` (already ported here as fb4e4b0e) routed `decode_inter_block8`'s
16+INTER arms' 8x8 chroma through `leaf8_inter_chroma_lossless`. The rect2
17+route was one arm over: `decode_inter_sub8_rect2`'s `chroma_444` coded arm
18+read each piece's (8,4)/(4,8) U/V plane block as ONE `TxbSet::ChromaRect8x4`
19+rect unit — at lossless that unit hits the WHT assert, exactly the ll64
20+report's prediction.
21+
22+## Change (decode.rs, one branch)
23+
24+New arm in `decode_inter_sub8_rect2`'s `chroma_444` coded path:
25+`lossless(fctx) && !mono(fctx)` routes the piece's chroma through the
26+sibling's `read_inter_chroma_lossless` walk with region and block
27+`(bw, bh)` at stride `SIDE` — lossless codes TX_4X4 on EVERY plane
28+(`av1_get_tx_size`, blockd.h:1383), so the plane block is a 2x1/1x2 raster
29+of `TxbSet::Chroma4` units. The walk stamps each unit's own coefficient
30+context, so — unlike the lossy arm — no whole-block `record_mi_chroma`
31+runs after it (the leaf8 rule). `piece_tx_type` inheritance stays lossy-
32+only (lossless is DCT_DCT on every plane). 4:2:0: zero change — the branch
33+lives inside `chroma_444`, and the reserved 4:2:0 group-tail chroma arm was
34+not touched. Luma was already correct (`lane-lossless2`'s TX_4X4 leaf walk).
35+
36+## Verification (measured, this tree @ HEAD + this change)
37+
38+- Fail-before: `testsrc2 128x96 yuv444p`, aomenc `--profile=1 --lossless=1
39+ --enable-palette=0 --enable-intrabc=0 --max-partition-size=64`, 6 frames
40+ → panic `(8, 4) != (4, 4)` at decode.rs:2566, backtrace
41+ `read_inter_plane_rect → push_mc_rect_tx`. Fail-after: gone; the decoder
42+ reads through the rect2 pieces and arrives coherently at the next
43+ (pre-existing) defect site — see deferred (1).
44+- Witness with the route actually firing: mandelbrot 128x96 6 frames, same
45+ recipe, `--cpu-used` 0 and 3 both decode ALL 6 frames;
46+ `sub8_inter_rect: horz8x4=22 vert4x8=15` (cpu0) / `10/12` (cpu3) — 37
47+ and 22 lossless 444 rect2 chroma pieces through the new walk, stream
48+ completes.
49+- Sibling non-regression: the ORIGINAL `/tmp/ll444/dodge2.obu` (sibling's
50+ own witness bytes) decodes byte-exact vs fresh `aomdec --rawvideo`, all 6
51+ frames, in this tree with this change.
52+- Entropy alignment on the repro stream: frames 0-2 of the 6-frame
53+ testsrc2 stream byte-exact vs aomdec; `sub8_inter_rect` counters 0 there
54+ (its first rect2 piece sits behind deferred (1)'s site), and its frame 3
55+ reads through the new arm up to the (8,8) site without a desync-form
56+ failure.
57+- Gates: `cargo test -p ec-av1 --lib a_lossless` → 6 passed, 0 failed
58+ (both 4:2:0 lossless libaom gates, the 444 min-partition-64 inter gate,
59+ the sb128 pair).
60+- `cargo check -p ec-av1 --all-targets` (target dir
61+ `$HOME/.cache/cargo-target-av1llsub8b`): 0 warnings, 0 errors.
62+- Fixtures are scratch in /tmp/llsub8b (regenerable recipes above);
63+ fixtures/ is gitignored, nothing committed from it.
64+
65+## Named, not chased (spoken)
66+
67+1. `decode_inter_block8`'s INTRA-leaf chroma arm (decode.rs:38958/:38985,
68+ `u_grid`/`v_grid = read_plane(..)` at `chroma_side == 8`) reads 4:4:4
69+ lossless chroma as ONE TX_8X8 unit → the same WHT assert, `(8, 8) !=
70+ (4, 4)`. Same class, the one arm the sibling's fix did not cover (it
71+ routed the INTER arms only). decode_inter_block8 is the llinter lane's
72+ function — deferred(fix-now by the lane owning block8's intra arm; the
73+ fix shape is the same per-unit lossless walk with intra-plane read
74+ semantics, not a port of the inter helper).
75+2. The 12-frame stream's `REFUSED: AV1 tile (a Golomb tail …)` from the
76+ ll64 report: GONE after this fix — that stream now stops at deferred
77+ (1)'s (8,8) site instead, exactly as ll64 predicted.
78+3. Fresh observation on today's regenerated fixtures: a mandelbrot
79+ default-partition lossless 444 KEY frame pixel-differs from aomdec
80+ (key-frame-only stream, zero sub8 counters, no refusal, first diff at
81+ sample 40). Key frames never enter `decode_inter_sub8_rect2`, so this
82+ is pre-existing and intra-side — the earlier lanes' key-frame proofs
83+ ran min-partition-64 keys, which stay exact. deferred(the intra lane).
84+
85+## Note on the shared oracle
86+
87+aomenc/aomdec binaries are the shared `$HOME/.cache/aom-oracle/build`.
88+Today's aomenc produces different RD picks than this morning's (the
89+regenerated min-partition-64 testsrc2 stream's inter frames differ from
90+the sibling's original bytes) — streams were therefore compared only
91+against aomdec output of THE SAME bytes, and the sibling's original
92+dodge2.obu was used verbatim for the non-regression check.
lanes/av1lrflush.report.mdadded+110 -0
@@ -0,0 +1,110 @@
1+# lane-av1lrflush — the r2 "RU-row-0 flush" defect REFUTED; f2 residual re-attributed to inter-rect entropy recon; one new threading defect named (r3)
2+
3+## Outcome
4+
5+1. THE NAMED DEFECT DOES NOT EXIST. r2's DEFECT 3 (stop-with-site: "`pipe_run_lr`'s
6+ `rrows: Some` branch refills only caller-passed RU rows, and the
7+ `ls.note(k-2)`/`ls.close(nb, false)` band release never flushes RU row 0 when the
8+ top SB row carries a 128-root rect") is refuted by direct measurement at this HEAD
9+ (48411287, fixture sha256 `27825e14…61e80` verified): with the filter pipeline
10+ engaged (`EC_AV1_FILTER_THREADS=4`, recon serial — `pipe_on=true` on both inter
11+ frames, witnessed by the new unconditional `PIPELINE_TAKEN` counter), the decoded
12+ output is **byte-identical to the whole-frame path on all three frames**, including
13+ frame 2 — the inter frame whose top SB row carries the 128-root rect. The band
14+ release provably flushes RU row 0 (f2 luma is a single RU row `(0,160)`,
15+ unit_size 128, 2 SGR units `ep=11 xqd=[0,73]/[0,72]`; f1's SGR-heavy restoration —
16+ 11754 changed samples — also reproduces exactly through the pipeline).
17+2. r2's stage ladder was misaligned by one stage. Measured at this HEAD with the
18+ pinned fixture and the current oracle (all dumps cross-checked frame-aligned; f0/f1
19+ byte-exact at every stage): frame 2 already diverges at **PREFILT** —
20+ Y 6952 / U 9568 / V 13496 samples — so POSTDEBLOCK/POSTCDEF are NOT byte-exact and
21+ the damage is introduced BEFORE loop restoration. r2's reported "FINAL" diff
22+ (Y 7308 / U 9685 / V 14012) matches today's POSTCDEF diff (Y 7307 / U 9685 /
23+ V 13722) almost sample-for-sample: the r2 comparisons paired our post-CDEF bytes
24+ against the oracle's FINAL and so on, one rung off. The "our final equals
25+ post-CDEF above row 63" reading is likewise stale — our LR actually changed rows
26+ from row 2 (Y) and covers all rows on V; U is `RestorationType::None` on f2 in
27+ BOTH decoders (oracle's U final == oracle's U post-CDEF, 0 rows differ), so the
28+ r2 parser reading (`lr_params` per-plane `f(2)`) is confirmed correct.
29+3. DEFECT A (real f2 residual — NOT this lane's): serial recon diverges at PREFILT
30+ with first diffs **Y (98,128), U (64,128), V (0,128)** — all three planes enter at
31+ column 128, i.e. inside the inter 64x128 block at (128,0), everything downstream
32+ carrying it. Site: the inter rect-strip entropy/recon path — the entropy lane's
33+ assigned territory (Agent044's `decode_rect4_16_strip` inter band stamping; their
34+ independent t6 finding — skipped inter 1:4 strips leaving stale band cells that
35+ flip coefficient contexts — is plausibly this class one size up). STOP per
36+ charter; nothing in the entropy path was touched here.
37+4. DEFECT B (NEW, needs its own lane): the wavefront reconstruction
38+ (`EC_AV1_RECON_THREADS>1`) diverges from the serial decoder at PREFILT on this
39+ fixture's inter frames — **chroma-only write-replay loss**: f1 U 17504 samples
40+ (first (1,0)), V 3 (29,67); f2 U 25472 (first (0,0)), V 1472 (first (128,2)); Y
41+ byte-exact on both frames, and f0 (keyframe) exact everywhere. Serial filters are
42+ unaffected (recon=2/filter=1 still diverges; recon=1/filter=4 is exact), so this
43+ is the wavefront write recording/replay machinery (lane-wave1 class), not the
44+ filter pipeline, not LR, not entropy. Never covered by any gate — every pixel gate
45+ decodes with default threads.
46+5. FIX: nothing to fix in the LR pipeline. What landed instead is the refutation
47+ pinned as a regression gate: `a_444_sb128_witness_lr_pipeline_flushes_ru_row_
48+ 0_pixel_exact` — serial decode vs `override_filter_threads(4)` decode of the same
49+ pinned fixture, asserting (a) `PIPELINE_TAKEN` delta == 2 (the arm really
50+ pipelined both inter frames; robust against the once-per-process
51+ `filter_threads()` env cache that would otherwise silently serialise the arm),
52+ (b) `LR_PIPELINE_ROW0` delta == 5 (f1 restores all three planes, f2 all but U:
53+ the pipeline's band release flushed RU row 0 that many times), (c) pipelined ==
54+ serial byte-exact on every frame, and (d) frames 0/1 byte-exact vs oracle
55+ aomdec AND ffmpeg THROUGH the pipeline. r4 review hole, fixed: the original (b)
56+ used the thread-local `LR_STRIPE0_HITS`, which the gate's own thread can
57+ satisfy from frame 0's whole-frame LR alone — vacuous as a pipeline witness;
58+ the replacement is a process-global counter bumped by `pipe_run_lr`'s
59+ filter-pool worker itself, so only a real pipeline row-0 flush can move it.
60+ Mutation-verified: hard-disabling the RU-row-0 release in `pipe_run_lr`'s
61+ band walk turns the gate red (row-0 delta 0 and "pipelined frame 1 plane 0
62+ differs", class lr-band-release); reverted, green.
63+6. Gate-extension status for the original acceptance item: extending
64+ `a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact` to assert f2
65+ byte-exact vs aomdec/ffmpeg is **deferred** — f2 is not green and its fix belongs
66+ to the entropy lane (DEFECT A). Unblocks as soon as that fix lands in this
67+ branch's ancestry: change the two `take(2)` arms to `take(3)` in that gate. Its
68+ current scoping comment (naming the LR band release as the residual site) is now
69+ known-stale; left untouched here to keep the lane diff free of another lane's
70+ gate, to be corrected in the same deferred edit.
71+
72+## Verification
73+
74+- `cargo check -p ec-av1`: 0 warnings, 0 errors (target
75+ `$HOME/.cache/cargo-target-av1lrflush`; scoped `rustfmt --check` drift is
76+ repo-wide pre-existing, untouched files fail it identically).
77+- `stream::tests::a_444_sb128_witness_lr_pipeline_flushes_ru_row_0_pixel_exact`: PASS.
78+- `stream::tests::a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact`:
79+ PASS (f0/f1 pins intact).
80+- Restoration battery (`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib
81+ restoration`): 10 passed, 0 failed — includes the 4 real-aomenc gates r2 ran
82+ (`…reads_lr_symbols_correctly`, `…superres_key_frame_with_cdef_and_loop_
83+ restoration…`, `…non_420_subsampled…`, `…skipped_8x8_intra_leaf…`) plus the
84+ 10-bit-stripe and sibling LR gates.
85+- Mutation proof: `pipe_run_lr` band-walk mutated to never release RU row 0 → new
86+ gate FAILED at the pipeline==serial assert; reverted → PASS (red/green cycle in
87+ this lane, target dir reused, rebuild verified by the failure itself).
88+- Stage evidence produced with env-gated dumps on both decoders
89+ (`EC_AV1_PREFILT_DUMP`/`EC_AV1_POSTDEBLOCK_DUMP`/`EC_AV1_POSTCDEF_DUMP`/
90+ `EC_AV1_FINAL_DUMP`, per-frame strided slices, 192x160x3 per frame); all temp
91+ probes and the throwaway example removed before commit.
92+
93+## Decision
94+
95+- LR pipeline: EXONERATED, gate-pinned. No production code changed in
96+ restoration.rs; decode.rs gained only the unconditional `PIPELINE_TAKEN` counter +
97+ accessor (the non-vacuity witness; the wave-stats-gated `PIPE_FRAMES` is not
98+ readable by gates).
99+- DEFECT A: handed to the entropy lane with first-diff coordinates (see Outcome 3);
100+ cross-referenced with Agent044's t6 context-zeroing finding.
101+- DEFECT B: named for a wavefront lane — reproducible 100% (deterministic), chroma
102+ write replay under `EC_AV1_RECON_THREADS>1`; fix owner not this lane.
103+- NOT touched: entropy band stamping / `read_coeffs_rect` / `decode_rect4_16_strip`
104+ (sibling's), the 4:2:0 group-tail chroma SKIP arm (reserved), sub8 rect arm,
105+ leaf8 OOB, wavefront write-replay code.
106+
107+## State
108+
109+- Branch lane-av1-lrflush, commit on top of 48411287 (no push): the gate + the
110+ `PIPELINE_TAKEN` counter + this report.
lanes/av1rect128recon.report.mdadded+88 -0
@@ -0,0 +1,88 @@
1+# lane-av1-rect128recon — the 444_sb128rect witness f2 is byte-exact vs aomdec AND ffmpeg; root cause: the inter-frame intra tail's chroma walk coded ONE whole-plane unit where 4:4:4 codes four TX_32X32 units; gate extended take(2)→take(3) (r1)
2+
3+## Outcome
4+
5+1. REPRODUCED at HEAD 99232190 (fresh target dir `cargo-target-av1rect128recon`,
6+ fixture sha256 `27825e14633a4b23e37d48a2acdc7f5d814ca4fadd0b8797d72a1ffb34061e80`
7+ re-verified, oracle aomdec `~/.cache/aom-oracle/build` regenerated this
8+ session): frame 2 diverges at PREFILT Y 6952 / U 9568 / V 13496, first diffs
9+ Y (col 128, row 98), U (col 128, row 64), V (col 128, row 0); f0/f1 exact.
10+ Numbers match av1444sbf2 r1 / av1lrflush r3 sample-for-sample.
11+2. BLOCK-SHAPE CORRECTION (ladder evidence, not inference): the oracle's f2
12+ top-right superblock root is a gathered-bit SPLIT, and its right column is
13+ INTRA blocks — 64x64 at (128,0), 64x32 at (128,64), 64x32 at (128,96),
14+ 64x64 at (128,128) — not "the inter 64x128 at (128,0)" the earlier lane
15+ reports name. Evidence: oracle `EC_PART`/`EC_PART_VAL` (ctx 14, values
16+ NONE/HORZ at mi (0,32)/(16,32)), `EC_PREDOUT8` per-unit sums, and
17+ `EC_DQCOEFF`. The earlier reports' pixel numbers are all reproduced here;
18+ only the block-shape naming was wrong.
19+3. FIRST DIVERGENT SYMBOL, pinned by consecutive-TU rng alignment on both
20+ ladders (`EC_COEFF_STEP`, TU-boundary values 60168/55581/51541 matching
21+ line-for-line): the 64x64 intra block's FIRST chroma TX_32X32 unit at
22+ mi (0,32). Ours decoded `txb_skip` off the offset-7 context row (printed
23+ ctx 0); aom reads the offset-10 row (true ctx 10 — the uv plane block
24+ 64x64 is larger than the TX_32X32 unit). Same decoded value (skip), but
25+ the CDF rows differ, so the arithmetic coders consumed different bits and
26+ the rest of frame 2 decodes off a drifting state — bounded, mostly-skip
27+ garbage that still corrupted the block's own V plane (uniform −1: the
28+ missing V residual) and the bottom superblock row.
29+4. ROOT CAUSE (one site): `decode_inter_block`'s intra tail read the block's
30+ chroma as ONE whole-plane unit (`read_plane` with `chroma_side`/`chroma_tx`,
31+ block-level `around`, no +10 offset) — a 4:2:0-era remnant. At 4:4:4 a
32+ 64x64 plane block is FOUR plane-major TX_32X32 units, each with its own
33+ `around_mi` context and the offset-10 rows. The keyframe path
34+ (`decode_block`'s `cn > 1` loop, lane-av1-444) and the inter tail's own
35+ ss-0/0 arm already did this correctly; the intra-in-inter tail was the one
36+ remaining copy of the old shape. The misnaming in (2) hid this: the
37+ "inter 64x128" framing pointed at Agent044's strip/inter territory, while
38+ the real site is the intra tail.
39+5. FIX (decode.rs, intra tail chroma chain): new `ss_x==0 && ss_y==0 &&
40+ chroma_side > chroma_tx` arm — four plane-major TX_32X32 units, per-unit
41+ `around_mi(cu_mi, 32)`, `Some(3)` skip-ctx offset (+10 convention on our
42+ chroma-32 table), immediate per-unit `record_mi_chroma`, per-unit
43+ `tu_reach`, assembled 64x64 plane grids, `mu_chroma = true` so the
44+ block-tail unit replay re-stamps after the whole-block record (class
45+ `override-slot-on-one-arm`). 4:2:0 is identical by construction: the arm
46+ is ss-gated and `chroma_side == chroma_tx` there still takes the old
47+ single-read path. Class sweep: the only other intra-in-inter chroma arms
48+ are the side>64 mu-chunk walk (already per-unit, correct) and the
49+ rect-strip readers (separate paths, sibling-owned, untouched).
50+6. RESULT: f2 PREFILT byte-exact; FINAL (full deblock/CDEF/LR pipeline)
51+ byte-exact on ALL THREE frames against BOTH oracles — ours ==
52+ `ffmpeg -f rawvideo -pix_fmt yuv444p` byte-for-byte (276480 bytes), and
53+ frame-equal to aomdec's Y4M output (its 12 interleaved `FRAME` markers
54+ stripped).
55+
56+## Verification
57+
58+- `a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact`
59+ (extended to `.take(3)` in both oracle arms + rewritten scoping comment,
60+ same commit): PASS.
61+- `cargo check -p ec-av1`: 0 warnings (target `$HOME/.cache/cargo-target-av1rect128recon`).
62+- sb128 family (`cargo test -p ec-av1 --lib sb128`): 10 passed, 1 ignored.
63+- 444 family (`--lib 444`): 4 passed (includes the lossless 444
64+ min-partition-64 inter stream).
65+- Restoration battery (`EC_AV1_REQUIRE_AOMENC=1 --lib restoration`):
66+ 10 passed, 0 failed.
67+- chroma family (`--lib chroma`): 28 passed, 0 failed.
68+- Stage evidence from env-gated rungs on both decoders (EC_PART/EC_PART_VAL,
69+ EC_COEFF_STEP, EC_ECDUMP_IN, EC_PREDOUT8, EC_IMODE, AOMMB, EC_DQCOEFF);
70+ throwaway /tmp scratch only, nothing left in the tree.
71+
72+## Decision
73+
74+- Gate extended and the stale "LR never restores RU row 0" scoping comment
75+ replaced (that attribution was refuted in lane-av1lrflush r3 as a
76+ stage-ladder mixup) — the deferred same-commit pairing is now discharged.
77+- Sibling ownership respected: `decode_rect4_16_strip`'s 16x4/strip-tail
78+ territory and the sub-8 leaf paths untouched; the fix lands in
79+ `decode_inter_block`'s intra tail only.
80+- Named for the record: any future block-shape work must sweep BOTH copies
81+ of the chroma unit walk — `decode_block` (keyframe) and
82+ `decode_inter_block`'s intra tail — plus the inter tail; this defect was
83+ the third copy drifting from the first two.
84+
85+## State
86+
87+- Commit on lane-av1-rect128recon (no push): decode.rs fix + stream.rs gate
88+ extension/comment + this report.
lanes/av1refusalaudit.report.mdadded+107 -0
@@ -0,0 +1,107 @@
1+# lane-av1-refusalaudit — the four witness2-proven-unreachable refusals, dispositioned
2+
3+Base: `main` **fe3e8418** (2026-09-26). Worktree `edith_codecs-av1refusalaudit`,
4+branch `lane-av1-refusalaudit`,
5+`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1refusalaudit` (private). No push.
6+Region: `crates/ec-av1/src/refusal_inventory.rs` ONLY — no decoder behaviour
7+change, no refusal string added or removed.
8+
9+## TL;DR
10+
11+The four Wave-2 census refusals that the lane-av1-witness2 hunt
12+(`../edith_codecs-av1witness2/lanes/av1witness2.report.md`, committed on
13+`lane-av1-witness2`; verdict **0 / 4 guards reached** in 31 valid encodes) are
14+now dispositioned PROVEN/unreachable in the inventory, each citing the hunt:
15+
16+| # | Refusal | Disposition |
17+|---|---|---|
18+| 1 | `a 64-axis strip whose chroma unit has no coefficient table` | **NEW PROVEN pair** + new ENUMERATION test (§1) |
19+| 2 | `a rectangular inter luma transform unit whose shape has no coefficient table set here` | already PROVEN (`every_rect_transform_shape_the_census_lists_has_a_coefficient_table_and_scan`); annotation extended with the hunt (§2) |
20+| 3 | `a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding` | already PROVEN (`a_block_shape_census_over_three_real_streams_leaves_the_rect_residual_refusal_unreachable`); annotation extended with the hunt (§3) |
21+| 4 | `a frame whose segmentation enables SEG_LVL_REF_FRAME/SKIP/GLOBALMV (…)` | already PROVEN (`a_frame_whose_segmentation_overrides_a_block_mode_is_refused_by_name`); annotation extended with the hunt (§4) |
22+
23+Untouched, per charter: every refusal with a live witness, and the reserved
24+4:2:0 group-tail chroma SKIP arm.
25+
26+## §1 — the 64-axis strip chroma table guard (new PROVEN entry)
27+
28+`decode.rs:15233`, the `_` arm of the chroma-unit `match` in
29+`decode_block_rect64` (reached only for depth-0, non-skip, non-lossless
30+superblock-level HORZ/VERT/1:4 strips). The witness2 hunt's static reduction:
31+the handled arms `(32,32) (32,16) (16,32) (32,8) (8,32)` cover every conformant
32+strip unit in both supported chroma formats — at 4:4:4 the strip set
33+64x32/32x64/64x16/16x64 tiles to (32,32)/(32,16)/(16,32); at 4:2:0 the halved
34+footprints land on (32,16)/(16,32)/(32,8)/(8,32). A 128-root half is
35+`decode_block_128rect`'s and the 128 root has no 1:4 arm. Dynamically: 8 real
36+aomenc key-frame encodes (screen+intrabc, rect+1:4, sb 64 and 128, cq 10..63,
37+cpu-used 0..2) never reached the arm; the three streams that decode to
38+completion never enter `decode_block_rect64` at all.
39+
40+Encoded as the repo's shape-3 convention (keep the guard, add an ENUMERATION
41+test that derives the gate's own table): new test
42+`every_chroma_unit_a_64_axis_strip_can_present_has_a_coefficient_table` in
43+`refusal_inventory.rs`, which
44+
45+1. derives the caller set from decode.rs itself
46+ (`read_sb128_root`, `decode_intra_rect_in_inter` — a 128-sided or sub-8
47+ caller would invalidate the domain),
48+2. pins the unit derivation spellings (`bw >> ss_x`, the `.min(32)` cap —
49+ asserted unique),
50+3. parses the five arms out of the `match` between the cap and the refusal
51+ string (class `table-and-reader-move-together`) and asserts they equal
52+ exactly the five handled units,
53+4. walks the strip domain (four 64-axis 2:1/1:4 strips × {4:4:4, 4:2:0} — the
54+ mixed formats are refused at the sequence header) through the mirrored
55+ derivation and asserts every combo lands on a handled arm, with
56+ non-vacuity asserted both ways (8 combos checked; every arm hit).
57+
58+PROVEN pairing added:
59+`("a 64-axis strip whose chroma unit has no coefficient table",
60+"every_chroma_unit_a_64_axis_strip_can_present_has_a_coefficient_table")`.
61+
62+## §2 — rect inter luma TU table guard
63+
64+Hunt: 8 encodes (`s2a`..`s2h`), `--enable-tx-size-search=1`, rect+1:4 on,
65+`--min-partition-size=4`, 4:2:0 and 4:4:4, sb 64/128, cq 10..45, cpu-used
66+0..2 — **no refusal**, while the domain was genuinely exercised (whole-block
67+32x8 inter TUs decoded, sub-8 rect pieces decoded). The census enumeration's
68+fourteen rect shapes are the whole alphabet, so the `_` arm has no conformant
69+input. Annotation extended on the existing PROVEN entry.
70+
71+## §3 — the rect residual (HORZ_B) guard
72+
73+Hunt: 8 encodes (`s3a`..`s3h`), banded + busy content, inter,
74+`--max-partition-size=32`, single-ref variant, cq 20..45 — **no refusal**;
75+every rect strip the encoder produced sat inside `rect_inter_residual_supported`.
76+Static half (same hunt, source-read): the supported list plus the partition
77+walker's piece set (SB pieces 64x32/32x64/64x16/16x64, the 32- and 16-level
78+rect/1:4/AB twins, 128 halves tiled as two TX_64X64) enumerate every rect
79+footprint AV1 partitioning can present — 1:4 stops at 64 (the 128 root has no
80+1:4 symbol). Annotation extended on the existing PROVEN entry.
81+
82+## §4 — the segmentation feature guard
83+
84+Hunt: 8 encodes (`s4a`..`s4h`, 7 valid — aq-mode 4 is out of range for this
85+aomenc build): aq-mode 1/2/3, aq-mode 3 + `--delta-lf-mode=1`, 4:4:4, banded —
86+**no refusal**. This aomenc build has **no `--enable-segmentation` flag at
87+all**; aq-mode is the only segmentation driver. Segmentation genuinely enabled
88+in s4a/s4b (`seg=true` on 3/3 frames) and those streams decode clean — the
89+hunt re-confirms the PROVEN annotation's claim ("What aomenc codes is
90+SEG_LVL_ALT_Q tables and segment_id symbols, and nothing else"). Annotation
91+extended on the existing PROVEN entry.
92+
93+## Verification
94+
95+- `cargo check -p ec-av1 --all-targets` — **0 warnings**.
96+- Inventory self-checks green:
97+ `the_decode_path_refuses_exactly_the_listed_cases`,
98+ `every_proven_refusal_names_a_test_that_exists`,
99+ `capability_claims_are_declared_not_scattered`,
100+ `gates_that_swallow_a_decode_error_are_declared`, and the new
101+ `every_chroma_unit_a_64_axis_strip_can_present_has_a_coefficient_table` —
102+ 5 passed, 0 failed.
103+- Inventory numerator: **33 refusals + 1 capability claims, 32 proven**
104+ (before this lane: 31 proven — the 64-axis strip chroma entry was the one
105+ unmeasured refusal of the four; nothing else moved).
106+
107+No fixtures committed; no `/tmp` artefacts referenced by any gate added.
lanes/av1sub8rect444.report.mdadded+95 -0
@@ -0,0 +1,95 @@
1+# lane-av1sub8rect444: the lossless sub-8 rect leaf's 4:4:4 chroma per-unit walk
2+
3+## Ticket
4+
5+`lanes/av1llintercdf.report.md` "Named, not chased" item 1: at the shared state
6+rng=51429 after the 8x4 leaf's luma, the oracle reads the leaf's chroma as
7+FOUR TX_4X4 units (plane 1 bc=0,1 ctx=11 then plane 2 bc=0,1) while
8+`decode_intra_sub8_leaf`'s `chroma_444 && bw != bh` arm read the chroma plane
9+as ONE `TX_8X4`/`TX_4X8` rect unit per plane (`read_coeffs_rect`, skip ctx
10+fixed at above+left where the oracle derives 11≡4). Wrong unit count AND wrong
11+skip ctx. Template: b3f815c8's per-unit 8x8-leaf walk.
12+
13+## Change (decode.rs, one arm + one tail guard + counter)
14+
15+1. `decode_intra_sub8_leaf`'s rect arm now branches on `lossless(fctx)`: the
16+ walk reads the leaf's 8x4/4x8 chroma plane block as a 1x2/2x1 raster of
17+ `TX_4X4` units per plane, PLANE-MAJOR (`av1_get_tx_size`, blockd.h:1383),
18+ via `read_plane` with `TxbSet::Chroma4`, per-unit `around_mi` (per-unit
19+ `get_txb_ctx`), the plane-block-bigger-than-transform `+3` (libaom's +10
20+ rows, so above+left=1 reads row 4 ↔ libaom ctx 11 — the named 11≡4), and
21+ the lossless tx_type drop (`read_plane`'s own `coding.tx_type = None` for
22+ lossless + DCT_DCT force). Units anchor at the leaf's own (px, py) at
23+ 4:4:4, clip past the frame edge like `read_intra_chroma_lossless`, stamp
24+ each unit's own coefficient context with per-unit `record_mi_chroma`
25+ (`av1_set_contexts` per unit), and assemble the leaf grid at stride bw.
26+ CFL is impossible here (the uv read upstream already takes the
27+ 13-symbol `uv_mode_no_cfl` row for this shape at lossless), so no alpha
28+ rides along — the same `None` the template walks pass.
29+2. Tail guard: the whole-leaf `record_mi_chroma(lmi, bw, bh, ...)` is skipped
30+ when the walk stamped per unit — NESTED inside the `chroma_444` branch.
31+ The first cut wrote `if chroma_444 && !stamped { record } else { <4:2:0
32+ group tail> }`, which let a walked leaf fall into the 4:2:0 group tail:
33+ it spans the GROUP's two mi rows/cols with one composed state and
34+ clobbered the walk's own stamps (measured: `above[3][1]` flipped pos→neg
35+ between the walk's stamp and the next leaf's read — the oracle wants the
36+ per-unit value). The nested form skips BOTH branches for the walk.
37+3. Non-vacuity counter `LLSUB8RECT444_CHROMA_WALK_HITS` +
38+ `llsub8rect444_chroma_walk_hits()` + a `decode_probe` line, per the lane
39+ convention (`CHROMA_SPLIT_TX_HITS` cannot attribute its bumps to this
40+ leaf). 4:2:0 is arithmetically identical: the branch lives inside
41+ `chroma_444`, and the non-lossless rect path and the 4:2:0 group tail are
42+ byte-preserved.
43+
44+## Verification (measured, this tree @ HEAD + this change)
45+
46+- Entropy witness, `/tmp/llkf/t6.obu` vs fresh `aomdec`
47+ (`$HOME/.cache/aom-oracle/build`), `EC_ECDUMP_IN` (value,rng) pairing:
48+ pre-change the first mismatching read is #2326 — inside the named leaf's
49+ chroma at mi(0,2). Post-change #2316–#2488 pair 1:1: the named leaf's FOUR
50+ chroma units read exactly the oracle's symbols
51+ ((30281,51429)/(20612,34312)/(33129,58376)/(30377,36104) against oracle
52+ ctx 11≡4), the sibling INTER leaf mi(1,2) and everything after pairs, and
53+ the walk counter fires (15 walks stream-wide, `decode_probe`).
54+ Fail-before: with the rect read in place the leaf desynced at its own
55+ chroma (t6 frame-1 first differing pixel byte 65, 16032 differing bytes).
56+- The stream still diverges — later and at a DIFFERENT block: first
57+ mismatching read #2489, the U unit (2,8) of the 16x4 INTER strip at
58+ mi(2,8): ours reads `txb_skip` ctx 3 (above[8][1]=0, left[2][1]=0) where
59+ the oracle reads ctx 11 with raw cells `above=[0,] left=[23,]`
60+ (`EC_ECDUMP`, the patched oracle's cell dump) — libaom's left[2][1] holds
61+ level 7 / dc 0 from an earlier row-2 writer, ours holds 0. That cell is
62+ written by the 16x16 intra block (0,4)'s chroma band stamping and the
63+ (1,8) 16x4 strip's own tail — `decode_rect4_16_strip` is llcpred's lane.
64+ With the desync now downstream, our decoder refuses honestly at the strip
65+ (`a Golomb tail longer than this decoder reads`) instead of decoding
66+ garbage, so per-frame byte counts are not claimable this round: **t6
67+ frames 1..5 are NOT exact — no exactness claimed.** Frame 0 is untouched
68+ by construction (both callers, `decode_inter_sub8_split4` and
69+ `decode_inter_sub8_rect2`, are inter-frame paths; the key frame never
70+ reaches this arm) and was byte-exact before.
71+- Non-regression: `cargo test -p ec-av1 --lib a_lossless` → 7 passed, 0
72+ failed (both 4:2:0 lossless libaom gates, the 444 min-partition-64 and
73+ min-partition-8 inter gates, the sb128 pair, the 16x4 pair).
74+- `cargo check -p ec-av1 --all-targets` (target dir
75+ `$HOME/.cache/cargo-target-av1sub8rect444`): 0 warnings, 0 errors.
76+ `rustfmt --check` reports no hunks inside the edited ranges (the crate's
77+ pre-existing drift is untouched).
78+- Fixtures are scratch in /tmp/llkf (t6.obu, regenerable per
79+ av1llkf.report.md's recipe) and /tmp/llsub8rect444; nothing committed
80+ from them.
81+
82+## Named, not chased (spoken)
83+
84+1. The t6 next-site: the 16x4 INTER strip's chroma coefficient-context
85+ stamping at 4:4:4 lossless. Measured above (ctx 3 vs 11 on U (2,8);
86+ oracle cells `above=[0] left=[23]`). The row-2 U band state our tree
87+ drops is written by the 16x16-intra/(0,4) stamping and consumed one
88+ superblock later; `decode_rect4_16_strip` is llcpred's lane — per the
89+ ticket this lane stops at the boundary.
90+ deferred(the 16x4 strip's per-unit chroma context stamping at 4:4:4
91+ lossless; unblock: llcpred's decode_rect4_16_strip lane, t6.obu as the
92+ ready-made fixture, first divergent read #2489 = U unit (2,8)).
93+2. Instrument parity: `read_coeffs_rect` still has no `EC_ECDUMP_IN` rung
94+ (av1llintercdf item 2) — this lane's walk bypasses the rect reader
95+ entirely, so the rung was not needed here.
lanes/av1wavefront.report.mdadded+66 -0
@@ -0,0 +1,66 @@
1+# lane-av1wavefront — defect B fixed: the wavefront replay read frame state off a default-seeded `FrameCtx`; 4:4:4 chroma lost, 4:2:0 accidentally exact
2+
3+## Outcome
4+
5+1. DEFECT B (lanes/av1lrflush.report.md) reproduced and fixed at the source.
6+ `EC_AV1_RECON_THREADS>1` diverged from serial at PREFILT, chroma-only, on
7+ `444_sb128rect_lr_witness.obu` (sha256 `27825e14…61e80`, verified): f1 U
8+ 17504 samples (first (0,1)) / V 3 (first (67,29)), f2 U 25472 (first (0,0))
9+ / V 1472 (first (2,128)), Y byte-exact, f0 exact — the report's own numbers,
10+ re-measured off `EC_AV1_PREFILT_DUMP` runs at recon=2/filter=1 vs
11+ recon=1/filter=1.
12+2. ROOT CAUSE — not a stride/plane-index bug in the write records, and not a
13+ lost op: [`wave_worker`] seeds each recon worker with a FRESH
14+ [`FrameCtx`] (`FrameCtx::new()`), carrying only `bit_depth` and
15+ `enable_edge_filter`. Every replay-side read of the frame's chroma
16+ subsampling therefore saw the CONSTRUCTOR DEFAULT `subsampling = (1, 1)`
17+ (4:2:0) regardless of the sequence. On a 4:4:4 stream the deferred chroma
18+ prediction builds read `ss_x(fctx)` at CLOSURE-RUN time —
19+ `mv_to_q4(px, mv.1, ss_x(fctx))` in the sub-8x8 group's `build_c` (and the
20+ same shape in the 4x4-piece and leaf-8 chroma builds) — so every worker
21+ fetched its chroma reference at HALF the true position: the prediction was
22+ wrong, the recorded op replayed faithfully at the wrong content. `exec_intra`'s
23+ CfL AC read (`cfl_ac_ss(.., ss_x(fctx), ss_y(fctx))`) is the same class one
24+ reader over. Serial is exact because there the closure runs at push time on
25+ the parse thread's real context. Every earlier wavefront gate stream is
26+ 4:2:0, where the default happens to BE the frame's pair — the defect was
27+ invisible to the whole existing recon-threads gate set.
28+3. FIX: `WaveState` carries `subsampling: (u8, u8)`; `WaveGuard::install`
29+ copies it from the tile's `FrameCtx` next to `bit_depth`;
30+ `wave_worker` seeds it into the worker context. All replay-side ss readers
31+ (the three `build_c` closure shapes and `exec_intra`'s CfL) are fixed by
32+ the one field; no recorded op changed shape, no push-site read moved.
33+4. Verified:
34+ - recon=2/filter=1 and recon=4/filter=1 now byte-identical to serial on
35+ all three frames of the fixture (`dump_yuv` output compare; the example
36+ binary rebuilt from this tree).
37+ - Serial byte-identical pre/post fix (same compare against the pre-fix
38+ binary's serial run) — the inline path never constructs a `WaveState`.
39+ - Gate: `444_sb128rect_lr_witness.obu` added to
40+ `a_real_stream_reconstructs_identically_with_one_and_four_recon_threads`
41+ (the 1-vs-4 recon-threads byte-exact gate, per-frame Y/U/V asserts).
42+ Mutation-verified: commenting the worker's `subsampling_x/y.set` seed
43+ makes the gate FAIL exactly on the new fixture ("frame 1 U differs at 4
44+ recon threads") while the three 4:2:0 fixtures still pass — the gate is
45+ non-vacuous and discriminates the class. Fix restored, gate green.
46+ - `cargo check -p ec-av1`: 0 warnings.
47+5. CLASS SWEEP (replay-side `FrameCtx` reads on a worker): enumerated every
48+ fctx read reachable from `exec_op` → `exec_intra`/`exec_mc`/PredBuild
49+ closures: `sample_max` (bit_depth — carried), `enable_edge_filter`
50+ (carried), `subsampling` (this fix), and nothing else —
51+ `reconstruct_mc_rect` reads only `sample_max`; `mc::predict`'s
52+ `interp_filter` read is not in any replay path (the deferred builds pass
53+ the explicitly parsed kernels to `predict_maybe_scaled`; the two
54+ `mc::predict` callers are `#[cfg(test)]` gate code). Parse-side ss reads
55+ run on the parse thread's real context and were never wrong.
56+
57+## Not touched
58+
59+- Entropy band stamping / `read_coeffs_rect` / `decode_rect4_16_strip`
60+ (Agent044's defect A territory) — nothing here lands in entropy code.
61+- Osman4's LR pipeline (proven clean; recon=1/filter=4 stays exact).
62+- The 4:2:0 group-tail chroma SKIP arm (reserved to its owning lane).
63+
64+## State
65+
66+Committed on lane-av1-wavefront. No push.
lanes/av1witness2.report.mdadded+155 -0
@@ -0,0 +1,155 @@
1+# lane-av1-witness2: Wave-2 census-shape witness hunt
2+
3+Branch `lane-av1-witness2` at `fe3e8418`. Hunt, not a fix lane: run real aomenc
4+streams at the four Wave-2 census refusals (lanes/av1decode.report.md §4,
5+Wave 2), watch for the refusal string on `decode_probe`, stop each shape after
6+8 encodes. **Verdict: 0 / 4 guards reached** in 31 valid encodes (one slot
7+spent on an invalid `--aq-mode=4` that this aomenc build rejects). Two
8+real-stream PANIC defects were found instead (Annex A) — both 4:4:4-only, both
9+in `decode_block_128rect`'s / `decode_leaf8`'s execution stages, and they cut
10+the 4:4:4 hunting domain short before any parse-level refusal can be evaluated.
11+
12+Method shared by every shape: content generated by ffmpeg 8.1.2 lavfi into
13+`/tmp/av1w2/*.y4m` (busy `testsrc2`, moving banded `geq` content at 8-px and
14+4-px period, mandelbrot `tile=2x2` as screen-ish content), one `aomenc
15+--obu --passes=1 --threads=1` encode per recipe, then
16+`decode_probe <stream.obu>` grepping for the exact refusal string; probe
17+stdout per stream kept as `/tmp/av1w2/<name>.probe`. Encoder:
18+`$HOME/.cache/aom-oracle/build/aomenc`. No fixtures committed; nothing under
19+`crates/ec-av1/fixtures/`.
20+
21+## Shape 1 — "a 64-axis strip whose chroma unit has no coefficient table"
22+
23+Guard: `decode.rs:15233`, the `_` arm of the chroma-unit match in
24+`decode_block_rect64` (reached only for depth==0, non-skip, non-lossless
25+superblock-level HORZ/VERT/1:4 strips). 8 encodes (`s1a`..`s1h`): 4:4:4
26+keyframes, `--tune-content=screen --enable-intrabc=1 --enable-palette=0`,
27+rect+1:4 partitions on, `--min-partition-size=4`, sb 64 and 128, cq 10..63,
28+cpu-used 0..2, `--allintra`, `--kf-max-dist=1` all-key variants. **No refusal;
29+not reached.**
30+
31+Evidence, two parts:
32+
33+1. The three streams that decode to completion (`s1b` bands cq45, `s1f`
34+ bands allintra cq10, `s1h` bands cq63 ×3 keyframes) never enter
35+ `decode_block_rect64` at all: `rect64_corner_tu: 64x32=0 32x64=0` in all
36+ three probes (the strips that fire are the 32-level `rect4_32`
37+ horz=7..16 / vert=8..32, and `intrabc_rect: 1..2`). The five remaining
38+ streams panic before completing (Annex A).
39+2. Static reduction [INFERENCE, source-read]: the handled arms
40+ `(32,32) (32,16) (16,32) (32,8) (8,32)` cover every conformant chroma
41+ footprint of a 64-axis strip in both supported chroma formats — at 4:4:4
42+ the strip set is 64x32/32x64/64x16/16x64 → units (32,32)/(32,16)/(16,32);
43+ at 4:2:0 the halved footprints land on (32,16)/(16,32)/(32,8)/(8,32).
44+ There is no conformant strip whose unit misses the table, which is why no
45+ recipe can reach the arm. A 128-root half (128x64) is a different function
46+ (`decode_block_128rect`), and the 128 root has no 1:4 arm.
47+
48+## Shape 2 — "a rectangular inter luma transform unit whose shape has no coefficient table set here"
49+
50+Guard: `decode.rs:21541`, the `_` arm of `rect_inter_luma_set`. 8 encodes
51+(`s2a`..`s2h`): inter frames, `--enable-tx-size-search=1`, rect+1:4 on,
52+`--min-partition-size=4`, one `--max-partition-size=16` sub-16-only recipe,
53+one single-ref-only recipe (lag 0 + all compound off), 4:2:0 and 4:4:4,
54+cq 10..45, cpu-used 0..2, sb 64/128. **No refusal; not reached.**
55+
56+Evidence: the rect-TU domain was genuinely exercised — `rect_inter: tu=5..10`
57+and whole-block rectangular 32x8 inter TUs decoded (`rect32x8_inter_tu:
58+32x8=3/1` in s2b/s2g, the shape that stopped the pre-lane-rectres film cuts),
59+sub-8 rect pieces `sub8_inter_rect: horz8x4=41 vert4x8=19` (s2g). Static
60+reduction [INFERENCE, source-read]: the match covers all fourteen rect shapes
61+the census lists (2:1 from 8x4 up to the 64-axis adjusted units, 1:4 at 16x4
62+and 32x8, plus 128-root halves tiled as squares) — the census gate
63+`every_rect_transform_shape_the_census_lists_has_a_coefficient_table_and_scan`
64+already carries this claim.
65+
66+## Shape 3 — "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding"
67+
68+Guard: `decode.rs:30489` in `decode_inter_block`, firing only for a
69+`write_w x write_h` footprint outside `rect_inter_residual_supported`
70+(`decode.rs:21396`). 8 encodes (`s3a`..`s3h`): banded + busy content, inter,
71+`--min-partition-size=4`, sb 64/128, `--max-partition-size=32`, 4-px band
72+content, single-ref variant, cq 20..45, cpu-used 0..1. **No refusal; not
73+reached.**
74+
75+Evidence: every rect strip the encoder produced is inside the supported set —
76+`inter_rect: 32x8=8 64x32=2` (s3a/s3f), whole-block 32x8 rect TUs
77+(`rect32x8_inter_tu: 32x8=4..6`), all 8/8 streams decode 4/4 frames OK.
78+`inter_ab16`/`inter_ab64` all 0: this content never even picked an AB arm, so
79+the HORZ_B-naming half of the string was not stressed, but the string can only
80+fire on an *unsupported* footprint, and the supported list plus the walker's
81+piece set (SB pieces 64x32/32x64/64x16/16x64 at 39895-39958, 32-level and
82+16-level rect/1:4/AB twins, 128 halves tiled as two TX_64X64) enumerate every
83+rect footprint AV1 partitioning can present — 1:4 stops at 64 (the 128 root
84+has no 1:4 symbol) [INFERENCE, source-read, matches the census gate
85+`a_block_shape_census_over_three_real_streams_leaves_the_rect_residual_\
86+refusal_unreachable`].
87+
88+## Shape 4 — "a frame whose segmentation enables SEG_LVL_REF_FRAME/SKIP/GLOBALMV"
89+
90+Guard: `stream.rs:1483`, per frame header. This aomenc build has **no
91+`--enable-segmentation` flag**; `--aq-mode` is the segmentation driver. 8
92+encodes (`s4a`..`s4h`): aq-mode 1/2/3 (4 is out of range for this build —
93+`aq_mode out of range [..AQ_MODE_COUNT - 1]`, the slot's encode never ran),
94+aq-mode 3 + `--delta-lf-mode=1`, aq-mode 2 + cq45, 4:4:4 aq-mode 3, banded
95+aq-mode 3. **No refusal; not reached.**
96+
97+Evidence: segmentation was genuinely enabled in s4a/s4b (`EC_PROBE_HDR`:
98+`seg=true` on 3/3 frames, aq-mode 1 and 2) and those streams decode clean —
99+matching the PROVEN annotation ("What aomenc codes is SEG_LVL_ALT_Q tables and
100+segment_id symbols, and nothing else"). Cyclic refresh (aq-mode 3) did not
101+engage on this content (`seg=false`). No aq recipe made the encoder write any
102+of the three mode/reference/skip segment features.
103+
104+## Annex A — two real-stream panic defects found by the hunt (not fixed here)
105+
106+Both are 4:4:4-only; all sixteen 4:2:0 streams decoded clean. They are a
107+distinct class from the hunted refusals — a crash, not a named refusal — and
108+they bound every future 4:4:4 hunt: the probe dies mid-frame, so any
109+parse-level refusal downstream of the panic point is untestable on such
110+content until these are fixed.
111+
112+**P1 — `decode.rs:17631` assert in `decode_block_128rect`.**
113+`assertion failed: lossless_frame || (chroma_w / chroma_tx, chroma_h /
114+chroma_tx) == (nch_x, nch_y)` — the chroma tiling invariant of a 128-root
115+HORZ/VERT strip at 4:4:4. Stream: `/tmp/av1w2/s1d.obu`, 595 bytes,
116+sha256 `68773f2c6e01a2d211bf0213479accb4c2c360132c0e1bc3b326eab7861925b1`:
117+
118+```
119+ffmpeg -f lavfi -i "nullsrc=s=320x256:rate=30:d=1,geq=lum='mod(floor((Y+T*160)/8)*67,255)':cb='128+20*sin(Y/17+T)':cr='128+20*sin(X/23+T*2)'" -pix_fmt yuv444p bands444.y4m
120+aomenc --codec=av1 --obu -o /tmp/av1w2/s1d.obu --passes=1 --threads=1 bands444.y4m \
121+ --limit=3 --kf-max-dist=1 --cpu-used=2 --end-usage=q --cq-level=20 --sb-size=128 \
122+ --enable-rect-partitions=1 --enable-1to4-partitions=1 --min-partition-size=4
123+```
124+
125+**P2 — `decode.rs:3766` index OOB in `PlaneBuf::reconstruct`.**
126+`index out of bounds: the len is 16 but the index is 16`, frames
127+`reconstruct ← exec_intra ← push_intra_tx/read_plane ← decode_leaf8 ←
128+decode_key_frame_tile_with_cdfs` — an 8x8 key-frame leaf whose prediction
129+mode reaches the reconstruct dispatch outside its 16-entry table, 4:4:4 only.
130+Smallest stream: `/tmp/av1w2/s1e.obu`, 3577 bytes, sha256
131+`72bed2791d1ceba8be7926a052c7838c5d96d4f9d56d28fb69789a753d3593af`:
132+
133+```
134+ffmpeg -f lavfi -i testsrc2=size=320x256:rate=30:duration=1 -pix_fmt yuv444p busy444.y4m
135+aomenc --codec=av1 --obu -o /tmp/av1w2/s1e.obu --passes=1 --threads=1 busy444.y4m \
136+ --limit=3 --cpu-used=0 --end-usage=q --cq-level=45 --sb-size=64 \
137+ --enable-rect-partitions=1 --enable-1to4-partitions=1 --min-partition-size=4
138+```
139+
140+Same panic also fires on `s1a.obu` (screen+intrabc recipe, sha256
141+`5cfcb15027947acddf9a74d26ac04a2dd95ee64b48434424ab48b54715ff19fb`) and
142+`s2e.obu` (inter-grid recipe, sha256
143+`e5d89be7a394b470e57133372e4da32084dae546294f38430947902d85fc4221`).
144+
145+## Per-shape summary
146+
147+| # | Guard | Encodes | Reached | Refusal fired |
148+|---|---|---|---|---|
149+| 1 | 64-axis strip chroma without table (`decode.rs:15233`) | 8 | no | none |
150+| 2 | rect inter luma TU without table (`decode.rs:21541`) | 8 | no | none |
151+| 3 | non-skip rect strip needs rect residual (`decode.rs:30489`) | 8 | no | none |
152+| 4 | segmentation REF_FRAME/SKIP/GLOBALMV (`stream.rs:1483`) | 8 (7 valid) | no | none |
153+
154+No code edited; no fixtures committed. Repro streams and probe logs live under
155+`/tmp/av1w2/`.
scripts/instrument-aom-oracle.shmodified+70 -0
@@ -40,6 +40,13 @@
4040 # its superres margin (lane-superres r5: hand-tracing the arithmetic
4141 # could only prove our own self-consistency, not correctness against
4242 # libaom).
43+# EC_AV1_POSTCDEF_DUMP=<prefix> -> <prefix>.f<N> per frame, same shape as
44+# the POSTDEBLOCK rung (full ALIGNED-buffer rows), written right after
45+# the CDEF pass and before superres/LR -- splits a final-output
46+# mismatch into "already in CDEF" vs "introduced by loop restoration"
47+# without the 16-bit-only DUMP16 rungs (lane-av1422filter: on the
48+# pinned 4:2:2 keyframe this named the 251/259-sample CDEF chroma
49+# defect whose first samples were the ticket's first final samples).
4350 # EC_TRACE_MODE_STEP=1 -> per-symbol range ladder inside
4451 # ec_read_intra_frame_mode_info_impl (rung 5's renamed body):
4552 # "EC_ISTEP mi_row=.. mi_col=.. name=skip val=.. rng=.." after
@@ -832,3 +839,66 @@ s = s.replace(anchor, anchor + dump, 1)
832839 open(path, "w").write(s)
833840 print("decodemv rung 14 (per-entry EC_STACK) instrumented")
834841 PYST
842+
843+# --- rung 15: post-CDEF, pre-superres 8-bit row dump (lane-av1422filter) ---
844+# The 8-bit mirror of rung 6 one stage later: written right after the CDEF
845+# pass (the `if (do_cdef) {...}` block) and before superres/LR, so a final
846+# chroma/luma mismatch splits into "already in CDEF" vs "introduced by
847+# loop restoration". The *_DUMP16 family covers this stage only in 16-bit
848+# builds (its 8-bit run SEGFAULTS); this rung is the 8-bit one. lane-
849+# av1422filter added it to the live oracle tree by hand first, then it was
850+# transcribed here (class: instrument that lives only in a build tree).
851+python3 - "$F" <<'PYC'
852+import sys
853+path = sys.argv[1]
854+s = open(path).read()
855+if "EC_INSTRUMENTED_POSTCDEF" in s:
856+ print("postcdef dump already instrumented (no-op)")
857+ sys.exit(0)
858+
859+anchor = """ if (do_cdef) {
860+ if (pbi->num_workers > 1) {
861+ av1_cdef_frame_mt(cm, &pbi->dcb.xd, pbi->cdef_worker,
862+ pbi->tile_workers, &pbi->cdef_sync,
863+ pbi->num_workers, av1_cdef_init_fb_row_mt,
864+ do_extend_border_mt);
865+ } else {
866+ av1_cdef_frame(&pbi->common.cur_frame->buf, cm, &pbi->dcb.xd,
867+ av1_cdef_init_fb_row);
868+ }
869+ }
870+"""
871+dump = """
872+ /* EC_INSTRUMENTED_POSTCDEF (8-bit twin of the POSTDEBLOCK rung:
873+ * full aligned buffer, post-CDEF pre-superres/LR) */
874+ {
875+ const char *ec_dump = getenv("EC_AV1_POSTCDEF_DUMP");
876+ if (ec_dump) {
877+ static int ec_postcdef_idx = 0;
878+ char ec_path[1024];
879+ snprintf(ec_path, sizeof(ec_path), "%s.f%d", ec_dump,
880+ ec_postcdef_idx++);
881+ FILE *ec_f = fopen(ec_path, "wb");
882+ if (ec_f) {
883+ const YV12_BUFFER_CONFIG *ec_b = &cm->cur_frame->buf;
884+ for (int ec_r = 0; ec_r < ec_b->y_height; ++ec_r)
885+ fwrite(ec_b->y_buffer + ec_r * ec_b->y_stride, 1, ec_b->y_width,
886+ ec_f);
887+ if (num_planes > 1) {
888+ for (int ec_r = 0; ec_r < ec_b->uv_height; ++ec_r)
889+ fwrite(ec_b->u_buffer + ec_r * ec_b->uv_stride, 1,
890+ ec_b->uv_width, ec_f);
891+ for (int ec_r = 0; ec_r < ec_b->uv_height; ++ec_r)
892+ fwrite(ec_b->v_buffer + ec_r * ec_b->uv_stride, 1,
893+ ec_b->uv_width, ec_f);
894+ }
895+ fclose(ec_f);
896+ }
897+ }
898+ }
899+"""
900+assert anchor in s, "do_cdef block anchor moved"
901+s = s.replace(anchor, anchor + dump, 1)
902+open(path, "w").write(s)
903+print("postcdef dump instrumented")
904+PYC