Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComPicSym.cpp
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComPicSym.cpp
r1179 r1313 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 48 48 49 49 TComPicSym::TComPicSym() 50 :m_uiWidthInCU(0) 51 ,m_uiHeightInCU(0) 52 ,m_uiMaxCUWidth(0) 53 ,m_uiMaxCUHeight(0) 50 :m_frameWidthInCtus(0) 51 ,m_frameHeightInCtus(0) 54 52 ,m_uiMinCUWidth(0) 55 53 ,m_uiMinCUHeight(0) 56 54 ,m_uhTotalDepth(0) 57 ,m_uiNumPartitions(0) 58 ,m_uiNumPartInWidth(0) 59 ,m_uiNumPartInHeight(0) 60 ,m_uiNumCUsInFrame(0) 61 ,m_apcTComSlice(NULL) 62 ,m_uiNumAllocatedSlice (0) 63 ,m_apcTComDataCU (NULL) 64 ,m_iNumColumnsMinus1 (0) 65 ,m_iNumRowsMinus1(0) 66 ,m_puiCUOrderMap(0) 55 ,m_numPartitionsInCtu(0) 56 ,m_numPartInCtuWidth(0) 57 ,m_numPartInCtuHeight(0) 58 ,m_numCtusInFrame(0) 59 ,m_apSlices() 60 ,m_pictureCtuArray(NULL) 61 ,m_numTileColumnsMinus1(0) 62 ,m_numTileRowsMinus1(0) 63 ,m_ctuTsToRsAddrMap(NULL) 67 64 ,m_puiTileIdxMap(NULL) 68 ,m_ puiInverseCUOrderMap(NULL)65 ,m_ctuRsToTsAddrMap(NULL) 69 66 ,m_saoBlkParams(NULL) 70 {}; 71 72 73 Void TComPicSym::create ( Int iPicWidth, Int iPicHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth ) 67 #if ADAPTIVE_QP_SELECTION 68 ,m_pParentARLBuffer(NULL) 69 #endif 70 {} 71 72 73 Void TComPicSym::create ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth ) 74 74 { 75 75 UInt i; 76 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 95 if (m_uiNumAllocatedSlice>0) 96 { 97 for ( i=0; i<m_uiNumAllocatedSlice ; i++ ) 98 { 99 delete m_apcTComSlice[i]; 100 } 101 delete [] m_apcTComSlice; 102 } 103 m_apcTComSlice = new TComSlice*[m_uiNumCUsInFrame]; 104 m_apcTComSlice[0] = new TComSlice; 105 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 76 m_sps = sps; 77 m_pps = pps; 78 79 const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc(); 80 const Int iPicWidth = sps.getPicWidthInLumaSamples(); 81 const Int iPicHeight = sps.getPicHeightInLumaSamples(); 82 const UInt uiMaxCuWidth = sps.getMaxCUWidth(); 83 const UInt uiMaxCuHeight = sps.getMaxCUHeight(); 84 85 m_uhTotalDepth = uiMaxDepth; 86 m_numPartitionsInCtu = 1<<(m_uhTotalDepth<<1); 87 88 m_uiMinCUWidth = uiMaxCuWidth >> m_uhTotalDepth; 89 m_uiMinCUHeight = uiMaxCuHeight >> m_uhTotalDepth; 90 91 m_numPartInCtuWidth = uiMaxCuWidth / m_uiMinCUWidth; // equivalent to 1<<m_uhTotalDepth 92 m_numPartInCtuHeight = uiMaxCuHeight / m_uiMinCUHeight; // equivalent to 1<<m_uhTotalDepth 93 94 m_frameWidthInCtus = ( iPicWidth %uiMaxCuWidth ) ? iPicWidth /uiMaxCuWidth + 1 : iPicWidth /uiMaxCuWidth; 95 m_frameHeightInCtus = ( iPicHeight%uiMaxCuHeight ) ? iPicHeight/uiMaxCuHeight + 1 : iPicHeight/uiMaxCuHeight; 96 97 m_numCtusInFrame = m_frameWidthInCtus * m_frameHeightInCtus; 98 m_pictureCtuArray = new TComDataCU*[m_numCtusInFrame]; 99 100 clearSliceBuffer(); 101 allocateNewSlice(); 102 110 103 #if ADAPTIVE_QP_SELECTION 111 , true 112 #endif 104 if (m_pParentARLBuffer == NULL) 105 { 106 m_pParentARLBuffer = new TCoeff[uiMaxCuWidth*uiMaxCuHeight*MAX_NUM_COMPONENT]; 107 } 108 #endif 109 110 for ( i=0; i<m_numCtusInFrame ; i++ ) 111 { 112 m_pictureCtuArray[i] = new TComDataCU; 113 m_pictureCtuArray[i]->create( chromaFormatIDC, m_numPartitionsInCtu, uiMaxCuWidth, uiMaxCuHeight, false, uiMaxCuWidth >> m_uhTotalDepth 114 #if ADAPTIVE_QP_SELECTION 115 , m_pParentARLBuffer 116 #endif 113 117 ); 114 118 } 115 119 116 m_puiCUOrderMap = new UInt[m_uiNumCUsInFrame+1]; 117 m_puiTileIdxMap = new UInt[m_uiNumCUsInFrame]; 118 m_puiInverseCUOrderMap = new UInt[m_uiNumCUsInFrame+1]; 119 120 for( i=0; i<m_uiNumCUsInFrame; i++ ) 121 { 122 m_puiCUOrderMap[i] = i; 123 m_puiInverseCUOrderMap[i] = i; 124 } 125 126 m_saoBlkParams = new SAOBlkParam[m_uiNumCUsInFrame]; 120 m_ctuTsToRsAddrMap = new UInt[m_numCtusInFrame+1]; 121 m_puiTileIdxMap = new UInt[m_numCtusInFrame]; 122 m_ctuRsToTsAddrMap = new UInt[m_numCtusInFrame+1]; 123 124 for( i=0; i<m_numCtusInFrame; i++ ) 125 { 126 m_ctuTsToRsAddrMap[i] = i; 127 m_ctuRsToTsAddrMap[i] = i; 128 } 129 130 m_saoBlkParams = new SAOBlkParam[m_numCtusInFrame]; 131 132 133 xInitTiles(); 134 xInitCtuTsRsAddrMaps(); 135 127 136 } 128 137 129 138 Void TComPicSym::destroy() 130 139 { 131 if (m_uiNumAllocatedSlice>0) 132 { 133 for (Int i = 0; i<m_uiNumAllocatedSlice ; i++ ) 134 { 135 delete m_apcTComSlice[i]; 136 } 137 delete [] m_apcTComSlice; 138 } 139 m_apcTComSlice = NULL; 140 141 for (Int i = 0; i < m_uiNumCUsInFrame; i++) 142 { 143 m_apcTComDataCU[i]->destroy(); 144 delete m_apcTComDataCU[i]; 145 m_apcTComDataCU[i] = NULL; 146 } 147 delete [] m_apcTComDataCU; 148 m_apcTComDataCU = NULL; 149 150 delete [] m_puiCUOrderMap; 151 m_puiCUOrderMap = NULL; 140 clearSliceBuffer(); 141 142 for (Int i = 0; i < m_numCtusInFrame; i++) 143 { 144 m_pictureCtuArray[i]->destroy(); 145 delete m_pictureCtuArray[i]; 146 m_pictureCtuArray[i] = NULL; 147 } 148 delete [] m_pictureCtuArray; 149 m_pictureCtuArray = NULL; 150 151 delete [] m_ctuTsToRsAddrMap; 152 m_ctuTsToRsAddrMap = NULL; 152 153 153 154 delete [] m_puiTileIdxMap; 154 155 m_puiTileIdxMap = NULL; 155 156 156 delete [] m_ puiInverseCUOrderMap;157 m_ puiInverseCUOrderMap = NULL;158 157 delete [] m_ctuRsToTsAddrMap; 158 m_ctuRsToTsAddrMap = NULL; 159 159 160 if(m_saoBlkParams) 160 161 { 161 162 delete[] m_saoBlkParams; m_saoBlkParams = NULL; 162 163 } 164 165 #if ADAPTIVE_QP_SELECTION 166 delete [] m_pParentARLBuffer; 167 m_pParentARLBuffer = NULL; 168 #endif 163 169 } 164 170 165 171 Void TComPicSym::allocateNewSlice() 166 172 { 167 assert ((m_uiNumAllocatedSlice + 1) <= m_uiNumCUsInFrame); 168 m_apcTComSlice[m_uiNumAllocatedSlice ++] = new TComSlice; 169 if (m_uiNumAllocatedSlice>=2) 170 { 171 m_apcTComSlice[m_uiNumAllocatedSlice-1]->copySliceInfo( m_apcTComSlice[m_uiNumAllocatedSlice-2] ); 172 m_apcTComSlice[m_uiNumAllocatedSlice-1]->initSlice(); 173 m_apSlices.push_back(new TComSlice); 174 m_apSlices.back()->setPPS(&m_pps); 175 m_apSlices.back()->setSPS(&m_sps); 176 if (m_apSlices.size()>=2) 177 { 178 m_apSlices.back()->copySliceInfo( m_apSlices[m_apSlices.size()-2] ); 179 m_apSlices.back()->initSlice(); 173 180 } 174 181 } … … 176 183 Void TComPicSym::clearSliceBuffer() 177 184 { 178 UInt i; 179 for (i = 1; i < m_uiNumAllocatedSlice; i++) 180 { 181 delete m_apcTComSlice[i]; 182 } 183 m_uiNumAllocatedSlice = 1; 184 } 185 186 UInt TComPicSym::getPicSCUEncOrder( UInt SCUAddr ) 187 { 188 return getInverseCUOrderMap(SCUAddr/m_uiNumPartitions)*m_uiNumPartitions + SCUAddr%m_uiNumPartitions; 189 } 190 191 UInt TComPicSym::getPicSCUAddr( UInt SCUEncOrder ) 192 { 193 return getCUOrderMap(SCUEncOrder/m_uiNumPartitions)*m_uiNumPartitions + SCUEncOrder%m_uiNumPartitions; 194 } 195 196 Void TComPicSym::initTiles(TComPPS *pps) 185 for (UInt i = 0; i < UInt(m_apSlices.size()); i++) 186 { 187 delete m_apSlices[i]; 188 } 189 m_apSlices.clear(); 190 } 191 192 Void TComPicSym::xInitCtuTsRsAddrMaps() 193 { 194 //generate the Coding Order Map and Inverse Coding Order Map 195 for(Int ctuTsAddr=0, ctuRsAddr=0; ctuTsAddr<getNumberOfCtusInFrame(); ctuTsAddr++, ctuRsAddr = xCalculateNextCtuRSAddr(ctuRsAddr)) 196 { 197 setCtuTsToRsAddrMap(ctuTsAddr, ctuRsAddr); 198 setCtuRsToTsAddrMap(ctuRsAddr, ctuTsAddr); 199 } 200 setCtuTsToRsAddrMap(getNumberOfCtusInFrame(), getNumberOfCtusInFrame()); 201 setCtuRsToTsAddrMap(getNumberOfCtusInFrame(), getNumberOfCtusInFrame()); 202 } 203 204 Void TComPicSym::xInitTiles() 197 205 { 198 206 //set NumColumnsMinus1 and NumRowsMinus1 199 setNum ColumnsMinus1( pps->getNumTileColumnsMinus1() );200 setNum RowsMinus1( pps->getTileNumRowsMinus1());201 202 const Int numCols = pps->getNumTileColumnsMinus1() + 1;203 const Int numRows = pps->getTileNumRowsMinus1() + 1;207 setNumTileColumnsMinus1( m_pps.getNumTileColumnsMinus1() ); 208 setNumTileRowsMinus1( m_pps.getNumTileRowsMinus1() ); 209 210 const Int numCols = m_pps.getNumTileColumnsMinus1() + 1; 211 const Int numRows = m_pps.getNumTileRowsMinus1() + 1; 204 212 const Int numTiles = numRows * numCols; 205 213 … … 207 215 m_tileParameters.resize(numTiles); 208 216 209 if( pps->getTileUniformSpacingFlag() )217 if( m_pps.getTileUniformSpacingFlag() ) 210 218 { 211 219 //set width and height for each (uniform) tile … … 215 223 { 216 224 const Int tileIdx = row * numCols + col; 217 m_tileParameters[tileIdx].setTileWidth( (col+1)*getFrameWidthInCU()/numCols 218 - (col*getFrameWidthInCU())/numCols ); 219 m_tileParameters[tileIdx].setTileHeight( (row+1)*getFrameHeightInCU()/numRows 220 - (row*getFrameHeightInCU())/numRows ); 225 m_tileParameters[tileIdx].setTileWidthInCtus( (col+1)*getFrameWidthInCtus( )/numCols - (col*getFrameWidthInCtus( ))/numCols ); 226 m_tileParameters[tileIdx].setTileHeightInCtus( (row+1)*getFrameHeightInCtus()/numRows - (row*getFrameHeightInCtus())/numRows ); 221 227 } 222 228 } … … 228 234 { 229 235 Int cumulativeTileWidth = 0; 230 for(Int col=0; col < getNum ColumnsMinus1(); col++)231 {232 m_tileParameters[row * numCols + col].setTileWidth ( pps->getTileColumnWidth(col) );233 cumulativeTileWidth += pps->getTileColumnWidth(col);234 }235 m_tileParameters[row * numCols + getNum ColumnsMinus1()].setTileWidth( getFrameWidthInCU()-cumulativeTileWidth );236 }236 for(Int col=0; col < getNumTileColumnsMinus1(); col++) 237 { 238 m_tileParameters[row * numCols + col].setTileWidthInCtus( m_pps.getTileColumnWidth(col) ); 239 cumulativeTileWidth += m_pps.getTileColumnWidth(col); 240 } 241 m_tileParameters[row * numCols + getNumTileColumnsMinus1()].setTileWidthInCtus( getFrameWidthInCtus()-cumulativeTileWidth ); 242 } 237 243 238 244 //set the height for each tile 239 245 for(Int col=0; col < numCols; col++) 240 {246 { 241 247 Int cumulativeTileHeight = 0; 242 for(Int row=0; row < getNum RowsMinus1(); row++)243 { 244 m_tileParameters[row * numCols + col].setTileHeight ( pps->getTileRowHeight(row) );245 cumulativeTileHeight += pps->getTileRowHeight(row);246 } 247 m_tileParameters[getNum RowsMinus1() * numCols + col].setTileHeight( getFrameHeightInCU()-cumulativeTileHeight );248 } 249 } 250 251 #if TILE_SIZE_CHECK 248 for(Int row=0; row < getNumTileRowsMinus1(); row++) 249 { 250 m_tileParameters[row * numCols + col].setTileHeightInCtus( m_pps.getTileRowHeight(row) ); 251 cumulativeTileHeight += m_pps.getTileRowHeight(row); 252 } 253 m_tileParameters[getNumTileRowsMinus1() * numCols + col].setTileHeightInCtus( getFrameHeightInCtus()-cumulativeTileHeight ); 254 } 255 } 256 257 // Tile size check 252 258 Int minWidth = 1; 253 259 Int minHeight = 1; 254 const Int profileIdc = pps->getSPS()->getPTL()->getGeneralPTL()->getProfileIdc();255 if ( profileIdc == Profile::MAIN || profileIdc == Profile::MAIN10) 256 { 257 if ( pps->getTilesEnabledFlag())258 { 259 minHeight = 64 / g_uiMaxCUHeight;260 minWidth = 256 / g_uiMaxCUWidth;260 const Int profileIdc = m_sps.getPTL()->getGeneralPTL()->getProfileIdc(); 261 if ( profileIdc == Profile::MAIN || profileIdc == Profile::MAIN10) //TODO: add more profiles to the tile-size check... 262 { 263 if (m_pps.getTilesEnabledFlag()) 264 { 265 minHeight = 64 / m_sps.getMaxCUHeight(); 266 minWidth = 256 / m_sps.getMaxCUWidth(); 261 267 } 262 268 } … … 266 272 { 267 273 const Int tileIdx = row * numCols + col; 268 assert (m_tileParameters[tileIdx].getTileWidth() >= minWidth); 269 assert (m_tileParameters[tileIdx].getTileHeight() >= minHeight); 270 } 271 } 272 #endif 274 assert (m_tileParameters[tileIdx].getTileWidthInCtus() >= minWidth); 275 assert (m_tileParameters[tileIdx].getTileHeightInCtus() >= minHeight); 276 } 277 } 273 278 274 279 //initialize each tile of the current picture … … 283 288 for( Int i=0; i <= col; i++ ) 284 289 { 285 rightEdgePosInCTU += m_tileParameters[row * numCols + i].getTileWidth ();286 } 287 m_tileParameters[tileIdx].setRightEdgePosInC U(rightEdgePosInCTU-1);290 rightEdgePosInCTU += m_tileParameters[row * numCols + i].getTileWidthInCtus(); 291 } 292 m_tileParameters[tileIdx].setRightEdgePosInCtus(rightEdgePosInCTU-1); 288 293 289 294 //initialize the BottomEdgePosInCU for each tile … … 291 296 for( Int i=0; i <= row; i++ ) 292 297 { 293 bottomEdgePosInCTU += m_tileParameters[i * numCols + col].getTileHeight ();294 } 295 m_tileParameters[tileIdx].setBottomEdgePosInC U(bottomEdgePosInCTU-1);298 bottomEdgePosInCTU += m_tileParameters[i * numCols + col].getTileHeightInCtus(); 299 } 300 m_tileParameters[tileIdx].setBottomEdgePosInCtus(bottomEdgePosInCTU-1); 296 301 297 302 //initialize the FirstCUAddr for each tile 298 m_tileParameters[tileIdx].setFirstC UAddr( (m_tileParameters[tileIdx].getBottomEdgePosInCU() - m_tileParameters[tileIdx].getTileHeight() + 1) * getFrameWidthInCU() +299 m_tileParameters[tileIdx].getRightEdgePosInCU() - m_tileParameters[tileIdx].getTileWidth()+ 1);303 m_tileParameters[tileIdx].setFirstCtuRsAddr( (m_tileParameters[tileIdx].getBottomEdgePosInCtus() - m_tileParameters[tileIdx].getTileHeightInCtus() + 1) * getFrameWidthInCtus() + 304 m_tileParameters[tileIdx].getRightEdgePosInCtus() - m_tileParameters[tileIdx].getTileWidthInCtus() + 1); 300 305 } 301 306 } … … 305 310 306 311 //initialize the TileIdxMap 307 for( Int i=0; i<m_ uiNumCUsInFrame; i++)312 for( Int i=0; i<m_numCtusInFrame; i++) 308 313 { 309 314 for( Int col=0; col < numCols; col++) 310 315 { 311 if(i % getFrameWidthInC U() <= m_tileParameters[col].getRightEdgePosInCU())316 if(i % getFrameWidthInCtus() <= m_tileParameters[col].getRightEdgePosInCtus()) 312 317 { 313 318 columnIdx = col; … … 317 322 for(Int row=0; row < numRows; row++) 318 323 { 319 if(i / getFrameWidthInC U() <= m_tileParameters[row*numCols].getBottomEdgePosInCU())324 if(i / getFrameWidthInCtus() <= m_tileParameters[row*numCols].getBottomEdgePosInCtus()) 320 325 { 321 326 rowIdx = row; … … 325 330 m_puiTileIdxMap[i] = rowIdx * numCols + columnIdx; 326 331 } 327 328 } 329 330 UInt TComPicSym::xCalculateNxtCUAddr( UInt uiCurrCUAddr ) 331 { 332 UInt uiNxtCUAddr; 333 UInt uiTileIdx; 334 335 //get the tile index for the current LCU 336 uiTileIdx = this->getTileIdxMap(uiCurrCUAddr); 337 338 //get the raster scan address for the next LCU 339 if( uiCurrCUAddr % m_uiWidthInCU == this->getTComTile(uiTileIdx)->getRightEdgePosInCU() && uiCurrCUAddr / m_uiWidthInCU == this->getTComTile(uiTileIdx)->getBottomEdgePosInCU() ) 340 //the current LCU is the last LCU of the tile 341 { 342 if(uiTileIdx == (m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1)-1) 343 { 344 uiNxtCUAddr = m_uiNumCUsInFrame; 332 } 333 UInt TComPicSym::xCalculateNextCtuRSAddr( UInt currCtuRsAddr ) 334 { 335 UInt nextCtuRsAddr; 336 337 //get the tile index for the current CTU 338 const UInt uiTileIdx = getTileIdxMap(currCtuRsAddr); 339 340 //get the raster scan address for the next CTU 341 if( currCtuRsAddr % m_frameWidthInCtus == getTComTile(uiTileIdx)->getRightEdgePosInCtus() && currCtuRsAddr / m_frameWidthInCtus == getTComTile(uiTileIdx)->getBottomEdgePosInCtus() ) 342 //the current CTU is the last CTU of the tile 343 { 344 if(uiTileIdx+1 == getNumTiles()) 345 { 346 nextCtuRsAddr = m_numCtusInFrame; 345 347 } 346 348 else 347 349 { 348 uiNxtCUAddr = this->getTComTile(uiTileIdx+1)->getFirstCUAddr();349 } 350 } 351 else //the current LCU is not the last LCU of the tile352 { 353 if( uiCurrCUAddr % m_uiWidthInCU == this->getTComTile(uiTileIdx)->getRightEdgePosInCU() ) //the current LCU is on the rightmost edge of the tile354 { 355 uiNxtCUAddr = uiCurrCUAddr + m_uiWidthInCU - this->getTComTile(uiTileIdx)->getTileWidth() + 1;350 nextCtuRsAddr = getTComTile(uiTileIdx+1)->getFirstCtuRsAddr(); 351 } 352 } 353 else //the current CTU is not the last CTU of the tile 354 { 355 if( currCtuRsAddr % m_frameWidthInCtus == getTComTile(uiTileIdx)->getRightEdgePosInCtus() ) //the current CTU is on the rightmost edge of the tile 356 { 357 nextCtuRsAddr = currCtuRsAddr + m_frameWidthInCtus - getTComTile(uiTileIdx)->getTileWidthInCtus() + 1; 356 358 } 357 359 else 358 360 { 359 uiNxtCUAddr = uiCurrCUAddr + 1;360 } 361 } 362 363 return uiNxtCUAddr;364 } 365 366 Void TComPicSym::deriveLoopFilterBoundaryAvailibility(Int ctu ,361 nextCtuRsAddr = currCtuRsAddr + 1; 362 } 363 } 364 365 return nextCtuRsAddr; 366 } 367 368 Void TComPicSym::deriveLoopFilterBoundaryAvailibility(Int ctuRsAddr, 367 369 Bool& isLeftAvail, 368 370 Bool& isRightAvail, … … 376 378 { 377 379 378 isLeftAvail = (ctu % m_uiWidthInCU!= 0);379 isRightAvail = (ctu % m_uiWidthInCU != m_uiWidthInCU-1);380 isAboveAvail = (ctu >= m_uiWidthInCU);381 isBelowAvail = (ctu < m_uiNumCUsInFrame - m_uiWidthInCU);380 isLeftAvail = (ctuRsAddr % m_frameWidthInCtus != 0); 381 isRightAvail = (ctuRsAddr % m_frameWidthInCtus != m_frameWidthInCtus-1); 382 isAboveAvail = (ctuRsAddr >= m_frameWidthInCtus ); 383 isBelowAvail = (ctuRsAddr < m_numCtusInFrame - m_frameWidthInCtus); 382 384 isAboveLeftAvail = (isAboveAvail && isLeftAvail); 383 385 isAboveRightAvail= (isAboveAvail && isRightAvail); … … 385 387 isBelowRightAvail= (isBelowAvail && isRightAvail); 386 388 387 Bool isLoopFiltAcrossTilePPS = getC U(ctu)->getSlice()->getPPS()->getLoopFilterAcrossTilesEnabledFlag();388 389 { 390 TComDataCU* ctuCurr = getC U(ctu);391 TComDataCU* ctuLeft = isLeftAvail ?getC U(ctu-1):NULL;392 TComDataCU* ctuRight = isRightAvail?getC U(ctu+1):NULL;393 TComDataCU* ctuAbove = isAboveAvail?getC U(ctu-m_uiWidthInCU):NULL;394 TComDataCU* ctuBelow = isBelowAvail?getC U(ctu+m_uiWidthInCU):NULL;395 TComDataCU* ctuAboveLeft = isAboveLeftAvail ? getC U(ctu-m_uiWidthInCU-1):NULL;396 TComDataCU* ctuAboveRig tht= isAboveRightAvail? getCU(ctu-m_uiWidthInCU+1):NULL;397 TComDataCU* ctuBelowLeft = isBelowLeftAvail ? getC U(ctu+m_uiWidthInCU-1):NULL;398 TComDataCU* ctuBelowRight = isBelowRightAvail? getC U(ctu+m_uiWidthInCU+1):NULL;389 Bool isLoopFiltAcrossTilePPS = getCtu(ctuRsAddr)->getSlice()->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); 390 391 { 392 TComDataCU* ctuCurr = getCtu(ctuRsAddr); 393 TComDataCU* ctuLeft = isLeftAvail ?getCtu(ctuRsAddr-1):NULL; 394 TComDataCU* ctuRight = isRightAvail?getCtu(ctuRsAddr+1):NULL; 395 TComDataCU* ctuAbove = isAboveAvail?getCtu(ctuRsAddr-m_frameWidthInCtus):NULL; 396 TComDataCU* ctuBelow = isBelowAvail?getCtu(ctuRsAddr+m_frameWidthInCtus):NULL; 397 TComDataCU* ctuAboveLeft = isAboveLeftAvail ? getCtu(ctuRsAddr-m_frameWidthInCtus-1):NULL; 398 TComDataCU* ctuAboveRight = isAboveRightAvail? getCtu(ctuRsAddr-m_frameWidthInCtus+1):NULL; 399 TComDataCU* ctuBelowLeft = isBelowLeftAvail ? getCtu(ctuRsAddr+m_frameWidthInCtus-1):NULL; 400 TComDataCU* ctuBelowRight = isBelowRightAvail? getCtu(ctuRsAddr+m_frameWidthInCtus+1):NULL; 399 401 400 402 { … … 402 404 if(ctuLeft != NULL) 403 405 { 404 isLeftAvail = (ctuCurr->getSlice()->getSliceCurStartC UAddr() != ctuLeft->getSlice()->getSliceCurStartCUAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true;406 isLeftAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuLeft->getSlice()->getSliceCurStartCtuTsAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true; 405 407 } 406 408 //above 407 409 if(ctuAbove != NULL) 408 410 { 409 isAboveAvail = (ctuCurr->getSlice()->getSliceCurStartC UAddr() != ctuAbove->getSlice()->getSliceCurStartCUAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true;411 isAboveAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuAbove->getSlice()->getSliceCurStartCtuTsAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true; 410 412 } 411 413 //right 412 414 if(ctuRight != NULL) 413 415 { 414 isRightAvail = (ctuCurr->getSlice()->getSliceCurStartC UAddr() != ctuRight->getSlice()->getSliceCurStartCUAddr())?ctuRight->getSlice()->getLFCrossSliceBoundaryFlag():true;416 isRightAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuRight->getSlice()->getSliceCurStartCtuTsAddr())?ctuRight->getSlice()->getLFCrossSliceBoundaryFlag():true; 415 417 } 416 418 //below 417 419 if(ctuBelow != NULL) 418 420 { 419 isBelowAvail = (ctuCurr->getSlice()->getSliceCurStartC UAddr() != ctuBelow->getSlice()->getSliceCurStartCUAddr())?ctuBelow->getSlice()->getLFCrossSliceBoundaryFlag():true;421 isBelowAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuBelow->getSlice()->getSliceCurStartCtuTsAddr())?ctuBelow->getSlice()->getLFCrossSliceBoundaryFlag():true; 420 422 } 421 423 //above-left 422 424 if(ctuAboveLeft != NULL) 423 425 { 424 isAboveLeftAvail = (ctuCurr->getSlice()->getSliceCurStartC UAddr() != ctuAboveLeft->getSlice()->getSliceCurStartCUAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true;426 isAboveLeftAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuAboveLeft->getSlice()->getSliceCurStartCtuTsAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true; 425 427 } 426 428 //below-right 427 429 if(ctuBelowRight != NULL) 428 { 429 isBelowRightAvail = (ctuCurr->getSlice()->getSliceCurStartCUAddr() != ctuBelowRight->getSlice()->getSliceCurStartCUAddr())?ctuBelowRight->getSlice()->getLFCrossSliceBoundaryFlag():true; 430 } 431 430 { 431 isBelowRightAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuBelowRight->getSlice()->getSliceCurStartCtuTsAddr())?ctuBelowRight->getSlice()->getLFCrossSliceBoundaryFlag():true; 432 } 432 433 433 434 //above-right 434 if(ctuAboveRig tht != NULL)435 { 436 Int curSliceStart EncOrder = ctuCurr->getSlice()->getSliceCurStartCUAddr();437 Int aboveRig thtSliceStartEncOrder = ctuAboveRigtht->getSlice()->getSliceCurStartCUAddr();438 439 isAboveRightAvail = (curSliceStart EncOrder == aboveRigthtSliceStartEncOrder)?(true):435 if(ctuAboveRight != NULL) 436 { 437 Int curSliceStartTsAddr = ctuCurr->getSlice()->getSliceCurStartCtuTsAddr(); 438 Int aboveRightSliceStartTsAddr = ctuAboveRight->getSlice()->getSliceCurStartCtuTsAddr(); 439 440 isAboveRightAvail = (curSliceStartTsAddr == aboveRightSliceStartTsAddr)?(true): 440 441 ( 441 (curSliceStart EncOrder > aboveRigthtSliceStartEncOrder)?(ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag())442 :(ctuAboveRig tht->getSlice()->getLFCrossSliceBoundaryFlag())443 ); 442 (curSliceStartTsAddr > aboveRightSliceStartTsAddr)?(ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag()) 443 :(ctuAboveRight->getSlice()->getLFCrossSliceBoundaryFlag()) 444 ); 444 445 } 445 446 //below-left 446 447 if(ctuBelowLeft != NULL) 447 448 { 448 Int curSliceStart EncOrder = ctuCurr->getSlice()->getSliceCurStartCUAddr();449 Int belowLeftSliceStart EncOrder = ctuBelowLeft->getSlice()->getSliceCurStartCUAddr();450 451 isBelowLeftAvail = (curSliceStart EncOrder == belowLeftSliceStartEncOrder)?(true):449 Int curSliceStartTsAddr = ctuCurr->getSlice()->getSliceCurStartCtuTsAddr(); 450 Int belowLeftSliceStartTsAddr = ctuBelowLeft->getSlice()->getSliceCurStartCtuTsAddr(); 451 452 isBelowLeftAvail = (curSliceStartTsAddr == belowLeftSliceStartTsAddr)?(true): 452 453 ( 453 (curSliceStart EncOrder > belowLeftSliceStartEncOrder)?(ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag())454 (curSliceStartTsAddr > belowLeftSliceStartTsAddr)?(ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag()) 454 455 :(ctuBelowLeft->getSlice()->getLFCrossSliceBoundaryFlag()) 455 456 ); 456 } 457 } 457 458 } 458 459 459 460 if(!isLoopFiltAcrossTilePPS) 460 { 461 isLeftAvail = (!isLeftAvail ) ?false:(getTileIdxMap( ctuLeft->getAddr() ) == getTileIdxMap( ctu )); 462 isAboveAvail = (!isAboveAvail ) ?false:(getTileIdxMap( ctuAbove->getAddr() ) == getTileIdxMap( ctu )); 463 isRightAvail = (!isRightAvail ) ?false:(getTileIdxMap( ctuRight->getAddr() ) == getTileIdxMap( ctu )); 464 isBelowAvail = (!isBelowAvail ) ?false:(getTileIdxMap( ctuBelow->getAddr() ) == getTileIdxMap( ctu )); 465 isAboveLeftAvail = (!isAboveLeftAvail ) ?false:(getTileIdxMap( ctuAboveLeft->getAddr() ) == getTileIdxMap( ctu )); 466 isAboveRightAvail= (!isAboveRightAvail) ?false:(getTileIdxMap( ctuAboveRigtht->getAddr() ) == getTileIdxMap( ctu )); 467 isBelowLeftAvail = (!isBelowLeftAvail ) ?false:(getTileIdxMap( ctuBelowLeft->getAddr() ) == getTileIdxMap( ctu )); 468 isBelowRightAvail= (!isBelowRightAvail) ?false:(getTileIdxMap( ctuBelowRight->getAddr() ) == getTileIdxMap( ctu )); 469 } 470 } 471 472 } 461 { 462 isLeftAvail = (!isLeftAvail ) ?false:(getTileIdxMap( ctuLeft->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); 463 isAboveAvail = (!isAboveAvail ) ?false:(getTileIdxMap( ctuAbove->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); 464 isRightAvail = (!isRightAvail ) ?false:(getTileIdxMap( ctuRight->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); 465 isBelowAvail = (!isBelowAvail ) ?false:(getTileIdxMap( ctuBelow->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); 466 isAboveLeftAvail = (!isAboveLeftAvail ) ?false:(getTileIdxMap( ctuAboveLeft->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); 467 isAboveRightAvail= (!isAboveRightAvail) ?false:(getTileIdxMap( ctuAboveRight->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); 468 isBelowLeftAvail = (!isBelowLeftAvail ) ?false:(getTileIdxMap( ctuBelowLeft->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); 469 isBelowRightAvail= (!isBelowRightAvail) ?false:(getTileIdxMap( ctuBelowRight->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); 470 } 471 } 472 473 } 474 473 475 474 476 TComTile::TComTile() 475 : m_uiTileWidth (0) 476 , m_uiTileHeight (0) 477 , m_uiRightEdgePosInCU (0) 478 , m_uiBottomEdgePosInCU (0) 479 , m_uiFirstCUAddr (0) 480 477 : m_tileWidthInCtus (0) 478 , m_tileHeightInCtus (0) 479 , m_rightEdgePosInCtus (0) 480 , m_bottomEdgePosInCtus (0) 481 , m_firstCtuRsAddr (0) 481 482 { 482 483 }
Note: See TracChangeset for help on using the changeset viewer.