<div dir="ltr">Please find attached the sample spreadsheet generated and let me know the changes needed.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 27, 2015 at 9:52 PM, Steve Borho <span dir="ltr"><<a href="mailto:steve@borho.org" target="_blank">steve@borho.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 05/27, Divya Manivannan wrote:<br>
> # HG changeset patch<br>
> # User Divya Manivannan <<a href="mailto:divya@multicorewareinc.com">divya@multicorewareinc.com</a>><br>
> # Date 1432729899 -19800<br>
> # Wed May 27 18:01:39 2015 +0530<br>
> # Node ID 49f81cae5865c3ec6f7bdf212ca1657a596bb728<br>
> # Parent c33107628ce48eb4df9039b3620e00ed4bfb36cc<br>
> stats: report counts of each CU partition per frame in log-level 4<br>
><br>
> diff -r c33107628ce4 -r 49f81cae5865 source/encoder/encoder.cpp<br>
> --- a/source/encoder/encoder.cpp Wed May 27 15:37:17 2015 +0530<br>
> +++ b/source/encoder/encoder.cpp Wed May 27 18:01:39 2015 +0530<br>
> @@ -249,6 +249,7 @@<br>
> fprintf(m_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 (m_param->logLevel >= X265_LOG_DEBUG)<br>
> {<br>
> + fprintf(m_csvfpt, ", 64x64 CU (%%), 32x32 CU (%%), 16x16 CU (%%), 8x8 CU (%%), 4x4 CU (%%)");<br>
> if (m_param->decodedPictureHashSEI && m_param->logLevel >= X265_LOG_FULL)<br>
> {<br>
> if (m_param->decodedPictureHashSEI == 1)<br>
> @@ -1295,6 +1296,12 @@<br>
><br>
> if (m_param->logLevel >= X265_LOG_DEBUG)<br>
> {<br>
> + fprintf(m_csvfpt, ", %5.2lf (Intra: %5.2lf Inter: %5.2lf Skip: %5.2lf)", curEncoder->m_frameStats.percentTotalCu[0], curEncoder->m_frameStats.percentIntraCu[0], curEncoder->m_frameStats.percentInterCu[0], curEncoder->m_frameStats.percentSkipCu[0]);<br>
<br>
</span>This doesn't look very parseable for a spreadsheet.<br>
<div><div class="h5"><br>
> + fprintf(m_csvfpt, ", %5.2lf (Intra: %5.2lf Inter: %5.2lf Skip: %5.2lf)", curEncoder->m_frameStats.percentTotalCu[1], curEncoder->m_frameStats.percentIntraCu[1], curEncoder->m_frameStats.percentInterCu[1], curEncoder->m_frameStats.percentSkipCu[1]);<br>
> + fprintf(m_csvfpt, ", %5.2lf (Intra: %5.2lf Inter: %5.2lf Skip: %5.2lf)", curEncoder->m_frameStats.percentTotalCu[2], curEncoder->m_frameStats.percentIntraCu[2], curEncoder->m_frameStats.percentInterCu[2], curEncoder->m_frameStats.percentSkipCu[2]);<br>
> + fprintf(m_csvfpt, ", %5.2lf (Intra: %5.2lf Inter: %5.2lf Skip: %5.2lf)", curEncoder->m_frameStats.percentTotalCu[3], curEncoder->m_frameStats.percentIntraCu[3], curEncoder->m_frameStats.percentInterCu[3], curEncoder->m_frameStats.percentSkipCu[3]);<br>
> + fprintf(m_csvfpt, ", %5.2lf", curEncoder->m_frameStats.percentIntraNxN);<br>
> +<br>
> if (m_param->decodedPictureHashSEI && m_param->logLevel >= X265_LOG_FULL)<br>
> {<br>
> const char* digestStr = NULL;<br>
> diff -r c33107628ce4 -r 49f81cae5865 source/encoder/frameencoder.cpp<br>
> --- a/source/encoder/frameencoder.cpp Wed May 27 15:37:17 2015 +0530<br>
> +++ b/source/encoder/frameencoder.cpp Wed May 27 18:01:39 2015 +0530<br>
> @@ -552,7 +552,7 @@<br>
> }<br>
> }<br>
><br>
> - if (m_param->rc.bStatWrite)<br>
> + if (m_param->rc.bStatWrite || m_param->logLevel >= X265_LOG_DEBUG)<br>
> {<br>
> int totalI = 0, totalP = 0, totalSkip = 0;<br>
><br>
> @@ -562,14 +562,32 @@<br>
> m_frameStats.mvBits += m_rows[i].rowStats.mvBits;<br>
> m_frameStats.coeffBits += m_rows[i].rowStats.coeffBits;<br>
> m_frameStats.miscBits += m_rows[i].rowStats.miscBits;<br>
> + m_frameStats.cntIntraNxN += m_rows[i].rowStats.cntIntraNxN;<br>
> + m_frameStats.totalCu += m_rows[i].rowStats.totalCu;<br>
> totalI += m_rows[i].rowStats.iCuCnt;<br>
> totalP += m_rows[i].rowStats.pCuCnt;<br>
> totalSkip += m_rows[i].rowStats.skipCuCnt;<br>
> +<br>
> + for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
> + {<br>
> + m_frameStats.cntInter[depth] += m_rows[i].rowStats.cntInter[depth];<br>
> + m_frameStats.cntIntra[depth] += m_rows[i].rowStats.cntIntra[depth];<br>
> + m_frameStats.cntSkipCu[depth] += m_rows[i].rowStats.cntSkipCu[depth];<br>
> + m_frameStats.cntTotalCu[depth] += m_rows[i].rowStats.cntTotalCu[depth];<br>
> + }<br>
> }<br>
> int totalCuCount = totalI + totalP + totalSkip;<br>
> m_frameStats.percentIntra = (double)totalI / totalCuCount;<br>
> m_frameStats.percentInter = (double)totalP / totalCuCount;<br>
> m_frameStats.percentSkip = (double)totalSkip / totalCuCount;<br>
> + m_frameStats.percentIntraNxN = (double)(m_frameStats.cntIntraNxN * 100) / m_frameStats.totalCu;<br>
> + for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)<br>
> + {<br>
> + m_frameStats.percentIntraCu[depth] = (double)(m_frameStats.cntIntra[depth] * 100) / m_frameStats.totalCu;<br>
> + m_frameStats.percentInterCu[depth] = (double)(m_frameStats.cntInter[depth] * 100) / m_frameStats.totalCu;<br>
> + m_frameStats.percentSkipCu[depth] = (double)(m_frameStats.cntSkipCu[depth] * 100) / m_frameStats.totalCu;<br>
> + m_frameStats.percentTotalCu[depth] = (double)(m_frameStats.cntTotalCu[depth] * 100) / m_frameStats.totalCu;<br>
> + }<br>
> }<br>
><br>
> m_bs.resetBits();<br>
> @@ -826,12 +844,10 @@<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>
> + /* This store the count of intra cus within quad tree structure of each CTU */<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>
> + qTreeIntraCnt[depth] = 0;<br>
><br>
> while (curRow.completed < numCols)<br>
> {<br>
> @@ -904,28 +920,35 @@<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>
> + StatisticLog cuLog;<br>
> + if (m_param->rc.bStatWrite || m_param->logLevel >= X265_LOG_DEBUG)<br>
> + curEncData.m_rowStat[row].sumQpAq += collectCTUStatistics(*ctu, qTreeIntraCnt, &cuLog);<br>
> else if (m_param->rc.aqMode)<br>
> curEncData.m_rowStat[row].sumQpAq += calcCTUQP(*ctu);<br>
><br>
> // copy no. of intra, inter Cu cnt per row into frame stats for 2 pass<br>
> - if (m_param->rc.bStatWrite)<br>
> + if (m_param->rc.bStatWrite || m_param->logLevel >= X265_LOG_DEBUG)<br>
> {<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.cntIntraNxN += cuLog.cntIntraNxN;<br>
> + curRow.rowStats.totalCu += cuLog.totalCu;<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.iCuCnt += qTreeIntraCnt[depth] << shift;<br>
> - curRow.rowStats.pCuCnt += qTreeInterCnt[depth] << shift;<br>
> - curRow.rowStats.skipCuCnt += qTreeSkipCnt[depth] << shift;<br>
> + curRow.rowStats.pCuCnt += (int)(cuLog.cntInter[depth] << shift);<br>
> + curRow.rowStats.skipCuCnt += (int)(cuLog.cntSkipCu[depth] << shift);<br>
> + curRow.rowStats.cntInter[depth] += cuLog.cntInter[depth];<br>
> + curRow.rowStats.cntIntra[depth] += cuLog.cntIntra[depth];<br>
> + curRow.rowStats.cntSkipCu[depth] += cuLog.cntSkipCu[depth];<br>
> + curRow.rowStats.cntTotalCu[depth] += cuLog.cntTotalCu[depth];<br>
><br>
> // clear the row cu data from thread local object<br>
> - qTreeIntraCnt[depth] = qTreeInterCnt[depth] = qTreeSkipCnt[depth] = 0;<br>
> + qTreeIntraCnt[depth] = 0;<br>
> }<br>
> }<br>
><br>
> @@ -1103,9 +1126,8 @@<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, uint32_t* qtreeIntraCnt, StatisticLog* 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>
> @@ -1116,6 +1138,7 @@<br>
> depth = ctu.m_cuDepth[absPartIdx];<br>
><br>
> log->totalCu++;<br>
> + log->cntTotalCu[depth]++;<br>
> log->cntIntra[depth]++;<br>
> qtreeIntraCnt[depth]++;<br>
> totQP += ctu.m_qp[absPartIdx] * (ctu.m_numPartitions >> (depth * 2));<br>
> @@ -1123,6 +1146,7 @@<br>
> if (ctu.m_predMode[absPartIdx] == MODE_NONE)<br>
> {<br>
> log->totalCu--;<br>
> + log->cntTotalCu[depth]--;<br>
> log->cntIntra[depth]--;<br>
> qtreeIntraCnt[depth]--;<br>
> }<br>
> @@ -1132,6 +1156,7 @@<br>
> X265_CHECK(ctu.m_log2CUSize[absPartIdx] == 3 && ctu.m_slice->m_sps->quadtreeTULog2MinSize < 3, "Intra NxN found at improbable depth\n");<br>
> log->cntIntraNxN++;<br>
> log->cntIntra[depth]--;<br>
> + log->cntTotalCu[depth]--;<br>
> }<br>
> else if (ctu.m_lumaIntraDir[absPartIdx] > 1)<br>
> log->cuIntraDistribution[depth][ANGULAR_MODE_ID]++;<br>
> @@ -1156,15 +1181,10 @@<br>
> log->cntTotalCu[depth]--;<br>
> }<br>
> else if (ctu.isSkipped(absPartIdx))<br>
> - {<br>
> - log->totalCu--;<br>
> log->cntSkipCu[depth]++;<br>
> - qtreeSkipCnt[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>
> @@ -1181,6 +1201,7 @@<br>
> X265_CHECK(ctu.m_log2CUSize[absPartIdx] == 3 && ctu.m_slice->m_sps->quadtreeTULog2MinSize < 3, "Intra NxN found at improbable depth\n");<br>
> log->cntIntraNxN++;<br>
> log->cntIntra[depth]--;<br>
> + log->cntTotalCu[depth]--;<br>
> /* TODO: log intra modes at absPartIdx +0 to +3 */<br>
> }<br>
> else if (ctu.m_lumaIntraDir[absPartIdx] > 1)<br>
> diff -r c33107628ce4 -r 49f81cae5865 source/encoder/frameencoder.h<br>
> --- a/source/encoder/frameencoder.h Wed May 27 15:37:17 2015 +0530<br>
> +++ b/source/encoder/frameencoder.h Wed May 27 18:01:39 2015 +0530<br>
> @@ -156,7 +156,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>
> FrameStats m_frameStats; // stats of current frame for multi-pass encodes<br>
><br>
> volatile int m_activeWorkerCount; // count of workers currently encoding or filtering CTUs<br>
> @@ -221,7 +220,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 collectCTUStatistics(const CUData& ctu, uint32_t* qtreeIntraCnt, StatisticLog* log);<br>
> int calcCTUQP(const CUData& ctu);<br>
> void noiseReductionUpdate();<br>
><br>
> diff -r c33107628ce4 -r 49f81cae5865 source/encoder/ratecontrol.h<br>
> --- a/source/encoder/ratecontrol.h Wed May 27 15:37:17 2015 +0530<br>
> +++ b/source/encoder/ratecontrol.h Wed May 27 18:01:39 2015 +0530<br>
> @@ -61,6 +61,19 @@<br>
> double percentIntra;<br>
> double percentInter;<br>
> double percentSkip;<br>
> +<br>
> + uint64_t cntInter[4];<br>
> + uint64_t cntIntra[4];<br>
> + uint64_t cntIntraNxN;<br>
> + uint64_t cntSkipCu[4];<br>
> + uint64_t cntTotalCu[4];<br>
> + uint64_t totalCu;<br>
> +<br>
> + double percentIntraCu[4];<br>
> + double percentInterCu[4];<br>
> + double percentSkipCu[4];<br>
> + double percentIntraNxN;<br>
> + double percentTotalCu[4];<br>
> };<br>
><br>
> struct Predictor<br>
</div></div>> _______________________________________________<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" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Steve Borho<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" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</font></span></blockquote></div><br></div>