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
Browse files at this commitded6f5cdfb62f6dd1d1561fca90d84fe8eb6cf74Parent: 5cb1524- feat
- 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
4 changed files +91 -30
- crates/ec-av1/src/decode.rs +6 -13
- crates/ec-av1/src/refusal_inventory.rs +2 -4
- crates/ec-av1/src/stream.rs +41 -13
- lanes/leaf8tx-r4.report.md +42 -0
crates/ec-av1/src/decode.rsmodified+6 -13
| @@ -22598,18 +22598,11 @@ fn decode_inter_block8( | ||
| 22598 | 22598 | skip, |
| 22599 | 22599 | )? |
| 22600 | 22600 | .1; |
| 22601 | - // lane-leaf8tx r2: the per-TU loop below is written and its ENTROPY is | |
| 22602 | - // range-exact against aomdec for 1216 of 1217 luma 4x4 txb_skip reads | |
| 22603 | - // on the 10-bit seed-68 stream, but the 1217th (the split leaf at | |
| 22604 | - // mi(30,36) of frame 5) reads the same table/ctx with a DIFFERENT | |
| 22605 | - // adapted CDF row, so the refusal stays until a gate is green. | |
| 22606 | - // `EC_LEAF8TX_SPLIT=1` bypasses it for the ablation arms. | |
| 22607 | - if intra_leaves.is_some() && std::env::var_os("EC_LEAF8TX_SPLIT").is_none() { | |
| 22608 | - return Err(unsupported( | |
| 22609 | - "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 \ | |
| 22610 | - transform units", | |
| 22611 | - )); | |
| 22612 | - } | |
| 22601 | + // lane-leaf8tx r4: the per-TU loop below is entropy- and pixel-exact | |
| 22602 | + // against aomdec once `tx_size_context_txfm` stopped reading | |
| 22603 | + // `above_inter`/`left_inter` four mi away (r3), so the refusal that | |
| 22604 | + // used to sit here is lifted; gate | |
| 22605 | + // `a_real_aomenc_{,10bit_}inter_sequence_with_an_angle_delta_8x8_intra_leaf_decodes_pixel_exact`. | |
| 22613 | 22606 | split8 = intra_leaves.is_some(); |
| 22614 | 22607 | let reach = Reach::of(SIDE, px, py, y.width, y.height); |
| 22615 | 22608 | if let Some(leaves) = intra_leaves { |
| @@ -25671,7 +25664,7 @@ mod tests { | ||
| 25671 | 25664 | neighbour_filter(None, [3, 3]) |
| 25672 | 25665 | .unwrap_err() |
| 25673 | 25666 | .to_string() |
| 25674 | - .contains("an OBMC neighbour whose interp filter was never recorded"), | |
| 25667 | + .contains("an OBMC neighbour whose switchable interp filter was never recorded"), | |
| 25675 | 25668 | "the [3, 3] sentinel must refuse by name, never panic" |
| 25676 | 25669 | ); |
| 25677 | 25670 | assert!(neighbour_filter(None, [3, 0]).is_err()); |
crates/ec-av1/src/refusal_inventory.rsmodified+2 -4
| @@ -36,8 +36,6 @@ const REFUSALS: &[&str] = &[ | ||
| 36 | 36 | "a sub-8x8 inter block under a scaled reference (superres, unimplemented)", |
| 37 | 37 | "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)", |
| 38 | 38 | "a COMPOUND_WEDGE mask on a non-square inter block (rect wedge codebook unimplemented)", |
| 39 | - "a 1:4 rect strip that actually uses a palette (reconstruction is not ported at this shape)", | |
| 40 | - "an inter partition below 8x8 (this decoder codes no inter leaf smaller than 8x8; lane-sub8 scoped to intra)", | |
| 41 | 39 | "an OBMC neighbour whose switchable interp filter was never recorded", |
| 42 | 40 | "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", |
| 43 | 41 | "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] = &[ | ||
| 68 | 66 | // lane-intrainter r1 lifted the >=16x16 square case (per-TU intra |
| 69 | 67 | // prediction + coefficients, gate |
| 70 | 68 | // `a_real_aomenc_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact`); |
| 71 | - // the 8x8 leaf's TX_4X4 2x2 grid is still refused here. | |
| 72 | - "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 transform units", | |
| 69 | + // lane-leaf8tx r4 lifted the 8x8 leaf's TX_4X4 2x2 grid (gate | |
| 70 | + // `a_real_aomenc_inter_sequence_with_an_angle_delta_8x8_intra_leaf_decodes_pixel_exact`). | |
| 73 | 71 | "an inter frame with no key frame before it", |
| 74 | 72 | "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)", |
| 75 | 73 | // lane-inter16ab r1 lifted the AB half (HORZ_A/HORZ_B/VERT_A/VERT_B at |
crates/ec-av1/src/stream.rsmodified+41 -13
| @@ -6625,6 +6625,7 @@ mod tests { | ||
| 6625 | 6625 | let (width, height, frame_count) = (192usize, 128usize, 6usize); |
| 6626 | 6626 | let mut refusals = Vec::new(); |
| 6627 | 6627 | let mut uncounted_exact = 0u32; |
| 6628 | + let mut counted_exact = 0u32; | |
| 6628 | 6629 | let mut totals = (0usize, 0usize); |
| 6629 | 6630 | for attempt in 0..30u32 { |
| 6630 | 6631 | let seed = 42 + attempt; |
| @@ -6740,8 +6741,24 @@ mod tests { | ||
| 6740 | 6741 | "--max-partition-size=8", |
| 6741 | 6742 | ], |
| 6742 | 6743 | Ok(_) => vec!["--enable-tx-size-search=0", "--enable-angle-delta=0"], |
| 6743 | - // Shipped recipe: only THIS lane's lifted tool is on. | |
| 6744 | - Err(_) => vec!["--enable-tx-size-search=0", "--enable-angle-delta=1"], | |
| 6744 | + // Shipped recipe (lane-leaf8tx r4): BOTH of this lane's | |
| 6745 | + // tools on -- the tx_depth split at an 8x8 intra-in-inter | |
| 6746 | + // leaf is what the lifted refusal covers, so | |
| 6747 | + // `--enable-tx-size-search=1` must survive the per-arm | |
| 6748 | + // override (aomenc keeps the LAST occurrence). Odd | |
| 6749 | + // attempts also cap the partition at 8x8, the shape that | |
| 6750 | + // produces the 2x2 TX_4X4 grid most often. | |
| 6751 | + Err(_) => { | |
| 6752 | + if attempt % 2 == 1 { | |
| 6753 | + vec![ | |
| 6754 | + "--enable-tx-size-search=1", | |
| 6755 | + "--enable-angle-delta=1", | |
| 6756 | + "--max-partition-size=8", | |
| 6757 | + ] | |
| 6758 | + } else { | |
| 6759 | + vec!["--enable-tx-size-search=1", "--enable-angle-delta=1"] | |
| 6760 | + } | |
| 6761 | + } | |
| 6745 | 6762 | }) |
| 6746 | 6763 | .arg(&y4m_path) |
| 6747 | 6764 | .stdin(Stdio::null()) |
| @@ -6829,24 +6846,35 @@ mod tests { | ||
| 6829 | 6846 | assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})"); |
| 6830 | 6847 | } |
| 6831 | 6848 | if counted { |
| 6832 | - gate_buckets( | |
| 6833 | - &name, | |
| 6834 | - 1, | |
| 6835 | - uncounted_exact, | |
| 6836 | - refusals.len() - uncounted_exact as usize, | |
| 6837 | - ); | |
| 6838 | - return; | |
| 6849 | + counted_exact += 1; | |
| 6839 | 6850 | } |
| 6840 | 6851 | } |
| 6852 | + // lane-leaf8tx r4: continue-and-sweep -- every arm is encoded, | |
| 6853 | + // decoded and pixel-compared on every plane of every decode-order | |
| 6854 | + // frame above; the counters are asserted ONCE here. A decode error or | |
| 6855 | + // a mismatch is a failure, never a SKIP, and `uncounted_exact` | |
| 6856 | + // (decoded + compared but neither capability fired) is the | |
| 6857 | + // out-of-scope-mismatch bucket that the sweep tolerates only while at | |
| 6858 | + // least one attempt did fire. | |
| 6841 | 6859 | gate_buckets( |
| 6842 | 6860 | &name, |
| 6843 | - 0, | |
| 6861 | + counted_exact, | |
| 6844 | 6862 | uncounted_exact, |
| 6845 | 6863 | refusals.len() - uncounted_exact as usize, |
| 6846 | 6864 | ); |
| 6847 | - panic!( | |
| 6848 | - "{name} never observed a nonzero angle delta on an 8x8 intra leaf in an inter \ | |
| 6849 | - frame (totals split/angle {totals:?}):\n{}", | |
| 6865 | + assert!( | |
| 6866 | + totals.0 > 0, | |
| 6867 | + "{name}: no decoded+compared attempt carried an 8x8 intra-in-inter leaf with \ | |
| 6868 | + tx_depth split to 4x4 (split-tx per size {:?}, angle-delta {}):\n{}", | |
| 6869 | + decode::intra_in_inter_split_tx_hits(), | |
| 6870 | + totals.1, | |
| 6871 | + refusals.join("\n") | |
| 6872 | + ); | |
| 6873 | + assert!( | |
| 6874 | + totals.1 > 0, | |
| 6875 | + "{name}: no decoded+compared attempt carried a nonzero angle_delta_y on an 8x8 \ | |
| 6876 | + intra-in-inter leaf (split-tx {}):\n{}", | |
| 6877 | + totals.0, | |
| 6850 | 6878 | refusals.join("\n") |
| 6851 | 6879 | ); |
| 6852 | 6880 | } |
lanes/leaf8tx-r4.report.mdadded+42 -0
| @@ -0,0 +1,42 @@ | ||
| 1 | +# lane-leaf8tx r4 report -- refusal lifted, gate swept | |
| 2 | + | |
| 3 | +## What changed | |
| 4 | +- `crates/ec-av1/src/decode.rs:22602` -- the refusal "an 8x8 intra leaf in an inter frame | |
| 5 | + whose tx_depth splits it into 4x4 transform units" and its `EC_LEAF8TX_SPLIT=1` env bypass | |
| 6 | + are DELETED; the per-TU 4x4 path is now the only path for that leaf. (Root cause that | |
| 7 | + unblocked it landed in r3, `d226074`: `tx_size_context_txfm` read `above_inter`/`left_inter` | |
| 8 | + at `mi/4`.) | |
| 9 | +- `crates/ec-av1/src/refusal_inventory.rs:69` -- the refusal string removed, replaced by the | |
| 10 | + lane note naming the gate that carries it. | |
| 11 | +- `crates/ec-av1/src/stream.rs:6574,6580` -- `tx_split_angle_in_inter8_gate` is now | |
| 12 | + continue-and-sweep: all 30 aomenc arms of each bit-depth run, every decode-order frame is | |
| 13 | + pixel-compared on Y/U/V (a mismatch is an immediate FAILURE, never a SKIP), and the two hit | |
| 14 | + counters are asserted ONCE after the sweep -- `totals.0 > 0` (an 8x8 intra-in-inter leaf with | |
| 15 | + tx_depth split to 4x4 was decoded AND compared) and `totals.1 > 0` (nonzero `angle_delta_y`). | |
| 16 | +- `crates/ec-av1/src/gate_coverage.rs` -- unchanged, and correctly so: it keys on `--enable-*` | |
| 17 | + flags, and this gate already spells `--enable-tx-size-search=1`/`--enable-angle-delta=1`, so | |
| 18 | + no entry named the lifted tool. | |
| 19 | +- `crates/ec-av1/src/stream.rs:6740` -- the SHIPPED recipe of that gate used to append | |
| 20 | + `--enable-tx-size-search=0` (aomenc keeps the LAST occurrence), so the split it is meant to | |
| 21 | + prove never fired: measured 0 split-tx hits on 30 arms. It now ships | |
| 22 | + `--enable-tx-size-search=1 --enable-angle-delta=1`, and odd attempts add | |
| 23 | + `--max-partition-size=8` (the shape that produces the 2x2 TX_4X4 grid most often). | |
| 24 | +- `crates/ec-av1/src/decode.rs:25668` -- the r2 merge kept main's refusal text ("an OBMC | |
| 25 | + neighbour whose *switchable* interp filter was never recorded") but the unit test still | |
| 26 | + asserted the pre-merge string; test updated to main's text. NOT a decode change. | |
| 27 | +- `crates/ec-av1/src/refusal_inventory.rs` -- two strings the r2 rectchroma2 merge made stale | |
| 28 | + ("a 1:4 rect strip that actually uses a palette", "an inter partition below 8x8") deleted; | |
| 29 | + `the_decode_path_refuses_exactly_the_listed_cases` demanded exactly that. | |
| 30 | + | |
| 31 | +## Gate | |
| 32 | +``` | |
| 33 | +EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-leaf8tx \ | |
| 34 | + cargo test -p ec-av1 --lib -j3 -- --nocapture --test-threads=3 \ | |
| 35 | + angle_delta_8x8_intra_leaf cdef_and_sub16 refusal_inventory gate_coverage \ | |
| 36 | + an_obmc_neighbour_with_no_recorded_filter_refuses_instead_of_panicking | |
| 37 | +``` | |
| 38 | +`test result: ok. 16 passed; 0 failed; 0 ignored; 423 filtered out; finished in 79.26s` | |
| 39 | +(log `$HOME/.cache/leaf8tx-r4-step23.log`) | |
| 40 | + | |
| 41 | +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 | |
| 42 | +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) |