[x265] [PATCH] motion.cpp: optimize 'X265_DIA_SEARCH' by eliminating costly branch instructions

praveen at multicorewareinc.com praveen at multicorewareinc.com
Tue Mar 8 15:48:49 CET 2016


# HG changeset patch
# User Praveen Tiwari <praveen at multicorewareinc.com>
# Date 1457448163 -19800
#      Tue Mar 08 20:12:43 2016 +0530
# Node ID 519441d72cf723dc3b279a91a6080f329729cb49
# Parent  0e1b6472c05e3a53538d8e064e502d8a7508eb6e
motion.cpp: optimize 'X265_DIA_SEARCH' by eliminating costly branch instructions

diff -r 0e1b6472c05e -r 519441d72cf7 source/encoder/motion.cpp
--- a/source/encoder/motion.cpp	Tue Mar 08 19:08:57 2016 +0530
+++ b/source/encoder/motion.cpp	Tue Mar 08 20:12:43 2016 +0530
@@ -659,10 +659,10 @@
         do
         {
             COST_MV_X4_DIR(0, -1, 0, 1, -1, 0, 1, 0, costs);
-            COPY1_IF_LT(bcost, (costs[0] << 4) + 1);
-            COPY1_IF_LT(bcost, (costs[1] << 4) + 3);
-            COPY1_IF_LT(bcost, (costs[2] << 4) + 4);
-            COPY1_IF_LT(bcost, (costs[3] << 4) + 12);
+            (((costs[0] << 4) + 1) < bcost) && (bcost = ((costs[0] << 4) + 1));  // if ((y) < (x)) (x) = (y);
+            (((costs[1] << 4) + 3) < bcost) && (bcost = ((costs[1] << 4) + 3));
+            (((costs[2] << 4) + 4) < bcost) && (bcost = ((costs[2] << 4) + 4));
+            (((costs[3] << 4) + 12) < bcost) && (bcost = ((costs[3] << 4) + 12));
             if (!(bcost & 15))
                 break;
             bmv.x -= (bcost << 28) >> 30;


More information about the x265-devel mailing list