Ignore:
Timestamp:
12 Nov 2014, 08:09:17 (10 years ago)
Author:
seregin
Message:

initial porting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-upgrade/source/Lib/TLibCommon/TComPicSym.cpp

    r823 r916  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2014, ITU/ISO/IEC
     
    4848
    4949TComPicSym::TComPicSym()
    50 :m_uiWidthInCU(0)
    51 ,m_uiHeightInCU(0)
     50:m_frameWidthInCtus(0)
     51,m_frameHeightInCtus(0)
    5252,m_uiMaxCUWidth(0)
    5353,m_uiMaxCUHeight(0)
     
    5555,m_uiMinCUHeight(0)
    5656,m_uhTotalDepth(0)
    57 ,m_uiNumPartitions(0)
    58 ,m_uiNumPartInWidth(0)
    59 ,m_uiNumPartInHeight(0)
    60 ,m_uiNumCUsInFrame(0)
     57,m_numPartitionsInCtu(0)
     58,m_numPartInCtuWidth(0)
     59,m_numPartInCtuHeight(0)
     60,m_numCtusInFrame(0)
    6161,m_apcTComSlice(NULL)
    62 ,m_uiNumAllocatedSlice (0)
    63 ,m_apcTComDataCU (NULL)
    64 ,m_iNumColumnsMinus1 (0)
    65 ,m_iNumRowsMinus1(0)
    66 ,m_puiCUOrderMap(0)
     62,m_uiNumAllocatedSlice(0)
     63,m_pictureCtuArray(NULL)
     64,m_numTileColumnsMinus1(0)
     65,m_numTileRowsMinus1(0)
     66,m_ctuTsToRsAddrMap(NULL)
    6767,m_puiTileIdxMap(NULL)
    68 ,m_puiInverseCUOrderMap(NULL)
     68,m_ctuRsToTsAddrMap(NULL)
    6969,m_saoBlkParams(NULL)
    70 {};
    71 
    72 
    73 Void TComPicSym::create  ( Int iPicWidth, Int iPicHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth )
     70{}
     71
     72
     73Void TComPicSym::create  ( ChromaFormat chromaFormatIDC, Int iPicWidth, Int iPicHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth )
    7474{
    7575  UInt i;
    7676
    77   m_uhTotalDepth      = uiMaxDepth;
    78   m_uiNumPartitions  = 1<<(m_uhTotalDepth<<1);
    79  
    80   m_uiMaxCUWidth      = uiMaxWidth;
    81   m_uiMaxCUHeight     = uiMaxHeight;
    82  
    83   m_uiMinCUWidth      = uiMaxWidth  >> m_uhTotalDepth;
    84   m_uiMinCUHeight     = uiMaxHeight >> m_uhTotalDepth;
    85  
    86   m_uiNumPartInWidth  = m_uiMaxCUWidth  / m_uiMinCUWidth;
    87   m_uiNumPartInHeight = m_uiMaxCUHeight / m_uiMinCUHeight;
    88  
    89   m_uiWidthInCU       = ( iPicWidth %m_uiMaxCUWidth  ) ? iPicWidth /m_uiMaxCUWidth  + 1 : iPicWidth /m_uiMaxCUWidth;
    90   m_uiHeightInCU      = ( iPicHeight%m_uiMaxCUHeight ) ? iPicHeight/m_uiMaxCUHeight + 1 : iPicHeight/m_uiMaxCUHeight;
    91  
    92   m_uiNumCUsInFrame   = m_uiWidthInCU * m_uiHeightInCU;
    93   m_apcTComDataCU     = new TComDataCU*[m_uiNumCUsInFrame];
    94  
     77  m_uhTotalDepth       = uiMaxDepth;
     78  m_numPartitionsInCtu = 1<<(m_uhTotalDepth<<1);
     79
     80  m_uiMaxCUWidth       = uiMaxWidth;
     81  m_uiMaxCUHeight      = uiMaxHeight;
     82
     83  m_uiMinCUWidth       = uiMaxWidth  >> m_uhTotalDepth;
     84  m_uiMinCUHeight      = uiMaxHeight >> m_uhTotalDepth;
     85
     86  m_numPartInCtuWidth  = m_uiMaxCUWidth  / m_uiMinCUWidth;  // equivalent to 1<<m_uhTotalDepth
     87  m_numPartInCtuHeight = m_uiMaxCUHeight / m_uiMinCUHeight; // equivalent to 1<<m_uhTotalDepth
     88
     89  m_frameWidthInCtus   = ( iPicWidth %m_uiMaxCUWidth  ) ? iPicWidth /m_uiMaxCUWidth  + 1 : iPicWidth /m_uiMaxCUWidth;
     90  m_frameHeightInCtus  = ( iPicHeight%m_uiMaxCUHeight ) ? iPicHeight/m_uiMaxCUHeight + 1 : iPicHeight/m_uiMaxCUHeight;
     91
     92  m_numCtusInFrame     = m_frameWidthInCtus * m_frameHeightInCtus;
     93  m_pictureCtuArray    = new TComDataCU*[m_numCtusInFrame];
     94
    9595  if (m_uiNumAllocatedSlice>0)
    9696  {
     
    101101    delete [] m_apcTComSlice;
    102102  }
    103   m_apcTComSlice      = new TComSlice*[m_uiNumCUsInFrame];
     103  m_apcTComSlice      = new TComSlice*[m_numCtusInFrame];
    104104  m_apcTComSlice[0]   = new TComSlice;
    105105  m_uiNumAllocatedSlice = 1;
    106   for ( i=0; i<m_uiNumCUsInFrame ; i++ )
    107   {
    108     m_apcTComDataCU[i] = new TComDataCU;
    109     m_apcTComDataCU[i]->create( m_uiNumPartitions, m_uiMaxCUWidth, m_uiMaxCUHeight, false, m_uiMaxCUWidth >> m_uhTotalDepth
     106  for ( i=0; i<m_numCtusInFrame ; i++ )
     107  {
     108    m_pictureCtuArray[i] = new TComDataCU;
     109    m_pictureCtuArray[i]->create( chromaFormatIDC, m_numPartitionsInCtu, m_uiMaxCUWidth, m_uiMaxCUHeight, false, m_uiMaxCUWidth >> m_uhTotalDepth
    110110#if ADAPTIVE_QP_SELECTION
    111111      , true
    112 #endif     
     112#endif
    113113      );
    114114  }
    115115
    116   m_puiCUOrderMap = new UInt[m_uiNumCUsInFrame+1];
    117   m_puiTileIdxMap = new UInt[m_uiNumCUsInFrame];
     116  m_ctuTsToRsAddrMap = new UInt[m_numCtusInFrame+1];
     117  m_puiTileIdxMap    = new UInt[m_numCtusInFrame];
     118  m_ctuRsToTsAddrMap = new UInt[m_numCtusInFrame+1];
     119
    118120#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    119   m_piTileSetIdxMap = new Int[m_uiNumCUsInFrame];
    120   m_pucTileSetType = new UChar[m_uiNumCUsInFrame];
    121   m_pbSkippedTileSetFlag = new Bool[m_uiNumCUsInFrame];
    122 #endif
    123   m_puiInverseCUOrderMap = new UInt[m_uiNumCUsInFrame+1];
    124 
    125   for( i=0; i<m_uiNumCUsInFrame; i++ )
    126   {
    127     m_puiCUOrderMap[i] = i;
    128     m_puiInverseCUOrderMap[i] = i;
    129   }
    130 
    131   m_saoBlkParams = new SAOBlkParam[m_uiNumCUsInFrame];
     121  m_piTileSetIdxMap = new Int[m_numCtusInFrame];
     122  m_pucTileSetType = new UChar[m_numCtusInFrame];
     123  m_pbSkippedTileSetFlag = new Bool[m_numCtusInFrame];
     124#endif 
     125
     126  for( i=0; i<m_numCtusInFrame; i++ )
     127  {
     128    m_ctuTsToRsAddrMap[i] = i;
     129    m_ctuRsToTsAddrMap[i] = i;
     130  }
     131
     132  m_saoBlkParams = new SAOBlkParam[m_numCtusInFrame];
    132133}
    133134
     
    143144  }
    144145  m_apcTComSlice = NULL;
    145  
    146   for (Int i = 0; i < m_uiNumCUsInFrame; i++)
    147   {
    148     m_apcTComDataCU[i]->destroy();
    149     delete m_apcTComDataCU[i];
    150     m_apcTComDataCU[i] = NULL;
    151   }
    152   delete [] m_apcTComDataCU;
    153   m_apcTComDataCU = NULL;
    154 
    155   delete [] m_puiCUOrderMap;
    156   m_puiCUOrderMap = NULL;
     146
     147  for (Int i = 0; i < m_numCtusInFrame; i++)
     148  {
     149    m_pictureCtuArray[i]->destroy();
     150    delete m_pictureCtuArray[i];
     151    m_pictureCtuArray[i] = NULL;
     152  }
     153  delete [] m_pictureCtuArray;
     154  m_pictureCtuArray = NULL;
     155
     156  delete [] m_ctuTsToRsAddrMap;
     157  m_ctuTsToRsAddrMap = NULL;
    157158
    158159  delete [] m_puiTileIdxMap;
     
    167168#endif
    168169
    169   delete [] m_puiInverseCUOrderMap;
    170   m_puiInverseCUOrderMap = NULL;
    171  
     170  delete [] m_ctuRsToTsAddrMap;
     171  m_ctuRsToTsAddrMap = NULL;
     172
    172173  if(m_saoBlkParams)
    173174  {
     
    178179Void TComPicSym::allocateNewSlice()
    179180{
    180   assert ((m_uiNumAllocatedSlice + 1) <= m_uiNumCUsInFrame);
     181  assert ((m_uiNumAllocatedSlice + 1) <= m_numCtusInFrame);
    181182  m_apcTComSlice[m_uiNumAllocatedSlice ++] = new TComSlice;
    182183  if (m_uiNumAllocatedSlice>=2)
     
    201202}
    202203
    203 UInt TComPicSym::getPicSCUEncOrder( UInt SCUAddr )
    204 {
    205   return getInverseCUOrderMap(SCUAddr/m_uiNumPartitions)*m_uiNumPartitions + SCUAddr%m_uiNumPartitions;
    206 }
    207 
    208 UInt TComPicSym::getPicSCUAddr( UInt SCUEncOrder )
    209 {
    210   return getCUOrderMap(SCUEncOrder/m_uiNumPartitions)*m_uiNumPartitions + SCUEncOrder%m_uiNumPartitions;
     204Void TComPicSym::initCtuTsRsAddrMaps()
     205{
     206  //generate the Coding Order Map and Inverse Coding Order Map
     207  for(Int ctuTsAddr=0, ctuRsAddr=0; ctuTsAddr<getNumberOfCtusInFrame(); ctuTsAddr++, ctuRsAddr = xCalculateNextCtuRSAddr(ctuRsAddr))
     208  {
     209    setCtuTsToRsAddrMap(ctuTsAddr, ctuRsAddr);
     210    setCtuRsToTsAddrMap(ctuRsAddr, ctuTsAddr);
     211  }
     212  setCtuTsToRsAddrMap(getNumberOfCtusInFrame(), getNumberOfCtusInFrame());
     213  setCtuRsToTsAddrMap(getNumberOfCtusInFrame(), getNumberOfCtusInFrame());
    211214}
    212215
     
    214217{
    215218  //set NumColumnsMinus1 and NumRowsMinus1
    216   setNumColumnsMinus1( pps->getNumTileColumnsMinus1() );
    217   setNumRowsMinus1( pps->getTileNumRowsMinus1() );
     219  setNumTileColumnsMinus1( pps->getNumTileColumnsMinus1() );
     220  setNumTileRowsMinus1(    pps->getNumTileRowsMinus1()    );
    218221
    219222  const Int numCols = pps->getNumTileColumnsMinus1() + 1;
    220   const Int numRows = pps->getTileNumRowsMinus1() + 1;
     223  const Int numRows = pps->getNumTileRowsMinus1() + 1;
    221224  const Int numTiles = numRows * numCols;
    222225
     
    228231    //set width and height for each (uniform) tile
    229232    for(Int row=0; row < numRows; row++)
    230   {
     233    {
    231234      for(Int col=0; col < numCols; col++)
    232235      {
    233236        const Int tileIdx = row * numCols + col;
    234         m_tileParameters[tileIdx].setTileWidth( (col+1)*getFrameWidthInCU()/numCols
    235                                               - (col*getFrameWidthInCU())/numCols );
    236         m_tileParameters[tileIdx].setTileHeight( (row+1)*getFrameHeightInCU()/numRows
    237                                                - (row*getFrameHeightInCU())/numRows );
     237        m_tileParameters[tileIdx].setTileWidthInCtus(  (col+1)*getFrameWidthInCtus( )/numCols - (col*getFrameWidthInCtus( ))/numCols );
     238        m_tileParameters[tileIdx].setTileHeightInCtus( (row+1)*getFrameHeightInCtus()/numRows - (row*getFrameHeightInCtus())/numRows );
    238239      }
    239240    }
     
    245246    {
    246247      Int cumulativeTileWidth = 0;
    247       for(Int col=0; col < getNumColumnsMinus1(); col++)
    248       {
    249         m_tileParameters[row * numCols + col].setTileWidth( pps->getTileColumnWidth(col) );
     248      for(Int col=0; col < getNumTileColumnsMinus1(); col++)
     249      {
     250        m_tileParameters[row * numCols + col].setTileWidthInCtus( pps->getTileColumnWidth(col) );
    250251        cumulativeTileWidth += pps->getTileColumnWidth(col);
    251252      }
    252       m_tileParameters[row * numCols + getNumColumnsMinus1()].setTileWidth( getFrameWidthInCU()-cumulativeTileWidth );
    253   }
     253      m_tileParameters[row * numCols + getNumTileColumnsMinus1()].setTileWidthInCtus( getFrameWidthInCtus()-cumulativeTileWidth );
     254    }
    254255
    255256    //set the height for each tile
     
    257258    {
    258259      Int cumulativeTileHeight = 0;
    259       for(Int row=0; row < getNumRowsMinus1(); row++)
    260       {
    261         m_tileParameters[row * numCols + col].setTileHeight( pps->getTileRowHeight(row) );
     260      for(Int row=0; row < getNumTileRowsMinus1(); row++)
     261      {
     262        m_tileParameters[row * numCols + col].setTileHeightInCtus( pps->getTileRowHeight(row) );
    262263        cumulativeTileHeight += pps->getTileRowHeight(row);
    263264      }
    264       m_tileParameters[getNumRowsMinus1() * numCols + col].setTileHeight( getFrameHeightInCU()-cumulativeTileHeight );
     265      m_tileParameters[getNumTileRowsMinus1() * numCols + col].setTileHeightInCtus( getFrameHeightInCtus()-cumulativeTileHeight );
    265266    }
    266267  }
     
    270271  Int minHeight = 1;
    271272  const Int profileIdc = pps->getSPS()->getPTL()->getGeneralPTL()->getProfileIdc();
    272   if (  profileIdc == Profile::MAIN || profileIdc == Profile::MAIN10)
     273  if (  profileIdc == Profile::MAIN || profileIdc == Profile::MAIN10) //TODO: add more profiles to the tile-size check...
    273274  {
    274275    if (pps->getTilesEnabledFlag())
     
    283284    {
    284285      const Int tileIdx = row * numCols + col;
    285       assert (m_tileParameters[tileIdx].getTileWidth() >= minWidth);
    286       assert (m_tileParameters[tileIdx].getTileHeight() >= minHeight);
     286      assert (m_tileParameters[tileIdx].getTileWidthInCtus() >= minWidth);
     287      assert (m_tileParameters[tileIdx].getTileHeightInCtus() >= minHeight);
    287288    }
    288289  }
     
    300301      for( Int i=0; i <= col; i++ )
    301302      {
    302         rightEdgePosInCTU += m_tileParameters[row * numCols + i].getTileWidth();
    303       }
    304       m_tileParameters[tileIdx].setRightEdgePosInCU(rightEdgePosInCTU-1);
     303        rightEdgePosInCTU += m_tileParameters[row * numCols + i].getTileWidthInCtus();
     304      }
     305      m_tileParameters[tileIdx].setRightEdgePosInCtus(rightEdgePosInCTU-1);
    305306
    306307      //initialize the BottomEdgePosInCU for each tile
     
    308309      for( Int i=0; i <= row; i++ )
    309310      {
    310         bottomEdgePosInCTU += m_tileParameters[i * numCols + col].getTileHeight();
    311       }
    312       m_tileParameters[tileIdx].setBottomEdgePosInCU(bottomEdgePosInCTU-1);
     311        bottomEdgePosInCTU += m_tileParameters[i * numCols + col].getTileHeightInCtus();
     312      }
     313      m_tileParameters[tileIdx].setBottomEdgePosInCtus(bottomEdgePosInCTU-1);
    313314
    314315      //initialize the FirstCUAddr for each tile
    315       m_tileParameters[tileIdx].setFirstCUAddr( (m_tileParameters[tileIdx].getBottomEdgePosInCU() - m_tileParameters[tileIdx].getTileHeight() + 1) * getFrameWidthInCU() +
    316                                                  m_tileParameters[tileIdx].getRightEdgePosInCU() - m_tileParameters[tileIdx].getTileWidth() + 1);
     316      m_tileParameters[tileIdx].setFirstCtuRsAddr( (m_tileParameters[tileIdx].getBottomEdgePosInCtus() - m_tileParameters[tileIdx].getTileHeightInCtus() + 1) * getFrameWidthInCtus() +
     317                                                    m_tileParameters[tileIdx].getRightEdgePosInCtus()  - m_tileParameters[tileIdx].getTileWidthInCtus() + 1);
    317318    }
    318319  }
     
    322323
    323324  //initialize the TileIdxMap
    324   for( Int i=0; i<m_uiNumCUsInFrame; i++)
     325  for( Int i=0; i<m_numCtusInFrame; i++)
    325326  {
    326327    for( Int col=0; col < numCols; col++)
    327328    {
    328       if(i % getFrameWidthInCU() <= m_tileParameters[col].getRightEdgePosInCU())
     329      if(i % getFrameWidthInCtus() <= m_tileParameters[col].getRightEdgePosInCtus())
    329330      {
    330331        columnIdx = col;
     
    334335    for(Int row=0; row < numRows; row++)
    335336    {
    336       if(i / getFrameWidthInCU() <= m_tileParameters[row*numCols].getBottomEdgePosInCU())
     337      if(i / getFrameWidthInCtus() <= m_tileParameters[row*numCols].getBottomEdgePosInCtus())
    337338      {
    338339        rowIdx = row;
     
    343344  }
    344345}
    345 
    346 UInt TComPicSym::xCalculateNxtCUAddr( UInt uiCurrCUAddr )
    347 {
    348   UInt  uiNxtCUAddr;
    349   UInt  uiTileIdx;
    350  
    351   //get the tile index for the current LCU
    352   uiTileIdx = this->getTileIdxMap(uiCurrCUAddr);
    353 
    354   //get the raster scan address for the next LCU
    355   if( uiCurrCUAddr % m_uiWidthInCU == this->getTComTile(uiTileIdx)->getRightEdgePosInCU() && uiCurrCUAddr / m_uiWidthInCU == this->getTComTile(uiTileIdx)->getBottomEdgePosInCU() )
    356   //the current LCU is the last LCU of the tile
    357   {
    358     if(uiTileIdx == (m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1)-1)
    359     {
    360       uiNxtCUAddr = m_uiNumCUsInFrame;
     346UInt TComPicSym::xCalculateNextCtuRSAddr( UInt currCtuRsAddr )
     347{
     348  UInt  nextCtuRsAddr;
     349
     350  //get the tile index for the current CTU
     351  const UInt uiTileIdx = getTileIdxMap(currCtuRsAddr);
     352
     353  //get the raster scan address for the next CTU
     354  if( currCtuRsAddr % m_frameWidthInCtus == getTComTile(uiTileIdx)->getRightEdgePosInCtus() && currCtuRsAddr / m_frameWidthInCtus == getTComTile(uiTileIdx)->getBottomEdgePosInCtus() )
     355  //the current CTU is the last CTU of the tile
     356  {
     357    if(uiTileIdx+1 == getNumTiles())
     358    {
     359      nextCtuRsAddr = m_numCtusInFrame;
    361360    }
    362361    else
    363362    {
    364       uiNxtCUAddr = this->getTComTile(uiTileIdx+1)->getFirstCUAddr();
    365     }
    366   } 
    367   else //the current LCU is not the last LCU of the tile
    368   {
    369     if( uiCurrCUAddr % m_uiWidthInCU == this->getTComTile(uiTileIdx)->getRightEdgePosInCU() )  //the current LCU is on the rightmost edge of the tile
    370     {
    371       uiNxtCUAddr = uiCurrCUAddr + m_uiWidthInCU - this->getTComTile(uiTileIdx)->getTileWidth() + 1;
     363      nextCtuRsAddr = getTComTile(uiTileIdx+1)->getFirstCtuRsAddr();
     364    }
     365  }
     366  else //the current CTU is not the last CTU of the tile
     367  {
     368    if( currCtuRsAddr % m_frameWidthInCtus == getTComTile(uiTileIdx)->getRightEdgePosInCtus() )  //the current CTU is on the rightmost edge of the tile
     369    {
     370      nextCtuRsAddr = currCtuRsAddr + m_frameWidthInCtus - getTComTile(uiTileIdx)->getTileWidthInCtus() + 1;
    372371    }
    373372    else
    374373    {
    375       uiNxtCUAddr = uiCurrCUAddr + 1;
    376     }
    377   }
    378 
    379   return uiNxtCUAddr;
    380 }
    381 
    382 Void TComPicSym::deriveLoopFilterBoundaryAvailibility(Int ctu,
     374      nextCtuRsAddr = currCtuRsAddr + 1;
     375    }
     376  }
     377
     378  return nextCtuRsAddr;
     379}
     380
     381Void TComPicSym::deriveLoopFilterBoundaryAvailibility(Int ctuRsAddr,
    383382                                                      Bool& isLeftAvail,
    384383                                                      Bool& isRightAvail,
     
    392391{
    393392
    394   isLeftAvail      = (ctu % m_uiWidthInCU != 0);
    395   isRightAvail     = (ctu % m_uiWidthInCU != m_uiWidthInCU-1);
    396   isAboveAvail     = (ctu >= m_uiWidthInCU );
    397   isBelowAvail     = (ctu <  m_uiNumCUsInFrame - m_uiWidthInCU);
     393  isLeftAvail      = (ctuRsAddr % m_frameWidthInCtus != 0);
     394  isRightAvail     = (ctuRsAddr % m_frameWidthInCtus != m_frameWidthInCtus-1);
     395  isAboveAvail     = (ctuRsAddr >= m_frameWidthInCtus );
     396  isBelowAvail     = (ctuRsAddr <  m_numCtusInFrame - m_frameWidthInCtus);
    398397  isAboveLeftAvail = (isAboveAvail && isLeftAvail);
    399398  isAboveRightAvail= (isAboveAvail && isRightAvail);
     
    401400  isBelowRightAvail= (isBelowAvail && isRightAvail);
    402401
    403   Bool isLoopFiltAcrossTilePPS = getCU(ctu)->getSlice()->getPPS()->getLoopFilterAcrossTilesEnabledFlag();
    404 
    405   {
    406     TComDataCU* ctuCurr  = getCU(ctu);
    407     TComDataCU* ctuLeft  = isLeftAvail ?getCU(ctu-1):NULL;
    408     TComDataCU* ctuRight = isRightAvail?getCU(ctu+1):NULL;
    409     TComDataCU* ctuAbove = isAboveAvail?getCU(ctu-m_uiWidthInCU):NULL;
    410     TComDataCU* ctuBelow = isBelowAvail?getCU(ctu+m_uiWidthInCU):NULL;
    411     TComDataCU* ctuAboveLeft  = isAboveLeftAvail ? getCU(ctu-m_uiWidthInCU-1):NULL;
    412     TComDataCU* ctuAboveRigtht= isAboveRightAvail? getCU(ctu-m_uiWidthInCU+1):NULL;
    413     TComDataCU* ctuBelowLeft  = isBelowLeftAvail ? getCU(ctu+m_uiWidthInCU-1):NULL;
    414     TComDataCU* ctuBelowRight = isBelowRightAvail? getCU(ctu+m_uiWidthInCU+1):NULL;
     402  Bool isLoopFiltAcrossTilePPS = getCtu(ctuRsAddr)->getSlice()->getPPS()->getLoopFilterAcrossTilesEnabledFlag();
     403
     404  {
     405    TComDataCU* ctuCurr  = getCtu(ctuRsAddr);
     406    TComDataCU* ctuLeft  = isLeftAvail ?getCtu(ctuRsAddr-1):NULL;
     407    TComDataCU* ctuRight = isRightAvail?getCtu(ctuRsAddr+1):NULL;
     408    TComDataCU* ctuAbove = isAboveAvail?getCtu(ctuRsAddr-m_frameWidthInCtus):NULL;
     409    TComDataCU* ctuBelow = isBelowAvail?getCtu(ctuRsAddr+m_frameWidthInCtus):NULL;
     410    TComDataCU* ctuAboveLeft  = isAboveLeftAvail ? getCtu(ctuRsAddr-m_frameWidthInCtus-1):NULL;
     411    TComDataCU* ctuAboveRight = isAboveRightAvail? getCtu(ctuRsAddr-m_frameWidthInCtus+1):NULL;
     412    TComDataCU* ctuBelowLeft  = isBelowLeftAvail ? getCtu(ctuRsAddr+m_frameWidthInCtus-1):NULL;
     413    TComDataCU* ctuBelowRight = isBelowRightAvail? getCtu(ctuRsAddr+m_frameWidthInCtus+1):NULL;
    415414
    416415    {
     
    418417      if(ctuLeft != NULL)
    419418      {
    420         isLeftAvail = (ctuCurr->getSlice()->getSliceCurStartCUAddr() != ctuLeft->getSlice()->getSliceCurStartCUAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true;
     419        isLeftAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuLeft->getSlice()->getSliceCurStartCtuTsAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true;
    421420      }
    422421      //above
    423422      if(ctuAbove != NULL)
    424423      {
    425         isAboveAvail = (ctuCurr->getSlice()->getSliceCurStartCUAddr() != ctuAbove->getSlice()->getSliceCurStartCUAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true;
     424        isAboveAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuAbove->getSlice()->getSliceCurStartCtuTsAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true;
    426425      }
    427426      //right
    428427      if(ctuRight != NULL)
    429428      {
    430         isRightAvail = (ctuCurr->getSlice()->getSliceCurStartCUAddr() != ctuRight->getSlice()->getSliceCurStartCUAddr())?ctuRight->getSlice()->getLFCrossSliceBoundaryFlag():true;
     429        isRightAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuRight->getSlice()->getSliceCurStartCtuTsAddr())?ctuRight->getSlice()->getLFCrossSliceBoundaryFlag():true;
    431430      }
    432431      //below
    433432      if(ctuBelow != NULL)
    434433      {
    435         isBelowAvail = (ctuCurr->getSlice()->getSliceCurStartCUAddr() != ctuBelow->getSlice()->getSliceCurStartCUAddr())?ctuBelow->getSlice()->getLFCrossSliceBoundaryFlag():true;
     434        isBelowAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuBelow->getSlice()->getSliceCurStartCtuTsAddr())?ctuBelow->getSlice()->getLFCrossSliceBoundaryFlag():true;
    436435      }
    437436      //above-left
    438437      if(ctuAboveLeft != NULL)
    439438      {
    440         isAboveLeftAvail = (ctuCurr->getSlice()->getSliceCurStartCUAddr() != ctuAboveLeft->getSlice()->getSliceCurStartCUAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true;
     439        isAboveLeftAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuAboveLeft->getSlice()->getSliceCurStartCtuTsAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true;
    441440      }
    442441      //below-right
    443442      if(ctuBelowRight != NULL)
    444443      {
    445         isBelowRightAvail = (ctuCurr->getSlice()->getSliceCurStartCUAddr() != ctuBelowRight->getSlice()->getSliceCurStartCUAddr())?ctuBelowRight->getSlice()->getLFCrossSliceBoundaryFlag():true;
    446       }
    447 
     444        isBelowRightAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuBelowRight->getSlice()->getSliceCurStartCtuTsAddr())?ctuBelowRight->getSlice()->getLFCrossSliceBoundaryFlag():true;
     445      }
    448446
    449447      //above-right
    450       if(ctuAboveRigtht != NULL)
    451       {
    452         Int curSliceStartEncOrder  = ctuCurr->getSlice()->getSliceCurStartCUAddr();
    453         Int aboveRigthtSliceStartEncOrder = ctuAboveRigtht->getSlice()->getSliceCurStartCUAddr();
    454 
    455         isAboveRightAvail = (curSliceStartEncOrder == aboveRigthtSliceStartEncOrder)?(true):
     448      if(ctuAboveRight != NULL)
     449      {
     450        Int curSliceStartTsAddr  = ctuCurr->getSlice()->getSliceCurStartCtuTsAddr();
     451        Int aboveRightSliceStartTsAddr = ctuAboveRight->getSlice()->getSliceCurStartCtuTsAddr();
     452
     453        isAboveRightAvail = (curSliceStartTsAddr == aboveRightSliceStartTsAddr)?(true):
    456454          (
    457           (curSliceStartEncOrder > aboveRigthtSliceStartEncOrder)?(ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag())
    458           :(ctuAboveRigtht->getSlice()->getLFCrossSliceBoundaryFlag())
    459           );         
     455          (curSliceStartTsAddr > aboveRightSliceStartTsAddr)?(ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag())
     456          :(ctuAboveRight->getSlice()->getLFCrossSliceBoundaryFlag())
     457          );
    460458      }
    461459      //below-left
    462460      if(ctuBelowLeft != NULL)
    463461      {
    464         Int curSliceStartEncOrder  = ctuCurr->getSlice()->getSliceCurStartCUAddr();
    465         Int belowLeftSliceStartEncOrder = ctuBelowLeft->getSlice()->getSliceCurStartCUAddr();
    466 
    467         isBelowLeftAvail = (curSliceStartEncOrder == belowLeftSliceStartEncOrder)?(true):
     462        Int curSliceStartTsAddr       = ctuCurr->getSlice()->getSliceCurStartCtuTsAddr();
     463        Int belowLeftSliceStartTsAddr = ctuBelowLeft->getSlice()->getSliceCurStartCtuTsAddr();
     464
     465        isBelowLeftAvail = (curSliceStartTsAddr == belowLeftSliceStartTsAddr)?(true):
    468466          (
    469           (curSliceStartEncOrder > belowLeftSliceStartEncOrder)?(ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag())
     467          (curSliceStartTsAddr > belowLeftSliceStartTsAddr)?(ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag())
    470468          :(ctuBelowLeft->getSlice()->getLFCrossSliceBoundaryFlag())
    471469          );
    472       }       
     470      }
    473471    }
    474472
    475473    if(!isLoopFiltAcrossTilePPS)
    476     {     
    477       isLeftAvail      = (!isLeftAvail      ) ?false:(getTileIdxMap( ctuLeft->getAddr()         ) == getTileIdxMap( ctu ));
    478       isAboveAvail     = (!isAboveAvail     ) ?false:(getTileIdxMap( ctuAbove->getAddr()        ) == getTileIdxMap( ctu ));
    479       isRightAvail     = (!isRightAvail     ) ?false:(getTileIdxMap( ctuRight->getAddr()        ) == getTileIdxMap( ctu ));
    480       isBelowAvail     = (!isBelowAvail     ) ?false:(getTileIdxMap( ctuBelow->getAddr()        ) == getTileIdxMap( ctu ));
    481       isAboveLeftAvail = (!isAboveLeftAvail ) ?false:(getTileIdxMap( ctuAboveLeft->getAddr()    ) == getTileIdxMap( ctu ));
    482       isAboveRightAvail= (!isAboveRightAvail) ?false:(getTileIdxMap( ctuAboveRigtht->getAddr()  ) == getTileIdxMap( ctu ));
    483       isBelowLeftAvail = (!isBelowLeftAvail ) ?false:(getTileIdxMap( ctuBelowLeft->getAddr()    ) == getTileIdxMap( ctu ));
    484       isBelowRightAvail= (!isBelowRightAvail) ?false:(getTileIdxMap( ctuBelowRight->getAddr()   ) == getTileIdxMap( ctu ));
    485     }
    486   }
    487 
    488 }
     474    {
     475      isLeftAvail      = (!isLeftAvail      ) ?false:(getTileIdxMap( ctuLeft->getCtuRsAddr()         ) == getTileIdxMap( ctuRsAddr ));
     476      isAboveAvail     = (!isAboveAvail     ) ?false:(getTileIdxMap( ctuAbove->getCtuRsAddr()        ) == getTileIdxMap( ctuRsAddr ));
     477      isRightAvail     = (!isRightAvail     ) ?false:(getTileIdxMap( ctuRight->getCtuRsAddr()        ) == getTileIdxMap( ctuRsAddr ));
     478      isBelowAvail     = (!isBelowAvail     ) ?false:(getTileIdxMap( ctuBelow->getCtuRsAddr()        ) == getTileIdxMap( ctuRsAddr ));
     479      isAboveLeftAvail = (!isAboveLeftAvail ) ?false:(getTileIdxMap( ctuAboveLeft->getCtuRsAddr()    ) == getTileIdxMap( ctuRsAddr ));
     480      isAboveRightAvail= (!isAboveRightAvail) ?false:(getTileIdxMap( ctuAboveRight->getCtuRsAddr()   ) == getTileIdxMap( ctuRsAddr ));
     481      isBelowLeftAvail = (!isBelowLeftAvail ) ?false:(getTileIdxMap( ctuBelowLeft->getCtuRsAddr()    ) == getTileIdxMap( ctuRsAddr ));
     482      isBelowRightAvail= (!isBelowRightAvail) ?false:(getTileIdxMap( ctuBelowRight->getCtuRsAddr()   ) == getTileIdxMap( ctuRsAddr ));
     483    }
     484  }
     485
     486}
     487
    489488
    490489TComTile::TComTile()
    491 : m_uiTileWidth         (0)
    492 , m_uiTileHeight        (0)
    493 , m_uiRightEdgePosInCU  (0)
    494 , m_uiBottomEdgePosInCU (0)
    495 , m_uiFirstCUAddr       (0)
    496 
     490: m_tileWidthInCtus     (0)
     491, m_tileHeightInCtus    (0)
     492, m_rightEdgePosInCtus  (0)
     493, m_bottomEdgePosInCtus (0)
     494, m_firstCtuRsAddr      (0)
    497495{
    498496}
Note: See TracChangeset for help on using the changeset viewer.