From a0468d239fbfa659641ce6085aa9b63977a5785d Mon Sep 17 00:00:00 2001 From: Akilan Sivakumar Date: Tue, 22 Sep 2026 10:57:01 +0530 Subject: [PATCH] Fix deltaX/deltaY offset formula for small rectangular PU shapes in SEA search --- source/encoder/motion.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/encoder/motion.cpp b/source/encoder/motion.cpp index a1ab3b5e2..40f554909 100644 --- a/source/encoder/motion.cpp +++ b/source/encoder/motion.cpp @@ -1498,11 +1498,13 @@ int MotionEstimate::motionEstimate(ReferencePlanes *ref, /* Successive elimination by comparing DC before a full SAD, * because sum(abs(diff)) >= abs(diff(sum)). */ + int sad4DeltaX = (horizontalRect && w <= 8) ? (w >> 1) : deltaX; + int sad4DeltaY = (verticalRect && h <= 8) ? (h >> 1) : deltaY; primitives.pu[tempPartEnum].sad_x4(zero, fenc, - fenc + deltaX, - fenc + deltaY * FENC_STRIDE, - fenc + deltaX + deltaY * FENC_STRIDE, + fenc + sad4DeltaX, + fenc + sad4DeltaY * FENC_STRIDE, + fenc + sad4DeltaX + sad4DeltaY * FENC_STRIDE, FENC_STRIDE, encDC);