]> granicus.if.org Git - libvpx/commitdiff
Set frames_since_key in vp9_get_coding_frame_num
authorangiebird <angiebird@google.com>
Mon, 9 Dec 2019 19:27:46 +0000 (11:27 -0800)
committerangiebird <angiebird@google.com>
Mon, 9 Dec 2019 22:14:11 +0000 (14:14 -0800)
Set frames_since_key to 0 whenever a key frame appears.

Add dependency notes to get_gop_coding_frame_num()

Change-Id: I41ff04bb1c6176e60946b05fe21c72fbb82be62a

vp9/encoder/vp9_firstpass.c

index d2225f20669db1130297fccc7b497bdf9920cab6..3350cdaf471aa9f0f5cac0a0ade1261de1fbd1af 100644 (file)
@@ -2458,6 +2458,22 @@ typedef struct RANGE {
   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 @@ int vp9_get_coding_frame_num(const VP9EncoderConfig *oxcf,
     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;
     }