[x265] [PATCH] stats: log maxCLL and maxFALL values calculated from input pictures

kavitha at multicorewareinc.com kavitha at multicorewareinc.com
Fri Aug 14 15:17:54 CEST 2015


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1439558256 -19800
#      Fri Aug 14 18:47:36 2015 +0530
# Node ID 7a288de3f26e1d0e3a461c16239e2eab41c64f2e
# Parent  d56b2466c04459205287e1581d8a36eebf372ba6
stats: log maxCLL and maxFALL values calculated from input pictures

diff -r d56b2466c044 -r 7a288de3f26e source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Aug 12 18:12:20 2015 +0530
+++ b/source/encoder/encoder.cpp	Fri Aug 14 18:47:36 2015 +0530
@@ -1038,6 +1038,9 @@
         stats->statsB.psnrU   = m_analyzeB.m_psnrSumU / (double)m_analyzeB.m_numPics;
         stats->statsB.psnrV   = m_analyzeB.m_psnrSumV / (double)m_analyzeB.m_numPics;
         stats->statsB.ssim    = x265_ssim2dB(m_analyzeB.m_globalSsim / (double)m_analyzeB.m_numPics);
+
+        stats->maxCLL         = m_analyzeAll.m_maxCLL;
+        stats->maxFALL        = (uint16_t)(m_analyzeAll.m_maxFALL / m_analyzeAll.m_numPics);
     }
 
     /* If new statistics are added to x265_stats, we must check here whether the
@@ -1111,6 +1114,9 @@
             m_analyzeB.addSsim(ssim);
     }
 
+    m_analyzeAll.m_maxFALL += curFrame->m_fencPic->m_avgLumaLevel;
+    m_analyzeAll.m_maxCLL = X265_MAX(m_analyzeAll.m_maxCLL, curFrame->m_fencPic->m_maxLumaLevel);
+
     char c = (slice->isIntra() ? 'I' : slice->isInterP() ? 'P' : 'B');
     int poc = slice->m_poc;
     if (!IS_REFERENCED(curFrame))
diff -r d56b2466c044 -r 7a288de3f26e source/encoder/encoder.h
--- a/source/encoder/encoder.h	Wed Aug 12 18:12:20 2015 +0530
+++ b/source/encoder/encoder.h	Fri Aug 14 18:47:36 2015 +0530
@@ -47,6 +47,8 @@
     double        m_totalQp;
     uint64_t      m_accBits;
     uint32_t      m_numPics;
+    uint16_t      m_maxCLL;
+    double        m_maxFALL;
 
     EncStats()
     {
@@ -54,6 +56,8 @@
         m_accBits = 0;
         m_numPics = 0;
         m_totalQp = 0;
+        m_maxCLL = 0;
+        m_maxFALL = 0;
     }
 
     void addQP(double aveQp);
diff -r d56b2466c044 -r 7a288de3f26e source/x265-extras.cpp
--- a/source/x265-extras.cpp	Wed Aug 12 18:12:20 2015 +0530
+++ b/source/x265-extras.cpp	Fri Aug 14 18:47:36 2015 +0530
@@ -36,7 +36,7 @@
     "I count, I ave-QP, I kbps, I-PSNR Y, I-PSNR U, I-PSNR V, I-SSIM (dB), "
     "P count, P ave-QP, P kbps, P-PSNR Y, P-PSNR U, P-PSNR V, P-SSIM (dB), "
     "B count, B ave-QP, B kbps, B-PSNR Y, B-PSNR U, B-PSNR V, B-SSIM (dB), "
-    "Version\n";
+    "MaxCLL, MaxFALL, Version\n";
 
 FILE* x265_csvlog_open(const x265_api& api, const x265_param& param, const char* fname, int level)
 {
@@ -273,7 +273,7 @@
     else
         fprintf(csvfp, " -, -, -, -, -, -, -,");
 
-    fprintf(csvfp, " %s\n", api.version_str);
+    fprintf(csvfp, " %-6u, %-6u, %s\n", stats.maxCLL, stats.maxFALL, api.version_str);
 }
 
 /* The dithering algorithm is based on Sierra-2-4A error diffusion. */
diff -r d56b2466c044 -r 7a288de3f26e source/x265.h
--- a/source/x265.h	Wed Aug 12 18:12:20 2015 +0530
+++ b/source/x265.h	Fri Aug 14 18:47:36 2015 +0530
@@ -385,6 +385,8 @@
     x265_sliceType_stats  statsI;               /* statistics of I slice */
     x265_sliceType_stats  statsP;               /* statistics of P slice */
     x265_sliceType_stats  statsB;               /* statistics of B slice */
+    uint16_t              maxCLL;               /* maximum content light level */
+    uint16_t              maxFALL;              /* maximum frame average light level */
 } x265_stats;
 
 /* String values accepted by x265_param_parse() (and CLI) for various parameters */


More information about the x265-devel mailing list