From 2eac6df788dbcfb8f9388f785e7b124765b252bc Mon Sep 17 00:00:00 2001 From: Hui Su Date: Mon, 23 Apr 2018 14:05:23 -0700 Subject: [PATCH] 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 --- vp9/encoder/vp9_rdopt.c | 2 +- vp9/encoder/vp9_speed_features.c | 1 + vp9/encoder/vp9_speed_features.h | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index b6541b0f7..f753cf6ab 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -858,7 +858,7 @@ static void choose_tx_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x, int *rate, 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]); diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c index c0f985cbd..90da68726 100644 --- a/vp9/encoder/vp9_speed_features.c +++ b/vp9/encoder/vp9_speed_features.c @@ -817,6 +817,7 @@ void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi) { // 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) diff --git a/vp9/encoder/vp9_speed_features.h b/vp9/encoder/vp9_speed_features.h index 15e8dacbd..946bf0545 100644 --- a/vp9/encoder/vp9_speed_features.h +++ b/vp9/encoder/vp9_speed_features.h @@ -272,6 +272,9 @@ typedef struct SPEED_FEATURES { // 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; -- 2.40.0