ref: 9f1b4bb10dc16a4acc87e4d3f07cf74e9fde23ef
parent: 5f906e92e19fcfc4806d06e704a9358c561028d9
parent: b5cd400e7640273d026cc7c33d4a76c4bef38074
author: Jingning Han <[email protected]>
date: Tue Nov 6 12:10:10 EST 2018
Merge "Refactor define_gf_group_structure()"
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2176,7 +2176,7 @@
}
}
-static int define_gf_group_structure(VP9_COMP *cpi) {
+static void define_gf_group_structure(VP9_COMP *cpi) {
RATE_CONTROL *const rc = &cpi->rc;
TWO_PASS *const twopass = &cpi->twopass;
GF_GROUP *const gf_group = &twopass->gf_group;
@@ -2219,7 +2219,8 @@
gf_group->arf_src_offset[frame_index] = 0;
gf_group->frame_gop_index[frame_index] = rc->baseline_gf_interval;
- return frame_index;
+ gf_group->gf_group_size = frame_index;
+ return;
}
normal_frames =
@@ -2245,7 +2246,7 @@
gf_group->arf_src_offset[frame_index] = 0;
gf_group->frame_gop_index[frame_index] = rc->baseline_gf_interval;
- return frame_index;
+ gf_group->gf_group_size = frame_index;
}
static void allocate_gf_group_bits(VP9_COMP *cpi, int64_t gf_group_bits,
@@ -2270,10 +2271,8 @@
double this_frame_score = 1.0;
// Define the GF structure and specify
- int gop_frames = define_gf_group_structure(cpi);
+ int gop_frames = gf_group->gf_group_size;
- gf_group->gf_group_size = gop_frames;
-
key_frame = cpi->common.frame_type == KEY_FRAME;
// For key frames the frame target rate is already set and it
@@ -2703,6 +2702,9 @@
// Adjust KF group bits and error remaining.
twopass->kf_group_error_left -= gf_group_err;
+
+ // Decide GOP structure.
+ define_gf_group_structure(cpi);
// Allocate bits to each of the frames in the GF group.
allocate_gf_group_bits(cpi, gf_group_bits, gf_arf_bits);