]> granicus.if.org Git - libvpx/commitdiff
Make initial q_index guess at 128
authorangiebird <angiebird@google.com>
Wed, 5 Aug 2020 20:44:01 +0000 (13:44 -0700)
committerangiebird <angiebird@google.com>
Thu, 6 Aug 2020 22:45:12 +0000 (15:45 -0700)
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

vp9/encoder/vp9_encoder.c

index 7985e18d806e33fd647c5c016d3aea62669892bd..169cd190eb511ff8e7333ba71182d2b7569907e0 100644 (file)
@@ -4265,7 +4265,7 @@ static double get_bits_percent_diff(int target_bits, int actual_bits) {
 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 @@ static void encode_with_recode_loop(VP9_COMP *cpi, size_t *size,
     }
 
 #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.