shithub: libvpx

Download patch

ref: 68fbf82ef0150da74470af78be8e2868e4ec2812
parent: e59f78b4842ee46fe5c0d64a47212a0ea5472585
parent: dc6e6fbdcc7aee0d2ff7984e974ae045bd9805c9
author: Paul Wilkins <paulwilkins@google.com>
date: Tue Apr 2 05:39:59 EDT 2019

Merge "Change to thresholding in rd_variance_adjustment()"

--- 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) {