changeset 9602:8cbb3771ae92

encoder: protect against logging inf stats if no RDO was performed which mostly can only happen if you CTRL+-C before the lookahead outputs any frames.
author Steve Borho <steve@borho.org>
date Fri, 27 Feb 2015 15:14:20 -0600
parents c19c94af303f
children 6d7b522079b5
files source/encoder/encoder.cpp
diffstat 1 files changed, 26 insertions(+-), 20 deletions(-) [+]
line wrap: on
line diff
--- a/source/encoder/encoder.cpp	Wed Mar 04 08:32:04 2015 -0600
+++ b/source/encoder/encoder.cpp	Fri Feb 27 15:14:20 2015 -0600
@@ -894,27 +894,33 @@ void Encoder::printSummary()
     x265_log(m_param, X265_LOG_INFO, "CU: %%%05.2lf time spent in other tasks\n",
              100.0 * unaccounted / totalWorkerTime);
 
-    x265_log(m_param, X265_LOG_INFO, "CU: Intra RDO time  per depth %%%05.2lf %%%05.2lf %%%05.2lf %%%05.2lf\n",
-             100.0 * cuStats.intraRDOElapsedTime[0] / intraRDOTotalTime,  // 64
-             100.0 * cuStats.intraRDOElapsedTime[1] / intraRDOTotalTime,  // 32
-             100.0 * cuStats.intraRDOElapsedTime[2] / intraRDOTotalTime,  // 16
-             100.0 * cuStats.intraRDOElapsedTime[3] / intraRDOTotalTime); // 8
-    x265_log(m_param, X265_LOG_INFO, "CU: Intra RDO calls per depth %%%05.2lf %%%05.2lf %%%05.2lf %%%05.2lf\n",
-             100.0 * cuStats.countIntraRDO[0] / intraRDOTotalCount,  // 64
-             100.0 * cuStats.countIntraRDO[1] / intraRDOTotalCount,  // 32
-             100.0 * cuStats.countIntraRDO[2] / intraRDOTotalCount,  // 16
-             100.0 * cuStats.countIntraRDO[3] / intraRDOTotalCount); // 8
+    if (intraRDOTotalTime && intraRDOTotalCount)
+    {
+        x265_log(m_param, X265_LOG_INFO, "CU: Intra RDO time  per depth %%%05.2lf %%%05.2lf %%%05.2lf %%%05.2lf\n",
+                 100.0 * cuStats.intraRDOElapsedTime[0] / intraRDOTotalTime,  // 64
+                 100.0 * cuStats.intraRDOElapsedTime[1] / intraRDOTotalTime,  // 32
+                 100.0 * cuStats.intraRDOElapsedTime[2] / intraRDOTotalTime,  // 16
+                 100.0 * cuStats.intraRDOElapsedTime[3] / intraRDOTotalTime); // 8
+        x265_log(m_param, X265_LOG_INFO, "CU: Intra RDO calls per depth %%%05.2lf %%%05.2lf %%%05.2lf %%%05.2lf\n",
+                 100.0 * cuStats.countIntraRDO[0] / intraRDOTotalCount,  // 64
+                 100.0 * cuStats.countIntraRDO[1] / intraRDOTotalCount,  // 32
+                 100.0 * cuStats.countIntraRDO[2] / intraRDOTotalCount,  // 16
+                 100.0 * cuStats.countIntraRDO[3] / intraRDOTotalCount); // 8
+    }
 
-    x265_log(m_param, X265_LOG_INFO, "CU: Inter RDO time  per depth %%%05.2lf %%%05.2lf %%%05.2lf %%%05.2lf\n",
-             100.0 * cuStats.interRDOElapsedTime[0] / interRDOTotalTime,  // 64
-             100.0 * cuStats.interRDOElapsedTime[1] / interRDOTotalTime,  // 32
-             100.0 * cuStats.interRDOElapsedTime[2] / interRDOTotalTime,  // 16
-             100.0 * cuStats.interRDOElapsedTime[3] / interRDOTotalTime); // 8
-    x265_log(m_param, X265_LOG_INFO, "CU: Inter RDO calls per depth %%%05.2lf %%%05.2lf %%%05.2lf %%%05.2lf\n",
-             100.0 * cuStats.countInterRDO[0] / interRDOTotalCount,  // 64
-             100.0 * cuStats.countInterRDO[1] / interRDOTotalCount,  // 32
-             100.0 * cuStats.countInterRDO[2] / interRDOTotalCount,  // 16
-             100.0 * cuStats.countInterRDO[3] / interRDOTotalCount); // 8
+    if (interRDOTotalTime && interRDOTotalCount)
+    {
+        x265_log(m_param, X265_LOG_INFO, "CU: Inter RDO time  per depth %%%05.2lf %%%05.2lf %%%05.2lf %%%05.2lf\n",
+                 100.0 * cuStats.interRDOElapsedTime[0] / interRDOTotalTime,  // 64
+                 100.0 * cuStats.interRDOElapsedTime[1] / interRDOTotalTime,  // 32
+                 100.0 * cuStats.interRDOElapsedTime[2] / interRDOTotalTime,  // 16
+                 100.0 * cuStats.interRDOElapsedTime[3] / interRDOTotalTime); // 8
+        x265_log(m_param, X265_LOG_INFO, "CU: Inter RDO calls per depth %%%05.2lf %%%05.2lf %%%05.2lf %%%05.2lf\n",
+                 100.0 * cuStats.countInterRDO[0] / interRDOTotalCount,  // 64
+                 100.0 * cuStats.countInterRDO[1] / interRDOTotalCount,  // 32
+                 100.0 * cuStats.countInterRDO[2] / interRDOTotalCount,  // 16
+                 100.0 * cuStats.countInterRDO[3] / interRDOTotalCount); // 8
+    }
 
     x265_log(m_param, X265_LOG_INFO, "CU: " X265_LL " %dX%d CTUs compressed in %.3lf seconds, %.3lf CTUs per worker-second\n",
              cuStats.totalCTUs, g_maxCUSize, g_maxCUSize,