summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_ratectrl.c
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2014-11-10 11:46:58 -0800
committerYaowu Xu <yaowu@google.com>2014-11-10 16:55:13 -0800
commitf2b978e895afb8102a5f16b760450935914c08b0 (patch)
tree685fcf2fcee39be8dce11f353e10a14c21cefaf2 /vp9/encoder/vp9_ratectrl.c
parent130c6d745535df6cf73f244edeae96a730d540c3 (diff)
downloadlibvpx-f2b978e895afb8102a5f16b760450935914c08b0.tar
libvpx-f2b978e895afb8102a5f16b760450935914c08b0.tar.gz
libvpx-f2b978e895afb8102a5f16b760450935914c08b0.tar.bz2
libvpx-f2b978e895afb8102a5f16b760450935914c08b0.zip
Use normal rate_correction_factor for gf in CBR mode
I0c5f010 changed to allow update golden reference buffer in CBR mode, this commit changes the use of rate_correction_factor for those frames to be aligned with the new usage. This commit attempts to solve two issues: a. Initialization of rate correction factor for Golden Frame Prior to this patch, even the regular inter frame has been update the rate correction factor based on content and encoding results, the first golden frame would still use the ininitialized value that can be way off. b. Allowing rate correction factor update to be slightly faster Prior to this patch, when the rate correction factor is off, the update to the factor is too slow, the factor could not get close to a semi-correct value even after many frames. The commit helps all clips in psnr/ssim metric, but especially to a few clip in RTC set that rate correction was way off. For example thaloundeskmtgvga gained about .5dB for both overall/average psnr. Change-Id: I0be5c41691be57891d824505348b64be87fa3545
Diffstat (limited to 'vp9/encoder/vp9_ratectrl.c')
-rw-r--r--vp9/encoder/vp9_ratectrl.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index 8a5b6114c..6f165797e 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -369,8 +369,8 @@ static double get_rate_correction_factor(const VP9_COMP *cpi) {
return rc->rate_correction_factors[rf_lvl];
} else {
if ((cpi->refresh_alt_ref_frame || cpi->refresh_golden_frame) &&
- !rc->is_src_frame_alt_ref &&
- !(cpi->use_svc && cpi->oxcf.rc_mode == VPX_CBR))
+ !rc->is_src_frame_alt_ref && !cpi->use_svc &&
+ cpi->oxcf.rc_mode != VPX_CBR)
return rc->rate_correction_factors[GF_ARF_STD];
else
return rc->rate_correction_factors[INTER_NORMAL];
@@ -388,8 +388,8 @@ static void set_rate_correction_factor(VP9_COMP *cpi, double factor) {
rc->rate_correction_factors[rf_lvl] = factor;
} else {
if ((cpi->refresh_alt_ref_frame || cpi->refresh_golden_frame) &&
- !rc->is_src_frame_alt_ref &&
- !(cpi->use_svc && cpi->oxcf.rc_mode == VPX_CBR))
+ !rc->is_src_frame_alt_ref && !cpi->use_svc &&
+ cpi->oxcf.rc_mode != VPX_CBR)
rc->rate_correction_factors[GF_ARF_STD] = factor;
else
rc->rate_correction_factors[INTER_NORMAL] = factor;
@@ -1186,8 +1186,8 @@ void vp9_rc_postencode_update(VP9_COMP *cpi, uint64_t bytes_used) {
// Post encode loop adjustment of Q prediction.
vp9_rc_update_rate_correction_factors(
- cpi, (cpi->sf.recode_loop >= ALLOW_RECODE_KFARFGF ||
- oxcf->rc_mode == VPX_CBR) ? 2 : 0);
+ cpi, (cpi->sf.recode_loop >= ALLOW_RECODE_KFARFGF) ? 2 :
+ ((oxcf->rc_mode == VPX_CBR) ? 1 : 0));
// Keep a record of last Q and ambient average Q.
if (cm->frame_type == KEY_FRAME) {