From 1c07e79ef18efbab652b9296af67503885606663 Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Wed, 13 Mar 2019 11:20:28 -0700 Subject: [PATCH] Refactor speed feature settings Make the speed feature setup functions take speed argument as their input. Change-Id: I542e8f6e04658e5d99e972380a31baab99a4fc23 --- vp9/encoder/vp9_encoder.c | 8 ++++---- vp9/encoder/vp9_speed_features.c | 13 ++++++------- vp9/encoder/vp9_speed_features.h | 6 ++++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 36dea81..f3f05d8 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -2377,8 +2377,8 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf, } #endif // !CONFIG_REALTIME_ONLY - vp9_set_speed_features_framesize_independent(cpi); - vp9_set_speed_features_framesize_dependent(cpi); + vp9_set_speed_features_framesize_independent(cpi, oxcf->speed); + vp9_set_speed_features_framesize_dependent(cpi, oxcf->speed); if (cpi->sf.enable_wiener_variance) { CHECK_MEM_ERROR(cm, cpi->stack_rank_buffer, @@ -3491,7 +3491,7 @@ static void set_mv_search_params(VP9_COMP *cpi) { } static void set_size_independent_vars(VP9_COMP *cpi) { - vp9_set_speed_features_framesize_independent(cpi); + vp9_set_speed_features_framesize_independent(cpi, cpi->oxcf.speed); vp9_set_rd_speed_thresholds(cpi); vp9_set_rd_speed_thresholds_sub8x8(cpi); cpi->common.interp_filter = cpi->sf.default_interp_filter; @@ -3502,7 +3502,7 @@ static void set_size_dependent_vars(VP9_COMP *cpi, int *q, int *bottom_index, VP9_COMMON *const cm = &cpi->common; // Setup variables that depend on the dimensions of the frame. - vp9_set_speed_features_framesize_dependent(cpi); + vp9_set_speed_features_framesize_dependent(cpi, cpi->oxcf.speed); // Decide q and q bounds. *q = vp9_rc_pick_q_and_bounds(cpi, bottom_index, top_index); diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c index c8e5795..b26bf04 100644 --- a/vp9/encoder/vp9_speed_features.c +++ b/vp9/encoder/vp9_speed_features.c @@ -791,7 +791,7 @@ static void set_rt_speed_feature_framesize_independent( } } -void vp9_set_speed_features_framesize_dependent(VP9_COMP *cpi) { +void vp9_set_speed_features_framesize_dependent(VP9_COMP *cpi, int speed) { SPEED_FEATURES *const sf = &cpi->sf; const VP9EncoderConfig *const oxcf = &cpi->oxcf; RD_OPT *const rd = &cpi->rd; @@ -805,9 +805,9 @@ void vp9_set_speed_features_framesize_dependent(VP9_COMP *cpi) { sf->rd_ml_partition.search_breakout = 0; if (oxcf->mode == REALTIME) { - set_rt_speed_feature_framesize_dependent(cpi, sf, oxcf->speed); + set_rt_speed_feature_framesize_dependent(cpi, sf, speed); } else if (oxcf->mode == GOOD) { - set_good_speed_feature_framesize_dependent(cpi, sf, oxcf->speed); + set_good_speed_feature_framesize_dependent(cpi, sf, speed); } if (sf->disable_split_mask == DISABLE_ALL_SPLIT) { @@ -836,7 +836,7 @@ void vp9_set_speed_features_framesize_dependent(VP9_COMP *cpi) { sf->adaptive_rd_thresh = 0; } -void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi) { +void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi, int speed) { SPEED_FEATURES *const sf = &cpi->sf; VP9_COMMON *const cm = &cpi->common; MACROBLOCK *const x = &cpi->td.mb; @@ -954,10 +954,9 @@ void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi) { } if (oxcf->mode == REALTIME) - set_rt_speed_feature_framesize_independent(cpi, sf, oxcf->speed, - oxcf->content); + set_rt_speed_feature_framesize_independent(cpi, sf, speed, oxcf->content); else if (oxcf->mode == GOOD) - set_good_speed_feature_framesize_independent(cpi, cm, sf, oxcf->speed); + set_good_speed_feature_framesize_independent(cpi, cm, sf, speed); cpi->diamond_search_sad = vp9_diamond_search_sad; diff --git a/vp9/encoder/vp9_speed_features.h b/vp9/encoder/vp9_speed_features.h index 4261fca..22c1c3f 100644 --- a/vp9/encoder/vp9_speed_features.h +++ b/vp9/encoder/vp9_speed_features.h @@ -609,8 +609,10 @@ typedef struct SPEED_FEATURES { struct VP9_COMP; -void vp9_set_speed_features_framesize_independent(struct VP9_COMP *cpi); -void vp9_set_speed_features_framesize_dependent(struct VP9_COMP *cpi); +void vp9_set_speed_features_framesize_independent(struct VP9_COMP *cpi, + int speed); +void vp9_set_speed_features_framesize_dependent(struct VP9_COMP *cpi, + int speed); #ifdef __cplusplus } // extern "C" -- 2.7.4