From: Dmitry Kovalev Date: Thu, 16 Jan 2014 00:26:09 +0000 (-0800) Subject: Merge "Cleaning up reatectrl.c file." X-Git-Tag: v1.4.0~2656 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f0d213494f0f71c614e33b4fd1a3b2baab9eb7e;p=platform%2Fupstream%2Flibvpx.git Merge "Cleaning up reatectrl.c file." --- 8f0d213494f0f71c614e33b4fd1a3b2baab9eb7e diff --cc vp9/encoder/vp9_ratectrl.c index 27b58d8,6550452..72ab00f --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@@ -738,21 -741,16 +741,21 @@@ int vp9_rc_pick_q_and_adjust_q_bounds(c } #endif - if (cpi->oxcf.end_usage == USAGE_CONSTANT_QUALITY) { + if (oxcf->end_usage == USAGE_CONSTANT_QUALITY) { q = active_best_quality; // Special case code to try and match quality with forced key frames - } else if ((cm->frame_type == KEY_FRAME) && cpi->rc.this_key_frame_forced) { - q = cpi->rc.last_boosted_qindex; + } else if ((cm->frame_type == KEY_FRAME) && rc->this_key_frame_forced) { + q = rc->last_boosted_qindex; } else { - q = vp9_rc_regulate_q(cpi, cpi->rc.this_frame_target, + q = vp9_rc_regulate_q(cpi, rc->this_frame_target, active_best_quality, active_worst_quality); - if (q > *top_index) - q = *top_index; + if (q > *top_index) { + // Special case when we are targeting the max allowed rate + if (cpi->rc.this_frame_target >= cpi->rc.max_frame_bandwidth) + *top_index = q; + else + q = *top_index; + } } #if CONFIG_MULTIPLE_ARF // Force the quantizer determined by the coding order pattern.