<div dir="ltr">Ok, thanks. please send a follow-on patch cleaning up both encodeCU and compressCu functions.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 16, 2014 at 11:32 AM, Santhoshini Sekar <span dir="ltr"><<a href="mailto:santhoshini@multicorewareinc.com" target="_blank">santhoshini@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 Tue, Sep 16, 2014 at 10:56 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Tue, Sep 16, 2014 at 9:45 AM,  <span dir="ltr"><<a href="mailto:santhoshini@multicorewareinc.com" target="_blank">santhoshini@multicorewareinc.com</a>></span> wrote:<br></span><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"># HG changeset patch<br>
# User Santhoshini Sekar <<a href="mailto:santhoshini@multicorewareinc.com" target="_blank">santhoshini@multicorewareinc.com</a>><br>
# Date 1410840429 -19800<br>
#      Tue Sep 16 09:37:09 2014 +0530<br>
# Node ID 50505472d3e33b775c70f2f373e1c15d17e47e66<br>
# Parent  7e29b10982d2eb7fd79f581d99996f04184522ba<br>
analysis: add CU specific details to encodeCU()<br>
<br>
diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/analysis.cpp<br>
--- a/source/encoder/analysis.cpp       Thu Sep 11 19:24:28 2014 +0530<br>
+++ b/source/encoder/analysis.cpp       Tue Sep 16 09:37:09 2014 +0530<br>
@@ -301,7 +301,6 @@<br>
 {<br>
     if (cu->m_slice->m_pps->bUseDQP)<br>
         m_bEncodeDQP = true;<br>
-    loadCTUData(cu);<br>
<br>
     // initialize CU data<br>
     m_bestCU[0]->initCU(cu->m_pic, cu->getAddr());<br>
diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/entropy.cpp<br>
--- a/source/encoder/entropy.cpp        Thu Sep 11 19:24:28 2014 +0530<br>
+++ b/source/encoder/entropy.cpp        Tue Sep 16 09:37:09 2014 +0530<br>
@@ -481,14 +481,14 @@<br>
     }<br>
 }<br>
<br>
-void Entropy::encodeCTU(TComDataCU* cu)<br>
+void Entropy::encodeCTU(TComDataCU* cu, CU* cuData)<br>
 {<br>
     bool bEncodeDQP = cu->m_slice->m_pps->bUseDQP;<br>
-    encodeCU(cu, 0, 0, false, bEncodeDQP);<br>
+    encodeCU(cu, 0, 0, bEncodeDQP, cuData);<br>
 }<br>
<br>
 /* encode a CU block recursively */<br>
-void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bInsidePicture, bool& bEncodeDQP)<br>
+void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool& bEncodeDQP, CU* cuData)<br>
 {<br>
     Frame* pic = cu->m_pic;<br>
     Slice* slice = cu->m_slice;<br>
@@ -496,30 +496,24 @@<br>
     if (depth <= slice->m_pps->maxCuDQPDepth && slice->m_pps->bUseDQP)<br>
         bEncodeDQP = true;<br>
<br>
-    if (!bInsidePicture)<br>
+    int cuSplitFlag = !(cuData->flags & CU::LEAF);<br>
+    int cuUnsplitFlag = !(cuData->flags & CU::SPLIT_MANDATORY);<br>
+<br>
+    if (!cuUnsplitFlag)<br>
     {<br>
-        uint32_t xmax = slice->m_sps->picWidthInLumaSamples  - cu->getCUPelX();<br>
-        uint32_t ymax = slice->m_sps->picHeightInLumaSamples - cu->getCUPelY();<br>
-        uint32_t cuSize = g_maxCUSize >> depth;<br>
-<br>
-        bInsidePicture = (g_zscanToPelX[absPartIdx] + cuSize <= xmax &&<br>
-                          g_zscanToPelY[absPartIdx] + cuSize <= ymax);<br>
-<br>
-        if (!bInsidePicture)<br>
+        uint32_t qNumParts = (pic->getNumPartInCU() >> (depth << 1)) >> 2;<br>
+        for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++, absPartIdx += qNumParts)<br>
         {<br>
-            uint32_t qNumParts = (pic->getNumPartInCU() >> (depth << 1)) >> 2;<br>
-            for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++, absPartIdx += qNumParts)<br>
-            {<br>
-                if (g_zscanToPelX[absPartIdx] < xmax && g_zscanToPelY[absPartIdx] < ymax)<br>
-                    encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP);<br>
-            }<br>
-<br>
-            return;<br>
+            CU *childCU = cu->m_CULocalData + cuData->childIdx + partUnitIdx;<br>
+            int cuPresentFlagChild = !(childCU->flags & CU::PRESENT);<br>
+            if (!cuPresentFlagChild)<br>
+                encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU);<br>
         }<br>
+        return;<br>
     }<br>
<br>
     // We need to split, so don't try these modes.<br>
-    if (bInsidePicture && depth < g_maxCUDepth)<br>
+    if (cuSplitFlag)<br>
         codeSplitFlag(cu, absPartIdx, depth);<br>
<br>
     if (depth < cu->getDepth(absPartIdx) && depth < g_maxCUDepth)<br>
@@ -527,7 +521,10 @@<br>
         uint32_t qNumParts = (pic->getNumPartInCU() >> (depth << 1)) >> 2;<br>
<br>
         for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++, absPartIdx += qNumParts)<br>
-            encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP);<br>
+        {<br>
+            CU *childCU = cu->m_CULocalData + cuData->childIdx + partUnitIdx;<br>
+            encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU);<br>
+        }<br>
         return;<br>
     }<br>
<br>
diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/entropy.h<br>
--- a/source/encoder/entropy.h  Thu Sep 11 19:24:28 2014 +0530<br>
+++ b/source/encoder/entropy.h  Tue Sep 16 09:37:09 2014 +0530<br>
@@ -148,7 +148,7 @@<br>
     void codeShortTermRefPicSet(RPS* rps);<br>
     void finishSlice()                 { encodeBinTrm(1); finish(); dynamic_cast<Bitstream*>(m_bitIf)->writeByteAlignment(); }<br>
<br>
-    void encodeCTU(TComDataCU* cu);<br>
+    void encodeCTU(TComDataCU* cu, CU *cuData);<br>
     void codeSaoOffset(SaoLcuParam* saoLcuParam, uint32_t compIdx);<br>
     void codeSaoUnitInterleaving(int compIdx, bool saoFlag, int rx, int ry, SaoLcuParam* saoLcuParam, int cuAddrInSlice, int cuAddrUpInSlice, int allowMergeLeft, int allowMergeUp);<br>
     void codeSaoMerge(uint32_t code)   { encodeBin(code, m_contextState[OFF_SAO_MERGE_FLAG_CTX]); }<br>
@@ -193,7 +193,7 @@<br>
     void encodeBinsEP(uint32_t binValues, int numBins);<br>
     void encodeBinTrm(uint32_t binValue);<br>
<br>
-    void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bInsidePicture, bool& bEncodeDQP);<br>
+    void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool& bEncodeDQP, CU *cuData);<br>
     void finishCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth);<br>
<br>
     void writeOut();<br>
diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/frameencoder.cpp<br>
--- a/source/encoder/frameencoder.cpp   Thu Sep 11 19:24:28 2014 +0530<br>
+++ b/source/encoder/frameencoder.cpp   Tue Sep 16 09:37:09 2014 +0530<br>
@@ -470,8 +470,9 @@<br>
             }<br>
         }<br>
<br>
+        m_tld.cuCoder.loadCTUData(cu);<br>
         // final coding (bitstream generation) for this CU<br>
-        m_entropyCoder.encodeCTU(cu);<br>
+        m_entropyCoder.encodeCTU(cu,  cu->m_CULocalData);<br>
<br></blockquote></div></div><div>Ok. This is the same in compressCU functions as well, but any reason cu->m_CULocalData cant just be accessed inside?<br></div></div></div></div></blockquote><div><br></div></div></div><div>No, we can directly access  cu->m_CULocalData inside <span style="color:rgb(80,0,80)">encodeCTU() and pass it to encodeCU().No particular reason for doing it in this way.</span></div><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>
         if (m_param->bEnableWavefront)<br>
         {<br>
@@ -689,12 +690,13 @@<br>
             // load current best state from go-on entropy coder<br>
             curRow.rdEntropyCoders[0][CI_CURR_BEST].load(rowCoder);<br>
<br>
+        tld.cuCoder.loadCTUData(cu);<br>
         tld.cuCoder.m_quant.setQPforQuant(cu);<br>
         tld.cuCoder.compressCU(cu); // Does all the CU analysis<br>
<br>
         /* advance top-level row coder to include the context of this CTU.<br>
          * if SAO is disabled, rowCoder writes the final CTU bitstream */<br>
-        rowCoder.encodeCTU(cu);<br>
+        rowCoder.encodeCTU(cu, cu->m_CULocalData);<br>
<br>
         if (m_param->bEnableWavefront && col == 1)<br>
             // Save CABAC state for next row<br></span><span>
_______________________________________________<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" 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" target="_blank">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>
<br></blockquote></span></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" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
<br></blockquote></div><br></div>