Give pinned_lr_sgr the pixel asserts it lacked, and un-ignore it
Browse files at this commit0777cd0bfa391cc84a0fa63f8dea6640d5726ab9Parent: 9ca92c7- test
- give pinned_lr_sgr the pixel asserts it lacked, and un-ignore it
1 changed file +86 -31
- crates/ec-av1/src/stream.rs +86 -31
crates/ec-av1/src/stream.rsmodified+86 -31
| @@ -30290,48 +30290,103 @@ pub(crate) mod tests { | |||
| 30290 | /// `EC_LR_CALL_DUMP=1` set (see `restoration.rs`'s `apply_sgrproj_stripe`) | 30290 | /// `EC_LR_CALL_DUMP=1` set (see `restoration.rs`'s `apply_sgrproj_stripe`) |
| 30291 | /// to get the real window on stderr, call-uniquely keyed to `xqd == | 30291 | /// to get the real window on stderr, call-uniquely keyed to `xqd == |
| 30292 | /// [-16,-32]` rather than any coordinate. | 30292 | /// [-16,-32]` rather than any coordinate. |
| 30293 | + /// lane-av1pinslive r4: this gate asserted NOTHING. It `eprintln!`d per-frame | ||
| 30294 | + /// mismatch flags and returned, so it could not go red on a decode regression | ||
| 30295 | + /// -- which is why r3 left it `#[ignore]`d on that fact rather than un-ignoring | ||
| 30296 | + /// it. It now carries the same three things its three siblings have: a pinned | ||
| 30297 | + /// FRAME COUNT, a length assert before the zip, and per-plane per-frame pixel | ||
| 30298 | + /// asserts. The diagnostic print is kept, and now runs BEFORE the asserts so a | ||
| 30299 | + /// failure still names the shape of the divergence. | ||
| 30300 | + /// | ||
| 30301 | + /// The frame count is the substantive fix. The old body passed `pics.len()` as | ||
| 30302 | + /// ffmpeg's EXPECTED count: | ||
| 30303 | + /// let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len()); | ||
| 30304 | + /// so a decoder that emitted ZERO frames asked ffmpeg for zero frames, the zip | ||
| 30305 | + /// compared no pairs, and the gate passed having proved nothing -- the exact | ||
| 30306 | + /// vacuous-pass shape the `cmpaudit` lane swept elsewhere in this crate. The | ||
| 30307 | + /// count now comes from the FIXTURE (`FRAMES`), so losing the frame reds on the | ||
| 30308 | + /// count instead of comparing nothing. | ||
| 30309 | + /// | ||
| 30310 | + /// On "does it compare only frame 0": the loop always visited every frame; this | ||
| 30311 | + /// pin simply holds one (`frame 0` was the only line the pre-r4 run printed). | ||
| 30312 | + /// The loop is unchanged in that respect and still visits every frame it gets. | ||
| 30313 | + /// | ||
| 30314 | + /// The `EC_LR_CALL_DUMP=1` window is unchanged and still needs that env -- but | ||
| 30315 | + /// it is a debugging session layered on a real gate now, not the gate itself. | ||
| 30293 | #[test] | 30316 | #[test] |
| 30294 | - // Stays `#[ignore]`d, and here are FACTS, not a judgement: (1) this gate | ||
| 30295 | - // asserts NOTHING -- it `eprintln!`s per-frame mismatch counts and returns, | ||
| 30296 | - // so it cannot go red on a decode regression and un-ignoring it would add a | ||
| 30297 | - // test that reports pass unconditionally; (2) its bytes ARE now committed | ||
| 30298 | - // at `crates/ec-av1/fixtures/lr-sgr-r7.obu` (192 bytes; sha256 | ||
| 30299 | - // `6b95b20e3377430ffae0b2ce86fad9502e0dedf13cd6c38ab7f5af4a8b21f33d`, | ||
| 30300 | - // recovered byte-for-byte from the runner library), so the old "reads a | ||
| 30301 | - // pinned fixture under the gitignored fixtures dir" reason is false; (3) it | ||
| 30302 | - // yields a window only with `EC_LR_CALL_DUMP=1`, a debugging session rather | ||
| 30303 | - // than a suite run. What would close it: give it the pixel asserts its | ||
| 30304 | - // siblings have, then un-ignore. | ||
| 30305 | - #[ignore = "diagnostic only -- asserts nothing, so it cannot fail on a decode regression; run with --ignored and EC_LR_CALL_DUMP=1 for the Sgrproj window"] | ||
| 30306 | fn pinned_lr_sgr_stream_call_unique_dump() { | 30317 | fn pinned_lr_sgr_stream_call_unique_dump() { |
| 30318 | + const NAME: &str = "pinned_lr_sgr_stream_call_unique_dump"; | ||
| 30319 | + const W: usize = 192; | ||
| 30320 | + const H: usize = 128; | ||
| 30321 | + /// Measured: the pre-r4 run printed `frame 0` and no other frame line. | ||
| 30322 | + const FRAMES: usize = 1; | ||
| 30307 | let path = std::env::var("EC_AV1_GATE_DUMP_PIN") | 30323 | let path = std::env::var("EC_AV1_GATE_DUMP_PIN") |
| 30308 | .map(std::path::PathBuf::from) | 30324 | .map(std::path::PathBuf::from) |
| 30309 | .unwrap_or_else(|_| crate_pin("lr-sgr-r7.obu")); | 30325 | .unwrap_or_else(|_| crate_pin("lr-sgr-r7.obu")); |
| 30310 | let stream = require_pin(&path, "lr-sgr-r7.obu"); | 30326 | let stream = require_pin(&path, "lr-sgr-r7.obu"); |
| 30311 | let pics = decode_stream(&stream).expect("pinned lr-sgr-r7.obu must decode"); | 30327 | let pics = decode_stream(&stream).expect("pinned lr-sgr-r7.obu must decode"); |
| 30312 | - if have_ffmpeg() { | 30328 | + assert_eq!( |
| 30313 | - let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len()); | 30329 | + pics.len(), |
| 30314 | - for (i, (got, want)) in pics.iter().zip(&reference).enumerate() { | 30330 | + FRAMES, |
| 30315 | - let y_mismatch = got.y != want.y; | 30331 | + "{NAME}: decoded {} frame(s), the pinned stream holds {FRAMES} -- a short \ |
| 30316 | - let u_mismatch = got.u != want.u; | 30332 | + decode would otherwise ask ffmpeg for the same short count and compare \ |
| 30317 | - let v_mismatch = got.v != want.v; | 30333 | + nothing", |
| 30318 | - eprintln!( | 30334 | + pics.len() |
| 30319 | - "frame {i}: y_mismatch={y_mismatch} u_mismatch={u_mismatch} v_mismatch={v_mismatch}" | 30335 | + ); |
| 30320 | - ); | 30336 | + for f in &pics { |
| 30321 | - if y_mismatch { | 30337 | + assert_eq!((f.width, f.height), (W, H), "{NAME}: dimensions"); |
| 30322 | - let n = got.y.iter().zip(&want.y).filter(|(a, b)| a != b).count(); | 30338 | + } |
| 30323 | - eprintln!(" {n} luma bytes differ / {}", got.y.len()); | 30339 | + if !have_ffmpeg() { |
| 30324 | - } | 30340 | + eprintln!( |
| 30325 | - if v_mismatch { | 30341 | + "SKIP {NAME}: no ffmpeg -- the pixel compare IS this gate's claim, so it \ |
| 30326 | - let w = 96usize; // chroma plane width (192/2) | 30342 | + proves nothing here; set EC_AV1_REQUIRE_FFMPEG=1 to make that a hard \ |
| 30327 | - for (idx, (a, b)) in got.v.iter().zip(&want.v).enumerate() { | 30343 | + failure instead" |
| 30328 | - if a != b { | 30344 | + ); |
| 30329 | - eprintln!(" V[{},{}] got={a} want={b}", idx / w, idx % w); | 30345 | + return; |
| 30330 | - } | 30346 | + } |
| 30347 | + let reference = ffmpeg_decode_sequence(&stream, W, H, FRAMES); | ||
| 30348 | + assert_eq!( | ||
| 30349 | + reference.len(), | ||
| 30350 | + FRAMES, | ||
| 30351 | + "{NAME}: ffmpeg returned {} frame(s), expected {FRAMES}", | ||
| 30352 | + reference.len() | ||
| 30353 | + ); | ||
| 30354 | + for (i, (got, want)) in pics.iter().zip(&reference).enumerate() { | ||
| 30355 | + let y_mismatch = got.y != want.y; | ||
| 30356 | + let u_mismatch = got.u != want.u; | ||
| 30357 | + let v_mismatch = got.v != want.v; | ||
| 30358 | + eprintln!( | ||
| 30359 | + "frame {i}: y_mismatch={y_mismatch} u_mismatch={u_mismatch} v_mismatch={v_mismatch}" | ||
| 30360 | + ); | ||
| 30361 | + if y_mismatch { | ||
| 30362 | + let n = got.y.iter().zip(&want.y).filter(|(a, b)| a != b).count(); | ||
| 30363 | + eprintln!(" {n} luma bytes differ / {}", got.y.len()); | ||
| 30364 | + } | ||
| 30365 | + if v_mismatch { | ||
| 30366 | + let w = 96usize; // chroma plane width (192/2) | ||
| 30367 | + for (idx, (a, b)) in got.v.iter().zip(&want.v).enumerate() { | ||
| 30368 | + if a != b { | ||
| 30369 | + eprintln!(" V[{},{}] got={a} want={b}", idx / w, idx % w); | ||
| 30331 | } | 30370 | } |
| 30332 | } | 30371 | } |
| 30333 | } | 30372 | } |
| 30373 | + assert_eq!( | ||
| 30374 | + got.y, want.y, | ||
| 30375 | + "{NAME} frame {i} luma vs ffmpeg (pinned lr-sgr)" | ||
| 30376 | + ); | ||
| 30377 | + assert_eq!( | ||
| 30378 | + got.u, want.u, | ||
| 30379 | + "{NAME} frame {i} U vs ffmpeg (pinned lr-sgr)" | ||
| 30380 | + ); | ||
| 30381 | + assert_eq!( | ||
| 30382 | + got.v, want.v, | ||
| 30383 | + "{NAME} frame {i} V vs ffmpeg (pinned lr-sgr)" | ||
| 30384 | + ); | ||
| 30334 | } | 30385 | } |
| 30386 | + eprintln!( | ||
| 30387 | + "{NAME}: {FRAMES} frame(s) byte-exact vs ffmpeg from {}", | ||
| 30388 | + path.display() | ||
| 30389 | + ); | ||
| 30335 | } | 30390 | } |
| 30336 | 30391 | ||
| 30337 | /// lane-realworld r2: `read_cdef` (spec 5.11.56) ported -- per-superblock | 30392 | /// lane-realworld r2: `read_cdef` (spec 5.11.56) ported -- per-superblock |