From abb01bd95257b4526e7c9631d784cd3956062a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 3 Oct 2026 06:22:48 +0300 Subject: [PATCH] ec-av1: the inventory listed 33 strings and PROVEN carried 31 rows Nothing compared the two sets. every_proven_refusal_names_a_test_that_exists walks PROVEN -> "is this string still a live decode-path refusal, and does its gate quote it", so a refusal ADDED to REFUSALS with no proving gate was invisible: on main the BLOCK_INVALID subsize refusal and the lone filter-intra capability claim were both listed and both unmeasured, and the module's own printed counts (32 refusals + 1 capability claim, 31 proven) sat 17 lines apart without anyone comparing them. Both rows are registered: - the BLOCK_INVALID subsize refusal (refuse_invalid_plane_block, libaom's get_plane_block_size rule at decodeframe.c:1456) -> a_422_header_over_a_420_tile_refuses_the_subsize_libaom_calls_corrupt, NegativeGate. That gate asserted only the libaom citation INSIDE the refusal ("invalid with this subsampling mode"), so a reworded guard stayed green as long as it kept citing decodeframe.c:1456; it now quotes the refusal WHOLE and asserts our own string on the error. Proven non-vacuous by mutating one word of the guard ("no chroma" -> "no CHROMA"): the gate reds at stream.rs on the new assertion, where the old one would have passed. - the filter-intra capability claim -> a_sb_level_horz_vert_strip_admits_no_filter_intra_symbol, Enumeration. Its body already quotes the claim's leading clause, which is what that anchor check accepts. Anchor strength moves from 25 WHOLE / 6 LEADING CLAUSE to 26 / 7 over 33 rows, 0 matching neither. New test every_listed_refusal_and_capability_claim_has_a_proven_row holds the other direction (listed string -> a row that proves it) and requires the two sets to be one to one. Red proof: deleting either new row turns it red on its own assertion, naming the unmeasured string. --- crates/ec-av1/src/refusal_inventory.rs | 68 ++++++++++++++++++++++++++ crates/ec-av1/src/stream.rs | 15 ++++++ 2 files changed, 83 insertions(+) diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index eda5b7d2..f532a9c3 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -696,6 +696,35 @@ const PROVEN: &[(&str, &str, Proof)] = &[ "an_inter_frame_naming_an_unrefreshed_primary_ref_slot_is_refused_by_name", Proof::NegativeGate, ), + // lane-av1bookkeep W1-4, NEGATIVE: the BLOCK_INVALID subsize refusal + // (`refuse_invalid_plane_block`, decode.rs). It is libaom's own rule + // (`get_plane_block_size` -> `AOM_CODEC_CORRUPT_FRAME`, decodeframe.c:1456) + // applied to a stream whose header and tile disagree. The pin is a 4:2:2 + // sequence header over a 4:2:0 key frame's tile, whose partition symbols + // name 8x16 -- a subsize with no chroma plane block at ss (1,0) -- so the + // guard FIRES, by name, and the gate also drives a genuine 4:2:2 pin that + // must still decode, so it cannot pass by refusing everything. The gate's + // body quotes the refusal WHOLE (not just the libaom citation inside it), + // which is what makes this row an anchor the checker can hold. + ( + "a block size 4x8, 8x16 or 16x4 (or 8x4 at 4:4:0) has no chroma plane block at this frame's subsampling mode (libaom: \\\"Block size %dx%d invalid with this subsampling mode\\\", av1/decoder/decodeframe.c:1456, refusing by the same rule)", + "a_422_header_over_a_420_tile_refuses_the_subsize_libaom_calls_corrupt", + Proof::NegativeGate, + ), + // lane-av1bookkeep W1-4, ENUMERATION: the LONE capability claim. The guard + // in `decode_block_rect` fires only when `filter_intra.is_some()`, and that + // flag is `Some` only where `filter_intra_size_class_rect` says so. The + // strips the guard protects are `(64, 32)` / `(32, 64)`; + // `av1_filter_intra_allowed_bsize` caps both sides at 32x32, so no conformant + // stream offers the symbol there. The gate walks every EXPLICIT arm of the + // table (none admits a 64 axis), drives the square-delegate's callee + // `filter_intra_size_class` at 32 and 64 directly, and quotes the claim's + // leading clause in its own body. + ( + "filter intra on a superblock-level HORZ/VERT strip (never expected -- av1_filter_intra_allowed_bsize caps at 32x32)", + "a_sb_level_horz_vert_strip_admits_no_filter_intra_symbol", + Proof::Enumeration, + ), ]; /// Gates whose `Err` arm turns a decode failure into a printed SKIP rather than @@ -2698,6 +2727,45 @@ mod tests { ); } + /// The OTHER half of the inventory's invariant: every string LISTED in + /// [`REFUSALS`] or [`CAPABILITY_CLAIMS`] has a row in [`PROVEN`]. + /// + /// `every_proven_refusal_names_a_test_that_exists` checks the direction + /// row -> live refusal, so a string added to the inventory with no proving + /// gate was invisible: the file could list 33 strings, carry 31 rows, and + /// every test in the module stayed green. Two rows were missing on main + /// (the BLOCK_INVALID subsize refusal and the lone filter-intra capability + /// claim) precisely because nothing compared the two sets. This is that + /// comparison, so the next one cannot land unmeasured. + #[test] + fn every_listed_refusal_and_capability_claim_has_a_proven_row() { + let mut listed = 0usize; + let mut unmeasured: Vec<&str> = Vec::new(); + for reason in REFUSALS.iter().chain(CAPABILITY_CLAIMS.iter()) { + listed += 1; + if !PROVEN.iter().any(|(row, _, _)| *row == *reason) { + unmeasured.push(reason); + } + } + assert!( + unmeasured.is_empty(), + "these strings are listed as refusals / capability claims but no PROVEN row names a \ + gate that proves them -- an unmeasured claim is what this table exists to make \ + visible:\n{unmeasured:#?}" + ); + assert_eq!( + listed, + PROVEN.len(), + "{listed} strings are listed and {} rows exist -- they must be one to one, so a row \ + can never stand in for a string that is not listed", + PROVEN.len() + ); + eprintln!( + "refusal inventory: {listed} listed strings, {} PROVEN rows, one to one", + PROVEN.len() + ); + } + /// Lane-av1refusalspan, non-vacuity of the BOUNDARY (not of the anchor): /// a neighbour's function must be unreachable from a gate's body, and a /// body that is not closed must fail rather than run on. diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 439c8823..bff955b8 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -2936,6 +2936,16 @@ pub(crate) mod tests { .join("fixtures") .join("440_request_is_422.obu"); let pinned = read_pin(&path, 2014, 0x98a1378df976253d, NAME); + // The refusal this gate PROVES, quoted whole -- the anchor the PROVEN + // row in `refusal_inventory.rs` is checked against inside this body's + // own bounds. The assertion below used to match only the libaom + // citation *inside* the string, so a reworded guard kept passing for + // as long as it kept citing `decodeframe.c:1456`: the half that names + // OUR shapes (4x8 / 8x16 / 16x4, and 8x4 at 4:4:0) was never pinned. + const REFUSAL: &str = "a block size 4x8, 8x16 or 16x4 (or 8x4 at 4:4:0) has no chroma \ + plane block at this frame's subsampling mode (libaom: \"Block \ + size %dx%d invalid with this subsampling mode\", \ + av1/decoder/decodeframe.c:1456, refusing by the same rule)"; let err = decode_stream(&pinned) .err() .unwrap_or_else(|| panic!("{NAME}: the pin must be REFUSED, not decoded")); @@ -2945,6 +2955,11 @@ pub(crate) mod tests { "{NAME}: the refusal must name the rule it refuses by (libaom's own wording), got: \ {msg}" ); + assert!( + msg.contains(REFUSAL), + "{NAME}: the refusal must be this decoder's OWN string, whole -- the guard's wording \ + drifted, so the PROVEN row no longer names what fires, got: {msg}" + ); // Positive control: a real 4:2:2 stream must still decode, so the gate // cannot pass by refusing everything. let ok_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))