[x265] TEncEntropy: cleanup bRD arg, fix 4:4:4 intra chroma rate [OUTPUT CHANGE 4:4:4]

Satoshi Nakagawa nakagawa424 at oki.com
Mon Apr 7 06:23:58 CEST 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1396844461 -32400
#      Mon Apr 07 13:21:01 2014 +0900
# Node ID 1112249482420db0ac2a0c501334458797378134
# Parent  a4cb624267f317c999167ae9d5514241ea637c8f
TEncEntropy: cleanup bRD arg, fix 4:4:4 intra chroma rate [OUTPUT CHANGE 4:4:4]

diff -r a4cb624267f3 -r 111224948242 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Sun Apr 06 17:31:49 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Mon Apr 07 13:21:01 2014 +0900
@@ -607,7 +607,7 @@
         }
 
         m_entropyCoder->resetBits();
-        m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth, true);
+        m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth);
         outBestCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
         outBestCU->m_totalCost  = m_rdCost->calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);
 
@@ -661,7 +661,7 @@
         if (!bBoundary)
         {
             m_entropyCoder->resetBits();
-            m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth, true);
+            m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth);
 
             outTempCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
         }
@@ -942,7 +942,7 @@
         }
 
         m_entropyCoder->resetBits();
-        m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth, true);
+        m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth);
         outBestCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
         outBestCU->m_totalCost  = m_rdCost->calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);
 
@@ -1004,7 +1004,7 @@
         if (!bBoundary)
         {
             m_entropyCoder->resetBits();
-            m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth, true);
+            m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth);
 
             outTempCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
         }
@@ -1399,13 +1399,13 @@
     m_entropyCoder->resetBits();
     if (outTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
     {
-        m_entropyCoder->encodeCUTransquantBypassFlag(outTempCU, 0, true);
+        m_entropyCoder->encodeCUTransquantBypassFlag(outTempCU, 0);
     }
-    m_entropyCoder->encodeSkipFlag(outTempCU, 0, true);
-    m_entropyCoder->encodePredMode(outTempCU, 0, true);
-    m_entropyCoder->encodePartSize(outTempCU, 0, depth, true);
-    m_entropyCoder->encodePredInfo(outTempCU, 0, true);
-    m_entropyCoder->encodeIPCMInfo(outTempCU, 0, true);
+    m_entropyCoder->encodeSkipFlag(outTempCU, 0);
+    m_entropyCoder->encodePredMode(outTempCU, 0);
+    m_entropyCoder->encodePartSize(outTempCU, 0, depth);
+    m_entropyCoder->encodePredInfo(outTempCU, 0);
+    m_entropyCoder->encodeIPCMInfo(outTempCU, 0);
 
     // Encode Coefficients
     bool bCodeDQP = getdQPFlag();
@@ -1438,13 +1438,13 @@
     m_entropyCoder->resetBits();
     if (outTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
     {
-        m_entropyCoder->encodeCUTransquantBypassFlag(outTempCU, 0, true);
+        m_entropyCoder->encodeCUTransquantBypassFlag(outTempCU, 0);
     }
-    m_entropyCoder->encodeSkipFlag(outTempCU, 0, true);
-    m_entropyCoder->encodePredMode(outTempCU, 0, true);
-    m_entropyCoder->encodePartSize(outTempCU, 0, depth, true);
-    m_entropyCoder->encodePredInfo(outTempCU, 0, true);
-    m_entropyCoder->encodeIPCMInfo(outTempCU, 0, true);
+    m_entropyCoder->encodeSkipFlag(outTempCU, 0);
+    m_entropyCoder->encodePredMode(outTempCU, 0);
+    m_entropyCoder->encodePartSize(outTempCU, 0, depth);
+    m_entropyCoder->encodePredInfo(outTempCU, 0);
+    m_entropyCoder->encodeIPCMInfo(outTempCU, 0);
 
     // Encode Coefficients
     bool bCodeDQP = getdQPFlag();
@@ -1487,12 +1487,12 @@
     m_entropyCoder->resetBits();
     if (outTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
     {
-        m_entropyCoder->encodeCUTransquantBypassFlag(outTempCU, 0, true);
+        m_entropyCoder->encodeCUTransquantBypassFlag(outTempCU, 0);
     }
-    m_entropyCoder->encodeSkipFlag(outTempCU, 0, true);
-    m_entropyCoder->encodePredMode(outTempCU, 0, true);
-    m_entropyCoder->encodePartSize(outTempCU, 0, depth, true);
-    m_entropyCoder->encodeIPCMInfo(outTempCU, 0, true);
+    m_entropyCoder->encodeSkipFlag(outTempCU, 0);
+    m_entropyCoder->encodePredMode(outTempCU, 0);
+    m_entropyCoder->encodePartSize(outTempCU, 0, depth);
+    m_entropyCoder->encodeIPCMInfo(outTempCU, 0);
 
     m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);
 
diff -r a4cb624267f3 -r 111224948242 source/Lib/TLibEncoder/TEncEntropy.cpp
--- a/source/Lib/TLibEncoder/TEncEntropy.cpp	Sun Apr 06 17:31:49 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncEntropy.cpp	Mon Apr 07 13:21:01 2014 +0900
@@ -94,12 +94,8 @@
     m_entropyCoderIf->codeAUD(slice);
 }
 
-void TEncEntropy::encodeCUTransquantBypassFlag(TComDataCU* cu, uint32_t absPartIdx, bool bRD)
+void TEncEntropy::encodeCUTransquantBypassFlag(TComDataCU* cu, uint32_t absPartIdx)
 {
-    if (bRD)
-    {
-        absPartIdx = 0;
-    }
     m_entropyCoderIf->codeCUTransquantBypassFlag(cu, absPartIdx);
 }
 
@@ -108,16 +104,12 @@
     m_entropyCoderIf->codeVPS(vps);
 }
 
-void TEncEntropy::encodeSkipFlag(TComDataCU* cu, uint32_t absPartIdx, bool bRD)
+void TEncEntropy::encodeSkipFlag(TComDataCU* cu, uint32_t absPartIdx)
 {
     if (cu->getSlice()->isIntra())
     {
         return;
     }
-    if (bRD)
-    {
-        absPartIdx = 0;
-    }
     m_entropyCoderIf->codeSkipFlag(cu, absPartIdx);
 }
 
@@ -136,31 +128,20 @@
  * \param cu
  * \param absPartIdx
  * \param uiPUIdx
- * \param bRD
  * \returns void
  */
-void TEncEntropy::encodeMergeIndex(TComDataCU* cu, uint32_t absPartIdx, bool bRD)
+void TEncEntropy::encodeMergeIndex(TComDataCU* cu, uint32_t absPartIdx)
 {
-    if (bRD)
-    {
-        absPartIdx = 0;
-        assert(cu->getPartitionSize(absPartIdx) == SIZE_2Nx2N);
-    }
     m_entropyCoderIf->codeMergeIndex(cu, absPartIdx);
 }
 
 /** encode prediction mode
  * \param cu
  * \param absPartIdx
- * \param bRD
  * \returns void
  */
-void TEncEntropy::encodePredMode(TComDataCU* cu, uint32_t absPartIdx, bool bRD)
+void TEncEntropy::encodePredMode(TComDataCU* cu, uint32_t absPartIdx)
 {
-    if (bRD)
-    {
-        absPartIdx = 0;
-    }
     if (cu->getSlice()->isIntra())
     {
         return;
@@ -170,12 +151,8 @@
 }
 
 // Split mode
-void TEncEntropy::encodeSplitFlag(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bRD)
+void TEncEntropy::encodeSplitFlag(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth)
 {
-    if (bRD)
-    {
-        absPartIdx = 0;
-    }
     m_entropyCoderIf->codeSplitFlag(cu, absPartIdx, depth);
 }
 
@@ -183,25 +160,19 @@
  * \param cu
  * \param absPartIdx
  * \param depth
- * \param bRD
  * \returns void
  */
-void TEncEntropy::encodePartSize(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bRD)
+void TEncEntropy::encodePartSize(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth)
 {
-    if (bRD)
-    {
-        absPartIdx = 0;
-    }
     m_entropyCoderIf->codePartSize(cu, absPartIdx, depth);
 }
 
 /** Encode I_PCM information.
  * \param cu pointer to CU
  * \param absPartIdx CU index
- * \param bRD flag indicating estimation or encoding
  * \returns void
  */
-void TEncEntropy::encodeIPCMInfo(TComDataCU* cu, uint32_t absPartIdx, bool bRD)
+void TEncEntropy::encodeIPCMInfo(TComDataCU* cu, uint32_t absPartIdx)
 {
     if (!cu->getSlice()->getSPS()->getUsePCM()
         || cu->getCUSize(absPartIdx) > (1 << cu->getSlice()->getSPS()->getPCMLog2MaxSize())
@@ -210,11 +181,6 @@
         return;
     }
 
-    if (bRD)
-    {
-        absPartIdx = 0;
-    }
-
     m_entropyCoderIf->codeIPCMInfo(cu, absPartIdx);
 }
 
@@ -417,57 +383,42 @@
 }
 
 // Intra direction for Chroma
-void TEncEntropy::encodeIntraDirModeChroma(TComDataCU* cu, uint32_t absPartIdx, bool bRD)
+void TEncEntropy::encodeIntraDirModeChroma(TComDataCU* cu, uint32_t absPartIdx)
 {
-    if (bRD)
-    {
-        absPartIdx = 0;
-    }
-
     m_entropyCoderIf->codeIntraDirChroma(cu, absPartIdx);
 }
 
-void TEncEntropy::encodePredInfo(TComDataCU* cu, uint32_t absPartIdx, bool bRD)
+void TEncEntropy::encodePredInfo(TComDataCU* cu, uint32_t absPartIdx)
 {
-    if (bRD)
-    {
-        absPartIdx = 0;
-    }
     if (cu->isIntra(absPartIdx)) // If it is Intra mode, encode intra prediction mode.
     {
         encodeIntraDirModeLuma(cu, absPartIdx, true);
         if (cu->getChromaFormat() != CHROMA_400)
         {
-            encodeIntraDirModeChroma(cu, absPartIdx, bRD);
+            encodeIntraDirModeChroma(cu, absPartIdx);
 
             if ((cu->getChromaFormat() == CHROMA_444) && (cu->getPartitionSize(absPartIdx) == SIZE_NxN))
             {
                 uint32_t partOffset = (cu->getPic()->getNumPartInCU() >> (cu->getDepth(absPartIdx) << 1)) >> 2;
-                encodeIntraDirModeChroma(cu, absPartIdx + partOffset, bRD);
-                encodeIntraDirModeChroma(cu, absPartIdx + partOffset * 2, bRD);
-                encodeIntraDirModeChroma(cu, absPartIdx + partOffset * 3, bRD);
+                encodeIntraDirModeChroma(cu, absPartIdx + partOffset);
+                encodeIntraDirModeChroma(cu, absPartIdx + partOffset * 2);
+                encodeIntraDirModeChroma(cu, absPartIdx + partOffset * 3);
             }
         }
     }
     else                        // if it is Inter mode, encode motion vector and reference index
     {
-        encodePUWise(cu, absPartIdx, bRD);
+        encodePUWise(cu, absPartIdx);
     }
 }
 
 /** encode motion information for every PU block
  * \param cu
  * \param absPartIdx
- * \param bRD
  * \returns void
  */
-void TEncEntropy::encodePUWise(TComDataCU* cu, uint32_t absPartIdx, bool bRD)
+void TEncEntropy::encodePUWise(TComDataCU* cu, uint32_t absPartIdx)
 {
-    if (bRD)
-    {
-        absPartIdx = 0;
-    }
-
     PartSize partSize = cu->getPartitionSize(absPartIdx);
     uint32_t numPU = (partSize == SIZE_2Nx2N ? 1 : (partSize == SIZE_NxN ? 4 : 2));
     uint32_t depth = cu->getDepth(absPartIdx);
diff -r a4cb624267f3 -r 111224948242 source/Lib/TLibEncoder/TEncEntropy.h
--- a/source/Lib/TLibEncoder/TEncEntropy.h	Sun Apr 06 17:31:49 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncEntropy.h	Mon Apr 07 13:21:01 2014 +0900
@@ -151,23 +151,23 @@
     void encodeSPS(TComSPS* sps);
     void encodePPS(TComPPS* pps);
     void encodeAUD(TComSlice* pps);
-    void encodeSplitFlag(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bRD = false);
-    void encodeCUTransquantBypassFlag(TComDataCU* cu, uint32_t absPartIdx, bool bRD = false);
-    void encodeSkipFlag(TComDataCU* cu, uint32_t absPartIdx, bool bRD = false);
-    void encodePUWise(TComDataCU* cu, uint32_t absPartIdx, bool bRD = false);
+    void encodeSplitFlag(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth);
+    void encodeCUTransquantBypassFlag(TComDataCU* cu, uint32_t absPartIdx);
+    void encodeSkipFlag(TComDataCU* cu, uint32_t absPartIdx);
+    void encodePUWise(TComDataCU* cu, uint32_t absPartIdx);
     void encodeInterDirPU(TComDataCU* pcSubCU, uint32_t absPartIdx);
     void encodeRefFrmIdxPU(TComDataCU* pcSubCU, uint32_t absPartIdx, int eRefList);
     void encodeMvdPU(TComDataCU* pcSubCU, uint32_t absPartIdx, int eRefList);
     void encodeMVPIdxPU(TComDataCU* pcSubCU, uint32_t absPartIdx, int eRefList);
     void encodeMergeFlag(TComDataCU* cu, uint32_t absPartIdx);
-    void encodeMergeIndex(TComDataCU* cu, uint32_t absPartIdx, bool bRD = false);
-    void encodePredMode(TComDataCU* cu, uint32_t absPartIdx, bool bRD = false);
-    void encodePartSize(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bRD = false);
-    void encodeIPCMInfo(TComDataCU* cu, uint32_t absPartIdx, bool bRD = false);
-    void encodePredInfo(TComDataCU* cu, uint32_t absPartIdx, bool bRD = false);
+    void encodeMergeIndex(TComDataCU* cu, uint32_t absPartIdx);
+    void encodePredMode(TComDataCU* cu, uint32_t absPartIdx);
+    void encodePartSize(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth);
+    void encodeIPCMInfo(TComDataCU* cu, uint32_t absPartIdx);
+    void encodePredInfo(TComDataCU* cu, uint32_t absPartIdx);
     void encodeIntraDirModeLuma(TComDataCU* cu, uint32_t absPartIdx, bool isMultiplePU = false);
 
-    void encodeIntraDirModeChroma(TComDataCU* cu, uint32_t absPartIdx, bool bRD = false);
+    void encodeIntraDirModeChroma(TComDataCU* cu, uint32_t absPartIdx);
 
     void encodeTransformSubdivFlag(uint32_t symbol, uint32_t ctx);
     void encodeQtCbf(TComDataCU* cu, uint32_t absPartIdx, TextType ttype, uint32_t trDepth);
diff -r a4cb624267f3 -r 111224948242 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Sun Apr 06 17:31:49 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Mon Apr 07 13:21:01 2014 +0900
@@ -285,17 +285,17 @@
             {
                 if (cu->getSlice()->getPPS()->getTransquantBypassEnableFlag())
                 {
-                    m_entropyCoder->encodeCUTransquantBypassFlag(cu, 0, true);
+                    m_entropyCoder->encodeCUTransquantBypassFlag(cu, 0);
                 }
-                m_entropyCoder->encodeSkipFlag(cu, 0, true);
-                m_entropyCoder->encodePredMode(cu, 0, true);
+                m_entropyCoder->encodeSkipFlag(cu, 0);
+                m_entropyCoder->encodePredMode(cu, 0);
             }
 
-            m_entropyCoder->encodePartSize(cu, 0, cu->getDepth(0), true);
+            m_entropyCoder->encodePartSize(cu, 0, cu->getDepth(0));
 
             if (cu->isIntra(0) && cu->getPartitionSize(0) == SIZE_2Nx2N)
             {
-                m_entropyCoder->encodeIPCMInfo(cu, 0, true);
+                m_entropyCoder->encodeIPCMInfo(cu, 0);
 
                 if (cu->getIPCMFlag(0))
                 {
@@ -335,7 +335,7 @@
         {
             if (absPartIdx == 0)
             {
-                m_entropyCoder->encodeIntraDirModeChroma(cu, absPartIdx, true);
+                m_entropyCoder->encodeIntraDirModeChroma(cu, absPartIdx);
             }
         }
         else
@@ -343,7 +343,7 @@
             uint32_t qtNumParts = cu->getTotalNumPart() >> 2;
             assert(trDepth > 0);
             if ((absPartIdx % qtNumParts) == 0)
-                m_entropyCoder->encodeIntraDirModeChroma(cu, absPartIdx, true);
+                m_entropyCoder->encodeIntraDirModeChroma(cu, absPartIdx);
         }
     }
 }
@@ -2573,10 +2573,10 @@
         m_entropyCoder->resetBits();
         if (cu->getSlice()->getPPS()->getTransquantBypassEnableFlag())
         {
-            m_entropyCoder->encodeCUTransquantBypassFlag(cu, 0, true);
+            m_entropyCoder->encodeCUTransquantBypassFlag(cu, 0);
         }
-        m_entropyCoder->encodeSkipFlag(cu, 0, true);
-        m_entropyCoder->encodeMergeIndex(cu, 0, true);
+        m_entropyCoder->encodeSkipFlag(cu, 0);
+        m_entropyCoder->encodeMergeIndex(cu, 0);
 
         bits = m_entropyCoder->getNumberOfWrittenBits();
         m_rdGoOnSbacCoder->store(m_rdSbacCoders[cu->getDepth(0)][CI_TEMP_BEST]);
@@ -3778,10 +3778,10 @@
         m_entropyCoder->resetBits();
         if (cu->getSlice()->getPPS()->getTransquantBypassEnableFlag())
         {
-            m_entropyCoder->encodeCUTransquantBypassFlag(cu, 0, true);
+            m_entropyCoder->encodeCUTransquantBypassFlag(cu, 0);
         }
-        m_entropyCoder->encodeSkipFlag(cu, 0, true);
-        m_entropyCoder->encodeMergeIndex(cu, 0, true);
+        m_entropyCoder->encodeSkipFlag(cu, 0);
+        m_entropyCoder->encodeMergeIndex(cu, 0);
         return m_entropyCoder->getNumberOfWrittenBits();
     }
     else
@@ -3789,12 +3789,12 @@
         m_entropyCoder->resetBits();
         if (cu->getSlice()->getPPS()->getTransquantBypassEnableFlag())
         {
-            m_entropyCoder->encodeCUTransquantBypassFlag(cu, 0, true);
+            m_entropyCoder->encodeCUTransquantBypassFlag(cu, 0);
         }
-        m_entropyCoder->encodeSkipFlag(cu, 0, true);
-        m_entropyCoder->encodePredMode(cu, 0, true);
-        m_entropyCoder->encodePartSize(cu, 0, cu->getDepth(0), true);
-        m_entropyCoder->encodePredInfo(cu, 0, true);
+        m_entropyCoder->encodeSkipFlag(cu, 0);
+        m_entropyCoder->encodePredMode(cu, 0);
+        m_entropyCoder->encodePartSize(cu, 0, cu->getDepth(0));
+        m_entropyCoder->encodePredInfo(cu, 0);
         bool bDummy = false;
         m_entropyCoder->encodeCoeff(cu, 0, cu->getDepth(0), cu->getCUSize(0), cu->getCUSize(0), bDummy);
         return m_entropyCoder->getNumberOfWrittenBits();
diff -r a4cb624267f3 -r 111224948242 source/encoder/compress.cpp
--- a/source/encoder/compress.cpp	Sun Apr 06 17:31:49 2014 -0500
+++ b/source/encoder/compress.cpp	Mon Apr 07 13:21:01 2014 +0900
@@ -55,13 +55,13 @@
     m_entropyCoder->resetBits();
     if (cu->getSlice()->getPPS()->getTransquantBypassEnableFlag())
     {
-        m_entropyCoder->encodeCUTransquantBypassFlag(cu, 0, true);
+        m_entropyCoder->encodeCUTransquantBypassFlag(cu, 0);
     }
-    m_entropyCoder->encodeSkipFlag(cu, 0, true);
-    m_entropyCoder->encodePredMode(cu, 0, true);
-    m_entropyCoder->encodePartSize(cu, 0, depth, true);
-    m_entropyCoder->encodePredInfo(cu, 0, true);
-    m_entropyCoder->encodeIPCMInfo(cu, 0, true);
+    m_entropyCoder->encodeSkipFlag(cu, 0);
+    m_entropyCoder->encodePredMode(cu, 0);
+    m_entropyCoder->encodePartSize(cu, 0, depth);
+    m_entropyCoder->encodePredInfo(cu, 0);
+    m_entropyCoder->encodeIPCMInfo(cu, 0);
 
     // Encode Coefficients
     bool bCodeDQP = getdQPFlag();
@@ -618,7 +618,7 @@
             if (m_param->rdLevel > 1)
             {
                 m_entropyCoder->resetBits();
-                m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth, true);
+                m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth);
                 outBestCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
                 outBestCU->m_totalCost  = m_rdCost->calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);
             }
@@ -740,7 +740,7 @@
             if (m_param->rdLevel > 1)
             {
                 m_entropyCoder->resetBits();
-                m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth, true);
+                m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth);
                 outTempCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
             }
         }


More information about the x265-devel mailing list