shithub: libvpx

Download patch

ref: f130666dcf49a24cf1a0b4534390f86119448893
parent: b073af5925aabb36a3f4ef6a6760899e041f6ca5
author: Jingning Han <[email protected]>
date: Fri Jul 13 12:05:16 EDT 2018

Set the estimate frame qp in tpl_frame

Assign the estimate frame quantization parameter in the tpl_frame
data structure.

Change-Id: I6149bdb1e15dbdae348f06ff61bf814004462232

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -6139,9 +6139,8 @@
   }
 
   if (arf_src_index && cpi->sf.enable_tpl_model) {
-    setup_tpl_stats(cpi);
     vp9_estimate_qp_gop(cpi);
-    vp9_configure_buffer_updates(cpi, cpi->twopass.gf_group.index);
+    setup_tpl_stats(cpi);
   }
 
   cpi->td.mb.fp_src_pred = 0;
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -297,6 +297,7 @@
   int height;
   int mi_rows;
   int mi_cols;
+  int base_qindex;
 } TplDepFrame;
 
 #define TPL_DEP_COST_SCALE_LOG2 4
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -1441,19 +1441,20 @@
   int gop_length = cpi->rc.baseline_gf_interval;
   int bottom_index, top_index;
   int idx;
-  int q;
   const int gf_index = cpi->twopass.gf_group.index;
 
   for (idx = 1; idx <= gop_length; ++idx) {
+    TplDepFrame *tpl_frame = &cpi->tpl_stats[idx];
     int target_rate = cpi->twopass.gf_group.bit_allocation[idx];
     cpi->twopass.gf_group.index = idx;
     vp9_rc_set_frame_target(cpi, target_rate);
     vp9_configure_buffer_updates(cpi, idx);
-    q = rc_pick_q_and_bounds_two_pass(cpi, &bottom_index, &top_index, idx);
-    (void)q;
+    tpl_frame->base_qindex =
+        rc_pick_q_and_bounds_two_pass(cpi, &bottom_index, &top_index, idx);
   }
-  // Reset the actual index
+  // Reset the actual index and frame update
   cpi->twopass.gf_group.index = gf_index;
+  vp9_configure_buffer_updates(cpi, gf_index);
 }
 
 void vp9_rc_compute_frame_size_bounds(const VP9_COMP *cpi, int frame_target,