forge
Explore
Log in

Don't you dare go Hollow

Clamp the pricer's committed context to the frame's true extent

Browse files at this commit

088a162e0d6022e4ccc9fb7193a9785e28016881Ahmet Kaan GümüşParent: b71a850
  • fix
    • clamp the pricer's committed context to the frame's true extent
Show full message
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.rsmodified+0 -29
@@ -3033,35 +3033,6 @@ pub(crate) mod tests {
3033 let decoded = decode_stream(&encoded.stream).unwrap();3033 let decoded = decode_stream(&encoded.stream).unwrap();
3034 assert_eq!(decoded.len(), encoded.frames.len());3034 assert_eq!(decoded.len(), encoded.frames.len());
3035 for (i, (got, frame)) in decoded.iter().zip(&encoded.frames).enumerate() {3035 for (i, (got, frame)) in decoded.iter().zip(&encoded.frames).enumerate() {
3036- for (name, a, b) in [
3037- ("y", &got.y, &frame.reconstruction.y),
3038- ("u", &got.u, &frame.reconstruction.u),
3039- ("v", &got.v, &frame.reconstruction.v),
3040- ] {
3041- let w = if name == "y" { width } else { width.div_ceil(2) };
3042- if let Some(k) = a.iter().zip(b.iter()).position(|(p, q)| p != q) {
3043- eprintln!(
3044- "DBG {width}x{height} frame {i} {name}: {} of {} differ, first at row {} col {} stride {w} ({}, {}), rows {:?} cols {:?}",
3045- a.iter().zip(b.iter()).filter(|(p, q)| p != q).count(),
3046- a.len(),
3047- k / w,
3048- k % w,
3049- a[k],
3050- b[k],
3051- {
3052- let mut v: Vec<usize> = a.iter().zip(b.iter()).enumerate().filter(|(_, (p, q))| p != q).map(|(j, _)| j / w).collect();
3053- v.dedup();
3054- v
3055- },
3056- {
3057- let mut v: Vec<usize> = a.iter().zip(b.iter()).enumerate().filter(|(_, (p, q))| p != q).map(|(j, _)| j % w).collect();
3058- v.sort_unstable();
3059- v.dedup();
3060- v
3061- }
3062- );
3063- }
3064- }
3065 assert_eq!(3036 assert_eq!(
3066 got.y, frame.reconstruction.y,3037 got.y, frame.reconstruction.y,
3067 "{width}x{height} frame {i} luma"3038 "{width}x{height} frame {i} luma"