From: Paul Wilkins Date: Thu, 28 Feb 2019 16:58:19 +0000 (+0000) Subject: Add block size scaling in rd_variance_adjustment() X-Git-Tag: v1.8.1~173^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b96d2846b16967128fcc674d785b64253f255d0;p=libvpx Add block size scaling in rd_variance_adjustment() Scale the block variance values used in this function to a common block size. Change-Id: I73ad7d48b2621f312d771ee0dd7b6fc59cfc1652 --- diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index a21681c4e..2c54bf5d3 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -3013,6 +3013,8 @@ static void rd_variance_adjustment(VP9_COMP *cpi, MACROBLOCK *x, 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; @@ -3032,6 +3034,10 @@ static void rd_variance_adjustment(VP9_COMP *cpi, MACROBLOCK *x, 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 // pixel (see above) so will likely be much larger.