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

kavitha at multicorewareinc.com kavitha at multicorewareinc.com
Mon Aug 17 08:05:18 CEST 2015


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1439791372 -19800
#      Mon Aug 17 11:32:52 2015 +0530
# Node ID 42d5e1b252fcc1a506d9bdcf97afeee4e4bfd922
# Parent  d56b2466c04459205287e1581d8a36eebf372ba6
stats: log maxCLL and maxFALL values calculated from input pictures

diff -r d56b2466c044 -r 42d5e1b252fc source/CMakeLists.txt
--- a/source/CMakeLists.txt	Wed Aug 12 18:12:20 2015 +0530
+++ b/source/CMakeLists.txt	Mon Aug 17 11:32:52 2015 +0530
@@ -30,7 +30,7 @@
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 70)
+set(X265_BUILD 71)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r d56b2466c044 -r 42d5e1b252fc source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Aug 12 18:12:20 2015 +0530
+++ b/source/encoder/encoder.cpp	Mon Aug 17 11:32:52 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 42d5e1b252fc source/encoder/encoder.h
--- a/source/encoder/encoder.h	Wed Aug 12 18:12:20 2015 +0530
+++ b/source/encoder/encoder.h	Mon Aug 17 11:32:52 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 42d5e1b252fc source/x265-extras.cpp
--- a/source/x265-extras.cpp	Wed Aug 12 18:12:20 2015 +0530
+++ b/source/x265-extras.cpp	Mon Aug 17 11:32:52 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 42d5e1b252fc source/x265.h
--- a/source/x265.h	Wed Aug 12 18:12:20 2015 +0530
+++ b/source/x265.h	Mon Aug 17 11:32:52 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