]> granicus.if.org Git - libvpx/commitdiff
Make a config time flag
authorYaowu Xu <yaowu@google.com>
Mon, 14 May 2018 21:32:34 +0000 (14:32 -0700)
committerYaowu Xu <yaowu@google.com>
Mon, 14 May 2018 21:32:34 +0000 (14:32 -0700)
This commit replace a hard coded macro with a macro defined by
a configure command.

Change-Id: Ib31354d61865314ed43e2c429c72b4ef2c8fa2a7

configure
vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_encoder.h
vp9/encoder/vp9_rd.h
vp9/encoder/vp9_rdopt.c

index feb27248c674ba7195583625f201fe84e785439e..26533c2662fa4949f8ce601d8724522988786765 100755 (executable)
--- 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
index 1c86af506fa0d43d883e2e951571797bcb9011e7..33fc02fc51e19f90e206e9f0aa338c0dc168babb 100644 (file)
@@ -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
 
index c680f97e26b0a3e67f1e0a71464f4399059dca9c..95bf4622f9f4222f02bee07f16ad26fbade232c1 100644 (file)
@@ -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
index 786fbf016e518fc85a119cd94ebd7563f0174e62..f66c13046a9097da3b5eb91d1323a07d7f50eab5 100644 (file)
@@ -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];
index c1bd9ed30fc8db9ad44b66a06edefaadcbce967c..8201bba7039d1e6e4b4d06880a11889e14bd1626 100644 (file)
@@ -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];
index 977c19e654ff16ddfbdd2be82258e345d1f7eb1d..cab78a7b8d835634f98b607bbbb73fcf3283f365 100644 (file)
@@ -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];