wip(part32): pin decode_block_rect64's block2 defect to a scan-table mismatch
Browse files at this commitf9547e32fc67bae11fec4536edad2b97bd844ad5Parent: c3dde3f2 changed files +62 -0
crates/ec-av1/src/decode.rsmodified+9 -0
| @@ -5681,6 +5681,11 @@ fn apply_deblock( | ||
| 5681 | 5681 | frame_width: usize, |
| 5682 | 5682 | frame_height: usize, |
| 5683 | 5683 | ) { |
| 5684 | + // lane-part32 r2 debug rung, env-gated: bisecting a widespread pixel | |
| 5685 | + // mismatch between the raw reconstruction and post-filter output. | |
| 5686 | + if std::env::var_os("EC_AV1_DEBUG_SKIP_DEBLOCK").is_some() { | |
| 5687 | + return; | |
| 5688 | + } | |
| 5684 | 5689 | if lf.level[0] != 0 || lf.level[1] != 0 { |
| 5685 | 5690 | deblock_plane(y, 0, lf, n, frame_width, frame_height); |
| 5686 | 5691 | } |
| @@ -6298,6 +6303,10 @@ fn apply_cdef( | ||
| 6298 | 6303 | cdef: &CdefParams, |
| 6299 | 6304 | skip_grid: &Neighbours, |
| 6300 | 6305 | ) { |
| 6306 | + // lane-part32 r2 debug rung, env-gated: see `apply_deblock`'s sibling. | |
| 6307 | + if std::env::var_os("EC_AV1_DEBUG_SKIP_CDEF").is_some() { | |
| 6308 | + return; | |
| 6309 | + } | |
| 6301 | 6310 | // `cdef.bits == 0` still means "no filtering at all" whenever the single |
| 6302 | 6311 | // (index 0) strength pair is all-zero -- the fast path every existing |
| 6303 | 6312 | // gate stream takes. A `bits > 0` frame can still be all-zero-strength |
crates/ec-av1/src/stream.rsmodified+53 -0
| @@ -9512,6 +9512,59 @@ mod tests { | ||
| 9512 | 9512 | ); |
| 9513 | 9513 | } |
| 9514 | 9514 | |
| 9515 | + /// lane-part32 r2: prints the exact mismatch geometry (block coords, | |
| 9516 | + /// got/want pixels) of the pinned seed-42 stream captured off | |
| 9517 | + /// `a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact` | |
| 9518 | + /// via `EC_AV1_GATE_DUMP`. Debug-only, `#[ignore]`d. | |
| 9519 | + #[test] | |
| 9520 | + #[ignore = "debug harness, run manually with EC_AV1_GATE_DUMP_PIN"] | |
| 9521 | + fn debug_part32_r2_sbpart_pin_mismatch_geometry() { | |
| 9522 | + let path = std::env::var("EC_AV1_GATE_DUMP_PIN").expect("set EC_AV1_GATE_DUMP_PIN"); | |
| 9523 | + let stream = std::fs::read(&path).expect("read pinned stream"); | |
| 9524 | + let frames = decode_stream(&stream).expect("pinned stream must decode"); | |
| 9525 | + if let Ok(dump) = std::env::var("EC_DEBUG_DUMP_Y") { | |
| 9526 | + let bytes: Vec<u8> = frames[0].y.iter().map(|&v| v as u8).collect(); | |
| 9527 | + std::fs::write(&dump, bytes).expect("write y dump"); | |
| 9528 | + } | |
| 9529 | + let ffmpeg_frames = ffmpeg_decode_sequence(&stream, 192, 128, 1); | |
| 9530 | + let got = &frames[0]; | |
| 9531 | + let want = &ffmpeg_frames[0]; | |
| 9532 | + let width = 192usize; | |
| 9533 | + let mut n = 0; | |
| 9534 | + let (mut min_x, mut max_x, mut min_y, mut max_y) = (width, 0, 128, 0); | |
| 9535 | + for y in 0..128usize { | |
| 9536 | + for x in 0..width { | |
| 9537 | + let idx = y * width + x; | |
| 9538 | + if got.y[idx] != want.y[idx] { | |
| 9539 | + n += 1; | |
| 9540 | + min_x = min_x.min(x); | |
| 9541 | + max_x = max_x.max(x); | |
| 9542 | + min_y = min_y.min(y); | |
| 9543 | + max_y = max_y.max(y); | |
| 9544 | + } | |
| 9545 | + } | |
| 9546 | + } | |
| 9547 | + eprintln!( | |
| 9548 | + "total luma mismatches: {n} bbox x=[{min_x},{max_x}] y=[{min_y},{max_y}] frame=192x128" | |
| 9549 | + ); | |
| 9550 | + for y in 0..128usize { | |
| 9551 | + let mut row_first = None; | |
| 9552 | + let mut row_count = 0; | |
| 9553 | + for x in 0..width { | |
| 9554 | + let idx = y * width + x; | |
| 9555 | + if got.y[idx] != want.y[idx] { | |
| 9556 | + if row_first.is_none() { | |
| 9557 | + row_first = Some(x); | |
| 9558 | + } | |
| 9559 | + row_count += 1; | |
| 9560 | + } | |
| 9561 | + } | |
| 9562 | + if let Some(fx) = row_first { | |
| 9563 | + eprintln!("row {y}: first mismatch x={fx} count={row_count}"); | |
| 9564 | + } | |
| 9565 | + } | |
| 9566 | + } | |
| 9567 | + | |
| 9515 | 9568 | /// lane-rect64q r1: same recipe as |
| 9516 | 9569 | /// [`a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact`] |
| 9517 | 9570 | /// minus `--deltaq-mode=0` -- real aomenc's non-realtime default is |