diff options
author | Deepa K G <deepa.kg@ittiam.com> | 2018-12-11 17:38:06 +0530 |
---|---|---|
committer | Deepa K G <deepa.kg@ittiam.com> | 2018-12-11 17:38:06 +0530 |
commit | e0454d36897d36263dc5f40235ed5ec6951a64e0 (patch) | |
tree | cec1495e6718dde66b539ac91da9aada32cc89e1 /vp9/encoder/vp9_ratectrl.c | |
parent | 5039d2d82b3beab14ca7c354e1a8fefe67bb671a (diff) | |
download | libvpx-e0454d36897d36263dc5f40235ed5ec6951a64e0.tar libvpx-e0454d36897d36263dc5f40235ed5ec6951a64e0.tar.gz libvpx-e0454d36897d36263dc5f40235ed5ec6951a64e0.tar.bz2 libvpx-e0454d36897d36263dc5f40235ed5ec6951a64e0.zip |
Use undamped adjustment for rate correction factors
Undamped adjustment is used for the first frame
of each frame type while updating the rate
correction factors.
Change-Id: I42f80daa123c4cd4e45c18c6960cc7a67e7df7e6
Diffstat (limited to 'vp9/encoder/vp9_ratectrl.c')
-rw-r--r-- | vp9/encoder/vp9_ratectrl.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index b5c002aea..52b14ea31 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -417,6 +417,7 @@ void vp9_rc_init(const VP9EncoderConfig *oxcf, int pass, RATE_CONTROL *rc) { for (i = 0; i < RATE_FACTOR_LEVELS; ++i) { rc->rate_correction_factors[i] = 1.0; + rc->damped_adjustment[i] = 0; } rc->min_gf_interval = oxcf->min_gf_interval; @@ -720,6 +721,8 @@ void vp9_rc_update_rate_correction_factors(VP9_COMP *cpi) { int correction_factor = 100; double rate_correction_factor = get_rate_correction_factor(cpi); double adjustment_limit; + RATE_FACTOR_LEVEL rf_lvl = + cpi->twopass.gf_group.rf_level[cpi->twopass.gf_group.index]; int projected_size_based_on_q = 0; @@ -746,10 +749,16 @@ void vp9_rc_update_rate_correction_factors(VP9_COMP *cpi) { correction_factor = (int)((100 * (int64_t)cpi->rc.projected_frame_size) / projected_size_based_on_q); - // More heavily damped adjustment used if we have been oscillating either side - // of target. - adjustment_limit = - 0.25 + 0.5 * VPXMIN(1, fabs(log10(0.01 * correction_factor))); + // Do not use damped adjustment for the first frame of each frame type + if (!cpi->rc.damped_adjustment[rf_lvl]) { + adjustment_limit = 1.0; + cpi->rc.damped_adjustment[rf_lvl] = 1; + } else { + // More heavily damped adjustment used if we have been oscillating either + // side of target. + adjustment_limit = + 0.25 + 0.5 * VPXMIN(1, fabs(log10(0.01 * correction_factor))); + } cpi->rc.q_2_frame = cpi->rc.q_1_frame; cpi->rc.q_1_frame = cm->base_qindex; |