ref: a264f5369392ff10a70a8a3ee6b817a4880223bd
parent: 91f8be5045bf9fdfb59106390fd6b4c85e711452
author: angiebird <angiebird@google.com>
date: Mon Feb 10 07:04:26 EST 2020
Do save/restore_encode_params when rate_ctrl is on Change-Id: I06492a4d1511869cb243477a47295d5f82608fca
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -5970,9 +5970,9 @@
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 CONFIG_CONSISTENT_RECODE
+#if CONFIG_CONSISTENT_RECODE || CONFIG_RATE_CTRL
tile_data->thresh_freq_fact_prev[i][j] = RD_THRESH_INIT_FACT;
-#endif
+#endif // CONFIG_CONSISTENT_RECODE || CONFIG_RATE_CTRL
tile_data->mode_map[i][j] = j;
}
}
@@ -6357,7 +6357,7 @@
return sum_delta / (cm->mi_rows * cm->mi_cols);
}
-#if CONFIG_CONSISTENT_RECODE
+#if CONFIG_CONSISTENT_RECODE || CONFIG_RATE_CTRL
static void restore_encode_params(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common;
const int tile_cols = 1 << cm->log2_tile_cols;
@@ -6390,12 +6390,12 @@
cm->interp_filter = cpi->sf.default_interp_filter;
}
-#endif
+#endif // CONFIG_CONSISTENT_RECODE || CONFIG_RATE_CTRL
void vp9_encode_frame(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common;
-#if CONFIG_CONSISTENT_RECODE
+#if CONFIG_CONSISTENT_RECODE || CONFIG_RATE_CTRL
restore_encode_params(cpi);
#endif
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -3815,7 +3815,7 @@
set_ref_ptrs(cm, xd, LAST_FRAME, LAST_FRAME);
}
-#if CONFIG_CONSISTENT_RECODE
+#if CONFIG_CONSISTENT_RECODE || CONFIG_RATE_CTRL
static void save_encode_params(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common;
const int tile_cols = 1 << cm->log2_tile_cols;
@@ -3846,7 +3846,7 @@
}
}
}
-#endif
+#endif // CONFIG_CONSISTENT_RECODE || CONFIG_RATE_CTRL
static INLINE void set_raw_source_frame(VP9_COMP *cpi) {
#ifdef ENABLE_KF_DENOISE
@@ -5172,10 +5172,10 @@
memset(cpi->mode_chosen_counts, 0,
MAX_MODES * sizeof(*cpi->mode_chosen_counts));
#endif
-#if CONFIG_CONSISTENT_RECODE
+#if CONFIG_CONSISTENT_RECODE || CONFIG_RATE_CTRL
// Backup to ensure consistency between recodes
save_encode_params(cpi);
-#endif
+#endif // CONFIG_CONSISTENT_RECODE || CONFIG_RATE_CTRL
if (cpi->sf.recode_loop == DISALLOW_RECODE) {
if (!encode_without_recode_loop(cpi, size, dest)) return;
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -331,9 +331,9 @@
typedef struct TileDataEnc {
TileInfo tile_info;
int thresh_freq_fact[BLOCK_SIZES][MAX_MODES];
-#if CONFIG_CONSISTENT_RECODE
+#if CONFIG_CONSISTENT_RECODE || CONFIG_RATE_CTRL
int thresh_freq_fact_prev[BLOCK_SIZES][MAX_MODES];
-#endif
+#endif // CONFIG_CONSISTENT_RECODE || CONFIG_RATE_CTRL
int8_t mode_map[BLOCK_SIZES][MAX_MODES];
FIRSTPASS_DATA fp_data;
VP9RowMTSync row_mt_sync;
--- a/vp9/encoder/vp9_rd.h
+++ b/vp9/encoder/vp9_rd.h
@@ -114,11 +114,11 @@
int64_t prediction_type_threshes[MAX_REF_FRAMES][REFERENCE_MODES];
int64_t filter_threshes[MAX_REF_FRAMES][SWITCHABLE_FILTER_CONTEXTS];
-#if CONFIG_CONSISTENT_RECODE
+#if CONFIG_CONSISTENT_RECODE || CONFIG_RATE_CTRL
int64_t prediction_type_threshes_prev[MAX_REF_FRAMES][REFERENCE_MODES];
int64_t filter_threshes_prev[MAX_REF_FRAMES][SWITCHABLE_FILTER_CONTEXTS];
-#endif
+#endif // CONFIG_CONSISTENT_RECODE || CONFIG_RATE_CTRL
int RDMULT;
int RDDIV;
double r0;