From 4438a11a3970915f5afcec2dd2fb25e99221aafa 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 21:12:02 +0300 Subject: [PATCH] fix(av1): both halves of a split intra block read the FIRST half's edge-filter neighbours `modes_above_left` keys its mi-exact lookup on the coarse 16x16 cell's own top-left mi, so the second 8x16 (or 16x8) half of a rect intra block in an inter frame asked for the neighbours of the first half. libaom reads `above_mbmi`/`left_mbmi` for the block itself, so the intra-edge filter type (`get_intra_edge_filter_type`, reconintra.c:974) came out 0 where libaom has 1, and every directional half whose real above/left neighbour was SMOOTH got its edge filtered at the wrong strength. Measured on a 2-frame 10-bit 1920x792 128-SB cut, decode-order frame 1 pre-loop-filter vs instrumented aomdec: luma 1269 differing pixels -> 0, whole-frame 1549 -> 258 bytes (chroma-only residue left). The witness block (8x16, p_angle 110, above neighbour SMOOTH_H) predicted sum 41742 where aomdec has 41767; recomputing the spec walk with filter type 1 reproduces aomdec exactly. `OUR_PRED` now prints `ft=` so the two decoders' filter type can be diffed directly (aomdec's `EC_PRED` already did). --- crates/ec-av1/src/decode.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index a82736cb..4d98d653 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -7665,7 +7665,14 @@ fn decode_intra_rect_in_inter( // The intra-edge filter type is the NEIGHBOUR's mode (libaom // `get_filt_type`), luma's off the luma neighbours and chroma's off the // chroma ones -- [`decode_block_rect`]'s own pair. - let (nb_above_mode, nb_left_mode) = neighbours.modes_above_left(r, c); + // lane-t900 r4: the coarse pair is keyed on the 16x16 cell's OWN top-left + // mi, so both 8x16 halves of a VERT split read the neighbours of the FIRST + // half. libaom's `above_mbmi`/`left_mbmi` are this block's own + // (`mi[-mi_stride]` / `mi[-1]`) -- take the mi-exact pair over the coarse + // one exactly as [`decode_leaf8`] already does (class + // context-read-from-one-cell). + let (nb_above_mode, nb_left_mode) = + neighbours.modes_above_left_mi(mi_r, mi_c, neighbours.modes_above_left(r, c)); let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode); if smooth_neighbor { SMOOTH_LUMA_HITS.with(|h| h.set(h.get() + 1)); @@ -10864,7 +10871,7 @@ impl PlaneBuf { let row0: Vec = prediction[..bw.min(8)].to_vec(); let col0: Vec = (0..bh.min(8)).map(|r| prediction[r * bw]).collect(); eprintln!( - "@{} OUR_PRED x={x} y={y} bw={bw} bh={bh} mode={mode} ad={angle_delta} sum={sum} row0={row0:?} col0={col0:?}", std::panic::Location::caller() + "@{} OUR_PRED x={x} y={y} bw={bw} bh={bh} mode={mode} ad={angle_delta} ft={} sum={sum} row0={row0:?} col0={col0:?}", std::panic::Location::caller(), i32::from(smooth_neighbor) ); } for row in 0..bh {