]> granicus.if.org Git - libvpx/commitdiff
vp8: Add extra conditon for overshoot-drop
authorMarco Paniconi <marpan@google.com>
Mon, 4 Feb 2019 22:49:58 +0000 (14:49 -0800)
committerMarco Paniconi <marpan@google.com>
Mon, 4 Feb 2019 22:57:23 +0000 (14:57 -0800)
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

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

index adc25024cfc8578ed6b26ab875f9d36fa2f55063..9aca0f24b77c4c3a4f487c9b2253c0ebe41529d7 100644 (file)
@@ -3950,6 +3950,7 @@ static void encode_frame_to_data_rate(VP8_COMP *cpi, size_t *size,
 
     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);
index 603de8bcbc2dd8e57a294e7646e97324337e1ce5..5189d43380a4c10548f119758d698e3f1fd60971 100644 (file)
@@ -510,6 +510,7 @@ typedef struct VP8_COMP {
 
   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;
index ce07a6f197f3b2261e5f894b22282f6ae94caf56..d7badeb5a3ccb749d60e18e900b8485731e396b3 100644 (file)
@@ -1484,7 +1484,8 @@ int vp8_drop_encodedframe_overshoot(VP8_COMP *cpi, int Q) {
     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;