forge
Explore
Log in

Don't you dare go Hollow

Merge 983b138d (refusalaudit) — suite green: refusalaudit 624/0

Browse files at this commit

d1df7234c4294f654b2adb0454a807226c7a0997Ahmet Kaan GümüşParent: f0a8ab26d20a72
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 ///
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.