shithub: libvpx

Download patch

ref: 67556170bf6c43c151c0e3ca1da43f401753e7bb
parent: 5a2b1962a4e23a65eab63cf79e94877abe5724c8
parent: 9b96d2846b16967128fcc674d785b64253f255d0
author: Paul Wilkins <paulwilkins@google.com>
date: Wed Mar 20 07:41:39 EDT 2019

Merge "Add block size scaling in rd_variance_adjustment()"

--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -3013,6 +3013,8 @@
   unsigned int absvar_diff = 0;
   unsigned int var_factor = 0;
   unsigned int adj_max;
+  const int bw = num_8x8_blocks_wide_lookup[bsize];
+  const int bh = num_8x8_blocks_high_lookup[bsize];
   vp9e_tune_content content_type = cpi->oxcf.content;
 
   if (*this_rd == INT64_MAX) return;
@@ -3031,6 +3033,10 @@
   rec_variance = vp9_get_sby_variance(cpi, &xd->plane[0].dst, bsize);
   src_variance = vp9_get_sby_variance(cpi, &x->plane[0].src, bsize);
 #endif  // CONFIG_VP9_HIGHBITDEPTH
+
+  // Scale based on area in 8x8 blocks
+  rec_variance /= (bw * bh);
+  src_variance /= (bw * bh);
 
   // 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