forge
Explore
Log in

Don't you dare go Hollow

av1txctxband2: correct the band-overwrite counter's doc to what the predicate actually measures

Browse files at this commit

0b7aabe049dcf54366a424973dc11fde5ca7e1b5Ahmet Kaan GümüşParent: ec0357f
A refutation pass (lane av1txctxband2, reviewer) reproduced every load-bearing claim of the band fix --
the libaom either/or, the RECT twin, the named missing write at mi=(78,110), per-plane per-frame exatness
on both 640x480 cells under a proven-live comparator, the 457907-read ladder with a comparator shown to
bite, and the mutation (removing only the set_txfm_ctxs call reds the gate and returns the cell to the
reported Golomb refusal) -- and falsified ONE documentation claim, which is corrected here.

The counter's predicate is `!intra_only && any covered above-band cell != pub_above`, which counts a
FIRST WRITE into a tile column still at TXFM_CTX_INIT as well as a genuine replacement of an earlier
block's size. Measured on committed fixtures: 420_lossless_tallinter_8x16.obu fires 48 with every covered
column still at init (the old doc predicted 0 on exactly such a stream), 420_lossless_arf_1to4_320x240_5f.obu
fires 320 with 53 first touches, and 183 of the pin's 944 are first touches. The count remains a decision
that a reader can act on, so the gate keeps its teeth and no behaviour changes; only the doc's narrower
causal reading ("overwrote a size some earlier block left") was wrong and is now replaced with the measured
one plus the refutation's numbers.
crates/ec-av1/src/decode.rsmodified+34 -15
@@ -29941,14 +29941,23 @@ fn read_block_tx_size(
29941 429941 4
29942 };29942 };
29943 // The gate's non-vacuity arm, on the DECISION, sampled BEFORE the29943 // The gate's non-vacuity arm, on the DECISION, sampled BEFORE the
29944- // write: this publish OVERWRITES a size some earlier block of the same29944+ // write: this publish CHANGES at least one of the above-band cells it
29945- // frame had left in one of the columns it covers -- the only way a29945+ // covers -- the cell did not already hold `pub_above`, so a later
29946- // later `get_tx_size_context` / `txfm_partition_context` reader can29946+ // `get_tx_size_context` / `txfm_partition_context` reader in the same
29947- // see it. On a frame whose blocks all sit in lossless segments nothing29947+ // tile column reads a value the publish produced.
29948- // reads either band (libaom's `read_tx_size` returns before29948+ //
29949- // `get_tx_size_context`, and the var-tx tree is gated on29949+ // CORRECTED 2026-09-30 (refutation pass `lanes/refute-av1txctxband2`):
29950- // `!xd->lossless`), so a wholly-lossless stream whose inter blocks are29950+ // an earlier version of this comment, and of the static's doc, claimed
29951- // all non-skip leaves this at zero.29951+ // the write counts only when it OVERWRITES "a size some earlier block
29952+ // had left", and that a wholly-lossless all-non-skip stream leaves it
29953+ // at zero. MEASURED FALSE: 420_lossless_tallinter_8x16.obu fires 48,
29954+ // ALL with every covered column still at `TXFM_CTX_INIT` -- a first
29955+ // write into a fresh tile column counts here too, because the test is
29956+ // "the cell did not already hold this value", not "some block wrote a
29957+ // different value earlier". Of the pin's 944 fires, 183 are that
29958+ // first-touch case. The count is still a decision (no reader, no
29959+ // intra-only frame, no unchanged column), so the gate keeps its teeth;
29960+ // only the doc's stronger reading was wrong.
29952 let overwrote = !fctx.intra_only.with(std::cell::Cell::get)29961 let overwrote = !fctx.intra_only.with(std::cell::Cell::get)
29953 && (0..side_mi).any(|i| n.above_txfm.get(at_mi.1 + i) != Some(&pub_above));29962 && (0..side_mi).any(|i| n.above_txfm.get(at_mi.1 + i) != Some(&pub_above));
29954 set_txfm_ctxs(n, at_mi, 4, side_mi, side_mi, skip && is_inter);29963 set_txfm_ctxs(n, at_mi, 4, side_mi, side_mi, skip && is_inter);
@@ -34821,14 +34830,24 @@ thread_local! {
34821 /// doing.34830 /// doing.
34822 pub(crate) static SUB8_LOSSLESS_NO_VARTX: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };34831 pub(crate) static SUB8_LOSSLESS_NO_VARTX: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
34823 /// lane-av1txctxband2: SQUARE lossless blocks on an INTER frame whose34832 /// lane-av1txctxband2: SQUARE lossless blocks on an INTER frame whose
34824- /// `set_txfm_ctxs` publish CHANGED an above-band cell -- i.e. the write34833+ /// `set_txfm_ctxs` publish CHANGED at least one above-band cell it covers
34825- /// overwrote a size some earlier block of the same frame had left, which34834+ /// (the cell did not already hold the published size), so a later
34826- /// is the only way a later `get_tx_size_context` /34835+ /// `get_tx_size_context` / `txfm_partition_context` reader in the same
34827- /// `txfm_partition_context` reader can see it. Zero on an intra-only34836+ /// tile column reads a value this publish produced. Zero on an intra-only
34828 /// frame (where `fill_lf_grid_rect_inner` publishes the same 4x4 value at34837 /// frame (where `fill_lf_grid_rect_inner` publishes the same 4x4 value at
34829- /// the same footprint) and on a wholly-lossless stream whose inter blocks34838+ /// the same footprint).
34830- /// are all non-skip (nothing reads either band there), so a gate cannot34839+ ///
34831- /// look armed by merely decoding a lossless fixture.34840+ /// CORRECTED 2026-09-30 (refutation pass `lanes/refute-av1txctxband2`):
34841+ /// this doc previously claimed the hit meant "overwrote a size some
34842+ /// earlier block left" and that a wholly-lossless all-non-skip stream
34843+ /// leaves it at zero. MEASURED FALSE -- `420_lossless_tallinter_8x16.obu`
34844+ /// fires **48**, all of them first touches of a column still at
34845+ /// `TXFM_CTX_INIT`; `420_lossless_arf_1to4_320x240_5f.obu` fires 320, 53 of
34846+ /// them first touches. Of the pin's 944, **183 are first-touch**. The
34847+ /// predicate tests "the cell did not already hold this value", which is
34848+ /// the decision that matters (no reader, no intra-only frame, no unchanged
34849+ /// column still reads 0), but it is NOT the strictly narrower causal claim
34850+ /// the old text made.
34832 pub(crate) static LOSSLESS_SQ_TXFM_BAND_OVERWRITE_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };34851 pub(crate) static LOSSLESS_SQ_TXFM_BAND_OVERWRITE_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
34833 }34852 }
34834 34853