From b89dee040364ace8245196833c4cd743ab9090c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 17 Sep 2026 05:32:25 +0300 Subject: [PATCH] docs(av1): intrabc_hits counts DV READS (a refused rect-strip block bumps it but is never reconstructed); depth-parameterised recipe helper counts at both depths in the gate-coverage derivation --- crates/ec-av1/src/decode.rs | 5 ++++- crates/ec-av1/src/gate_coverage.rs | 19 +++++++++++++++---- crates/ec-av1/src/stream.rs | 10 ++++++---- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 023dbbbe..8ba409de 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -3583,7 +3583,10 @@ thread_local! { /// [`decode_block`] off the call stack (same idiom as [`PALETTE_PRED`], /// which the alternative -- a tenth tuple member through every caller -- /// already avoids). Always `.take()`n by the block that reads it. - /// How many blocks decoded `use_intrabc == 1` -- the gate's hit counter. + /// How many blocks read `use_intrabc == 1` and took the DV path -- the + /// gate's hit counter. Bumped on the READ, before the rect-strip refusal + /// returns too, so it counts reads, not reconstructions (a refused block + /// is never reconstructed). static INTRABC_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; } // The `tx_type` the last plane-0 [`read_plane`] actually coded, kept so diff --git a/crates/ec-av1/src/gate_coverage.rs b/crates/ec-av1/src/gate_coverage.rs index 21878052..087cfb69 100644 --- a/crates/ec-av1/src/gate_coverage.rs +++ b/crates/ec-av1/src/gate_coverage.rs @@ -50,9 +50,12 @@ const NEVER_EXERCISED: &[(&str, &str)] = &[ // spells `--enable-intrabc=1` and decodes three such 8-bit streams whole- // frame pixel-exact against ffmpeg, with the block counter asserted > 0. // Re-verified 2026-09-17 (lane-av1-intrabc) at main f715d70c: 185 rect - // `use_intrabc` symbols read, 5 intrabc blocks decoded, 7 frames - // compared pixel-exact, 1 named refusal (rect-strip intrabc), 0 - // mismatches -- the counts the assert above stands on. + // `use_intrabc` symbols read, and 5 blocks took the DV path -- 4 of them + // DECODED whole-frame pixel-exact across 4 arms (7 frames compared, 0 + // mismatches). The fifth is the testsrc2 rectangle-strip arm, which reads + // the symbol and then refuses by name (the `intrabc_hits` bump happens on + // the READ), so "5 blocks decoded" would overcount: 4 decoded + 1 refused, + // exactly the single `refused == 1` the gate asserts. ]; /// The `--enable-*` tools this decoder cares about, whether or not any gate @@ -417,8 +420,16 @@ mod tests { /// that loops `for depth in [8usize, 10]` builds BOTH streams from one /// recipe, but its `yuv420p10le` arm made `is_ten_bit` classify it as /// 10-bit only, hiding `--enable-cfl-intra=1` from the 8-bit list. + /// lane-av1-intrabc r1: the shared recipe helper + /// `screen_intrabc_stream_at_depth` is parameterised on `depth` and sits in + /// the segment that opens at the PRECEDING gate's `#[test]`, so without + /// this marker that gate's own 8-bit-only flags read as 10-bit-only -- the + /// lane-defon/reelckf blind spot with `depth` spelled instead of + /// `bit_depth`. Three gates share the helper, at both depths. fn covers_both_depths(body: &str) -> bool { - body.contains("if bit_depth == 10") || body.contains("for depth in [8usize, 10]") + body.contains("if bit_depth == 10") + || body.contains("if depth == 10") + || body.contains("for depth in [8usize, 10]") } /// Whether a gate body drives a stream at this depth. diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index a93dc8b8..da227e8a 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -177,10 +177,12 @@ pub fn leaf8_intrabc_hits() -> usize { crate::decode::leaf8_intrabc_hits() } -/// Blocks reconstructed with intra block copy at ANY shape: every block whose -/// `use_intrabc` symbol came out 1 and was predicted from the current frame. -/// The engagement counter the intrabc gates assert on; [`leaf8_intrabc_hits`] -/// is its 8x8-leaf subset. +/// Blocks whose `use_intrabc` symbol came out 1 and took the DV path, at ANY +/// shape -- the engagement counter the intrabc gates assert on. It counts +/// "read a `use_intrabc` DV", not "reconstructed": a block the rect-strip +/// reader REFUSES for an unported shape bumps it too (the symbol and the DV +/// are parsed before the refusal). [`leaf8_intrabc_hits`] is its 8x8-leaf +/// subset. pub fn intrabc_hits() -> usize { crate::decode::intrabc_hits() }