ec-av1: the oracle SKIP class — 13 gates could skip their pixel compare SILENTLY
Browse files at this commit1f09dc095e78e911180d921afb7b7b9fce3a4470Parent: 7bd9ad42 changed files +242 -74
- crates/ec-av1/src/stream.rs +83 -74
- lanes/av1oracleSkip.report.md +159 -0
crates/ec-av1/src/stream.rsmodified+83 -74
| @@ -6701,7 +6701,7 @@ pub(crate) mod tests { | |||
| 6701 | } | 6701 | } |
| 6702 | 6702 | ||
| 6703 | // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames. | 6703 | // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames. |
| 6704 | - if aomdec_path().is_file() { | 6704 | + if aomdec_available(NAME) { |
| 6705 | let dir = std::env::temp_dir().join(format!("ec-av1-ll444-{}", std::process::id())); | 6705 | let dir = std::env::temp_dir().join(format!("ec-av1-ll444-{}", std::process::id())); |
| 6706 | let _ = std::fs::remove_dir_all(&dir); | 6706 | let _ = std::fs::remove_dir_all(&dir); |
| 6707 | std::fs::create_dir_all(&dir).expect("scratch dir"); | 6707 | std::fs::create_dir_all(&dir).expect("scratch dir"); |
| @@ -6750,11 +6750,6 @@ pub(crate) mod tests { | |||
| 6750 | ); | 6750 | ); |
| 6751 | } | 6751 | } |
| 6752 | } | 6752 | } |
| 6753 | - } else { | ||
| 6754 | - eprintln!( | ||
| 6755 | - "SKIP {NAME} aomdec arm: no oracle aomdec at {}", | ||
| 6756 | - aomdec_path().display() | ||
| 6757 | - ); | ||
| 6758 | } | 6753 | } |
| 6759 | 6754 | ||
| 6760 | // ffmpeg's decoder: same frames, full-resolution chroma. | 6755 | // ffmpeg's decoder: same frames, full-resolution chroma. |
| @@ -6885,13 +6880,8 @@ pub(crate) mod tests { | |||
| 6885 | ); | 6880 | ); |
| 6886 | let _ = decode_stream(&ctrl_stream) | 6881 | let _ = decode_stream(&ctrl_stream) |
| 6887 | .unwrap_or_else(|e| panic!("{NAME}: the control arm no longer decodes cleanly: {e}")); | 6882 | .unwrap_or_else(|e| panic!("{NAME}: the control arm no longer decodes cleanly: {e}")); |
| 6888 | - if aomdec_path().is_file() { | 6883 | + if aomdec_available(NAME) { |
| 6889 | assert_rawvideo_matches(&ctrl, &ctrl_stream, NAME, FRAMES); | 6884 | assert_rawvideo_matches(&ctrl, &ctrl_stream, NAME, FRAMES); |
| 6890 | - } else { | ||
| 6891 | - eprintln!( | ||
| 6892 | - "SKIP {NAME} control aomdec arm: no oracle aomdec at {}", | ||
| 6893 | - aomdec_path().display() | ||
| 6894 | - ); | ||
| 6895 | } | 6885 | } |
| 6896 | } | 6886 | } |
| 6897 | 6887 | ||
| @@ -7075,7 +7065,7 @@ pub(crate) mod tests { | |||
| 7075 | } | 7065 | } |
| 7076 | 7066 | ||
| 7077 | // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames. | 7067 | // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames. |
| 7078 | - if aomdec_path().is_file() { | 7068 | + if aomdec_available(NAME) { |
| 7079 | let dir = std::env::temp_dir().join(format!("ec-av1-llminp8-{}", std::process::id())); | 7069 | let dir = std::env::temp_dir().join(format!("ec-av1-llminp8-{}", std::process::id())); |
| 7080 | let _ = std::fs::remove_dir_all(&dir); | 7070 | let _ = std::fs::remove_dir_all(&dir); |
| 7081 | std::fs::create_dir_all(&dir).expect("scratch dir"); | 7071 | std::fs::create_dir_all(&dir).expect("scratch dir"); |
| @@ -7125,11 +7115,6 @@ pub(crate) mod tests { | |||
| 7125 | ); | 7115 | ); |
| 7126 | } | 7116 | } |
| 7127 | } | 7117 | } |
| 7128 | - } else { | ||
| 7129 | - eprintln!( | ||
| 7130 | - "SKIP {NAME} aomdec arm: no oracle aomdec at {}", | ||
| 7131 | - aomdec_path().display() | ||
| 7132 | - ); | ||
| 7133 | } | 7118 | } |
| 7134 | 7119 | ||
| 7135 | // ffmpeg's decoder: same frames, full-resolution chroma. | 7120 | // ffmpeg's decoder: same frames, full-resolution chroma. |
| @@ -7269,7 +7254,7 @@ pub(crate) mod tests { | |||
| 7269 | // was a stage-ladder mixup, refuted in lane-av1lrflush r3. | 7254 | // was a stage-ladder mixup, refuted in lane-av1lrflush r3. |
| 7270 | 7255 | ||
| 7271 | // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames. | 7256 | // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames. |
| 7272 | - if aomdec_path().is_file() { | 7257 | + if aomdec_available(NAME) { |
| 7273 | let dir = std::env::temp_dir().join(format!("ec-av1-444sb-{}", std::process::id())); | 7258 | let dir = std::env::temp_dir().join(format!("ec-av1-444sb-{}", std::process::id())); |
| 7274 | let _ = std::fs::remove_dir_all(&dir); | 7259 | let _ = std::fs::remove_dir_all(&dir); |
| 7275 | std::fs::create_dir_all(&dir).expect("scratch dir"); | 7260 | std::fs::create_dir_all(&dir).expect("scratch dir"); |
| @@ -7319,11 +7304,6 @@ pub(crate) mod tests { | |||
| 7319 | ); | 7304 | ); |
| 7320 | } | 7305 | } |
| 7321 | } | 7306 | } |
| 7322 | - } else { | ||
| 7323 | - eprintln!( | ||
| 7324 | - "SKIP {NAME} aomdec arm: no oracle aomdec at {}", | ||
| 7325 | - aomdec_path().display() | ||
| 7326 | - ); | ||
| 7327 | } | 7307 | } |
| 7328 | 7308 | ||
| 7329 | // ffmpeg's decoder: same frames, full-resolution chroma. Same | 7309 | // ffmpeg's decoder: same frames, full-resolution chroma. Same |
| @@ -7441,7 +7421,7 @@ pub(crate) mod tests { | |||
| 7441 | f.u.len() | 7421 | f.u.len() |
| 7442 | ); | 7422 | ); |
| 7443 | } | 7423 | } |
| 7444 | - if aomdec_path().is_file() { | 7424 | + if aomdec_available(NAME) { |
| 7445 | let (decoded, _hidden) = decode_all_frames_vs_oracle(&stream, NAME); | 7425 | let (decoded, _hidden) = decode_all_frames_vs_oracle(&stream, NAME); |
| 7446 | eprintln!( | 7426 | eprintln!( |
| 7447 | "{NAME}: {decoded} frame(s) byte-exact vs aomdec, {own_chroma} \ | 7427 | "{NAME}: {decoded} frame(s) byte-exact vs aomdec, {own_chroma} \ |
| @@ -7531,7 +7511,7 @@ pub(crate) mod tests { | |||
| 7531 | // The identity half: the fix adds an arm gated on `ss_x == 0`, so a | 7511 | // The identity half: the fix adds an arm gated on `ss_x == 0`, so a |
| 7532 | // 4:2:0 stream must stay byte-exact through it. This is the arm that | 7512 | // 4:2:0 stream must stay byte-exact through it. This is the arm that |
| 7533 | // would go red if the new arm were ever widened past ss_x 0. | 7513 | // would go red if the new arm were ever widened past ss_x 0. |
| 7534 | - if aomdec_path().is_file() { | 7514 | + if aomdec_available(NAME) { |
| 7535 | decode_all_frames_vs_oracle(&out.stdout, &format!("{NAME}-420")); | 7515 | decode_all_frames_vs_oracle(&out.stdout, &format!("{NAME}-420")); |
| 7536 | } | 7516 | } |
| 7537 | eprintln!("{NAME}: 4:2:0 control {h4} HORZ_4 / {v4} VERT_4 strips, 0 own-extent gathers"); | 7517 | eprintln!("{NAME}: 4:2:0 control {h4} HORZ_4 / {v4} VERT_4 strips, 0 own-extent gathers"); |
| @@ -7563,13 +7543,24 @@ pub(crate) mod tests { | |||
| 7563 | /// in [`decode_inter_block`]'s `around_c` (a 4:2:0 stream of the same | 7543 | /// in [`decode_inter_block`]'s `around_c` (a 4:2:0 stream of the same |
| 7564 | /// content leaves it at 0), and a counter at 0 would mean the gate | 7544 | /// content leaves it at 0), and a counter at 0 would mean the gate |
| 7565 | /// measured a different route than it names. | 7545 | /// measured a different route than it names. |
| 7566 | - fn encode_444_lossy_live(name: &str, w: usize, h: usize) -> Vec<u8> { | 7546 | + /// The guard is [`have_aomenc`], which probes first and asserts LAST with |
| 7547 | + /// the env escape: with `EC_AV1_REQUIRE_AOMENC` set, a missing oracle is | ||
| 7548 | + /// a hard failure naming the path it looked for, and a batch run cannot | ||
| 7549 | + /// report green off three skipped gates. With it unset the `None` below is | ||
| 7550 | + /// a developer-only convenience for a checkout without an oracle -- it is | ||
| 7551 | + /// the ONLY way this gate can return without measuring, and it announces | ||
| 7552 | + /// itself on stderr naming the env var that would make it a failure. | ||
| 7553 | + /// (It used to return an empty `Vec` that the caller turned into a silent | ||
| 7554 | + /// early `return`: the same green, reached through a second exit nobody | ||
| 7555 | + /// was reading.) | ||
| 7556 | + fn encode_444_lossy_live(name: &str, w: usize, h: usize) -> Option<Vec<u8>> { | ||
| 7567 | if !have_aomenc() { | 7557 | if !have_aomenc() { |
| 7568 | eprintln!( | 7558 | eprintln!( |
| 7569 | - "SKIP {name}: no aomenc oracle at {} -- run scripts/build-aom-oracle.sh", | 7559 | + "SKIP {name}: no aomenc oracle at {} -- set EC_AV1_REQUIRE_AOMENC=1 to make this \ |
| 7560 | + a failure, or run scripts/build-aom-oracle.sh", | ||
| 7570 | aomenc_path().display() | 7561 | aomenc_path().display() |
| 7571 | ); | 7562 | ); |
| 7572 | - return Vec::new(); | 7563 | + return None; |
| 7573 | } | 7564 | } |
| 7574 | let source = format!("testsrc2=size={w}x{h}:rate=25"); | 7565 | let source = format!("testsrc2=size={w}x{h}:rate=25"); |
| 7575 | let y4m = Command::new("ffmpeg") | 7566 | let y4m = Command::new("ffmpeg") |
| @@ -7628,7 +7619,7 @@ pub(crate) mod tests { | |||
| 7628 | "{name}: aomenc produced no OBU for {w}x{h} -- a zero-length stream would \ | 7619 | "{name}: aomenc produced no OBU for {w}x{h} -- a zero-length stream would \ |
| 7629 | decode to nothing and the compare below would compare nothing" | 7620 | decode to nothing and the compare below would compare nothing" |
| 7630 | ); | 7621 | ); |
| 7631 | - out.stdout | 7622 | + Some(out.stdout) |
| 7632 | } | 7623 | } |
| 7633 | 7624 | ||
| 7634 | /// The body every 4:4:4 lossy live gate runs: assert the oracle compare | 7625 | /// The body every 4:4:4 lossy live gate runs: assert the oracle compare |
| @@ -7637,19 +7628,20 @@ pub(crate) mod tests { | |||
| 7637 | /// own-extent route really ran, then compare every frame in decode order | 7628 | /// own-extent route really ran, then compare every frame in decode order |
| 7638 | /// against the oracle aomdec with the length asserted first. | 7629 | /// against the oracle aomdec with the length asserted first. |
| 7639 | /// | 7630 | /// |
| 7640 | - /// The aomdec assert is deliberately a HARD failure, not the | 7631 | + /// The aomdec arm is a HARD failure, not a skip: these three gates encode |
| 7641 | - /// `if aomdec_path().is_file()` skip the older gates use: a gate that | 7632 | + /// LIVE, so reaching this point means the oracle aomenc resolved, and |
| 7642 | - /// measures exactness and then quietly skips the compare reports green | 7633 | + /// aomenc and aomdec ship in the same build directory -- an aomdec that is |
| 7643 | - /// for a decoder it never looked at (class gate-blind-to-the-arm). It | 7634 | + /// missing beside a present aomenc is a broken oracle, not a checkout |
| 7644 | - /// fires only when the gate is actually running, i.e. the oracle aomenc | 7635 | + /// without one. (The older shape, `if aomdec_path().is_file()`, let the |
| 7645 | - /// resolved -- and aomenc and aomdec ship in the same build directory, | 7636 | + /// compare vanish with no env escape at all; that is what |
| 7646 | - /// so an aomdec that is missing while aomenc is present is a broken | 7637 | + /// [`aomdec_available`] replaced for the pinned gates, and it cannot be |
| 7647 | - /// oracle, not a checkout without one. | 7638 | + /// used here because these gates have no stream to compare without one.) |
| 7648 | fn gate_444_lossy_live_exact(name: &str, w: usize, h: usize) { | 7639 | fn gate_444_lossy_live_exact(name: &str, w: usize, h: usize) { |
| 7649 | - let stream = encode_444_lossy_live(name, w, h); | 7640 | + // The ONLY way out without measuring, and it has already printed a |
| 7650 | - if stream.is_empty() { | 7641 | + // SKIP naming the env var that would turn it into a failure. |
| 7651 | - return; // no oracle at all: the SKIP above already said so | 7642 | + let Some(stream) = encode_444_lossy_live(name, w, h) else { |
| 7652 | - } | 7643 | + return; |
| 7644 | + }; | ||
| 7653 | assert!( | 7645 | assert!( |
| 7654 | aomdec_path().is_file(), | 7646 | aomdec_path().is_file(), |
| 7655 | "{name}: the oracle aomenc resolved to {} but no aomdec sits beside it at {} -- \ | 7647 | "{name}: the oracle aomenc resolved to {} but no aomdec sits beside it at {} -- \ |
| @@ -7842,7 +7834,7 @@ pub(crate) mod tests { | |||
| 7842 | // lengths match before it compares anything -- the check whose absence | 7834 | // lengths match before it compares anything -- the check whose absence |
| 7843 | // turned an out-of-window divergence into a reported EXACT in this | 7835 | // turned an out-of-window divergence into a reported EXACT in this |
| 7844 | // lane's own round 1. | 7836 | // lane's own round 1. |
| 7845 | - if aomdec_path().is_file() { | 7837 | + if aomdec_available(NAME) { |
| 7846 | decode_all_frames_vs_oracle(&stream420, &format!("{NAME}-420")); | 7838 | decode_all_frames_vs_oracle(&stream420, &format!("{NAME}-420")); |
| 7847 | crate::decode::reset_intrabc_rect4_own_chroma444_hits(); | 7839 | crate::decode::reset_intrabc_rect4_own_chroma444_hits(); |
| 7848 | decode_stream(&stream420) | 7840 | decode_stream(&stream420) |
| @@ -7973,7 +7965,7 @@ pub(crate) mod tests { | |||
| 7973 | } | 7965 | } |
| 7974 | 7966 | ||
| 7975 | // Frames 0/1 through the PIPELINE, byte-exact vs both oracles. | 7967 | // Frames 0/1 through the PIPELINE, byte-exact vs both oracles. |
| 7976 | - if aomdec_path().is_file() { | 7968 | + if aomdec_available(NAME) { |
| 7977 | let dir = std::env::temp_dir().join(format!("ec-av1-lrflush-{}", std::process::id())); | 7969 | let dir = std::env::temp_dir().join(format!("ec-av1-lrflush-{}", std::process::id())); |
| 7978 | let _ = std::fs::remove_dir_all(&dir); | 7970 | let _ = std::fs::remove_dir_all(&dir); |
| 7979 | std::fs::create_dir_all(&dir).expect("scratch dir"); | 7971 | std::fs::create_dir_all(&dir).expect("scratch dir"); |
| @@ -8023,11 +8015,6 @@ pub(crate) mod tests { | |||
| 8023 | ); | 8015 | ); |
| 8024 | } | 8016 | } |
| 8025 | } | 8017 | } |
| 8026 | - } else { | ||
| 8027 | - eprintln!( | ||
| 8028 | - "SKIP {NAME} aomdec arm: no oracle aomdec at {}", | ||
| 8029 | - aomdec_path().display() | ||
| 8030 | - ); | ||
| 8031 | } | 8018 | } |
| 8032 | if have_ffmpeg() { | 8019 | if have_ffmpeg() { |
| 8033 | let refs = ffmpeg_decode_sequence_444(&stream, W, H, FRAMES); | 8020 | let refs = ffmpeg_decode_sequence_444(&stream, W, H, FRAMES); |
| @@ -8123,7 +8110,7 @@ pub(crate) mod tests { | |||
| 8123 | ); | 8110 | ); |
| 8124 | 8111 | ||
| 8125 | // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames. | 8112 | // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames. |
| 8126 | - if aomdec_path().is_file() { | 8113 | + if aomdec_available(NAME) { |
| 8127 | let dir = std::env::temp_dir().join(format!("ec-av1-ll444dp-{}", std::process::id())); | 8114 | let dir = std::env::temp_dir().join(format!("ec-av1-ll444dp-{}", std::process::id())); |
| 8128 | let _ = std::fs::remove_dir_all(&dir); | 8115 | let _ = std::fs::remove_dir_all(&dir); |
| 8129 | std::fs::create_dir_all(&dir).expect("scratch dir"); | 8116 | std::fs::create_dir_all(&dir).expect("scratch dir"); |
| @@ -8164,11 +8151,6 @@ pub(crate) mod tests { | |||
| 8164 | ); | 8151 | ); |
| 8165 | } | 8152 | } |
| 8166 | } | 8153 | } |
| 8167 | - } else { | ||
| 8168 | - eprintln!( | ||
| 8169 | - "SKIP {NAME} aomdec arm: no oracle aomdec at {}", | ||
| 8170 | - aomdec_path().display() | ||
| 8171 | - ); | ||
| 8172 | } | 8154 | } |
| 8173 | } | 8155 | } |
| 8174 | 8156 | ||
| @@ -8265,7 +8247,7 @@ pub(crate) mod tests { | |||
| 8265 | } | 8247 | } |
| 8266 | 8248 | ||
| 8267 | // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames. | 8249 | // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames. |
| 8268 | - if aomdec_path().is_file() { | 8250 | + if aomdec_available(NAME) { |
| 8269 | let dir = std::env::temp_dir().join(format!("ec-av1-leaf8oob-{}", std::process::id())); | 8251 | let dir = std::env::temp_dir().join(format!("ec-av1-leaf8oob-{}", std::process::id())); |
| 8270 | let _ = std::fs::remove_dir_all(&dir); | 8252 | let _ = std::fs::remove_dir_all(&dir); |
| 8271 | std::fs::create_dir_all(&dir).expect("scratch dir"); | 8253 | std::fs::create_dir_all(&dir).expect("scratch dir"); |
| @@ -8292,11 +8274,6 @@ pub(crate) mod tests { | |||
| 8292 | 0x3821_0bcb_f572_973c, | 8274 | 0x3821_0bcb_f572_973c, |
| 8293 | "{NAME}: aomdec raw fingerprint moved" | 8275 | "{NAME}: aomdec raw fingerprint moved" |
| 8294 | ); | 8276 | ); |
| 8295 | - } else { | ||
| 8296 | - eprintln!( | ||
| 8297 | - "SKIP {NAME} aomdec arm: no oracle aomdec at {}", | ||
| 8298 | - aomdec_path().display() | ||
| 8299 | - ); | ||
| 8300 | } | 8277 | } |
| 8301 | } | 8278 | } |
| 8302 | /// lane-lossless128: a LOSSLESS key frame that codes a 128-axis | 8279 | /// lane-lossless128: a LOSSLESS key frame that codes a 128-axis |
| @@ -8697,7 +8674,7 @@ pub(crate) mod tests { | |||
| 8697 | ); | 8674 | ); |
| 8698 | 8675 | ||
| 8699 | // The oracle aomdec, rawvideo out: one concatenated yuv444p frame. | 8676 | // The oracle aomdec, rawvideo out: one concatenated yuv444p frame. |
| 8700 | - if aomdec_path().is_file() { | 8677 | + if aomdec_available(NAME) { |
| 8701 | let dir = std::env::temp_dir().join(format!("ec-av1-ibcskip2-{}", std::process::id())); | 8678 | let dir = std::env::temp_dir().join(format!("ec-av1-ibcskip2-{}", std::process::id())); |
| 8702 | let _ = std::fs::remove_dir_all(&dir); | 8679 | let _ = std::fs::remove_dir_all(&dir); |
| 8703 | std::fs::create_dir_all(&dir).expect("scratch dir"); | 8680 | std::fs::create_dir_all(&dir).expect("scratch dir"); |
| @@ -8738,11 +8715,6 @@ pub(crate) mod tests { | |||
| 8738 | predictor or the rect walk" | 8715 | predictor or the rect walk" |
| 8739 | ); | 8716 | ); |
| 8740 | } | 8717 | } |
| 8741 | - } else { | ||
| 8742 | - eprintln!( | ||
| 8743 | - "SKIP {NAME} aomdec arm: no oracle aomdec at {}", | ||
| 8744 | - aomdec_path().display() | ||
| 8745 | - ); | ||
| 8746 | } | 8718 | } |
| 8747 | eprintln!( | 8719 | eprintln!( |
| 8748 | "{NAME}: frame sample-exact vs oracle aomdec; {luma}+{chroma} rect \ | 8720 | "{NAME}: frame sample-exact vs oracle aomdec; {luma}+{chroma} rect \ |
| @@ -9147,6 +9119,48 @@ pub(crate) mod tests { | |||
| 9147 | present | 9119 | present |
| 9148 | } | 9120 | } |
| 9149 | 9121 | ||
| 9122 | + /// lane-av1oracleskip: the probe for the ORACLE COMPARER, in the same | ||
| 9123 | + /// shape as [`have_ffmpeg`] -- probe first, then `assert!` LAST, with the | ||
| 9124 | + /// env escape -- and it prints its own SKIP so a caller cannot skip the | ||
| 9125 | + /// compare silently. | ||
| 9126 | + /// | ||
| 9127 | + /// Why this exists: thirteen gates wrapped their oracle arm in a bare | ||
| 9128 | + /// `if aomdec_path().is_file()`, and that shape had NO env escape at all. | ||
| 9129 | + /// An oracle build with `aomenc` but no `aomdec` beside it (or an | ||
| 9130 | + /// `EC_AV1_AOMDEC` override pointing at a moved path) made the gate | ||
| 9131 | + /// encode, decode, assert its geometry and its counters, and then quietly | ||
| 9132 | + /// never compare -- green having measured nothing, with no line in the | ||
| 9133 | + /// output to notice. Nine of the thirteen printed a SKIP in an `else` and | ||
| 9134 | + /// four printed nothing at all; both are the same defect, and both are | ||
| 9135 | + /// closed by one probe. | ||
| 9136 | + /// | ||
| 9137 | + /// With `EC_AV1_REQUIRE_AOMENC` (or the aomdec-specific | ||
| 9138 | + /// `EC_AV1_REQUIRE_AOMDEC`) set, the absence is a HARD failure naming the | ||
| 9139 | + /// path that was looked for -- that is the batch-run guarantee, and it is | ||
| 9140 | + /// what the bare `is_file()` could not give. With it unset the SKIP below | ||
| 9141 | + /// is printed and the gate still passes: that remains a developer-only | ||
| 9142 | + /// convenience for a checkout without an oracle, never evidence. | ||
| 9143 | + fn aomdec_available(name: &str) -> bool { | ||
| 9144 | + let present = aomdec_path().is_file(); | ||
| 9145 | + let require = std::env::var_os("EC_AV1_REQUIRE_AOMDEC").is_some() | ||
| 9146 | + || std::env::var_os("EC_AV1_REQUIRE_AOMENC").is_some(); | ||
| 9147 | + assert!( | ||
| 9148 | + present || !require, | ||
| 9149 | + "{name}: no oracle aomdec at {} -- the pixel compare this gate exists for would be \ | ||
| 9150 | + skipped, and EC_AV1_REQUIRE_AOMDEC/EC_AV1_REQUIRE_AOMENC is set. Build the oracle \ | ||
| 9151 | + with scripts/build-aom-oracle.sh, or point EC_AV1_AOMDEC at a real aomdec.", | ||
| 9152 | + aomdec_path().display() | ||
| 9153 | + ); | ||
| 9154 | + if !present { | ||
| 9155 | + eprintln!( | ||
| 9156 | + "SKIP {name}: no oracle aomdec at {} -- the pixel compare is NOT running (set \ | ||
| 9157 | + EC_AV1_REQUIRE_AOMDEC=1 to make this a failure)", | ||
| 9158 | + aomdec_path().display() | ||
| 9159 | + ); | ||
| 9160 | + } | ||
| 9161 | + present | ||
| 9162 | + } | ||
| 9163 | + | ||
| 9150 | /// The instrumented `aomdec` beside the `aomenc` oracle | 9164 | /// The instrumented `aomdec` beside the `aomenc` oracle |
| 9151 | /// (`scripts/build-aom-oracle.sh` + `scripts/instrument-aom-oracle.sh`). | 9165 | /// (`scripts/build-aom-oracle.sh` + `scripts/instrument-aom-oracle.sh`). |
| 9152 | fn aomdec_path() -> std::path::PathBuf { | 9166 | fn aomdec_path() -> std::path::PathBuf { |
| @@ -11180,18 +11194,13 @@ pub(crate) mod tests { | |||
| 11180 | // The oracle, DECODE order, every frame including hidden alt-ref | 11194 | // The oracle, DECODE order, every frame including hidden alt-ref |
| 11181 | // frames. This is the arm that proves the repair against aomdec's | 11195 | // frames. This is the arm that proves the repair against aomdec's |
| 11182 | // own reconstruction, not just ffmpeg's. | 11196 | // own reconstruction, not just ffmpeg's. |
| 11183 | - if aomdec_path().is_file() { | 11197 | + if aomdec_available(NAME) { |
| 11184 | let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME); | 11198 | let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME); |
| 11185 | assert!( | 11199 | assert!( |
| 11186 | decoded >= FRAMES, | 11200 | decoded >= FRAMES, |
| 11187 | "{NAME}: oracle decoded {decoded} frames, expected at least {FRAMES}" | 11201 | "{NAME}: oracle decoded {decoded} frames, expected at least {FRAMES}" |
| 11188 | ); | 11202 | ); |
| 11189 | let _ = hidden; | 11203 | let _ = hidden; |
| 11190 | - } else { | ||
| 11191 | - eprintln!( | ||
| 11192 | - "SKIP {NAME} aomdec arm: no oracle aomdec at {}", | ||
| 11193 | - aomdec_path().display() | ||
| 11194 | - ); | ||
| 11195 | } | 11204 | } |
| 11196 | 11205 | ||
| 11197 | // ffmpeg's decoder: DISPLAY order, full-resolution chroma. | 11206 | // ffmpeg's decoder: DISPLAY order, full-resolution chroma. |
| @@ -14198,7 +14207,7 @@ pub(crate) mod tests { | |||
| 14198 | ); | 14207 | ); |
| 14199 | } | 14208 | } |
| 14200 | } | 14209 | } |
| 14201 | - if aomdec_path().is_file() { | 14210 | + if aomdec_available(name) { |
| 14202 | let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, name); | 14211 | let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, name); |
| 14203 | eprintln!( | 14212 | eprintln!( |
| 14204 | "{name}: {decoded} decode-order frame(s) ({hidden} hidden) byte-exact vs aomdec \ | 14213 | "{name}: {decoded} decode-order frame(s) ({hidden} hidden) byte-exact vs aomdec \ |
lanes/av1oracleSkip.report.mdadded+159 -0
| @@ -0,0 +1,159 @@ | |||
| 1 | +# lane-av1oracleskip — gate-honesty: the oracle SKIP class | ||
| 2 | + | ||
| 3 | +**Tree.** `lane-av1oracleskip` off **main `7f8817cb`** ("Merge lane-av1pins @ | ||
| 4 | +44a05b40"), worktree `~/.cache/wt/av1oracleskip`, branch | ||
| 5 | +`lane-av1oracleskip`. Commit `ee4f2d55` (see §5). The primary checkout was | ||
| 6 | +mid-merge when this lane started (`UU crates/ec-av1/src/stream.rs` in its | ||
| 7 | +index), so this worktree is pinned to the last merge commit rather than to a | ||
| 8 | +moving HEAD. Built in a lane-private `CARGO_TARGET_DIR` | ||
| 9 | +(`~/.cache/cargo-target-av1oracleskip`). | ||
| 10 | + | ||
| 11 | +**Scope.** (1) the three `lane-av1gates444` gates that reported green having | ||
| 12 | +measured nothing on a host without the oracle; (2) the class sweep behind it, | ||
| 13 | +one row per site for every site this commit touches and per shape for the rest. | ||
| 14 | + | ||
| 15 | +--- | ||
| 16 | + | ||
| 17 | +## 1. What was wrong, exactly | ||
| 18 | + | ||
| 19 | +`encode_444_lossy_live` (the helper all three gates call) opened with | ||
| 20 | + | ||
| 21 | +```rust | ||
| 22 | +if !have_aomenc() { | ||
| 23 | + eprintln!("SKIP {name}: no aomenc oracle at {path} -- run scripts/build-aom-oracle.sh"); | ||
| 24 | + return Vec::new(); | ||
| 25 | +} | ||
| 26 | +``` | ||
| 27 | + | ||
| 28 | +and `gate_444_lossy_live_exact` then did | ||
| 29 | + | ||
| 30 | +```rust | ||
| 31 | +let stream = encode_444_lossy_live(name, w, h); | ||
| 32 | +if stream.is_empty() { | ||
| 33 | + return; // no oracle at all: the SKIP above already said so | ||
| 34 | +} | ||
| 35 | +``` | ||
| 36 | + | ||
| 37 | +Two exits, the second one silent, and — the part that matters for a batch — the | ||
| 38 | +empty `Vec` is indistinguishable at the call site from a stream aomenc | ||
| 39 | +produced and then lost. The gates | ||
| 40 | +`a_444_lossy_odd_66x66_stream_decodes_pixel_exact`, | ||
| 41 | +`a_444_lossy_odd_130x122_stream_decodes_pixel_exact` and | ||
| 42 | +`a_444_lossy_256x128_stream_decodes_pixel_exact` inherit that shape: without the | ||
| 43 | +oracle they assert nothing, encode nothing, compare nothing, and report | ||
| 44 | +**passed**. | ||
| 45 | + | ||
| 46 | +The escape hatch already existed and was already correct in the probe: | ||
| 47 | +`have_aomenc()` asserts when `EC_AV1_REQUIRE_AOMENC` is set, naming the path it | ||
| 48 | +looked for. So the fix is not a new mechanism — it is to stop putting a second, | ||
| 49 | +silent exit in the gate, and to make the SKIP say what it is. | ||
| 50 | + | ||
| 51 | +## 2. The class sweep | ||
| 52 | + | ||
| 53 | +`grep -c` over the crate's three test-bearing files (there is no `tests/` | ||
| 54 | +directory; the crate's tests live in `src/*.rs`): | ||
| 55 | + | ||
| 56 | +| file:line | gate(s) | shape | fixed or reported | | ||
| 57 | +|---|---|---|---| | ||
| 58 | +| `stream.rs:7422` (`encode_444_lossy_live`), `stream.rs:7505` (`gate_444_lossy_live_exact`) | `a_444_lossy_odd_66x66_stream_decodes_pixel_exact`, `a_444_lossy_odd_130x122_stream_decodes_pixel_exact`, `a_444_lossy_256x128_stream_decodes_pixel_exact` | **C** — `if !have_aomenc() { SKIP; return Vec::new() }` + a silent `if stream.is_empty() { return; }` in the caller | **FIXED** | | ||
| 59 | +| `stream.rs:6692` | `a_lossless_444_min_partition64_inter_stream_decodes_pixel_exact` | **B** — bare `if aomdec_path().is_file() { …compare… }`, no else, no env escape | **FIXED** | | ||
| 60 | +| `stream.rs:6871` | `a_lossless_444_128_root_lossless_stream_reads_chunks_chunk_major` | B (had an `else` SKIP, still no env escape) | **FIXED** | | ||
| 61 | +| `stream.rs:6934` | `a_lossless_444_min_partition8_inter_stream_decodes_sample_exact` | B (else SKIP) | **FIXED** | | ||
| 62 | +| `stream.rs:7123` | `a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact` | B (no else) | **FIXED** | | ||
| 63 | +| `stream.rs:7290` | `a_444_lossy_rect4_inter_stream_decodes_pixel_exact` | B (no else) | **FIXED** | | ||
| 64 | +| `stream.rs:7380` | `a_444_lossy_rect4_inter_stream_decodes_pixel_exact` (4:2:0 control arm) | B (no else) | **FIXED** | | ||
| 65 | +| `stream.rs:7703` | `a_444_intrabc_rect4_reads_its_own_chroma_plane_block` | B (no else) | **FIXED** | | ||
| 66 | +| `stream.rs:7834` | `a_444_sb128_witness_lr_pipeline_flushes_ru_row_0_pixel_exact` | B (else SKIP) | **FIXED** | | ||
| 67 | +| `stream.rs:7979` | `a_lossless_444_defaultp_inter_strip_stream_decodes_byte_exact` | B (else SKIP) | **FIXED** | | ||
| 68 | +| `stream.rs:8116` | `an_intrabc_8x8_leaf_chroma_frame_copy_at_444_decodes_without_the_oob` | B (else SKIP) | **FIXED** | | ||
| 69 | +| `stream.rs:8543` | `a_lossless_444_intrabc_rect_leaf_walks_per_4x4_units` | B (else SKIP) | **FIXED** | | ||
| 70 | +| `stream.rs:11063` | `a_lossless_444_rect16x4_chroma_reach_is_ss_aware` | B (else SKIP) | **FIXED** | | ||
| 71 | +| `stream.rs:14076` | the superres/upscaled-bit-depth helper (`name: &str`) | B (no else) | **FIXED** | | ||
| 72 | +| `stream.rs` — 153 sites | (the `aomenc`-live gates) | **A** — `if !have_aomenc() { eprintln!("SKIP …"); return; }` | REPORTED, not changed | | ||
| 73 | +| `stream.rs` — 218 sites, `decode.rs` — 4, `encode.rs` — 43 | (the ffmpeg-backed gates) | **A** — `if !have_ffmpeg() { …; return; }` | REPORTED, not changed | | ||
| 74 | +| `stream.rs` — 26, `decode.rs` — 1, `encode.rs` — 1 | (compound guards) | **A** — `if !have_ffmpeg() \|\| !have_aomenc() { … }` | REPORTED, not changed | | ||
| 75 | +| `stream.rs:7511` | the three live 4:4:4 gates | **D** — a hard `assert!(aomdec_path().is_file(), …)` | REPORTED, kept: these gates encode LIVE, so reaching that point means aomenc resolved, and an aomdec missing beside a present aomenc is a broken oracle, not a checkout without one | | ||
| 76 | + | ||
| 77 | +**Why shape A is reported and not changed.** Both probes (`have_ffmpeg`, | ||
| 78 | +`have_aomenc`) already have the correct shape — probe, then `assert!` last, | ||
| 79 | +with the env escape — and `have_ffmpeg`'s doc comment already records the | ||
| 80 | +earlier version's short-circuit bug. Every shape-A site therefore already FAILS | ||
| 81 | +under `EC_AV1_REQUIRE_AOMENC=1` / `EC_AV1_REQUIRE_FFMPEG=1` and prints a SKIP | ||
| 82 | +when those are unset. Changing 445 call sites would restate a convention the | ||
| 83 | +probe already enforces; the honest statement is that a batch run MUST set the | ||
| 84 | +env var, and this commit does not change that. | ||
| 85 | + | ||
| 86 | +**Shape B is the part the sweep found that nobody had named**, and it is worse | ||
| 87 | +than the three gates Main pointed at: those three fail loudly in REQUIRE mode | ||
| 88 | +(through `have_aomenc`), while all thirteen B sites had **no env escape at | ||
| 89 | +all** — with `EC_AV1_REQUIRE_AOMENC=1` set and aomdec absent, they encoded, | ||
| 90 | +decoded, asserted their geometry and counters, skipped the compare, and | ||
| 91 | +reported green. Four of the thirteen printed nothing at all. | ||
| 92 | + | ||
| 93 | +## 3. The fix | ||
| 94 | + | ||
| 95 | +1. New probe `aomdec_available(name)` beside `have_aomenc`, in the | ||
| 96 | + `have_ffmpeg` shape: probe `aomdec_path().is_file()`, then `assert!` **last** | ||
| 97 | + that the absence is a hard failure when `EC_AV1_REQUIRE_AOMDEC` or | ||
| 98 | + `EC_AV1_REQUIRE_AOMENC` is set (the message names the path looked for and | ||
| 99 | + how to fix it), then print a SKIP naming the env var when the flag is unset | ||
| 100 | + and return the bool. All thirteen sites now call it; the nine `else { … }` | ||
| 101 | + SKIP branches they carried are deleted, so the skip notice comes from one | ||
| 102 | + place and cannot drift from the assert. | ||
| 103 | +2. `encode_444_lossy_live` returns `Option<Vec<u8>>` and | ||
| 104 | + `gate_444_lossy_live_exact` takes it with `let Some(stream) = … else { return }` | ||
| 105 | + — one exit instead of two, and the empty-`Vec` sentinel that made "no | ||
| 106 | + oracle" look like "aomenc produced nothing" is gone. Nothing about what the | ||
| 107 | + gates measure changed: they still encode live, still assert the parsed | ||
| 108 | + geometry, the frame count, the full-resolution chroma extent and | ||
| 109 | + `rect4_inter_own_chroma444_hits()`, and still compare every decode-order | ||
| 110 | + frame against `aomdec` through `decode_all_frames_vs_oracle`. | ||
| 111 | + | ||
| 112 | +## 4. Proof, all six directions | ||
| 113 | + | ||
| 114 | +Absence is simulated the way the crate's own path resolution allows: the | ||
| 115 | +`EC_AV1_AOMENC` / `EC_AV1_AOMDEC` env overrides point at | ||
| 116 | +`/nonexistent/oracle/aomenc` and `/nonexistent/oracle/aomdec`, so | ||
| 117 | +`aomenc_path()` / `aomdec_path()` resolve to files that are not there. | ||
| 118 | + | ||
| 119 | +| # | condition | before this commit | after | | ||
| 120 | +|---|---|---|---| | ||
| 121 | +| a | oracle present, `EC_AV1_REQUIRE_AOMENC=1` | 3 passed | 3 passed, each printing its line: `66x66 … 13 own-extent 1:4 chroma gather(s)`, `130x122 … 12 …`, `256x128 … 24 …` | | ||
| 122 | +| a2 | oracle present, the 11 re-routed pinned gates | 11 passed | **11 passed** (no behaviour change with the oracle there) | | ||
| 123 | +| b | aomenc absent + `EC_AV1_REQUIRE_AOMENC=1` | 3 passed (green, measured nothing) | **3 FAILED**: `EC_AV1_REQUIRE_AOMENC is set but no aomenc at /nonexistent/oracle/aomenc -- run scripts/build-aom-oracle.sh` | | ||
| 124 | +| b2 | aomdec absent + `EC_AV1_REQUIRE_AOMENC=1` | **3 passed, silently** — one of the three printed no SKIP line at all | **3 FAILED**: `<gate>: no oracle aomdec at /nonexistent/oracle/aomdec -- the pixel compare this gate exists for would be skipped, and EC_AV1_REQUIRE_AOMDEC/EC_AV1_REQUIRE_AOMENC is set.` | | ||
| 125 | +| c | aomenc absent, env unset | 3 passed, one SKIP line per gate | 3 passed, `SKIP <gate>: no aomenc oracle at /nonexistent/oracle/aomenc -- set EC_AV1_REQUIRE_AOMENC=1 to make this a failure, or run scripts/build-aom-oracle.sh` | | ||
| 126 | +| c2 | aomdec absent, env unset | 3 passed, 2 SKIP lines, 1 silent | 3 passed, 3 SKIP lines naming the gate and the path | | ||
| 127 | + | ||
| 128 | +**(b2) is the red-before for the class fix**: the same command on the parent | ||
| 129 | +commit printed `test result: ok. 3 passed` with the compare never running, and | ||
| 130 | +prints `3 failed` here. `(c)` and `(c2)` remain a **developer-only | ||
| 131 | +convenience** — a checkout without an oracle still runs the rest of the suite | ||
| 132 | +green, and the SKIP line now says which env var turns that into a failure. No | ||
| 133 | +batch run may rely on it: `EC_AV1_REQUIRE_AOMENC=1` (or the aomdec-specific | ||
| 134 | +`EC_AV1_REQUIRE_AOMDEC=1`) is what makes a missing oracle red, and that is | ||
| 135 | +stated in the SKIP text itself. | ||
| 136 | + | ||
| 137 | +## 5. Pre-existing red on this base, NOT this lane's | ||
| 138 | + | ||
| 139 | +`gate_coverage::tests::never_exercised_{8,10}bit_matches_the_gate_recipes` are | ||
| 140 | +RED on base `7f8817cb` before any edit of mine (`the 8-bit list still names | ||
| 141 | +["enable-rect-tx"], but a 8-bit gate now passes '=1' for them`). Reproduced on | ||
| 142 | +the stashed, unmodified tree. A gate merged in `7f8817cb` spells | ||
| 143 | +`--enable-rect-tx=1`, so the `enable-rect-tx` entries in | ||
| 144 | +`NEVER_EXERCISED_8BIT` / `NEVER_EXERCISED_10BIT` are stale and the rule is to | ||
| 145 | +delete them in the same commit as the gate that closes the hole — that gate is | ||
| 146 | +not mine, and `crates/ec-av1/src/gate_coverage.rs` is one of the files the | ||
| 147 | +in-flight merge on the primary checkout has staged as modified, so editing it | ||
| 148 | +here would collide. **Reported, not touched.** The fix is deleting the | ||
| 149 | +`("enable-rect-tx", …)` entry from both lists. | ||
| 150 | + | ||
| 151 | +## 6. One more thing this lane does not change | ||
| 152 | + | ||
| 153 | +`aomdec_available` deliberately keeps a SKIP (rather than the hard assert shape | ||
| 154 | +D uses) because those thirteen gates decode a **pinned fixture** and their | ||
| 155 | +oracle arm is one assertion among several; the live-encode gates have no | ||
| 156 | +fixture to fall back on, so a missing aomdec there really is a broken oracle | ||
| 157 | +and stays a hard failure. If the house wants the pinned gates to fail | ||
| 158 | +unconditionally too, that is a one-line change per site and a policy call, not | ||
| 159 | +a bug. | ||