shithub: libvpx

Download patch

ref: 2cdc78fc61369c2e9721e1643c26fa70da54acd9
parent: 3248ea0e455aa3a57e9b034d740181d216c99cfb
author: Marco Paniconi <marpan@google.com>
date: Mon Feb 4 09:49:58 EST 2019

vp8: Add extra conditon for overshoot-drop

For drop due to large overshoot feature (in 1 pass CBR):
add additional condition that current prediction error
is larger than that of last encoded frame. This make the
drop due to sudden overshoot more robust, and improves
rate convergence for steady hard content.

Change-Id: If20027d26b4dcd290e4f788ae8e2760d95b536a5

--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -3950,6 +3950,7 @@
 
     if (cpi->pass == 0 && cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) {
       if (vp8_drop_encodedframe_overshoot(cpi, Q)) return;
+      cpi->last_pred_err_mb = (int)(cpi->mb.prediction_error / cpi->common.MBs);
     }
 
     cpi->projected_frame_size -= vp8_estimate_entropy_savings(cpi);
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -510,6 +510,7 @@
 
   int force_maxqp;
   int frames_since_last_drop_overshoot;
+  int last_pred_err_mb;
 
   // GF update for 1 pass cbr.
   int gf_update_onepass_cbr;
--- a/vp8/encoder/ratectrl.c
+++ b/vp8/encoder/ratectrl.c
@@ -1484,7 +1484,8 @@
     if (cpi->drop_frames_allowed && pred_err_mb > (thresh_pred_err_mb << 4))
       thresh_rate = thresh_rate >> 3;
     if ((Q < thresh_qp && cpi->projected_frame_size > thresh_rate &&
-         pred_err_mb > thresh_pred_err_mb) ||
+         pred_err_mb > thresh_pred_err_mb &&
+         pred_err_mb > 2 * cpi->last_pred_err_mb) ||
         force_drop_overshoot) {
       unsigned int i;
       double new_correction_factor;