From 9868499e4b6a2f986017c62a5adc6f1933fe992f Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Mon, 10 Sep 2018 11:55:10 -0700 Subject: [PATCH] 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 --- vp9/encoder/vp9_encoder.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 69ab0445c..dae718b99 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -2921,9 +2921,12 @@ static int big_rate_miss(VP9_COMP *cpi) { 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; } -- 2.40.0