Rescale arf bit budget calculation
authorDeepa K G <deepa.kg@ittiam.com>
Wed, 5 Dec 2018 11:22:49 +0000 (16:52 +0530)
committerDeepa K G <deepa.kg@ittiam.com>
Wed, 5 Dec 2018 11:22:49 +0000 (16:52 +0530)
To compute the total budget for a depth layer, exclude the count of
frames in the current layer.

Change-Id: I9ffd1f63ea597de3ea95e0832b13f5b1f35cb086

vp9/encoder/vp9_firstpass.c

index e29e865..344656d 100644 (file)
@@ -2301,9 +2301,9 @@ static void allocate_gf_group_bits(VP9_COMP *cpi, int64_t gf_group_bits,
 
     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 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
   }
 
   // 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;