From: Yaowu Xu Date: Mon, 20 Jun 2011 23:30:26 +0000 (-0700) Subject: adjusting the calculation of errorperbit X-Git-Tag: v0.9.7~77^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=10ed60dc718aa6133508c2fb5183cfc7dc67e920;p=libvpx adjusting the calculation of errorperbit RDMULT/RDDIV defines a bit worth of distortion in term of sum squared difference. This has also been used as errorperbit in subpixel motion search, where the distortions computed as variance of the difference. The variance of differences is different from sum squared differences by amount of DC squared. Typically, for inter predicted MBs, this difference averages around 10% between the two distortion, so this patch introduces a 110% constant in deriving errorperbit from RDMULT/RDDIV. Test on CIF set shows small but positive gain on overall PSNR (.03%) and SSIM (.07%), overall impact on average PSNR is 0. Change-Id: I95425f922d037b4d96083064a10c7cdd4948ee62 --- diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index 892284ed2..132e50858 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -335,7 +335,8 @@ void vp8_activity_masking(VP8_COMP *cpi, MACROBLOCK *x) { #if USE_ACT_INDEX x->rdmult += *(x->mb_activity_ptr) * (x->rdmult >> 2); - x->errorperbit = x->rdmult/x->rddiv; + x->errorperbit = x->rdmult * 100 /(110 * x->rddiv); + x->errorperbit += (x->errorperbit==0); #else INT64 a; INT64 b; @@ -346,8 +347,8 @@ void vp8_activity_masking(VP8_COMP *cpi, MACROBLOCK *x) b = (2*act) + cpi->activity_avg; x->rdmult = (unsigned int)(((INT64)x->rdmult*b + (a>>1))/a); - x->errorperbit = x->rdmult/x->rddiv; - + x->errorperbit = x->rdmult * 100 /(110 * x->rddiv); + x->errorperbit += (x->errorperbit==0); #endif // Activity based Zbin adjustment diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index 5ce61a04e..e05ffdb1a 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -238,7 +238,7 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int Qvalue) (cpi->RDMULT * rd_iifactor[cpi->twopass.next_iiratio]) >> 4; } - cpi->mb.errorperbit = (cpi->RDMULT / 100); + cpi->mb.errorperbit = (cpi->RDMULT / 110); cpi->mb.errorperbit += (cpi->mb.errorperbit==0); vp8_set_speed_features(cpi);