]> granicus.if.org Git - libvpx/commitdiff
Adjust arf Q limits with multi-arf.
authorPaul Wilkins <paulwilkins@google.com>
Mon, 23 Jun 2014 13:59:46 +0000 (14:59 +0100)
committerPaul Wilkins <paulwilkins@google.com>
Tue, 24 Jun 2014 15:29:24 +0000 (16:29 +0100)
Adjust enforced minimum arf Q deltas for non primary arfs
in the middle of an arf/gf group.

Change-Id: Ie8034ffb3ac00f887d74ae1586d4cac91d6cace2

vp9/encoder/vp9_ratectrl.c

index 533f59970b79bca3fa12bb9a1c6f36212ca81371..c39d90b2234eecfc0936cd43352a402b5ad8f6cc 100644 (file)
@@ -892,21 +892,20 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi,
   *bottom_index = active_best_quality;
 
 #if LIMIT_QRANGE_FOR_ALTREF_AND_KEY
+  vp9_clear_system_state();
   {
-    int qdelta = 0;
-    vp9_clear_system_state();
-
-    // Limit Q range for the adaptive loop.
-    if ((cm->frame_type == KEY_FRAME || vp9_is_upper_layer_key_frame(cpi)) &&
-        !rc->this_key_frame_forced) {
-      qdelta = vp9_compute_qdelta_by_rate(&cpi->rc, cm->frame_type,
-                                          active_worst_quality, 2.0);
-    } else if (!rc->is_src_frame_alt_ref &&
-               (oxcf->rc_mode != VPX_CBR) &&
-               (cpi->refresh_alt_ref_frame)) {
-      qdelta = vp9_compute_qdelta_by_rate(&cpi->rc, cm->frame_type,
-                                          active_worst_quality, 1.75);
-    }
+    const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
+    const double rate_factor_deltas[RATE_FACTOR_LEVELS] = {
+      1.00,  // INTER_NORMAL
+      1.00,  // INTER_HIGH
+      1.50,  // GF_ARF_LOW
+      1.75,  // GF_ARF_STD
+      2.00,  // KF_STD
+    };
+    const double rate_factor =
+      rate_factor_deltas[gf_group->rf_level[gf_group->index]];
+    int qdelta = vp9_compute_qdelta_by_rate(&cpi->rc, cm->frame_type,
+                                            active_worst_quality, rate_factor);
     *top_index = active_worst_quality + qdelta;
     *top_index = (*top_index > *bottom_index) ? *top_index : *bottom_index;
   }