Merge FPMT updates of rate control elements to default
FPMT related updates of rate control elements are merged to the default
path.
Change-Id: Ibf9aa5468619a88de6a646ef1049c8d7db9f9d59
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c
index c03ad54..8c11c03 100644
--- a/av1/encoder/encode_strategy.c
+++ b/av1/encoder/encode_strategy.c
@@ -1285,21 +1285,20 @@
start_timing(cpi, av1_get_second_pass_params_time);
#endif
-#if CONFIG_FRAME_PARALLEL_ENCODE
// Initialise frame_level_rate_correction_factors with value previous
// to the parallel frames.
if (cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] > 0) {
for (int i = 0; i < RATE_FACTOR_LEVELS; i++) {
cpi->rc.frame_level_rate_correction_factors[i] =
-#if CONFIG_FPMT_TEST
+#if CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
(cpi->ppi->fpmt_unit_test_cfg == PARALLEL_SIMULATION_ENCODE)
? cpi->ppi->p_rc.temp_rate_correction_factors[i]
:
-#endif // CONFIG_FPMT_TEST
+#endif // CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
cpi->ppi->p_rc.rate_correction_factors[i];
}
}
-#endif
+
// copy mv_stats from ppi to frame_level cpi.
cpi->mv_stats = cpi->ppi->mv_stats;
av1_get_second_pass_params(cpi, &frame_params, *frame_flags);
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index c84f650..0e57d3f 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -556,7 +556,7 @@
double rate_correction_factors_kfstd;
double rate_correction_factors_gfarfstd;
double rate_correction_factors_internormal;
-#if CONFIG_FRAME_PARALLEL_ENCODE
+
rate_correction_factors_kfstd =
(cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] > 0)
? rc->frame_level_rate_correction_factors[KF_STD]
@@ -569,27 +569,16 @@
(cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] > 0)
? rc->frame_level_rate_correction_factors[INTER_NORMAL]
: p_rc->rate_correction_factors[INTER_NORMAL];
-#else
- rate_correction_factors_kfstd = p_rc->rate_correction_factors[KF_STD];
- rate_correction_factors_gfarfstd = p_rc->rate_correction_factors[GF_ARF_STD];
- rate_correction_factors_internormal =
- p_rc->rate_correction_factors[INTER_NORMAL];
-#endif
if (cpi->common.current_frame.frame_type == KEY_FRAME) {
rcf = rate_correction_factors_kfstd;
} else if (is_stat_consumption_stage(cpi)) {
const RATE_FACTOR_LEVEL rf_lvl =
get_rate_factor_level(&cpi->ppi->gf_group, cpi->gf_frame_index);
- double rate_correction_factors_rflvl;
-#if CONFIG_FRAME_PARALLEL_ENCODE
- rate_correction_factors_rflvl =
+ double rate_correction_factors_rflvl =
(cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] > 0)
? rc->frame_level_rate_correction_factors[rf_lvl]
: p_rc->rate_correction_factors[rf_lvl];
-#else
- rate_correction_factors_rflvl = p_rc->rate_correction_factors[rf_lvl];
-#endif
rcf = rate_correction_factors_rflvl;
} else {
if ((refresh_frame->alt_ref_frame || refresh_frame->golden_frame) &&
@@ -625,9 +614,6 @@
RATE_CONTROL *const rc = &cpi->rc;
PRIMARY_RATE_CONTROL *const p_rc = &cpi->ppi->p_rc;
const RefreshFrameInfo *const refresh_frame = &cpi->refresh_frame;
-#if !CONFIG_FRAME_PARALLEL_ENCODE
- (void)is_encode_stage;
-#endif
int update_default_rcf = 1;
// Normalize RCF to account for the size-dependent scaling factor.
factor /= resize_rate_factor(&cpi->oxcf.frm_dim_cfg, width, height);
@@ -639,13 +625,11 @@
} else if (is_stat_consumption_stage(cpi)) {
const RATE_FACTOR_LEVEL rf_lvl =
get_rate_factor_level(&cpi->ppi->gf_group, cpi->gf_frame_index);
-#if CONFIG_FRAME_PARALLEL_ENCODE
if (is_encode_stage &&
cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] > 0) {
rc->frame_level_rate_correction_factors[rf_lvl] = factor;
update_default_rcf = 0;
}
-#endif
if (update_default_rcf) p_rc->rate_correction_factors[rf_lvl] = factor;
} else {
if ((refresh_frame->alt_ref_frame || refresh_frame->golden_frame) &&
@@ -654,13 +638,11 @@
cpi->oxcf.rc_cfg.gf_cbr_boost_pct > 20)) {
p_rc->rate_correction_factors[GF_ARF_STD] = factor;
} else {
-#if CONFIG_FRAME_PARALLEL_ENCODE
if (is_encode_stage &&
cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] > 0) {
rc->frame_level_rate_correction_factors[INTER_NORMAL] = factor;
update_default_rcf = 0;
}
-#endif
if (update_default_rcf)
p_rc->rate_correction_factors[INTER_NORMAL] = factor;
}
@@ -675,11 +657,6 @@
get_rate_correction_factor(cpi, width, height);
double adjustment_limit;
const int MBs = av1_get_MBs(width, height);
-
-#if !CONFIG_FRAME_PARALLEL_ENCODE
- (void)is_encode_stage;
-#endif
-
int projected_size_based_on_q = 0;
// Do not update the rate factors for arf overlay frames.
diff --git a/av1/encoder/ratectrl.h b/av1/encoder/ratectrl.h
index c3b3bc9..5ac9660 100644
--- a/av1/encoder/ratectrl.h
+++ b/av1/encoder/ratectrl.h
@@ -250,9 +250,8 @@
// Stores fast_extra_bits of the current frame.
int frame_level_fast_extra_bits;
-#if CONFIG_FRAME_PARALLEL_ENCODE
+
double frame_level_rate_correction_factors[RATE_FACTOR_LEVELS];
-#endif
/*!\endcond */
} RATE_CONTROL;