[x265] [PATCH 2 of 5] added states for storing ssim values per frame and globally at ecoder level

Aarthi Thirumalai aarthi at multicorewareinc.com
Sat Sep 28 06:52:48 CEST 2013


# HG changeset patch
# User Aarthi Thirumalai
# Date 1380342678 -19800
#      Sat Sep 28 10:01:18 2013 +0530
# Node ID f8684226fc3aa8b94f698381b628412bfa63b6cc
# Parent  0fa415d022c56451e6580c5b2bee793498d986c8
added states for storing ssim values per frame and globally at ecoder level.

diff -r 0fa415d022c5 -r f8684226fc3a source/Lib/TLibCommon/TComSlice.cpp
--- a/source/Lib/TLibCommon/TComSlice.cpp	Sat Sep 28 09:54:14 2013 +0530
+++ b/source/Lib/TLibCommon/TComSlice.cpp	Sat Sep 28 10:01:18 2013 +0530
@@ -128,6 +128,8 @@
     m_cabacInitFlag = false;
     m_numEntryPointOffsets = 0;
     m_enableTMVPFlag = true;
+    m_ssim = 0;
+    m_ssimCnt = 0;
 }
 
 bool TComSlice::getRapPicFlag()
diff -r 0fa415d022c5 -r f8684226fc3a source/Lib/TLibCommon/TComSlice.h
--- a/source/Lib/TLibCommon/TComSlice.h	Sat Sep 28 09:54:14 2013 +0530
+++ b/source/Lib/TLibCommon/TComSlice.h	Sat Sep 28 10:01:18 2013 +0530
@@ -1438,6 +1438,10 @@
     MotionReference * m_mref[2][MAX_NUM_REF + 1];
     wpScalingParam  m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
 
+    /* SSIM values per frame */
+    double m_ssim;
+    int    m_ssimCnt;
+
     TComSlice();
     virtual ~TComSlice();
     void      initSlice();
diff -r 0fa415d022c5 -r f8684226fc3a source/Lib/TLibEncoder/TEncTop.h
--- a/source/Lib/TLibEncoder/TEncTop.h	Sat Sep 28 09:54:14 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncTop.h	Sat Sep 28 10:01:18 2013 +0530
@@ -87,6 +87,7 @@
 
     // quality control
     TComScalingList    m_scalingList;      ///< quantization matrix information
+    double m_globalSsim;
 
 public:
 
@@ -105,6 +106,8 @@
 
     int getStreamHeaders(NALUnitEBSP **nalunits);
 
+    double getSSIM() { return m_globalSsim/m_analyzeAll.getNumPic(); }
+
     double printSummary();
 
     TComScalingList* getScalingList() { return &m_scalingList; }
diff -r 0fa415d022c5 -r f8684226fc3a source/x265.cpp
--- a/source/x265.cpp	Sat Sep 28 09:54:14 2013 +0530
+++ b/source/x265.cpp	Sat Sep 28 10:01:18 2013 +0530
@@ -571,7 +571,8 @@
         fprintf(stderr, "                                                                               \r");
 
     double PSNR = 0.0;
-    x265_encoder_close(encoder, &PSNR);
+    double SSIM = 0.0;
+    x265_encoder_close(encoder, &PSNR , &SSIM);
     cliopt.bitstreamFile.close();
 
     if (b_ctrl_c)
@@ -580,9 +581,14 @@
     double elapsed = (double)(x265_mdate() - cliopt.i_start) / 1000000;
     double vidtime = (double)inFrameCount / param.frameRate;
     double bitrate = (0.008f * cliopt.totalBytes) / vidtime;
-    printf("\nencoded %d frames in %.2fs (%.2f fps), %.2f kb/s, Global PSNR: %.3f\n",
-           outFrameCount, elapsed, outFrameCount / elapsed, bitrate, PSNR);
-
+    printf("\nencoded %d frames in %.2fs (%.2f fps), %.2f kb/s,",
+            outFrameCount, elapsed, outFrameCount / elapsed, bitrate);
+    if(param.bEnablePsnr)
+        printf(" Global PSNR: %.3f\n",
+                PSNR);
+    if(param.bEnableSsim)
+        printf(" Global SSIM: %.3f\n",
+                SSIM);
     x265_cleanup(); /* Free library singletons */
 
     if (cliopt.csvfp)


More information about the x265-devel mailing list