shithub: libvpx

Download patch

ref: 38a4e46fd3029c903e124c9f47e88063eb7a4018
parent: c33f859615ee467e94adb7bca22e1f3882344e50
author: angiebird <angiebird@google.com>
date: Mon Dec 9 06:27:46 EST 2019

Set frames_since_key in vp9_get_coding_frame_num

Set frames_since_key to 0 whenever a key frame appears.

Add dependency notes to get_gop_coding_frame_num()

Change-Id: I41ff04bb1c6176e60946b05fe21c72fbb82be62a

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2458,6 +2458,22 @@
   int max;
 } RANGE;
 
+/* get_gop_coding_frame_num() depends on several fields in RATE_CONTROL *rc as
+ * follows.
+ * Static fields:
+ * (The following fields will remain unchanged after initialization of encoder.)
+ *   rc->static_scene_max_gf_interval
+ *   rc->min_gf_interval
+ *
+ * Dynamic fields:
+ * (The following fields will be updated before or after coding each frame.)
+ *   rc->frames_to_key
+ *   rc->frames_since_key
+ *   rc->source_alt_ref_active
+ *
+ * TODO(angiebird): Separate the dynamic fields and static fields into two
+ * structs.
+ */
 static int get_gop_coding_frame_num(
     int *use_alt_ref, const FRAME_INFO *frame_info,
     const FIRST_PASS_INFO *first_pass_info, const RATE_CONTROL *rc,
@@ -3675,6 +3691,7 @@
     if (rc.frames_to_key == 0) {
       rc.frames_to_key = vp9_get_frames_to_next_key(
           oxcf, frame_info, first_pass_info, show_idx, rc.min_gf_interval);
+      rc.frames_since_key = 0;
       first_is_key_frame = 1;
     }