[x265] [PATCH] search: removed redundant getAllowedChromaDir function call

ashok at multicorewareinc.com ashok at multicorewareinc.com
Fri Oct 17 16:12:00 CEST 2014


# HG changeset patch
# User Ashok Kumar Mishra<ashok at multicorewareinc.com>
# Date 1413538540 -19800
#      Fri Oct 17 15:05:40 2014 +0530
# Node ID d05635e818c5bb1e5f1f93d7618c6c16dbdb3132
# Parent  0829d64dd7626a425ed1c533d1db73165f53a4ed
search: removed redundant getAllowedChromaDir function call

diff -r 0829d64dd762 -r d05635e818c5 source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Fri Oct 17 02:19:02 2014 -0500
+++ b/source/encoder/entropy.cpp	Fri Oct 17 15:05:40 2014 +0530
@@ -801,14 +801,20 @@
         codeIntraDirLumaAng(cu, absPartIdx, true);
         if (cu.m_chromaFormat != X265_CSP_I400)
         {
-            codeIntraDirChroma(cu, absPartIdx);
+            uint32_t chromaDirMode[NUM_CHROMA_MODE];
+            cu.getAllowedChromaDir(absPartIdx, chromaDirMode);
+
+            codeIntraDirChroma(cu, absPartIdx, chromaDirMode);
 
             if ((cu.m_chromaFormat == X265_CSP_I444) && (cu.m_partSizes[absPartIdx] == SIZE_NxN))
             {
                 uint32_t partOffset = (NUM_CU_PARTITIONS >> (cu.m_depth[absPartIdx] << 1)) >> 2;
-                codeIntraDirChroma(cu, absPartIdx + partOffset);
-                codeIntraDirChroma(cu, absPartIdx + partOffset * 2);
-                codeIntraDirChroma(cu, absPartIdx + partOffset * 3);
+                for (uint32_t i = 1; i <= 3; i++)
+                {
+                    uint32_t offset = absPartIdx + i * partOffset;
+                    cu.getAllowedChromaDir(offset, chromaDirMode);
+                    codeIntraDirChroma(cu, offset, chromaDirMode);
+                }
             }
         }
     }
@@ -1310,7 +1316,7 @@
     }
 }
 
-void Entropy::codeIntraDirChroma(const TComDataCU& cu, uint32_t absPartIdx)
+void Entropy::codeIntraDirChroma(const TComDataCU& cu, uint32_t absPartIdx, uint32_t *chromaDirMode)
 {
     uint32_t intraDirChroma = cu.m_chromaIntraDir[absPartIdx];
 
@@ -1318,12 +1324,9 @@
         encodeBin(0, m_contextState[OFF_CHROMA_PRED_CTX]);
     else
     {
-        uint32_t allowedChromaDir[NUM_CHROMA_MODE];
-        cu.getAllowedChromaDir(absPartIdx, allowedChromaDir);
-
         for (int i = 0; i < NUM_CHROMA_MODE - 1; i++)
         {
-            if (intraDirChroma == allowedChromaDir[i])
+            if (intraDirChroma == chromaDirMode[i])
             {
                 intraDirChroma = i;
                 break;
diff -r 0829d64dd762 -r d05635e818c5 source/encoder/entropy.h
--- a/source/encoder/entropy.h	Fri Oct 17 02:19:02 2014 -0500
+++ b/source/encoder/entropy.h	Fri Oct 17 15:05:40 2014 +0530
@@ -177,7 +177,7 @@
     void codeCoeffNxN(const TComDataCU& cu, const coeff_t* coef, uint32_t absPartIdx, uint32_t log2TrSize, TextType ttype);
 
     void codeIntraDirLumaAng(const TComDataCU& cu, uint32_t absPartIdx, bool isMultiple);
-    void codeIntraDirChroma(const TComDataCU& cu, uint32_t absPartIdx);
+    void codeIntraDirChroma(const TComDataCU& cu, uint32_t absPartIdx, uint32_t *chromaDirMode);
 
     // RDO functions
     void estBit(EstBitsSbac& estBitsSbac, uint32_t log2TrSize, bool bIsLuma) const;
diff -r 0829d64dd762 -r d05635e818c5 source/encoder/search.cpp
--- a/source/encoder/search.cpp	Fri Oct 17 02:19:02 2014 -0500
+++ b/source/encoder/search.cpp	Fri Oct 17 15:05:40 2014 +0530
@@ -1526,14 +1526,15 @@
             if (cu->m_partSizes[0] == SIZE_2Nx2N || cu->m_chromaFormat != X265_CSP_I444)
             {
                 if (!absPartIdxC)
-                    m_entropyCoder.codeIntraDirChroma(*cu, absPartIdxC);
+                    m_entropyCoder.codeIntraDirChroma(*cu, absPartIdxC, modeList);
             }
             else
             {
                 uint32_t qtNumParts = cuData.numPartitions >> 2;
                 if (!(absPartIdxC & (qtNumParts - 1)))
-                    m_entropyCoder.codeIntraDirChroma(*cu, absPartIdxC);
+                    m_entropyCoder.codeIntraDirChroma(*cu, absPartIdxC, modeList);
             }
+
             xEncSubdivCbfQTChroma(*cu, initTrDepth, absPartIdxC, tuIterator.absPartIdxStep, cuSize, cuSize);
             xEncCoeffQTChroma(*cu, initTrDepth, absPartIdxC, TEXT_CHROMA_U);
             xEncCoeffQTChroma(*cu, initTrDepth, absPartIdxC, TEXT_CHROMA_V);


More information about the x265-devel mailing list