From 2e5bbdc8fc9510b34e1d9cf5a475910d992ef2c0 Mon Sep 17 00:00:00 2001 From: Paul Wilkins Date: Thu, 6 Dec 2018 13:34:41 +0000 Subject: [PATCH] Improve rd_variance_adjustment() for low variance blocks. Change the cross over point for switching between per pixel and per block variance numbers when comparing reconstruction and source complexity. This improves the accuracy of the comparison for low variance regions, For example, recon and source may both have an integer per pixel variance of 1, but one of these may actually be be 1.01 and the other 1.99. The reason for using per pixel at all was because this number is already available for the source block so does not need to be recomputed here. Changing the threshold from >0 to >100 for using per pixel values will thus cause a little extra work for some blocks. With my default runs on derf and nf sets their is a net gain as follows: (-ve = better, Overal PSNR, SSIm, PSNR-HVS) derf low res -0.106, -0.107, -0.093 midres -0.000, -0.021, 0.001 hd res -0.198, -0.190, -0.282 nf2k -0.090, -0.088, -0.077 Change-Id: I53ef514fe1c35ee3f08c64e9b22fc05fc7fe5887 --- vp9/encoder/vp9_rdopt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index b55e2dd..84ae130 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -2963,7 +2963,7 @@ static void rd_variance_adjustment(VP9_COMP *cpi, MACROBLOCK *x, #if CONFIG_VP9_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { - if (source_variance > 0) { + if (source_variance > 100) { rec_variance = vp9_high_get_sby_perpixel_variance(cpi, &xd->plane[0].dst, bsize, xd->bd); src_variance = source_variance; @@ -2974,7 +2974,7 @@ static void rd_variance_adjustment(VP9_COMP *cpi, MACROBLOCK *x, vp9_high_get_sby_variance(cpi, &x->plane[0].src, bsize, xd->bd); } } else { - if (source_variance > 0) { + if (source_variance > 100) { rec_variance = vp9_get_sby_perpixel_variance(cpi, &xd->plane[0].dst, bsize); src_variance = source_variance; @@ -2984,7 +2984,7 @@ static void rd_variance_adjustment(VP9_COMP *cpi, MACROBLOCK *x, } } #else - if (source_variance > 0) { + if (source_variance > 100) { rec_variance = vp9_get_sby_perpixel_variance(cpi, &xd->plane[0].dst, bsize); src_variance = source_variance; } else { -- 2.7.4