From 38a4e46fd3029c903e124c9f47e88063eb7a4018 Mon Sep 17 00:00:00 2001 From: angiebird Date: Mon, 9 Dec 2019 11:27:46 -0800 Subject: [PATCH] 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 --- vp9/encoder/vp9_firstpass.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index d2225f206..3350cdaf4 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -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; } -- 2.40.0