[x265] [PATCH] csv: add scenecut information and improve docs

bhavna at multicorewareinc.com bhavna at multicorewareinc.com
Fri Jun 2 15:10:09 CEST 2017


# HG changeset patch
# User Bhavna Hariharan <bhavna at multicorewareinc.com>
# Date 1496390566 -19800
#      Fri Jun 02 13:32:46 2017 +0530
# Node ID 4f0d56f5faf7eeba55a97f276e4af2f147258522
# Parent  f850cdbe381c196758fd445a367487416fef62f9
csv: add scenecut information and improve docs

diff -r f850cdbe381c -r 4f0d56f5faf7 doc/reST/cli.rst
--- a/doc/reST/cli.rst	Tue May 23 12:42:54 2017 +0530
+++ b/doc/reST/cli.rst	Fri Jun 02 13:32:46 2017 +0530
@@ -83,9 +83,45 @@
 	it adds one line per run. If :option:`--csv-log-level` is greater than
 	0, it writes one line per frame. Default none
 
+	The following statistics are available when :option:`--csv-log-level` is
+	greater than or	equal to 1:
+	
+	**Encode Order** The frame order in which the encoder encodes.
+	
+	**Type** Slice type of the frame.
+	
+	**POC** Picture Order Count - The display order of the frames. 
+	
+	**QP** Quantization Parameter decided for the frame. 
+	
+	**Bits** Number of bits consumed by the frame.
+	
+	**Scenecut** 1 if the frame is a scenecut, 0 otherwise. 
+	
+	**RateFactor** Applicable only when CRF is enabled. The rate factor depends
+	on the CRF given by the user. This is used to determine the QP so as to 
+	target a certain quality.
+	
+	**BufferFill** Bits available for the next frame. Includes bits carried
+	over from the current frame.
+	
+	**Latency** Latency in terms of number of frames between when the frame 
+	was given in and when the frame is given out.
+	
+	**PSNR** Peak signal to noise ratio for Y, U and V planes.
+	
+	**SSIM** A quality metric that denotes the structural similarity between frames.
+	
+	**Ref lists** POC of references in lists 0 and 1 for the frame.
+	
 	Several statistics about the encoded bitstream and encoder performance are 
 	available when :option:`--csv-log-level` is greater than or equal to 2:
 	
+	**I/P cost ratio:** The ratio between the cost when a frame is decided as an
+	I frame to that when it is decided as a P frame as computed from the 
+	quarter-resolution frame in look-ahead. This, in combination with other parameters
+	such as position of the frame in the GOP, is used to decide scene transitions.
+	
 	**Analysis statistics:**
 	
 	**CU Statistics** percentage of CU modes.
@@ -132,6 +168,8 @@
 	**Stall Time ms** the number of milliseconds of the reported wall
 	time that were spent with zero worker threads, aka all compression
 	was completely stalled.
+	
+	**Total frame time** Total time spent to encode the frame.
 
 	**Avg WPP** the average number of worker threads working on this
 	frame, at any given time. This value is sampled at the completion of
diff -r f850cdbe381c -r 4f0d56f5faf7 source/common/framedata.h
--- a/source/common/framedata.h	Tue May 23 12:42:54 2017 +0530
+++ b/source/common/framedata.h	Fri Jun 02 13:32:46 2017 +0530
@@ -62,6 +62,7 @@
     double      percentMergeCu[NUM_CU_DEPTH];
     double      percentIntraDistribution[NUM_CU_DEPTH][INTRA_MODES];
     double      percentInterDistribution[NUM_CU_DEPTH][3];           // 2Nx2N, RECT, AMP modes percentage
+    double      ipCostRatio;
 
     uint64_t    cntIntraNxN;
     uint64_t    totalCu;
diff -r f850cdbe381c -r 4f0d56f5faf7 source/common/lowres.h
--- a/source/common/lowres.h	Tue May 23 12:42:54 2017 +0530
+++ b/source/common/lowres.h	Fri Jun 02 13:32:46 2017 +0530
@@ -118,6 +118,8 @@
     bool   bKeyframe;
     bool   bLastMiniGopBFrame;
 
+    double ipCostRatio;
+
     /* lookahead output data */
     int64_t   costEst[X265_BFRAME_MAX + 2][X265_BFRAME_MAX + 2];
     int64_t   costEstAq[X265_BFRAME_MAX + 2][X265_BFRAME_MAX + 2];
diff -r f850cdbe381c -r 4f0d56f5faf7 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Tue May 23 12:42:54 2017 +0530
+++ b/source/encoder/encoder.cpp	Fri Jun 02 13:32:46 2017 +0530
@@ -1723,6 +1723,7 @@
         frameStats->qp = curEncData.m_avgQpAq;
         frameStats->bits = bits;
         frameStats->bScenecut = curFrame->m_lowres.bScenecut;
+        frameStats->ipCostRatio = curFrame->m_lowres.ipCostRatio;
         frameStats->bufferFill = m_rateControl->m_bufferFillActual;
         frameStats->frameLatency = inPoc - poc;
         if (m_param->rc.rateControlMode == X265_RC_CRF)
diff -r f850cdbe381c -r 4f0d56f5faf7 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Tue May 23 12:42:54 2017 +0530
+++ b/source/encoder/slicetype.cpp	Fri Jun 02 13:32:46 2017 +0530
@@ -1638,6 +1638,13 @@
             m_isSceneTransition = false; /* Signal end of scene transitioning */
     }
 
+    if (m_param->logLevel >= 2)
+    {
+        int64_t icost = frames[p1]->costEst[0][0];
+        int64_t pcost = frames[p1]->costEst[p1 - p0][0];
+        frames[p1]->ipCostRatio = (double)icost / pcost;
+    }
+
     /* A frame is always analysed with bRealScenecut = true first, and then bRealScenecut = false,
        the former for I decisions and the latter for P/B decisions. It's possible that the first 
        analysis detected scenecuts which were later nulled due to scene transitioning, in which 
diff -r f850cdbe381c -r 4f0d56f5faf7 source/x265-extras.cpp
--- a/source/x265-extras.cpp	Tue May 23 12:42:54 2017 +0530
+++ b/source/x265-extras.cpp	Fri Jun 02 13:32:46 2017 +0530
@@ -62,6 +62,8 @@
             if (level)
             {
                 fprintf(csvfp, "Encode Order, Type, POC, QP, Bits, Scenecut, ");
+                if (level >= 2)
+                    fprintf(csvfp, "I/P cost ratio, ");
                 if (param.rc.rateControlMode == X265_RC_CRF)
                     fprintf(csvfp, "RateFactor, ");
                 if (param.rc.vbvBufferSize)
@@ -159,6 +161,8 @@
     const x265_frame_stats* frameStats = &pic.frameData;
     fprintf(csvfp, "%d, %c-SLICE, %4d, %2.2lf, %10d, %d,", frameStats->encoderOrder, frameStats->sliceType, frameStats->poc, 
                                                            frameStats->qp, (int)frameStats->bits, frameStats->bScenecut);
+    if (level >= 2)
+        fprintf(csvfp, "%.2f,", frameStats->ipCostRatio);
     if (param.rc.rateControlMode == X265_RC_CRF)
         fprintf(csvfp, "%.3lf,", frameStats->rateFactor);
     if (param.rc.vbvBufferSize)
diff -r f850cdbe381c -r 4f0d56f5faf7 source/x265.h
--- a/source/x265.h	Tue May 23 12:42:54 2017 +0530
+++ b/source/x265.h	Fri Jun 02 13:32:46 2017 +0530
@@ -181,6 +181,7 @@
 
     char             sliceType;
     int              bScenecut;
+    double           ipCostRatio;
     int              frameLatency;
     x265_cu_stats    cuStats;
     x265_pu_stats    puStats;


More information about the x265-devel mailing list