diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index f8d7e0cc..c8d0bf28 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -5681,6 +5681,11 @@ fn apply_deblock( frame_width: usize, frame_height: usize, ) { + // lane-part32 r2 debug rung, env-gated: bisecting a widespread pixel + // mismatch between the raw reconstruction and post-filter output. + if std::env::var_os("EC_AV1_DEBUG_SKIP_DEBLOCK").is_some() { + return; + } if lf.level[0] != 0 || lf.level[1] != 0 { deblock_plane(y, 0, lf, n, frame_width, frame_height); } @@ -6298,6 +6303,10 @@ fn apply_cdef( cdef: &CdefParams, skip_grid: &Neighbours, ) { + // lane-part32 r2 debug rung, env-gated: see `apply_deblock`'s sibling. + if std::env::var_os("EC_AV1_DEBUG_SKIP_CDEF").is_some() { + return; + } // `cdef.bits == 0` still means "no filtering at all" whenever the single // (index 0) strength pair is all-zero -- the fast path every existing // gate stream takes. A `bits > 0` frame can still be all-zero-strength diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 9f05fa43..94e56e1c 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -9512,6 +9512,59 @@ mod tests { ); } + /// lane-part32 r2: prints the exact mismatch geometry (block coords, + /// got/want pixels) of the pinned seed-42 stream captured off + /// `a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact` + /// via `EC_AV1_GATE_DUMP`. Debug-only, `#[ignore]`d. + #[test] + #[ignore = "debug harness, run manually with EC_AV1_GATE_DUMP_PIN"] + fn debug_part32_r2_sbpart_pin_mismatch_geometry() { + let path = std::env::var("EC_AV1_GATE_DUMP_PIN").expect("set EC_AV1_GATE_DUMP_PIN"); + let stream = std::fs::read(&path).expect("read pinned stream"); + let frames = decode_stream(&stream).expect("pinned stream must decode"); + if let Ok(dump) = std::env::var("EC_DEBUG_DUMP_Y") { + let bytes: Vec = frames[0].y.iter().map(|&v| v as u8).collect(); + std::fs::write(&dump, bytes).expect("write y dump"); + } + let ffmpeg_frames = ffmpeg_decode_sequence(&stream, 192, 128, 1); + let got = &frames[0]; + let want = &ffmpeg_frames[0]; + let width = 192usize; + let mut n = 0; + let (mut min_x, mut max_x, mut min_y, mut max_y) = (width, 0, 128, 0); + for y in 0..128usize { + for x in 0..width { + let idx = y * width + x; + if got.y[idx] != want.y[idx] { + n += 1; + min_x = min_x.min(x); + max_x = max_x.max(x); + min_y = min_y.min(y); + max_y = max_y.max(y); + } + } + } + eprintln!( + "total luma mismatches: {n} bbox x=[{min_x},{max_x}] y=[{min_y},{max_y}] frame=192x128" + ); + for y in 0..128usize { + let mut row_first = None; + let mut row_count = 0; + for x in 0..width { + let idx = y * width + x; + if got.y[idx] != want.y[idx] { + if row_first.is_none() { + row_first = Some(x); + } + row_count += 1; + } + } + if let Some(fx) = row_first { + eprintln!("row {y}: first mismatch x={fx} count={row_count}"); + } + } + } + /// lane-rect64q r1: same recipe as /// [`a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact`] /// minus `--deltaq-mode=0` -- real aomenc's non-realtime default is