shithub: libvpx

Download patch

ref: dc6e6fbdcc7aee0d2ff7984e974ae045bd9805c9
parent: 19941fcc116a0b4c31de25ea330b63ea4d0f4912
author: Paul Wilkins <paulwilkins@google.com>
date: Thu Feb 28 12:44:02 EST 2019

Change to thresholding in rd_variance_adjustment()

Always test thresholds using a scaled block variance value.

Source pixel variance no longer used so delete it as a parameter
to the function

Change-Id: I9e251edac6ebb15da98e40dcfa43333fe8b6ba55

--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -3124,8 +3124,7 @@
 
 // This function is designed to apply a bias or adjustment to an rd value based
 // on the relative variance of the source and reconstruction.
-#define VERY_LOW_VAR_THRESH 2
-#define LOW_VAR_THRESH 5
+#define LOW_VAR_THRESH 250
 #define VAR_MULT 250
 static unsigned int max_var_adjust[VP9E_CONTENT_INVALID] = { 16, 16, 250 };
 
@@ -3132,8 +3131,7 @@
 static void rd_variance_adjustment(VP9_COMP *cpi, MACROBLOCK *x,
                                    BLOCK_SIZE bsize, int64_t *this_rd,
                                    struct buf_2d *recon,
-                                   MV_REFERENCE_FRAME ref_frame,
-                                   unsigned int source_variance) {
+                                   MV_REFERENCE_FRAME ref_frame) {
   MACROBLOCKD *const xd = &x->e_mbd;
   unsigned int rec_variance;
   unsigned int src_variance;
@@ -3168,7 +3166,7 @@
   // Lower of source (raw per pixel value) and recon variance. Note that
   // if the source per pixel is 0 then the recon value here will not be per
   // pixel (see above) so will likely be much larger.
-  src_rec_min = VPXMIN(source_variance, rec_variance);
+  src_rec_min = VPXMIN(src_variance, rec_variance);
 
   if (src_rec_min > LOW_VAR_THRESH) return;
 
@@ -3184,7 +3182,7 @@
   *this_rd += (*this_rd * var_factor) / 100;
 
   if (content_type == VP9E_CONTENT_FILM) {
-    if (src_rec_min <= VERY_LOW_VAR_THRESH) {
+    if (src_rec_min <= LOW_VAR_THRESH / 2) {
       if (ref_frame == INTRA_FRAME) *this_rd *= 2;
       if (bsize > BLOCK_16X16) *this_rd *= 2;
     }
@@ -3728,8 +3726,7 @@
     // Apply an adjustment to the rd value based on the similarity of the
     // source variance and reconstructed variance.
     if (recon) {
-      rd_variance_adjustment(cpi, x, bsize, &this_rd, recon, ref_frame,
-                             x->source_variance);
+      rd_variance_adjustment(cpi, x, bsize, &this_rd, recon, ref_frame);
     }
 
     if (ref_frame == INTRA_FRAME) {