]> granicus.if.org Git - libvpx/commitdiff
Disable tpl model in GF-only GOP structure
authorJingning Han <jingning@google.com>
Wed, 14 Nov 2018 22:58:56 +0000 (14:58 -0800)
committerJingning Han <jingning@google.com>
Wed, 14 Nov 2018 22:58:56 +0000 (14:58 -0800)
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

vp9/encoder/vp9_encoder.c

index e269955c11bf396a645cf200716656b8a39b538d..35f5aa32403449f6c9d0af43a72a75136e0c60a2 100644 (file)
@@ -6442,6 +6442,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
   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 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
   }
 
   // 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 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
     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);
   }