From 6f661bc726ad78caa279b066adb57c5cb08b5050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 23 Sep 2026 07:48:05 +0300 Subject: [PATCH] ec-av1: 4:4:4 loop filter byte-exact (filters-on witness) deblock_plane_span clipped the chroma filter to frame_width/2 x frame_height/2 (a hardcoded 4:2:0 halving), so at 4:4:4 no chroma edge in the right/bottom three quarters of the plane was ever filtered. The crop now follows the sequence subsampling; identical at 4:2:0. libaom's own chroma filter rules needed no change: filter length (dim==0 ? 4 : 6), mi mapping (scale | coord<>2), and the uv-transform lookup (av1_get_max_uv_txsize) all already match (set_lpf_parameters, av1_loopfilter.c:221). Witnesses (aomenc, aomdec+ffmpeg cross-checked, 128x128 2 frames): - 444 filters on (loop filter + CDEF + restoration): IDENTICAL - 444 filters on, forced 64x64 blocks: IDENTICAL - 420 filters on: IDENTICAL (regression) - loop filter alone off, CDEF+LR on: IDENTICAL (isolates the fix) --- crates/ec-av1/src/decode.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index bc5e527d..0575affd 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -20825,8 +20825,14 @@ fn deblock_plane_span( // filter level there). r7's superres measurement is preserved: its frame // was already 8-aligned, so this bound equals `frame_width` there and // still excludes the superblock padding up to `true_width`. + // lane-av1-444: the chroma crop follows the sequence subsampling, not a + // hardcoded 4:2:0 halving -- at 4:4:4 the halved bound clipped the whole + // filter to the top-left quarter of each chroma plane. let (cw, ch) = if chroma { - (frame_width.div_ceil(2), frame_height.div_ceil(2)) + ( + frame_width.div_ceil(1 << ss_x(fctx)), + frame_height.div_ceil(1 << ss_y(fctx)), + ) } else { (frame_width, frame_height) };