[x265] [PATCH] encoder: print global ssim in db

Gopu Govindaswamy gopu at multicorewareinc.com
Wed Dec 18 07:53:52 CET 2013


# HG changeset patch
# User Gopu Govindaswamy <gopu at multicorewareinc.com>
# Date 1387349623 -19800
# Node ID fc7f603d7d106cace9eb34577db4726dec6f1388
# Parent  f16bb88d53318be9c032bef226d50c57abde4f04
encoder: print global ssim in db

diff -r f16bb88d5331 -r fc7f603d7d10 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Dec 18 11:35:40 2013 +0530
+++ b/source/encoder/encoder.cpp	Wed Dec 18 12:23:43 2013 +0530
@@ -1627,3 +1627,14 @@
     destroyROM();
     BitCost::destroy();
 }
+
+extern "C"
+double x265_ssim(double ssim)
+{
+    double inv_ssim = 1 - ssim;
+    if (inv_ssim <= 0.0000000001) /* Max 100dB */
+        return 100;
+
+    return -10.0 * log10(inv_ssim);
+}
+
diff -r f16bb88d5331 -r fc7f603d7d10 source/x265.cpp
--- a/source/x265.cpp	Wed Dec 18 11:35:40 2013 +0530
+++ b/source/x265.cpp	Wed Dec 18 12:23:43 2013 +0530
@@ -684,7 +684,7 @@
             printf(", Global PSNR: %.3f", stats.globalPsnr);
 
         if (param->bEnableSsim)
-            printf(", Global SSIM: %.3f", stats.globalSsim);
+            printf(", SSIM Mean Y: %.7f (%6.3fdb)", stats.globalSsim, x265_ssim(stats.globalSsim));
 
         printf("\n");
     }
diff -r f16bb88d5331 -r fc7f603d7d10 source/x265.h
--- a/source/x265.h	Wed Dec 18 11:35:40 2013 +0530
+++ b/source/x265.h	Wed Dec 18 12:23:43 2013 +0530
@@ -766,6 +766,11 @@
  */
 void x265_cleanup(void);
 
+/***
+ * Convert ssim into db
+ */
+double x265_ssim(double ssim);
+
 #ifdef __cplusplus
 }
 #endif


More information about the x265-devel mailing list