shithub: libvpx

Download patch

ref: 6fc07a217da53554e56321ead7437cc67f627492
parent: 66b2266a221a619ba87600310143229f09c46511
author: paulwilkins <[email protected]>
date: Mon Aug 8 11:08:21 EDT 2016

Modified resize loop constraints.

Using a tighter resize constraint on undershoot seems to help
results (especially SSIM) as significant undershoot on a frame
seems to have more of a damaging impact than overshoot.

This patch has been tuned so that in local testing using the
derf set it is encode speed neutral for speed  setting 2.

Average quality result for speed 2 (psnr,ssim) were  as follows:-

 lowres  0.039,  0.453
 midres  0.249, 0.853
 hdres  0.159, 0.659
 NetFlix -0.241, 0.360

Change-Id: Ie8d3a0d7d6f7ea89d9965d1821be17f8bda85062

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -1233,10 +1233,11 @@
   } else {
     // For very small rate targets where the fractional adjustment
     // may be tiny make sure there is at least a minimum range.
-    const int tolerance = (cpi->sf.recode_tolerance * frame_target) / 100;
-    *frame_under_shoot_limit = VPXMAX(frame_target - tolerance - 200, 0);
+    const int tol_low = (cpi->sf.recode_tolerance_low * frame_target) / 100;
+    const int tol_high = (cpi->sf.recode_tolerance_high * frame_target) / 100;
+    *frame_under_shoot_limit = VPXMAX(frame_target - tol_low - 100, 0);
     *frame_over_shoot_limit =
-        VPXMIN(frame_target + tolerance + 200, cpi->rc.max_frame_bandwidth);
+        VPXMIN(frame_target + tol_high + 100, cpi->rc.max_frame_bandwidth);
   }
 }
 
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -187,6 +187,9 @@
     sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V;
     sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V;
     sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V;
+
+    sf->recode_tolerance_low = 15;
+    sf->recode_tolerance_high = 30;
   }
 
   if (speed >= 2) {
@@ -206,6 +209,8 @@
     sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
     sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX;
     sf->allow_partition_search_skip = 1;
+    sf->recode_tolerance_low = 15;
+    sf->recode_tolerance_high = 45;
   }
 
   if (speed >= 3) {
@@ -608,7 +613,8 @@
   sf->search_type_check_frequency = 50;
   sf->encode_breakout_thresh = 0;
   // Recode loop tolerance %.
-  sf->recode_tolerance = 25;
+  sf->recode_tolerance_low = 12;
+  sf->recode_tolerance_high = 25;
   sf->default_interp_filter = SWITCHABLE;
   sf->simple_model_rd_from_var = 0;
   sf->short_circuit_flat_blocks = 0;
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -403,7 +403,8 @@
 
   // This feature controls the tolerence vs target used in deciding whether to
   // recode a frame. It has no meaning if recode is disabled.
-  int recode_tolerance;
+  int recode_tolerance_low;
+  int recode_tolerance_high;
 
   // This variable controls the maximum block size where intra blocks can be
   // used in inter frames.