Ticket #1378: SCM3.0_T0048_bugfixes.diff

File SCM3.0_T0048_bugfixes.diff, 19.0 KB (added by cgisquet, 9 years ago)

JCTVC-T0048 complete fix for both slices and tiles

  • App/TAppEncoder/TAppEncCfg.cpp

     
    10871087    m_framesToBeEncoded *= 2;
    10881088  }
    10891089
     1090#if CANON_FORCE_TILES_3x3
     1091  m_tileUniformSpacingFlag = true;
     1092  m_numTileColumnsMinus1   = 2;
     1093  m_numTileRowsMinus1      = 2;
     1094#endif
     1095
    10901096  if( !m_tileUniformSpacingFlag && m_numTileColumnsMinus1 > 0 )
    10911097  {
    10921098    if (cfg_ColumnWidth.values.size() > m_numTileColumnsMinus1)
     
    17441750    xConfirmPara(  m_pcmLog2MaxSize < m_uiPCMLog2MinSize,                       "PCMLog2MaxSize must be equal to or greater than m_uiPCMLog2MinSize.");
    17451751  }
    17461752
     1753#if CANON_FORCE_SLICES_8
     1754  m_sliceMode = 1;
     1755  m_sliceArgument = 8;
     1756#endif
     1757
    17471758  xConfirmPara( m_sliceMode < 0 || m_sliceMode > 3, "SliceMode exceeds supported range (0 to 3)" );
    17481759  if (m_sliceMode!=0)
    17491760  {
  • Lib/TLibCommon/TComDataCU.h

     
    339339  TComMv        getLastIntraBCMv(Int idx=0) {return m_lastIntraBCMv[idx]; }
    340340  Void          setLastIntraBCMv(TComMv mv, Int idx=0 ) { m_lastIntraBCMv[idx] = mv; }
    341341  UInt          getIntraBCSearchAreaWidth( UInt uiMaxSearchWidthToLeftInCTUs );
     342#if CANON_LIMIT_IBC_TILES
     343  UInt          getIntraBCSearchAreaHeight( UInt uiMaxSearchHeightToUpInCTUs );
     344#endif
    342345
    343346  TCoeff*       getCoeff              (ComponentID component)   { return m_pcTrCoeff[component]; }
    344347
  • Lib/TLibCommon/TComDataCU.cpp

     
    42144214  const UInt        lcuWidth          = getSlice()->getSPS()->getMaxCUWidth(); 
    42154215  const TComPicSym &picSym            = *getPic()->getPicSym();
    42164216  const UInt        currentTileIdx    = picSym.getTileIdxMap(getCtuRsAddr());
     4217#if CANON_LIMIT_IBC_SLICES
     4218  const UInt        currentSliceIdx   = getSlice()->getSliceIdx();
     4219#endif
    42174220  const UInt        maxWidth          = uiMaxSearchWidthToLeftInCTUs*lcuWidth;
    42184221
    42194222  UInt width = 0;
     
    42264229    {
    42274230      break;
    42284231    }
     4232#if CANON_LIMIT_IBC_SLICES
     4233    if( getPic()->getCtu( pTestCU->getCtuRsAddr() )->getSlice()->getSliceIdx() != currentSliceIdx )
     4234    {
     4235      break;
     4236    }
     4237#endif
    42294238  }
    42304239  return std::min<UInt>(width, maxWidth);
    42314240}
    42324241
     4242#if CANON_LIMIT_IBC_TILES
     4243UInt TComDataCU::getIntraBCSearchAreaHeight( UInt uiMaxSearchHeightToUpInCTUs )
     4244{
     4245  const UInt        lcuHeight         = getSlice()->getSPS()->getMaxCUHeight(); 
     4246  const TComPicSym &picSym            = *getPic()->getPicSym();
     4247  const UInt        currentTileIdx    = picSym.getTileIdxMap(getCtuRsAddr());
     4248#if CANON_LIMIT_IBC_SLICES
     4249  const UInt        currentSliceIdx   = getSlice()->getSliceIdx();
     4250#endif
     4251  const UInt        maxHeight         = uiMaxSearchHeightToUpInCTUs*lcuHeight;
     4252
     4253  UInt height = 0;
     4254
     4255  for(TComDataCU *pTestCU=getCtuAbove();
     4256      height<maxHeight && pTestCU!=NULL && pTestCU->getSlice()!=NULL;
     4257      pTestCU=pTestCU->getCtuAbove(), height+=lcuHeight)
     4258  {
     4259    if ( picSym.getTileIdxMap( pTestCU->getCtuRsAddr() ) != currentTileIdx )
     4260    {
     4261      break;
     4262    }
     4263#if CANON_LIMIT_IBC_SLICES
     4264    if( getPic()->getCtu( pTestCU->getCtuRsAddr() )->getSlice()->getSliceIdx() != currentSliceIdx )
     4265    {
     4266      break;
     4267    }
     4268#endif
     4269  }
     4270  return std::min<UInt>(height, maxHeight);
     4271}
     4272#endif
     4273
    42334274Void TComDataCU::setPLTScanRotationModeFlagSubParts (Bool bPLTScanRotationModeFlag, UInt uiAbsPartIdx, UInt uiDepth)
    42344275{
    42354276  UInt uiCurrPartNumb = m_pcPic->getNumPartitionsInCtu() >> (uiDepth << 1);
  • Lib/TLibCommon/TypeDef.h

     
    4141#include <vector>
    4242#include <cstdlib>
    4343
     44#define CANON_FORCE_TILES_3x3      0
     45#define CANON_FORCE_SLICES_8       1
     46
     47#define CANON_LIMIT_IBC_TILES      1
     48#define CANON_LIMIT_IBC_SLICES     0
     49#define CANON_LIMIT_IBC_SLICES_v2  1
     50
     51#define CANON_TOOL_VERIFICATION_IBC_TILES  1
     52#define CANON_TOOL_VERIFICATION_IBC_SLICES 1
     53
    4454//! \ingroup TLibCommon
    4555//! \{
    4656
  • Lib/TLibEncoder/TEncSlice.cpp

     
    846846    if (ctuRsAddr == firstCtuRsAddrOfTile)
    847847    {
    848848      m_pppcRDSbacCoder[0][CI_CURR_BEST]->resetEntropy();
     849#if CANON_LIMIT_IBC_TILES
     850      //clear the hash table used in Intra BC search
     851      if( m_pcCfg->getUseHashBasedIntraBCSearch() )
     852      {
     853#if CANON_TOOL_VERIFICATION_IBC_TILES
     854        printf("xClearIntraBCHashTable TileIdx:%d \n", pcPic->getPicSym()->getTileIdxMap(ctuRsAddr) );
     855#endif
     856        m_pcPredSearch->xClearIntraBCHashTable();
     857      }
     858#endif
    849859    }
    850860    else if ( ctuXPosInCtus == tileXPosInCtus && m_pcCfg->getWaveFrontsynchro())
    851861    {
     
    11461156  //clear the hash table used in Intra BC search
    11471157  if( m_pcCfg->getUseHashBasedIntraBCSearch() )
    11481158  {
     1159#if CANON_TOOL_VERIFICATION_IBC_TILES
     1160    printf("xClearIntraBCHashTable sliceIdx:%d \n", pcSlice->getSliceIdx() );
     1161#endif
    11491162    m_pcPredSearch->xClearIntraBCHashTable();
    11501163  }
    11511164}
  • Lib/TLibEncoder/TEncSearch.h

     
    455455    }
    456456#endif
    457457
     458#if CANON_LIMIT_IBC_SLICES_v2
     459    if( pcCU->getSlice()->getSliceMode() )
     460    {
     461      UInt currSliceIdx = pcCU->getSlice()->getSliceIdx();
     462
     463      Int uiRefCuALX             = (cuPelX + predX )/uiMaxCuWidth;
     464      Int uiRefCuALY             = (cuPelY + predY )/uiMaxCuHeight;
     465
     466      UInt ctuAddrAL = uiRefCuALY*pcCU->getPic()->getFrameWidthInCtus() + uiRefCuALX;
     467      UInt ALSliceIdx =  pcCU->getPic()->getCtu( ctuAddrAL )->getSlice()->getSliceIdx();
     468
     469      if( ALSliceIdx != currSliceIdx )
     470      {
     471        return false;
     472      }
     473    }
     474#endif
     475
    458476    return (!pcCU->getSlice()->getPPS()->getConstrainedIntraPred())        ||
    459477           (pcCU->getSlice()->getSliceType() == I_SLICE)                   ||
    460478           xCIPIntraSearchPruning(pcCU, predX + ROIStartX, predY + ROIStartY, roiWidth, roiHeight);
  • Lib/TLibEncoder/TEncSearch.cpp

     
    57925792
    57935793  if((pcCU->getWidth(0) == 16) && (pcCU->getPartitionSize(0) == SIZE_2Nx2N) && m_pcEncCfg->getUseIntraBCFullFrameSearch())
    57945794  {
     5795#if CANON_LIMIT_IBC_TILES
     5796    if( pcCU->getSlice()->getPPS()->getTilesEnabledFlag()
     5797#if CANON_LIMIT_IBC_SLICES
     5798      ||  pcCU->getSlice()->getSliceMode()
     5799#endif
     5800      )
     5801    {
     5802      Int maxXsr = (cuPelX % lcuWidth)  + pcCU->getIntraBCSearchAreaWidth ( cuPelX/lcuWidth  );
     5803      Int maxYsr = (cuPelY % lcuHeight) + pcCU->getIntraBCSearchAreaHeight( cuPelY/lcuHeight );
     5804
     5805      srLeft  = -maxXsr;
     5806      srTop   = -maxYsr;
     5807    }
     5808    else
     5809    {
     5810      srLeft  = -1 * cuPelX;
     5811      srTop   = -1 * cuPelY;
     5812    }
     5813#else
    57955814    srLeft  = -1 * cuPelX;
    57965815    srTop   = -1 * cuPelY;
     5816#endif
    57975817
    57985818    srRight = iPicWidth - cuPelX - iRoiWidth;
    57995819    srBottom = lcuHeight - cuPelY % lcuHeight - iRoiHeight;
     
    60996119
    61006120    if(m_pcEncCfg->getUseIntraBCFullFrameSearch() )
    61016121    {
    6102       srLeft  = -1 * cuPelX;
    6103       srTop   = -1 * cuPelY;
     6122#if CANON_LIMIT_IBC_TILES
     6123      if( pcCU->getSlice()->getPPS()->getTilesEnabledFlag()
     6124#if CANON_LIMIT_IBC_SLICES
     6125        ||  pcCU->getSlice()->getSliceMode()
     6126#endif
     6127        )
     6128      {
     6129        Int maxXsr = (cuPelX % lcuWidth)  + pcCU->getIntraBCSearchAreaWidth ( cuPelX/lcuWidth  );
     6130        Int maxYsr = (cuPelY % lcuHeight) + pcCU->getIntraBCSearchAreaHeight( cuPelY/lcuHeight );
    61046131
     6132        srLeft  = -maxXsr;
     6133        srTop   = -maxYsr;
     6134      }
     6135      else
     6136      {
     6137        srLeft  = -1 * cuPelX;
     6138        srTop   = -1 * cuPelY;
     6139      }
     6140#endif
     6141
    61056142      srRight  = iPicWidth - cuPelX - iRoiWidth;
    61066143      srBottom = lcuHeight - cuPelY % lcuHeight - iRoiHeight;
    61076144
     
    62796316
    62806317    const Int boundY = (0 - iRoiHeight - puPelOffsetY);
    62816318#if SCM_S0067_IBC_FULL_1D_SEARCH_FOR_PU
     6319#if CANON_LIMIT_IBC_TILES
    62826320    Int lowY = (pcCU->getPartitionSize(uiPartAddr) == SCM_S0067_IBC_FULL_1D_SEARCH_FOR_PU)
     6321             ? srTop : max(iSrchRngVerTop, srTop);
     6322#else
     6323    Int lowY = (pcCU->getPartitionSize(uiPartAddr) == SCM_S0067_IBC_FULL_1D_SEARCH_FOR_PU)
    62836324             ? -cuPelY : max(iSrchRngVerTop, 0 - cuPelY);
     6325#endif
    62846326    for(Int y = lowY ; y <= boundY ; ++y )
    62856327#else
    62866328    for(Int y = max(iSrchRngVerTop, 0 - cuPelY) ; y <= boundY ; ++y )
     
    63356377    }
    63366378
    63376379#if SCM_S0067_IBC_FULL_1D_SEARCH_FOR_PU
     6380#if CANON_LIMIT_IBC_TILES
    63386381    const Int boundX = (pcCU->getPartitionSize(uiPartAddr) == SCM_S0067_IBC_FULL_1D_SEARCH_FOR_PU)
     6382                     ? srLeft : max(iSrchRngHorLeft, srLeft);
     6383#else
     6384    const Int boundX = (pcCU->getPartitionSize(uiPartAddr) == SCM_S0067_IBC_FULL_1D_SEARCH_FOR_PU)
    63396385                     ? -cuPelX : max(iSrchRngHorLeft, - cuPelX);
     6386#endif
    63406387#else
    63416388    const Int boundX = max(iSrchRngHorLeft, - cuPelX);
    63426389#endif
     
    64136460
    64146461    if( pcCU->getWidth(0) < 16 && !bUse1DSearchFor8x8 )
    64156462    {
     6463#if CANON_LIMIT_IBC_TILES
     6464      for(Int y = max(iSrchRngVerTop, srTop); y <= iSrchRngVerBottom; y +=2)
     6465#else
    64166466      for(Int y = max(iSrchRngVerTop, -cuPelY); y <= iSrchRngVerBottom; y +=2)
     6467#endif
    64176468      {
    64186469        if ((y == 0) || ((Int) (cuPelY + y + iRoiHeight) >= iPicHeight)) //NOTE: RExt - is this still necessary?
    64196470          continue;
    64206471
    64216472        Int iTempY = y + iRelCUPelY + iRoiHeight - 1;
    64226473
     6474#if CANON_LIMIT_IBC_TILES
     6475        for(Int x = max(iSrchRngHorLeft, srLeft); x <= iSrchRngHorRight; x++)
     6476#else
    64236477        for(Int x = max(iSrchRngHorLeft, -cuPelX); x <= iSrchRngHorRight; x++)
     6478#endif
    64246479        {
    64256480          if ((x == 0) || ((Int) (cuPelX + x + iRoiWidth) >= iPicWidth)) //NOTE: RExt - is this still necessary?
    64266481            continue;
     
    64876542#endif
    64886543      }
    64896544
    6490 
     6545#if CANON_LIMIT_IBC_TILES
     6546      for(Int y = (max(iSrchRngVerTop, srTop) + 1); y <= iSrchRngVerBottom; y += 2)
     6547#else
    64916548      for(Int y = (max(iSrchRngVerTop, -cuPelY) + 1); y <= iSrchRngVerBottom; y += 2)
     6549#endif
    64926550      {
    64936551        if ((y == 0) || ((Int) (cuPelY + y + iRoiHeight) >= iPicHeight)) //NOTE: RExt - is this still necessary?
    64946552          continue;
    64956553
    64966554        Int iTempY = y + iRelCUPelY + iRoiHeight - 1;
    64976555
     6556#if CANON_LIMIT_IBC_TILES
     6557        for(Int x = max(iSrchRngHorLeft, srLeft); x <= iSrchRngHorRight; x += 2)
     6558#else
    64986559        for(Int x = max(iSrchRngHorLeft, -cuPelX); x <= iSrchRngHorRight; x += 2)
     6560#endif
    64996561        {
    65006562          if ((x == 0) || ((Int) (cuPelX + x + iRoiWidth) >= iPicWidth)) //NOTE: RExt - is this still necessary?
    65016563            continue;
     
    65806642
    65816643      uiTempSadBest = uiSadBestCand[0];
    65826644
    6583 
     6645#if CANON_LIMIT_IBC_TILES
     6646      for(Int y = (max(iSrchRngVerTop, srTop) + 1); y <= iSrchRngVerBottom; y += 2)
     6647#else
    65846648      for(Int y = (max(iSrchRngVerTop, -cuPelY) + 1); y <= iSrchRngVerBottom; y += 2)
     6649#endif
    65856650      {
    65866651        if ((y == 0) || ((Int) (cuPelY + y + iRoiHeight) >= iPicHeight)) //NOTE: RExt - is this still necessary?
    65876652          continue;
    65886653
    65896654        Int iTempY = y + iRelCUPelY + iRoiHeight - 1;
    65906655
     6656#if CANON_LIMIT_IBC_TILES
     6657        for(Int x = (max(iSrchRngHorLeft, srLeft) + 1); x <= iSrchRngHorRight; x += 2)
     6658#else
    65916659        for(Int x = (max(iSrchRngHorLeft, -cuPelX) + 1); x <= iSrchRngHorRight; x += 2)
     6660#endif
    65926661        {
    65936662
    65946663          if ((x == 0) || ((Int) (cuPelX + x + iRoiWidth) >= iPicWidth)) //NOTE: RExt - is this still necessary?
     
    69657034    }
    69667035#endif
    69677036
     7037#if CANON_TOOL_VERIFICATION_IBC_TILES
     7038    const TComPicSym &picSym  = *pcCU->getPic()->getPicSym();
     7039    UInt currTileIdx = picSym.getTileIdxMap( pcCU->getCtuRsAddr() );
     7040
     7041    // Check BottomRight Corner of referenced Block
     7042    UInt ctuAddrBR = uiRefCuY*pcCU->getPic()->getFrameWidthInCtus() + uiRefCuX;
     7043    UInt BRTileIdx = picSym.getTileIdxMap( ctuAddrBR );
     7044
     7045    if( currTileIdx != BRTileIdx )
     7046    {
     7047      printf("Error Hash IBC reference across Tiles absPartIdx:%d CurrCtu:%d CurrTileIdx:%d ctuBR:%d refBRTileIdx:%d mv(%d,%d) \n", pcCU->getZorderIdxInCtu(), pcCU->getCtuRsAddr(), currTileIdx, ctuAddrBR, BRTileIdx, iTempX, iTempY );
     7048      fflush(stdout);
     7049    }
     7050
     7051    // Check AboveLeft Corner of referenced Block
     7052    Int uiRefALCuX   = iTempX / uiMaxCuWidth;
     7053    Int uiRefALCuY   = iTempY / uiMaxCuHeight;   
     7054
     7055    UInt ctuAddrAL = uiRefALCuY*pcCU->getPic()->getFrameWidthInCtus() + uiRefALCuX;
     7056    UInt ALTileIdx = picSym.getTileIdxMap( ctuAddrAL );
     7057
     7058    if( currTileIdx != ALTileIdx )
     7059    {
     7060      printf("Error Hash IBC reference across Tiles absPartIdx:%d CurrCtu:%d CurrTileIdx:%d ctuAL:%d refALTileIdx:%d mv(%d,%d) \n", pcCU->getZorderIdxInCtu(), pcCU->getCtuRsAddr(), currTileIdx, ctuAddrAL, ALTileIdx, iTempX, iTempY );
     7061      fflush(stdout);
     7062    }
     7063#endif
     7064
    69687065    uiSad = 0;//m_pcRdCost->getCost( iTempX - cuPelX, iTempY - cuPelY);
    69697066
    69707067    for(int r = 0; r < iRoiHeight; )
     
    70337130  Int        iOrgHashIndex;
    70347131  IntraBCHashNode* NewHashNode;
    70357132
     7133#if CANON_LIMIT_IBC_TILES || (CANON_LIMIT_IBC_SLICES || CANON_LIMIT_IBC_SLICES_v2)
     7134#if CANON_LIMIT_IBC_TILES
     7135  const Bool tilesEnabled = pcCU->getSlice()->getPPS()->getTilesEnabledFlag();
     7136  const TComPicSym &picSym  = *pcCU->getPic()->getPicSym();
     7137  const UInt currTileIdx = picSym.getTileIdxMap( pcCU->getCtuRsAddr() );
     7138#endif
     7139#if CANON_LIMIT_IBC_SLICES || CANON_LIMIT_IBC_SLICES_v2
     7140  const Bool slicesEnabled = pcCU->getSlice()->getSliceMode();
     7141  const UInt currSliceIdx  = pcCU->getSlice()->getSliceIdx();
     7142#endif
    70367143
     7144  const UInt uiMaxCuWidth         = pcCU->getSlice()->getSPS()->getMaxCUWidth();
     7145  const UInt uiMaxCuHeight        = pcCU->getSlice()->getSPS()->getMaxCUHeight();
     7146#endif
     7147
    70377148  for(int j = 0; j < MAX_CU_SIZE; j++)
    70387149  {
    70397150    for(int i = 0; i < MAX_CU_SIZE; i++)
     
    70467157        continue;
    70477158      }
    70487159
     7160#if CANON_LIMIT_IBC_TILES
     7161      if( tilesEnabled )
     7162      {
     7163        Int refCTBPosXAL = iTempX / uiMaxCuWidth;
     7164        Int refCTBPosYAL = iTempY / uiMaxCuHeight;
     7165
     7166        UInt ctuAddrAL = refCTBPosYAL*pcCU->getPic()->getFrameWidthInCtus() + refCTBPosXAL;
     7167        UInt ALTileIdx = picSym.getTileIdxMap( ctuAddrAL );
     7168
     7169        if( currTileIdx != ALTileIdx )
     7170        {
     7171          continue;
     7172        }
     7173      }
     7174#endif
     7175#if CANON_LIMIT_IBC_SLICES || CANON_LIMIT_IBC_SLICES_v2
     7176      if( slicesEnabled )
     7177      {
     7178        Int refCTBPosXAL = iTempX / uiMaxCuWidth;
     7179        Int refCTBPosYAL = iTempY / uiMaxCuHeight;
     7180
     7181        UInt ctuAddrAL = refCTBPosYAL*pcCU->getPic()->getFrameWidthInCtus() + refCTBPosXAL;
     7182        UInt ALSliceIdx = pcCU->getPic()->getCtu( ctuAddrAL )->getSlice()->getSliceIdx();
     7183
     7184        if( currSliceIdx != ALSliceIdx )
     7185        {
     7186          continue;
     7187        }
     7188      }
     7189#endif
     7190
    70497191      iOrgHashIndex = xIntraBCHashTableIndex(pcCU, iTempX, iTempY, iRoiWidth, iRoiHeight, isRec);
    70507192
    70517193      if(iOrgHashIndex < 0)
  • Lib/TLibDecoder/TDecCu.cpp

     
    533533      fflush(stdout);
    534534      assert(0);
    535535    }
     536
     537#if CANON_TOOL_VERIFICATION_IBC_TILES
     538    if( pcCU->getSlice()->getPPS()->getTilesEnabledFlag() )
     539    {
     540      const TComPicSym &picSym  = *pcCU->getPic()->getPicSym();
     541      UInt currTileIdx = picSym.getTileIdxMap( pcCU->getCtuRsAddr() );
     542
     543      // Check BottomRight Corner of referenced Block
     544      UInt ctuAddrBR = refCTBPosY*pcCU->getPic()->getFrameWidthInCtus() + refCTBPosX;
     545      UInt BRTileIdx = picSym.getTileIdxMap( ctuAddrBR );
     546
     547      if( currTileIdx != BRTileIdx )
     548      {
     549        printf("Error IBC reference across Tiles uiDepth:%d absPartIdx:%d CurrCtu:%d CurrTileIdx:%d ctuBR:%d refBRTileIdx:%d mv(%d,%d) \n", uiDepth, pcCU->getZorderIdxInCtu(), pcCU->getCtuRsAddr(), currTileIdx, ctuAddrBR, BRTileIdx, cMv.getHor(), cMv.getVer() );
     550        fflush(stdout);
     551      }
     552
     553      // AboveLeft Corner
     554      Int refPosXAL    = posX + cMv.getHor();
     555      Int refPosYAL    = posY + cMv.getVer();
     556      // CTB Position
     557      Int refCTBPosXAL = refPosXAL / uiMaxCuWidth;
     558      Int refCTBPosYAL = refPosYAL / uiMaxCuHeight;
     559
     560      UInt ctuAddrAL = refCTBPosYAL*pcCU->getPic()->getFrameWidthInCtus() + refCTBPosXAL;
     561      UInt ALTileIdx = picSym.getTileIdxMap( ctuAddrAL );
     562
     563      if( currTileIdx != ALTileIdx )
     564      {
     565        printf("Error IBC reference across Tiles uiDepth:%d absPartIdx:%d CurrCtu:%d CurrTileIdx:%d ctuAL:%d refALTileIdx:%d mv(%d,%d) \n", uiDepth, pcCU->getZorderIdxInCtu(), pcCU->getCtuRsAddr(), currTileIdx, ctuAddrAL, ALTileIdx, cMv.getHor(), cMv.getVer() );
     566        fflush(stdout);
     567      }
     568    }
    536569#endif
     570#if CANON_TOOL_VERIFICATION_IBC_SLICES
     571    //if( pcCU->getSlice()->getSliceMode() ) // useless at decoder
     572    {
     573      UInt currSliceIdx = pcCU->getSlice()->getSliceIdx();
     574
     575      // Check BottomRight Corner of referenced Block
     576      UInt ctuAddrBR = refCTBPosY*pcCU->getPic()->getFrameWidthInCtus() + refCTBPosX;
     577      UInt BRSliceIdx = pcCU->getPic()->getCtu( ctuAddrBR )->getSlice()->getSliceIdx();
     578
     579      if( currSliceIdx != BRSliceIdx )
     580      {
     581        printf("Error IBC reference across Slices uiDepth:%d absPartIdx:%d CurrCtu:%d CurrSliceIdx:%d ctuBR:%d refBRSliceIdx:%d mv(%d,%d) \n", uiDepth, pcCU->getZorderIdxInCtu(), pcCU->getCtuRsAddr(), currSliceIdx, ctuAddrBR, BRSliceIdx, cMv.getHor(), cMv.getVer() );
     582        fflush(stdout);
     583      }
     584
     585      // AboveLeft Corner
     586      Int refPosXAL    = posX + cMv.getHor();
     587      Int refPosYAL    = posY + cMv.getVer();
     588      // CTB Position
     589      Int refCTBPosXAL = refPosXAL / uiMaxCuWidth;
     590      Int refCTBPosYAL = refPosYAL / uiMaxCuHeight;
     591
     592      UInt ctuAddrAL = refCTBPosYAL*pcCU->getPic()->getFrameWidthInCtus() + refCTBPosXAL;
     593      UInt ALSliceIdx =  pcCU->getPic()->getCtu( ctuAddrAL )->getSlice()->getSliceIdx();
     594
     595      if( currSliceIdx != ALSliceIdx )
     596      {
     597        printf("Error IBC reference across Slices uiDepth:%d absPartIdx:%d CurrCtu:%d CurrSliceIdx:%d ctuAL:%d refALSliceIdx:%d mv(%d,%d) \n", uiDepth, pcCU->getZorderIdxInCtu(), pcCU->getCtuRsAddr(), currSliceIdx, ctuAddrAL, ALSliceIdx, cMv.getHor(), cMv.getVer() );
     598        fflush(stdout);
     599      }
     600    }
     601#endif
     602
     603#endif
    537604    m_pcPrediction->intraBlockCopy( pcCU, m_ppcYuvReco[uiDepth], iPartIdx );
    538605  }
    539606