shithub: libvpx

Download patch

ref: e3ae48b861d18badb414c8fbe201e5c4aafb5180
parent: 927fad48472b969065226e6e727e5e7670d2ff68
author: angiebird <angiebird@google.com>
date: Wed Aug 5 09:44:01 EDT 2020

Make initial q_index guess at 128

This reduce the average recode times per frame from 2.81 to 2.73
when targeting 15% error for target bitrate per frame.

Change-Id: I58f0be86443643ba23623cb1d522ae41897734a3

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -4265,7 +4265,7 @@
 static int rq_model_predict_q_index(const RATE_QSTEP_MODEL *rq_model,
                                     const RATE_QINDEX_HISTORY *rq_history,
                                     int target_bits) {
-  int q_index = -1;
+  int q_index = 128;
   if (rq_history->recode_count > 0) {
     const int actual_bits =
         rq_history->rate_history[rq_history->recode_count - 1];
@@ -4405,12 +4405,9 @@
     }
 
 #if CONFIG_RATE_CTRL
-    {
-      const int suggested_q_index = rq_model_predict_q_index(
-          rq_model, &rq_history, rc->this_frame_target);
-      if (suggested_q_index != -1) {
-        q = suggested_q_index;
-      }
+    if (cpi->encode_command.use_external_target_frame_bits) {
+      q = rq_model_predict_q_index(rq_model, &rq_history,
+                                   rc->this_frame_target);
     }
 #endif  // CONFIG_RATE_CTRL
     // Decide frame size bounds first time through.