[x265] [PATCH 1 of 2] improve MotionEstimate::subpelCompare by replace variant shift to constant

Min Chen chenm003 at 163.com
Tue Nov 3 07:01:38 CET 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1446499548 21600
# Node ID 86c940eb28b7765eb81a46264194e00e9aa1187d
# Parent  d75bdce03a742bbcfade49ab92cf1f45c563a8d3
improve MotionEstimate::subpelCompare by replace variant shift to constant
---
 source/encoder/motion.cpp |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff -r d75bdce03a74 -r 86c940eb28b7 source/encoder/motion.cpp
--- a/source/encoder/motion.cpp	Mon Nov 02 15:25:45 2015 -0600
+++ b/source/encoder/motion.cpp	Mon Nov 02 15:25:48 2015 -0600
@@ -1215,8 +1215,11 @@
         const pixel* refCb = ref->getCbAddr(ctuAddr, absPartIdx) + refOffset;
         const pixel* refCr = ref->getCrAddr(ctuAddr, absPartIdx) + refOffset;
 
-        xFrac = qmv.x & ((1 << shiftHor) - 1);
-        yFrac = qmv.y & ((1 << shiftVer) - 1);
+        X265_CHECK((hshift == 0) || (hshift == 1), "hshift must be 0 or 1\n");
+        X265_CHECK((vshift == 0) || (vshift == 1), "vshift must be 0 or 1\n");
+
+        xFrac = qmv.x & (hshift ? 7 : 3);
+        yFrac = qmv.y & (vshift ? 7 : 3);
 
         if (!(yFrac | xFrac))
         {



More information about the x265-devel mailing list