[x265] [PATCH] csv: add support for logging latency per frame

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Mon Nov 30 06:42:40 CET 2015


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1448862027 -19800
#      Mon Nov 30 11:10:27 2015 +0530
# Node ID 694caac52b23067b223326f8a5dbb667b906b296
# Parent  687f397dcd65fba080d46b4fd502a8425589cf19
csv: add support for logging latency per frame

diff -r 687f397dcd65 -r 694caac52b23 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Fri Nov 06 12:33:51 2015 +0530
+++ b/source/CMakeLists.txt	Mon Nov 30 11:10:27 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 77)
+set(X265_BUILD 78)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 687f397dcd65 -r 694caac52b23 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Fri Nov 06 12:33:51 2015 +0530
+++ b/source/encoder/encoder.cpp	Mon Nov 30 11:10:27 2015 +0530
@@ -731,7 +731,7 @@
             if (m_aborted)
                 return -1;
 
-            finishFrameStats(outFrame, curEncoder, frameData);
+            finishFrameStats(outFrame, curEncoder, frameData, m_pocLast);
 
             /* Write RateControl Frame level stats in multipass encodes */
             if (m_param->rc.bStatWrite)
@@ -1185,7 +1185,7 @@
      * future safety) */
 }
 
-void Encoder::finishFrameStats(Frame* curFrame, FrameEncoder *curEncoder, x265_frame_stats* frameStats)
+void Encoder::finishFrameStats(Frame* curFrame, FrameEncoder *curEncoder, x265_frame_stats* frameStats, int inPoc)
 {
     PicYuv* reconPic = curFrame->m_reconPic;
     uint64_t bits = curEncoder->m_accessUnitBits;
@@ -1268,6 +1268,7 @@
         frameStats->qp = curEncData.m_avgQpAq;
         frameStats->bits = bits;
         frameStats->bScenecut = curFrame->m_lowres.bScenecut;
+        frameStats->frameLatency = poc - inPoc;
         if (m_param->rc.rateControlMode == X265_RC_CRF)
             frameStats->rateFactor = curEncData.m_rateFactor;
         frameStats->psnrY = psnrY;
diff -r 687f397dcd65 -r 694caac52b23 source/encoder/encoder.h
--- a/source/encoder/encoder.h	Fri Nov 06 12:33:51 2015 +0530
+++ b/source/encoder/encoder.h	Mon Nov 30 11:10:27 2015 +0530
@@ -166,7 +166,7 @@
 
     void writeAnalysisFile(x265_analysis_data* pic);
 
-    void finishFrameStats(Frame* pic, FrameEncoder *curEncoder, x265_frame_stats* frameStats);
+    void finishFrameStats(Frame* pic, FrameEncoder *curEncoder, x265_frame_stats* frameStats, int inPoc);
 
     void calcRefreshInterval(Frame* frameEnc);
 
diff -r 687f397dcd65 -r 694caac52b23 source/x265-extras.cpp
--- a/source/x265-extras.cpp	Fri Nov 06 12:33:51 2015 +0530
+++ b/source/x265-extras.cpp	Mon Nov 30 11:10:27 2015 +0530
@@ -67,7 +67,8 @@
                 if (param.bEnablePsnr)
                     fprintf(csvfp, "Y PSNR, U PSNR, V PSNR, YUV PSNR, ");
                 if (param.bEnableSsim)
-                    fprintf(csvfp, "SSIM, SSIM(dB),");
+                    fprintf(csvfp, "SSIM, SSIM(dB), ");
+                fprintf(csvfp, "Latency, ");
                 fprintf(csvfp, "List 0, List 1");
                 uint32_t size = param.maxCUSize;
                 for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)
@@ -135,6 +136,7 @@
         fprintf(csvfp, "%.3lf, %.3lf, %.3lf, %.3lf,", frameStats->psnrY, frameStats->psnrU, frameStats->psnrV, frameStats->psnr);
     if (param.bEnableSsim)
         fprintf(csvfp, " %.6f, %6.3f,", frameStats->ssim, x265_ssim2dB(frameStats->ssim));
+    fprintf(csvfp, "%d, ", frameStats->frameLatency);
     if (frameStats->sliceType == 'I')
         fputs(" -, -,", csvfp);
     else
diff -r 687f397dcd65 -r 694caac52b23 source/x265.h
--- a/source/x265.h	Fri Nov 06 12:33:51 2015 +0530
+++ b/source/x265.h	Mon Nov 30 11:10:27 2015 +0530
@@ -144,6 +144,7 @@
     uint16_t         maxLumaLevel;
     char             sliceType;
     int              bScenecut;
+    int              frameLatency;
     x265_cu_stats    cuStats;
 } x265_frame_stats;
 


More information about the x265-devel mailing list