[x265] [PATCH] improve motionEstimate() by bypass reduce MV Candidate
Min Chen
chenm003 at 163.com
Tue Aug 25 20:48:03 CEST 2015
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1440525548 25200
# Node ID 7012026de2627f6b7f421c28930ba028684e9186
# Parent 7a5deb91c834bb3b3d8ea71a23e86b6f512d2cca
improve motionEstimate() by bypass reduce MV Candidate
---
source/common/mv.h | 2 ++
source/encoder/motion.cpp | 11 ++++++++++-
2 files changed, 12 insertions(+), 1 deletions(-)
diff -r 7a5deb91c834 -r 7012026de262 source/common/mv.h
--- a/source/common/mv.h Tue Aug 25 10:50:07 2015 -0700
+++ b/source/common/mv.h Tue Aug 25 10:59:08 2015 -0700
@@ -79,6 +79,8 @@
bool operator !() const { return !word; }
+ MV operator ~() const { return ~word; }
+
// Scale down a QPEL mv to FPEL mv, rounding up by one HPEL offset
MV roundToFPel() const { return MV((x + 2) >> 2, (y + 2) >> 2); }
diff -r 7a5deb91c834 -r 7012026de262 source/encoder/motion.cpp
--- a/source/encoder/motion.cpp Tue Aug 25 10:50:07 2015 -0700
+++ b/source/encoder/motion.cpp Tue Aug 25 10:59:08 2015 -0700
@@ -621,10 +621,19 @@
}
}
- 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;
+ if (numCandidates)
+ prevMV = ~mvc[0];
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