[x265] [PATCH] Include elapsed time for encoding each frame in CSV

vignesh at multicorewareinc.com vignesh at multicorewareinc.com
Thu Jan 19 10:13:45 CET 2017


# HG changeset patch
# User Vignesh Vijayakumar <vignesh at multicorewareinc.com>
# Date 1484801689 -19800
#      Thu Jan 19 10:24:49 2017 +0530
# Node ID 5d2e422ca8d125b2cc20ab8282c1e81b5b897d9f
# Parent  20217c8af8acbe8f28cc80cdeb95fba52f0ff3ff
Include elapsed time for encoding each frame in CSV

diff -r 20217c8af8ac -r 5d2e422ca8d1 source/common/frame.cpp
--- a/source/common/frame.cpp	Wed Jan 04 17:48:25 2017 +0530
+++ b/source/common/frame.cpp	Thu Jan 19 10:24:49 2017 +0530
@@ -46,6 +46,7 @@
     m_userSEI.payloads = NULL;
     memset(&m_lowres, 0, sizeof(m_lowres));
     m_rcData = NULL;
+    m_encodeStartTime = 0;
 }
 
 bool Frame::create(x265_param *param, float* quantOffsets)
diff -r 20217c8af8ac -r 5d2e422ca8d1 source/common/frame.h
--- a/source/common/frame.h	Wed Jan 04 17:48:25 2017 +0530
+++ b/source/common/frame.h	Thu Jan 19 10:24:49 2017 +0530
@@ -100,6 +100,8 @@
     x265_analysis_data     m_analysisData;
     x265_analysis_2Pass    m_analysis2Pass;
     RcStats*               m_rcData;
+
+    int64_t                m_encodeStartTime;
     Frame();
 
     bool create(x265_param *param, float* quantOffsets);
diff -r 20217c8af8ac -r 5d2e422ca8d1 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Jan 04 17:48:25 2017 +0530
+++ b/source/encoder/encoder.cpp	Thu Jan 19 10:24:49 2017 +0530
@@ -605,6 +605,7 @@
         if (m_dpb->m_freeList.empty())
         {
             inFrame = new Frame;
+            inFrame->m_encodeStartTime = x265_mdate();
             x265_param* p = m_reconfigure ? m_latestParam : m_param;
             if (inFrame->create(p, pic_in->quantOffsets))
             {
@@ -657,6 +658,7 @@
         else
         {
             inFrame = m_dpb->m_freeList.popBack();
+            inFrame->m_encodeStartTime = x265_mdate();
             /* Set lowres scencut and satdCost here to aovid overwriting ANALYSIS_READ
                decision by lowres init*/
             inFrame->m_lowres.bScenecut = false;
@@ -1542,6 +1544,7 @@
         frameStats->refWaitWallTime = ELAPSED_MSEC(curEncoder->m_row0WaitTime, curEncoder->m_allRowsAvailableTime);
         frameStats->totalCTUTime = ELAPSED_MSEC(0, curEncoder->m_totalWorkerElapsedTime);
         frameStats->stallTime = ELAPSED_MSEC(0, curEncoder->m_totalNoWorkerTime);
+        frameStats->totalFrameTime = ELAPSED_MSEC(curFrame->m_encodeStartTime, x265_mdate());
         if (curEncoder->m_totalActiveWorkerCount)
             frameStats->avgWPP = (double)curEncoder->m_totalActiveWorkerCount / curEncoder->m_activeWorkerCountSamples;
         else
diff -r 20217c8af8ac -r 5d2e422ca8d1 source/x265-extras.cpp
--- a/source/x265-extras.cpp	Wed Jan 04 17:48:25 2017 +0530
+++ b/source/x265-extras.cpp	Thu Jan 19 10:24:49 2017 +0530
@@ -114,7 +114,7 @@
 
                 /* detailed performance statistics */
                 if (level >= 2)
-                    fprintf(csvfp, ", DecideWait (ms), Row0Wait (ms), Wall time (ms), Ref Wait Wall (ms), Total CTU time (ms), Stall Time (ms), Avg WPP, Row Blocks");
+                    fprintf(csvfp, ", DecideWait (ms), Row0Wait (ms), Wall time (ms), Ref Wait Wall (ms), Total CTU time (ms), Stall Time (ms), Total frame time (ms), Avg WPP, Row Blocks");
                 fprintf(csvfp, "\n");
             }
             else
@@ -184,7 +184,7 @@
 
     if (level >= 2)
     {
-        fprintf(csvfp, ", %.1lf, %.1lf, %.1lf, %.1lf, %.1lf, %.1lf,", frameStats->decideWaitTime, frameStats->row0WaitTime, frameStats->wallTime, frameStats->refWaitWallTime, frameStats->totalCTUTime, frameStats->stallTime);
+        fprintf(csvfp, ", %.1lf, %.1lf, %.1lf, %.1lf, %.1lf, %.1lf, %.1lf,", frameStats->decideWaitTime, frameStats->row0WaitTime, frameStats->wallTime, frameStats->refWaitWallTime, frameStats->totalCTUTime, frameStats->stallTime, frameStats->totalFrameTime);
         fprintf(csvfp, " %.3lf, %d", frameStats->avgWPP, frameStats->countRowBlocks);
     }
     fprintf(csvfp, "\n");
diff -r 20217c8af8ac -r 5d2e422ca8d1 source/x265.h
--- a/source/x265.h	Wed Jan 04 17:48:25 2017 +0530
+++ b/source/x265.h	Thu Jan 19 10:24:49 2017 +0530
@@ -139,6 +139,7 @@
     double           refWaitWallTime;
     double           totalCTUTime;
     double           stallTime;
+    double           totalFrameTime;
     double           avgWPP;
     double           avgLumaDistortion;
     double           avgChromaDistortion;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265.patch
Type: text/x-patch
Size: 4373 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20170119/bac4ea73/attachment.bin>


More information about the x265-devel mailing list