[313] | 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 |
---|
[1029] | 4 | * granted under this license. |
---|
[313] | 5 | * |
---|
[1259] | 6 | * Copyright (c) 2010-2015, ITU/ISO/IEC |
---|
[313] | 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 | */ |
---|
| 33 | |
---|
| 34 | /** \file TComPic.cpp |
---|
| 35 | \brief picture class |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include "TComPic.h" |
---|
| 39 | #include "SEI.h" |
---|
| 40 | |
---|
| 41 | //! \ingroup TLibCommon |
---|
| 42 | //! \{ |
---|
| 43 | |
---|
| 44 | // ==================================================================================================================== |
---|
| 45 | // Constructor / destructor / create / destroy |
---|
| 46 | // ==================================================================================================================== |
---|
| 47 | |
---|
| 48 | TComPic::TComPic() |
---|
| 49 | : m_uiTLayer (0) |
---|
| 50 | , m_bUsedByCurr (false) |
---|
| 51 | , m_bIsLongTerm (false) |
---|
| 52 | , m_pcPicYuvPred (NULL) |
---|
| 53 | , m_pcPicYuvResi (NULL) |
---|
| 54 | , m_bReconstructed (false) |
---|
| 55 | , m_bNeededForOutput (false) |
---|
| 56 | , m_uiCurrSliceIdx (0) |
---|
[595] | 57 | , m_bCheckLTMSB (false) |
---|
| 58 | #if SVC_EXTENSION |
---|
| 59 | , m_layerId( 0 ) |
---|
[540] | 60 | #endif |
---|
[313] | 61 | { |
---|
| 62 | #if SVC_EXTENSION |
---|
| 63 | memset( m_pcFullPelBaseRec, 0, sizeof( m_pcFullPelBaseRec ) ); |
---|
| 64 | memset( m_bSpatialEnhLayer, false, sizeof( m_bSpatialEnhLayer ) ); |
---|
[901] | 65 | memset( m_equalPictureSizeAndOffsetFlag, false, sizeof( m_equalPictureSizeAndOffsetFlag ) ); |
---|
[1420] | 66 | memset( m_mvScalingFactor, 0, sizeof( m_mvScalingFactor ) ); |
---|
| 67 | memset( m_posScalingFactor, 0, sizeof( m_posScalingFactor ) ); |
---|
[313] | 68 | #endif |
---|
[1029] | 69 | for(UInt i=0; i<NUM_PIC_YUV; i++) |
---|
| 70 | { |
---|
| 71 | m_apcPicYuv[i] = NULL; |
---|
| 72 | } |
---|
[313] | 73 | } |
---|
| 74 | |
---|
| 75 | TComPic::~TComPic() |
---|
| 76 | { |
---|
| 77 | } |
---|
[815] | 78 | #if SVC_EXTENSION |
---|
[1290] | 79 | Void TComPic::create( const TComVPS &vps, const TComSPS &sps, const TComPPS &pps, const Bool bIsVirtual, const UInt layerId ) |
---|
[313] | 80 | { |
---|
[1235] | 81 | const ChromaFormat chromaFormatIDC = vps.getChromaFormatIdc(&sps, layerId); |
---|
[1290] | 82 | const Int iWidth = vps.getPicWidthInLumaSamples(&sps, layerId); |
---|
| 83 | const Int iHeight = vps.getPicHeightInLumaSamples(&sps, layerId); |
---|
| 84 | const UInt uiMaxCuWidth = sps.getMaxCUWidth(); |
---|
| 85 | const UInt uiMaxCuHeight = sps.getMaxCUHeight(); |
---|
| 86 | const UInt uiMaxDepth = sps.getMaxTotalCUDepth(); |
---|
[1235] | 87 | |
---|
| 88 | const Window& conformanceWindow = vps.getConformanceWindow( &sps, layerId ); |
---|
| 89 | |
---|
[1289] | 90 | m_picSym.create( vps, sps, pps, uiMaxDepth, layerId ); |
---|
[1235] | 91 | |
---|
[313] | 92 | if (!bIsVirtual) |
---|
| 93 | { |
---|
[1289] | 94 | m_apcPicYuv[PIC_YUV_ORG] = new TComPicYuv; m_apcPicYuv[PIC_YUV_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow ); |
---|
| 95 | m_apcPicYuv[PIC_YUV_TRUE_ORG] = new TComPicYuv; m_apcPicYuv[PIC_YUV_TRUE_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow ); |
---|
[313] | 96 | } |
---|
[1289] | 97 | m_apcPicYuv[PIC_YUV_REC] = new TComPicYuv; m_apcPicYuv[PIC_YUV_REC]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow ); |
---|
[313] | 98 | |
---|
| 99 | for( Int i = 0; i < MAX_LAYERS; i++ ) |
---|
| 100 | { |
---|
| 101 | if( m_bSpatialEnhLayer[i] ) |
---|
| 102 | { |
---|
[1289] | 103 | m_pcFullPelBaseRec[i] = new TComPicYuv; m_pcFullPelBaseRec[i]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow ); |
---|
[313] | 104 | } |
---|
[1235] | 105 | } |
---|
[313] | 106 | |
---|
| 107 | // there are no SEI messages associated with this picture initially |
---|
| 108 | if (m_SEIs.size() > 0) |
---|
| 109 | { |
---|
| 110 | deleteSEIs (m_SEIs); |
---|
| 111 | } |
---|
| 112 | m_bUsedByCurr = false; |
---|
| 113 | } |
---|
| 114 | #else |
---|
[1290] | 115 | Void TComPic::create( const TComSPS &sps, const TComPPS &pps, const Bool bIsVirtual) |
---|
[313] | 116 | { |
---|
[1290] | 117 | const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc(); |
---|
| 118 | const Int iWidth = sps.getPicWidthInLumaSamples(); |
---|
| 119 | const Int iHeight = sps.getPicHeightInLumaSamples(); |
---|
| 120 | const UInt uiMaxCuWidth = sps.getMaxCUWidth(); |
---|
| 121 | const UInt uiMaxCuHeight = sps.getMaxCUHeight(); |
---|
| 122 | const UInt uiMaxDepth = sps.getMaxTotalCUDepth(); |
---|
[1235] | 123 | |
---|
[1289] | 124 | m_picSym.create( sps, pps, uiMaxDepth ); |
---|
[313] | 125 | if (!bIsVirtual) |
---|
| 126 | { |
---|
[1289] | 127 | m_apcPicYuv[PIC_YUV_ORG ] = new TComPicYuv; m_apcPicYuv[PIC_YUV_ORG ]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true ); |
---|
| 128 | m_apcPicYuv[PIC_YUV_TRUE_ORG] = new TComPicYuv; m_apcPicYuv[PIC_YUV_TRUE_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true ); |
---|
[313] | 129 | } |
---|
[1289] | 130 | m_apcPicYuv[PIC_YUV_REC] = new TComPicYuv; m_apcPicYuv[PIC_YUV_REC]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true ); |
---|
[1029] | 131 | |
---|
[313] | 132 | // there are no SEI messages associated with this picture initially |
---|
| 133 | if (m_SEIs.size() > 0) |
---|
| 134 | { |
---|
| 135 | deleteSEIs (m_SEIs); |
---|
| 136 | } |
---|
| 137 | m_bUsedByCurr = false; |
---|
| 138 | } |
---|
| 139 | #endif |
---|
| 140 | |
---|
| 141 | Void TComPic::destroy() |
---|
| 142 | { |
---|
[1235] | 143 | m_picSym.destroy(); |
---|
[1029] | 144 | |
---|
| 145 | for(UInt i=0; i<NUM_PIC_YUV; i++) |
---|
[313] | 146 | { |
---|
[1029] | 147 | if (m_apcPicYuv[i]) |
---|
| 148 | { |
---|
| 149 | m_apcPicYuv[i]->destroy(); |
---|
| 150 | delete m_apcPicYuv[i]; |
---|
| 151 | m_apcPicYuv[i] = NULL; |
---|
| 152 | } |
---|
[313] | 153 | } |
---|
[1029] | 154 | |
---|
[313] | 155 | deleteSEIs(m_SEIs); |
---|
[815] | 156 | #if SVC_EXTENSION |
---|
[313] | 157 | for( Int i = 0; i < MAX_LAYERS; i++ ) |
---|
| 158 | { |
---|
[827] | 159 | if( m_bSpatialEnhLayer[i] && m_pcFullPelBaseRec[i] ) |
---|
[313] | 160 | { |
---|
| 161 | m_pcFullPelBaseRec[i]->destroy(); |
---|
| 162 | delete m_pcFullPelBaseRec[i]; |
---|
| 163 | m_pcFullPelBaseRec[i] = NULL; |
---|
| 164 | } |
---|
| 165 | } |
---|
[1419] | 166 | |
---|
| 167 | for( Int comp = 0; comp < 2; comp++ ) |
---|
| 168 | { |
---|
| 169 | if( m_mvScalingFactor[comp] ) |
---|
| 170 | { |
---|
| 171 | delete [] m_mvScalingFactor[comp]; |
---|
| 172 | m_mvScalingFactor[comp] = NULL; |
---|
| 173 | } |
---|
| 174 | |
---|
| 175 | if( m_posScalingFactor[comp] ) |
---|
| 176 | { |
---|
| 177 | delete [] m_posScalingFactor[comp]; |
---|
| 178 | m_posScalingFactor[comp] = NULL; |
---|
| 179 | } |
---|
| 180 | } |
---|
[313] | 181 | #endif |
---|
| 182 | } |
---|
| 183 | |
---|
| 184 | Void TComPic::compressMotion() |
---|
| 185 | { |
---|
[1029] | 186 | TComPicSym* pPicSym = getPicSym(); |
---|
| 187 | for ( UInt uiCUAddr = 0; uiCUAddr < pPicSym->getNumberOfCtusInFrame(); uiCUAddr++ ) |
---|
[313] | 188 | { |
---|
[1029] | 189 | TComDataCU* pCtu = pPicSym->getCtu(uiCUAddr); |
---|
| 190 | pCtu->compressMV(); |
---|
| 191 | } |
---|
[313] | 192 | } |
---|
[595] | 193 | |
---|
[540] | 194 | Bool TComPic::getSAOMergeAvailability(Int currAddr, Int mergeAddr) |
---|
| 195 | { |
---|
[1029] | 196 | Bool mergeCtbInSliceSeg = (mergeAddr >= getPicSym()->getCtuTsToRsAddrMap(getCtu(currAddr)->getSlice()->getSliceCurStartCtuTsAddr())); |
---|
[540] | 197 | Bool mergeCtbInTile = (getPicSym()->getTileIdxMap(mergeAddr) == getPicSym()->getTileIdxMap(currAddr)); |
---|
| 198 | return (mergeCtbInSliceSeg && mergeCtbInTile); |
---|
| 199 | } |
---|
[313] | 200 | |
---|
[1029] | 201 | UInt TComPic::getSubstreamForCtuAddr(const UInt ctuAddr, const Bool bAddressInRaster, TComSlice *pcSlice) |
---|
| 202 | { |
---|
| 203 | UInt subStrm; |
---|
[1235] | 204 | const bool bWPPEnabled=pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag(); |
---|
| 205 | const TComPicSym &picSym = *(getPicSym()); |
---|
[1029] | 206 | |
---|
[1235] | 207 | if ((bWPPEnabled && picSym.getFrameHeightInCtus()>1) || (picSym.getNumTiles()>1)) // wavefronts, and possibly tiles being used. |
---|
[1029] | 208 | { |
---|
[1235] | 209 | if (bWPPEnabled) |
---|
[1029] | 210 | { |
---|
| 211 | const UInt ctuRsAddr = bAddressInRaster?ctuAddr : picSym.getCtuTsToRsAddrMap(ctuAddr); |
---|
| 212 | const UInt frameWidthInCtus = picSym.getFrameWidthInCtus(); |
---|
| 213 | const UInt tileIndex = picSym.getTileIdxMap(ctuRsAddr); |
---|
| 214 | const UInt numTileColumns = (picSym.getNumTileColumnsMinus1()+1); |
---|
| 215 | const TComTile *pTile = picSym.getTComTile(tileIndex); |
---|
| 216 | const UInt firstCtuRsAddrOfTile = pTile->getFirstCtuRsAddr(); |
---|
| 217 | const UInt tileYInCtus = firstCtuRsAddrOfTile / frameWidthInCtus; |
---|
| 218 | // independent tiles => substreams are "per tile" |
---|
| 219 | const UInt ctuLine = ctuRsAddr / frameWidthInCtus; |
---|
| 220 | const UInt startingSubstreamForTile =(tileYInCtus*numTileColumns) + (pTile->getTileHeightInCtus()*(tileIndex%numTileColumns)); |
---|
| 221 | subStrm = startingSubstreamForTile + (ctuLine - tileYInCtus); |
---|
| 222 | } |
---|
| 223 | else |
---|
| 224 | { |
---|
| 225 | const UInt ctuRsAddr = bAddressInRaster?ctuAddr : picSym.getCtuTsToRsAddrMap(ctuAddr); |
---|
| 226 | const UInt tileIndex = picSym.getTileIdxMap(ctuRsAddr); |
---|
| 227 | subStrm=tileIndex; |
---|
| 228 | } |
---|
| 229 | } |
---|
| 230 | else |
---|
| 231 | { |
---|
| 232 | // dependent tiles => substreams are "per frame". |
---|
| 233 | subStrm = 0; |
---|
| 234 | } |
---|
| 235 | return subStrm; |
---|
| 236 | } |
---|
| 237 | |
---|
[442] | 238 | #if SVC_EXTENSION |
---|
[1419] | 239 | Void TComPic::createMvScalingFactor(UInt numOfILRPs) |
---|
| 240 | { |
---|
| 241 | assert(m_mvScalingFactor[0] == NULL); |
---|
| 242 | m_mvScalingFactor[0] = new Int[numOfILRPs]; |
---|
| 243 | |
---|
| 244 | assert(m_mvScalingFactor[1] == NULL); |
---|
| 245 | m_mvScalingFactor[1] = new Int[numOfILRPs]; |
---|
| 246 | } |
---|
| 247 | |
---|
| 248 | Void TComPic::createPosScalingFactor(UInt numOfILRPs) |
---|
| 249 | { |
---|
| 250 | assert(m_posScalingFactor[0] == NULL); |
---|
| 251 | m_posScalingFactor[0] = new Int[numOfILRPs]; |
---|
| 252 | |
---|
| 253 | assert(m_posScalingFactor[1] == NULL); |
---|
| 254 | m_posScalingFactor[1] = new Int[numOfILRPs]; |
---|
| 255 | } |
---|
| 256 | |
---|
[313] | 257 | Void copyOnetoOnePicture( // SVC_NONCOLL |
---|
| 258 | Pel *in, |
---|
| 259 | Pel *out, |
---|
| 260 | Int nCols, |
---|
| 261 | Int nRows, |
---|
| 262 | Int fullRowWidth) |
---|
| 263 | { |
---|
| 264 | Int rX; |
---|
| 265 | |
---|
| 266 | for (rX = 0; rX < nRows; rX++) |
---|
| 267 | { |
---|
| 268 | memcpy( out, in, sizeof(Pel) * nCols ); |
---|
| 269 | in = in + fullRowWidth; |
---|
| 270 | out = out + fullRowWidth; |
---|
| 271 | } |
---|
| 272 | } |
---|
| 273 | |
---|
| 274 | Void TComPic::copyUpsampledPictureYuv(TComPicYuv* pcPicYuvIn, TComPicYuv* pcPicYuvOut) |
---|
| 275 | { |
---|
[1029] | 276 | Int upsampledRowWidthLuma = pcPicYuvOut->getStride(COMPONENT_Y); // 2 * pcPicYuvOut->getLumaMargin() + pcPicYuvOut->getWidth(); |
---|
| 277 | Int upsampledRowWidthCroma = pcPicYuvOut->getStride(COMPONENT_Cb); //2 * pcPicYuvOut->getChromaMargin() + (pcPicYuvOut->getWidth()>>1); |
---|
[313] | 278 | |
---|
| 279 | copyOnetoOnePicture( |
---|
[1029] | 280 | pcPicYuvIn->getAddr(COMPONENT_Y), |
---|
| 281 | pcPicYuvOut->getAddr(COMPONENT_Y), |
---|
| 282 | pcPicYuvOut->getWidth(COMPONENT_Y), |
---|
| 283 | pcPicYuvOut->getHeight(COMPONENT_Y), |
---|
[313] | 284 | upsampledRowWidthLuma); |
---|
| 285 | copyOnetoOnePicture( |
---|
[1029] | 286 | pcPicYuvIn->getAddr(COMPONENT_Cr), |
---|
| 287 | pcPicYuvOut->getAddr(COMPONENT_Cr), |
---|
| 288 | pcPicYuvOut->getWidth(COMPONENT_Y)>>1, |
---|
| 289 | pcPicYuvOut->getHeight(COMPONENT_Y)>>1, |
---|
[313] | 290 | upsampledRowWidthCroma); |
---|
| 291 | copyOnetoOnePicture( |
---|
[1029] | 292 | pcPicYuvIn->getAddr(COMPONENT_Cb), |
---|
| 293 | pcPicYuvOut->getAddr(COMPONENT_Cb), |
---|
| 294 | pcPicYuvOut->getWidth(COMPONENT_Y)>>1, |
---|
| 295 | pcPicYuvOut->getHeight(COMPONENT_Y)>>1, |
---|
[313] | 296 | upsampledRowWidthCroma); |
---|
| 297 | } |
---|
| 298 | |
---|
[1419] | 299 | Void TComPic::copyUpsampledMvField(UInt refLayerIdc, Int** mvScalingFactor, Int** posScalingFactor) |
---|
[313] | 300 | { |
---|
[1290] | 301 | const TComSPS *sps = getSlice(0)->getSPS(); |
---|
| 302 | const UInt uiMaxDepth = sps->getMaxTotalCUDepth(); |
---|
| 303 | const UInt numPartitions = 1<<(uiMaxDepth<<1); |
---|
| 304 | const UInt widthMinPU = sps->getMaxCUWidth() / (1<<uiMaxDepth); |
---|
| 305 | const UInt heightMinPU = sps->getMaxCUHeight() / (1<<uiMaxDepth); |
---|
| 306 | const Int unitNum = max( 1, (Int)((16/widthMinPU)*(16/heightMinPU)) ); |
---|
[313] | 307 | |
---|
[1029] | 308 | for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCtusInFrame(); cuIdx++) //each LCU |
---|
[313] | 309 | { |
---|
[1029] | 310 | TComDataCU* pcCUDes = getCtu(cuIdx); |
---|
[313] | 311 | |
---|
| 312 | for(UInt absPartIdx = 0; absPartIdx < numPartitions; absPartIdx+=unitNum ) //each 16x16 unit |
---|
| 313 | { |
---|
| 314 | //pixel position of each unit in up-sampled layer |
---|
[1289] | 315 | UInt pelX = pcCUDes->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[absPartIdx] ]; |
---|
| 316 | UInt pelY = pcCUDes->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[absPartIdx] ]; |
---|
[313] | 317 | UInt baseCUAddr, baseAbsPartIdx; |
---|
| 318 | |
---|
| 319 | TComDataCU *pcColCU = 0; |
---|
[1419] | 320 | pcColCU = pcCUDes->getBaseColCU(refLayerIdc, pelX, pelY, baseCUAddr, baseAbsPartIdx, posScalingFactor, true); |
---|
[313] | 321 | |
---|
[1029] | 322 | if( pcColCU && pcColCU->getPredictionMode(baseAbsPartIdx) == MODE_INTER ) //base layer unit not skip and invalid mode |
---|
[313] | 323 | { |
---|
| 324 | for(UInt refPicList = 0; refPicList < 2; refPicList++) //for each reference list |
---|
| 325 | { |
---|
| 326 | TComMvField sMvFieldBase, sMvField; |
---|
| 327 | pcColCU->getMvField( pcColCU, baseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase); |
---|
[1419] | 328 | pcCUDes->scaleBaseMV( refLayerIdc, sMvField, sMvFieldBase, mvScalingFactor ); |
---|
[313] | 329 | |
---|
| 330 | pcCUDes->getCUMvField((RefPicList)refPicList)->setMvField(sMvField, absPartIdx); |
---|
| 331 | pcCUDes->setPredictionMode(absPartIdx, MODE_INTER); |
---|
| 332 | } |
---|
| 333 | } |
---|
| 334 | else |
---|
| 335 | { |
---|
| 336 | TComMvField zeroMvField; //zero MV and invalid reference index |
---|
| 337 | pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(zeroMvField, absPartIdx); |
---|
| 338 | pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(zeroMvField, absPartIdx); |
---|
| 339 | pcCUDes->setPredictionMode(absPartIdx, MODE_INTRA); |
---|
| 340 | } |
---|
| 341 | |
---|
| 342 | for(UInt i = 1; i < unitNum; i++ ) |
---|
| 343 | { |
---|
| 344 | pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_0)->getMv(absPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_0)->getRefIdx(absPartIdx), absPartIdx + i); |
---|
| 345 | pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_1)->getMv(absPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_1)->getRefIdx(absPartIdx), absPartIdx + i); |
---|
| 346 | pcCUDes->setPredictionMode(absPartIdx+i, pcCUDes->getPredictionMode(absPartIdx)); |
---|
| 347 | } |
---|
| 348 | } |
---|
[822] | 349 | memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(Char)*numPartitions ); |
---|
[313] | 350 | } |
---|
| 351 | } |
---|
| 352 | |
---|
| 353 | Void TComPic::initUpsampledMvField() |
---|
| 354 | { |
---|
[1290] | 355 | const TComSPS *sps = getSlice(0)->getSPS(); |
---|
| 356 | const UInt uiMaxDepth = sps->getMaxTotalCUDepth(); |
---|
| 357 | const UInt uiNumPartitions = 1<<(uiMaxDepth<<1); |
---|
[313] | 358 | |
---|
[1029] | 359 | for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCtusInFrame(); cuIdx++) //each LCU |
---|
[313] | 360 | { |
---|
[1029] | 361 | TComDataCU* pcCUDes = getCtu(cuIdx); |
---|
[313] | 362 | TComMvField zeroMvField; |
---|
| 363 | for(UInt list = 0; list < 2; list++) //each reference list |
---|
| 364 | { |
---|
| 365 | for(UInt i = 0; i < uiNumPartitions; i++ ) |
---|
| 366 | { |
---|
| 367 | pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(zeroMvField, i); |
---|
| 368 | pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(zeroMvField, i); |
---|
| 369 | pcCUDes->setPredictionMode(i, MODE_INTRA); |
---|
| 370 | pcCUDes->setPartitionSize(i, SIZE_2Nx2N); |
---|
| 371 | } |
---|
| 372 | } |
---|
| 373 | } |
---|
| 374 | return; |
---|
| 375 | } |
---|
| 376 | |
---|
[494] | 377 | Bool TComPic::checkSameRefInfo() |
---|
| 378 | { |
---|
| 379 | Bool bSameRefInfo = true; |
---|
| 380 | TComSlice * pSlice0 = getSlice( 0 ); |
---|
| 381 | for( UInt uSliceID = getNumAllocatedSlice() - 1 ; bSameRefInfo && uSliceID > 0 ; uSliceID-- ) |
---|
| 382 | { |
---|
| 383 | TComSlice * pSliceN = getSlice( uSliceID ); |
---|
| 384 | if( pSlice0->getSliceType() != pSliceN->getSliceType() ) |
---|
| 385 | { |
---|
| 386 | bSameRefInfo = false; |
---|
| 387 | } |
---|
| 388 | else if( pSlice0->getSliceType() != I_SLICE ) |
---|
| 389 | { |
---|
| 390 | Int nListNum = pSlice0->getSliceType() == B_SLICE ? 2 : 1; |
---|
| 391 | for( Int nList = 0 ; nList < nListNum ; nList++ ) |
---|
| 392 | { |
---|
| 393 | RefPicList eRefList = ( RefPicList )nList; |
---|
| 394 | if( pSlice0->getNumRefIdx( eRefList ) == pSliceN->getNumRefIdx( eRefList ) ) |
---|
| 395 | { |
---|
| 396 | for( Int refIdx = pSlice0->getNumRefIdx( eRefList ) - 1 ; refIdx >= 0 ; refIdx-- ) |
---|
| 397 | { |
---|
| 398 | if( pSlice0->getRefPic( eRefList , refIdx ) != pSliceN->getRefPic( eRefList , refIdx ) ) |
---|
| 399 | { |
---|
| 400 | bSameRefInfo = false; |
---|
| 401 | break; |
---|
| 402 | } |
---|
| 403 | } |
---|
| 404 | } |
---|
| 405 | else |
---|
| 406 | { |
---|
| 407 | bSameRefInfo = false; |
---|
| 408 | break; |
---|
| 409 | } |
---|
| 410 | } |
---|
| 411 | } |
---|
| 412 | } |
---|
[313] | 413 | |
---|
[494] | 414 | return( bSameRefInfo ); |
---|
| 415 | } |
---|
[1029] | 416 | #endif //SVC_EXTENSION |
---|
[494] | 417 | |
---|
[313] | 418 | //! \} |
---|