]> granicus.if.org Git - libvpx/commitdiff
Change to recode rules.
authorpaulwilkins <paulwilkins@google.com>
Tue, 9 Aug 2016 09:50:33 +0000 (10:50 +0100)
committerpaulwilkins <paulwilkins@google.com>
Mon, 15 Aug 2016 09:52:02 +0000 (10:52 +0100)
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

vp9/encoder/vp9_encoder.c

index 421fcd11560793caaf431cfad8a67c471f822ecd..18bd7df6f40ffe70519a6d310a9762272dad154e 100644 (file)
@@ -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.