From 088a162e0d6022e4ccc9fb7193a9785e28016881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 6 Sep 2026 16:50:58 +0300 Subject: [PATCH] fix(av1): clamp the pricer's committed context to the frame's true extent Plane::commit_ctx published a straddling block's nz/DC state over the cells past the true frame edge; the writer's own Neighbours::record_mi_planes clamps to blocks_wide/blocks_high (spec av1_set_entropy_contexts, off the true mi_cols/mi_rows, with libaom's round-up-even for a subsampled plane) and leaves those cells uncoded, so the price read a neighbour the writer never records. --- crates/ec-av1/src/stream.rs | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index db66f549..4cc6869d 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -3033,35 +3033,6 @@ pub(crate) mod tests { let decoded = decode_stream(&encoded.stream).unwrap(); assert_eq!(decoded.len(), encoded.frames.len()); for (i, (got, frame)) in decoded.iter().zip(&encoded.frames).enumerate() { - for (name, a, b) in [ - ("y", &got.y, &frame.reconstruction.y), - ("u", &got.u, &frame.reconstruction.u), - ("v", &got.v, &frame.reconstruction.v), - ] { - let w = if name == "y" { width } else { width.div_ceil(2) }; - if let Some(k) = a.iter().zip(b.iter()).position(|(p, q)| p != q) { - eprintln!( - "DBG {width}x{height} frame {i} {name}: {} of {} differ, first at row {} col {} stride {w} ({}, {}), rows {:?} cols {:?}", - a.iter().zip(b.iter()).filter(|(p, q)| p != q).count(), - a.len(), - k / w, - k % w, - a[k], - b[k], - { - let mut v: Vec = a.iter().zip(b.iter()).enumerate().filter(|(_, (p, q))| p != q).map(|(j, _)| j / w).collect(); - v.dedup(); - v - }, - { - let mut v: Vec = a.iter().zip(b.iter()).enumerate().filter(|(_, (p, q))| p != q).map(|(j, _)| j % w).collect(); - v.sort_unstable(); - v.dedup(); - v - } - ); - } - } assert_eq!( got.y, frame.reconstruction.y, "{width}x{height} frame {i} luma"