From 30e31106188cccefcfe2a80a4cd5e0f02af4516f 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 22:47:23 +0300 Subject: [PATCH] test(av1): give the interintra gate an arm that can actually produce a rect interintra block The interintra gate's recipe spells `--enable-rect-partitions=0 --min-partition-size=32`, so it cannot emit a rectangular block at all and lane-midcut r1's `interintra_rect_hits` delta assert was unsatisfiable on it (40 pixel-exact matches, counter 0 -- the gate disabled the very shape the assert claims to prove). Added a RECT ARM that re-encodes the same source with `--enable-rect-partitions=1 --min-partition-size=8 --max-partition-size=64` appended (aomenc keeps the LAST occurrence of a repeated flag) and compares every decode-order frame of that stream against aomdec, running per seed until the counter fires. Result: seed 46's rect arm decodes 24/24 decode-order frames pixel-exact with interintra_rect_hits=4, and the gate is green again (1 passed, 11.7 s). --- crates/ec-av1/src/stream.rs | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 9f4311d2..f82c697e 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -14152,6 +14152,61 @@ mod tests { decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" ); } + // lane-midcut r3 RECT ARM: the recipe above spells + // `--enable-rect-partitions=0 --min-partition-size=32`, so it can + // never produce a RECT interintra block -- the delta assert at the + // end of this gate was unsatisfiable on it (the gate disabled the + // very shape it claims to prove). Re-encode the SAME source with + // the rect overrides APPENDED (aomenc keeps the LAST occurrence of + // a repeated flag) and compare every decode-order frame of that + // stream against aomdec, until a rect interintra block fires. + if crate::decode::interintra_rect_hits() == rect_before { + let mut rect_args = args.clone(); + rect_args.extend_from_slice(&[ + "--enable-rect-partitions=1", + "--min-partition-size=8", + "--max-partition-size=64", + ]); + let mut child = Command::new(aomenc_path()) + .args(&rect_args) + .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} RECT-ARM: aomenc refused its own recipe plus the rect overrides: {}", + String::from_utf8_lossy(&out.stderr) + ); + let rect_stream = out.stdout; + match decode_stream(&rect_stream) { + Err(e) => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "{NAME} RECT-ARM failed outright, not a named refusal (seed {seed}): {msg}" + ); + eprintln!("{NAME} RECT-ARM: skipped on a named refusal: {msg}"); + } + Ok(_) => { + let (total, hidden) = + decode_all_frames_vs_oracle(&rect_stream, &format!("{NAME}-rect")); + eprintln!( + "{NAME} RECT-ARM: seed {seed}: {total} decode-order frames, {hidden} \ + hidden, all pixel-exact vs the oracle, interintra_rect_hits={}", + crate::decode::interintra_rect_hits() - rect_before + ); + } + } + } matched += 1; } assert!(