From a77a341ee251bd9f90f41f04a1fd131dc3732c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Tue, 8 Sep 2026 12:23:34 +0300 Subject: [PATCH] wip(av1): svt1 lane snapshot at the turn cap (orchestrator) --- crates/ec-av1/examples/decode_probe.rs | 4 +++ crates/ec-av1/src/decode.rs | 37 +++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/crates/ec-av1/examples/decode_probe.rs b/crates/ec-av1/examples/decode_probe.rs index 92b9d394..95b81ba7 100644 --- a/crates/ec-av1/examples/decode_probe.rs +++ b/crates/ec-av1/examples/decode_probe.rs @@ -50,6 +50,10 @@ fn main() { let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters(); println!("rect_inter: tu={rtu} txsplit={rsplit} obmc_leaf={robmc}"); println!("sub8_inter_split: groups={}", ec_av1::decode::sub8_inter_split_hits()); + println!( + "skip_split_tx_override: {}", + ec_av1::decode::skip_split_tx_override_hits() + ); println!("interintra_rect: {}", ec_av1::decode::interintra_rect_hits()); println!("gm_nontrans_small_side: {}", ec_av1::decode::gm_nontrans_small_side_hits()); println!("tr_reach_longer_side: {}", ec_av1::decode::tr_reach_longer_side_hits()); diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 1fe71148..0aca3a45 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -2119,6 +2119,24 @@ pub fn skip_split_tx_hits() -> usize { SKIP_SPLIT_TX_HITS.with(|c| c.get()) } +// lane-svt1: SKIPPED square blocks carrying a palette/intrabc prediction whose +// `tx_depth` split the luma transform -- the arm that predicted DC off the +// block edges before the fix. Like [`SKIP_SPLIT_TX_HITS`] only the pixels +// witness this path, so a gate that wants it needs the counter. +thread_local! { + static SKIP_SPLIT_TX_OVERRIDE_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + +/// Current value of [`SKIP_SPLIT_TX_OVERRIDE_HITS`] (blocks). +pub fn skip_split_tx_override_hits() -> usize { + SKIP_SPLIT_TX_OVERRIDE_HITS.with(|c| c.get()) +} + +/// Zeroes [`SKIP_SPLIT_TX_OVERRIDE_HITS`] before a gate's own decode attempt. +pub fn reset_skip_split_tx_override_hits() { + SKIP_SPLIT_TX_OVERRIDE_HITS.with(|c| c.set(0)); +} + /// Zeroes [`SKIP_SPLIT_TX_HITS`] before a gate's own decode attempt. pub fn reset_skip_split_tx_hits() { SKIP_SPLIT_TX_HITS.with(|c| c.set(0)); @@ -14209,9 +14227,21 @@ fn decode_block( // `logical_tx`-sized window of that same map, set fresh inside the TU loop // below (lane-palette2 r7) -- setting the full-block buffer here would be // taken by the FIRST unit and indexed at the wrong stride. + // lane-svt1: a SKIPPED block predicts the whole `side`x`side` in ONE call + // (the `else` arm below -- a palette/intrabc block never takes the per-unit + // `split_tx_skip` walk), so its map must be armed here even when the + // transform is split. Gating the arm on `logical_tx == side` alone left a + // 16x16 palette block with `tx_depth == 1` and `skip == 1` predicting DC + // off its own edges: right symbols, wrong pixels (SVT-AV1 preset-8 screen + // key frame; class override-slot-on-one-arm). Neither prediction is + // edge-derived, so the whole-block buffer at the block's own stride is + // exactly what that single call wants. if let Some(buf) = &palette_y_buf - && logical_tx == side + && (logical_tx == side) { + if skip && logical_tx < side { + hit!(SKIP_SPLIT_TX_OVERRIDE_HITS); + } set_palette_pred(buf.clone(), fctx); } // A UV-palette block's own chroma prediction override (lane-palette2 r1), @@ -21230,6 +21260,7 @@ fn pipe_filters_ok(fctx: &crate::decode::FrameCtx, tile_cols: u32, lf_present: b || crate::envflags::is_set("EC_AV1_POSTCDEF_DUMP16") || crate::envflags::is_set("EC_AV1_DEBUG_SKIP_DEBLOCK") || crate::envflags::is_set("EC_AV1_DEBUG_SKIP_CDEF") + || crate::envflags::is_set("EC_AV1_DEBUG_SKIP_LR") || crate::envflags::is_set("EC_AV1_DEBUG_CDEF_BAND") || crate::envflags::is_set("EC_AV1_DEBLOCK_TRACE") || crate::envflags::is_set("EC_AV1_DEBLOCK_TRACE_V")) @@ -21494,6 +21525,10 @@ fn apply_loop_restoration( // (class av1-truesize-lane: true frame size vs mi-rounded). (frame_w, frame_h): (usize, usize), fctx: &crate::decode::FrameCtx, ) { + // lane-svt1 debug rung, env-gated: see `apply_cdef`/`apply_deblock`'s siblings. + if crate::envflags::env_flag!("EC_AV1_DEBUG_SKIP_LR") { + return; + } let mut out = scratch_empty(); crate::restoration::apply_loop_restoration_plane( &y.data,