[x265] [PATCH 3 of 3] encoder: improve cu statistics logging messages, fix pmode and pme accounting

Steve Borho steve at borho.org
Sun Feb 1 22:20:40 CET 2015


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1422822937 21600
#      Sun Feb 01 14:35:37 2015 -0600
# Node ID 2de50a44d41b4d6cd11116c72bb7c85fef9df016
# Parent  597dd16c40caa50f11cc3f6a53cf5647d7057843
encoder: improve cu statistics logging messages, fix pmode and pme accounting

make the descriptions more precise and in a more useful form, this example was
from a dual core Macbook that has no business using pmode or pme

x265 [info]: CU: Worker threads compressed 9856 64X64 CTUs in 16.559 worker seconds, 595.211 CTUs per second
x265 [info]: CU: %23.29 time spent in motion estimation, averaging 9.726 CU inter modes per CTU
x265 [info]: CU: 0.996 PME masters per inter CU, each blocked an average of 0.340 ns
x265 [info]: CU:       0.017 slaves per PME master, each took an average of 0.041 ms
x265 [info]: CU: %03.97 time spent in intra analysis, averaging 9.515 Intra PUs per CTU
x265 [info]: CU: %16.70 time spent in inter RDO, measuring 20.980 inter/merge predictions per CTU
x265 [info]: CU: %14.03 time spent in intra RDO, measuring 27.478 intra predictions per CTU
x265 [info]: CU: 9.726 PMODE masters per CTU, each blocked an average of 0.293 ns
x265 [info]: CU:       1.622 slaves per PMODE master, each took average of 0.038 ms

diff -r 597dd16c40ca -r 2de50a44d41b source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Sun Feb 01 14:11:58 2015 -0600
+++ b/source/encoder/encoder.cpp	Sun Feb 01 14:35:37 2015 -0600
@@ -821,35 +821,51 @@
 #define ELAPSED_SEC(val)  ((double)(val) / 1000000)
 #define ELAPSED_MSEC(val) ((double)(val) / 1000)
 
-    x265_log(m_param, X265_LOG_INFO, "CU: " X265_LL " %dX%d CTUs in %.3lf seconds, %.3lf CTUs per second\n",
+    int64_t totalWorkerTime = cuStats.totalCTUTime;
+    if (m_param->bDistributeModeAnalysis && cuStats.countPModeMasters)
+        totalWorkerTime += cuStats.pmodeTime;
+    if (m_param->bDistributeMotionEstimation && cuStats.countPMEMasters)
+        totalWorkerTime += cuStats.pmeTime;
+
+    x265_log(m_param, X265_LOG_INFO, "CU: Worker threads compressed " X265_LL " %dX%d CTUs in %.3lf worker seconds, %.3lf CTUs per second\n",
             cuStats.totalCTUs, g_maxCUSize, g_maxCUSize,
-            ELAPSED_SEC(cuStats.totalCTUTime),
-            cuStats.totalCTUs / ELAPSED_SEC(cuStats.totalCTUTime));
-    x265_log(m_param, X265_LOG_INFO, "CU: %%%05.2lf time spend Motion Estimation in " X265_LL " calls\n",
-            100.0 * cuStats.motionEstimationElapsedTime / cuStats.totalCTUTime,
-            cuStats.countMotionEstimate);
-    x265_log(m_param, X265_LOG_INFO, "CU: %%%05.2lf time spend Intra Analysis in " X265_LL " calls\n",
-            100.0 * cuStats.intraAnalysisElapsedTime / cuStats.totalCTUTime,
-            cuStats.countIntraAnalysis);
-    x265_log(m_param, X265_LOG_INFO, "CU: %%%05.2lf time spend Inter RDO in %.3lf calls per CTU\n",
-            100.0 * cuStats.interRDOElapsedTime / cuStats.totalCTUTime,
+            ELAPSED_SEC(totalWorkerTime),
+            cuStats.totalCTUs / ELAPSED_SEC(totalWorkerTime));
+    if (m_param->bDistributeMotionEstimation && cuStats.countPMEMasters)
+    {
+        x265_log(m_param, X265_LOG_INFO, "CU: %%%05.2lf time spent in motion estimation, averaging %.3lf CU inter modes per CTU\n",
+                100.0 * (cuStats.motionEstimationElapsedTime + cuStats.pmeTime) / totalWorkerTime,
+                (double)cuStats.countMotionEstimate / cuStats.totalCTUs);
+        x265_log(m_param, X265_LOG_INFO, "CU: %.3lf PME masters per inter CU, each blocked an average of %.3lf ns\n",
+                (double)cuStats.countPMEMasters / cuStats.countMotionEstimate,
+                (double)cuStats.pmeBlockTime / cuStats.countPMEMasters);
+        x265_log(m_param, X265_LOG_INFO, "CU:       %.3lf slaves per PME master, each took an average of %.3lf ms\n",
+                (double)cuStats.countPMETasks / cuStats.countPMEMasters,
+                ELAPSED_MSEC(cuStats.pmeTime) / cuStats.countPMETasks);
+    }
+    else
+    {
+        x265_log(m_param, X265_LOG_INFO, "CU: %%%05.2lf time spent in motion estimation, averaging %.3lf CU inter modes per CTU\n",
+                100.0 * cuStats.motionEstimationElapsedTime / totalWorkerTime,
+                (double)cuStats.countMotionEstimate / cuStats.totalCTUs);
+    }
+    x265_log(m_param, X265_LOG_INFO, "CU: %%%05.2lf time spent in intra analysis, averaging %.3lf Intra PUs per CTU\n",
+            100.0 * cuStats.intraAnalysisElapsedTime / totalWorkerTime,
+            (double)cuStats.countIntraAnalysis / cuStats.totalCTUs);
+    x265_log(m_param, X265_LOG_INFO, "CU: %%%05.2lf time spent in inter RDO, measuring %.3lf inter/merge predictions per CTU\n",
+            100.0 * cuStats.interRDOElapsedTime / totalWorkerTime,
             (double)cuStats.countInterRDO / cuStats.totalCTUs);
-    x265_log(m_param, X265_LOG_INFO, "CU: %%%05.2lf time spend Intra RDO in %.3lf calls per CTU\n",
-            100.0 * cuStats.intraRDOElapsedTime / cuStats.totalCTUTime,
+    x265_log(m_param, X265_LOG_INFO, "CU: %%%05.2lf time spent in intra RDO, measuring %.3lf intra predictions per CTU\n",
+            100.0 * cuStats.intraRDOElapsedTime / totalWorkerTime,
             (double)cuStats.countIntraRDO / cuStats.totalCTUs);
     if (m_param->bDistributeModeAnalysis && cuStats.countPModeMasters)
     {
-        x265_log(m_param, X265_LOG_INFO, "CU: %d PMode Masters blocked an average of %.3lf ns\n",
-                cuStats.countPModeMasters, cuStats.pmodeBlockTime / cuStats.countPModeMasters);
-        x265_log(m_param, X265_LOG_INFO, "CU: %d PMode Tasks took average of %.3lf ms\n",
-                cuStats.countPModeTasks, ELAPSED_MSEC(cuStats.pmodeTime) / cuStats.countPModeTasks);
-    }
-    if (m_param->bDistributeMotionEstimation && cuStats.countPMEMasters)
-    {
-        x265_log(m_param, X265_LOG_INFO, "CU: %d PME Masters blocked an average of %.3lf ns\n",
-                cuStats.countPMEMasters, cuStats.pmeBlockTime / cuStats.countPMEMasters);
-        x265_log(m_param, X265_LOG_INFO, "CU: %d PME Tasks took average of %.3lf ms\n",
-                cuStats.countPMETasks, ELAPSED_MSEC(cuStats.pmeTime) / cuStats.countPMETasks);
+        x265_log(m_param, X265_LOG_INFO, "CU: %.3lf PMODE masters per CTU, each blocked an average of %.3lf ns\n",
+                (double)cuStats.countPModeMasters / cuStats.totalCTUs,
+                (double)cuStats.pmodeBlockTime / cuStats.countPModeMasters);
+        x265_log(m_param, X265_LOG_INFO, "CU:       %.3lf slaves per PMODE master, each took average of %.3lf ms\n",
+                (double)cuStats.countPModeTasks / cuStats.countPModeMasters, 
+                ELAPSED_MSEC(cuStats.pmodeTime) / cuStats.countPModeTasks);
     }
 
 #undef ELAPSED_SEC


More information about the x265-devel mailing list