shithub: libvpx

Download patch

ref: 7a19f6afeaf7170d05dce92f11e4ec9b93fa3637
parent: 5039d2d82b3beab14ca7c354e1a8fefe67bb671a
author: Deepa K G <deepa.kg@ittiam.com>
date: Wed Dec 5 11:52:49 EST 2018

Rescale arf bit budget calculation

To compute the total budget for a depth layer, exclude the count of
frames in the current layer.

Change-Id: I9ffd1f63ea597de3ea95e0832b13f5b1f35cb086

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2301,9 +2301,9 @@
 
     for (idx = 2; idx < MAX_ARF_LAYERS; ++idx) {
       if (arf_depth_boost[idx] == 0) break;
-      arf_depth_bits[idx] =
-          calculate_boost_bits(rc->baseline_gf_interval - total_arfs,
-                               arf_depth_boost[idx], total_group_bits);
+      arf_depth_bits[idx] = calculate_boost_bits(
+          rc->baseline_gf_interval - total_arfs - arf_depth_count[idx],
+          arf_depth_boost[idx], total_group_bits);
 
       total_group_bits -= arf_depth_bits[idx];
       total_arfs += arf_depth_count[idx];
@@ -2675,8 +2675,8 @@
   }
 
   // Calculate the extra bits to be used for boosted frame(s)
-  gf_arf_bits = calculate_boost_bits(rc->baseline_gf_interval, rc->gfu_boost,
-                                     gf_group_bits);
+  gf_arf_bits = calculate_boost_bits((rc->baseline_gf_interval - 1),
+                                     rc->gfu_boost, gf_group_bits);
 
   // Adjust KF group bits and error remaining.
   twopass->kf_group_error_left -= gf_group_err;