forge
Explore
Log in

Don't you dare go Hollow

Give the interintra gate an arm that can actually produce a rect interintra block

Browse files at this commit

30e31106188cccefcfe2a80a4cd5e0f02af4516fAhmet Kaan GümüşParent: 00a6ca0
  • test
    • give the interintra gate an arm that can actually produce a rect interintra block
Show full message
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.rsmodified+55 -0
@@ -14152,6 +14152,61 @@ mod tests {
14152 decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"14152 decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
14153 );14153 );
14154 }14154 }
14155+ // lane-midcut r3 RECT ARM: the recipe above spells
14156+ // `--enable-rect-partitions=0 --min-partition-size=32`, so it can
14157+ // never produce a RECT interintra block -- the delta assert at the
14158+ // end of this gate was unsatisfiable on it (the gate disabled the
14159+ // very shape it claims to prove). Re-encode the SAME source with
14160+ // the rect overrides APPENDED (aomenc keeps the LAST occurrence of
14161+ // a repeated flag) and compare every decode-order frame of that
14162+ // stream against aomdec, until a rect interintra block fires.
14163+ if crate::decode::interintra_rect_hits() == rect_before {
14164+ let mut rect_args = args.clone();
14165+ rect_args.extend_from_slice(&[
14166+ "--enable-rect-partitions=1",
14167+ "--min-partition-size=8",
14168+ "--max-partition-size=64",
14169+ ]);
14170+ let mut child = Command::new(aomenc_path())
14171+ .args(&rect_args)
14172+ .stdin(Stdio::piped())
14173+ .stdout(Stdio::piped())
14174+ .stderr(Stdio::piped())
14175+ .spawn()
14176+ .expect("aomenc failed to start");
14177+ child
14178+ .stdin
14179+ .take()
14180+ .expect("aomenc stdin")
14181+ .write_all(&y4m.stdout)
14182+ .expect("writing y4m to aomenc");
14183+ let out = child.wait_with_output().expect("aomenc failed to run");
14184+ assert!(
14185+ out.status.success(),
14186+ "{NAME} RECT-ARM: aomenc refused its own recipe plus the rect overrides: {}",
14187+ String::from_utf8_lossy(&out.stderr)
14188+ );
14189+ let rect_stream = out.stdout;
14190+ match decode_stream(&rect_stream) {
14191+ Err(e) => {
14192+ let msg = e.to_string();
14193+ assert!(
14194+ msg.contains("unsupported"),
14195+ "{NAME} RECT-ARM failed outright, not a named refusal (seed {seed}): {msg}"
14196+ );
14197+ eprintln!("{NAME} RECT-ARM: skipped on a named refusal: {msg}");
14198+ }
14199+ Ok(_) => {
14200+ let (total, hidden) =
14201+ decode_all_frames_vs_oracle(&rect_stream, &format!("{NAME}-rect"));
14202+ eprintln!(
14203+ "{NAME} RECT-ARM: seed {seed}: {total} decode-order frames, {hidden} \
14204+ hidden, all pixel-exact vs the oracle, interintra_rect_hits={}",
14205+ crate::decode::interintra_rect_hits() - rect_before
14206+ );
14207+ }
14208+ }
14209+ }
14155 matched += 1;14210 matched += 1;
14156 }14211 }
14157 assert!(14212 assert!(