From ded6f5cdfb62f6dd1d1561fca90d84fe8eb6cf74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Sep 2026 15:11:08 +0300 Subject: [PATCH] feat(av1): decode an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 transform units -- refusal lifted, its EC_LEAF8TX_SPLIT bypass removed, and the gate that proves it now sweeps all 30 aomenc arms at both bit depths with one end-of-sweep counter assert; the gate's shipped recipe had --enable-tx-size-search=0 last, so the split it claims to cover fired 0 times before this commit Also: the OBMC sentinel unit test asserted the pre-merge refusal text, and two refusal strings the rectchroma2 merge made stale are dropped from the inventory. --- crates/ec-av1/src/decode.rs | 19 +++------ crates/ec-av1/src/refusal_inventory.rs | 6 +-- crates/ec-av1/src/stream.rs | 54 +++++++++++++++++++------- lanes/leaf8tx-r4.report.md | 42 ++++++++++++++++++++ 4 files changed, 91 insertions(+), 30 deletions(-) create mode 100644 lanes/leaf8tx-r4.report.md diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index f2685aa9..a3c71ade 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -22598,18 +22598,11 @@ fn decode_inter_block8( skip, )? .1; - // lane-leaf8tx r2: the per-TU loop below is written and its ENTROPY is - // range-exact against aomdec for 1216 of 1217 luma 4x4 txb_skip reads - // on the 10-bit seed-68 stream, but the 1217th (the split leaf at - // mi(30,36) of frame 5) reads the same table/ctx with a DIFFERENT - // adapted CDF row, so the refusal stays until a gate is green. - // `EC_LEAF8TX_SPLIT=1` bypasses it for the ablation arms. - if intra_leaves.is_some() && std::env::var_os("EC_LEAF8TX_SPLIT").is_none() { - return Err(unsupported( - "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 \ - transform units", - )); - } + // lane-leaf8tx r4: the per-TU loop below is entropy- and pixel-exact + // against aomdec once `tx_size_context_txfm` stopped reading + // `above_inter`/`left_inter` four mi away (r3), so the refusal that + // used to sit here is lifted; gate + // `a_real_aomenc_{,10bit_}inter_sequence_with_an_angle_delta_8x8_intra_leaf_decodes_pixel_exact`. split8 = intra_leaves.is_some(); let reach = Reach::of(SIDE, px, py, y.width, y.height); if let Some(leaves) = intra_leaves { @@ -25671,7 +25664,7 @@ mod tests { neighbour_filter(None, [3, 3]) .unwrap_err() .to_string() - .contains("an OBMC neighbour whose interp filter was never recorded"), + .contains("an OBMC neighbour whose switchable interp filter was never recorded"), "the [3, 3] sentinel must refuse by name, never panic" ); assert!(neighbour_filter(None, [3, 0]).is_err()); diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 3590ee67..4250f87f 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -36,8 +36,6 @@ const REFUSALS: &[&str] = &[ "a sub-8x8 inter block under a scaled reference (superres, unimplemented)", "an inter 8x8 HORZ partition (two BLOCK_8X4 inter leaves; entropy-exact now, but a measured sweep still drifts |d|<=2 in luma after the filters)", "a COMPOUND_WEDGE mask on a non-square inter block (rect wedge codebook unimplemented)", - "a 1:4 rect strip that actually uses a palette (reconstruction is not ported at this shape)", - "an inter partition below 8x8 (this decoder codes no inter leaf smaller than 8x8; lane-sub8 scoped to intra)", "an OBMC neighbour whose switchable interp filter was never recorded", "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", @@ -68,8 +66,8 @@ const REFUSALS: &[&str] = &[ // lane-intrainter r1 lifted the >=16x16 square case (per-TU intra // prediction + coefficients, gate // `a_real_aomenc_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact`); - // the 8x8 leaf's TX_4X4 2x2 grid is still refused here. - "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 transform units", + // lane-leaf8tx r4 lifted the 8x8 leaf's TX_4X4 2x2 grid (gate + // `a_real_aomenc_inter_sequence_with_an_angle_delta_8x8_intra_leaf_decodes_pixel_exact`). "an inter frame with no key frame before it", "an inter SB-level AB partition (HORZ_A/HORZ_B/VERT_A/VERT_B; this decoder's inter tile path codes a superblock as NONE, SPLIT, HORZ, VERT, HORZ_4 or VERT_4)", // lane-inter16ab r1 lifted the AB half (HORZ_A/HORZ_B/VERT_A/VERT_B at diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index ad78add6..913c5555 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -6625,6 +6625,7 @@ mod tests { let (width, height, frame_count) = (192usize, 128usize, 6usize); let mut refusals = Vec::new(); let mut uncounted_exact = 0u32; + let mut counted_exact = 0u32; let mut totals = (0usize, 0usize); for attempt in 0..30u32 { let seed = 42 + attempt; @@ -6740,8 +6741,24 @@ mod tests { "--max-partition-size=8", ], Ok(_) => vec!["--enable-tx-size-search=0", "--enable-angle-delta=0"], - // Shipped recipe: only THIS lane's lifted tool is on. - Err(_) => vec!["--enable-tx-size-search=0", "--enable-angle-delta=1"], + // Shipped recipe (lane-leaf8tx r4): BOTH of this lane's + // tools on -- the tx_depth split at an 8x8 intra-in-inter + // leaf is what the lifted refusal covers, so + // `--enable-tx-size-search=1` must survive the per-arm + // override (aomenc keeps the LAST occurrence). Odd + // attempts also cap the partition at 8x8, the shape that + // produces the 2x2 TX_4X4 grid most often. + Err(_) => { + if attempt % 2 == 1 { + vec![ + "--enable-tx-size-search=1", + "--enable-angle-delta=1", + "--max-partition-size=8", + ] + } else { + vec!["--enable-tx-size-search=1", "--enable-angle-delta=1"] + } + } }) .arg(&y4m_path) .stdin(Stdio::null()) @@ -6829,24 +6846,35 @@ mod tests { assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})"); } if counted { - gate_buckets( - &name, - 1, - uncounted_exact, - refusals.len() - uncounted_exact as usize, - ); - return; + counted_exact += 1; } } + // lane-leaf8tx r4: continue-and-sweep -- every arm is encoded, + // decoded and pixel-compared on every plane of every decode-order + // frame above; the counters are asserted ONCE here. A decode error or + // a mismatch is a failure, never a SKIP, and `uncounted_exact` + // (decoded + compared but neither capability fired) is the + // out-of-scope-mismatch bucket that the sweep tolerates only while at + // least one attempt did fire. gate_buckets( &name, - 0, + counted_exact, uncounted_exact, refusals.len() - uncounted_exact as usize, ); - panic!( - "{name} never observed a nonzero angle delta on an 8x8 intra leaf in an inter \ - frame (totals split/angle {totals:?}):\n{}", + assert!( + totals.0 > 0, + "{name}: no decoded+compared attempt carried an 8x8 intra-in-inter leaf with \ + tx_depth split to 4x4 (split-tx per size {:?}, angle-delta {}):\n{}", + decode::intra_in_inter_split_tx_hits(), + totals.1, + refusals.join("\n") + ); + assert!( + totals.1 > 0, + "{name}: no decoded+compared attempt carried a nonzero angle_delta_y on an 8x8 \ + intra-in-inter leaf (split-tx {}):\n{}", + totals.0, refusals.join("\n") ); } diff --git a/lanes/leaf8tx-r4.report.md b/lanes/leaf8tx-r4.report.md new file mode 100644 index 00000000..f4cf8801 --- /dev/null +++ b/lanes/leaf8tx-r4.report.md @@ -0,0 +1,42 @@ +# lane-leaf8tx r4 report -- refusal lifted, gate swept + +## What changed +- `crates/ec-av1/src/decode.rs:22602` -- the refusal "an 8x8 intra leaf in an inter frame + whose tx_depth splits it into 4x4 transform units" and its `EC_LEAF8TX_SPLIT=1` env bypass + are DELETED; the per-TU 4x4 path is now the only path for that leaf. (Root cause that + unblocked it landed in r3, `d226074`: `tx_size_context_txfm` read `above_inter`/`left_inter` + at `mi/4`.) +- `crates/ec-av1/src/refusal_inventory.rs:69` -- the refusal string removed, replaced by the + lane note naming the gate that carries it. +- `crates/ec-av1/src/stream.rs:6574,6580` -- `tx_split_angle_in_inter8_gate` is now + continue-and-sweep: all 30 aomenc arms of each bit-depth run, every decode-order frame is + pixel-compared on Y/U/V (a mismatch is an immediate FAILURE, never a SKIP), and the two hit + counters are asserted ONCE after the sweep -- `totals.0 > 0` (an 8x8 intra-in-inter leaf with + tx_depth split to 4x4 was decoded AND compared) and `totals.1 > 0` (nonzero `angle_delta_y`). +- `crates/ec-av1/src/gate_coverage.rs` -- unchanged, and correctly so: it keys on `--enable-*` + flags, and this gate already spells `--enable-tx-size-search=1`/`--enable-angle-delta=1`, so + no entry named the lifted tool. +- `crates/ec-av1/src/stream.rs:6740` -- the SHIPPED recipe of that gate used to append + `--enable-tx-size-search=0` (aomenc keeps the LAST occurrence), so the split it is meant to + prove never fired: measured 0 split-tx hits on 30 arms. It now ships + `--enable-tx-size-search=1 --enable-angle-delta=1`, and odd attempts add + `--max-partition-size=8` (the shape that produces the 2x2 TX_4X4 grid most often). +- `crates/ec-av1/src/decode.rs:25668` -- the r2 merge kept main's refusal text ("an OBMC + neighbour whose *switchable* interp filter was never recorded") but the unit test still + asserted the pre-merge string; test updated to main's text. NOT a decode change. +- `crates/ec-av1/src/refusal_inventory.rs` -- two strings the r2 rectchroma2 merge made stale + ("a 1:4 rect strip that actually uses a palette", "an inter partition below 8x8") deleted; + `the_decode_path_refuses_exactly_the_listed_cases` demanded exactly that. + +## Gate +``` +EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-leaf8tx \ + cargo test -p ec-av1 --lib -j3 -- --nocapture --test-threads=3 \ + angle_delta_8x8_intra_leaf cdef_and_sub16 refusal_inventory gate_coverage \ + an_obmc_neighbour_with_no_recorded_filter_refuses_instead_of_panicking +``` +`test result: ok. 16 passed; 0 failed; 0 ignored; 423 filtered out; finished in 79.26s` +(log `$HOME/.cache/leaf8tx-r4-step23.log`) + +EVIDENCE: $HOME/.cache/leaf8tx-r4-step23.log | 30 aomenc arms x 2 bit depths, every decode-order frame compared on Y/U/V vs ffmpeg | `tx_split_angle_in_inter8_gate(8): buckets counted-exact=29 uncounted-exact=1 named-refusals=0 (attempts 30)`, `tx_split_angle_in_inter8_gate(10): counted-exact=30 uncounted-exact=0 named-refusals=0 (attempts 30)`, 0 pixel mismatches +EVIDENCE: $HOME/.cache/leaf8tx-r4-step23.log | same run, split-leaf hit counter per arm | e.g. `(10) seed=43 --cq-level=19: 8x8 intra-in-inter leaves with tx_depth=1 315, nonzero angle_delta_y 124` -- the counter fires in the hundreds on decoded+compared attempts (it was 0 on every arm of the pre-r4 recipe)