forge
Explore
Log in

Don't you dare go Hollow

Clamp every mvstack entry, not just the derived nearest/near pair

Browse files at this commit

569067b9ca4fbebf27b8f39e2a6d04e0262d7341Ahmet Kaan GümüşParent: 497de2d
  • fix
    • clamp every mvstack entry, not just the derived nearest/near pair
Show full message
fix(av1): clamp every mvstack entry, not just the derived nearest/near pair

libaom av1_find_mv_refs clamps each stack entry after the build; the NEWMV
predictor is the DRL-selected ENTRY, so a left neighbour coded past the
frame edge (col 520 in pinned warp-flake-5.obu) predicted unclamped where
libaom used 384 -- an mv drift with IDENTICAL entropy (same diff symbols,
range ladder exact at every partition read) surfacing as +-1 warp rounding
crumbs in a hidden altref, inherited by shown frames (V-plane assert).
Both builders (single + compound). All three warp pins green.

class: value-equal narrowing drift (neighbour-votes-all-its-fields family);
localization = part-read range ladder exact -> prediction-side, then
EC_MV pred diff vs patched aomdec.
crates/ec-av1/src/mvstack.rsmodified+14 -0
@@ -932,6 +932,14 @@ pub fn find_mv_stack_with_sign_bias(
932932 }
933933
934934 let clamp = |mv| clamp_mv_ref(mv, mi_row, mi_col, bw4, bh4, mi_cols, mi_rows);
935+ // libaom `av1_find_mv_refs` clamps EVERY stack entry once the stack is
936+ // built -- the NEWMV predictor is the DRL-selected entry itself, so a
937+ // raw out-of-range candidate (left neighbour coding past the frame
938+ // edge) must not survive here (pinned warp-flake-5.obu: pred col 520
939+ // vs libaom's clamped 384, a value-equal-entropy mv drift).
940+ for e in candidates.iter_mut() {
941+ e.mv = clamp(e.mv);
942+ }
935943 let nearest_mv = candidates.first().map_or((0, 0), |e| clamp(e.mv));
936944 let near_mv = candidates.get(1).map_or((0, 0), |e| clamp(e.mv));
937945 let pred_mv = if candidates.is_empty() {
@@ -1606,6 +1614,12 @@ pub fn find_mv_stack_compound(
16061614 }
16071615
16081616 let clamp = |mv| clamp_mv_ref(mv, mi_row, mi_col, bw4, bh4, mi_cols, mi_rows);
1617+ // Same as the single-ref builder: libaom clamps every stack entry, and
1618+ // DRL reads the entries directly.
1619+ for e in candidates.iter_mut() {
1620+ e.mv0 = clamp(e.mv0);
1621+ e.mv1 = clamp(e.mv1);
1622+ }
16091623 let nearest_mv = candidates
16101624 .first()
16111625 .map_or(((0, 0), (0, 0)), |e| (clamp(e.mv0), clamp(e.mv1)));