[x265] [PATCH 3/6] cleanup: remove bLeft and bAbove since HEVC have a reference sample pad, they are always True

Min Chen chenm003 at 163.com
Tue Jun 18 18:43:35 CEST 2013


---
 source/Lib/TLibCommon/TComPattern.cpp    |  14 ++--
 source/Lib/TLibCommon/TComPattern.h      |  10 +--
 source/Lib/TLibCommon/TComPrediction.cpp |  33 +++++----
 source/Lib/TLibCommon/TComPrediction.h   |   4 +-
 source/Lib/TLibEncoder/TEncSearch.cpp    |  29 +++-----
 source/common/IntraPred.cpp              |  43 +++---------
 source/common/primitives.h               |   4 +-
 source/common/vec/intrapred.inc          | 115 +++++++++++++++----------------
 8 files changed, 101 insertions(+), 151 deletions(-)

diff --git a/source/Lib/TLibCommon/TComPattern.cpp b/source/Lib/TLibCommon/TComPattern.cpp
index e81dda6..d44a970 100644
--- a/source/Lib/TLibCommon/TComPattern.cpp
+++ b/source/Lib/TLibCommon/TComPattern.cpp
@@ -170,7 +170,7 @@ Void TComPattern::initPattern(TComDataCU* pcCU, UInt uiPartDepth, UInt uiAbsPart
     m_cPatternCr.setPatternParamCU(pcCU, 2, uiWidth >> 1, uiHeight >> 1, uiOffsetLeft, uiOffsetAbove, uiAbsPartIdx);
 }
 
-Void TComPattern::initAdiPattern(TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Pel* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight, Bool& bAbove, Bool& bLeft)
+Void TComPattern::initAdiPattern(TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Pel* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight)
 {
     Pel*  piRoiOrigin;
     Pel*  piAdiTemp;
@@ -203,9 +203,6 @@ Void TComPattern::initAdiPattern(TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt
     iNumIntraNeighbor  += isLeftAvailable(pcCU, uiPartIdxLT, uiPartIdxLB, bNeighborFlags + (iNumUnitsInCu * 2) - 1);
     iNumIntraNeighbor  += isBelowLeftAvailable(pcCU, uiPartIdxLT, uiPartIdxLB, bNeighborFlags + iNumUnitsInCu   - 1);
 
-    bAbove = true;
-    bLeft  = true;
-
     uiWidth = uiCuWidth2 + 1;
     uiHeight = uiCuHeight2 + 1;
 
@@ -304,9 +301,9 @@ Void TComPattern::initAdiPattern(TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt
 }
 
 //Overloaded initialiation of ADI buffers to support buffered references for xpredIntraAngBufRef
-Void TComPattern::initAdiPattern(TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Pel* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight, Bool& bAbove, Bool& bLeft, Pel* refAbove, Pel* refLeft, Pel* refAboveFlt, Pel* refLeftFlt)
+Void TComPattern::initAdiPattern(TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Pel* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight, Pel* refAbove, Pel* refLeft, Pel* refAboveFlt, Pel* refLeftFlt)
 {
-    initAdiPattern(pcCU, uiZorderIdxInPart, uiPartDepth, piAdiBuf, iOrgBufStride, iOrgBufHeight, bAbove, bLeft);
+    initAdiPattern(pcCU, uiZorderIdxInPart, uiPartDepth, piAdiBuf, iOrgBufStride, iOrgBufHeight);
     UInt  uiCuWidth   = pcCU->getWidth(0) >> uiPartDepth;
     UInt  uiCuHeight  = pcCU->getHeight(0) >> uiPartDepth;
     UInt  uiCuWidth2  = uiCuWidth << 1;
@@ -328,7 +325,7 @@ Void TComPattern::initAdiPattern(TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt
     }
 }
 
-Void TComPattern::initAdiPatternChroma(TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Pel* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight, Bool& bAbove, Bool& bLeft)
+Void TComPattern::initAdiPatternChroma(TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Pel* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight)
 {
     Pel*  piRoiOrigin;
     Pel*  piAdiTemp;
@@ -360,9 +357,6 @@ Void TComPattern::initAdiPatternChroma(TComDataCU* pcCU, UInt uiZorderIdxInPart,
     iNumIntraNeighbor  += isLeftAvailable(pcCU, uiPartIdxLT, uiPartIdxLB, bNeighborFlags + (iNumUnitsInCu * 2) - 1);
     iNumIntraNeighbor  += isBelowLeftAvailable(pcCU, uiPartIdxLT, uiPartIdxLB, bNeighborFlags + iNumUnitsInCu   - 1);
 
-    bAbove = true;
-    bLeft  = true;
-
     uiCuWidth = uiCuWidth >> 1; // for chroma
     uiCuHeight = uiCuHeight >> 1; // for chroma
 
diff --git a/source/Lib/TLibCommon/TComPattern.h b/source/Lib/TLibCommon/TComPattern.h
index 7cb03c7..54d66e1 100644
--- a/source/Lib/TLibCommon/TComPattern.h
+++ b/source/Lib/TLibCommon/TComPattern.h
@@ -135,7 +135,7 @@ public:
                      Int  iOffsetLeft,
                      Int  iOffsetAbove);
 
-    Void initAdiPattern(TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Pel* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight, Bool& bAbove, Bool& bLeft, Pel* refAbove, Pel* refLeft, Pel* refAboveFlt, Pel* refLeftFlt);
+    Void initAdiPattern(TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Pel* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight, Pel* refAbove, Pel* refLeft, Pel* refAboveFlt, Pel* refLeftFlt);
 
     /// set parameters from CU data for accessing neighbouring pixels
     Void  initPattern(TComDataCU* pcCU,
@@ -148,9 +148,7 @@ public:
                          UInt        uiPartDepth,
                          Pel*        piAdiBuf,
                          Int         iOrgBufStride,
-                         Int         iOrgBufHeight,
-                         Bool&       bAbove,
-                         Bool&       bLeft);
+                         Int         iOrgBufHeight);
 
     /// set chroma parameters from CU data for accessing ADI data
     Void  initAdiPatternChroma(TComDataCU* pcCU,
@@ -158,9 +156,7 @@ public:
                                UInt        uiPartDepth,
                                Pel*        piAdiBuf,
                                Int         iOrgBufStride,
-                               Int         iOrgBufHeight,
-                               Bool&       bAbove,
-                               Bool&       bLeft);
+                               Int         iOrgBufHeight);
 
 private:
 
diff --git a/source/Lib/TLibCommon/TComPrediction.cpp b/source/Lib/TLibCommon/TComPrediction.cpp
index 7338e2c..6e6baf3 100644
--- a/source/Lib/TLibCommon/TComPrediction.cpp
+++ b/source/Lib/TLibCommon/TComPrediction.cpp
@@ -299,17 +299,16 @@ Void xPredIntraAng(Int bitDepth, Pel* pSrc, Int srcStride, Pel*& rpDst, Int dstS
     }
 }
 
-Void TComPrediction::predIntraLumaAng(TComPattern* pcTComPattern, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft)
+Void TComPrediction::predIntraLumaAng(TComPattern* pcTComPattern, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iSize)
 {
     Pel *pDst = piPred;
     Pel *ptrSrc;
     Pel *refLft, *refAbv;
 
-    assert(g_aucConvertToBit[iWidth] >= 0);   //   4x  4
-    assert(g_aucConvertToBit[iWidth] <= 5);   // 128x128
-    assert(iWidth == iHeight);
+    assert(g_aucConvertToBit[iSize] >= 0);   //   4x  4
+    assert(g_aucConvertToBit[iSize] <= 5);   // 128x128
 
-    char log2BlkSize = g_aucConvertToBit[iWidth] + 2;
+    char log2BlkSize = g_aucConvertToBit[iSize] + 2;
 
     ptrSrc = m_piPredBuf;
     assert(log2BlkSize >= 2 && log2BlkSize < 7);
@@ -322,37 +321,37 @@ Void TComPrediction::predIntraLumaAng(TComPattern* pcTComPattern, UInt uiDirMode
 
     assert(ucFiltIdx <= 1);
 
-    refLft = refLeft + iWidth - 1;
-    refAbv = refAbove + iWidth - 1;
+    refLft = refLeft + iSize - 1;
+    refAbv = refAbove + iSize - 1;
 
     if (ucFiltIdx)
     {
-        ptrSrc += ADI_BUF_STRIDE * (2 * iHeight + 1);
-        refLft = refLeftFlt + iWidth - 1;
-        refAbv = refAboveFlt + iWidth - 1;
+        ptrSrc += ADI_BUF_STRIDE * (2 * iSize + 1);
+        refLft = refLeftFlt + iSize - 1;
+        refAbv = refAboveFlt + iSize - 1;
     }
 
     // get starting pixel in block
     Int sw = ADI_BUF_STRIDE;
-    Bool bFilter = ((iWidth <= 16) && (iHeight <= 16));
+    Bool bFilter = (iSize <= 16);
 
     // Create the prediction
     if (uiDirMode == PLANAR_IDX)
     {
-        primitives.getIPredPlanar((pixel*)ptrSrc + sw + 1, sw, (pixel*)pDst, uiStride, iWidth, iHeight);
+        primitives.getIPredPlanar((pixel*)ptrSrc + sw + 1, sw, (pixel*)pDst, uiStride, iSize);
     }
     else if (uiDirMode == DC_IDX)
     {
-        primitives.getIPredDC((pixel*)ptrSrc + sw + 1, sw, (pixel*)pDst, uiStride, iWidth, iHeight, bAbove, bLeft, bFilter);
+        primitives.getIPredDC((pixel*)ptrSrc + sw + 1, sw, (pixel*)pDst, uiStride, iSize, bFilter);
     }
     else
     {
-        primitives.getIPredAng(g_bitDepthY, (pixel*)pDst, uiStride, iWidth, uiDirMode, bFilter, (pixel*)refLft, (pixel*)refAbv);
+        primitives.getIPredAng(g_bitDepthY, (pixel*)pDst, uiStride, iSize, uiDirMode, bFilter, (pixel*)refLft, (pixel*)refAbv);
     }
 }
 
 // Angular chroma
-Void TComPrediction::predIntraChromaAng(Pel* piSrc, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft)
+Void TComPrediction::predIntraChromaAng(Pel* piSrc, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth)
 {
     Pel *pDst = piPred;
     Pel *ptrSrc = piSrc;
@@ -362,11 +361,11 @@ Void TComPrediction::predIntraChromaAng(Pel* piSrc, UInt uiDirMode, Pel* piPred,
 
     if (uiDirMode == PLANAR_IDX)
     {
-        primitives.getIPredPlanar((pixel*)ptrSrc + sw + 1, sw, (pixel*)pDst, uiStride, iWidth, iHeight);
+        primitives.getIPredPlanar((pixel*)ptrSrc + sw + 1, sw, (pixel*)pDst, uiStride, iWidth);
     }
     else if (uiDirMode == DC_IDX)
     {
-        primitives.getIPredDC((pixel*)ptrSrc + sw + 1, sw, (pixel*)pDst, uiStride, iWidth, iHeight, bAbove, bLeft, false);
+        primitives.getIPredDC((pixel*)ptrSrc + sw + 1, sw, (pixel*)pDst, uiStride, iWidth, false);
     }
     else
     {
diff --git a/source/Lib/TLibCommon/TComPrediction.h b/source/Lib/TLibCommon/TComPrediction.h
index d23b811..33d3882 100644
--- a/source/Lib/TLibCommon/TComPrediction.h
+++ b/source/Lib/TLibCommon/TComPrediction.h
@@ -103,8 +103,8 @@ public:
     Void getMvPredAMVP(TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, TComMv& rcMvPred);
 
     // Angular Intra
-    Void predIntraLumaAng(TComPattern* pcTComPattern, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft);
-    Void predIntraChromaAng(Pel* piSrc, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft);
+    Void predIntraLumaAng(TComPattern* pcTComPattern, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth);
+    Void predIntraChromaAng(Pel* piSrc, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth);
 
     Pel* getPredicBuf()             { return m_piPredBuf; }
 
diff --git a/source/Lib/TLibEncoder/TEncSearch.cpp b/source/Lib/TLibEncoder/TEncSearch.cpp
index 47bdcc3..34e8850 100644
--- a/source/Lib/TLibEncoder/TEncSearch.cpp
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp
@@ -937,15 +937,13 @@ Void TEncSearch::xIntraCodingLumaBlk(TComDataCU* pcCU,
     UInt    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride();
     Bool    useTransformSkip  = pcCU->getTransformSkip(uiAbsPartIdx, TEXT_LUMA);
     //===== init availability pattern =====
-    Bool  bAboveAvail = false;
-    Bool  bLeftAvail  = false;
 
     if (default0Save1Load2 != 2)
     {
         pcCU->getPattern()->initPattern(pcCU, uiTrDepth, uiAbsPartIdx);
-        pcCU->getPattern()->initAdiPattern(pcCU, uiAbsPartIdx, uiTrDepth, m_piPredBuf, m_iPredBufStride, m_iPredBufHeight, bAboveAvail, bLeftAvail, refAbove, refLeft, refAboveFlt, refLeftFlt);
+        pcCU->getPattern()->initAdiPattern(pcCU, uiAbsPartIdx, uiTrDepth, m_piPredBuf, m_iPredBufStride, m_iPredBufHeight, refAbove, refLeft, refAboveFlt, refLeftFlt);
         //===== get prediction signal =====
-        predIntraLumaAng(pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail);
+        predIntraLumaAng(pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth);
         // save prediction
         if (default0Save1Load2 == 1)
         {
@@ -1060,19 +1058,15 @@ Void TEncSearch::xIntraCodingChromaBlk(TComDataCU* pcCU,
     }
 
     //===== init availability pattern =====
-    Bool  bAboveAvail = false;
-    Bool  bLeftAvail  = false;
     if (default0Save1Load2 != 2)
     {
         pcCU->getPattern()->initPattern(pcCU, uiTrDepth, uiAbsPartIdx);
 
-        pcCU->getPattern()->initAdiPatternChroma(pcCU, uiAbsPartIdx, uiTrDepth, m_piPredBuf, m_iPredBufStride, m_iPredBufHeight, bAboveAvail, bLeftAvail);
+        pcCU->getPattern()->initAdiPatternChroma(pcCU, uiAbsPartIdx, uiTrDepth, m_piPredBuf, m_iPredBufStride, m_iPredBufHeight);
         Pel*  pPatChroma  = (uiChromaId > 0 ? pcCU->getPattern()->getAdiCrBuf(uiWidth, uiHeight, m_piPredBuf) : pcCU->getPattern()->getAdiCbBuf(uiWidth, uiHeight, m_piPredBuf));
 
         //===== get prediction signal =====
-        {
-            predIntraChromaAng(pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail);
-        }
+        predIntraChromaAng(pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth);
         // save prediction
         if (default0Save1Load2 == 1)
         {
@@ -2126,9 +2120,6 @@ Void TEncSearch::preestChromaPredMode(TComDataCU* pcCU,
     Pel*  piPredV     = pcPredYuv->getCrAddr(0);
 
     //===== init pattern =====
-    Bool  bAboveAvail = false;
-    Bool  bLeftAvail  = false;
-
     x265::pixelcmp sa8d;
 
     switch (uiWidth)
@@ -2154,7 +2145,7 @@ Void TEncSearch::preestChromaPredMode(TComDataCU* pcCU,
     assert(uiWidth == uiHeight);
 
     pcCU->getPattern()->initPattern(pcCU, 0, 0);
-    pcCU->getPattern()->initAdiPatternChroma(pcCU, 0, 0, m_piPredBuf, m_iPredBufStride, m_iPredBufHeight, bAboveAvail, bLeftAvail);
+    pcCU->getPattern()->initAdiPatternChroma(pcCU, 0, 0, m_piPredBuf, m_iPredBufStride, m_iPredBufHeight);
     Pel*  pPatChromaU = pcCU->getPattern()->getAdiCbBuf(uiWidth, uiHeight, m_piPredBuf);
     Pel*  pPatChromaV = pcCU->getPattern()->getAdiCrBuf(uiWidth, uiHeight, m_piPredBuf);
 
@@ -2166,8 +2157,8 @@ Void TEncSearch::preestChromaPredMode(TComDataCU* pcCU,
     for (UInt uiMode  = uiMinMode; uiMode < uiMaxMode; uiMode++)
     {
         //--- get prediction ---
-        predIntraChromaAng(pPatChromaU, uiMode, piPredU, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail);
-        predIntraChromaAng(pPatChromaV, uiMode, piPredV, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail);
+        predIntraChromaAng(pPatChromaU, uiMode, piPredU, uiStride, uiWidth);
+        predIntraChromaAng(pPatChromaV, uiMode, piPredV, uiStride, uiWidth);
 
         //--- get SAD ---
         UInt uiSAD = sa8d((pixel*)piOrgU, uiStride, (pixel*)piPredU, uiStride) +
@@ -2249,11 +2240,9 @@ Void TEncSearch::estIntraPredQT(TComDataCU* pcCU,
     for (UInt uiPU = 0; uiPU < uiNumPU; uiPU++, uiPartOffset += uiQNumParts)
     {
         //===== init pattern for luma prediction =====
-        Bool bAboveAvail = false;
-        Bool bLeftAvail  = false;
         pcCU->getPattern()->initPattern(pcCU, uiInitTrDepth, uiPartOffset);
         // Reference sample smoothing
-        pcCU->getPattern()->initAdiPattern(pcCU, uiPartOffset, uiInitTrDepth, m_piPredBuf, m_iPredBufStride, m_iPredBufHeight, bAboveAvail, bLeftAvail, refAbove, refLeft, refAboveFlt, refLeftFlt);
+        pcCU->getPattern()->initAdiPattern(pcCU, uiPartOffset, uiInitTrDepth, m_piPredBuf, m_iPredBufStride, m_iPredBufHeight, refAbove, refLeft, refAboveFlt, refLeftFlt);
 
         //===== determine set of modes to be tested (using prediction signal only) =====
         Int numModesAvailable     = 35; //total number of Intra modes
@@ -2278,7 +2267,7 @@ Void TEncSearch::estIntraPredQT(TComDataCU* pcCU,
 
             for (UInt uiMode = 0; uiMode < numModesAvailable; uiMode++)
             {
-                predIntraLumaAng(pcCU->getPattern(), uiMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail);
+                predIntraLumaAng(pcCU->getPattern(), uiMode, piPred, uiStride, uiWidth);
 
                 // use hadamard transform here
                 UInt uiSad = sa8d((pixel*)piOrg, uiStride, (pixel*)piPred, uiStride);
diff --git a/source/common/IntraPred.cpp b/source/common/IntraPred.cpp
index 3db5c36..75c7812 100644
--- a/source/common/IntraPred.cpp
+++ b/source/common/IntraPred.cpp
@@ -30,42 +30,21 @@
 extern char g_aucConvertToBit[];
 
 namespace {
-pixel CDECL predIntraGetPredValDC(pixel* pSrc, intptr_t iSrcStride, intptr_t iWidth, intptr_t iHeight, int bAbove, int bLeft)
+pixel CDECL predIntraGetPredValDC(pixel* pSrc, intptr_t iSrcStride, intptr_t iWidth)
 {
     int iInd, iSum = 0;
     pixel pDcVal;
 
-    if (bAbove)
+    for (iInd = 0; iInd < iWidth; iInd++)
     {
-        for (iInd = 0; iInd < iWidth; iInd++)
-        {
-            iSum += pSrc[iInd - iSrcStride];
-        }
+        iSum += pSrc[iInd - iSrcStride];
     }
-    if (bLeft)
+    for (iInd = 0; iInd < iWidth; iInd++)
     {
-        for (iInd = 0; iInd < iHeight; iInd++)
-        {
-            iSum += pSrc[iInd * iSrcStride - 1];
-        }
+        iSum += pSrc[iInd * iSrcStride - 1];
     }
 
-    if (bAbove && bLeft)
-    {
-        pDcVal = (pixel)((iSum + iWidth) / (iWidth + iHeight));
-    }
-    else if (bAbove)
-    {
-        pDcVal = (pixel)((iSum + iWidth / 2) / iWidth);
-    }
-    else if (bLeft)
-    {
-        pDcVal = (pixel)((iSum + iHeight / 2) / iHeight);
-    }
-    else
-    {
-        pDcVal = pSrc[-1]; // Default DC value already calculated and placed in the prediction array if no neighbors are available
-    }
+    pDcVal = (pixel)((iSum + iWidth) / (iWidth + iWidth));
 
     return pDcVal;
 }
@@ -88,13 +67,13 @@ void xDCPredFiltering(pixel* pSrc, intptr_t iSrcStride, pixel* pDst, intptr_t iD
     }
 }
 
-void xPredIntraDC(pixel* pSrc, intptr_t srcStride, pixel* pDst, intptr_t dstStride, int width, int height, int blkAboveAvailable, int blkLeftAvailable, int bFilter)
+void xPredIntraDC(pixel* pSrc, intptr_t srcStride, pixel* pDst, intptr_t dstStride, int width, int bFilter)
 {
     int k, l;
     int blkSize = width;
 
     // Do the DC prediction
-    pixel dcval = (pixel)predIntraGetPredValDC(pSrc, srcStride, width, height, blkAboveAvailable, blkLeftAvailable);
+    pixel dcval = (pixel)predIntraGetPredValDC(pSrc, srcStride, width);
 
     for (k = 0; k < blkSize; k++)
     {
@@ -104,13 +83,13 @@ void xPredIntraDC(pixel* pSrc, intptr_t srcStride, pixel* pDst, intptr_t dstStri
         }
     }
 
-    if (bFilter && blkAboveAvailable && blkLeftAvailable)
+    if (bFilter)
     {
-        xDCPredFiltering(pSrc, srcStride, pDst, dstStride, width, height);
+        xDCPredFiltering(pSrc, srcStride, pDst, dstStride, width, width);
     }
 }
 
-void xPredIntraPlanar(pixel* pSrc, intptr_t srcStride, pixel* pDst, intptr_t dstStride, int width, int /*height*/)
+void xPredIntraPlanar(pixel* pSrc, intptr_t srcStride, pixel* pDst, intptr_t dstStride, int width)
 {
     //assert(width == height);
 
diff --git a/source/common/primitives.h b/source/common/primitives.h
index 2c563ec..aaa90c8 100644
--- a/source/common/primitives.h
+++ b/source/common/primitives.h
@@ -192,8 +192,8 @@ typedef void (CDECL * blockcpy_p_p)(int bx, int by, pixel *dst, intptr_t dstride
 typedef void (CDECL * blockcpy_s_p)(int bx, int by, short *dst, intptr_t dstride, pixel *src, intptr_t sstride); // dst is aligned
 typedef void (CDECL * blockcpy_p_s)(int bx, int by, pixel *dst, intptr_t dstride, short *src, intptr_t sstride); // dst is aligned
 typedef void (CDECL * blockcpy_s_c)(int bx, int by, short *dst, intptr_t dstride, uint8_t *src, intptr_t sstride); // dst is aligned
-typedef void (CDECL * getIPredDC_p)(pixel* pSrc, intptr_t srcStride, pixel* pDst, intptr_t dstStride, int width, int /*height*/, int blkAboveAvailable, int blkLeftAvailable, int bFilter);
-typedef void (CDECL * getIPredPlanar_p)(pixel* pSrc, intptr_t srcStride, pixel* rpDst, intptr_t dstStride, int width, int /*height*/);
+typedef void (CDECL * getIPredDC_p)(pixel* pSrc, intptr_t srcStride, pixel* pDst, intptr_t dstStride, int width, int bFilter);
+typedef void (CDECL * getIPredPlanar_p)(pixel* pSrc, intptr_t srcStride, pixel* rpDst, intptr_t dstStride, int width);
 typedef void (CDECL * getIPredAng_p)(int bitDepth, pixel* rpDst, int dstStride, int width, int dirMode, bool bFilter, pixel *refLeft, pixel *refAbove);
 typedef void (CDECL * quant)(int bitDepth, const int* pSrc, int* pDes, int iWidth, int iHeight, int mcqp_miper, int mcqp_mirem, bool useScalingList, unsigned int uiLog2TrSize, int *piDequantCoef);
 typedef void (CDECL * cvt16to32_t)(short *psOrg, int *piDst, int);
diff --git a/source/common/vec/intrapred.inc b/source/common/vec/intrapred.inc
index da53f53..43e3f1d 100644
--- a/source/common/vec/intrapred.inc
+++ b/source/common/vec/intrapred.inc
@@ -296,7 +296,7 @@ void xDCPredFiltering(pixel* pSrc, intptr_t iSrcStride, pixel* rpDst, intptr_t i
     }
 }
 
-void predIntraDC(pixel* pSrc, intptr_t srcStride, pixel* pDst, intptr_t dstStride, int width, int /*height*/, int blkAboveAvailable, int blkLeftAvailable, int bFilter)
+void predIntraDC(pixel* pSrc, intptr_t srcStride, pixel* pDst, intptr_t dstStride, int width, int bFilter)
 {
     //assert(iWidth == iHeight); // all of Intra is NxN
     //assert(blkAboveAvailable || blkLeftAvailable); // I think left and above always true since HEVC have a pixel fill process
@@ -305,72 +305,66 @@ void predIntraDC(pixel* pSrc, intptr_t srcStride, pixel* pDst, intptr_t dstStrid
     pixel *pSrcAbove = &pSrc[-srcStride];
     pixel *pSrcLeft = &pSrc[-1];
 
-    if (blkLeftAvailable)
+    for (int iInd = 0; iInd < width; iInd++)
     {
-        for (int iInd = 0; iInd < width; iInd++)
-        {
-            iSum += *pSrcLeft;
-            pSrcLeft += srcStride;
-        }
+        iSum += *pSrcLeft;
+        pSrcLeft += srcStride;
     }
 
 #if HIGH_BIT_DEPTH
     Vec8s sumAbove(0);
     Vec8s m0;
 
-    if (blkAboveAvailable)
+    switch (width)
     {
-        switch (width)
-        {
-        case 4:
-            sumAbove = load_partial(const_int(8), pSrcAbove);
-            break;
-        case 8:
-            m0.load(pSrcAbove);
-            sumAbove = m0;
-            break;
-        case 16:
-            m0.load(pSrcAbove);
-            sumAbove  = m0;
-            m0.load(pSrcAbove + 8);
-            sumAbove += m0;
-            break;
-        case 32:
-            m0.load(pSrcAbove);
-            sumAbove  = m0;
-            m0.load(pSrcAbove + 8);
-            sumAbove += m0;
-            m0.load(pSrcAbove + 16);
-            sumAbove += m0;
-            m0.load(pSrcAbove + 24);
-            sumAbove += m0;
-            break;
+    case 4:
+        sumAbove = load_partial(const_int(8), pSrcAbove);
+        break;
+    case 8:
+        m0.load(pSrcAbove);
+        sumAbove = m0;
+        break;
+    case 16:
+        m0.load(pSrcAbove);
+        sumAbove  = m0;
+        m0.load(pSrcAbove + 8);
+        sumAbove += m0;
+        break;
+    case 32:
+        m0.load(pSrcAbove);
+        sumAbove  = m0;
+        m0.load(pSrcAbove + 8);
+        sumAbove += m0;
+        m0.load(pSrcAbove + 16);
+        sumAbove += m0;
+        m0.load(pSrcAbove + 24);
+        sumAbove += m0;
+        break;
         //case 64:
-        default:
-            // CHECK_ME: the max support bit_depth is 13-bits
-            m0.load(pSrcAbove);
-            sumAbove  = m0;
-            m0.load(pSrcAbove + 8);
-            sumAbove += m0;
-            m0.load(pSrcAbove + 16);
-            sumAbove += m0;
-            m0.load(pSrcAbove + 24);
-            sumAbove += m0;
-            m0.load(pSrcAbove + 32);
-            sumAbove += m0;
-            m0.load(pSrcAbove + 40);
-            sumAbove += m0;
-            m0.load(pSrcAbove + 48);
-            sumAbove += m0;
-            m0.load(pSrcAbove + 56);
-            sumAbove += m0;
-            break;
-        }
-
-        iSum += horizontal_add_x(sumAbove);
+    default:
+        // CHECK_ME: the max support bit_depth is 13-bits
+        m0.load(pSrcAbove);
+        sumAbove  = m0;
+        m0.load(pSrcAbove + 8);
+        sumAbove += m0;
+        m0.load(pSrcAbove + 16);
+        sumAbove += m0;
+        m0.load(pSrcAbove + 24);
+        sumAbove += m0;
+        m0.load(pSrcAbove + 32);
+        sumAbove += m0;
+        m0.load(pSrcAbove + 40);
+        sumAbove += m0;
+        m0.load(pSrcAbove + 48);
+        sumAbove += m0;
+        m0.load(pSrcAbove + 56);
+        sumAbove += m0;
+        break;
     }
 
-    logSize += (blkAboveAvailable + blkLeftAvailable - 1);
+    iSum += horizontal_add_x(sumAbove);
+
+    logSize += 1;
     pixel dcVal = (iSum + (1 << (logSize - 1))) >> logSize;
     Vec8us dcValN(dcVal);
     int k;
@@ -451,13 +445,12 @@ void predIntraDC(pixel* pSrc, intptr_t srcStride, pixel* pDst, intptr_t dstStrid
         break;
     }
 
-    if (bFilter && blkAboveAvailable && blkLeftAvailable)
+    if (bFilter)
     {
         xDCPredFiltering(pSrc, srcStride, pDst, dstStride, width, width);
     }
 #else // if !HIGH_BIT_DEPTH
 
-    if (blkAboveAvailable)
     {
         Vec16uc pix;
         Vec8us  im;
@@ -506,7 +499,7 @@ void predIntraDC(pixel* pSrc, intptr_t srcStride, pixel* pDst, intptr_t dstStrid
         }
     }
 
-    logSize += (blkAboveAvailable + blkLeftAvailable - 1);
+    logSize += 1;
     pixel dcVal = (iSum + (1 << (logSize - 1))) >> logSize;
     Vec16uc dcValN(dcVal);
     int k;
@@ -583,7 +576,7 @@ void predIntraDC(pixel* pSrc, intptr_t srcStride, pixel* pDst, intptr_t dstStrid
         break;
     }
 
-    if (bFilter && blkAboveAvailable && blkLeftAvailable)
+    if (bFilter)
     {
         xDCPredFiltering(pSrc, srcStride, pDst, dstStride, width, width);
     }
@@ -1423,7 +1416,7 @@ predIntraPlanar_t *intraPlanarN[] =
 #endif
 };
 
-void predIntraPlanar(pixel* pSrc, intptr_t srcStride, pixel* rpDst, intptr_t dstStride, int width, int /*height*/)
+void predIntraPlanar(pixel* pSrc, intptr_t srcStride, pixel* rpDst, intptr_t dstStride, int width)
 {
     //assert(width == height);
 
-- 
1.8.3.msysgit.0




More information about the x265-devel mailing list