[x265] [PATCH 4 of 4] improve motionEstimate() by bypass reduce MV Candidate

Min Chen chenm003 at 163.com
Tue Aug 25 02:05:32 CEST 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1440460166 25200
# Node ID d3884d55fb6caedcd751db7b289dac470d139d1d
# Parent  63f16fa65e3f4963863f31bc3802d7958410ff09
improve motionEstimate() by bypass reduce MV Candidate
---
 source/encoder/motion.cpp |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff -r 63f16fa65e3f -r d3884d55fb6c source/encoder/motion.cpp
--- a/source/encoder/motion.cpp	Mon Aug 24 16:26:14 2015 -0700
+++ b/source/encoder/motion.cpp	Mon Aug 24 16:49:26 2015 -0700
@@ -621,10 +621,18 @@
         }
     }
 
-    X265_CHECK(!(ref->isLowres && numCandidates), "lowres motion candidates not allowed\n")
+    X265_CHECK(!(ref->isLowres && numCandidates), "lowres motion candidates not allowed\n");
+
     // measure SAD cost at each QPEL motion vector candidate
+    MV prevMV(0x7EEDDEAD);
+    X265_CHECK((numCandidates == 0) || (mvc[0] != prevMV), "Magic MV 0x7EEDDEAD check failure!\n");
     for (int i = 0; i < numCandidates; i++)
     {
+        // Bypass duplicated mvc, it isn't a good way but simplest. Prepare to sort input mvc list will give us less candidate
+        if (prevMV == mvc[i])
+            continue;
+        prevMV = mvc[i];
+
         MV m = mvc[i].clipped(qmvmin, qmvmax);
         if (m.notZero() & (m != pmv ? 1 : 0) & (m != bestpre ? 1 : 0)) // check already measured
         {



More information about the x265-devel mailing list