]> granicus.if.org Git - libvpx/commitdiff
Use compute_arf_boost() in define_gf_group()
authorangiebird <angiebird@google.com>
Tue, 15 Oct 2019 21:41:07 +0000 (14:41 -0700)
committerangiebird <angiebird@google.com>
Wed, 16 Oct 2019 18:38:45 +0000 (11:38 -0700)
Remove reset_fpf_position() because
compute_arf_boost does not count on twopass->stats_in

Change-Id: I560dccfcc4a2cbaa8e78a493a070a416465db4a9

vp9/encoder/vp9_firstpass.c

index 8d2152a5c5d42ab5d521bb60516d5e502dc8d707..d1e26b5230b254ba4ea7b2190f555715e5550bb1 100644 (file)
@@ -2694,8 +2694,16 @@ static void define_gf_group(VP9_COMP *cpi, int gf_start_show_idx) {
                           b_frames, avg_inter_frame_qindex);
     rc->source_alt_ref_pending = 1;
   } else {
-    reset_fpf_position(twopass, start_pos);
-    rc->gfu_boost = VPXMIN(MAX_GF_BOOST, calc_arf_boost(cpi, (i - 1), 0));
+    const int f_frames = i - 1;
+    const int b_frames = 0;
+    const int avg_inter_frame_qindex = rc->avg_frame_qindex[INTER_FRAME];
+    // TODO(angiebird): figure out why arf's location is assigned this way
+    const int gld_show_idx =
+        VPXMIN(gf_start_show_idx + 1, fps_get_num_frames(first_pass_info));
+    const int arf_boost =
+        compute_arf_boost(frame_info, first_pass_info, gld_show_idx, f_frames,
+                          b_frames, avg_inter_frame_qindex);
+    rc->gfu_boost = VPXMIN(MAX_GF_BOOST, arf_boost);
     rc->source_alt_ref_pending = 0;
   }
 
@@ -2740,9 +2748,6 @@ static void define_gf_group(VP9_COMP *cpi, int gf_start_show_idx) {
 
   rc->baseline_gf_interval = i - rc->source_alt_ref_pending;
 
-  // Reset the file position.
-  reset_fpf_position(twopass, start_pos);
-
   if (rc->source_alt_ref_pending)
     is_alt_ref_flash = detect_flash(twopass, rc->baseline_gf_interval);