diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 013a4862..3088e62e 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -1740,6 +1740,68 @@ mod tests { (oracle_frames, hidden) } + /// lane-hidden r2: the `--arnr-maxframes=0` SECOND ARM of an existing + /// gate -- the gate's own recipe is never changed, this re-encodes the + /// same fixture with libaom's temporal alt-ref filter switched off and + /// runs [`decode_all_frames_vs_oracle`] on the result. Measured: with + /// the filter at its default EVERY alt-ref recipe in this file emits + /// ZERO hidden frames (the candidates are filtered away), so the + /// hidden-frame compare on the gate's own stream is vacuous; this arm + /// is what actually puts `show_frame == 0` frames on the wire. + /// + /// Runs at most once per gate name per process (the loop gates sweep + /// dozens of attempts and each arm costs a full encode + two decodes). + /// A stream this decoder refuses BY NAME skips the arm -- the arm is + /// about hidden frames, not about that capability gap -- while a pixel + /// mismatch is a hard failure raised inside the compare. + fn hidden_arnr_arm(name: &str, y4m: &[u8], args: &[&str]) -> Option<(usize, usize)> { + static ARMED: std::sync::OnceLock>> = + std::sync::OnceLock::new(); + if !ARMED + .get_or_init(Default::default) + .lock() + .unwrap() + .insert(name.to_string()) + { + return None; + } + let mut arm: Vec<&str> = vec!["--arnr-maxframes=0"]; + arm.extend_from_slice(args); + let mut child = Command::new(aomenc_path()) + .args(&arm) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(y4m) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "{name} HIDDEN-ARM: aomenc refused its own recipe plus --arnr-maxframes=0: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + match decode_stream(&stream) { + Err(e) => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "{name} HIDDEN-ARM failed outright: {msg}" + ); + eprintln!("{name} HIDDEN-ARM: skipped on a named refusal: {msg}"); + None + } + Ok(_) => Some(decode_all_frames_vs_oracle(&stream, &format!("{name}-arnr0"))), + } + } + + /// The repo's first hidden-frame pixel gate. Every other aomenc gate /// here compares `decode_stream`'s output against `ffmpeg -f obu`, and /// both sides emit SHOWN frames only -- so an alt-ref frame that is @@ -4191,6 +4253,25 @@ mod tests { "{gate_name} frame {i} V vs ffmpeg (seed {seed})" ); } + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same + // stream again, comparing EVERY decode-order frame -- the hidden + // (show_frame == 0) alt-ref frames the ffmpeg compare above + // cannot see, because both sides of it emit shown frames only. + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, gate_name); + eprintln!( + "{gate_name} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ + {hidden_n} hidden, all pixel-exact vs the oracle" + ); + // lane-hidden r2 SECOND ARM (the recipe above is untouched): + // libaom's temporal alt-ref filter absorbs this recipe's hidden + // frames, so the compare above is vacuous -- re-encode the same + // fixture with --arnr-maxframes=0 and compare THOSE. + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(gate_name, &y4m.stdout, &args) { + eprintln!( + "{gate_name} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" + ); + } eprintln!( "{gate_name} FIRING seed {seed}: {target_ref_name} hits advanced by {}", decode::ref_hits(target_ref) - before @@ -4409,6 +4490,25 @@ mod tests { assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); } } + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same + // stream again, comparing EVERY decode-order frame -- the hidden + // (show_frame == 0) alt-ref frames the ffmpeg compare above + // cannot see, because both sides of it emit shown frames only. + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); + eprintln!( + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ + {hidden_n} hidden, all pixel-exact vs the oracle" + ); + // lane-hidden r2 SECOND ARM (the recipe above is untouched): + // libaom's temporal alt-ref filter absorbs this recipe's hidden + // frames, so the compare above is vacuous -- re-encode the same + // fixture with --arnr-maxframes=0 and compare THOSE. + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { + eprintln!( + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" + ); + } eprintln!( "{NAME} FIRING seed {seed}: comp_mode hits advanced by {}, decoded \ fully and pixel-exact", @@ -4591,6 +4691,25 @@ mod tests { ); } } + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same + // stream again, comparing EVERY decode-order frame -- the hidden + // (show_frame == 0) alt-ref frames the ffmpeg compare above + // cannot see, because both sides of it emit shown frames only. + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); + eprintln!( + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ + {hidden_n} hidden, all pixel-exact vs the oracle" + ); + // lane-hidden r2 SECOND ARM (the recipe above is untouched): + // libaom's temporal alt-ref filter absorbs this recipe's hidden + // frames, so the compare above is vacuous -- re-encode the same + // fixture with --arnr-maxframes=0 and compare THOSE. + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { + eprintln!( + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" + ); + } eprintln!( "{NAME} FIRING seed {seed}: skip_mode hits advanced by {}", decode::skip_mode_hits() - before @@ -4753,6 +4872,25 @@ mod tests { assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); } + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same + // stream again, comparing EVERY decode-order frame -- the hidden + // (show_frame == 0) alt-ref frames the ffmpeg compare above + // cannot see, because both sides of it emit shown frames only. + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); + eprintln!( + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ + {hidden_n} hidden, all pixel-exact vs the oracle" + ); + // lane-hidden r2 SECOND ARM (the recipe above is untouched): + // libaom's temporal alt-ref filter absorbs this recipe's hidden + // frames, so the compare above is vacuous -- re-encode the same + // fixture with --arnr-maxframes=0 and compare THOSE. + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { + eprintln!( + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" + ); + } eprintln!( "{NAME} FIRING seed {seed}: obmc hits advanced by {}", decode::obmc_hits() - before @@ -4944,6 +5082,25 @@ mod tests { assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); } + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same + // stream again, comparing EVERY decode-order frame -- the hidden + // (show_frame == 0) alt-ref frames the ffmpeg compare above + // cannot see, because both sides of it emit shown frames only. + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); + eprintln!( + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ + {hidden_n} hidden, all pixel-exact vs the oracle" + ); + // lane-hidden r2 SECOND ARM (the recipe above is untouched): + // libaom's temporal alt-ref filter absorbs this recipe's hidden + // frames, so the compare above is vacuous -- re-encode the same + // fixture with --arnr-maxframes=0 and compare THOSE. + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { + eprintln!( + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" + ); + } eprintln!( "{NAME} FIRING seed {seed}: 8x8 obmc hits {fired8} (total across attempts so far {total_obmc8})" ); @@ -5110,6 +5267,25 @@ mod tests { assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); } + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same + // stream again, comparing EVERY decode-order frame -- the hidden + // (show_frame == 0) alt-ref frames the ffmpeg compare above + // cannot see, because both sides of it emit shown frames only. + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); + eprintln!( + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ + {hidden_n} hidden, all pixel-exact vs the oracle" + ); + // lane-hidden r2 SECOND ARM (the recipe above is untouched): + // libaom's temporal alt-ref filter absorbs this recipe's hidden + // frames, so the compare above is vacuous -- re-encode the same + // fixture with --arnr-maxframes=0 and compare THOSE. + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { + eprintln!( + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" + ); + } matched += 1; } assert!( @@ -5559,6 +5735,25 @@ mod tests { assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); } + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same + // stream again, comparing EVERY decode-order frame -- the hidden + // (show_frame == 0) alt-ref frames the ffmpeg compare above + // cannot see, because both sides of it emit shown frames only. + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); + eprintln!( + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ + {hidden_n} hidden, all pixel-exact vs the oracle" + ); + // lane-hidden r2 SECOND ARM (the recipe above is untouched): + // libaom's temporal alt-ref filter absorbs this recipe's hidden + // frames, so the compare above is vacuous -- re-encode the same + // fixture with --arnr-maxframes=0 and compare THOSE. + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { + eprintln!( + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" + ); + } matched += 1; } assert!( @@ -5739,6 +5934,25 @@ mod tests { assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); } + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same + // stream again, comparing EVERY decode-order frame -- the hidden + // (show_frame == 0) alt-ref frames the ffmpeg compare above + // cannot see, because both sides of it emit shown frames only. + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); + eprintln!( + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ + {hidden_n} hidden, all pixel-exact vs the oracle" + ); + // lane-hidden r2 SECOND ARM (the recipe above is untouched): + // libaom's temporal alt-ref filter absorbs this recipe's hidden + // frames, so the compare above is vacuous -- re-encode the same + // fixture with --arnr-maxframes=0 and compare THOSE. + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { + eprintln!( + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" + ); + } matched += 1; } assert!( @@ -6060,6 +6274,25 @@ mod tests { assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); } + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same + // stream again, comparing EVERY decode-order frame -- the hidden + // (show_frame == 0) alt-ref frames the ffmpeg compare above + // cannot see, because both sides of it emit shown frames only. + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); + eprintln!( + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ + {hidden_n} hidden, all pixel-exact vs the oracle" + ); + // lane-hidden r2 SECOND ARM (the recipe above is untouched): + // libaom's temporal alt-ref filter absorbs this recipe's hidden + // frames, so the compare above is vacuous -- re-encode the same + // fixture with --arnr-maxframes=0 and compare THOSE. + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { + eprintln!( + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" + ); + } matched += 1; } assert!( @@ -6261,6 +6494,25 @@ mod tests { assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); } + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same + // stream again, comparing EVERY decode-order frame -- the hidden + // (show_frame == 0) alt-ref frames the ffmpeg compare above + // cannot see, because both sides of it emit shown frames only. + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); + eprintln!( + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ + {hidden_n} hidden, all pixel-exact vs the oracle" + ); + // lane-hidden r2 SECOND ARM (the recipe above is untouched): + // libaom's temporal alt-ref filter absorbs this recipe's hidden + // frames, so the compare above is vacuous -- re-encode the same + // fixture with --arnr-maxframes=0 and compare THOSE. + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { + eprintln!( + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" + ); + } matched += 1; } assert!( @@ -6467,6 +6719,25 @@ mod tests { assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); } + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same + // stream again, comparing EVERY decode-order frame -- the hidden + // (show_frame == 0) alt-ref frames the ffmpeg compare above + // cannot see, because both sides of it emit shown frames only. + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); + eprintln!( + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ + {hidden_n} hidden, all pixel-exact vs the oracle" + ); + // lane-hidden r2 SECOND ARM (the recipe above is untouched): + // libaom's temporal alt-ref filter absorbs this recipe's hidden + // frames, so the compare above is vacuous -- re-encode the same + // fixture with --arnr-maxframes=0 and compare THOSE. + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { + eprintln!( + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" + ); + } matched += 1; } // r1: observed flaky at 40 attempts -- aomenc's cpu-used=0 RD is @@ -6899,6 +7170,25 @@ mod tests { assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); } + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same + // stream again, comparing EVERY decode-order frame -- the hidden + // (show_frame == 0) alt-ref frames the ffmpeg compare above + // cannot see, because both sides of it emit shown frames only. + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); + eprintln!( + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ + {hidden_n} hidden, all pixel-exact vs the oracle" + ); + // lane-hidden r2 SECOND ARM (the recipe above is untouched): + // libaom's temporal alt-ref filter absorbs this recipe's hidden + // frames, so the compare above is vacuous -- re-encode the same + // fixture with --arnr-maxframes=0 and compare THOSE. + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { + eprintln!( + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" + ); + } matched += 1; } assert!( @@ -9209,6 +9499,25 @@ mod tests { assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); } + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same + // stream again, comparing EVERY decode-order frame -- the hidden + // (show_frame == 0) alt-ref frames the ffmpeg compare above + // cannot see, because both sides of it emit shown frames only. + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); + eprintln!( + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ + {hidden_n} hidden, all pixel-exact vs the oracle" + ); + // lane-hidden r2 SECOND ARM (the recipe above is untouched): + // libaom's temporal alt-ref filter absorbs this recipe's hidden + // frames, so the compare above is vacuous -- re-encode the same + // fixture with --arnr-maxframes=0 and compare THOSE. + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { + eprintln!( + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" + ); + } matched += 1; } assert!( diff --git a/lanes/hidden-r2.report.md b/lanes/hidden-r2.report.md new file mode 100644 index 00000000..258ffd93 --- /dev/null +++ b/lanes/hidden-r2.report.md @@ -0,0 +1,72 @@ +# lane-hidden r2 — hidden-frame compare wired into the 15 alt-ref gates + +## What changed +- `crates/ec-av1/src/stream.rs` — 13 insertion sites, each **after** the gate's existing + shown-frame `assert_eq!` loop, calling r1's `decode_all_frames_vs_oracle(&stream, NAME)` + on the SAME stream bytes: every decode-order frame (hidden alt-refs included) byte-compared + against the instrumented `aomdec`'s `EC_AV1_FINAL_DUMP`. No gate recipe was changed. + Sites: `a_real_aomenc_single_ref_gate` (:4256, covers the last2/last3/bwdref/altref2/**altref** + gates), reference_select :4493, compound_references :4694, obmc :4875, obmc_8x8 :5085, + warped_motion :5270, interintra :5738, interintra_wedge :5937, free_partitions :6277, + ab_partitions :6497, masked_compound :6722, cdef :7173, delta_q_and_delta_lf :9502. +- `crates/ec-av1/src/stream.rs:1745` — new `hidden_arnr_arm(name, y4m, args)`: the SECOND ARM. + Re-encodes the gate's own fixture with the gate's own args **plus** `--arnr-maxframes=0`, + runs the same decode-order compare, at most once per gate per process. A named + ("unsupported") refusal on the arm's stream skips the arm; a pixel mismatch is a hard + failure inside the compare. Called at the same 13 sites. +- `scripts/instrument-aom-oracle.sh` — **rung 13** (coordinator's extra item): lane-inter8 r3's + hand patch of `~/.cache/aom-oracle/src/av1/decoder/decodemv.c` (an `EC_MODE_MV` line right + after `assign_mv`, and `stack=` on rung 4's `EC_MODE_VAL`) existed only in + the build tree; a script rebuild would have dropped it. Both are now script-applied, + `EC_TRACE_MODE`-gated, idempotent. + +## Finding: every gate's own recipe is VACUOUS for hidden frames +`--auto-alt-ref=1 --lag-in-frames=16` does NOT put hidden frames on the wire — libaom's +temporal alt-ref filter absorbs the candidates. Across the whole suite the 15 gates decoded +**281 attempt-streams and saw 5 hidden frames in total**, 13 of the 16 gate names seeing zero. +Every gate claim of "hidden alt-refs included" is propagation only. `--arnr-maxframes=0` as a +second arm fixes it: 13 of 16 arms carry 1-3 hidden frames. + +| gate | attempts compared | hidden (own recipe) | ARM `--arnr-maxframes=0` | result | +|---|---|---|---|---| +| reference_select | 1 | 1 | 22 frames, **2 hidden** | pixel-exact | +| compound_references | 1 | 0 | 25 frames, **1 hidden** | pixel-exact | +| obmc | 1 | 0 | 25 frames, **1 hidden** | pixel-exact | +| obmc_8x8 | 0 (gate SKIPs: 74 attempts, 0 8x8-obmc hits) | — | — | not reached (pre-existing vacuity) | +| warped_motion | 40 | 2 (max 1/stream) | 25 frames, **1 hidden** | pixel-exact | +| interintra | 40 | 2 (max 1/stream) | 25 frames, **1 hidden** | pixel-exact | +| interintra_wedge | 40 | 0 | 25 frames, **1 hidden** | pixel-exact | +| free_partitions | 17 | 0 | 25 frames, **1 hidden** | pixel-exact | +| ab_partitions | 17 | 0 | 25 frames, **1 hidden** | pixel-exact | +| masked_compound | 80 | 0 | 27 frames, **3 hidden** | pixel-exact | +| cdef | 40 | 0 | 27 frames, **3 hidden** | pixel-exact | +| an_altref_reference | 1 | 0 | 17 frames, **1 hidden** | pixel-exact | +| delta_q_and_delta_lf | 40 | 0 | 27 frames, **3 hidden** | pixel-exact | +| a_bwdref_reference (bonus, same helper) | 1 | 0 | 18 frames, **2 hidden** | pixel-exact | +| an_altref2_reference (bonus) | 1 | 0 | 64 frames, 0 hidden | vacuous even with the arm | +| a_last2 / a_last3 (bonus, `--auto-alt-ref=0`) | 1 each | 0 | 8 frames, 0 hidden | vacuous by construction (no alt-ref) | +| gradients_with_cdef | n/a | n/a | n/a | single ffmpeg/libaom KEY frame, no alt-ref possible | +| a_golden_reference | n/a | n/a | n/a | `--lag-in-frames=0`, no alt-ref possible | + +**No hidden-frame mismatch was found.** Nothing is `#[ignore]`d, no assertion weakened, +no refusal touched (`refusal_inventory.rs` / `gate_coverage.rs` unchanged). + +## Commands + cd /home/user/Documents/Code/Rust/edith_codecs-hidden + export CARGO_TARGET_DIR=$HOME/.cache/cargo-target-hidden + EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --nocapture # table lines: grep HIDDEN + bash scripts/instrument-aom-oracle.sh # rung 13 idempotent + +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 +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 +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 + +## Residue +- fix-now: none — no defect surfaced. +- deferred: obmc_8x8's hidden compare is unreached because that gate itself never fires an 8x8 + OBMC block (74 attempts, 0 hits) — pre-existing vacuity owned by the OBMC lane; unblocked by a + recipe that actually codes 8x8 OBMC. +- deferred: `an_altref2_reference` still shows 0 hidden even with the arm (64-frame clip); + unblocked by a recipe search like the one lanes/altref2-r1.report.md ran for ALTREF2 firing. +- accepted: the arm runs once per gate per process (a full encode + two decodes per arm); the + gates' own per-attempt sweeps still get the (mostly hidden-free) compare on every attempt. diff --git a/scripts/instrument-aom-oracle.sh b/scripts/instrument-aom-oracle.sh index 2dbc1fee..23f715e9 100755 --- a/scripts/instrument-aom-oracle.sh +++ b/scripts/instrument-aom-oracle.sh @@ -21,6 +21,8 @@ # two lanes stalled on 2026-08-30 because this rung did not exist. # EC_TRACE_MODE=1 -> "EC_MODE mi_row=.. mi_col=.. rng=.." before every inter # block's mode info, "EC_MODE_VAL .. mode=.. ref0/1=.. mv0=.. rng=.." +# (rung 13 adds "stack=" to that line and an "EC_MODE_MV" line right +# after assign_mv) # after -- the mv-stack/DRL/mv reads EC_PART cannot see. The same flag # also emits "EC_IMODE .. rng=.." / "EC_IMODE_VAL .. mode=.. uv_mode=.. # skip=.. tx=.. rng=.." around every INTRA key-frame block: without it @@ -705,3 +707,57 @@ s = s.replace(anchor, dump + anchor, 1) open(path, "w").write(s) print("final dump instrumented") PYF + +# --- rung 13: MV ground truth inside the inter mode ladder (lane-inter8 r3) -- +# lane-inter8 r3 patched the live oracle tree BY HAND and rebuilt aomdec, so +# these two probes existed only in ~/.cache/aom-oracle/src and any rebuild +# from this script would have silently dropped them (class: instrument that +# lives only in a build tree). Both extend rung 4 and are gated by the same +# EC_TRACE_MODE: +# * EC_MODE_MV .. mode=.. mv0=(..,..) rng=.. -- printed immediately after +# assign_mv, i.e. the MV as decoded, BEFORE interintra/motion-mode/ +# interp-filter syntax moves the range further; lets a lane separate an +# MV defect from a later-symbol defect on the same block. +# * stack= added to rung 4's EC_MODE_VAL -- +# the reference's own mv-stack depth for the block's reference pair. +H="$SRC/av1/decoder/decodemv.c" +[ -f "$H" ] || { echo "no oracle source at $H" >&2; exit 1; } + +python3 - "$H" <<'PYMV' +import sys +path = sys.argv[1] +s = open(path).read() +if "EC_MODE_MV" in s: + print("decodemv rung 13 already applied (no-op)") + sys.exit(0) +assert "EC_INSTRUMENTED" in s, "rung 13 needs rung 4 (run this script top to bottom)" + +# (a) stack= on rung 4's EC_MODE_VAL +old_val = """ "mv0=(%d,%d) rng=%u\\n", + ec_xd->mi_row, ec_xd->mi_col, (int)mbmi->mode, + (int)mbmi->ref_frame[0], (int)mbmi->ref_frame[1], + mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col, + (unsigned)r->ec.rng);""" +new_val = """ "mv0=(%d,%d) stack=%d rng=%u\\n", + ec_xd->mi_row, ec_xd->mi_col, (int)mbmi->mode, + (int)mbmi->ref_frame[0], (int)mbmi->ref_frame[1], + mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col, + /* EC_STACK */ (int)dcb->ref_mv_count[av1_ref_frame_type(mbmi->ref_frame)], + (unsigned)r->ec.rng);""" +assert old_val in s, "rung 4's EC_MODE_VAL body moved" +s = s.replace(old_val, new_val, 1) + +# (b) EC_MODE_MV right after assign_mv's corrupted-flag merge +anchor = " aom_merge_corrupted_flag(&dcb->corrupted, mv_corrupted_flag);\n" +assert s.count(anchor) == 1, "assign_mv corrupted-flag merge is no longer unique" +probe = """ if (getenv("EC_TRACE_MODE") != NULL) { + fprintf(stderr, + "EC_MODE_MV mi_row=%d mi_col=%d mode=%d mv0=(%d,%d) rng=%u\\n", + xd->mi_row, xd->mi_col, (int)mbmi->mode, mbmi->mv[0].as_mv.row, + mbmi->mv[0].as_mv.col, (unsigned)r->ec.rng); + } +""" +s = s.replace(anchor, anchor + probe, 1) +open(path, "w").write(s) +print("decodemv rung 13 (EC_MODE_MV + EC_MODE_VAL stack=) instrumented") +PYMV