From 9278c9ae0d36384a60911f457f878d556775bb2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 25 Sep 2026 10:37:54 +0300 Subject: [PATCH] ec-av1: lane-av1-422l -- key the inter-strip chroma pairing on the strip's own subsampled axis strip_has_chroma: horz keeps i%2==1 || ss_y==0 (no chroma row parity once ss_y==0, every 16x4 strip its own reference, mirroring the intra strip arm); vert becomes i%2==1 || ss_x==0 so 4:4:4 keeps self-paired strips and 4:2:2 keeps the 4:2:0 column pairing with an existing left neighbour. pair_mi self-pairs whenever the pair axis is unsubsampled, and prev carries pair motion only when the strip actually pairs. 4:2:0 and 4:4:4 are branch-identical to the previous code; 4:2:2 no longer underflows at_mi.0/at_mi.1 on strip 0. --- crates/ec-av1/src/decode.rs | 46 +++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 5107799b..23ab70b1 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -41519,22 +41519,50 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( // so there is no pair: each strip codes // and predicts its own chroma from its // own motion (`prev` = None). - let strip_has_chroma = - i % 2 == 1 || ss_y(fctx) == 0; - let pair_mi = if !strip_has_chroma || ss_x(fctx) == 0 { - at_mi - } else if horz { - (at_mi.0 - 1, at_mi.1) + // lane-av1-422l: a strip pairs along its + // OWN subsampled axis -- horz strips pair + // on rows (no pair once ss_y == 0: chroma + // has no row parity, every 16x4 strip is + // its own reference, exactly the intra + // strip arm's `else if ss_y(fctx) == 0`); + // vert strips pair on columns (ss_x == 0 + // => every strip self-pairs, 4:2:2 keeps + // the 4:2:0 column pairing -- a VERT_4 + // 4x16 strip's `ss_size_lookup` chroma + // at ss (1,0) is BLOCK_INVALID, so only + // the pair shape can ever be coded). + let strip_has_chroma = if horz { + i % 2 == 1 || ss_y(fctx) == 0 } else { - (at_mi.0, at_mi.1 - 1) + i % 2 == 1 || ss_x(fctx) == 0 }; + let pair_mi = + if !strip_has_chroma + || (if horz { + ss_y(fctx) == 0 + } else { + ss_x(fctx) == 0 + }) + { + at_mi + } else if horz { + (at_mi.0 - 1, at_mi.1) + } else { + (at_mi.0, at_mi.1 - 1) + }; fctx.inter_strip_chroma.with(|c| { c.set(Some(InterStripChroma { has_chroma: strip_has_chroma, horz, pair_mi, - prev: if strip_has_chroma && ss_x(fctx) == 1 { - fctx.inter_last_mc.with(std::cell::Cell::get) + prev: if strip_has_chroma + && (if horz { + ss_y(fctx) == 1 + } else { + ss_x(fctx) == 1 + }) { + fctx.inter_last_mc + .with(std::cell::Cell::get) } else { None },