Merge "Cleaning up reatectrl.c file."
authorDmitry Kovalev <dkovalev@google.com>
Thu, 16 Jan 2014 00:26:09 +0000 (16:26 -0800)
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>
Thu, 16 Jan 2014 00:26:09 +0000 (16:26 -0800)
1  2 
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.