From 315f5f2c944e8262290ad8e2f2dcaec248cd107d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Sep 2026 18:22:56 +0300 Subject: [PATCH] fix(av1): compound 8x8 leaf published transform width 8 to the deblock grid even when its var-tx split it into 4x4 units `decode_inter_block8`'s COMPOUND early return called `fill_lf_grid(leaf_mi, 2, 8, ..)` with a literal 8 where the fall-through single-ref tail writes `if split8 { 4 } else { 8 }`. libaom `get_transform_size` (av1_loopfilter.c:207) reads the per-TU `inter_tx_size` for a non-skip inter luma block, so the leaf's interior vertical/horizontal edges at x % 8 == 4 are real filter edges. Ours skipped them and widened the neighbouring edge's filter from 4-tap to 8-tap. Class early-return-skips-tail, third instance in this same arm. Witness (8-bit 128x128 6-frame inter stream, cq 63): entropy and the pre-filter picture were already exact on every frame; the POSTDEBLOCK dump vs the instrumented aomdec's diverged on decode frame 2 at luma (78..80, 58..63), 12 px, max delta 3, around the unfiltered x=60 edge of the 8x8 at mi(20,14) -- our `EC_AV1_DEBLOCK_TRACE_V` printed no VEDGE at x0=60 there while the block's four TX_4X4 units demand one. A 12-stream sub-8x8-intra probe sweep (8/10-bit x cq 48/55/63 x 128x128/192x128) goes 10/12 -> 12/12 pixel-EXACT vs ffmpeg. --- crates/ec-av1/src/decode.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 730ca9ba..30bb7078 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -5010,6 +5010,9 @@ impl Neighbours { tx_h_px: u8, ) { let (mi_r, mi_c) = at_mi; + if std::env::var_os("EC_TXGRID_TRACE").is_some() { + eprintln!("EC_LFLEAF mi_row={mi_r} mi_col={mi_c} w_mi={w_mi} h_mi={h_mi} tx_px={tx_px} tx_h_px={tx_h_px}"); + } for rr in 0..h_mi { for cc in 0..w_mi { let idx = (mi_r + rr) * self.skip_grid_cols_mi + (mi_c + cc); @@ -24980,10 +24983,18 @@ fn decode_inter_block8( // dlist excludes it (3 luma samples on a 192x128 inter frame). INTER8_SKIP_BAND_HITS.with(|c| c.set(c.get() + 1)); neighbours.fill_skip_grid(leaf_mi, 2, skip); + // lane-sub8x4 r2: `split8` is this leaf's OWN var-tx split, so + // the deblock grid must publish the TX_4X4 leaves' width the + // same way the fall-through arm below does (libaom + // `get_transform_size`, av1_loopfilter.c:207, reads the per-TU + // `inter_tx_size` for a non-skip inter luma block). Hardcoding + // 8 here left a compound var-tx 8x8 leaf's interior vertical + // edge at x % 8 == 4 unfiltered -- class early-return-skips-tail, + // third instance in this same arm. neighbours.fill_lf_grid( leaf_mi, 2, - 8, + if split8 { 4 } else { 8 }, if is_inter { leaf_refs.0.max(LAST_FRAME) } else { 0 }, ); return Ok((