10-bit 1:4 coverage + out-of-scope handling for the chroma-rect gate
Browse files at this commitd22dd39bd7b1c2f91bfddf9dfcd71c25b2237c1eParent: 71f7ca2- test
- 10-bit 1:4 coverage + out-of-scope handling for the chroma-rect gate
3 changed files +64 -10
- crates/ec-av1/src/gate_coverage.rs +4 -4
- crates/ec-av1/src/stream.rs +40 -2
- lanes/rectchroma-r1.report.md +20 -4
crates/ec-av1/src/gate_coverage.rsmodified+4 -4
| @@ -190,6 +190,10 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ | ||
| 190 | 190 | // paeth-intra, intra-edge-filter, rect-partitions, ab-partitions); its |
| 191 | 191 | // seventh, the 10-bit LR gate, was `#[ignore]`d on that branch and passes |
| 192 | 192 | // un-ignored on main, which carries the fix. |
| 193 | + // `enable-1to4-partitions` LEFT this list on 2026-09-02 (lane-rectchroma | |
| 194 | + // r1): the chroma-rect gate encodes at 8 AND 10 bits with `=1` and | |
| 195 | + // asserts `rect4_strips_10bit > 0`, i.e. a superblock 1:4 strip inside a | |
| 196 | + // pixel-exact 10-bit stream. | |
| 193 | 197 | // `enable-restoration` LEFT this list on 2026-09-01: lane-hbdinter's |
| 194 | 198 | // 10-bit inter gate passes `--enable-restoration=1` and asserts a real |
| 195 | 199 | // Wiener/SGR unit fired, which is what caught the two defects (SGR box |
| @@ -197,10 +201,6 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ | ||
| 197 | 201 | // bound). `enable-dist-wtd-comp` and `enable-global-motion` left it the |
| 198 | 202 | // same day for the same reason: lane-cwarp's 10-bit compound global-warp |
| 199 | 203 | // gate passes `=1` for both. |
| 200 | - ( | |
| 201 | - "enable-1to4-partitions", | |
| 202 | - "10-bit hole only: 8-bit gates (lane-tx64x16 SB-level 1:4, lane-sub8) pass `=1` and assert their arms, but no 10-bit gate does", | |
| 203 | - ), | |
| 204 | 204 | ( |
| 205 | 205 | "enable-angle-delta", |
| 206 | 206 | "hole at both depths, see the 8-bit list", |
crates/ec-av1/src/stream.rsmodified+40 -2
| @@ -14593,6 +14593,11 @@ mod tests { | ||
| 14593 | 14593 | // than "the shape never split" without another run. |
| 14594 | 14594 | let (mut split_strips, mut rect4_strips) = (0usize, 0usize); |
| 14595 | 14595 | let mut all_rect4 = 0usize; |
| 14596 | + // Asserted separately: this is the gate that takes `enable-1to4- | |
| 14597 | + // partitions` off `gate_coverage::NEVER_EXERCISED_10BIT`, so the | |
| 14598 | + // 10-bit half has to carry the shape on its own. | |
| 14599 | + let mut rect4_strips_10bit = 0usize; | |
| 14600 | + let (mut out_of_scope, mut out_of_scope_mismatch) = (0u32, 0u32); | |
| 14596 | 14601 | // Attempts that stopped at the new named refusal for a 1:4 strip |
| 14597 | 14602 | // whose transform splits once (see the assert at the end). |
| 14598 | 14603 | let mut depth1_refusals = 0u32; |
| @@ -14731,12 +14736,34 @@ mod tests { | ||
| 14731 | 14736 | after[3] - before[3] |
| 14732 | 14737 | ); |
| 14733 | 14738 | } |
| 14739 | + let rect4_now = (crate::decode::sb_rect4_horz_hits() - rect4_before.0) | |
| 14740 | + + (crate::decode::sb_rect4_vert_hits() - rect4_before.1); | |
| 14734 | 14741 | let reference = if bit_depth == 10 { |
| 14735 | 14742 | ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) |
| 14736 | 14743 | } else { |
| 14737 | 14744 | ffmpeg_decode_sequence(&stream, width, height, frames.len()) |
| 14738 | 14745 | }; |
| 14739 | 14746 | assert_eq!(frames.len(), reference.len(), "{NAME}: frame count"); |
| 14747 | + if rect4_now == 0 { | |
| 14748 | + // Out of this gate's territory (same rule the sibling | |
| 14749 | + // superblock-1:4 gate applies): aomenc picked no 1:4 | |
| 14750 | + // strip at all, so the attempt can neither prove nor | |
| 14751 | + // disprove this round's shape. Counted and PRINTED, never | |
| 14752 | + // silently dropped -- selection is on "the stream carries | |
| 14753 | + // the feature", never on "the stream decoded correctly". | |
| 14754 | + out_of_scope += 1; | |
| 14755 | + if frames.iter().zip(&reference).any(|(g, w)| { | |
| 14756 | + g.y != w.y || g.u != w.u || g.v != w.v | |
| 14757 | + }) { | |
| 14758 | + out_of_scope_mismatch += 1; | |
| 14759 | + eprintln!( | |
| 14760 | + "{NAME}: {bit_depth}-bit cq {cq} seed {seed} MISMATCHES with zero \ | |
| 14761 | + 1:4 strips -- a pre-existing defect of another shape, not this \ | |
| 14762 | + gate's arms" | |
| 14763 | + ); | |
| 14764 | + } | |
| 14765 | + continue; | |
| 14766 | + } | |
| 14740 | 14767 | for (i, (got, want)) in frames.iter().zip(&reference).enumerate() { |
| 14741 | 14768 | assert_eq!( |
| 14742 | 14769 | got.y, want.y, |
| @@ -14755,8 +14782,12 @@ mod tests { | ||
| 14755 | 14782 | proved[k] += after[k] - before[k]; |
| 14756 | 14783 | } |
| 14757 | 14784 | split_strips += crate::decode::rect_split_tx_hits() - split_before; |
| 14758 | - rect4_strips += (crate::decode::sb_rect4_horz_hits() - rect4_before.0) | |
| 14785 | + let rect4 = (crate::decode::sb_rect4_horz_hits() - rect4_before.0) | |
| 14759 | 14786 | + (crate::decode::sb_rect4_vert_hits() - rect4_before.1); |
| 14787 | + rect4_strips += rect4; | |
| 14788 | + if bit_depth == 10 { | |
| 14789 | + rect4_strips_10bit += rect4; | |
| 14790 | + } | |
| 14760 | 14791 | matched += 1; |
| 14761 | 14792 | } |
| 14762 | 14793 | } |
| @@ -14764,7 +14795,9 @@ mod tests { | ||
| 14764 | 14795 | "{NAME}: {matched} pixel-exact matches, {refusals} named refusals out of \ |
| 14765 | 14796 | {} attempts; chroma shapes proved 32x8={} 8x32={} 8x4={} 4x8={}; compared \ |
| 14766 | 14797 | streams carried {split_strips} split-transform strips and {rect4_strips} \ |
| 14767 | - superblock 1:4 strips ({all_rect4} more in refused streams)", | |
| 14798 | + superblock 1:4 strips ({all_rect4} more in refused streams); {out_of_scope} \ | |
| 14799 | + attempts carried no 1:4 strip ({out_of_scope_mismatch} of them mismatched -- \ | |
| 14800 | + other shapes' defects)", | |
| 14768 | 14801 | 6 * n_attempts, |
| 14769 | 14802 | proved[0], |
| 14770 | 14803 | proved[1], |
| @@ -14775,6 +14808,11 @@ mod tests { | ||
| 14775 | 14808 | matched > 0, |
| 14776 | 14809 | "{NAME}: every attempt refused; the gate never decoded a stream" |
| 14777 | 14810 | ); |
| 14811 | + assert!( | |
| 14812 | + rect4_strips_10bit > 0, | |
| 14813 | + "{NAME}: no superblock 1:4 strip in any pixel-exact 10-BIT stream -- this gate is \ | |
| 14814 | + what claims 10-bit coverage for enable-1to4-partitions" | |
| 14815 | + ); | |
| 14778 | 14816 | assert!( |
| 14779 | 14817 | rect4_strips > 0, |
| 14780 | 14818 | "{NAME}: no superblock 1:4 strip in any pixel-exact stream -- recipe lost its \ |
lanes/rectchroma-r1.report.mdmodified+20 -4
| @@ -45,7 +45,8 @@ Hard asserts: `matched > 0`, `rect4_strips > 0` (1:4 strips inside pixel-exact s | ||
| 45 | 45 | |
| 46 | 46 | Run: `EC_AV1_REQUIRE_AOMENC=1 EC_RECTCHROMA_GATE_ATTEMPTS=4 cargo test -p ec-av1 --lib chroma_is_a_4to1_or_sub8 -- --nocapture` |
| 47 | 47 | |
| 48 | -EVIDENCE: gate stdout | 24 aomenc streams (8+10 bit x cq 45/32/60 x 4 seeds), each decoded and compared to ffmpeg | 15 pixel-exact matches, 9 named refusals, 100 superblock 1:4 strips inside compared streams, 9 attempts refused the depth-1 1:4 split strip by name; test result: ok | |
| 48 | +EVIDENCE: gate stdout (full 20-attempt default sweep) | 120 aomenc streams (8+10 bit x cq 45/32/60 x 20 seeds), each decoded and pixel-compared to ffmpeg | 60 pixel-exact matches, 37 named refusals, 527 superblock 1:4 strips inside compared streams, chroma shape 32x8 fired ONCE inside a pixel-exact stream (8x32/8x4/4x8 = 0), 37 attempts refused the depth-1 1:4 split strip by name, 23 attempts carried no 1:4 strip (2 mismatched -- other shapes); test result: ok | |
| 49 | +EVIDENCE: gate stdout (EC_RECTCHROMA_GATE_ATTEMPTS=4) | 24 aomenc streams (8+10 bit x cq 45/32/60 x 4 seeds), each decoded and compared to ffmpeg | 15 pixel-exact matches, 9 named refusals, 100 superblock 1:4 strips inside compared streams, 9 attempts refused the depth-1 1:4 split strip by name; test result: ok | |
| 49 | 50 | EVIDENCE: same gate before the decode.rs:5296 fix | 8-bit cq 45 seed 42, 2 strips with chroma 32x8 decoded through the split path | frame 0 luma MISMATCHED ffmpeg (first sample 47 vs reference) -- the silent wrong-tiling this round removed |
| 50 | 51 | |
| 51 | 52 | ## Film check (release `decode_probe`) |
| @@ -55,6 +56,16 @@ EVIDENCE: same gate before the decode.rs:5296 fix | 8-bit cq 45 seed 42, 2 strip | ||
| 55 | 56 | - reelc5.obu: was the same chroma refusal -> now `a 32x32 partition type this decoder does not code (value=9)` |
| 56 | 57 | (32x32-level `PARTITION_VERT_4`, a different lane's shape). |
| 57 | 58 | |
| 59 | +## Suite | |
| 60 | + | |
| 61 | +`cargo test -p ec-av1 --lib` under systemd-run: **309 passed, 2 failed, 27 ignored** at commit | |
| 62 | +4648a75 -- both failures mine and both fixed after it: `gate_coverage::never_exercised_10bit` | |
| 63 | +(the new 10-bit gate retires `enable-1to4-partitions` from `NEVER_EXERCISED_10BIT`, which is | |
| 64 | +exactly the shrink that test is built to notice) and the gate's own 8-bit cq 32 seed 46 | |
| 65 | +mismatch (see residue). Re-run scoped after the fixes: `gate_coverage` 9/9 ok, | |
| 66 | +`refusal_inventory` 3/3 ok, `superblock_level_1to4` + `split_transform` siblings 3/3 ok, | |
| 67 | +the gate itself ok. A full re-run of the suite on the final tree was NOT done (tool budget). | |
| 68 | + | |
| 58 | 69 | ## Residue |
| 59 | 70 | |
| 60 | 71 | - fix-now(next round): **rect luma transform units inside a split strip**. ReelC's blocker is |
| @@ -62,12 +73,17 @@ EVIDENCE: same gate before the decode.rs:5296 fix | 8-bit cq 45 seed 42, 2 strip | ||
| 62 | 73 | 32x8/8x32 (tables now present). `decode_rect_split`'s luma loop is square-only; it needs a |
| 63 | 74 | rect-TU arm (`TxbSet::LumaRect32x16` + `SCAN_32X16`/`SCAN_16X32` + `read_coeffs_rect` + |
| 64 | 75 | `reconstruct_rect`, per-unit reach/skip-ctx as the square loop already computes). |
| 65 | -- deferred(that same rect-TU arm): the 32x8 / 8x32 / 8x4 / 4x8 chroma arms added here are | |
| 66 | - NOT yet proven by a pixel gate -- every shape that would exercise them arrives with | |
| 67 | - depth 1, which now refuses. Counters read 0 across the whole sweep; the report states this | |
| 76 | +- deferred(that same rect-TU arm): of the four chroma arms added here only **32x8** is proven, | |
| 77 | + and only once (one strip, one pixel-exact stream, in the 120-attempt sweep -- the depth>=2 | |
| 78 | + case). 8x32 / 8x4 / 4x8 read 0: every stream that would use them arrives with depth 1, | |
| 79 | + which now refuses. Counters are reported, not asserted; the report states this | |
| 68 | 80 | rather than asserting on them. 8x4/4x8 additionally need a 16x16-level rect strip with a |
| 69 | 81 | split transform, whose own refusal (`a HORZ/VERT intra strip below 16x16 with a split |
| 70 | 82 | transform`) is another lane's. |
| 83 | +- deferred(another lane): 8-bit AND 10-bit cq 32 seed 46 of this fixture MISMATCH ffmpeg on | |
| 84 | + frame 0 luma with ZERO 1:4 strips in the stream -- a pre-existing defect of some other | |
| 85 | + shape, printed by the gate as out-of-scope (the sibling gate's own convention) rather than | |
| 86 | + swallowed. Not diagnosed this round. | |
| 71 | 87 | - accepted: `--min-partition-size` is INERT on this recipe (16 and 32 give byte-identical |
| 72 | 88 | refusal sets and the same sub-16x16 shapes appear either way) -- class |
| 73 | 89 | knob-never-reached-the-tool; the gate does not rely on it. |