Changeset 474 in SHVCSoftware for branches


Ignore:
Timestamp:
15 Nov 2013, 13:43:17 (11 years ago)
Author:
nokia
Message:

Fix inter-layer constrained tile sets for merge and skip modes

Location:
branches/SHM-4.0-dev/source/Lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComDataCU.cpp

    r467 r474  
    18721872#endif
    18731873
     1874#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1875Bool TComDataCU::isInterLayerReference(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1)
     1876{
     1877  Bool checkILR = false;
     1878
     1879  if(uhInterDir&0x1)  //list0
     1880  {
     1881    Int refIdxL0 = cMvFieldL0.getRefIdx();
     1882    checkILR = getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->isILR(m_layerId);
     1883  }
     1884  if(uhInterDir&0x2)  //list1
     1885  {
     1886    Int refIdxL1  = cMvFieldL1.getRefIdx();
     1887    checkILR = checkILR || getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->isILR(m_layerId);
     1888  }
     1889
     1890  return checkILR;
     1891}
     1892#endif
     1893
    18741894UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx )
    18751895{
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComDataCU.h

    r442 r474  
    492492  Bool          isSkipped ( UInt uiPartIdx );                                                     ///< SKIP (no residual)
    493493  Bool          isBipredRestriction( UInt puIdx );
     494#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     495  Bool          isInterLayerReference(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1);
     496#endif
    494497
    495498  // -------------------------------------------------------------------------------------------------------------------
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncCu.cpp

    r442 r474  
    250250#endif
    251251
     252#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     253  m_disableILP = xCheckTileSetConstraint(rpcCU);
     254  m_pcPredSearch->setDisableILP(m_disableILP);
     255#endif
     256
    252257  // analysis of CU
    253258  xCompressCU( m_ppcBestCU[0], m_ppcTempCU[0], 0 );
     
    261266    }
    262267  }
     268#endif
     269
     270#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     271  xVerifyTileSetConstraint(rpcCU);
    263272#endif
    264273}
     
    731740        }
    732741#if (ENCODER_FAST_MODE)
     742#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     743      if(pcPic->getLayerId() > 0 && !m_disableILP)
     744#else
    733745      if(pcPic->getLayerId() > 0)
     746#endif
    734747      {
    735748        for(Int refLayer = 0; refLayer < pcSlice->getActiveNumILRRefIdx(); refLayer++)
     
    13811394      Bool bZeroMVILR = rpcTempCU->xCheckZeroMVILRMerge(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]);
    13821395      if(bZeroMVILR)
     1396      {
     1397#endif
     1398#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1399      if (!(rpcTempCU->isInterLayerReference(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]) && m_disableILP))
    13831400      {
    13841401#endif
     
    14261443          }
    14271444        }
     1445      }
     1446#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1447      }
     1448#endif
    14281449#if REF_IDX_ME_ZEROMV
    1429         }
    1430 #endif
    1431       }
     1450      }
     1451#endif
    14321452  }
    14331453
     
    18081828}
    18091829
     1830#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1831Bool TEncCu::xCheckTileSetConstraint( TComDataCU*& rpcCU )
     1832{
     1833  Bool disableILP = false;
     1834
     1835  if (rpcCU->getLayerId() == (m_pcEncCfg->getNumLayer() - 1)  && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(rpcCU->getAddr()) >= 0)
     1836  {
     1837    if (rpcCU->getPic()->getPicSym()->getTileSetType(rpcCU->getAddr()) == 2)
     1838    {
     1839      disableILP = true;
     1840    }
     1841    if (rpcCU->getPic()->getPicSym()->getTileSetType(rpcCU->getAddr()) == 1)
     1842    {
     1843      Int currCUaddr = rpcCU->getAddr();
     1844      Int frameWitdhInCU  = rpcCU->getPic()->getPicSym()->getFrameWidthInCU();
     1845      Int frameHeightInCU = rpcCU->getPic()->getPicSym()->getFrameHeightInCU();
     1846      Bool leftCUExists   = (currCUaddr % frameWitdhInCU) > 0;
     1847      Bool aboveCUExists  = (currCUaddr / frameWitdhInCU) > 0;
     1848      Bool rightCUExists  = (currCUaddr % frameWitdhInCU) < (frameWitdhInCU - 1);
     1849      Bool belowCUExists  = (currCUaddr / frameWitdhInCU) < (frameHeightInCU - 1);
     1850      Int currTileSetIdx  = rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr);
     1851      // Check if CU is at tile set boundary
     1852      if ( (leftCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-1) != currTileSetIdx) ||
     1853           (leftCUExists && aboveCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-frameWitdhInCU-1) != currTileSetIdx) ||
     1854           (aboveCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-frameWitdhInCU) != currTileSetIdx) ||
     1855           (aboveCUExists && rightCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-frameWitdhInCU+1) != currTileSetIdx) ||
     1856           (rightCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+1) != currTileSetIdx) ||
     1857           (rightCUExists && belowCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+frameWitdhInCU+1) != currTileSetIdx) ||
     1858           (belowCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+frameWitdhInCU) != currTileSetIdx) ||
     1859           (belowCUExists && leftCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+frameWitdhInCU-1) != currTileSetIdx) )
     1860      {
     1861        disableILP = true;  // Disable ILP in tile set boundary CU
     1862      }
     1863    }
     1864  }
     1865
     1866  return disableILP;
     1867}
     1868
     1869Void TEncCu::xVerifyTileSetConstraint( TComDataCU*& rpcCU )
     1870{
     1871  if (rpcCU->getLayerId() == (m_pcEncCfg->getNumLayer() - 1)  && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(rpcCU->getAddr()) >= 0 &&
     1872      m_disableILP)
     1873  {
     1874    UInt numPartitions = rpcCU->getPic()->getNumPartInCU();
     1875    for (UInt i = 0; i < numPartitions; i++)
     1876    {
     1877      if (!rpcCU->isIntra(i))
     1878      {
     1879        for (UInt refList = 0; refList < 2; refList++)
     1880        {
     1881          if (rpcCU->getInterDir(i) & (1<<refList))
     1882          {
     1883            TComCUMvField *mvField = rpcCU->getCUMvField(RefPicList(refList));
     1884            if (mvField->getRefIdx(i) >= 0)
     1885            {
     1886              assert(!(rpcCU->getSlice()->getRefPic(RefPicList(refList), mvField->getRefIdx(i))->isILR(rpcCU->getLayerId())));
     1887            }
     1888          }
     1889        }
     1890      }
     1891    }
     1892  }
     1893}
     1894#endif
     1895
    18101896/** Collect ARL statistics from one LCU
    18111897 * \param pcCU
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncCu.h

    r345 r474  
    108108  Int                     m_temporalSAD;
    109109#endif
     110#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     111  Bool                    m_disableILP;
     112#endif
    110113public:
    111114  /// copy parameters from encoder class
     
    171174#endif
    172175
     176#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     177  Bool xCheckTileSetConstraint( TComDataCU*& rpcCU );
     178  Void xVerifyTileSetConstraint( TComDataCU*& rpcCU );
     179#endif
     180
    173181#if AMP_ENC_SPEEDUP
    174182#if AMP_MRG
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r466 r474  
    30923092    {
    30933093#endif
     3094#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     3095    if (!(pcCU->isInterLayerReference(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]) && m_disableILP))
     3096    {
     3097#endif
    30943098      UInt uiCostCand = MAX_UINT;
    30953099      UInt uiBitsCand = 0;
     
    31153119        uiMergeIndex = uiMergeCand;
    31163120      }
     3121#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     3122    }
     3123#endif
    31173124#if REF_IDX_ME_ZEROMV
    31183125    }
     
    32213228  Int numValidMergeCand = 0 ;
    32223229
    3223 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3224   Bool disableILP = false;
    3225   if (pcCU->getPic()->getLayerId() == (m_pcEncCfg->getNumLayer() - 1)  && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && pcCU->getPic()->getPicSym()->getTileSetIdxMap(pcCU->getAddr()) >= 0)
    3226   {
    3227     if (pcCU->getPic()->getPicSym()->getTileSetType(pcCU->getAddr()) == 2)
    3228     {
    3229       disableILP = true;
    3230     }
    3231     if (pcCU->getPic()->getPicSym()->getTileSetType(pcCU->getAddr()) == 1)
    3232     {
    3233       Int currCUaddr = pcCU->getAddr();
    3234       Int frameWitdhInCU  = pcCU->getPic()->getPicSym()->getFrameWidthInCU();
    3235       Int frameHeightInCU = pcCU->getPic()->getPicSym()->getFrameHeightInCU();
    3236       Bool leftCUExists   = (currCUaddr % frameWitdhInCU) > 0;
    3237       Bool aboveCUExists  = (currCUaddr / frameWitdhInCU) > 0;
    3238       Bool rightCUExists  = (currCUaddr % frameWitdhInCU) < (frameWitdhInCU - 1);
    3239       Bool belowCUExists  = (currCUaddr / frameWitdhInCU) < (frameHeightInCU - 1);
    3240       Int currTileSetIdx  = pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr);
    3241       // Check if CU is at tile set boundary
    3242       if ( (leftCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-1) != currTileSetIdx) ||
    3243            (leftCUExists && aboveCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU-1) != currTileSetIdx) ||
    3244            (aboveCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU) != currTileSetIdx) ||
    3245            (aboveCUExists && rightCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU+1) != currTileSetIdx) ||
    3246            (rightCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+1) != currTileSetIdx) ||
    3247            (rightCUExists && belowCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU+1) != currTileSetIdx) ||
    3248            (belowCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU) != currTileSetIdx) ||
    3249            (belowCUExists && leftCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU-1) != currTileSetIdx) )
    3250       {
    3251         disableILP = true;  // Disable ILP in tile set boundary CU
    3252       }
    3253     }
    3254   }
    3255 #endif
    3256 
    32573230  for ( Int iPartIdx = 0; iPartIdx < iNumPart; iPartIdx++ )
    32583231  {
     
    33053278      {
    33063279#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3307         if (pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp )->isILR(pcCU->getLayerId()) && disableILP)
     3280        if (pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp )->isILR(pcCU->getLayerId()) && m_disableILP)
    33083281        {
    33093282          continue;
     
    35293502        }
    35303503#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3531         if (pcPic->isILR(pcCU->getLayerId()) && disableILP)
     3504        if (pcPic->isILR(pcCU->getLayerId()) && m_disableILP)
    35323505        {
    35333506          testIter = false;
     
    35503523          }
    35513524#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3552           if (pcPic->isILR(pcCU->getLayerId()) && disableILP)
     3525          if (pcPic->isILR(pcCU->getLayerId()) && m_disableILP)
    35533526          {
    35543527            testRefIdx = false;
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSearch.h

    r345 r474  
    129129  // UInt            m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS];
    130130  UInt            m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS+1]; //th array bounds
    131  
     131
     132#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     133  Bool            m_disableILP;
     134#endif
     135
    132136public:
    133137  TEncSearch();
     
    220224  Void xEncPCM    (TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piOrg, Pel* piPCM, Pel* piPred, Pel* piResi, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType eText);
    221225  Void IPCMSearch (TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv );
     226
     227#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     228  Void setDisableILP(Bool a) {m_disableILP = a;}
     229#endif
     230
    222231protected:
    223232 
Note: See TracChangeset for help on using the changeset viewer.