Commit e7d1ff6627 for ffmpeg
commit e7d1ff6627f0fbe830fe7d38ae2ac56030481f48
Author: Frank Plowman <post@frankplowman.com>
Date: Sat Sep 5 14:45:00 2026 +0100
lavc/vvc: Re-clip MVs after adding MMVD MVD
Per Eqs. (484) and (485) in H.266(V3), merge MVs need to be clipped if
MMVD is used.
Signed-off-by: Frank Plowman <post@frankplowman.com>
diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c
index a69fc460c7..a5952fc231 100644
--- a/libavcodec/vvc/ctu.c
+++ b/libavcodec/vvc/ctu.c
@@ -1315,10 +1315,13 @@ static void derive_mmvd(const VVCLocalContext *lc, MvField *mvf, const Mv *mmvd_
mvf->mv[0].y += mmvd[0].y;
mvf->mv[1].x += mmvd[1].x;
mvf->mv[1].y += mmvd[1].y;
+ ff_vvc_clip_mv(&mvf->mv[0]);
+ ff_vvc_clip_mv(&mvf->mv[1]);
} else {
const int idx = mvf->pred_flag - PF_L0;
mvf->mv[idx].x += mmvd_offset->x;
mvf->mv[idx].y += mmvd_offset->y;
+ ff_vvc_clip_mv(&mvf->mv[idx]);
}
}