diff --git a/crates/ec-av1/src/gate_coverage.rs b/crates/ec-av1/src/gate_coverage.rs index aee0c31e..ade37960 100644 --- a/crates/ec-av1/src/gate_coverage.rs +++ b/crates/ec-av1/src/gate_coverage.rs @@ -190,17 +190,15 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ // paeth-intra, intra-edge-filter, rect-partitions, ab-partitions); its // seventh, the 10-bit LR gate, was `#[ignore]`d on that branch and passes // un-ignored on main, which carries the fix. - // `enable-1to4-partitions` LEFT this list on 2026-09-02 (lane-rectchroma - // r1): the chroma-rect gate encodes at 8 AND 10 bits with `=1` and - // asserts `rect4_strips_10bit > 0`, i.e. a superblock 1:4 strip inside a - // pixel-exact 10-bit stream. // `enable-restoration` LEFT this list on 2026-09-01: lane-hbdinter's // 10-bit inter gate passes `--enable-restoration=1` and asserts a real // Wiener/SGR unit fired, which is what caught the two defects (SGR box // sums never brought back to the 8-bit scale, Wiener clamp at the wrong // bound). `enable-dist-wtd-comp` and `enable-global-motion` left it the // same day for the same reason: lane-cwarp's 10-bit compound global-warp - // gate passes `=1` for both. + // gate passes `=1` for both. `enable-1to4-partitions` left it on 2026-09-02: + // lane-tx64x16 r4's 32-level 1:4 gate has a 10-bit arm that asserts both + // orientations and coded strips inside pixel-exact attempts. ( "enable-angle-delta", "hole at both depths, see the 8-bit list", diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index ebc3b5a5..0d08ed48 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -2450,7 +2450,7 @@ mod tests { "--enable-tx-size-search=0", "--enable-cdef=1", "--enable-restoration=1", - "--min-partition-size=32", + "--min-partition-size=16", "--max-partition-size=32", "--enable-palette=0", "--enable-intrabc=0", @@ -14570,6 +14570,13 @@ mod tests { fn a_real_aomenc_stream_with_a_coded_strip_whose_chroma_is_a_4to1_or_sub8_rect_decodes_pixel_exact() { const NAME: &str = "a_real_aomenc_stream_with_a_coded_strip_whose_chroma_is_a_4to1_or_sub8_rect_decodes_pixel_exact"; + // Seed 46 mismatches ffmpeg at cq 32 on BOTH depths while carrying + // ZERO 1:4 strips -- an open defect of another shape, being diagnosed + // by lane-band46. Excluded here by name so this gate's + // `out_of_scope_mismatch` assert stays a hard 0 instead of swallowing + // it; the pin below decodes exactly that seed and is what un-ignoring + // will prove. + const EXCLUDED_SEEDS: &[u32] = &[46]; let _gate_lock = lock_gate_counters(); if !have_ffmpeg() { eprintln!("SKIP {NAME}: no ffmpeg"); @@ -14602,99 +14609,12 @@ mod tests { // whose transform splits once (see the assert at the end). let mut depth1_refusals = 0u32; for (bit_depth, cq) in [(8u32, 45u32), (8, 32), (8, 60), (10, 45), (10, 32), (10, 60)] { - let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }; for attempt in 0..n_attempts { let seed = 42 + attempt; - // `gradients_source`, the content the sibling split-transform - // superblock gate uses. A band/noise `geq` fixture was tried - // first (r1) and gave 12/12 pixel-exact streams carrying ZERO - // 1:4 strips -- vacuous. Odd attempts render it transposed so - // HORZ_4 and VERT_4 both appear (class scan-weights-cross-axis). - let bands = format!( - "geq=lum='mod(floor(Y/16),2)*160+48':cb=128:cr=128,noise=alls=10:all_seed={seed}" - ); - let source = if attempt % 2 == 0 { - format!("color=c=black:size={width}x{height}:duration=0.04:rate=25,{bands}") - } else { - format!( - "color=c=black:size={height}x{width}:duration=0.04:rate=25,{bands},transpose=1" - ) - }; - let y4m = Command::new("ffmpeg") - .args([ - "-v", "error", "-f", "lavfi", "-i", &source, "-t", "0.04", "-pix_fmt", - pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-", - ]) - .stdin(Stdio::null()) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .output() - .expect("ffmpeg failed to run"); - assert!( - y4m.status.success(), - "{NAME}: ffmpeg refused the {bit_depth}-bit fixture: {}", - String::from_utf8_lossy(&y4m.stderr) - ); - let cq_arg = format!("--cq-level={cq}"); - let depth_arg = format!("--bit-depth={bit_depth}"); - let input_depth_arg = format!("--input-bit-depth={bit_depth}"); - let mut child = Command::new(aomenc_path()) - .args([ - "--codec=av1", - "--passes=1", - "--end-usage=q", - &cq_arg, - "--cpu-used=0", - "--threads=1", - "--row-mt=0", - "--sb-size=64", - &depth_arg, - &input_depth_arg, - "--enable-rect-partitions=1", - // AB off: it competes with 1:4 in the RD search (with - // AB on, 0 superblock 1:4 strips appeared in 16 - // compared streams), and AB below 16x16 is another - // lane's refusal. - "--enable-ab-partitions=0", - "--enable-1to4-partitions=1", - // 16, not 8: with 8 every seed of this recipe stops - // at a 32x32-level PARTITION_HORZ_4/VERT_4 (partition - // values 8/9, 32x8/8x32 luma strips), a shape this - // decoder does not code at all yet -- 12/12 attempts - // refused before a pixel was compared (measured r1). - // At 16 the 1:4 split happens at the superblock, the - // 64x16/16x64 strips whose chroma half is 32x8/8x32. - "--min-partition-size=16", - "--max-partition-size=64", - "--enable-restoration=0", - "--enable-palette=0", - "--deltaq-mode=0", - "--enable-filter-intra=0", - "--enable-cfl-intra=0", - "--enable-intrabc=0", - "--obu", - "-o", - "-", - "-", - ]) - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn() - .expect("aomenc failed to start"); - child - .stdin - .take() - .expect("aomenc stdin") - .write_all(&y4m.stdout) - .expect("writing y4m to aomenc"); - let out = child.wait_with_output().expect("aomenc failed to run"); - assert!( - out.status.success(), - "{NAME}: aomenc refused the fixture: {}", - String::from_utf8_lossy(&out.stderr) - ); - let stream = out.stdout; + if EXCLUDED_SEEDS.contains(&seed) { + continue; + } + let stream = rectchroma_stream(bit_depth, cq, attempt, width, height); let before = crate::decode::rect_split_chroma_shape_hits(); let split_before = crate::decode::rect_split_tx_hits(); let rect4_before = ( @@ -14804,6 +14724,12 @@ mod tests { proved[2], proved[3] ); + assert_eq!( + out_of_scope_mismatch, 0, + "{NAME}: {out_of_scope_mismatch} attempts carrying no 1:4 strip mismatched \ + ffmpeg -- a defect of another shape, not out of scope for the suite (the one \ + known case, seed 46, is in EXCLUDED_SEEDS and pinned separately)" + ); assert!( matched > 0, "{NAME}: every attempt refused; the gate never decoded a stream" @@ -14834,4 +14760,147 @@ mod tests { ); eprintln!("{NAME}: {depth1_refusals} attempts refused the depth-1 1:4 split strip by name"); } + + /// The chroma-rect gate's fixture + aomenc recipe for one attempt, shared + /// with the seed-46 pin test below so the pin cannot drift from the gate. + fn rectchroma_stream( + bit_depth: u32, + cq: u32, + attempt: u32, + width: usize, + height: usize, + ) -> Vec { + const NAME: &str = "rectchroma_stream"; + let seed = 42 + attempt; + let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }; + // `gradients_source`, the content the sibling split-transform + // superblock gate uses. A band/noise `geq` fixture was tried + // first (r1) and gave 12/12 pixel-exact streams carrying ZERO + // 1:4 strips -- vacuous. Odd attempts render it transposed so + // HORZ_4 and VERT_4 both appear (class scan-weights-cross-axis). + let bands = format!( + "geq=lum='mod(floor(Y/16),2)*160+48':cb=128:cr=128,noise=alls=10:all_seed={seed}" + ); + let source = if attempt % 2 == 0 { + format!("color=c=black:size={width}x{height}:duration=0.04:rate=25,{bands}") + } else { + format!( + "color=c=black:size={height}x{width}:duration=0.04:rate=25,{bands},transpose=1" + ) + }; + let y4m = Command::new("ffmpeg") + .args([ + "-v", "error", "-f", "lavfi", "-i", &source, "-t", "0.04", "-pix_fmt", + pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-", + ]) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .expect("ffmpeg failed to run"); + assert!( + y4m.status.success(), + "{NAME}: ffmpeg refused the {bit_depth}-bit fixture: {}", + String::from_utf8_lossy(&y4m.stderr) + ); + let cq_arg = format!("--cq-level={cq}"); + let depth_arg = format!("--bit-depth={bit_depth}"); + let input_depth_arg = format!("--input-bit-depth={bit_depth}"); + let mut child = Command::new(aomenc_path()) + .args([ + "--codec=av1", + "--passes=1", + "--end-usage=q", + &cq_arg, + "--cpu-used=0", + "--threads=1", + "--row-mt=0", + "--sb-size=64", + &depth_arg, + &input_depth_arg, + "--enable-rect-partitions=1", + // AB off: it competes with 1:4 in the RD search (with + // AB on, 0 superblock 1:4 strips appeared in 16 + // compared streams), and AB below 16x16 is another + // lane's refusal. + "--enable-ab-partitions=0", + "--enable-1to4-partitions=1", + // 16, not 8: with 8 every seed of this recipe stops + // at a 32x32-level PARTITION_HORZ_4/VERT_4 (partition + // values 8/9, 32x8/8x32 luma strips), a shape this + // decoder does not code at all yet -- 12/12 attempts + // refused before a pixel was compared (measured r1). + // At 16 the 1:4 split happens at the superblock, the + // 64x16/16x64 strips whose chroma half is 32x8/8x32. + "--min-partition-size=16", + "--max-partition-size=64", + "--enable-restoration=0", + "--enable-palette=0", + "--deltaq-mode=0", + "--enable-filter-intra=0", + "--enable-cfl-intra=0", + "--enable-intrabc=0", + "--obu", + "-o", + "-", + "-", + ]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m.stdout) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "{NAME}: aomenc refused the fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + out.stdout + } + + /// PIN for the one stream the chroma-rect gate excludes: cq 32 seed 46 + /// mismatches ffmpeg at BOTH bit depths while carrying zero 1:4 strips, + /// so the defect belongs to some other shape -- the stream decodes, the + /// pixels are wrong. Undiagnosed; lane-band46 owns it. Un-ignoring this + /// test is the proof that it is fixed. + #[test] + #[ignore = "band fixture cq32 seed 46 mismatches ffmpeg with zero 1:4 strips (8- and 10-bit) -- undiagnosed, lane-band46"] + fn the_chroma_rect_gates_excluded_seed_46_decodes_pixel_exact() { + const NAME: &str = "the_chroma_rect_gates_excluded_seed_46_decodes_pixel_exact"; + let _gate_lock = lock_gate_counters(); + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + return; + } + let (width, height) = (192usize, 128usize); + // seed 46 == attempt 4 of the gate's sweep, cq 32. + for bit_depth in [8u32, 10] { + let stream = rectchroma_stream(bit_depth, 32, 4, width, height); + let frames = decode_stream(&stream) + .unwrap_or_else(|e| panic!("{NAME}: {bit_depth}-bit seed 46 refused: {e}")); + let reference = if bit_depth == 10 { + ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) + } else { + ffmpeg_decode_sequence(&stream, width, height, frames.len()) + }; + assert_eq!(frames.len(), reference.len(), "{NAME}: frame count"); + for (i, (got, want)) in frames.iter().zip(&reference).enumerate() { + assert_eq!(got.y, want.y, "{NAME} frame {i} luma ({bit_depth}-bit seed 46)"); + assert_eq!(got.u, want.u, "{NAME} frame {i} U ({bit_depth}-bit seed 46)"); + assert_eq!(got.v, want.v, "{NAME} frame {i} V ({bit_depth}-bit seed 46)"); + } + } + } + } diff --git a/lanes/rectchroma-r1.report.md b/lanes/rectchroma-r1.report.md index f89fea89..aafa2285 100644 --- a/lanes/rectchroma-r1.report.md +++ b/lanes/rectchroma-r1.report.md @@ -87,3 +87,55 @@ the gate itself ok. A full re-run of the suite on the final tree was NOT done (t - accepted: `--min-partition-size` is INERT on this recipe (16 and 32 give byte-identical refusal sets and the same sub-16x16 shapes appear either way) -- class knob-never-reached-the-tool; the gate does not rely on it. + +## r2 — verifier FAIL fixes (587d388 -> this commit) + +Three verifier findings, all test-file only; no decode-path change. + +1. **`out_of_scope_mismatch` was printed, not asserted** (`crates/ec-av1/src/stream.rs`, + gate `a_real_aomenc_stream_with_a_coded_strip_whose_chroma_is_a_4to1_or_sub8_rect_decodes_pixel_exact`). + Now `assert_eq!(out_of_scope_mismatch, 0, ...)`, matching main's two sibling 1:4 gates + (main 8262b99 stream.rs:15340/15573). The two real mismatches that assert would have + caught (8-bit and 10-bit, cq 32, **seed 46**, zero 1:4 strips) are NOT swallowed: + - `const EXCLUDED_SEEDS: &[u32] = &[46];` skips exactly that seed in this gate's window, + with a comment naming the open defect and its owner (lane-band46); + - `#[ignore]`d pin `the_chroma_rect_gates_excluded_seed_46_decodes_pixel_exact` decodes + seed 46 at **both** depths through the same recipe and asserts pixel-exact, so + un-ignoring it is the proof the defect is fixed. It shares the gate's fixture/aomenc + recipe through the new `rectchroma_stream(bit_depth, cq, attempt, width, height)` + helper, so the pin cannot drift from the gate. + + Gate run with the assert live: **57 pixel-exact matches, 36 named refusals out of 120 + attempts; 21 attempts carried no 1:4 strip, 0 of them mismatched**; chroma shapes proved + 32x8=1; compared streams carried 12 split-transform strips and 499 superblock 1:4 strips. + +2. **`--min-partition-size` 16->32 in `a_real_aomenc_10bit_inter_sequence_decodes_pixel_exact` + reverted** (stream.rs:2453 back to `=16`). The verifier proved the gate passes at 16 on + this tree, so the narrowing was unneeded coverage loss and a merge conflict with main. + `git diff main -- crates/ec-av1/src/stream.rs` now contains no added `--min-partition-size` + line at all. Gate re-run: **ok**. + +3. **`gate_coverage.rs` made a no-op against main**: main already dropped + `enable-1to4-partitions` from `NEVER_EXERCISED_10BIT` with its own comment (lane-tx64x16 + r4). The lane's duplicate comment paragraph is gone and main's wording restored, so the + file's only remaining delta from the merge base is byte-identical to main's own change -- + the merge is clean. + +### Gates run (r2) + +`ec_av1` lib suite, filtered by name, `--test-threads=1 --nocapture`: + +``` +test stream::tests::a_real_aomenc_stream_with_a_coded_strip_whose_chroma_is_a_4to1_or_sub8_rect_decodes_pixel_exact ... ok +test stream::tests::a_real_aomenc_10bit_inter_sequence_decodes_pixel_exact ... ok +test gate_coverage::tests::* (8) ... ok +test refusal_inventory::tests::* (3) ... ok +test result: ok. 14 passed; 0 failed; 0 ignored; 325 filtered out; finished in 27.58s +``` + +Full suite not re-run: 311/0/27 at 587d388 (verifier), and r2 touches test code only. + +### Open (unchanged by r2) + +- cq 32 seed 46 mismatches ffmpeg at both depths with **zero** 1:4 strips -- another shape's + defect, undiagnosed, owned by lane-band46, pinned by the ignored test above.