shithub: libvpx

Download patch

ref: e6bfdce30df73cd2f86c16d010b5430ed14ed090
parent: 76d9afc349fec0d1edc4d674daaca89b6c8c9c90
author: sdeng <[email protected]>
date: Mon Nov 18 06:33:22 EST 2019

Use a better model for tune=ssim

Comparing to the baseline tune=ssim, the average gains are
PSNR -0.55, SSIM -0.30, MS-SSIM -0.98, VMAF -1.26

Details: (150f VBR)
               PSNR    SSIM  MS-SSIM    VMAF
Lowres       -1.347   0.291   -0.307  -1.291
Midres       -0.628  -0.329   -1.011  -2.173
Hdres         0.781  -0.656   -1.319   0.210
Ugc360p      -2.695  -0.972   -1.503  -4.055
Lowres_bd10   0.074   0.196   -0.623  -0.835
Midres_bd10   0.517  -0.327   -1.124   0.566

Change-Id: Ie034eaedf20e1fe843921cafbb3b7ad9a2bc89d1

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -4863,17 +4863,6 @@
   }
 }
 
-// Implementation and modifications of C. Yeo, H. L. Tan, and Y. H. Tan, "On
-// rate distortion optimization using SSIM," Circuits and Systems for Video
-// Technology, IEEE Transactions on, vol. 23, no. 7, pp. 1170-1181, 2013.
-// SSIM_VAR_SCALE defines the strength of the bias towards SSIM in RDO.
-// Some sample values are:
-// (for midres test set)
-// SSIM_VAR_SCALE  avg_psnr   ssim   ms_ssim
-//      8.0          9.421   -5.537  -6.898
-//     16.0          4.703   -5.378  -6.238
-//     32.0          1.929   -4.308  -4.807
-#define SSIM_VAR_SCALE 16.0
 static void set_mb_ssim_rdmult_scaling(VP9_COMP *cpi) {
   VP9_COMMON *cm = &cpi->common;
   ThreadData *td = &cpi->td;
@@ -4890,8 +4879,6 @@
   double log_sum = 0.0;
   int row, col;
 
-  const double c2 = 58.5225 * SSIM_VAR_SCALE;  // 58.5225 = (.03*255)^2
-
   // Loop through each 64x64 block.
   for (row = 0; row < num_rows; ++row) {
     for (col = 0; col < num_cols; ++col) {
@@ -4925,7 +4912,10 @@
         }
       }
       var = var / num_of_var / 64.0;
-      var = 2.0 * var + c2;
+
+      // Curve fitting with an exponential model on all 16x16 blocks from the
+      // Midres dataset.
+      var = 67.035434 * (1 - exp(-0.0021489 * var)) + 17.492222;
       cpi->mi_ssim_rdmult_scaling_factors[index] = var;
       log_sum += log(var);
     }