[x265] [PATCH] motion: bypass the ME search if any of MVC Cost is Zero

gopu at multicorewareinc.com gopu at multicorewareinc.com
Thu Jun 25 09:51:56 CEST 2015


# HG changeset patch
# User Gopu Govindaswamy <gopu at multicorewareinc.com>
# Date 1435217502 -19800
#      Thu Jun 25 13:01:42 2015 +0530
# Node ID 58a40cd36ed9aa5c5ab94bb8ab2cda8c36a12b05
# Parent  b1af4c36f48a4500a4912373ebcda9a5540b5c15
motion: bypass the ME search if any of MVC Cost is Zero

diff -r b1af4c36f48a -r 58a40cd36ed9 source/encoder/motion.cpp
--- a/source/encoder/motion.cpp	Wed Jun 24 10:36:15 2015 -0500
+++ b/source/encoder/motion.cpp	Thu Jun 25 13:01:42 2015 +0530
@@ -616,6 +616,7 @@
     MV pmv = qmvp.clipped(qmvmin, qmvmax);
     MV bestpre = pmv;
     int bprecost;
+    int mvcCost = COST_MAX;
 
     if (ref->isLowres)
         bprecost = ref->lowresQPelCost(fenc, blockOffset, pmv, sad);
@@ -650,7 +651,7 @@
                 int cost = ref->lowresQPelCost(fenc, blockOffset, m, sad) + mvcost(m);
                 if (cost < bprecost)
                 {
-                    bprecost = cost;
+                    mvcCost = bprecost = cost;
                     bestpre = m;
                 }
             }
@@ -666,7 +667,7 @@
                 int cost = subpelCompare(ref, m, sad) + mvcost(m);
                 if (cost < bprecost)
                 {
-                    bprecost = cost;
+                    mvcCost = bprecost = cost;
                     bestpre = m;
                 }
             }
@@ -676,6 +677,10 @@
     pmv = pmv.roundToFPel();
     MV omv = bmv;  // current search origin or starting point
 
+    //bypass the ME search if any of MVC Cost is Zero
+    if (!mvcCost)
+        goto me_early_exit;
+
     switch (searchMethod)
     {
     case X265_DIA_SEARCH:
@@ -1112,6 +1117,8 @@
         break;
     }
 
+me_early_exit:
+
     if (bprecost < bcost)
     {
         bmv = bestpre;


More information about the x265-devel mailing list