[1200] | 1 | /* The copyright in this software is being made available under the BSD |
---|
[5] | 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. |
---|
[5] | 5 | * |
---|
[1200] | 6 | * Copyright (c) 2010-2015, ITU/ISO/IEC |
---|
[5] | 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. |
---|
[56] | 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
[5] | 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 | |
---|
[2] | 34 | /** \file TComSlice.cpp |
---|
| 35 | \brief slice header and SPS class |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include "CommonDef.h" |
---|
| 39 | #include "TComSlice.h" |
---|
| 40 | #include "TComPic.h" |
---|
[608] | 41 | #include "TLibEncoder/TEncSbac.h" |
---|
| 42 | #include "TLibDecoder/TDecSbac.h" |
---|
[2] | 43 | |
---|
[1200] | 44 | |
---|
[56] | 45 | //! \ingroup TLibCommon |
---|
| 46 | //! \{ |
---|
| 47 | |
---|
[2] | 48 | TComSlice::TComSlice() |
---|
[56] | 49 | : m_iPPSId ( -1 ) |
---|
[1200] | 50 | , m_PicOutputFlag ( true ) |
---|
| 51 | #if NH_MV |
---|
[964] | 52 | , m_slicePicOrderCntLsb ( 0 ) |
---|
| 53 | #endif |
---|
[56] | 54 | , m_iPOC ( 0 ) |
---|
| 55 | , m_iLastIDR ( 0 ) |
---|
[1200] | 56 | , m_iAssociatedIRAP ( 0 ) |
---|
| 57 | , m_iAssociatedIRAPType ( NAL_UNIT_INVALID ) |
---|
| 58 | , m_pcRPS ( 0 ) |
---|
| 59 | , m_LocalRPS ( ) |
---|
| 60 | , m_iBDidx ( 0 ) |
---|
| 61 | , m_RefPicListModification ( ) |
---|
[608] | 62 | , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR_W_RADL ) |
---|
[56] | 63 | , m_eSliceType ( I_SLICE ) |
---|
| 64 | , m_iSliceQp ( 0 ) |
---|
[1200] | 65 | , m_dependentSliceSegmentFlag ( false ) |
---|
[56] | 66 | #if ADAPTIVE_QP_SELECTION |
---|
| 67 | , m_iSliceQpBase ( 0 ) |
---|
[2] | 68 | #endif |
---|
[1200] | 69 | , m_ChromaQpAdjEnabled ( false ) |
---|
| 70 | , m_deblockingFilterDisable ( false ) |
---|
| 71 | , m_deblockingFilterOverrideFlag ( false ) |
---|
| 72 | , m_deblockingFilterBetaOffsetDiv2( 0 ) |
---|
| 73 | , m_deblockingFilterTcOffsetDiv2 ( 0 ) |
---|
[56] | 74 | , m_bCheckLDC ( false ) |
---|
| 75 | , m_iSliceQpDelta ( 0 ) |
---|
| 76 | , m_iDepth ( 0 ) |
---|
| 77 | , m_bRefenced ( false ) |
---|
[1200] | 78 | , m_pcVPS ( NULL ) |
---|
[56] | 79 | , m_pcSPS ( NULL ) |
---|
| 80 | , m_pcPPS ( NULL ) |
---|
| 81 | , m_pcPic ( NULL ) |
---|
[1200] | 82 | , m_colFromL0Flag ( true ) |
---|
[964] | 83 | , m_noOutputPriorPicsFlag ( false ) |
---|
| 84 | , m_noRaslOutputFlag ( false ) |
---|
[1200] | 85 | , m_handleCraAsBlaFlag ( false ) |
---|
[56] | 86 | , m_colRefIdx ( 0 ) |
---|
[1200] | 87 | , m_maxNumMergeCand ( 0 ) |
---|
[56] | 88 | , m_uiTLayer ( 0 ) |
---|
| 89 | , m_bTLayerSwitchingFlag ( false ) |
---|
[1200] | 90 | , m_sliceMode ( NO_SLICES ) |
---|
| 91 | , m_sliceArgument ( 0 ) |
---|
| 92 | , m_sliceCurStartCtuTsAddr ( 0 ) |
---|
| 93 | , m_sliceCurEndCtuTsAddr ( 0 ) |
---|
| 94 | , m_sliceIdx ( 0 ) |
---|
| 95 | , m_sliceSegmentMode ( NO_SLICES ) |
---|
| 96 | , m_sliceSegmentArgument ( 0 ) |
---|
| 97 | , m_sliceSegmentCurStartCtuTsAddr ( 0 ) |
---|
| 98 | , m_sliceSegmentCurEndCtuTsAddr ( 0 ) |
---|
| 99 | , m_nextSlice ( false ) |
---|
| 100 | , m_nextSliceSegment ( false ) |
---|
| 101 | , m_sliceBits ( 0 ) |
---|
| 102 | , m_sliceSegmentBits ( 0 ) |
---|
[56] | 103 | , m_bFinalized ( false ) |
---|
[1200] | 104 | , m_bTestWeightPred ( false ) |
---|
| 105 | , m_bTestWeightBiPred ( false ) |
---|
| 106 | , m_substreamSizes ( ) |
---|
[56] | 107 | , m_cabacInitFlag ( false ) |
---|
[608] | 108 | , m_bLMvdL1Zero ( false ) |
---|
| 109 | , m_temporalLayerNonReferenceFlag ( false ) |
---|
[1200] | 110 | , m_LFCrossSliceBoundaryFlag ( false ) |
---|
[608] | 111 | , m_enableTMVPFlag ( true ) |
---|
[1200] | 112 | , m_encCABACTableIdx (I_SLICE) |
---|
| 113 | #if NH_MV |
---|
[1066] | 114 | , m_availableForTMVPRefFlag ( true ) |
---|
[1200] | 115 | , m_refPicSetInterLayer0 ( NULL ) |
---|
| 116 | , m_refPicSetInterLayer1 ( NULL ) |
---|
[608] | 117 | , m_layerId (0) |
---|
| 118 | , m_viewId (0) |
---|
[622] | 119 | , m_viewIndex (0) |
---|
[1200] | 120 | #if NH_3D |
---|
[608] | 121 | , m_isDepth (false) |
---|
[56] | 122 | #endif |
---|
[872] | 123 | #if !H_MV_HLS7_GEN |
---|
[622] | 124 | , m_pocResetFlag (false) |
---|
[872] | 125 | #endif |
---|
[1200] | 126 | #if NH_MV |
---|
[738] | 127 | , m_crossLayerBlaFlag (false) |
---|
| 128 | #endif |
---|
[608] | 129 | , m_discardableFlag (false) |
---|
| 130 | , m_interLayerPredEnabledFlag (false) |
---|
| 131 | , m_numInterLayerRefPicsMinus1 (0) |
---|
[1200] | 132 | #if NH_MV |
---|
[872] | 133 | , m_sliceSegmentHeaderExtensionLength (0) |
---|
[1200] | 134 | , m_pocResetIdc (0) |
---|
| 135 | , m_pocResetPeriodId (0) |
---|
| 136 | , m_fullPocResetFlag (false) |
---|
| 137 | , m_pocLsbVal (0) |
---|
| 138 | , m_pocMsbValPresentFlag (false) |
---|
| 139 | , m_pocMsbVal (0) |
---|
| 140 | , m_pocMsbValRequiredFlag (false) |
---|
[872] | 141 | #endif |
---|
[608] | 142 | #if H_3D_IC |
---|
[1200] | 143 | , m_bApplyIC (false) |
---|
| 144 | , m_icSkipParseFlag (false) |
---|
[189] | 145 | #endif |
---|
[1200] | 146 | #if NH_3D |
---|
| 147 | , m_inCmpPredFlag (false) |
---|
| 148 | , m_numViews (0) |
---|
| 149 | , m_depthToDisparityB (NULL) |
---|
| 150 | , m_depthToDisparityF (NULL) |
---|
| 151 | #endif |
---|
[608] | 152 | #if H_3D |
---|
[1179] | 153 | , m_bApplyDIS (false) |
---|
[296] | 154 | #endif |
---|
[1039] | 155 | #endif |
---|
[56] | 156 | { |
---|
[1200] | 157 | for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++) |
---|
[872] | 158 | { |
---|
[1200] | 159 | m_aiNumRefIdx[i] = 0; |
---|
[872] | 160 | } |
---|
[1200] | 161 | |
---|
| 162 | for (UInt component = 0; component < MAX_NUM_COMPONENT; component++) |
---|
| 163 | { |
---|
| 164 | m_lambdas [component] = 0.0; |
---|
| 165 | m_iSliceChromaQpDelta[component] = 0; |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | initEqualRef(); |
---|
| 169 | |
---|
[608] | 170 | for ( Int idx = 0; idx < MAX_NUM_REF; idx++ ) |
---|
[56] | 171 | { |
---|
[608] | 172 | m_list1IdxToList0Idx[idx] = -1; |
---|
| 173 | } |
---|
[1200] | 174 | |
---|
[608] | 175 | for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++) |
---|
[56] | 176 | { |
---|
[1200] | 177 | for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++) |
---|
| 178 | { |
---|
| 179 | m_apcRefPicList [i][iNumCount] = NULL; |
---|
| 180 | m_aiRefPOCList [i][iNumCount] = 0; |
---|
| 181 | } |
---|
| 182 | #if NH_MV |
---|
[608] | 183 | m_aiRefLayerIdList[0][iNumCount] = 0; |
---|
| 184 | m_aiRefLayerIdList[1][iNumCount] = 0; |
---|
| 185 | #endif |
---|
[56] | 186 | } |
---|
[1200] | 187 | |
---|
[608] | 188 | resetWpScaling(); |
---|
[2] | 189 | initWpAcDcParam(); |
---|
[1200] | 190 | |
---|
| 191 | for(Int ch=0; ch < MAX_NUM_CHANNEL_TYPE; ch++) |
---|
| 192 | { |
---|
| 193 | m_saoEnabledFlag[ch] = false; |
---|
| 194 | } |
---|
| 195 | #if NH_MV |
---|
[608] | 196 | for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
[210] | 197 | { |
---|
[738] | 198 | m_interLayerPredLayerIdc[ i ] = -1; |
---|
[210] | 199 | } |
---|
| 200 | #endif |
---|
[1200] | 201 | #if NH_3D |
---|
[1124] | 202 | m_iDefaultRefViewIdx = -1; |
---|
| 203 | m_bDefaultRefViewIdxAvailableFlag = false; |
---|
[1179] | 204 | m_ivMvPredFlag = false; |
---|
| 205 | m_ivMvScalingFlag = false; |
---|
| 206 | m_ivResPredFlag = false; |
---|
| 207 | m_depthRefinementFlag = false; |
---|
| 208 | m_viewSynthesisPredFlag = false; |
---|
| 209 | m_depthBasedBlkPartFlag = false; |
---|
| 210 | m_mpiFlag = false; |
---|
| 211 | m_intraContourFlag = false; |
---|
| 212 | m_intraSdcWedgeFlag = false; |
---|
| 213 | m_qtPredFlag = false; |
---|
| 214 | m_interSdcFlag = false; |
---|
| 215 | m_depthIntraSkipFlag = false; |
---|
| 216 | m_subPbSize = 1 << 6; |
---|
| 217 | m_mpiSubPbSize = 1 << 6; |
---|
[1200] | 218 | |
---|
| 219 | m_aaiCodedOffset.resize(2); |
---|
| 220 | m_aaiCodedScale .resize(2); |
---|
| 221 | for (Int i = 0; i < 2; i++) |
---|
| 222 | { |
---|
| 223 | m_aaiCodedOffset[i].resize(MAX_NUM_LAYERS); |
---|
| 224 | m_aaiCodedScale [i].resize(MAX_NUM_LAYERS); |
---|
| 225 | } |
---|
| 226 | |
---|
[1179] | 227 | #endif |
---|
[1200] | 228 | |
---|
[2] | 229 | } |
---|
| 230 | |
---|
| 231 | TComSlice::~TComSlice() |
---|
| 232 | { |
---|
[1200] | 233 | #if NH_3D |
---|
[1179] | 234 | for( UInt i = 0; i < m_numViews; i++ ) |
---|
[56] | 235 | { |
---|
[608] | 236 | if ( m_depthToDisparityB && m_depthToDisparityB[ i ] ) |
---|
[622] | 237 | { |
---|
[608] | 238 | delete[] m_depthToDisparityB [ i ]; |
---|
[622] | 239 | } |
---|
[608] | 240 | |
---|
| 241 | if ( m_depthToDisparityF && m_depthToDisparityF[ i ] ) |
---|
[622] | 242 | { |
---|
[608] | 243 | delete[] m_depthToDisparityF [ i ]; |
---|
[1179] | 244 | } |
---|
[56] | 245 | } |
---|
[608] | 246 | |
---|
| 247 | if ( m_depthToDisparityF ) |
---|
[622] | 248 | { |
---|
[608] | 249 | delete[] m_depthToDisparityF; |
---|
[622] | 250 | } |
---|
[608] | 251 | |
---|
| 252 | m_depthToDisparityF = NULL; |
---|
| 253 | |
---|
| 254 | if ( m_depthToDisparityB ) |
---|
| 255 | delete[] m_depthToDisparityB; |
---|
| 256 | |
---|
| 257 | m_depthToDisparityB = NULL; |
---|
| 258 | #endif |
---|
[1200] | 259 | |
---|
[2] | 260 | } |
---|
| 261 | |
---|
| 262 | |
---|
| 263 | Void TComSlice::initSlice() |
---|
| 264 | { |
---|
[1200] | 265 | for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++) |
---|
| 266 | { |
---|
| 267 | m_aiNumRefIdx[i] = 0; |
---|
| 268 | } |
---|
| 269 | m_colFromL0Flag = true; |
---|
| 270 | |
---|
[56] | 271 | m_colRefIdx = 0; |
---|
[2] | 272 | initEqualRef(); |
---|
[1200] | 273 | |
---|
[56] | 274 | m_bCheckLDC = false; |
---|
| 275 | |
---|
[1200] | 276 | for (UInt component = 0; component < MAX_NUM_COMPONENT; component++) |
---|
| 277 | { |
---|
| 278 | m_iSliceChromaQpDelta[component] = 0; |
---|
| 279 | } |
---|
[608] | 280 | #if H_3D_IV_MERGE |
---|
| 281 | m_maxNumMergeCand = MRG_MAX_NUM_CANDS_MEM; |
---|
| 282 | #else |
---|
| 283 | m_maxNumMergeCand = MRG_MAX_NUM_CANDS; |
---|
| 284 | #endif |
---|
[56] | 285 | |
---|
| 286 | m_bFinalized=false; |
---|
| 287 | |
---|
[1200] | 288 | m_substreamSizes.clear(); |
---|
[56] | 289 | m_cabacInitFlag = false; |
---|
[608] | 290 | m_enableTMVPFlag = true; |
---|
| 291 | #if H_3D_TMVP |
---|
| 292 | m_aiAlterRefIdx[0] = -1; |
---|
| 293 | m_aiAlterRefIdx[1] = -1; |
---|
[56] | 294 | #endif |
---|
[2] | 295 | } |
---|
| 296 | |
---|
[1200] | 297 | Bool TComSlice::getRapPicFlag() const |
---|
[56] | 298 | { |
---|
[608] | 299 | return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL |
---|
| 300 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP |
---|
| 301 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP |
---|
| 302 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 303 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 304 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA; |
---|
[56] | 305 | } |
---|
| 306 | |
---|
| 307 | |
---|
[2] | 308 | Void TComSlice::sortPicList (TComList<TComPic*>& rcListPic) |
---|
| 309 | { |
---|
| 310 | TComPic* pcPicExtract; |
---|
| 311 | TComPic* pcPicInsert; |
---|
[1200] | 312 | |
---|
[2] | 313 | TComList<TComPic*>::iterator iterPicExtract; |
---|
| 314 | TComList<TComPic*>::iterator iterPicExtract_1; |
---|
| 315 | TComList<TComPic*>::iterator iterPicInsert; |
---|
[1200] | 316 | |
---|
[2] | 317 | for (Int i = 1; i < (Int)(rcListPic.size()); i++) |
---|
| 318 | { |
---|
| 319 | iterPicExtract = rcListPic.begin(); |
---|
[1200] | 320 | for (Int j = 0; j < i; j++) |
---|
| 321 | { |
---|
| 322 | iterPicExtract++; |
---|
| 323 | } |
---|
[2] | 324 | pcPicExtract = *(iterPicExtract); |
---|
| 325 | pcPicExtract->setCurrSliceIdx(0); |
---|
[1200] | 326 | |
---|
[2] | 327 | iterPicInsert = rcListPic.begin(); |
---|
| 328 | while (iterPicInsert != iterPicExtract) |
---|
| 329 | { |
---|
| 330 | pcPicInsert = *(iterPicInsert); |
---|
| 331 | pcPicInsert->setCurrSliceIdx(0); |
---|
| 332 | if (pcPicInsert->getPOC() >= pcPicExtract->getPOC()) |
---|
| 333 | { |
---|
| 334 | break; |
---|
| 335 | } |
---|
[1200] | 336 | |
---|
[2] | 337 | iterPicInsert++; |
---|
| 338 | } |
---|
[1200] | 339 | |
---|
[2] | 340 | iterPicExtract_1 = iterPicExtract; iterPicExtract_1++; |
---|
[1200] | 341 | |
---|
[2] | 342 | // swap iterPicExtract and iterPicInsert, iterPicExtract = curr. / iterPicInsert = insertion position |
---|
| 343 | rcListPic.insert (iterPicInsert, iterPicExtract, iterPicExtract_1); |
---|
| 344 | rcListPic.erase (iterPicExtract); |
---|
| 345 | } |
---|
| 346 | } |
---|
| 347 | |
---|
[1200] | 348 | TComPic* TComSlice::xGetRefPic (TComList<TComPic*>& rcListPic, Int poc) |
---|
[2] | 349 | { |
---|
[1200] | 350 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
[56] | 351 | TComPic* pcPic = *(iterPic); |
---|
| 352 | while ( iterPic != rcListPic.end() ) |
---|
[2] | 353 | { |
---|
[608] | 354 | if(pcPic->getPOC() == poc) |
---|
[2] | 355 | { |
---|
[56] | 356 | break; |
---|
[2] | 357 | } |
---|
[56] | 358 | iterPic++; |
---|
| 359 | pcPic = *(iterPic); |
---|
[2] | 360 | } |
---|
[56] | 361 | return pcPic; |
---|
| 362 | } |
---|
[2] | 363 | |
---|
[56] | 364 | |
---|
[608] | 365 | TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb) |
---|
[56] | 366 | { |
---|
[1200] | 367 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
[56] | 368 | TComPic* pcPic = *(iterPic); |
---|
| 369 | TComPic* pcStPic = pcPic; |
---|
[1200] | 370 | |
---|
[608] | 371 | Int pocCycle = 1 << getSPS()->getBitsForPOC(); |
---|
| 372 | if (!pocHasMsb) |
---|
| 373 | { |
---|
[655] | 374 | poc = poc & (pocCycle - 1); |
---|
[608] | 375 | } |
---|
[1200] | 376 | |
---|
[56] | 377 | while ( iterPic != rcListPic.end() ) |
---|
| 378 | { |
---|
| 379 | pcPic = *(iterPic); |
---|
[608] | 380 | if (pcPic && pcPic->getPOC()!=this->getPOC() && pcPic->getSlice( 0 )->isReferenced()) |
---|
[56] | 381 | { |
---|
[608] | 382 | Int picPoc = pcPic->getPOC(); |
---|
| 383 | if (!pocHasMsb) |
---|
| 384 | { |
---|
[655] | 385 | picPoc = picPoc & (pocCycle - 1); |
---|
[608] | 386 | } |
---|
[1200] | 387 | |
---|
[608] | 388 | if (poc == picPoc) |
---|
| 389 | { |
---|
[1200] | 390 | if(pcPic->getIsLongTerm()) |
---|
| 391 | { |
---|
| 392 | return pcPic; |
---|
| 393 | } |
---|
| 394 | else |
---|
| 395 | { |
---|
| 396 | pcStPic = pcPic; |
---|
| 397 | } |
---|
| 398 | break; |
---|
[608] | 399 | } |
---|
[56] | 400 | } |
---|
| 401 | |
---|
| 402 | iterPic++; |
---|
| 403 | } |
---|
[1200] | 404 | |
---|
[56] | 405 | return pcStPic; |
---|
[2] | 406 | } |
---|
| 407 | |
---|
[608] | 408 | Void TComSlice::setRefPOCList () |
---|
[56] | 409 | { |
---|
[1200] | 410 | for (Int iDir = 0; iDir < NUM_REF_PIC_LIST_01; iDir++) |
---|
[56] | 411 | { |
---|
[608] | 412 | for (Int iNumRefIdx = 0; iNumRefIdx < m_aiNumRefIdx[iDir]; iNumRefIdx++) |
---|
[56] | 413 | { |
---|
[608] | 414 | m_aiRefPOCList[iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getPOC(); |
---|
[1200] | 415 | #if NH_MV |
---|
[608] | 416 | m_aiRefLayerIdList[iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getLayerId(); |
---|
| 417 | #endif |
---|
[56] | 418 | } |
---|
| 419 | } |
---|
| 420 | |
---|
| 421 | } |
---|
| 422 | |
---|
[608] | 423 | Void TComSlice::setList1IdxToList0Idx() |
---|
[56] | 424 | { |
---|
[608] | 425 | Int idxL0, idxL1; |
---|
| 426 | for ( idxL1 = 0; idxL1 < getNumRefIdx( REF_PIC_LIST_1 ); idxL1++ ) |
---|
[56] | 427 | { |
---|
[608] | 428 | m_list1IdxToList0Idx[idxL1] = -1; |
---|
| 429 | for ( idxL0 = 0; idxL0 < getNumRefIdx( REF_PIC_LIST_0 ); idxL0++ ) |
---|
[56] | 430 | { |
---|
[608] | 431 | if ( m_apcRefPicList[REF_PIC_LIST_0][idxL0]->getPOC() == m_apcRefPicList[REF_PIC_LIST_1][idxL1]->getPOC() ) |
---|
| 432 | { |
---|
| 433 | m_list1IdxToList0Idx[idxL1] = idxL0; |
---|
| 434 | break; |
---|
| 435 | } |
---|
[56] | 436 | } |
---|
| 437 | } |
---|
| 438 | } |
---|
[872] | 439 | |
---|
[1200] | 440 | #if !NH_MV |
---|
[622] | 441 | Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr ) |
---|
| 442 | { |
---|
| 443 | if (!checkNumPocTotalCurr) |
---|
| 444 | { |
---|
| 445 | if (m_eSliceType == I_SLICE) |
---|
| 446 | { |
---|
| 447 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); |
---|
| 448 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); |
---|
| 449 | |
---|
| 450 | return; |
---|
| 451 | } |
---|
| 452 | |
---|
[1200] | 453 | m_aiNumRefIdx[REF_PIC_LIST_0] = getNumRefIdx(REF_PIC_LIST_0); |
---|
| 454 | m_aiNumRefIdx[REF_PIC_LIST_1] = getNumRefIdx(REF_PIC_LIST_1); |
---|
[622] | 455 | } |
---|
| 456 | |
---|
| 457 | TComPic* pcRefPic= NULL; |
---|
[1200] | 458 | static const UInt MAX_NUM_NEGATIVE_PICTURES=16; |
---|
| 459 | TComPic* RefPicSetStCurr0[MAX_NUM_NEGATIVE_PICTURES]; |
---|
| 460 | TComPic* RefPicSetStCurr1[MAX_NUM_NEGATIVE_PICTURES]; |
---|
| 461 | TComPic* RefPicSetLtCurr[MAX_NUM_NEGATIVE_PICTURES]; |
---|
| 462 | UInt NumPicStCurr0 = 0; |
---|
| 463 | UInt NumPicStCurr1 = 0; |
---|
| 464 | UInt NumPicLtCurr = 0; |
---|
[622] | 465 | Int i; |
---|
| 466 | |
---|
| 467 | for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++) |
---|
| 468 | { |
---|
| 469 | if(m_pcRPS->getUsed(i)) |
---|
| 470 | { |
---|
| 471 | pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); |
---|
| 472 | pcRefPic->setIsLongTerm(0); |
---|
| 473 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
[1200] | 474 | RefPicSetStCurr0[NumPicStCurr0] = pcRefPic; |
---|
| 475 | NumPicStCurr0++; |
---|
| 476 | pcRefPic->setCheckLTMSBPresent(false); |
---|
[622] | 477 | } |
---|
| 478 | } |
---|
| 479 | |
---|
| 480 | for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++) |
---|
| 481 | { |
---|
| 482 | if(m_pcRPS->getUsed(i)) |
---|
| 483 | { |
---|
| 484 | pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); |
---|
| 485 | pcRefPic->setIsLongTerm(0); |
---|
| 486 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
[1200] | 487 | RefPicSetStCurr1[NumPicStCurr1] = pcRefPic; |
---|
| 488 | NumPicStCurr1++; |
---|
| 489 | pcRefPic->setCheckLTMSBPresent(false); |
---|
[622] | 490 | } |
---|
| 491 | } |
---|
| 492 | |
---|
| 493 | for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--) |
---|
| 494 | { |
---|
| 495 | if(m_pcRPS->getUsed(i)) |
---|
| 496 | { |
---|
| 497 | pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 498 | pcRefPic->setIsLongTerm(1); |
---|
| 499 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
[1200] | 500 | RefPicSetLtCurr[NumPicLtCurr] = pcRefPic; |
---|
| 501 | NumPicLtCurr++; |
---|
[622] | 502 | } |
---|
[1200] | 503 | if(pcRefPic==NULL) |
---|
[622] | 504 | { |
---|
| 505 | pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 506 | } |
---|
[1200] | 507 | pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); |
---|
[622] | 508 | } |
---|
| 509 | |
---|
| 510 | // ref_pic_list_init |
---|
| 511 | TComPic* rpsCurrList0[MAX_NUM_REF+1]; |
---|
| 512 | TComPic* rpsCurrList1[MAX_NUM_REF+1]; |
---|
[1200] | 513 | Int numPicTotalCurr = NumPicStCurr0 + NumPicStCurr1 + NumPicLtCurr; |
---|
| 514 | |
---|
[622] | 515 | if (checkNumPocTotalCurr) |
---|
| 516 | { |
---|
| 517 | // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr: |
---|
[964] | 518 | // - If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. |
---|
| 519 | // - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. |
---|
[622] | 520 | if (getRapPicFlag()) |
---|
| 521 | { |
---|
[1200] | 522 | assert(numPicTotalCurr == 0); |
---|
[622] | 523 | } |
---|
| 524 | |
---|
| 525 | if (m_eSliceType == I_SLICE) |
---|
| 526 | { |
---|
| 527 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); |
---|
| 528 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); |
---|
| 529 | |
---|
| 530 | return; |
---|
| 531 | } |
---|
| 532 | |
---|
[1200] | 533 | assert(numPicTotalCurr > 0); |
---|
| 534 | // general tier and level limit: |
---|
| 535 | assert(numPicTotalCurr <= 8); |
---|
[622] | 536 | |
---|
| 537 | m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); |
---|
| 538 | m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); |
---|
| 539 | } |
---|
| 540 | |
---|
| 541 | Int cIdx = 0; |
---|
[1200] | 542 | for ( i=0; i<NumPicStCurr0; i++, cIdx++) |
---|
[622] | 543 | { |
---|
| 544 | rpsCurrList0[cIdx] = RefPicSetStCurr0[i]; |
---|
| 545 | } |
---|
[1200] | 546 | for ( i=0; i<NumPicStCurr1; i++, cIdx++) |
---|
[622] | 547 | { |
---|
| 548 | rpsCurrList0[cIdx] = RefPicSetStCurr1[i]; |
---|
| 549 | } |
---|
[1200] | 550 | for ( i=0; i<NumPicLtCurr; i++, cIdx++) |
---|
[622] | 551 | { |
---|
| 552 | rpsCurrList0[cIdx] = RefPicSetLtCurr[i]; |
---|
| 553 | } |
---|
[1200] | 554 | assert(cIdx == numPicTotalCurr); |
---|
[622] | 555 | |
---|
| 556 | if (m_eSliceType==B_SLICE) |
---|
| 557 | { |
---|
| 558 | cIdx = 0; |
---|
[1200] | 559 | for ( i=0; i<NumPicStCurr1; i++, cIdx++) |
---|
[622] | 560 | { |
---|
| 561 | rpsCurrList1[cIdx] = RefPicSetStCurr1[i]; |
---|
| 562 | } |
---|
[1200] | 563 | for ( i=0; i<NumPicStCurr0; i++, cIdx++) |
---|
[622] | 564 | { |
---|
| 565 | rpsCurrList1[cIdx] = RefPicSetStCurr0[i]; |
---|
| 566 | } |
---|
[1200] | 567 | for ( i=0; i<NumPicLtCurr; i++, cIdx++) |
---|
[622] | 568 | { |
---|
| 569 | rpsCurrList1[cIdx] = RefPicSetLtCurr[i]; |
---|
| 570 | } |
---|
[1200] | 571 | assert(cIdx == numPicTotalCurr); |
---|
[622] | 572 | } |
---|
| 573 | |
---|
| 574 | ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm)); |
---|
| 575 | |
---|
[1200] | 576 | for (Int rIdx = 0; rIdx < m_aiNumRefIdx[REF_PIC_LIST_0]; rIdx ++) |
---|
[622] | 577 | { |
---|
[1200] | 578 | cIdx = m_RefPicListModification.getRefPicListModificationFlagL0() ? m_RefPicListModification.getRefPicSetIdxL0(rIdx) : rIdx % numPicTotalCurr; |
---|
| 579 | assert(cIdx >= 0 && cIdx < numPicTotalCurr); |
---|
| 580 | m_apcRefPicList[REF_PIC_LIST_0][rIdx] = rpsCurrList0[ cIdx ]; |
---|
| 581 | m_bIsUsedAsLongTerm[REF_PIC_LIST_0][rIdx] = ( cIdx >= NumPicStCurr0 + NumPicStCurr1 ); |
---|
[622] | 582 | } |
---|
| 583 | if ( m_eSliceType != B_SLICE ) |
---|
| 584 | { |
---|
[1200] | 585 | m_aiNumRefIdx[REF_PIC_LIST_1] = 0; |
---|
| 586 | ::memset( m_apcRefPicList[REF_PIC_LIST_1], 0, sizeof(m_apcRefPicList[REF_PIC_LIST_1])); |
---|
[622] | 587 | } |
---|
| 588 | else |
---|
| 589 | { |
---|
[1200] | 590 | for (Int rIdx = 0; rIdx < m_aiNumRefIdx[REF_PIC_LIST_1]; rIdx ++) |
---|
[622] | 591 | { |
---|
[1200] | 592 | cIdx = m_RefPicListModification.getRefPicListModificationFlagL1() ? m_RefPicListModification.getRefPicSetIdxL1(rIdx) : rIdx % numPicTotalCurr; |
---|
| 593 | assert(cIdx >= 0 && cIdx < numPicTotalCurr); |
---|
| 594 | m_apcRefPicList[REF_PIC_LIST_1][rIdx] = rpsCurrList1[ cIdx ]; |
---|
| 595 | m_bIsUsedAsLongTerm[REF_PIC_LIST_1][rIdx] = ( cIdx >= NumPicStCurr0 + NumPicStCurr1 ); |
---|
[622] | 596 | } |
---|
| 597 | } |
---|
| 598 | } |
---|
| 599 | #else |
---|
| 600 | Void TComSlice::getTempRefPicLists( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1, |
---|
| 601 | std::vector<TComPic*> rpsCurrList[2], std::vector<Bool> usedAsLongTerm[2], Int& numPocTotalCurr, Bool checkNumPocTotalCurr ) |
---|
| 602 | { |
---|
| 603 | if (!checkNumPocTotalCurr) |
---|
| 604 | { |
---|
| 605 | if (m_eSliceType == I_SLICE) |
---|
| 606 | { |
---|
| 607 | return; |
---|
| 608 | } |
---|
| 609 | } |
---|
| 610 | |
---|
| 611 | TComPic* pcRefPic= NULL; |
---|
| 612 | TComPic* RefPicSetStCurr0[16]; |
---|
| 613 | TComPic* RefPicSetStCurr1[16]; |
---|
| 614 | TComPic* RefPicSetLtCurr[16]; |
---|
| 615 | UInt NumPocStCurr0 = 0; |
---|
| 616 | UInt NumPocStCurr1 = 0; |
---|
| 617 | UInt NumPocLtCurr = 0; |
---|
| 618 | Int i; |
---|
[1200] | 619 | #if NH_3D |
---|
[1179] | 620 | m_pocsInCurrRPSs.clear(); |
---|
| 621 | #endif |
---|
[622] | 622 | for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++) |
---|
| 623 | { |
---|
| 624 | if(m_pcRPS->getUsed(i)) |
---|
| 625 | { |
---|
| 626 | pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); |
---|
| 627 | pcRefPic->setIsLongTerm(0); |
---|
| 628 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 629 | RefPicSetStCurr0[NumPocStCurr0] = pcRefPic; |
---|
| 630 | NumPocStCurr0++; |
---|
| 631 | pcRefPic->setCheckLTMSBPresent(false); |
---|
[1200] | 632 | #if NH_3D |
---|
[1179] | 633 | m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() ); |
---|
| 634 | #endif |
---|
[622] | 635 | } |
---|
| 636 | } |
---|
| 637 | |
---|
| 638 | for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++) |
---|
| 639 | { |
---|
| 640 | if(m_pcRPS->getUsed(i)) |
---|
| 641 | { |
---|
| 642 | pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); |
---|
| 643 | pcRefPic->setIsLongTerm(0); |
---|
| 644 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 645 | RefPicSetStCurr1[NumPocStCurr1] = pcRefPic; |
---|
| 646 | NumPocStCurr1++; |
---|
| 647 | pcRefPic->setCheckLTMSBPresent(false); |
---|
[1200] | 648 | #if NH_3D |
---|
[1179] | 649 | m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() ); |
---|
| 650 | #endif |
---|
[622] | 651 | } |
---|
| 652 | } |
---|
| 653 | |
---|
| 654 | for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--) |
---|
| 655 | { |
---|
| 656 | if(m_pcRPS->getUsed(i)) |
---|
| 657 | { |
---|
| 658 | pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 659 | pcRefPic->setIsLongTerm(1); |
---|
| 660 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 661 | RefPicSetLtCurr[NumPocLtCurr] = pcRefPic; |
---|
| 662 | NumPocLtCurr++; |
---|
[1200] | 663 | #if NH_3D |
---|
[1179] | 664 | m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() ); |
---|
| 665 | #endif |
---|
[622] | 666 | } |
---|
| 667 | if(pcRefPic==NULL) |
---|
| 668 | { |
---|
| 669 | pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 670 | } |
---|
| 671 | pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 672 | } |
---|
| 673 | |
---|
| 674 | Int numPocInterCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; |
---|
[1200] | 675 | #if NH_3D |
---|
[1179] | 676 | assert( numPocInterCurr == (Int) m_pocsInCurrRPSs.size() ); |
---|
| 677 | #endif |
---|
[622] | 678 | numPocTotalCurr = numPocInterCurr + getNumActiveRefLayerPics( ); |
---|
| 679 | assert( numPocTotalCurr == getNumRpsCurrTempList() ); |
---|
| 680 | |
---|
| 681 | if (checkNumPocTotalCurr) |
---|
| 682 | { |
---|
| 683 | // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr: |
---|
| 684 | // - If nuh_layer_id is equal to 0 and the current picture is a BLA picture or a CRA picture, the value of NumPocTotalCurr shall be equal to 0. |
---|
| 685 | // - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. |
---|
| 686 | if ( getRapPicFlag() && m_layerId == 0 ) |
---|
| 687 | { |
---|
| 688 | assert(numPocTotalCurr == 0); |
---|
| 689 | } |
---|
| 690 | |
---|
| 691 | if (m_eSliceType == I_SLICE) |
---|
| 692 | { |
---|
| 693 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); |
---|
| 694 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); |
---|
| 695 | |
---|
| 696 | return; |
---|
| 697 | } |
---|
| 698 | |
---|
| 699 | assert(numPocTotalCurr > 0); |
---|
| 700 | |
---|
| 701 | m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); |
---|
| 702 | m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); |
---|
| 703 | } |
---|
| 704 | |
---|
| 705 | std::vector<TComPic*>* refPicSetInterLayer[2] = { &refPicSetInterLayer0, &refPicSetInterLayer1}; |
---|
| 706 | Int numPocInterLayer[2] = { getNumActiveRefLayerPics0( ), getNumActiveRefLayerPics1( ) }; |
---|
| 707 | |
---|
| 708 | TComPic** refPicSetStCurr [2] = { RefPicSetStCurr0, RefPicSetStCurr1 }; |
---|
[1039] | 709 | Int numPocStCurr[2] = { (Int)NumPocStCurr0, (Int)NumPocStCurr1 }; |
---|
[622] | 710 | |
---|
| 711 | for (Int li = 0; li < ((m_eSliceType==B_SLICE) ? 2 : 1); li++) |
---|
| 712 | { |
---|
| 713 | rpsCurrList [li].resize(MAX_NUM_REF+1,NULL ); |
---|
| 714 | usedAsLongTerm[li].resize(MAX_NUM_REF+1,false); |
---|
| 715 | |
---|
| 716 | Int cIdx = 0; |
---|
| 717 | for ( i=0; i < numPocStCurr[li]; i++, cIdx++) |
---|
| 718 | { |
---|
| 719 | rpsCurrList[li][cIdx] = refPicSetStCurr[li][i]; |
---|
| 720 | usedAsLongTerm [li][cIdx] = false; |
---|
| 721 | } |
---|
| 722 | |
---|
| 723 | for ( i=0; i < numPocInterLayer[li]; i++, cIdx++) |
---|
| 724 | { |
---|
| 725 | rpsCurrList[li][cIdx] = (*refPicSetInterLayer[li])[i]; |
---|
| 726 | usedAsLongTerm [li][cIdx] = true; |
---|
| 727 | } |
---|
| 728 | |
---|
| 729 | for ( i=0; i < numPocStCurr[1-li]; i++, cIdx++) |
---|
| 730 | { |
---|
| 731 | rpsCurrList[li][cIdx] = refPicSetStCurr[1-li][i]; |
---|
| 732 | usedAsLongTerm [li][cIdx] = false; |
---|
| 733 | } |
---|
| 734 | |
---|
| 735 | for ( i=0; i<NumPocLtCurr; i++, cIdx++) |
---|
| 736 | { |
---|
| 737 | rpsCurrList[li][cIdx] = RefPicSetLtCurr[i]; |
---|
| 738 | usedAsLongTerm [li][cIdx] = true; |
---|
| 739 | } |
---|
| 740 | |
---|
| 741 | for ( i=0; i < numPocInterLayer[1-li]; i++, cIdx++) |
---|
| 742 | { |
---|
| 743 | assert( cIdx < MAX_NUM_REF ); |
---|
| 744 | rpsCurrList[li][cIdx] = (*refPicSetInterLayer[1-li])[i]; |
---|
| 745 | usedAsLongTerm [li][cIdx] = true; |
---|
| 746 | } |
---|
| 747 | |
---|
| 748 | assert(cIdx == numPocTotalCurr); |
---|
| 749 | } |
---|
| 750 | } |
---|
| 751 | |
---|
| 752 | Void TComSlice::setRefPicList( std::vector<TComPic*> rpsCurrList[2], std::vector<Bool> usedAsLongTerm[2], Int numPocTotalCurr, Bool checkNumPocTotalCurr ) |
---|
| 753 | |
---|
| 754 | { |
---|
| 755 | if (!checkNumPocTotalCurr) |
---|
| 756 | { |
---|
| 757 | if (m_eSliceType == I_SLICE) |
---|
| 758 | { |
---|
| 759 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); |
---|
| 760 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); |
---|
| 761 | |
---|
| 762 | return; |
---|
| 763 | } |
---|
| 764 | } |
---|
| 765 | |
---|
| 766 | ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm)); |
---|
| 767 | |
---|
| 768 | for (Int li = 0; li < 2; li++) |
---|
| 769 | { |
---|
| 770 | if ( m_eSliceType == P_SLICE && li == 1 ) |
---|
| 771 | { |
---|
| 772 | m_aiNumRefIdx[1] = 0; |
---|
| 773 | ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1])); |
---|
| 774 | } |
---|
| 775 | else |
---|
| 776 | { |
---|
| 777 | for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[ li ] - 1 ); rIdx ++) |
---|
| 778 | { |
---|
| 779 | Bool listModified = m_RefPicListModification.getRefPicListModificationFlagL( li ); |
---|
| 780 | Int orgIdx = listModified ? m_RefPicListModification.getRefPicSetIdxL(li, rIdx) : (rIdx % numPocTotalCurr); |
---|
| 781 | |
---|
| 782 | assert( rpsCurrList[li][ orgIdx ] != NULL ); |
---|
[1066] | 783 | assert( rpsCurrList[li][ orgIdx ]->getSlice(0)->getDiscardableFlag() == 0 ); // Inter-layer RPS shall not contain picture with discardable_flag = 1. |
---|
[622] | 784 | m_apcRefPicList [li][rIdx] = rpsCurrList [li][ orgIdx ]; |
---|
| 785 | m_bIsUsedAsLongTerm[li][rIdx] = usedAsLongTerm [li][ orgIdx ] ; |
---|
| 786 | } |
---|
| 787 | } |
---|
| 788 | } |
---|
| 789 | } |
---|
| 790 | #endif |
---|
[1200] | 791 | |
---|
| 792 | Int TComSlice::getNumRpsCurrTempList() const |
---|
[608] | 793 | { |
---|
| 794 | Int numRpsCurrTempList = 0; |
---|
| 795 | |
---|
[1200] | 796 | if (m_eSliceType == I_SLICE) |
---|
[608] | 797 | { |
---|
| 798 | return 0; |
---|
| 799 | } |
---|
| 800 | for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++) |
---|
| 801 | { |
---|
| 802 | if(m_pcRPS->getUsed(i)) |
---|
| 803 | { |
---|
| 804 | numRpsCurrTempList++; |
---|
[2] | 805 | } |
---|
| 806 | } |
---|
[1200] | 807 | #if NH_MV |
---|
[608] | 808 | numRpsCurrTempList = numRpsCurrTempList + getNumActiveRefLayerPics(); |
---|
| 809 | #endif |
---|
| 810 | return numRpsCurrTempList; |
---|
[2] | 811 | } |
---|
| 812 | |
---|
| 813 | Void TComSlice::initEqualRef() |
---|
| 814 | { |
---|
[1200] | 815 | for (Int iDir = 0; iDir < NUM_REF_PIC_LIST_01; iDir++) |
---|
[2] | 816 | { |
---|
| 817 | for (Int iRefIdx1 = 0; iRefIdx1 < MAX_NUM_REF; iRefIdx1++) |
---|
| 818 | { |
---|
| 819 | for (Int iRefIdx2 = iRefIdx1; iRefIdx2 < MAX_NUM_REF; iRefIdx2++) |
---|
| 820 | { |
---|
| 821 | m_abEqualRef[iDir][iRefIdx1][iRefIdx2] = m_abEqualRef[iDir][iRefIdx2][iRefIdx1] = (iRefIdx1 == iRefIdx2? true : false); |
---|
| 822 | } |
---|
| 823 | } |
---|
| 824 | } |
---|
| 825 | } |
---|
[608] | 826 | #if H_3D |
---|
| 827 | #if H_3D_TMVP |
---|
| 828 | Void TComSlice::generateAlterRefforTMVP() |
---|
| 829 | { |
---|
| 830 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
| 831 | { |
---|
| 832 | if ( this->getNumRefIdx( RefPicList( uiRefListIdx ) ) == 0) |
---|
[773] | 833 | { |
---|
[608] | 834 | continue; |
---|
[773] | 835 | } |
---|
[608] | 836 | Bool bZeroIdxLtFlag = this->getRefPic(RefPicList(uiRefListIdx), 0)->getIsLongTerm(); |
---|
| 837 | for(Int i = 1; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ ) |
---|
[2] | 838 | { |
---|
[608] | 839 | if ( ( bZeroIdxLtFlag && !this->getRefPic(RefPicList(uiRefListIdx), i)->getIsLongTerm() ) || |
---|
| 840 | (!bZeroIdxLtFlag && this->getRefPic(RefPicList(uiRefListIdx), i)->getIsLongTerm() ) ) |
---|
| 841 | { |
---|
| 842 | this->setAlterRefIdx(RefPicList(uiRefListIdx),i); |
---|
| 843 | break; |
---|
| 844 | } |
---|
[2] | 845 | } |
---|
| 846 | } |
---|
| 847 | } |
---|
[608] | 848 | #endif |
---|
[1200] | 849 | #endif |
---|
| 850 | |
---|
| 851 | #if NH_3D |
---|
[608] | 852 | Void TComSlice::setCamparaSlice( Int** aaiScale, Int** aaiOffset ) |
---|
| 853 | { |
---|
[1179] | 854 | Int voiInVps = m_pcVPS->getVoiInVps(getViewIndex() ); |
---|
| 855 | if( m_pcVPS->getNumCp( voiInVps ) > 0 ) |
---|
| 856 | { |
---|
| 857 | if( m_pcVPS->getCpInSliceSegmentHeaderFlag( voiInVps ) ) |
---|
| 858 | { |
---|
| 859 | for( Int m = 0; m < m_pcVPS->getNumCp( voiInVps ); m++ ) |
---|
| 860 | { |
---|
| 861 | Int j = m_pcVPS->getCpRefVoi( voiInVps, m ); |
---|
| 862 | Int jInVps = m_pcVPS->getVoiInVps( j ); |
---|
| 863 | |
---|
| 864 | setCpScale ( jInVps , aaiScale [ jInVps ][ voiInVps ]); |
---|
| 865 | setCpInvScale( jInVps , aaiScale [ voiInVps ][ jInVps ]); |
---|
| 866 | setCpOff ( jInVps , aaiOffset[ jInVps ][ voiInVps ]); |
---|
| 867 | setCpInvOff ( jInVps , aaiOffset[ voiInVps ][ jInVps ]); |
---|
| 868 | } |
---|
| 869 | } |
---|
| 870 | } |
---|
[608] | 871 | } |
---|
| 872 | #endif |
---|
[2] | 873 | |
---|
[56] | 874 | Void TComSlice::checkColRefIdx(UInt curSliceIdx, TComPic* pic) |
---|
| 875 | { |
---|
| 876 | Int i; |
---|
| 877 | TComSlice* curSlice = pic->getSlice(curSliceIdx); |
---|
[1200] | 878 | Int currColRefPOC = curSlice->getRefPOC( RefPicList(1 - curSlice->getColFromL0Flag()), curSlice->getColRefIdx()); |
---|
[56] | 879 | TComSlice* preSlice; |
---|
| 880 | Int preColRefPOC; |
---|
| 881 | for(i=curSliceIdx-1; i>=0; i--) |
---|
| 882 | { |
---|
| 883 | preSlice = pic->getSlice(i); |
---|
| 884 | if(preSlice->getSliceType() != I_SLICE) |
---|
| 885 | { |
---|
[1200] | 886 | preColRefPOC = preSlice->getRefPOC( RefPicList(1 - preSlice->getColFromL0Flag()), preSlice->getColRefIdx()); |
---|
[56] | 887 | if(currColRefPOC != preColRefPOC) |
---|
| 888 | { |
---|
| 889 | printf("Collocated_ref_idx shall always be the same for all slices of a coded picture!\n"); |
---|
| 890 | exit(EXIT_FAILURE); |
---|
| 891 | } |
---|
| 892 | else |
---|
| 893 | { |
---|
| 894 | break; |
---|
| 895 | } |
---|
| 896 | } |
---|
| 897 | } |
---|
| 898 | } |
---|
[608] | 899 | |
---|
[1200] | 900 | Void TComSlice::checkCRA(const TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic) |
---|
[56] | 901 | { |
---|
| 902 | for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++) |
---|
| 903 | { |
---|
| 904 | if(pocCRA < MAX_UINT && getPOC() > pocCRA) |
---|
| 905 | { |
---|
| 906 | assert(getPOC()+pReferencePictureSet->getDeltaPOC(i) >= pocCRA); |
---|
| 907 | } |
---|
| 908 | } |
---|
| 909 | for(Int i = pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i < pReferencePictureSet->getNumberOfPictures(); i++) |
---|
| 910 | { |
---|
| 911 | if(pocCRA < MAX_UINT && getPOC() > pocCRA) |
---|
| 912 | { |
---|
[608] | 913 | if (!pReferencePictureSet->getCheckLTMSBPresent(i)) |
---|
| 914 | { |
---|
| 915 | assert(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() >= pocCRA); |
---|
| 916 | } |
---|
| 917 | else |
---|
| 918 | { |
---|
[1200] | 919 | assert(pReferencePictureSet->getPOC(i) >= pocCRA); |
---|
| 920 | } |
---|
[56] | 921 | } |
---|
| 922 | } |
---|
[608] | 923 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found |
---|
[56] | 924 | { |
---|
| 925 | pocCRA = getPOC(); |
---|
[655] | 926 | associatedIRAPType = getNalUnitType(); |
---|
[56] | 927 | } |
---|
[608] | 928 | else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found |
---|
| 929 | { |
---|
| 930 | pocCRA = getPOC(); |
---|
[655] | 931 | associatedIRAPType = getNalUnitType(); |
---|
[608] | 932 | } |
---|
| 933 | else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 934 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 935 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) // BLA picture found |
---|
| 936 | { |
---|
| 937 | pocCRA = getPOC(); |
---|
[655] | 938 | associatedIRAPType = getNalUnitType(); |
---|
[608] | 939 | } |
---|
[56] | 940 | } |
---|
[2] | 941 | |
---|
[608] | 942 | /** Function for marking the reference pictures when an IDR/CRA/CRANT/BLA/BLANT is encountered. |
---|
| 943 | * \param pocCRA POC of the CRA/CRANT/BLA/BLANT picture |
---|
[2] | 944 | * \param bRefreshPending flag indicating if a deferred decoding refresh is pending |
---|
| 945 | * \param rcListPic reference to the reference picture list |
---|
| 946 | * This function marks the reference pictures as "unused for reference" in the following conditions. |
---|
[1200] | 947 | * If the nal_unit_type is IDR/BLA/BLANT, all pictures in the reference picture list |
---|
[608] | 948 | * are marked as "unused for reference" |
---|
| 949 | * If the nal_unit_type is BLA/BLANT, set the pocCRA to the temporal reference of the current picture. |
---|
| 950 | * Otherwise |
---|
[1200] | 951 | * If the bRefreshPending flag is true (a deferred decoding refresh is pending) and the current |
---|
| 952 | * temporal reference is greater than the temporal reference of the latest CRA/CRANT/BLA/BLANT picture (pocCRA), |
---|
| 953 | * mark all reference pictures except the latest CRA/CRANT/BLA/BLANT picture as "unused for reference" and set |
---|
[2] | 954 | * the bRefreshPending flag to false. |
---|
[1200] | 955 | * If the nal_unit_type is CRA/CRANT, set the bRefreshPending flag to true and pocCRA to the temporal |
---|
[2] | 956 | * reference of the current picture. |
---|
| 957 | * Note that the current picture is already placed in the reference list and its marking is not changed. |
---|
| 958 | * If the current picture has a nal_ref_idc that is not 0, it will remain marked as "used for reference". |
---|
| 959 | */ |
---|
[1200] | 960 | Void TComSlice::decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic, const bool bEfficientFieldIRAPEnabled) |
---|
[2] | 961 | { |
---|
[1200] | 962 | TComPic* rpcPic; |
---|
| 963 | Int pocCurr = getPOC(); |
---|
[2] | 964 | |
---|
[608] | 965 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 966 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 967 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP |
---|
| 968 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL |
---|
| 969 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR or BLA picture |
---|
[2] | 970 | { |
---|
| 971 | // mark all pictures as not used for reference |
---|
| 972 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 973 | while (iterPic != rcListPic.end()) |
---|
| 974 | { |
---|
| 975 | rpcPic = *(iterPic); |
---|
| 976 | rpcPic->setCurrSliceIdx(0); |
---|
[1200] | 977 | if (rpcPic->getPOC() != pocCurr) |
---|
| 978 | { |
---|
| 979 | rpcPic->getSlice(0)->setReferenced(false); |
---|
| 980 | } |
---|
[2] | 981 | iterPic++; |
---|
| 982 | } |
---|
[608] | 983 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 984 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 985 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) |
---|
| 986 | { |
---|
| 987 | pocCRA = pocCurr; |
---|
| 988 | } |
---|
[1200] | 989 | if (bEfficientFieldIRAPEnabled) |
---|
| 990 | { |
---|
[964] | 991 | bRefreshPending = true; |
---|
[1200] | 992 | } |
---|
[2] | 993 | } |
---|
[56] | 994 | else // CRA or No DR |
---|
[2] | 995 | { |
---|
[1200] | 996 | if(bEfficientFieldIRAPEnabled && (getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL)) |
---|
[964] | 997 | { |
---|
| 998 | if (bRefreshPending==true && pocCurr > m_iLastIDR) // IDR reference marking pending |
---|
| 999 | { |
---|
| 1000 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1001 | while (iterPic != rcListPic.end()) |
---|
| 1002 | { |
---|
| 1003 | rpcPic = *(iterPic); |
---|
| 1004 | if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != m_iLastIDR) |
---|
| 1005 | { |
---|
| 1006 | rpcPic->getSlice(0)->setReferenced(false); |
---|
| 1007 | } |
---|
| 1008 | iterPic++; |
---|
| 1009 | } |
---|
| 1010 | bRefreshPending = false; |
---|
| 1011 | } |
---|
| 1012 | } |
---|
| 1013 | else |
---|
| 1014 | { |
---|
[1200] | 1015 | if (bRefreshPending==true && pocCurr > pocCRA) // CRA reference marking pending |
---|
[2] | 1016 | { |
---|
[1200] | 1017 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1018 | while (iterPic != rcListPic.end()) |
---|
[608] | 1019 | { |
---|
[1200] | 1020 | rpcPic = *(iterPic); |
---|
| 1021 | if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) |
---|
| 1022 | { |
---|
| 1023 | rpcPic->getSlice(0)->setReferenced(false); |
---|
| 1024 | } |
---|
| 1025 | iterPic++; |
---|
[608] | 1026 | } |
---|
[1200] | 1027 | bRefreshPending = false; |
---|
[2] | 1028 | } |
---|
| 1029 | } |
---|
[608] | 1030 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found |
---|
[2] | 1031 | { |
---|
[1200] | 1032 | bRefreshPending = true; |
---|
[608] | 1033 | pocCRA = pocCurr; |
---|
[2] | 1034 | } |
---|
| 1035 | } |
---|
| 1036 | } |
---|
| 1037 | |
---|
| 1038 | Void TComSlice::copySliceInfo(TComSlice *pSrc) |
---|
| 1039 | { |
---|
| 1040 | assert( pSrc != NULL ); |
---|
| 1041 | |
---|
| 1042 | Int i, j, k; |
---|
| 1043 | |
---|
| 1044 | m_iPOC = pSrc->m_iPOC; |
---|
[608] | 1045 | m_eNalUnitType = pSrc->m_eNalUnitType; |
---|
[1200] | 1046 | #if NH_MV |
---|
[608] | 1047 | m_layerId = pSrc->m_layerId; |
---|
| 1048 | // GT: Copying of several other values might be be missing here, or is above not necessary? |
---|
[21] | 1049 | #endif |
---|
[2] | 1050 | m_eSliceType = pSrc->m_eSliceType; |
---|
| 1051 | m_iSliceQp = pSrc->m_iSliceQp; |
---|
[56] | 1052 | #if ADAPTIVE_QP_SELECTION |
---|
| 1053 | m_iSliceQpBase = pSrc->m_iSliceQpBase; |
---|
| 1054 | #endif |
---|
[1200] | 1055 | m_ChromaQpAdjEnabled = pSrc->m_ChromaQpAdjEnabled; |
---|
[608] | 1056 | m_deblockingFilterDisable = pSrc->m_deblockingFilterDisable; |
---|
| 1057 | m_deblockingFilterOverrideFlag = pSrc->m_deblockingFilterOverrideFlag; |
---|
| 1058 | m_deblockingFilterBetaOffsetDiv2 = pSrc->m_deblockingFilterBetaOffsetDiv2; |
---|
| 1059 | m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2; |
---|
[1200] | 1060 | |
---|
| 1061 | for (i = 0; i < NUM_REF_PIC_LIST_01; i++) |
---|
[2] | 1062 | { |
---|
| 1063 | m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i]; |
---|
| 1064 | } |
---|
| 1065 | |
---|
[608] | 1066 | for (i = 0; i < MAX_NUM_REF; i++) |
---|
| 1067 | { |
---|
| 1068 | m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i]; |
---|
[1200] | 1069 | } |
---|
| 1070 | |
---|
[608] | 1071 | m_bCheckLDC = pSrc->m_bCheckLDC; |
---|
| 1072 | m_iSliceQpDelta = pSrc->m_iSliceQpDelta; |
---|
[1200] | 1073 | for (UInt component = 0; component < MAX_NUM_COMPONENT; component++) |
---|
[2] | 1074 | { |
---|
[1200] | 1075 | m_iSliceChromaQpDelta[component] = pSrc->m_iSliceChromaQpDelta[component]; |
---|
| 1076 | } |
---|
| 1077 | for (i = 0; i < NUM_REF_PIC_LIST_01; i++) |
---|
| 1078 | { |
---|
[608] | 1079 | for (j = 0; j < MAX_NUM_REF; j++) |
---|
[2] | 1080 | { |
---|
[608] | 1081 | m_apcRefPicList[i][j] = pSrc->m_apcRefPicList[i][j]; |
---|
| 1082 | m_aiRefPOCList[i][j] = pSrc->m_aiRefPOCList[i][j]; |
---|
[1200] | 1083 | m_bIsUsedAsLongTerm[i][j] = pSrc->m_bIsUsedAsLongTerm[i][j]; |
---|
| 1084 | #if NH_MV |
---|
[608] | 1085 | m_aiRefLayerIdList[i][j] = pSrc->m_aiRefLayerIdList[i][j]; |
---|
| 1086 | #endif |
---|
[2] | 1087 | } |
---|
[1200] | 1088 | m_bIsUsedAsLongTerm[i][MAX_NUM_REF] = pSrc->m_bIsUsedAsLongTerm[i][MAX_NUM_REF]; |
---|
[2] | 1089 | } |
---|
| 1090 | m_iDepth = pSrc->m_iDepth; |
---|
| 1091 | |
---|
| 1092 | // referenced slice |
---|
| 1093 | m_bRefenced = pSrc->m_bRefenced; |
---|
| 1094 | |
---|
| 1095 | // access channel |
---|
[1200] | 1096 | #if NH_MV |
---|
[608] | 1097 | m_pcVPS = pSrc->m_pcVPS; |
---|
| 1098 | #endif |
---|
[56] | 1099 | m_pcRPS = pSrc->m_pcRPS; |
---|
| 1100 | m_iLastIDR = pSrc->m_iLastIDR; |
---|
| 1101 | |
---|
[2] | 1102 | m_pcPic = pSrc->m_pcPic; |
---|
| 1103 | |
---|
[608] | 1104 | m_colFromL0Flag = pSrc->m_colFromL0Flag; |
---|
[56] | 1105 | m_colRefIdx = pSrc->m_colRefIdx; |
---|
[1200] | 1106 | |
---|
[872] | 1107 | setLambdas(pSrc->getLambdas()); |
---|
[1200] | 1108 | |
---|
| 1109 | for (i = 0; i < NUM_REF_PIC_LIST_01; i++) |
---|
[2] | 1110 | { |
---|
| 1111 | for (j = 0; j < MAX_NUM_REF; j++) |
---|
| 1112 | { |
---|
| 1113 | for (k =0; k < MAX_NUM_REF; k++) |
---|
| 1114 | { |
---|
| 1115 | m_abEqualRef[i][j][k] = pSrc->m_abEqualRef[i][j][k]; |
---|
| 1116 | } |
---|
| 1117 | } |
---|
| 1118 | } |
---|
| 1119 | |
---|
[56] | 1120 | m_uiTLayer = pSrc->m_uiTLayer; |
---|
| 1121 | m_bTLayerSwitchingFlag = pSrc->m_bTLayerSwitchingFlag; |
---|
| 1122 | |
---|
[1200] | 1123 | m_sliceMode = pSrc->m_sliceMode; |
---|
| 1124 | m_sliceArgument = pSrc->m_sliceArgument; |
---|
| 1125 | m_sliceCurStartCtuTsAddr = pSrc->m_sliceCurStartCtuTsAddr; |
---|
| 1126 | m_sliceCurEndCtuTsAddr = pSrc->m_sliceCurEndCtuTsAddr; |
---|
| 1127 | m_sliceIdx = pSrc->m_sliceIdx; |
---|
| 1128 | m_sliceSegmentMode = pSrc->m_sliceSegmentMode; |
---|
| 1129 | m_sliceSegmentArgument = pSrc->m_sliceSegmentArgument; |
---|
| 1130 | m_sliceSegmentCurStartCtuTsAddr = pSrc->m_sliceSegmentCurStartCtuTsAddr; |
---|
| 1131 | m_sliceSegmentCurEndCtuTsAddr = pSrc->m_sliceSegmentCurEndCtuTsAddr; |
---|
| 1132 | m_nextSlice = pSrc->m_nextSlice; |
---|
| 1133 | m_nextSliceSegment = pSrc->m_nextSliceSegment; |
---|
| 1134 | |
---|
| 1135 | for ( UInt e=0 ; e<NUM_REF_PIC_LIST_01 ; e++ ) |
---|
[608] | 1136 | { |
---|
[1200] | 1137 | for ( UInt n=0 ; n<MAX_NUM_REF ; n++ ) |
---|
[608] | 1138 | { |
---|
[1200] | 1139 | memcpy(m_weightPredTable[e][n], pSrc->m_weightPredTable[e][n], sizeof(WPScalingParam)*MAX_NUM_COMPONENT ); |
---|
[608] | 1140 | } |
---|
| 1141 | } |
---|
[56] | 1142 | |
---|
[1200] | 1143 | for( UInt ch = 0 ; ch < MAX_NUM_CHANNEL_TYPE; ch++) |
---|
| 1144 | { |
---|
| 1145 | m_saoEnabledFlag[ch] = pSrc->m_saoEnabledFlag[ch]; |
---|
| 1146 | } |
---|
| 1147 | |
---|
| 1148 | m_cabacInitFlag = pSrc->m_cabacInitFlag; |
---|
| 1149 | |
---|
| 1150 | m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero; |
---|
| 1151 | m_LFCrossSliceBoundaryFlag = pSrc->m_LFCrossSliceBoundaryFlag; |
---|
[608] | 1152 | m_enableTMVPFlag = pSrc->m_enableTMVPFlag; |
---|
| 1153 | m_maxNumMergeCand = pSrc->m_maxNumMergeCand; |
---|
[1200] | 1154 | m_encCABACTableIdx = pSrc->m_encCABACTableIdx; |
---|
[608] | 1155 | |
---|
[1200] | 1156 | #if NH_MV |
---|
[608] | 1157 | // Additional slice header syntax elements |
---|
[872] | 1158 | #if !H_MV_HLS7_GEN |
---|
[622] | 1159 | m_pocResetFlag = pSrc->m_pocResetFlag; |
---|
[872] | 1160 | #endif |
---|
[608] | 1161 | m_discardableFlag = pSrc->m_discardableFlag; |
---|
| 1162 | m_interLayerPredEnabledFlag = pSrc->m_interLayerPredEnabledFlag; |
---|
| 1163 | m_numInterLayerRefPicsMinus1 = pSrc->m_numInterLayerRefPicsMinus1; |
---|
| 1164 | |
---|
| 1165 | for (Int layer = 0; layer < MAX_NUM_LAYERS; layer++ ) |
---|
| 1166 | { |
---|
| 1167 | m_interLayerPredLayerIdc[ layer ] = pSrc->m_interLayerPredLayerIdc[ layer ]; |
---|
| 1168 | } |
---|
| 1169 | #endif |
---|
[1196] | 1170 | #if H_3D |
---|
[1179] | 1171 | m_bApplyDIS = pSrc->m_bApplyDIS; |
---|
[1039] | 1172 | #endif |
---|
[608] | 1173 | #if H_3D_IC |
---|
[443] | 1174 | m_bApplyIC = pSrc->m_bApplyIC; |
---|
| 1175 | m_icSkipParseFlag = pSrc->m_icSkipParseFlag; |
---|
| 1176 | #endif |
---|
[1200] | 1177 | |
---|
[2] | 1178 | } |
---|
| 1179 | |
---|
[608] | 1180 | |
---|
[56] | 1181 | /** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag. |
---|
| 1182 | * \param uiTLayer Temporal layer ID of the current slice |
---|
[1200] | 1183 | * The decoder calls this function to set temporal_layer_switching_point_flag for each temporal layer based on |
---|
| 1184 | * the SPS's temporal_id_nesting_flag and the parsed PPS. Then, current slice's temporal layer ID and |
---|
[56] | 1185 | * temporal_layer_switching_point_flag is set accordingly. |
---|
| 1186 | */ |
---|
| 1187 | Void TComSlice::setTLayerInfo( UInt uiTLayer ) |
---|
[2] | 1188 | { |
---|
[56] | 1189 | m_uiTLayer = uiTLayer; |
---|
[2] | 1190 | } |
---|
| 1191 | |
---|
[56] | 1192 | /** Function for checking if this is a switching-point |
---|
| 1193 | */ |
---|
[1200] | 1194 | Bool TComSlice::isTemporalLayerSwitchingPoint(TComList<TComPic*>& rcListPic) |
---|
[2] | 1195 | { |
---|
[56] | 1196 | TComPic* rpcPic; |
---|
| 1197 | // loop through all pictures in the reference picture buffer |
---|
| 1198 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1199 | while ( iterPic != rcListPic.end()) |
---|
| 1200 | { |
---|
| 1201 | rpcPic = *(iterPic++); |
---|
| 1202 | if(rpcPic->getSlice(0)->isReferenced() && rpcPic->getPOC() != getPOC()) |
---|
| 1203 | { |
---|
| 1204 | if(rpcPic->getTLayer() >= getTLayer()) |
---|
| 1205 | { |
---|
| 1206 | return false; |
---|
| 1207 | } |
---|
| 1208 | } |
---|
| 1209 | } |
---|
| 1210 | return true; |
---|
| 1211 | } |
---|
| 1212 | |
---|
[1200] | 1213 | /** Function for checking if this is a STSA candidate |
---|
[608] | 1214 | */ |
---|
[1200] | 1215 | Bool TComSlice::isStepwiseTemporalLayerSwitchingPointCandidate(TComList<TComPic*>& rcListPic) |
---|
[608] | 1216 | { |
---|
[1200] | 1217 | TComPic* rpcPic; |
---|
| 1218 | |
---|
| 1219 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1220 | while ( iterPic != rcListPic.end()) |
---|
| 1221 | { |
---|
| 1222 | rpcPic = *(iterPic++); |
---|
| 1223 | if(rpcPic->getSlice(0)->isReferenced() && (rpcPic->getUsedByCurr()==true) && rpcPic->getPOC() != getPOC()) |
---|
[608] | 1224 | { |
---|
[1200] | 1225 | if(rpcPic->getTLayer() >= getTLayer()) |
---|
| 1226 | { |
---|
| 1227 | return false; |
---|
| 1228 | } |
---|
[608] | 1229 | } |
---|
[1200] | 1230 | } |
---|
| 1231 | return true; |
---|
[608] | 1232 | } |
---|
| 1233 | |
---|
[655] | 1234 | |
---|
| 1235 | Void TComSlice::checkLeadingPictureRestrictions(TComList<TComPic*>& rcListPic) |
---|
| 1236 | { |
---|
| 1237 | TComPic* rpcPic; |
---|
| 1238 | |
---|
| 1239 | Int nalUnitType = this->getNalUnitType(); |
---|
| 1240 | |
---|
| 1241 | // When a picture is a leading picture, it shall be a RADL or RASL picture. |
---|
| 1242 | if(this->getAssociatedIRAPPOC() > this->getPOC()) |
---|
| 1243 | { |
---|
| 1244 | // Do not check IRAP pictures since they may get a POC lower than their associated IRAP |
---|
| 1245 | if(nalUnitType < NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
| 1246 | nalUnitType > NAL_UNIT_RESERVED_IRAP_VCL23) |
---|
| 1247 | { |
---|
| 1248 | assert(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1249 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || |
---|
| 1250 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1251 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R); |
---|
| 1252 | } |
---|
| 1253 | } |
---|
| 1254 | |
---|
| 1255 | // When a picture is a trailing picture, it shall not be a RADL or RASL picture. |
---|
| 1256 | if(this->getAssociatedIRAPPOC() < this->getPOC()) |
---|
| 1257 | { |
---|
| 1258 | assert(nalUnitType != NAL_UNIT_CODED_SLICE_RASL_N && |
---|
| 1259 | nalUnitType != NAL_UNIT_CODED_SLICE_RASL_R && |
---|
| 1260 | nalUnitType != NAL_UNIT_CODED_SLICE_RADL_N && |
---|
| 1261 | nalUnitType != NAL_UNIT_CODED_SLICE_RADL_R); |
---|
| 1262 | } |
---|
| 1263 | |
---|
| 1264 | // No RASL pictures shall be present in the bitstream that are associated |
---|
| 1265 | // with a BLA picture having nal_unit_type equal to BLA_W_RADL or BLA_N_LP. |
---|
| 1266 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1267 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
| 1268 | { |
---|
| 1269 | assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_W_RADL && |
---|
| 1270 | this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP); |
---|
| 1271 | } |
---|
| 1272 | |
---|
| 1273 | // No RASL pictures shall be present in the bitstream that are associated with |
---|
| 1274 | // an IDR picture. |
---|
| 1275 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1276 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
| 1277 | { |
---|
| 1278 | assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP && |
---|
| 1279 | this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL); |
---|
| 1280 | } |
---|
| 1281 | |
---|
| 1282 | // No RADL pictures shall be present in the bitstream that are associated with |
---|
| 1283 | // a BLA picture having nal_unit_type equal to BLA_N_LP or that are associated |
---|
| 1284 | // with an IDR picture having nal_unit_type equal to IDR_N_LP. |
---|
| 1285 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1286 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R) |
---|
| 1287 | { |
---|
| 1288 | assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP && |
---|
| 1289 | this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP); |
---|
| 1290 | } |
---|
| 1291 | |
---|
| 1292 | // loop through all pictures in the reference picture buffer |
---|
| 1293 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1294 | while ( iterPic != rcListPic.end()) |
---|
| 1295 | { |
---|
| 1296 | rpcPic = *(iterPic++); |
---|
[872] | 1297 | if(!rpcPic->getReconMark()) |
---|
| 1298 | { |
---|
| 1299 | continue; |
---|
| 1300 | } |
---|
[655] | 1301 | if (rpcPic->getPOC() == this->getPOC()) |
---|
| 1302 | { |
---|
| 1303 | continue; |
---|
| 1304 | } |
---|
| 1305 | |
---|
| 1306 | // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture |
---|
| 1307 | // in decoding order shall precede the IRAP picture in output order. |
---|
| 1308 | // (Note that any picture following in output order would be present in the DPB) |
---|
[964] | 1309 | if(rpcPic->getSlice(0)->getPicOutputFlag() == 1 && !this->getNoOutputPriorPicsFlag()) |
---|
[655] | 1310 | { |
---|
| 1311 | if(nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP || |
---|
| 1312 | nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
| 1313 | nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL || |
---|
| 1314 | nalUnitType == NAL_UNIT_CODED_SLICE_CRA || |
---|
| 1315 | nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || |
---|
| 1316 | nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL) |
---|
| 1317 | { |
---|
| 1318 | assert(rpcPic->getPOC() < this->getPOC()); |
---|
| 1319 | } |
---|
| 1320 | } |
---|
| 1321 | |
---|
| 1322 | // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture |
---|
| 1323 | // in decoding order shall precede any RADL picture associated with the IRAP |
---|
| 1324 | // picture in output order. |
---|
| 1325 | if(rpcPic->getSlice(0)->getPicOutputFlag() == 1) |
---|
| 1326 | { |
---|
| 1327 | if((nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1328 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R)) |
---|
| 1329 | { |
---|
| 1330 | // rpcPic precedes the IRAP in decoding order |
---|
| 1331 | if(this->getAssociatedIRAPPOC() > rpcPic->getSlice(0)->getAssociatedIRAPPOC()) |
---|
| 1332 | { |
---|
| 1333 | // rpcPic must not be the IRAP picture |
---|
| 1334 | if(this->getAssociatedIRAPPOC() != rpcPic->getPOC()) |
---|
| 1335 | { |
---|
| 1336 | assert(rpcPic->getPOC() < this->getPOC()); |
---|
| 1337 | } |
---|
| 1338 | } |
---|
| 1339 | } |
---|
| 1340 | } |
---|
| 1341 | |
---|
| 1342 | // When a picture is a leading picture, it shall precede, in decoding order, |
---|
| 1343 | // all trailing pictures that are associated with the same IRAP picture. |
---|
[1200] | 1344 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1345 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || |
---|
| 1346 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1347 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R) |
---|
[655] | 1348 | { |
---|
[1200] | 1349 | if(rpcPic->getSlice(0)->getAssociatedIRAPPOC() == this->getAssociatedIRAPPOC()) |
---|
| 1350 | { |
---|
| 1351 | // rpcPic is a picture that preceded the leading in decoding order since it exist in the DPB |
---|
| 1352 | // rpcPic would violate the constraint if it was a trailing picture |
---|
| 1353 | assert(rpcPic->getPOC() <= this->getAssociatedIRAPPOC()); |
---|
| 1354 | } |
---|
[655] | 1355 | } |
---|
| 1356 | |
---|
| 1357 | // Any RASL picture associated with a CRA or BLA picture shall precede any |
---|
| 1358 | // RADL picture associated with the CRA or BLA picture in output order |
---|
| 1359 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1360 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
[1200] | 1361 | { |
---|
[655] | 1362 | if((this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || |
---|
| 1363 | this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
| 1364 | this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL || |
---|
| 1365 | this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) && |
---|
| 1366 | this->getAssociatedIRAPPOC() == rpcPic->getSlice(0)->getAssociatedIRAPPOC()) |
---|
| 1367 | { |
---|
| 1368 | if(rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1369 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R) |
---|
| 1370 | { |
---|
| 1371 | assert(rpcPic->getPOC() > this->getPOC()); |
---|
| 1372 | } |
---|
| 1373 | } |
---|
| 1374 | } |
---|
| 1375 | |
---|
| 1376 | // Any RASL picture associated with a CRA picture shall follow, in output |
---|
| 1377 | // order, any IRAP picture that precedes the CRA picture in decoding order. |
---|
| 1378 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1379 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
| 1380 | { |
---|
| 1381 | if(this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) |
---|
| 1382 | { |
---|
| 1383 | if(rpcPic->getSlice(0)->getPOC() < this->getAssociatedIRAPPOC() && |
---|
| 1384 | (rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || |
---|
| 1385 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
| 1386 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL || |
---|
| 1387 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || |
---|
| 1388 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || |
---|
| 1389 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)) |
---|
| 1390 | { |
---|
| 1391 | assert(this->getPOC() > rpcPic->getSlice(0)->getPOC()); |
---|
| 1392 | } |
---|
| 1393 | } |
---|
| 1394 | } |
---|
| 1395 | } |
---|
| 1396 | } |
---|
| 1397 | |
---|
| 1398 | |
---|
[1200] | 1399 | |
---|
[56] | 1400 | /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. |
---|
| 1401 | */ |
---|
[1200] | 1402 | Void TComSlice::applyReferencePictureSet( TComList<TComPic*>& rcListPic, const TComReferencePictureSet *pReferencePictureSet) |
---|
[56] | 1403 | { |
---|
| 1404 | TComPic* rpcPic; |
---|
| 1405 | Int i, isReference; |
---|
| 1406 | |
---|
[655] | 1407 | checkLeadingPictureRestrictions(rcListPic); |
---|
| 1408 | |
---|
[56] | 1409 | // loop through all pictures in the reference picture buffer |
---|
| 1410 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1411 | while ( iterPic != rcListPic.end()) |
---|
| 1412 | { |
---|
| 1413 | rpcPic = *(iterPic++); |
---|
| 1414 | |
---|
[608] | 1415 | if(!rpcPic->getSlice( 0 )->isReferenced()) |
---|
| 1416 | { |
---|
| 1417 | continue; |
---|
| 1418 | } |
---|
| 1419 | |
---|
[56] | 1420 | isReference = 0; |
---|
[608] | 1421 | // loop through all pictures in the Reference Picture Set |
---|
| 1422 | // to see if the picture should be kept as reference picture |
---|
[56] | 1423 | for(i=0;i<pReferencePictureSet->getNumberOfPositivePictures()+pReferencePictureSet->getNumberOfNegativePictures();i++) |
---|
| 1424 | { |
---|
| 1425 | if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i)) |
---|
| 1426 | { |
---|
| 1427 | isReference = 1; |
---|
| 1428 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
| 1429 | rpcPic->setIsLongTerm(0); |
---|
| 1430 | } |
---|
| 1431 | } |
---|
| 1432 | for(;i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
| 1433 | { |
---|
[608] | 1434 | if(pReferencePictureSet->getCheckLTMSBPresent(i)==true) |
---|
[56] | 1435 | { |
---|
[608] | 1436 | if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i)) |
---|
| 1437 | { |
---|
| 1438 | isReference = 1; |
---|
| 1439 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
| 1440 | } |
---|
[56] | 1441 | } |
---|
[1200] | 1442 | else |
---|
[608] | 1443 | { |
---|
[655] | 1444 | Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); |
---|
| 1445 | Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1); |
---|
| 1446 | Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1); |
---|
| 1447 | if(rpcPic->getIsLongTerm() && curPoc == refPoc) |
---|
[608] | 1448 | { |
---|
| 1449 | isReference = 1; |
---|
| 1450 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
| 1451 | } |
---|
| 1452 | } |
---|
| 1453 | |
---|
[56] | 1454 | } |
---|
[1200] | 1455 | #if NH_MV |
---|
[872] | 1456 | if( isReference ) // Current picture is in the temporal RPS |
---|
| 1457 | { |
---|
| 1458 | assert( rpcPic->getSlice(0)->getDiscardableFlag() == 0 ); // Temporal RPS shall not contain picture with discardable_flag equal to 1 |
---|
| 1459 | } |
---|
| 1460 | #endif |
---|
[56] | 1461 | // mark the picture as "unused for reference" if it is not in |
---|
| 1462 | // the Reference Picture Set |
---|
[1200] | 1463 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && isReference == 0) |
---|
| 1464 | { |
---|
| 1465 | rpcPic->getSlice( 0 )->setReferenced( false ); |
---|
[608] | 1466 | rpcPic->setUsedByCurr(0); |
---|
[56] | 1467 | rpcPic->setIsLongTerm(0); |
---|
| 1468 | } |
---|
[608] | 1469 | //check that pictures of higher temporal layers are not used |
---|
| 1470 | assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getTLayer()<=this->getTLayer()); |
---|
| 1471 | //check that pictures of higher or equal temporal layer are not in the RPS if the current picture is a TSA picture |
---|
[872] | 1472 | if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) |
---|
[608] | 1473 | { |
---|
| 1474 | assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getTLayer()<this->getTLayer()); |
---|
| 1475 | } |
---|
| 1476 | //check that pictures marked as temporal layer non-reference pictures are not used for reference |
---|
| 1477 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && rpcPic->getTLayer()==this->getTLayer()) |
---|
| 1478 | { |
---|
| 1479 | assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getSlice( 0 )->getTemporalLayerNonReferenceFlag()==false); |
---|
| 1480 | } |
---|
| 1481 | } |
---|
[56] | 1482 | } |
---|
| 1483 | |
---|
| 1484 | /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. |
---|
| 1485 | */ |
---|
[1200] | 1486 | Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, const TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess, Bool bUseRecoveryPoint) |
---|
[56] | 1487 | { |
---|
[964] | 1488 | Int atLeastOneUnabledByRecoveryPoint = 0; |
---|
| 1489 | Int atLeastOneFlushedByPreviousIDR = 0; |
---|
[56] | 1490 | TComPic* rpcPic; |
---|
[608] | 1491 | Int i, isAvailable; |
---|
[56] | 1492 | Int atLeastOneLost = 0; |
---|
| 1493 | Int atLeastOneRemoved = 0; |
---|
| 1494 | Int iPocLost = 0; |
---|
| 1495 | |
---|
| 1496 | // loop through all long-term pictures in the Reference Picture Set |
---|
| 1497 | // to see if the picture should be kept as reference picture |
---|
| 1498 | for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
| 1499 | { |
---|
| 1500 | isAvailable = 0; |
---|
| 1501 | // loop through all pictures in the reference picture buffer |
---|
| 1502 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1503 | while ( iterPic != rcListPic.end()) |
---|
| 1504 | { |
---|
| 1505 | rpcPic = *(iterPic++); |
---|
[608] | 1506 | if(pReferencePictureSet->getCheckLTMSBPresent(i)==true) |
---|
[56] | 1507 | { |
---|
[608] | 1508 | if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
| 1509 | { |
---|
[964] | 1510 | if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) |
---|
| 1511 | { |
---|
| 1512 | isAvailable = 0; |
---|
| 1513 | } |
---|
| 1514 | else |
---|
| 1515 | { |
---|
[1200] | 1516 | isAvailable = 1; |
---|
| 1517 | } |
---|
[608] | 1518 | } |
---|
[56] | 1519 | } |
---|
[1200] | 1520 | else |
---|
[608] | 1521 | { |
---|
[655] | 1522 | Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); |
---|
| 1523 | Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1); |
---|
| 1524 | Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1); |
---|
| 1525 | if(rpcPic->getIsLongTerm() && curPoc == refPoc && rpcPic->getSlice(0)->isReferenced()) |
---|
[608] | 1526 | { |
---|
[964] | 1527 | if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) |
---|
| 1528 | { |
---|
| 1529 | isAvailable = 0; |
---|
| 1530 | } |
---|
| 1531 | else |
---|
| 1532 | { |
---|
[1200] | 1533 | isAvailable = 1; |
---|
| 1534 | } |
---|
[608] | 1535 | } |
---|
| 1536 | } |
---|
[56] | 1537 | } |
---|
| 1538 | // if there was no such long-term check the short terms |
---|
| 1539 | if(!isAvailable) |
---|
| 1540 | { |
---|
| 1541 | iterPic = rcListPic.begin(); |
---|
| 1542 | while ( iterPic != rcListPic.end()) |
---|
| 1543 | { |
---|
| 1544 | rpcPic = *(iterPic++); |
---|
| 1545 | |
---|
[608] | 1546 | Int pocCycle = 1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); |
---|
| 1547 | Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC(); |
---|
| 1548 | Int refPoc = pReferencePictureSet->getPOC(i); |
---|
| 1549 | if (!pReferencePictureSet->getCheckLTMSBPresent(i)) |
---|
[56] | 1550 | { |
---|
[655] | 1551 | curPoc = curPoc & (pocCycle - 1); |
---|
| 1552 | refPoc = refPoc & (pocCycle - 1); |
---|
[608] | 1553 | } |
---|
[1200] | 1554 | |
---|
[608] | 1555 | if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc) |
---|
| 1556 | { |
---|
[964] | 1557 | if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) |
---|
| 1558 | { |
---|
| 1559 | isAvailable = 0; |
---|
| 1560 | } |
---|
| 1561 | else |
---|
| 1562 | { |
---|
[1200] | 1563 | isAvailable = 1; |
---|
| 1564 | rpcPic->setIsLongTerm(1); |
---|
| 1565 | break; |
---|
| 1566 | } |
---|
[2] | 1567 | } |
---|
[56] | 1568 | } |
---|
| 1569 | } |
---|
| 1570 | // report that a picture is lost if it is in the Reference Picture Set |
---|
| 1571 | // but not available as reference picture |
---|
[1200] | 1572 | if(isAvailable == 0) |
---|
| 1573 | { |
---|
[56] | 1574 | if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) |
---|
| 1575 | { |
---|
| 1576 | if(!pReferencePictureSet->getUsed(i) ) |
---|
| 1577 | { |
---|
[608] | 1578 | if(printErrors) |
---|
| 1579 | { |
---|
[56] | 1580 | printf("\nLong-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
[608] | 1581 | } |
---|
[56] | 1582 | atLeastOneRemoved = 1; |
---|
[2] | 1583 | } |
---|
[56] | 1584 | else |
---|
| 1585 | { |
---|
[608] | 1586 | if(printErrors) |
---|
| 1587 | { |
---|
[56] | 1588 | printf("\nLong-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
[608] | 1589 | } |
---|
[56] | 1590 | atLeastOneLost = 1; |
---|
| 1591 | iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); |
---|
[2] | 1592 | } |
---|
| 1593 | } |
---|
[964] | 1594 | else if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess) |
---|
| 1595 | { |
---|
| 1596 | atLeastOneUnabledByRecoveryPoint = 1; |
---|
| 1597 | } |
---|
| 1598 | else if(bUseRecoveryPoint && (this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_N_LP || this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_W_RADL)) |
---|
| 1599 | { |
---|
| 1600 | atLeastOneFlushedByPreviousIDR = 1; |
---|
| 1601 | } |
---|
[56] | 1602 | } |
---|
[1200] | 1603 | } |
---|
[56] | 1604 | // loop through all short-term pictures in the Reference Picture Set |
---|
| 1605 | // to see if the picture should be kept as reference picture |
---|
| 1606 | for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++) |
---|
| 1607 | { |
---|
| 1608 | isAvailable = 0; |
---|
| 1609 | // loop through all pictures in the reference picture buffer |
---|
| 1610 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1611 | while ( iterPic != rcListPic.end()) |
---|
| 1612 | { |
---|
| 1613 | rpcPic = *(iterPic++); |
---|
| 1614 | |
---|
| 1615 | if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
| 1616 | { |
---|
[964] | 1617 | if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) |
---|
| 1618 | { |
---|
| 1619 | isAvailable = 0; |
---|
| 1620 | } |
---|
| 1621 | else |
---|
| 1622 | { |
---|
[1200] | 1623 | isAvailable = 1; |
---|
| 1624 | } |
---|
[56] | 1625 | } |
---|
| 1626 | } |
---|
| 1627 | // report that a picture is lost if it is in the Reference Picture Set |
---|
| 1628 | // but not available as reference picture |
---|
[1200] | 1629 | if(isAvailable == 0) |
---|
| 1630 | { |
---|
[56] | 1631 | if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) |
---|
| 1632 | { |
---|
| 1633 | if(!pReferencePictureSet->getUsed(i) ) |
---|
| 1634 | { |
---|
[608] | 1635 | if(printErrors) |
---|
| 1636 | { |
---|
[56] | 1637 | printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
[608] | 1638 | } |
---|
[56] | 1639 | atLeastOneRemoved = 1; |
---|
| 1640 | } |
---|
| 1641 | else |
---|
| 1642 | { |
---|
[608] | 1643 | if(printErrors) |
---|
| 1644 | { |
---|
[56] | 1645 | printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
[608] | 1646 | } |
---|
[56] | 1647 | atLeastOneLost = 1; |
---|
| 1648 | iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); |
---|
| 1649 | } |
---|
| 1650 | } |
---|
[964] | 1651 | else if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess) |
---|
| 1652 | { |
---|
| 1653 | atLeastOneUnabledByRecoveryPoint = 1; |
---|
[1200] | 1654 | } |
---|
[964] | 1655 | else if(bUseRecoveryPoint && (this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_N_LP || this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_W_RADL)) |
---|
| 1656 | { |
---|
| 1657 | atLeastOneFlushedByPreviousIDR = 1; |
---|
[1200] | 1658 | } |
---|
[964] | 1659 | } |
---|
[1200] | 1660 | } |
---|
| 1661 | |
---|
[964] | 1662 | if(atLeastOneUnabledByRecoveryPoint || atLeastOneFlushedByPreviousIDR) |
---|
| 1663 | { |
---|
| 1664 | return -1; |
---|
| 1665 | } |
---|
[56] | 1666 | if(atLeastOneLost) |
---|
| 1667 | { |
---|
| 1668 | return iPocLost+1; |
---|
[2] | 1669 | } |
---|
[56] | 1670 | if(atLeastOneRemoved) |
---|
| 1671 | { |
---|
| 1672 | return -2; |
---|
| 1673 | } |
---|
| 1674 | else |
---|
[608] | 1675 | { |
---|
[56] | 1676 | return 0; |
---|
[608] | 1677 | } |
---|
[2] | 1678 | } |
---|
| 1679 | |
---|
[56] | 1680 | /** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set |
---|
| 1681 | */ |
---|
[1200] | 1682 | Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, const TComReferencePictureSet *pReferencePictureSet, Bool isRAP, Int pocRandomAccess, Bool bUseRecoveryPoint, const Bool bEfficientFieldIRAPEnabled) |
---|
[56] | 1683 | { |
---|
| 1684 | TComPic* rpcPic; |
---|
| 1685 | Int i, j; |
---|
| 1686 | Int k = 0; |
---|
| 1687 | Int nrOfNegativePictures = 0; |
---|
| 1688 | Int nrOfPositivePictures = 0; |
---|
| 1689 | TComReferencePictureSet* pcRPS = this->getLocalRPS(); |
---|
[1200] | 1690 | Bool irapIsInRPS = false; // Used when bEfficientFieldIRAPEnabled==true |
---|
[56] | 1691 | |
---|
| 1692 | // loop through all pictures in the Reference Picture Set |
---|
| 1693 | for(i=0;i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
| 1694 | { |
---|
| 1695 | j = 0; |
---|
| 1696 | // loop through all pictures in the reference picture buffer |
---|
| 1697 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1698 | while ( iterPic != rcListPic.end()) |
---|
| 1699 | { |
---|
| 1700 | j++; |
---|
| 1701 | rpcPic = *(iterPic++); |
---|
| 1702 | |
---|
| 1703 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
| 1704 | { |
---|
| 1705 | // This picture exists as a reference picture |
---|
| 1706 | // and should be added to the explicit Reference Picture Set |
---|
| 1707 | pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); |
---|
[608] | 1708 | pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP)); |
---|
[1200] | 1709 | if (bEfficientFieldIRAPEnabled) |
---|
| 1710 | { |
---|
[964] | 1711 | pcRPS->setUsed(k, pcRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) ); |
---|
[1200] | 1712 | } |
---|
| 1713 | |
---|
[56] | 1714 | if(pcRPS->getDeltaPOC(k) < 0) |
---|
[608] | 1715 | { |
---|
[56] | 1716 | nrOfNegativePictures++; |
---|
[608] | 1717 | } |
---|
[56] | 1718 | else |
---|
[608] | 1719 | { |
---|
[1200] | 1720 | if(bEfficientFieldIRAPEnabled && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC()+1) |
---|
| 1721 | { |
---|
| 1722 | irapIsInRPS = true; |
---|
| 1723 | } |
---|
[56] | 1724 | nrOfPositivePictures++; |
---|
[608] | 1725 | } |
---|
[56] | 1726 | k++; |
---|
| 1727 | } |
---|
| 1728 | } |
---|
| 1729 | } |
---|
[1200] | 1730 | |
---|
[964] | 1731 | Bool useNewRPS = false; |
---|
| 1732 | // if current picture is complimentary field associated to IRAP, add the IRAP to its RPS. |
---|
[1200] | 1733 | if(bEfficientFieldIRAPEnabled && m_pcPic->isField() && !irapIsInRPS) |
---|
[964] | 1734 | { |
---|
| 1735 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1736 | while ( iterPic != rcListPic.end()) |
---|
| 1737 | { |
---|
| 1738 | rpcPic = *(iterPic++); |
---|
| 1739 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC()+1) |
---|
| 1740 | { |
---|
| 1741 | pcRPS->setDeltaPOC(k, 1); |
---|
| 1742 | pcRPS->setUsed(k, true); |
---|
| 1743 | nrOfPositivePictures++; |
---|
| 1744 | k ++; |
---|
| 1745 | useNewRPS = true; |
---|
| 1746 | } |
---|
| 1747 | } |
---|
| 1748 | } |
---|
[56] | 1749 | pcRPS->setNumberOfNegativePictures(nrOfNegativePictures); |
---|
| 1750 | pcRPS->setNumberOfPositivePictures(nrOfPositivePictures); |
---|
| 1751 | pcRPS->setNumberOfPictures(nrOfNegativePictures+nrOfPositivePictures); |
---|
[1200] | 1752 | // This is a simplistic inter rps example. A smarter encoder will look for a better reference RPS to do the |
---|
[56] | 1753 | // inter RPS prediction with. Here we just use the reference used by pReferencePictureSet. |
---|
| 1754 | // If pReferencePictureSet is not inter_RPS_predicted, then inter_RPS_prediction is for the current RPS also disabled. |
---|
[1200] | 1755 | if (!pReferencePictureSet->getInterRPSPrediction() || useNewRPS ) |
---|
[56] | 1756 | { |
---|
| 1757 | pcRPS->setInterRPSPrediction(false); |
---|
| 1758 | pcRPS->setNumRefIdc(0); |
---|
| 1759 | } |
---|
| 1760 | else |
---|
| 1761 | { |
---|
| 1762 | Int rIdx = this->getRPSidx() - pReferencePictureSet->getDeltaRIdxMinus1() - 1; |
---|
| 1763 | Int deltaRPS = pReferencePictureSet->getDeltaRPS(); |
---|
[1200] | 1764 | const TComReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx); |
---|
[56] | 1765 | Int iRefPics = pcRefRPS->getNumberOfPictures(); |
---|
| 1766 | Int iNewIdc=0; |
---|
[1200] | 1767 | for(i=0; i<= iRefPics; i++) |
---|
[56] | 1768 | { |
---|
| 1769 | Int deltaPOC = ((i != iRefPics)? pcRefRPS->getDeltaPOC(i) : 0); // check if the reference abs POC is >= 0 |
---|
| 1770 | Int iRefIdc = 0; |
---|
| 1771 | for (j=0; j < pcRPS->getNumberOfPictures(); j++) // loop through the pictures in the new RPS |
---|
| 1772 | { |
---|
| 1773 | if ( (deltaPOC + deltaRPS) == pcRPS->getDeltaPOC(j)) |
---|
| 1774 | { |
---|
| 1775 | if (pcRPS->getUsed(j)) |
---|
| 1776 | { |
---|
| 1777 | iRefIdc = 1; |
---|
| 1778 | } |
---|
| 1779 | else |
---|
| 1780 | { |
---|
| 1781 | iRefIdc = 2; |
---|
| 1782 | } |
---|
| 1783 | } |
---|
| 1784 | } |
---|
| 1785 | pcRPS->setRefIdc(i, iRefIdc); |
---|
| 1786 | iNewIdc++; |
---|
| 1787 | } |
---|
| 1788 | pcRPS->setInterRPSPrediction(true); |
---|
| 1789 | pcRPS->setNumRefIdc(iNewIdc); |
---|
[1200] | 1790 | pcRPS->setDeltaRPS(deltaRPS); |
---|
[56] | 1791 | pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx()); |
---|
| 1792 | } |
---|
| 1793 | |
---|
| 1794 | this->setRPS(pcRPS); |
---|
| 1795 | this->setRPSidx(-1); |
---|
| 1796 | } |
---|
| 1797 | |
---|
[1200] | 1798 | //! get AC and DC values for weighted pred |
---|
| 1799 | Void TComSlice::getWpAcDcParam(WPACDCParam *&wp) |
---|
[56] | 1800 | { |
---|
| 1801 | wp = m_weightACDCParam; |
---|
| 1802 | } |
---|
| 1803 | |
---|
[1200] | 1804 | //! init AC and DC values for weighted pred |
---|
[56] | 1805 | Void TComSlice::initWpAcDcParam() |
---|
| 1806 | { |
---|
[1200] | 1807 | for(Int iComp = 0; iComp < MAX_NUM_COMPONENT; iComp++ ) |
---|
[56] | 1808 | { |
---|
| 1809 | m_weightACDCParam[iComp].iAC = 0; |
---|
| 1810 | m_weightACDCParam[iComp].iDC = 0; |
---|
| 1811 | } |
---|
| 1812 | } |
---|
| 1813 | |
---|
[1200] | 1814 | //! get tables for weighted prediction |
---|
| 1815 | Void TComSlice::getWpScaling( RefPicList e, Int iRefIdx, WPScalingParam *&wp ) |
---|
[56] | 1816 | { |
---|
[1200] | 1817 | assert (e<NUM_REF_PIC_LIST_01); |
---|
[56] | 1818 | wp = m_weightPredTable[e][iRefIdx]; |
---|
| 1819 | } |
---|
| 1820 | |
---|
[1200] | 1821 | //! reset Default WP tables settings : no weight. |
---|
[608] | 1822 | Void TComSlice::resetWpScaling() |
---|
[2] | 1823 | { |
---|
[1200] | 1824 | for ( Int e=0 ; e<NUM_REF_PIC_LIST_01 ; e++ ) |
---|
[56] | 1825 | { |
---|
[608] | 1826 | for ( Int i=0 ; i<MAX_NUM_REF ; i++ ) |
---|
[56] | 1827 | { |
---|
[1200] | 1828 | for ( Int yuv=0 ; yuv<MAX_NUM_COMPONENT ; yuv++ ) |
---|
[56] | 1829 | { |
---|
[1200] | 1830 | WPScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); |
---|
[2] | 1831 | pwp->bPresentFlag = false; |
---|
| 1832 | pwp->uiLog2WeightDenom = 0; |
---|
| 1833 | pwp->uiLog2WeightDenom = 0; |
---|
| 1834 | pwp->iWeight = 1; |
---|
| 1835 | pwp->iOffset = 0; |
---|
| 1836 | } |
---|
[56] | 1837 | } |
---|
[2] | 1838 | } |
---|
| 1839 | } |
---|
| 1840 | |
---|
[1200] | 1841 | //! init WP table |
---|
| 1842 | Void TComSlice::initWpScaling(const TComSPS *sps) |
---|
[2] | 1843 | { |
---|
[1200] | 1844 | const Bool bUseHighPrecisionPredictionWeighting = sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag(); |
---|
| 1845 | for ( Int e=0 ; e<NUM_REF_PIC_LIST_01 ; e++ ) |
---|
[56] | 1846 | { |
---|
[608] | 1847 | for ( Int i=0 ; i<MAX_NUM_REF ; i++ ) |
---|
[56] | 1848 | { |
---|
[1200] | 1849 | for ( Int yuv=0 ; yuv<MAX_NUM_COMPONENT ; yuv++ ) |
---|
[56] | 1850 | { |
---|
[1200] | 1851 | WPScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); |
---|
| 1852 | if ( !pwp->bPresentFlag ) |
---|
[608] | 1853 | { |
---|
[2] | 1854 | // Inferring values not present : |
---|
| 1855 | pwp->iWeight = (1 << pwp->uiLog2WeightDenom); |
---|
| 1856 | pwp->iOffset = 0; |
---|
| 1857 | } |
---|
| 1858 | |
---|
[1200] | 1859 | const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (sps->getBitDepth(toChannelType(ComponentID(yuv)))-8)); |
---|
| 1860 | |
---|
[2] | 1861 | pwp->w = pwp->iWeight; |
---|
[1200] | 1862 | pwp->o = pwp->iOffset * offsetScalingFactor; //NOTE: This value of the ".o" variable is never used - .o is set immediately before it gets used |
---|
[2] | 1863 | pwp->shift = pwp->uiLog2WeightDenom; |
---|
| 1864 | pwp->round = (pwp->uiLog2WeightDenom>=1) ? (1 << (pwp->uiLog2WeightDenom-1)) : (0); |
---|
| 1865 | } |
---|
[56] | 1866 | } |
---|
[2] | 1867 | } |
---|
| 1868 | } |
---|
| 1869 | |
---|
[608] | 1870 | // ------------------------------------------------------------------------------------------------ |
---|
| 1871 | // Video parameter set (VPS) |
---|
| 1872 | // ------------------------------------------------------------------------------------------------ |
---|
| 1873 | TComVPS::TComVPS() |
---|
| 1874 | : m_VPSId ( 0) |
---|
| 1875 | , m_uiMaxTLayers ( 1) |
---|
[1200] | 1876 | #if NH_MV |
---|
[622] | 1877 | , m_uiMaxLayersMinus1 ( 0) |
---|
| 1878 | #else |
---|
[608] | 1879 | , m_uiMaxLayers ( 1) |
---|
[622] | 1880 | #endif |
---|
[608] | 1881 | , m_bTemporalIdNestingFlag (false) |
---|
| 1882 | , m_numHrdParameters ( 0) |
---|
[1200] | 1883 | #if NH_MV |
---|
[608] | 1884 | , m_maxLayerId ( 0) |
---|
| 1885 | #else |
---|
| 1886 | , m_maxNuhReservedZeroLayerId ( 0) |
---|
| 1887 | #endif |
---|
[1200] | 1888 | , m_hrdParameters () |
---|
| 1889 | , m_hrdOpSetIdx () |
---|
| 1890 | , m_cprmsPresentFlag () |
---|
[2] | 1891 | { |
---|
[1200] | 1892 | #if NH_MV |
---|
[964] | 1893 | m_vpsBaseLayerInternalFlag = true; |
---|
[1066] | 1894 | m_vpsBaseLayerAvailableFlag = true; |
---|
[1124] | 1895 | |
---|
| 1896 | m_numViews = 0; |
---|
[964] | 1897 | |
---|
[1124] | 1898 | #endif |
---|
| 1899 | |
---|
[608] | 1900 | for( Int i = 0; i < MAX_TLAYER; i++) |
---|
[56] | 1901 | { |
---|
[608] | 1902 | m_numReorderPics[i] = 0; |
---|
[1200] | 1903 | m_uiMaxDecPicBuffering[i] = 1; |
---|
[608] | 1904 | m_uiMaxLatencyIncrease[i] = 0; |
---|
| 1905 | } |
---|
[1200] | 1906 | #if NH_MV |
---|
[608] | 1907 | for (Int lsIdx = 0; lsIdx < MAX_VPS_OP_SETS_PLUS1; lsIdx++ ) |
---|
| 1908 | { |
---|
| 1909 | for( Int layerId = 0; layerId < MAX_VPS_NUH_LAYER_ID_PLUS1; layerId++ ) |
---|
[56] | 1910 | { |
---|
[738] | 1911 | m_layerIdIncludedFlag[lsIdx][layerId] = (( lsIdx == 0 ) && ( layerId == 0 )) ; |
---|
[56] | 1912 | } |
---|
[608] | 1913 | } |
---|
| 1914 | m_vpsNumProfileTierLevelMinus1 = -1; |
---|
| 1915 | |
---|
[964] | 1916 | m_numAddLayerSets = 0; |
---|
| 1917 | m_numAddOlss = 0; |
---|
| 1918 | m_defaultOutputLayerIdc = 0; |
---|
[608] | 1919 | |
---|
| 1920 | for ( Int i = 0; i < MAX_VPS_OUTPUTLAYER_SETS; i++) |
---|
| 1921 | { |
---|
[964] | 1922 | m_layerSetIdxForOlsMinus1[i] = -1; |
---|
[608] | 1923 | for ( Int j = 0; j < MAX_VPS_NUH_LAYER_ID_PLUS1; j++) |
---|
| 1924 | { |
---|
[1066] | 1925 | m_profileTierLevelIdx[i][j] = -1; |
---|
[608] | 1926 | m_outputLayerFlag[i][j] = false; |
---|
| 1927 | } |
---|
[872] | 1928 | m_altOutputLayerFlag[ i ] = false; |
---|
[608] | 1929 | } |
---|
[964] | 1930 | |
---|
| 1931 | m_repFormatIdxPresentFlag = false; |
---|
[608] | 1932 | m_maxOneActiveRefLayerFlag = false; |
---|
[1124] | 1933 | m_vpsPocLsbAlignedFlag = false; |
---|
[608] | 1934 | m_directDepTypeLenMinus2 = 0; |
---|
| 1935 | |
---|
| 1936 | |
---|
[964] | 1937 | m_vpsExtensionFlag = true; |
---|
[872] | 1938 | m_vpsNonVuiExtensionLength = 0; |
---|
[608] | 1939 | m_splittingFlag = false; |
---|
[1124] | 1940 | |
---|
[608] | 1941 | |
---|
| 1942 | for( Int i = 0; i < MAX_NUM_SCALABILITY_TYPES; i++ ) |
---|
| 1943 | { |
---|
[622] | 1944 | m_scalabilityMaskFlag[i] = false; |
---|
[608] | 1945 | m_dimensionIdLen [i] = -1; |
---|
| 1946 | } |
---|
| 1947 | |
---|
| 1948 | m_vpsNuhLayerIdPresentFlag = false; |
---|
| 1949 | |
---|
| 1950 | for( Int i = 0; i < MAX_VPS_OP_SETS_PLUS1; i++ ) |
---|
| 1951 | { |
---|
| 1952 | m_vpsProfilePresentFlag [i] = false; |
---|
[964] | 1953 | m_layerSetIdxForOlsMinus1 [i] = 0; |
---|
[608] | 1954 | for( Int j = 0; j < MAX_VPS_NUH_LAYER_ID_PLUS1; j++ ) |
---|
| 1955 | { |
---|
| 1956 | m_outputLayerFlag[i][j] = false; |
---|
| 1957 | } |
---|
| 1958 | } |
---|
| 1959 | |
---|
| 1960 | for( Int i = 0; i < MAX_NUM_LAYER_IDS; i++ ) |
---|
| 1961 | { |
---|
| 1962 | m_layerIdInVps[i] = (i == 0 ) ? 0 : -1; |
---|
| 1963 | } |
---|
| 1964 | |
---|
| 1965 | for( Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
| 1966 | { |
---|
| 1967 | m_layerIdInNuh [i] = ( i == 0 ) ? 0 : -1; |
---|
| 1968 | m_numDirectRefLayers[i] = 0; |
---|
[1200] | 1969 | #if NH_3D |
---|
[1124] | 1970 | m_numRefListLayers[i] = 0; |
---|
| 1971 | #endif |
---|
[622] | 1972 | m_vpsRepFormatIdx [i] = 0; |
---|
[1200] | 1973 | m_pocLsbNotPresentFlag[i] = 0; |
---|
[622] | 1974 | m_viewIdVal [i] = 0; |
---|
| 1975 | |
---|
[1200] | 1976 | #if NH_3D |
---|
[608] | 1977 | m_viewIndex [i] = -1; |
---|
[1039] | 1978 | #endif |
---|
[608] | 1979 | |
---|
| 1980 | for( Int j = 0; j < MAX_NUM_LAYERS; j++ ) |
---|
| 1981 | { |
---|
| 1982 | m_directDependencyFlag[i][j] = false; |
---|
| 1983 | m_directDependencyType[i][j] = -1; |
---|
[1066] | 1984 | m_dependencyFlag [i][j] = false; |
---|
| 1985 | m_idDirectRefLayer[i][j] = -1; |
---|
[1200] | 1986 | #if NH_3D |
---|
[1124] | 1987 | m_idRefListLayer[i][j] = -1; |
---|
| 1988 | #endif |
---|
[1066] | 1989 | m_idPredictedLayer[i][j] = -1; |
---|
| 1990 | m_idRefLayer [i][j] = -1; |
---|
[738] | 1991 | m_maxTidIlRefPicsPlus1[i][j] = 7; |
---|
[608] | 1992 | } |
---|
| 1993 | |
---|
| 1994 | for( Int j = 0; j < MAX_NUM_SCALABILITY_TYPES; j++ ) |
---|
| 1995 | { |
---|
| 1996 | m_dimensionId[i][j] = 0; |
---|
| 1997 | } |
---|
| 1998 | #if H_3D_ARP |
---|
| 1999 | #endif |
---|
[1200] | 2000 | } |
---|
[1124] | 2001 | #endif |
---|
[56] | 2002 | } |
---|
[608] | 2003 | |
---|
| 2004 | TComVPS::~TComVPS() |
---|
[56] | 2005 | { |
---|
[608] | 2006 | } |
---|
| 2007 | |
---|
[1200] | 2008 | #if NH_MV |
---|
[608] | 2009 | |
---|
| 2010 | Bool TComVPS::checkVPSExtensionSyntax() |
---|
| 2011 | { |
---|
[622] | 2012 | for( Int layer = 1; layer <= getMaxLayersMinus1(); layer++ ) |
---|
[608] | 2013 | { |
---|
| 2014 | // check layer_id_in_nuh constraint |
---|
| 2015 | assert( getLayerIdInNuh( layer ) > getLayerIdInNuh( layer -1 ) ); |
---|
| 2016 | } |
---|
[964] | 2017 | |
---|
| 2018 | //The value of vps_num_rep_formats_minus1 shall be in the range of 0 to 255, inclusive. |
---|
| 2019 | assert( getVpsNumRepFormatsMinus1() >= 0 ); |
---|
| 2020 | assert( getVpsNumRepFormatsMinus1() <= 255 ); |
---|
| 2021 | |
---|
[1066] | 2022 | // The value of num_add_layer_sets shall be in the range of 0 to 1023, inclusive. |
---|
| 2023 | assert( getNumAddLayerSets() >= 0 && getNumAddLayerSets() <= 1023 ); |
---|
[608] | 2024 | return true; |
---|
[56] | 2025 | } |
---|
[608] | 2026 | |
---|
[1200] | 2027 | Int TComVPS::getNumScalabilityTypes() const |
---|
[2] | 2028 | { |
---|
[608] | 2029 | return scalTypeToScalIdx( ScalabilityType(MAX_NUM_SCALABILITY_TYPES) ); |
---|
| 2030 | } |
---|
| 2031 | |
---|
[1200] | 2032 | Int TComVPS::scalTypeToScalIdx( ScalabilityType scalType ) const |
---|
[608] | 2033 | { |
---|
| 2034 | assert( scalType >= 0 && scalType <= MAX_NUM_SCALABILITY_TYPES ); |
---|
[622] | 2035 | assert( scalType == MAX_NUM_SCALABILITY_TYPES || getScalabilityMaskFlag( scalType ) ); |
---|
[608] | 2036 | Int scalIdx = 0; |
---|
| 2037 | for( Int curScalType = 0; curScalType < scalType; curScalType++ ) |
---|
[2] | 2038 | { |
---|
[622] | 2039 | scalIdx += ( getScalabilityMaskFlag( curScalType ) ? 1 : 0 ); |
---|
| 2040 | |
---|
[2] | 2041 | } |
---|
[608] | 2042 | |
---|
| 2043 | return scalIdx; |
---|
[2] | 2044 | } |
---|
[622] | 2045 | Void TComVPS::setScalabilityMaskFlag( UInt val ) |
---|
| 2046 | { |
---|
| 2047 | for ( Int scalType = 0; scalType < MAX_NUM_SCALABILITY_TYPES; scalType++ ) |
---|
| 2048 | { |
---|
| 2049 | setScalabilityMaskFlag( scalType, ( val & (1 << scalType ) ) != 0 ); |
---|
| 2050 | } |
---|
| 2051 | } |
---|
[189] | 2052 | |
---|
[608] | 2053 | Void TComVPS::setRefLayers() |
---|
| 2054 | { |
---|
[1066] | 2055 | |
---|
| 2056 | for( Int i = 0; i <= getMaxLayersMinus1(); i++ ) |
---|
| 2057 | { |
---|
| 2058 | for( Int j = 0; j <= getMaxLayersMinus1(); j++ ) |
---|
| 2059 | { |
---|
| 2060 | m_dependencyFlag[ i ][ j ] = getDirectDependencyFlag( i , j ); |
---|
| 2061 | for( Int k = 0; k < i; k++ ) |
---|
| 2062 | { |
---|
| 2063 | if( getDirectDependencyFlag(i , k ) && m_dependencyFlag[k][j] ) |
---|
| 2064 | { |
---|
| 2065 | m_dependencyFlag[ i ][ j ] = true; |
---|
| 2066 | } |
---|
| 2067 | } |
---|
| 2068 | } |
---|
| 2069 | } |
---|
| 2070 | |
---|
| 2071 | for( Int i = 0; i <= getMaxLayersMinus1(); i++ ) |
---|
| 2072 | { |
---|
| 2073 | Int iNuhLId = getLayerIdInNuh( i ); |
---|
| 2074 | Int d = 0; |
---|
[1200] | 2075 | #if NH_3D |
---|
[1124] | 2076 | Int l = 0; |
---|
| 2077 | #endif |
---|
[1066] | 2078 | Int r = 0; |
---|
| 2079 | Int p = 0; |
---|
[1124] | 2080 | |
---|
[1066] | 2081 | for( Int j = 0; j <= getMaxLayersMinus1(); j++ ) |
---|
| 2082 | { |
---|
| 2083 | Int jNuhLid = getLayerIdInNuh( j ); |
---|
| 2084 | if( getDirectDependencyFlag( i , j ) ) |
---|
| 2085 | { |
---|
| 2086 | m_idDirectRefLayer[iNuhLId][d++] = jNuhLid; |
---|
| 2087 | } |
---|
[1200] | 2088 | #if NH_3D |
---|
[1124] | 2089 | if( getDirectDependencyFlag( i , j ) && ( getDepthId( iNuhLId ) == getDepthId( jNuhLid ) )) |
---|
| 2090 | { |
---|
| 2091 | m_idRefListLayer [iNuhLId][l++] = jNuhLid; |
---|
| 2092 | } |
---|
| 2093 | #endif |
---|
| 2094 | |
---|
[1066] | 2095 | if( getDependencyFlag( i , j ) ) |
---|
| 2096 | { |
---|
| 2097 | m_idRefLayer [iNuhLId][r++] = jNuhLid; |
---|
| 2098 | } |
---|
| 2099 | if( getDependencyFlag( j , i ) ) |
---|
| 2100 | { |
---|
| 2101 | m_idPredictedLayer[iNuhLId][p++] = jNuhLid; |
---|
| 2102 | } |
---|
| 2103 | } |
---|
| 2104 | m_numDirectRefLayers[ iNuhLId ] = d; |
---|
[1200] | 2105 | #if NH_3D |
---|
[1124] | 2106 | m_numRefListLayers[ iNuhLId ] = l; |
---|
| 2107 | #endif |
---|
| 2108 | |
---|
[1066] | 2109 | m_numRefLayers [ iNuhLId ] = r; |
---|
| 2110 | m_numPredictedLayers[ iNuhLId ] = p; |
---|
| 2111 | } |
---|
| 2112 | |
---|
| 2113 | Bool layerIdInListFlag[ 64 ]; |
---|
| 2114 | for( Int i = 0; i <= 63; i++ ) |
---|
| 2115 | { |
---|
| 2116 | layerIdInListFlag[ i ] = 0; |
---|
| 2117 | } |
---|
| 2118 | |
---|
| 2119 | Int k = 0; |
---|
| 2120 | for( Int i = 0; i <= getMaxLayersMinus1(); i++ ) |
---|
| 2121 | { |
---|
| 2122 | Int iNuhLId = getLayerIdInNuh( i ); |
---|
| 2123 | if( getNumDirectRefLayers( iNuhLId ) == 0 ) |
---|
| 2124 | { |
---|
| 2125 | m_treePartitionLayerIdList[ k ][ 0 ] = iNuhLId; |
---|
| 2126 | Int h = 1; |
---|
| 2127 | for( Int j = 0; j < getNumPredictedLayers( iNuhLId ); j++ ) |
---|
| 2128 | { |
---|
| 2129 | Int predLId = getIdPredictedLayer( iNuhLId, j ); |
---|
| 2130 | if ( !layerIdInListFlag[ predLId ] ) |
---|
| 2131 | { |
---|
| 2132 | m_treePartitionLayerIdList[ k ][ h++ ] = predLId; |
---|
| 2133 | layerIdInListFlag[ predLId ] = 1; |
---|
| 2134 | } |
---|
| 2135 | } |
---|
| 2136 | m_numLayersInTreePartition[ k++ ] = h; |
---|
| 2137 | } |
---|
| 2138 | } |
---|
| 2139 | m_numIndependentLayers = k; |
---|
[622] | 2140 | } |
---|
| 2141 | |
---|
| 2142 | |
---|
[1124] | 2143 | Void TComVPS::initNumViews( ) |
---|
| 2144 | { |
---|
| 2145 | m_numViews = 1; |
---|
[1200] | 2146 | #if NH_3D |
---|
| 2147 | AOF( m_viewOIdxList.size() == 0 ); |
---|
[1124] | 2148 | m_viewOIdxList.push_back( 0 ); |
---|
| 2149 | #endif |
---|
| 2150 | |
---|
| 2151 | for( Int i = 0; i <= getMaxLayersMinus1(); i++ ) |
---|
| 2152 | { |
---|
| 2153 | Int lId = getLayerIdInNuh( i ); |
---|
| 2154 | if( i > 0 ) |
---|
| 2155 | { |
---|
| 2156 | Bool newViewFlag = true; |
---|
| 2157 | for( Int j = 0; j < i; j++ ) |
---|
| 2158 | { |
---|
| 2159 | if( getViewOrderIdx( lId ) == getViewOrderIdx( getLayerIdInNuh( j ) ) ) |
---|
| 2160 | { |
---|
| 2161 | newViewFlag = false; |
---|
| 2162 | } |
---|
| 2163 | } |
---|
| 2164 | if( newViewFlag ) |
---|
| 2165 | { |
---|
| 2166 | m_numViews++; |
---|
[1200] | 2167 | #if NH_3D |
---|
[1124] | 2168 | m_viewOIdxList.push_back( getViewOrderIdx( lId ) ); |
---|
| 2169 | #endif |
---|
| 2170 | } |
---|
| 2171 | } |
---|
| 2172 | } |
---|
| 2173 | } |
---|
| 2174 | |
---|
| 2175 | |
---|
[1200] | 2176 | Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType ) const |
---|
[622] | 2177 | { |
---|
| 2178 | return getScalabilityMaskFlag( scalType ) ? getDimensionId( layerIdInVps, scalTypeToScalIdx( scalType ) ) : 0; |
---|
| 2179 | } |
---|
| 2180 | |
---|
[1200] | 2181 | #if NH_3D |
---|
| 2182 | Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag ) const |
---|
[622] | 2183 | { |
---|
| 2184 | Int foundLayerIdinNuh = -1; |
---|
| 2185 | |
---|
| 2186 | for (Int layerIdInVps = 0 ; layerIdInVps <= getMaxLayersMinus1(); layerIdInVps++ ) |
---|
| 2187 | { |
---|
| 2188 | Int layerIdInNuh = getLayerIdInNuh( layerIdInVps ); |
---|
| 2189 | if( ( getViewIndex( layerIdInNuh ) == viewIndex ) && ( getDepthId( layerIdInNuh ) == ( depthFlag ? 1 : 0 ) ) ) |
---|
| 2190 | { |
---|
| 2191 | foundLayerIdinNuh = layerIdInNuh; |
---|
| 2192 | break; |
---|
| 2193 | } |
---|
| 2194 | } |
---|
| 2195 | return foundLayerIdinNuh; |
---|
| 2196 | } |
---|
[773] | 2197 | |
---|
[758] | 2198 | Void TComVPS::createCamPars(Int iNumViews) |
---|
| 2199 | { |
---|
[1200] | 2200 | m_numCp .resize( iNumViews ); |
---|
| 2201 | m_cpRefVoi .resize( iNumViews ); |
---|
| 2202 | m_cpInSliceSegmentHeaderFlag.resize( iNumViews ); |
---|
| 2203 | m_cpPresentFlag .resize( iNumViews ); |
---|
| 2204 | m_aaaiCodedScale .resize( iNumViews ); |
---|
| 2205 | m_aaaiCodedOffset .resize( iNumViews ); |
---|
[758] | 2206 | |
---|
[1200] | 2207 | for ( Int i = 0; i < iNumViews ; i++ ) |
---|
[758] | 2208 | { |
---|
[1200] | 2209 | m_numCp [i] = 0; |
---|
| 2210 | m_cpRefVoi [i].resize( iNumViews ); |
---|
| 2211 | m_cpInSliceSegmentHeaderFlag[i] = false; |
---|
| 2212 | m_aaaiCodedScale [i].resize( 2 ); |
---|
| 2213 | m_aaaiCodedOffset [i].resize( 2 ); |
---|
| 2214 | m_cpPresentFlag [i].resize( iNumViews ); |
---|
[1179] | 2215 | |
---|
[1200] | 2216 | for ( Int j = 0; j < iNumViews; j++) |
---|
[1179] | 2217 | { |
---|
[1200] | 2218 | m_cpRefVoi [i][j] = 0; |
---|
| 2219 | m_cpPresentFlag [i][j] = false; |
---|
[1179] | 2220 | } |
---|
[1200] | 2221 | |
---|
| 2222 | for ( Int j = 0; j < 2; j++ ) |
---|
[758] | 2223 | { |
---|
[1200] | 2224 | m_aaaiCodedScale [i][j].resize( MAX_NUM_LAYERS ); |
---|
| 2225 | m_aaaiCodedOffset [i][j].resize( MAX_NUM_LAYERS ); |
---|
| 2226 | |
---|
[758] | 2227 | for ( Int k = 0; k < MAX_NUM_LAYERS; k++ ) |
---|
| 2228 | { |
---|
[1200] | 2229 | m_aaaiCodedScale [i][j][k] = 0; |
---|
[758] | 2230 | m_aaaiCodedOffset[i][j][k] = 0; |
---|
| 2231 | } |
---|
| 2232 | } |
---|
| 2233 | } |
---|
| 2234 | } |
---|
[622] | 2235 | #endif // H_3D |
---|
[189] | 2236 | |
---|
[608] | 2237 | |
---|
[1200] | 2238 | Int TComVPS::xGetDimBitOffset( Int j ) const |
---|
[608] | 2239 | { |
---|
| 2240 | Int dimBitOffset = 0; |
---|
| 2241 | if ( getSplittingFlag() && j == getNumScalabilityTypes() ) |
---|
| 2242 | { |
---|
| 2243 | dimBitOffset = 6; |
---|
| 2244 | } |
---|
[443] | 2245 | else |
---|
| 2246 | { |
---|
[608] | 2247 | for (Int dimIdx = 0; dimIdx <= j-1; dimIdx++) |
---|
[443] | 2248 | { |
---|
[608] | 2249 | dimBitOffset += getDimensionIdLen( dimIdx ); |
---|
[443] | 2250 | } |
---|
| 2251 | } |
---|
[608] | 2252 | return dimBitOffset; |
---|
[443] | 2253 | } |
---|
[608] | 2254 | |
---|
[1200] | 2255 | Int TComVPS::inferDimensionId( Int i, Int j ) const |
---|
[210] | 2256 | { |
---|
[608] | 2257 | return ( ( getLayerIdInNuh( i ) & ( (1 << xGetDimBitOffset( j + 1 ) ) - 1) ) >> xGetDimBitOffset( j ) ); |
---|
[210] | 2258 | } |
---|
| 2259 | |
---|
[1200] | 2260 | Int TComVPS::inferLastDimsionIdLenMinus1() const |
---|
[210] | 2261 | { |
---|
[608] | 2262 | return ( 5 - xGetDimBitOffset( getNumScalabilityTypes() - 1 ) ); |
---|
[210] | 2263 | } |
---|
[608] | 2264 | |
---|
[1200] | 2265 | Int TComVPS::getNumLayersInIdList( Int lsIdx ) const |
---|
[77] | 2266 | { |
---|
[608] | 2267 | assert( lsIdx >= 0 ); |
---|
[1066] | 2268 | assert( lsIdx <= getNumLayerSets() ); |
---|
[738] | 2269 | return (Int) m_layerSetLayerIdList[ lsIdx ].size(); |
---|
[77] | 2270 | } |
---|
[738] | 2271 | |
---|
[1200] | 2272 | Int TComVPS::getNumOutputLayerSets() const |
---|
[738] | 2273 | { |
---|
[964] | 2274 | return getNumAddOlss() + getNumLayerSets(); |
---|
[738] | 2275 | } |
---|
| 2276 | |
---|
[622] | 2277 | |
---|
| 2278 | |
---|
[738] | 2279 | Void TComVPS::deriveLayerSetLayerIdList() |
---|
| 2280 | { |
---|
| 2281 | m_layerSetLayerIdList.resize( getVpsNumLayerSetsMinus1() + 1 ); |
---|
| 2282 | for (Int i = 0; i <= getVpsNumLayerSetsMinus1(); i++ ) |
---|
| 2283 | { |
---|
| 2284 | for( Int m = 0; m <= getVpsMaxLayerId(); m++ ) |
---|
| 2285 | { |
---|
| 2286 | if( getLayerIdIncludedFlag( i, m) ) |
---|
| 2287 | { |
---|
| 2288 | m_layerSetLayerIdList[ i ].push_back( m ); |
---|
| 2289 | } |
---|
| 2290 | } |
---|
| 2291 | } |
---|
| 2292 | } |
---|
| 2293 | |
---|
[872] | 2294 | Void TComVPS::initTargetLayerIdLists() |
---|
| 2295 | { |
---|
| 2296 | m_targetDecLayerIdLists.resize( getNumOutputLayerSets() ); |
---|
| 2297 | m_targetOptLayerIdLists.resize( getNumOutputLayerSets() ); |
---|
| 2298 | } |
---|
| 2299 | |
---|
| 2300 | Void TComVPS::deriveTargetLayerIdList( Int i ) |
---|
| 2301 | { |
---|
[964] | 2302 | Int lsIdx = olsIdxToLsIdx( i ); |
---|
[1066] | 2303 | |
---|
[872] | 2304 | for( Int j = 0; j < getNumLayersInIdList( lsIdx ); j++ ) |
---|
| 2305 | { |
---|
[1066] | 2306 | if ( getNecessaryLayerFlag( i , j )) |
---|
| 2307 | { |
---|
| 2308 | m_targetDecLayerIdLists[i].push_back( m_layerSetLayerIdList[ lsIdx ][ j ] ); |
---|
| 2309 | } |
---|
| 2310 | |
---|
[872] | 2311 | if( getOutputLayerFlag( i, j )) |
---|
| 2312 | { |
---|
| 2313 | m_targetOptLayerIdLists[i].push_back( m_layerSetLayerIdList[ lsIdx ][ j ] ); |
---|
| 2314 | } |
---|
| 2315 | } |
---|
[964] | 2316 | assert( getNumOutputLayersInOutputLayerSet( i ) > 0 ); |
---|
[872] | 2317 | } |
---|
[884] | 2318 | |
---|
[1200] | 2319 | Bool TComVPS::inferOutputLayerFlag( Int i, Int j ) const |
---|
[738] | 2320 | { |
---|
[884] | 2321 | Bool outputLayerFlag; |
---|
[964] | 2322 | switch ( getDefaultOutputLayerIdc( ) ) |
---|
[738] | 2323 | { |
---|
[884] | 2324 | case 0: |
---|
| 2325 | outputLayerFlag = true; |
---|
| 2326 | break; |
---|
| 2327 | case 1: |
---|
[964] | 2328 | outputLayerFlag = ( j == m_layerSetLayerIdList[ olsIdxToLsIdx( i ) ].size() - 1 ); |
---|
[884] | 2329 | break; |
---|
| 2330 | case 2: |
---|
| 2331 | if ( i == 0 && j == 0) |
---|
| 2332 | { |
---|
| 2333 | outputLayerFlag = true; // This is a software only fix for a bug in the spec. In spec outputLayerFlag is neither present nor inferred. |
---|
| 2334 | } |
---|
| 2335 | else |
---|
[738] | 2336 | { |
---|
[884] | 2337 | assert( 0 ); |
---|
| 2338 | } |
---|
| 2339 | break; |
---|
| 2340 | default: |
---|
| 2341 | assert( 0 ); |
---|
| 2342 | break; |
---|
[738] | 2343 | } |
---|
[884] | 2344 | return outputLayerFlag; |
---|
[738] | 2345 | } |
---|
[872] | 2346 | |
---|
[1200] | 2347 | Int TComVPS::getMaxSubLayersInLayerSetMinus1( Int i ) const |
---|
[884] | 2348 | { |
---|
| 2349 | Int maxSLMinus1 = 0; |
---|
[964] | 2350 | for( Int k = 0; k < getNumLayersInIdList( i ); k++ ) |
---|
| 2351 | { |
---|
| 2352 | Int lId = m_layerSetLayerIdList[i][k]; |
---|
[884] | 2353 | maxSLMinus1 = std::max( maxSLMinus1, getSubLayersVpsMaxMinus1( getLayerIdInVps( lId ) )); |
---|
| 2354 | } |
---|
| 2355 | return maxSLMinus1; |
---|
| 2356 | } |
---|
[976] | 2357 | |
---|
[1200] | 2358 | Bool TComVPS::getAltOutputLayerFlagVar( Int i ) const |
---|
[976] | 2359 | { |
---|
| 2360 | // Semantics variable not syntax element ! |
---|
| 2361 | |
---|
| 2362 | Bool altOptLayerFlag = false; |
---|
| 2363 | if ( i > 0 && getNumOutputLayersInOutputLayerSet( i ) == 1 && |
---|
| 2364 | getNumDirectRefLayers( getOlsHighestOutputLayerId( i ) ) > 0 ) |
---|
| 2365 | { |
---|
| 2366 | altOptLayerFlag = getAltOutputLayerFlag( i ); |
---|
| 2367 | } |
---|
| 2368 | return altOptLayerFlag; |
---|
| 2369 | } |
---|
| 2370 | |
---|
| 2371 | |
---|
| 2372 | |
---|
[1200] | 2373 | Int TComVPS::inferProfileTierLevelIdx(Int i, Int j) const |
---|
[1066] | 2374 | { |
---|
| 2375 | Bool inferZero = ( i == 0 && j == 0 && getVpsBaseLayerInternalFlag() ); |
---|
| 2376 | Bool inferGreaterZero = getNecessaryLayerFlag(i,j) && ( getVpsNumProfileTierLevelMinus1() == 0 ); |
---|
| 2377 | assert( inferZero || inferGreaterZero ); |
---|
| 2378 | |
---|
| 2379 | Bool ptlIdx = 0; // inference for greaterZero |
---|
| 2380 | if ( inferZero ) |
---|
| 2381 | { |
---|
| 2382 | ptlIdx = getMaxLayersMinus1() > 0 ? 1 : 0; |
---|
| 2383 | if ( inferGreaterZero ) |
---|
| 2384 | { |
---|
| 2385 | assert( ptlIdx == 0 ); |
---|
| 2386 | // This should never happen since : |
---|
| 2387 | // When vps_max_layers_minus1 is greater than 0, the value of vps_num_profile_tier_level_minus1 shall be greater than or equal to 1. |
---|
| 2388 | } |
---|
| 2389 | } |
---|
| 2390 | return ptlIdx; |
---|
| 2391 | } |
---|
| 2392 | |
---|
| 2393 | Void TComVPS::deriveAddLayerSetLayerIdList(Int i) |
---|
| 2394 | { |
---|
| 2395 | assert( m_layerSetLayerIdList.size() == ( getVpsNumLayerSetsMinus1() + 1 + i ) ); |
---|
| 2396 | std::vector<Int> layerSetLayerIdList; |
---|
| 2397 | |
---|
| 2398 | for( Int treeIdx = 1; treeIdx < getNumIndependentLayers(); treeIdx++ ) |
---|
| 2399 | { |
---|
| 2400 | // The value of highest_layer_idx_plus1[ i ][ j ] shall be in the range of 0 to NumLayersInTreePartition[ j ], inclusive. |
---|
| 2401 | assert( getHighestLayerIdxPlus1( i, treeIdx ) >= 0 && getHighestLayerIdxPlus1( i, treeIdx ) <= getNumLayersInTreePartition( treeIdx ) ); |
---|
| 2402 | |
---|
| 2403 | for( Int layerCnt = 0; layerCnt < getHighestLayerIdxPlus1( i, treeIdx ); layerCnt++ ) |
---|
| 2404 | { |
---|
| 2405 | layerSetLayerIdList.push_back( getTreePartitionLayerIdList( treeIdx, layerCnt ) ); |
---|
| 2406 | } |
---|
| 2407 | } |
---|
| 2408 | m_layerSetLayerIdList.push_back( layerSetLayerIdList ); |
---|
| 2409 | |
---|
| 2410 | //It is a requirement of bitstream conformance that |
---|
| 2411 | //NumLayersInIdList[ vps_num_layer_sets_minus1 + 1 + i ] shall be greater than 0. |
---|
| 2412 | assert( getNumLayersInIdList( getVpsNumLayerSetsMinus1() + 1 + i ) > 0 ); |
---|
| 2413 | } |
---|
| 2414 | |
---|
| 2415 | |
---|
| 2416 | Void TComVPS::deriveNecessaryLayerFlags(Int olsIdx) |
---|
| 2417 | { |
---|
| 2418 | AOF( olsIdx >= 0 && olsIdx < getNumOutputLayerSets() ); |
---|
| 2419 | Int lsIdx = olsIdxToLsIdx( olsIdx ); |
---|
| 2420 | for( Int lsLayerIdx = 0; lsLayerIdx < getNumLayersInIdList( lsIdx) ; lsLayerIdx++ ) |
---|
| 2421 | { |
---|
| 2422 | m_necessaryLayerFlag[ olsIdx ][ lsLayerIdx ] = 0; |
---|
| 2423 | } |
---|
| 2424 | for( Int lsLayerIdx = 0; lsLayerIdx < getNumLayersInIdList( lsIdx ); lsLayerIdx++ ) |
---|
| 2425 | { |
---|
| 2426 | if( getOutputLayerFlag( olsIdx, lsLayerIdx )) |
---|
| 2427 | { |
---|
| 2428 | m_necessaryLayerFlag[ olsIdx ][ lsLayerIdx ] = 1; |
---|
| 2429 | Int currLayerId = getLayerSetLayerIdList( lsIdx, lsLayerIdx ); |
---|
| 2430 | for( Int rLsLayerIdx = 0; rLsLayerIdx < lsLayerIdx; rLsLayerIdx++ ) |
---|
| 2431 | { |
---|
| 2432 | Int refLayerId = getLayerSetLayerIdList( lsIdx, rLsLayerIdx ); |
---|
| 2433 | if( getDependencyFlag( getLayerIdInVps( currLayerId ), getLayerIdInVps( refLayerId ) ) ) |
---|
| 2434 | { |
---|
| 2435 | m_necessaryLayerFlag[ olsIdx ][ rLsLayerIdx ] = 1; |
---|
| 2436 | } |
---|
| 2437 | } |
---|
| 2438 | } |
---|
| 2439 | } |
---|
| 2440 | m_numNecessaryLayers[ olsIdx ] = 0; |
---|
| 2441 | for( Int lsLayerIdx = 0; lsLayerIdx < getNumLayersInIdList( lsIdx ); lsLayerIdx++ ) |
---|
| 2442 | { |
---|
| 2443 | m_numNecessaryLayers[ olsIdx ] += m_necessaryLayerFlag[ olsIdx ][ lsLayerIdx ]; |
---|
| 2444 | } |
---|
| 2445 | } |
---|
| 2446 | |
---|
[1200] | 2447 | Void TComVPS::printPTL() const |
---|
[1066] | 2448 | { |
---|
| 2449 | std::vector<Int> idx; |
---|
| 2450 | std::vector<Int> num; |
---|
[1200] | 2451 | IntAry2d ptlInfo; |
---|
[1066] | 2452 | |
---|
| 2453 | std::cout << std::right << std::setw(60) << std::setfill('-') << " " << std::setfill(' ') << std::endl << "PTLI" << std::endl; |
---|
| 2454 | |
---|
| 2455 | for ( Int i = 0; i <= getVpsNumProfileTierLevelMinus1(); i++ ) |
---|
| 2456 | { |
---|
| 2457 | std::vector<Int> curPtlInfo; |
---|
[1200] | 2458 | const ProfileTierLevel* ptl = getPTL( i )->getGeneralPTL(); |
---|
[1066] | 2459 | curPtlInfo.push_back( (Int) ptl->getProfileIdc() ); |
---|
| 2460 | curPtlInfo.push_back( (Int) ptl->getTierFlag() ); |
---|
| 2461 | curPtlInfo.push_back( (Int) ptl->getLevelIdc() ); |
---|
| 2462 | curPtlInfo.push_back( (Int) ptl->getInbldFlag() ); |
---|
| 2463 | |
---|
| 2464 | idx.push_back ( i ); |
---|
| 2465 | num.push_back ( 4 ); |
---|
| 2466 | ptlInfo.push_back( curPtlInfo ); |
---|
| 2467 | } |
---|
| 2468 | |
---|
| 2469 | xPrintArray( "VpsProfileTierLevel", getVpsNumProfileTierLevelMinus1() + 1, idx, num, ptlInfo, false ); |
---|
| 2470 | |
---|
| 2471 | num.clear(); |
---|
| 2472 | idx.clear(); |
---|
| 2473 | for (Int i = 0; i < getNumOutputLayerSets(); i++) |
---|
| 2474 | { |
---|
| 2475 | num.push_back ( getNumLayersInIdList( olsIdxToLsIdx( i )) ); |
---|
| 2476 | idx.push_back( i ); |
---|
| 2477 | } |
---|
| 2478 | |
---|
| 2479 | xPrintArray( "profile_tier_level_idx", getNumOutputLayerSets(), idx, num, m_profileTierLevelIdx, true ); |
---|
| 2480 | std::cout << std::endl; |
---|
| 2481 | } |
---|
| 2482 | |
---|
[1200] | 2483 | Void TComVPS::printLayerDependencies() const |
---|
[1066] | 2484 | { |
---|
| 2485 | vector<Int> fullArray; |
---|
| 2486 | vector<Int> range; |
---|
| 2487 | |
---|
[1200] | 2488 | #if NH_3D |
---|
[1066] | 2489 | vector<Int> depthId; |
---|
| 2490 | #endif |
---|
| 2491 | |
---|
| 2492 | vector<Int> viewOrderIndex; |
---|
| 2493 | vector<Int> auxId; |
---|
| 2494 | vector<Int> dependencyId; |
---|
| 2495 | vector<Int> viewId; |
---|
| 2496 | for (Int i = 0; i <= getMaxLayersMinus1(); i++ ) |
---|
| 2497 | { |
---|
| 2498 | fullArray.push_back( getMaxLayersMinus1() + 1 ); |
---|
| 2499 | range.push_back( i ); |
---|
| 2500 | viewOrderIndex.push_back( getViewIndex ( i ) ); |
---|
| 2501 | dependencyId .push_back( getDependencyId( i ) ); |
---|
| 2502 | auxId .push_back( getAuxId ( i ) ); |
---|
| 2503 | viewId .push_back( getViewId ( getLayerIdInNuh( i ) ) ); |
---|
| 2504 | #if H_3D |
---|
| 2505 | depthId.push_back( getDepthId( i ) ); |
---|
| 2506 | #endif |
---|
| 2507 | } |
---|
| 2508 | std::cout << std::right << std::setw(60) << std::setfill('-') << " " << std::setfill(' ') << std::endl << "Layer Dependencies" << std::endl; |
---|
| 2509 | xPrintArray( "direct_dependency_flag", getMaxLayersMinus1()+1, range, fullArray, m_directDependencyFlag, false ); |
---|
| 2510 | xPrintArray( "DependencyFlag", getMaxLayersMinus1()+1, range, fullArray, m_dependencyFlag, false ); |
---|
| 2511 | xPrintArray( "layer_id_in_nuh", getMaxLayersMinus1()+1, m_layerIdInNuh, true ); |
---|
| 2512 | xPrintArray( "IdPredictedLayer", getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numPredictedLayers, m_idPredictedLayer, true ); |
---|
| 2513 | xPrintArray( "IdRefLayer" , getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numRefLayers, m_idRefLayer, true ); |
---|
| 2514 | xPrintArray( "IdDirectRefLayer", getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numDirectRefLayers, m_idDirectRefLayer, true ); |
---|
[1200] | 2515 | #if NH_3D |
---|
[1124] | 2516 | xPrintArray( "IdRefListLayer", getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numRefListLayers, m_idRefListLayer, true ); |
---|
| 2517 | #endif |
---|
| 2518 | |
---|
[1066] | 2519 | std::cout << std::endl; |
---|
| 2520 | } |
---|
| 2521 | |
---|
[1200] | 2522 | Void TComVPS::printScalabilityId() const |
---|
[1066] | 2523 | { |
---|
| 2524 | vector<Int> layerIdxInVps; |
---|
| 2525 | |
---|
[1200] | 2526 | |
---|
[1066] | 2527 | vector<Int> depthId; |
---|
| 2528 | vector<Int> viewOrderIndex; |
---|
| 2529 | vector<Int> auxId; |
---|
| 2530 | vector<Int> dependencyId; |
---|
| 2531 | vector<Int> viewId; |
---|
| 2532 | |
---|
| 2533 | for (Int i = 0; i <= getMaxLayersMinus1(); i++ ) |
---|
| 2534 | { |
---|
| 2535 | Int layerIdInNuh = getLayerIdInNuh( i ); |
---|
| 2536 | layerIdxInVps .push_back( i ); |
---|
[1200] | 2537 | depthId .push_back( getDepthId ( layerIdInNuh ) ); |
---|
[1066] | 2538 | viewOrderIndex.push_back( getViewIndex ( layerIdInNuh ) ); |
---|
| 2539 | dependencyId .push_back( getDependencyId( layerIdInNuh ) ); |
---|
| 2540 | auxId .push_back( getAuxId ( layerIdInNuh ) ); |
---|
| 2541 | viewId .push_back( getViewId ( layerIdInNuh ) ); |
---|
[1200] | 2542 | |
---|
[1066] | 2543 | } |
---|
| 2544 | |
---|
| 2545 | std::cout << std::right << std::setw(60) << std::setfill('-') << " " << std::setfill(' ') << std::endl << "Scalability Ids" << std::endl; |
---|
| 2546 | xPrintArray( "layerIdxInVps" , getMaxLayersMinus1()+1, layerIdxInVps, false ); |
---|
| 2547 | xPrintArray( "layer_id_in_nuh", getMaxLayersMinus1()+1, m_layerIdInNuh, false ); |
---|
| 2548 | |
---|
[1200] | 2549 | xPrintArray( "DepthLayerFlag", getMaxLayersMinus1()+1, depthId , false ); |
---|
| 2550 | xPrintArray( "ViewOrderIdx" , getMaxLayersMinus1()+1, viewOrderIndex, false ); |
---|
[1066] | 2551 | xPrintArray( "DependencyId" , getMaxLayersMinus1()+1, dependencyId , false ); |
---|
| 2552 | xPrintArray( "AuxId" , getMaxLayersMinus1()+1, auxId , false ); |
---|
[1200] | 2553 | xPrintArray( "ViewIdVal" , getMaxLayersMinus1()+1, viewId , false ); |
---|
[1066] | 2554 | |
---|
| 2555 | std::cout << std::endl; |
---|
| 2556 | } |
---|
| 2557 | |
---|
[1200] | 2558 | Void TComVPS::printLayerSets() const |
---|
[1066] | 2559 | { |
---|
| 2560 | vector<Int> fullArray; |
---|
| 2561 | vector<Int> numLayersInIdList; |
---|
| 2562 | vector<Int> rangeLayerSets; |
---|
| 2563 | |
---|
| 2564 | |
---|
| 2565 | for (Int i = 0; i < getNumLayerSets(); i++ ) |
---|
| 2566 | { |
---|
| 2567 | numLayersInIdList.push_back( getNumLayersInIdList( i ) ); |
---|
| 2568 | rangeLayerSets.push_back( i ); |
---|
| 2569 | } |
---|
| 2570 | |
---|
| 2571 | vector<Int> rangeOutputLayerSets; |
---|
| 2572 | vector<Int> numOutputLayersInOutputLayerSet; |
---|
| 2573 | vector<Int> numDecLayer; |
---|
| 2574 | vector<Int> numLayersInLayerSetForOutputLayerSet; |
---|
| 2575 | vector<Int> vOlsIdxToLsIdx; |
---|
| 2576 | for (Int i = 0; i < getNumOutputLayerSets(); i++ ) |
---|
| 2577 | { |
---|
| 2578 | vOlsIdxToLsIdx.push_back( olsIdxToLsIdx(i)); |
---|
| 2579 | numOutputLayersInOutputLayerSet.push_back( getNumOutputLayersInOutputLayerSet( i ) ); |
---|
| 2580 | numDecLayer.push_back( (Int) m_targetDecLayerIdLists[ i ].size() ); |
---|
| 2581 | rangeOutputLayerSets.push_back( i ); |
---|
| 2582 | numLayersInLayerSetForOutputLayerSet.push_back( getNumLayersInIdList( olsIdxToLsIdx( i ) ) ); |
---|
| 2583 | } |
---|
| 2584 | |
---|
| 2585 | vector<Int> rangeIndependentLayers; |
---|
| 2586 | for(Int i = 0; i < getNumIndependentLayers(); i++ ) |
---|
| 2587 | { |
---|
| 2588 | rangeIndependentLayers.push_back( i ); |
---|
| 2589 | } |
---|
| 2590 | |
---|
| 2591 | vector<Int> rangeAddLayerSets; |
---|
| 2592 | vector<Int> numHighestLayerIdxPlus1; |
---|
| 2593 | for(Int i = 0; i < getNumAddLayerSets(); i++ ) |
---|
| 2594 | { |
---|
| 2595 | rangeAddLayerSets.push_back( i ); |
---|
| 2596 | numHighestLayerIdxPlus1.push_back( getNumIndependentLayers() ); |
---|
| 2597 | } |
---|
| 2598 | |
---|
| 2599 | std::cout << std::right << std::setw(60) << std::setfill('-') << " " << std::setfill(' ') << std::endl << "Layer Sets" << std::endl; |
---|
| 2600 | xPrintArray( "TreePartitionLayerIdList", getNumIndependentLayers(), rangeIndependentLayers, m_numLayersInTreePartition, m_treePartitionLayerIdList, true ); |
---|
| 2601 | xPrintArray( "highest_layer_idx_plus1", getNumAddLayerSets(), rangeAddLayerSets, numHighestLayerIdxPlus1, m_highestLayerIdxPlus1, true ); |
---|
| 2602 | xPrintArray( "LayerSetLayerIdList" , (Int) getNumLayerSets() , rangeLayerSets , numLayersInIdList, m_layerSetLayerIdList, true ); |
---|
| 2603 | xPrintArray( "OlsIdxToLsIdx", (Int) vOlsIdxToLsIdx.size(), vOlsIdxToLsIdx, true ); |
---|
| 2604 | xPrintArray( "OutputLayerFlag" , getNumOutputLayerSets(), rangeOutputLayerSets, numLayersInLayerSetForOutputLayerSet, m_outputLayerFlag, true ); |
---|
| 2605 | xPrintArray( "TargetOptLayerIdList", getNumOutputLayerSets(), rangeOutputLayerSets, numOutputLayersInOutputLayerSet, m_targetOptLayerIdLists, true ); |
---|
| 2606 | xPrintArray( "NecessaryLayerFlag" , getNumOutputLayerSets(), rangeOutputLayerSets, numLayersInLayerSetForOutputLayerSet, m_necessaryLayerFlag , true ); |
---|
| 2607 | xPrintArray( "TargetDecLayerIdList", getNumOutputLayerSets(), rangeOutputLayerSets, numDecLayer, m_targetDecLayerIdLists, true ); |
---|
| 2608 | std::cout << endl; |
---|
| 2609 | } |
---|
| 2610 | |
---|
[1200] | 2611 | #if NH_3D |
---|
[1196] | 2612 | Void TComVPS::initViewCompLayer() |
---|
| 2613 | { |
---|
| 2614 | assert( m_viewCompLayerId.size() == 0 && m_viewCompLayerPresentFlag.size() == 0 ); |
---|
| 2615 | for( Int i = 0; i < getNumViews(); i++ ) |
---|
| 2616 | { |
---|
| 2617 | m_viewCompLayerId .push_back( std::vector<Int>(0) ); |
---|
| 2618 | m_viewCompLayerPresentFlag.push_back( std::vector<Bool>(0) ); |
---|
[1066] | 2619 | |
---|
[1196] | 2620 | for( Int depFlag = 0; depFlag <= 1; depFlag++ ) |
---|
| 2621 | { |
---|
| 2622 | Int iViewOIdx = getViewOIdxList( i ); |
---|
| 2623 | Int layerId = -1; |
---|
| 2624 | for( Int j = 0; j <= getMaxLayersMinus1(); j++ ) |
---|
| 2625 | { |
---|
| 2626 | Int jNuhLId = getLayerIdInNuh( j ); |
---|
| 2627 | if( getVpsDepthFlag( jNuhLId ) == ( (Bool) depFlag ) && getViewOrderIdx( jNuhLId ) == iViewOIdx |
---|
| 2628 | && getDependencyId( jNuhLId ) == 0 && getAuxId( jNuhLId ) == 0 ) |
---|
| 2629 | { |
---|
| 2630 | layerId = jNuhLId; |
---|
| 2631 | } |
---|
| 2632 | } |
---|
| 2633 | m_viewCompLayerPresentFlag[ i ].push_back( layerId != -1 ); |
---|
| 2634 | m_viewCompLayerId [ i ].push_back( layerId ); |
---|
| 2635 | } |
---|
| 2636 | } |
---|
| 2637 | } |
---|
| 2638 | |
---|
[1200] | 2639 | Int TComVPS::getVoiInVps(Int viewOIdx) const |
---|
[1196] | 2640 | { |
---|
| 2641 | for ( Int i = 0; i < m_viewOIdxList.size(); i++ ) |
---|
| 2642 | { |
---|
| 2643 | if ( m_viewOIdxList[ i ] == viewOIdx ) |
---|
| 2644 | { |
---|
| 2645 | return i; |
---|
| 2646 | } |
---|
| 2647 | } |
---|
| 2648 | assert( 0 ); |
---|
| 2649 | return -1; |
---|
| 2650 | } |
---|
| 2651 | |
---|
| 2652 | Void TComVPS::deriveCpPresentFlag() |
---|
| 2653 | { |
---|
| 2654 | for( Int nInVps = 0; nInVps < getNumViews(); nInVps++ ) |
---|
| 2655 | { |
---|
| 2656 | for( Int mInVps = 0; mInVps < getNumViews(); mInVps++ ) |
---|
| 2657 | { |
---|
| 2658 | m_cpPresentFlag[nInVps][mInVps] = 0; |
---|
| 2659 | } |
---|
| 2660 | } |
---|
| 2661 | |
---|
| 2662 | for( Int n = 1; n < getNumViews(); n++ ) |
---|
| 2663 | { |
---|
| 2664 | Int iInVps = getVoiInVps( getViewOIdxList( n ) ); |
---|
| 2665 | for( Int m = 0; m < getNumCp( iInVps ); m++ ) |
---|
| 2666 | { |
---|
| 2667 | m_cpPresentFlag[ iInVps ][ getVoiInVps( getCpRefVoi( iInVps, m ) ) ] = 1; |
---|
| 2668 | } |
---|
| 2669 | } |
---|
| 2670 | } |
---|
| 2671 | #endif |
---|
| 2672 | |
---|
[1200] | 2673 | #endif // NH_MV |
---|
[56] | 2674 | |
---|
[2] | 2675 | // ------------------------------------------------------------------------------------------------ |
---|
| 2676 | // Sequence parameter set (SPS) |
---|
| 2677 | // ------------------------------------------------------------------------------------------------ |
---|
| 2678 | |
---|
[1200] | 2679 | TComSPSRExt::TComSPSRExt() |
---|
| 2680 | : m_transformSkipRotationEnabledFlag (false) |
---|
| 2681 | , m_transformSkipContextEnabledFlag (false) |
---|
| 2682 | // m_rdpcmEnabledFlag initialized below |
---|
| 2683 | , m_extendedPrecisionProcessingFlag (false) |
---|
| 2684 | , m_intraSmoothingDisabledFlag (false) |
---|
| 2685 | , m_highPrecisionOffsetsEnabledFlag (false) |
---|
| 2686 | , m_persistentRiceAdaptationEnabledFlag(false) |
---|
| 2687 | , m_cabacBypassAlignmentEnabledFlag (false) |
---|
| 2688 | { |
---|
| 2689 | for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++) |
---|
| 2690 | { |
---|
| 2691 | m_rdpcmEnabledFlag[signallingModeIndex] = false; |
---|
| 2692 | } |
---|
| 2693 | } |
---|
| 2694 | |
---|
[2] | 2695 | TComSPS::TComSPS() |
---|
[56] | 2696 | : m_SPSId ( 0) |
---|
[608] | 2697 | , m_VPSId ( 0) |
---|
[56] | 2698 | , m_chromaFormatIdc (CHROMA_420) |
---|
| 2699 | , m_uiMaxTLayers ( 1) |
---|
| 2700 | // Structure |
---|
| 2701 | , m_picWidthInLumaSamples (352) |
---|
| 2702 | , m_picHeightInLumaSamples (288) |
---|
[608] | 2703 | , m_log2MinCodingBlockSize ( 0) |
---|
[1200] | 2704 | , m_log2DiffMaxMinCodingBlockSize(0) |
---|
[56] | 2705 | , m_uiMaxCUWidth ( 32) |
---|
| 2706 | , m_uiMaxCUHeight ( 32) |
---|
[1200] | 2707 | , m_uiMaxTotalCUDepth ( 3) |
---|
[56] | 2708 | , m_bLongTermRefsPresent (false) |
---|
| 2709 | , m_uiQuadtreeTULog2MaxSize ( 0) |
---|
| 2710 | , m_uiQuadtreeTULog2MinSize ( 0) |
---|
| 2711 | , m_uiQuadtreeTUMaxDepthInter ( 0) |
---|
| 2712 | , m_uiQuadtreeTUMaxDepthIntra ( 0) |
---|
| 2713 | // Tool list |
---|
[1200] | 2714 | , m_usePCM (false) |
---|
[56] | 2715 | , m_pcmLog2MaxSize ( 5) |
---|
| 2716 | , m_uiPCMLog2MinSize ( 7) |
---|
| 2717 | , m_bPCMFilterDisableFlag (false) |
---|
| 2718 | , m_uiBitsForPOC ( 8) |
---|
[1200] | 2719 | , m_numLongTermRefPicSPS ( 0) |
---|
[56] | 2720 | , m_uiMaxTrSize ( 32) |
---|
[1200] | 2721 | , m_bUseSAO (false) |
---|
[56] | 2722 | , m_bTemporalIdNestingFlag (false) |
---|
| 2723 | , m_scalingListEnabledFlag (false) |
---|
[608] | 2724 | , m_useStrongIntraSmoothing (false) |
---|
| 2725 | , m_vuiParametersPresentFlag (false) |
---|
| 2726 | , m_vuiParameters () |
---|
[1200] | 2727 | #if NH_MV |
---|
[622] | 2728 | , m_pcVPS ( NULL ) |
---|
| 2729 | , m_spsInferScalingListFlag ( false ) |
---|
| 2730 | , m_spsScalingListRefLayerId ( 0 ) |
---|
[738] | 2731 | |
---|
| 2732 | , m_updateRepFormatFlag ( false ) |
---|
| 2733 | , m_spsRepFormatIdx ( 0 ) |
---|
[608] | 2734 | , m_interViewMvVertConstraintFlag (false) |
---|
[56] | 2735 | #endif |
---|
[1200] | 2736 | |
---|
[56] | 2737 | { |
---|
[1200] | 2738 | for(Int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) |
---|
| 2739 | { |
---|
| 2740 | m_bitDepths.recon[ch] = 8; |
---|
| 2741 | #if O0043_BEST_EFFORT_DECODING |
---|
| 2742 | m_bitDepths.stream[ch] = 8; |
---|
| 2743 | #endif |
---|
| 2744 | m_pcmBitDepths[ch] = 8; |
---|
| 2745 | m_qpBDOffset [ch] = 0; |
---|
| 2746 | } |
---|
| 2747 | |
---|
| 2748 | |
---|
[56] | 2749 | for ( Int i = 0; i < MAX_TLAYER; i++ ) |
---|
| 2750 | { |
---|
| 2751 | m_uiMaxLatencyIncrease[i] = 0; |
---|
[608] | 2752 | m_uiMaxDecPicBuffering[i] = 1; |
---|
[56] | 2753 | m_numReorderPics[i] = 0; |
---|
| 2754 | } |
---|
[1200] | 2755 | |
---|
[608] | 2756 | ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps)); |
---|
| 2757 | ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag)); |
---|
[1200] | 2758 | #if NH_MV |
---|
[964] | 2759 | m_spsRangeExtensionsFlag = false; |
---|
| 2760 | m_spsMultilayerExtensionFlag = false; |
---|
| 2761 | m_spsExtension5bits = 0; |
---|
| 2762 | m_sps3dExtensionFlag = false; |
---|
[1200] | 2763 | |
---|
[964] | 2764 | #endif |
---|
| 2765 | |
---|
[2] | 2766 | } |
---|
| 2767 | |
---|
| 2768 | TComSPS::~TComSPS() |
---|
| 2769 | { |
---|
[608] | 2770 | m_RPSList.destroy(); |
---|
| 2771 | } |
---|
| 2772 | |
---|
| 2773 | Void TComSPS::createRPSList( Int numRPS ) |
---|
[1200] | 2774 | { |
---|
[608] | 2775 | m_RPSList.destroy(); |
---|
| 2776 | m_RPSList.create(numRPS); |
---|
| 2777 | } |
---|
| 2778 | |
---|
[1200] | 2779 | const Int TComSPS::m_winUnitX[]={1,2,2,1}; |
---|
| 2780 | const Int TComSPS::m_winUnitY[]={1,2,1,1}; |
---|
| 2781 | |
---|
| 2782 | TComPPSRExt::TComPPSRExt() |
---|
| 2783 | : m_log2MaxTransformSkipBlockSize (2) |
---|
| 2784 | , m_crossComponentPredictionEnabledFlag(false) |
---|
| 2785 | , m_diffCuChromaQpOffsetDepth (0) |
---|
| 2786 | , m_chromaQpOffsetListLen (0) |
---|
| 2787 | // m_ChromaQpAdjTableIncludingNullEntry initialized below |
---|
| 2788 | // m_log2SaoOffsetScale initialized below |
---|
[608] | 2789 | { |
---|
[1200] | 2790 | m_ChromaQpAdjTableIncludingNullEntry[0].u.comp.CbOffset = 0; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0. This is initialised here and never subsequently changed. |
---|
| 2791 | m_ChromaQpAdjTableIncludingNullEntry[0].u.comp.CrOffset = 0; |
---|
| 2792 | for(Int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) |
---|
[56] | 2793 | { |
---|
[1200] | 2794 | m_log2SaoOffsetScale[ch] = 0; |
---|
[56] | 2795 | } |
---|
[189] | 2796 | } |
---|
| 2797 | |
---|
[2] | 2798 | TComPPS::TComPPS() |
---|
[1200] | 2799 | : m_PPSId (0) |
---|
| 2800 | , m_SPSId (0) |
---|
| 2801 | , m_picInitQPMinus26 (0) |
---|
| 2802 | , m_useDQP (false) |
---|
| 2803 | , m_bConstrainedIntraPred (false) |
---|
| 2804 | , m_bSliceChromaQpFlag (false) |
---|
| 2805 | , m_uiMaxCuDQPDepth (0) |
---|
| 2806 | , m_chromaCbQpOffset (0) |
---|
| 2807 | , m_chromaCrQpOffset (0) |
---|
| 2808 | , m_numRefIdxL0DefaultActive (1) |
---|
| 2809 | , m_numRefIdxL1DefaultActive (1) |
---|
| 2810 | , m_TransquantBypassEnableFlag (false) |
---|
| 2811 | , m_useTransformSkip (false) |
---|
| 2812 | , m_dependentSliceSegmentsEnabledFlag(false) |
---|
| 2813 | , m_tilesEnabledFlag (false) |
---|
| 2814 | , m_entropyCodingSyncEnabledFlag (false) |
---|
| 2815 | , m_loopFilterAcrossTilesEnabledFlag (true) |
---|
| 2816 | , m_uniformSpacingFlag (false) |
---|
| 2817 | , m_numTileColumnsMinus1 (0) |
---|
| 2818 | , m_numTileRowsMinus1 (0) |
---|
| 2819 | , m_signHideFlag (false) |
---|
| 2820 | , m_cabacInitPresentFlag (false) |
---|
| 2821 | , m_sliceHeaderExtensionPresentFlag (false) |
---|
| 2822 | , m_loopFilterAcrossSlicesEnabledFlag(false) |
---|
| 2823 | , m_listsModificationPresentFlag (0) |
---|
| 2824 | , m_numExtraSliceHeaderBits (0) |
---|
| 2825 | #if NH_MV |
---|
| 2826 | , m_ppsInferScalingListFlag (false) |
---|
| 2827 | , m_ppsScalingListRefLayerId (0) |
---|
| 2828 | , m_pocResetInfoPresentFlag (false) |
---|
[773] | 2829 | #if H_3D |
---|
[758] | 2830 | , m_pcDLT(NULL) |
---|
[622] | 2831 | #endif |
---|
[758] | 2832 | #endif |
---|
[1200] | 2833 | |
---|
[2] | 2834 | { |
---|
[1200] | 2835 | #if NH_MV |
---|
[964] | 2836 | m_ppsRangeExtensionsFlag = false; |
---|
| 2837 | m_ppsMultilayerExtensionFlag = false; |
---|
| 2838 | m_pps3dExtensionFlag = false; |
---|
| 2839 | m_ppsExtension5bits = 0; |
---|
| 2840 | #endif |
---|
[1200] | 2841 | |
---|
[2] | 2842 | } |
---|
| 2843 | |
---|
| 2844 | TComPPS::~TComPPS() |
---|
| 2845 | { |
---|
| 2846 | } |
---|
| 2847 | |
---|
[773] | 2848 | #if H_3D |
---|
[758] | 2849 | TComDLT::TComDLT() |
---|
| 2850 | : m_bDltPresentFlag(false) |
---|
| 2851 | , m_iNumDepthViews(0) |
---|
| 2852 | , m_uiDepthViewBitDepth(8) |
---|
| 2853 | { |
---|
| 2854 | m_uiDepthViewBitDepth = g_bitDepthY; |
---|
| 2855 | |
---|
| 2856 | for( Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
| 2857 | { |
---|
| 2858 | m_bUseDLTFlag [i] = false; |
---|
| 2859 | m_bInterViewDltPredEnableFlag [i] = false; |
---|
| 2860 | |
---|
| 2861 | // allocate some memory and initialize with default mapping |
---|
| 2862 | m_iNumDepthmapValues[i] = ((1 << m_uiDepthViewBitDepth)-1)+1; |
---|
| 2863 | m_iDepthValue2Idx[i] = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]); |
---|
| 2864 | m_iIdx2DepthValue[i] = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]); |
---|
| 2865 | |
---|
| 2866 | //default mapping |
---|
| 2867 | for (Int d=0; d<m_iNumDepthmapValues[i]; d++) |
---|
| 2868 | { |
---|
| 2869 | m_iDepthValue2Idx[i][d] = d; |
---|
| 2870 | m_iIdx2DepthValue[i][d] = d; |
---|
| 2871 | } |
---|
| 2872 | } |
---|
| 2873 | } |
---|
| 2874 | |
---|
| 2875 | TComDLT::~TComDLT() |
---|
| 2876 | { |
---|
| 2877 | for( Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
| 2878 | { |
---|
| 2879 | if ( m_iDepthValue2Idx[i] != NULL ) |
---|
| 2880 | { |
---|
| 2881 | xFree( m_iDepthValue2Idx[i] ); |
---|
| 2882 | m_iDepthValue2Idx[i] = NULL; |
---|
| 2883 | } |
---|
| 2884 | |
---|
| 2885 | if ( m_iIdx2DepthValue[i] != NULL ) |
---|
| 2886 | { |
---|
| 2887 | xFree( m_iIdx2DepthValue[i] ); |
---|
| 2888 | m_iIdx2DepthValue[i] = NULL; |
---|
| 2889 | } |
---|
| 2890 | } |
---|
| 2891 | } |
---|
| 2892 | |
---|
| 2893 | Void TComDLT::setDepthLUTs(Int layerIdInVps, Int* idxToDepthValueTable, Int iNumDepthValues) |
---|
| 2894 | { |
---|
| 2895 | if( idxToDepthValueTable == NULL || iNumDepthValues == 0 ) // default mapping only |
---|
| 2896 | return; |
---|
| 2897 | |
---|
| 2898 | // copy idx2DepthValue to internal array |
---|
| 2899 | memcpy(m_iIdx2DepthValue[layerIdInVps], idxToDepthValueTable, iNumDepthValues*sizeof(UInt)); |
---|
| 2900 | |
---|
| 2901 | UInt uiMaxDepthValue = ((1 << g_bitDepthY)-1); |
---|
| 2902 | for(Int p=0; p<=uiMaxDepthValue; p++) |
---|
| 2903 | { |
---|
| 2904 | Int iIdxDown = 0; |
---|
| 2905 | Int iIdxUp = iNumDepthValues-1; |
---|
| 2906 | Bool bFound = false; |
---|
| 2907 | |
---|
| 2908 | // iterate over indices to find lower closest depth |
---|
| 2909 | Int i = 1; |
---|
| 2910 | while(!bFound && i<iNumDepthValues) |
---|
| 2911 | { |
---|
| 2912 | if( m_iIdx2DepthValue[layerIdInVps][i] > p ) |
---|
| 2913 | { |
---|
| 2914 | iIdxDown = i-1; |
---|
| 2915 | bFound = true; |
---|
| 2916 | } |
---|
| 2917 | |
---|
| 2918 | i++; |
---|
| 2919 | } |
---|
[1124] | 2920 | iIdxUp = bFound ? iIdxDown + 1 : iNumDepthValues-1; |
---|
[758] | 2921 | |
---|
| 2922 | // assign closer depth value/idx |
---|
| 2923 | if( abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxDown]) < abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxUp]) ) |
---|
| 2924 | { |
---|
| 2925 | m_iDepthValue2Idx[layerIdInVps][p] = iIdxDown; |
---|
| 2926 | } |
---|
| 2927 | else |
---|
| 2928 | { |
---|
| 2929 | m_iDepthValue2Idx[layerIdInVps][p] = iIdxUp; |
---|
| 2930 | } |
---|
| 2931 | |
---|
| 2932 | } |
---|
| 2933 | |
---|
| 2934 | // update DLT variables |
---|
| 2935 | m_iNumDepthmapValues[layerIdInVps] = iNumDepthValues; |
---|
| 2936 | } |
---|
| 2937 | |
---|
| 2938 | Void TComDLT::getDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTOut, UInt *puiDeltaDLTOutNum ) |
---|
| 2939 | { |
---|
| 2940 | Bool abBM0[ 256 ]; |
---|
| 2941 | Bool abBM1[ 256 ]; |
---|
| 2942 | |
---|
| 2943 | memset( abBM0, 0, sizeof( abBM0 )); |
---|
| 2944 | memset( abBM1, 0, sizeof( abBM1 )); |
---|
| 2945 | |
---|
| 2946 | // convert reference DLT to bit string |
---|
| 2947 | for( Int i = 0; i < uiDLTInRefNum; i++ ) |
---|
| 2948 | { |
---|
| 2949 | abBM0[ piDLTInRef[ i ] ] = true; |
---|
| 2950 | } |
---|
| 2951 | // convert internal DLT to bit string |
---|
| 2952 | for( Int i = 0; i < m_iNumDepthmapValues[ layerIdInVps ]; i++ ) |
---|
| 2953 | { |
---|
| 2954 | abBM1[ m_iIdx2DepthValue[ layerIdInVps ][ i ] ] = true; |
---|
| 2955 | } |
---|
| 2956 | |
---|
| 2957 | *puiDeltaDLTOutNum = 0; |
---|
| 2958 | for( Int i = 0; i < 256; i++ ) |
---|
| 2959 | { |
---|
| 2960 | if( abBM0[ i ] ^ abBM1[ i ] ) |
---|
| 2961 | { |
---|
| 2962 | piDeltaDLTOut[ *puiDeltaDLTOutNum ] = i; |
---|
| 2963 | *puiDeltaDLTOutNum = *puiDeltaDLTOutNum + 1; |
---|
| 2964 | } |
---|
| 2965 | } |
---|
| 2966 | } |
---|
| 2967 | |
---|
| 2968 | Void TComDLT::setDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTIn, UInt uiDeltaDLTInNum ) |
---|
| 2969 | { |
---|
| 2970 | Bool abBM0[ 256 ]; |
---|
| 2971 | Bool abBM1[ 256 ]; |
---|
| 2972 | |
---|
| 2973 | memset( abBM0, 0, sizeof( abBM0 )); |
---|
| 2974 | memset( abBM1, 0, sizeof( abBM1 )); |
---|
| 2975 | |
---|
| 2976 | // convert reference DLT to bit string |
---|
| 2977 | for( Int i = 0; i < uiDLTInRefNum; i++ ) |
---|
| 2978 | { |
---|
| 2979 | abBM0[ piDLTInRef[ i ] ] = true; |
---|
| 2980 | } |
---|
| 2981 | // convert delta DLT to bit string |
---|
| 2982 | for( Int i = 0; i < uiDeltaDLTInNum; i++ ) |
---|
| 2983 | { |
---|
| 2984 | abBM1[ piDeltaDLTIn[ i ] ] = true; |
---|
| 2985 | } |
---|
| 2986 | |
---|
| 2987 | Int aiIdx2DepthValue[256]; |
---|
| 2988 | UInt uiNumDepthValues = 0; |
---|
| 2989 | memset( aiIdx2DepthValue, 0, sizeof( aiIdx2DepthValue )); |
---|
| 2990 | |
---|
| 2991 | for( Int i = 0; i < 256; i++ ) |
---|
| 2992 | { |
---|
| 2993 | if( abBM0[ i ] ^ abBM1[ i ] ) |
---|
| 2994 | { |
---|
| 2995 | aiIdx2DepthValue[ uiNumDepthValues++ ] = i; |
---|
| 2996 | } |
---|
| 2997 | } |
---|
| 2998 | |
---|
| 2999 | // update internal tables |
---|
| 3000 | setDepthLUTs(layerIdInVps, aiIdx2DepthValue, uiNumDepthValues); |
---|
| 3001 | } |
---|
| 3002 | |
---|
| 3003 | #endif |
---|
| 3004 | |
---|
[1200] | 3005 | #if NH_MV |
---|
| 3006 | Void TComSPS::inferRepFormat( TComVPS* vps, Int layerIdCurr, Bool encoder ) |
---|
[622] | 3007 | { |
---|
[1066] | 3008 | if ( getMultiLayerExtSpsFlag() ) |
---|
[1200] | 3009 | { |
---|
[738] | 3010 | Int repFormatIdx = getUpdateRepFormatFlag() ? getSpsRepFormatIdx() : vps->getVpsRepFormatIdx( vps->getLayerIdInVps( layerIdCurr ) ) ; |
---|
[1200] | 3011 | const TComRepFormat* repFormat = vps->getRepFormat( repFormatIdx ); |
---|
[622] | 3012 | |
---|
[1200] | 3013 | if ( encoder ) |
---|
| 3014 | { |
---|
| 3015 | assert( getChromaFormatIdc() == (ChromaFormat) repFormat->getChromaFormatVpsIdc() ); |
---|
| 3016 | //// ToDo: add when supported: |
---|
| 3017 | // assert( getSeperateColourPlaneFlag( repFormat->getSeparateColourPlaneVpsFlag() ) ; |
---|
[622] | 3018 | |
---|
[1200] | 3019 | assert( getPicWidthInLumaSamples() == repFormat->getPicWidthVpsInLumaSamples() ); |
---|
| 3020 | assert( getPicHeightInLumaSamples() == repFormat->getPicHeightVpsInLumaSamples() ); |
---|
[622] | 3021 | |
---|
[1200] | 3022 | assert( getBitDepth ( CHANNEL_TYPE_LUMA ) == repFormat->getBitDepthVpsLumaMinus8() + 8 ); |
---|
| 3023 | assert( getQpBDOffset ( CHANNEL_TYPE_LUMA ) == (Int) (6*( getBitDepth( CHANNEL_TYPE_LUMA ) - 8 )) ); |
---|
[1066] | 3024 | |
---|
[1200] | 3025 | assert( getBitDepth ( CHANNEL_TYPE_CHROMA ) == repFormat->getBitDepthVpsChromaMinus8() + 8 ); |
---|
| 3026 | assert( getQpBDOffset ( CHANNEL_TYPE_CHROMA ) == (Int) (6* ( getBitDepth( CHANNEL_TYPE_CHROMA ) -8 ) ) ); |
---|
| 3027 | } |
---|
| 3028 | else |
---|
| 3029 | { |
---|
| 3030 | setChromaFormatIdc( (ChromaFormat) repFormat->getChromaFormatVpsIdc() ); |
---|
| 3031 | //// ToDo: add when supported: |
---|
| 3032 | // setSeperateColourPlaneFlag( repFormat->getSeparateColourPlaneVpsFlag() ) ; |
---|
[1066] | 3033 | |
---|
[1200] | 3034 | setPicWidthInLumaSamples ( repFormat->getPicWidthVpsInLumaSamples() ); |
---|
| 3035 | setPicHeightInLumaSamples( repFormat->getPicHeightVpsInLumaSamples() ); |
---|
| 3036 | |
---|
| 3037 | setBitDepth ( CHANNEL_TYPE_LUMA, repFormat->getBitDepthVpsLumaMinus8() + 8 ); |
---|
| 3038 | setQpBDOffset ( CHANNEL_TYPE_LUMA, (Int) (6*( getBitDepth( CHANNEL_TYPE_LUMA ) - 8 )) ); |
---|
| 3039 | |
---|
| 3040 | setBitDepth ( CHANNEL_TYPE_CHROMA, repFormat->getBitDepthVpsChromaMinus8() + 8 ); |
---|
| 3041 | setQpBDOffset ( CHANNEL_TYPE_CHROMA, (Int) (6* ( getBitDepth( CHANNEL_TYPE_CHROMA ) -8 ) ) ); |
---|
| 3042 | Window &spsConf = getConformanceWindow(); |
---|
| 3043 | |
---|
| 3044 | // Scaled later |
---|
| 3045 | spsConf.setScaledFlag( false ); |
---|
| 3046 | spsConf.setWindowLeftOffset ( repFormat->getConfWinVpsLeftOffset() ); |
---|
| 3047 | spsConf.setWindowRightOffset ( repFormat->getConfWinVpsRightOffset() ); |
---|
| 3048 | spsConf.setWindowTopOffset ( repFormat->getConfWinVpsTopOffset() ); |
---|
| 3049 | spsConf.setWindowBottomOffset( repFormat->getConfWinVpsBottomOffset() ); |
---|
| 3050 | } |
---|
| 3051 | |
---|
[1066] | 3052 | if ( getMultiLayerExtSpsFlag() && getUpdateRepFormatFlag() ) |
---|
[622] | 3053 | { |
---|
| 3054 | assert( getChromaFormatIdc() <= repFormat->getChromaFormatVpsIdc() ); |
---|
| 3055 | //// ToDo: add when supported: |
---|
| 3056 | // assert( getSeperateColourPlaneFlag() <= repFormat->getSeparateColourPlaneVpsFlag() ) ; |
---|
| 3057 | |
---|
| 3058 | assert( getPicWidthInLumaSamples() <= repFormat->getPicWidthVpsInLumaSamples() ); |
---|
| 3059 | assert( getPicHeightInLumaSamples() <= repFormat->getPicHeightVpsInLumaSamples() ); |
---|
| 3060 | |
---|
[1200] | 3061 | assert( getBitDepth( CHANNEL_TYPE_LUMA ) <= repFormat->getBitDepthVpsLumaMinus8() + 8 ); |
---|
| 3062 | assert( getBitDepth( CHANNEL_TYPE_CHROMA ) <= repFormat->getBitDepthVpsChromaMinus8() + 8 ); |
---|
[622] | 3063 | } |
---|
| 3064 | } |
---|
| 3065 | |
---|
| 3066 | // Set conformance window |
---|
| 3067 | Int scal = TComSPS::getWinUnitX( getChromaFormatIdc() ) ; |
---|
| 3068 | getConformanceWindow().scaleOffsets( scal ); |
---|
| 3069 | getVuiParameters()->getDefaultDisplayWindow().scaleOffsets( scal ); |
---|
[1200] | 3070 | |
---|
| 3071 | if (encoder && getMultiLayerExtSpsFlag() ) |
---|
| 3072 | { |
---|
| 3073 | Int repFormatIdx = getUpdateRepFormatFlag() ? getSpsRepFormatIdx() : vps->getVpsRepFormatIdx( vps->getLayerIdInVps( layerIdCurr ) ) ; |
---|
| 3074 | const TComRepFormat* repFormat = vps->getRepFormat( repFormatIdx ); |
---|
| 3075 | |
---|
| 3076 | Window &spsConf = getConformanceWindow(); |
---|
| 3077 | assert( spsConf.getWindowLeftOffset () == repFormat->getConfWinVpsLeftOffset() ); |
---|
| 3078 | assert( spsConf.getWindowRightOffset () == repFormat->getConfWinVpsRightOffset() ); |
---|
| 3079 | assert( spsConf.getWindowTopOffset () == repFormat->getConfWinVpsTopOffset() ); |
---|
| 3080 | assert( spsConf.getWindowBottomOffset() == repFormat->getConfWinVpsBottomOffset() ); |
---|
| 3081 | } |
---|
[622] | 3082 | } |
---|
| 3083 | |
---|
[1200] | 3084 | Void TComSPS::inferScalingList( const TComSPS* spsSrc ) |
---|
[622] | 3085 | { |
---|
| 3086 | if ( getSpsInferScalingListFlag() ) |
---|
| 3087 | { |
---|
| 3088 | assert( spsSrc != NULL ); |
---|
| 3089 | assert( !spsSrc->getSpsInferScalingListFlag() ); |
---|
[1200] | 3090 | getScalingList().inferFrom( (spsSrc->getScalingList()) ); |
---|
[622] | 3091 | } |
---|
| 3092 | } |
---|
[976] | 3093 | |
---|
| 3094 | Void TComSPS::inferSpsMaxDecPicBufferingMinus1( TComVPS* vps, Int targetOptLayerSetIdx, Int currLayerId, Bool encoder ) |
---|
| 3095 | { |
---|
| 3096 | const std::vector<Int>& targetDecLayerIdList = vps->getTargetDecLayerIdList( vps->olsIdxToLsIdx( targetOptLayerSetIdx )); |
---|
| 3097 | |
---|
[1066] | 3098 | if ( getMultiLayerExtSpsFlag() ) |
---|
[976] | 3099 | { |
---|
| 3100 | Int layerIdx = 0; |
---|
| 3101 | while (layerIdx < (Int) targetDecLayerIdList.size() ) |
---|
| 3102 | { |
---|
| 3103 | if ( targetDecLayerIdList[layerIdx] == currLayerId ) |
---|
| 3104 | { |
---|
| 3105 | break; |
---|
| 3106 | } |
---|
| 3107 | layerIdx++; |
---|
| 3108 | } |
---|
| 3109 | |
---|
| 3110 | assert( layerIdx < (Int) targetDecLayerIdList.size() ); |
---|
| 3111 | |
---|
| 3112 | for (Int i = 0; i <= getSpsMaxSubLayersMinus1(); i++ ) |
---|
| 3113 | { |
---|
| 3114 | Int maxDecPicBufferingMinus1 = vps->getDpbSize()->getMaxVpsDecPicBufferingMinus1( targetOptLayerSetIdx, layerIdx, i ) ; |
---|
| 3115 | |
---|
[1066] | 3116 | // This preliminary fix needs to be checked. |
---|
| 3117 | Int maxNumReorderPics = vps->getDpbSize()->getMaxVpsNumReorderPics( targetOptLayerSetIdx, i ); |
---|
| 3118 | Int maxLatencyIncreasePlus1 = vps->getDpbSize()->getMaxVpsLatencyIncreasePlus1( targetOptLayerSetIdx, i ); |
---|
| 3119 | if ( encoder ) |
---|
[976] | 3120 | { |
---|
| 3121 | assert( getMaxDecPicBuffering( i ) - 1 == maxDecPicBufferingMinus1 ); |
---|
[1066] | 3122 | // This preliminary fix needs to be checked. |
---|
| 3123 | assert( getNumReorderPics( i ) == maxNumReorderPics ); |
---|
| 3124 | assert( getMaxLatencyIncrease( i ) == maxLatencyIncreasePlus1 ); |
---|
| 3125 | |
---|
[976] | 3126 | } |
---|
| 3127 | else |
---|
| 3128 | { |
---|
[1066] | 3129 | // This preliminary fix needs to be checked. |
---|
| 3130 | setMaxDecPicBuffering( maxDecPicBufferingMinus1 + 1 , i); |
---|
| 3131 | setNumReorderPics ( maxNumReorderPics, i ); |
---|
| 3132 | setMaxLatencyIncrease( maxLatencyIncreasePlus1 - 1 , i); |
---|
[976] | 3133 | } |
---|
[1066] | 3134 | } |
---|
[976] | 3135 | } |
---|
| 3136 | } |
---|
| 3137 | |
---|
[1200] | 3138 | Void TComSPS::checkRpsMaxNumPics( const TComVPS* vps, Int currLayerId ) const |
---|
[976] | 3139 | { |
---|
| 3140 | for (Int i = 0; i < getRPSList()->getNumberOfReferencePictureSets(); i++ ) |
---|
| 3141 | { |
---|
[1200] | 3142 | const TComReferencePictureSet* rps = getRPSList()->getReferencePictureSet( i ); |
---|
[976] | 3143 | if ( !rps->getInterRPSPrediction() ) |
---|
| 3144 | { |
---|
[1066] | 3145 | rps->checkMaxNumPics( vps->getVpsExtensionFlag(), MAX_INT, getLayerId(), getMaxDecPicBuffering( getSpsMaxSubLayersMinus1() ) - 1 ); // INT_MAX to be replaced by DpbSize |
---|
[976] | 3146 | } |
---|
| 3147 | } |
---|
| 3148 | } |
---|
| 3149 | |
---|
[1066] | 3150 | Void TComSPS::inferSpsMaxSubLayersMinus1(Bool atPsActivation, TComVPS* vps) |
---|
| 3151 | { |
---|
| 3152 | assert( getLayerId() != 0 ); |
---|
| 3153 | if ( !atPsActivation ) |
---|
| 3154 | { |
---|
| 3155 | assert( vps == NULL ); |
---|
| 3156 | if (getSpsExtOrMaxSubLayersMinus1() != 7) |
---|
| 3157 | { |
---|
| 3158 | setSpsMaxSubLayersMinus1( getSpsExtOrMaxSubLayersMinus1() ); |
---|
| 3159 | } |
---|
| 3160 | } |
---|
| 3161 | else |
---|
| 3162 | { |
---|
| 3163 | assert( vps != NULL ); |
---|
| 3164 | if (getSpsExtOrMaxSubLayersMinus1() == 7) |
---|
| 3165 | { |
---|
| 3166 | setSpsMaxSubLayersMinus1( vps->getMaxSubLayersMinus1() ); |
---|
| 3167 | } |
---|
| 3168 | } |
---|
| 3169 | } |
---|
[622] | 3170 | #endif |
---|
[2] | 3171 | |
---|
[1200] | 3172 | |
---|
[56] | 3173 | TComReferencePictureSet::TComReferencePictureSet() |
---|
| 3174 | : m_numberOfPictures (0) |
---|
| 3175 | , m_numberOfNegativePictures (0) |
---|
| 3176 | , m_numberOfPositivePictures (0) |
---|
| 3177 | , m_numberOfLongtermPictures (0) |
---|
[1200] | 3178 | , m_interRPSPrediction (0) |
---|
| 3179 | , m_deltaRIdxMinus1 (0) |
---|
| 3180 | , m_deltaRPS (0) |
---|
| 3181 | , m_numRefIdc (0) |
---|
[56] | 3182 | { |
---|
| 3183 | ::memset( m_deltaPOC, 0, sizeof(m_deltaPOC) ); |
---|
| 3184 | ::memset( m_POC, 0, sizeof(m_POC) ); |
---|
| 3185 | ::memset( m_used, 0, sizeof(m_used) ); |
---|
| 3186 | ::memset( m_refIdc, 0, sizeof(m_refIdc) ); |
---|
[1200] | 3187 | ::memset( m_bCheckLTMSB, 0, sizeof(m_bCheckLTMSB) ); |
---|
| 3188 | ::memset( m_pocLSBLT, 0, sizeof(m_pocLSBLT) ); |
---|
| 3189 | ::memset( m_deltaPOCMSBCycleLT, 0, sizeof(m_deltaPOCMSBCycleLT) ); |
---|
| 3190 | ::memset( m_deltaPocMSBPresentFlag, 0, sizeof(m_deltaPocMSBPresentFlag) ); |
---|
[56] | 3191 | } |
---|
| 3192 | |
---|
| 3193 | TComReferencePictureSet::~TComReferencePictureSet() |
---|
| 3194 | { |
---|
| 3195 | } |
---|
| 3196 | |
---|
| 3197 | Void TComReferencePictureSet::setUsed(Int bufferNum, Bool used) |
---|
| 3198 | { |
---|
| 3199 | m_used[bufferNum] = used; |
---|
| 3200 | } |
---|
| 3201 | |
---|
| 3202 | Void TComReferencePictureSet::setDeltaPOC(Int bufferNum, Int deltaPOC) |
---|
| 3203 | { |
---|
| 3204 | m_deltaPOC[bufferNum] = deltaPOC; |
---|
| 3205 | } |
---|
| 3206 | |
---|
| 3207 | Void TComReferencePictureSet::setNumberOfPictures(Int numberOfPictures) |
---|
| 3208 | { |
---|
| 3209 | m_numberOfPictures = numberOfPictures; |
---|
| 3210 | } |
---|
| 3211 | |
---|
[1200] | 3212 | Int TComReferencePictureSet::getUsed(Int bufferNum) const |
---|
[56] | 3213 | { |
---|
| 3214 | return m_used[bufferNum]; |
---|
| 3215 | } |
---|
| 3216 | |
---|
[1200] | 3217 | Int TComReferencePictureSet::getDeltaPOC(Int bufferNum) const |
---|
[56] | 3218 | { |
---|
| 3219 | return m_deltaPOC[bufferNum]; |
---|
| 3220 | } |
---|
| 3221 | |
---|
[1200] | 3222 | Int TComReferencePictureSet::getNumberOfPictures() const |
---|
[56] | 3223 | { |
---|
| 3224 | return m_numberOfPictures; |
---|
| 3225 | } |
---|
| 3226 | |
---|
[1200] | 3227 | Int TComReferencePictureSet::getPOC(Int bufferNum) const |
---|
[56] | 3228 | { |
---|
| 3229 | return m_POC[bufferNum]; |
---|
| 3230 | } |
---|
[608] | 3231 | |
---|
[56] | 3232 | Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC) |
---|
| 3233 | { |
---|
| 3234 | m_POC[bufferNum] = POC; |
---|
| 3235 | } |
---|
| 3236 | |
---|
[1200] | 3237 | Bool TComReferencePictureSet::getCheckLTMSBPresent(Int bufferNum) const |
---|
[608] | 3238 | { |
---|
| 3239 | return m_bCheckLTMSB[bufferNum]; |
---|
| 3240 | } |
---|
| 3241 | |
---|
| 3242 | Void TComReferencePictureSet::setCheckLTMSBPresent(Int bufferNum, Bool b) |
---|
| 3243 | { |
---|
| 3244 | m_bCheckLTMSB[bufferNum] = b; |
---|
| 3245 | } |
---|
| 3246 | |
---|
[1200] | 3247 | //! set the reference idc value at uiBufferNum entry to the value of iRefIdc |
---|
[56] | 3248 | Void TComReferencePictureSet::setRefIdc(Int bufferNum, Int refIdc) |
---|
| 3249 | { |
---|
| 3250 | m_refIdc[bufferNum] = refIdc; |
---|
| 3251 | } |
---|
| 3252 | |
---|
[1200] | 3253 | //! get the reference idc value at uiBufferNum |
---|
| 3254 | Int TComReferencePictureSet::getRefIdc(Int bufferNum) const |
---|
[56] | 3255 | { |
---|
| 3256 | return m_refIdc[bufferNum]; |
---|
| 3257 | } |
---|
| 3258 | |
---|
| 3259 | /** Sorts the deltaPOC and Used by current values in the RPS based on the deltaPOC values. |
---|
| 3260 | * deltaPOC values are sorted with -ve values before the +ve values. -ve values are in decreasing order. |
---|
| 3261 | * +ve values are in increasing order. |
---|
| 3262 | * \returns Void |
---|
| 3263 | */ |
---|
| 3264 | Void TComReferencePictureSet::sortDeltaPOC() |
---|
| 3265 | { |
---|
| 3266 | // sort in increasing order (smallest first) |
---|
| 3267 | for(Int j=1; j < getNumberOfPictures(); j++) |
---|
[1200] | 3268 | { |
---|
[56] | 3269 | Int deltaPOC = getDeltaPOC(j); |
---|
| 3270 | Bool used = getUsed(j); |
---|
| 3271 | for (Int k=j-1; k >= 0; k--) |
---|
| 3272 | { |
---|
| 3273 | Int temp = getDeltaPOC(k); |
---|
| 3274 | if (deltaPOC < temp) |
---|
| 3275 | { |
---|
| 3276 | setDeltaPOC(k+1, temp); |
---|
| 3277 | setUsed(k+1, getUsed(k)); |
---|
| 3278 | setDeltaPOC(k, deltaPOC); |
---|
| 3279 | setUsed(k, used); |
---|
| 3280 | } |
---|
| 3281 | } |
---|
| 3282 | } |
---|
| 3283 | // flip the negative values to largest first |
---|
| 3284 | Int numNegPics = getNumberOfNegativePictures(); |
---|
| 3285 | for(Int j=0, k=numNegPics-1; j < numNegPics>>1; j++, k--) |
---|
[1200] | 3286 | { |
---|
[56] | 3287 | Int deltaPOC = getDeltaPOC(j); |
---|
| 3288 | Bool used = getUsed(j); |
---|
| 3289 | setDeltaPOC(j, getDeltaPOC(k)); |
---|
| 3290 | setUsed(j, getUsed(k)); |
---|
| 3291 | setDeltaPOC(k, deltaPOC); |
---|
| 3292 | setUsed(k, used); |
---|
| 3293 | } |
---|
| 3294 | } |
---|
| 3295 | |
---|
| 3296 | /** Prints the deltaPOC and RefIdc (if available) values in the RPS. |
---|
| 3297 | * A "*" is added to the deltaPOC value if it is Used bu current. |
---|
| 3298 | * \returns Void |
---|
| 3299 | */ |
---|
[1200] | 3300 | Void TComReferencePictureSet::printDeltaPOC() const |
---|
[56] | 3301 | { |
---|
| 3302 | printf("DeltaPOC = { "); |
---|
| 3303 | for(Int j=0; j < getNumberOfPictures(); j++) |
---|
| 3304 | { |
---|
| 3305 | printf("%d%s ", getDeltaPOC(j), (getUsed(j)==1)?"*":""); |
---|
[1200] | 3306 | } |
---|
| 3307 | if (getInterRPSPrediction()) |
---|
[56] | 3308 | { |
---|
| 3309 | printf("}, RefIdc = { "); |
---|
| 3310 | for(Int j=0; j < getNumRefIdc(); j++) |
---|
| 3311 | { |
---|
| 3312 | printf("%d ", getRefIdc(j)); |
---|
[1200] | 3313 | } |
---|
[56] | 3314 | } |
---|
| 3315 | printf("}\n"); |
---|
| 3316 | } |
---|
[1200] | 3317 | |
---|
| 3318 | #if NH_MV |
---|
| 3319 | Void TComReferencePictureSet::checkMaxNumPics( Bool vpsExtensionFlag, Int maxNumPics, Int nuhLayerId, Int spsMaxDecPicBufferingMinus1 ) const |
---|
[976] | 3320 | { |
---|
| 3321 | assert( getNumberOfPictures() >= 0 ); |
---|
| 3322 | if ( nuhLayerId == 0 ) |
---|
| 3323 | { |
---|
| 3324 | assert( getNumberOfPictures() <= spsMaxDecPicBufferingMinus1 ); |
---|
| 3325 | } |
---|
[56] | 3326 | |
---|
[976] | 3327 | if ( vpsExtensionFlag ) |
---|
| 3328 | { |
---|
| 3329 | assert( getNumberOfPictures() <= maxNumPics ); |
---|
| 3330 | } |
---|
| 3331 | } |
---|
| 3332 | #endif |
---|
| 3333 | |
---|
[56] | 3334 | |
---|
| 3335 | |
---|
| 3336 | |
---|
| 3337 | TComRefPicListModification::TComRefPicListModification() |
---|
[1200] | 3338 | : m_refPicListModificationFlagL0 (false) |
---|
| 3339 | , m_refPicListModificationFlagL1 (false) |
---|
[56] | 3340 | { |
---|
| 3341 | ::memset( m_RefPicSetIdxL0, 0, sizeof(m_RefPicSetIdxL0) ); |
---|
| 3342 | ::memset( m_RefPicSetIdxL1, 0, sizeof(m_RefPicSetIdxL1) ); |
---|
| 3343 | } |
---|
| 3344 | |
---|
| 3345 | TComRefPicListModification::~TComRefPicListModification() |
---|
| 3346 | { |
---|
| 3347 | } |
---|
| 3348 | |
---|
[608] | 3349 | TComScalingList::TComScalingList() |
---|
[56] | 3350 | { |
---|
[1200] | 3351 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 3352 | { |
---|
| 3353 | for(UInt listId = 0; listId < SCALING_LIST_NUM; listId++) |
---|
| 3354 | { |
---|
| 3355 | m_scalingListCoef[sizeId][listId].resize(min<Int>(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
| 3356 | } |
---|
| 3357 | } |
---|
[56] | 3358 | } |
---|
| 3359 | |
---|
[608] | 3360 | /** set default quantization matrix to array |
---|
| 3361 | */ |
---|
[1200] | 3362 | Void TComScalingList::setDefaultScalingList() |
---|
[56] | 3363 | { |
---|
[608] | 3364 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 3365 | { |
---|
[1200] | 3366 | for(UInt listId=0;listId<SCALING_LIST_NUM;listId++) |
---|
[608] | 3367 | { |
---|
[1200] | 3368 | processDefaultMatrix(sizeId, listId); |
---|
[608] | 3369 | } |
---|
| 3370 | } |
---|
| 3371 | } |
---|
| 3372 | /** check if use default quantization matrix |
---|
| 3373 | * \returns true if use default quantization matrix in all size |
---|
| 3374 | */ |
---|
[1200] | 3375 | Bool TComScalingList::checkDefaultScalingList() |
---|
[608] | 3376 | { |
---|
| 3377 | UInt defaultCounter=0; |
---|
[56] | 3378 | |
---|
[608] | 3379 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 3380 | { |
---|
[1200] | 3381 | for(UInt listId=0;listId<SCALING_LIST_NUM;listId++) |
---|
[608] | 3382 | { |
---|
[1200] | 3383 | if( !memcmp(getScalingListAddress(sizeId,listId), getScalingListDefaultAddress(sizeId, listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix |
---|
| 3384 | && ((sizeId < SCALING_LIST_16x16) || (getScalingListDC(sizeId,listId) == 16))) // check DC value |
---|
[608] | 3385 | { |
---|
| 3386 | defaultCounter++; |
---|
| 3387 | } |
---|
| 3388 | } |
---|
| 3389 | } |
---|
[1200] | 3390 | |
---|
| 3391 | return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM )) ? false : true; |
---|
[56] | 3392 | } |
---|
| 3393 | |
---|
[1200] | 3394 | #if NH_MV |
---|
[622] | 3395 | Void TComSlice::createInterLayerReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1 ) |
---|
| 3396 | { |
---|
| 3397 | refPicSetInterLayer0.clear(); |
---|
| 3398 | refPicSetInterLayer1.clear(); |
---|
| 3399 | |
---|
| 3400 | for( Int i = 0; i < getNumActiveRefLayerPics(); i++ ) |
---|
| 3401 | { |
---|
| 3402 | Int layerIdRef = getRefPicLayerId( i ); |
---|
| 3403 | TComPic* picRef = ivPicLists->getPic( layerIdRef, getPOC() ) ; |
---|
[872] | 3404 | assert ( picRef != 0 ); // There shall be no entry equal to "no reference picture" in RefPicSetInterLayer0 or RefPicSetInterLayer1. |
---|
[622] | 3405 | |
---|
| 3406 | picRef->getPicYuvRec()->extendPicBorder(); |
---|
| 3407 | picRef->setIsLongTerm( true ); |
---|
| 3408 | picRef->getSlice(0)->setReferenced( true ); |
---|
| 3409 | |
---|
| 3410 | Int viewIdCur = getVPS()->getViewId( getLayerId() ); |
---|
| 3411 | Int viewIdZero = getVPS()->getViewId( 0 ); |
---|
| 3412 | Int viewIdRef = getVPS()->getViewId( layerIdRef ); |
---|
| 3413 | |
---|
| 3414 | if ( ( viewIdCur <= viewIdZero && viewIdCur <= viewIdRef ) || ( viewIdCur >= viewIdZero && viewIdCur >= viewIdRef ) ) |
---|
| 3415 | { |
---|
| 3416 | refPicSetInterLayer0.push_back( picRef ); |
---|
| 3417 | } |
---|
| 3418 | else |
---|
| 3419 | { |
---|
| 3420 | refPicSetInterLayer1.push_back( picRef ); |
---|
| 3421 | } |
---|
| 3422 | // Consider to check here: |
---|
| 3423 | // "If the current picture is a RADL picture, there shall be no entry in the RefPicSetInterLayer0 and RefPicSetInterLayer1 that is a RASL picture. " |
---|
[872] | 3424 | assert( picRef->getSlice(0)->getDiscardableFlag() == false ); // "There shall be no picture that has discardable_flag equal to 1 in RefPicSetInterLayer0 or RefPicSetInterLayer1". |
---|
[622] | 3425 | } |
---|
| 3426 | } |
---|
[56] | 3427 | |
---|
[622] | 3428 | Void TComSlice::markIvRefPicsAsShortTerm( std::vector<TComPic*> refPicSetInterLayer0, std::vector<TComPic*> refPicSetInterLayer1 ) |
---|
| 3429 | { |
---|
[964] | 3430 | // Mark as short-term |
---|
[622] | 3431 | for ( Int i = 0; i < refPicSetInterLayer0.size(); i++ ) |
---|
| 3432 | { |
---|
| 3433 | refPicSetInterLayer0[i]->setIsLongTerm( false ); |
---|
| 3434 | } |
---|
| 3435 | |
---|
| 3436 | for ( Int i = 0; i < refPicSetInterLayer1.size(); i++ ) |
---|
| 3437 | { |
---|
| 3438 | refPicSetInterLayer1[i]->setIsLongTerm( false ); |
---|
| 3439 | } |
---|
| 3440 | |
---|
| 3441 | } |
---|
[964] | 3442 | |
---|
[622] | 3443 | Void TComSlice::printRefPicList() |
---|
[608] | 3444 | { |
---|
| 3445 | for ( Int li = 0; li < 2; li++) |
---|
| 3446 | { |
---|
| 3447 | std::cout << std::endl << "RefPicListL" << li << ":" << std::endl; |
---|
| 3448 | for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[li]-1); rIdx ++) |
---|
| 3449 | { |
---|
| 3450 | if (rIdx == 0 && li == 0) m_apcRefPicList[li][rIdx]->print( true ); |
---|
| 3451 | |
---|
| 3452 | m_apcRefPicList[li][rIdx]->print( false ); |
---|
| 3453 | } |
---|
| 3454 | } |
---|
| 3455 | } |
---|
| 3456 | |
---|
| 3457 | Void TComSlice::markCurrPic( TComPic* currPic ) |
---|
[56] | 3458 | { |
---|
[976] | 3459 | currPic->getSlice(0)->setReferenced( true ) ; |
---|
| 3460 | currPic->setIsLongTerm( false ); |
---|
[964] | 3461 | |
---|
| 3462 | currPic->setReconMark( true ); |
---|
| 3463 | currPic->setPicOutputFlag( currPic->getSlice(0)->getPicOutputFlag() ); |
---|
[56] | 3464 | } |
---|
| 3465 | |
---|
[622] | 3466 | Void TComSlice::setRefPicSetInterLayer( std::vector<TComPic*>* refPicSetInterLayer0, std::vector<TComPic*>* refPicSetInterLayer1 ) |
---|
| 3467 | { |
---|
| 3468 | m_refPicSetInterLayer0 = refPicSetInterLayer0; |
---|
| 3469 | m_refPicSetInterLayer1 = refPicSetInterLayer1; |
---|
| 3470 | } |
---|
| 3471 | |
---|
[1200] | 3472 | TComPic* TComSlice::getPicFromRefPicSetInterLayer(Int setIdc, Int layerId ) const |
---|
[622] | 3473 | { |
---|
| 3474 | assert ( setIdc == 0 || setIdc == 1); |
---|
| 3475 | std::vector<TComPic*>* refPicSetInterLayer = ( setIdc == 0 ? m_refPicSetInterLayer0 : m_refPicSetInterLayer1); |
---|
| 3476 | assert( refPicSetInterLayer != 0 ); |
---|
| 3477 | |
---|
| 3478 | TComPic* pcPic = NULL; |
---|
| 3479 | for ( Int i = 0; i < (*refPicSetInterLayer).size(); i++ ) |
---|
| 3480 | { |
---|
| 3481 | if ((*refPicSetInterLayer)[ i ]->getLayerId() == layerId ) |
---|
| 3482 | { |
---|
| 3483 | pcPic = (*refPicSetInterLayer)[ i ]; |
---|
| 3484 | } |
---|
| 3485 | } |
---|
| 3486 | |
---|
| 3487 | assert(pcPic != NULL); |
---|
| 3488 | return pcPic; |
---|
| 3489 | } |
---|
[738] | 3490 | |
---|
| 3491 | |
---|
[1200] | 3492 | Int TComSlice::getRefLayerPicFlag( Int i ) const |
---|
[738] | 3493 | { |
---|
[1200] | 3494 | const TComVPS* vps = getVPS(); |
---|
| 3495 | #if NH_3D |
---|
[1124] | 3496 | Int refLayerIdx = vps->getLayerIdInVps( vps->getIdRefListLayer( getLayerId(), i ) ); |
---|
| 3497 | #else |
---|
[1066] | 3498 | Int refLayerIdx = vps->getLayerIdInVps( vps->getIdDirectRefLayer( getLayerId(), i ) ); |
---|
[1124] | 3499 | #endif |
---|
[738] | 3500 | |
---|
[1124] | 3501 | Bool refLayerPicFlag = ( vps->getSubLayersVpsMaxMinus1( refLayerIdx ) >= getTLayer() && ( getTLayer() == 0 || |
---|
| 3502 | vps->getMaxTidIlRefPicsPlus1( refLayerIdx, vps->getLayerIdInVps( getLayerId() )) > getTLayer() )); |
---|
[738] | 3503 | return refLayerPicFlag; |
---|
| 3504 | } |
---|
| 3505 | |
---|
[1200] | 3506 | Int TComSlice::getRefLayerPicIdc( Int j ) const |
---|
[738] | 3507 | { |
---|
| 3508 | Int refLayerPicIdc = -1; |
---|
| 3509 | Int curj = 0; |
---|
[1200] | 3510 | #if NH_3D |
---|
[1124] | 3511 | for( Int i = 0; i < getVPS()->getNumRefListLayers( getLayerId()) ; i++ ) |
---|
| 3512 | #else |
---|
[738] | 3513 | for( Int i = 0; i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ ) |
---|
[1124] | 3514 | #endif |
---|
[738] | 3515 | { |
---|
| 3516 | if( getRefLayerPicFlag( i ) ) |
---|
| 3517 | { |
---|
| 3518 | if ( curj == j ) |
---|
| 3519 | { |
---|
| 3520 | refLayerPicIdc = i; |
---|
| 3521 | break; |
---|
| 3522 | } |
---|
| 3523 | curj++; |
---|
| 3524 | } |
---|
| 3525 | } |
---|
| 3526 | |
---|
| 3527 | assert( curj == j ); |
---|
| 3528 | assert( refLayerPicIdc != -1 ); |
---|
| 3529 | return refLayerPicIdc; |
---|
| 3530 | } |
---|
| 3531 | |
---|
[1200] | 3532 | Int TComSlice::getNumRefLayerPics( ) const |
---|
[738] | 3533 | { |
---|
| 3534 | Int numRefLayerPics = 0; |
---|
[1200] | 3535 | #if NH_3D |
---|
[1124] | 3536 | for( Int i = 0; i < getVPS()->getNumRefListLayers( getLayerId()) ; i++ ) |
---|
| 3537 | #else |
---|
[738] | 3538 | for( Int i = 0; i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ ) |
---|
[1124] | 3539 | #endif |
---|
[738] | 3540 | { |
---|
| 3541 | numRefLayerPics += getRefLayerPicFlag( i ); |
---|
| 3542 | } |
---|
| 3543 | return numRefLayerPics; |
---|
| 3544 | } |
---|
| 3545 | |
---|
| 3546 | |
---|
| 3547 | |
---|
[1200] | 3548 | Int TComSlice::getNumActiveRefLayerPics() const |
---|
[56] | 3549 | { |
---|
[608] | 3550 | Int numActiveRefLayerPics; |
---|
| 3551 | |
---|
[872] | 3552 | if( getLayerId() == 0 || getNumRefLayerPics() == 0 ) |
---|
[622] | 3553 | { |
---|
| 3554 | numActiveRefLayerPics = 0; |
---|
| 3555 | } |
---|
| 3556 | else if (getVPS()->getAllRefLayersActiveFlag() ) |
---|
| 3557 | { |
---|
[738] | 3558 | numActiveRefLayerPics = getNumRefLayerPics(); |
---|
[622] | 3559 | } |
---|
| 3560 | else if ( !getInterLayerPredEnabledFlag() ) |
---|
| 3561 | { |
---|
| 3562 | numActiveRefLayerPics = 0; |
---|
| 3563 | } |
---|
[1200] | 3564 | #if NH_3D |
---|
[1124] | 3565 | else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumRefListLayers( getLayerId() ) == 1 ) |
---|
| 3566 | #else |
---|
[622] | 3567 | else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerId() ) == 1 ) |
---|
[1124] | 3568 | #endif |
---|
[608] | 3569 | { |
---|
[872] | 3570 | numActiveRefLayerPics = 1; |
---|
[608] | 3571 | } |
---|
| 3572 | else |
---|
| 3573 | { |
---|
| 3574 | numActiveRefLayerPics = getNumInterLayerRefPicsMinus1() + 1; |
---|
| 3575 | } |
---|
| 3576 | return numActiveRefLayerPics; |
---|
[56] | 3577 | } |
---|
[608] | 3578 | |
---|
[1200] | 3579 | Int TComSlice::getRefPicLayerId( Int i ) const |
---|
[56] | 3580 | { |
---|
[1200] | 3581 | #if NH_3D |
---|
[1124] | 3582 | return getVPS()->getIdRefListLayer( getLayerId(), getInterLayerPredLayerIdc( i ) ); |
---|
| 3583 | #else |
---|
[1066] | 3584 | return getVPS()->getIdDirectRefLayer( getLayerId(), getInterLayerPredLayerIdc( i ) ); |
---|
[1124] | 3585 | #endif |
---|
[56] | 3586 | } |
---|
[1133] | 3587 | #if H_3D |
---|
[1124] | 3588 | Void TComSlice::setDefaultRefView( ) |
---|
| 3589 | { |
---|
| 3590 | setDefaultRefViewIdx( -1 ); |
---|
| 3591 | setDefaultRefViewIdxAvailableFlag( false ); |
---|
| 3592 | |
---|
| 3593 | Int valid = 0; |
---|
| 3594 | Int DefaultRefViewIdx = -1; |
---|
| 3595 | for( UInt curViewIdx = 0; curViewIdx < getViewIndex() && valid == 0; curViewIdx++ ) |
---|
| 3596 | { |
---|
| 3597 | for( Int iRefListId = 0; ( iRefListId < (isInterB() ? 2 : 1) ) && !isIntra() && valid == 0; iRefListId++ ) |
---|
| 3598 | { |
---|
| 3599 | RefPicList eRefPicList = RefPicList( iRefListId ); |
---|
| 3600 | Int iNumRefPics = getNumRefIdx( eRefPicList ); |
---|
| 3601 | for( Int i = 0; i < iNumRefPics; i++ ) |
---|
| 3602 | { |
---|
| 3603 | if(getPOC() == getRefPic( eRefPicList, i )->getPOC() && curViewIdx == getRefPic( eRefPicList, i )->getViewIndex()) |
---|
| 3604 | { |
---|
| 3605 | valid = 1; |
---|
| 3606 | DefaultRefViewIdx = curViewIdx; |
---|
| 3607 | break; |
---|
| 3608 | } |
---|
| 3609 | } |
---|
| 3610 | } |
---|
| 3611 | } |
---|
| 3612 | if( valid ) |
---|
| 3613 | { |
---|
| 3614 | setDefaultRefViewIdx( DefaultRefViewIdx ); |
---|
| 3615 | setDefaultRefViewIdxAvailableFlag( true ); |
---|
| 3616 | } |
---|
| 3617 | } |
---|
| 3618 | #endif |
---|
| 3619 | |
---|
[608] | 3620 | #if H_3D_ARP |
---|
[724] | 3621 | Void TComSlice::setARPStepNum( TComPicLists*ivPicLists ) |
---|
[608] | 3622 | { |
---|
[724] | 3623 | Bool tempRefPicInListsFlag = false; |
---|
[1124] | 3624 | if( !getIvResPredFlag() || this->isIRAP()) |
---|
[56] | 3625 | { |
---|
[608] | 3626 | m_nARPStepNum = 0; |
---|
| 3627 | } |
---|
| 3628 | else |
---|
| 3629 | { |
---|
[724] | 3630 | setFirstTRefIdx (REF_PIC_LIST_0, -1); |
---|
| 3631 | setFirstTRefIdx (REF_PIC_LIST_1, -1); |
---|
| 3632 | for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ ) |
---|
| 3633 | { |
---|
[833] | 3634 | Int diffPOC=MAX_INT; |
---|
| 3635 | Int idx=-1; |
---|
[724] | 3636 | for(Int i = 0; i < getNumRefIdx(RefPicList(refListIdx)); i++ ) |
---|
| 3637 | { |
---|
| 3638 | if ( getRefPic(RefPicList(refListIdx), i)->getPOC() != getPOC() ) |
---|
| 3639 | { |
---|
[833] | 3640 | if( abs(getRefPic(RefPicList(refListIdx), i)->getPOC() - getPOC()) < diffPOC) |
---|
| 3641 | { |
---|
| 3642 | diffPOC=abs(getRefPic(RefPicList(refListIdx), i)->getPOC() - getPOC()); |
---|
| 3643 | idx=i; |
---|
| 3644 | } |
---|
[724] | 3645 | } |
---|
[833] | 3646 | if(idx>=0) |
---|
| 3647 | { |
---|
| 3648 | setFirstTRefIdx (RefPicList(refListIdx), idx); |
---|
| 3649 | } |
---|
[724] | 3650 | } |
---|
| 3651 | } |
---|
[1124] | 3652 | tempRefPicInListsFlag = (getFirstTRefIdx(REF_PIC_LIST_0) >= 0 || getFirstTRefIdx(REF_PIC_LIST_1) >= 0) && getDefaultRefViewIdxAvailableFlag(); |
---|
| 3653 | m_nARPStepNum = tempRefPicInListsFlag ? H_3D_ARP_WFNR : 0; |
---|
[773] | 3654 | } |
---|
[608] | 3655 | |
---|
[724] | 3656 | if (tempRefPicInListsFlag) |
---|
| 3657 | { |
---|
| 3658 | for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ ) |
---|
| 3659 | { |
---|
| 3660 | RefPicList eRefPicList = RefPicList( refListIdx ); |
---|
| 3661 | Int prevPOC = getRefPic(eRefPicList, getFirstTRefIdx(eRefPicList) )->getPOC(); |
---|
| 3662 | for( Int i = 0; i < getNumActiveRefLayerPics(); i++ ) |
---|
| 3663 | { |
---|
| 3664 | Int layerIdInNuh = getRefPicLayerId( i ); |
---|
[1196] | 3665 | |
---|
[1179] | 3666 | TComPic* picV = getIvPic( getIsDepth(), getVPS()->getViewIndex( layerIdInNuh ) ); |
---|
| 3667 | assert( picV != NULL ); |
---|
[1200] | 3668 | IntAry1d pocsInCurrRPSsPicV = picV->getSlice(0)->getPocsInCurrRPSs(); |
---|
[1179] | 3669 | Bool refRpRefAvailFlag = false; |
---|
| 3670 | for (Int idx = 0; idx < pocsInCurrRPSsPicV.size(); idx++) |
---|
| 3671 | { |
---|
| 3672 | if ( pocsInCurrRPSsPicV[idx] == prevPOC ) |
---|
| 3673 | { |
---|
| 3674 | refRpRefAvailFlag = true; |
---|
| 3675 | break; |
---|
| 3676 | } |
---|
| 3677 | } |
---|
| 3678 | |
---|
| 3679 | if (getFirstTRefIdx(eRefPicList) >= 0 && refRpRefAvailFlag ) |
---|
[724] | 3680 | { |
---|
| 3681 | m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = true; |
---|
| 3682 | } |
---|
| 3683 | else |
---|
| 3684 | { |
---|
| 3685 | m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = false; |
---|
| 3686 | } |
---|
| 3687 | } |
---|
[773] | 3688 | } |
---|
[724] | 3689 | } |
---|
[56] | 3690 | } |
---|
[608] | 3691 | #endif |
---|
[1196] | 3692 | |
---|
[608] | 3693 | #if H_3D_IC |
---|
[1196] | 3694 | // This is an encoder only function and should be moved to TEncSlice or TEncSearch!! |
---|
[950] | 3695 | Void TComSlice::xSetApplyIC(Bool bUseLowLatencyICEnc) |
---|
[608] | 3696 | { |
---|
[950] | 3697 | if(bUseLowLatencyICEnc) |
---|
| 3698 | { |
---|
| 3699 | Bool existInterViewRef=false; |
---|
| 3700 | TComPic* pcCurrPic = getPic(); |
---|
| 3701 | TComPic* pcRefPic = NULL; |
---|
| 3702 | for ( Int i = 0; (i < getNumRefIdx( REF_PIC_LIST_0 )) && !existInterViewRef; i++ ) |
---|
| 3703 | { |
---|
| 3704 | pcRefPic = getRefPic( REF_PIC_LIST_0, i ); |
---|
| 3705 | if ( pcRefPic != NULL ) |
---|
| 3706 | { |
---|
| 3707 | if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) |
---|
| 3708 | { |
---|
| 3709 | existInterViewRef = true; |
---|
| 3710 | } |
---|
| 3711 | } |
---|
| 3712 | } |
---|
| 3713 | |
---|
| 3714 | for ( Int i = 0; (i < getNumRefIdx( REF_PIC_LIST_1 )) && !existInterViewRef; i++ ) |
---|
| 3715 | { |
---|
| 3716 | pcRefPic = getRefPic( REF_PIC_LIST_1, i ); |
---|
| 3717 | if ( pcRefPic != NULL ) |
---|
| 3718 | { |
---|
| 3719 | if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) |
---|
| 3720 | { |
---|
| 3721 | existInterViewRef = true; |
---|
| 3722 | } |
---|
| 3723 | } |
---|
| 3724 | } |
---|
| 3725 | |
---|
| 3726 | if(!existInterViewRef) |
---|
| 3727 | { |
---|
| 3728 | m_bApplyIC = false; |
---|
| 3729 | } |
---|
| 3730 | else |
---|
| 3731 | { |
---|
| 3732 | Int curLayer=getDepth(); |
---|
| 3733 | if( curLayer>9) curLayer=9; // Max layer is 10 |
---|
| 3734 | |
---|
| 3735 | m_bApplyIC = true; |
---|
| 3736 | Int refLayer = curLayer-1; |
---|
[1084] | 3737 | |
---|
[1066] | 3738 | Int ICEnableCandidate = getICEnableCandidate(refLayer); |
---|
| 3739 | Int ICEnableNum = getICEnableNum(refLayer); |
---|
| 3740 | if( (refLayer>=0) && (ICEnableCandidate>0) ) |
---|
| 3741 | { |
---|
| 3742 | Double ratio=Double(ICEnableNum/Double(ICEnableCandidate)); |
---|
| 3743 | |
---|
| 3744 | if( ratio > IC_LOW_LATENCY_ENCODING_THRESHOLD) |
---|
| 3745 | { |
---|
| 3746 | m_bApplyIC=true; |
---|
| 3747 | } |
---|
| 3748 | else |
---|
| 3749 | { |
---|
| 3750 | m_bApplyIC=false; |
---|
| 3751 | } |
---|
| 3752 | } |
---|
| 3753 | setICEnableCandidate(curLayer, 0); |
---|
| 3754 | setICEnableNum(curLayer, 0); |
---|
[950] | 3755 | } |
---|
| 3756 | } |
---|
| 3757 | else |
---|
[1196] | 3758 | { |
---|
| 3759 | TComPic* pcCurrPic = getPic(); |
---|
| 3760 | TComPicYuv* pcCurrPicYuv = pcCurrPic->getPicYuvOrg(); |
---|
| 3761 | |
---|
| 3762 | // Get InterView Reference picture |
---|
| 3763 | // !!!!! Assume only one Interview Reference Picture in L0 |
---|
| 3764 | // GT: Is this assumption correct? |
---|
[608] | 3765 | |
---|
[1196] | 3766 | TComPicYuv* pcRefPicYuvOrg = NULL; |
---|
| 3767 | for ( Int i = 0; i < getNumRefIdx( REF_PIC_LIST_0 ); i++ ) |
---|
[608] | 3768 | { |
---|
[1196] | 3769 | TComPic* pcRefPic = getRefPic( REF_PIC_LIST_0, i ); |
---|
| 3770 | if ( pcRefPic != NULL ) |
---|
[608] | 3771 | { |
---|
[1196] | 3772 | if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) |
---|
| 3773 | { |
---|
| 3774 | pcRefPicYuvOrg = pcRefPic->getPicYuvOrg(); |
---|
| 3775 | } |
---|
[608] | 3776 | } |
---|
| 3777 | } |
---|
| 3778 | |
---|
[1196] | 3779 | if ( pcRefPicYuvOrg != NULL ) |
---|
| 3780 | { |
---|
| 3781 | // Histogram building - luminance |
---|
| 3782 | Int iMaxPelValue = ( 1 << g_bitDepthY ); |
---|
| 3783 | Int *aiRefOrgHist = (Int *) xMalloc( Int,iMaxPelValue ); |
---|
| 3784 | Int *aiCurrHist = (Int *) xMalloc( Int,iMaxPelValue ); |
---|
| 3785 | memset( aiRefOrgHist, 0, iMaxPelValue*sizeof(Int) ); |
---|
| 3786 | memset( aiCurrHist, 0, iMaxPelValue*sizeof(Int) ); |
---|
[608] | 3787 | |
---|
[1196] | 3788 | Int iWidth = pcCurrPicYuv->getWidth(); |
---|
| 3789 | Int iHeight = pcCurrPicYuv->getHeight(); |
---|
| 3790 | |
---|
| 3791 | Pel* pCurrY = pcCurrPicYuv ->getLumaAddr(); |
---|
| 3792 | Pel* pRefOrgY = pcRefPicYuvOrg ->getLumaAddr(); |
---|
| 3793 | Int iCurrStride = pcCurrPicYuv->getStride(); |
---|
| 3794 | Int iRefStride = pcRefPicYuvOrg->getStride(); |
---|
| 3795 | |
---|
| 3796 | for ( Int y = 0; y < iHeight; y++ ) |
---|
[608] | 3797 | { |
---|
[1196] | 3798 | for ( Int x = 0; x < iWidth; x++ ) |
---|
| 3799 | { |
---|
| 3800 | aiCurrHist[pCurrY[x]]++; |
---|
| 3801 | aiRefOrgHist[pRefOrgY[x]]++; |
---|
| 3802 | } |
---|
| 3803 | pCurrY += iCurrStride; |
---|
| 3804 | pRefOrgY += iRefStride; |
---|
[608] | 3805 | } |
---|
[1196] | 3806 | |
---|
| 3807 | // Histogram SAD |
---|
| 3808 | Int iSumOrgSAD = 0; |
---|
| 3809 | for ( Int i = 0; i < iMaxPelValue; i++ ) |
---|
| 3810 | { |
---|
| 3811 | iSumOrgSAD += abs( aiCurrHist[i] - aiRefOrgHist[i] ); |
---|
| 3812 | } |
---|
| 3813 | |
---|
| 3814 | // Setting |
---|
| 3815 | Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05; |
---|
| 3816 | |
---|
| 3817 | if ( iSumOrgSAD > Int( dThresholdOrgSAD * iWidth * iHeight ) ) |
---|
| 3818 | { |
---|
| 3819 | m_bApplyIC = true; |
---|
| 3820 | } |
---|
| 3821 | else |
---|
| 3822 | { |
---|
| 3823 | m_bApplyIC = false; |
---|
| 3824 | } |
---|
| 3825 | |
---|
| 3826 | xFree( aiCurrHist ); |
---|
| 3827 | xFree( aiRefOrgHist ); |
---|
[608] | 3828 | } |
---|
[950] | 3829 | }//if(bUseLowLatencyICEnc) |
---|
[608] | 3830 | } |
---|
| 3831 | #endif |
---|
[1200] | 3832 | #if NH_3D |
---|
[608] | 3833 | Void TComSlice::setIvPicLists( TComPicLists* m_ivPicLists ) |
---|
| 3834 | { |
---|
| 3835 | for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
| 3836 | { |
---|
| 3837 | for ( Int depthId = 0; depthId < 2; depthId++ ) |
---|
| 3838 | { |
---|
| 3839 | m_ivPicsCurrPoc[ depthId ][ i ] = ( i <= m_viewIndex ) ? m_ivPicLists->getPic( i, ( depthId == 1) , getPOC() ) : NULL; |
---|
| 3840 | } |
---|
| 3841 | } |
---|
| 3842 | } |
---|
| 3843 | Void TComSlice::setDepthToDisparityLUTs() |
---|
| 3844 | { |
---|
| 3845 | Bool setupLUT = false; |
---|
[1124] | 3846 | |
---|
| 3847 | setupLUT = setupLUT || getViewSynthesisPredFlag( ); |
---|
[608] | 3848 | |
---|
| 3849 | #if H_3D_NBDV_REF |
---|
[1124] | 3850 | setupLUT = setupLUT || getDepthRefinementFlag( ); |
---|
[1179] | 3851 | #endif |
---|
[608] | 3852 | |
---|
[773] | 3853 | #if H_3D_IV_MERGE |
---|
[1124] | 3854 | setupLUT = setupLUT || ( getIvMvPredFlag() && getIsDepth() ); |
---|
[724] | 3855 | #endif |
---|
| 3856 | |
---|
[1200] | 3857 | Int bitDepthY = getSPS()->getBitDepth(CHANNEL_TYPE_LUMA); |
---|
[833] | 3858 | |
---|
[608] | 3859 | if( !setupLUT ) |
---|
[1200] | 3860 | { |
---|
[608] | 3861 | return; |
---|
[1200] | 3862 | } |
---|
[608] | 3863 | |
---|
[1179] | 3864 | m_numViews = getVPS()->getNumViews(); |
---|
[608] | 3865 | /// GT: Allocation should be moved to a better place later; |
---|
| 3866 | if ( m_depthToDisparityB == NULL ) |
---|
| 3867 | { |
---|
[1179] | 3868 | m_depthToDisparityB = new Int*[ m_numViews ]; |
---|
| 3869 | for ( Int i = 0; i < getVPS()->getNumViews(); i++ ) |
---|
[608] | 3870 | { |
---|
[1200] | 3871 | m_depthToDisparityB[ i ] = new Int[ Int(1 << bitDepthY) ]; |
---|
[608] | 3872 | } |
---|
| 3873 | } |
---|
| 3874 | |
---|
[1179] | 3875 | |
---|
[608] | 3876 | if ( m_depthToDisparityF == NULL ) |
---|
| 3877 | { |
---|
[1179] | 3878 | m_depthToDisparityF = new Int*[ m_numViews ]; |
---|
| 3879 | for ( Int i = 0; i < m_numViews; i++ ) |
---|
[608] | 3880 | { |
---|
[1200] | 3881 | m_depthToDisparityF[ i ] = new Int[ Int(1 << bitDepthY) ]; |
---|
[608] | 3882 | } |
---|
| 3883 | } |
---|
| 3884 | |
---|
| 3885 | assert( m_depthToDisparityB != NULL ); |
---|
| 3886 | assert( m_depthToDisparityF != NULL ); |
---|
| 3887 | |
---|
[1200] | 3888 | const TComVPS* vps = getVPS(); |
---|
[608] | 3889 | |
---|
[1200] | 3890 | Int log2Div = bitDepthY - 1 + vps->getCpPrecision(); |
---|
[1179] | 3891 | Int voiInVps = vps->getVoiInVps( getViewIndex() ); |
---|
| 3892 | Bool camParaSH = vps->getCpInSliceSegmentHeaderFlag( voiInVps ); |
---|
| 3893 | |
---|
[1200] | 3894 | const IntAry1d codScale = camParaSH ? m_aaiCodedScale [ 0 ] : vps->getCodedScale ( voiInVps ); |
---|
| 3895 | const IntAry1d codOffset = camParaSH ? m_aaiCodedOffset[ 0 ] : vps->getCodedOffset ( voiInVps ); |
---|
| 3896 | const IntAry1d invCodScale = camParaSH ? m_aaiCodedScale [ 1 ] : vps->getInvCodedScale ( voiInVps ); |
---|
| 3897 | const IntAry1d invCodOffset = camParaSH ? m_aaiCodedOffset[ 1 ] : vps->getInvCodedOffset( voiInVps ); |
---|
[1179] | 3898 | |
---|
| 3899 | |
---|
| 3900 | for (Int i = 0; i < voiInVps; i++) |
---|
| 3901 | { |
---|
| 3902 | Int iInVoi = vps->getVoiInVps( i ); |
---|
| 3903 | #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC |
---|
| 3904 | if ( g_traceCameraParameters ) |
---|
| 3905 | { |
---|
| 3906 | std::cout << std::endl << "Cp: " << codScale [ iInVoi ] << " " << codOffset[ iInVoi ] << " " |
---|
| 3907 | << invCodScale[ iInVoi ] << " " << invCodOffset[ iInVoi ] << " " << log2Div; |
---|
| 3908 | } |
---|
| 3909 | #endif |
---|
[1200] | 3910 | for ( Int d = 0; d <= ( ( 1 << bitDepthY ) - 1 ); d++ ) |
---|
[1179] | 3911 | { |
---|
[1200] | 3912 | Int offset = ( codOffset [ iInVoi ] << bitDepthY ) + ( ( 1 << log2Div ) >> 1 ); |
---|
[1179] | 3913 | m_depthToDisparityB[ iInVoi ][ d ] = ( codScale [ iInVoi ] * d + offset ) >> log2Div; |
---|
| 3914 | |
---|
[1200] | 3915 | Int invOffset = ( invCodOffset[ iInVoi ] << bitDepthY ) + ( ( 1 << log2Div ) >> 1 ); |
---|
[1179] | 3916 | m_depthToDisparityF[ iInVoi ][ d ] = ( invCodScale[ iInVoi ] * d + invOffset ) >> log2Div; |
---|
| 3917 | } |
---|
| 3918 | } |
---|
[608] | 3919 | } |
---|
| 3920 | #endif |
---|
| 3921 | #endif |
---|
[833] | 3922 | |
---|
| 3923 | |
---|
[1200] | 3924 | #if NH_MV |
---|
| 3925 | Void TComSlice::checkCrossLayerBlaFlag() const |
---|
[976] | 3926 | { |
---|
| 3927 | // cross_layer_bla_flag shall be equal to 0 for pictures with nal_unit_type not equal to IDR_W_RADL or IDR_N_LP or with nuh_layer_id not equal to 0. |
---|
| 3928 | if ( getLayerId() != 0 || getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) |
---|
| 3929 | { |
---|
| 3930 | assert( m_crossLayerBlaFlag == 0 ); |
---|
| 3931 | } |
---|
| 3932 | } |
---|
| 3933 | |
---|
| 3934 | Bool TComSlice::inferPocMsbValPresentFlag() |
---|
| 3935 | { |
---|
| 3936 | Bool pocMsbValPresentFlag; |
---|
| 3937 | if( getSliceSegmentHeaderExtensionLength() == 0 ) |
---|
| 3938 | { |
---|
| 3939 | pocMsbValPresentFlag = false; |
---|
| 3940 | } |
---|
| 3941 | else if ( getPocMsbValRequiredFlag() ) |
---|
| 3942 | { |
---|
| 3943 | pocMsbValPresentFlag = true; |
---|
| 3944 | } |
---|
| 3945 | else |
---|
| 3946 | { |
---|
| 3947 | pocMsbValPresentFlag = false; |
---|
| 3948 | } |
---|
| 3949 | |
---|
| 3950 | return pocMsbValPresentFlag; |
---|
| 3951 | } |
---|
| 3952 | |
---|
| 3953 | |
---|
| 3954 | #endif |
---|
| 3955 | |
---|
| 3956 | |
---|
[1200] | 3957 | #if NH_3D |
---|
[1124] | 3958 | Void TComSlice::init3dToolParameters() |
---|
| 3959 | { |
---|
| 3960 | Bool depthFlag = getIsDepth(); |
---|
| 3961 | |
---|
| 3962 | Bool nRLLG0 = ( getVPS()->getNumRefListLayers( getLayerId() ) > 0 ); |
---|
| 3963 | |
---|
[1200] | 3964 | const TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension(); |
---|
[1124] | 3965 | |
---|
[1179] | 3966 | m_ivMvPredFlag = sps3dExt->getIvMvPredFlag ( depthFlag ) && nRLLG0 ; |
---|
| 3967 | m_ivMvScalingFlag = sps3dExt->getIvMvScalingFlag ( depthFlag ) ; |
---|
| 3968 | m_ivResPredFlag = sps3dExt->getIvResPredFlag ( depthFlag ) && nRLLG0 ; |
---|
| 3969 | m_depthRefinementFlag = sps3dExt->getDepthRefinementFlag ( depthFlag ) && getInCompPredFlag() && m_cpAvailableFlag; |
---|
| 3970 | m_viewSynthesisPredFlag = sps3dExt->getViewSynthesisPredFlag( depthFlag ) && nRLLG0 && getInCompPredFlag() && m_cpAvailableFlag; |
---|
| 3971 | m_depthBasedBlkPartFlag = sps3dExt->getDepthBasedBlkPartFlag( depthFlag ) && getInCompPredFlag(); |
---|
| 3972 | m_mpiFlag = sps3dExt->getMpiFlag ( depthFlag ) && getInCompPredFlag(); |
---|
| 3973 | m_intraContourFlag = sps3dExt->getIntraContourFlag ( depthFlag ) && getInCompPredFlag(); |
---|
| 3974 | m_intraSdcWedgeFlag = sps3dExt->getIntraSdcWedgeFlag ( depthFlag ) ; |
---|
| 3975 | m_qtPredFlag = sps3dExt->getQtPredFlag ( depthFlag ) && getInCompPredFlag(); |
---|
| 3976 | m_interSdcFlag = sps3dExt->getInterSdcFlag ( depthFlag ) ; |
---|
| 3977 | m_depthIntraSkipFlag = sps3dExt->getDepthIntraSkipFlag ( depthFlag ) ; |
---|
| 3978 | |
---|
| 3979 | m_subPbSize = 1 << ( sps3dExt->getLog2SubPbSizeMinus3 ( depthFlag ) + 3 ); |
---|
| 3980 | m_mpiSubPbSize = 1 << ( sps3dExt->getLog2MpiSubPbSizeMinus3( depthFlag ) + 3 ); |
---|
| 3981 | |
---|
| 3982 | |
---|
[1124] | 3983 | #if H_3D_OUTPUT_ACTIVE_TOOLS |
---|
| 3984 | std::cout << "Layer: :" << getLayerId() << std::endl; |
---|
| 3985 | std::cout << "DepthFlag: :" << getIsDepth() << std::endl; |
---|
| 3986 | std::cout << "ViewOrderIdx: :" << getViewIndex() << std::endl; |
---|
[1179] | 3987 | std::cout << "InterCmpPredAvailableFlag:" << getInCmpPredAvailFlag() << std::endl; |
---|
| 3988 | std::cout << "InterCompPredFlag :" << getInCompPredFlag() << std::endl; |
---|
[1124] | 3989 | |
---|
| 3990 | std::cout << "ivMvPredFlag :" << m_ivMvPredFlag << std::endl; |
---|
| 3991 | std::cout << "ivMvScalingFlag :" << m_ivMvScalingFlag << std::endl; |
---|
| 3992 | std::cout << "ivResPredFlag :" << m_ivResPredFlag << std::endl; |
---|
| 3993 | std::cout << "depthRefinementFlag :" << m_depthRefinementFlag << std::endl; |
---|
| 3994 | std::cout << "viewSynthesisPredFlag :" << m_viewSynthesisPredFlag << std::endl; |
---|
| 3995 | std::cout << "depthBasedBlkPartFlag :" << m_depthBasedBlkPartFlag << std::endl; |
---|
| 3996 | std::cout << "mpiFlag :" << m_mpiFlag << std::endl; |
---|
| 3997 | std::cout << "intraContourFlag :" << m_intraContourFlag << std::endl; |
---|
| 3998 | std::cout << "intraSdcWedgeFlag :" << m_intraSdcWedgeFlag << std::endl; |
---|
| 3999 | std::cout << "qtPredFlag :" << m_qtPredFlag << std::endl; |
---|
| 4000 | std::cout << "interSdcFlag :" << m_interSdcFlag << std::endl; |
---|
[1179] | 4001 | std::cout << "depthIntraSkipFlag :" << m_depthIntraSkipFlag << std::endl; |
---|
[1124] | 4002 | std::cout << "subPbSize :" << m_subPbSize << std::endl; |
---|
| 4003 | std::cout << "mpiSubPbSize :" << m_mpiSubPbSize << std::endl; |
---|
| 4004 | #endif |
---|
| 4005 | } |
---|
[1196] | 4006 | |
---|
[1200] | 4007 | Void TComSlice::deriveInCmpPredAndCpAvailFlag( ) |
---|
[1196] | 4008 | { |
---|
| 4009 | Int numCurCmpLIds = getIsDepth() ? 1 : getNumActiveRefLayerPics(); |
---|
| 4010 | std::vector<Int> curCmpLIds; |
---|
| 4011 | if ( getIsDepth() ) |
---|
| 4012 | { |
---|
| 4013 | curCmpLIds.push_back( getLayerId() ); |
---|
| 4014 | } |
---|
| 4015 | else |
---|
| 4016 | { |
---|
| 4017 | for (Int i = 0; i < numCurCmpLIds; i++) |
---|
| 4018 | { |
---|
| 4019 | curCmpLIds.push_back( getRefPicLayerId( i ) ); |
---|
| 4020 | } |
---|
| 4021 | } |
---|
| 4022 | |
---|
| 4023 | m_cpAvailableFlag = true; |
---|
| 4024 | m_inCmpRefViewIdcs.clear(); |
---|
| 4025 | Bool allRefCmpLayersAvailFlag = true; |
---|
| 4026 | |
---|
| 4027 | for( Int i = 0; i <= numCurCmpLIds - 1; i++ ) |
---|
| 4028 | { |
---|
| 4029 | m_inCmpRefViewIdcs.push_back( getVPS()->getViewOrderIdx( curCmpLIds[ i ] )); |
---|
| 4030 | if( !getVPS()->getCpPresentFlag( getVPS()->getVoiInVps( getViewIndex() ), getVPS()->getVoiInVps( m_inCmpRefViewIdcs[ i ] ) ) ) |
---|
| 4031 | { |
---|
| 4032 | m_cpAvailableFlag = false; |
---|
| 4033 | } |
---|
| 4034 | Bool refCmpCurLIdAvailFlag = false; |
---|
| 4035 | if( getVPS()->getViewCompLayerPresentFlag( m_inCmpRefViewIdcs[ i ], !getIsDepth() ) ) |
---|
| 4036 | { |
---|
| 4037 | Int j = getVPS()->getLayerIdInVps( getVPS()->getViewCompLayerId( m_inCmpRefViewIdcs[ i ], !getIsDepth() ) ); |
---|
| 4038 | if ( getVPS()->getDirectDependencyFlag( getVPS()->getLayerIdInVps( getLayerId() ) , j ) && |
---|
| 4039 | getVPS()->getSubLayersVpsMaxMinus1( j ) >= getTemporalId() && |
---|
| 4040 | ( getTemporalId() == 0 || getVPS()->getMaxTidIlRefPicsPlus1( j , getVPS()->getLayerIdInVps( getLayerId() ) ) > getTemporalId() ) |
---|
| 4041 | ) |
---|
| 4042 | { |
---|
| 4043 | refCmpCurLIdAvailFlag = true; |
---|
| 4044 | } |
---|
| 4045 | } |
---|
| 4046 | if( !refCmpCurLIdAvailFlag ) |
---|
| 4047 | { |
---|
| 4048 | allRefCmpLayersAvailFlag = false; |
---|
| 4049 | } |
---|
| 4050 | } |
---|
| 4051 | |
---|
| 4052 | if( !allRefCmpLayersAvailFlag ) |
---|
| 4053 | { |
---|
| 4054 | m_inCmpPredAvailFlag = false; |
---|
| 4055 | } |
---|
| 4056 | else |
---|
| 4057 | { |
---|
[1200] | 4058 | const TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension(); |
---|
[1196] | 4059 | if( !getIsDepth() ) |
---|
| 4060 | { |
---|
| 4061 | m_inCmpPredAvailFlag = sps3dExt->getViewSynthesisPredFlag( getIsDepth() ) || |
---|
| 4062 | sps3dExt->getDepthBasedBlkPartFlag( getIsDepth() ) || |
---|
| 4063 | sps3dExt->getDepthRefinementFlag ( getIsDepth() ); |
---|
| 4064 | } |
---|
| 4065 | else |
---|
| 4066 | { |
---|
| 4067 | m_inCmpPredAvailFlag = sps3dExt->getIntraContourFlag( getIsDepth() ) || |
---|
| 4068 | sps3dExt->getQtPredFlag( getIsDepth() ) || |
---|
| 4069 | sps3dExt->getMpiFlag( getIsDepth() ); |
---|
| 4070 | } |
---|
| 4071 | } |
---|
| 4072 | } |
---|
| 4073 | |
---|
| 4074 | Void TComSlice::checkInCompPredRefLayers() |
---|
| 4075 | { |
---|
| 4076 | if ( getInCompPredFlag() ) |
---|
| 4077 | { |
---|
| 4078 | for (Int i = 0; i < getNumCurCmpLIds(); i++ ) |
---|
| 4079 | { |
---|
| 4080 | assert( getIvPic(!getIsDepth(), getInCmpRefViewIdcs( i ) ) != NULL ); |
---|
| 4081 | // It is a requirement of bitstream conformance that there |
---|
| 4082 | // is a picture in the DPB with PicOrderCntVal equal to the PicOrderCntVal of the current picture, |
---|
| 4083 | // and a nuh_layer_id value equal to ViewCompLayerId[ inCmpRefViewIdcs[ i ] ][ !DepthFlag ]. |
---|
| 4084 | } |
---|
| 4085 | } |
---|
| 4086 | } |
---|
| 4087 | |
---|
[1124] | 4088 | #endif |
---|
| 4089 | |
---|
[56] | 4090 | /** get scaling matrix from RefMatrixID |
---|
[1200] | 4091 | * \param sizeId size index |
---|
| 4092 | * \param listId index of input matrix |
---|
| 4093 | * \param refListId index of reference matrix |
---|
[56] | 4094 | */ |
---|
| 4095 | Void TComScalingList::processRefMatrix( UInt sizeId, UInt listId , UInt refListId ) |
---|
| 4096 | { |
---|
[608] | 4097 | ::memcpy(getScalingListAddress(sizeId, listId),((listId == refListId)? getScalingListDefaultAddress(sizeId, refListId): getScalingListAddress(sizeId, refListId)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
[56] | 4098 | } |
---|
[608] | 4099 | |
---|
[1200] | 4100 | Void TComScalingList::checkPredMode(UInt sizeId, UInt listId) |
---|
[56] | 4101 | { |
---|
[1200] | 4102 | Int predListStep = (sizeId == SCALING_LIST_32x32? (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) : 1); // if 32x32, skip over chroma entries. |
---|
[56] | 4103 | |
---|
[1200] | 4104 | for(Int predListIdx = (Int)listId ; predListIdx >= 0; predListIdx-=predListStep) |
---|
[56] | 4105 | { |
---|
[1200] | 4106 | if( !memcmp(getScalingListAddress(sizeId,listId),((listId == predListIdx) ? |
---|
| 4107 | getScalingListDefaultAddress(sizeId, predListIdx): getScalingListAddress(sizeId, predListIdx)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix |
---|
| 4108 | && ((sizeId < SCALING_LIST_16x16) || (getScalingListDC(sizeId,listId) == getScalingListDC(sizeId,predListIdx)))) // check DC value |
---|
| 4109 | { |
---|
| 4110 | setRefMatrixId(sizeId, listId, predListIdx); |
---|
| 4111 | setScalingListPredModeFlag(sizeId, listId, false); |
---|
| 4112 | return; |
---|
| 4113 | } |
---|
[56] | 4114 | } |
---|
[1200] | 4115 | setScalingListPredModeFlag(sizeId, listId, true); |
---|
| 4116 | } |
---|
[56] | 4117 | |
---|
[1200] | 4118 | static Void outputScalingListHelp(std::ostream &os) |
---|
| 4119 | { |
---|
| 4120 | os << "The scaling list file specifies all matrices and their DC values; none can be missing,\n" |
---|
| 4121 | "but their order is arbitrary.\n\n" |
---|
| 4122 | "The matrices are specified by:\n" |
---|
| 4123 | "<matrix name><unchecked data>\n" |
---|
| 4124 | " <value>,<value>,<value>,....\n\n" |
---|
| 4125 | " Line-feeds can be added arbitrarily between values, and the number of values needs to be\n" |
---|
| 4126 | " at least the number of entries for the matrix (superfluous entries are ignored).\n" |
---|
| 4127 | " The <unchecked data> is text on the same line as the matrix that is not checked\n" |
---|
| 4128 | " except to ensure that the matrix name token is unique. It is recommended that it is ' ='\n" |
---|
| 4129 | " The values in the matrices are the absolute values (0-255), not the delta values as\n" |
---|
| 4130 | " exchanged between the encoder and decoder\n\n" |
---|
| 4131 | "The DC values (for matrix sizes larger than 8x8) are specified by:\n" |
---|
| 4132 | "<matrix name>_DC<unchecked data>\n" |
---|
| 4133 | " <value>\n"; |
---|
| 4134 | |
---|
| 4135 | os << "The permitted matrix names are:\n"; |
---|
| 4136 | for(UInt sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) |
---|
[56] | 4137 | { |
---|
[1200] | 4138 | for(UInt listIdc = 0; listIdc < SCALING_LIST_NUM; listIdc++) |
---|
[56] | 4139 | { |
---|
[1200] | 4140 | if ((sizeIdc!=SCALING_LIST_32x32) || (listIdc%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) == 0)) |
---|
| 4141 | { |
---|
| 4142 | os << " " << MatrixType[sizeIdc][listIdc] << '\n'; |
---|
| 4143 | } |
---|
| 4144 | } |
---|
| 4145 | } |
---|
| 4146 | } |
---|
[56] | 4147 | |
---|
[1200] | 4148 | Void TComScalingList::outputScalingLists(std::ostream &os) const |
---|
| 4149 | { |
---|
| 4150 | for(UInt sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) |
---|
| 4151 | { |
---|
| 4152 | const UInt size = min(8,4<<(sizeIdc)); |
---|
| 4153 | for(UInt listIdc = 0; listIdc < SCALING_LIST_NUM; listIdc++) |
---|
| 4154 | { |
---|
| 4155 | if ((sizeIdc!=SCALING_LIST_32x32) || (listIdc%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) == 0)) |
---|
[56] | 4156 | { |
---|
[1200] | 4157 | const Int *src = getScalingListAddress(sizeIdc, listIdc); |
---|
| 4158 | os << (MatrixType[sizeIdc][listIdc]) << " =\n "; |
---|
| 4159 | for(UInt y=0; y<size; y++) |
---|
[56] | 4160 | { |
---|
[1200] | 4161 | for(UInt x=0; x<size; x++, src++) |
---|
| 4162 | { |
---|
| 4163 | os << std::setw(3) << (*src) << ", "; |
---|
| 4164 | } |
---|
| 4165 | os << (y+1<size?"\n ":"\n"); |
---|
[56] | 4166 | } |
---|
[1200] | 4167 | if(sizeIdc > SCALING_LIST_8x8) |
---|
| 4168 | { |
---|
| 4169 | os << MatrixType_DC[sizeIdc][listIdc] << " = \n " << std::setw(3) << getScalingListDC(sizeIdc, listIdc) << "\n"; |
---|
| 4170 | } |
---|
| 4171 | os << "\n"; |
---|
[56] | 4172 | } |
---|
[1200] | 4173 | } |
---|
| 4174 | } |
---|
| 4175 | } |
---|
| 4176 | |
---|
| 4177 | Bool TComScalingList::xParseScalingList(Char* pchFile) |
---|
| 4178 | { |
---|
| 4179 | static const Int LINE_SIZE=1024; |
---|
| 4180 | FILE *fp = NULL; |
---|
| 4181 | Char line[LINE_SIZE]; |
---|
| 4182 | |
---|
| 4183 | if (pchFile == NULL) |
---|
| 4184 | { |
---|
| 4185 | fprintf(stderr, "Error: no scaling list file specified. Help on scaling lists being output\n"); |
---|
| 4186 | outputScalingListHelp(std::cout); |
---|
| 4187 | std::cout << "\n\nExample scaling list file using default values:\n\n"; |
---|
| 4188 | outputScalingLists(std::cout); |
---|
| 4189 | exit (1); |
---|
| 4190 | return true; |
---|
| 4191 | } |
---|
| 4192 | else if ((fp = fopen(pchFile,"r")) == (FILE*)NULL) |
---|
| 4193 | { |
---|
| 4194 | fprintf(stderr, "Error: cannot open scaling list file %s for reading\n",pchFile); |
---|
| 4195 | return true; |
---|
| 4196 | } |
---|
| 4197 | |
---|
| 4198 | for(UInt sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) |
---|
| 4199 | { |
---|
| 4200 | const UInt size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeIdc]); |
---|
| 4201 | |
---|
| 4202 | for(UInt listIdc = 0; listIdc < SCALING_LIST_NUM; listIdc++) |
---|
| 4203 | { |
---|
| 4204 | Int * const src = getScalingListAddress(sizeIdc, listIdc); |
---|
| 4205 | |
---|
| 4206 | if ((sizeIdc==SCALING_LIST_32x32) && (listIdc%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) != 0)) // derive chroma32x32 from chroma16x16 |
---|
[56] | 4207 | { |
---|
[1200] | 4208 | const Int *srcNextSmallerSize = getScalingListAddress(sizeIdc-1, listIdc); |
---|
| 4209 | for(UInt i=0; i<size; i++) |
---|
[56] | 4210 | { |
---|
[1200] | 4211 | src[i] = srcNextSmallerSize[i]; |
---|
[56] | 4212 | } |
---|
[1200] | 4213 | setScalingListDC(sizeIdc,listIdc,(sizeIdc > SCALING_LIST_8x8) ? getScalingListDC(sizeIdc-1, listIdc) : src[0]); |
---|
[56] | 4214 | } |
---|
[1200] | 4215 | else |
---|
[56] | 4216 | { |
---|
| 4217 | { |
---|
[1200] | 4218 | fseek(fp, 0, SEEK_SET); |
---|
| 4219 | Bool bFound=false; |
---|
| 4220 | while ((!feof(fp)) && (!bFound)) |
---|
[56] | 4221 | { |
---|
[1200] | 4222 | Char *ret = fgets(line, LINE_SIZE, fp); |
---|
| 4223 | Char *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType[sizeIdc][listIdc]); |
---|
| 4224 | // This could be a match against the DC string as well, so verify it isn't |
---|
| 4225 | if (findNamePosition!= NULL && (MatrixType_DC[sizeIdc][listIdc]==NULL || strstr(line, MatrixType_DC[sizeIdc][listIdc])==NULL)) |
---|
| 4226 | { |
---|
| 4227 | bFound=true; |
---|
| 4228 | } |
---|
| 4229 | } |
---|
| 4230 | if (!bFound) |
---|
| 4231 | { |
---|
| 4232 | fprintf(stderr, "Error: cannot find Matrix %s from scaling list file %s\n", MatrixType[sizeIdc][listIdc], pchFile); |
---|
[56] | 4233 | return true; |
---|
| 4234 | } |
---|
| 4235 | } |
---|
[1200] | 4236 | for (UInt i=0; i<size; i++) |
---|
[608] | 4237 | { |
---|
[1200] | 4238 | Int data; |
---|
| 4239 | if (fscanf(fp, "%d,", &data)!=1) |
---|
| 4240 | { |
---|
| 4241 | fprintf(stderr, "Error: cannot read value #%d for Matrix %s from scaling list file %s at file position %ld\n", i, MatrixType[sizeIdc][listIdc], pchFile, ftell(fp)); |
---|
| 4242 | return true; |
---|
| 4243 | } |
---|
| 4244 | if (data<0 || data>255) |
---|
| 4245 | { |
---|
| 4246 | fprintf(stderr, "Error: QMatrix entry #%d of value %d for Matrix %s from scaling list file %s at file position %ld is out of range (0 to 255)\n", i, data, MatrixType[sizeIdc][listIdc], pchFile, ftell(fp)); |
---|
| 4247 | return true; |
---|
| 4248 | } |
---|
| 4249 | src[i] = data; |
---|
[608] | 4250 | } |
---|
[1200] | 4251 | |
---|
| 4252 | //set DC value for default matrix check |
---|
| 4253 | setScalingListDC(sizeIdc,listIdc,src[0]); |
---|
| 4254 | |
---|
| 4255 | if(sizeIdc > SCALING_LIST_8x8) |
---|
| 4256 | { |
---|
| 4257 | { |
---|
| 4258 | fseek(fp, 0, SEEK_SET); |
---|
| 4259 | Bool bFound=false; |
---|
| 4260 | while ((!feof(fp)) && (!bFound)) |
---|
| 4261 | { |
---|
| 4262 | Char *ret = fgets(line, LINE_SIZE, fp); |
---|
| 4263 | Char *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType_DC[sizeIdc][listIdc]); |
---|
| 4264 | if (findNamePosition!= NULL) |
---|
| 4265 | { |
---|
| 4266 | // This won't be a match against the non-DC string. |
---|
| 4267 | bFound=true; |
---|
| 4268 | } |
---|
| 4269 | } |
---|
| 4270 | if (!bFound) |
---|
| 4271 | { |
---|
| 4272 | fprintf(stderr, "Error: cannot find DC Matrix %s from scaling list file %s\n", MatrixType_DC[sizeIdc][listIdc], pchFile); |
---|
| 4273 | return true; |
---|
| 4274 | } |
---|
| 4275 | } |
---|
| 4276 | Int data; |
---|
| 4277 | if (fscanf(fp, "%d,", &data)!=1) |
---|
| 4278 | { |
---|
| 4279 | fprintf(stderr, "Error: cannot read DC %s from scaling list file %s at file position %ld\n", MatrixType_DC[sizeIdc][listIdc], pchFile, ftell(fp)); |
---|
| 4280 | return true; |
---|
| 4281 | } |
---|
| 4282 | if (data<0 || data>255) |
---|
| 4283 | { |
---|
| 4284 | fprintf(stderr, "Error: DC value %d for Matrix %s from scaling list file %s at file position %ld is out of range (0 to 255)\n", data, MatrixType[sizeIdc][listIdc], pchFile, ftell(fp)); |
---|
| 4285 | return true; |
---|
| 4286 | } |
---|
| 4287 | //overwrite DC value when size of matrix is larger than 16x16 |
---|
| 4288 | setScalingListDC(sizeIdc,listIdc,data); |
---|
| 4289 | } |
---|
[56] | 4290 | } |
---|
| 4291 | } |
---|
| 4292 | } |
---|
[1200] | 4293 | // std::cout << "\n\nRead scaling lists of:\n\n"; |
---|
| 4294 | // outputScalingLists(std::cout); |
---|
| 4295 | |
---|
[56] | 4296 | fclose(fp); |
---|
| 4297 | return false; |
---|
| 4298 | } |
---|
| 4299 | |
---|
[1200] | 4300 | #if NH_MV |
---|
| 4301 | Void TComScalingList::inferFrom( const TComScalingList& srcScLi ) |
---|
[622] | 4302 | { |
---|
| 4303 | for(Int sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 4304 | { |
---|
[1200] | 4305 | for(Int listId = 0; listId < SCALING_LIST_NUM; listId++) |
---|
[622] | 4306 | { |
---|
[1200] | 4307 | setRefMatrixId (sizeId,listId, srcScLi.getRefMatrixId (sizeId,listId)); |
---|
| 4308 | setScalingListDC(sizeId,listId, srcScLi.getScalingListDC(sizeId,listId)); |
---|
| 4309 | ::memcpy(getScalingListAddress(sizeId, listId),srcScLi.getScalingListAddress(sizeId, listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
[622] | 4310 | } |
---|
| 4311 | } |
---|
| 4312 | } |
---|
| 4313 | #endif |
---|
[608] | 4314 | |
---|
| 4315 | |
---|
[1200] | 4316 | /** get default address of quantization matrix |
---|
[56] | 4317 | * \param sizeId size index |
---|
| 4318 | * \param listId list index |
---|
| 4319 | * \returns pointer of quantization matrix |
---|
| 4320 | */ |
---|
[1200] | 4321 | const Int* TComScalingList::getScalingListDefaultAddress(UInt sizeId, UInt listId) |
---|
[56] | 4322 | { |
---|
[1200] | 4323 | const Int *src = 0; |
---|
[56] | 4324 | switch(sizeId) |
---|
| 4325 | { |
---|
| 4326 | case SCALING_LIST_4x4: |
---|
[608] | 4327 | src = g_quantTSDefault4x4; |
---|
[56] | 4328 | break; |
---|
| 4329 | case SCALING_LIST_8x8: |
---|
| 4330 | case SCALING_LIST_16x16: |
---|
| 4331 | case SCALING_LIST_32x32: |
---|
[1200] | 4332 | src = (listId < (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) ) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
[56] | 4333 | break; |
---|
| 4334 | default: |
---|
| 4335 | assert(0); |
---|
| 4336 | src = NULL; |
---|
| 4337 | break; |
---|
| 4338 | } |
---|
| 4339 | return src; |
---|
| 4340 | } |
---|
[608] | 4341 | |
---|
[56] | 4342 | /** process of default matrix |
---|
| 4343 | * \param sizeId size index |
---|
[1200] | 4344 | * \param listId index of input matrix |
---|
[56] | 4345 | */ |
---|
[872] | 4346 | Void TComScalingList::processDefaultMatrix(UInt sizeId, UInt listId) |
---|
[56] | 4347 | { |
---|
| 4348 | ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
| 4349 | setScalingListDC(sizeId,listId,SCALING_LIST_DC); |
---|
| 4350 | } |
---|
[608] | 4351 | |
---|
[56] | 4352 | /** check DC value of matrix for default matrix signaling |
---|
| 4353 | */ |
---|
| 4354 | Void TComScalingList::checkDcOfMatrix() |
---|
| 4355 | { |
---|
| 4356 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 4357 | { |
---|
[1200] | 4358 | for(UInt listId = 0; listId < SCALING_LIST_NUM; listId++) |
---|
[56] | 4359 | { |
---|
| 4360 | //check default matrix? |
---|
| 4361 | if(getScalingListDC(sizeId,listId) == 0) |
---|
| 4362 | { |
---|
[872] | 4363 | processDefaultMatrix(sizeId, listId); |
---|
[56] | 4364 | } |
---|
| 4365 | } |
---|
| 4366 | } |
---|
| 4367 | } |
---|
| 4368 | |
---|
| 4369 | ParameterSetManager::ParameterSetManager() |
---|
[608] | 4370 | : m_vpsMap(MAX_NUM_VPS) |
---|
| 4371 | , m_spsMap(MAX_NUM_SPS) |
---|
[56] | 4372 | , m_ppsMap(MAX_NUM_PPS) |
---|
[608] | 4373 | , m_activeVPSId(-1) |
---|
[1200] | 4374 | #if !NH_MV |
---|
[608] | 4375 | , m_activeSPSId(-1) |
---|
[1200] | 4376 | #endif |
---|
[56] | 4377 | { |
---|
[1200] | 4378 | #if NH_MV |
---|
[622] | 4379 | for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
[1200] | 4380 | { |
---|
| 4381 | m_activeSPSId[i] = -1; |
---|
[622] | 4382 | } |
---|
| 4383 | #endif |
---|
[56] | 4384 | } |
---|
| 4385 | |
---|
| 4386 | |
---|
| 4387 | ParameterSetManager::~ParameterSetManager() |
---|
| 4388 | { |
---|
| 4389 | } |
---|
| 4390 | |
---|
[608] | 4391 | //! activate a SPS from a active parameter sets SEI message |
---|
| 4392 | //! \returns true, if activation is successful |
---|
[1200] | 4393 | #if NH_MV |
---|
| 4394 | //Bool ParameterSetManager::activateSPSWithSEI(Int spsId, Int layerId ) |
---|
[622] | 4395 | #else |
---|
[1200] | 4396 | //Bool ParameterSetManager::activateSPSWithSEI(Int spsId) |
---|
[622] | 4397 | #endif |
---|
[1200] | 4398 | //{ |
---|
| 4399 | //TComSPS *sps = m_spsMap.getPS(spsId); |
---|
| 4400 | // if (sps) |
---|
| 4401 | // { |
---|
| 4402 | // Int vpsId = sps->getVPSId(); |
---|
| 4403 | // TComVPS *vps = m_vpsMap.getPS(vpsId); |
---|
| 4404 | // if (vps) |
---|
| 4405 | // { |
---|
| 4406 | #if NH_MV |
---|
| 4407 | // m_activeVPS = *(vps); |
---|
| 4408 | // m_activeSPS[ layerId ] = *(sps); |
---|
[622] | 4409 | #else |
---|
[1200] | 4410 | // m_activeVPS = *(vps); |
---|
| 4411 | // m_activeSPS = *(sps); |
---|
[622] | 4412 | #endif |
---|
[1200] | 4413 | // return true; |
---|
| 4414 | // } |
---|
| 4415 | // else |
---|
| 4416 | // { |
---|
| 4417 | // printf("Warning: tried to activate SPS using an Active parameter sets SEI message. Referenced VPS does not exist."); |
---|
| 4418 | // } |
---|
| 4419 | // } |
---|
| 4420 | // else |
---|
| 4421 | // { |
---|
| 4422 | // printf("Warning: tried to activate non-existing SPS using an Active parameter sets SEI message."); |
---|
| 4423 | // } |
---|
| 4424 | // return false; |
---|
| 4425 | //} |
---|
[608] | 4426 | |
---|
| 4427 | //! activate a PPS and depending on isIDR parameter also SPS and VPS |
---|
| 4428 | //! \returns true, if activation is successful |
---|
[1200] | 4429 | #if NH_MV |
---|
[622] | 4430 | Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP, Int layerId ) |
---|
| 4431 | #else |
---|
[608] | 4432 | Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP) |
---|
[622] | 4433 | #endif |
---|
[608] | 4434 | { |
---|
| 4435 | TComPPS *pps = m_ppsMap.getPS(ppsId); |
---|
| 4436 | if (pps) |
---|
| 4437 | { |
---|
| 4438 | Int spsId = pps->getSPSId(); |
---|
[1200] | 4439 | #if NH_MV |
---|
| 4440 | if (!isIRAP && (spsId != m_activeSPSId[ layerId ] )) |
---|
[622] | 4441 | #else |
---|
[1200] | 4442 | if (!isIRAP && (spsId != m_activeSPSId )) |
---|
[622] | 4443 | #endif |
---|
| 4444 | { |
---|
[1200] | 4445 | printf("Warning: tried to activate PPS referring to a inactive SPS at non-IDR."); |
---|
[622] | 4446 | } |
---|
[1200] | 4447 | else |
---|
[622] | 4448 | { |
---|
[1200] | 4449 | TComSPS *sps = m_spsMap.getPS(spsId); |
---|
| 4450 | if (sps) |
---|
[622] | 4451 | { |
---|
[1200] | 4452 | Int vpsId = sps->getVPSId(); |
---|
| 4453 | if (!isIRAP && (vpsId != m_activeVPSId )) |
---|
| 4454 | { |
---|
| 4455 | printf("Warning: tried to activate PPS referring to a inactive VPS at non-IDR."); |
---|
| 4456 | } |
---|
| 4457 | else |
---|
| 4458 | { |
---|
| 4459 | TComVPS *vps =m_vpsMap.getPS(vpsId); |
---|
| 4460 | if (vps) |
---|
| 4461 | { |
---|
| 4462 | m_activeVPSId = vpsId; |
---|
| 4463 | #if NH_MV |
---|
| 4464 | m_activeSPSId[layerId] = spsId; |
---|
[622] | 4465 | #else |
---|
[1200] | 4466 | m_activeSPSId = spsId; |
---|
[622] | 4467 | #endif |
---|
[1200] | 4468 | return true; |
---|
| 4469 | } |
---|
| 4470 | else |
---|
| 4471 | { |
---|
| 4472 | printf("Warning: tried to activate PPS that refers to a non-existing VPS."); |
---|
| 4473 | } |
---|
| 4474 | } |
---|
[608] | 4475 | } |
---|
| 4476 | else |
---|
| 4477 | { |
---|
[1200] | 4478 | printf("Warning: tried to activate a PPS that refers to a non-existing SPS."); |
---|
[608] | 4479 | } |
---|
| 4480 | } |
---|
| 4481 | } |
---|
| 4482 | else |
---|
| 4483 | { |
---|
| 4484 | printf("Warning: tried to activate non-existing PPS."); |
---|
| 4485 | } |
---|
[1200] | 4486 | |
---|
| 4487 | // Failed to activate if reach here. |
---|
| 4488 | #if NH_MV |
---|
| 4489 | m_activeSPSId[layerId]=-1; |
---|
| 4490 | #else |
---|
| 4491 | m_activeSPSId=-1; |
---|
| 4492 | #endif |
---|
| 4493 | m_activeVPSId=-1; |
---|
| 4494 | |
---|
[608] | 4495 | return false; |
---|
| 4496 | } |
---|
| 4497 | |
---|
| 4498 | ProfileTierLevel::ProfileTierLevel() |
---|
| 4499 | : m_profileSpace (0) |
---|
[1200] | 4500 | , m_tierFlag (Level::MAIN) |
---|
| 4501 | , m_profileIdc (Profile::NONE) |
---|
| 4502 | , m_levelIdc (Level::NONE) |
---|
| 4503 | , m_progressiveSourceFlag (false) |
---|
| 4504 | , m_interlacedSourceFlag (false) |
---|
| 4505 | , m_nonPackedConstraintFlag(false) |
---|
| 4506 | , m_frameOnlyConstraintFlag(false) |
---|
| 4507 | #if NH_MV |
---|
| 4508 | , m_intraConstraintFlag ( false ) |
---|
| 4509 | , m_onePictureOnlyConstraintFlag( false ) |
---|
| 4510 | , m_lowerBitRateConstraintFlag ( false ) |
---|
[1066] | 4511 | , m_max12bitConstraintFlag ( false ) |
---|
| 4512 | , m_max10bitConstraintFlag ( false ) |
---|
| 4513 | , m_max8bitConstraintFlag ( false ) |
---|
| 4514 | , m_max422chromaConstraintFlag ( false ) |
---|
| 4515 | , m_max420chromaConstraintFlag ( false ) |
---|
[1200] | 4516 | , m_maxMonochromeConstraintFlag ( false ) |
---|
[1066] | 4517 | , m_inbldFlag ( false ) |
---|
| 4518 | #endif |
---|
[608] | 4519 | { |
---|
| 4520 | ::memset(m_profileCompatibilityFlag, 0, sizeof(m_profileCompatibilityFlag)); |
---|
| 4521 | } |
---|
| 4522 | |
---|
[1200] | 4523 | #if NH_MV |
---|
| 4524 | Bool ProfileTierLevel::getV2ConstraintsPresentFlag() const |
---|
[1066] | 4525 | { |
---|
| 4526 | return ( |
---|
| 4527 | getProfileIdc( ) == 4 || getProfileCompatibilityFlag( 4 ) || getProfileIdc( ) == 5 || getProfileCompatibilityFlag( 5 ) || |
---|
| 4528 | getProfileIdc( ) == 6 || getProfileCompatibilityFlag( 6 ) || getProfileIdc( ) == 7 || getProfileCompatibilityFlag( 7 ) |
---|
| 4529 | ); |
---|
| 4530 | } |
---|
| 4531 | |
---|
[1200] | 4532 | Bool ProfileTierLevel::getInbldPresentFlag() const |
---|
[1066] | 4533 | { |
---|
| 4534 | return ( |
---|
| 4535 | ( getProfileIdc() >= 1 && getProfileIdc() <= 5 ) || getProfileCompatibilityFlag( 1 ) || getProfileCompatibilityFlag( 2 ) || |
---|
| 4536 | getProfileCompatibilityFlag( 3 ) || getProfileCompatibilityFlag( 4 ) || getProfileCompatibilityFlag( 5 ) |
---|
| 4537 | ); |
---|
| 4538 | } |
---|
| 4539 | |
---|
| 4540 | Void ProfileTierLevel::copyV2ConstraintFlags(ProfileTierLevel* ptlRef) |
---|
| 4541 | { |
---|
| 4542 | setMax12bitConstraintFlag ( ptlRef->getMax12bitConstraintFlag ( ) ); |
---|
| 4543 | setMax10bitConstraintFlag ( ptlRef->getMax10bitConstraintFlag ( ) ); |
---|
| 4544 | setMax8bitConstraintFlag ( ptlRef->getMax8bitConstraintFlag ( ) ); |
---|
| 4545 | setMax422chromaConstraintFlag ( ptlRef->getMax422chromaConstraintFlag ( ) ); |
---|
| 4546 | setMax420chromaConstraintFlag ( ptlRef->getMax420chromaConstraintFlag ( ) ); |
---|
| 4547 | setMaxMonochromeConstraintFlag ( ptlRef->getMaxMonochromeConstraintFlag ( ) ); |
---|
| 4548 | setIntraConstraintFlag ( ptlRef->getIntraConstraintFlag ( ) ); |
---|
| 4549 | setOnePictureOnlyConstraintFlag ( ptlRef->getOnePictureOnlyConstraintFlag ( ) ); |
---|
| 4550 | setLowerBitRateConstraintFlag ( ptlRef->getLowerBitRateConstraintFlag ( ) ); |
---|
| 4551 | } |
---|
| 4552 | |
---|
| 4553 | Void ProfileTierLevel::copyProfile(ProfileTierLevel* ptlRef) |
---|
| 4554 | { |
---|
| 4555 | setProfileSpace ( ptlRef->getProfileSpace ( ) ); |
---|
| 4556 | setTierFlag ( ptlRef->getTierFlag ( ) ); |
---|
| 4557 | setProfileIdc ( ptlRef->getProfileIdc ( ) ); |
---|
| 4558 | for (Int j = 0; j < 32; j++) |
---|
| 4559 | { |
---|
| 4560 | setProfileCompatibilityFlag(j, ptlRef->getProfileCompatibilityFlag ( j ) ); |
---|
| 4561 | } |
---|
| 4562 | setProgressiveSourceFlag ( ptlRef->getProgressiveSourceFlag ( ) ); |
---|
| 4563 | setInterlacedSourceFlag ( ptlRef->getInterlacedSourceFlag ( ) ); |
---|
| 4564 | setNonPackedConstraintFlag ( ptlRef->getNonPackedConstraintFlag ( ) ); |
---|
| 4565 | setFrameOnlyConstraintFlag ( ptlRef->getFrameOnlyConstraintFlag ( ) ); |
---|
| 4566 | copyV2ConstraintFlags ( ptlRef ); |
---|
| 4567 | } |
---|
| 4568 | #endif |
---|
| 4569 | |
---|
[608] | 4570 | TComPTL::TComPTL() |
---|
| 4571 | { |
---|
| 4572 | ::memset(m_subLayerProfilePresentFlag, 0, sizeof(m_subLayerProfilePresentFlag)); |
---|
| 4573 | ::memset(m_subLayerLevelPresentFlag, 0, sizeof(m_subLayerLevelPresentFlag )); |
---|
| 4574 | } |
---|
| 4575 | |
---|
[1200] | 4576 | Void calculateParameterSetChangedFlag(Bool &bChanged, const std::vector<UChar> *pOldData, const std::vector<UChar> &newData) |
---|
| 4577 | { |
---|
| 4578 | if (!bChanged) |
---|
| 4579 | { |
---|
| 4580 | if ((pOldData==0 && pOldData!=0) || (pOldData!=0 && pOldData==0)) |
---|
| 4581 | { |
---|
| 4582 | bChanged=true; |
---|
| 4583 | } |
---|
| 4584 | else if (pOldData!=0 && pOldData!=0) |
---|
| 4585 | { |
---|
| 4586 | // compare the two |
---|
| 4587 | if (pOldData->size() != pOldData->size()) |
---|
| 4588 | { |
---|
| 4589 | bChanged=true; |
---|
| 4590 | } |
---|
| 4591 | else |
---|
| 4592 | { |
---|
| 4593 | const UChar *pNewDataArray=&(newData)[0]; |
---|
| 4594 | const UChar *pOldDataArray=&(*pOldData)[0]; |
---|
| 4595 | if (memcmp(pOldDataArray, pNewDataArray, pOldData->size())) |
---|
| 4596 | { |
---|
| 4597 | bChanged=true; |
---|
| 4598 | } |
---|
| 4599 | } |
---|
| 4600 | } |
---|
| 4601 | } |
---|
| 4602 | } |
---|
| 4603 | #if NH_MV |
---|
[1066] | 4604 | Void TComPTL::inferGeneralValues(Bool profilePresentFlag, Int k, TComPTL* refPTL) |
---|
| 4605 | { |
---|
| 4606 | ProfileTierLevel* refProfileTierLevel = NULL; |
---|
| 4607 | if ( k > 0 ) |
---|
| 4608 | { |
---|
| 4609 | assert( refPTL != NULL); |
---|
| 4610 | refProfileTierLevel = refPTL->getGeneralPTL(); |
---|
| 4611 | } |
---|
| 4612 | |
---|
| 4613 | ProfileTierLevel* curProfileTierLevel = getGeneralPTL( ); |
---|
| 4614 | |
---|
| 4615 | if( !profilePresentFlag ) |
---|
| 4616 | { |
---|
| 4617 | assert( k > 0 ); |
---|
| 4618 | assert( refProfileTierLevel != NULL ); |
---|
| 4619 | curProfileTierLevel->copyProfile( refProfileTierLevel); |
---|
| 4620 | } |
---|
| 4621 | else |
---|
| 4622 | { |
---|
| 4623 | if ( !curProfileTierLevel->getV2ConstraintsPresentFlag() ) |
---|
| 4624 | { |
---|
| 4625 | curProfileTierLevel->setMax12bitConstraintFlag ( false ); |
---|
| 4626 | curProfileTierLevel->setMax10bitConstraintFlag ( false ); |
---|
| 4627 | curProfileTierLevel->setMax8bitConstraintFlag ( false ); |
---|
| 4628 | curProfileTierLevel->setMax422chromaConstraintFlag ( false ); |
---|
| 4629 | curProfileTierLevel->setMax420chromaConstraintFlag ( false ); |
---|
| 4630 | curProfileTierLevel->setMaxMonochromeConstraintFlag ( false ); |
---|
| 4631 | curProfileTierLevel->setIntraConstraintFlag ( false ); |
---|
| 4632 | curProfileTierLevel->setOnePictureOnlyConstraintFlag ( false ); |
---|
| 4633 | curProfileTierLevel->setLowerBitRateConstraintFlag ( false ); |
---|
| 4634 | } |
---|
| 4635 | |
---|
| 4636 | if ( !curProfileTierLevel->getInbldPresentFlag() ) |
---|
| 4637 | { |
---|
| 4638 | curProfileTierLevel->setInbldFlag( false ); |
---|
| 4639 | } |
---|
| 4640 | } |
---|
| 4641 | } |
---|
| 4642 | |
---|
| 4643 | Void TComPTL::inferSubLayerValues(Int maxNumSubLayersMinus1, Int k, TComPTL* refPTL) |
---|
| 4644 | { |
---|
| 4645 | assert( k == 0 || refPTL != NULL ); |
---|
| 4646 | |
---|
| 4647 | for (Int i = maxNumSubLayersMinus1; i >= 0; i--) |
---|
| 4648 | { |
---|
| 4649 | ProfileTierLevel* refProfileTierLevel; |
---|
| 4650 | if ( k != 0 ) |
---|
| 4651 | { |
---|
| 4652 | refProfileTierLevel = refPTL->getSubLayerPTL( i ); |
---|
| 4653 | } |
---|
| 4654 | else |
---|
| 4655 | { |
---|
| 4656 | if ( i == maxNumSubLayersMinus1) |
---|
| 4657 | { |
---|
| 4658 | refProfileTierLevel = getGeneralPTL(); |
---|
| 4659 | } |
---|
| 4660 | else |
---|
| 4661 | { |
---|
| 4662 | refProfileTierLevel = getSubLayerPTL( i + 1 ); |
---|
| 4663 | } |
---|
| 4664 | } |
---|
| 4665 | |
---|
| 4666 | ProfileTierLevel* curProfileTierLevel = getSubLayerPTL( i ); |
---|
| 4667 | if( !getSubLayerLevelPresentFlag( i ) ) |
---|
| 4668 | { |
---|
| 4669 | curProfileTierLevel->setLevelIdc( refProfileTierLevel->getLevelIdc() ); |
---|
| 4670 | } |
---|
| 4671 | |
---|
| 4672 | if( !getSubLayerProfilePresentFlag( i ) ) |
---|
| 4673 | { |
---|
| 4674 | curProfileTierLevel->copyProfile( refProfileTierLevel); |
---|
| 4675 | } |
---|
| 4676 | else |
---|
| 4677 | { |
---|
| 4678 | if ( !curProfileTierLevel->getV2ConstraintsPresentFlag() ) |
---|
| 4679 | { |
---|
| 4680 | curProfileTierLevel->copyV2ConstraintFlags( refProfileTierLevel ); |
---|
| 4681 | } |
---|
| 4682 | |
---|
| 4683 | if ( !curProfileTierLevel->getInbldPresentFlag() ) |
---|
| 4684 | { |
---|
| 4685 | curProfileTierLevel->setInbldFlag( refProfileTierLevel->getInbldFlag() ); |
---|
| 4686 | } |
---|
| 4687 | } |
---|
| 4688 | } |
---|
| 4689 | } |
---|
| 4690 | |
---|
[608] | 4691 | #endif |
---|
[1200] | 4692 | |
---|
[622] | 4693 | //! \} |
---|
| 4694 | |
---|
[1200] | 4695 | #if NH_MV |
---|
| 4696 | Void TComVPSVUI::init( Int numLayerSets, Int maxNumSubLayers, Int maxNumLayers ) |
---|
[608] | 4697 | { |
---|
[738] | 4698 | m_crossLayerIrapAlignedFlag = true; |
---|
[872] | 4699 | m_allLayersIdrAlignedFlag = false; |
---|
[1200] | 4700 | m_bitRatePresentVpsFlag = false; |
---|
| 4701 | m_picRatePresentVpsFlag = false; |
---|
| 4702 | |
---|
| 4703 | m_bitRatePresentFlag .resize(numLayerSets); |
---|
| 4704 | m_picRatePresentFlag .resize(numLayerSets); |
---|
| 4705 | m_avgBitRate .resize(numLayerSets); |
---|
| 4706 | m_maxBitRate .resize(numLayerSets); |
---|
| 4707 | m_constantPicRateIdc .resize(numLayerSets); |
---|
| 4708 | m_avgPicRate .resize(numLayerSets); |
---|
| 4709 | |
---|
| 4710 | for ( Int i = 0; i < numLayerSets; i++) |
---|
| 4711 | { |
---|
| 4712 | m_bitRatePresentFlag [i].resize( maxNumSubLayers); |
---|
| 4713 | m_picRatePresentFlag [i].resize( maxNumSubLayers); |
---|
| 4714 | m_avgBitRate [i].resize( maxNumSubLayers); |
---|
| 4715 | m_maxBitRate [i].resize( maxNumSubLayers); |
---|
| 4716 | m_constantPicRateIdc [i].resize( maxNumSubLayers); |
---|
| 4717 | m_avgPicRate [i].resize( maxNumSubLayers); |
---|
| 4718 | for ( Int j = 0; j < maxNumSubLayers; j++) |
---|
[622] | 4719 | { |
---|
| 4720 | m_bitRatePresentFlag [i][j] = false; |
---|
| 4721 | m_picRatePresentFlag [i][j] = false; |
---|
| 4722 | m_avgBitRate [i][j] = -1; |
---|
| 4723 | m_maxBitRate [i][j] = -1; |
---|
| 4724 | m_constantPicRateIdc [i][j] = -1; |
---|
| 4725 | m_avgPicRate [i][j] = -1; |
---|
| 4726 | } |
---|
| 4727 | } |
---|
| 4728 | |
---|
| 4729 | m_ilpRestrictedRefLayersFlag = false; |
---|
| 4730 | |
---|
[1200] | 4731 | m_tileBoundariesAlignedFlag .resize( maxNumLayers ); |
---|
| 4732 | m_minSpatialSegmentOffsetPlus1 .resize( maxNumLayers ); |
---|
| 4733 | m_ctuBasedOffsetEnabledFlag .resize( maxNumLayers ); |
---|
| 4734 | m_minHorizontalCtuOffsetPlus1 .resize( maxNumLayers ); |
---|
| 4735 | m_baseLayerParameterSetCompatibilityFlag.resize( maxNumLayers ); |
---|
| 4736 | |
---|
| 4737 | for ( Int i = 0; i < maxNumLayers; i++) |
---|
[622] | 4738 | { |
---|
[1200] | 4739 | m_tileBoundariesAlignedFlag [i].resize( maxNumLayers ); |
---|
| 4740 | m_minSpatialSegmentOffsetPlus1[i].resize( maxNumLayers ); |
---|
| 4741 | m_ctuBasedOffsetEnabledFlag [i].resize( maxNumLayers ); |
---|
| 4742 | m_minHorizontalCtuOffsetPlus1 [i].resize( maxNumLayers ); |
---|
| 4743 | for ( Int j = 0; j < maxNumLayers; j++) |
---|
[622] | 4744 | { |
---|
| 4745 | m_tileBoundariesAlignedFlag [i][j] = false; |
---|
| 4746 | m_minSpatialSegmentOffsetPlus1[i][j] = 0; |
---|
| 4747 | m_ctuBasedOffsetEnabledFlag [i][j] = false; |
---|
| 4748 | m_minHorizontalCtuOffsetPlus1 [i][j] = -1; |
---|
| 4749 | } |
---|
[872] | 4750 | m_baseLayerParameterSetCompatibilityFlag[i] = false; |
---|
[622] | 4751 | } |
---|
[738] | 4752 | m_vpsVuiBspHrdPresentFlag = false; |
---|
[608] | 4753 | } |
---|
[738] | 4754 | |
---|
[1200] | 4755 | Void TComRepFormat::inferChromaAndBitDepth( const TComRepFormat* prevRepFormat ) |
---|
[738] | 4756 | { |
---|
| 4757 | setChromaAndBitDepthVpsPresentFlag( prevRepFormat->getChromaAndBitDepthVpsPresentFlag() ); |
---|
| 4758 | setSeparateColourPlaneVpsFlag ( prevRepFormat->getSeparateColourPlaneVpsFlag () ); |
---|
| 4759 | setBitDepthVpsLumaMinus8 ( prevRepFormat->getBitDepthVpsLumaMinus8 () ); |
---|
| 4760 | setBitDepthVpsChromaMinus8 ( prevRepFormat->getBitDepthVpsChromaMinus8 () ); |
---|
[1200] | 4761 | } |
---|
| 4762 | |
---|
| 4763 | Void TComRepFormat::checkInferChromaAndBitDepth( const TComRepFormat* prevRepFormat ) const |
---|
| 4764 | { |
---|
[738] | 4765 | assert( getChromaAndBitDepthVpsPresentFlag() == prevRepFormat->getChromaAndBitDepthVpsPresentFlag() ); |
---|
| 4766 | assert( getSeparateColourPlaneVpsFlag () == prevRepFormat->getSeparateColourPlaneVpsFlag () ); |
---|
| 4767 | assert( getBitDepthVpsLumaMinus8 () == prevRepFormat->getBitDepthVpsLumaMinus8 () ); |
---|
| 4768 | assert( getBitDepthVpsChromaMinus8 () == prevRepFormat->getBitDepthVpsChromaMinus8 () ); |
---|
| 4769 | } |
---|
| 4770 | |
---|
[1200] | 4771 | Int TComVpsVuiBspHrdParameters::getBspHrdIdxLen( const TComVPS* vps) const |
---|
[1066] | 4772 | { |
---|
| 4773 | return gCeilLog2( vps->getNumHrdParameters() + getVpsNumAddHrdParams() ); |
---|
| 4774 | } |
---|
| 4775 | |
---|
[1200] | 4776 | Void TComVpsVuiBspHrdParameters::createAfterVpsNumAddHrdParams( const TComVPS* vps ) |
---|
[1066] | 4777 | { |
---|
| 4778 | m_offsetHrdParamIdx = vps->getNumHrdParameters(); |
---|
| 4779 | m_numHrdParam = vps->getNumHrdParameters() + getVpsNumAddHrdParams() - m_offsetHrdParamIdx; |
---|
| 4780 | m_numOls = vps->getNumOutputLayerSets(); |
---|
| 4781 | |
---|
[1200] | 4782 | m_cprmsAddPresentFlag .resize( m_numHrdParam ); |
---|
| 4783 | m_numSubLayerHrdMinus1.resize( m_numHrdParam ); |
---|
| 4784 | m_hrdParameters .resize( m_numHrdParam ); |
---|
[1066] | 4785 | |
---|
[1200] | 4786 | m_numSignalledPartitioningSchemes .resize( m_numOls ); |
---|
| 4787 | m_numPartitionsInSchemeMinus1 .resize( m_numOls ); |
---|
| 4788 | m_numBspSchedulesMinus1 .resize( m_numOls ); |
---|
| 4789 | m_bspHrdIdx .resize( m_numOls ); |
---|
| 4790 | m_bspSchedIdx .resize( m_numOls ); |
---|
[1066] | 4791 | } |
---|
| 4792 | |
---|
[1200] | 4793 | Void TComVpsVuiBspHrdParameters::createAfterNumSignalledPartitioningSchemes( const TComVPS* vps, Int h ) |
---|
[1066] | 4794 | { |
---|
[1200] | 4795 | m_numPartitionsInSchemeMinus1 [h].resize( getNumSignalledPartitioningSchemes(h) ); |
---|
| 4796 | m_layerIncludedInPartitionFlag[h].resize( getNumSignalledPartitioningSchemes(h) ); |
---|
[1066] | 4797 | |
---|
[1200] | 4798 | m_numBspSchedulesMinus1 [h].resize( getNumSignalledPartitioningSchemes(h) + 1 ); |
---|
[1066] | 4799 | for (Int i = 0; i < getNumSignalledPartitioningSchemes(h) + 1; i++) |
---|
| 4800 | { |
---|
[1200] | 4801 | Int tMax = vps->getMaxSubLayersInLayerSetMinus1( m_vps->olsIdxToLsIdx(h) ) + 1; |
---|
| 4802 | m_numBspSchedulesMinus1[h][i].resize( tMax ); |
---|
| 4803 | m_bspHrdIdx [h][i].resize( tMax ); |
---|
| 4804 | m_bspSchedIdx [h][i].resize( tMax ); |
---|
[1066] | 4805 | } |
---|
| 4806 | } |
---|
| 4807 | |
---|
[1200] | 4808 | Void TComVpsVuiBspHrdParameters::createAfterNumPartitionsInSchemeMinus1( const TComVPS* vps, Int h, Int j ) |
---|
[1066] | 4809 | { |
---|
[1200] | 4810 | m_layerIncludedInPartitionFlag[h][j].resize( getNumPartitionsInSchemeMinus1(h,j)); |
---|
[1066] | 4811 | for( Int k = 0; k < getNumPartitionsInSchemeMinus1(h,j); k++ ) |
---|
| 4812 | { |
---|
[1200] | 4813 | m_layerIncludedInPartitionFlag[h][j][k].resize( m_vps->getNumLayersInIdList( vps->olsIdxToLsIdx(h))); |
---|
[1066] | 4814 | } |
---|
| 4815 | } |
---|
| 4816 | |
---|
[1200] | 4817 | Void TComVpsVuiBspHrdParameters::createAfterNumBspSchedulesMinus1( const TComVPS* vps, Int h, Int i, Int t ) |
---|
[1066] | 4818 | { |
---|
[1200] | 4819 | m_bspSchedIdx[h][i][t].resize( getNumBspSchedulesMinus1( h, i, t ) + 1 ); |
---|
| 4820 | m_bspHrdIdx [h][i][t].resize( getNumBspSchedulesMinus1( h, i, t ) + 1 ); |
---|
[1066] | 4821 | for( Int j = 0; j < getNumBspSchedulesMinus1( h, i, t ) + 1; j++ ) |
---|
| 4822 | { |
---|
[1200] | 4823 | m_bspSchedIdx[h][i][t][j].resize( getNumPartitionsInSchemeMinus1( h, i ) ); |
---|
| 4824 | m_bspHrdIdx [h][i][t][j].resize( getNumPartitionsInSchemeMinus1( h, i ) ); |
---|
[1066] | 4825 | } |
---|
| 4826 | } |
---|
| 4827 | |
---|
| 4828 | |
---|
[1200] | 4829 | Void TComVUI::inferVideoSignalInfo( const TComVPS* vps, Int layerIdCurr ) |
---|
[773] | 4830 | { |
---|
| 4831 | if ( layerIdCurr == 0 || !vps->getVpsVuiPresentFlag() ) |
---|
| 4832 | { |
---|
| 4833 | return; |
---|
| 4834 | } |
---|
| 4835 | |
---|
[1200] | 4836 | const TComVPSVUI* vpsVui = vps->getVPSVUI(); |
---|
| 4837 | assert( vpsVui != NULL ); |
---|
[773] | 4838 | |
---|
[1200] | 4839 | const TComVideoSignalInfo* videoSignalInfo = vpsVui->getVideoSignalInfo( vpsVui->getVpsVideoSignalInfoIdx( vps->getLayerIdInVps( layerIdCurr ) ) ); |
---|
[773] | 4840 | assert( videoSignalInfo != NULL ); |
---|
| 4841 | |
---|
| 4842 | setVideoFormat ( videoSignalInfo->getVideoVpsFormat () ); |
---|
| 4843 | setVideoFullRangeFlag ( videoSignalInfo->getVideoFullRangeVpsFlag () ); |
---|
| 4844 | setColourPrimaries ( videoSignalInfo->getColourPrimariesVps () ); |
---|
| 4845 | setTransferCharacteristics( videoSignalInfo->getTransferCharacteristicsVps() ); |
---|
| 4846 | setMatrixCoefficients ( videoSignalInfo->getMatrixCoeffsVps () ); |
---|
| 4847 | } |
---|
[884] | 4848 | |
---|
[1200] | 4849 | Void TComDpbSize::init( Int numOutputLayerSets, Int maxNumLayerIds, Int maxNumSubLayers ) |
---|
[884] | 4850 | { |
---|
[1200] | 4851 | m_subLayerFlagInfoPresentFlag.resize( numOutputLayerSets ); |
---|
| 4852 | m_subLayerDpbInfoPresentFlag .resize( numOutputLayerSets ); |
---|
| 4853 | m_maxVpsDecPicBufferingMinus1.resize( numOutputLayerSets ); |
---|
| 4854 | m_maxVpsNumReorderPics .resize( numOutputLayerSets ); |
---|
| 4855 | m_maxVpsLatencyIncreasePlus1 .resize( numOutputLayerSets ); |
---|
| 4856 | |
---|
| 4857 | for (Int i = 0; i < numOutputLayerSets; i++ ) |
---|
[884] | 4858 | { |
---|
| 4859 | m_subLayerFlagInfoPresentFlag[i] = false; |
---|
| 4860 | |
---|
[1200] | 4861 | m_subLayerDpbInfoPresentFlag [i].resize( maxNumSubLayers ); |
---|
| 4862 | m_maxVpsDecPicBufferingMinus1[i].resize( maxNumLayerIds ); |
---|
| 4863 | m_maxVpsNumReorderPics [i].resize( maxNumSubLayers ); |
---|
| 4864 | m_maxVpsLatencyIncreasePlus1 [i].resize( maxNumSubLayers ); |
---|
| 4865 | |
---|
| 4866 | for (Int j = 0; j < maxNumSubLayers; j++ ) |
---|
[884] | 4867 | { |
---|
| 4868 | m_subLayerDpbInfoPresentFlag [i][j] = ( j == 0) ; |
---|
| 4869 | m_maxVpsNumReorderPics [i][j] = 0; |
---|
| 4870 | m_maxVpsLatencyIncreasePlus1 [i][j] = 0; |
---|
[1200] | 4871 | } |
---|
[884] | 4872 | |
---|
[1200] | 4873 | for (Int k = 0; k < maxNumLayerIds; k++ ) |
---|
| 4874 | { |
---|
| 4875 | m_maxVpsDecPicBufferingMinus1[i][k].resize( maxNumSubLayers ); |
---|
| 4876 | for (Int j = 0; j < maxNumSubLayers; j++ ) |
---|
| 4877 | { |
---|
[1066] | 4878 | m_maxVpsDecPicBufferingMinus1[i][k][j] = MIN_INT; |
---|
[884] | 4879 | } |
---|
| 4880 | } |
---|
| 4881 | } |
---|
| 4882 | } |
---|
[976] | 4883 | |
---|
| 4884 | Void Window::scaleOffsets( Int scal ) |
---|
| 4885 | { |
---|
| 4886 | if (! m_scaledFlag ) |
---|
| 4887 | { |
---|
| 4888 | m_scaledFlag = true; |
---|
| 4889 | m_winLeftOffset *= scal; |
---|
| 4890 | m_winRightOffset *= scal; |
---|
| 4891 | m_winTopOffset *= scal; |
---|
| 4892 | m_winBottomOffset *= scal; |
---|
| 4893 | } |
---|
| 4894 | } |
---|
[738] | 4895 | #endif |
---|