}
#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.