shithub: libvpx

Download patch

ref: d804d8b9644f5ec911b9b756d5e7e7122e113b19
parent: 1e12d19bbfbf4cc5a7ddce394b40f3ba00a4ec15
author: Angie Chiang <angiebird@google.com>
date: Fri Feb 8 12:28:43 EST 2019

Only discount new mv mode when tpl model is ready

Change-Id: I3326f0912627981fd604b16ddbf668d2262d4287

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -2369,6 +2369,7 @@
 
 #if CONFIG_NON_GREEDY_MV
   cpi->feature_score_loc_alloc = 0;
+  cpi->tpl_ready = 0;
 #endif  // CONFIG_NON_GREEDY_MV
   for (i = 0; i < MAX_ARF_GOP_SIZE; ++i) cpi->tpl_stats[i].tpl_stats_ptr = NULL;
 
@@ -6884,6 +6885,7 @@
     mc_flow_dispenser(cpi, gf_picture, frame_idx, cpi->tpl_bsize);
   }
 #if CONFIG_NON_GREEDY_MV
+  cpi->tpl_ready = 1;
 #if DUMP_TPL_STATS
   dump_tpl_stats(cpi, tpl_group_frames, gf_picture, cpi->tpl_bsize);
 #endif  // DUMP_TPL_STATS
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -594,6 +594,7 @@
   YV12_BUFFER_CONFIG *tpl_recon_frames[REF_FRAMES];
   EncFrameBuf enc_frame_buf[REF_FRAMES];
 #if CONFIG_NON_GREEDY_MV
+  int tpl_ready;
   int feature_score_loc_alloc;
   FEATURE_SCORE_LOC *feature_score_loc_arr;
   FEATURE_SCORE_LOC **feature_score_loc_sort;
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2543,7 +2543,7 @@
 #if CONFIG_NON_GREEDY_MV
   (void)mode_mv;
   (void)this_mv;
-  if (this_mode == NEWMV && bsize >= BLOCK_8X8) {
+  if (this_mode == NEWMV && bsize >= BLOCK_8X8 && cpi->tpl_ready) {
     const int gf_group_idx = cpi->twopass.gf_group.index;
     const int gf_rf_idx = ref_frame_to_gf_rf_idx(ref_frame);
     const TplDepFrame tpl_frame = cpi->tpl_stats[gf_group_idx];