From a3d22aa2a4e9946f5dd5e0e77c351511fb5d97ec Mon Sep 17 00:00:00 2001
From: Yunqing Wang <yunqingwang@google.com>
Date: Tue, 4 Aug 2015 12:06:21 -0700
Subject: [PATCH] Small improvement in sub-pixel motion search

If the current best mv(namely, the search center) is still the best mv
after the first level search, the second level checks is skipped. This
patch doesn't change the bitstream. At speed 0, it speeds up the encoder
by 1% - 2%.

Change-Id: I054c91b884d3f7aef157436c061744562bd6506d
---
 vp9/encoder/vp9_mcomp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c
index 081b99f9f1..6e0c561c3e 100644
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -735,7 +735,7 @@ int vp9_find_best_sub_pixel_tree(const MACROBLOCK *x,
       bc = tc;
     }
 
-    if (iters_per_step > 1)
+    if (iters_per_step > 1 && best_idx != -1)
       SECOND_LEVEL_CHECKS;
 
     tr = br;
-- 
GitLab