<div dir="ltr">I will update and send the patch again.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 13, 2015 at 11:47 AM, Deepthi Nandakumar <span dir="ltr"><<a href="mailto:deepthi@multicorewareinc.com" target="_blank">deepthi@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Mon, Jul 6, 2015 at 10:59 AM, Divya Manivannan <span dir="ltr"><<a href="mailto:divya@multicorewareinc.com" target="_blank">divya@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Divya Manivannan <<a href="mailto:divya@multicorewareinc.com" target="_blank">divya@multicorewareinc.com</a>><br>
# Date 1435741578 -19800<br>
#      Wed Jul 01 14:36:18 2015 +0530<br>
# Node ID fab7c493b7ce3845565f9fbe07ebc183c22e928c<br>
# Parent  1162fb0b99f82d32529f396e3afb6966cc38ec02<br>
stats: count of each CU partition per frame<br>
<br>
diff -r 1162fb0b99f8 -r fab7c493b7ce doc/reST/api.rst<br>
--- a/doc/reST/api.rst  Fri Jul 03 13:43:47 2015 -0500<br>
+++ b/doc/reST/api.rst  Wed Jul 01 14:36:18 2015 +0530<br>
@@ -338,10 +338,6 @@<br>
 Cleanup<br>
 =======<br>
<br>
-       /* x265_encoder_log:<br>
-        *       This function is now deprecated */<br>
-       void x265_encoder_log(x265_encoder *encoder, int argc, char **argv);<br>
-<br>
 Finally, the encoder must be closed in order to free all of its<br>
 resources. An encoder that has been flushed cannot be restarted and<br>
 reused. Once **x265_encoder_close()** has been called, the encoder<br>
diff -r 1162fb0b99f8 -r fab7c493b7ce source/CMakeLists.txt<br>
--- a/source/CMakeLists.txt     Fri Jul 03 13:43:47 2015 -0500<br>
+++ b/source/CMakeLists.txt     Wed Jul 01 14:36:18 2015 +0530<br>
@@ -30,7 +30,7 @@<br>
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)<br>
<br>
 # X265_BUILD must be incremented each time the public API is changed<br>
-set(X265_BUILD 63)<br>
+set(X265_BUILD 64)<br>
 configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265.def.in" rel="noreferrer" target="_blank">x265.def.in</a>"<br>
                "${PROJECT_BINARY_DIR}/x265.def")<br>
 configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in" rel="noreferrer" target="_blank">x265_config.h.in</a>"<br>
diff -r 1162fb0b99f8 -r fab7c493b7ce source/common/framedata.h<br>
--- a/source/common/framedata.h Fri Jul 03 13:43:47 2015 -0500<br>
+++ b/source/common/framedata.h Wed Jul 01 14:36:18 2015 +0530<br>
@@ -34,6 +34,9 @@<br>
 class PicYuv;<br>
 class JobProvider;<br>
<br>
+#define INTER_MODES 4 // 2Nx2N, 2NxN, Nx2N, AMP modes<br>
+#define INTRA_MODES 3 // DC, Planar, Angular modes<br>
+<br>
 /* Current frame stats for 2 pass */<br>
 struct FrameStats<br>
 {<br>
@@ -49,6 +52,25 @@<br>
     double      percent8x8Intra;<br>
     double      percent8x8Inter;<br>
     double      percent8x8Skip;<br>
+    double      percentIntraNxN;<br>
+    double      percentSkipCu[NUM_CU_DEPTH];<br>
+    double      percentMergeCu[NUM_CU_DEPTH];<br>
+    double      percentIntraDistribution[NUM_CU_DEPTH][INTRA_MODES];<br>
+    double      percentInterDistribution[NUM_CU_DEPTH][3];           // 2Nx2N, RECT, AMP modes percentage<br>
+<br>
+    uint64_t    cntIntraNxN;<br>
+    uint64_t    totalCu;<br>
+    uint64_t    cntSkipCu[NUM_CU_DEPTH];<br>
+    uint64_t    cntMergeCu[NUM_CU_DEPTH];<br>
+    uint64_t    cntInter[NUM_CU_DEPTH];<br>
+    uint64_t    cntIntra[NUM_CU_DEPTH];<br>
+    uint64_t    cuInterDistribution[NUM_CU_DEPTH][INTER_MODES];<br>
+    uint64_t    cuIntraDistribution[NUM_CU_DEPTH][INTRA_MODES];<br>
+<br>
+    FrameStats()<br>
+    {<br>
+        memset(this, 0, sizeof(FrameStats));<br>
+    }<br>
 };<br>
<br>
 /* Per-frame data that is used during encodes and referenced while the picture<br>
diff -r 1162fb0b99f8 -r fab7c493b7ce source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp        Fri Jul 03 13:43:47 2015 -0500<br>
+++ b/source/encoder/encoder.cpp        Wed Jul 01 14:36:18 2015 +0530<br>
@@ -1163,6 +1163,18 @@<br>
         else<br>
             frameStats->avgWPP = 1;<br>
         frameStats->countRowBlocks = curEncoder->m_countRowBlocks;<br>
+<br>
+        frameStats->cuStats.percentIntraNxN = curFrame->m_encData->m_frameStats.percentIntraNxN;<br>
+        for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+        {<br>
+            frameStats->cuStats.percentSkipCu[depth]  = curFrame->m_encData->m_frameStats.percentSkipCu[depth];<br>
+            frameStats->cuStats.percentMergeCu[depth] = curFrame->m_encData->m_frameStats.percentMergeCu[depth];<br>
+            frameStats->cuStats.percentInterDistribution[depth][0] = curFrame->m_encData->m_frameStats.percentInterDistribution[depth][0];<br>
+            frameStats->cuStats.percentInterDistribution[depth][1] = curFrame->m_encData->m_frameStats.percentInterDistribution[depth][1];<br>
+            frameStats->cuStats.percentInterDistribution[depth][2] = curFrame->m_encData->m_frameStats.percentInterDistribution[depth][2];<br>
+            for (int n = 0; n < INTRA_MODES; n++)<br>
+                frameStats->cuStats.percentIntraDistribution[depth][n] = curFrame->m_encData->m_frameStats.percentIntraDistribution[depth][n];<br>
+        }<br>
     }<br>
 }<br>
<br>
diff -r 1162fb0b99f8 -r fab7c493b7ce source/encoder/frameencoder.cpp<br>
--- a/source/encoder/frameencoder.cpp   Fri Jul 03 13:43:47 2015 -0500<br>
+++ b/source/encoder/frameencoder.cpp   Wed Jul 01 14:36:18 2015 +0530<br>
@@ -583,6 +583,33 @@<br>
         m_frame->m_encData->m_frameStats.percent8x8Inter = (double)totalP / totalCuCount;<br>
         m_frame->m_encData->m_frameStats.percent8x8Skip  = (double)totalSkip / totalCuCount;<br>
     }<br>
+    for (uint32_t i = 0; i < m_numRows; i++)<br>
+    {<br>
+        m_frame->m_encData->m_frameStats.cntIntraNxN += m_rows[i].rowStats.cntIntraNxN;<br>
+        m_frame->m_encData->m_frameStats.totalCu     += m_rows[i].rowStats.totalCu;<br>
+        for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+        {<br>
+            m_frame->m_encData->m_frameStats.cntSkipCu[depth] += m_rows[i].rowStats.cntSkipCu[depth];<br>
+            m_frame->m_encData->m_frameStats.cntMergeCu[depth] += m_rows[i].rowStats.cntMergeCu[depth];<br>
+            for (int m = 0; m < INTER_MODES; m++)<br>
+                m_frame->m_encData->m_frameStats.cuInterDistribution[depth][m] += m_rows[i].rowStats.cuInterDistribution[depth][m];<br>
+            for (int n = 0; n < INTRA_MODES; n++)<br>
+                m_frame->m_encData->m_frameStats.cuIntraDistribution[depth][n] += m_rows[i].rowStats.cuIntraDistribution[depth][n];<br>
+        }<br>
+    }<br>
+    m_frame->m_encData->m_frameStats.percentIntraNxN = (double)(m_frame->m_encData->m_frameStats.cntIntraNxN * 100) / m_frame->m_encData->m_frameStats.totalCu;<br>
+    for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+    {<br>
+        m_frame->m_encData->m_frameStats.percentSkipCu[depth]  = (double)(m_frame->m_encData->m_frameStats.cntSkipCu[depth] * 100) / m_frame->m_encData->m_frameStats.totalCu;<br>
+        m_frame->m_encData->m_frameStats.percentMergeCu[depth] = (double)(m_frame->m_encData->m_frameStats.cntMergeCu[depth] * 100) / m_frame->m_encData->m_frameStats.totalCu;<br>
+        for (int n = 0; n < INTRA_MODES; n++)<br>
+            m_frame->m_encData->m_frameStats.percentIntraDistribution[depth][n] = (double)(m_frame->m_encData->m_frameStats.cuIntraDistribution[depth][n] * 100) / m_frame->m_encData->m_frameStats.totalCu;<br>
+        uint64_t cuInterRectCnt = 0; // sum of Nx2N, 2NxN counts<br>
+        cuInterRectCnt += m_frame->m_encData->m_frameStats.cuInterDistribution[depth][1] + m_frame->m_encData->m_frameStats.cuInterDistribution[depth][2];<br>
+        m_frame->m_encData->m_frameStats.percentInterDistribution[depth][0] = (double)(m_frame->m_encData->m_frameStats.cuInterDistribution[depth][0] * 100) / m_frame->m_encData->m_frameStats.totalCu;<br>
+        m_frame->m_encData->m_frameStats.percentInterDistribution[depth][1] = (double)(cuInterRectCnt * 100) / m_frame->m_encData->m_frameStats.totalCu;<br>
+        m_frame->m_encData->m_frameStats.percentInterDistribution[depth][2] = (double)(m_frame->m_encData->m_frameStats.cuInterDistribution[depth][3] * 100) / m_frame->m_encData->m_frameStats.totalCu;<br>
+    }<br>
<br>
     m_bs.resetBits();<br>
     m_entropyCoder.load(m_initSliceContext);<br>
@@ -838,13 +865,6 @@<br>
     const uint32_t lineStartCUAddr = row * numCols;<br>
     bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;<br>
<br>
-    /* These store the count of inter, intra and skip cus within quad tree structure of each CTU */<br>
-    uint32_t qTreeInterCnt[NUM_CU_DEPTH];<br>
-    uint32_t qTreeIntraCnt[NUM_CU_DEPTH];<br>
-    uint32_t qTreeSkipCnt[NUM_CU_DEPTH];<br>
-    for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
-        qTreeIntraCnt[depth] = qTreeInterCnt[depth] = qTreeSkipCnt[depth] = 0;<br>
-<br>
     while (curRow.completed < numCols)<br>
     {<br>
         ProfileScopeEvent(encodeCTU);<br>
@@ -916,30 +936,42 @@<br>
         // Completed CU processing<br>
         curRow.completed++;<br>
<br>
-        if (m_param->rc.bStatWrite)<br>
-            curEncData.m_rowStat[row].sumQpAq += collectCTUStatistics(*ctu, qTreeInterCnt, qTreeIntraCnt, qTreeSkipCnt);<br>
-        else if (m_param->rc.aqMode)<br>
-            curEncData.m_rowStat[row].sumQpAq += calcCTUQP(*ctu);<br>
+        FrameStats frameLog;<br>
+        curEncData.m_rowStat[row].sumQpAq += collectCTUStatistics(*ctu, &frameLog);<br>
<br>
         // copy no. of intra, inter Cu cnt per row into frame stats for 2 pass<br>
         if (m_param->rc.bStatWrite)<br>
         {<br>
-            curRow.rowStats.mvBits += best.mvBits;<br>
+            curRow.rowStats.mvBits    += best.mvBits;<br>
             curRow.rowStats.coeffBits += best.coeffBits;<br>
-            curRow.rowStats.miscBits += best.totalBits - (best.mvBits + best.coeffBits);<br>
+            curRow.rowStats.miscBits  += best.totalBits - (best.mvBits + best.coeffBits);<br>
<br>
             for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
             {<br>
                 /* 1 << shift == number of 8x8 blocks at current depth */<br>
                 int shift = 2 * (g_maxCUDepth - depth);<br>
-                curRow.rowStats.intra8x8Cnt += qTreeIntraCnt[depth] << shift;<br>
-                curRow.rowStats.inter8x8Cnt += qTreeInterCnt[depth] << shift;<br>
-                curRow.rowStats.skip8x8Cnt  += qTreeSkipCnt[depth] << shift;<br>
+                int cuSize = g_maxCUSize >> depth;<br>
<br>
-                // clear the row cu data from thread local object<br>
-                qTreeIntraCnt[depth] = qTreeInterCnt[depth] = qTreeSkipCnt[depth] = 0;<br>
+                if (cuSize == 8)<br>
+                    curRow.rowStats.intra8x8Cnt += (int)(frameLog.cntIntra[depth] + frameLog.cntIntraNxN);<br>
+                else<br>
+                    curRow.rowStats.intra8x8Cnt += (int)(frameLog.cntIntra[depth] << shift);<br>
+<br>
+                curRow.rowStats.inter8x8Cnt += (int)(frameLog.cntInter[depth] << shift);<br>
+                curRow.rowStats.skip8x8Cnt  += (int)(frameLog.cntSkipCu[depth] << shift);<br>
             }<br>
         }<br>
+        curRow.rowStats.cntIntraNxN += frameLog.cntIntraNxN;<br>
+        curRow.rowStats.totalCu     += frameLog.totalCu;<br>
+        for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+        {<br>
+            curRow.rowStats.cntSkipCu[depth] += frameLog.cntSkipCu[depth];<br>
+            curRow.rowStats.cntMergeCu[depth] += frameLog.cntMergeCu[depth];<br>
+            for (int m = 0; m < INTER_MODES; m++)<br>
+                curRow.rowStats.cuInterDistribution[depth][m] += frameLog.cuInterDistribution[depth][m];<br>
+            for (int n = 0; n < INTRA_MODES; n++)<br>
+                curRow.rowStats.cuIntraDistribution[depth][n] += frameLog.cuIntraDistribution[depth][n];<br>
+        }<br>
<br>
         curEncData.m_cuStat[cuAddr].totalBits = best.totalBits;<br>
         x265_emms();<br>
@@ -1115,11 +1147,9 @@<br>
 }<br>
<br>
 /* collect statistics about CU coding decisions, return total QP */<br>
-int FrameEncoder::collectCTUStatistics(const CUData& ctu, uint32_t* qtreeInterCnt, uint32_t* qtreeIntraCnt, uint32_t* qtreeSkipCnt)<br>
+int FrameEncoder::collectCTUStatistics(const CUData& ctu, FrameStats* log)<br>
 {<br>
-    StatisticLog* log = &m_sliceTypeLog[ctu.m_slice->m_sliceType];<br>
     int totQP = 0;<br>
-<br>
     if (ctu.m_slice->m_sliceType == I_SLICE)<br>
     {<br>
         uint32_t depth = 0;<br>
@@ -1129,14 +1159,12 @@<br>
<br>
             log->totalCu++;<br>
             log->cntIntra[depth]++;<br>
-            qtreeIntraCnt[depth]++;<br>
             totQP += ctu.m_qp[absPartIdx] * (ctu.m_numPartitions >> (depth * 2));<br>
<br>
             if (ctu.m_predMode[absPartIdx] == MODE_NONE)<br>
             {<br>
                 log->totalCu--;<br>
                 log->cntIntra[depth]--;<br>
-                qtreeIntraCnt[depth]--;<br>
             }<br>
             else if (ctu.m_partSize[absPartIdx] != SIZE_2Nx2N)<br>
             {<br>
@@ -1159,24 +1187,20 @@<br>
             depth = ctu.m_cuDepth[absPartIdx];<br>
<br>
             log->totalCu++;<br>
-            log->cntTotalCu[depth]++;<br>
             totQP += ctu.m_qp[absPartIdx] * (ctu.m_numPartitions >> (depth * 2));<br>
<br>
             if (ctu.m_predMode[absPartIdx] == MODE_NONE)<br>
-            {<br>
                 log->totalCu--;<br>
-                log->cntTotalCu[depth]--;<br>
-            }<br>
             else if (ctu.isSkipped(absPartIdx))<br>
             {<br>
-                log->totalCu--;<br>
-                log->cntSkipCu[depth]++;<br>
-                qtreeSkipCnt[depth]++;<br>
+                if (ctu.m_mergeFlag[0])<br>
+                    log->cntMergeCu[depth]++;<br>
+                else<br>
+                    log->cntSkipCu[depth]++;<br>
             }<br>
             else if (ctu.isInter(absPartIdx))<br>
             {<br>
                 log->cntInter[depth]++;<br>
-                qtreeInterCnt[depth]++;<br>
<br>
                 if (ctu.m_partSize[absPartIdx] < AMP_ID)<br>
                     log->cuInterDistribution[depth][ctu.m_partSize[absPartIdx]]++;<br>
@@ -1186,7 +1210,6 @@<br>
             else if (ctu.isIntra(absPartIdx))<br>
             {<br>
                 log->cntIntra[depth]++;<br>
-                qtreeIntraCnt[depth]++;<br>
<br>
                 if (ctu.m_partSize[absPartIdx] != SIZE_2Nx2N)<br>
                 {<br>
@@ -1206,21 +1229,6 @@<br>
     return totQP;<br>
 }<br>
<br>
-/* iterate over coded CUs and determine total QP */<br>
-int FrameEncoder::calcCTUQP(const CUData& ctu)<br>
-{<br>
-    int totQP = 0;<br>
-    uint32_t depth = 0, numParts = ctu.m_numPartitions;<br>
-<br>
-    for (uint32_t absPartIdx = 0; absPartIdx < ctu.m_numPartitions; absPartIdx += numParts)<br>
-    {<br>
-        depth = ctu.m_cuDepth[absPartIdx];<br>
-        numParts = ctu.m_numPartitions >> (depth * 2);<br>
-        totQP += ctu.m_qp[absPartIdx] * numParts;<br>
-    }<br>
-    return totQP;<br>
-}<br>
-<br>
 /* DCT-domain noise reduction / adaptive deadzone from libavcodec */<br>
 void FrameEncoder::noiseReductionUpdate()<br>
 {<br>
diff -r 1162fb0b99f8 -r fab7c493b7ce source/encoder/frameencoder.h<br>
--- a/source/encoder/frameencoder.h     Fri Jul 03 13:43:47 2015 -0500<br>
+++ b/source/encoder/frameencoder.h     Wed Jul 01 14:36:18 2015 +0530<br>
@@ -49,8 +49,6 @@<br>
<br>
 #define ANGULAR_MODE_ID 2<br>
 #define AMP_ID 3<br>
-#define INTER_MODES 4<br>
-#define INTRA_MODES 3<br>
<br>
 struct StatisticLog<br>
 {<br>
@@ -156,7 +154,6 @@<br>
     MD5Context               m_state[3];<br>
     uint32_t                 m_crc[3];<br>
     uint32_t                 m_checksum[3];<br>
-    StatisticLog             m_sliceTypeLog[3];     // per-slice type CU statistics<br>
<br>
     volatile int             m_activeWorkerCount;        // count of workers currently encoding or filtering CTUs<br>
     volatile int             m_totalActiveWorkerCount;   // sum of m_activeWorkerCount sampled at end of each CTU<br>
@@ -220,8 +217,7 @@<br>
     void encodeSlice();<br>
<br>
     void threadMain();<br>
-    int  collectCTUStatistics(const CUData& ctu, uint32_t* qtreeInterCnt, uint32_t* qtreeIntraCnt, uint32_t* qtreeSkipCnt);<br>
-    int  calcCTUQP(const CUData& ctu);<br>
+    int  collectCTUStatistics(const CUData& ctu, FrameStats* frameLog);<br>
     void noiseReductionUpdate();<br>
<br>
     /* Called by WaveFront::findJob() */<br>
diff -r 1162fb0b99f8 -r fab7c493b7ce source/x265.cpp<br>
--- a/source/x265.cpp   Fri Jul 03 13:43:47 2015 -0500<br>
+++ b/source/x265.cpp   Wed Jul 01 14:36:18 2015 +0530<br></blockquote><div><br></div></div></div><div>Thanks, Divya - ready to be pushed. Can you move the portions below into x265-extras.cpp and update this patch? <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
@@ -171,7 +171,49 @@<br>
                     fprintf(csvfpt, "RateFactor, ");<br>
                 fprintf(csvfpt, "Y PSNR, U PSNR, V PSNR, YUV PSNR, SSIM, SSIM (dB),  List 0, List 1");<br>
                 /* detailed performance statistics */<br>
-                fprintf(csvfpt, ", DecideWait (ms), Row0Wait (ms), Wall time (ms), Ref Wait Wall (ms), Total CTU time (ms), Stall Time (ms), Avg WPP, Row Blocks\n");<br>
+                fprintf(csvfpt, ", DecideWait (ms), Row0Wait (ms), Wall time (ms), Ref Wait Wall (ms), Total CTU time (ms), Stall Time (ms), Avg WPP, Row Blocks");<br>
+                if (csvLogLevel >= 2)<br>
+                {<br>
+                    uint32_t size = param->maxCUSize;<br>
+                    for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+                    {<br>
+                        fprintf(csvfpt, ", Intra %dx%d DC, Intra %dx%d Planar, Intra %dx%d Ang", size, size, size, size, size, size);<br>
+                        size /= 2;<br>
+                    }<br>
+                    fprintf(csvfpt, ", 4x4");<br>
+                    size = param->maxCUSize;<br>
+                    if (param->bEnableRectInter)<br>
+                    {<br>
+                        for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+                        {<br>
+                            fprintf(csvfpt, ", Inter %dx%d, Inter %dx%d (Rect)", size, size, size, size);<br>
+                            if (param->bEnableAMP)<br>
+                                fprintf(csvfpt, ", Inter %dx%d (Amp)", size, size);<br>
+                            size /= 2;<br>
+                        }<br>
+                    }<br>
+                    else<br>
+                    {<br>
+                        for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+                        {<br>
+                            fprintf(csvfpt, ", Inter %dx%d", size, size);<br>
+                            size /= 2;<br>
+                        }<br>
+                    }<br>
+                    size = param->maxCUSize;<br>
+                    for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+                    {<br>
+                        fprintf(csvfpt, ", Skip %dx%d", size, size);<br>
+                        size /= 2;<br>
+                    }<br>
+                    size = param->maxCUSize;<br>
+                    for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+                    {<br>
+                        fprintf(csvfpt, ", Merge %dx%d", size, size);<br>
+                        size /= 2;<br>
+                    }<br>
+                }<br>
+                fprintf(csvfpt, "\n");<br>
             }<br>
             else<br>
                 fputs(summaryCSVHeader, csvfpt);<br>
@@ -312,6 +354,30 @@<br>
         }<br>
         fprintf(csvfpt, " %.1lf, %.1lf, %.1lf, %.1lf, %.1lf, %.1lf,", frameStats->decideWaitTime, frameStats->row0WaitTime, frameStats->wallTime, frameStats->refWaitWallTime, frameStats->totalCTUTime, frameStats->stallTime);<br>
         fprintf(csvfpt, " %.3lf, %d", frameStats->avgWPP, frameStats->countRowBlocks);<br>
+        if (csvLogLevel >= 2)<br>
+        {<br>
+            for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+                fprintf(csvfpt, ", %5.2lf%%, %5.2lf%%, %5.2lf%%", frameStats->cuStats.percentIntraDistribution[depth][0], frameStats->cuStats.percentIntraDistribution[depth][1], frameStats->cuStats.percentIntraDistribution[depth][2]);<br>
+            fprintf(csvfpt, ", %5.2lf%%", frameStats->cuStats.percentIntraNxN);<br>
+            if (param->bEnableRectInter)<br>
+            {<br>
+                for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+                {<br>
+                    fprintf(csvfpt, ", %5.2lf%%, %5.2lf%%", frameStats->cuStats.percentInterDistribution[depth][0], frameStats->cuStats.percentInterDistribution[depth][1]);<br>
+                    if (param->bEnableAMP)<br>
+                        fprintf(csvfpt, ", %5.2lf%%", frameStats->cuStats.percentInterDistribution[depth][2]);<br>
+                }<br>
+            }<br>
+            else<br>
+            {<br>
+                for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+                    fprintf(csvfpt, ", %5.2lf%%", frameStats->cuStats.percentInterDistribution[depth][0]);<br>
+            }<br>
+            for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+                fprintf(csvfpt, ", %5.2lf%%", frameStats->cuStats.percentSkipCu[depth]);<br>
+            for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
+                fprintf(csvfpt, ", %5.2lf%%", frameStats->cuStats.percentMergeCu[depth]);<br>
+        }<br>
         fprintf(csvfpt, "\n");<br>
         fflush(stderr);<br>
     }<br>
@@ -703,17 +769,6 @@<br>
     if (cliopt.reconPlayCmd)<br>
         reconPlay = new ReconPlay(cliopt.reconPlayCmd, *param);<br>
<br>
-    if (cliopt.csvfn)<br>
-    {<br>
-        if (cliopt.parseCSVFile())<br>
-        {<br>
-            cliopt.destroy();<br>
-            if (cliopt.api)<br>
-                cliopt.api->param_free(cliopt.param);<br>
-            exit(5);<br>
-        }<br>
-    }<br>
-<br>
     /* note: we could try to acquire a different libx265 API here based on<br>
      * the profile found during option parsing, but it must be done before<br>
      * opening an encoder */<br>
@@ -731,6 +786,17 @@<br>
     /* get the encoder parameters post-initialization */<br>
     api->encoder_parameters(encoder, param);<br>
<br>
+    if (cliopt.csvfn)<br>
+    {<br>
+        if (cliopt.parseCSVFile())<br>
+        {<br>
+            cliopt.destroy();<br>
+            if (cliopt.api)<br>
+                cliopt.api->param_free(cliopt.param);<br>
+            exit(5);<br>
+        }<br>
+    }<br>
+<br>
     /* Control-C handler */<br>
     if (signal(SIGINT, sigint_handler) == SIG_ERR)<br>
         x265_log(param, X265_LOG_ERROR, "Unable to register CTRL+C handler: %s\n", strerror(errno));<br>
diff -r 1162fb0b99f8 -r fab7c493b7ce source/x265.h<br>
--- a/source/x265.h     Fri Jul 03 13:43:47 2015 -0500<br>
+++ b/source/x265.h     Wed Jul 01 14:36:18 2015 +0530<br>
@@ -100,6 +100,18 @@<br>
     uint32_t         numPartitions;<br>
 } x265_analysis_data;<br>
<br>
+/* cu statistics */<br>
+typedef struct x265_cu_stats<br>
+{<br>
+    double      percentSkipCu[4];                // Percentage of skip cu in all depths<br>
+    double      percentMergeCu[4];               // Percentage of merge cu in all depths<br>
+    double      percentIntraDistribution[4][3];  // Percentage of DC, Planar, Angular intra modes in all depths<br>
+    double      percentInterDistribution[4][3];  // Percentage of 2Nx2N inter, rect and amp in all depths<br>
+    double      percentIntraNxN;                 // Percentage of 4x4 cu<br>
+<br>
+    /* All the above values will add up to 100%. */<br>
+} x265_cu_stats;<br>
+<br>
 /* Frame level statistics */<br>
 typedef struct x265_frame_stats<br>
 {<br>
@@ -124,6 +136,7 @@<br>
     int              list0POC[16];<br>
     int              list1POC[16];<br>
     char             sliceType;<br>
+    x265_cu_stats    cuStats;<br>
 } x265_frame_stats;<br>
<br>
 /* Used to pass pictures into the encoder, and to get picture data back out of<br></div></div><span class="">
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</span></blockquote></div><br></div></div>
<br>_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
<br></blockquote></div><br></div>