]> granicus.if.org Git - libvpx/commitdiff
vp8 rc: always update correction factor
authorJerome Jiang <jianj@google.com>
Wed, 8 Sep 2021 23:52:51 +0000 (16:52 -0700)
committerJerome Jiang <jianj@google.com>
Wed, 8 Sep 2021 23:52:51 +0000 (16:52 -0700)
Change-Id: Id40b9cb5a85a15fb313a2a93f14f6768259f7c15

vp8/encoder/onyx_if.c
vp8/encoder/onyx_int.h
vp8/vp8_cx_iface.c

index 71ef057a4ab7786a0e18c08a0141257794616ab6..57c94071b0f934b2476db034a64217469d82b611 100644 (file)
@@ -1910,6 +1910,7 @@ struct VP8_COMP *vp8_create_compressor(VP8_CONFIG *oxcf) {
 
   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 @@ static void encode_frame_to_data_rate(VP8_COMP *cpi, size_t *size,
     }
   }
 
-  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;
 
index b96f9b1dc5bceb5a1cb803a371accee9eb4591a9..a29994a135fa1a1e814f70abcfb1160424787988 100644 (file)
@@ -702,6 +702,10 @@ typedef struct VP8_COMP {
   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);
index 20e18aee7889552e4ceea0a42504eba7f3c62b19..893b7a5132e774de00f9b8eb7eb3f25f432a2b78 100644 (file)
@@ -611,6 +611,7 @@ static vpx_codec_err_t ctrl_set_rtc_external_ratectrl(vpx_codec_alg_priv_t *ctx,
   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;
 }