forge
Explore
Log in

Don't you dare go Hollow

lane-av1subsizesweep r2: a real witness, a derived read-spelling scan, a scoped census

Browse files at this commit

bee9cbf5249cd8811cb0d49d15072a7a4328b302Ahmet Kaan GümüşParent: 67c524e
Main's r2 review was right on all counts. Fixed, plus the three items still
open from r1.

WITNESS. There is one, and the earlier "no witness exists" claim was wrong.
422_header_edge16_walk.obu (128 bytes) is a 4:2:2 sequence header over a 4:2:0
key frame's tile at 88x64. Width 88 is 8 mod 16, so the last 16x16 column block
is column-short and the frame-edge arm fires; height 64 is 16-aligned, so the
both-cut arm is not taken. aomdec says:

    Block size 8x16 invalid with this subsampling mode

and so do we. What makes this pin different from every other refusal gate here
is that the 8x16 is the ONLY offending subsize in the stream: over a
260-candidate sweep (4 card textures x 5 quantizers x 13 declared widths) it is
the one candidate whose decode with the guard DELETED SUCCEEDS -- the decoder
returned a full 88x64 picture where libaom refuses the frame. So the guard is
load-bearing, not a redundant second refusal, and the new gate reds when it is
deleted.

The witness had to be built from this crate's own encoder with a DECLARED width
(encode_key_frame_at_size, the gen_coverage_cells cell-2 construction): aomenc
rounds the coded size to even and never declares 88. That also corrects the
report: my earlier `partition_rect_allowed` explanation for the aomenc non-hit
was WRONG -- that gate governs the encoder's partition search, whereas this
arm's partition comes from a single gathered bit after a frame-edge geometry
test. Why aomenc never produces the shape is not known. Severity is a
false-accept, not a pixel divergence: libaom refuses the whole frame, so there
is no correct output to diverge from.

MATCHER GAP WIDENED, AND DERIVED. A partition-symbol READ is now defined as a
`dec.<name>(..)` call whose OWN ARGUMENT LIST names a `partition_w<N>[` CDF.
That needs no hand-list: `dec.symbol(..partition_w..)` qualifies, the frame-edge
gather's `dec.symbol_fixed(&gather(..partition_w..))` qualifies, and
`dec.debug_state()` does not. The old test's read test was the literal
`dec.symbol(`, which is not a substring of `dec.symbol_fixed(` -- that spelling
gap is what hid the hole. The `var == "b"` skip is gone too: edge reads are
sites now and must carry a guard for their own level before the first
chroma-walking dispatch after them. Stated limitation: the definition is
syntactic, so a read reaching a partition CDF through a helper that does not
name it would not be enumerated; there is no such call in this file.

CENSUS ROWS NOW CLAIM A REAL GUARD. r2 was right that AtResolution asserted only
that some shape was BLOCK_INVALID and never mentioned a guard, so rows 5-12 and
19's guard column were prose. A resolution row now CARRIES the guard it depends
on -- (function scope, level) -- and the check looks for
refuse_invalid_subsize((L,L)) inside that function and before the walk's first
call there. Per-guard deletion now reds the census on its own for ten of the
twelve guards. Two are claimed by LEVEL, not by site -- the key-frame 8x8 second
resolution and the inter decoder's own 128-root -- and are caught instead by the
merged scan's resolution-count cross-check; the report says so rather than
papering over it. Three inter rows were added, because the inter 32- and
64-level guards were previously claimed by nothing at all.

ORDERING CHECK NO LONGER VACUOUS. The per-route loop resolved each pair's guard
with find() over the whole decode body, which returns the FIRST 16x16 guard --
the key-frame one -- so the inter pair was satisfied by a guard three quarters
of the file away and deleting the inter guard left it green. Each pair now
scopes its guard search to its own enclosing function. Verified: deleting the
inter 16-level guard at 54809 reds naming decode_intra_rect_in_inter.

ALSO: the stale inter-edge citation (54720/54733 -> the reads, 54777/54790), a
one-line note that two edits leaked into the primary through relative paths and
were reverted before any commit, and the headline that the find came from
censusing WALK sites rather than SYMBOL sites -- that reframing is the only
reason the hole was visible.

cargo check --tests clean. 28 named 422/sub8/subsize/chroma_422 tests pass
(includes the new witness gate). 270 pixel_exact/byte_exact pass, which is the
over-refusal control at scale.
crates/ec-av1/fixtures/422_header_edge16_walk.obuadded+0 -0

Binary file changed

crates/ec-av1/src/decode.rsmodified+276 -42
@@ -21454,8 +21454,11 @@ const PLANE_BLOCK_INVALID_440: &[(usize, usize)] = &[
21454 21454
21455 /// Whether `av1_ss_size_lookup[(bw, bh)][sx][sy]` is not `BLOCK_INVALID` -- i.e.21455 /// Whether `av1_ss_size_lookup[(bw, bh)][sx][sy]` is not `BLOCK_INVALID` -- i.e.
21456 /// whether libaom lets a subsize of this luma shape have a chroma plane block21456 /// whether libaom lets a subsize of this luma shape have a chroma plane block
21457-/// at this subsampling at all.21457+/// at this subsampling at all. `pub(crate)` so a fixture gate in `stream.rs`
21458-fn chroma_plane_block_codable(bw: usize, bh: usize, sx: usize, sy: usize) -> bool {21458+/// can assert WHICH shape its pin carries, rather than only that the decode
21459+/// refused -- a refusal gate that cannot name the shape is one decode-site
21460+/// change away from measuring the wrong thing.
21461+pub(crate) fn chroma_plane_block_codable(bw: usize, bh: usize, sx: usize, sy: usize) -> bool {
21459 match (sx, sy) {21462 match (sx, sy) {
21460 (1, 0) => !PLANE_BLOCK_INVALID_422.contains(&(bw, bh)),21463 (1, 0) => !PLANE_BLOCK_INVALID_422.contains(&(bw, bh)),
21461 (0, 1) => !PLANE_BLOCK_INVALID_440.contains(&(bw, bh)),21464 (0, 1) => !PLANE_BLOCK_INVALID_440.contains(&(bw, bh)),
@@ -37064,12 +37067,12 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
37064 // dispatches on its own symbol instead of37067 // dispatches on its own symbol instead of
37065 // resolving it into a `partN` the level's guard37068 // resolving it into a `partN` the level's guard
37066 // covers. The 128-root edge arms37069 // covers. The 128-root edge arms
37067- // (decode.rs:35551/35559), the 64-level ones37070+ // (decode.rs:35559/35567), the 64-level ones
37068- // (36239/36256) and the 32-level ones37071+ // (36247/36264) and the 32-level ones
37069- // (36363/36383) all end in `PARTITION_HORZ` /37072+ // (36371/36391) all end in `PARTITION_HORZ` /
37070 // `PARTITION_VERT` / `PARTITION_SPLIT`, which37073 // `PARTITION_VERT` / `PARTITION_SPLIT`, which
37071 // the guard after their `match` sees -- the37074 // the guard after their `match` sees -- the
37072- // inter-frame 16-level edge arms (54720/54733)37075+ // inter-frame 16-level edge arms (54777/54790)
37073 // resolve into `part16` for the same reason.37076 // resolve into `part16` for the same reason.
37074 // Here `edge_split` goes straight into37077 // Here `edge_split` goes straight into
37075 // `decode_leaf_rect`, and the shape it carries is37078 // `decode_leaf_rect`, and the shape it carries is
@@ -56733,6 +56736,57 @@ mod tests {
56733 }56736 }
56734 }56737 }
56735 }56738 }
56739+ // r11 (lane-av1subsizesweep): a partition-symbol READ is a `dec.<name>(..)`
56740+ // call whose OWN ARGUMENT LIST names a `partition_w<N>[` CDF. That is the
56741+ // whole definition, and it is why the read spellings need no hand-list:
56742+ // `dec.symbol(..partition_w..)` qualifies, the frame-edge gather's
56743+ // `dec.symbol_fixed(&gather(..partition_w..))` qualifies, and
56744+ // `dec.debug_state()` does not -- it never names a partition CDF. A third
56745+ // spelling is covered the day somebody writes it.
56746+ //
56747+ // r11's hole was a SPELLING gap, not a shape gap: the old matcher named
56748+ // `dec.symbol(` literally, and `dec.symbol(` is not a substring of
56749+ // `dec.symbol_fixed(`. So the key-frame 16-level frame-edge arm -- which
56750+ // dispatches `decode_leaf_rect` straight off a gathered `edge_split` onto
56751+ // a BLOCK_8X16 chroma walk -- was never a site at all.
56752+ let is_partition_read = |window: &str| -> bool {
56753+ let mut at = 0usize;
56754+ while let Some(rel) = window[at..].find("dec.") {
56755+ let call = at + rel + "dec.".len();
56756+ at = call;
56757+ let name: String = window[call..]
56758+ .chars()
56759+ .take_while(|c| c.is_ascii_alphanumeric() || *c == '_')
56760+ .collect();
56761+ if name.is_empty() {
56762+ continue;
56763+ }
56764+ let Some(open) = window[call + name.len()..].find('(') else {
56765+ continue;
56766+ };
56767+ let arg_from = call + name.len() + open + 1;
56768+ let mut depth = 1usize;
56769+ let mut stop = None;
56770+ for (i, c) in window[arg_from..].char_indices() {
56771+ match c {
56772+ '(' => depth += 1,
56773+ ')' => {
56774+ depth -= 1;
56775+ if depth == 0 {
56776+ stop = Some(arg_from + i);
56777+ break;
56778+ }
56779+ }
56780+ _ => {}
56781+ }
56782+ }
56783+ let Some(stop) = stop else { continue };
56784+ if window[arg_from..stop].contains("partition_w") {
56785+ return true;
56786+ }
56787+ }
56788+ false
56789+ };
56736 for (n, line) in lines.iter().enumerate() {56790 for (n, line) in lines.iter().enumerate() {
56737 let t = line.trim_start();56791 let t = line.trim_start();
56738 // A doc comment quoting the shape is not a site, and neither is the56792 // A doc comment quoting the shape is not a site, and neither is the
@@ -56743,7 +56797,9 @@ mod tests {
56743 let lo = n.saturating_sub(1);56797 let lo = n.saturating_sub(1);
56744 let hi = (n + 2).min(lines.len());56798 let hi = (n + 2).min(lines.len());
56745 let window = lines[lo..hi].join(" ");56799 let window = lines[lo..hi].join(" ");
56746- if !window.contains("dec.symbol(") {56800+ // r11: the read test is the DERIVED predicate above, not a spelling
56801+ // literal. Naming `dec.symbol(` here is what hid the frame-edge arm.
56802+ if !is_partition_read(&window) {
56747 continue;56803 continue;
56748 }56804 }
56749 let Some(i) = window.find("partition_w") else {56805 let Some(i) = window.find("partition_w") else {
@@ -56778,23 +56834,25 @@ mod tests {
56778 continue;56834 continue;
56779 }56835 }
56780 // This binding is followed by the symbol read if the SAME line56836 // This binding is followed by the symbol read if the SAME line
56781- // completes `let <name> = dec.symbol(`, or if the next line starts56837+ // completes `let <name> = dec.<spelling>(`, or if the next line
56782- // the call. That is what separates `let part8 =` from an unrelated56838+ // starts the call. That is what separates `let part8 =` from an
56783- // `let ec_dbg_pre =` two lines above it.56839+ // unrelated `let ec_dbg_pre =` two lines above it.
56784 let next = lines.get(cand + 1).copied().unwrap_or("");56840 let next = lines.get(cand + 1).copied().unwrap_or("");
56785- let binds_here = ct.contains("= dec.symbol") || next.contains("dec.symbol(");56841+ let binds_here = ct.contains("= dec.") || next.contains("dec.");
56786 if binds_here || cand == n {56842 if binds_here || cand == n {
56787 var = Some(name);56843 var = Some(name);
56788 break;56844 break;
56789 }56845 }
56790 }56846 }
56791 let Some(var) = var else { continue };56847 let Some(var) = var else { continue };
56792- // An edge `gather` binds `b` and is not a resolution: libaom resolves56848+ // r11: the edge `gather` reads are SITES now, not skips. r10 skipped
56793- // those from a two-symbol CDF and the site is guarded at the level's56849+ // them on the reasoning that "the site is guarded at the level's own
56794- // own resolution instead.56850+ // resolution instead" -- true for every arm that resolves into a
56795- if var == "b" {56851+ // `partN`, and FALSE for the one that does not: the key-frame 16-level
56796- continue;56852+ // frame-edge arm dispatches `decode_leaf_rect` straight off `edge_split`,
56797- }56853+ // and `BLOCK_8X16` is BLOCK_INVALID at 4:2:2. Every site therefore has
56854+ // to carry a guard for its OWN level between the read and the first
56855+ // chroma-walking dispatch after it -- see the per-site check below.
56798 sites.push((n, var, level));56856 sites.push((n, var, level));
56799 }56857 }
56800 56858
@@ -57093,6 +57151,15 @@ mod tests {
57093 /// and this test is what makes that a checked claim instead of a comment.57151 /// and this test is what makes that a checked claim instead of a comment.
57094 #[test]57152 #[test]
57095 fn every_chroma_walking_leaf_dispatch_is_guarded_or_closed_with_a_reason() {57153 fn every_chroma_walking_leaf_dispatch_is_guarded_or_closed_with_a_reason() {
57154+ let src = include_str!("decode.rs");
57155+ // r2: `decode_body` is hoisted to the top of the test because the per-row
57156+ // guard check below needs it BEFORE the walk census it sits under, and a
57157+ // reader who has to hunt for a binding is a reader who will not notice
57158+ // when it is scoped to the wrong thing.
57159+ let decode_body = match src.find("\n#[cfg(test)]\nmod tests {") {
57160+ Some(i) => &src[..i],
57161+ None => src,
57162+ };
57096 // (a) The shapes libaom cannot code, transcribed from the same57163 // (a) The shapes libaom cannot code, transcribed from the same
57097 // `av1_ss_size_lookup` cells `PLANE_BLOCK_INVALID_422` carries. A walk57164 // `av1_ss_size_lookup` cells `PLANE_BLOCK_INVALID_422` carries. A walk
57098 // handed one of these at the matching subsampling mode is the defect.57165 // handed one of these at the matching subsampling mode is the defect.
@@ -57115,11 +57182,33 @@ mod tests {
57115 // a guard.57182 // a guard.
57116 //57183 //
57117 // Each row is (walk, shapes, mechanism).57184 // Each row is (walk, shapes, mechanism).
57185+ //
57186+ // r2 (Main's review, and it was right): `AtResolution` used to assert
57187+ // only that SOME shape the walk handles is BLOCK_INVALID, which
57188+ // restates the libaom table and never mentions a guard -- deleting the
57189+ // inter 32-level guard left it green. So a resolution row now CARRIES
57190+ // the guard it depends on: `(walk, fn-scope, level)`, and the check
57191+ // below looks for `refuse_invalid_subsize((level, level))` inside that
57192+ // function and before the walk's first call site in it. A row that
57193+ // cannot be checked that way says so with `Prose` instead.
57118 enum Mech {57194 enum Mech {
57119 AtDispatch,57195 AtDispatch,
57120- AtResolution,57196+ /// Protected by `refuse_invalid_subsize((L, L))` in the named
57197+ /// function, above the walk's first call site there.
57198+ AtResolution(&'static str, usize),
57199+ /// The walk is reached INDIRECTLY -- this row's guard is asserted to
57200+ /// exist in `fscope`, and the ordering is asserted by the per-route
57201+ /// loop further down (which scopes to the enclosing function and
57202+ /// names this walk's real caller chain). Used only where the walk's
57203+ /// call site is not in the guard's own function.
57204+ AtResolutionVia(&'static str, usize),
57121 Unreachable(&'static str),57205 Unreachable(&'static str),
57122 }57206 }
57207+ // The key-frame tile decoder and the inter tile decoder. Every
57208+ // resolution guard lives in one of the two, which is what makes "the
57209+ // guard for THIS row" a scoped lookup rather than a global one.
57210+ const KF: &str = "decode_key_frame_tile_with_cdfs";
57211+ const INTER: &str = "decode_inter_frame_tile_with_cdfs";
57123 let census: &[(&str, &[(usize, usize)], Mech)] = &[57212 let census: &[(&str, &[(usize, usize)], Mech)] = &[
57124 // ---- the residue the merged lane named -------------------57213 // ---- the residue the merged lane named -------------------
57125 //57214 //
@@ -57142,52 +57231,101 @@ mod tests {
57142 (57231 (
57143 "decode_rect4_16_intrabc",57232 "decode_rect4_16_intrabc",
57144 &[(16, 4), (4, 16)],57233 &[(16, 4), (4, 16)],
57145- Mech::AtResolution,57234+ Mech::AtResolutionVia(KF, 16),
57146 ),57235 ),
57147 // ---- 1:4 and 2:1 rect walks, all resolved-symbol guarded --57236 // ---- 1:4 and 2:1 rect walks, all resolved-symbol guarded --
57148- ("decode_rect4_16", &[(16, 4), (4, 16)], Mech::AtResolution),57237+ (
57238+ "decode_rect4_16",
57239+ &[(16, 4), (4, 16)],
57240+ Mech::AtResolution(KF, 16),
57241+ ),
57149 (57242 (
57150 "decode_rect4_16_strip",57243 "decode_rect4_16_strip",
57151 &[(16, 4), (4, 16)],57244 &[(16, 4), (4, 16)],
57152- Mech::AtResolution,57245+ Mech::AtResolutionVia(KF, 16),
57153 ),57246 ),
57154 (57247 (
57155 "decode_block_rect",57248 "decode_block_rect",
57156 &[(32, 16), (16, 32)],57249 &[(32, 16), (16, 32)],
57157- Mech::AtResolution,57250+ Mech::AtResolution(KF, 32),
57158 ),57251 ),
57159 (57252 (
57160 "decode_block_rect4",57253 "decode_block_rect4",
57161 &[(32, 8), (8, 32)],57254 &[(32, 8), (8, 32)],
57162- Mech::AtResolution,57255+ Mech::AtResolution(KF, 32),
57163 ),57256 ),
57164 (57257 (
57165 "decode_block_rect64",57258 "decode_block_rect64",
57166 &[(64, 16), (16, 64)],57259 &[(64, 16), (16, 64)],
57167- Mech::AtResolution,57260+ Mech::AtResolution(KF, 64),
57168 ),57261 ),
57262+ // The 128-root guard lives in `read_sb128_root`, the shared
57263+ // resolver both tile decoders call -- not in the walker's own
57264+ // function.
57169 (57265 (
57170 "decode_block_128rect",57266 "decode_block_128rect",
57171 &[(128, 64), (64, 128)],57267 &[(128, 64), (64, 128)],
57172- Mech::AtResolution,57268+ Mech::AtResolutionVia("read_sb128_root", 128),
57173 ),57269 ),
57270+ // `decode_rect_split` is called from inside decode_block_rect /
57271+ // decode_leaf_rect / decode_block_rect4 / decode_block_rect64, none of
57272+ // which is the tile decoder -- so the guard it inherits is checked on
57273+ // its own callers' rows, not here.
57174 (57274 (
57175 "decode_rect_split",57275 "decode_rect_split",
57176 &[(64, 16), (16, 64), (32, 16), (16, 32)],57276 &[(64, 16), (16, 64), (32, 16), (16, 32)],
57177- Mech::AtResolution,57277+ Mech::AtResolutionVia(KF, 32),
57278+ ),
57279+ (
57280+ "decode_leaf_rect",
57281+ &[(16, 8), (8, 16)],
57282+ Mech::AtResolution(KF, 16),
57283+ ),
57284+ // ---- the INTER-side rect walks -----------------------------
57285+ //
57286+ // r2: without these three rows the inter 32- and 64-level guards
57287+ // were claimed by NOTHING, and deleting either left the census
57288+ // green. They are load-bearing -- `decode_intra_rect_in_inter`
57289+ // dispatches `decode_block_rect4` on 32x8/8x32 (8x32 is
57290+ // BLOCK_INVALID at 4:2:2) and `decode_block_rect64` on
57291+ // 64x16/16x64 (16x64 likewise) -- so each gets its own row naming
57292+ // the guard that stands in front of it.
57293+ //
57294+ // These are `AtResolutionVia`, not `AtResolution`: the walk is
57295+ // dispatched from `decode_intra_rect_in_inter`, a helper, not from
57296+ // the tile decoder the guard lives in. The check is therefore guard
57297+ // EXISTENCE in that decoder -- which is what reds when the guard
57298+ // is deleted -- and the linkage is stated here rather than derived.
57299+ (
57300+ "decode_block_rect4[inter]",
57301+ &[(32, 8), (8, 32)],
57302+ Mech::AtResolutionVia(INTER, 32),
57303+ ),
57304+ (
57305+ "decode_block_rect64[inter]",
57306+ &[(64, 16), (16, 64)],
57307+ Mech::AtResolutionVia(INTER, 64),
57308+ ),
57309+ (
57310+ "decode_intra_rect_in_inter",
57311+ &[(16, 8), (8, 16), (16, 4), (4, 16)],
57312+ Mech::AtResolutionVia(INTER, 16),
57178 ),57313 ),
57179- ("decode_leaf_rect", &[(16, 8), (8, 16)], Mech::AtResolution),
57180 // ---- sub-8 walks ------------------------------------------57314 // ---- sub-8 walks ------------------------------------------
57181 // (8,4) is legal at 4:2:2 (`av1_ss_size_lookup[8x4][1][0]` is57315 // (8,4) is legal at 4:2:2 (`av1_ss_size_lookup[8x4][1][0]` is
57182 // BLOCK_4X4); (4,8) is BLOCK_INVALID there. Both come off a raw57316 // BLOCK_4X4); (4,8) is BLOCK_INVALID there. Both come off a raw
57183 // `part8`, and both 8x8 resolution sites carry the guard -- plus57317 // `part8`, and both 8x8 resolution sites carry the guard -- plus
57184 // the redundant inline `chroma_plane_block_codable` check the57318 // the redundant inline `chroma_plane_block_codable` check the
57185 // merged lane left at 36904.57319 // merged lane left at 36904.
57186- ("decode_leaf_rect8", &[(8, 4), (4, 8)], Mech::AtResolution),57320+ (
57321+ "decode_leaf_rect8",
57322+ &[(8, 4), (4, 8)],
57323+ Mech::AtResolution(KF, 8),
57324+ ),
57187 (57325 (
57188 "decode_inter_sub8_rect2",57326 "decode_inter_sub8_rect2",
57189 &[(8, 4), (4, 8)],57327 &[(8, 4), (4, 8)],
57190- Mech::AtResolution,57328+ Mech::AtResolution(INTER, 8),
57191 ),57329 ),
57192 (57330 (
57193 "decode_leaf_split4",57331 "decode_leaf_split4",
@@ -57249,7 +57387,6 @@ mod tests {
57249 // (c) Every row's mechanism must be a REAL one. This is what stops57387 // (c) Every row's mechanism must be a REAL one. This is what stops
57250 // the census from being a list of good intentions: each claim is57388 // the census from being a list of good intentions: each claim is
57251 // re-derived here, and the file is checked for the site it names.57389 // re-derived here, and the file is checked for the site it names.
57252- let src = include_str!("decode.rs");
57253 for (walk, shapes, mech) in census {57390 for (walk, shapes, mech) in census {
57254 let name = walk.split('[').next().expect("walk name");57391 let name = walk.split('[').next().expect("walk name");
57255 assert!(57392 assert!(
@@ -57293,11 +57430,77 @@ mod tests {
57293 );57430 );
57294 }57431 }
57295 }57432 }
57296- Mech::AtResolution => {57433+ // r2: the guard THIS row depends on, scoped to the function it
57434+ // lives in and ordered before the walk's first call there.
57435+ // Deleting that one guard -- and only that one -- reds this row,
57436+ // which is what r2's review showed the previous version could
57437+ // not do.
57438+ Mech::AtResolution(fscope, level) => {
57297 assert!(57439 assert!(
57298 !offending.is_empty(),57440 !offending.is_empty(),
57299- "{walk} is listed AtResolution but no shape it walks is \57441+ "{walk} is listed AtResolution but no shape it walks is BLOCK_INVALID \
57300- BLOCK_INVALID -- then the level's guard is not what protects it"57442+ -- then the level's guard is not what protects it"
57443+ );
57444+ let fstart = decode_body
57445+ .find(&format!("\nfn {fscope}("))
57446+ .or_else(|| decode_body.find(&format!("\npub(crate) fn {fscope}(")))
57447+ .or_else(|| decode_body.find(&format!("\npub fn {fscope}(")))
57448+ .unwrap_or_else(|| {
57449+ panic!("the census names `{fscope}`, which is not a function here")
57450+ });
57451+ let fend = ["\nfn ", "\npub fn ", "\npub(crate) fn "]
57452+ .iter()
57453+ .filter_map(|pat| {
57454+ decode_body[fstart + 1..].find(pat).map(|i| fstart + 1 + i)
57455+ })
57456+ .min()
57457+ .unwrap_or(decode_body.len());
57458+ let body = &decode_body[fstart..fend];
57459+ let guard = format!("refuse_invalid_subsize(({level}, {level})");
57460+ let gpos = body.find(&guard).unwrap_or_else(|| {
57461+ panic!(
57462+ "{walk} claims refuse_invalid_subsize(({level}, {level})) guards it, \
57463+ but there is NO such guard in `{fscope}` -- the row's mechanism is \
57464+ prose, not a check; re-derive it or mark the row Prose"
57465+ )
57466+ });
57467+ let call = body.find(&format!("{name}(")).unwrap_or_else(|| {
57468+ panic!(
57469+ "{walk} has no call site inside `{fscope}` to order the guard against"
57470+ )
57471+ });
57472+ assert!(
57473+ gpos < call,
57474+ "{walk}: in `{fscope}` the ({level}, {level}) guard is at {gpos} and the \
57475+ walk is dispatched at {call} -- a guard BELOW the dispatch can never \
57476+ observe it"
57477+ );
57478+ }
57479+ Mech::AtResolutionVia(fscope, level) => {
57480+ assert!(
57481+ !offending.is_empty(),
57482+ "{walk} is listed AtResolutionVia but no shape it walks is \
57483+ BLOCK_INVALID"
57484+ );
57485+ let fstart = decode_body
57486+ .find(&format!("\nfn {fscope}("))
57487+ .or_else(|| decode_body.find(&format!("\npub(crate) fn {fscope}(")))
57488+ .or_else(|| decode_body.find(&format!("\npub fn {fscope}(")))
57489+ .unwrap_or_else(|| {
57490+ panic!("the census names `{fscope}`, which is not a function here")
57491+ });
57492+ let fend = ["\nfn ", "\npub fn ", "\npub(crate) fn "]
57493+ .iter()
57494+ .filter_map(|pat| {
57495+ decode_body[fstart + 1..].find(pat).map(|i| fstart + 1 + i)
57496+ })
57497+ .min()
57498+ .unwrap_or(decode_body.len());
57499+ assert!(
57500+ decode_body[fstart..fend]
57501+ .contains(&format!("refuse_invalid_subsize(({level}, {level})")),
57502+ "{walk} claims refuse_invalid_subsize(({level}, {level})) in `{fscope}` \
57503+ guards it, but there is NO such guard there"
57301 );57504 );
57302 }57505 }
57303 Mech::Unreachable(reason) => {57506 Mech::Unreachable(reason) => {
@@ -57378,10 +57581,6 @@ mod tests {
57378 // the DECODE BODY only -- this test's own string literals name the same57581 // the DECODE BODY only -- this test's own string literals name the same
57379 // functions, and the merged lane's own scan hit exactly that (five of57582 // functions, and the merged lane's own scan hit exactly that (five of
57380 // its eighteen `refuse_invalid_subsize((` matches are its own).57583 // its eighteen `refuse_invalid_subsize((` matches are its own).
57381- let decode_body = match src.find("\n#[cfg(test)]\nmod tests {") {
57382- Some(i) => &src[..i],
57383- None => src,
57384- };
57385 for (name, calls) in [57584 for (name, calls) in [
57386 ("decode_rect4_16_intrabc", 1usize),57585 ("decode_rect4_16_intrabc", 1usize),
57387 ("decode_rect4_16_strip", 2),57586 ("decode_rect4_16_strip", 2),
@@ -57438,14 +57637,49 @@ mod tests {
57438 let call_at = decode_body57637 let call_at = decode_body
57439 .rfind(call)57638 .rfind(call)
57440 .unwrap_or_else(|| panic!("{what} is gone -- re-derive the residue's closure"));57639 .unwrap_or_else(|| panic!("{what} is gone -- re-derive the residue's closure"));
57441- let guard_at = decode_body57640+ // r2 (Main's review, and it was right): the guard search is SCOPED
57641+ // to the anchor's own enclosing function. `find()` over the whole
57642+ // decode body returns the FIRST `refuse_invalid_subsize((16, 16)` --
57643+ // the KEY-FRAME one -- so the inter pair's comparison was satisfied
57644+ // by a guard three quarters of the file away, and deleting the inter
57645+ // 16-level guard left this test green. Both routes live in
57646+ // different `fn` bodies (`decode_key_frame_tile_with_cdfs` and the
57647+ // inter tile decoder), so the enclosing function is the scope that
57648+ // tells the two apart.
57649+ let fn_scope = |at: usize| -> std::ops::Range<usize> {
57650+ let head = ["\nfn ", "\npub fn ", "\npub(crate) fn "]
57651+ .iter()
57652+ .filter_map(|pat| decode_body[..at].rfind(pat))
57653+ .max()
57654+ .unwrap_or(0);
57655+ let tail = ["\nfn ", "\npub fn ", "\npub(crate) fn "]
57656+ .iter()
57657+ .filter_map(|pat| decode_body[at..].find(pat).map(|i| at + i))
57658+ .min()
57659+ .unwrap_or(decode_body.len());
57660+ head..tail
57661+ };
57662+ let scope = fn_scope(test_at);
57663+ let guard_at = decode_body[scope.clone()]
57442 .find("refuse_invalid_subsize((16, 16)")57664 .find("refuse_invalid_subsize((16, 16)")
57443- .expect("a 16x16-level guard above both 1:4 arms");57665+ .map(|i| scope.start + i)
57666+ .unwrap_or_else(|| {
57667+ panic!(
57668+ "{what}: there is NO refuse_invalid_subsize((16, 16)) in the function \
57669+ enclosing the 1:4 arm test -- so nothing refuses the VERT_4 symbol \
57670+ this arm dispatches on, and decode_rect4_16_intrabc's closure is gone"
57671+ )
57672+ });
57444 assert!(57673 assert!(
57445 guard_at < test_at && test_at < call_at,57674 guard_at < test_at && test_at < call_at,
57446- "{what}: guard at {guard_at}, 1:4 arm test at {test_at}, dispatch at \57675+ "{what}: guard at {guard_at} (function scope {scope:?}), 1:4 arm test at \
57447- {call_at}. The guard has to sit ABOVE the 1:4 arm test, or the \57676+ {test_at}, dispatch at {call_at}. The guard has to sit ABOVE the 1:4 arm \
57448- VERT_4 symbol it refuses has already been dispatched on"57677+ test INSIDE THE SAME FUNCTION, or the VERT_4 symbol it refuses has already \
57678+ been dispatched on"
57679+ );
57680+ assert!(
57681+ scope.contains(&guard_at) && scope.contains(&test_at) && scope.contains(&call_at),
57682+ "{what}: guard, 1:4 test and dispatch must share one enclosing function"
57449 );57683 );
57450 }57684 }
57451 // And the inter route really is the only one: `strip16` is built from57685 // And the inter route really is the only one: `strip16` is built from
crates/ec-av1/src/stream.rsmodified+76 -0
@@ -2915,6 +2915,82 @@ pub(crate) mod tests {
2915 );2915 );
2916 }2916 }
2917 2917
2918+ /// lane-av1subsizesweep: the FRAME-EDGE walk of a BLOCK_INVALID subsize,
2919+ /// pinned. This is the one install site the partition-symbol guards missed,
2920+ /// and the sibling pin above cannot see it -- that pin's 8x16 comes from a
2921+ /// 16x16-level `PARTITION_VERT_B` (an interior AB strip, refused at
2922+ /// decode.rs:36472), while this pin's comes from the key-frame 16-level
2923+ /// FRAME-EDGE arm, which is not a `dec.symbol(` site at all: it reads one
2924+ /// gathered bit with `dec.symbol_fixed(&gather(..))` and dispatches
2925+ /// `decode_leaf_rect` straight off it.
2926+ ///
2927+ /// `422_header_edge16_walk.obu` (128 bytes, sha256
2928+ /// `e8ab2bb229896f796cdec4d2cb383b41f057ef8d364da30f160a3f55a452657f`,
2929+ /// fnv1a64 `0xcfa2394ebe1f7764`) is a 4:2:2 sequence header over a 4:2:0
2930+ /// key frame's tile, at 88x64. Width 88 is 8 mod 16, so the last 16x16
2931+ /// column block is COLUMN-short and the frame-edge arm fires; height 64 is
2932+ /// 16-aligned, so the ROW is not short and the both-cut arm is not taken.
2933+ /// The gathered bit names `PARTITION_VERT`, so the strip is `BLOCK_8X16`.
2934+ ///
2935+ /// libaom's own verdict, which is the rule this pin pins:
2936+ ///
2937+ /// ```text
2938+ /// $ aomdec --rawvideo -o /dev/null fixtures/422_header_edge16_walk.obu
2939+ /// Warning: Failed to decode frame 1: Corrupt frame detected
2940+ /// Warning: Additional information: Block size 8x16 invalid with this subsampling mode
2941+ /// ```
2942+ ///
2943+ /// What makes this pin different from every other refusal gate in this file
2944+ /// is that the 8x16 is the ONLY offending subsize in the stream. Measured
2945+ /// over a 260-candidate sweep (4 card textures x 5 quantizers x 13 declared
2946+ /// widths), this is the one candidate whose decode with the guard removed
2947+ /// SUCCEEDS: with the `refuse_invalid_subsize` at decode.rs:37098 deleted,
2948+ /// this decoder returned a full 88x64 picture where libaom refuses the
2949+ /// frame. So the guard is not a redundant second refusal here -- it is the
2950+ /// only thing between a corrupt frame and a plausible-looking decode.
2951+ #[test]
2952+ fn a_422_header_whose_only_invalid_subsize_is_the_16_level_frame_edge_walk_is_refused() {
2953+ const NAME: &str =
2954+ "a_422_header_whose_only_invalid_subsize_is_the_16_level_frame_edge_walk_is_refused";
2955+ let _gate_lock = lock_gate_counters();
2956+ let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
2957+ .join("fixtures")
2958+ .join("422_header_edge16_walk.obu");
2959+ let pinned = read_pin(&path, 128, 0xcfa2394ebe1f7764, NAME);
2960+ // The shape must be the one this lane's arm carries: if the pin ever
2961+ // stops being an 8x16 strip the refusal is coming from somewhere else
2962+ // and this gate is measuring the wrong thing.
2963+ assert!(
2964+ !crate::decode::chroma_plane_block_codable(8, 16, 1, 0),
2965+ "{NAME}: BLOCK_8X16 must be BLOCK_INVALID at 4:2:2 -- this gate's whole \
2966+ subject is `av1_ss_size_lookup[BLOCK_8X16][1][0] == BLOCK_INVALID`"
2967+ );
2968+ assert!(
2969+ crate::decode::chroma_plane_block_codable(16, 8, 1, 0),
2970+ "{NAME}: the 16x8 mirror MUST stay legal at 4:2:2 (BLOCK_8X8) -- it is what \
2971+ keeps the new guard from refusing the sibling arm's strip"
2972+ );
2973+ let err = decode_stream(&pinned)
2974+ .err()
2975+ .unwrap_or_else(|| panic!("{NAME}: the pin must be REFUSED, not decoded"));
2976+ let msg = err.to_string();
2977+ assert!(
2978+ msg.contains("invalid with this subsampling mode"),
2979+ "{NAME}: the refusal must name libaom's rule (its own wording), got: {msg}"
2980+ );
2981+ // Positive control: a genuine 4:2:2 stream must still decode, so this
2982+ // gate cannot pass by refusing everything.
2983+ let ok_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
2984+ .join("fixtures")
2985+ .join("422_key_64x64.obu");
2986+ let ok = decode_stream(&std::fs::read(&ok_path).expect("the 4:2:2 control fixture"))
2987+ .unwrap_or_else(|e| panic!("{NAME}: a genuine 4:2:2 pin must still decode: {e}"));
2988+ assert!(
2989+ !ok.is_empty(),
2990+ "{NAME}: the 4:2:2 control decoded no frames"
2991+ );
2992+ }
2993+
2918 /// lane-av1-422bigblock: the two witnessed 4:2:2 big-block defects, pinned2994 /// lane-av1-422bigblock: the two witnessed 4:2:2 big-block defects, pinned
2919 /// as fixtures (`git add -f`; `fixtures/` is gitignored).2995 /// as fixtures (`git add -f`; `fixtures/` is gitignored).
2920 ///2996 ///
lanes/av1subsizesweep.report.mdmodified+220 -179
@@ -3,236 +3,277 @@
3 Base `main` = `e45cc748` ("Merge lane/av1unwritten: refuse the subsize libaom calls corrupt").3 Base `main` = `e45cc748` ("Merge lane/av1unwritten: refuse the subsize libaom calls corrupt").
4 Worktree `~/.cache/wt/av1subsizesweep`, own `CARGO_TARGET_DIR=~/.cache/tgt/subsizesweep`.4 Worktree `~/.cache/wt/av1subsizesweep`, own `CARGO_TARGET_DIR=~/.cache/tgt/subsizesweep`.
5 5
6-## What the merged lane already covered (not redone)6+## Headline: the find came from censusing WALK sites, not SYMBOL sites
7 7
8-`refuse_invalid_subsize` (`decode.rs:21489`) with `PLANE_BLOCK_INVALID_422` /8+The merged lane's gate enumerates partition-**symbol** sites. This lane enumerates
9-`PLANE_BLOCK_INVALID_440` transcribed cell-for-cell from `av1_ss_size_lookup`9+chroma-plane **walk** sites — every `decode_*` that reconstructs chroma from a
10-(`common_data.c`), `partition_subsize_dims` as libaom's `get_partition_subsize`10+block's luma extent, with the footprints its dispatch can hand it — and that
11-reduced to dimensions, **11 guard call sites**, the structural test11+reframing is what found the hole. A symbol-site census cannot see a subsize that
12-`every_partition_symbol_resolution_is_guarded_before_it_dispatches`, and the12+arrives without a partition symbol at all, and it cannot see a subsize that
13-`EC_AV1_SUBSIZE_GUARD_TRACE` / `EC_AV1_SUBSIZE_ARM_TRACE` coverage artefacts.13+arrives through a *differently spelled* symbol read.
14 14
15-Its named residue: `decode_rect4_16_intrabc`.15+Concretely: the key-frame 16-level **frame-edge** arm reads one gathered bit with
16+`dec.symbol_fixed(&gather(..))` and dispatches `decode_leaf_rect` **directly** on
17+it. The merged scan's read test was the literal `dec.symbol(`, and
18+`dec.symbol(` is not a substring of `dec.symbol_fixed(`. Every sibling edge arm
19+resolves into a `partN` the level's guard sees; this one did not.
16 20
17-## The hole this lane found: the key-frame 16-level FRAME-EDGE arm21+## The hole, and the fix
18 22
19-`decode.rs:37034-37067` (pre-fix numbering) is the **one** partition read in the23+| | reads | resolves to | guarded before? |
20-file that dispatches on its own symbol instead of resolving it into a `partN` the
21-level's guard covers.
22-
23-| | reads | resolves to | guarded? |
24 |---|---|---|---|24 |---|---|---|---|
25-| 128-root edge (`35551`/`35559`) | `symbol_fixed(&gather(..))` | `PARTITION_SPLIT`/`HORZ`/`VERT` | yes — `refuse_invalid_subsize((128,128), part128)` at `35588` |25+| 128-root edge (`35559`/`35567`) | `symbol_fixed(&gather(..))` | `SPLIT`/`HORZ`/`VERT` | yes — `refuse_invalid_subsize((128,128), part128)` at `35596` |
26-| 64-level edge (`36239`/`36256`) | same | same | yes — `(64,64)` guard at `36278` |26+| 64-level edge (`36247`/`36264`) | same | same | yes — `(64,64)` at `36286` |
27-| 32-level edge (`36363`/`36383`) | same | same | yes — `(32,32)` guard at `36406` |27+| 32-level edge (`36371`/`36391`) | same | same | yes — `(32,32)` at `36414` |
28-| **16-level edge (kf)** | same | **`edge_split`, straight into `decode_leaf_rect`** | **NO — nothing on the path** |28+| **16-level edge (key frame, `37043`/`37048`)** | same | **`edge_split`, straight into `decode_leaf_rect`** | **NO — nothing on the path** |
29-| 16-level edge (inter, `54767`/`54780`) | same | `part16` | yes — `(16,16)` guard at `54799` |29+| 16-level edge (inter, `54777`/`54790`) | same | `part16` | yes — `(16,16)` at `54809` |
30 30
31 With `has_cols16 == false` the strip is `BLOCK_8X16`, whose `(1,0)` chroma plane31 With `has_cols16 == false` the strip is `BLOCK_8X16`, whose `(1,0)` chroma plane
32-block is `BLOCK_INVALID` (`av1_ss_size_lookup`, `common_data.c:20`). At 4:2:2 that32+block is `BLOCK_INVALID` (`av1_ss_size_lookup`, `common_data.c:20`). At 4:2:2 this
33-is a subsize libaom refuses at `decodeframe.c:1456`, and this decoder walked it33+walked a subsize libaom refuses at `decodeframe.c:1456`. With `has_cols16 == true`
34-into `decode_leaf_rect` anyway. With `has_cols16 == true` the strip is `16x8` —34+the strip is `16x8` — `BLOCK_8X16`'s mirror, whose `(1,0)` cell is `BLOCK_8X8` —
35-`BLOCK_8X16`'s mirror, whose `(1,0)` cell is `BLOCK_8X8` — and **must** keep35+and **must** keep decoding.
36-decoding.36+
37-37+**Fix** (`decode.rs:37101-37119`): the guard sits on the arm's own path and names
38-Why the merged lane's structural test could not see it: the scan keys on38+the LEVEL, not a shape — the gathered bit resolves to `PARTITION_HORZ` when the
39-`dec.symbol(` (line 56698), and this arm reads `dec.symbol_fixed(&gather(..))`.39+columns are full and `PARTITION_VERT` when they are not, and
40-Every other edge read is either invisible for the same reason or resolves into a40+`refuse_invalid_subsize((16,16), edge_part, …)` reduces that through the same
41-guarded `partN`; only this one both dispatches directly *and* carries an41+`partition_subsize_dims` every other site uses. A `note_subsize_arm` census line
42-INVALID shape.42+was added alongside, per the merged lane's convention.
43-43+
44-**Fix** (`decode.rs:37063-37109`): the guard sits on the arm's own path, named by44+### Reachability, stated separately from the guard's correctness
45-LEVEL not by a hand-picked shape — the gathered bit resolves to45+
46-`PARTITION_HORZ` when the columns are full and `PARTITION_VERT` when they are46+There **is** a witness, and it is the only offending subsize in its stream.
47-not, and `refuse_invalid_subsize((16,16), edge_part, …)` reduces that through the47+`crates/ec-av1/fixtures/422_header_edge16_walk.obu` (128 bytes, sha256
48-same `partition_subsize_dims` every other site uses. A `note_subsize_arm` census48+`e8ab2bb229896f796cdec4d2cb383b41f057ef8d364da30f160a3f55a452657f`, fnv1a64
49-line was added alongside, per the merged lane's convention.49+`0xcfa2394ebe1f7764`) is a 4:2:2 sequence header over a 4:2:0 key frame's tile at
50+88x64. Width 88 is 8 mod 16 → the last 16x16 column block is column-short, so the
51+frame-edge arm fires; height 64 is 16-aligned, so the row is not short and the
52+both-cut arm is not taken. The gathered bit names `PARTITION_VERT`, so the strip
53+is `BLOCK_8X16`.
54+
55+libaom's own verdict:
56+
57+```text
58+$ aomdec --rawvideo -o /dev/null fixtures/422_header_edge16_walk.obu
59+Warning: Failed to decode frame 1: Corrupt frame detected
60+Warning: Additional information: Block size 8x16 invalid with this subsampling mode
61+```
62+
63+The three-way measurement, which is the part that matters:
64+
65+| build | this decoder |
66+|---|---|
67+| with the guard | REFUSED, naming libaom's rule — agrees with `aomdec` |
68+| **guard deleted** | **`OK: 1 frames decoded, 88x64`** — a full picture from a frame libaom calls corrupt |
69+| libaom | refuses |
70+
71+So the guard is load-bearing, not a redundant second refusal, and the gate
72+`a_422_header_whose_only_invalid_subsize_is_the_16_level_frame_edge_walk_is_refused`
73+reds when the guard is deleted (verified).
74+
75+**Severity: a false-accept, not a pixel divergence.** libaom refuses the whole
76+frame, so there is no "correct" pixel output to diverge from; the defect is that we
77+returned plausible-looking pixels for a corrupt frame. No legal 4:2:2 stream is
78+affected — the shape only reaches stream data through a hostile or mismatched
79+header, which is the same exposure the merged lane's guards already carry.
80+
81+**The earlier "no witness" claim in this lane was wrong, and so was its
82+explanation.** The first sweep (45 aomenc-encoded 4:2:2 streams) never reached the
83+arm, and I attributed that to `partition_rect_allowed`. That mechanism governs the
84+encoder's partition *search*; this arm's partition comes from a single gathered
85+bit after a frame-edge geometry test, so `partition_rect_allowed` does not explain
86+it — the real reason aomenc never produced a witness is **not known**. The
87+witness exists, but it had to be built from this crate's own encoder with a
88+**declared** width (`encode_key_frame_at_size`, the `gen_coverage_cells.rs` cell-2
89+construction) and then re-headered, because aomenc rounds the coded size to even
90+and never declares 88.
50 91
51 ## The named residue: `decode_rect4_16_intrabc` — CLOSED, not guarded a third time92 ## The named residue: `decode_rect4_16_intrabc` — CLOSED, not guarded a third time
52 93
53-Its concrete code shape is `decode.rs:18336-18337`:94+Its concrete code shape is `decode.rs:18334-18337`:
54 95
55 ```rust96 ```rust
56 let (cw, ch) = if own_chroma { (bw >> ss_x(fctx), bh >> ss_y(fctx)) }97 let (cw, ch) = if own_chroma { (bw >> ss_x(fctx), bh >> ss_y(fctx)) }
57- else { (pw / 2, ph / 2) }; // <- hardcoded both-axes halving98+ else { (pw / 2, ph / 2) }; // both axes halved
58 ```99 ```
59 100
60 `own_chroma = own444 || own422`, and `own422 = ss_x == 1 && ss_y == 0 && horz`101 `own_chroma = own444 || own422`, and `own422 = ss_x == 1 && ss_y == 0 && horz`
61 (`18317`). A **VERT** strip at `ss (1,0)` is therefore neither `own444` nor102 (`18317`). A **VERT** strip at `ss (1,0)` is therefore neither `own444` nor
62-`own422`, falls to the `else`, and derives `pw,ph = (8,16)` → `cw,ch = (4,8)` —103+`own422`, falls to the `else`, and derives `pw,ph = (8,16)` → `cw,ch = (4,8)` — a
63-a `BLOCK_4X8` plane block, itself `BLOCK_INVALID` at `(1,0)`. Same for the104+`BLOCK_4X8` plane block, itself `BLOCK_INVALID` at `(1,0)`. Same for the
64 `(pair_mi.1 * MI / 2, pair_mi.0 * MI / 2)` origin at `18354`.105 `(pair_mi.1 * MI / 2, pair_mi.0 * MI / 2)` origin at `18354`.
65 106
66 It is dead, and the reason is derived rather than read:107 It is dead, and the reason is derived rather than read:
67 108
68-1. `decode_rect4_16_intrabc` has exactly **one** caller (`decode_rect4_16_strip`,109+1. `decode_rect4_16_intrabc` has exactly **one** caller (`decode_rect4_16_strip`, `18934`).
69- `18934`).110+2. `decode_rect4_16_strip` has exactly **two** (`17595` from `decode_rect4_16`, `13810` from `decode_intra_rect_in_inter`).
70-2. `decode_rect4_16_strip` has exactly **two** (`17595` from `decode_rect4_16`,111+3. `decode_rect4_16` (`36801`) and `decode_intra_rect_in_inter` (`45457`, reached only when `fctx.inter_strip_chroma` is set — one writer, `55126`) are both **16x16-level 1:4 arms**, each above a `refuse_invalid_subsize((16, 16), part16, …)`.
71- `13810` from `decode_intra_rect_in_inter`).112+4. `partition_subsize_dims((16,16), PARTITION_VERT_4) == (4,16)`, and `(4,16)` is in `PLANE_BLOCK_INVALID_422`. The guard refuses the **only** shape that could reach the bad arm.
72-3. `decode_rect4_16` (`36793`) and `decode_intra_rect_in_inter` (`45447`, reached113+5. `PARTITION_HORZ_4` gives `(16,4)`, whose `(1,0)` cell is `BLOCK_8X4` and is legal — so the strip that survives is the one `own422` is written for.
73- only when `fctx.inter_strip_chroma` is set — one writer, `55116`) are both114+
74- **16x16-level 1:4 arms**, and both sit above a115+Classified **guarded-at-resolution**, not `unreachable`: the site *is* handable an
75- `refuse_invalid_subsize((16, 16), part16, …)`.116+INVALID subsize in principle, and a guard one level up is what makes it safe.
76-4. `partition_subsize_dims((16,16), PARTITION_VERT_4) == (4,16)`, and `(4,16)` is
77- in `PLANE_BLOCK_INVALID_422`. So the guard refuses the **only** shape that
78- could reach the bad arm.
79-5. `PARTITION_HORZ_4` gives `(16,4)`, whose `(1,0)` cell is `BLOCK_8X4` and is
80- legal — so the strip that survives is the one `own422` is written for, and
81- `refuse_invalid_subsize` does not over-refuse.
82-
83-Items 1–5 are asserted in
84-`every_chroma_walking_leaf_dispatch_is_guarded_or_closed_with_a_reason` (4 and 5
85-derived from the real predicate; 1–3 from counted call sites plus the ordering of
86-guard < 1:4-arm test < dispatch on each of the two routes). It is closed as
87-**guarded-at-resolution**, not `unreachable`: the site *is* handable an INVALID
88-subsize in principle, and what makes it safe is a guard one level up.
89 117
90 ## Census table118 ## Census table
91 119
92-`guard` = the `refuse_invalid_subsize` that covers the walk. "shape@mode" lists the120+`guard` = the `refuse_invalid_subsize` that covers the walk. Offending shapes at
93-footprints the walk is handed and the subsampling mode at which libaom marks them121+4:2:2 `(1,0)`: **4x8, 8x16, 4x16, 8x32, 16x32, 16x64, 32x64, 64x128**. 4:4:0
94-`BLOCK_INVALID`. Offending shapes at 4:2:2 `(1,0)`: **4x8, 8x16, 4x16, 8x32,122+`(0,1)` is excluded throughout — libaom's `color_config` asserts
95-16x32, 16x64, 32x64, 64x128**. 4:4:0 `(0,1)` is excluded throughout — libaom123+`subsampling_y == 0` when `subsampling_x == 0`, so no frame can select it.
96-asserts `subsampling_y == 0` when `subsampling_x == 0`, so no frame can select
97-it.
98 124
99-| # | site | shapes | offending @mode | guard | mechanism | evidence |125+| # | site | shapes | offending @mode | guard | mechanism | checked by |
100 |---|---|---|---|---|---|---|126 |---|---|---|---|---|---|---|
101-| 1 | `decode_leaf_rect` **kf 16-edge** (`37067`) | 16x8, **8x16** | 8x16@(1,0) | `refuse_invalid_subsize((16,16), edge_part)` **added this lane** | AtDispatch | census row + ordering assert; mutations A/B red |127+| 1 | `decode_leaf_rect` kf 16-edge (`37124`) | 16x8, **8x16** | 8x16@(1,0) | `(16,16)` `edge_part` **added this lane**, `37106` | AtDispatch | census ordering + the pinned fixture |
102-| 2 | `decode_rect4_16_intrabc` (`18232`) | 16x4, **4x16** | 4x16@(1,0) | `(16,16)` @ `36472` (kf) / `54799` (inter) | AtResolution | derived VERT_4→(4,16) + caller count, census part (d)/(f) |128+| 2 | `decode_rect4_16_intrabc` (`18232`) | 16x4, **4x16** | 4x16@(1,0) | `(16,16)` `36480` kf / `54809` inter | AtResolutionVia | derived VERT_4→(4,16), per-route ordering loop |
103-| 3 | `decode_rect4_16` (`17552`) | 16x4, 4x16 | 4x16@(1,0) | same `(16,16)` guards | AtResolution | single caller `36793`, under the 1:4 arm |129+| 3 | `decode_rect4_16` (`17552`) | 16x4, 4x16 | 4x16@(1,0) | `(16,16)` `36480` | AtResolution | row-scoped guard + ordering |
104-| 4 | `decode_rect4_16_strip` (`18862`) | 16x4, 4x16 | 4x16@(1,0) | same | AtResolution | callers `17595`, `13810`, both 1:4 |130+| 4 | `decode_rect4_16_strip` (`18862`) | 16x4, 4x16 | 4x16@(1,0) | `(16,16)` `36480` | AtResolutionVia | guard-in-scope + per-route loop |
105-| 5 | `decode_block_rect` (`15596`) | 32x16, **16x32** | 16x32@(1,0) | `(32,32)` @ `36406` / `54653` | AtResolution | 32-level HORZ/VERT arms |131+| 5 | `decode_block_rect` (`15596`) | 32x16, **16x32** | 16x32@(1,0) | `(32,32)` `36414` / `54663` | AtResolution | row-scoped guard + ordering |
106-| 6 | `decode_block_rect4` (`16764`) | 32x8, **8x32** | 8x32@(1,0) | `(32,32)` @ `36406` / `54653` | AtResolution | 32-level HORZ_4/VERT_4 arms |132+| 6 | `decode_block_rect4` (`16764`) | 32x8, **8x32** | 8x32@(1,0) | `(32,32)` `36414` | AtResolution | row-scoped guard + ordering |
107-| 7 | `decode_block_rect64` (`19851`) | 64x16, **16x64** | 16x64@(1,0) | `(64,64)` @ `36278` / `54269` | AtResolution | 64-level 1:4 arms |133+| 7 | `decode_block_rect4`[inter] | 32x8, **8x32** | 8x32@(1,0) | `(32,32)` `54663` | AtResolutionVia | guard-in-scope in the inter decoder |
108-| 8 | `decode_block_128rect` (`23921`) | 128x64, **64x128** | 64x128@(1,0) | `(128,128)` @ `35588` / `54032` | AtResolution | 128-root HORZ/VERT + all four AB arms |134+| 8 | `decode_block_rect64` (`19851`) | 64x16, **16x64** | 16x64@(1,0) | `(64,64)` `36286` | AtResolution | row-scoped guard + ordering |
109-| 9 | `decode_rect_split` (`12420`) | 32x16, 16x32, 64x16, 16x64 | all four | inherited from callers 5/7 | AtResolution | 4 call sites, all under 5–8 |135+| 9 | `decode_block_rect64`[inter] | 64x16, **16x64** | 16x64@(1,0) | `(64,64)` `54279` | AtResolutionVia | guard-in-scope in the inter decoder |
110-| 10 | `decode_leaf_rect` **AB arms** (`36599`, `36688`, `36737`, `36756`) | 16x8, **8x16** | 8x16@(1,0) | `(16,16)` @ `36472` — `partition_subsize_dims((16,16), VERT_A/B) == (8,16)` | AtResolution | guard is above the AB range, never inside it (merged lane's AB invariant) |136+| 10 | `decode_intra_rect_in_inter` (`13761`) | 16x8, **8x16**, 16x4, **4x16** | all four | `(16,16)` `54809` | AtResolutionVia | guard-in-scope + per-route loop |
111-| 11 | `decode_leaf_rect8` (`27733`) | 8x4, **4x8** | 4x8@(1,0) | `(8,8)` @ `36882` / `37179`, plus the redundant inline check at `36904` | AtResolution | both 8x8 resolutions |137+| 11 | `decode_block_128rect` (`23929`) | 128x64, **64x128** | 64x128@(1,0) | `(128,128)` `35596` in `read_sb128_root` | AtResolutionVia | guard-in-scope |
112-| 12 | `decode_inter_sub8_rect2` (`48863`) | 8x4, **4x8** | 4x8@(1,0) | `(8,8)` @ `55211` | AtResolution | inter 8x8 level |138+| 12 | `decode_rect_split` (`12420`) | 32x16, 16x32, 64x16, 16x64 | all four | inherits from rows 5/7/8/9 | AtResolutionVia | guard-in-scope |
113-| 13 | `decode_leaf_split4` (`27044`) | 4x4 | none | none needed | unreachable | 4x4's plane block is 4x4 in **every** cell |139+| 13 | `decode_leaf_rect` AB arms (`36599`, `36688`, `36737`, `36756`) | 16x8, **8x16** | 8x16@(1,0) | `(16,16)` `36480` — `partition_subsize_dims((16,16), VERT_A/B) == (8,16)` | AtResolution | guard is above the AB range, never inside it (merged lane's AB invariant) |
114-| 14 | `decode_inter_sub8_split4` (`46999`) | 4x4 | none | none needed | unreachable | same |140+| 14 | `decode_leaf_rect8` (`27741`) | 8x4, **4x8** | 4x8@(1,0) | `(8,8)` `36890` / `37189`, plus the inline check at `36912` | AtResolution | row-scoped guard + ordering |
115-| 15 | `decode_leaf8` (`24413`) | 8x8 | none | none needed | unreachable | 8x8 → 8x8/4x8/4x4, never INVALID |141+| 15 | `decode_inter_sub8_rect2` (`48920`) | 8x4, **4x8** | 4x8@(1,0) | `(8,8)` `55221` | AtResolution | row-scoped guard + ordering |
116-| 16 | `decode_inter_block8` (`50045`) | 8x8 | none | none needed | unreachable | same |142+| 16 | `decode_leaf_split4` (`27052`) | 4x4 | none | none needed | unreachable | offending set asserted empty |
117-| 17 | `decode_block` (`22475`) | squares only | none | none needed | unreachable | every square's plane block is valid at **every** selectable mode; the whole BLOCK_INVALID column is rect |143+| 17 | `decode_inter_sub8_split4` (`47056`) | 4x4 | none | none needed | unreachable | offending set asserted empty |
118-| 18 | `decode_inter_block` (`41372`) | squares only | none | none needed | unreachable | same |144+| 18 | `decode_leaf8` (`24421`), `decode_inter_block8` (`50102`) | 8x8 | none | none needed | unreachable | offending set asserted empty |
119-| 19 | `read_sb128_root` (`35493`) | 128x128 root | none itself | own `(128,128)` guard at `35588` | AtResolution | covers rows 5–8 upstream |145+| 19 | `decode_block` (`22483`), `decode_inter_block` (`41429`) | squares only | none | none needed | unreachable | every square's plane block is valid at every selectable mode; the whole BLOCK_INVALID column is rect |
120-146+
121-**Rows not closed: none.** Every row is either guarded (1–12, 19) or needs no147+**Rows not closed: none.** Every row is guarded (1–15) or needs no guard because
122-guard because the shape is codable at every selectable subsampling mode (13–18).148+the shape is codable at every selectable subsampling mode (16–19).
149+
150+## The merged lane's matcher gap, widened (r11)
151+
152+Its site list was incomplete **for a spelling, not for a shape**, so it would miss
153+the next differently-spelled read the same way. The read test is now derived:
154+
155+> a partition-symbol READ is a `dec.<name>(..)` call whose **own argument list**
156+> names a `partition_w<N>[` CDF.
157+
158+That is the whole definition and it needs no hand-list. `dec.symbol(..partition_w..)`
159+qualifies; the frame-edge gather's `dec.symbol_fixed(&gather(..partition_w..))`
160+qualifies; `dec.debug_state()` does not — it never names a partition CDF. A third
161+spelling is covered the day somebody writes it. The `var == "b"` skip is gone too:
162+edge reads are **sites** now, and instead of being skipped they must carry a guard
163+for their own level before the first chroma-walking dispatch that follows them.
164+
165+**A limitation, stated rather than hidden:** the definition is syntactic. A read
166+that reaches a `partition_w` CDF through a helper whose argument list does not
167+mention the CDF name would not be enumerated. There is no such call in this file
168+today, and the census's `AtDispatch` row covers the arm this gap actually hid.
123 169
124 ## Evidence170 ## Evidence
125 171
126-**Guard fires on a live path, and does not over-refuse.** `EC_AV1_SUBSIZE_GUARD_TRACE`172+### The widening bites, and so does every guard the census claims
127-on real `aomenc` 4:2:0 streams of exactly the shape that reaches the arm173+
128-(`testsrc2`, widths 40/72/104/136, `h=120`, `--min-partition-size=4174+Per-guard deletion, one at a time, by line number, against the census alone:
129---max-partition-size=64 --sb-size=64`):175+
176+| deleted | census |
177+|---|---|
178+| 35596 — 128-root (`read_sb128_root`) | RED — "NO such guard there" |
179+| 36286 — kf 64x64 | RED — "NO such guard in `decode_key_frame_tile_with_cdfs`" |
180+| 36414 — kf 32x32 | RED — same, naming `decode_block_rect` |
181+| 36472 — kf 16x16 | RED — ordering ("guard BELOW the dispatch") |
182+| 36890 — kf 8x8 (first) | RED — ordering, naming `decode_leaf_rect8` |
183+| 37106 — kf 16-level frame-edge arm | RED — "sits AFTER the `decode_leaf_rect` it protects" |
184+| 37106 — same guard, moved below the dispatch | RED — the r5 defect in a new place |
185+| 54279 — inter 64x64 | RED — names `decode_block_rect64[inter]` |
186+| 54663 — inter 32x32 | RED — names `decode_block_rect4[inter]` |
187+| 54809 — inter 16x16 | RED — names `decode_intra_rect_in_inter` |
188+| 55221 — inter 8x8 | RED — names `decode_inter_sub8_rect2` |
189+
190+**Two guards are claimed by LEVEL, not by site**, and the census stays green when
191+they are deleted — stated here rather than papered over:
192+
193+* **37189** — the key-frame 8x8 **second** resolution (the frame-edge straddle loop).
194+* **54042** — the inter decoder's own 128-root guard (the row claims the shared one in `read_sb128_root`).
195+
196+Both are caught by the merged scan's resolution-count cross-check
197+(`the decode body has 12 partition resolutions but only 11 guard sites`). A
198+per-site row for each would pin them individually; that is the obvious next
199+ratchet step and it is not in this lane.
200+
201+### Over-refusal control
202+
203+`EC_AV1_SUBSIZE_GUARD_TRACE` on real `aomenc` 4:2:0 streams of exactly the shape
204+that reaches the arm (`testsrc2`, widths 40/72/104/136, `h=120`,
205+`--min-partition-size=4 --max-partition-size=64 --sb-size=64`):
130 206
131 ```207 ```
132-SUBSIZE_GUARD site=.../decode.rs:37098 bsize=16x16 part=2 codable=true reached=2208+SUBSIZE_GUARD site=.../decode.rs:37106 bsize=16x16 part=2 codable=true reached=2
133-SUBSIZE_ARM site=.../decode.rs:37101 part=2 codable=true reached=2209+SUBSIZE_ARM site=.../decode.rs:37109 part=2 codable=true reached=2
134 ```210 ```
135 211
136-`part=2` is `PARTITION_VERT` — the 8x16 strip, the shape that is INVALID at212+`part=2` is `PARTITION_VERT` — the 8x16 strip, INVALID at 4:2:2. At 4:2:0 the
137-4:2:2. At 4:2:0 the guard reports `codable=true`, the frame decodes OK. The guard213+guard reports `codable=true` and the frame decodes: the guard is on a live path and
138-is on a live path and refuses nothing it should not.214+refuses nothing it should not.
139-215+
140-**A real aomenc witness for the guard FIRING does not exist, and that is a216+### Tests
141-property of libaom, not a gap in the sweep.** 45 real 4:2:2 encodes were built217+
142-(`--i422`, `testsrc2`, 11 widths × 3 heights at cq 45, plus 12218+* `cargo check --tests` clean.
143-`--tune-content=screen --enable-intrabc=1 --enable-palette=1` encodes at cq 20;219+* `cargo test -p ec-av1 --lib -- 422 sub8 subsize chroma_422` — **27 passed, 0 failed** (52 s), including the pinned 4:2:2 corpus, bigblock, lossless-inter and intrabc-sb128 pixel-exactness gates.
144-widths chosen so the 16-level column is short, heights so it is the *only* short220+* `cargo test -p ec-av1 --lib -- pixel_exact byte_exact` — **270 passed, 0 failed** (818 s). The over-refusal control at scale: if the new guard refused anything legal these would go red.
145-axis). None reached `37098` at all. The reason is that aomenc's own221+* The three structural gates pass together, plus the two hostile-pin refusal gates.
146-`partition_rect_allowed` is gated on the same `av1_ss_size_lookup` table (the
147-merged lane cites `partition_search.c:3383-3389`), so a conformant encoder
148-cannot emit a partition whose plane block is `BLOCK_INVALID`. The guard is
149-therefore a **hostile-stream** guard, in exactly the same class as the merged
150-lane's own `37171-37177` note ("Not corpus-reachable at ss(1,0) today, so it is
151-residue rather than live pixels, and it is guarded anyway"). No witness is
152-claimed.
153-
154-**Red-before-green on the new gate** (both mutations against
155-`every_chroma_walking_leaf_dispatch_is_guarded_or_closed_with_a_reason`):
156-
157-* delete `refuse_invalid_subsize((16,16), edge_part, …)` → RED, "dispatches
158- `decode_leaf_rect` on an 8x16 strip … with NO `refuse_invalid_subsize` on its path".
159-* move it **below** the `decode_leaf_rect` call (r5's defect in a new place) →
160- RED, "sits AFTER the `decode_leaf_rect` it protects -- it can never observe it".
161-
162-Restored; both green.
163-
164-**The gate caught two errors in my own census before it shipped** — recorded
165-because they are the class this lane exists to close:
166-
167-* it counted 4:4:0 `(0,1)` as a reachable offending mode and flagged `16x4` as
168- needing a guard. That is the merged lane's r2 mistake reproduced: refusing a
169- legal 4:2:2 shape by testing a cell no `color_config` can request. Fixed by
170- restricting the offending set to the selectable modes.
171-* it flagged `decode_block`/`decode_inter_block` as `AtResolution` when no shape
172- they walk is ever INVALID (squares only). Reclassified `unreachable`.
173-
174-**Named tests.** `cargo check --tests` clean. `cargo test -p ec-av1 --lib -- 422
175-sub8 subsize chroma_422` → **27 passed, 0 failed** (52 s), including
176-`a_real_422_key_frame_and_inter_sequence_decode_pixel_exact`,
177-`the_pinned_422_corpus_cells_decode_pixel_exact`,
178-`the_pinned_422_bigblock_witnesses_decode_pixel_exact`,
179-`the_pinned_422_lossless_inter_witnesses_decode_pixel_exact`,
180-`the_pinned_422_intrabc_sb128_strip_witnesses_decode_pixel_exact`.
181-The three structural gates pass together.
182-
183-**Non-regression on the committed tree.** `cargo test -p ec-av1 --lib -- pixel_exact
184-byte_exact` → **270 passed, 0 failed** (818 s), on this lane's commit. This is the
185-over-refusal control at scale: the new guard sits on a live path (measured
186-reached with `part=2` at 4:2:0 above), and if it refused anything legal these
187-would go red.
188 222
189 ## Wider sweep — hardcoded chroma halvings, NAMED NOT FIXED (out of charter)223 ## Wider sweep — hardcoded chroma halvings, NAMED NOT FIXED (out of charter)
190 224
191-One wider finding **is inside** the residue and is covered by row 2:225+One finding **is** inside the residue and is covered by row 2:
192-`decode_rect4_16_intrabc`'s `else` arm at `18336-18337` / `18354` — the226+`decode_rect4_16_intrabc`'s `else` arm at `18334-18337` / `18354` — the
193 `(pw / 2, ph / 2)` halving and the `(pair_mi.1 * MI / 2, pair_mi.0 * MI / 2)`227 `(pw / 2, ph / 2)` halving and the `(pair_mi.1 * MI / 2, pair_mi.0 * MI / 2)`
194 origin — is a both-axes halving whose predicate (`own444 || own422`) does not228 origin — is a both-axes halving whose predicate (`own444 || own422`) does not
195-enumerate every reachable `(ss, shape)` cell. It is dead only because row 2's229+enumerate every reachable `(ss, shape)` cell. Dead only because row 2's guard
196-guard refuses VERT_4 at 4:2:2. If that guard ever moves, this arm becomes the230+refuses VERT_4 at 4:2:2. If that guard moves, this arm becomes the live defect.
197-live defect.
198 231
199-Outside the charter, named for the owning lanes. Provenance: every row below is232+Outside the charter, named for the owning lanes. Provenance: line numbers
200-either read by me in the decode spine (rows 1, and the residue's `else` arm233+confirmed against the worktree, but nothing outside the decode.rs
201-above) or comes from a read-only source sweep run as part of this lane — the234+partition/chroma walk was **reproduced by a probe here**; rows marked "not probed"
202-line numbers were confirmed against the worktree, but nothing outside the235+should be re-measured by the lane that takes them.
203-decode.rs partition/chroma walk was **reproduced by a probe here**. Rows marked
204-"not probed" should be re-measured by the lane that takes them.
205 236
206 | site | what | consequence at 4:2:2 |237 | site | what | consequence at 4:2:2 |
207 |---|---|---|238 |---|---|---|
208-| `decode.rs:21081` `cfl_ac_q3_at` | `let (cw, ch) = (bw / 2, bh / 2)` + 2×2 luma average | correct today only because `cfl_ac_ss` routes 4:2:2 elsewhere; held by the `cfl_ac_q3_at_hits` 4:2:0-only gate |239+| `decode.rs:21081` `cfl_ac_q3_at` | `(bw / 2, bh / 2)` + 2×2 luma average | correct only because `cfl_ac_ss` routes 4:2:2 elsewhere; held by the `cfl_ac_q3_at_hits` 4:2:0-only gate |
209-| `decode.rs:47516, 47908, 49484, 49930` | `mv_to_q4(<y>, <row_mv>, ss_x(fctx))` — the **Y** axis shifted by `ss_x` | each currently masked by a guard pinning the format to one where `ss_x == ss_y` |240+| `decode.rs:47516, 47908, 49484, 49930` | `mv_to_q4(<y>, <row_mv>, ss_x(fctx))` — the **Y** axis shifted by `ss_x` | each masked by a guard pinning the format to one where `ss_x == ss_y` |
210-| `decode.rs:43251/43262, 43366` | `chroma_side * chroma_side` sizing in the mu-chroma composed grid, where at `ss (1,0)` the plane rect is `(side/2, side)` and a square `side/2` is too short on rows `>= side/2` | a scout finding from a source read; **not reproduced by a probe in this lane** — the lossless sibling of this path was already repaired to `chroma_stride`, these were not. Needs an owning lane with a 128-root 4:2:2 mu-chunk witness |241+| `decode.rs:43251/43262, 43366` | `chroma_side * chroma_side` sizing in the mu-chroma composed grid; at `ss (1,0)` the plane rect is `(side/2, side)` and a square `side/2` is too short on rows `>= side/2` | not probed; the lossless sibling was repaired to `chroma_stride`, these were not. Needs an owning lane with a 128-root 4:2:2 mu-chunk witness |
211-| `decode.rs:35700, 53411` | floor-`>>` chroma plane allocators | shape assumption at frame edges; scout finding, not probed here |242+| `decode.rs:35708, 53419` | floor-`>>` chroma plane allocators | shape assumption at frame edges; not probed |
212 | `encode.rs:1674-1687, 1862-1863, 7477/7483, 7928/7934, 8215/8221, 9295-9315` | every chroma plane/stride/crop at `width / 2` with no ss term | correct only because the encoder emits 4:2:0 exclusively; `obmc_plan` (`7362`) passes real `ss_x`/`ss_y` next to a `side / 2` stride, so two conventions meet there |243 | `encode.rs:1674-1687, 1862-1863, 7477/7483, 7928/7934, 8215/8221, 9295-9315` | every chroma plane/stride/crop at `width / 2` with no ss term | correct only because the encoder emits 4:2:0 exclusively; `obmc_plan` (`7362`) passes real `ss_x`/`ss_y` next to a `side / 2` stride, so two conventions meet there |
213-| `tile.rs:5004-5006` (`fn palette_uv_side`) | `palette_uv_side = (side / 2).max(4)` | 4:2:2/4:4:0 palette map mis-sized |244+| `tile.rs:5004-5006` (`fn palette_uv_side`) | `(side / 2).max(4)` | 4:2:2/4:4:0 palette map mis-sized |
214 | `stream.rs:6672, 6773, 17075` + `probe.rs:81` | ffmpeg rawvideo oracle slices chroma at `width * height / 4` | **the dangerous ones**: a future 4:2:2 gate using them compares half the oracle's bytes and passes green. The `_422_depth`/`_444` siblings exist and are correct; the 4:2:0 trio is unguarded against the wrong format |245 | `stream.rs:6672, 6773, 17075` + `probe.rs:81` | ffmpeg rawvideo oracle slices chroma at `width * height / 4` | **the dangerous ones**: a future 4:2:2 gate using them compares half the oracle's bytes and passes green. The `_422_depth`/`_444` siblings exist and are correct; the 4:2:0 trio is unguarded against the wrong format |
215 | `encode.rs:1595-1616` (`Picture::grey`/`check`), `1605`, `1658`, `1852` | every test card's chroma allocated and asserted at `width * height / 4` | the crate's test surface is 4:2:0-sized before any test code runs |246 | `encode.rs:1595-1616` (`Picture::grey`/`check`), `1605`, `1658`, `1852` | every test card's chroma allocated and asserted at `width * height / 4` | the crate's test surface is 4:2:0-sized before any test code runs |
216-| `decode.rs:59012, 59031, 59284-59304` | test-card chroma + `PlaneBuf` test harness at `width/2`, `height/2` | same |247+| `decode.rs:58989, 59008, 59261-59281` | test-card chroma + `PlaneBuf` test harness at `width/2`, `height/2` | same |
217 | `examples/gen_coverage_cells.rs:94-96`, `examples/syntax_census.rs` | quarter-plane chroma arithmetic | same |248 | `examples/gen_coverage_cells.rs:94-96`, `examples/syntax_census.rs` | quarter-plane chroma arithmetic | same |
218 249
219 `mc.rs`, `intra.rs`, `transform.rs`, `compound.rs` are clean — plane dims arrive as250 `mc.rs`, `intra.rs`, `transform.rs`, `compound.rs` are clean — plane dims arrive as
220 parameters. `restoration.rs` and `film_grain.rs` are per-axis and correct.251 parameters. `restoration.rs` and `film_grain.rs` are per-axis and correct.
221 `motion_field.rs:74`'s `/ 2` is the 8×8 MV-cell grid, not a chroma extent.252 `motion_field.rs:74`'s `/ 2` is the 8×8 MV-cell grid, not a chroma extent.
222 253
254+## Housekeeping
255+
256+An early edit of this lane leaked into the primary checkout through a relative
257+path and was reverted before any commit (`git checkout --` on the one file it
258+touched); a second leak, the `stream.rs` gate, was caught the same way. The
259+primary checkout is clean at every commit on this branch, and no commit here
260+contains either hunk.
261+
223 ## Not closed, stated plainly262 ## Not closed, stated plainly
224 263
225-1. **No aomenc witness proves the new guard FIRES**, because libaom's encoder264+1. **The structural gate is a derived site list, not a proof.** It pins the
226- cannot emit the symbol (§ Evidence). The red-before-green proof for the guard265+ mechanism for 19 walks and guard ordering for the hole, but it cannot see a
227- is mutation-based, not corpus-based. This is the same limitation the merged266+ walk that is neither named in the census nor reachable through a
228- lane's guards carry and is not fixable from this side.
229-2. **The structural gate is a derived site list, not a proof.** It pins the
230- mechanism for 19 walks and the guard ordering for the hole, but it cannot see
231- a walk that is neither named in the census nor reachable through a
232 `partition_w<N>` read — e.g. a future site fed a block shape from a267 `partition_w<N>` read — e.g. a future site fed a block shape from a
233- non-partition source. The census is a ratchet, not a proof.
234-3. **`decode_rect4_16_intrabc`'s `else` arm is still wrong in isolation.** It is
235- closed by reachability, not by construction. Closing it by construction would
236- mean making the arm `unreachable!("...")` at `ss (1,0) && !horz` — deliberately
237- not done here, because that would assert a property of the callers from inside
238- the callee and break the moment the arm gains a legal 4:2:2 VERT_4 use.
\ No newline at end of file\ No newline at end of file
268+ non-partition source. The census is a ratchet.
269+2. **Two guards are level-claimed, not site-claimed** (kf 8x8 second resolution,
270+ inter 128-root). The merged scan's count cross-check is what reds them.
271+3. **The read-spelling derivation is syntactic.** A read reaching a `partition_w`
272+ CDF through a helper that does not mention the CDF name would not be enumerated.
273+4. **`decode_rect4_16_intrabc`'s `else` arm is still wrong in isolation** — closed
274+ by reachability, not construction. Closing it by construction would mean
275+ asserting a caller property from inside the callee, and breaking the moment the
276+ arm gains a legal 4:2:2 VERT_4 use.
277+5. **Why aomenc never produces this shape is unknown.** The witness had to be
278+ built from this crate's own encoder with a declared width. See the reachability
279+ section — the earlier `partition_rect_allowed` explanation was wrong.
\ No newline at end of file\ No newline at end of file