shithub: libvpx

Download patch

ref: 2eac6df788dbcfb8f9388f785e7b124765b252bc
parent: 3b460db214b5bec07a3da6914a224d90c361ccac
author: Hui Su <huisu@google.com>
date: Mon Apr 23 10:05:23 EDT 2018

Add speed feture to control tx size search depth

Set the max depth as 2 for speed 0.

Compression(negative means gain):
        speed 0     speed 1
lowres   -0.01%      0.00%
midres    0.05%     -0.01%
hdres    -0.01%      0.01%

Encoding speed gain:
Tested on crowd_run_1080p 30 frames
Fixed QP = 20, speed 0: 669.7s -> 656.1s
               speed 1: 104.5s -> 101.5s
Fixed QP = 40, speed 0: 440.7s -> 435.8s
               speed 1:  47.7s ->  45.1s

Change-Id: I61bc13818c72317b9f1d596727d54a906b20c012

--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -858,7 +858,7 @@
 
   if (cm->tx_mode == TX_MODE_SELECT) {
     start_tx = max_tx_size;
-    end_tx = 0;
+    end_tx = VPXMAX(start_tx - cpi->sf.tx_size_search_depth, 0);
   } else {
     TX_SIZE chosen_tx_size =
         VPXMIN(max_tx_size, tx_mode_to_biggest_tx_size[cm->tx_mode]);
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -817,6 +817,7 @@
   // Some speed-up features even for best quality as minimal impact on quality.
   sf->adaptive_rd_thresh = 1;
   sf->tx_size_search_breakout = 1;
+  sf->tx_size_search_depth = 2;
 
   sf->exhaustive_searches_thresh =
       (cpi->twopass.fr_content_type == FC_GRAPHICS_ANIMATION) ? (1 << 20)
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -272,6 +272,9 @@
   // for intra and model coefs for the rest.
   TX_SIZE_SEARCH_METHOD tx_size_search_method;
 
+  // How many levels of tx size to search, starting from the largest.
+  int tx_size_search_depth;
+
   // Low precision 32x32 fdct keeps everything in 16 bits and thus is less
   // precise but significantly faster than the non lp version.
   int use_lp32x32fdct;