forge
Explore
Log in

Don't you dare go Hollow

Every alt-ref gate now compares hidden frames -- decode-order compare at 13 sites + an --arnr-maxframes=0 second arm

Browse files at this commit

33130e2ae48efdbc7262268fc26359e31dc942cdAhmet Kaan GümüşParent: 8981bd6
  • test
    • every alt-ref gate now compares hidden frames -- decode-order compare at 13 sites + an --arnr-maxframes=0 second arm
    • finding: the gates' own recipes emit ~0 hidden frames (5 across 281 attempt-streams), the arm emits 1-3 each and all are pixel-exact
    • oracle rung 13 (EC_MODE_MV + EC_MODE_VAL stack=) lifted out of the hand-patched build tree into instrument-aom-oracle.sh
Show full message
test(av1): every alt-ref gate now compares hidden frames -- decode-order compare at 13 sites + an --arnr-maxframes=0 second arm; finding: the gates' own recipes emit ~0 hidden frames (5 across 281 attempt-streams), the arm emits 1-3 each and all are pixel-exact; oracle rung 13 (EC_MODE_MV + EC_MODE_VAL stack=) lifted out of the hand-patched build tree into instrument-aom-oracle.sh
crates/ec-av1/src/stream.rsmodified+309 -0
@@ -1740,6 +1740,68 @@ mod tests {
17401740 (oracle_frames, hidden)
17411741 }
17421742
1743+ /// lane-hidden r2: the `--arnr-maxframes=0` SECOND ARM of an existing
1744+ /// gate -- the gate's own recipe is never changed, this re-encodes the
1745+ /// same fixture with libaom's temporal alt-ref filter switched off and
1746+ /// runs [`decode_all_frames_vs_oracle`] on the result. Measured: with
1747+ /// the filter at its default EVERY alt-ref recipe in this file emits
1748+ /// ZERO hidden frames (the candidates are filtered away), so the
1749+ /// hidden-frame compare on the gate's own stream is vacuous; this arm
1750+ /// is what actually puts `show_frame == 0` frames on the wire.
1751+ ///
1752+ /// Runs at most once per gate name per process (the loop gates sweep
1753+ /// dozens of attempts and each arm costs a full encode + two decodes).
1754+ /// A stream this decoder refuses BY NAME skips the arm -- the arm is
1755+ /// about hidden frames, not about that capability gap -- while a pixel
1756+ /// mismatch is a hard failure raised inside the compare.
1757+ fn hidden_arnr_arm(name: &str, y4m: &[u8], args: &[&str]) -> Option<(usize, usize)> {
1758+ static ARMED: std::sync::OnceLock<std::sync::Mutex<std::collections::HashSet<String>>> =
1759+ std::sync::OnceLock::new();
1760+ if !ARMED
1761+ .get_or_init(Default::default)
1762+ .lock()
1763+ .unwrap()
1764+ .insert(name.to_string())
1765+ {
1766+ return None;
1767+ }
1768+ let mut arm: Vec<&str> = vec!["--arnr-maxframes=0"];
1769+ arm.extend_from_slice(args);
1770+ let mut child = Command::new(aomenc_path())
1771+ .args(&arm)
1772+ .stdin(Stdio::piped())
1773+ .stdout(Stdio::piped())
1774+ .stderr(Stdio::piped())
1775+ .spawn()
1776+ .expect("aomenc failed to start");
1777+ child
1778+ .stdin
1779+ .take()
1780+ .expect("aomenc stdin")
1781+ .write_all(y4m)
1782+ .expect("writing y4m to aomenc");
1783+ let out = child.wait_with_output().expect("aomenc failed to run");
1784+ assert!(
1785+ out.status.success(),
1786+ "{name} HIDDEN-ARM: aomenc refused its own recipe plus --arnr-maxframes=0: {}",
1787+ String::from_utf8_lossy(&out.stderr)
1788+ );
1789+ let stream = out.stdout;
1790+ match decode_stream(&stream) {
1791+ Err(e) => {
1792+ let msg = e.to_string();
1793+ assert!(
1794+ msg.contains("unsupported"),
1795+ "{name} HIDDEN-ARM failed outright: {msg}"
1796+ );
1797+ eprintln!("{name} HIDDEN-ARM: skipped on a named refusal: {msg}");
1798+ None
1799+ }
1800+ Ok(_) => Some(decode_all_frames_vs_oracle(&stream, &format!("{name}-arnr0"))),
1801+ }
1802+ }
1803+
1804+
17431805 /// The repo's first hidden-frame pixel gate. Every other aomenc gate
17441806 /// here compares `decode_stream`'s output against `ffmpeg -f obu`, and
17451807 /// both sides emit SHOWN frames only -- so an alt-ref frame that is
@@ -4191,6 +4253,25 @@ mod tests {
41914253 "{gate_name} frame {i} V vs ffmpeg (seed {seed})"
41924254 );
41934255 }
4256+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
4257+ // stream again, comparing EVERY decode-order frame -- the hidden
4258+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
4259+ // cannot see, because both sides of it emit shown frames only.
4260+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, gate_name);
4261+ eprintln!(
4262+ "{gate_name} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
4263+ {hidden_n} hidden, all pixel-exact vs the oracle"
4264+ );
4265+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
4266+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
4267+ // frames, so the compare above is vacuous -- re-encode the same
4268+ // fixture with --arnr-maxframes=0 and compare THOSE.
4269+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(gate_name, &y4m.stdout, &args) {
4270+ eprintln!(
4271+ "{gate_name} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
4272+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
4273+ );
4274+ }
41944275 eprintln!(
41954276 "{gate_name} FIRING seed {seed}: {target_ref_name} hits advanced by {}",
41964277 decode::ref_hits(target_ref) - before
@@ -4409,6 +4490,25 @@ mod tests {
44094490 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
44104491 }
44114492 }
4493+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
4494+ // stream again, comparing EVERY decode-order frame -- the hidden
4495+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
4496+ // cannot see, because both sides of it emit shown frames only.
4497+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
4498+ eprintln!(
4499+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
4500+ {hidden_n} hidden, all pixel-exact vs the oracle"
4501+ );
4502+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
4503+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
4504+ // frames, so the compare above is vacuous -- re-encode the same
4505+ // fixture with --arnr-maxframes=0 and compare THOSE.
4506+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
4507+ eprintln!(
4508+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
4509+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
4510+ );
4511+ }
44124512 eprintln!(
44134513 "{NAME} FIRING seed {seed}: comp_mode hits advanced by {}, decoded \
44144514 fully and pixel-exact",
@@ -4591,6 +4691,25 @@ mod tests {
45914691 );
45924692 }
45934693 }
4694+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
4695+ // stream again, comparing EVERY decode-order frame -- the hidden
4696+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
4697+ // cannot see, because both sides of it emit shown frames only.
4698+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
4699+ eprintln!(
4700+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
4701+ {hidden_n} hidden, all pixel-exact vs the oracle"
4702+ );
4703+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
4704+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
4705+ // frames, so the compare above is vacuous -- re-encode the same
4706+ // fixture with --arnr-maxframes=0 and compare THOSE.
4707+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
4708+ eprintln!(
4709+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
4710+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
4711+ );
4712+ }
45944713 eprintln!(
45954714 "{NAME} FIRING seed {seed}: skip_mode hits advanced by {}",
45964715 decode::skip_mode_hits() - before
@@ -4753,6 +4872,25 @@ mod tests {
47534872 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
47544873 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
47554874 }
4875+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
4876+ // stream again, comparing EVERY decode-order frame -- the hidden
4877+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
4878+ // cannot see, because both sides of it emit shown frames only.
4879+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
4880+ eprintln!(
4881+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
4882+ {hidden_n} hidden, all pixel-exact vs the oracle"
4883+ );
4884+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
4885+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
4886+ // frames, so the compare above is vacuous -- re-encode the same
4887+ // fixture with --arnr-maxframes=0 and compare THOSE.
4888+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
4889+ eprintln!(
4890+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
4891+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
4892+ );
4893+ }
47564894 eprintln!(
47574895 "{NAME} FIRING seed {seed}: obmc hits advanced by {}",
47584896 decode::obmc_hits() - before
@@ -4944,6 +5082,25 @@ mod tests {
49445082 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
49455083 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
49465084 }
5085+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
5086+ // stream again, comparing EVERY decode-order frame -- the hidden
5087+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
5088+ // cannot see, because both sides of it emit shown frames only.
5089+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
5090+ eprintln!(
5091+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
5092+ {hidden_n} hidden, all pixel-exact vs the oracle"
5093+ );
5094+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
5095+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
5096+ // frames, so the compare above is vacuous -- re-encode the same
5097+ // fixture with --arnr-maxframes=0 and compare THOSE.
5098+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
5099+ eprintln!(
5100+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
5101+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
5102+ );
5103+ }
49475104 eprintln!(
49485105 "{NAME} FIRING seed {seed}: 8x8 obmc hits {fired8} (total across attempts so far {total_obmc8})"
49495106 );
@@ -5110,6 +5267,25 @@ mod tests {
51105267 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
51115268 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
51125269 }
5270+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
5271+ // stream again, comparing EVERY decode-order frame -- the hidden
5272+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
5273+ // cannot see, because both sides of it emit shown frames only.
5274+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
5275+ eprintln!(
5276+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
5277+ {hidden_n} hidden, all pixel-exact vs the oracle"
5278+ );
5279+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
5280+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
5281+ // frames, so the compare above is vacuous -- re-encode the same
5282+ // fixture with --arnr-maxframes=0 and compare THOSE.
5283+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
5284+ eprintln!(
5285+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
5286+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
5287+ );
5288+ }
51135289 matched += 1;
51145290 }
51155291 assert!(
@@ -5559,6 +5735,25 @@ mod tests {
55595735 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
55605736 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
55615737 }
5738+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
5739+ // stream again, comparing EVERY decode-order frame -- the hidden
5740+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
5741+ // cannot see, because both sides of it emit shown frames only.
5742+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
5743+ eprintln!(
5744+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
5745+ {hidden_n} hidden, all pixel-exact vs the oracle"
5746+ );
5747+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
5748+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
5749+ // frames, so the compare above is vacuous -- re-encode the same
5750+ // fixture with --arnr-maxframes=0 and compare THOSE.
5751+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
5752+ eprintln!(
5753+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
5754+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
5755+ );
5756+ }
55625757 matched += 1;
55635758 }
55645759 assert!(
@@ -5739,6 +5934,25 @@ mod tests {
57395934 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
57405935 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
57415936 }
5937+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
5938+ // stream again, comparing EVERY decode-order frame -- the hidden
5939+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
5940+ // cannot see, because both sides of it emit shown frames only.
5941+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
5942+ eprintln!(
5943+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
5944+ {hidden_n} hidden, all pixel-exact vs the oracle"
5945+ );
5946+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
5947+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
5948+ // frames, so the compare above is vacuous -- re-encode the same
5949+ // fixture with --arnr-maxframes=0 and compare THOSE.
5950+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
5951+ eprintln!(
5952+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
5953+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
5954+ );
5955+ }
57425956 matched += 1;
57435957 }
57445958 assert!(
@@ -6060,6 +6274,25 @@ mod tests {
60606274 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
60616275 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
60626276 }
6277+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
6278+ // stream again, comparing EVERY decode-order frame -- the hidden
6279+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
6280+ // cannot see, because both sides of it emit shown frames only.
6281+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
6282+ eprintln!(
6283+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
6284+ {hidden_n} hidden, all pixel-exact vs the oracle"
6285+ );
6286+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
6287+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
6288+ // frames, so the compare above is vacuous -- re-encode the same
6289+ // fixture with --arnr-maxframes=0 and compare THOSE.
6290+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
6291+ eprintln!(
6292+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
6293+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
6294+ );
6295+ }
60636296 matched += 1;
60646297 }
60656298 assert!(
@@ -6261,6 +6494,25 @@ mod tests {
62616494 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
62626495 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
62636496 }
6497+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
6498+ // stream again, comparing EVERY decode-order frame -- the hidden
6499+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
6500+ // cannot see, because both sides of it emit shown frames only.
6501+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
6502+ eprintln!(
6503+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
6504+ {hidden_n} hidden, all pixel-exact vs the oracle"
6505+ );
6506+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
6507+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
6508+ // frames, so the compare above is vacuous -- re-encode the same
6509+ // fixture with --arnr-maxframes=0 and compare THOSE.
6510+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
6511+ eprintln!(
6512+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
6513+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
6514+ );
6515+ }
62646516 matched += 1;
62656517 }
62666518 assert!(
@@ -6467,6 +6719,25 @@ mod tests {
64676719 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
64686720 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
64696721 }
6722+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
6723+ // stream again, comparing EVERY decode-order frame -- the hidden
6724+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
6725+ // cannot see, because both sides of it emit shown frames only.
6726+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
6727+ eprintln!(
6728+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
6729+ {hidden_n} hidden, all pixel-exact vs the oracle"
6730+ );
6731+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
6732+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
6733+ // frames, so the compare above is vacuous -- re-encode the same
6734+ // fixture with --arnr-maxframes=0 and compare THOSE.
6735+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
6736+ eprintln!(
6737+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
6738+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
6739+ );
6740+ }
64706741 matched += 1;
64716742 }
64726743 // r1: observed flaky at 40 attempts -- aomenc's cpu-used=0 RD is
@@ -6899,6 +7170,25 @@ mod tests {
68997170 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
69007171 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
69017172 }
7173+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
7174+ // stream again, comparing EVERY decode-order frame -- the hidden
7175+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
7176+ // cannot see, because both sides of it emit shown frames only.
7177+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
7178+ eprintln!(
7179+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
7180+ {hidden_n} hidden, all pixel-exact vs the oracle"
7181+ );
7182+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
7183+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
7184+ // frames, so the compare above is vacuous -- re-encode the same
7185+ // fixture with --arnr-maxframes=0 and compare THOSE.
7186+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
7187+ eprintln!(
7188+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
7189+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
7190+ );
7191+ }
69027192 matched += 1;
69037193 }
69047194 assert!(
@@ -9209,6 +9499,25 @@ mod tests {
92099499 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
92109500 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
92119501 }
9502+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
9503+ // stream again, comparing EVERY decode-order frame -- the hidden
9504+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
9505+ // cannot see, because both sides of it emit shown frames only.
9506+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
9507+ eprintln!(
9508+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
9509+ {hidden_n} hidden, all pixel-exact vs the oracle"
9510+ );
9511+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
9512+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
9513+ // frames, so the compare above is vacuous -- re-encode the same
9514+ // fixture with --arnr-maxframes=0 and compare THOSE.
9515+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
9516+ eprintln!(
9517+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
9518+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
9519+ );
9520+ }
92129521 matched += 1;
92139522 }
92149523 assert!(
lanes/hidden-r2.report.mdadded+72 -0
@@ -0,0 +1,72 @@
1+# lane-hidden r2 — hidden-frame compare wired into the 15 alt-ref gates
2+
3+## What changed
4+- `crates/ec-av1/src/stream.rs` — 13 insertion sites, each **after** the gate's existing
5+ shown-frame `assert_eq!` loop, calling r1's `decode_all_frames_vs_oracle(&stream, NAME)`
6+ on the SAME stream bytes: every decode-order frame (hidden alt-refs included) byte-compared
7+ against the instrumented `aomdec`'s `EC_AV1_FINAL_DUMP`. No gate recipe was changed.
8+ Sites: `a_real_aomenc_single_ref_gate` (:4256, covers the last2/last3/bwdref/altref2/**altref**
9+ gates), reference_select :4493, compound_references :4694, obmc :4875, obmc_8x8 :5085,
10+ warped_motion :5270, interintra :5738, interintra_wedge :5937, free_partitions :6277,
11+ ab_partitions :6497, masked_compound :6722, cdef :7173, delta_q_and_delta_lf :9502.
12+- `crates/ec-av1/src/stream.rs:1745` — new `hidden_arnr_arm(name, y4m, args)`: the SECOND ARM.
13+ Re-encodes the gate's own fixture with the gate's own args **plus** `--arnr-maxframes=0`,
14+ runs the same decode-order compare, at most once per gate per process. A named
15+ ("unsupported") refusal on the arm's stream skips the arm; a pixel mismatch is a hard
16+ failure inside the compare. Called at the same 13 sites.
17+- `scripts/instrument-aom-oracle.sh` — **rung 13** (coordinator's extra item): lane-inter8 r3's
18+ hand patch of `~/.cache/aom-oracle/src/av1/decoder/decodemv.c` (an `EC_MODE_MV` line right
19+ after `assign_mv`, and `stack=<ref_mv_count[...]>` on rung 4's `EC_MODE_VAL`) existed only in
20+ the build tree; a script rebuild would have dropped it. Both are now script-applied,
21+ `EC_TRACE_MODE`-gated, idempotent.
22+
23+## Finding: every gate's own recipe is VACUOUS for hidden frames
24+`--auto-alt-ref=1 --lag-in-frames=16` does NOT put hidden frames on the wire — libaom's
25+temporal alt-ref filter absorbs the candidates. Across the whole suite the 15 gates decoded
26+**281 attempt-streams and saw 5 hidden frames in total**, 13 of the 16 gate names seeing zero.
27+Every gate claim of "hidden alt-refs included" is propagation only. `--arnr-maxframes=0` as a
28+second arm fixes it: 13 of 16 arms carry 1-3 hidden frames.
29+
30+| gate | attempts compared | hidden (own recipe) | ARM `--arnr-maxframes=0` | result |
31+|---|---|---|---|---|
32+| reference_select | 1 | 1 | 22 frames, **2 hidden** | pixel-exact |
33+| compound_references | 1 | 0 | 25 frames, **1 hidden** | pixel-exact |
34+| obmc | 1 | 0 | 25 frames, **1 hidden** | pixel-exact |
35+| obmc_8x8 | 0 (gate SKIPs: 74 attempts, 0 8x8-obmc hits) | — | — | not reached (pre-existing vacuity) |
36+| warped_motion | 40 | 2 (max 1/stream) | 25 frames, **1 hidden** | pixel-exact |
37+| interintra | 40 | 2 (max 1/stream) | 25 frames, **1 hidden** | pixel-exact |
38+| interintra_wedge | 40 | 0 | 25 frames, **1 hidden** | pixel-exact |
39+| free_partitions | 17 | 0 | 25 frames, **1 hidden** | pixel-exact |
40+| ab_partitions | 17 | 0 | 25 frames, **1 hidden** | pixel-exact |
41+| masked_compound | 80 | 0 | 27 frames, **3 hidden** | pixel-exact |
42+| cdef | 40 | 0 | 27 frames, **3 hidden** | pixel-exact |
43+| an_altref_reference | 1 | 0 | 17 frames, **1 hidden** | pixel-exact |
44+| delta_q_and_delta_lf | 40 | 0 | 27 frames, **3 hidden** | pixel-exact |
45+| a_bwdref_reference (bonus, same helper) | 1 | 0 | 18 frames, **2 hidden** | pixel-exact |
46+| an_altref2_reference (bonus) | 1 | 0 | 64 frames, 0 hidden | vacuous even with the arm |
47+| a_last2 / a_last3 (bonus, `--auto-alt-ref=0`) | 1 each | 0 | 8 frames, 0 hidden | vacuous by construction (no alt-ref) |
48+| gradients_with_cdef | n/a | n/a | n/a | single ffmpeg/libaom KEY frame, no alt-ref possible |
49+| a_golden_reference | n/a | n/a | n/a | `--lag-in-frames=0`, no alt-ref possible |
50+
51+**No hidden-frame mismatch was found.** Nothing is `#[ignore]`d, no assertion weakened,
52+no refusal touched (`refusal_inventory.rs` / `gate_coverage.rs` unchanged).
53+
54+## Commands
55+ cd /home/user/Documents/Code/Rust/edith_codecs-hidden
56+ export CARGO_TARGET_DIR=$HOME/.cache/cargo-target-hidden
57+ EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --nocapture # table lines: grep HIDDEN
58+ bash scripts/instrument-aom-oracle.sh # rung 13 idempotent
59+
60+EVIDENCE: /tmp/.../scratchpad/hidden-r2-suite2.log | EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --nocapture (whole suite, 630.72s) | 273 passed, 0 failed, 22 ignored; 281 attempt-streams compared frame-by-frame in decode order, 5 hidden frames on the gates' own recipes, 16 HIDDEN-ARM lines with 21 hidden frames total, every frame pixel-exact
61+EVIDENCE: same log, HIDDEN-ARM lines | each gate's own args + --arnr-maxframes=0, re-encoded and decoded through decode_all_frames_vs_oracle | 13 of 16 arms carry 1-3 hidden frames; altref2/last2/last3 arms carry 0
62+EVIDENCE: /tmp/.../scratchpad/rung13/decodemv.c | pristine `git show HEAD:av1/decoder/decodemv.c` + the script's rung-4 then rung-13 python blocks | both probe regions diff-identical to the live hand-patched ~/.cache/aom-oracle/src copy (SAME_MV, SAME_VAL); second application prints "already applied (no-op)"; live aomdec `strings` contains 3 EC_MODE_MV/stack=%d entries
63+
64+## Residue
65+- fix-now: none — no defect surfaced.
66+- deferred: obmc_8x8's hidden compare is unreached because that gate itself never fires an 8x8
67+ OBMC block (74 attempts, 0 hits) — pre-existing vacuity owned by the OBMC lane; unblocked by a
68+ recipe that actually codes 8x8 OBMC.
69+- deferred: `an_altref2_reference` still shows 0 hidden even with the arm (64-frame clip);
70+ unblocked by a recipe search like the one lanes/altref2-r1.report.md ran for ALTREF2 firing.
71+- accepted: the arm runs once per gate per process (a full encode + two decodes per arm); the
72+ gates' own per-attempt sweeps still get the (mostly hidden-free) compare on every attempt.
scripts/instrument-aom-oracle.shmodified+56 -0
@@ -21,6 +21,8 @@
2121 # two lanes stalled on 2026-08-30 because this rung did not exist.
2222 # EC_TRACE_MODE=1 -> "EC_MODE mi_row=.. mi_col=.. rng=.." before every inter
2323 # block's mode info, "EC_MODE_VAL .. mode=.. ref0/1=.. mv0=.. rng=.."
24+# (rung 13 adds "stack=" to that line and an "EC_MODE_MV" line right
25+# after assign_mv)
2426 # after -- the mv-stack/DRL/mv reads EC_PART cannot see. The same flag
2527 # also emits "EC_IMODE .. rng=.." / "EC_IMODE_VAL .. mode=.. uv_mode=..
2628 # skip=.. tx=.. rng=.." around every INTRA key-frame block: without it
@@ -705,3 +707,57 @@ s = s.replace(anchor, dump + anchor, 1)
705707 open(path, "w").write(s)
706708 print("final dump instrumented")
707709 PYF
710+
711+# --- rung 13: MV ground truth inside the inter mode ladder (lane-inter8 r3) --
712+# lane-inter8 r3 patched the live oracle tree BY HAND and rebuilt aomdec, so
713+# these two probes existed only in ~/.cache/aom-oracle/src and any rebuild
714+# from this script would have silently dropped them (class: instrument that
715+# lives only in a build tree). Both extend rung 4 and are gated by the same
716+# EC_TRACE_MODE:
717+# * EC_MODE_MV .. mode=.. mv0=(..,..) rng=.. -- printed immediately after
718+# assign_mv, i.e. the MV as decoded, BEFORE interintra/motion-mode/
719+# interp-filter syntax moves the range further; lets a lane separate an
720+# MV defect from a later-symbol defect on the same block.
721+# * stack=<ref_mv_count[ref_frame_type]> added to rung 4's EC_MODE_VAL --
722+# the reference's own mv-stack depth for the block's reference pair.
723+H="$SRC/av1/decoder/decodemv.c"
724+[ -f "$H" ] || { echo "no oracle source at $H" >&2; exit 1; }
725+
726+python3 - "$H" <<'PYMV'
727+import sys
728+path = sys.argv[1]
729+s = open(path).read()
730+if "EC_MODE_MV" in s:
731+ print("decodemv rung 13 already applied (no-op)")
732+ sys.exit(0)
733+assert "EC_INSTRUMENTED" in s, "rung 13 needs rung 4 (run this script top to bottom)"
734+
735+# (a) stack= on rung 4's EC_MODE_VAL
736+old_val = """ "mv0=(%d,%d) rng=%u\\n",
737+ ec_xd->mi_row, ec_xd->mi_col, (int)mbmi->mode,
738+ (int)mbmi->ref_frame[0], (int)mbmi->ref_frame[1],
739+ mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col,
740+ (unsigned)r->ec.rng);"""
741+new_val = """ "mv0=(%d,%d) stack=%d rng=%u\\n",
742+ ec_xd->mi_row, ec_xd->mi_col, (int)mbmi->mode,
743+ (int)mbmi->ref_frame[0], (int)mbmi->ref_frame[1],
744+ mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col,
745+ /* EC_STACK */ (int)dcb->ref_mv_count[av1_ref_frame_type(mbmi->ref_frame)],
746+ (unsigned)r->ec.rng);"""
747+assert old_val in s, "rung 4's EC_MODE_VAL body moved"
748+s = s.replace(old_val, new_val, 1)
749+
750+# (b) EC_MODE_MV right after assign_mv's corrupted-flag merge
751+anchor = " aom_merge_corrupted_flag(&dcb->corrupted, mv_corrupted_flag);\n"
752+assert s.count(anchor) == 1, "assign_mv corrupted-flag merge is no longer unique"
753+probe = """ if (getenv("EC_TRACE_MODE") != NULL) {
754+ fprintf(stderr,
755+ "EC_MODE_MV mi_row=%d mi_col=%d mode=%d mv0=(%d,%d) rng=%u\\n",
756+ xd->mi_row, xd->mi_col, (int)mbmi->mode, mbmi->mv[0].as_mv.row,
757+ mbmi->mv[0].as_mv.col, (unsigned)r->ec.rng);
758+ }
759+"""
760+s = s.replace(anchor, anchor + probe, 1)
761+open(path, "w").write(s)
762+print("decodemv rung 13 (EC_MODE_MV + EC_MODE_VAL stack=) instrumented")
763+PYMV