shithub: libvpx

Download patch

ref: 9868499e4b6a2f986017c62a5adc6f1933fe992f
parent: 740083a97bb3ef0a11e45977611402a047099cfb
author: Jingning Han <jingning@google.com>
date: Mon Sep 10 07:55:10 EDT 2018

Rework two_pass_first_group_inter()

This function is used to in part decide if to trigger recode loop
for the first normal P frame in a GOP. Rework its design logic to
support the GOP with multi-layer ARF. Allow recode when there is
a transition from ARF/OVERLAY/USE_BUF to normal P frame.

The overall coding performance for multi-ARF gets slightly better
(less than 0.1% for show_existing_frame case). Tested on a few
clips, the encoding speed remains similar too. This change primarily
serves to help integration of multi-layer ARF and dual-ARF systems.

Change-Id: Ia44e44526b05029b1546985b3eb649e767d5444f

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -2921,9 +2921,12 @@
 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;
+  const int gfg_index = gf_group->index;
+
+  if (cpi->oxcf.pass == 2) {
+    if (gfg_index == 0) return gf_group->update_type[gfg_index] == LF_UPDATE;
+    return gf_group->update_type[gfg_index - 1] != LF_UPDATE &&
+           gf_group->update_type[gfg_index] == LF_UPDATE;
   } else {
     return 0;
   }