forge
Explore
Log in

Don't you dare go Hollow

ec-av1: lane-av1444rect r3 -- drop the intra-BC prefix-floor assert; it encoded a defect as expected behaviour

Browse files at this commit

1d861513793fc2e6f9a51a970a027169628f40cdAhmet Kaan GümüşParent: 2bcb6de
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.rsmodified+15 -55
@@ -7143,11 +7143,6 @@ pub(crate) mod tests {
7143 const W: usize = 640;7143 const W: usize = 640;
7144 const H: usize = 480;7144 const H: usize = 480;
7145 const PS: usize = W * H;7145 const PS: usize = W * H;
7146- /// The luma prefix the ss gate makes exact (measured: 205264, i.e.
7147- /// Y(464,320); before the gate the first wrong luma sample was 164416,
7148- /// Y(576,256)). A floor, not a pin: fixing the open chroma divergence
7149- /// moves this later, never earlier.
7150- const LUMA_EXACT_PREFIX: usize = 205264;
7151 let read = |name: &str, file: &str, len: usize, fnv: u64| -> Vec<u8> {7146 let read = |name: &str, file: &str, len: usize, fnv: u64| -> Vec<u8> {
7152 let path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))7147 let path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
7153 .join(format!("fixtures/{file}"));7148 .join(format!("fixtures/{file}"));
@@ -7202,57 +7197,22 @@ pub(crate) mod tests {
7202 "{NAME}: the 4:2:0 twin fired the ss (0,0)-only route"7197 "{NAME}: the 4:2:0 twin fired the ss (0,0)-only route"
7203 );7198 );
7204 7199
7205- // The 4:4:4 prefix claim. Same length-first discipline: an7200+ // NO 4:4:4 pixel assert here, and deliberately so. The cell is
7206- // unequal-length compare would silently become a prefix compare7201+ // still divergent (390380 of 921600 samples; both chroma planes
7207- // and pass for the wrong reason.7202+ // first wrong at index 20532, x=52 y=32; entropy fork read 12465
7208- let dir = std::env::temp_dir().join(format!("ec-av1-ibc444-{}", std::process::id()));7203+ // at mi (90,108)) and an assertion of the form "our output is
7209- let _ = std::fs::remove_dir_all(&dir);7204+ // wrong by exactly N" would encode the defect as expected
7210- std::fs::create_dir_all(&dir).expect("scratch dir");7205+ // behaviour -- the shape this suite refuses everywhere else, and
7211- let obu = dir.join("in.obu");7206+ // one that outlives the memory of why. The true assertions this
7212- std::fs::write(&obu, &stream444).expect("write stream");7207+ // gate can make today are the two above: the route is reached at
7213- let out = Command::new(aomdec_path())7208+ // 4:4:4 and is not reached at 4:2:0, and the 4:2:0 twin is
7214- .args(["--codec=av1", "-o"])7209+ // byte-exact. The open chroma root and its numbers live in
7215- .arg(dir.join("out.y4m"))7210+ // lanes/av1444rect.report.md §6, not in an assertion.
7216- .arg(&obu)
7217- .env("EC_AV1_FINAL_DUMP", dir.join("aom"))
7218- .stdin(Stdio::null())
7219- .stdout(Stdio::piped())
7220- .stderr(Stdio::piped())
7221- .output()
7222- .expect("aomdec failed to run");
7223- assert!(
7224- out.status.success(),
7225- "{NAME}: the oracle aomdec refused the stream: {}",
7226- String::from_utf8_lossy(&out.stderr)
7227- );
7228- let reference = std::fs::read(dir.join("aom.f0")).expect("oracle dump");
7229- assert_eq!(
7230- reference.len(),
7231- 3 * PS,
7232- "{NAME}: the oracle dump is {} bytes, the 4:4:4 frame is {} -- a \
7233- compare across different lengths is a PREFIX compare and passes \
7234- for the wrong reason",
7235- reference.len(),
7236- 3 * PS
7237- );
7238- let ours = &frames[0];
7239- let at = (0..LUMA_EXACT_PREFIX)
7240- .find(|&k| ours.y[k] != u16::from(reference[k]))
7241- .unwrap_or(LUMA_EXACT_PREFIX);
7242- assert_eq!(
7243- at,
7244- LUMA_EXACT_PREFIX,
7245- "{NAME}: the luma plane first differs from the oracle at sample {at} \
7246- (Y({},{})), inside the {LUMA_EXACT_PREFIX}-sample prefix this \
7247- gate covers -- the intra-BC own-chroma ss gate regressed",
7248- at % W,
7249- at / W
7250- );
7251- let _ = std::fs::remove_dir_all(&dir);
7252 eprintln!(7211 eprintln!(
7253- "{NAME}: {own} own-chroma intra-BC strip(s); luma exact to \7212+ "{NAME}: {own} own-chroma intra-BC strip(s) at 4:4:4, 0 at 4:2:0; \
7254- {LUMA_EXACT_PREFIX}; chroma still diverges from index 20532 \7213+ 4:2:0 twin byte-exact; 4:4:4 intra-BC CHROMA still OPEN \
7255- (OPEN, see lanes/av1444rect.report.md §6)"7214+ (U/V first wrong at index 20532, entropy fork read 12465 at \
7215+ mi (90,108)) -- see lanes/av1444rect.report.md \u{00a7}6"
7256 );7216 );
7257 } else {7217 } else {
7258 eprintln!("{NAME}: no oracle aomdec, pixel arm skipped");7218 eprintln!("{NAME}: no oracle aomdec, pixel arm skipped");