<div dir="ltr">Thanks, looks really good, a couple of comments below. <br><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 8, 2015 at 6:24 PM,  <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 1444301894 -19800<br>
#      Thu Oct 08 16:28:14 2015 +0530<br>
# Node ID bd8087bfd93f7564df436a27c22f7e44f6803c4a<br>
# Parent  55a4a9b920ff0385fd0b65c73c4c3f63b8a8cc65<br>
analysis: cleanup intra analysis functions<br>
<br>
During the analysis-load mode, the predicted luma and chroma modes saved in<br>
shared buffers are no longer passed explicitly to intra analysis functions.<br>
Instead the predicted modes are copied to parentCTU, thereby enabling the intra<br>
analysis functions to decide implicitly if modes should be reused.<br>
<br>
diff -r 55a4a9b920ff -r bd8087bfd93f source/common/cudata.cpp<br>
--- a/source/common/cudata.cpp  Thu Oct 08 15:40:43 2015 +0530<br>
+++ b/source/common/cudata.cpp  Thu Oct 08 16:28:14 2015 +0530<br>
@@ -199,6 +199,7 @@<br>
     m_qp        = (int8_t*)charBuf; charBuf += m_numPartitions;<br>
     m_log2CUSize         = charBuf; charBuf += m_numPartitions;<br>
     m_lumaIntraDir       = charBuf; charBuf += m_numPartitions;<br>
+    m_chromaIntraDir     = charBuf; charBuf += m_numPartitions;<br>
     m_tqBypass           = charBuf; charBuf += m_numPartitions;<br>
     m_refIdx[0] = (int8_t*)charBuf; charBuf += m_numPartitions;<br>
     m_refIdx[1] = (int8_t*)charBuf; charBuf += m_numPartitions;<br>
@@ -216,7 +217,6 @@<br>
     m_cbf[0]             = charBuf; charBuf += m_numPartitions;<br>
     m_cbf[1]             = charBuf; charBuf += m_numPartitions;<br>
     m_cbf[2]             = charBuf; charBuf += m_numPartitions;<br>
-    m_chromaIntraDir     = charBuf; charBuf += m_numPartitions;<br>
<br>
     X265_CHECK(charBuf == dataPool.charMemBlock + (m_numPartitions * BytesPerPartition) * (instance + 1), "CU data layout is broken\n");<br>
<br>
@@ -246,7 +246,8 @@<br>
     /* sequential memsets */<br>
     m_partSet((uint8_t*)m_qp, (uint8_t)qp);<br>
     m_partSet(m_log2CUSize,   (uint8_t)g_maxLog2CUSize);<br>
-    m_partSet(m_lumaIntraDir, (uint8_t)DC_IDX);<br>
+    m_partSet(m_lumaIntraDir, (uint8_t)ALL_IDX);<br>
+    m_partSet(m_chromaIntraDir, (uint8_t)ALL_IDX);<br>
     m_partSet(m_tqBypass,     (uint8_t)frame.m_encData->m_param->bLossless);<br>
     if (m_slice->m_sliceType != I_SLICE)<br>
     {<br>
@@ -257,7 +258,7 @@<br>
     X265_CHECK(!(frame.m_encData->m_param->bLossless && !m_slice->m_pps->bTransquantBypassEnabled), "lossless enabled without TQbypass in PPS\n");<br>
<br>
     /* initialize the remaining CU data in one memset */<br>
-    memset(m_cuDepth, 0, (BytesPerPartition - 6) * m_numPartitions);<br>
+    memset(m_cuDepth, 0, (BytesPerPartition - 7) * m_numPartitions);<br>
<br>
     uint32_t widthInCU = m_slice->m_sps->numCuInWidth;<br>
     m_cuLeft = (m_cuAddr % widthInCU) ? m_encData->getPicCTU(m_cuAddr - 1) : NULL;<br>
@@ -284,14 +285,15 @@<br>
     m_partSet((uint8_t*)m_qp, (uint8_t)qp);<br>
<br>
     m_partSet(m_log2CUSize,   (uint8_t)cuGeom.log2CUSize);<br>
-    m_partSet(m_lumaIntraDir, (uint8_t)DC_IDX);<br>
     m_partSet(m_tqBypass,     (uint8_t)m_encData->m_param->bLossless);<br>
     m_partSet((uint8_t*)m_refIdx[0], (uint8_t)REF_NOT_VALID);<br>
     m_partSet((uint8_t*)m_refIdx[1], (uint8_t)REF_NOT_VALID);<br>
     m_partSet(m_cuDepth,      (uint8_t)cuGeom.depth);<br>
+    memcpy(m_lumaIntraDir, ctu.m_lumaIntraDir + cuGeom.absPartIdx, cuGeom.numPartitions);<br>
+    memcpy(m_chromaIntraDir, ctu.m_chromaIntraDir + cuGeom.absPartIdx, cuGeom.numPartitions);<br>
<br>
     /* initialize the remaining CU data in one memset */<br>
-    memset(m_predMode, 0, (BytesPerPartition - 7) * m_numPartitions);<br>
+    memset(m_predMode, 0, (BytesPerPartition - 8) * m_numPartitions);<br>
 }<br>
<br>
 /* Copy the results of a sub-part (split) CU to the parent CU */<br>
diff -r 55a4a9b920ff -r bd8087bfd93f source/common/cudata.h<br>
--- a/source/common/cudata.h    Thu Oct 08 15:40:43 2015 +0530<br>
+++ b/source/common/cudata.h    Thu Oct 08 16:28:14 2015 +0530<br>
@@ -287,6 +287,12 @@<br>
     const CUData* getPUAboveRightAdi(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset) const;<br>
     const CUData* getPUBelowLeftAdi(uint32_t& blPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset) const;<br>
<br>
+    inline void resetIntraModes(bool resetLuma, bool resetChroma)<br>
+    {<br>
+        if (resetLuma) m_partSet(m_lumaIntraDir, (uint8_t)ALL_IDX);<br>
+        if (resetChroma) m_partSet(m_chromaIntraDir, (uint8_t)ALL_IDX);<br>
+    }<br>
+<br>
 protected:<br>
<br>
     template<typename T><br>
diff -r 55a4a9b920ff -r bd8087bfd93f source/encoder/analysis.cpp<br>
--- a/source/encoder/analysis.cpp       Thu Oct 08 15:40:43 2015 +0530<br>
+++ b/source/encoder/analysis.cpp       Thu Oct 08 16:28:14 2015 +0530<br>
@@ -72,7 +72,6 @@<br>
<br>
 Analysis::Analysis()<br>
 {<br>
-    m_reuseIntraDataCTU = NULL;<br>
     m_reuseInterDataCTU = NULL;<br>
     m_reuseRef = NULL;<br>
     m_reuseBestMergeCand = NULL;<br>
@@ -141,17 +140,12 @@<br>
     m_modeDepth[0].fencYuv.copyFromPicYuv(*m_frame->m_fencPic, ctu.m_cuAddr, 0);<br>
<br>
     uint32_t numPartition = ctu.m_numPartitions;<br>
-    if (m_param->analysisMode)<br>
+    if (m_param->analysisMode && m_slice->m_sliceType != I_SLICE)<br>
     {<br>
-        if (m_slice->m_sliceType == I_SLICE)<br>
-            m_reuseIntraDataCTU = (analysis_intra_data*)m_frame->m_analysisData.intraData;<br>
-        else<br>
-        {<br>
-            int numPredDir = m_slice->isInterP() ? 1 : 2;<br>
-            m_reuseInterDataCTU = (analysis_inter_data*)m_frame->m_analysisData.interData;<br>
-            m_reuseRef = &m_reuseInterDataCTU->ref[ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];<br>
-            m_reuseBestMergeCand = &m_reuseInterDataCTU->bestMergeCand[ctu.m_cuAddr * CUGeom::MAX_GEOMS];<br>
-        }<br>
+        int numPredDir = m_slice->isInterP() ? 1 : 2;<br>
+        m_reuseInterDataCTU = (analysis_inter_data*)m_frame->m_analysisData.interData;<br>
+        m_reuseRef = &m_reuseInterDataCTU->ref[ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];<br>
+        m_reuseBestMergeCand = &m_reuseInterDataCTU->bestMergeCand[ctu.m_cuAddr * CUGeom::MAX_GEOMS];<br>
     }<br>
<br>
     ProfileCUScope(ctu, totalCTUTime, totalCTUs);<br>
@@ -159,14 +153,22 @@<br>
     uint32_t zOrder = 0;<br>
     if (m_slice->m_sliceType == I_SLICE)<br>
     {<br>
+        analysis_intra_data* intraDataCTU = (analysis_intra_data*)m_frame->m_analysisData.intraData;<br>
+        if (m_param->analysisMode == X265_ANALYSIS_LOAD)<br>
+        {<br>
+            memcpy(ctu.m_cuDepth, &intraDataCTU->depth[ctu.m_cuAddr * numPartition], sizeof(uint8_t) * numPartition);<br>
+            memcpy(ctu.m_lumaIntraDir, &intraDataCTU->modes[ctu.m_cuAddr * numPartition], sizeof(uint8_t) * numPartition);<br>
+            memcpy(ctu.m_partSize, &intraDataCTU->partSizes[ctu.m_cuAddr * numPartition], sizeof(char) * numPartition);<br>
+            memcpy(ctu.m_chromaIntraDir, &intraDataCTU->chromaModes[ctu.m_cuAddr * numPartition], sizeof(uint8_t) * numPartition);<br>
+        }<br>
         compressIntraCU(ctu, cuGeom, zOrder, qp);<br>
-        if (m_param->analysisMode == X265_ANALYSIS_SAVE && m_frame->m_analysisData.intraData)<br>
+        if (m_param->analysisMode == X265_ANALYSIS_SAVE && intraDataCTU)<br>
         {<br>
             CUData* bestCU = &m_modeDepth[0].bestMode->cu;<br>
-            memcpy(&m_reuseIntraDataCTU->depth[ctu.m_cuAddr * numPartition], bestCU->m_cuDepth, sizeof(uint8_t) * numPartition);<br>
-            memcpy(&m_reuseIntraDataCTU->modes[ctu.m_cuAddr * numPartition], bestCU->m_lumaIntraDir, sizeof(uint8_t) * numPartition);<br>
-            memcpy(&m_reuseIntraDataCTU->partSizes[ctu.m_cuAddr * numPartition], bestCU->m_partSize, sizeof(uint8_t) * numPartition);<br>
-            memcpy(&m_reuseIntraDataCTU->chromaModes[ctu.m_cuAddr * numPartition], bestCU->m_chromaIntraDir, sizeof(uint8_t) * numPartition);<br>
+            memcpy(&intraDataCTU->depth[ctu.m_cuAddr * numPartition], bestCU->m_cuDepth, sizeof(uint8_t) * numPartition);<br>
+            memcpy(&intraDataCTU->modes[ctu.m_cuAddr * numPartition], bestCU->m_lumaIntraDir, sizeof(uint8_t) * numPartition);<br>
+            memcpy(&intraDataCTU->partSizes[ctu.m_cuAddr * numPartition], bestCU->m_partSize, sizeof(uint8_t) * numPartition);<br>
+            memcpy(&intraDataCTU->chromaModes[ctu.m_cuAddr * numPartition], bestCU->m_chromaIntraDir, sizeof(uint8_t) * numPartition);<br>
         }<br>
     }<br>
     else<br>
@@ -213,8 +215,7 @@<br>
         md.pred[PRED_LOSSLESS].initCosts();<br>
         md.pred[PRED_LOSSLESS].cu.initLosslessCU(md.bestMode->cu, cuGeom);<br>
         PartSize size = (PartSize)md.pred[PRED_LOSSLESS].cu.m_partSize[0];<br>
-        uint8_t* modes = md.pred[PRED_LOSSLESS].cu.m_lumaIntraDir;<br>
-        checkIntra(md.pred[PRED_LOSSLESS], cuGeom, size, modes, NULL);<br>
+        checkIntra(md.pred[PRED_LOSSLESS], cuGeom, size);<br>
         checkBestMode(md.pred[PRED_LOSSLESS], cuGeom.depth);<br>
     }<br>
     else<br>
@@ -236,42 +237,37 @@<br>
     bool mightSplit = !(cuGeom.flags & CUGeom::LEAF);<br>
     bool mightNotSplit = !(cuGeom.flags & CUGeom::SPLIT_MANDATORY);<br>
<br>
-    if (m_param->analysisMode == X265_ANALYSIS_LOAD)<br>
+    bool bAlreadyDecided = parentCTU.m_lumaIntraDir[cuGeom.absPartIdx] != (uint8_t)ALL_IDX;<br>
+    bool bDecidedDepth = parentCTU.m_cuDepth[cuGeom.absPartIdx] == depth;<br>
+<br>
+    // stop recursion if we reach the depth of previous analysis decision<br>
+    mightSplit &= !(bAlreadyDecided && bDecidedDepth);<br>
+<br>
+    if (bAlreadyDecided)<br>
     {<br>
-        uint8_t* reuseDepth  = &m_reuseIntraDataCTU->depth[parentCTU.m_cuAddr * parentCTU.m_numPartitions];<br>
-        uint8_t* reuseModes  = &m_reuseIntraDataCTU->modes[parentCTU.m_cuAddr * parentCTU.m_numPartitions];<br>
-        char* reusePartSizes = &m_reuseIntraDataCTU->partSizes[parentCTU.m_cuAddr * parentCTU.m_numPartitions];<br>
-        uint8_t* reuseChromaModes = &m_reuseIntraDataCTU->chromaModes[parentCTU.m_cuAddr * parentCTU.m_numPartitions];<br>
-<br>
-        if (mightNotSplit && depth == reuseDepth[zOrder] && zOrder == cuGeom.absPartIdx)<br>
+        if (bDecidedDepth)<br>
         {<br>
-            PartSize size = (PartSize)reusePartSizes[zOrder];<br>
-            Mode& mode = size == SIZE_2Nx2N ? md.pred[PRED_INTRA] : md.pred[PRED_INTRA_NxN];<br>
+            Mode& mode = md.pred[0];<br></blockquote><div><br></div><div>need to use the correct enum PRED_INTRA above. <br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+            md.bestMode = &mode;<br>
             mode.cu.initSubCU(parentCTU, cuGeom, qp);<br>
-            checkIntra(mode, cuGeom, size, &reuseModes[zOrder], &reuseChromaModes[zOrder]);<br>
-            checkBestMode(mode, depth);<br>
-<br></blockquote><div><br></div><div>So, instead of copying the dirs in initSubCU and then resetting them everywhere else,  can't we just copy the dirs into the subCU if bAlreadyDecided is true right here?<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+            checkIntra(mode, cuGeom, (PartSize)parentCTU.m_partSize[cuGeom.absPartIdx]);<br>
             if (m_bTryLossless)<br>
                 tryLossless(cuGeom);<br>
<br>
             if (mightSplit)<br>
                 addSplitFlagCost(*md.bestMode, cuGeom.depth);<br>
-<br>
-            // increment zOrder offset to point to next best depth in sharedDepth buffer<br>
-            zOrder += g_depthInc[g_maxCUDepth - 1][reuseDepth[zOrder]];<br>
-            mightSplit = false;<br>
         }<br>
     }<br>
     else if (mightNotSplit)<br>
     {<br>
         md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom, qp);<br>
-        checkIntra(md.pred[PRED_INTRA], cuGeom, SIZE_2Nx2N, NULL, NULL);<br>
+        checkIntra(md.pred[PRED_INTRA], cuGeom, SIZE_2Nx2N);<br>
         checkBestMode(md.pred[PRED_INTRA], depth);<br>
<br>
         if (cuGeom.log2CUSize == 3 && m_slice->m_sps->quadtreeTULog2MinSize < 3)<br>
         {<br>
             md.pred[PRED_INTRA_NxN].cu.initSubCU(parentCTU, cuGeom, qp);<br>
-            checkIntra(md.pred[PRED_INTRA_NxN], cuGeom, SIZE_NxN, NULL, NULL);<br>
+            checkIntra(md.pred[PRED_INTRA_NxN], cuGeom, SIZE_NxN);<br>
             checkBestMode(md.pred[PRED_INTRA_NxN], depth);<br>
         }<br>
<br>
@@ -389,6 +385,7 @@<br>
             switch (pmode.modes[task])<br>
             {<br>
             case PRED_INTRA:<br>
+                md.pred[PRED_INTRA].cu.resetIntraModes(true, true);<br>
                 slave.checkIntraInInter(md.pred[PRED_INTRA], pmode.cuGeom);<br>
                 if (m_param->rdLevel > 2)<br>
                     slave.encodeIntraInInter(md.pred[PRED_INTRA], pmode.cuGeom);<br>
@@ -454,9 +451,10 @@<br>
             switch (pmode.modes[task])<br>
             {<br>
             case PRED_INTRA:<br>
-                slave.checkIntra(md.pred[PRED_INTRA], pmode.cuGeom, SIZE_2Nx2N, NULL, NULL);<br>
+                md.pred[PRED_INTRA].cu.resetIntraModes(true, true);<br>
+                slave.checkIntra(md.pred[PRED_INTRA], pmode.cuGeom, SIZE_2Nx2N);<br>
                 if (pmode.cuGeom.log2CUSize == 3 && m_slice->m_sps->quadtreeTULog2MinSize < 3)<br>
-                    slave.checkIntra(md.pred[PRED_INTRA_NxN], pmode.cuGeom, SIZE_NxN, NULL, NULL);<br>
+                    slave.checkIntra(md.pred[PRED_INTRA_NxN], pmode.cuGeom, SIZE_NxN);<br>
                 break;<br>
<br>
             case PRED_2Nx2N:<br>
@@ -720,6 +718,7 @@<br>
                 if (bTryIntra && md.pred[PRED_INTRA].sa8dCost < md.bestMode->sa8dCost)<br>
                 {<br>
                     md.bestMode = &md.pred[PRED_INTRA];<br>
+                    md.bestMode->cu.resetIntraModes(false, true);<br>
                     encodeIntraInInter(*md.bestMode, cuGeom);<br>
                 }<br>
                 else if (!md.bestMode->cu.m_mergeFlag[0])<br>
@@ -1026,6 +1025,7 @@<br>
                     {<br>
                         ProfileCounter(parentCTU, totalIntraCU[cuGeom.depth]);<br>
                         md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom, qp);<br>
+                        md.pred[PRED_INTRA].cu.resetIntraModes(true, true);<br>
                         checkIntraInInter(md.pred[PRED_INTRA], cuGeom);<br>
                         encodeIntraInInter(md.pred[PRED_INTRA], cuGeom);<br>
                         checkBestMode(md.pred[PRED_INTRA], depth);<br>
@@ -1052,6 +1052,7 @@<br>
                     {<br>
                         ProfileCounter(parentCTU, totalIntraCU[cuGeom.depth]);<br>
                         md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom, qp);<br>
+                        md.pred[PRED_INTRA].cu.resetIntraModes(true, false);<br>
                         checkIntraInInter(md.pred[PRED_INTRA], cuGeom);<br>
                         if (md.pred[PRED_INTRA].sa8dCost < md.bestMode->sa8dCost)<br>
                             md.bestMode = &md.pred[PRED_INTRA];<br>
@@ -1104,7 +1105,10 @@<br>
                 else<br>
                 {<br>
                     if (m_param->rdLevel == 2)<br>
+                    {<br>
+                        md.bestMode->cu.resetIntraModes(false, true);<br>
                         encodeIntraInInter(*md.bestMode, cuGeom);<br>
+                    }<br>
                     else if (m_param->rdLevel == 1)<br>
                     {<br>
                         /* generate recon pixels with no rate distortion considerations */<br>
@@ -1374,13 +1378,15 @@<br>
                 {<br>
                     ProfileCounter(parentCTU, totalIntraCU[cuGeom.depth]);<br>
                     md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom, qp);<br>
-                    checkIntra(md.pred[PRED_INTRA], cuGeom, SIZE_2Nx2N, NULL, NULL);<br>
+                    md.pred[PRED_INTRA].cu.resetIntraModes(true, true);<br>
+                    checkIntra(md.pred[PRED_INTRA], cuGeom, SIZE_2Nx2N);<br>
                     checkBestMode(md.pred[PRED_INTRA], depth);<br>
<br>
                     if (cuGeom.log2CUSize == 3 && m_slice->m_sps->quadtreeTULog2MinSize < 3)<br>
                     {<br>
                         md.pred[PRED_INTRA_NxN].cu.initSubCU(parentCTU, cuGeom, qp);<br>
-                        checkIntra(md.pred[PRED_INTRA_NxN], cuGeom, SIZE_NxN, NULL, NULL);<br>
+                        md.pred[PRED_INTRA_NxN].cu.resetIntraModes(true, true);<br>
+                        checkIntra(md.pred[PRED_INTRA_NxN], cuGeom, SIZE_NxN);<br>
                         checkBestMode(md.pred[PRED_INTRA_NxN], depth);<br>
                     }<br>
                 }<br>
diff -r 55a4a9b920ff -r bd8087bfd93f source/encoder/analysis.h<br>
--- a/source/encoder/analysis.h Thu Oct 08 15:40:43 2015 +0530<br>
+++ b/source/encoder/analysis.h Thu Oct 08 16:28:14 2015 +0530<br>
@@ -104,7 +104,6 @@<br>
 protected:<br>
<br>
     /* Analysis data for load/save modes, keeps getting incremented as CTU analysis proceeds and data is consumed or read */<br>
-    analysis_intra_data* m_reuseIntraDataCTU;<br>
     analysis_inter_data* m_reuseInterDataCTU;<br>
     int32_t*             m_reuseRef;<br>
     uint32_t*            m_reuseBestMergeCand;<br>
diff -r 55a4a9b920ff -r bd8087bfd93f source/encoder/search.cpp<br>
--- a/source/encoder/search.cpp Thu Oct 08 15:40:43 2015 +0530<br>
+++ b/source/encoder/search.cpp Thu Oct 08 16:28:14 2015 +0530<br>
@@ -1157,7 +1157,7 @@<br>
     }<br>
 }<br>
<br>
-void Search::checkIntra(Mode& intraMode, const CUGeom& cuGeom, PartSize partSize, uint8_t* sharedModes, uint8_t* sharedChromaModes)<br>
+void Search::checkIntra(Mode& intraMode, const CUGeom& cuGeom, PartSize partSize)<br>
 {<br>
     CUData& cu = intraMode.cu;<br>
<br>
@@ -1168,8 +1168,8 @@<br>
     cu.getIntraTUQtDepthRange(tuDepthRange, 0);<br>
<br>
     intraMode.initCosts();<br>
-    intraMode.lumaDistortion += estIntraPredQT(intraMode, cuGeom, tuDepthRange, sharedModes);<br>
-    intraMode.chromaDistortion += estIntraPredChromaQT(intraMode, cuGeom, sharedChromaModes);<br>
+    intraMode.lumaDistortion += estIntraPredQT(intraMode, cuGeom, tuDepthRange);<br>
+    intraMode.chromaDistortion += estIntraPredChromaQT(intraMode, cuGeom);<br>
     intraMode.distortion += intraMode.lumaDistortion + intraMode.chromaDistortion;<br>
<br>
     m_entropyCoder.resetBits();<br>
@@ -1388,7 +1388,7 @@<br>
     extractIntraResultQT(cu, *reconYuv, 0, 0);<br>
<br>
     intraMode.lumaDistortion = icosts.distortion;<br>
-    intraMode.chromaDistortion = estIntraPredChromaQT(intraMode, cuGeom, NULL);<br>
+    intraMode.chromaDistortion = estIntraPredChromaQT(intraMode, cuGeom);<br>
     intraMode.distortion = intraMode.lumaDistortion + intraMode.chromaDistortion;<br>
<br>
     m_entropyCoder.resetBits();<br>
@@ -1416,7 +1416,7 @@<br>
     checkDQP(intraMode, cuGeom);<br>
 }<br>
<br>
-uint32_t Search::estIntraPredQT(Mode &intraMode, const CUGeom& cuGeom, const uint32_t depthRange[2], uint8_t* sharedModes)<br>
+uint32_t Search::estIntraPredQT(Mode &intraMode, const CUGeom& cuGeom, const uint32_t depthRange[2])<br>
 {<br>
     CUData& cu = intraMode.cu;<br>
     Yuv* reconYuv = &intraMode.reconYuv;<br>
@@ -1440,8 +1440,8 @@<br>
     {<br>
         uint32_t bmode = 0;<br>
<br>
-        if (sharedModes)<br>
-            bmode = sharedModes[puIdx];<br>
+        if (intraMode.cu.m_lumaIntraDir[puIdx] != (uint8_t)ALL_IDX)<br>
+            bmode = intraMode.cu.m_lumaIntraDir[puIdx];<br>
         else<br>
         {<br>
             uint64_t candCostList[MAX_RD_INTRA_MODES];<br>
@@ -1680,7 +1680,7 @@<br>
     cu.setChromIntraDirSubParts(bestMode, 0, cuGeom.depth);<br>
 }<br>
<br>
-uint32_t Search::estIntraPredChromaQT(Mode &intraMode, const CUGeom& cuGeom, uint8_t* sharedChromaModes)<br>
+uint32_t Search::estIntraPredChromaQT(Mode &intraMode, const CUGeom& cuGeom)<br>
 {<br>
     CUData& cu = intraMode.cu;<br>
     Yuv& reconYuv = intraMode.reconYuv;<br>
@@ -1708,10 +1708,10 @@<br>
         uint32_t maxMode = NUM_CHROMA_MODE;<br>
         uint32_t modeList[NUM_CHROMA_MODE];<br>
<br>
-        if (sharedChromaModes && !initTuDepth)<br>
+        if (intraMode.cu.m_chromaIntraDir[0] != (uint8_t)ALL_IDX && !initTuDepth)<br>
         {<br>
             for (uint32_t l = 0; l < NUM_CHROMA_MODE; l++)<br>
-                modeList[l] = sharedChromaModes[0];<br>
+                modeList[l] = intraMode.cu.m_chromaIntraDir[0];<br>
             maxMode = 1;<br>
         }<br>
         else<br>
diff -r 55a4a9b920ff -r bd8087bfd93f source/encoder/search.h<br>
--- a/source/encoder/search.h   Thu Oct 08 15:40:43 2015 +0530<br>
+++ b/source/encoder/search.h   Thu Oct 08 16:28:14 2015 +0530<br>
@@ -338,8 +338,8 @@<br>
     // mark temp RD entropy contexts as uninitialized; useful for finding loads without stores<br>
     void     invalidateContexts(int fromDepth);<br>
<br>
-    // full RD search of intra modes. if sharedModes is not NULL, it directly uses them<br>
-    void     checkIntra(Mode& intraMode, const CUGeom& cuGeom, PartSize partSize, uint8_t* sharedModes, uint8_t* sharedChromaModes);<br>
+    // full RD search of intra modes<br>
+    void     checkIntra(Mode& intraMode, const CUGeom& cuGeom, PartSize partSizes);<br>
<br>
     // select best intra mode using only sa8d costs, cannot measure NxN intra<br>
     void     checkIntraInInter(Mode& intraMode, const CUGeom& cuGeom);<br>
@@ -405,10 +405,10 @@<br>
     void     saveResidualQTData(CUData& cu, ShortYuv& resiYuv, uint32_t absPartIdx, uint32_t tuDepth);<br>
<br>
     // RDO search of luma intra modes; result is fully encoded luma. luma distortion is returned<br>
-    uint32_t estIntraPredQT(Mode &intraMode, const CUGeom& cuGeom, const uint32_t depthRange[2], uint8_t* sharedModes);<br>
+    uint32_t estIntraPredQT(Mode &intraMode, const CUGeom& cuGeom, const uint32_t depthRange[2]);<br>
<br>
     // RDO select best chroma mode from luma; result is fully encode chroma. chroma distortion is returned<br>
-    uint32_t estIntraPredChromaQT(Mode &intraMode, const CUGeom& cuGeom, uint8_t* sharedChromaModes);<br>
+    uint32_t estIntraPredChromaQT(Mode &intraMode, const CUGeom& cuGeom);<br>
<br>
     void     codeSubdivCbfQTChroma(const CUData& cu, uint32_t tuDepth, uint32_t absPartIdx);<br>
     void     codeInterSubdivCbfQT(CUData& cu, uint32_t absPartIdx, const uint32_t tuDepth, const uint32_t depthRange[2]);<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>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div>Deepthi Nandakumar<br></div>Engineering Manager, x265<br></div>Multicoreware, Inc<br></div></div>
</div></div></div>