shithub: libvpx

Download patch

ref: ca40ca9bed87687eb0b534bf3974c95182dd29a1
parent: ee73384f0304c7e8a84a214ddc8863d40fe716ad
author: Jerome Jiang <jianj@google.com>
date: Wed Sep 8 12:52:51 EDT 2021

vp8 rc: always update correction factor

Change-Id: Id40b9cb5a85a15fb313a2a93f14f6768259f7c15

--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -1910,6 +1910,7 @@
 
   cpi->force_maxqp = 0;
   cpi->frames_since_last_drop_overshoot = 0;
+  cpi->rt_always_update_correction_factor = 0;
 
   cpi->b_calculate_psnr = CONFIG_INTERNAL_STATS;
 #if CONFIG_INTERNAL_STATS
@@ -4445,7 +4446,8 @@
     }
   }
 
-  if (!active_worst_qchanged) vp8_update_rate_correction_factors(cpi, 2);
+  if (cpi->rt_always_update_correction_factor || !active_worst_qchanged)
+    vp8_update_rate_correction_factors(cpi, 2);
 
   cpi->last_q[cm->frame_type] = cm->base_qindex;
 
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -702,6 +702,10 @@
   int use_roi_static_threshold;
 
   int ext_refresh_frame_flags_pending;
+
+  // Always update correction factor used for rate control after each frame for
+  // realtime encoding.
+  int rt_always_update_correction_factor;
 } VP8_COMP;
 
 void vp8_initialize_enc(void);
--- a/vp8/vp8_cx_iface.c
+++ b/vp8/vp8_cx_iface.c
@@ -611,6 +611,7 @@
   const unsigned int data = CAST(VP8E_SET_GF_CBR_BOOST_PCT, args);
   if (data) {
     cpi->cyclic_refresh_mode_enabled = 0;
+    cpi->rt_always_update_correction_factor = 1;
   }
   return VPX_CODEC_OK;
 }