From 1d861513793fc2e6f9a51a970a027169628f40cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Mon, 28 Sep 2026 21:54:38 +0300 Subject: [PATCH] ec-av1: lane-av1444rect r3 -- drop the intra-BC prefix-floor assert; it encoded a defect as expected behaviour Main's push-back, accepted. The gate asserted our luma plane is byte-exact to sample 205264, i.e. that our output is wrong by exactly N past that point. That is a defect encoded as expected behaviour, the shape this suite refuses everywhere else, and it would outlive the memory of why. Removed. What the gate asserts now are only true statements: intrabc_rect4_own_chroma444_hits() is non-zero on the 4:4:4 witness (18) and zero on the 4:2:0 twin, and the 4:2:0 twin is byte-exact through decode_all_frames_vs_oracle (which asserts frame length before comparing). The open chroma divergence is named in a comment and in the test's output line -- 390380/921600 wrong, U and V both first wrong at index 20532, entropy fork read 12465 at mi (90,108) -- and never asserted. Also removed the temporary per-unit coefficient traces used to localize it. --- crates/ec-av1/src/stream.rs | 70 ++++++++----------------------------- 1 file changed, 15 insertions(+), 55 deletions(-) diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index b2e8ca93..ca0d2e47 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -7143,11 +7143,6 @@ pub(crate) mod tests { const W: usize = 640; const H: usize = 480; const PS: usize = W * H; - /// The luma prefix the ss gate makes exact (measured: 205264, i.e. - /// Y(464,320); before the gate the first wrong luma sample was 164416, - /// Y(576,256)). A floor, not a pin: fixing the open chroma divergence - /// moves this later, never earlier. - const LUMA_EXACT_PREFIX: usize = 205264; let read = |name: &str, file: &str, len: usize, fnv: u64| -> Vec { let path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) .join(format!("fixtures/{file}")); @@ -7202,57 +7197,22 @@ pub(crate) mod tests { "{NAME}: the 4:2:0 twin fired the ss (0,0)-only route" ); - // The 4:4:4 prefix claim. Same length-first discipline: an - // unequal-length compare would silently become a prefix compare - // and pass for the wrong reason. - let dir = std::env::temp_dir().join(format!("ec-av1-ibc444-{}", std::process::id())); - let _ = std::fs::remove_dir_all(&dir); - std::fs::create_dir_all(&dir).expect("scratch dir"); - let obu = dir.join("in.obu"); - std::fs::write(&obu, &stream444).expect("write stream"); - let out = Command::new(aomdec_path()) - .args(["--codec=av1", "-o"]) - .arg(dir.join("out.y4m")) - .arg(&obu) - .env("EC_AV1_FINAL_DUMP", dir.join("aom")) - .stdin(Stdio::null()) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .output() - .expect("aomdec failed to run"); - assert!( - out.status.success(), - "{NAME}: the oracle aomdec refused the stream: {}", - String::from_utf8_lossy(&out.stderr) - ); - let reference = std::fs::read(dir.join("aom.f0")).expect("oracle dump"); - assert_eq!( - reference.len(), - 3 * PS, - "{NAME}: the oracle dump is {} bytes, the 4:4:4 frame is {} -- a \ - compare across different lengths is a PREFIX compare and passes \ - for the wrong reason", - reference.len(), - 3 * PS - ); - let ours = &frames[0]; - let at = (0..LUMA_EXACT_PREFIX) - .find(|&k| ours.y[k] != u16::from(reference[k])) - .unwrap_or(LUMA_EXACT_PREFIX); - assert_eq!( - at, - LUMA_EXACT_PREFIX, - "{NAME}: the luma plane first differs from the oracle at sample {at} \ - (Y({},{})), inside the {LUMA_EXACT_PREFIX}-sample prefix this \ - gate covers -- the intra-BC own-chroma ss gate regressed", - at % W, - at / W - ); - let _ = std::fs::remove_dir_all(&dir); + // NO 4:4:4 pixel assert here, and deliberately so. The cell is + // still divergent (390380 of 921600 samples; both chroma planes + // first wrong at index 20532, x=52 y=32; entropy fork read 12465 + // at mi (90,108)) and an assertion of the form "our output is + // wrong by exactly N" would encode the defect as expected + // behaviour -- the shape this suite refuses everywhere else, and + // one that outlives the memory of why. The true assertions this + // gate can make today are the two above: the route is reached at + // 4:4:4 and is not reached at 4:2:0, and the 4:2:0 twin is + // byte-exact. The open chroma root and its numbers live in + // lanes/av1444rect.report.md §6, not in an assertion. eprintln!( - "{NAME}: {own} own-chroma intra-BC strip(s); luma exact to \ - {LUMA_EXACT_PREFIX}; chroma still diverges from index 20532 \ - (OPEN, see lanes/av1444rect.report.md §6)" + "{NAME}: {own} own-chroma intra-BC strip(s) at 4:4:4, 0 at 4:2:0; \ + 4:2:0 twin byte-exact; 4:4:4 intra-BC CHROMA still OPEN \ + (U/V first wrong at index 20532, entropy fork read 12465 at \ + mi (90,108)) -- see lanes/av1444rect.report.md \u{00a7}6" ); } else { eprintln!("{NAME}: no oracle aomdec, pixel arm skipped");