]> granicus.if.org Git - libvpx/commitdiff
Set the estimate frame qp in tpl_frame
authorJingning Han <jingning@google.com>
Fri, 13 Jul 2018 23:05:16 +0000 (16:05 -0700)
committerJingning Han <jingning@google.com>
Fri, 13 Jul 2018 23:05:16 +0000 (16:05 -0700)
Assign the estimate frame quantization parameter in the tpl_frame
data structure.

Change-Id: I6149bdb1e15dbdae348f06ff61bf814004462232

vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_encoder.h
vp9/encoder/vp9_ratectrl.c

index 40ccc5bc9f3fd7dae54f2667773d15cdf2cadc06..b74fda8bbfd1625344090059627a2e2eb05fea51 100644 (file)
@@ -6139,9 +6139,8 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
   }
 
   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;
index d80aa4ae9534dc55c58511589d9de22f2247c5e5..7cacc3236c105048a23ecc0823b2575e1e2b7dfb 100644 (file)
@@ -297,6 +297,7 @@ typedef struct TplDepFrame {
   int height;
   int mi_rows;
   int mi_cols;
+  int base_qindex;
 } TplDepFrame;
 
 #define TPL_DEP_COST_SCALE_LOG2 4
index eb398e251c12dac75d6293ab364c34579f550ab6..a66dae5d0322f8dbfa5571bdf8287966102de986 100644 (file)
@@ -1441,19 +1441,20 @@ void vp9_estimate_qp_gop(VP9_COMP *cpi) {
   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,