[x265] [PATCH] consider skip cost in lookahead cost estimation

sagar at multicorewareinc.com sagar at multicorewareinc.com
Fri Nov 6 05:45:27 CET 2015


# HG changeset patch
# User sagar at multicorewareinc.com
# Date 1446785051 -19800
#      Fri Nov 06 10:14:11 2015 +0530
# Node ID 4013786f7013c20b073cbd58ff02b64af8f4f15f
# Parent  39c35f175c8c515860ae4ea8ec75e15bc115d530
consider skip cost in lookahead cost estimation

diff -r 39c35f175c8c -r 4013786f7013 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Thu Nov 05 16:01:25 2015 +0530
+++ b/source/encoder/slicetype.cpp	Fri Nov 06 10:14:11 2015 +0530
@@ -2088,6 +2088,7 @@
     for (int i = 0; i < 1 + bBidir; i++)
     {
         int& fencCost = fenc->lowresMvCosts[i][listDist[i]][cuXY];
+        int skipCost = INT_MAX;
 
         if (!bDoSearch[i])
         {
@@ -2129,6 +2130,9 @@
                 intptr_t stride = X265_LOWRES_CU_SIZE;
                 pixel *src = fref->lowresMC(pelOffset, mvc[idx], subpelbuf, stride);
                 int cost = tld.me.bufSATD(src, stride);
+                /* Except for mv0 case, everyting else is likely to have enough residual to not trigger the skip. */
+                if (!mvp.notZero() && bBidir)
+                    skipCost = cost;
                 COPY2_IF_LT(mvpcost, cost, mvp, mvc[idx]);
             }
         }
@@ -2136,6 +2140,11 @@
         /* ME will never return a cost larger than the cost @MVP, so we do not
          * have to check that ME cost is more than the estimated merge cost */
         fencCost = tld.me.motionEstimate(fref, mvmin, mvmax, mvp, 0, NULL, s_merange, *fencMV);
+        if (skipCost < 64 && skipCost < fencCost && bBidir)
+        {
+            fencCost = skipCost;
+            *fencMV = 0;
+        }
         COPY2_IF_LT(bcost, fencCost, listused, i + 1);
     }
 


More information about the x265-devel mailing list