wip(av1): sbpart r4's in-flight rect64 trace edits, committed verbatim at the turn cap
Browse files at this commit1677429f5792d03d85ed0fd8b13f9ed10275ea74Parent: c67fd632 changed files +35 -0
crates/ec-av1/src/decode.rsmodified+4 -0
| @@ -2848,6 +2848,10 @@ fn decode_block_rect64( | |||
| 2848 | neighbours.fill_skip_grid_rect((mi_r, mi_c), bw / MI, bh / MI, skip); | 2848 | neighbours.fill_skip_grid_rect((mi_r, mi_c), bw / MI, bh / MI, skip); |
| 2849 | neighbours.fill_lf_grid_rect((mi_r, mi_c), bw / MI, bh / MI, tx_w as u8, tx_h as u8, 0); | 2849 | neighbours.fill_lf_grid_rect((mi_r, mi_c), bw / MI, bh / MI, tx_w as u8, tx_h as u8, 0); |
| 2850 | SB_RECT_HITS.with(|c| c.set(c.get() + 1)); | 2850 | SB_RECT_HITS.with(|c| c.set(c.get() + 1)); |
| 2851 | + if std::env::var_os("EC_AV1_TRACE").is_some() { | ||
| 2852 | + let (rng, _) = dec.debug_state(); | ||
| 2853 | + eprintln!("TRACE_RECT64_END mi_row={mi_r} mi_col={mi_c} bw={bw} bh={bh} rng={rng}"); | ||
| 2854 | + } | ||
| 2851 | Ok(()) | 2855 | Ok(()) |
| 2852 | } | 2856 | } |
| 2853 | 2857 | ||
crates/ec-av1/src/stream.rsmodified+31 -0
| @@ -6522,4 +6522,35 @@ mod tests { | |||
| 6522 | crate::decode::sb_rect_hits() | 6522 | crate::decode::sb_rect_hits() |
| 6523 | ); | 6523 | ); |
| 6524 | } | 6524 | } |
| 6525 | + | ||
| 6526 | + /// lane-sbpart r4: replays a pinned mismatch byte-for-byte off disk (no | ||
| 6527 | + /// aomenc/ffmpeg re-encode), same pattern as `pinned_golden3/4_stream_ | ||
| 6528 | + /// decodes_pixel_exact` -- fast red/green loop for the bisect, and lets | ||
| 6529 | + /// `EC_AV1_TRACE=1` be set for one run without re-driving the encoder. | ||
| 6530 | + #[test] | ||
| 6531 | + #[ignore = "reads a pinned fixture path outside the repo; run manually"] | ||
| 6532 | + fn pinned_sbpart_stream_decodes_pixel_exact() { | ||
| 6533 | + let path = std::env::var("EC_AV1_GATE_DUMP_PIN") | ||
| 6534 | + .map(std::path::PathBuf::from) | ||
| 6535 | + .unwrap_or_else(|_| pin_dir().join("sbpart-pin.obu")); | ||
| 6536 | + let Ok(stream) = std::fs::read(&path) else { | ||
| 6537 | + eprintln!( | ||
| 6538 | + "SKIP pinned_sbpart_stream_decodes_pixel_exact: no pinned bytes at {} \ | ||
| 6539 | + -- re-capture with EC_AV1_GATE_DUMP off the sbpart gate", | ||
| 6540 | + path.display() | ||
| 6541 | + ); | ||
| 6542 | + return; | ||
| 6543 | + }; | ||
| 6544 | + if !have_ffmpeg() { | ||
| 6545 | + eprintln!("SKIP pinned_sbpart_stream_decodes_pixel_exact: no ffmpeg"); | ||
| 6546 | + return; | ||
| 6547 | + } | ||
| 6548 | + let frames = decode_stream(&stream).expect("pinned stream must decode"); | ||
| 6549 | + let ffmpeg_frames = ffmpeg_decode_sequence(&stream, 192, 128, 1); | ||
| 6550 | + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { | ||
| 6551 | + 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)"); | ||
| 6553 | + assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (pinned sbpart)"); | ||
| 6554 | + } | ||
| 6555 | + } | ||
| 6525 | } | 6556 | } |