]> granicus.if.org Git - libvpx/commitdiff
Modify static threshold calculation
authorYunqing Wang <yunqingwang@google.com>
Fri, 26 Jul 2013 02:17:46 +0000 (19:17 -0700)
committerYunqing Wang <yunqingwang@google.com>
Fri, 26 Jul 2013 02:59:33 +0000 (19:59 -0700)
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

vp9/encoder/vp9_rdopt.c

index 5383c7fbac30b29dbb05e55fff16b026e592f783..619f3e44ab056de1592d7e2151055d340d0f8e8d 100644 (file)
@@ -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;