From 4353787102b92f59995dd95799f13bf64a74082a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 27 Aug 2026 06:22:39 +0300 Subject: [PATCH] fix(av1): 16x16 partition ctx reads stale coarse side after a leaf8 sibling partition_ctx (SUB-grid) only advances above_side/left_side in whole-16px steps, so write_leaf8's record_mi (mi-precise only) never updated them: the next 16x16-level split query after a leaf8 quadrant read a stale side value instead of 8. Delegate partition_ctx through partition_ctx_mi (same pattern as around/around_mi), which record already keeps in sync at mi granularity for every block. Confirmed against a debug aomdec EC_RNG/EC_TRACE2 trace: the 16x16-level ctx at mi(4,8) now matches libaom's (row 1 both sides, after subtracting aomdec's shared-cdf bsl*4 offset). Full ec-av1 gate green, no regressions. Not sufficient on its own: the 40x32 straddle test still desyncs, now traced to the BLOCK_8X8 leaf's own partition-symbol context/table, not the TX_TYPE/EOB_PT pair r8 flagged -- see ledger for handoff. --- crates/ec-av1/src/tile.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/ec-av1/src/tile.rs b/crates/ec-av1/src/tile.rs index e2b07c88..9c821fd5 100644 --- a/crates/ec-av1/src/tile.rs +++ b/crates/ec-av1/src/tile.rs @@ -804,8 +804,14 @@ impl Neighbours { } fn partition_ctx(&self, at: (usize, usize), side: usize) -> usize { + // Delegates to the mi-precise reader (same pattern as `around` / + // `around_mi`): `above_side`/`left_side` are only ever advanced in + // whole-[`SUB`] steps by [`Self::record`], so a leaf8's `record_mi` + // (lane-av1-rect) -- which only touches the finer mi arrays -- leaves + // them stale for the *next* sibling's own partition symbol, reading a + // 16x16-slot side that already split into 8x8s underneath it. let (r, c) = at; - 2 * usize::from(self.left_side[r] * 2 <= side) + usize::from(self.above_side[c] * 2 <= side) + self.partition_ctx_mi((r * (SUB / MI), c * (SUB / MI)), side) } /// [`Self::partition_ctx`] at mi granularity, for an 8x8 leaf of a