forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-hidden' (68e6619): every alt-ref gate compares decode-order frames incl. hidden via decode_all_frames_vs_oracle; hidden_arnr_arm (--arnr-maxframes=0) second arms; oracle rung 13 (EC_MODE_MV/stack=) scripted; no hidden-frame defect found (273/0 on branch)

Browse files at this commit

2b7f47f1a529949415e8176a5e8001e706a676c0Ahmet Kaan GümüşParent: 628d9cb33130e2
crates/ec-av1/src/stream.rsmodified+309 -0
@@ -1775,6 +1775,68 @@ mod tests {
1775 (oracle_frames, hidden)1775 (oracle_frames, hidden)
1776 }1776 }
1777 1777
1778+ /// lane-hidden r2: the `--arnr-maxframes=0` SECOND ARM of an existing
1779+ /// gate -- the gate's own recipe is never changed, this re-encodes the
1780+ /// same fixture with libaom's temporal alt-ref filter switched off and
1781+ /// runs [`decode_all_frames_vs_oracle`] on the result. Measured: with
1782+ /// the filter at its default EVERY alt-ref recipe in this file emits
1783+ /// ZERO hidden frames (the candidates are filtered away), so the
1784+ /// hidden-frame compare on the gate's own stream is vacuous; this arm
1785+ /// is what actually puts `show_frame == 0` frames on the wire.
1786+ ///
1787+ /// Runs at most once per gate name per process (the loop gates sweep
1788+ /// dozens of attempts and each arm costs a full encode + two decodes).
1789+ /// A stream this decoder refuses BY NAME skips the arm -- the arm is
1790+ /// about hidden frames, not about that capability gap -- while a pixel
1791+ /// mismatch is a hard failure raised inside the compare.
1792+ fn hidden_arnr_arm(name: &str, y4m: &[u8], args: &[&str]) -> Option<(usize, usize)> {
1793+ static ARMED: std::sync::OnceLock<std::sync::Mutex<std::collections::HashSet<String>>> =
1794+ std::sync::OnceLock::new();
1795+ if !ARMED
1796+ .get_or_init(Default::default)
1797+ .lock()
1798+ .unwrap()
1799+ .insert(name.to_string())
1800+ {
1801+ return None;
1802+ }
1803+ let mut arm: Vec<&str> = vec!["--arnr-maxframes=0"];
1804+ arm.extend_from_slice(args);
1805+ let mut child = Command::new(aomenc_path())
1806+ .args(&arm)
1807+ .stdin(Stdio::piped())
1808+ .stdout(Stdio::piped())
1809+ .stderr(Stdio::piped())
1810+ .spawn()
1811+ .expect("aomenc failed to start");
1812+ child
1813+ .stdin
1814+ .take()
1815+ .expect("aomenc stdin")
1816+ .write_all(y4m)
1817+ .expect("writing y4m to aomenc");
1818+ let out = child.wait_with_output().expect("aomenc failed to run");
1819+ assert!(
1820+ out.status.success(),
1821+ "{name} HIDDEN-ARM: aomenc refused its own recipe plus --arnr-maxframes=0: {}",
1822+ String::from_utf8_lossy(&out.stderr)
1823+ );
1824+ let stream = out.stdout;
1825+ match decode_stream(&stream) {
1826+ Err(e) => {
1827+ let msg = e.to_string();
1828+ assert!(
1829+ msg.contains("unsupported"),
1830+ "{name} HIDDEN-ARM failed outright: {msg}"
1831+ );
1832+ eprintln!("{name} HIDDEN-ARM: skipped on a named refusal: {msg}");
1833+ None
1834+ }
1835+ Ok(_) => Some(decode_all_frames_vs_oracle(&stream, &format!("{name}-arnr0"))),
1836+ }
1837+ }
1838+
1839+
1778 /// The repo's first hidden-frame pixel gate. Every other aomenc gate1840 /// The repo's first hidden-frame pixel gate. Every other aomenc gate
1779 /// here compares `decode_stream`'s output against `ffmpeg -f obu`, and1841 /// here compares `decode_stream`'s output against `ffmpeg -f obu`, and
1780 /// both sides emit SHOWN frames only -- so an alt-ref frame that is1842 /// both sides emit SHOWN frames only -- so an alt-ref frame that is
@@ -5228,6 +5290,25 @@ mod tests {
5228 "{gate_name} frame {i} V vs ffmpeg (seed {seed})"5290 "{gate_name} frame {i} V vs ffmpeg (seed {seed})"
5229 );5291 );
5230 }5292 }
5293+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
5294+ // stream again, comparing EVERY decode-order frame -- the hidden
5295+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
5296+ // cannot see, because both sides of it emit shown frames only.
5297+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, gate_name);
5298+ eprintln!(
5299+ "{gate_name} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
5300+ {hidden_n} hidden, all pixel-exact vs the oracle"
5301+ );
5302+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
5303+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
5304+ // frames, so the compare above is vacuous -- re-encode the same
5305+ // fixture with --arnr-maxframes=0 and compare THOSE.
5306+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(gate_name, &y4m.stdout, &args) {
5307+ eprintln!(
5308+ "{gate_name} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
5309+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
5310+ );
5311+ }
5231 eprintln!(5312 eprintln!(
5232 "{gate_name} FIRING seed {seed}: {target_ref_name} hits advanced by {}",5313 "{gate_name} FIRING seed {seed}: {target_ref_name} hits advanced by {}",
5233 decode::ref_hits(target_ref) - before5314 decode::ref_hits(target_ref) - before
@@ -5446,6 +5527,25 @@ mod tests {
5446 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");5527 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
5447 }5528 }
5448 }5529 }
5530+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
5531+ // stream again, comparing EVERY decode-order frame -- the hidden
5532+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
5533+ // cannot see, because both sides of it emit shown frames only.
5534+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
5535+ eprintln!(
5536+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
5537+ {hidden_n} hidden, all pixel-exact vs the oracle"
5538+ );
5539+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
5540+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
5541+ // frames, so the compare above is vacuous -- re-encode the same
5542+ // fixture with --arnr-maxframes=0 and compare THOSE.
5543+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
5544+ eprintln!(
5545+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
5546+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
5547+ );
5548+ }
5449 eprintln!(5549 eprintln!(
5450 "{NAME} FIRING seed {seed}: comp_mode hits advanced by {}, decoded \5550 "{NAME} FIRING seed {seed}: comp_mode hits advanced by {}, decoded \
5451 fully and pixel-exact",5551 fully and pixel-exact",
@@ -5628,6 +5728,25 @@ mod tests {
5628 );5728 );
5629 }5729 }
5630 }5730 }
5731+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
5732+ // stream again, comparing EVERY decode-order frame -- the hidden
5733+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
5734+ // cannot see, because both sides of it emit shown frames only.
5735+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
5736+ eprintln!(
5737+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
5738+ {hidden_n} hidden, all pixel-exact vs the oracle"
5739+ );
5740+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
5741+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
5742+ // frames, so the compare above is vacuous -- re-encode the same
5743+ // fixture with --arnr-maxframes=0 and compare THOSE.
5744+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
5745+ eprintln!(
5746+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
5747+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
5748+ );
5749+ }
5631 eprintln!(5750 eprintln!(
5632 "{NAME} FIRING seed {seed}: skip_mode hits advanced by {}",5751 "{NAME} FIRING seed {seed}: skip_mode hits advanced by {}",
5633 decode::skip_mode_hits() - before5752 decode::skip_mode_hits() - before
@@ -5790,6 +5909,25 @@ mod tests {
5790 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");5909 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
5791 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");5910 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
5792 }5911 }
5912+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
5913+ // stream again, comparing EVERY decode-order frame -- the hidden
5914+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
5915+ // cannot see, because both sides of it emit shown frames only.
5916+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
5917+ eprintln!(
5918+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
5919+ {hidden_n} hidden, all pixel-exact vs the oracle"
5920+ );
5921+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
5922+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
5923+ // frames, so the compare above is vacuous -- re-encode the same
5924+ // fixture with --arnr-maxframes=0 and compare THOSE.
5925+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
5926+ eprintln!(
5927+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
5928+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
5929+ );
5930+ }
5793 eprintln!(5931 eprintln!(
5794 "{NAME} FIRING seed {seed}: obmc hits advanced by {}",5932 "{NAME} FIRING seed {seed}: obmc hits advanced by {}",
5795 decode::obmc_hits() - before5933 decode::obmc_hits() - before
@@ -5981,6 +6119,25 @@ mod tests {
5981 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");6119 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
5982 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");6120 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
5983 }6121 }
6122+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
6123+ // stream again, comparing EVERY decode-order frame -- the hidden
6124+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
6125+ // cannot see, because both sides of it emit shown frames only.
6126+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
6127+ eprintln!(
6128+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
6129+ {hidden_n} hidden, all pixel-exact vs the oracle"
6130+ );
6131+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
6132+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
6133+ // frames, so the compare above is vacuous -- re-encode the same
6134+ // fixture with --arnr-maxframes=0 and compare THOSE.
6135+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
6136+ eprintln!(
6137+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
6138+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
6139+ );
6140+ }
5984 eprintln!(6141 eprintln!(
5985 "{NAME} FIRING seed {seed}: 8x8 obmc hits {fired8} (total across attempts so far {total_obmc8})"6142 "{NAME} FIRING seed {seed}: 8x8 obmc hits {fired8} (total across attempts so far {total_obmc8})"
5986 );6143 );
@@ -6147,6 +6304,25 @@ mod tests {
6147 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");6304 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
6148 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");6305 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
6149 }6306 }
6307+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
6308+ // stream again, comparing EVERY decode-order frame -- the hidden
6309+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
6310+ // cannot see, because both sides of it emit shown frames only.
6311+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
6312+ eprintln!(
6313+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
6314+ {hidden_n} hidden, all pixel-exact vs the oracle"
6315+ );
6316+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
6317+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
6318+ // frames, so the compare above is vacuous -- re-encode the same
6319+ // fixture with --arnr-maxframes=0 and compare THOSE.
6320+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
6321+ eprintln!(
6322+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
6323+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
6324+ );
6325+ }
6150 matched += 1;6326 matched += 1;
6151 }6327 }
6152 assert!(6328 assert!(
@@ -6596,6 +6772,25 @@ mod tests {
6596 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");6772 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
6597 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");6773 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
6598 }6774 }
6775+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
6776+ // stream again, comparing EVERY decode-order frame -- the hidden
6777+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
6778+ // cannot see, because both sides of it emit shown frames only.
6779+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
6780+ eprintln!(
6781+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
6782+ {hidden_n} hidden, all pixel-exact vs the oracle"
6783+ );
6784+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
6785+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
6786+ // frames, so the compare above is vacuous -- re-encode the same
6787+ // fixture with --arnr-maxframes=0 and compare THOSE.
6788+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
6789+ eprintln!(
6790+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
6791+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
6792+ );
6793+ }
6599 matched += 1;6794 matched += 1;
6600 }6795 }
6601 assert!(6796 assert!(
@@ -7012,6 +7207,25 @@ mod tests {
7012 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");7207 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
7013 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");7208 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
7014 }7209 }
7210+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
7211+ // stream again, comparing EVERY decode-order frame -- the hidden
7212+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
7213+ // cannot see, because both sides of it emit shown frames only.
7214+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
7215+ eprintln!(
7216+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
7217+ {hidden_n} hidden, all pixel-exact vs the oracle"
7218+ );
7219+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
7220+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
7221+ // frames, so the compare above is vacuous -- re-encode the same
7222+ // fixture with --arnr-maxframes=0 and compare THOSE.
7223+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
7224+ eprintln!(
7225+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
7226+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
7227+ );
7228+ }
7015 matched += 1;7229 matched += 1;
7016 }7230 }
7017 assert!(7231 assert!(
@@ -7333,6 +7547,25 @@ mod tests {
7333 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");7547 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
7334 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");7548 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
7335 }7549 }
7550+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
7551+ // stream again, comparing EVERY decode-order frame -- the hidden
7552+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
7553+ // cannot see, because both sides of it emit shown frames only.
7554+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
7555+ eprintln!(
7556+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
7557+ {hidden_n} hidden, all pixel-exact vs the oracle"
7558+ );
7559+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
7560+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
7561+ // frames, so the compare above is vacuous -- re-encode the same
7562+ // fixture with --arnr-maxframes=0 and compare THOSE.
7563+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
7564+ eprintln!(
7565+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
7566+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
7567+ );
7568+ }
7336 matched += 1;7569 matched += 1;
7337 }7570 }
7338 assert!(7571 assert!(
@@ -7534,6 +7767,25 @@ mod tests {
7534 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");7767 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
7535 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");7768 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
7536 }7769 }
7770+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
7771+ // stream again, comparing EVERY decode-order frame -- the hidden
7772+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
7773+ // cannot see, because both sides of it emit shown frames only.
7774+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
7775+ eprintln!(
7776+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
7777+ {hidden_n} hidden, all pixel-exact vs the oracle"
7778+ );
7779+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
7780+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
7781+ // frames, so the compare above is vacuous -- re-encode the same
7782+ // fixture with --arnr-maxframes=0 and compare THOSE.
7783+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
7784+ eprintln!(
7785+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
7786+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
7787+ );
7788+ }
7537 matched += 1;7789 matched += 1;
7538 }7790 }
7539 assert!(7791 assert!(
@@ -7941,6 +8193,25 @@ mod tests {
7941 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");8193 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
7942 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");8194 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
7943 }8195 }
8196+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
8197+ // stream again, comparing EVERY decode-order frame -- the hidden
8198+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
8199+ // cannot see, because both sides of it emit shown frames only.
8200+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
8201+ eprintln!(
8202+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
8203+ {hidden_n} hidden, all pixel-exact vs the oracle"
8204+ );
8205+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
8206+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
8207+ // frames, so the compare above is vacuous -- re-encode the same
8208+ // fixture with --arnr-maxframes=0 and compare THOSE.
8209+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
8210+ eprintln!(
8211+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
8212+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
8213+ );
8214+ }
7944 matched += 1;8215 matched += 1;
7945 }8216 }
7946 // r1: observed flaky at 40 attempts -- aomenc's cpu-used=0 RD is8217 // r1: observed flaky at 40 attempts -- aomenc's cpu-used=0 RD is
@@ -8373,6 +8644,25 @@ mod tests {
8373 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");8644 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
8374 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");8645 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
8375 }8646 }
8647+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
8648+ // stream again, comparing EVERY decode-order frame -- the hidden
8649+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
8650+ // cannot see, because both sides of it emit shown frames only.
8651+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
8652+ eprintln!(
8653+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
8654+ {hidden_n} hidden, all pixel-exact vs the oracle"
8655+ );
8656+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
8657+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
8658+ // frames, so the compare above is vacuous -- re-encode the same
8659+ // fixture with --arnr-maxframes=0 and compare THOSE.
8660+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
8661+ eprintln!(
8662+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
8663+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
8664+ );
8665+ }
8376 matched += 1;8666 matched += 1;
8377 }8667 }
8378 assert!(8668 assert!(
@@ -10683,6 +10973,25 @@ mod tests {
10683 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");10973 assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
10684 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");10974 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
10685 }10975 }
10976+ // lane-hidden r2 (class gate-blind-to-hidden-frames): the same
10977+ // stream again, comparing EVERY decode-order frame -- the hidden
10978+ // (show_frame == 0) alt-ref frames the ffmpeg compare above
10979+ // cannot see, because both sides of it emit shown frames only.
10980+ let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME);
10981+ eprintln!(
10982+ "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \
10983+ {hidden_n} hidden, all pixel-exact vs the oracle"
10984+ );
10985+ // lane-hidden r2 SECOND ARM (the recipe above is untouched):
10986+ // libaom's temporal alt-ref filter absorbs this recipe's hidden
10987+ // frames, so the compare above is vacuous -- re-encode the same
10988+ // fixture with --arnr-maxframes=0 and compare THOSE.
10989+ if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) {
10990+ eprintln!(
10991+ "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \
10992+ decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
10993+ );
10994+ }
10686 matched += 1;10995 matched += 1;
10687 }10996 }
10688 assert!(10997 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 @@
21 # two lanes stalled on 2026-08-30 because this rung did not exist.21 # two lanes stalled on 2026-08-30 because this rung did not exist.
22 # EC_TRACE_MODE=1 -> "EC_MODE mi_row=.. mi_col=.. rng=.." before every inter22 # EC_TRACE_MODE=1 -> "EC_MODE mi_row=.. mi_col=.. rng=.." before every inter
23 # block's mode info, "EC_MODE_VAL .. mode=.. ref0/1=.. mv0=.. rng=.."23 # 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)
24 # after -- the mv-stack/DRL/mv reads EC_PART cannot see. The same flag26 # after -- the mv-stack/DRL/mv reads EC_PART cannot see. The same flag
25 # also emits "EC_IMODE .. rng=.." / "EC_IMODE_VAL .. mode=.. uv_mode=..27 # also emits "EC_IMODE .. rng=.." / "EC_IMODE_VAL .. mode=.. uv_mode=..
26 # skip=.. tx=.. rng=.." around every INTRA key-frame block: without it28 # skip=.. tx=.. rng=.." around every INTRA key-frame block: without it
@@ -705,3 +707,57 @@ s = s.replace(anchor, dump + anchor, 1)
705 open(path, "w").write(s)707 open(path, "w").write(s)
706 print("final dump instrumented")708 print("final dump instrumented")
707 PYF709 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