[56] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[1200] | 4 | * granted under this license. |
---|
[56] | 5 | * |
---|
[1200] | 6 | * Copyright (c) 2010-2015, ITU/ISO/IEC |
---|
[56] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
| 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
| 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
[2] | 33 | |
---|
| 34 | /** \file TComPicSym.cpp |
---|
| 35 | \brief picture symbol class |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include "TComPicSym.h" |
---|
[608] | 39 | #include "TComSampleAdaptiveOffset.h" |
---|
[1084] | 40 | #include "TComSlice.h" |
---|
[2] | 41 | |
---|
[56] | 42 | //! \ingroup TLibCommon |
---|
| 43 | //! \{ |
---|
| 44 | |
---|
[2] | 45 | // ==================================================================================================================== |
---|
| 46 | // Constructor / destructor / create / destroy |
---|
| 47 | // ==================================================================================================================== |
---|
| 48 | |
---|
[608] | 49 | TComPicSym::TComPicSym() |
---|
[1200] | 50 | :m_frameWidthInCtus(0) |
---|
| 51 | ,m_frameHeightInCtus(0) |
---|
[608] | 52 | ,m_uiMinCUWidth(0) |
---|
| 53 | ,m_uiMinCUHeight(0) |
---|
| 54 | ,m_uhTotalDepth(0) |
---|
[1200] | 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) |
---|
[608] | 64 | ,m_puiTileIdxMap(NULL) |
---|
[1200] | 65 | ,m_ctuRsToTsAddrMap(NULL) |
---|
[872] | 66 | ,m_saoBlkParams(NULL) |
---|
[1200] | 67 | #if ADAPTIVE_QP_SELECTION |
---|
| 68 | ,m_pParentARLBuffer(NULL) |
---|
| 69 | #endif |
---|
| 70 | {} |
---|
[608] | 71 | |
---|
| 72 | |
---|
[1200] | 73 | Void TComPicSym::create ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth ) |
---|
[2] | 74 | { |
---|
| 75 | UInt i; |
---|
[1200] | 76 | m_sps = sps; |
---|
| 77 | m_pps = pps; |
---|
[2] | 78 | |
---|
[1200] | 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 | |
---|
| 103 | #if ADAPTIVE_QP_SELECTION |
---|
| 104 | if (m_pParentARLBuffer == NULL) |
---|
[2] | 105 | { |
---|
[1200] | 106 | m_pParentARLBuffer = new TCoeff[uiMaxCuWidth*uiMaxCuHeight*MAX_NUM_COMPONENT]; |
---|
[2] | 107 | } |
---|
[1200] | 108 | #endif |
---|
| 109 | |
---|
| 110 | for ( i=0; i<m_numCtusInFrame ; i++ ) |
---|
[2] | 111 | { |
---|
[1200] | 112 | m_pictureCtuArray[i] = new TComDataCU; |
---|
| 113 | m_pictureCtuArray[i]->create( chromaFormatIDC, m_numPartitionsInCtu, uiMaxCuWidth, uiMaxCuHeight, false, uiMaxCuWidth >> m_uhTotalDepth |
---|
[56] | 114 | #if ADAPTIVE_QP_SELECTION |
---|
[1200] | 115 | , m_pParentARLBuffer |
---|
| 116 | #endif |
---|
[56] | 117 | ); |
---|
[2] | 118 | } |
---|
[56] | 119 | |
---|
[1200] | 120 | m_ctuTsToRsAddrMap = new UInt[m_numCtusInFrame+1]; |
---|
| 121 | m_puiTileIdxMap = new UInt[m_numCtusInFrame]; |
---|
| 122 | m_ctuRsToTsAddrMap = new UInt[m_numCtusInFrame+1]; |
---|
[56] | 123 | |
---|
[1200] | 124 | for( i=0; i<m_numCtusInFrame; i++ ) |
---|
[56] | 125 | { |
---|
[1200] | 126 | m_ctuTsToRsAddrMap[i] = i; |
---|
| 127 | m_ctuRsToTsAddrMap[i] = i; |
---|
[56] | 128 | } |
---|
[872] | 129 | |
---|
[1200] | 130 | m_saoBlkParams = new SAOBlkParam[m_numCtusInFrame]; |
---|
| 131 | |
---|
| 132 | |
---|
| 133 | xInitTiles(); |
---|
| 134 | xInitCtuTsRsAddrMaps(); |
---|
| 135 | |
---|
[2] | 136 | } |
---|
| 137 | |
---|
| 138 | Void TComPicSym::destroy() |
---|
| 139 | { |
---|
[1200] | 140 | clearSliceBuffer(); |
---|
| 141 | |
---|
| 142 | for (Int i = 0; i < m_numCtusInFrame; i++) |
---|
[2] | 143 | { |
---|
[1200] | 144 | m_pictureCtuArray[i]->destroy(); |
---|
| 145 | delete m_pictureCtuArray[i]; |
---|
| 146 | m_pictureCtuArray[i] = NULL; |
---|
[2] | 147 | } |
---|
[1200] | 148 | delete [] m_pictureCtuArray; |
---|
| 149 | m_pictureCtuArray = NULL; |
---|
[56] | 150 | |
---|
[1200] | 151 | delete [] m_ctuTsToRsAddrMap; |
---|
| 152 | m_ctuTsToRsAddrMap = NULL; |
---|
[56] | 153 | |
---|
| 154 | delete [] m_puiTileIdxMap; |
---|
| 155 | m_puiTileIdxMap = NULL; |
---|
| 156 | |
---|
[1200] | 157 | delete [] m_ctuRsToTsAddrMap; |
---|
| 158 | m_ctuRsToTsAddrMap = NULL; |
---|
| 159 | |
---|
[872] | 160 | if(m_saoBlkParams) |
---|
[608] | 161 | { |
---|
[872] | 162 | delete[] m_saoBlkParams; m_saoBlkParams = NULL; |
---|
[608] | 163 | } |
---|
[1200] | 164 | |
---|
| 165 | #if ADAPTIVE_QP_SELECTION |
---|
| 166 | delete [] m_pParentARLBuffer; |
---|
| 167 | m_pParentARLBuffer = NULL; |
---|
| 168 | #endif |
---|
[2] | 169 | } |
---|
| 170 | |
---|
| 171 | Void TComPicSym::allocateNewSlice() |
---|
| 172 | { |
---|
[1200] | 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) |
---|
[56] | 177 | { |
---|
[1200] | 178 | m_apSlices.back()->copySliceInfo( m_apSlices[m_apSlices.size()-2] ); |
---|
| 179 | m_apSlices.back()->initSlice(); |
---|
[56] | 180 | } |
---|
[2] | 181 | } |
---|
| 182 | |
---|
| 183 | Void TComPicSym::clearSliceBuffer() |
---|
| 184 | { |
---|
[1200] | 185 | for (UInt i = 0; i < UInt(m_apSlices.size()); i++) |
---|
[2] | 186 | { |
---|
[1200] | 187 | delete m_apSlices[i]; |
---|
[2] | 188 | } |
---|
[1200] | 189 | m_apSlices.clear(); |
---|
[2] | 190 | } |
---|
[56] | 191 | |
---|
[1200] | 192 | Void TComPicSym::xInitCtuTsRsAddrMaps() |
---|
[56] | 193 | { |
---|
[1200] | 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()); |
---|
[56] | 202 | } |
---|
| 203 | |
---|
[1200] | 204 | Void TComPicSym::xInitTiles() |
---|
[56] | 205 | { |
---|
[1084] | 206 | //set NumColumnsMinus1 and NumRowsMinus1 |
---|
[1200] | 207 | setNumTileColumnsMinus1( m_pps.getNumTileColumnsMinus1() ); |
---|
| 208 | setNumTileRowsMinus1( m_pps.getNumTileRowsMinus1() ); |
---|
[1084] | 209 | |
---|
[1200] | 210 | const Int numCols = m_pps.getNumTileColumnsMinus1() + 1; |
---|
| 211 | const Int numRows = m_pps.getNumTileRowsMinus1() + 1; |
---|
[1084] | 212 | const Int numTiles = numRows * numCols; |
---|
| 213 | |
---|
| 214 | // allocate memory for tile parameters |
---|
| 215 | m_tileParameters.resize(numTiles); |
---|
| 216 | |
---|
[1200] | 217 | if( m_pps.getTileUniformSpacingFlag() ) |
---|
[56] | 218 | { |
---|
[1084] | 219 | //set width and height for each (uniform) tile |
---|
| 220 | for(Int row=0; row < numRows; row++) |
---|
| 221 | { |
---|
| 222 | for(Int col=0; col < numCols; col++) |
---|
| 223 | { |
---|
| 224 | const Int tileIdx = row * numCols + col; |
---|
[1200] | 225 | m_tileParameters[tileIdx].setTileWidthInCtus( (col+1)*getFrameWidthInCtus( )/numCols - (col*getFrameWidthInCtus( ))/numCols ); |
---|
| 226 | m_tileParameters[tileIdx].setTileHeightInCtus( (row+1)*getFrameHeightInCtus()/numRows - (row*getFrameHeightInCtus())/numRows ); |
---|
[1084] | 227 | } |
---|
| 228 | } |
---|
[56] | 229 | } |
---|
[1084] | 230 | else |
---|
| 231 | { |
---|
| 232 | //set the width for each tile |
---|
| 233 | for(Int row=0; row < numRows; row++) |
---|
| 234 | { |
---|
| 235 | Int cumulativeTileWidth = 0; |
---|
[1200] | 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 | } |
---|
[56] | 243 | |
---|
[1084] | 244 | //set the height for each tile |
---|
| 245 | for(Int col=0; col < numCols; col++) |
---|
[1200] | 246 | { |
---|
[1084] | 247 | Int cumulativeTileHeight = 0; |
---|
[1200] | 248 | for(Int row=0; row < getNumTileRowsMinus1(); row++) |
---|
[1084] | 249 | { |
---|
[1200] | 250 | m_tileParameters[row * numCols + col].setTileHeightInCtus( m_pps.getTileRowHeight(row) ); |
---|
| 251 | cumulativeTileHeight += m_pps.getTileRowHeight(row); |
---|
[1084] | 252 | } |
---|
[1200] | 253 | m_tileParameters[getNumTileRowsMinus1() * numCols + col].setTileHeightInCtus( getFrameHeightInCtus()-cumulativeTileHeight ); |
---|
[1084] | 254 | } |
---|
| 255 | } |
---|
[56] | 256 | |
---|
[1200] | 257 | // Tile size check |
---|
[1084] | 258 | Int minWidth = 1; |
---|
| 259 | Int minHeight = 1; |
---|
[1200] | 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... |
---|
[1084] | 262 | { |
---|
[1200] | 263 | if (m_pps.getTilesEnabledFlag()) |
---|
[1084] | 264 | { |
---|
[1200] | 265 | minHeight = 64 / m_sps.getMaxCUHeight(); |
---|
| 266 | minWidth = 256 / m_sps.getMaxCUWidth(); |
---|
[1084] | 267 | } |
---|
| 268 | } |
---|
| 269 | for(Int row=0; row < numRows; row++) |
---|
| 270 | { |
---|
| 271 | for(Int col=0; col < numCols; col++) |
---|
| 272 | { |
---|
| 273 | const Int tileIdx = row * numCols + col; |
---|
[1200] | 274 | assert (m_tileParameters[tileIdx].getTileWidthInCtus() >= minWidth); |
---|
| 275 | assert (m_tileParameters[tileIdx].getTileHeightInCtus() >= minHeight); |
---|
[1084] | 276 | } |
---|
| 277 | } |
---|
| 278 | |
---|
[56] | 279 | //initialize each tile of the current picture |
---|
[1084] | 280 | for( Int row=0; row < numRows; row++ ) |
---|
[608] | 281 | { |
---|
[1084] | 282 | for( Int col=0; col < numCols; col++ ) |
---|
[56] | 283 | { |
---|
[1084] | 284 | const Int tileIdx = row * numCols + col; |
---|
[56] | 285 | |
---|
| 286 | //initialize the RightEdgePosInCU for each tile |
---|
[1084] | 287 | Int rightEdgePosInCTU = 0; |
---|
| 288 | for( Int i=0; i <= col; i++ ) |
---|
[56] | 289 | { |
---|
[1200] | 290 | rightEdgePosInCTU += m_tileParameters[row * numCols + i].getTileWidthInCtus(); |
---|
[56] | 291 | } |
---|
[1200] | 292 | m_tileParameters[tileIdx].setRightEdgePosInCtus(rightEdgePosInCTU-1); |
---|
[56] | 293 | |
---|
| 294 | //initialize the BottomEdgePosInCU for each tile |
---|
[1084] | 295 | Int bottomEdgePosInCTU = 0; |
---|
| 296 | for( Int i=0; i <= row; i++ ) |
---|
[56] | 297 | { |
---|
[1200] | 298 | bottomEdgePosInCTU += m_tileParameters[i * numCols + col].getTileHeightInCtus(); |
---|
[56] | 299 | } |
---|
[1200] | 300 | m_tileParameters[tileIdx].setBottomEdgePosInCtus(bottomEdgePosInCTU-1); |
---|
[56] | 301 | |
---|
| 302 | //initialize the FirstCUAddr for each tile |
---|
[1200] | 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); |
---|
[56] | 305 | } |
---|
[608] | 306 | } |
---|
[56] | 307 | |
---|
[1084] | 308 | Int columnIdx = 0; |
---|
| 309 | Int rowIdx = 0; |
---|
| 310 | |
---|
[56] | 311 | //initialize the TileIdxMap |
---|
[1200] | 312 | for( Int i=0; i<m_numCtusInFrame; i++) |
---|
[56] | 313 | { |
---|
[1084] | 314 | for( Int col=0; col < numCols; col++) |
---|
[56] | 315 | { |
---|
[1200] | 316 | if(i % getFrameWidthInCtus() <= m_tileParameters[col].getRightEdgePosInCtus()) |
---|
[56] | 317 | { |
---|
[1084] | 318 | columnIdx = col; |
---|
| 319 | break; |
---|
[56] | 320 | } |
---|
| 321 | } |
---|
[1084] | 322 | for(Int row=0; row < numRows; row++) |
---|
[56] | 323 | { |
---|
[1200] | 324 | if(i / getFrameWidthInCtus() <= m_tileParameters[row*numCols].getBottomEdgePosInCtus()) |
---|
[56] | 325 | { |
---|
[1084] | 326 | rowIdx = row; |
---|
| 327 | break; |
---|
[56] | 328 | } |
---|
| 329 | } |
---|
[1084] | 330 | m_puiTileIdxMap[i] = rowIdx * numCols + columnIdx; |
---|
[56] | 331 | } |
---|
| 332 | } |
---|
[1200] | 333 | UInt TComPicSym::xCalculateNextCtuRSAddr( UInt currCtuRsAddr ) |
---|
[56] | 334 | { |
---|
[1200] | 335 | UInt nextCtuRsAddr; |
---|
[56] | 336 | |
---|
[1200] | 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 |
---|
[56] | 343 | { |
---|
[1200] | 344 | if(uiTileIdx+1 == getNumTiles()) |
---|
[56] | 345 | { |
---|
[1200] | 346 | nextCtuRsAddr = m_numCtusInFrame; |
---|
[56] | 347 | } |
---|
| 348 | else |
---|
| 349 | { |
---|
[1200] | 350 | nextCtuRsAddr = getTComTile(uiTileIdx+1)->getFirstCtuRsAddr(); |
---|
[56] | 351 | } |
---|
[1200] | 352 | } |
---|
| 353 | else //the current CTU is not the last CTU of the tile |
---|
[56] | 354 | { |
---|
[1200] | 355 | if( currCtuRsAddr % m_frameWidthInCtus == getTComTile(uiTileIdx)->getRightEdgePosInCtus() ) //the current CTU is on the rightmost edge of the tile |
---|
[56] | 356 | { |
---|
[1200] | 357 | nextCtuRsAddr = currCtuRsAddr + m_frameWidthInCtus - getTComTile(uiTileIdx)->getTileWidthInCtus() + 1; |
---|
[56] | 358 | } |
---|
| 359 | else |
---|
| 360 | { |
---|
[1200] | 361 | nextCtuRsAddr = currCtuRsAddr + 1; |
---|
[56] | 362 | } |
---|
| 363 | } |
---|
| 364 | |
---|
[1200] | 365 | return nextCtuRsAddr; |
---|
[56] | 366 | } |
---|
| 367 | |
---|
[1200] | 368 | Void TComPicSym::deriveLoopFilterBoundaryAvailibility(Int ctuRsAddr, |
---|
[872] | 369 | Bool& isLeftAvail, |
---|
| 370 | Bool& isRightAvail, |
---|
| 371 | Bool& isAboveAvail, |
---|
| 372 | Bool& isBelowAvail, |
---|
| 373 | Bool& isAboveLeftAvail, |
---|
| 374 | Bool& isAboveRightAvail, |
---|
| 375 | Bool& isBelowLeftAvail, |
---|
| 376 | Bool& isBelowRightAvail |
---|
| 377 | ) |
---|
[608] | 378 | { |
---|
[872] | 379 | |
---|
[1200] | 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); |
---|
[872] | 384 | isAboveLeftAvail = (isAboveAvail && isLeftAvail); |
---|
| 385 | isAboveRightAvail= (isAboveAvail && isRightAvail); |
---|
| 386 | isBelowLeftAvail = (isBelowAvail && isLeftAvail); |
---|
| 387 | isBelowRightAvail= (isBelowAvail && isRightAvail); |
---|
| 388 | |
---|
[1200] | 389 | Bool isLoopFiltAcrossTilePPS = getCtu(ctuRsAddr)->getSlice()->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); |
---|
[872] | 390 | |
---|
| 391 | { |
---|
[1200] | 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; |
---|
[872] | 401 | |
---|
| 402 | { |
---|
| 403 | //left |
---|
| 404 | if(ctuLeft != NULL) |
---|
| 405 | { |
---|
[1200] | 406 | isLeftAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuLeft->getSlice()->getSliceCurStartCtuTsAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true; |
---|
[872] | 407 | } |
---|
| 408 | //above |
---|
| 409 | if(ctuAbove != NULL) |
---|
| 410 | { |
---|
[1200] | 411 | isAboveAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuAbove->getSlice()->getSliceCurStartCtuTsAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true; |
---|
[872] | 412 | } |
---|
| 413 | //right |
---|
| 414 | if(ctuRight != NULL) |
---|
| 415 | { |
---|
[1200] | 416 | isRightAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuRight->getSlice()->getSliceCurStartCtuTsAddr())?ctuRight->getSlice()->getLFCrossSliceBoundaryFlag():true; |
---|
[872] | 417 | } |
---|
| 418 | //below |
---|
| 419 | if(ctuBelow != NULL) |
---|
| 420 | { |
---|
[1200] | 421 | isBelowAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuBelow->getSlice()->getSliceCurStartCtuTsAddr())?ctuBelow->getSlice()->getLFCrossSliceBoundaryFlag():true; |
---|
[872] | 422 | } |
---|
| 423 | //above-left |
---|
| 424 | if(ctuAboveLeft != NULL) |
---|
| 425 | { |
---|
[1200] | 426 | isAboveLeftAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuAboveLeft->getSlice()->getSliceCurStartCtuTsAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true; |
---|
[872] | 427 | } |
---|
| 428 | //below-right |
---|
| 429 | if(ctuBelowRight != NULL) |
---|
[1200] | 430 | { |
---|
| 431 | isBelowRightAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuBelowRight->getSlice()->getSliceCurStartCtuTsAddr())?ctuBelowRight->getSlice()->getLFCrossSliceBoundaryFlag():true; |
---|
[872] | 432 | } |
---|
| 433 | |
---|
| 434 | //above-right |
---|
[1200] | 435 | if(ctuAboveRight != NULL) |
---|
[872] | 436 | { |
---|
[1200] | 437 | Int curSliceStartTsAddr = ctuCurr->getSlice()->getSliceCurStartCtuTsAddr(); |
---|
| 438 | Int aboveRightSliceStartTsAddr = ctuAboveRight->getSlice()->getSliceCurStartCtuTsAddr(); |
---|
[872] | 439 | |
---|
[1200] | 440 | isAboveRightAvail = (curSliceStartTsAddr == aboveRightSliceStartTsAddr)?(true): |
---|
[872] | 441 | ( |
---|
[1200] | 442 | (curSliceStartTsAddr > aboveRightSliceStartTsAddr)?(ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag()) |
---|
| 443 | :(ctuAboveRight->getSlice()->getLFCrossSliceBoundaryFlag()) |
---|
| 444 | ); |
---|
[872] | 445 | } |
---|
| 446 | //below-left |
---|
| 447 | if(ctuBelowLeft != NULL) |
---|
| 448 | { |
---|
[1200] | 449 | Int curSliceStartTsAddr = ctuCurr->getSlice()->getSliceCurStartCtuTsAddr(); |
---|
| 450 | Int belowLeftSliceStartTsAddr = ctuBelowLeft->getSlice()->getSliceCurStartCtuTsAddr(); |
---|
[872] | 451 | |
---|
[1200] | 452 | isBelowLeftAvail = (curSliceStartTsAddr == belowLeftSliceStartTsAddr)?(true): |
---|
[872] | 453 | ( |
---|
[1200] | 454 | (curSliceStartTsAddr > belowLeftSliceStartTsAddr)?(ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag()) |
---|
[872] | 455 | :(ctuBelowLeft->getSlice()->getLFCrossSliceBoundaryFlag()) |
---|
| 456 | ); |
---|
[1200] | 457 | } |
---|
[872] | 458 | } |
---|
| 459 | |
---|
| 460 | if(!isLoopFiltAcrossTilePPS) |
---|
[1200] | 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 )); |
---|
[872] | 470 | } |
---|
| 471 | } |
---|
| 472 | |
---|
[608] | 473 | } |
---|
| 474 | |
---|
[1200] | 475 | |
---|
[56] | 476 | TComTile::TComTile() |
---|
[1200] | 477 | : m_tileWidthInCtus (0) |
---|
| 478 | , m_tileHeightInCtus (0) |
---|
| 479 | , m_rightEdgePosInCtus (0) |
---|
| 480 | , m_bottomEdgePosInCtus (0) |
---|
| 481 | , m_firstCtuRsAddr (0) |
---|
[56] | 482 | { |
---|
| 483 | } |
---|
| 484 | |
---|
| 485 | TComTile::~TComTile() |
---|
| 486 | { |
---|
| 487 | } |
---|
| 488 | //! \} |
---|