Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComSlice.cpp
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComSlice.cpp
r1196 r1313 1 /* 1 /* The copyright in this software is being made available under the BSD 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 42 42 #include "TLibDecoder/TDecSbac.h" 43 43 44 44 45 //! \ingroup TLibCommon 45 46 //! \{ 46 47 47 48 48 TComSlice::TComSlice() 49 49 : m_iPPSId ( -1 ) 50 #if H_MV 50 , m_PicOutputFlag ( true ) 51 #if NH_MV 51 52 , m_slicePicOrderCntLsb ( 0 ) 52 53 #endif 53 54 , m_iPOC ( 0 ) 54 55 , m_iLastIDR ( 0 ) 56 , m_iAssociatedIRAP ( 0 ) 57 , m_iAssociatedIRAPType ( NAL_UNIT_INVALID ) 58 , m_pRPS ( 0 ) 59 , m_localRPS ( ) 60 , m_rpsIdx ( 0 ) 61 , m_RefPicListModification ( ) 55 62 , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR_W_RADL ) 56 63 , m_eSliceType ( I_SLICE ) 57 64 , m_iSliceQp ( 0 ) 58 , m_dependentSliceSegmentFlag 65 , m_dependentSliceSegmentFlag ( false ) 59 66 #if ADAPTIVE_QP_SELECTION 60 67 , m_iSliceQpBase ( 0 ) 61 68 #endif 62 , m_deblockingFilterDisable ( false ) 63 , m_deblockingFilterOverrideFlag ( false ) 64 , m_deblockingFilterBetaOffsetDiv2 ( 0 ) 65 , m_deblockingFilterTcOffsetDiv2 ( 0 ) 69 , m_ChromaQpAdjEnabled ( false ) 70 , m_deblockingFilterDisable ( false ) 71 , m_deblockingFilterOverrideFlag ( false ) 72 , m_deblockingFilterBetaOffsetDiv2( 0 ) 73 , m_deblockingFilterTcOffsetDiv2 ( 0 ) 66 74 , m_bCheckLDC ( false ) 67 75 , m_iSliceQpDelta ( 0 ) 68 , m_iSliceQpDeltaCb ( 0 )69 , m_iSliceQpDeltaCr ( 0 )70 76 , m_iDepth ( 0 ) 71 77 , m_bRefenced ( false ) 78 , m_pcVPS ( NULL ) 72 79 , m_pcSPS ( NULL ) 73 80 , m_pcPPS ( NULL ) 74 81 , m_pcPic ( NULL ) 75 , m_colFromL0Flag ( 1 ) 76 #if SETTING_NO_OUT_PIC_PRIOR 82 , m_colFromL0Flag ( true ) 77 83 , m_noOutputPriorPicsFlag ( false ) 78 84 , m_noRaslOutputFlag ( false ) 79 , m_handleCraAsBlaFlag ( false ) 80 #endif 85 , m_handleCraAsBlaFlag ( false ) 81 86 , m_colRefIdx ( 0 ) 87 , m_maxNumMergeCand ( 0 ) 82 88 , m_uiTLayer ( 0 ) 83 89 , m_bTLayerSwitchingFlag ( false ) 84 , m_sliceMode ( 0)85 , m_sliceArgument ( 0 )86 , m_sliceCurStartC UAddr( 0 )87 , m_sliceCurEndC UAddr( 0 )88 , m_sliceIdx ( 0 )89 , m_sliceSegmentMode ( 0)90 , m_sliceSegmentArgument ( 0 )91 , m_sliceSegmentCurStartC UAddr( 0 )92 , m_sliceSegmentCurEndC UAddr( 0 )93 , m_nextSlice ( false )94 , m_nextSliceSegment ( false )95 , m_sliceBits ( 0 )96 , m_sliceSegmentBits ( 0 )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 ) 97 103 , m_bFinalized ( false ) 98 , m_uiTileOffstForMultES ( 0 ) 99 , m_puiSubstreamSizes ( NULL ) 104 , m_bTestWeightPred ( false ) 105 , m_bTestWeightBiPred ( false ) 106 , m_substreamSizes ( ) 100 107 , m_cabacInitFlag ( false ) 101 108 , m_bLMvdL1Zero ( false ) 102 , m_numEntryPointOffsets ( 0 )103 109 , m_temporalLayerNonReferenceFlag ( false ) 110 , m_LFCrossSliceBoundaryFlag ( false ) 104 111 , m_enableTMVPFlag ( true ) 105 #if H_MV 112 , m_encCABACTableIdx (I_SLICE) 113 #if NH_MV 106 114 , m_availableForTMVPRefFlag ( true ) 107 , m_refPicSetInterLayer0 108 , m_refPicSetInterLayer1 115 , m_refPicSetInterLayer0 ( NULL ) 116 , m_refPicSetInterLayer1 ( NULL ) 109 117 , m_layerId (0) 110 118 , m_viewId (0) 111 119 , m_viewIndex (0) 112 #if H_3D120 #if NH_3D 113 121 , m_isDepth (false) 114 122 #endif … … 116 124 , m_pocResetFlag (false) 117 125 #endif 118 #if H_MV126 #if NH_MV 119 127 , m_crossLayerBlaFlag (false) 120 128 #endif … … 122 130 , m_interLayerPredEnabledFlag (false) 123 131 , m_numInterLayerRefPicsMinus1 (0) 124 #if H_MV132 #if NH_MV 125 133 , m_sliceSegmentHeaderExtensionLength (0) 126 , m_pocResetIdc (0) 127 , m_pocResetPeriodId (0) 128 , m_fullPocResetFlag (false) 129 , m_pocLsbVal (0) 130 , m_pocMsbValPresentFlag (false) 131 , m_pocMsbVal (0) 132 , m_pocMsbValRequiredFlag ( false ) 133 #endif 134 #if H_3D_IC 135 , m_bApplyIC ( false ) 136 , m_icSkipParseFlag ( false ) 137 #endif 138 #if H_3D 139 , m_inCmpPredFlag ( false ) 140 , m_numViews ( 0 ) 141 , m_depthToDisparityB ( NULL ) 142 , m_depthToDisparityF ( NULL ) 143 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) 141 #endif 142 #if NH_3D_IC 143 , m_bApplyIC (false) 144 , m_icSkipParseFlag (false) 145 #endif 146 #if NH_3D 147 , m_inCmpPredFlag (false) 148 , m_numViews (0) 149 , m_depthToDisparityB (NULL) 150 , m_depthToDisparityF (NULL) 151 #endif 152 #if NH_3D_DIS 144 153 , m_bApplyDIS (false) 145 154 #endif 146 155 #endif 147 156 { 148 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0; 149 157 for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++) 158 { 159 m_aiNumRefIdx[i] = 0; 160 } 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 150 168 initEqualRef(); 151 152 for (Int component = 0; component < 3; component++) 153 { 154 m_lambdas[component] = 0.0; 155 } 156 169 157 170 for ( Int idx = 0; idx < MAX_NUM_REF; idx++ ) 158 171 { 159 172 m_list1IdxToList0Idx[idx] = -1; 160 173 } 174 161 175 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++) 162 176 { 163 m_apcRefPicList [0][iNumCount] = NULL; 164 m_apcRefPicList [1][iNumCount] = NULL; 165 m_aiRefPOCList [0][iNumCount] = 0; 166 m_aiRefPOCList [1][iNumCount] = 0; 167 #if H_MV 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 168 183 m_aiRefLayerIdList[0][iNumCount] = 0; 169 184 m_aiRefLayerIdList[1][iNumCount] = 0; 170 185 #endif 171 186 } 187 172 188 resetWpScaling(); 173 189 initWpAcDcParam(); 174 m_saoEnabledFlag = false; 175 m_saoEnabledFlagChroma = false; 176 #if H_MV 190 191 for(Int ch=0; ch < MAX_NUM_CHANNEL_TYPE; ch++) 192 { 193 m_saoEnabledFlag[ch] = false; 194 } 195 #if NH_MV 177 196 for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) 178 197 { … … 180 199 } 181 200 #endif 201 #if NH_3D 182 202 m_iDefaultRefViewIdx = -1; 183 203 m_bDefaultRefViewIdxAvailableFlag = false; 184 #if H_3D185 204 m_ivMvPredFlag = false; 186 205 m_ivMvScalingFlag = false; … … 197 216 m_subPbSize = 1 << 6; 198 217 m_mpiSubPbSize = 1 << 6; 199 #endif 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 227 #endif 228 200 229 } 201 230 202 231 TComSlice::~TComSlice() 203 232 { 204 delete[] m_puiSubstreamSizes; 205 m_puiSubstreamSizes = NULL; 206 #if H_3D 233 #if NH_3D 207 234 for( UInt i = 0; i < m_numViews; i++ ) 208 235 { … … 230 257 m_depthToDisparityB = NULL; 231 258 #endif 259 232 260 } 233 261 … … 235 263 Void TComSlice::initSlice() 236 264 { 237 m_aiNumRefIdx[0] = 0; 238 m_aiNumRefIdx[1] = 0; 239 240 m_colFromL0Flag = 1; 241 265 for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++) 266 { 267 m_aiNumRefIdx[i] = 0; 268 } 269 m_colFromL0Flag = true; 270 242 271 m_colRefIdx = 0; 243 272 initEqualRef(); 273 244 274 m_bCheckLDC = false; 245 m_iSliceQpDeltaCb = 0; 246 m_iSliceQpDeltaCr = 0; 247 248 #if H_3D_IV_MERGE 275 276 for (UInt component = 0; component < MAX_NUM_COMPONENT; component++) 277 { 278 m_iSliceChromaQpDelta[component] = 0; 279 } 280 #if NH_3D_IV_MERGE 249 281 m_maxNumMergeCand = MRG_MAX_NUM_CANDS_MEM; 250 282 #else … … 254 286 m_bFinalized=false; 255 287 256 m_ tileByteLocation.clear();288 m_substreamSizes.clear(); 257 289 m_cabacInitFlag = false; 258 m_numEntryPointOffsets = 0;259 290 m_enableTMVPFlag = true; 260 #if H_3D_TMVP291 #if NH_3D_TMVP 261 292 m_aiAlterRefIdx[0] = -1; 262 293 m_aiAlterRefIdx[1] = -1; … … 264 295 } 265 296 266 Bool TComSlice::getRapPicFlag() 297 Bool TComSlice::getRapPicFlag() const 267 298 { 268 299 return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL … … 274 305 } 275 306 276 /**277 - allocate table to contain substream sizes to be written to the slice header.278 .279 \param uiNumSubstreams Number of substreams -- the allocation will be this value - 1.280 */281 Void TComSlice::allocSubstreamSizes(UInt uiNumSubstreams)282 {283 delete[] m_puiSubstreamSizes;284 m_puiSubstreamSizes = new UInt[uiNumSubstreams > 0 ? uiNumSubstreams-1 : 0];285 }286 307 287 308 Void TComSlice::sortPicList (TComList<TComPic*>& rcListPic) … … 289 310 TComPic* pcPicExtract; 290 311 TComPic* pcPicInsert; 291 312 292 313 TComList<TComPic*>::iterator iterPicExtract; 293 314 TComList<TComPic*>::iterator iterPicExtract_1; 294 315 TComList<TComPic*>::iterator iterPicInsert; 295 316 296 317 for (Int i = 1; i < (Int)(rcListPic.size()); i++) 297 318 { 298 319 iterPicExtract = rcListPic.begin(); 299 for (Int j = 0; j < i; j++) iterPicExtract++; 320 for (Int j = 0; j < i; j++) 321 { 322 iterPicExtract++; 323 } 300 324 pcPicExtract = *(iterPicExtract); 301 325 pcPicExtract->setCurrSliceIdx(0); 302 326 303 327 iterPicInsert = rcListPic.begin(); 304 328 while (iterPicInsert != iterPicExtract) … … 310 334 break; 311 335 } 312 336 313 337 iterPicInsert++; 314 338 } 315 339 316 340 iterPicExtract_1 = iterPicExtract; iterPicExtract_1++; 317 341 318 342 // swap iterPicExtract and iterPicInsert, iterPicExtract = curr. / iterPicInsert = insertion position 319 343 rcListPic.insert (iterPicInsert, iterPicExtract, iterPicExtract_1); … … 322 346 } 323 347 324 TComPic* TComSlice::xGetRefPic (TComList<TComPic*>& rcListPic, 325 Int poc) 326 { 327 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 348 TComPic* TComSlice::xGetRefPic (TComList<TComPic*>& rcListPic, Int poc) 349 { 350 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 328 351 TComPic* pcPic = *(iterPic); 329 352 while ( iterPic != rcListPic.end() ) … … 342 365 TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb) 343 366 { 344 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 367 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 345 368 TComPic* pcPic = *(iterPic); 346 369 TComPic* pcStPic = pcPic; 347 370 348 371 Int pocCycle = 1 << getSPS()->getBitsForPOC(); 349 372 if (!pocHasMsb) … … 351 374 poc = poc & (pocCycle - 1); 352 375 } 353 376 354 377 while ( iterPic != rcListPic.end() ) 355 378 { … … 362 385 picPoc = picPoc & (pocCycle - 1); 363 386 } 364 387 365 388 if (poc == picPoc) 366 {367 if(pcPic->getIsLongTerm())368 {369 return pcPic;370 }371 else372 {373 pcStPic = pcPic;374 }375 break;376 }389 { 390 if(pcPic->getIsLongTerm()) 391 { 392 return pcPic; 393 } 394 else 395 { 396 pcStPic = pcPic; 397 } 398 break; 399 } 377 400 } 378 401 379 402 iterPic++; 380 403 } 381 404 382 405 return pcStPic; 383 406 } … … 385 408 Void TComSlice::setRefPOCList () 386 409 { 387 for (Int iDir = 0; iDir < 2; iDir++)410 for (Int iDir = 0; iDir < NUM_REF_PIC_LIST_01; iDir++) 388 411 { 389 412 for (Int iNumRefIdx = 0; iNumRefIdx < m_aiNumRefIdx[iDir]; iNumRefIdx++) 390 413 { 391 414 m_aiRefPOCList[iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getPOC(); 392 #if H_MV415 #if NH_MV 393 416 m_aiRefLayerIdList[iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getLayerId(); 394 417 #endif … … 415 438 } 416 439 417 #if ! H_MV440 #if !NH_MV 418 441 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr ) 419 442 { … … 428 451 } 429 452 453 m_aiNumRefIdx[REF_PIC_LIST_0] = getNumRefIdx(REF_PIC_LIST_0); 454 m_aiNumRefIdx[REF_PIC_LIST_1] = getNumRefIdx(REF_PIC_LIST_1); 455 } 456 457 TComPic* pcRefPic= NULL; 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; 465 Int i; 466 467 for(i=0; i < m_pRPS->getNumberOfNegativePictures(); i++) 468 { 469 if(m_pRPS->getUsed(i)) 470 { 471 pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pRPS->getDeltaPOC(i)); 472 pcRefPic->setIsLongTerm(0); 473 pcRefPic->getPicYuvRec()->extendPicBorder(); 474 RefPicSetStCurr0[NumPicStCurr0] = pcRefPic; 475 NumPicStCurr0++; 476 pcRefPic->setCheckLTMSBPresent(false); 477 } 478 } 479 480 for(; i < m_pRPS->getNumberOfNegativePictures()+m_pRPS->getNumberOfPositivePictures(); i++) 481 { 482 if(m_pRPS->getUsed(i)) 483 { 484 pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pRPS->getDeltaPOC(i)); 485 pcRefPic->setIsLongTerm(0); 486 pcRefPic->getPicYuvRec()->extendPicBorder(); 487 RefPicSetStCurr1[NumPicStCurr1] = pcRefPic; 488 NumPicStCurr1++; 489 pcRefPic->setCheckLTMSBPresent(false); 490 } 491 } 492 493 for(i = m_pRPS->getNumberOfNegativePictures()+m_pRPS->getNumberOfPositivePictures()+m_pRPS->getNumberOfLongtermPictures()-1; i > m_pRPS->getNumberOfNegativePictures()+m_pRPS->getNumberOfPositivePictures()-1 ; i--) 494 { 495 if(m_pRPS->getUsed(i)) 496 { 497 pcRefPic = xGetLongTermRefPic(rcListPic, m_pRPS->getPOC(i), m_pRPS->getCheckLTMSBPresent(i)); 498 pcRefPic->setIsLongTerm(1); 499 pcRefPic->getPicYuvRec()->extendPicBorder(); 500 RefPicSetLtCurr[NumPicLtCurr] = pcRefPic; 501 NumPicLtCurr++; 502 } 503 if(pcRefPic==NULL) 504 { 505 pcRefPic = xGetLongTermRefPic(rcListPic, m_pRPS->getPOC(i), m_pRPS->getCheckLTMSBPresent(i)); 506 } 507 pcRefPic->setCheckLTMSBPresent(m_pRPS->getCheckLTMSBPresent(i)); 508 } 509 510 // ref_pic_list_init 511 TComPic* rpsCurrList0[MAX_NUM_REF+1]; 512 TComPic* rpsCurrList1[MAX_NUM_REF+1]; 513 Int numPicTotalCurr = NumPicStCurr0 + NumPicStCurr1 + NumPicLtCurr; 514 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: 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. 520 if (getRapPicFlag()) 521 { 522 assert(numPicTotalCurr == 0); 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 533 assert(numPicTotalCurr > 0); 534 // general tier and level limit: 535 assert(numPicTotalCurr <= 8); 536 430 537 m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); 431 538 m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); 539 } 540 541 Int cIdx = 0; 542 for ( i=0; i<NumPicStCurr0; i++, cIdx++) 543 { 544 rpsCurrList0[cIdx] = RefPicSetStCurr0[i]; 545 } 546 for ( i=0; i<NumPicStCurr1; i++, cIdx++) 547 { 548 rpsCurrList0[cIdx] = RefPicSetStCurr1[i]; 549 } 550 for ( i=0; i<NumPicLtCurr; i++, cIdx++) 551 { 552 rpsCurrList0[cIdx] = RefPicSetLtCurr[i]; 553 } 554 assert(cIdx == numPicTotalCurr); 555 556 if (m_eSliceType==B_SLICE) 557 { 558 cIdx = 0; 559 for ( i=0; i<NumPicStCurr1; i++, cIdx++) 560 { 561 rpsCurrList1[cIdx] = RefPicSetStCurr1[i]; 562 } 563 for ( i=0; i<NumPicStCurr0; i++, cIdx++) 564 { 565 rpsCurrList1[cIdx] = RefPicSetStCurr0[i]; 566 } 567 for ( i=0; i<NumPicLtCurr; i++, cIdx++) 568 { 569 rpsCurrList1[cIdx] = RefPicSetLtCurr[i]; 570 } 571 assert(cIdx == numPicTotalCurr); 572 } 573 574 ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm)); 575 576 for (Int rIdx = 0; rIdx < m_aiNumRefIdx[REF_PIC_LIST_0]; rIdx ++) 577 { 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 ); 582 } 583 if ( m_eSliceType != B_SLICE ) 584 { 585 m_aiNumRefIdx[REF_PIC_LIST_1] = 0; 586 ::memset( m_apcRefPicList[REF_PIC_LIST_1], 0, sizeof(m_apcRefPicList[REF_PIC_LIST_1])); 587 } 588 else 589 { 590 for (Int rIdx = 0; rIdx < m_aiNumRefIdx[REF_PIC_LIST_1]; rIdx ++) 591 { 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 ); 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 } 432 609 } 433 610 … … 440 617 UInt NumPocLtCurr = 0; 441 618 Int i; 442 443 for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++) 444 { 445 if(m_pcRPS->getUsed(i)) 446 { 447 pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); 619 #if NH_3D 620 m_pocsInCurrRPSs.clear(); 621 #endif 622 for(i=0; i < m_pRPS->getNumberOfNegativePictures(); i++) 623 { 624 if(m_pRPS->getUsed(i)) 625 { 626 pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pRPS->getDeltaPOC(i)); 448 627 pcRefPic->setIsLongTerm(0); 449 628 pcRefPic->getPicYuvRec()->extendPicBorder(); … … 451 630 NumPocStCurr0++; 452 631 pcRefPic->setCheckLTMSBPresent(false); 453 } 454 } 455 456 for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++) 457 { 458 if(m_pcRPS->getUsed(i)) 459 { 460 pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); 632 #if NH_3D 633 m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() ); 634 #endif 635 } 636 } 637 638 for(; i < m_pRPS->getNumberOfNegativePictures()+m_pRPS->getNumberOfPositivePictures(); i++) 639 { 640 if(m_pRPS->getUsed(i)) 641 { 642 pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pRPS->getDeltaPOC(i)); 461 643 pcRefPic->setIsLongTerm(0); 462 644 pcRefPic->getPicYuvRec()->extendPicBorder(); … … 464 646 NumPocStCurr1++; 465 647 pcRefPic->setCheckLTMSBPresent(false); 466 } 467 } 468 469 for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--) 470 { 471 if(m_pcRPS->getUsed(i)) 472 { 473 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); 648 #if NH_3D 649 m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() ); 650 #endif 651 } 652 } 653 654 for(i = m_pRPS->getNumberOfNegativePictures()+m_pRPS->getNumberOfPositivePictures()+m_pRPS->getNumberOfLongtermPictures()-1; i > m_pRPS->getNumberOfNegativePictures()+m_pRPS->getNumberOfPositivePictures()-1 ; i--) 655 { 656 if(m_pRPS->getUsed(i)) 657 { 658 pcRefPic = xGetLongTermRefPic(rcListPic, m_pRPS->getPOC(i), m_pRPS->getCheckLTMSBPresent(i)); 474 659 pcRefPic->setIsLongTerm(1); 475 660 pcRefPic->getPicYuvRec()->extendPicBorder(); 476 661 RefPicSetLtCurr[NumPocLtCurr] = pcRefPic; 477 662 NumPocLtCurr++; 663 #if NH_3D 664 m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() ); 665 #endif 478 666 } 479 667 if(pcRefPic==NULL) 480 668 { 481 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); 482 } 483 pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); 484 } 485 486 // ref_pic_list_init 487 TComPic* rpsCurrList0[MAX_NUM_REF+1]; 488 TComPic* rpsCurrList1[MAX_NUM_REF+1]; 489 Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; 490 if (checkNumPocTotalCurr) 491 { 492 // 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: 493 // - If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. 494 // - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. 495 if (getRapPicFlag()) 496 { 497 assert(numPocTotalCurr == 0); 498 } 499 500 if (m_eSliceType == I_SLICE) 501 { 502 ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); 503 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); 504 505 return; 506 } 507 508 assert(numPocTotalCurr > 0); 509 510 m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); 511 m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); 512 } 513 514 Int cIdx = 0; 515 for ( i=0; i<NumPocStCurr0; i++, cIdx++) 516 { 517 rpsCurrList0[cIdx] = RefPicSetStCurr0[i]; 518 } 519 for ( i=0; i<NumPocStCurr1; i++, cIdx++) 520 { 521 rpsCurrList0[cIdx] = RefPicSetStCurr1[i]; 522 } 523 for ( i=0; i<NumPocLtCurr; i++, cIdx++) 524 { 525 rpsCurrList0[cIdx] = RefPicSetLtCurr[i]; 526 } 527 assert(cIdx == numPocTotalCurr); 528 529 if (m_eSliceType==B_SLICE) 530 { 531 cIdx = 0; 532 for ( i=0; i<NumPocStCurr1; i++, cIdx++) 533 { 534 rpsCurrList1[cIdx] = RefPicSetStCurr1[i]; 535 } 536 for ( i=0; i<NumPocStCurr0; i++, cIdx++) 537 { 538 rpsCurrList1[cIdx] = RefPicSetStCurr0[i]; 539 } 540 for ( i=0; i<NumPocLtCurr; i++, cIdx++) 541 { 542 rpsCurrList1[cIdx] = RefPicSetLtCurr[i]; 543 } 544 assert(cIdx == numPocTotalCurr); 545 } 546 547 ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm)); 548 549 for (Int rIdx = 0; rIdx < m_aiNumRefIdx[0]; rIdx ++) 550 { 551 cIdx = m_RefPicListModification.getRefPicListModificationFlagL0() ? m_RefPicListModification.getRefPicSetIdxL0(rIdx) : rIdx % numPocTotalCurr; 552 assert(cIdx >= 0 && cIdx < numPocTotalCurr); 553 m_apcRefPicList[0][rIdx] = rpsCurrList0[ cIdx ]; 554 m_bIsUsedAsLongTerm[0][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 ); 555 } 556 if ( m_eSliceType != B_SLICE ) 557 { 558 m_aiNumRefIdx[1] = 0; 559 ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1])); 560 } 561 else 562 { 563 for (Int rIdx = 0; rIdx < m_aiNumRefIdx[1]; rIdx ++) 564 { 565 cIdx = m_RefPicListModification.getRefPicListModificationFlagL1() ? m_RefPicListModification.getRefPicSetIdxL1(rIdx) : rIdx % numPocTotalCurr; 566 assert(cIdx >= 0 && cIdx < numPocTotalCurr); 567 m_apcRefPicList[1][rIdx] = rpsCurrList1[ cIdx ]; 568 m_bIsUsedAsLongTerm[1][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 ); 569 } 570 } 571 } 572 573 #else 574 Void TComSlice::getTempRefPicLists( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1, 575 std::vector<TComPic*> rpsCurrList[2], std::vector<Bool> usedAsLongTerm[2], Int& numPocTotalCurr, Bool checkNumPocTotalCurr ) 576 { 577 if (!checkNumPocTotalCurr) 578 { 579 if (m_eSliceType == I_SLICE) 580 { 581 return; 582 } 583 } 584 585 TComPic* pcRefPic= NULL; 586 TComPic* RefPicSetStCurr0[16]; 587 TComPic* RefPicSetStCurr1[16]; 588 TComPic* RefPicSetLtCurr[16]; 589 UInt NumPocStCurr0 = 0; 590 UInt NumPocStCurr1 = 0; 591 UInt NumPocLtCurr = 0; 592 Int i; 593 #if H_3D 594 m_pocsInCurrRPSs.clear(); 595 #endif 596 for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++) 597 { 598 if(m_pcRPS->getUsed(i)) 599 { 600 pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); 601 pcRefPic->setIsLongTerm(0); 602 pcRefPic->getPicYuvRec()->extendPicBorder(); 603 RefPicSetStCurr0[NumPocStCurr0] = pcRefPic; 604 NumPocStCurr0++; 605 pcRefPic->setCheckLTMSBPresent(false); 606 #if H_3D 607 m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() ); 608 #endif 609 } 610 } 611 612 for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++) 613 { 614 if(m_pcRPS->getUsed(i)) 615 { 616 pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); 617 pcRefPic->setIsLongTerm(0); 618 pcRefPic->getPicYuvRec()->extendPicBorder(); 619 RefPicSetStCurr1[NumPocStCurr1] = pcRefPic; 620 NumPocStCurr1++; 621 pcRefPic->setCheckLTMSBPresent(false); 622 #if H_3D 623 m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() ); 624 #endif 625 } 626 } 627 628 for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--) 629 { 630 if(m_pcRPS->getUsed(i)) 631 { 632 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); 633 pcRefPic->setIsLongTerm(1); 634 pcRefPic->getPicYuvRec()->extendPicBorder(); 635 RefPicSetLtCurr[NumPocLtCurr] = pcRefPic; 636 NumPocLtCurr++; 637 #if H_3D 638 m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() ); 639 #endif 640 } 641 if(pcRefPic==NULL) 642 { 643 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); 644 } 645 pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); 669 pcRefPic = xGetLongTermRefPic(rcListPic, m_pRPS->getPOC(i), m_pRPS->getCheckLTMSBPresent(i)); 670 } 671 pcRefPic->setCheckLTMSBPresent(m_pRPS->getCheckLTMSBPresent(i)); 646 672 } 647 673 648 674 Int numPocInterCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; 649 #if H_3D675 #if NH_3D 650 676 assert( numPocInterCurr == (Int) m_pocsInCurrRPSs.size() ); 651 677 #endif … … 763 789 } 764 790 #endif 765 Int TComSlice::getNumRpsCurrTempList() 791 792 Int TComSlice::getNumRpsCurrTempList() const 766 793 { 767 794 Int numRpsCurrTempList = 0; 768 795 769 if (m_eSliceType == I_SLICE) 796 if (m_eSliceType == I_SLICE) 770 797 { 771 798 return 0; 772 799 } 773 for(UInt i=0; i < m_p cRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++)774 { 775 if(m_p cRPS->getUsed(i))800 for(UInt i=0; i < m_pRPS->getNumberOfNegativePictures()+ m_pRPS->getNumberOfPositivePictures() + m_pRPS->getNumberOfLongtermPictures(); i++) 801 { 802 if(m_pRPS->getUsed(i)) 776 803 { 777 804 numRpsCurrTempList++; 778 805 } 779 806 } 780 #if H_MV807 #if NH_MV 781 808 numRpsCurrTempList = numRpsCurrTempList + getNumActiveRefLayerPics(); 782 809 #endif … … 786 813 Void TComSlice::initEqualRef() 787 814 { 788 for (Int iDir = 0; iDir < 2; iDir++)815 for (Int iDir = 0; iDir < NUM_REF_PIC_LIST_01; iDir++) 789 816 { 790 817 for (Int iRefIdx1 = 0; iRefIdx1 < MAX_NUM_REF; iRefIdx1++) … … 797 824 } 798 825 } 799 #if H_3D800 #if H_3D_TMVP826 #if NH_3D 827 #if NH_3D_TMVP 801 828 Void TComSlice::generateAlterRefforTMVP() 802 829 { … … 820 847 } 821 848 #endif 849 #endif 850 851 #if NH_3D 822 852 Void TComSlice::setCamparaSlice( Int** aaiScale, Int** aaiOffset ) 823 853 { … … 846 876 Int i; 847 877 TComSlice* curSlice = pic->getSlice(curSliceIdx); 848 Int currColRefPOC = curSlice->getRefPOC( RefPicList(1 -curSlice->getColFromL0Flag()), curSlice->getColRefIdx());878 Int currColRefPOC = curSlice->getRefPOC( RefPicList(1 - curSlice->getColFromL0Flag()), curSlice->getColRefIdx()); 849 879 TComSlice* preSlice; 850 880 Int preColRefPOC; … … 854 884 if(preSlice->getSliceType() != I_SLICE) 855 885 { 856 preColRefPOC = preSlice->getRefPOC( RefPicList(1 -preSlice->getColFromL0Flag()), preSlice->getColRefIdx());886 preColRefPOC = preSlice->getRefPOC( RefPicList(1 - preSlice->getColFromL0Flag()), preSlice->getColRefIdx()); 857 887 if(currColRefPOC != preColRefPOC) 858 888 { … … 868 898 } 869 899 870 Void TComSlice::checkCRA( TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic)900 Void TComSlice::checkCRA(const TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic) 871 901 { 872 902 for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++) … … 887 917 else 888 918 { 889 assert(pReferencePictureSet->getPOC(i) >= pocCRA);890 }891 }919 assert(pReferencePictureSet->getPOC(i) >= pocCRA); 920 } 921 } 892 922 } 893 923 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found … … 915 945 * \param rcListPic reference to the reference picture list 916 946 * This function marks the reference pictures as "unused for reference" in the following conditions. 917 * If the nal_unit_type is IDR/BLA/BLANT, all pictures in the reference picture list 947 * If the nal_unit_type is IDR/BLA/BLANT, all pictures in the reference picture list 918 948 * are marked as "unused for reference" 919 949 * If the nal_unit_type is BLA/BLANT, set the pocCRA to the temporal reference of the current picture. 920 950 * Otherwise 921 * If the bRefreshPending flag is true (a deferred decoding refresh is pending) and the current 922 * temporal reference is greater than the temporal reference of the latest CRA/CRANT/BLA/BLANT picture (pocCRA), 923 * mark all reference pictures except the latest CRA/CRANT/BLA/BLANT picture as "unused for reference" and set 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 924 954 * the bRefreshPending flag to false. 925 * If the nal_unit_type is CRA/CRANT, set the bRefreshPending flag to true and pocCRA to the temporal 955 * If the nal_unit_type is CRA/CRANT, set the bRefreshPending flag to true and pocCRA to the temporal 926 956 * reference of the current picture. 927 957 * Note that the current picture is already placed in the reference list and its marking is not changed. 928 958 * If the current picture has a nal_ref_idc that is not 0, it will remain marked as "used for reference". 929 959 */ 930 Void TComSlice::decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic) 931 { 932 TComPic* rpcPic; 933 #if !FIX1172 934 setAssociatedIRAPPOC(pocCRA); 935 #endif 936 Int pocCurr = getPOC(); 960 Void TComSlice::decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic, const bool bEfficientFieldIRAPEnabled) 961 { 962 TComPic* rpcPic; 963 Int pocCurr = getPOC(); 937 964 938 965 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP … … 948 975 rpcPic = *(iterPic); 949 976 rpcPic->setCurrSliceIdx(0); 950 if (rpcPic->getPOC() != pocCurr) rpcPic->getSlice(0)->setReferenced(false); 977 if (rpcPic->getPOC() != pocCurr) 978 { 979 rpcPic->getSlice(0)->setReferenced(false); 980 } 951 981 iterPic++; 952 982 } … … 957 987 pocCRA = pocCurr; 958 988 } 959 #if EFFICIENT_FIELD_IRAP 989 if (bEfficientFieldIRAPEnabled) 990 { 960 991 bRefreshPending = true; 961 #endif 992 } 962 993 } 963 994 else // CRA or No DR 964 995 { 965 #if EFFICIENT_FIELD_IRAP 966 if(getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL) 996 if(bEfficientFieldIRAPEnabled && (getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL)) 967 997 { 968 998 if (bRefreshPending==true && pocCurr > m_iLastIDR) // IDR reference marking pending … … 983 1013 else 984 1014 { 985 #endif 986 if (bRefreshPending==true && pocCurr > pocCRA) // CRA reference marking pending 987 { 988 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 989 while (iterPic != rcListPic.end()) 990 { 991 rpcPic = *(iterPic); 992 if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) 993 { 994 rpcPic->getSlice(0)->setReferenced(false); 995 } 996 iterPic++; 997 } 998 bRefreshPending = false; 999 } 1000 #if EFFICIENT_FIELD_IRAP 1001 } 1002 #endif 1015 if (bRefreshPending==true && pocCurr > pocCRA) // CRA reference marking pending 1016 { 1017 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 1018 while (iterPic != rcListPic.end()) 1019 { 1020 rpcPic = *(iterPic); 1021 if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) 1022 { 1023 rpcPic->getSlice(0)->setReferenced(false); 1024 } 1025 iterPic++; 1026 } 1027 bRefreshPending = false; 1028 } 1029 } 1003 1030 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found 1004 1031 { 1005 bRefreshPending = true; 1032 bRefreshPending = true; 1006 1033 pocCRA = pocCurr; 1007 1034 } … … 1017 1044 m_iPOC = pSrc->m_iPOC; 1018 1045 m_eNalUnitType = pSrc->m_eNalUnitType; 1019 #if H_MV1046 #if NH_MV 1020 1047 m_layerId = pSrc->m_layerId; 1021 1048 // GT: Copying of several other values might be be missing here, or is above not necessary? … … 1026 1053 m_iSliceQpBase = pSrc->m_iSliceQpBase; 1027 1054 #endif 1055 m_ChromaQpAdjEnabled = pSrc->m_ChromaQpAdjEnabled; 1028 1056 m_deblockingFilterDisable = pSrc->m_deblockingFilterDisable; 1029 1057 m_deblockingFilterOverrideFlag = pSrc->m_deblockingFilterOverrideFlag; 1030 1058 m_deblockingFilterBetaOffsetDiv2 = pSrc->m_deblockingFilterBetaOffsetDiv2; 1031 1059 m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2; 1032 1033 for (i = 0; i < 2; i++)1060 1061 for (i = 0; i < NUM_REF_PIC_LIST_01; i++) 1034 1062 { 1035 1063 m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i]; … … 1039 1067 { 1040 1068 m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i]; 1041 } 1069 } 1070 1042 1071 m_bCheckLDC = pSrc->m_bCheckLDC; 1043 1072 m_iSliceQpDelta = pSrc->m_iSliceQpDelta; 1044 m_iSliceQpDeltaCb = pSrc->m_iSliceQpDeltaCb; 1045 m_iSliceQpDeltaCr = pSrc->m_iSliceQpDeltaCr; 1046 for (i = 0; i < 2; i++) 1073 for (UInt component = 0; component < MAX_NUM_COMPONENT; component++) 1074 { 1075 m_iSliceChromaQpDelta[component] = pSrc->m_iSliceChromaQpDelta[component]; 1076 } 1077 for (i = 0; i < NUM_REF_PIC_LIST_01; i++) 1047 1078 { 1048 1079 for (j = 0; j < MAX_NUM_REF; j++) … … 1050 1081 m_apcRefPicList[i][j] = pSrc->m_apcRefPicList[i][j]; 1051 1082 m_aiRefPOCList[i][j] = pSrc->m_aiRefPOCList[i][j]; 1052 #if H_MV 1083 m_bIsUsedAsLongTerm[i][j] = pSrc->m_bIsUsedAsLongTerm[i][j]; 1084 #if NH_MV 1053 1085 m_aiRefLayerIdList[i][j] = pSrc->m_aiRefLayerIdList[i][j]; 1054 1086 #endif 1055 1087 } 1056 } 1057 for (i = 0; i < 2; i++) 1058 { 1059 for (j = 0; j < MAX_NUM_REF + 1; j++) 1060 { 1061 m_bIsUsedAsLongTerm[i][j] = pSrc->m_bIsUsedAsLongTerm[i][j]; 1062 } 1088 m_bIsUsedAsLongTerm[i][MAX_NUM_REF] = pSrc->m_bIsUsedAsLongTerm[i][MAX_NUM_REF]; 1063 1089 } 1064 1090 m_iDepth = pSrc->m_iDepth; … … 1068 1094 1069 1095 // access channel 1070 #if H_MV1096 #if NH_MV 1071 1097 m_pcVPS = pSrc->m_pcVPS; 1072 1098 #endif 1073 m_pcSPS = pSrc->m_pcSPS; 1074 m_pcPPS = pSrc->m_pcPPS; 1075 m_pcRPS = pSrc->m_pcRPS; 1076 m_iLastIDR = pSrc->m_iLastIDR; 1099 m_pRPS = pSrc->m_pRPS; m_iLastIDR = pSrc->m_iLastIDR; 1077 1100 1078 1101 m_pcPic = pSrc->m_pcPic; … … 1080 1103 m_colFromL0Flag = pSrc->m_colFromL0Flag; 1081 1104 m_colRefIdx = pSrc->m_colRefIdx; 1105 1082 1106 setLambdas(pSrc->getLambdas()); 1083 for (i = 0; i < 2; i++) 1107 1108 for (i = 0; i < NUM_REF_PIC_LIST_01; i++) 1084 1109 { 1085 1110 for (j = 0; j < MAX_NUM_REF; j++) … … 1095 1120 m_bTLayerSwitchingFlag = pSrc->m_bTLayerSwitchingFlag; 1096 1121 1097 m_sliceMode = pSrc->m_sliceMode; 1098 m_sliceArgument = pSrc->m_sliceArgument; 1099 m_sliceCurStartCUAddr = pSrc->m_sliceCurStartCUAddr; 1100 m_sliceCurEndCUAddr = pSrc->m_sliceCurEndCUAddr; 1101 m_sliceIdx = pSrc->m_sliceIdx; 1102 m_sliceSegmentMode = pSrc->m_sliceSegmentMode; 1103 m_sliceSegmentArgument = pSrc->m_sliceSegmentArgument; 1104 m_sliceSegmentCurStartCUAddr = pSrc->m_sliceSegmentCurStartCUAddr; 1105 m_sliceSegmentCurEndCUAddr = pSrc->m_sliceSegmentCurEndCUAddr; 1106 m_nextSlice = pSrc->m_nextSlice; 1107 m_nextSliceSegment = pSrc->m_nextSliceSegment; 1108 for ( Int e=0 ; e<2 ; e++ ) 1109 { 1110 for ( Int n=0 ; n<MAX_NUM_REF ; n++ ) 1111 { 1112 memcpy(m_weightPredTable[e][n], pSrc->m_weightPredTable[e][n], sizeof(wpScalingParam)*3 ); 1113 } 1114 } 1115 m_saoEnabledFlag = pSrc->m_saoEnabledFlag; 1116 m_saoEnabledFlagChroma = pSrc->m_saoEnabledFlagChroma; 1117 m_cabacInitFlag = pSrc->m_cabacInitFlag; 1118 m_numEntryPointOffsets = pSrc->m_numEntryPointOffsets; 1119 1120 m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero; 1121 m_LFCrossSliceBoundaryFlag = pSrc->m_LFCrossSliceBoundaryFlag; 1122 m_sliceMode = pSrc->m_sliceMode; 1123 m_sliceArgument = pSrc->m_sliceArgument; 1124 m_sliceCurStartCtuTsAddr = pSrc->m_sliceCurStartCtuTsAddr; 1125 m_sliceCurEndCtuTsAddr = pSrc->m_sliceCurEndCtuTsAddr; 1126 m_sliceIdx = pSrc->m_sliceIdx; 1127 m_sliceSegmentMode = pSrc->m_sliceSegmentMode; 1128 m_sliceSegmentArgument = pSrc->m_sliceSegmentArgument; 1129 m_sliceSegmentCurStartCtuTsAddr = pSrc->m_sliceSegmentCurStartCtuTsAddr; 1130 m_sliceSegmentCurEndCtuTsAddr = pSrc->m_sliceSegmentCurEndCtuTsAddr; 1131 m_nextSlice = pSrc->m_nextSlice; 1132 m_nextSliceSegment = pSrc->m_nextSliceSegment; 1133 1134 for ( UInt e=0 ; e<NUM_REF_PIC_LIST_01 ; e++ ) 1135 { 1136 for ( UInt n=0 ; n<MAX_NUM_REF ; n++ ) 1137 { 1138 memcpy(m_weightPredTable[e][n], pSrc->m_weightPredTable[e][n], sizeof(WPScalingParam)*MAX_NUM_COMPONENT ); 1139 } 1140 } 1141 1142 for( UInt ch = 0 ; ch < MAX_NUM_CHANNEL_TYPE; ch++) 1143 { 1144 m_saoEnabledFlag[ch] = pSrc->m_saoEnabledFlag[ch]; 1145 } 1146 1147 m_cabacInitFlag = pSrc->m_cabacInitFlag; 1148 1149 m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero; 1150 m_LFCrossSliceBoundaryFlag = pSrc->m_LFCrossSliceBoundaryFlag; 1122 1151 m_enableTMVPFlag = pSrc->m_enableTMVPFlag; 1123 1152 m_maxNumMergeCand = pSrc->m_maxNumMergeCand; 1124 1125 #if H_MV 1153 m_encCABACTableIdx = pSrc->m_encCABACTableIdx; 1154 1155 #if NH_MV 1126 1156 // Additional slice header syntax elements 1127 1157 #if !H_MV_HLS7_GEN … … 1137 1167 } 1138 1168 #endif 1139 #if H_3D1169 #if NH_3D_DIS 1140 1170 m_bApplyDIS = pSrc->m_bApplyDIS; 1141 1171 #endif 1142 #if H_3D_IC1172 #if NH_3D_IC 1143 1173 m_bApplyIC = pSrc->m_bApplyIC; 1144 1174 m_icSkipParseFlag = pSrc->m_icSkipParseFlag; 1145 1175 #endif 1146 } 1147 1148 Int TComSlice::m_prevTid0POC = 0; 1176 1177 } 1178 1149 1179 1150 1180 /** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag. 1151 1181 * \param uiTLayer Temporal layer ID of the current slice 1152 * The decoder calls this function to set temporal_layer_switching_point_flag for each temporal layer based on 1153 * the SPS's temporal_id_nesting_flag and the parsed PPS. Then, current slice's temporal layer ID and 1182 * The decoder calls this function to set temporal_layer_switching_point_flag for each temporal layer based on 1183 * the SPS's temporal_id_nesting_flag and the parsed PPS. Then, current slice's temporal layer ID and 1154 1184 * temporal_layer_switching_point_flag is set accordingly. 1155 1185 */ … … 1161 1191 /** Function for checking if this is a switching-point 1162 1192 */ 1163 Bool TComSlice::isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic)1193 Bool TComSlice::isTemporalLayerSwitchingPoint(TComList<TComPic*>& rcListPic) 1164 1194 { 1165 1195 TComPic* rpcPic; … … 1180 1210 } 1181 1211 1182 /** Function for checking if this is a STSA candidate 1212 /** Function for checking if this is a STSA candidate 1183 1213 */ 1184 Bool TComSlice::isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic)1185 { 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1214 Bool TComSlice::isStepwiseTemporalLayerSwitchingPointCandidate(TComList<TComPic*>& rcListPic) 1215 { 1216 TComPic* rpcPic; 1217 1218 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 1219 while ( iterPic != rcListPic.end()) 1220 { 1221 rpcPic = *(iterPic++); 1222 if(rpcPic->getSlice(0)->isReferenced() && (rpcPic->getUsedByCurr()==true) && rpcPic->getPOC() != getPOC()) 1223 { 1224 if(rpcPic->getTLayer() >= getTLayer()) 1225 { 1226 return false; 1227 } 1228 } 1229 } 1230 return true; 1201 1231 } 1202 1232 … … 1264 1294 { 1265 1295 rpcPic = *(iterPic++); 1266 #if BUGFIX_INTRAPERIOD1267 1296 if(!rpcPic->getReconMark()) 1268 1297 { 1269 1298 continue; 1270 1299 } 1271 #endif1272 1300 if (rpcPic->getPOC() == this->getPOC()) 1273 1301 { … … 1278 1306 // in decoding order shall precede the IRAP picture in output order. 1279 1307 // (Note that any picture following in output order would be present in the DPB) 1280 #if !SETTING_NO_OUT_PIC_PRIOR1281 if(rpcPic->getSlice(0)->getPicOutputFlag() == 1)1282 #else1283 1308 if(rpcPic->getSlice(0)->getPicOutputFlag() == 1 && !this->getNoOutputPriorPicsFlag()) 1284 #endif1285 1309 { 1286 1310 if(nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP || … … 1317 1341 // When a picture is a leading picture, it shall precede, in decoding order, 1318 1342 // all trailing pictures that are associated with the same IRAP picture. 1319 if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||1320 nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R ||1321 nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||1322 nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R)1323 {1324 if(rpcPic->getSlice(0)->getAssociatedIRAPPOC() == this->getAssociatedIRAPPOC())1325 {1326 // rpcPic is a picture that preceded the leading in decoding order since it exist in the DPB1327 // rpcPic would violate the constraint if it was a trailing picture1328 assert(rpcPic->getPOC() <= this->getAssociatedIRAPPOC());1329 }1330 }1343 if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || 1344 nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || 1345 nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || 1346 nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R) 1347 { 1348 if(rpcPic->getSlice(0)->getAssociatedIRAPPOC() == this->getAssociatedIRAPPOC()) 1349 { 1350 // rpcPic is a picture that preceded the leading in decoding order since it exist in the DPB 1351 // rpcPic would violate the constraint if it was a trailing picture 1352 assert(rpcPic->getPOC() <= this->getAssociatedIRAPPOC()); 1353 } 1354 } 1331 1355 1332 1356 // Any RASL picture associated with a CRA or BLA picture shall precede any … … 1334 1358 if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || 1335 1359 nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) 1336 { 1360 { 1337 1361 if((this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || 1338 1362 this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_LP || … … 1372 1396 1373 1397 1398 1374 1399 /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. 1375 1400 */ 1376 Void TComSlice::applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet)1401 Void TComSlice::applyReferencePictureSet( TComList<TComPic*>& rcListPic, const TComReferencePictureSet *pReferencePictureSet) 1377 1402 { 1378 1403 TComPic* rpcPic; … … 1414 1439 } 1415 1440 } 1416 else 1441 else 1417 1442 { 1418 1443 Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); … … 1427 1452 1428 1453 } 1429 #if H_MV1454 #if NH_MV 1430 1455 if( isReference ) // Current picture is in the temporal RPS 1431 1456 { … … 1435 1460 // mark the picture as "unused for reference" if it is not in 1436 1461 // the Reference Picture Set 1437 if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && isReference == 0) 1438 { 1439 rpcPic->getSlice( 0 )->setReferenced( false ); 1462 if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && isReference == 0) 1463 { 1464 rpcPic->getSlice( 0 )->setReferenced( false ); 1440 1465 rpcPic->setUsedByCurr(0); 1441 1466 rpcPic->setIsLongTerm(0); … … 1458 1483 /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. 1459 1484 */ 1460 #if ALLOW_RECOVERY_POINT_AS_RAP 1461 Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess, Bool bUseRecoveryPoint) 1462 #else 1463 Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess) 1464 #endif 1465 { 1466 #if ALLOW_RECOVERY_POINT_AS_RAP 1485 Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, const TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess, Bool bUseRecoveryPoint) 1486 { 1467 1487 Int atLeastOneUnabledByRecoveryPoint = 0; 1468 1488 Int atLeastOneFlushedByPreviousIDR = 0; 1469 #endif1470 1489 TComPic* rpcPic; 1471 1490 Int i, isAvailable; … … 1488 1507 if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i) && rpcPic->getSlice(0)->isReferenced()) 1489 1508 { 1490 #if ALLOW_RECOVERY_POINT_AS_RAP1491 1509 if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) 1492 1510 { … … 1495 1513 else 1496 1514 { 1497 isAvailable = 1; 1498 } 1499 #else 1500 isAvailable = 1; 1501 #endif 1502 } 1503 } 1504 else 1515 isAvailable = 1; 1516 } 1517 } 1518 } 1519 else 1505 1520 { 1506 1521 Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); … … 1509 1524 if(rpcPic->getIsLongTerm() && curPoc == refPoc && rpcPic->getSlice(0)->isReferenced()) 1510 1525 { 1511 #if ALLOW_RECOVERY_POINT_AS_RAP1512 1526 if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) 1513 1527 { … … 1516 1530 else 1517 1531 { 1518 isAvailable = 1; 1519 } 1520 #else 1521 isAvailable = 1; 1522 #endif 1532 isAvailable = 1; 1533 } 1523 1534 } 1524 1535 } … … 1540 1551 refPoc = refPoc & (pocCycle - 1); 1541 1552 } 1542 1553 1543 1554 if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc) 1544 1555 { 1545 #if ALLOW_RECOVERY_POINT_AS_RAP1546 1556 if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) 1547 1557 { … … 1550 1560 else 1551 1561 { 1552 isAvailable = 1; 1553 rpcPic->setIsLongTerm(1); 1554 break; 1555 } 1556 #else 1557 isAvailable = 1; 1558 rpcPic->setIsLongTerm(1); 1559 break; 1560 #endif 1562 isAvailable = 1; 1563 rpcPic->setIsLongTerm(1); 1564 break; 1565 } 1561 1566 } 1562 1567 } … … 1564 1569 // report that a picture is lost if it is in the Reference Picture Set 1565 1570 // but not available as reference picture 1566 if(isAvailable == 0) 1567 { 1571 if(isAvailable == 0) 1572 { 1568 1573 if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) 1569 1574 { … … 1586 1591 } 1587 1592 } 1588 #if ALLOW_RECOVERY_POINT_AS_RAP1589 1593 else if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess) 1590 1594 { … … 1595 1599 atLeastOneFlushedByPreviousIDR = 1; 1596 1600 } 1597 #endif 1598 } 1599 } 1601 } 1602 } 1600 1603 // loop through all short-term pictures in the Reference Picture Set 1601 1604 // to see if the picture should be kept as reference picture … … 1611 1614 if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) 1612 1615 { 1613 #if ALLOW_RECOVERY_POINT_AS_RAP1614 1616 if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) 1615 1617 { … … 1618 1620 else 1619 1621 { 1620 isAvailable = 1; 1621 } 1622 #else 1623 isAvailable = 1; 1624 #endif 1622 isAvailable = 1; 1623 } 1625 1624 } 1626 1625 } 1627 1626 // report that a picture is lost if it is in the Reference Picture Set 1628 1627 // but not available as reference picture 1629 if(isAvailable == 0) 1630 { 1628 if(isAvailable == 0) 1629 { 1631 1630 if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) 1632 1631 { … … 1649 1648 } 1650 1649 } 1651 #if ALLOW_RECOVERY_POINT_AS_RAP1652 1650 else if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess) 1653 1651 { 1654 1652 atLeastOneUnabledByRecoveryPoint = 1; 1655 }1653 } 1656 1654 else if(bUseRecoveryPoint && (this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_N_LP || this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_W_RADL)) 1657 1655 { 1658 1656 atLeastOneFlushedByPreviousIDR = 1; 1659 } 1660 #endif 1661 } 1662 } 1663 #if ALLOW_RECOVERY_POINT_AS_RAP 1657 } 1658 } 1659 } 1660 1664 1661 if(atLeastOneUnabledByRecoveryPoint || atLeastOneFlushedByPreviousIDR) 1665 1662 { 1666 1663 return -1; 1667 1664 } 1668 #endif1669 1665 if(atLeastOneLost) 1670 1666 { … … 1683 1679 /** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set 1684 1680 */ 1685 #if ALLOW_RECOVERY_POINT_AS_RAP 1686 Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP, Int pocRandomAccess, Bool bUseRecoveryPoint) 1687 #else 1688 Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP) 1689 #endif 1681 Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, const TComReferencePictureSet *pReferencePictureSet, Bool isRAP, Int pocRandomAccess, Bool bUseRecoveryPoint, const Bool bEfficientFieldIRAPEnabled) 1690 1682 { 1691 1683 TComPic* rpcPic; … … 1694 1686 Int nrOfNegativePictures = 0; 1695 1687 Int nrOfPositivePictures = 0; 1696 TComReferencePictureSet* pcRPS = this->getLocalRPS(); 1688 TComReferencePictureSet* pLocalRPS = this->getLocalRPS(); 1689 (*pLocalRPS)=TComReferencePictureSet(); 1690 1691 Bool irapIsInRPS = false; // Used when bEfficientFieldIRAPEnabled==true 1697 1692 1698 1693 // loop through all pictures in the Reference Picture Set … … 1711 1706 // This picture exists as a reference picture 1712 1707 // and should be added to the explicit Reference Picture Set 1713 pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); 1714 pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP)); 1715 #if ALLOW_RECOVERY_POINT_AS_RAP 1716 pcRPS->setUsed(k, pcRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) ); 1717 #endif 1718 if(pcRPS->getDeltaPOC(k) < 0) 1708 pLocalRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); 1709 pLocalRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP)); 1710 if (bEfficientFieldIRAPEnabled) 1711 { 1712 pLocalRPS->setUsed(k, pLocalRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) ); 1713 } 1714 1715 if(pLocalRPS->getDeltaPOC(k) < 0) 1719 1716 { 1720 1717 nrOfNegativePictures++; … … 1722 1719 else 1723 1720 { 1721 if(bEfficientFieldIRAPEnabled && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC()+1) 1722 { 1723 irapIsInRPS = true; 1724 } 1724 1725 nrOfPositivePictures++; 1725 1726 } … … 1728 1729 } 1729 1730 } 1730 #if EFFICIENT_FIELD_IRAP 1731 1731 1732 Bool useNewRPS = false; 1732 1733 // if current picture is complimentary field associated to IRAP, add the IRAP to its RPS. 1733 if( m_pcPic->isField())1734 if(bEfficientFieldIRAPEnabled && m_pcPic->isField() && !irapIsInRPS) 1734 1735 { 1735 1736 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); … … 1739 1740 if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC()+1) 1740 1741 { 1741 p cRPS->setDeltaPOC(k, 1);1742 p cRPS->setUsed(k, true);1742 pLocalRPS->setDeltaPOC(k, 1); 1743 pLocalRPS->setUsed(k, true); 1743 1744 nrOfPositivePictures++; 1744 1745 k ++; … … 1747 1748 } 1748 1749 } 1749 #endif 1750 pcRPS->setNumberOfNegativePictures(nrOfNegativePictures); 1751 pcRPS->setNumberOfPositivePictures(nrOfPositivePictures); 1752 pcRPS->setNumberOfPictures(nrOfNegativePictures+nrOfPositivePictures); 1753 // This is a simplistic inter rps example. A smarter encoder will look for a better reference RPS to do the 1750 pLocalRPS->setNumberOfNegativePictures(nrOfNegativePictures); 1751 pLocalRPS->setNumberOfPositivePictures(nrOfPositivePictures); 1752 pLocalRPS->setNumberOfPictures(nrOfNegativePictures+nrOfPositivePictures); 1753 // This is a simplistic inter rps example. A smarter encoder will look for a better reference RPS to do the 1754 1754 // inter RPS prediction with. Here we just use the reference used by pReferencePictureSet. 1755 1755 // If pReferencePictureSet is not inter_RPS_predicted, then inter_RPS_prediction is for the current RPS also disabled. 1756 if (!pReferencePictureSet->getInterRPSPrediction() 1757 #if EFFICIENT_FIELD_IRAP 1758 || useNewRPS 1759 #endif 1760 ) 1761 { 1762 pcRPS->setInterRPSPrediction(false); 1763 pcRPS->setNumRefIdc(0); 1756 if (!pReferencePictureSet->getInterRPSPrediction() || useNewRPS ) 1757 { 1758 pLocalRPS->setInterRPSPrediction(false); 1759 pLocalRPS->setNumRefIdc(0); 1764 1760 } 1765 1761 else … … 1767 1763 Int rIdx = this->getRPSidx() - pReferencePictureSet->getDeltaRIdxMinus1() - 1; 1768 1764 Int deltaRPS = pReferencePictureSet->getDeltaRPS(); 1769 TComReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx);1765 const TComReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx); 1770 1766 Int iRefPics = pcRefRPS->getNumberOfPictures(); 1771 1767 Int iNewIdc=0; 1772 for(i=0; i<= iRefPics; i++) 1768 for(i=0; i<= iRefPics; i++) 1773 1769 { 1774 1770 Int deltaPOC = ((i != iRefPics)? pcRefRPS->getDeltaPOC(i) : 0); // check if the reference abs POC is >= 0 1775 1771 Int iRefIdc = 0; 1776 for (j=0; j < p cRPS->getNumberOfPictures(); j++) // loop through the pictures in the new RPS1777 { 1778 if ( (deltaPOC + deltaRPS) == p cRPS->getDeltaPOC(j))1779 { 1780 if (p cRPS->getUsed(j))1772 for (j=0; j < pLocalRPS->getNumberOfPictures(); j++) // loop through the pictures in the new RPS 1773 { 1774 if ( (deltaPOC + deltaRPS) == pLocalRPS->getDeltaPOC(j)) 1775 { 1776 if (pLocalRPS->getUsed(j)) 1781 1777 { 1782 1778 iRefIdc = 1; … … 1788 1784 } 1789 1785 } 1790 p cRPS->setRefIdc(i, iRefIdc);1786 pLocalRPS->setRefIdc(i, iRefIdc); 1791 1787 iNewIdc++; 1792 1788 } 1793 p cRPS->setInterRPSPrediction(true);1794 p cRPS->setNumRefIdc(iNewIdc);1795 p cRPS->setDeltaRPS(deltaRPS);1796 p cRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx());1797 } 1798 1799 this->setRPS(p cRPS);1789 pLocalRPS->setInterRPSPrediction(true); 1790 pLocalRPS->setNumRefIdc(iNewIdc); 1791 pLocalRPS->setDeltaRPS(deltaRPS); 1792 pLocalRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx()); 1793 } 1794 1795 this->setRPS(pLocalRPS); 1800 1796 this->setRPSidx(-1); 1801 1797 } 1802 1798 1803 /** get AC and DC values for weighted pred 1804 * \param *wp 1805 * \returns Void 1806 */ 1807 Void TComSlice::getWpAcDcParam(wpACDCParam *&wp) 1799 //! get AC and DC values for weighted pred 1800 Void TComSlice::getWpAcDcParam(WPACDCParam *&wp) 1808 1801 { 1809 1802 wp = m_weightACDCParam; 1810 1803 } 1811 1804 1812 /** init AC and DC values for weighted pred 1813 * \returns Void 1814 */ 1805 //! init AC and DC values for weighted pred 1815 1806 Void TComSlice::initWpAcDcParam() 1816 1807 { 1817 for(Int iComp = 0; iComp < 3; iComp++ )1808 for(Int iComp = 0; iComp < MAX_NUM_COMPONENT; iComp++ ) 1818 1809 { 1819 1810 m_weightACDCParam[iComp].iAC = 0; … … 1822 1813 } 1823 1814 1824 /** get WP tables for weighted pred 1825 * \param RefPicList 1826 * \param iRefIdx 1827 * \param *&wpScalingParam 1828 * \returns Void 1829 */ 1830 Void TComSlice::getWpScaling( RefPicList e, Int iRefIdx, wpScalingParam *&wp ) 1831 { 1815 //! get tables for weighted prediction 1816 Void TComSlice::getWpScaling( RefPicList e, Int iRefIdx, WPScalingParam *&wp ) 1817 { 1818 assert (e<NUM_REF_PIC_LIST_01); 1832 1819 wp = m_weightPredTable[e][iRefIdx]; 1833 1820 } 1834 1821 1835 /** reset Default WP tables settings : no weight. 1836 * \param wpScalingParam 1837 * \returns Void 1838 */ 1822 //! reset Default WP tables settings : no weight. 1839 1823 Void TComSlice::resetWpScaling() 1840 1824 { 1841 for ( Int e=0 ; e< 2; e++ )1825 for ( Int e=0 ; e<NUM_REF_PIC_LIST_01 ; e++ ) 1842 1826 { 1843 1827 for ( Int i=0 ; i<MAX_NUM_REF ; i++ ) 1844 1828 { 1845 for ( Int yuv=0 ; yuv< 3; yuv++ )1846 { 1847 wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]);1829 for ( Int yuv=0 ; yuv<MAX_NUM_COMPONENT ; yuv++ ) 1830 { 1831 WPScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); 1848 1832 pwp->bPresentFlag = false; 1849 1833 pwp->uiLog2WeightDenom = 0; … … 1856 1840 } 1857 1841 1858 /** init WP table 1859 * \returns Void 1860 */ 1861 Void TComSlice::initWpScaling() 1862 { 1863 for ( Int e=0 ; e<2 ; e++ ) 1842 //! init WP table 1843 Void TComSlice::initWpScaling(const TComSPS *sps) 1844 { 1845 const Bool bUseHighPrecisionPredictionWeighting = sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag(); 1846 for ( Int e=0 ; e<NUM_REF_PIC_LIST_01 ; e++ ) 1864 1847 { 1865 1848 for ( Int i=0 ; i<MAX_NUM_REF ; i++ ) 1866 1849 { 1867 for ( Int yuv=0 ; yuv< 3; yuv++ )1868 { 1869 wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]);1870 if ( !pwp->bPresentFlag ) 1850 for ( Int yuv=0 ; yuv<MAX_NUM_COMPONENT ; yuv++ ) 1851 { 1852 WPScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); 1853 if ( !pwp->bPresentFlag ) 1871 1854 { 1872 1855 // Inferring values not present : … … 1875 1858 } 1876 1859 1860 const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (sps->getBitDepth(toChannelType(ComponentID(yuv)))-8)); 1861 1877 1862 pwp->w = pwp->iWeight; 1878 Int bitDepth = yuv ? g_bitDepthC : g_bitDepthY; 1879 pwp->o = pwp->iOffset << (bitDepth-8); 1863 pwp->o = pwp->iOffset * offsetScalingFactor; //NOTE: This value of the ".o" variable is never used - .o is set immediately before it gets used 1880 1864 pwp->shift = pwp->uiLog2WeightDenom; 1881 1865 pwp->round = (pwp->uiLog2WeightDenom>=1) ? (1 << (pwp->uiLog2WeightDenom-1)) : (0); … … 1891 1875 : m_VPSId ( 0) 1892 1876 , m_uiMaxTLayers ( 1) 1893 #if H_MV1877 #if NH_MV 1894 1878 , m_uiMaxLayersMinus1 ( 0) 1895 1879 #else … … 1898 1882 , m_bTemporalIdNestingFlag (false) 1899 1883 , m_numHrdParameters ( 0) 1900 #if H_MV1884 #if NH_MV 1901 1885 , m_maxLayerId ( 0) 1902 1886 #else 1903 1887 , m_maxNuhReservedZeroLayerId ( 0) 1904 1888 #endif 1905 , m_hrdParameters (NULL) 1906 , m_hrdOpSetIdx (NULL) 1907 , m_cprmsPresentFlag (NULL) 1908 #if H_MV 1909 , m_dpbSize (NULL) 1910 , m_vpsVUI ( NULL ) 1911 #endif 1912 { 1913 #if H_MV 1889 , m_hrdParameters () 1890 , m_hrdOpSetIdx () 1891 , m_cprmsPresentFlag () 1892 { 1893 #if NH_MV 1914 1894 m_vpsBaseLayerInternalFlag = true; 1915 1895 m_vpsBaseLayerAvailableFlag = true; … … 1922 1902 { 1923 1903 m_numReorderPics[i] = 0; 1924 m_uiMaxDecPicBuffering[i] = 1; 1904 m_uiMaxDecPicBuffering[i] = 1; 1925 1905 m_uiMaxLatencyIncrease[i] = 0; 1926 1906 } 1927 #if H_MV1907 #if NH_MV 1928 1908 for (Int lsIdx = 0; lsIdx < MAX_VPS_OP_SETS_PLUS1; lsIdx++ ) 1929 1909 { … … 1988 1968 m_layerIdInNuh [i] = ( i == 0 ) ? 0 : -1; 1989 1969 m_numDirectRefLayers[i] = 0; 1990 #if H_3D1970 #if NH_3D 1991 1971 m_numRefListLayers[i] = 0; 1992 1972 #endif 1993 1973 m_vpsRepFormatIdx [i] = 0; 1994 m_pocLsbNotPresentFlag[i] = 0; 1995 m_repFormat [i] = NULL; 1974 m_pocLsbNotPresentFlag[i] = 0; 1996 1975 m_viewIdVal [i] = 0; 1997 1976 1998 #if H_3D1977 #if NH_3D 1999 1978 m_viewIndex [i] = -1; 2000 1979 #endif … … 2006 1985 m_dependencyFlag [i][j] = false; 2007 1986 m_idDirectRefLayer[i][j] = -1; 2008 #if H_3D1987 #if NH_3D 2009 1988 m_idRefListLayer[i][j] = -1; 2010 1989 #endif … … 2018 1997 m_dimensionId[i][j] = 0; 2019 1998 } 2020 #if H_3D_ARP 2021 #endif 2022 } 2023 m_vpsVUI = new TComVPSVUI; 2024 m_dpbSize = new TComDpbSize; 2025 2026 1999 #if NH_3D_ARP 2000 #endif 2001 } 2027 2002 #endif 2028 2003 } … … 2030 2005 TComVPS::~TComVPS() 2031 2006 { 2032 if( m_hrdParameters != NULL ) delete[] m_hrdParameters; 2033 if( m_hrdOpSetIdx != NULL ) delete[] m_hrdOpSetIdx; 2034 if( m_cprmsPresentFlag != NULL ) delete[] m_cprmsPresentFlag; 2035 #if H_MV 2036 if ( m_vpsVUI != NULL ) delete m_vpsVUI; 2037 if ( m_dpbSize != NULL ) delete m_dpbSize; 2038 2039 for( Int i = 0; i < MAX_NUM_LAYERS; i++ ) 2040 { 2041 if (m_repFormat[ i ] != NULL ) delete m_repFormat[ i ]; 2042 } 2043 #endif 2044 #if H_3D 2045 deleteCamPars(); 2046 #endif 2047 } 2048 2049 #if H_MV 2007 } 2008 2009 #if NH_MV 2050 2010 2051 2011 Bool TComVPS::checkVPSExtensionSyntax() … … 2066 2026 } 2067 2027 2068 Int TComVPS::getNumScalabilityTypes() 2028 Int TComVPS::getNumScalabilityTypes() const 2069 2029 { 2070 2030 return scalTypeToScalIdx( ScalabilityType(MAX_NUM_SCALABILITY_TYPES) ); 2071 2031 } 2072 2032 2073 Int TComVPS::scalTypeToScalIdx( ScalabilityType scalType ) 2074 { 2075 assert( scalType >= 0 && scalType <= MAX_NUM_SCALABILITY_TYPES );2076 assert( scalType == MAX_NUM_SCALABILITY_TYPES || getScalabilityMaskFlag( scalType ) );2033 Int TComVPS::scalTypeToScalIdx( ScalabilityType scalType ) const 2034 { 2035 assert( (Int)scalType >= 0 && (Int)scalType <= MAX_NUM_SCALABILITY_TYPES ); 2036 assert( (Int)scalType == MAX_NUM_SCALABILITY_TYPES || getScalabilityMaskFlag( scalType ) ); 2077 2037 Int scalIdx = 0; 2078 2038 for( Int curScalType = 0; curScalType < scalType; curScalType++ ) … … 2114 2074 Int iNuhLId = getLayerIdInNuh( i ); 2115 2075 Int d = 0; 2116 #if H_3D2076 #if NH_3D 2117 2077 Int l = 0; 2118 2078 #endif … … 2127 2087 m_idDirectRefLayer[iNuhLId][d++] = jNuhLid; 2128 2088 } 2129 #if H_3D2089 #if NH_3D 2130 2090 if( getDirectDependencyFlag( i , j ) && ( getDepthId( iNuhLId ) == getDepthId( jNuhLid ) )) 2131 2091 { … … 2144 2104 } 2145 2105 m_numDirectRefLayers[ iNuhLId ] = d; 2146 #if H_3D2106 #if NH_3D 2147 2107 m_numRefListLayers[ iNuhLId ] = l; 2148 2108 #endif … … 2185 2145 { 2186 2146 m_numViews = 1; 2187 #if H_3D 2188 AOF( m_viewOIdxList.size() == 0 ); 2189 2147 #if NH_3D 2148 AOF( m_viewOIdxList.size() == 0 ); 2190 2149 m_viewOIdxList.push_back( 0 ); 2191 2150 #endif … … 2207 2166 { 2208 2167 m_numViews++; 2209 #if H_3D2168 #if NH_3D 2210 2169 m_viewOIdxList.push_back( getViewOrderIdx( lId ) ); 2211 2170 #endif … … 2216 2175 2217 2176 2218 Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType ) 2177 Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType ) const 2219 2178 { 2220 2179 return getScalabilityMaskFlag( scalType ) ? getDimensionId( layerIdInVps, scalTypeToScalIdx( scalType ) ) : 0; 2221 2180 } 2222 2181 2223 #if H_3D2224 Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag ) 2182 #if NH_3D 2183 Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag ) const 2225 2184 { 2226 2185 Int foundLayerIdinNuh = -1; … … 2240 2199 Void TComVPS::createCamPars(Int iNumViews) 2241 2200 { 2242 Int i = 0, j = 0; 2243 2244 m_numCp = new Int [ iNumViews ]; 2245 m_cpRefVoi = new Int*[ iNumViews ]; 2246 m_cpInSliceSegmentHeaderFlag = new Bool[ iNumViews ]; 2247 2248 m_cpPresentFlag = new Bool*[ iNumViews ]; 2249 2250 2251 m_aaaiCodedScale = new Int**[ iNumViews ]; 2252 m_aaaiCodedOffset = new Int**[ iNumViews ]; 2253 for ( i = 0; i < iNumViews ; i++ ) 2254 { 2255 m_cpInSliceSegmentHeaderFlag[i] = false; 2256 2257 m_aaaiCodedScale[i] = new Int*[ 2 ]; 2258 m_aaaiCodedOffset[i] = new Int*[ 2 ]; 2259 2260 m_numCp [i] = 0; 2261 m_cpRefVoi[i] = new Int[ iNumViews ]; 2262 m_cpPresentFlag[i] = new Bool[ iNumViews ]; 2263 for ( j = 0; j < iNumViews; j++) 2264 { 2265 m_cpRefVoi[i][j] = 0; 2266 m_cpPresentFlag[i][j] = false; 2267 } 2268 for ( j = 0; j < 2; j++ ) 2269 { 2270 m_aaaiCodedScale[i][j] = new Int[ MAX_NUM_LAYERS ]; 2271 m_aaaiCodedOffset[i][j] = new Int[ MAX_NUM_LAYERS ]; 2201 m_numCp .resize( iNumViews ); 2202 m_cpRefVoi .resize( iNumViews ); 2203 m_cpInSliceSegmentHeaderFlag.resize( iNumViews ); 2204 m_cpPresentFlag .resize( iNumViews ); 2205 m_aaaiCodedScale .resize( iNumViews ); 2206 m_aaaiCodedOffset .resize( iNumViews ); 2207 2208 for ( Int i = 0; i < iNumViews ; i++ ) 2209 { 2210 m_numCp [i] = 0; 2211 m_cpRefVoi [i].resize( iNumViews ); 2212 m_cpInSliceSegmentHeaderFlag[i] = false; 2213 m_aaaiCodedScale [i].resize( 2 ); 2214 m_aaaiCodedOffset [i].resize( 2 ); 2215 m_cpPresentFlag [i].resize( iNumViews ); 2216 2217 for ( Int j = 0; j < iNumViews; j++) 2218 { 2219 m_cpRefVoi [i][j] = 0; 2220 m_cpPresentFlag [i][j] = false; 2221 } 2222 2223 for ( Int j = 0; j < 2; j++ ) 2224 { 2225 m_aaaiCodedScale [i][j].resize( MAX_NUM_LAYERS ); 2226 m_aaaiCodedOffset [i][j].resize( MAX_NUM_LAYERS ); 2227 2272 2228 for ( Int k = 0; k < MAX_NUM_LAYERS; k++ ) 2273 2229 { 2274 m_aaaiCodedScale [i][j][k] = 0;2230 m_aaaiCodedScale [i][j][k] = 0; 2275 2231 m_aaaiCodedOffset[i][j][k] = 0; 2276 2232 } … … 2278 2234 } 2279 2235 } 2280 2281 Void TComVPS::deleteCamPars() 2282 { 2283 Int iNumViews = getNumViews(); 2284 Int i = 0, j = 0; 2285 2286 if ( m_numCp != NULL ) 2287 { 2288 delete [] m_numCp; 2289 } 2290 2291 if ( m_cpRefVoi != NULL ) 2292 { 2293 for ( i = 0; i < iNumViews ; i++ ) 2294 { 2295 delete [] m_cpRefVoi[i]; 2296 } 2297 delete[] m_cpRefVoi; 2298 } 2299 2300 if ( m_cpPresentFlag != NULL ) 2301 { 2302 for ( i = 0; i < iNumViews ; i++ ) 2303 { 2304 delete [] m_cpPresentFlag[i]; 2305 } 2306 delete[] m_cpPresentFlag; 2307 } 2308 2309 2310 if ( m_cpInSliceSegmentHeaderFlag != NULL ) 2311 { 2312 delete [] m_cpInSliceSegmentHeaderFlag; 2313 } 2314 2315 2316 if ( m_aaaiCodedScale != NULL ) 2317 { 2318 for ( i = 0; i < iNumViews ; i++ ) 2319 { 2320 for ( j = 0; j < 2; j++ ) 2321 { 2322 delete [] m_aaaiCodedScale[i][j]; 2323 } 2324 delete [] m_aaaiCodedScale[i]; 2325 } 2326 delete [] m_aaaiCodedScale; 2327 } 2328 2329 if ( m_aaaiCodedOffset != NULL ) 2330 { 2331 for ( i = 0; i < iNumViews ; i++ ) 2332 { 2333 for ( j = 0; j < 2; j++ ) 2334 { 2335 delete [] m_aaaiCodedOffset[i][j]; 2336 } 2337 delete [] m_aaaiCodedOffset[i]; 2338 } 2339 delete [] m_aaaiCodedOffset; 2340 } 2341 } 2342 2343 2344 2345 #endif // H_3D 2346 2347 2348 Int TComVPS::xGetDimBitOffset( Int j ) 2236 #endif // NH_3D 2237 2238 2239 Int TComVPS::xGetDimBitOffset( Int j ) const 2349 2240 { 2350 2241 Int dimBitOffset = 0; … … 2363 2254 } 2364 2255 2365 Int TComVPS::inferDimensionId( Int i, Int j ) 2256 Int TComVPS::inferDimensionId( Int i, Int j ) const 2366 2257 { 2367 2258 return ( ( getLayerIdInNuh( i ) & ( (1 << xGetDimBitOffset( j + 1 ) ) - 1) ) >> xGetDimBitOffset( j ) ); 2368 2259 } 2369 2260 2370 Int TComVPS::inferLastDimsionIdLenMinus1() 2261 Int TComVPS::inferLastDimsionIdLenMinus1() const 2371 2262 { 2372 2263 return ( 5 - xGetDimBitOffset( getNumScalabilityTypes() - 1 ) ); 2373 2264 } 2374 2265 2375 Int TComVPS::getNumLayersInIdList( Int lsIdx ) 2266 Int TComVPS::getNumLayersInIdList( Int lsIdx ) const 2376 2267 { 2377 2268 assert( lsIdx >= 0 ); … … 2380 2271 } 2381 2272 2382 Int TComVPS::getNumOutputLayerSets() 2273 Int TComVPS::getNumOutputLayerSets() const 2383 2274 { 2384 2275 return getNumAddOlss() + getNumLayerSets(); … … 2427 2318 } 2428 2319 2429 Bool TComVPS::inferOutputLayerFlag( Int i, Int j ) 2320 Bool TComVPS::inferOutputLayerFlag( Int i, Int j ) const 2430 2321 { 2431 2322 Bool outputLayerFlag; … … 2455 2346 } 2456 2347 2457 Int TComVPS::getMaxSubLayersInLayerSetMinus1( Int i ) 2348 Int TComVPS::getMaxSubLayersInLayerSetMinus1( Int i ) const 2458 2349 { 2459 2350 Int maxSLMinus1 = 0; … … 2466 2357 } 2467 2358 2468 Bool TComVPS::getAltOutputLayerFlagVar( Int i ) 2359 Bool TComVPS::getAltOutputLayerFlagVar( Int i ) const 2469 2360 { 2470 2361 // Semantics variable not syntax element ! … … 2481 2372 2482 2373 2483 Int TComVPS::inferProfileTierLevelIdx(Int i, Int j) 2374 Int TComVPS::inferProfileTierLevelIdx(Int i, Int j) const 2484 2375 { 2485 2376 Bool inferZero = ( i == 0 && j == 0 && getVpsBaseLayerInternalFlag() ); … … 2555 2446 } 2556 2447 2557 Void TComVPS::printPTL() 2448 Void TComVPS::printPTL() const 2558 2449 { 2559 2450 std::vector<Int> idx; 2560 2451 std::vector<Int> num; 2561 std::vector< std::vector<Int> >ptlInfo;2452 IntAry2d ptlInfo; 2562 2453 2563 2454 std::cout << std::right << std::setw(60) << std::setfill('-') << " " << std::setfill(' ') << std::endl << "PTLI" << std::endl; … … 2566 2457 { 2567 2458 std::vector<Int> curPtlInfo; 2568 ProfileTierLevel* ptl = getPTL( i )->getGeneralPTL();2459 const ProfileTierLevel* ptl = getPTL( i )->getGeneralPTL(); 2569 2460 curPtlInfo.push_back( (Int) ptl->getProfileIdc() ); 2570 2461 curPtlInfo.push_back( (Int) ptl->getTierFlag() ); … … 2591 2482 } 2592 2483 2593 Void TComVPS::printLayerDependencies() 2484 Void TComVPS::printLayerDependencies() const 2594 2485 { 2595 2486 vector<Int> fullArray; 2596 2487 vector<Int> range; 2597 2488 2598 #if H_3D2489 #if NH_3D 2599 2490 vector<Int> depthId; 2600 2491 #endif … … 2612 2503 auxId .push_back( getAuxId ( i ) ); 2613 2504 viewId .push_back( getViewId ( getLayerIdInNuh( i ) ) ); 2614 #if H_3D2505 #if NH_3D 2615 2506 depthId.push_back( getDepthId( i ) ); 2616 2507 #endif … … 2623 2514 xPrintArray( "IdRefLayer" , getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numRefLayers, m_idRefLayer, true ); 2624 2515 xPrintArray( "IdDirectRefLayer", getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numDirectRefLayers, m_idDirectRefLayer, true ); 2625 #if H_3D2516 #if NH_3D 2626 2517 xPrintArray( "IdRefListLayer", getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numRefListLayers, m_idRefListLayer, true ); 2627 2518 #endif … … 2630 2521 } 2631 2522 2632 Void TComVPS::printScalabilityId() 2523 Void TComVPS::printScalabilityId() const 2633 2524 { 2634 2525 vector<Int> layerIdxInVps; 2635 2526 2636 #if H_3D 2527 2637 2528 vector<Int> depthId; 2638 #endif2639 2640 2529 vector<Int> viewOrderIndex; 2641 2530 vector<Int> auxId; … … 2647 2536 Int layerIdInNuh = getLayerIdInNuh( i ); 2648 2537 layerIdxInVps .push_back( i ); 2538 depthId .push_back( getDepthId ( layerIdInNuh ) ); 2649 2539 viewOrderIndex.push_back( getViewIndex ( layerIdInNuh ) ); 2650 2540 dependencyId .push_back( getDependencyId( layerIdInNuh ) ); 2651 2541 auxId .push_back( getAuxId ( layerIdInNuh ) ); 2652 2542 viewId .push_back( getViewId ( layerIdInNuh ) ); 2653 #if H_3D 2654 depthId .push_back( getDepthId ( layerIdInNuh ) ); 2655 #endif 2543 2656 2544 } 2657 2545 … … 2660 2548 xPrintArray( "layer_id_in_nuh", getMaxLayersMinus1()+1, m_layerIdInNuh, false ); 2661 2549 2662 xPrintArray( "ViewOrderIndex", getMaxLayersMinus1()+1, viewOrderIndex, false ); 2550 xPrintArray( "DepthLayerFlag", getMaxLayersMinus1()+1, depthId , false ); 2551 xPrintArray( "ViewOrderIdx" , getMaxLayersMinus1()+1, viewOrderIndex, false ); 2663 2552 xPrintArray( "DependencyId" , getMaxLayersMinus1()+1, dependencyId , false ); 2664 2553 xPrintArray( "AuxId" , getMaxLayersMinus1()+1, auxId , false ); 2665 xPrintArray( "ViewId ", getMaxLayersMinus1()+1, viewId , false );2554 xPrintArray( "ViewIdVal" , getMaxLayersMinus1()+1, viewId , false ); 2666 2555 2667 2556 std::cout << std::endl; 2668 2557 } 2669 2558 2670 Void TComVPS::printLayerSets() 2559 Void TComVPS::printLayerSets() const 2671 2560 { 2672 2561 vector<Int> fullArray; … … 2721 2610 } 2722 2611 2723 #if H_3D2612 #if NH_3D 2724 2613 Void TComVPS::initViewCompLayer() 2725 2614 { … … 2749 2638 } 2750 2639 2751 Int TComVPS::getVoiInVps(Int viewOIdx) 2640 Int TComVPS::getVoiInVps(Int viewOIdx) const 2752 2641 { 2753 2642 for ( Int i = 0; i < m_viewOIdxList.size(); i++ ) … … 2783 2672 #endif 2784 2673 2785 #endif // H_MV2674 #endif // NH_MV 2786 2675 2787 2676 // ------------------------------------------------------------------------------------------------ 2788 2677 // Sequence parameter set (SPS) 2789 2678 // ------------------------------------------------------------------------------------------------ 2679 2680 TComSPSRExt::TComSPSRExt() 2681 : m_transformSkipRotationEnabledFlag (false) 2682 , m_transformSkipContextEnabledFlag (false) 2683 // m_rdpcmEnabledFlag initialized below 2684 , m_extendedPrecisionProcessingFlag (false) 2685 , m_intraSmoothingDisabledFlag (false) 2686 , m_highPrecisionOffsetsEnabledFlag (false) 2687 , m_persistentRiceAdaptationEnabledFlag(false) 2688 , m_cabacBypassAlignmentEnabledFlag (false) 2689 { 2690 for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++) 2691 { 2692 m_rdpcmEnabledFlag[signallingModeIndex] = false; 2693 } 2694 } 2790 2695 2791 2696 TComSPS::TComSPS() … … 2798 2703 , m_picHeightInLumaSamples (288) 2799 2704 , m_log2MinCodingBlockSize ( 0) 2800 , m_log2DiffMaxMinCodingBlockSize 2705 , m_log2DiffMaxMinCodingBlockSize(0) 2801 2706 , m_uiMaxCUWidth ( 32) 2802 2707 , m_uiMaxCUHeight ( 32) 2803 , m_uiMax CUDepth( 3)2708 , m_uiMaxTotalCUDepth ( 3) 2804 2709 , m_bLongTermRefsPresent (false) 2805 2710 , m_uiQuadtreeTULog2MaxSize ( 0) … … 2808 2713 , m_uiQuadtreeTUMaxDepthIntra ( 0) 2809 2714 // Tool list 2810 , m_usePCM (false)2715 , m_usePCM (false) 2811 2716 , m_pcmLog2MaxSize ( 5) 2812 2717 , m_uiPCMLog2MinSize ( 7) 2813 , m_bitDepthY ( 8)2814 , m_bitDepthC ( 8)2815 , m_qpBDOffsetY ( 0)2816 , m_qpBDOffsetC ( 0)2817 , m_uiPCMBitDepthLuma ( 8)2818 , m_uiPCMBitDepthChroma ( 8)2819 2718 , m_bPCMFilterDisableFlag (false) 2820 2719 , m_uiBitsForPOC ( 8) 2821 , m_numLongTermRefPicSPS ( 0)2720 , m_numLongTermRefPicSPS ( 0) 2822 2721 , m_uiMaxTrSize ( 32) 2823 , m_bUseSAO (false) 2722 , m_bUseSAO (false) 2824 2723 , m_bTemporalIdNestingFlag (false) 2825 2724 , m_scalingListEnabledFlag (false) … … 2827 2726 , m_vuiParametersPresentFlag (false) 2828 2727 , m_vuiParameters () 2829 #if H_MV2728 #if NH_MV 2830 2729 , m_pcVPS ( NULL ) 2831 2730 , m_spsInferScalingListFlag ( false ) … … 2836 2735 , m_interViewMvVertConstraintFlag (false) 2837 2736 #endif 2838 { 2737 2738 { 2739 for(Int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) 2740 { 2741 m_bitDepths.recon[ch] = 8; 2742 #if O0043_BEST_EFFORT_DECODING 2743 m_bitDepths.stream[ch] = 8; 2744 #endif 2745 m_pcmBitDepths[ch] = 8; 2746 m_qpBDOffset [ch] = 0; 2747 } 2748 2749 2839 2750 for ( Int i = 0; i < MAX_TLAYER; i++ ) 2840 2751 { … … 2843 2754 m_numReorderPics[i] = 0; 2844 2755 } 2845 m_scalingList = new TComScalingList; 2756 2846 2757 ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps)); 2847 2758 ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag)); 2848 #if H_MV2759 #if NH_MV 2849 2760 m_spsRangeExtensionsFlag = false; 2850 2761 m_spsMultilayerExtensionFlag = false; 2851 #if H_3D2852 2762 m_spsExtension5bits = 0; 2853 2763 m_sps3dExtensionFlag = false; 2854 #else 2855 m_spsExtension6bits = 0; 2856 #endif 2857 2858 #endif 2764 2765 #endif 2766 2859 2767 } 2860 2768 2861 2769 TComSPS::~TComSPS() 2862 2770 { 2863 delete m_scalingList;2864 2771 m_RPSList.destroy(); 2865 2772 } 2866 2773 2867 2774 Void TComSPS::createRPSList( Int numRPS ) 2868 { 2775 { 2869 2776 m_RPSList.destroy(); 2870 2777 m_RPSList.create(numRPS); 2871 2778 } 2872 2779 2873 Void TComSPS::setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess )2874 {2875 if( !getVuiParametersPresentFlag() )2876 {2877 return;2878 }2879 2880 TComVUI *vui = getVuiParameters();2881 TComHRD *hrd = vui->getHrdParameters();2882 2883 TimingInfo *timingInfo = vui->getTimingInfo();2884 timingInfo->setTimingInfoPresentFlag( true );2885 switch( frameRate )2886 {2887 case 24:2888 timingInfo->setNumUnitsInTick( 1125000 ); timingInfo->setTimeScale ( 27000000 );2889 break;2890 case 25:2891 timingInfo->setNumUnitsInTick( 1080000 ); timingInfo->setTimeScale ( 27000000 );2892 break;2893 case 30:2894 timingInfo->setNumUnitsInTick( 900900 ); timingInfo->setTimeScale ( 27000000 );2895 break;2896 case 50:2897 timingInfo->setNumUnitsInTick( 540000 ); timingInfo->setTimeScale ( 27000000 );2898 break;2899 case 60:2900 timingInfo->setNumUnitsInTick( 450450 ); timingInfo->setTimeScale ( 27000000 );2901 break;2902 default:2903 timingInfo->setNumUnitsInTick( 1001 ); timingInfo->setTimeScale ( 60000 );2904 break;2905 }2906 2907 Bool rateCnt = ( bitRate > 0 );2908 hrd->setNalHrdParametersPresentFlag( rateCnt );2909 hrd->setVclHrdParametersPresentFlag( rateCnt );2910 2911 hrd->setSubPicCpbParamsPresentFlag( ( numDU > 1 ) );2912 2913 if( hrd->getSubPicCpbParamsPresentFlag() )2914 {2915 hrd->setTickDivisorMinus2( 100 - 2 ); //2916 hrd->setDuCpbRemovalDelayLengthMinus1( 7 ); // 8-bit precision ( plus 1 for last DU in AU )2917 hrd->setSubPicCpbParamsInPicTimingSEIFlag( true );2918 hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 ); // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay2919 }2920 else2921 {2922 hrd->setSubPicCpbParamsInPicTimingSEIFlag( false );2923 }2924 2925 hrd->setBitRateScale( 4 ); // in units of 2~( 6 + 4 ) = 1,024 bps2926 hrd->setCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit2927 hrd->setDuCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit2928 2929 hrd->setInitialCpbRemovalDelayLengthMinus1(15); // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit2930 if( randomAccess )2931 {2932 hrd->setCpbRemovalDelayLengthMinus1(5); // 32 = 2^5 (plus 1)2933 hrd->setDpbOutputDelayLengthMinus1 (5); // 32 + 3 = 2^62934 }2935 else2936 {2937 hrd->setCpbRemovalDelayLengthMinus1(9); // max. 2^102938 hrd->setDpbOutputDelayLengthMinus1 (9); // max. 2^102939 }2940 2941 /*2942 Note: only the case of "vps_max_temporal_layers_minus1 = 0" is supported.2943 */2944 Int i, j;2945 UInt birateValue, cpbSizeValue;2946 UInt ducpbSizeValue;2947 UInt duBitRateValue = 0;2948 2949 for( i = 0; i < MAX_TLAYER; i ++ )2950 {2951 hrd->setFixedPicRateFlag( i, 1 );2952 hrd->setPicDurationInTcMinus1( i, 0 );2953 hrd->setLowDelayHrdFlag( i, 0 );2954 hrd->setCpbCntMinus1( i, 0 );2955 2956 birateValue = bitRate;2957 cpbSizeValue = bitRate; // 1 second2958 ducpbSizeValue = bitRate/numDU;2959 duBitRateValue = bitRate;2960 for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ )2961 {2962 hrd->setBitRateValueMinus1( i, j, 0, ( birateValue - 1 ) );2963 hrd->setCpbSizeValueMinus1( i, j, 0, ( cpbSizeValue - 1 ) );2964 hrd->setDuCpbSizeValueMinus1( i, j, 0, ( ducpbSizeValue - 1 ) );2965 hrd->setCbrFlag( i, j, 0, ( j == 0 ) );2966 2967 hrd->setBitRateValueMinus1( i, j, 1, ( birateValue - 1) );2968 hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) );2969 hrd->setDuCpbSizeValueMinus1( i, j, 1, ( ducpbSizeValue - 1 ) );2970 hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) );2971 hrd->setCbrFlag( i, j, 1, ( j == 0 ) );2972 }2973 }2974 }2975 2780 const Int TComSPS::m_winUnitX[]={1,2,2,1}; 2976 2781 const Int TComSPS::m_winUnitY[]={1,2,1,1}; 2977 2782 2783 TComPPSRExt::TComPPSRExt() 2784 : m_log2MaxTransformSkipBlockSize (2) 2785 , m_crossComponentPredictionEnabledFlag(false) 2786 , m_diffCuChromaQpOffsetDepth (0) 2787 , m_chromaQpOffsetListLen (0) 2788 // m_ChromaQpAdjTableIncludingNullEntry initialized below 2789 // m_log2SaoOffsetScale initialized below 2790 { 2791 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. 2792 m_ChromaQpAdjTableIncludingNullEntry[0].u.comp.CrOffset = 0; 2793 for(Int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) 2794 { 2795 m_log2SaoOffsetScale[ch] = 0; 2796 } 2797 } 2798 2978 2799 TComPPS::TComPPS() 2979 : m_PPSId (0) 2980 , m_SPSId (0) 2981 , m_picInitQPMinus26 (0) 2982 , m_useDQP (false) 2983 , m_bConstrainedIntraPred (false) 2984 , m_bSliceChromaQpFlag (false) 2985 , m_pcSPS (NULL) 2986 , m_uiMaxCuDQPDepth (0) 2987 , m_uiMinCuDQPSize (0) 2988 , m_chromaCbQpOffset (0) 2989 , m_chromaCrQpOffset (0) 2990 , m_numRefIdxL0DefaultActive (1) 2991 , m_numRefIdxL1DefaultActive (1) 2992 , m_TransquantBypassEnableFlag (false) 2993 , m_useTransformSkip (false) 2994 , m_dependentSliceSegmentsEnabledFlag (false) 2995 , m_tilesEnabledFlag (false) 2996 , m_entropyCodingSyncEnabledFlag (false) 2997 , m_loopFilterAcrossTilesEnabledFlag (true) 2998 , m_uniformSpacingFlag (false) 2999 , m_numTileColumnsMinus1 (0) 3000 , m_numTileRowsMinus1 (0) 3001 , m_numSubstreams (1) 3002 , m_signHideFlag(0) 3003 , m_cabacInitPresentFlag (false) 3004 , m_encCABACTableIdx (I_SLICE) 3005 , m_sliceHeaderExtensionPresentFlag (false) 3006 , m_loopFilterAcrossSlicesEnabledFlag (false) 3007 , m_listsModificationPresentFlag( 0) 3008 , m_numExtraSliceHeaderBits(0) 3009 #if H_MV 3010 , m_ppsInferScalingListFlag(false) 3011 , m_ppsScalingListRefLayerId(0) 3012 , m_pocResetInfoPresentFlag(false) 3013 #if H_3D 3014 , m_pcDLT(NULL) 3015 #endif 3016 #endif 3017 { 3018 m_scalingList = new TComScalingList; 3019 3020 #if H_MV 2800 : m_PPSId (0) 2801 , m_SPSId (0) 2802 , m_picInitQPMinus26 (0) 2803 , m_useDQP (false) 2804 , m_bConstrainedIntraPred (false) 2805 , m_bSliceChromaQpFlag (false) 2806 , m_uiMaxCuDQPDepth (0) 2807 , m_chromaCbQpOffset (0) 2808 , m_chromaCrQpOffset (0) 2809 , m_numRefIdxL0DefaultActive (1) 2810 , m_numRefIdxL1DefaultActive (1) 2811 , m_TransquantBypassEnableFlag (false) 2812 , m_useTransformSkip (false) 2813 , m_dependentSliceSegmentsEnabledFlag(false) 2814 , m_tilesEnabledFlag (false) 2815 , m_entropyCodingSyncEnabledFlag (false) 2816 , m_loopFilterAcrossTilesEnabledFlag (true) 2817 , m_uniformSpacingFlag (false) 2818 , m_numTileColumnsMinus1 (0) 2819 , m_numTileRowsMinus1 (0) 2820 , m_signHideFlag (false) 2821 , m_cabacInitPresentFlag (false) 2822 , m_sliceHeaderExtensionPresentFlag (false) 2823 , m_loopFilterAcrossSlicesEnabledFlag(false) 2824 , m_listsModificationPresentFlag (0) 2825 , m_numExtraSliceHeaderBits (0) 2826 #if NH_MV 2827 , m_ppsInferScalingListFlag (false) 2828 , m_ppsScalingListRefLayerId (0) 2829 , m_pocResetInfoPresentFlag (false) 2830 #endif 2831 #if NH_3D_DLT 2832 , m_cDLT () 2833 #endif 2834 { 2835 #if NH_MV 3021 2836 m_ppsRangeExtensionsFlag = false; 3022 2837 m_ppsMultilayerExtensionFlag = false; 3023 #if !H_3D3024 m_ppsExtension6bits = 0;3025 #else3026 2838 m_pps3dExtensionFlag = false; 3027 2839 m_ppsExtension5bits = 0; 3028 2840 #endif 3029 #endif 2841 3030 2842 } 3031 2843 3032 2844 TComPPS::~TComPPS() 3033 2845 { 3034 delete m_scalingList; 3035 } 3036 3037 #if H_3D 2846 } 2847 2848 #if NH_3D_DLT 3038 2849 TComDLT::TComDLT() 3039 2850 : m_bDltPresentFlag(false) … … 3041 2852 , m_uiDepthViewBitDepth(8) 3042 2853 { 3043 m_uiDepthViewBitDepth = g_bitDepthY;3044 3045 2854 for( Int i = 0; i < MAX_NUM_LAYERS; i++ ) 3046 2855 { 3047 2856 m_bUseDLTFlag [i] = false; 3048 2857 m_bInterViewDltPredEnableFlag [i] = false; 2858 m_bDltBitMapRepFlag [i] = false; 3049 2859 3050 2860 // allocate some memory and initialize with default mapping 3051 2861 m_iNumDepthmapValues[i] = ((1 << m_uiDepthViewBitDepth)-1)+1; 3052 m_iDepthValue2Idx[i] = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]); 3053 m_iIdx2DepthValue[i] = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]); 2862 m_iDepthValue2Idx[i] = std::vector<Int>(m_iNumDepthmapValues[i]); 2863 m_iIdx2DepthValue[i] = std::vector<Int>(m_iNumDepthmapValues[i]); 2864 2865 m_iDepthIdxToLayerId[i] = i; 3054 2866 3055 2867 //default mapping … … 3064 2876 TComDLT::~TComDLT() 3065 2877 { 3066 for( Int i = 0; i < MAX_NUM_LAYERS; i++ ) 3067 { 3068 if ( m_iDepthValue2Idx[i] != NULL ) 3069 { 3070 xFree( m_iDepthValue2Idx[i] ); 3071 m_iDepthValue2Idx[i] = NULL; 3072 } 3073 3074 if ( m_iIdx2DepthValue[i] != NULL ) 3075 { 3076 xFree( m_iIdx2DepthValue[i] ); 3077 m_iIdx2DepthValue[i] = NULL; 3078 } 3079 } 3080 } 3081 3082 Void TComDLT::setDepthLUTs(Int layerIdInVps, Int* idxToDepthValueTable, Int iNumDepthValues) 3083 { 3084 if( idxToDepthValueTable == NULL || iNumDepthValues == 0 ) // default mapping only 2878 2879 } 2880 2881 Void TComDLT::setDepthLUTs(Int layerIdInVps, std::vector<Int> idxToDepthValueTable, Int iNumDepthValues) 2882 { 2883 if( iNumDepthValues == 0 ) // default mapping only 3085 2884 return; 3086 2885 3087 2886 // copy idx2DepthValue to internal array 3088 m emcpy(m_iIdx2DepthValue[layerIdInVps], idxToDepthValueTable, iNumDepthValues*sizeof(UInt));3089 3090 UInt uiMaxDepthValue = ((1 << g_bitDepthY)-1);2887 m_iIdx2DepthValue[layerIdInVps] = idxToDepthValueTable; 2888 2889 UInt uiMaxDepthValue = ((1 << m_uiDepthViewBitDepth)-1); 3091 2890 for(Int p=0; p<=uiMaxDepthValue; p++) 3092 2891 { … … 3125 2924 } 3126 2925 3127 Void TComDLT::getDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTOut, UInt *puiDeltaDLTOutNum )2926 Void TComDLT::getDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int>& riDeltaDLTOut, UInt&ruiDeltaDLTOutNum ) const 3128 2927 { 3129 2928 Bool abBM0[ 256 ]; … … 3144 2943 } 3145 2944 3146 *puiDeltaDLTOutNum = 0;2945 ruiDeltaDLTOutNum = 0; 3147 2946 for( Int i = 0; i < 256; i++ ) 3148 2947 { 3149 2948 if( abBM0[ i ] ^ abBM1[ i ] ) 3150 2949 { 3151 piDeltaDLTOut[ *puiDeltaDLTOutNum ] = i; 3152 *puiDeltaDLTOutNum = *puiDeltaDLTOutNum + 1; 3153 } 3154 } 3155 } 3156 3157 Void TComDLT::setDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTIn, UInt uiDeltaDLTInNum ) 2950 riDeltaDLTOut[ ruiDeltaDLTOutNum++ ] = i; 2951 } 2952 } 2953 } 2954 2955 Void TComDLT::setDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int> piDeltaDLTIn, UInt uiDeltaDLTInNum ) 3158 2956 { 3159 2957 Bool abBM0[ 256 ]; … … 3174 2972 } 3175 2973 3176 Int aiIdx2DepthValue[256];2974 std::vector<Int> aiIdx2DepthValue(256, 0); 3177 2975 UInt uiNumDepthValues = 0; 3178 memset( aiIdx2DepthValue, 0, sizeof( aiIdx2DepthValue ));2976 std::fill(aiIdx2DepthValue.begin(), aiIdx2DepthValue.end(), 0); 3179 2977 3180 2978 for( Int i = 0; i < 256; i++ ) … … 3192 2990 #endif 3193 2991 3194 #if H_MV3195 Void TComSPS::inferRepFormat( TComVPS* vps, Int layerIdCurr )2992 #if NH_MV 2993 Void TComSPS::inferRepFormat( TComVPS* vps, Int layerIdCurr, Bool encoder ) 3196 2994 { 3197 2995 if ( getMultiLayerExtSpsFlag() ) 3198 { 2996 { 3199 2997 Int repFormatIdx = getUpdateRepFormatFlag() ? getSpsRepFormatIdx() : vps->getVpsRepFormatIdx( vps->getLayerIdInVps( layerIdCurr ) ) ; 3200 TComRepFormat* repFormat = vps->getRepFormat( repFormatIdx ); 3201 setChromaFormatIdc( repFormat->getChromaFormatVpsIdc() ); 3202 //// ToDo: add when supported: 3203 // setSeperateColourPlaneFlag( repFormat->getSeparateColourPlaneVpsFlag() ) ; 3204 3205 setPicWidthInLumaSamples ( repFormat->getPicWidthVpsInLumaSamples() ); 3206 setPicHeightInLumaSamples( repFormat->getPicHeightVpsInLumaSamples() ); 3207 3208 setBitDepthY ( repFormat->getBitDepthVpsLumaMinus8() + 8 ); 3209 setQpBDOffsetY ( (Int) (6*( getBitDepthY() - 8 )) ); 3210 3211 setBitDepthC ( repFormat->getBitDepthVpsChromaMinus8() + 8 ); 3212 setQpBDOffsetC ( (Int) (6* ( getBitDepthC() -8 ) ) ); 3213 Window &spsConf = getConformanceWindow(); 3214 3215 // Scaled later 3216 spsConf.setScaledFlag( false ); 3217 spsConf.setWindowLeftOffset ( repFormat->getConfWinVpsLeftOffset() ); 3218 spsConf.setWindowRightOffset ( repFormat->getConfWinVpsRightOffset() ); 3219 spsConf.setWindowTopOffset ( repFormat->getConfWinVpsTopOffset() ); 3220 spsConf.setWindowBottomOffset( repFormat->getConfWinVpsBottomOffset() ); 2998 const TComRepFormat* repFormat = vps->getRepFormat( repFormatIdx ); 2999 3000 if ( encoder ) 3001 { 3002 assert( getChromaFormatIdc() == (ChromaFormat) repFormat->getChromaFormatVpsIdc() ); 3003 //// ToDo: add when supported: 3004 // assert( getSeperateColourPlaneFlag( repFormat->getSeparateColourPlaneVpsFlag() ) ; 3005 3006 assert( getPicWidthInLumaSamples() == repFormat->getPicWidthVpsInLumaSamples() ); 3007 assert( getPicHeightInLumaSamples() == repFormat->getPicHeightVpsInLumaSamples() ); 3008 3009 assert( getBitDepth ( CHANNEL_TYPE_LUMA ) == repFormat->getBitDepthVpsLumaMinus8() + 8 ); 3010 assert( getQpBDOffset ( CHANNEL_TYPE_LUMA ) == (Int) (6*( getBitDepth( CHANNEL_TYPE_LUMA ) - 8 )) ); 3011 3012 assert( getBitDepth ( CHANNEL_TYPE_CHROMA ) == repFormat->getBitDepthVpsChromaMinus8() + 8 ); 3013 assert( getQpBDOffset ( CHANNEL_TYPE_CHROMA ) == (Int) (6* ( getBitDepth( CHANNEL_TYPE_CHROMA ) -8 ) ) ); 3014 } 3015 else 3016 { 3017 setChromaFormatIdc( (ChromaFormat) repFormat->getChromaFormatVpsIdc() ); 3018 //// ToDo: add when supported: 3019 // setSeperateColourPlaneFlag( repFormat->getSeparateColourPlaneVpsFlag() ) ; 3020 3021 setPicWidthInLumaSamples ( repFormat->getPicWidthVpsInLumaSamples() ); 3022 setPicHeightInLumaSamples( repFormat->getPicHeightVpsInLumaSamples() ); 3023 3024 setBitDepth ( CHANNEL_TYPE_LUMA, repFormat->getBitDepthVpsLumaMinus8() + 8 ); 3025 setQpBDOffset ( CHANNEL_TYPE_LUMA, (Int) (6*( getBitDepth( CHANNEL_TYPE_LUMA ) - 8 )) ); 3026 3027 setBitDepth ( CHANNEL_TYPE_CHROMA, repFormat->getBitDepthVpsChromaMinus8() + 8 ); 3028 setQpBDOffset ( CHANNEL_TYPE_CHROMA, (Int) (6* ( getBitDepth( CHANNEL_TYPE_CHROMA ) -8 ) ) ); 3029 Window &spsConf = getConformanceWindow(); 3030 3031 // Scaled later 3032 spsConf.setScaledFlag( false ); 3033 spsConf.setWindowLeftOffset ( repFormat->getConfWinVpsLeftOffset() ); 3034 spsConf.setWindowRightOffset ( repFormat->getConfWinVpsRightOffset() ); 3035 spsConf.setWindowTopOffset ( repFormat->getConfWinVpsTopOffset() ); 3036 spsConf.setWindowBottomOffset( repFormat->getConfWinVpsBottomOffset() ); 3037 } 3221 3038 3222 3039 if ( getMultiLayerExtSpsFlag() && getUpdateRepFormatFlag() ) … … 3229 3046 assert( getPicHeightInLumaSamples() <= repFormat->getPicHeightVpsInLumaSamples() ); 3230 3047 3231 assert( getBitDepth Y()<= repFormat->getBitDepthVpsLumaMinus8() + 8 );3232 assert( getBitDepth C()<= repFormat->getBitDepthVpsChromaMinus8() + 8 );3048 assert( getBitDepth( CHANNEL_TYPE_LUMA ) <= repFormat->getBitDepthVpsLumaMinus8() + 8 ); 3049 assert( getBitDepth( CHANNEL_TYPE_CHROMA ) <= repFormat->getBitDepthVpsChromaMinus8() + 8 ); 3233 3050 } 3234 3051 } … … 3238 3055 getConformanceWindow().scaleOffsets( scal ); 3239 3056 getVuiParameters()->getDefaultDisplayWindow().scaleOffsets( scal ); 3240 } 3241 3242 Void TComSPS::inferScalingList( TComSPS* spsSrc ) 3057 3058 if (encoder && getMultiLayerExtSpsFlag() ) 3059 { 3060 Int repFormatIdx = getUpdateRepFormatFlag() ? getSpsRepFormatIdx() : vps->getVpsRepFormatIdx( vps->getLayerIdInVps( layerIdCurr ) ) ; 3061 const TComRepFormat* repFormat = vps->getRepFormat( repFormatIdx ); 3062 3063 Window &spsConf = getConformanceWindow(); 3064 assert( spsConf.getWindowLeftOffset () == repFormat->getConfWinVpsLeftOffset() ); 3065 assert( spsConf.getWindowRightOffset () == repFormat->getConfWinVpsRightOffset() ); 3066 assert( spsConf.getWindowTopOffset () == repFormat->getConfWinVpsTopOffset() ); 3067 assert( spsConf.getWindowBottomOffset() == repFormat->getConfWinVpsBottomOffset() ); 3068 } 3069 } 3070 3071 Void TComSPS::inferScalingList( const TComSPS* spsSrc ) 3243 3072 { 3244 3073 if ( getSpsInferScalingListFlag() ) … … 3246 3075 assert( spsSrc != NULL ); 3247 3076 assert( !spsSrc->getSpsInferScalingListFlag() ); 3248 getScalingList() ->inferFrom( spsSrc->getScalingList() );3077 getScalingList().inferFrom( (spsSrc->getScalingList()) ); 3249 3078 } 3250 3079 } … … 3294 3123 } 3295 3124 3296 Void TComSPS::checkRpsMaxNumPics( TComVPS* vps, Int currLayerId )3125 Void TComSPS::checkRpsMaxNumPics( const TComVPS* vps, Int currLayerId ) const 3297 3126 { 3298 3127 for (Int i = 0; i < getRPSList()->getNumberOfReferencePictureSets(); i++ ) 3299 3128 { 3300 TComReferencePictureSet* rps = getRPSList()->getReferencePictureSet( i );3129 const TComReferencePictureSet* rps = getRPSList()->getReferencePictureSet( i ); 3301 3130 if ( !rps->getInterRPSPrediction() ) 3302 3131 { … … 3327 3156 } 3328 3157 #endif 3158 3329 3159 3330 3160 TComReferencePictureSet::TComReferencePictureSet() … … 3333 3163 , m_numberOfPositivePictures (0) 3334 3164 , m_numberOfLongtermPictures (0) 3335 , m_interRPSPrediction (0) 3336 , m_deltaRIdxMinus1 (0) 3337 , m_deltaRPS (0) 3338 , m_numRefIdc (0) 3165 , m_interRPSPrediction (0) 3166 , m_deltaRIdxMinus1 (0) 3167 , m_deltaRPS (0) 3168 , m_numRefIdc (0) 3339 3169 { 3340 3170 ::memset( m_deltaPOC, 0, sizeof(m_deltaPOC) ); … … 3342 3172 ::memset( m_used, 0, sizeof(m_used) ); 3343 3173 ::memset( m_refIdc, 0, sizeof(m_refIdc) ); 3174 ::memset( m_bCheckLTMSB, 0, sizeof(m_bCheckLTMSB) ); 3175 ::memset( m_pocLSBLT, 0, sizeof(m_pocLSBLT) ); 3176 ::memset( m_deltaPOCMSBCycleLT, 0, sizeof(m_deltaPOCMSBCycleLT) ); 3177 ::memset( m_deltaPocMSBPresentFlag, 0, sizeof(m_deltaPocMSBPresentFlag) ); 3344 3178 } 3345 3179 … … 3363 3197 } 3364 3198 3365 Int TComReferencePictureSet::getUsed(Int bufferNum) 3199 Int TComReferencePictureSet::getUsed(Int bufferNum) const 3366 3200 { 3367 3201 return m_used[bufferNum]; 3368 3202 } 3369 3203 3370 Int TComReferencePictureSet::getDeltaPOC(Int bufferNum) 3204 Int TComReferencePictureSet::getDeltaPOC(Int bufferNum) const 3371 3205 { 3372 3206 return m_deltaPOC[bufferNum]; 3373 3207 } 3374 3208 3375 Int TComReferencePictureSet::getNumberOfPictures() 3209 Int TComReferencePictureSet::getNumberOfPictures() const 3376 3210 { 3377 3211 return m_numberOfPictures; 3378 3212 } 3379 3213 3380 Int TComReferencePictureSet::getPOC(Int bufferNum) 3214 Int TComReferencePictureSet::getPOC(Int bufferNum) const 3381 3215 { 3382 3216 return m_POC[bufferNum]; … … 3388 3222 } 3389 3223 3390 Bool TComReferencePictureSet::getCheckLTMSBPresent(Int bufferNum) 3224 Bool TComReferencePictureSet::getCheckLTMSBPresent(Int bufferNum) const 3391 3225 { 3392 3226 return m_bCheckLTMSB[bufferNum]; … … 3398 3232 } 3399 3233 3400 /** set the reference idc value at uiBufferNum entry to the value of iRefIdc 3401 * \param uiBufferNum 3402 * \param iRefIdc 3403 * \returns Void 3404 */ 3234 //! set the reference idc value at uiBufferNum entry to the value of iRefIdc 3405 3235 Void TComReferencePictureSet::setRefIdc(Int bufferNum, Int refIdc) 3406 3236 { … … 3408 3238 } 3409 3239 3410 /** get the reference idc value at uiBufferNum 3411 * \param uiBufferNum 3412 * \returns Int 3413 */ 3414 Int TComReferencePictureSet::getRefIdc(Int bufferNum) 3240 //! get the reference idc value at uiBufferNum 3241 Int TComReferencePictureSet::getRefIdc(Int bufferNum) const 3415 3242 { 3416 3243 return m_refIdc[bufferNum]; … … 3426 3253 // sort in increasing order (smallest first) 3427 3254 for(Int j=1; j < getNumberOfPictures(); j++) 3428 { 3255 { 3429 3256 Int deltaPOC = getDeltaPOC(j); 3430 3257 Bool used = getUsed(j); … … 3444 3271 Int numNegPics = getNumberOfNegativePictures(); 3445 3272 for(Int j=0, k=numNegPics-1; j < numNegPics>>1; j++, k--) 3446 { 3273 { 3447 3274 Int deltaPOC = getDeltaPOC(j); 3448 3275 Bool used = getUsed(j); … … 3458 3285 * \returns Void 3459 3286 */ 3460 Void TComReferencePictureSet::printDeltaPOC() 3287 Void TComReferencePictureSet::printDeltaPOC() const 3461 3288 { 3462 3289 printf("DeltaPOC = { "); … … 3464 3291 { 3465 3292 printf("%d%s ", getDeltaPOC(j), (getUsed(j)==1)?"*":""); 3466 } 3467 if (getInterRPSPrediction()) 3293 } 3294 if (getInterRPSPrediction()) 3468 3295 { 3469 3296 printf("}, RefIdc = { "); … … 3471 3298 { 3472 3299 printf("%d ", getRefIdc(j)); 3473 } 3300 } 3474 3301 } 3475 3302 printf("}\n"); 3476 3303 } 3477 #if H_MV 3478 Void TComReferencePictureSet::checkMaxNumPics( Bool vpsExtensionFlag, Int maxNumPics, Int nuhLayerId, Int spsMaxDecPicBufferingMinus1 ) 3304 3305 #if NH_MV 3306 Void TComReferencePictureSet::checkMaxNumPics( Bool vpsExtensionFlag, Int maxNumPics, Int nuhLayerId, Int spsMaxDecPicBufferingMinus1 ) const 3479 3307 { 3480 3308 assert( getNumberOfPictures() >= 0 ); … … 3491 3319 #endif 3492 3320 3493 TComRPSList::TComRPSList() 3494 :m_referencePictureSets (NULL) 3495 { 3496 } 3497 3498 TComRPSList::~TComRPSList() 3499 { 3500 } 3501 3502 Void TComRPSList::create( Int numberOfReferencePictureSets) 3503 { 3504 m_numberOfReferencePictureSets = numberOfReferencePictureSets; 3505 m_referencePictureSets = new TComReferencePictureSet[numberOfReferencePictureSets]; 3506 } 3507 3508 Void TComRPSList::destroy() 3509 { 3510 if (m_referencePictureSets) 3511 { 3512 delete [] m_referencePictureSets; 3513 } 3514 m_numberOfReferencePictureSets = 0; 3515 m_referencePictureSets = NULL; 3516 } 3517 3518 3519 3520 TComReferencePictureSet* TComRPSList::getReferencePictureSet(Int referencePictureSetNum) 3521 { 3522 return &m_referencePictureSets[referencePictureSetNum]; 3523 } 3524 3525 Int TComRPSList::getNumberOfReferencePictureSets() 3526 { 3527 return m_numberOfReferencePictureSets; 3528 } 3529 3530 Void TComRPSList::setNumberOfReferencePictureSets(Int numberOfReferencePictureSets) 3531 { 3532 m_numberOfReferencePictureSets = numberOfReferencePictureSets; 3533 } 3321 3322 3534 3323 3535 3324 TComRefPicListModification::TComRefPicListModification() 3536 : m_ bRefPicListModificationFlagL0 (false)3537 , m_ bRefPicListModificationFlagL1 (false)3325 : m_refPicListModificationFlagL0 (false) 3326 , m_refPicListModificationFlagL1 (false) 3538 3327 { 3539 3328 ::memset( m_RefPicSetIdxL0, 0, sizeof(m_RefPicSetIdxL0) ); … … 3547 3336 TComScalingList::TComScalingList() 3548 3337 { 3549 init(); 3550 } 3551 TComScalingList::~TComScalingList() 3552 { 3553 destroy(); 3338 for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 3339 { 3340 for(UInt listId = 0; listId < SCALING_LIST_NUM; listId++) 3341 { 3342 m_scalingListCoef[sizeId][listId].resize(min<Int>(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); 3343 } 3344 } 3554 3345 } 3555 3346 3556 3347 /** set default quantization matrix to array 3557 3348 */ 3558 Void TComS lice::setDefaultScalingList()3349 Void TComScalingList::setDefaultScalingList() 3559 3350 { 3560 3351 for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 3561 3352 { 3562 for(UInt listId=0;listId< g_scalingListNum[sizeId];listId++)3563 { 3564 getScalingList()->processDefaultMatrix(sizeId, listId);3353 for(UInt listId=0;listId<SCALING_LIST_NUM;listId++) 3354 { 3355 processDefaultMatrix(sizeId, listId); 3565 3356 } 3566 3357 } … … 3569 3360 * \returns true if use default quantization matrix in all size 3570 3361 */ 3571 Bool TComS lice::checkDefaultScalingList()3362 Bool TComScalingList::checkDefaultScalingList() 3572 3363 { 3573 3364 UInt defaultCounter=0; … … 3575 3366 for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 3576 3367 { 3577 for(UInt listId=0;listId< g_scalingListNum[sizeId];listId++)3578 { 3579 if( !memcmp(getScalingList ()->getScalingListAddress(sizeId,listId), getScalingList()->getScalingListDefaultAddress(sizeId, listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix3580 && ((sizeId < SCALING_LIST_16x16) || (getScalingList ()->getScalingListDC(sizeId,listId) == 16))) // check DC value3368 for(UInt listId=0;listId<SCALING_LIST_NUM;listId++) 3369 { 3370 if( !memcmp(getScalingListAddress(sizeId,listId), getScalingListDefaultAddress(sizeId, listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix 3371 && ((sizeId < SCALING_LIST_16x16) || (getScalingListDC(sizeId,listId) == 16))) // check DC value 3581 3372 { 3582 3373 defaultCounter++; … … 3584 3375 } 3585 3376 } 3586 return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? false : true; // -4 for 32x32 3587 } 3588 3589 #if H_MV 3377 3378 return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM )) ? false : true; 3379 } 3380 3381 #if NH_MV 3590 3382 Void TComSlice::createInterLayerReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1 ) 3591 3383 { … … 3665 3457 } 3666 3458 3667 TComPic* TComSlice::getPicFromRefPicSetInterLayer(Int setIdc, Int layerId ) 3459 TComPic* TComSlice::getPicFromRefPicSetInterLayer(Int setIdc, Int layerId ) const 3668 3460 { 3669 3461 assert ( setIdc == 0 || setIdc == 1); … … 3685 3477 3686 3478 3687 Int TComSlice::getRefLayerPicFlag( Int i ) 3688 { 3689 TComVPS* vps = getVPS();3690 #if H_3D3479 Int TComSlice::getRefLayerPicFlag( Int i ) const 3480 { 3481 const TComVPS* vps = getVPS(); 3482 #if NH_3D 3691 3483 Int refLayerIdx = vps->getLayerIdInVps( vps->getIdRefListLayer( getLayerId(), i ) ); 3692 3484 #else … … 3699 3491 } 3700 3492 3701 Int TComSlice::getRefLayerPicIdc( Int j ) 3493 Int TComSlice::getRefLayerPicIdc( Int j ) const 3702 3494 { 3703 3495 Int refLayerPicIdc = -1; 3704 3496 Int curj = 0; 3705 #if H_3D3497 #if NH_3D 3706 3498 for( Int i = 0; i < getVPS()->getNumRefListLayers( getLayerId()) ; i++ ) 3707 3499 #else … … 3725 3517 } 3726 3518 3727 Int TComSlice::getNumRefLayerPics( ) 3519 Int TComSlice::getNumRefLayerPics( ) const 3728 3520 { 3729 3521 Int numRefLayerPics = 0; 3730 #if H_3D3522 #if NH_3D 3731 3523 for( Int i = 0; i < getVPS()->getNumRefListLayers( getLayerId()) ; i++ ) 3732 3524 #else … … 3741 3533 3742 3534 3743 Int TComSlice::getNumActiveRefLayerPics() 3535 Int TComSlice::getNumActiveRefLayerPics() const 3744 3536 { 3745 3537 Int numActiveRefLayerPics; … … 3757 3549 numActiveRefLayerPics = 0; 3758 3550 } 3759 #if H_3D3551 #if NH_3D 3760 3552 else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumRefListLayers( getLayerId() ) == 1 ) 3761 3553 #else … … 3772 3564 } 3773 3565 3774 Int TComSlice::getRefPicLayerId( Int i ) 3775 { 3776 #if H_3D3566 Int TComSlice::getRefPicLayerId( Int i ) const 3567 { 3568 #if NH_3D 3777 3569 return getVPS()->getIdRefListLayer( getLayerId(), getInterLayerPredLayerIdc( i ) ); 3778 3570 #else … … 3780 3572 #endif 3781 3573 } 3782 #if H_3D3783 Void TComSlice::setDefaultRefView( 3784 { 3785 setDefaultRefViewIdx( -1);3786 setDefaultRefViewIdxAvailableFlag( false);3574 #if NH_3D_NBDV 3575 Void TComSlice::setDefaultRefView() 3576 { 3577 setDefaultRefViewIdx(-1); 3578 setDefaultRefViewIdxAvailableFlag(false); 3787 3579 3788 3580 Int valid = 0; 3789 3581 Int DefaultRefViewIdx = -1; 3790 for( UInt curViewIdx = 0; curViewIdx < getViewIndex() && valid == 0; curViewIdx++ ) 3791 { 3792 for( Int iRefListId = 0; ( iRefListId < (isInterB() ? 2 : 1) ) && !isIntra() && valid == 0; iRefListId++ ) 3793 { 3794 RefPicList eRefPicList = RefPicList( iRefListId ); 3795 Int iNumRefPics = getNumRefIdx( eRefPicList ); 3796 for( Int i = 0; i < iNumRefPics; i++ ) 3582 3583 for(UInt curViewIdx = 0; curViewIdx < getViewIndex() && valid == 0; curViewIdx++) 3584 { 3585 for(Int iRefListId = 0; (iRefListId < (isInterB() ? 2 : 1)) && !isIntra() && valid == 0; iRefListId++) 3586 { 3587 RefPicList eRefPicList = RefPicList(iRefListId); 3588 Int iNumRefPics = getNumRefIdx(eRefPicList); 3589 3590 for(Int i = 0; i < iNumRefPics; i++) 3797 3591 { 3798 if(getPOC() == getRefPic( eRefPicList, i )->getPOC() && curViewIdx == getRefPic( eRefPicList, i)->getViewIndex())3592 if(getPOC() == getRefPic(eRefPicList, i)->getPOC() && curViewIdx == getRefPic(eRefPicList, i)->getViewIndex()) 3799 3593 { 3800 3594 valid = 1; … … 3805 3599 } 3806 3600 } 3807 if( valid ) 3808 { 3809 setDefaultRefViewIdx( DefaultRefViewIdx ); 3810 setDefaultRefViewIdxAvailableFlag( true ); 3811 } 3812 } 3813 #endif 3814 3815 #if H_3D_ARP 3601 3602 if(valid) 3603 { 3604 setDefaultRefViewIdx(DefaultRefViewIdx); 3605 setDefaultRefViewIdxAvailableFlag(true); 3606 } 3607 } 3608 #endif 3609 3610 #if NH_3D_ARP 3816 3611 Void TComSlice::setARPStepNum( TComPicLists*ivPicLists ) 3817 3612 { … … 3861 3656 TComPic* picV = getIvPic( getIsDepth(), getVPS()->getViewIndex( layerIdInNuh ) ); 3862 3657 assert( picV != NULL ); 3863 std::vector<Int>pocsInCurrRPSsPicV = picV->getSlice(0)->getPocsInCurrRPSs();3658 IntAry1d pocsInCurrRPSsPicV = picV->getSlice(0)->getPocsInCurrRPSs(); 3864 3659 Bool refRpRefAvailFlag = false; 3865 3660 for (Int idx = 0; idx < pocsInCurrRPSsPicV.size(); idx++) … … 3883 3678 } 3884 3679 } 3885 } 3886 #endif 3887 3888 #if H_3D_IC 3680 if( m_nARPStepNum > 1) 3681 { 3682 for(Int i = 0; i < getNumActiveRefLayerPics(); i ++ ) 3683 { 3684 Int iLayerId = getRefPicLayerId( i ); 3685 Int iViewIdx = getVPS()->getViewIndex(iLayerId); 3686 Bool bIsDepth = ( getVPS()->getDepthId ( iLayerId ) == 1 ); 3687 if( iViewIdx<getViewIndex() && !bIsDepth ) 3688 { 3689 setBaseViewRefPicList( ivPicLists->getPicList( iLayerId ), iViewIdx ); 3690 } 3691 } 3692 } 3693 } 3694 #endif 3695 3696 #if NH_3D_IC 3889 3697 // This is an encoder only function and should be moved to TEncSlice or TEncSearch!! 3890 3698 Void TComSlice::xSetApplyIC(Bool bUseLowLatencyICEnc) … … 3975 3783 { 3976 3784 // Histogram building - luminance 3977 Int iMaxPelValue = ( 1 << g _bitDepthY);3785 Int iMaxPelValue = ( 1 << getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) ); 3978 3786 Int *aiRefOrgHist = (Int *) xMalloc( Int,iMaxPelValue ); 3979 3787 Int *aiCurrHist = (Int *) xMalloc( Int,iMaxPelValue ); … … 3981 3789 memset( aiCurrHist, 0, iMaxPelValue*sizeof(Int) ); 3982 3790 3983 Int iWidth = pcCurrPicYuv->getWidth(); 3984 Int iHeight = pcCurrPicYuv->getHeight(); 3985 3986 Pel* pCurrY = pcCurrPicYuv ->getLumaAddr(); 3987 Pel* pRefOrgY = pcRefPicYuvOrg ->getLumaAddr(); 3988 Int iCurrStride = pcCurrPicYuv->getStride(); 3989 Int iRefStride = pcRefPicYuvOrg->getStride(); 3990 3791 Int iWidth = pcCurrPicYuv->getWidth(COMPONENT_Y); 3792 Int iHeight = pcCurrPicYuv->getHeight(COMPONENT_Y); 3793 Pel* pCurrY = pcCurrPicYuv->getAddr(COMPONENT_Y); 3794 Pel* pRefOrgY = pcRefPicYuvOrg->getAddr(COMPONENT_Y); 3795 Int iCurrStride = pcCurrPicYuv->getStride(COMPONENT_Y); 3796 Int iRefStride = pcRefPicYuvOrg->getStride(COMPONENT_Y); 3991 3797 for ( Int y = 0; y < iHeight; y++ ) 3992 3798 { … … 4025 3831 } 4026 3832 #endif 4027 #if H_3D3833 #if NH_3D 4028 3834 Void TComSlice::setIvPicLists( TComPicLists* m_ivPicLists ) 4029 3835 { … … 4042 3848 setupLUT = setupLUT || getViewSynthesisPredFlag( ); 4043 3849 4044 #if H_3D_NBDV_REF3850 #if NH_3D_NBDV_REF 4045 3851 setupLUT = setupLUT || getDepthRefinementFlag( ); 4046 3852 #endif 4047 3853 4048 #if H_3D_IV_MERGE3854 #if NH_3D_IV_MERGE 4049 3855 setupLUT = setupLUT || ( getIvMvPredFlag() && getIsDepth() ); 4050 3856 #endif 4051 3857 3858 Int bitDepthY = getSPS()->getBitDepth(CHANNEL_TYPE_LUMA); 4052 3859 4053 3860 if( !setupLUT ) 3861 { 4054 3862 return; 3863 } 4055 3864 4056 3865 m_numViews = getVPS()->getNumViews(); … … 4061 3870 for ( Int i = 0; i < getVPS()->getNumViews(); i++ ) 4062 3871 { 4063 m_depthToDisparityB[ i ] = new Int[ Int(1 << g_bitDepthY) ];3872 m_depthToDisparityB[ i ] = new Int[ Int(1 << bitDepthY) ]; 4064 3873 } 4065 3874 } … … 4071 3880 for ( Int i = 0; i < m_numViews; i++ ) 4072 3881 { 4073 m_depthToDisparityF[ i ] = new Int[ Int(1 << g_bitDepthY) ];3882 m_depthToDisparityF[ i ] = new Int[ Int(1 << bitDepthY) ]; 4074 3883 } 4075 3884 } … … 4078 3887 assert( m_depthToDisparityF != NULL ); 4079 3888 4080 TComVPS* vps = getVPS();4081 4082 Int log2Div = g_bitDepthY - 1 + vps->getCpPrecision();3889 const TComVPS* vps = getVPS(); 3890 3891 Int log2Div = bitDepthY - 1 + vps->getCpPrecision(); 4083 3892 Int voiInVps = vps->getVoiInVps( getViewIndex() ); 4084 3893 Bool camParaSH = vps->getCpInSliceSegmentHeaderFlag( voiInVps ); 4085 3894 4086 Int*codScale = camParaSH ? m_aaiCodedScale [ 0 ] : vps->getCodedScale ( voiInVps );4087 Int*codOffset = camParaSH ? m_aaiCodedOffset[ 0 ] : vps->getCodedOffset ( voiInVps );4088 Int*invCodScale = camParaSH ? m_aaiCodedScale [ 1 ] : vps->getInvCodedScale ( voiInVps );4089 Int*invCodOffset = camParaSH ? m_aaiCodedOffset[ 1 ] : vps->getInvCodedOffset( voiInVps );3895 const IntAry1d codScale = camParaSH ? m_aaiCodedScale [ 0 ] : vps->getCodedScale ( voiInVps ); 3896 const IntAry1d codOffset = camParaSH ? m_aaiCodedOffset[ 0 ] : vps->getCodedOffset ( voiInVps ); 3897 const IntAry1d invCodScale = camParaSH ? m_aaiCodedScale [ 1 ] : vps->getInvCodedScale ( voiInVps ); 3898 const IntAry1d invCodOffset = camParaSH ? m_aaiCodedOffset[ 1 ] : vps->getInvCodedOffset( voiInVps ); 4090 3899 4091 3900 … … 4096 3905 if ( g_traceCameraParameters ) 4097 3906 { 4098 std::cout << std::endl <<"Cp: " << codScale [ iInVoi ] << " " << codOffset[ iInVoi ] << " "4099 << invCodScale[ iInVoi ] << " " << invCodOffset[ iInVoi ] << " " << log2Div ;4100 } 4101 #endif 4102 for ( Int d = 0; d <= ( ( 1 << g_bitDepthY ) - 1 ); d++ )3907 std::cout << "Cp: " << codScale [ iInVoi ] << " " << codOffset[ iInVoi ] << " " 3908 << invCodScale[ iInVoi ] << " " << invCodOffset[ iInVoi ] << " " << log2Div << std::endl ; 3909 } 3910 #endif 3911 for ( Int d = 0; d <= ( ( 1 << bitDepthY ) - 1 ); d++ ) 4103 3912 { 4104 Int offset = ( codOffset [ iInVoi ] << g_bitDepthY ) + ( ( 1 << log2Div ) >> 1 );3913 Int offset = ( codOffset [ iInVoi ] << bitDepthY ) + ( ( 1 << log2Div ) >> 1 ); 4105 3914 m_depthToDisparityB[ iInVoi ][ d ] = ( codScale [ iInVoi ] * d + offset ) >> log2Div; 4106 3915 4107 Int invOffset = ( invCodOffset[ iInVoi ] << g_bitDepthY ) + ( ( 1 << log2Div ) >> 1 );3916 Int invOffset = ( invCodOffset[ iInVoi ] << bitDepthY ) + ( ( 1 << log2Div ) >> 1 ); 4108 3917 m_depthToDisparityF[ iInVoi ][ d ] = ( invCodScale[ iInVoi ] * d + invOffset ) >> log2Div; 4109 3918 } … … 4114 3923 4115 3924 4116 #if H_MV4117 Void TComSlice::checkCrossLayerBlaFlag() 3925 #if NH_MV 3926 Void TComSlice::checkCrossLayerBlaFlag() const 4118 3927 { 4119 3928 // 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. … … 4147 3956 4148 3957 4149 #if H_3D3958 #if NH_3D 4150 3959 Void TComSlice::init3dToolParameters() 4151 3960 { … … 4154 3963 Bool nRLLG0 = ( getVPS()->getNumRefListLayers( getLayerId() ) > 0 ); 4155 3964 4156 TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension();3965 const TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension(); 4157 3966 4158 3967 m_ivMvPredFlag = sps3dExt->getIvMvPredFlag ( depthFlag ) && nRLLG0 ; … … 4197 4006 } 4198 4007 4199 Void TComSlice::deriveInCmpPredAndCpAvailFlag( )4008 Void TComSlice::deriveInCmpPredAndCpAvailFlag( ) 4200 4009 { 4201 4010 Int numCurCmpLIds = getIsDepth() ? 1 : getNumActiveRefLayerPics(); … … 4248 4057 else 4249 4058 { 4250 TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension();4059 const TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension(); 4251 4060 if( !getIsDepth() ) 4252 4061 { … … 4280 4089 #endif 4281 4090 4282 4283 4091 /** get scaling matrix from RefMatrixID 4284 * \param sizeId size index4285 * \param Index of input matrix4286 * \param Index of reference matrix4092 * \param sizeId size index 4093 * \param listId index of input matrix 4094 * \param refListId index of reference matrix 4287 4095 */ 4288 4096 Void TComScalingList::processRefMatrix( UInt sizeId, UInt listId , UInt refListId ) … … 4291 4099 } 4292 4100 4293 /** parse syntax infomation 4294 * \param pchFile syntax infomation 4295 * \returns false if successful 4296 */ 4101 Void TComScalingList::checkPredMode(UInt sizeId, UInt listId) 4102 { 4103 Int predListStep = (sizeId == SCALING_LIST_32x32? (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) : 1); // if 32x32, skip over chroma entries. 4104 4105 for(Int predListIdx = (Int)listId ; predListIdx >= 0; predListIdx-=predListStep) 4106 { 4107 if( !memcmp(getScalingListAddress(sizeId,listId),((listId == predListIdx) ? 4108 getScalingListDefaultAddress(sizeId, predListIdx): getScalingListAddress(sizeId, predListIdx)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix 4109 && ((sizeId < SCALING_LIST_16x16) || (getScalingListDC(sizeId,listId) == getScalingListDC(sizeId,predListIdx)))) // check DC value 4110 { 4111 setRefMatrixId(sizeId, listId, predListIdx); 4112 setScalingListPredModeFlag(sizeId, listId, false); 4113 return; 4114 } 4115 } 4116 setScalingListPredModeFlag(sizeId, listId, true); 4117 } 4118 4119 static Void outputScalingListHelp(std::ostream &os) 4120 { 4121 os << "The scaling list file specifies all matrices and their DC values; none can be missing,\n" 4122 "but their order is arbitrary.\n\n" 4123 "The matrices are specified by:\n" 4124 "<matrix name><unchecked data>\n" 4125 " <value>,<value>,<value>,....\n\n" 4126 " Line-feeds can be added arbitrarily between values, and the number of values needs to be\n" 4127 " at least the number of entries for the matrix (superfluous entries are ignored).\n" 4128 " The <unchecked data> is text on the same line as the matrix that is not checked\n" 4129 " except to ensure that the matrix name token is unique. It is recommended that it is ' ='\n" 4130 " The values in the matrices are the absolute values (0-255), not the delta values as\n" 4131 " exchanged between the encoder and decoder\n\n" 4132 "The DC values (for matrix sizes larger than 8x8) are specified by:\n" 4133 "<matrix name>_DC<unchecked data>\n" 4134 " <value>\n"; 4135 4136 os << "The permitted matrix names are:\n"; 4137 for(UInt sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) 4138 { 4139 for(UInt listIdc = 0; listIdc < SCALING_LIST_NUM; listIdc++) 4140 { 4141 if ((sizeIdc!=SCALING_LIST_32x32) || (listIdc%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) == 0)) 4142 { 4143 os << " " << MatrixType[sizeIdc][listIdc] << '\n'; 4144 } 4145 } 4146 } 4147 } 4148 4149 Void TComScalingList::outputScalingLists(std::ostream &os) const 4150 { 4151 for(UInt sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) 4152 { 4153 const UInt size = min(8,4<<(sizeIdc)); 4154 for(UInt listIdc = 0; listIdc < SCALING_LIST_NUM; listIdc++) 4155 { 4156 if ((sizeIdc!=SCALING_LIST_32x32) || (listIdc%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) == 0)) 4157 { 4158 const Int *src = getScalingListAddress(sizeIdc, listIdc); 4159 os << (MatrixType[sizeIdc][listIdc]) << " =\n "; 4160 for(UInt y=0; y<size; y++) 4161 { 4162 for(UInt x=0; x<size; x++, src++) 4163 { 4164 os << std::setw(3) << (*src) << ", "; 4165 } 4166 os << (y+1<size?"\n ":"\n"); 4167 } 4168 if(sizeIdc > SCALING_LIST_8x8) 4169 { 4170 os << MatrixType_DC[sizeIdc][listIdc] << " = \n " << std::setw(3) << getScalingListDC(sizeIdc, listIdc) << "\n"; 4171 } 4172 os << "\n"; 4173 } 4174 } 4175 } 4176 } 4177 4297 4178 Bool TComScalingList::xParseScalingList(Char* pchFile) 4298 4179 { 4299 FILE *fp;4300 Char line[1024];4301 UInt sizeIdc,listIdc;4302 UInt i,size = 0; 4303 Int *src=0,data;4304 Char *ret;4305 UInt retval;4306 4307 if((fp = fopen(pchFile,"r")) == (FILE*)NULL)4308 {4309 printf("can't open file %s :: set Default Matrix\n",pchFile);4180 static const Int LINE_SIZE=1024; 4181 FILE *fp = NULL; 4182 Char line[LINE_SIZE]; 4183 4184 if (pchFile == NULL) 4185 { 4186 fprintf(stderr, "Error: no scaling list file specified. Help on scaling lists being output\n"); 4187 outputScalingListHelp(std::cout); 4188 std::cout << "\n\nExample scaling list file using default values:\n\n"; 4189 outputScalingLists(std::cout); 4190 exit (1); 4310 4191 return true; 4311 4192 } 4312 4313 for(sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) 4314 { 4315 size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeIdc]); 4316 for(listIdc = 0; listIdc < g_scalingListNum[sizeIdc]; listIdc++) 4317 { 4318 src = getScalingListAddress(sizeIdc, listIdc); 4319 4320 fseek(fp,0,0); 4321 do 4322 { 4323 ret = fgets(line, 1024, fp); 4324 if ((ret==NULL)||(strstr(line, MatrixType[sizeIdc][listIdc])==NULL && feof(fp))) 4325 { 4326 printf("Error: can't read Matrix :: set Default Matrix\n"); 4327 return true; 4328 } 4329 } 4330 while (strstr(line, MatrixType[sizeIdc][listIdc]) == NULL); 4331 for (i=0; i<size; i++) 4332 { 4333 retval = fscanf(fp, "%d,", &data); 4334 if (retval!=1) 4335 { 4336 printf("Error: can't read Matrix :: set Default Matrix\n"); 4337 return true; 4338 } 4339 src[i] = data; 4340 } 4341 //set DC value for default matrix check 4342 setScalingListDC(sizeIdc,listIdc,src[0]); 4343 4344 if(sizeIdc > SCALING_LIST_8x8) 4345 { 4346 fseek(fp,0,0); 4347 do 4348 { 4349 ret = fgets(line, 1024, fp); 4350 if ((ret==NULL)||(strstr(line, MatrixType_DC[sizeIdc][listIdc])==NULL && feof(fp))) 4193 else if ((fp = fopen(pchFile,"r")) == (FILE*)NULL) 4194 { 4195 fprintf(stderr, "Error: cannot open scaling list file %s for reading\n",pchFile); 4196 return true; 4197 } 4198 4199 for(UInt sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) 4200 { 4201 const UInt size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeIdc]); 4202 4203 for(UInt listIdc = 0; listIdc < SCALING_LIST_NUM; listIdc++) 4204 { 4205 Int * const src = getScalingListAddress(sizeIdc, listIdc); 4206 4207 if ((sizeIdc==SCALING_LIST_32x32) && (listIdc%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) != 0)) // derive chroma32x32 from chroma16x16 4208 { 4209 const Int *srcNextSmallerSize = getScalingListAddress(sizeIdc-1, listIdc); 4210 for(UInt i=0; i<size; i++) 4211 { 4212 src[i] = srcNextSmallerSize[i]; 4213 } 4214 setScalingListDC(sizeIdc,listIdc,(sizeIdc > SCALING_LIST_8x8) ? getScalingListDC(sizeIdc-1, listIdc) : src[0]); 4215 } 4216 else 4217 { 4218 { 4219 fseek(fp, 0, SEEK_SET); 4220 Bool bFound=false; 4221 while ((!feof(fp)) && (!bFound)) 4351 4222 { 4352 printf("Error: can't read DC :: set Default Matrix\n"); 4223 Char *ret = fgets(line, LINE_SIZE, fp); 4224 Char *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType[sizeIdc][listIdc]); 4225 // This could be a match against the DC string as well, so verify it isn't 4226 if (findNamePosition!= NULL && (MatrixType_DC[sizeIdc][listIdc]==NULL || strstr(line, MatrixType_DC[sizeIdc][listIdc])==NULL)) 4227 { 4228 bFound=true; 4229 } 4230 } 4231 if (!bFound) 4232 { 4233 fprintf(stderr, "Error: cannot find Matrix %s from scaling list file %s\n", MatrixType[sizeIdc][listIdc], pchFile); 4353 4234 return true; 4354 4235 } 4355 4236 } 4356 while (strstr(line, MatrixType_DC[sizeIdc][listIdc]) == NULL); 4357 retval = fscanf(fp, "%d,", &data); 4358 if (retval!=1) 4359 { 4360 printf("Error: can't read Matrix :: set Default Matrix\n"); 4361 return true; 4362 } 4363 //overwrite DC value when size of matrix is larger than 16x16 4364 setScalingListDC(sizeIdc,listIdc,data); 4365 } 4366 } 4367 } 4237 for (UInt i=0; i<size; i++) 4238 { 4239 Int data; 4240 if (fscanf(fp, "%d,", &data)!=1) 4241 { 4242 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)); 4243 return true; 4244 } 4245 if (data<0 || data>255) 4246 { 4247 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)); 4248 return true; 4249 } 4250 src[i] = data; 4251 } 4252 4253 //set DC value for default matrix check 4254 setScalingListDC(sizeIdc,listIdc,src[0]); 4255 4256 if(sizeIdc > SCALING_LIST_8x8) 4257 { 4258 { 4259 fseek(fp, 0, SEEK_SET); 4260 Bool bFound=false; 4261 while ((!feof(fp)) && (!bFound)) 4262 { 4263 Char *ret = fgets(line, LINE_SIZE, fp); 4264 Char *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType_DC[sizeIdc][listIdc]); 4265 if (findNamePosition!= NULL) 4266 { 4267 // This won't be a match against the non-DC string. 4268 bFound=true; 4269 } 4270 } 4271 if (!bFound) 4272 { 4273 fprintf(stderr, "Error: cannot find DC Matrix %s from scaling list file %s\n", MatrixType_DC[sizeIdc][listIdc], pchFile); 4274 return true; 4275 } 4276 } 4277 Int data; 4278 if (fscanf(fp, "%d,", &data)!=1) 4279 { 4280 fprintf(stderr, "Error: cannot read DC %s from scaling list file %s at file position %ld\n", MatrixType_DC[sizeIdc][listIdc], pchFile, ftell(fp)); 4281 return true; 4282 } 4283 if (data<0 || data>255) 4284 { 4285 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)); 4286 return true; 4287 } 4288 //overwrite DC value when size of matrix is larger than 16x16 4289 setScalingListDC(sizeIdc,listIdc,data); 4290 } 4291 } 4292 } 4293 } 4294 // std::cout << "\n\nRead scaling lists of:\n\n"; 4295 // outputScalingLists(std::cout); 4296 4368 4297 fclose(fp); 4369 4298 return false; 4370 4299 } 4371 4300 4372 #if H_MV4373 Void TComScalingList::inferFrom( TComScalingList*srcScLi )4301 #if NH_MV 4302 Void TComScalingList::inferFrom( const TComScalingList& srcScLi ) 4374 4303 { 4375 4304 for(Int sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 4376 4305 { 4377 for(Int listId = 0; listId < g_scalingListNum[sizeId]; listId++) 4378 { 4379 setRefMatrixId (sizeId,listId, srcScLi->getRefMatrixId (sizeId,listId)); 4380 setScalingListDC(sizeId,listId, srcScLi->getScalingListDC(sizeId,listId)); 4381 ::memcpy(getScalingListAddress(sizeId, listId),srcScLi->getScalingListAddress(sizeId, listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); 4382 } 4383 } 4384 } 4385 #endif 4386 /** initialization process of quantization matrix array 4387 */ 4388 Void TComScalingList::init() 4389 { 4390 for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 4391 { 4392 for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) 4393 { 4394 m_scalingListCoef[sizeId][listId] = new Int [min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])]; 4395 } 4396 } 4397 m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32 4398 } 4399 4400 /** destroy quantization matrix array 4401 */ 4402 Void TComScalingList::destroy() 4403 { 4404 for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 4405 { 4406 for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) 4407 { 4408 if(m_scalingListCoef[sizeId][listId]) delete [] m_scalingListCoef[sizeId][listId]; 4409 } 4410 } 4411 } 4412 4413 /** get default address of quantization matrix 4306 for(Int listId = 0; listId < SCALING_LIST_NUM; listId++) 4307 { 4308 setRefMatrixId (sizeId,listId, srcScLi.getRefMatrixId (sizeId,listId)); 4309 setScalingListDC(sizeId,listId, srcScLi.getScalingListDC(sizeId,listId)); 4310 ::memcpy(getScalingListAddress(sizeId, listId),srcScLi.getScalingListAddress(sizeId, listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); 4311 } 4312 } 4313 } 4314 #endif 4315 4316 4317 /** get default address of quantization matrix 4414 4318 * \param sizeId size index 4415 4319 * \param listId list index 4416 4320 * \returns pointer of quantization matrix 4417 4321 */ 4418 Int* TComScalingList::getScalingListDefaultAddress(UInt sizeId, UInt listId)4419 { 4420 Int *src = 0;4322 const Int* TComScalingList::getScalingListDefaultAddress(UInt sizeId, UInt listId) 4323 { 4324 const Int *src = 0; 4421 4325 switch(sizeId) 4422 4326 { … … 4425 4329 break; 4426 4330 case SCALING_LIST_8x8: 4427 src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8;4428 break;4429 4331 case SCALING_LIST_16x16: 4430 src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8;4431 break;4432 4332 case SCALING_LIST_32x32: 4433 src = (listId <1) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8;4333 src = (listId < (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) ) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; 4434 4334 break; 4435 4335 default: … … 4443 4343 /** process of default matrix 4444 4344 * \param sizeId size index 4445 * \param Index of input matrix4345 * \param listId index of input matrix 4446 4346 */ 4447 4347 Void TComScalingList::processDefaultMatrix(UInt sizeId, UInt listId) … … 4457 4357 for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 4458 4358 { 4459 for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++)4359 for(UInt listId = 0; listId < SCALING_LIST_NUM; listId++) 4460 4360 { 4461 4361 //check default matrix? … … 4473 4373 , m_ppsMap(MAX_NUM_PPS) 4474 4374 , m_activeVPSId(-1) 4475 #if ! H_MV4375 #if !NH_MV 4476 4376 , m_activeSPSId(-1) 4477 , m_activePPSId(-1) 4478 { 4479 #else 4480 { 4377 #endif 4378 { 4379 #if NH_MV 4481 4380 for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) 4482 { 4483 m_activeSPSId[ i ] = -1; 4484 m_activePPSId[ i ] = -1; 4381 { 4382 m_activeSPSId[i] = -1; 4485 4383 } 4486 4384 #endif … … 4494 4392 //! activate a SPS from a active parameter sets SEI message 4495 4393 //! \returns true, if activation is successful 4496 #if H_MV4497 Bool ParameterSetManager::activateSPSWithSEI(Int spsId, Int layerId )4394 #if NH_MV 4395 //Bool ParameterSetManager::activateSPSWithSEI(Int spsId, Int layerId ) 4498 4396 #else 4499 Bool ParameterSetManager::activateSPSWithSEI(Int spsId) 4500 #endif 4501 { 4502 TComSPS *sps = m_spsMap.getPS(spsId); 4503 if (sps) 4504 { 4505 Int vpsId = sps->getVPSId(); 4506 if (m_vpsMap.getPS(vpsId)) 4507 { 4508 m_activeVPSId = vpsId; 4509 #if H_MV 4510 m_activeSPSId[ layerId ] = spsId; 4397 //Bool ParameterSetManager::activateSPSWithSEI(Int spsId) 4398 #endif 4399 //{ 4400 //TComSPS *sps = m_spsMap.getPS(spsId); 4401 // if (sps) 4402 // { 4403 // Int vpsId = sps->getVPSId(); 4404 // TComVPS *vps = m_vpsMap.getPS(vpsId); 4405 // if (vps) 4406 // { 4407 #if NH_MV 4408 // m_activeVPS = *(vps); 4409 // m_activeSPS[ layerId ] = *(sps); 4511 4410 #else 4512 m_activeSPSId = spsId; 4513 #endif 4514 return true; 4515 } 4516 else 4517 { 4518 printf("Warning: tried to activate SPS using an Active parameter sets SEI message. Referenced VPS does not exist."); 4519 } 4520 } 4521 else 4522 { 4523 printf("Warning: tried to activate non-existing SPS using an Active parameter sets SEI message."); 4524 } 4525 return false; 4526 } 4411 // m_activeVPS = *(vps); 4412 // m_activeSPS = *(sps); 4413 #endif 4414 // return true; 4415 // } 4416 // else 4417 // { 4418 // printf("Warning: tried to activate SPS using an Active parameter sets SEI message. Referenced VPS does not exist."); 4419 // } 4420 // } 4421 // else 4422 // { 4423 // printf("Warning: tried to activate non-existing SPS using an Active parameter sets SEI message."); 4424 // } 4425 // return false; 4426 //} 4527 4427 4528 4428 //! activate a PPS and depending on isIDR parameter also SPS and VPS 4529 4429 //! \returns true, if activation is successful 4530 #if H_MV4430 #if NH_MV 4531 4431 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP, Int layerId ) 4532 4432 #else … … 4538 4438 { 4539 4439 Int spsId = pps->getSPSId(); 4540 #if H_MV4541 if (!isIRAP && (spsId != m_activeSPSId[ layerId ] ))4440 #if NH_MV 4441 if (!isIRAP && (spsId != m_activeSPSId[ layerId ] )) 4542 4442 #else 4543 if (!isIRAP && (spsId != m_activeSPSId)) 4544 #endif 4545 { 4546 printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP."); 4547 return false; 4548 } 4549 4550 TComSPS *sps = m_spsMap.getPS(spsId); 4551 if (sps) 4552 { 4553 Int vpsId = sps->getVPSId(); 4554 if (!isIRAP && (vpsId != m_activeVPSId)) 4555 { 4556 printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP."); 4557 return false; 4558 } 4559 if (m_vpsMap.getPS(vpsId)) 4560 { 4561 #if H_MV 4562 m_activePPSId[ layerId ] = ppsId; 4563 m_activeVPSId = vpsId; 4564 m_activeSPSId[ layerId ] = spsId; 4443 if (!isIRAP && (spsId != m_activeSPSId )) 4444 #endif 4445 { 4446 printf("Warning: tried to activate PPS referring to a inactive SPS at non-IDR."); 4447 } 4448 else 4449 { 4450 TComSPS *sps = m_spsMap.getPS(spsId); 4451 if (sps) 4452 { 4453 Int vpsId = sps->getVPSId(); 4454 if (!isIRAP && (vpsId != m_activeVPSId )) 4455 { 4456 printf("Warning: tried to activate PPS referring to a inactive VPS at non-IDR."); 4457 } 4458 else 4459 { 4460 TComVPS *vps =m_vpsMap.getPS(vpsId); 4461 if (vps) 4462 { 4463 m_activeVPSId = vpsId; 4464 #if NH_MV 4465 m_activeSPSId[layerId] = spsId; 4565 4466 #else 4566 m_activePPSId = ppsId; 4567 m_activeVPSId = vpsId; 4568 m_activeSPSId = spsId; 4569 #endif 4570 return true; 4467 m_activeSPSId = spsId; 4468 #endif 4469 return true; 4470 } 4471 else 4472 { 4473 printf("Warning: tried to activate PPS that refers to a non-existing VPS."); 4474 } 4475 } 4571 4476 } 4572 4477 else 4573 4478 { 4574 printf("Warning: tried to activate PPS that refers to a non-existing VPS."); 4575 } 4576 } 4577 else 4578 { 4579 printf("Warning: tried to activate a PPS that refers to a non-existing SPS."); 4479 printf("Warning: tried to activate a PPS that refers to a non-existing SPS."); 4480 } 4580 4481 } 4581 4482 } … … 4584 4485 printf("Warning: tried to activate non-existing PPS."); 4585 4486 } 4487 4488 // Failed to activate if reach here. 4489 #if NH_MV 4490 m_activeSPSId[layerId]=-1; 4491 #else 4492 m_activeSPSId=-1; 4493 #endif 4494 m_activeVPSId=-1; 4495 4586 4496 return false; 4587 4497 } … … 4589 4499 ProfileTierLevel::ProfileTierLevel() 4590 4500 : m_profileSpace (0) 4591 , m_tierFlag (false) 4592 , m_profileIdc (0) 4593 , m_levelIdc (0) 4594 , m_progressiveSourceFlag (false) 4595 , m_interlacedSourceFlag (false) 4596 , m_nonPackedConstraintFlag(false) 4597 , m_frameOnlyConstraintFlag(false) 4598 #if H_MV 4501 , m_tierFlag (Level::MAIN) 4502 , m_profileIdc (Profile::NONE) 4503 , m_levelIdc (Level::NONE) 4504 , m_progressiveSourceFlag (false) 4505 , m_interlacedSourceFlag (false) 4506 , m_nonPackedConstraintFlag(false) 4507 , m_frameOnlyConstraintFlag(false) 4508 #if NH_MV 4509 , m_intraConstraintFlag ( false ) 4510 , m_onePictureOnlyConstraintFlag( false ) 4511 , m_lowerBitRateConstraintFlag ( false ) 4599 4512 , m_max12bitConstraintFlag ( false ) 4600 4513 , m_max10bitConstraintFlag ( false ) … … 4602 4515 , m_max422chromaConstraintFlag ( false ) 4603 4516 , m_max420chromaConstraintFlag ( false ) 4604 , m_maxMonochromeConstraintFlag ( false ) 4605 , m_intraConstraintFlag ( false ) 4606 , m_onePictureOnlyConstraintFlag( false ) 4607 , m_lowerBitRateConstraintFlag ( false ) 4517 , m_maxMonochromeConstraintFlag ( false ) 4608 4518 , m_inbldFlag ( false ) 4609 4519 #endif … … 4612 4522 } 4613 4523 4614 #if H_MV4615 Bool ProfileTierLevel::getV2ConstraintsPresentFlag() 4524 #if NH_MV 4525 Bool ProfileTierLevel::getV2ConstraintsPresentFlag() const 4616 4526 { 4617 4527 return ( … … 4621 4531 } 4622 4532 4623 Bool ProfileTierLevel::getInbldPresentFlag() 4533 Bool ProfileTierLevel::getInbldPresentFlag() const 4624 4534 { 4625 4535 return ( … … 4665 4575 } 4666 4576 4667 #if H_MV 4577 Void calculateParameterSetChangedFlag(Bool &bChanged, const std::vector<UChar> *pOldData, const std::vector<UChar> &newData) 4578 { 4579 if (!bChanged) 4580 { 4581 if ((pOldData==0 && pOldData!=0) || (pOldData!=0 && pOldData==0)) 4582 { 4583 bChanged=true; 4584 } 4585 else if (pOldData!=0 && pOldData!=0) 4586 { 4587 // compare the two 4588 if (pOldData->size() != pOldData->size()) 4589 { 4590 bChanged=true; 4591 } 4592 else 4593 { 4594 const UChar *pNewDataArray=&(newData)[0]; 4595 const UChar *pOldDataArray=&(*pOldData)[0]; 4596 if (memcmp(pOldDataArray, pNewDataArray, pOldData->size())) 4597 { 4598 bChanged=true; 4599 } 4600 } 4601 } 4602 } 4603 } 4604 #if NH_MV 4668 4605 Void TComPTL::inferGeneralValues(Bool profilePresentFlag, Int k, TComPTL* refPTL) 4669 4606 { … … 4754 4691 4755 4692 #endif 4693 4756 4694 //! \} 4757 4695 4758 #if H_MV4759 TComVPSVUI::TComVPSVUI()4696 #if NH_MV 4697 Void TComVPSVUI::init( Int numLayerSets, Int maxNumSubLayers, Int maxNumLayers ) 4760 4698 { 4761 4699 m_crossLayerIrapAlignedFlag = true; 4762 4700 m_allLayersIdrAlignedFlag = false; 4763 m_bitRatePresentVpsFlag = false; 4764 m_picRatePresentVpsFlag = false; 4765 for ( Int i = 0; i < MAX_VPS_OP_SETS_PLUS1; i++) 4766 { 4767 for ( Int j = 0; j < MAX_TLAYER; j++) 4701 m_bitRatePresentVpsFlag = false; 4702 m_picRatePresentVpsFlag = false; 4703 4704 m_bitRatePresentFlag .resize(numLayerSets); 4705 m_picRatePresentFlag .resize(numLayerSets); 4706 m_avgBitRate .resize(numLayerSets); 4707 m_maxBitRate .resize(numLayerSets); 4708 m_constantPicRateIdc .resize(numLayerSets); 4709 m_avgPicRate .resize(numLayerSets); 4710 4711 for ( Int i = 0; i < numLayerSets; i++) 4712 { 4713 m_bitRatePresentFlag [i].resize( maxNumSubLayers); 4714 m_picRatePresentFlag [i].resize( maxNumSubLayers); 4715 m_avgBitRate [i].resize( maxNumSubLayers); 4716 m_maxBitRate [i].resize( maxNumSubLayers); 4717 m_constantPicRateIdc [i].resize( maxNumSubLayers); 4718 m_avgPicRate [i].resize( maxNumSubLayers); 4719 for ( Int j = 0; j < maxNumSubLayers; j++) 4768 4720 { 4769 4721 m_bitRatePresentFlag [i][j] = false; … … 4778 4730 m_ilpRestrictedRefLayersFlag = false; 4779 4731 4780 for ( Int i = 0; i < MAX_NUM_LAYERS; i++) 4732 m_tileBoundariesAlignedFlag .resize( maxNumLayers ); 4733 m_minSpatialSegmentOffsetPlus1 .resize( maxNumLayers ); 4734 m_ctuBasedOffsetEnabledFlag .resize( maxNumLayers ); 4735 m_minHorizontalCtuOffsetPlus1 .resize( maxNumLayers ); 4736 m_baseLayerParameterSetCompatibilityFlag.resize( maxNumLayers ); 4737 4738 for ( Int i = 0; i < maxNumLayers; i++) 4781 4739 { 4782 for ( Int j = 0; j < MAX_NUM_LAYERS; j++) 4740 m_tileBoundariesAlignedFlag [i].resize( maxNumLayers ); 4741 m_minSpatialSegmentOffsetPlus1[i].resize( maxNumLayers ); 4742 m_ctuBasedOffsetEnabledFlag [i].resize( maxNumLayers ); 4743 m_minHorizontalCtuOffsetPlus1 [i].resize( maxNumLayers ); 4744 for ( Int j = 0; j < maxNumLayers; j++) 4783 4745 { 4784 4746 m_tileBoundariesAlignedFlag [i][j] = false; … … 4789 4751 m_baseLayerParameterSetCompatibilityFlag[i] = false; 4790 4752 } 4791 for ( Int i = 0; i < MAX_NUM_VIDEO_SIGNAL_INFO; i++ )4792 {4793 m_videoSignalInfo [i] = NULL;4794 }4795 4796 4753 m_vpsVuiBspHrdPresentFlag = false; 4797 m_vpsVuiBspHrdParameters = NULL; 4798 } 4799 4800 TComVPSVUI::~TComVPSVUI() 4801 { 4802 for ( Int i = 0; i < MAX_NUM_VIDEO_SIGNAL_INFO; i++ ) 4803 { 4804 if (m_videoSignalInfo[ i ] != NULL ) delete m_videoSignalInfo[ i ]; 4805 m_videoSignalInfo [ i ] = NULL; 4806 } 4807 4808 if ( m_vpsVuiBspHrdParameters ) delete m_vpsVuiBspHrdParameters; 4809 m_vpsVuiBspHrdParameters = NULL; 4810 } 4811 4812 Void TComVPSVUI::inferVpsVui( Bool encoderFlag ) 4813 { 4814 // inference of syntax elements that differ from default inference (as done in constructor), when VPS VUI is not present 4815 if (!encoderFlag ) 4816 { 4817 setCrossLayerIrapAlignedFlag( false ); 4818 } 4819 else 4820 { 4821 assert( !getCrossLayerIrapAlignedFlag() ); 4822 } 4823 } 4824 4825 Void TComRepFormat::inferChromaAndBitDepth( TComRepFormat* prevRepFormat, Bool encoderFlag ) 4826 { 4827 if ( !encoderFlag ) 4828 { 4754 } 4755 4756 Void TComRepFormat::inferChromaAndBitDepth( const TComRepFormat* prevRepFormat ) 4757 { 4829 4758 setChromaAndBitDepthVpsPresentFlag( prevRepFormat->getChromaAndBitDepthVpsPresentFlag() ); 4830 4759 setSeparateColourPlaneVpsFlag ( prevRepFormat->getSeparateColourPlaneVpsFlag () ); 4831 4760 setBitDepthVpsLumaMinus8 ( prevRepFormat->getBitDepthVpsLumaMinus8 () ); 4832 4761 setBitDepthVpsChromaMinus8 ( prevRepFormat->getBitDepthVpsChromaMinus8 () ); 4833 } 4834 else 4835 { 4762 } 4763 4764 Void TComRepFormat::checkInferChromaAndBitDepth( const TComRepFormat* prevRepFormat ) const 4765 { 4836 4766 assert( getChromaAndBitDepthVpsPresentFlag() == prevRepFormat->getChromaAndBitDepthVpsPresentFlag() ); 4837 4767 assert( getSeparateColourPlaneVpsFlag () == prevRepFormat->getSeparateColourPlaneVpsFlag () ); 4838 4768 assert( getBitDepthVpsLumaMinus8 () == prevRepFormat->getBitDepthVpsLumaMinus8 () ); 4839 4769 assert( getBitDepthVpsChromaMinus8 () == prevRepFormat->getBitDepthVpsChromaMinus8 () ); 4840 } 4841 } 4842 4843 4844 4845 TComVpsVuiBspHrdParameters::~TComVpsVuiBspHrdParameters() 4846 { 4847 delete[] m_cprmsAddPresentFlag; 4848 delete[] m_numSubLayerHrdMinus1; 4849 delete[] m_hrdParameters; 4850 4851 for (Int h = 0; h < m_numOls; h++) 4852 { 4853 if ( h > 0 ) 4854 { 4855 for (Int i = 0; i < getNumSignalledPartitioningSchemes(h)+1; i++) 4856 { 4857 for (Int t = 0; t < m_vps->getMaxSubLayersInLayerSetMinus1( m_vps->olsIdxToLsIdx(h) ) + 1; t++) 4858 { 4859 for ( Int j = 0; j <= getNumBspSchedulesMinus1(h,i,j);j++ ) 4860 { 4861 delete[] m_bspHrdIdx [h][i][t][j]; 4862 delete[] m_bspSchedIdx[h][i][t][j]; 4863 } 4864 } 4865 delete[] m_numBspSchedulesMinus1[h][i]; 4866 } 4867 } 4868 4869 for (Int j = 0; j <= getNumSignalledPartitioningSchemes(h ) + 1; j++ ) 4870 { 4871 for (Int k = 0; k <= getNumPartitionsInSchemeMinus1(h,j); k++ ) 4872 { 4873 delete[] m_layerIncludedInPartitionFlag[h][j][k]; 4874 } 4875 } 4876 delete[] m_numPartitionsInSchemeMinus1[h]; 4877 } 4878 delete[] m_numSignalledPartitioningSchemes; 4879 } 4880 4881 4882 Int TComVpsVuiBspHrdParameters::getBspHrdIdxLen(TComVPS* vps) 4770 } 4771 4772 Int TComVpsVuiBspHrdParameters::getBspHrdIdxLen( const TComVPS* vps) const 4883 4773 { 4884 4774 return gCeilLog2( vps->getNumHrdParameters() + getVpsNumAddHrdParams() ); 4885 4775 } 4886 4776 4887 Void TComVpsVuiBspHrdParameters::createAfterVpsNumAddHrdParams( TComVPS* vps ) 4888 { 4889 assert( vps == NULL ); 4890 m_vps = vps; 4777 Void TComVpsVuiBspHrdParameters::createAfterVpsNumAddHrdParams( const TComVPS* vps ) 4778 { 4891 4779 m_offsetHrdParamIdx = vps->getNumHrdParameters(); 4892 4780 m_numHrdParam = vps->getNumHrdParameters() + getVpsNumAddHrdParams() - m_offsetHrdParamIdx; 4893 4781 m_numOls = vps->getNumOutputLayerSets(); 4894 4782 4895 m_cprmsAddPresentFlag = new Bool [ m_numHrdParam ];4896 m_numSubLayerHrdMinus1 = new Int [ m_numHrdParam ];4897 m_hrdParameters = new TComHRD [ m_numHrdParam ];4898 4899 m_numSignalledPartitioningSchemes = new Int [ m_numOls ];4900 m_numPartitionsInSchemeMinus1 = new Int* [ m_numOls ];4901 m_numBspSchedulesMinus1 = new Int** [ m_numOls ];4902 m_bspHrdIdx = new Int****[ m_numOls ];4903 m_bspSchedIdx = new Int****[ m_numOls ];4904 } 4905 4906 Void TComVpsVuiBspHrdParameters::createAfterNumSignalledPartitioningSchemes( Int h )4907 { 4908 m_numPartitionsInSchemeMinus1 [h] = new Int [ getNumSignalledPartitioningSchemes(h) ];4909 m_layerIncludedInPartitionFlag[h] = new Bool** [ getNumSignalledPartitioningSchemes(h) ];4910 4911 m_numBspSchedulesMinus1 [h] = new Int* [ getNumSignalledPartitioningSchemes(h) + 1 ];4783 m_cprmsAddPresentFlag .resize( m_numHrdParam ); 4784 m_numSubLayerHrdMinus1.resize( m_numHrdParam ); 4785 m_hrdParameters .resize( m_numHrdParam ); 4786 4787 m_numSignalledPartitioningSchemes .resize( m_numOls ); 4788 m_numPartitionsInSchemeMinus1 .resize( m_numOls ); 4789 m_numBspSchedulesMinus1 .resize( m_numOls ); 4790 m_bspHrdIdx .resize( m_numOls ); 4791 m_bspSchedIdx .resize( m_numOls ); 4792 } 4793 4794 Void TComVpsVuiBspHrdParameters::createAfterNumSignalledPartitioningSchemes( const TComVPS* vps, Int h ) 4795 { 4796 m_numPartitionsInSchemeMinus1 [h].resize( getNumSignalledPartitioningSchemes(h) ); 4797 m_layerIncludedInPartitionFlag[h].resize( getNumSignalledPartitioningSchemes(h) ); 4798 4799 m_numBspSchedulesMinus1 [h].resize( getNumSignalledPartitioningSchemes(h) + 1 ); 4912 4800 for (Int i = 0; i < getNumSignalledPartitioningSchemes(h) + 1; i++) 4913 4801 { 4914 Int tMax = m_vps->getMaxSubLayersInLayerSetMinus1( m_vps->olsIdxToLsIdx(h) ) + 1;4915 m_numBspSchedulesMinus1[h][i] = new Int [ tMax ];4916 m_bspHrdIdx [h][i] = new Int**[ tMax ];4917 m_bspSchedIdx [h][i] = new Int**[ tMax ];4918 } 4919 } 4920 4921 Void TComVpsVuiBspHrdParameters::createAfterNumPartitionsInSchemeMinus1( Int h, Int j )4922 { 4923 m_layerIncludedInPartitionFlag[h][j] = new Bool*[ getNumPartitionsInSchemeMinus1(h,j)];4802 Int tMax = vps->getMaxSubLayersInLayerSetMinus1( m_vps->olsIdxToLsIdx(h) ) + 1; 4803 m_numBspSchedulesMinus1[h][i].resize( tMax ); 4804 m_bspHrdIdx [h][i].resize( tMax ); 4805 m_bspSchedIdx [h][i].resize( tMax ); 4806 } 4807 } 4808 4809 Void TComVpsVuiBspHrdParameters::createAfterNumPartitionsInSchemeMinus1( const TComVPS* vps, Int h, Int j ) 4810 { 4811 m_layerIncludedInPartitionFlag[h][j].resize( getNumPartitionsInSchemeMinus1(h,j)); 4924 4812 for( Int k = 0; k < getNumPartitionsInSchemeMinus1(h,j); k++ ) 4925 4813 { 4926 m_layerIncludedInPartitionFlag[h][j][k] = new Bool[ m_vps->getNumLayersInIdList( m_vps->olsIdxToLsIdx(h))];4927 } 4928 } 4929 4930 Void TComVpsVuiBspHrdParameters::createAfterNumBspSchedulesMinus1( Int h, Int i, Int t )4931 { 4932 m_bspSchedIdx[h][i][t] = new Int* [ getNumBspSchedulesMinus1( h, i, t ) + 1 ];4933 m_bspHrdIdx [h][i][t] = new Int* [ getNumBspSchedulesMinus1( h, i, t ) + 1 ];4814 m_layerIncludedInPartitionFlag[h][j][k].resize( m_vps->getNumLayersInIdList( vps->olsIdxToLsIdx(h))); 4815 } 4816 } 4817 4818 Void TComVpsVuiBspHrdParameters::createAfterNumBspSchedulesMinus1( const TComVPS* vps, Int h, Int i, Int t ) 4819 { 4820 m_bspSchedIdx[h][i][t].resize( getNumBspSchedulesMinus1( h, i, t ) + 1 ); 4821 m_bspHrdIdx [h][i][t].resize( getNumBspSchedulesMinus1( h, i, t ) + 1 ); 4934 4822 for( Int j = 0; j < getNumBspSchedulesMinus1( h, i, t ) + 1; j++ ) 4935 4823 { 4936 m_bspSchedIdx[h][i][t][j] = new Int[ getNumPartitionsInSchemeMinus1( h, i ) ];4937 m_bspHrdIdx [h][i][t][j] = new Int[ getNumPartitionsInSchemeMinus1( h, i ) ];4938 } 4939 } 4940 4941 4942 Void TComVUI::inferVideoSignalInfo( TComVPS* vps, Int layerIdCurr )4824 m_bspSchedIdx[h][i][t][j].resize( getNumPartitionsInSchemeMinus1( h, i ) ); 4825 m_bspHrdIdx [h][i][t][j].resize( getNumPartitionsInSchemeMinus1( h, i ) ); 4826 } 4827 } 4828 4829 4830 Void TComVUI::inferVideoSignalInfo( const TComVPS* vps, Int layerIdCurr ) 4943 4831 { 4944 4832 if ( layerIdCurr == 0 || !vps->getVpsVuiPresentFlag() ) … … 4947 4835 } 4948 4836 4949 TComVPSVUI* vpsVUI= vps->getVPSVUI();4950 assert( vpsV UI!= NULL );4951 4952 TComVideoSignalInfo* videoSignalInfo = vpsVUI->getVideoSignalInfo( vpsVUI->getVpsVideoSignalInfoIdx( vps->getLayerIdInVps( layerIdCurr ) ) );4837 const TComVPSVUI* vpsVui = vps->getVPSVUI(); 4838 assert( vpsVui != NULL ); 4839 4840 const TComVideoSignalInfo* videoSignalInfo = vpsVui->getVideoSignalInfo( vpsVui->getVpsVideoSignalInfoIdx( vps->getLayerIdInVps( layerIdCurr ) ) ); 4953 4841 assert( videoSignalInfo != NULL ); 4954 4842 … … 4960 4848 } 4961 4849 4962 TComDpbSize::TComDpbSize() 4963 { 4964 for (Int i = 0; i < MAX_VPS_OUTPUTLAYER_SETS; i++ ) 4850 Void TComDpbSize::init( Int numOutputLayerSets, Int maxNumLayerIds, Int maxNumSubLayers ) 4851 { 4852 m_subLayerFlagInfoPresentFlag.resize( numOutputLayerSets ); 4853 m_subLayerDpbInfoPresentFlag .resize( numOutputLayerSets ); 4854 m_maxVpsDecPicBufferingMinus1.resize( numOutputLayerSets ); 4855 m_maxVpsNumReorderPics .resize( numOutputLayerSets ); 4856 m_maxVpsLatencyIncreasePlus1 .resize( numOutputLayerSets ); 4857 4858 for (Int i = 0; i < numOutputLayerSets; i++ ) 4965 4859 { 4966 4860 m_subLayerFlagInfoPresentFlag[i] = false; 4967 4861 4968 for (Int j = 0; j < MAX_TLAYER; j++ ) 4862 m_subLayerDpbInfoPresentFlag [i].resize( maxNumSubLayers ); 4863 m_maxVpsDecPicBufferingMinus1[i].resize( maxNumLayerIds ); 4864 m_maxVpsNumReorderPics [i].resize( maxNumSubLayers ); 4865 m_maxVpsLatencyIncreasePlus1 [i].resize( maxNumSubLayers ); 4866 4867 for (Int j = 0; j < maxNumSubLayers; j++ ) 4969 4868 { 4970 4869 m_subLayerDpbInfoPresentFlag [i][j] = ( j == 0) ; 4971 4870 m_maxVpsNumReorderPics [i][j] = 0; 4972 4871 m_maxVpsLatencyIncreasePlus1 [i][j] = 0; 4973 4974 for (Int k = 0; k < MAX_NUM_LAYER_IDS; k++ ) 4975 { 4872 } 4873 4874 for (Int k = 0; k < maxNumLayerIds; k++ ) 4875 { 4876 m_maxVpsDecPicBufferingMinus1[i][k].resize( maxNumSubLayers ); 4877 for (Int j = 0; j < maxNumSubLayers; j++ ) 4878 { 4976 4879 m_maxVpsDecPicBufferingMinus1[i][k][j] = MIN_INT; 4977 4880 } … … 4992 4895 } 4993 4896 #endif 4994
Note: See TracChangeset for help on using the changeset viewer.