From 32c4fdec7862657bc3865ca0f2dd151ee0e45646 Mon Sep 17 00:00:00 2001
From: Paul Wilkins <paulwilkins@google.com>
Date: Fri, 21 Mar 2014 16:14:46 +0000
Subject: [PATCH] Experimental change to speed 1 settings.

Allow tx search for ARF and GF helps quality but a little slower.
Setting subpel_iters_per_step to 1 improves encode speed.
Setting sf->mode_skip_start = 10 improves speed.

Initial local results suggest overall impact on quality is neutral
but encode is up to 15% faster.

Change-Id: Ibde02cae6626a44c10a1da0cefe888afbb51f037
---
 vp9/encoder/vp9_onyx_if.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index c32c08e7fe..0e8819cf90 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -541,7 +541,16 @@ static void set_rd_speed_thresholds_sub8x8(VP9_COMP *cpi) {
     sf->thresh_mult_sub8x8[THR_COMP_GA] = INT_MAX;
 }
 
-static void set_good_speed_feature(VP9_COMMON *cm,
+// Intra only frames, golden frames (except alt ref overlays) and
+// alt ref frames tend to be coded at a higher than ambient quality
+static INLINE int frame_is_boosted(const VP9_COMP *cpi,
+                                   const VP9_COMMON *const cm) {
+  return frame_is_intra_only(cm) || cpi->refresh_alt_ref_frame ||
+         (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref);
+}
+
+static void set_good_speed_feature(VP9_COMP *cpi,
+                                   VP9_COMMON *cm,
                                    SPEED_FEATURES *sf,
                                    int speed) {
   int i;
@@ -551,7 +560,7 @@ static void set_good_speed_feature(VP9_COMMON *cm,
   if (speed == 1) {
     sf->use_square_partition_only = !frame_is_intra_only(cm);
     sf->less_rectangular_check  = 1;
-    sf->tx_size_search_method = frame_is_intra_only(cm)
+    sf->tx_size_search_method = frame_is_boosted(cpi, cm)
       ? USE_FULL_RD : USE_LARGESTALL;
 
     if (MIN(cm->width, cm->height) >= 720)
@@ -568,6 +577,8 @@ static void set_good_speed_feature(VP9_COMMON *cm,
     sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V;
     sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V;
     sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V;
+    sf->subpel_iters_per_step = 1;
+    sf->mode_skip_start = 10;
   }
   if (speed == 2) {
     sf->use_square_partition_only = !frame_is_intra_only(cm);
@@ -937,7 +948,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
     case MODE_FIRSTPASS:
     case MODE_GOODQUALITY:
     case MODE_SECONDPASS:
-      set_good_speed_feature(cm, sf, speed);
+      set_good_speed_feature(cpi, cm, sf, speed);
       break;
     case MODE_REALTIME:
       set_rt_speed_feature(cm, sf, speed);
-- 
GitLab