ref: 701d907f3aae0cad58916e0413f3f74ea3be8d09
parent: 00fbdc159b1ac4896a57a8ef5665a24df4a06e19
author: Deb Mukherjee <[email protected]>
date: Thu May 22 11:16:23 EDT 2014
Fix for missing initialization of ratectrl vars Initializes total_actual_bits and total_target_bits to 0 Change-Id: Ia50d3bf5df765146a44aa1f6045e73367ccf50df
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -213,6 +213,7 @@
rc->long_rolling_actual_bits = rc->avg_frame_bandwidth;
rc->total_actual_bits = 0;
+ rc->total_target_bits = 0;
rc->total_target_vs_actual = 0;
rc->baseline_gf_interval = DEFAULT_GF_INTERVAL;
@@ -611,7 +612,8 @@
const VP9EncoderConfig *const oxcf) {
static const double cq_adjust_threshold = 0.5;
int active_cq_level = oxcf->cq_level;
- if (oxcf->rc_mode == RC_MODE_CONSTRAINED_QUALITY) {
+ if (oxcf->rc_mode == RC_MODE_CONSTRAINED_QUALITY &&
+ rc->total_target_bits > 0) {
const double x = (double)rc->total_actual_bits / rc->total_target_bits;
if (x < cq_adjust_threshold) {
active_cq_level = (int)(active_cq_level * x / cq_adjust_threshold);