From: paulwilkins Date: Tue, 9 Aug 2016 09:50:33 +0000 (+0100) Subject: Change to recode rules. X-Git-Tag: v1.6.1~325 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=de3b769524a662f14833300d8ab28226389b3a30;p=libvpx 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 --- diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 421fcd115..18bd7df6f 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -2394,6 +2394,17 @@ static int big_rate_miss(VP9_COMP *cpi, int high_limit, int low_limit) { (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 @@ static int recode_loop_test(VP9_COMP *cpi, int high_limit, int low_limit, int q, 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.