[x265] [PATCH] Statistics logging refinement: represent 4x4 statistics for I frame, combine I frame log in single line, preserve space in log
Deepthi Nandakumar
deepthi at multicorewareinc.com
Mon Nov 25 07:42:56 CET 2013
Looks good, except....
On Mon, Nov 25, 2013 at 10:21 AM, <kavitha at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Kavitha Sampath <kavitha at multicorewareinc.com>
> # Date 1385354868 -19800
> # Mon Nov 25 10:17:48 2013 +0530
> # Node ID 1cd255c10fff69dbbb42042a09fa56d1fbeb1367
> # Parent 10f605bd053009c8c981c7529322fecd1e54af7b
> Statistics logging refinement: represent 4x4 statistics for I frame,
> combine I frame log in single line, preserve space in log
>
> diff -r 10f605bd0530 -r 1cd255c10fff source/Lib/TLibEncoder/TEncCu.cpp
> --- a/source/Lib/TLibEncoder/TEncCu.cpp Fri Nov 22 14:59:34 2013 -0600
> +++ b/source/Lib/TLibEncoder/TEncCu.cpp Mon Nov 25 10:17:48 2013 +0530
> @@ -636,14 +636,26 @@
> if (outBestCU->m_totalCost < outTempCU->m_totalCost)
> {
> m_log->cntIntra[depth]++;
> - m_log->cntIntra[depth + 1] = m_log->cntIntra[depth + 1] - 4 +
> boundaryCu;
> + for (int i = 0; i < 4; i++)
> + {
> + if (outTempCU->getPartitionSize(i) != SIZE_NxN)
> + m_log->cntIntra[depth + 1]--;
> + else
> + m_log->cntIntraNxN--;
> + }
> + m_log->cntIntra[depth + 1] += boundaryCu;
> }
> xCheckBestMode(outBestCU, outTempCU, depth); // RD compare
> current prediction with split prediction.
> }
>
> if (depth == g_maxCUDepth - 1 && bSubBranch)
> {
> - m_log->cntIntra[depth]++;
> + if (outBestCU->getPartitionSize(0) == SIZE_NxN)
> + {
> + m_log->cntIntraNxN++;
> + }
> + else
> + m_log->cntIntra[depth]++;
> }
> outBestCU->copyToPic(depth); // Copy Best data to Picture for next
> partition prediction.
>
> diff -r 10f605bd0530 -r 1cd255c10fff source/encoder/compress.cpp
> --- a/source/encoder/compress.cpp Fri Nov 22 14:59:34 2013 -0600
> +++ b/source/encoder/compress.cpp Mon Nov 25 10:17:48 2013 +0530
> @@ -350,7 +350,6 @@
>
> void TEncCu::xCompressInterCU(TComDataCU*& outBestCU, TComDataCU*&
> outTempCU, TComDataCU*& cu, uint32_t depth, uint32_t PartitionIndex, UChar
> minDepth)
> {
> - m_log->cntTotalCu[depth]++;
> m_abortFlag = false;
>
> TComPic* pic = outTempCU->getPic();
> @@ -424,6 +423,7 @@
> if (!(depth < minDepth)) //topskip
> #endif
> {
> + m_log->cntTotalCu[depth]++;
> if (!bSliceEnd && bInsidePicture)
> {
> // variables for fast encoder decision
> diff -r 10f605bd0530 -r 1cd255c10fff source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp Fri Nov 22 14:59:34 2013 -0600
> +++ b/source/encoder/encoder.cpp Mon Nov 25 10:17:48 2013 +0530
> @@ -356,31 +356,14 @@
>
> void Encoder::printSummary()
> {
> - if (param.logLevel >= X265_LOG_INFO)
> - {
> - char buffer[200];
> - if (m_analyzeI.m_numPics)
> - x265_log(¶m, X265_LOG_INFO, "frame I: %s\n",
> statsString(m_analyzeI, buffer));
> - if (m_analyzeP.m_numPics)
> - x265_log(¶m, X265_LOG_INFO, "frame P: %s\n",
> statsString(m_analyzeP, buffer));
> - if (m_analyzeB.m_numPics)
> - x265_log(¶m, X265_LOG_INFO, "frame B: %s\n",
> statsString(m_analyzeB, buffer));
> - if (m_analyzeAll.m_numPics)
> - x265_log(¶m, X265_LOG_INFO, "global : %s\n",
> statsString(m_analyzeAll, buffer));
> - if (param.bEnableWeightedPred)
> - {
> - x265_log(¶m, X265_LOG_INFO, "%d of %d (%.2f%%) P frames
> weighted\n",
> - m_numWPFrames, m_analyzeP.m_numPics, (float)100.0 *
> m_numWPFrames / m_analyzeP.m_numPics);
> - }
> - }
> for (int sliceType = 2; sliceType >= 0; sliceType--)
> {
> StatisticLog finalLog;
> + uint64_t cntIntraNxN = 0, cntIntra[4];
> for (int depth = 0; depth < (int)g_maxCUDepth; depth++)
> {
> - double cntInter, cntIntra, cntSplit, cntSkipCu;
> - double cuInterDistribution[INTER_MODES],
> cuIntraDistribution[INTRA_MODES];
> - double cntIntraNxN = 0.0;
> + uint64_t cntInter, cntSplit, cntSkipCu;
> + uint64_t cuInterDistribution[INTER_MODES],
> cuIntraDistribution[INTRA_MODES];
> for (int j = 0; j < param.frameNumThreads; j++)
> {
> for (int row = 0; row < m_frameEncoder[0].m_numRows;
> row++)
> @@ -401,9 +384,9 @@
> }
> finalLog.cuInterDistribution[depth][m] +=
> enclog.cuInterDistribution[depth][m];
> }
> - if (depth == (int)g_maxCUDepth - 1)
> - finalLog.cntIntraNxN += enclog.cntIntraNxN;
> }
> + if (depth == (int)g_maxCUDepth - 1)
> + finalLog.cntIntraNxN += enclog.cntIntraNxN;
> }
> }
> // check for 0/0, if true assign 0 else calculate percentage
> @@ -412,7 +395,7 @@
> if (finalLog.cntInter[depth] == 0)
> cuInterDistribution[n] = 0;
> else
> - cuInterDistribution[n] =
> (double)(finalLog.cuInterDistribution[depth][n] * 100) /
> (double)finalLog.cntInter[depth];
> + cuInterDistribution[n] =
> (finalLog.cuInterDistribution[depth][n] * 100) / finalLog.cntInter[depth];
> if (n < INTRA_MODES)
> {
> if (finalLog.cntIntra[depth] == 0)
> @@ -422,58 +405,89 @@
> }
> else
> {
> - cntIntraNxN = (double)(finalLog.cntIntraNxN *
> 100) / (double)finalLog.cntIntra[depth];
> - cuIntraDistribution[n] =
> (double)(finalLog.cuIntraDistribution[depth][n] * 100) /
> (double)finalLog.cntIntra[depth];
> + cntIntraNxN = (finalLog.cntIntraNxN * 100) /
> finalLog.cntIntra[depth];
> + cuIntraDistribution[n] =
> (finalLog.cuIntraDistribution[depth][n] * 100) / finalLog.cntIntra[depth];
> }
> }
> }
> if (finalLog.cntTotalCu[depth] == 0)
> {
> cntInter = 0;
> - cntIntra = 0;
> + cntIntra[depth] = 0;
> cntSplit = 0;
> cntSkipCu = 0;
> }
> else
> {
> - cntInter = (double)(finalLog.cntInter[depth] * 100) /
> (double)finalLog.cntTotalCu[depth];
> - cntIntra = (double)(finalLog.cntIntra[depth] * 100) /
> (double)finalLog.cntTotalCu[depth];
> - cntSplit = (double)(finalLog.cntSplit[depth] * 100) /
> (double)finalLog.cntTotalCu[depth];
> - cntSkipCu = (double)(finalLog.cntSkipCu[depth] * 100) /
> (double)finalLog.cntTotalCu[depth];
> + cntInter = (finalLog.cntInter[depth] * 100) /
> finalLog.cntTotalCu[depth];
> + cntIntra[depth] = (finalLog.cntIntra[depth] * 100) /
> finalLog.cntTotalCu[depth];
> + cntSplit = (finalLog.cntSplit[depth] * 100) /
> finalLog.cntTotalCu[depth];
> + cntSkipCu = (finalLog.cntSkipCu[depth] * 100) /
> finalLog.cntTotalCu[depth];
> + if (sliceType == I_SLICE)
> + cntIntraNxN = (finalLog.cntIntraNxN * 100) /
> finalLog.cntTotalCu[depth];
> }
> // print statistics
> - if (sliceType == I_SLICE)
> - x265_log(¶m, X265_LOG_INFO, "Intra I%d %.2f%%\n",
> g_maxCUWidth >> depth, cntIntra);
> - else
> + if (sliceType != I_SLICE)
> {
> + int cuSize = g_maxCUWidth >> depth;
> if (depth < (int)g_maxCUDepth - 1)
> {
> if (sliceType == P_SLICE)
> - x265_log(¶m, X265_LOG_INFO, "Inter P%d
> Inter %.2f%% (2Nx2N %.2f%% Nx2N %.2f%% 2NxN %.2f%% AMP %.2f%%) "
> - "Intra %.2f%% (DC %.2f%% Planar %.2f%%
> Ang %.2f%% ) Split %.2f%% Skipped %.2f%% \n", g_maxCUWidth >> depth,
> - cntInter, cuInterDistribution[0],
> cuInterDistribution[2], cuInterDistribution[1], cuInterDistribution[3],
> - cntIntra, cuIntraDistribution[0],
> cuIntraDistribution[1], cuIntraDistribution[2], cntSplit, cntSkipCu);
> + x265_log(¶m, X265_LOG_INFO, "Inter P%d:Split
> %I64d%% Skip %I64d%% Inter %I64d%%(%dx%d %I64d%% %dx%d %I64d%%"
> + " %dx%d %I64d%% AMP %I64d%%) Intra
> %I64d%%(DC %I64d%% Planar %I64d%% Ang %I64d%%)\n", cuSize, cntSplit,
> cntSkipCu,
> + cntInter, cuSize, cuSize,
> cuInterDistribution[0], cuSize/2, cuSize, cuInterDistribution[2], cuSize,
> cuSize/2, cuInterDistribution[1],
> + cuInterDistribution[3], cntIntra[depth],
> cuIntraDistribution[0], cuIntraDistribution[1], cuIntraDistribution[2]);
> else
> - x265_log(¶m, X265_LOG_INFO, "Inter B%d
> Inter %.2f%% (2Nx2N %.2f%% Nx2N %.2f%% 2NxN %.2f%% AMP %.2f%%) "
> - "Intra %.2f%% (DC %.2f%% Planar %.2f%%
> Ang %.2f%% ) Split %.2f%% Skipped %.2f%% \n", g_maxCUWidth >> depth,
> - cntInter, cuInterDistribution[0],
> cuInterDistribution[2], cuInterDistribution[1], cuInterDistribution[3],
> - cntIntra, cuIntraDistribution[0],
> cuIntraDistribution[1], cuIntraDistribution[2], cntSplit, cntSkipCu);
> + x265_log(¶m, X265_LOG_INFO, "Inter B%d:Split
> %I64d%% Skip %I64d%% Inter %I64d%%(%dx%d %I64d%% %dx%d %I64d%%"
> + " %dx%d %I64d%% AMP %I64d%%) Intra
> %I64d%%(DC %I64d%% Planar %I64d%% Ang %I64d%%)\n", cuSize, cntSplit,
> cntSkipCu,
> + cntInter, cuSize, cuSize,
> cuInterDistribution[0], cuSize/2, cuSize, cuInterDistribution[2], cuSize,
> cuSize/2, cuInterDistribution[1],
> + cuInterDistribution[3], cntIntra[depth],
> cuIntraDistribution[0], cuIntraDistribution[1], cuIntraDistribution[2]);
> }
> else
> {
> if (sliceType == P_SLICE)
> - x265_log(¶m, X265_LOG_INFO, "Inter P%d
> Inter %.2f%% (2Nx2N %.2f%% Nx2N %.2f%% 2NxN %.2f%% AMP %.2f%%) "
> - "Intra %.2f%% (DC %.2f%% Planar %.2f%%
> Ang %.2f%% NXN %.2f%%) Skipped %.2f%% \n", g_maxCUWidth >> depth,
> - cntInter, cuInterDistribution[0],
> cuInterDistribution[2], cuInterDistribution[1], cuInterDistribution[3],
> - cntIntra, cuIntraDistribution[0],
> cuIntraDistribution[1], cuIntraDistribution[2], cntIntraNxN, cntSkipCu);
> + x265_log(¶m, X265_LOG_INFO, "Inter P%-2d:
> Skip %I64d%% Inter %I64d%%(%dx%d %I64d%% %dx%d %I64d%%"
> + " %dx%d %I64d%% AMP %I64d%%) Intra
> %I64d%%(DC %I64d%% Planar %I64d%% Ang %I64d%% %dx%d %I64d%%)\n", cuSize,
> + cntSkipCu, cntInter, cuSize, cuSize,
> cuInterDistribution[0], cuSize/2, cuSize, cuInterDistribution[2], cuSize,
> + cuSize/2, cuInterDistribution[1],
> cuInterDistribution[3], cntIntra[depth], cuIntraDistribution[0],
> + cuIntraDistribution[1],
> cuIntraDistribution[2], cuSize/2, cuSize/2, cntIntraNxN);
> else
> - x265_log(¶m, X265_LOG_INFO, "Inter B%d
> Inter %.2f%% (2Nx2N %.2f%% Nx2N %.2f%% 2NxN %.2f%% AMP %.2f%%) "
> - "Intra %.2f%% (DC %.2f%% Planar %.2f%%
> Ang %.2f%% NXN %.2f%%) Skipped %.2f%% \n", g_maxCUWidth >> depth,
> - cntInter, cuInterDistribution[0],
> cuInterDistribution[2], cuInterDistribution[1], cuInterDistribution[3],
> - cntIntra, cuIntraDistribution[0],
> cuIntraDistribution[1], cuIntraDistribution[2], cntIntraNxN, cntSkipCu);
> + x265_log(¶m, X265_LOG_INFO, "Inter B%-2d:
> Skip %I64d%% Inter %I64d%%(%dx%d %I64d%% %dx%d %I64d%%"
>
An extra tab here after InterP8 and InterB8, since split is not valid
anymore. Looks unappealing. Can you correct this and send?
> + " %dx%d %I64d%% AMP %I64d%%) Intra
> %I64d%%(DC %I64d%% Planar %I64d%% Ang %I64d%% %dx%d %I64d%%)\n", cuSize,
> + cntSkipCu, cntInter, cuSize, cuSize,
> cuInterDistribution[0], cuSize/2, cuSize, cuInterDistribution[2], cuSize,
> + cuSize/2, cuInterDistribution[1],
> cuInterDistribution[3], cntIntra[depth], cuIntraDistribution[0],
> + cuIntraDistribution[1],
> cuIntraDistribution[2], cuSize/2, cuSize/2, cntIntraNxN);
> }
> }
> }
> + if (sliceType == I_SLICE)
> + {
> + char stats[50];
> + if (g_maxCUDepth == 4)
> + sprintf(stats, "%I64d%% %I64d%% %I64d%% %I64d%%
> %I64d%%", cntIntra[0], cntIntra[1], cntIntra[2], cntIntra[3], cntIntraNxN);
> + else if (g_maxCUDepth == 3)
> + sprintf(stats, "%I64d%% %I64d%% %I64d%% %I64d%%",
> cntIntra[0], cntIntra[1], cntIntra[2], cntIntraNxN);
> + else
> + sprintf(stats, "%I64d%% %I64d%% %I64d%%", cntIntra[0],
> cntIntra[1], cntIntraNxN);
> + x265_log(¶m, X265_LOG_INFO, "I-frame %d..4: %s\n",
> g_maxCUWidth, stats);
> + }
> + }
> + if (param.logLevel >= X265_LOG_INFO)
> + {
> + char buffer[200];
> + if (m_analyzeI.m_numPics)
> + x265_log(¶m, X265_LOG_INFO, "frame I: %s\n",
> statsString(m_analyzeI, buffer));
> + if (m_analyzeP.m_numPics)
> + x265_log(¶m, X265_LOG_INFO, "frame P: %s\n",
> statsString(m_analyzeP, buffer));
> + if (m_analyzeB.m_numPics)
> + x265_log(¶m, X265_LOG_INFO, "frame B: %s\n",
> statsString(m_analyzeB, buffer));
> + if (m_analyzeAll.m_numPics)
> + x265_log(¶m, X265_LOG_INFO, "global : %s\n",
> statsString(m_analyzeAll, buffer));
> + if (param.bEnableWeightedPred)
> + {
> + x265_log(¶m, X265_LOG_INFO, "%d of %d (%.2f%%) P frames
> weighted\n",
> + m_numWPFrames, m_analyzeP.m_numPics, (float)100.0 *
> m_numWPFrames / m_analyzeP.m_numPics);
> + }
> }
> }
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20131125/4d764b3f/attachment-0001.html>
More information about the x265-devel
mailing list