From 4f2f86725b3e56b28762318f3f810edcd6d619ef Mon Sep 17 00:00:00 2001
From: Jingning Han <jingning@google.com>
Date: Wed, 23 Jul 2014 11:47:56 -0700
Subject: [PATCH] Use the chessboard pattern pred search in newmv mode

This commit extends the chessboard pattern prediction filter search.
If the above and left blocks have the same prediction filter type,
the encoder will skip the prediction filter type search and use the
reference one.

The overall chessboard pattern prediction filter type search reduces
speed 3 runtime for hard clips. Experiments on park joy at 1080p
and 15000 kbps show that the runtime goes from 723265 ms to 65832 ms,
i.e., about 10% speed-up. Compression performance wise, it affects
the coding quality by

Change-Id: I880975497c7ad166532e9eea9bf46684d77ff327
derf:    -0.326%
yt:      -0.257%
hd:      -0.241%
stdhd:   -0.417%
---
 vp9/encoder/vp9_rdopt.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index ef81959f07..e5d0e6a44a 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2045,11 +2045,15 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
   int pred_filter_search = cpi->sf.cb_pred_filter_search ?
       (((mi_row + mi_col) >> bsl)) & 0x01 : 0;
 
-  if (pred_filter_search && this_mode != NEWMV) {
+  if (pred_filter_search) {
+    INTERP_FILTER af = SWITCHABLE, lf = SWITCHABLE;
     if (xd->up_available)
-      best_filter = xd->mi[-xd->mi_stride]->mbmi.interp_filter;
-    else if (xd->left_available)
-      best_filter = xd->mi[-1]->mbmi.interp_filter;
+      af = xd->mi[-xd->mi_stride]->mbmi.interp_filter;
+    if (xd->left_available)
+      lf = xd->mi[-1]->mbmi.interp_filter;
+
+    if ((this_mode != NEWMV) || (af == lf))
+      best_filter = af;
   }
 
   if (is_comp_pred) {
-- 
GitLab