<div dir="ltr">Build fails. <br><div><div id="__tbSetup"></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 28, 2013 at 11:10 AM,  <span dir="ltr"><<a href="mailto:kavitha@multicorewareinc.com" target="_blank">kavitha@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 Kavitha Sampath <<a href="mailto:kavitha@multicorewareinc.com">kavitha@multicorewareinc.com</a>><br>
# Date 1385616934 -19800<br>
#      Thu Nov 28 11:05:34 2013 +0530<br>
# Branch stable<br>
# Node ID 8519dc4a5b9e53f1ed6f2f52294d7caea2803bc3<br>
# Parent  f92e0c49a9f0a0e6f6db3eb247bd04431eb75b1e<br>
log: output intra type statistics of I frame, bug fix in intra percentage calculation<br>
<br>
diff -r f92e0c49a9f0 -r 8519dc4a5b9e source/Lib/TLibEncoder/TEncCu.cpp<br>
--- a/source/Lib/TLibEncoder/TEncCu.cpp Wed Nov 27 20:50:08 2013 -0600<br>
+++ b/source/Lib/TLibEncoder/TEncCu.cpp Thu Nov 28 11:05:34 2013 +0530<br>
@@ -551,6 +551,11 @@<br>
     }<br>
<br>
     outTempCU->initEstData(depth, qp);<br>
+    if (depth < g_maxCUDepth - 2)<br>
+    {<br>
+        memcpy(m_log->tempIntra[depth], m_log->cntIntra, sizeof(m_log->cntIntra));<br>
+        memcpy(m_log->tempIntraDist[depth], m_log->cuIntraDistribution, sizeof(m_log->cuIntraDistribution));<br>
+    }<br>
<br>
     // further split<br>
     if (bSubBranch && bTrySplitDQP && depth < g_maxCUDepth - g_addCUDepth)<br>
@@ -575,19 +580,9 @@<br>
                     m_rdSbacCoders[nextDepth][CI_CURR_BEST]->load(m_rdSbacCoders[nextDepth][CI_NEXT_BEST]);<br>
                 }<br>
<br>
-                // The following if condition has to be commented out in case the early Abort based on comparison of parentCu cost, childCU cost is not required.<br>
-                if (outBestCU->isIntra(0))<br>
-                {<br>
-                    xCompressIntraCU(subBestPartCU[partUnitIdx], subTempPartCU[partUnitIdx], nextDepth);<br>
-                }<br>
-                else<br>
-                {<br>
-                    xCompressIntraCU(subBestPartCU[partUnitIdx], subTempPartCU[partUnitIdx], nextDepth);<br>
-                }<br>
-                {<br>
-                    outTempCU->copyPartFrom(subBestPartCU[partUnitIdx], partUnitIdx, nextDepth); // Keep best part data to current temporary data.<br>
-                    xCopyYuv2Tmp(subBestPartCU[partUnitIdx]->getTotalNumPart() * partUnitIdx, nextDepth);<br>
-                }<br>
+                xCompressIntraCU(subBestPartCU[partUnitIdx], subTempPartCU[partUnitIdx], nextDepth);<br>
+                outTempCU->copyPartFrom(subBestPartCU[partUnitIdx], partUnitIdx, nextDepth); // Keep best part data to current temporary data.<br>
+                xCopyYuv2Tmp(subBestPartCU[partUnitIdx]->getTotalNumPart() * partUnitIdx, nextDepth);<br>
             }<br>
             else if (bInSlice)<br>
             {<br>
@@ -635,28 +630,39 @@<br>
         m_rdSbacCoders[nextDepth][CI_NEXT_BEST]->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);<br>
         if (outBestCU->m_totalCost < outTempCU->m_totalCost)<br>
         {<br>
+            if (depth < g_maxCUDepth - 2)<br>
+            {<br>
+                memcpy(m_log->cntIntra, m_log->tempIntra[depth], sizeof(m_log->tempIntra[depth]));<br>
+                memcpy(m_log->cuIntraDistribution, m_log->tempIntraDist[depth], sizeof(m_log->tempIntraDist[depth]));<br>
+            }<br></blockquote><div><br></div><div>I'm uncomfortable seeing memcpy's in the innermost CU-analysis loop. Why is this necessary? <br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

             m_log->cntIntra[depth]++;<br>
-            for (int i = 0; i < 4; i++)<br>
+            if (outBestCU->getLumaIntraDir()[0] > 1)<br>
+                m_log->cuIntraDistribution[depth][ANGULAR_MODE_ID]++;<br>
+            else<br>
+                m_log->cuIntraDistribution[depth][outBestCU->getLumaIntraDir()[0]]++;<br>
+        }<br>
+        else<br>
+        {<br>
+            if (depth == g_maxCUDepth - 2)<br>
             {<br>
-                if (outTempCU->getPartitionSize(i) != SIZE_NxN)<br>
-                    m_log->cntIntra[depth + 1]--;<br>
-                else<br>
-                    m_log->cntIntraNxN--;<br>
+                for (int i = 0; i < 16; i = i + 4)<br>
+                {<br>
+                    if (outTempCU->getPartitionSize(i) != SIZE_NxN)<br>
+                    {<br>
+                        m_log->cntIntra[depth + 1]++;<br>
+                        if (outTempCU->getLumaIntraDir()[i] > 1)<br>
+                            m_log->cuIntraDistribution[depth + 1][ANGULAR_MODE_ID]++;<br>
+                        else<br>
+                            m_log->cuIntraDistribution[depth + 1][outTempCU->getLumaIntraDir()[i]]++;<br>
+                    }<br>
+                    else<br>
+                        m_log->cntIntraNxN++;<br>
+                }<br>
             }<br>
-            m_log->cntIntra[depth + 1] += boundaryCu;<br>
         }<br>
         xCheckBestMode(outBestCU, outTempCU, depth); // RD compare current prediction with split prediction.<br>
     }<br>
<br>
-    if (depth == g_maxCUDepth - 1 && bSubBranch)<br>
-    {<br>
-        if (outBestCU->getPartitionSize(0) == SIZE_NxN)<br>
-        {<br>
-            m_log->cntIntraNxN++;<br>
-        }<br>
-        else<br>
-            m_log->cntIntra[depth]++;<br>
-    }<br>
     outBestCU->copyToPic(depth); // Copy Best data to Picture for next partition prediction.<br>
<br>
     // Copy Yuv data to picture Yuv<br>
diff -r f92e0c49a9f0 -r 8519dc4a5b9e source/Lib/TLibEncoder/TEncCu.h<br>
--- a/source/Lib/TLibEncoder/TEncCu.h   Wed Nov 27 20:50:08 2013 -0600<br>
+++ b/source/Lib/TLibEncoder/TEncCu.h   Thu Nov 28 11:05:34 2013 +0530<br>
@@ -66,6 +66,8 @@<br>
     uint64_t cntIntraNxN;<br>
     uint64_t cntSkipCu[4];<br>
     uint64_t cntTotalCu[4];<br>
+    uint64_t tempIntra[2][4];<br>
+    uint64_t tempIntraDist[2][4][3];<br>
<br>
     StatisticLog()<br>
     {<br>
diff -r f92e0c49a9f0 -r 8519dc4a5b9e source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp        Wed Nov 27 20:50:08 2013 -0600<br>
+++ b/source/encoder/encoder.cpp        Thu Nov 28 11:05:34 2013 +0530<br>
@@ -372,10 +372,9 @@<br>
             continue;<br>
<br>
         StatisticLog finalLog;<br>
-        uint64_t cntIntraNxN = 0, cntIntra[4];<br>
         for (int depth = 0; depth < (int)g_maxCUDepth; depth++)<br>
         {<br>
-            uint64_t cntInter, cntSplit, cntSkipCu;<br>
+            uint64_t cntInter, cntSplit, cntSkipCu, cntIntra, cntIntraNxN;<br>
             uint64_t cuInterDistribution[INTER_MODES], cuIntraDistribution[INTRA_MODES];<br>
             for (int j = 0; j < param.frameNumThreads; j++)<br>
             {<br>
@@ -389,14 +388,14 @@<br>
                         finalLog.cntInter[depth] += enclog.cntInter[depth];<br>
                         finalLog.cntSkipCu[depth] += enclog.cntSkipCu[depth];<br>
                         finalLog.cntSplit[depth] += enclog.cntSplit[depth];<br>
-                        for (int m = 0; m < INTER_MODES; m++)<br>
+                    }<br>
+                    for (int m = 0; m < INTER_MODES; m++)<br>
+                    {<br>
+                        if (m < INTRA_MODES)<br>
                         {<br>
-                            if (m < INTRA_MODES)<br>
-                            {<br>
-                                finalLog.cuIntraDistribution[depth][m] += enclog.cuIntraDistribution[depth][m];<br>
-                            }<br>
-                            finalLog.cuInterDistribution[depth][m] += enclog.cuInterDistribution[depth][m];<br>
+                            finalLog.cuIntraDistribution[depth][m] += enclog.cuIntraDistribution[depth][m];<br>
                         }<br>
+                        finalLog.cuInterDistribution[depth][m] += enclog.cuInterDistribution[depth][m];<br>
                     }<br>
                     if (depth == (int)g_maxCUDepth - 1)<br>
                         finalLog.cntIntraNxN += enclog.cntIntraNxN;<br>
@@ -426,28 +425,28 @@<br>
             if (finalLog.cntTotalCu[depth] == 0)<br>
             {<br>
                 cntInter = 0;<br>
-                cntIntra[depth] = 0;<br>
+                cntIntra = 0;<br>
                 cntSplit = 0;<br>
                 cntSkipCu = 0;<br>
             }<br>
             else<br>
             {<br>
                 cntInter = (finalLog.cntInter[depth] * 100) / finalLog.cntTotalCu[depth];<br>
-                cntIntra[depth] = (finalLog.cntIntra[depth] * 100) / finalLog.cntTotalCu[depth];<br>
+                cntIntra = (finalLog.cntIntra[depth] * 100) / finalLog.cntTotalCu[depth];<br>
                 cntSplit = (finalLog.cntSplit[depth] * 100) / finalLog.cntTotalCu[depth];<br>
                 cntSkipCu = (finalLog.cntSkipCu[depth] * 100) / finalLog.cntTotalCu[depth];<br>
                 if (sliceType == I_SLICE)<br>
                     cntIntraNxN = (finalLog.cntIntraNxN * 100) / finalLog.cntTotalCu[depth];<br>
             }<br>
             // print statistics<br>
+            int cuSize = g_maxCUWidth >> depth;<br>
+            char stats[256] = {NULL};<br>
+            int len = 0;<br>
             if (sliceType != I_SLICE)<br>
             {<br>
-                char stats[256];<br>
-                int len;<br>
-<br>
-                int cuSize = g_maxCUWidth >> depth;<br>
-                len = sprintf(stats, "Split "LL"%% Merge "LL"%% Inter "LL"%%",<br>
-                              cntSplit, cntSkipCu, cntInter);<br>
+                if (depth != (int)g_maxCUDepth - 1)<br>
+                    len = sprintf(stats, "Split "LL"%% ", cntSplit);<br>
+                len += sprintf(stats + len, "Merge "LL"%% Inter "LL"%%", cntSkipCu, cntInter);<br>
<br>
                 if (param.bEnableAMP)<br>
                     len += sprintf(stats + len, "(%dx%d "LL"%% %dx%d "LL"%% %dx%d "LL"%% AMP "LL"%%)",<br>
@@ -461,29 +460,27 @@<br>
                                    cuSize/2, cuSize, cuInterDistribution[2],<br>
                                    cuSize, cuSize/2, cuInterDistribution[1]);<br>
<br>
-                if (cntIntra[depth])<br>
+            }<br>
+            if (cntIntra)<br>
+            {<br>
+                len += sprintf(stats + len, "Intra "LL"%%(DC "LL"%% P "LL"%% Ang "LL"%%",<br>
+                                cntIntra, cuIntraDistribution[0],<br>
+                                cuIntraDistribution[1], cuIntraDistribution[2]);<br>
+                if (sliceType != I_SLICE)<br>
                 {<br>
-                    len += sprintf(stats + len, " Intra "LL"%%(DC "LL"%% P "LL"%% Ang "LL"%%",<br>
-                                   cntIntra[depth], cuIntraDistribution[0],<br>
-                                   cuIntraDistribution[1], cuIntraDistribution[2]);<br>
                     if (depth == (int)g_maxCUDepth - 1)<br>
                         len += sprintf(stats + len, " %dx%d "LL"%%", cuSize/2, cuSize/2, cntIntraNxN);<br>
-                    len += sprintf(stats + len, ")");<br>
                 }<br>
<br>
-                x265_log(&param, X265_LOG_INFO, "%c%-2d: %s\n", sliceType == P_SLICE ? 'P' : 'B', cuSize, stats);<br>
+                len += sprintf(stats + len, ")");<br>
+                if (sliceType == I_SLICE)<br>
+                {<br>
+                    if (depth == (int)g_maxCUDepth - 1)<br>
+                        len += sprintf(stats + len, " %dx%d: "LL"%%", cuSize/2, cuSize/2, cntIntraNxN);<br></blockquote><div><br></div><div>warning that cntIntraNxN could be uninitialised. <br> <br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+                }<br>
             }<br>
-        }<br>
-        if (sliceType == I_SLICE)<br>
-        {<br>
-            char stats[50];<br>
-            if (g_maxCUDepth == 4)<br>
-                sprintf(stats, LL"%%  "LL"%%  "LL"%%  "LL"%%  "LL"%%", cntIntra[0], cntIntra[1], cntIntra[2], cntIntra[3], cntIntraNxN);<br>
-            else if (g_maxCUDepth == 3)<br>
-                sprintf(stats, LL"%%  "LL"%%  "LL"%%  "LL"%%", cntIntra[0], cntIntra[1], cntIntra[2], cntIntraNxN);<br>
-            else<br>
-                sprintf(stats, LL"%%  "LL"%%  "LL"%%", cntIntra[0], cntIntra[1], cntIntraNxN);<br>
-            x265_log(&param, X265_LOG_INFO, "I-frame %d..4:  %s\n", g_maxCUWidth, stats);<br>
+            if (stats[0])<br>
+                x265_log(&param, X265_LOG_INFO, "%c%-2d: %s\n", sliceType == P_SLICE ? 'P' : sliceType == B_SLICE ? 'B' : 'I', cuSize, stats);<br>
         }<br>
     }<br>
     if (param.logLevel >= X265_LOG_INFO)<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>
</blockquote></div><br></div></div>