[x265] [PATCH] TComPattern: remove redundant functions used for CIP

santhoshini at multicorewareinc.com santhoshini at multicorewareinc.com
Tue Aug 5 12:09:56 CEST 2014


# HG changeset patch
# User Santhoshini Sekar <santhoshini at multicorewareinc.com>
# Date 1407233322 -19800
#      Tue Aug 05 15:38:42 2014 +0530
# Node ID aadca66911c2f838e5b6dba671f65a3abeafcb38
# Parent  0d4723a0080cff763ff20ab9c516c6e082496a0b
TComPattern: remove redundant functions used for CIP

diff -r 0d4723a0080c -r aadca66911c2 source/Lib/TLibCommon/TComPattern.cpp
--- a/source/Lib/TLibCommon/TComPattern.cpp	Tue Aug 05 01:05:47 2014 -0500
+++ b/source/Lib/TLibCommon/TComPattern.cpp	Tue Aug 05 15:38:42 2014 +0530
@@ -209,24 +209,13 @@
     int  partIdxStride   = cu->m_pic->getNumPartInCUSize();
     partIdxLB            = g_rasterToZscan[g_zscanToRaster[partIdxLT] + ((tuHeightInUnits - 1) * partIdxStride)];
 
-    if (!cu->m_slice->m_pps->bConstrainedIntraPred)
-    {
-        bNeighborFlags[leftUnits] = isAboveLeftAvailable(cu, partIdxLT);
-        numIntraNeighbor += (int)(bNeighborFlags[leftUnits]);
-        numIntraNeighbor += isAboveAvailable(cu, partIdxLT, partIdxRT, (bNeighborFlags + leftUnits + 1));
-        numIntraNeighbor += isAboveRightAvailable(cu, partIdxLT, partIdxRT, (bNeighborFlags + leftUnits + 1 + tuWidthInUnits));
-        numIntraNeighbor += isLeftAvailable(cu, partIdxLT, partIdxLB, (bNeighborFlags + leftUnits - 1));
-        numIntraNeighbor += isBelowLeftAvailable(cu, partIdxLT, partIdxLB, (bNeighborFlags + leftUnits   - 1 - tuHeightInUnits));
-    }
-    else
-    {
-        bNeighborFlags[leftUnits] = isAboveLeftAvailableCIP(cu, partIdxLT);
-        numIntraNeighbor += (int)(bNeighborFlags[leftUnits]);
-        numIntraNeighbor += isAboveAvailableCIP(cu, partIdxLT, partIdxRT, (bNeighborFlags + leftUnits + 1));
-        numIntraNeighbor += isAboveRightAvailableCIP(cu, partIdxLT, partIdxRT, (bNeighborFlags + leftUnits + 1 + tuWidthInUnits));
-        numIntraNeighbor += isLeftAvailableCIP(cu, partIdxLT, partIdxLB, (bNeighborFlags + leftUnits - 1));
-        numIntraNeighbor += isBelowLeftAvailableCIP(cu, partIdxLT, partIdxLB, (bNeighborFlags + leftUnits   - 1 - tuHeightInUnits));
-    }
+    bNeighborFlags[leftUnits] = isAboveLeftAvailable(cu, partIdxLT);
+    numIntraNeighbor += (int)(bNeighborFlags[leftUnits]);
+    numIntraNeighbor += isAboveAvailable(cu, partIdxLT, partIdxRT, (bNeighborFlags + leftUnits + 1));
+    numIntraNeighbor += isAboveRightAvailable(cu, partIdxLT, partIdxRT, (bNeighborFlags + leftUnits + 1 + tuWidthInUnits));
+    numIntraNeighbor += isLeftAvailable(cu, partIdxLT, partIdxLB, (bNeighborFlags + leftUnits - 1));
+    numIntraNeighbor += isBelowLeftAvailable(cu, partIdxLT, partIdxLB, (bNeighborFlags + leftUnits   - 1 - tuHeightInUnits));
+
     intraNeighbors->numIntraNeighbor = numIntraNeighbor;
     intraNeighbors->totalUnits       = aboveUnits + leftUnits + 1;
     intraNeighbors->aboveUnits       = aboveUnits;
@@ -421,7 +410,10 @@
     uint32_t partAboveLeft;
     TComDataCU* pcCUAboveLeft = cu->getPUAboveLeft(partAboveLeft, partIdxLT);
 
-    return pcCUAboveLeft ? true : false;
+    if (!cu->m_slice->m_pps->bConstrainedIntraPred)
+        return pcCUAboveLeft ? true : false;
+    else
+        return pcCUAboveLeft && pcCUAboveLeft->isIntra(partAboveLeft);
 }
 
 int TComPattern::isAboveAvailable(TComDataCU* cu, uint32_t partIdxLT, uint32_t partIdxRT, bool *bValidFlags)
@@ -436,7 +428,7 @@
     {
         uint32_t uiPartAbove;
         TComDataCU* pcCUAbove = cu->getPUAbove(uiPartAbove, g_rasterToZscan[rasterPart]);
-        if (pcCUAbove)
+        if (pcCUAbove && (!cu->m_slice->m_pps->bConstrainedIntraPred || pcCUAbove->isIntra(uiPartAbove)))
         {
             numIntra++;
             *validFlagPtr = true;
@@ -463,7 +455,7 @@
     {
         uint32_t partLeft;
         TComDataCU* pcCULeft = cu->getPULeft(partLeft, g_rasterToZscan[rasterPart]);
-        if (pcCULeft)
+        if (pcCULeft && (!cu->m_slice->m_pps->bConstrainedIntraPred || pcCULeft->isIntra(partLeft)))
         {
             numIntra++;
             *validFlagPtr = true;
@@ -488,7 +480,7 @@
     {
         uint32_t uiPartAboveRight;
         TComDataCU* pcCUAboveRight = cu->getPUAboveRightAdi(uiPartAboveRight, partIdxRT, offset);
-        if (pcCUAboveRight)
+        if (pcCUAboveRight && (!cu->m_slice->m_pps->bConstrainedIntraPred || pcCUAboveRight->isIntra(uiPartAboveRight)))
         {
             numIntra++;
             *validFlagPtr = true;
@@ -513,119 +505,7 @@
     {
         uint32_t uiPartBelowLeft;
         TComDataCU* pcCUBelowLeft = cu->getPUBelowLeftAdi(uiPartBelowLeft, partIdxLB, offset);
-        if (pcCUBelowLeft)
-        {
-            numIntra++;
-            *validFlagPtr = true;
-        }
-        else
-        {
-            *validFlagPtr = false;
-        }
-        validFlagPtr--; // opposite direction
-    }
-
-    return numIntra;
-}
-
-bool TComPattern::isAboveLeftAvailableCIP(TComDataCU* cu, uint32_t partIdxLT)
-{
-    uint32_t partAboveLeft;
-    TComDataCU* pcCUAboveLeft = cu->getPUAboveLeft(partAboveLeft, partIdxLT);
-
-    return pcCUAboveLeft && pcCUAboveLeft->isIntra(partAboveLeft);
-}
-
-int TComPattern::isAboveAvailableCIP(TComDataCU* cu, uint32_t partIdxLT, uint32_t partIdxRT, bool *bValidFlags)
-{
-    const uint32_t rasterPartBegin = g_zscanToRaster[partIdxLT];
-    const uint32_t rasterPartEnd = g_zscanToRaster[partIdxRT] + 1;
-    const uint32_t idxStep = 1;
-    bool *validFlagPtr = bValidFlags;
-    int numIntra = 0;
-
-    for (uint32_t rasterPart = rasterPartBegin; rasterPart < rasterPartEnd; rasterPart += idxStep)
-    {
-        uint32_t uiPartAbove;
-        TComDataCU* pcCUAbove = cu->getPUAbove(uiPartAbove, g_rasterToZscan[rasterPart]);
-        if (pcCUAbove && pcCUAbove->isIntra(uiPartAbove))
-        {
-            numIntra++;
-            *validFlagPtr = true;
-        }
-        else
-        {
-            *validFlagPtr = false;
-        }
-        validFlagPtr++;
-    }
-
-    return numIntra;
-}
-
-int TComPattern::isLeftAvailableCIP(TComDataCU* cu, uint32_t partIdxLT, uint32_t partIdxLB, bool *bValidFlags)
-{
-    const uint32_t rasterPartBegin = g_zscanToRaster[partIdxLT];
-    const uint32_t rasterPartEnd = g_zscanToRaster[partIdxLB] + 1;
-    const uint32_t idxStep = cu->m_pic->getNumPartInCUSize();
-    bool *validFlagPtr = bValidFlags;
-    int numIntra = 0;
-
-    for (uint32_t rasterPart = rasterPartBegin; rasterPart < rasterPartEnd; rasterPart += idxStep)
-    {
-        uint32_t partLeft;
-        TComDataCU* pcCULeft = cu->getPULeft(partLeft, g_rasterToZscan[rasterPart]);
-        if (pcCULeft && pcCULeft->isIntra(partLeft))
-        {
-            numIntra++;
-            *validFlagPtr = true;
-        }
-        else
-        {
-            *validFlagPtr = false;
-        }
-        validFlagPtr--; // opposite direction
-    }
-
-    return numIntra;
-}
-
-int TComPattern::isAboveRightAvailableCIP(TComDataCU* cu, uint32_t partIdxLT, uint32_t partIdxRT, bool *bValidFlags)
-{
-    const uint32_t numUnitsInPU = g_zscanToRaster[partIdxRT] - g_zscanToRaster[partIdxLT] + 1;
-    bool *validFlagPtr = bValidFlags;
-    int numIntra = 0;
-
-    for (uint32_t offset = 1; offset <= numUnitsInPU; offset++)
-    {
-        uint32_t uiPartAboveRight;
-        TComDataCU* pcCUAboveRight = cu->getPUAboveRightAdi(uiPartAboveRight, partIdxRT, offset);
-        if (pcCUAboveRight && pcCUAboveRight->isIntra(uiPartAboveRight))
-        {
-            numIntra++;
-            *validFlagPtr = true;
-        }
-        else
-        {
-            *validFlagPtr = false;
-        }
-        validFlagPtr++;
-    }
-
-    return numIntra;
-}
-
-int TComPattern::isBelowLeftAvailableCIP(TComDataCU* cu, uint32_t partIdxLT, uint32_t partIdxLB, bool *bValidFlags)
-{
-    const uint32_t numUnitsInPU = (g_zscanToRaster[partIdxLB] - g_zscanToRaster[partIdxLT]) / cu->m_pic->getNumPartInCUSize() + 1;
-    bool *validFlagPtr = bValidFlags;
-    int numIntra = 0;
-
-    for (uint32_t offset = 1; offset <= numUnitsInPU; offset++)
-    {
-        uint32_t uiPartBelowLeft;
-        TComDataCU* pcCUBelowLeft = cu->getPUBelowLeftAdi(uiPartBelowLeft, partIdxLB, offset);
-        if (pcCUBelowLeft && pcCUBelowLeft->isIntra(uiPartBelowLeft))
+        if (pcCUBelowLeft && (!cu->m_slice->m_pps->bConstrainedIntraPred || pcCUBelowLeft->isIntra(uiPartBelowLeft)))
         {
             numIntra++;
             *validFlagPtr = true;
diff -r 0d4723a0080c -r aadca66911c2 source/Lib/TLibCommon/TComPattern.h
--- a/source/Lib/TLibCommon/TComPattern.h	Tue Aug 05 01:05:47 2014 -0500
+++ b/source/Lib/TLibCommon/TComPattern.h	Tue Aug 05 15:38:42 2014 +0530
@@ -103,12 +103,6 @@
     static int   isLeftAvailable(TComDataCU* cu, uint32_t partIdxLT, uint32_t partIdxLB, bool* bValidFlags);
     static int   isAboveRightAvailable(TComDataCU* cu, uint32_t partIdxLT, uint32_t partIdxRT, bool* bValidFlags);
     static int   isBelowLeftAvailable(TComDataCU* cu, uint32_t partIdxLT, uint32_t partIdxLB, bool* bValidFlags);
-
-    static bool  isAboveLeftAvailableCIP(TComDataCU* cu, uint32_t partIdxLT);
-    static int   isAboveAvailableCIP(TComDataCU* cu, uint32_t partIdxLT, uint32_t partIdxRT, bool* bValidFlags);
-    static int   isLeftAvailableCIP(TComDataCU* cu, uint32_t partIdxLT, uint32_t partIdxLB, bool* bValidFlags);
-    static int   isAboveRightAvailableCIP(TComDataCU* cu, uint32_t partIdxLT, uint32_t partIdxRT, bool* bValidFlags);
-    static int   isBelowLeftAvailableCIP(TComDataCU* cu, uint32_t partIdxLT, uint32_t partIdxLB, bool* bValidFlags);
 };
 }
 //! \}


More information about the x265-devel mailing list