From fd554ec7144032ec24bab639cb314d5b1b63f684 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Mon, 14 May 2018 14:32:34 -0700 Subject: [PATCH] Make a config time flag This commit replace a hard coded macro with a macro defined by a configure command. Change-Id: Ib31354d61865314ed43e2c429c72b4ef2c8fa2a7 --- configure | 2 ++ vp9/encoder/vp9_encodeframe.c | 8 ++++---- vp9/encoder/vp9_encoder.c | 4 ++-- vp9/encoder/vp9_encoder.h | 2 +- vp9/encoder/vp9_rd.h | 5 +---- vp9/encoder/vp9_rdopt.c | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/configure b/configure index feb27248c..26533c266 100755 --- a/configure +++ b/configure @@ -327,6 +327,7 @@ CONFIG_LIST=" multi_res_encoding temporal_denoising vp9_temporal_denoising + consistent_recode coefficient_range_checking vp9_highbitdepth better_hw_compatibility @@ -388,6 +389,7 @@ CMDLINE_SELECT=" multi_res_encoding temporal_denoising vp9_temporal_denoising + consistent_recode coefficient_range_checking better_hw_compatibility vp9_highbitdepth diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 1c86af506..33fc02fc5 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -4663,7 +4663,7 @@ void vp9_init_tile_data(VP9_COMP *cpi) { for (i = 0; i < BLOCK_SIZES; ++i) { for (j = 0; j < MAX_MODES; ++j) { tile_data->thresh_freq_fact[i][j] = RD_THRESH_INIT_FACT; -#if CONSISTENT_RECODE_STATE +#if CONFIG_CONSISTENT_RECODE tile_data->thresh_freq_fact_prev[i][j] = RD_THRESH_INIT_FACT; #endif tile_data->mode_map[i][j] = j; @@ -4790,7 +4790,7 @@ static void encode_frame_internal(VP9_COMP *cpi) { x->fwd_txfm4x4 = xd->lossless ? vp9_fwht4x4 : vpx_fdct4x4; #endif // CONFIG_VP9_HIGHBITDEPTH x->inv_txfm_add = xd->lossless ? vp9_iwht4x4_add : vp9_idct4x4_add; -#if CONSISTENT_RECODE_STATE +#if CONFIG_CONSISTENT_RECODE x->optimize = sf->optimize_coefficients == 1 && cpi->oxcf.pass != 1; #endif if (xd->lossless) x->optimize = 0; @@ -4917,7 +4917,7 @@ static int compute_frame_aq_offset(struct VP9_COMP *cpi) { return sum_delta / (cm->mi_rows * cm->mi_cols); } -#if CONSISTENT_RECODE_STATE +#if CONFIG_CONSISTENT_RECODE static void restore_encode_params(VP9_COMP *cpi) { VP9_COMMON *const cm = &cpi->common; const int tile_cols = 1 << cm->log2_tile_cols; @@ -4955,7 +4955,7 @@ static void restore_encode_params(VP9_COMP *cpi) { void vp9_encode_frame(VP9_COMP *cpi) { VP9_COMMON *const cm = &cpi->common; -#if CONSISTENT_RECODE_STATE +#if CONFIG_CONSISTENT_RECODE restore_encode_params(cpi); #endif diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index c680f97e2..95bf4622f 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -3579,7 +3579,7 @@ static void set_frame_size(VP9_COMP *cpi) { set_ref_ptrs(cm, xd, LAST_FRAME, LAST_FRAME); } -#if CONSISTENT_RECODE_STATE +#if CONFIG_CONSISTENT_RECODE static void save_encode_params(VP9_COMP *cpi) { VP9_COMMON *const cm = &cpi->common; const int tile_cols = 1 << cm->log2_tile_cols; @@ -4644,7 +4644,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, size_t *size, memset(cpi->mode_chosen_counts, 0, MAX_MODES * sizeof(*cpi->mode_chosen_counts)); #endif -#if CONSISTENT_RECODE_STATE +#if CONFIG_CONSISTENT_RECODE // Backup to ensure consistency between recodes save_encode_params(cpi); #endif diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index 786fbf016..f66c13046 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -282,7 +282,7 @@ static INLINE int is_lossless_requested(const VP9EncoderConfig *cfg) { typedef struct TileDataEnc { TileInfo tile_info; int thresh_freq_fact[BLOCK_SIZES][MAX_MODES]; -#if CONSISTENT_RECODE_STATE +#if CONFIG_CONSISTENT_RECODE int thresh_freq_fact_prev[BLOCK_SIZES][MAX_MODES]; #endif int8_t mode_map[BLOCK_SIZES][MAX_MODES]; diff --git a/vp9/encoder/vp9_rd.h b/vp9/encoder/vp9_rd.h index c1bd9ed30..8201bba70 100644 --- a/vp9/encoder/vp9_rd.h +++ b/vp9/encoder/vp9_rd.h @@ -23,9 +23,6 @@ extern "C" { #endif -// This macro defines the control for consistent recode behaviour -#define CONSISTENT_RECODE_STATE 0 - #define RDDIV_BITS 7 #define RD_EPB_SHIFT 6 @@ -111,7 +108,7 @@ typedef struct RD_OPT { int64_t prediction_type_threshes[MAX_REF_FRAMES][REFERENCE_MODES]; int64_t filter_threshes[MAX_REF_FRAMES][SWITCHABLE_FILTER_CONTEXTS]; -#if CONSISTENT_RECODE_STATE +#if CONFIG_CONSISTENT_RECODE int64_t prediction_type_threshes_prev[MAX_REF_FRAMES][REFERENCE_MODES]; int64_t filter_threshes_prev[MAX_REF_FRAMES][SWITCHABLE_FILTER_CONTEXTS]; diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 977c19e65..cab78a7b8 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -3614,7 +3614,7 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, TileDataEnc *tile_data, if (best_mode_index < 0 || best_rd >= best_rd_so_far) { // If adaptive interp filter is enabled, then the current leaf node of 8x8 // data is needed for sub8x8. Hence preserve the context. -#if CONSISTENT_RECODE_STATE +#if CONFIG_CONSISTENT_RECODE if (bsize == BLOCK_8X8) ctx->mic = *xd->mi[0]; #else if (cpi->row_mt && bsize == BLOCK_8X8) ctx->mic = *xd->mi[0]; -- 2.40.0