shithub: libvpx

Download patch

ref: 66a6cfa5eb36dbc2e48bb154d28b1c229c7468a3
parent: 38eb8e7752da9cc086f7843ecf830c37ba11157e
author: Jingning Han <jingning@google.com>
date: Wed Nov 14 09:58:56 EST 2018

Disable tpl model in GF-only GOP structure

The tpl model assumes a relative short stats buffer length. Hence
it is not ready to support GF-only GOP structure where the max
length can go up to 250. Disable tpl model in such setting to avoid
a rare encode failure in GF-only setting.

Change-Id: I3409dbb829a8105478876684ec21a2bd405c33c8

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -6442,6 +6442,7 @@
   struct lookahead_entry *last_source = NULL;
   struct lookahead_entry *source = NULL;
   int arf_src_index;
+  const int gf_group_index = cpi->twopass.gf_group.index;
   int i;
 
   if (is_one_pass_cbr_svc(cpi)) {
@@ -6489,7 +6490,7 @@
   }
 
   // Clear arf index stack before group of pictures processing starts.
-  if (cpi->twopass.gf_group.index == 1) {
+  if (gf_group_index == 1) {
     stack_init(cpi->twopass.gf_group.arf_index_stack, MAX_LAG_BUFFERS * 2);
     cpi->twopass.gf_group.stack_size = 0;
   }
@@ -6640,7 +6641,9 @@
     for (i = 0; i < REFS_PER_FRAME; ++i) cpi->scaled_ref_idx[i] = INVALID_IDX;
   }
 
-  if (cpi->twopass.gf_group.index == 1 && cpi->sf.enable_tpl_model) {
+  if (gf_group_index == 1 &&
+      cpi->twopass.gf_group.update_type[gf_group_index] == ARF_UPDATE &&
+      cpi->sf.enable_tpl_model) {
     vp9_estimate_qp_gop(cpi);
     setup_tpl_stats(cpi);
   }