ref: de3b769524a662f14833300d8ab28226389b3a30
parent: fe4dd4f43ff6bddf923bd3fb104b7b2516c24838
author: paulwilkins <[email protected]>
date: Tue Aug 9 06:50:33 EDT 2016
Change to recode rules. Allow recodes for the first inter frame in each arf group even when the recode rule is set to ALLOW_RECODE_KFARFGF. Small gains of 0.05%. Change-Id: I40cb559d36a2bf0ebf5cf758c3f92e452b480577
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -2394,6 +2394,17 @@
(rc->projected_frame_size < (low_limit / 2));
}
+// test in two pass for the first
+static int two_pass_first_group_inter(VP9_COMP *cpi) {
+ TWO_PASS *const twopass = &cpi->twopass;
+ GF_GROUP *const gf_group = &twopass->gf_group;
+ if ((cpi->oxcf.pass == 2) &&
+ (gf_group->index == gf_group->first_inter_index))
+ return 1;
+ else
+ return 0;
+}
+
// Function to test for conditions that indicate we should loop
// back and recode a frame.
static int recode_loop_test(VP9_COMP *cpi, int high_limit, int low_limit, int q,
@@ -2406,7 +2417,8 @@
if ((rc->projected_frame_size >= rc->max_frame_bandwidth) ||
big_rate_miss(cpi, high_limit, low_limit) ||
(cpi->sf.recode_loop == ALLOW_RECODE) ||
- (frame_is_kfgfarf && (cpi->sf.recode_loop == ALLOW_RECODE_KFARFGF))) {
+ ((frame_is_kfgfarf || two_pass_first_group_inter(cpi)) &&
+ (cpi->sf.recode_loop == ALLOW_RECODE_KFARFGF))) {
if (frame_is_kfgfarf && (oxcf->resize_mode == RESIZE_DYNAMIC) &&
scale_down(cpi, q)) {
// Code this group at a lower resolution.