From: Yunqing Wang Date: Fri, 26 Jul 2013 02:17:46 +0000 (-0700) Subject: Modify static threshold calculation X-Git-Tag: v1.3.0~734 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52256cdbcaf07e637c964f92671dfc82321f2125;p=libvpx Modify static threshold calculation Used 3 * standard_deviation in internal threshold calculation instead of fit curve. This actually approached the algorithm better. For comparison, similar tests were done: The overall psnr loss is less than before. 1. derf set: when static-thresh = 1, psnr loss is 0.329%; when static-thresh = 500, psnr loss is 0.970%; 2. stdhd set: when static-thresh = 1, psnr loss is 0.922%; when static-thresh = 500, psnr loss is 1.307%; Similar speedup is achieved. For example, clip bitrate static-thresh psnr time akiyo(cif) 500 0 48.952 5.077s(50f) akiyo 500 500 48.866 4.169s(50f) parkjoy(1080p) 4000 0 30.388 78.20s(30f) parkjoy 4000 500 30.367 70.85s(30f) sunflower(1080p) 4000 0 44.402 74.55s(30f) sunflower 4000 500 44.414 68.69s(30f) Change-Id: Ic78833642ce1911dbbd1cb6c899a2d7e2dfcc1f3 --- diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 5383c7fba..619f3e44a 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -3048,14 +3048,10 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, // The encode_breakout input unsigned int encode_breakout = x->encode_breakout << 4; - // Adjust threshold according to dequant value. Making threshold more - // strict when dequant is high to avoid big PSNR loss. - if (xd->plane[0].dequant[1] < 32) - // Initial threshold value - thresh_ac = xd->plane[0].dequant[1] * xd->plane[0].dequant[1]; - else - thresh_ac = (xd->plane[0].dequant[1] << 6) - 1024; + // Calculate threshold according to dequant value. + thresh_ac = (xd->plane[0].dequant[1] * xd->plane[0].dequant[1]) / 9; + // Set a maximum for threshold to avoid big PSNR loss in low bitrate case. if (thresh_ac > 36000) thresh_ac = 36000;