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
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;
}