shithub: libvpx

Download patch

ref: fd554ec7144032ec24bab639cb314d5b1b63f684
parent: e51c9e39bcfcf26b9031845ff7767050bcb3b059
author: Yaowu Xu <yaowu@google.com>
date: Mon May 14 10:32:34 EDT 2018

Make a config time flag

This commit replace a hard coded macro with a macro defined by
a configure command.

Change-Id: Ib31354d61865314ed43e2c429c72b4ef2c8fa2a7

--- a/configure
+++ b/configure
@@ -327,6 +327,7 @@
     multi_res_encoding
     temporal_denoising
     vp9_temporal_denoising
+    consistent_recode
     coefficient_range_checking
     vp9_highbitdepth
     better_hw_compatibility
@@ -388,6 +389,7 @@
     multi_res_encoding
     temporal_denoising
     vp9_temporal_denoising
+    consistent_recode
     coefficient_range_checking
     better_hw_compatibility
     vp9_highbitdepth
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -4663,7 +4663,7 @@
         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 @@
   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 @@
   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 @@
 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
 
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -3579,7 +3579,7 @@
   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 @@
   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
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -282,7 +282,7 @@
 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];
--- 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 @@
   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];
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -3614,7 +3614,7 @@
   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];