[x265] cleanup unused variables

Satoshi Nakagawa nakagawa424 at oki.com
Mon Feb 17 08:57:49 CET 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1392623778 -32400
#      Mon Feb 17 16:56:18 2014 +0900
# Node ID 3bd3525dc31fa93819deca8cd377d531206d00b2
# Parent  ce96cdb390fe26aee6effa731e51303c1d9056b0
cleanup unused variables

diff -r ce96cdb390fe -r 3bd3525dc31f source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Sun Feb 16 22:47:32 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Mon Feb 17 16:56:18 2014 +0900
@@ -920,7 +920,7 @@
     return NULL;
 }
 
-TComDataCU* TComDataCU::getPUBelowLeftAdi(uint32_t& blPartUnitIdx,  uint32_t curPartUnitIdx, uint32_t partUnitOffset, bool bEnforceSliceRestriction)
+TComDataCU* TComDataCU::getPUBelowLeftAdi(uint32_t& blPartUnitIdx,  uint32_t curPartUnitIdx, uint32_t partUnitOffset)
 {
     uint32_t absPartIdxLB     = g_zscanToRaster[curPartUnitIdx];
     uint32_t absZorderCUIdxLB = g_zscanToRaster[m_absIdxInLCU] + ((m_height[0] / m_pic->getMinCUHeight()) - 1) * m_pic->getNumPartInWidth();
@@ -954,7 +954,7 @@
             return NULL;
         }
         blPartUnitIdx = g_rasterToZscan[absPartIdxLB + (1 + partUnitOffset) * numPartInCUWidth - 1];
-        if ((bEnforceSliceRestriction && (m_cuLeft == NULL || m_cuLeft->getSlice() == NULL)))
+        if (m_cuLeft == NULL || m_cuLeft->getSlice() == NULL)
         {
             return NULL;
         }
@@ -965,7 +965,7 @@
     return NULL;
 }
 
-TComDataCU* TComDataCU::getPUAboveRightAdi(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset, bool bEnforceSliceRestriction)
+TComDataCU* TComDataCU::getPUAboveRightAdi(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset)
 {
     uint32_t absPartIdxRT     = g_zscanToRaster[curPartUnitIdx];
     uint32_t absZorderCUIdx   = g_zscanToRaster[m_absIdxInLCU] + (m_width[0] / m_pic->getMinCUWidth()) - 1;
@@ -999,7 +999,7 @@
             return NULL;
         }
         arPartUnitIdx = g_rasterToZscan[absPartIdxRT + m_pic->getNumPartInCU() - numPartInCUWidth + partUnitOffset];
-        if ((bEnforceSliceRestriction && (m_cuAbove == NULL || m_cuAbove->getSlice() == NULL)))
+        if (m_cuAbove == NULL || m_cuAbove->getSlice() == NULL)
         {
             return NULL;
         }
@@ -1013,8 +1013,8 @@
     }
 
     arPartUnitIdx = g_rasterToZscan[m_pic->getNumPartInCU() - numPartInCUWidth + partUnitOffset - 1];
-    if ((bEnforceSliceRestriction && (m_cuAboveRight == NULL || m_cuAboveRight->getSlice() == NULL ||
-                                      (m_cuAboveRight->getAddr()) > getAddr())))
+    if ((m_cuAboveRight == NULL || m_cuAboveRight->getSlice() == NULL ||
+         (m_cuAboveRight->getAddr()) > getAddr()))
     {
         return NULL;
     }
@@ -2460,18 +2460,9 @@
     }
 }
 
-bool TComDataCU::isBipredRestriction(uint32_t puIdx)
+bool TComDataCU::isBipredRestriction()
 {
-    int width = 0;
-    int height = 0;
-    uint32_t partAddr;
-
-    getPartIndexAndSize(puIdx, partAddr, width, height);
-    if (getWidth(0) == 8 && (width < 8 || height < 8))
-    {
-        return true;
-    }
-    return false;
+    return getWidth(0) == 8 && getPartitionSize(0) != SIZE_2Nx2N;
 }
 
 void TComDataCU::clipMv(MV& outMV)
@@ -2505,11 +2496,6 @@
     return cnt > 6 ? 6 : cnt;
 }
 
-void TComDataCU::clearCbf(uint32_t idx, TextType ttype, uint32_t numParts)
-{
-    ::memset(&m_cbf[ttype][idx], 0, sizeof(UChar) * numParts);
-}
-
 /** Set a I_PCM flag for all sub-partitions of a partition.
  * \param bIpcmFlag I_PCM flag
  * \param absPartIdx partition index
diff -r ce96cdb390fe -r 3bd3525dc31f source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Sun Feb 16 22:47:32 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.h	Mon Feb 17 16:56:18 2014 +0900
@@ -312,7 +312,6 @@
 
     void          setCbf(uint32_t idx, TextType ttype, UChar uh)     { m_cbf[ttype][idx] = uh; }
 
-    void          clearCbf(uint32_t idx, TextType ttype, uint32_t numParts);
     UChar         getQtRootCbf(uint32_t idx)           { return getCbf(idx, TEXT_LUMA, 0) || getCbf(idx, TEXT_CHROMA_U, 0) || getCbf(idx, TEXT_CHROMA_V, 0); }
 
     void          setCbfSubParts(uint32_t cbfY, uint32_t cbfU, uint32_t cbfV, uint32_t absPartIdx, uint32_t depth);
@@ -426,8 +425,8 @@
     TComDataCU*   getQpMinCuAbove(uint32_t& aPartUnitIdx, uint32_t currAbsIdxInLCU);
     char          getRefQP(uint32_t uiCurrAbsIdxInLCU);
 
-    TComDataCU*   getPUAboveRightAdi(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset = 1, bool bEnforceSliceRestriction = true);
-    TComDataCU*   getPUBelowLeftAdi(uint32_t& blPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset = 1, bool bEnforceSliceRestriction = true);
+    TComDataCU*   getPUAboveRightAdi(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset = 1);
+    TComDataCU*   getPUBelowLeftAdi(uint32_t& blPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset = 1);
 
     void          deriveLeftRightTopIdx(uint32_t partIdx, uint32_t& partIdxLT, uint32_t& partIdxRT);
     void          deriveLeftBottomIdx(uint32_t partIdx, uint32_t& partIdxLB);
@@ -447,7 +446,7 @@
     bool          isIntra(uint32_t partIdx)  { return m_predModes[partIdx] == MODE_INTRA; }
 
     bool          isSkipped(uint32_t partIdx); ///< SKIP (no residual)
-    bool          isBipredRestriction(uint32_t puIdx);
+    bool          isBipredRestriction();
 
     // -------------------------------------------------------------------------------------------------------------------
     // member functions for symbol prediction (most probable / mode conversion)
diff -r ce96cdb390fe -r 3bd3525dc31f source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Sun Feb 16 22:47:32 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Mon Feb 17 16:56:18 2014 +0900
@@ -534,14 +534,10 @@
     // get Original YUV data from picture
     m_origYuv[depth]->copyFromPicYuv(pic->getPicYuvOrg(), outBestCU->getAddr(), outBestCU->getZorderIdxInCU());
 
-    // variables for fast encoder decision
-    bool bTrySplit = true;
-
     // variable for Early CU determination
     bool bSubBranch = true;
 
     // variable for Cbf fast mode PU decision
-    bool bTrySplitDQP = true;
     bool bBoundary = false;
 
     uint32_t lpelx = outBestCU->getCUPelX();
@@ -563,13 +559,8 @@
     //We need to split; so dont try these modes
     if (!bSliceEnd && bInsidePicture)
     {
-        // variables for fast encoder decision
-        bTrySplit = true;
-
         outTempCU->initEstData(depth, qp);
 
-        bTrySplitDQP = bTrySplit;
-
         xCheckRDCostIntra(outBestCU, outTempCU, SIZE_2Nx2N);
         outTempCU->initEstData(depth, qp);
 
@@ -600,7 +591,7 @@
     outTempCU->initEstData(depth, qp);
 
     // further split
-    if (bSubBranch && bTrySplitDQP && depth < g_maxCUDepth - g_addCUDepth)
+    if (bSubBranch && depth < g_maxCUDepth - g_addCUDepth)
     {
         for (; partUnitIdx < 4; partUnitIdx++)
         {
@@ -695,9 +686,6 @@
     // get Original YUV data from picture
     m_origYuv[depth]->copyFromPicYuv(pic->getPicYuvOrg(), outBestCU->getAddr(), outBestCU->getZorderIdxInCU());
 
-    // variables for fast encoder decision
-    bool bTrySplit = true;
-
     // variable for Early CU determination
     bool bSubBranch = true;
 
@@ -705,8 +693,6 @@
     bool doNotBlockPu = true;
     bool earlyDetectionSkipMode = false;
 
-    bool bTrySplitDQP = true;
-
     bool bBoundary = false;
     uint32_t lpelx = outBestCU->getCUPelX();
     uint32_t rpelx = lpelx + outBestCU->getWidth(0)  - 1;
@@ -725,9 +711,6 @@
     // We need to split, so don't try these modes.
     if (!bSliceEnd && bInsidePicture)
     {
-        // variables for fast encoder decision
-        bTrySplit    = true;
-
         outTempCU->initEstData(depth, qp);
 
         // do inter modes, SKIP and 2Nx2N
@@ -756,8 +739,6 @@
             }
         }
 
-        bTrySplitDQP = bTrySplit;
-
         if (!earlyDetectionSkipMode)
         {
             outTempCU->initEstData(depth, qp);
@@ -946,7 +927,7 @@
     outTempCU->initEstData(depth, qp);
 
     // further split
-    if (bSubBranch && bTrySplitDQP && depth < g_maxCUDepth - g_addCUDepth)
+    if (bSubBranch && depth < g_maxCUDepth - g_addCUDepth)
     {
         UChar       nextDepth     = depth + 1;
         TComDataCU* subBestPartCU = m_bestCU[nextDepth];
diff -r ce96cdb390fe -r 3bd3525dc31f source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Sun Feb 16 22:47:32 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Mon Feb 17 16:56:18 2014 +0900
@@ -2503,7 +2503,7 @@
     {
         cu->getInterMergeCandidates(absPartIdx, puIdx, mvFieldNeighbours, interDirNeighbours, numValidMergeCand);
     }
-    xRestrictBipredMergeCand(cu, puIdx, mvFieldNeighbours, interDirNeighbours, numValidMergeCand);
+    xRestrictBipredMergeCand(cu, mvFieldNeighbours, interDirNeighbours, numValidMergeCand);
 
     outCost = MAX_UINT;
     for (uint32_t mergeCand = 0; mergeCand < numValidMergeCand; ++mergeCand)
@@ -2543,9 +2543,9 @@
  * \param numValidMergeCand
  * \returns void
  */
-void TEncSearch::xRestrictBipredMergeCand(TComDataCU* cu, uint32_t puIdx, TComMvField* mvFieldNeighbours, UChar* interDirNeighbours, int numValidMergeCand)
+void TEncSearch::xRestrictBipredMergeCand(TComDataCU* cu, TComMvField* mvFieldNeighbours, UChar* interDirNeighbours, int numValidMergeCand)
 {
-    if (cu->isBipredRestriction(puIdx))
+    if (cu->isBipredRestriction())
     {
         for (uint32_t mergeCand = 0; mergeCand < numValidMergeCand; ++mergeCand)
         {
@@ -2680,7 +2680,7 @@
             }
 
             // Bi-directional prediction
-            if ((cu->getSlice()->isInterB()) && (cu->isBipredRestriction(partIdx) == false))
+            if ((cu->getSlice()->isInterB()) && (cu->isBipredRestriction() == false))
             {
                 mvBidir[0] = mv[0];
                 mvBidir[1] = mv[1];
@@ -3146,21 +3146,6 @@
     int      qp, qpBest = 0;
     uint64_t cost, bcost = MAX_INT64;
 
-    uint32_t trLevel = 0;
-    if ((cu->getWidth(0) > cu->getSlice()->getSPS()->getMaxTrSize()))
-    {
-        while (cu->getWidth(0) > (cu->getSlice()->getSPS()->getMaxTrSize() << trLevel))
-        {
-            trLevel++;
-        }
-    }
-    uint32_t maxTrLevel = 1 + trLevel;
-
-    while ((width >> maxTrLevel) < (g_maxCUWidth >> g_maxCUDepth))
-    {
-        maxTrLevel--;
-    }
-
     qp = bHighPass ? Clip3(-cu->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, (int)cu->getQP(0)) : cu->getQP(0);
 
     outResiYuv->subtract(fencYuv, predYuv, 0, width);
@@ -3205,8 +3190,7 @@
 
     bits = xSymbolBitsInter(cu);
 
-    uint64_t exactCost = m_rdCost->calcRdCost(distortion, bits);
-    cost = exactCost;
+    cost = m_rdCost->calcRdCost(distortion, bits);
 
     if (cost < bcost)
     {
diff -r ce96cdb390fe -r 3bd3525dc31f source/Lib/TLibEncoder/TEncSearch.h
--- a/source/Lib/TLibEncoder/TEncSearch.h	Sun Feb 16 22:47:32 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSearch.h	Mon Feb 17 16:56:18 2014 +0900
@@ -249,7 +249,7 @@
                           TComMvField* pacMvField, uint32_t& mergeIndex, uint32_t& outCost, uint32_t& outbits,
                           TComMvField* mvFieldNeighbors, UChar* interDirNeighbors, int& numValidMergeCand);
 
-    void xRestrictBipredMergeCand(TComDataCU* cu, uint32_t puIdx, TComMvField* mvFieldNeighbours,
+    void xRestrictBipredMergeCand(TComDataCU* cu, TComMvField* mvFieldNeighbours,
                                   UChar* interDirNeighbours, int numValidMergeCand);
 
     // -------------------------------------------------------------------------------------------------------------------


More information about the x265-devel mailing list