forge
Explore
Log in

Don't you dare go Hollow

diag(av1): sbpart r5 -- confirm entropy desync between the two rect64 VERT/HORZ calls

Browse files at this commit

cc3d46c36c52f146d041f6d13451c6bfdcb24cbbAhmet Kaan GümüşParent: d3ce9a2
Pinned-stream diagnostics only: TRACE_RECT32_END trace print, and an
EC_SBPART_DIAG bbox/per-SB-column breakdown on the pinned replay test.
No behavior change to the live gate. See lanes/sbpart-r5.report.md for
the finding.
crates/ec-av1/src/decode.rsmodified+3 -0
@@ -2580,6 +2580,9 @@ fn decode_block_rect(
2580 neighbours.fill_skip_grid_rect((mi_r, mi_c), bw / MI, bh / MI, skip);2580 neighbours.fill_skip_grid_rect((mi_r, mi_c), bw / MI, bh / MI, skip);
2581 neighbours.fill_lf_grid_rect((mi_r, mi_c), bw / MI, bh / MI, tx_w as u8, tx_h as u8, 0);2581 neighbours.fill_lf_grid_rect((mi_r, mi_c), bw / MI, bh / MI, tx_w as u8, tx_h as u8, 0);
2582 RECT_PARTITION_HITS.with(|c| c.set(c.get() + 1));2582 RECT_PARTITION_HITS.with(|c| c.set(c.get() + 1));
2583+ if std::env::var_os("EC_AV1_TRACE").is_some() {
2584+ eprintln!("TRACE_RECT32_END mi_row={mi_r} mi_col={mi_c} bw={bw} bh={bh}");
2585+ }
2583 Ok(())2586 Ok(())
2584 }2587 }
2585 2588
crates/ec-av1/src/stream.rsmodified+45 -0
@@ -6547,7 +6547,52 @@ mod tests {
6547 }6547 }
6548 let frames = decode_stream(&stream).expect("pinned stream must decode");6548 let frames = decode_stream(&stream).expect("pinned stream must decode");
6549 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, 192, 128, 1);6549 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, 192, 128, 1);
6550+ let (width, height) = (192usize, 128usize);
6550 for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {6551 for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
6552+ if std::env::var_os("EC_SBPART_DIAG").is_some() {
6553+ let (mut min_r, mut max_r, mut min_c, mut max_c, mut n) =
6554+ (usize::MAX, 0usize, usize::MAX, 0usize, 0usize);
6555+ for r in 0..height {
6556+ for c in 0..width {
6557+ let idx = r * width + c;
6558+ if got.y[idx] != want.y[idx] {
6559+ min_r = min_r.min(r);
6560+ max_r = max_r.max(r);
6561+ min_c = min_c.min(c);
6562+ max_c = max_c.max(c);
6563+ n += 1;
6564+ }
6565+ }
6566+ }
6567+ eprintln!(
6568+ "DIAG frame {i}: {n} luma mismatches, bbox rows [{min_r}..{max_r}] cols \
6569+ [{min_c}..{max_c}] of {width}x{height}"
6570+ );
6571+ // Per-64px-superblock-column mismatch counts, to see whether
6572+ // corruption starts exactly at the rect64 SB or bleeds into
6573+ // SBs decoded earlier (raster order).
6574+ for sb_col in 0..(width + 63) / 64 {
6575+ let c0 = sb_col * 64;
6576+ let c1 = (c0 + 64).min(width);
6577+ let mut cnt = 0usize;
6578+ let mut first = None;
6579+ for r in 0..height {
6580+ for c in c0..c1 {
6581+ let idx = r * width + c;
6582+ if got.y[idx] != want.y[idx] {
6583+ cnt += 1;
6584+ if first.is_none() {
6585+ first = Some((r, c));
6586+ }
6587+ }
6588+ }
6589+ }
6590+ eprintln!(
6591+ "DIAG frame {i} sb_col {sb_col} (cols {c0}..{c1}): {cnt} mismatches, \
6592+ first={first:?}"
6593+ );
6594+ }
6595+ }
6551 assert_eq!(got.y, want.y, "frame {i} luma vs ffmpeg (pinned sbpart)");6596 assert_eq!(got.y, want.y, "frame {i} luma vs ffmpeg (pinned sbpart)");
6552 assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (pinned sbpart)");6597 assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (pinned sbpart)");
6553 assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (pinned sbpart)");6598 assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (pinned sbpart)");