Changeset 916 in SHVCSoftware for branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.cpp
- Timestamp:
- 12 Nov 2014, 08:09:17 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.cpp
r903 r916 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 6 * Copyright (c) 2010-2014, ITU/ISO/IEC … … 38 38 #include "NALread.h" 39 39 #include "TDecTop.h" 40 #if RExt__DECODER_DEBUG_BIT_STATISTICS 41 #include "TLibCommon/TComCodingStatistics.h" 42 #endif 40 43 41 44 #if SVC_EXTENSION … … 64 67 65 68 TDecTop::TDecTop() 69 : m_pDecodedSEIOutputStream(NULL) 66 70 { 67 71 m_pcPic = 0; 68 72 m_iMaxRefPicNum = 0; 69 73 #if ENC_DEC_TRACE 70 g_hTrace = fopen( "TraceDec.txt", "wb" ); 74 if (g_hTrace == NULL) 75 { 76 g_hTrace = fopen( "TraceDec.txt", "wb" ); 77 } 71 78 g_bJustDoIt = g_bEncDecTraceDisable; 72 79 g_nSymbolCounter = 0; … … 74 81 m_associatedIRAPType = NAL_UNIT_INVALID; 75 82 m_pocCRA = 0; 76 m_pocRandomAccess = MAX_INT; 83 m_pocRandomAccess = MAX_INT; 77 84 #if !SVC_EXTENSION 78 85 m_prevPOC = MAX_INT; … … 91 98 m_prevSliceSkipped = false; 92 99 m_skippedPOC = 0; 93 #if SETTING_NO_OUT_PIC_PRIOR94 100 m_bFirstSliceInBitstream = true; 95 101 m_lastPOCNoOutputPriorPics = -1; 96 102 m_craNoRaslOutputFlag = false; 97 103 m_isNoOutputPriorPics = false; 98 #endif99 104 #if Q0177_EOS_CHECKS 100 105 m_isLastNALWasEos = false; … … 129 134 { 130 135 #if ENC_DEC_TRACE 131 fclose( g_hTrace ); 136 if (g_hTrace != stdout) 137 { 138 fclose( g_hTrace ); 139 } 132 140 #endif 133 141 #if Q0048_CGS_3D_ASYMLUT … … 155 163 { 156 164 m_cGopDecoder.destroy(); 157 165 158 166 delete m_apcSlicePilot; 159 167 m_apcSlicePilot = NULL; 160 168 161 169 m_cSliceDecoder.destroy(); 162 170 #if SVC_EXTENSION … … 189 197 } 190 198 191 #if SVC_EXTENSION192 #if !REPN_FORMAT_IN_VPS193 Void TDecTop::xInitILRP(TComSPS *pcSPS)194 #else195 Void TDecTop::xInitILRP(TComSlice *slice)196 #endif197 {198 #if REPN_FORMAT_IN_VPS199 TComSPS* pcSPS = slice->getSPS();200 Int bitDepthY = slice->getBitDepthY();201 Int bitDepthC = slice->getBitDepthC();202 Int picWidth = slice->getPicWidthInLumaSamples();203 Int picHeight = slice->getPicHeightInLumaSamples();204 #endif205 if(m_layerId>0)206 {207 #if REPN_FORMAT_IN_VPS208 g_bitDepthY = bitDepthY;209 g_bitDepthC = bitDepthC;210 #else211 g_bitDepthY = pcSPS->getBitDepthY();212 g_bitDepthC = pcSPS->getBitDepthC();213 #endif214 g_uiMaxCUWidth = pcSPS->getMaxCUWidth();215 g_uiMaxCUHeight = pcSPS->getMaxCUHeight();216 g_uiMaxCUDepth = pcSPS->getMaxCUDepth();217 g_uiAddCUDepth = max (0, pcSPS->getLog2MinCodingBlockSize() - (Int)pcSPS->getQuadtreeTULog2MinSize() );218 219 Int numReorderPics[MAX_TLAYER];220 #if R0156_CONF_WINDOW_IN_REP_FORMAT221 Window &conformanceWindow = slice->getConformanceWindow();222 #else223 Window &conformanceWindow = pcSPS->getConformanceWindow();224 #endif225 Window defaultDisplayWindow = pcSPS->getVuiParametersPresentFlag() ? pcSPS->getVuiParameters()->getDefaultDisplayWindow() : Window();226 227 for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++)228 {229 #if USE_DPB_SIZE_TABLE230 if( getCommonDecoderParams()->getTargetOutputLayerSetIdx() == 0 )231 {232 assert( this->getLayerId() == 0 );233 numReorderPics[temporalLayer] = pcSPS->getNumReorderPics(temporalLayer);234 }235 else236 {237 TComVPS *vps = slice->getVPS();238 // SHM decoders will use DPB size table in the VPS to determine the number of reorder pictures.239 numReorderPics[temporalLayer] = vps->getMaxVpsNumReorderPics( getCommonDecoderParams()->getTargetOutputLayerSetIdx() , temporalLayer);240 }241 #else242 numReorderPics[temporalLayer] = pcSPS->getNumReorderPics(temporalLayer);243 #endif244 }245 246 if (m_cIlpPic[0] == NULL)247 {248 for (Int j=0; j < m_numDirectRefLayers; j++)249 {250 251 m_cIlpPic[j] = new TComPic;252 253 #if AUXILIARY_PICTURES254 #if REPN_FORMAT_IN_VPS255 m_cIlpPic[j]->create(picWidth, picHeight, slice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);256 #else257 m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), pcSPS->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);258 #endif259 #else260 #if REPN_FORMAT_IN_VPS261 m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);262 #else263 m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);264 #endif265 #endif266 for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCUsInFrame(); i++)267 {268 m_cIlpPic[j]->getPicSym()->getCU(i)->initCU(m_cIlpPic[j], i);269 }270 }271 }272 }273 }274 #endif275 276 199 Void TDecTop::deletePicBuffer ( ) 277 200 { 278 201 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); 279 202 Int iSize = Int( m_cListPic.size() ); 280 203 281 204 for (Int i = 0; i < iSize; i++ ) 282 205 { … … 292 215 #else 293 216 pcPic->destroy(); 294 217 295 218 delete pcPic; 296 219 pcPic = NULL; 297 220 #endif 298 221 } 299 222 300 223 m_cSAO.destroy(); 301 224 302 225 m_cLoopFilter. destroy(); 303 226 … … 318 241 Window defaultDisplayWindow = pcSlice->getSPS()->getVuiParametersPresentFlag() ? pcSlice->getSPS()->getVuiParameters()->getDefaultDisplayWindow() : Window(); 319 242 320 for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++) 243 for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++) 321 244 { 322 245 #if USE_DPB_SIZE_TABLE … … 409 332 #if O0194_DIFFERENT_BITDEPTH_EL_BL 410 333 UInt refLayerId = pcSlice->getVPS()->getRefLayerId(m_layerId, i); 411 Bool sameBitDepths = ( g_bitDepth YLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] );334 Bool sameBitDepths = ( g_bitDepthLayer[CHANNEL_TYPE_LUMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId] ) && ( g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId] ); 412 335 413 336 #if REF_IDX_MFM 414 if( pcPicYuvRecBase->getWidth( ) == pcSlice->getPicWidthInLumaSamples() && pcPicYuvRecBase->getHeight() == pcSlice->getPicHeightInLumaSamples() && equalOffsets && zeroPhase )337 if( pcPicYuvRecBase->getWidth(COMPONENT_Y) == pcSlice->getPicWidthInLumaSamples() && pcPicYuvRecBase->getHeight(COMPONENT_Y) == pcSlice->getPicHeightInLumaSamples() && equalOffsets && zeroPhase ) 415 338 { 416 339 rpcPic->setEqualPictureSizeAndOffsetFlag( i, true ); … … 469 392 } 470 393 471 #if AUXILIARY_PICTURES472 394 #if REPN_FORMAT_IN_VPS 473 395 rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, … … 477 399 conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true); 478 400 #endif 479 #else480 #if REPN_FORMAT_IN_VPS481 rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,482 conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);483 #else484 rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,485 conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);486 #endif487 #endif488 401 489 402 #else //SVC_EXTENSION 490 rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,403 rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 491 404 conformanceWindow, defaultDisplayWindow, numReorderPics, true); 492 405 #endif //SVC_EXTENSION 493 406 494 407 m_cListPic.pushBack( rpcPic ); 495 408 496 409 return; 497 410 } 498 411 499 412 Bool bBufferIsAvailable = false; 500 413 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); … … 520 433 } 521 434 } 522 435 523 436 if ( !bBufferIsAvailable ) 524 437 { … … 531 444 532 445 #if SVC_EXTENSION 533 #if AUXILIARY_PICTURES534 446 #if REPN_FORMAT_IN_VPS 535 447 rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, … … 539 451 conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true); 540 452 #endif 541 #else542 #if REPN_FORMAT_IN_VPS543 rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,544 conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);545 546 #else547 rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,548 conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);549 #endif550 #endif551 453 #else //SVC_EXTENSION 552 rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,454 rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 553 455 conformanceWindow, defaultDisplayWindow, numReorderPics, true); 554 456 #endif //SVC_EXTENSION … … 562 464 return; 563 465 } 564 565 TComPic* &pcPic = m_pcPic;466 467 TComPic* pcPic = m_pcPic; 566 468 567 469 // Execute Deblock + Cleanup 470 568 471 m_cGopDecoder.filterPicture(pcPic); 569 472 570 473 TComSlice::sortPicList( m_cListPic ); // sorting for application output 571 474 poc = pcPic->getSlice(m_uiSliceIdx-1)->getPOC(); 572 rpcListPic = &m_cListPic; 573 m_cCuDecoder.destroy(); 475 rpcListPic = &m_cListPic; 476 m_cCuDecoder.destroy(); 574 477 m_bFirstSliceInPicture = true; 575 478 … … 577 480 } 578 481 579 #if SETTING_NO_OUT_PIC_PRIOR 580 Void TDecTop::checkNoOutputPriorPics (TComList<TComPic*>*& rpcListPic) 482 Void TDecTop::checkNoOutputPriorPics (TComList<TComPic*>* pcListPic) 581 483 { 582 if (! rpcListPic || !m_isNoOutputPriorPics) return;583 584 TComList<TComPic*>::iterator iterPic = rpcListPic->begin();585 586 while (iterPic != rpcListPic->end())587 { 588 TComPic* &pcPicTmp = *(iterPic++);484 if (!pcListPic || !m_isNoOutputPriorPics) return; 485 486 TComList<TComPic*>::iterator iterPic = pcListPic->begin(); 487 488 while (iterPic != pcListPic->end()) 489 { 490 TComPic* pcPicTmp = *(iterPic++); 589 491 if (m_lastPOCNoOutputPriorPics != pcPicTmp->getPOC()) 590 492 { … … 593 495 } 594 496 } 595 #endif 596 597 #if EARLY_REF_PIC_MARKING 598 Void TDecTop::earlyPicMarking(Int maxTemporalLayer, std::vector<Int>& targetDecLayerIdSet) 599 { 600 UInt currTid = m_pcPic->getTLayer(); 601 UInt highestTid = (maxTemporalLayer >= 0) ? maxTemporalLayer : (m_pcPic->getSlice(0)->getSPS()->getMaxTLayers() - 1); 602 UInt latestDecLayerId = m_layerId; 603 UInt numTargetDecLayers = 0; 604 Int targetDecLayerIdList[MAX_LAYERS]; 605 UInt latestDecIdx = 0; 606 TComSlice* pcSlice = m_pcPic->getSlice(0); 607 608 if ( currTid != highestTid ) // Marking process is only applicaple for highest decoded TLayer 609 { 610 return; 611 } 612 613 // currPic must be marked as "used for reference" and must be a sub-layer non-reference picture 614 if ( !((pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || 615 pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || 616 pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || 617 pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || 618 pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N || 619 pcSlice->getNalUnitType() == NAL_UNIT_RESERVED_VCL_N10 || 620 pcSlice->getNalUnitType() == NAL_UNIT_RESERVED_VCL_N12 || 621 pcSlice->getNalUnitType() == NAL_UNIT_RESERVED_VCL_N14) && pcSlice->isReferenced())) 622 { 623 return; 624 } 625 626 if ( targetDecLayerIdSet.size() == 0 ) // Cannot mark if we don't know the number of scalable layers 627 { 628 return; 629 } 630 631 for (std::vector<Int>::iterator it = targetDecLayerIdSet.begin(); it != targetDecLayerIdSet.end(); it++) 632 { 633 if ( latestDecLayerId == (*it) ) 634 { 635 latestDecIdx = numTargetDecLayers; 636 } 637 targetDecLayerIdList[numTargetDecLayers++] = (*it); 638 } 639 640 Int remainingInterLayerReferencesFlag = 0; 641 #if O0225_MAX_TID_FOR_REF_LAYERS 642 for ( Int j = latestDecIdx + 1; j < numTargetDecLayers; j++ ) 643 { 644 Int jLidx = pcSlice->getVPS()->getLayerIdInVps(targetDecLayerIdList[j]); 645 if ( currTid <= pcSlice->getVPS()->getMaxTidIlRefPicsPlus1(latestDecLayerId,jLidx) - 1 ) 646 { 647 #else 648 if ( currTid <= pcSlice->getVPS()->getMaxTidIlRefPicsPlus1(latestDecLayerId) - 1 ) 649 { 650 for ( Int j = latestDecIdx + 1; j < numTargetDecLayers; j++ ) 651 { 652 #endif 653 for ( Int k = 0; k < m_ppcTDecTop[targetDecLayerIdList[j]]->getNumDirectRefLayers(); k++ ) 654 { 655 if ( latestDecIdx == m_ppcTDecTop[targetDecLayerIdList[j]]->getRefLayerId(k) ) 656 { 657 remainingInterLayerReferencesFlag = 1; 658 } 659 } 660 } 661 } 662 663 if ( remainingInterLayerReferencesFlag == 0 ) 664 { 665 pcSlice->setReferenced(false); 666 } 667 } 668 #endif 669 670 Void TDecTop::xCreateLostPicture(Int iLostPoc) 497 498 Void TDecTop::xCreateLostPicture(Int iLostPoc) 671 499 { 672 500 printf("\ninserting lost poc : %d\n",iLostPoc); … … 713 541 } 714 542 cFillPic->setCurrSliceIdx(0); 715 for(Int i=0; i<cFillPic->getNumCUsInFrame(); i++)716 { 717 cFillPic->getC U(i)->initCU(cFillPic,i);543 for(Int ctuRsAddr=0; ctuRsAddr<cFillPic->getNumberOfCtusInFrame(); ctuRsAddr++) 544 { 545 cFillPic->getCtu(ctuRsAddr)->initCtu(cFillPic, ctuRsAddr); 718 546 } 719 547 cFillPic->getSlice(0)->setReferenced(true); … … 731 559 { 732 560 m_parameterSetManagerDecoder.applyPrefetchedPS(); 733 561 734 562 TComPPS *pps = m_parameterSetManagerDecoder.getPPS(m_apcSlicePilot->getPPSId()); 735 563 assert (pps != 0); … … 854 682 855 683 #if O0194_DIFFERENT_BITDEPTH_EL_BL 856 g_bitDepth YLayer[0] = repFormat->getBitDepthVpsLuma();857 g_bitDepth CLayer[0] = repFormat->getBitDepthVpsChroma();684 g_bitDepthLayer[CHANNEL_TYPE_LUMA][0] = repFormat->getBitDepthVpsLuma(); 685 g_bitDepthLayer[CHANNEL_TYPE_CHROMA][0] = repFormat->getBitDepthVpsChroma(); 858 686 #endif 859 687 } … … 919 747 #endif 920 748 921 if( pps->getDependentSliceSegmentsEnabledFlag() ) 922 { 923 Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1; 924 925 if (m_cSliceDecoder.getCtxMemSize() != NumCtx) 926 { 927 m_cSliceDecoder.initCtxMem(NumCtx); 928 for ( UInt st = 0; st < NumCtx; st++ ) 929 { 930 TDecSbac* ctx = NULL; 931 ctx = new TDecSbac; 932 ctx->init( &m_cBinCABAC ); 933 m_cSliceDecoder.setCtxMem( ctx, st ); 934 } 935 } 936 } 749 #if R0227_REP_FORMAT_CONSTRAINT //Conformance checking for rep format -- rep format of current picture of current layer shall never be greater rep format defined in VPS for the current layer 750 if ( activeVPS->getVpsExtensionFlag() == 1 && (m_apcSlicePilot->getLayerId() == 0 || sps->getV1CompatibleSPSFlag() == 1) ) 751 { 752 UInt layerId = m_apcSlicePilot->getLayerId(); 753 assert( sps->getPicWidthInLumaSamples() <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerId) )->getPicWidthVpsInLumaSamples() ); 754 assert( sps->getPicHeightInLumaSamples() <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerId) )->getPicHeightVpsInLumaSamples() ); 755 assert( sps->getChromaFormatIdc() <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerId) )->getChromaFormatVpsIdc() ); 756 assert( sps->getBitDepth(CHANNEL_TYPE_LUMA) <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerId) )->getBitDepthVpsLuma() ); 757 assert( sps->getBitDepth(CHANNEL_TYPE_CHROMA) <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerId) )->getBitDepthVpsChroma() ); 758 } 759 else if ( activeVPS->getVpsExtensionFlag() == 1 ) 760 { 761 UInt layerId = m_apcSlicePilot->getLayerId(); 762 assert(activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId))->getPicWidthVpsInLumaSamples() <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerId))->getPicWidthVpsInLumaSamples()); 763 assert(activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId))->getPicHeightVpsInLumaSamples() <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerId))->getPicHeightVpsInLumaSamples()); 764 assert(activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId))->getChromaFormatVpsIdc() <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerId))->getChromaFormatVpsIdc()); 765 assert(activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId))->getBitDepthVpsLuma() <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerId))->getBitDepthVpsLuma()); 766 assert(activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId))->getBitDepthVpsChroma() <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerId))->getBitDepthVpsChroma()); 767 } 768 #endif 937 769 938 770 m_apcSlicePilot->setPPS(pps); 939 771 m_apcSlicePilot->setSPS(sps); 940 772 pps->setSPS(sps); 773 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumTileColumnsMinus1() + 1) : ((pps->getNumTileRowsMinus1() + 1)*(pps->getNumTileColumnsMinus1() + 1))); 774 pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) ); 775 pps->setMinCuChromaQpAdjSize( sps->getMaxCUWidth() >> ( pps->getMaxCuChromaQpAdjDepth()) ); 776 777 for (UInt channel = 0; channel < MAX_NUM_CHANNEL_TYPE; channel++) 778 { 941 779 #if REPN_FORMAT_IN_VPS 942 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumTileColumnsMinus1() + 1) : 1); 943 #else 944 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumTileColumnsMinus1() + 1) : 1); 945 #endif 946 pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) ); 947 948 #if REPN_FORMAT_IN_VPS 949 g_bitDepthY = m_apcSlicePilot->getBitDepthY(); 950 g_bitDepthC = m_apcSlicePilot->getBitDepthC(); 951 #else 952 g_bitDepthY = sps->getBitDepthY(); 953 g_bitDepthC = sps->getBitDepthC(); 954 #endif 780 g_bitDepth[channel] = isLuma(ChannelType(channel)) ? m_apcSlicePilot->getBitDepthY() : m_apcSlicePilot->getBitDepthC(); 781 #else 782 g_bitDepth[channel] = sps->getBitDepth(ChannelType(channel)); 783 #endif 784 785 if (sps->getUseExtendedPrecision()) g_maxTrDynamicRange[channel] = std::max<Int>(15, (g_bitDepth[channel] + 6)); 786 else g_maxTrDynamicRange[channel] = 15; 787 } 955 788 g_uiMaxCUWidth = sps->getMaxCUWidth(); 956 789 g_uiMaxCUHeight = sps->getMaxCUHeight(); 957 790 g_uiMaxCUDepth = sps->getMaxCUDepth(); 958 g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() );791 g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() + (Int)getMaxCUDepthOffset(sps->getChromaFormatIdc(), sps->getQuadtreeTULog2MinSize())); 959 792 960 793 for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++) … … 970 803 m_cSAO.destroy(); 971 804 #if REPN_FORMAT_IN_VPS 972 #if AUXILIARY_PICTURES 973 m_cSAO.create( m_apcSlicePilot->getPicWidthInLumaSamples(), m_apcSlicePilot->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth() ); 974 #else 975 m_cSAO.create( m_apcSlicePilot->getPicWidthInLumaSamples(), m_apcSlicePilot->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth() ); 976 #endif 977 #else 978 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth() ); 805 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), pps->getSaoOffsetBitShift(CHANNEL_TYPE_LUMA), pps->getSaoOffsetBitShift(CHANNEL_TYPE_CHROMA) ); 979 806 #endif 980 807 m_cLoopFilter.create( sps->getMaxCUDepth() ); … … 991 818 #endif 992 819 { 993 TComPic*& pcPic = m_pcPic;994 820 #if SVC_EXTENSION 995 821 m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getPrefetchedVPS(0) ); … … 1009 835 if (m_bFirstSliceInPicture) 1010 836 { 1011 m_uiSliceIdx 837 m_uiSliceIdx = 0; 1012 838 } 1013 839 else 1014 840 { 1015 m_apcSlicePilot->copySliceInfo( pcPic->getPicSym()->getSlice(m_uiSliceIdx-1) );841 m_apcSlicePilot->copySliceInfo( m_pcPic->getPicSym()->getSlice(m_uiSliceIdx-1) ); 1016 842 } 1017 843 m_apcSlicePilot->setSliceIdx(m_uiSliceIdx); … … 1027 853 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N); 1028 854 m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag); 1029 1030 855 m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS 1031 856 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); 857 858 #if ENC_DEC_TRACE 859 const UInt64 originalSymbolCount = g_nSymbolCounter; 860 #endif 1032 861 1033 862 #if SVC_EXTENSION … … 1040 869 1041 870 // set POC for dependent slices in skipped pictures 1042 if(m_apcSlicePilot->getDependentSliceSegmentFlag() && m_prevSliceSkipped) 871 if(m_apcSlicePilot->getDependentSliceSegmentFlag() && m_prevSliceSkipped) 1043 872 { 1044 873 m_apcSlicePilot->setPOC(m_skippedPOC); … … 1048 877 m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType); 1049 878 1050 #if SETTING_NO_OUT_PIC_PRIOR1051 879 //For inference of NoOutputOfPriorPicsFlag 1052 880 if (m_apcSlicePilot->getRapPicFlag()) … … 1086 914 } 1087 915 1088 //TODO: HENDRY -- Probably do the checking for max number of positive and negative pics here1089 1090 1091 916 //For inference of PicOutputFlag 1092 917 if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R) … … 1097 922 } 1098 923 } 1099 #endif 1100 1101 #if FIX_POC_CRA_NORASL_OUTPUT 924 1102 925 if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_craNoRaslOutputFlag) //Reset POC MSB when CRA has NoRaslOutputFlag equal to 1 1103 926 { … … 1105 928 m_apcSlicePilot->setPOC( m_apcSlicePilot->getPOC() & (iMaxPOClsb - 1) ); 1106 929 } 1107 #endif1108 930 1109 931 // Skip pictures due to random access … … 1507 1329 #endif 1508 1330 #if POC_RESET_IDC_DECODER 1509 if ( m_apcSlicePilot->isNextSlice() && (bNewPOC || m_layerId!=m_uiPrevLayerId || m_parseIdc == 1) && !m_bFirstSliceInSequence )1510 #else 1511 if ( m_apcSlicePilot->isNextSlice() && (bNewPOC || m_layerId!=m_uiPrevLayerId) && !m_bFirstSliceInSequence )1331 if (!m_apcSlicePilot->getDependentSliceSegmentFlag() && (bNewPOC || m_layerId!=m_uiPrevLayerId || m_parseIdc == 1) && !m_bFirstSliceInSequence ) 1332 #else 1333 if (!m_apcSlicePilot->getDependentSliceSegmentFlag() && (bNewPOC || m_layerId!=m_uiPrevLayerId) && !m_bFirstSliceInSequence ) 1512 1334 #endif 1513 1335 { … … 1547 1369 1548 1370 // actual decoding starts here 1549 1371 xActivateParameterSets(); 1550 1372 1551 1373 #if REPN_FORMAT_IN_VPS … … 1555 1377 xInitILRP(m_apcSlicePilot); 1556 1378 #endif 1557 if ( m_apcSlicePilot->isNextSlice())1379 if (!m_apcSlicePilot->getDependentSliceSegmentFlag()) 1558 1380 { 1559 1381 m_prevPOC = m_apcSlicePilot->getPOC(); … … 1562 1384 } 1563 1385 m_bFirstSliceInSequence = false; 1564 #if SETTING_NO_OUT_PIC_PRIOR1565 1386 m_bFirstSliceInBitstream = false; 1566 #endif1567 1387 #if POC_RESET_FLAG 1568 1388 // This operation would do the following: … … 1670 1490 #else //SVC_EXTENSION 1671 1491 //we should only get a different poc for a new picture (with CTU address==0) 1672 if ( m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (m_apcSlicePilot->getSliceCurStartCUAddr()!=0))1492 if (!m_apcSlicePilot->getDependentSliceSegmentFlag() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (m_apcSlicePilot->getSliceCurStartCtuTsAddr() != 0)) 1673 1493 { 1674 1494 printf ("Warning, the first slice of a picture might have been lost!\n"); 1675 1495 } 1496 1676 1497 // exit when a new picture is found 1677 if ( m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence)1498 if (!m_apcSlicePilot->getDependentSliceSegmentFlag() && (m_apcSlicePilot->getSliceCurStartCtuTsAddr() == 0 && !m_bFirstSliceInPicture) ) 1678 1499 { 1679 1500 if (m_prevPOC >= m_pocRandomAccess) 1680 1501 { 1681 1502 m_prevPOC = m_apcSlicePilot->getPOC(); 1503 #if ENC_DEC_TRACE 1504 //rewind the trace counter since we didn't actually decode the slice 1505 g_nSymbolCounter = originalSymbolCount; 1506 #endif 1682 1507 return true; 1683 1508 } … … 1688 1513 xActivateParameterSets(); 1689 1514 1690 if ( m_apcSlicePilot->isNextSlice())1515 if (!m_apcSlicePilot->getDependentSliceSegmentFlag()) 1691 1516 { 1692 1517 m_prevPOC = m_apcSlicePilot->getPOC(); 1693 1518 } 1694 1519 m_bFirstSliceInSequence = false; 1520 m_bFirstSliceInBitstream = false; 1695 1521 #endif //SVC_EXTENSION 1696 1522 //detect lost reference picture and insert copy of earlier frame. … … 1715 1541 if( pFile->good() ) 1716 1542 { 1717 Bool is16bit = g_bitDepth YLayer[0] > 8 || g_bitDepthCLayer[0] > 8;1718 UInt uiWidth = pBLPic->getPicYuvRec()->getWidth( );1719 UInt uiHeight = pBLPic->getPicYuvRec()->getHeight( );1543 Bool is16bit = g_bitDepthLayer[CHANNEL_TYPE_LUMA][0] > 8 || g_bitDepthLayer[CHANNEL_TYPE_CHROMA][0] > 8; 1544 UInt uiWidth = pBLPic->getPicYuvRec()->getWidth(COMPONENT_Y); 1545 UInt uiHeight = pBLPic->getPicYuvRec()->getHeight(COMPONENT_Y); 1720 1546 1721 1547 Int len = uiWidth * (is16bit ? 2 : 1); … … 1731 1557 1732 1558 // read Y component 1733 Pel* pPel = pBLPic->getPicYuvRec()->get LumaAddr();1734 UInt uiStride = pBLPic->getPicYuvRec()->getStride( );1559 Pel* pPel = pBLPic->getPicYuvRec()->getAddr(COMPONENT_Y); 1560 UInt uiStride = pBLPic->getPicYuvRec()->getStride(COMPONENT_Y); 1735 1561 for( Int i = 0; i < uiHeight; i++ ) 1736 1562 { … … 1760 1586 1761 1587 // read Cb component 1762 pPel = pBLPic->getPicYuvRec()->get CbAddr();1763 uiStride = pBLPic->getPicYuvRec()->get CStride();1588 pPel = pBLPic->getPicYuvRec()->getAddr(COMPONENT_Cb); 1589 uiStride = pBLPic->getPicYuvRec()->getStride(COMPONENT_Cb); 1764 1590 for( Int i = 0; i < uiHeight; i++ ) 1765 1591 { … … 1785 1611 1786 1612 // read Cr component 1787 pPel = pBLPic->getPicYuvRec()->get CrAddr();1788 uiStride = pBLPic->getPicYuvRec()->get CStride();1613 pPel = pBLPic->getPicYuvRec()->getAddr(COMPONENT_Cr); 1614 uiStride = pBLPic->getPicYuvRec()->getStride(COMPONENT_Cr); 1789 1615 for( Int i = 0; i < uiHeight; i++ ) 1790 1616 { … … 1825 1651 #endif 1826 1652 // Buffer initialize for prediction. 1827 m_cPrediction.initTempBuff( );1653 m_cPrediction.initTempBuff(m_apcSlicePilot->getSPS()->getChromaFormatIdc()); 1828 1654 #if ALIGNED_BUMPING 1829 1655 m_apcSlicePilot->checkLeadingPictureRestrictions(m_cListPic); … … 1832 1658 #endif 1833 1659 // Get a new picture buffer 1834 xGetNewPicBuffer (m_apcSlicePilot, pcPic);1660 xGetNewPicBuffer (m_apcSlicePilot, m_pcPic); 1835 1661 1836 1662 #if POC_RESET_IDC_DECODER 1837 pcPic->setCurrAuFlag( true );1663 m_pcPic->setCurrAuFlag( true ); 1838 1664 #if POC_RESET_RESTRICTIONS 1839 if( pcPic->getLayerId() > 0 && m_apcSlicePilot->isIDR() && !m_nonBaseIdrPresentFlag )1665 if( m_pcPic->getLayerId() > 0 && m_apcSlicePilot->isIDR() && !m_nonBaseIdrPresentFlag ) 1840 1666 { 1841 1667 // IDR picture with nuh_layer_id > 0 present … … 1860 1686 m_checkPocRestrictionsForCurrAu = true; 1861 1687 m_pocResetIdcOrCurrAu = m_apcSlicePilot->getPocResetIdc(); 1862 if( pcPic->getLayerId() == 0 )1688 if( m_pcPic->getLayerId() == 0 ) 1863 1689 { 1864 1690 // Base layer picture is present … … 1941 1767 if (seiTMVPConstrainsList.size() > 0) 1942 1768 { 1943 assert ( pcPic->getTLayer() == 0 ); //this SEI can present only for AU with Tid equal to 01769 assert ( m_pcPic->getTLayer() == 0 ); //this SEI can present only for AU with Tid equal to 0 1944 1770 SEITMVPConstrains* tmvpConstraintSEI = (SEITMVPConstrains*) *(seiTMVPConstrainsList.begin()); 1945 1771 if ( tmvpConstraintSEI->prev_pics_not_used_flag == 1 ) … … 1950 1776 { 1951 1777 TComPic *refPic = *iterRefPic; 1952 if( ( refPic->getLayerId() == pcPic->getLayerId() ) && refPic->getReconMark() )1778 if( ( refPic->getLayerId() == m_pcPic->getLayerId() ) && refPic->getReconMark() ) 1953 1779 { 1954 1780 for(Int i = refPic->getNumAllocatedSlice()-1; i >= 0; i--) … … 1970 1796 1971 1797 // transfer any SEI messages that have been received to the picture 1972 pcPic->setSEIs(m_SEIs);1798 m_pcPic->setSEIs(m_SEIs); 1973 1799 m_SEIs.clear(); 1974 1800 1975 1801 // Recursive structure 1976 m_cCuDecoder.create ( g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight );1802 m_cCuDecoder.create ( g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, m_apcSlicePilot->getSPS()->getChromaFormatIdc() ); 1977 1803 #if SVC_EXTENSION 1978 1804 m_cCuDecoder.init ( m_ppcTDecTop,&m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction, curLayerId ); … … 1990 1816 { 1991 1817 // Currently only decoding Unit SEI message occurring between VCL NALUs copied 1992 SEIMessages &picSEI = pcPic->getSEIs();1818 SEIMessages &picSEI = m_pcPic->getSEIs(); 1993 1819 SEIMessages decodingUnitInfos = extractSeisByType (m_SEIs, SEI::DECODING_UNIT_INFO); 1994 1820 picSEI.insert(picSEI.end(), decodingUnitInfos.begin(), decodingUnitInfos.end()); … … 1996 1822 } 1997 1823 } 1998 1824 1999 1825 // Set picture slice pointer 2000 1826 TComSlice* pcSlice = m_apcSlicePilot; 2001 Bool bNextSlice = pcSlice->isNextSlice(); 2002 2003 UInt i; 2004 pcPic->getPicSym()->initTiles(pcSlice->getPPS()); 2005 2006 //generate the Coding Order Map and Inverse Coding Order Map 2007 UInt uiEncCUAddr; 2008 for(i=0, uiEncCUAddr=0; i<pcPic->getPicSym()->getNumberOfCUsInFrame(); i++, uiEncCUAddr = pcPic->getPicSym()->xCalculateNxtCUAddr(uiEncCUAddr)) 2009 { 2010 pcPic->getPicSym()->setCUOrderMap(i, uiEncCUAddr); 2011 pcPic->getPicSym()->setInverseCUOrderMap(uiEncCUAddr, i); 2012 } 2013 pcPic->getPicSym()->setCUOrderMap(pcPic->getPicSym()->getNumberOfCUsInFrame(), pcPic->getPicSym()->getNumberOfCUsInFrame()); 2014 pcPic->getPicSym()->setInverseCUOrderMap(pcPic->getPicSym()->getNumberOfCUsInFrame(), pcPic->getPicSym()->getNumberOfCUsInFrame()); 2015 2016 //convert the start and end CU addresses of the slice and dependent slice into encoding order 2017 pcSlice->setSliceSegmentCurStartCUAddr( pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceSegmentCurStartCUAddr()) ); 2018 pcSlice->setSliceSegmentCurEndCUAddr( pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceSegmentCurEndCUAddr()) ); 2019 if(pcSlice->isNextSlice()) 2020 { 2021 pcSlice->setSliceCurStartCUAddr(pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceCurStartCUAddr())); 2022 pcSlice->setSliceCurEndCUAddr(pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceCurEndCUAddr())); 2023 } 2024 2025 if (m_bFirstSliceInPicture) 2026 { 2027 if(pcPic->getNumAllocatedSlice() != 1) 2028 { 2029 pcPic->clearSliceBuffer(); 1827 1828 m_pcPic->getPicSym()->initTiles(pcSlice->getPPS()); 1829 m_pcPic->getPicSym()->initCtuTsRsAddrMaps(); 1830 1831 // When decoding the slice header, the stored start and end addresses were actually RS addresses, not TS addresses. 1832 // Now, having set up the maps, convert them to the correct form. 1833 pcSlice->setSliceSegmentCurStartCtuTsAddr( m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceSegmentCurStartCtuTsAddr()) ); 1834 pcSlice->setSliceSegmentCurEndCtuTsAddr( m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceSegmentCurEndCtuTsAddr()) ); 1835 if(!pcSlice->getDependentSliceSegmentFlag()) 1836 { 1837 pcSlice->setSliceCurStartCtuTsAddr(m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceCurStartCtuTsAddr())); 1838 pcSlice->setSliceCurEndCtuTsAddr(m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceCurEndCtuTsAddr())); 1839 } 1840 1841 if (m_bFirstSliceInPicture) 1842 { 1843 if(m_pcPic->getNumAllocatedSlice() != 1) 1844 { 1845 m_pcPic->clearSliceBuffer(); 2030 1846 } 2031 1847 } 2032 1848 else 2033 1849 { 2034 pcPic->allocateNewSlice();2035 } 2036 assert( pcPic->getNumAllocatedSlice() == (m_uiSliceIdx + 1));2037 m_apcSlicePilot = pcPic->getPicSym()->getSlice(m_uiSliceIdx);2038 pcPic->getPicSym()->setSlice(pcSlice, m_uiSliceIdx);2039 2040 pcPic->setTLayer(nalu.m_temporalId);1850 m_pcPic->allocateNewSlice(); 1851 } 1852 assert(m_pcPic->getNumAllocatedSlice() == (m_uiSliceIdx + 1)); 1853 m_apcSlicePilot = m_pcPic->getPicSym()->getSlice(m_uiSliceIdx); 1854 m_pcPic->getPicSym()->setSlice(pcSlice, m_uiSliceIdx); 1855 1856 m_pcPic->setTLayer(nalu.m_temporalId); 2041 1857 2042 1858 #if SVC_EXTENSION 2043 pcPic->setLayerId(nalu.m_layerId);1859 m_pcPic->setLayerId(nalu.m_layerId); 2044 1860 pcSlice->setLayerId(nalu.m_layerId); 2045 pcSlice->setPic( pcPic);2046 #endif 2047 2048 if ( bNextSlice)1861 pcSlice->setPic(m_pcPic); 1862 #endif 1863 1864 if (!pcSlice->getDependentSliceSegmentFlag()) 2049 1865 { 2050 1866 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_associatedIRAPType, m_cListPic ); … … 2063 1879 if( !pcSlice->getVPS()->getSingleLayerForNonIrapFlag() || ( pcSlice->getVPS()->getSingleLayerForNonIrapFlag() && pcSlice->isIRAP() ) ) 2064 1880 #endif 2065 for( i = 0; i < pcSlice->getNumILRRefIdx(); i++ )1881 for( Int i = 0; i < pcSlice->getNumILRRefIdx(); i++ ) 2066 1882 { 2067 1883 UInt refLayerIdc = i; … … 2124 1940 #if REF_REGION_OFFSET 2125 1941 const Window &windowRL = pcSlice->getPPS()->getRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc)); 2126 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth( ) - windowRL.getWindowLeftOffset() - windowRL.getWindowRightOffset();2127 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight( ) - windowRL.getWindowTopOffset() - windowRL.getWindowBottomOffset();2128 #else 2129 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth( );2130 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight( );1942 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth(COMPONENT_Y) - windowRL.getWindowLeftOffset() - windowRL.getWindowRightOffset(); 1943 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight(COMPONENT_Y) - windowRL.getWindowTopOffset() - windowRL.getWindowBottomOffset(); 1944 #else 1945 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth(COMPONENT_Y); 1946 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight(COMPONENT_Y); 2131 1947 #if Q0200_CONFORMANCE_BL_SIZE 2132 1948 Int chromaFormatIdc = pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getChromaFormatIdc(); … … 2136 1952 #endif 2137 1953 #endif 2138 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();2139 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset();1954 Int widthEL = m_pcPic->getPicYuvRec()->getWidth(COMPONENT_Y) - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 1955 Int heightEL = m_pcPic->getPicYuvRec()->getHeight(COMPONENT_Y) - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 2140 1956 2141 1957 #if RESAMPLING_FIX … … 2188 2004 #endif 2189 2005 #if SVC_EXTENSION 2190 if( pcPic->isSpatialEnhLayer(refLayerIdc) )2006 if( m_pcPic->isSpatialEnhLayer(refLayerIdc) ) 2191 2007 { 2192 2008 // check for the sample prediction picture type … … 2196 2012 #if O0194_JOINT_US_BITSHIFT 2197 2013 #if Q0048_CGS_3D_ASYMLUT 2198 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec,pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() );2199 #else 2200 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(),pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() );2014 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, m_pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() ); 2015 #else 2016 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), m_pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() ); 2201 2017 #endif 2202 2018 #else 2203 2019 #if Q0048_CGS_3D_ASYMLUT 2204 2020 #if MOVE_SCALED_OFFSET_TO_PPS 2205 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec,pcPic->getPicYuvRec(), pcSlice->getPPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );2206 #else 2207 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec,pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );2208 #endif 2209 #else 2210 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(),pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );2021 m_cPrediction.upsampleBasePic( refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, m_pcPic->getPicYuvRec(), pcSlice->getPPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() ); 2022 #else 2023 m_cPrediction.upsampleBasePic( refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, m_pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() ); 2024 #endif 2025 #else 2026 m_cPrediction.upsampleBasePic( refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), m_pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); 2211 2027 #endif 2212 2028 #endif … … 2215 2031 #if Q0048_CGS_3D_ASYMLUT 2216 2032 #if REF_REGION_OFFSET 2217 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec,pcPic->getPicYuvRec(), scalEL, altRL );2218 #else 2219 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec,pcPic->getPicYuvRec(), scalEL );2220 #endif 2221 #else 2222 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(),pcPic->getPicYuvRec(), scalEL );2033 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, m_pcPic->getPicYuvRec(), scalEL, altRL ); 2034 #else 2035 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, m_pcPic->getPicYuvRec(), scalEL ); 2036 #endif 2037 #else 2038 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), m_pcPic->getPicYuvRec(), scalEL ); 2223 2039 #endif 2224 2040 #else 2225 2041 #if Q0048_CGS_3D_ASYMLUT 2226 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec,pcPic->getPicYuvRec(), scalEL );2227 #else 2228 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(),pcPic->getPicYuvRec(), scalEL );2042 m_cPrediction.upsampleBasePic( refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, m_pcPic->getPicYuvRec(), scalEL ); 2043 #else 2044 m_cPrediction.upsampleBasePic( refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), m_pcPic->getPicYuvRec(), scalEL ); 2229 2045 #endif 2230 2046 #endif … … 2234 2050 else 2235 2051 { 2236 pcPic->setFullPelBaseRec( refLayerIdc, pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec() );2237 } 2238 pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) );2052 m_pcPic->setFullPelBaseRec( refLayerIdc, pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec() ); 2053 } 2054 pcSlice->setFullPelBaseRec ( refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc) ); 2239 2055 #endif //SVC_EXTENSION 2240 2056 } … … 2243 2059 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) 2244 2060 { 2245 for( i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )2061 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 2246 2062 { 2247 2063 UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i); … … 2275 2091 #endif 2276 2092 2277 pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) );2093 pcSlice->setFullPelBaseRec ( refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc) ); 2278 2094 } 2279 2095 … … 2374 2190 bLowDelay = false; 2375 2191 } 2376 } 2377 } 2378 2379 pcSlice->setCheckLDC(bLowDelay); 2192 } 2193 } 2194 2195 pcSlice->setCheckLDC(bLowDelay); 2380 2196 } 2381 2197 … … 2384 2200 } 2385 2201 2386 pcPic->setCurrSliceIdx(m_uiSliceIdx);2202 m_pcPic->setCurrSliceIdx(m_uiSliceIdx); 2387 2203 if(pcSlice->getSPS()->getScalingListFlag()) 2388 2204 { … … 2399 2215 pcSlice->setDefaultScalingList(); 2400 2216 } 2401 m_cTrQuant.setScalingListDec(pcSlice->getScalingList() );2217 m_cTrQuant.setScalingListDec(pcSlice->getScalingList(), pcSlice->getSPS()->getChromaFormatIdc()); 2402 2218 m_cTrQuant.setUseScalingList(true); 2403 2219 } 2404 2220 else 2405 2221 { 2406 m_cTrQuant.setFlatScalingList( );2222 m_cTrQuant.setFlatScalingList(pcSlice->getSPS()->getChromaFormatIdc()); 2407 2223 m_cTrQuant.setUseScalingList(false); 2408 2224 } 2409 2225 2410 2226 // Decode a picture 2411 m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic);2227 m_cGopDecoder.decompressSlice(nalu.m_Bitstream, m_pcPic); 2412 2228 2413 2229 #if P0297_VPS_POC_LSB_ALIGNED_FLAG … … 2424 2240 { 2425 2241 TComVPS* vps = new TComVPS(); 2426 2242 2427 2243 m_cEntropyDecoder.decodeVPS( vps ); 2428 m_parameterSetManagerDecoder.storePrefetchedVPS(vps); 2244 m_parameterSetManagerDecoder.storePrefetchedVPS(vps); 2429 2245 } 2430 2246 … … 2433 2249 { 2434 2250 TComSPS* sps = new TComSPS(); 2251 #if O0043_BEST_EFFORT_DECODING 2252 sps->setForceDecodeBitDepth(m_forceDecodeBitDepth); 2253 #endif 2435 2254 sps->setLayerId(m_layerId); 2436 2255 #if SPS_DPB_PARAMS … … 2471 2290 { 2472 2291 TComSPS* sps = new TComSPS(); 2292 #if O0043_BEST_EFFORT_DECODING 2293 sps->setForceDecodeBitDepth(m_forceDecodeBitDepth); 2294 #endif 2473 2295 m_cEntropyDecoder.decodeSPS( sps ); 2474 2296 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); … … 2493 2315 } 2494 2316 #if LAYERS_NOT_PRESENT_SEI 2495 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() );2496 #else 2497 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );2317 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream ); 2318 #else 2319 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream ); 2498 2320 #endif 2499 2321 } … … 2501 2323 { 2502 2324 #if LAYERS_NOT_PRESENT_SEI 2503 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() );2504 #else 2505 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );2325 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream ); 2326 #else 2327 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream ); 2506 2328 #endif 2507 2329 SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS); … … 2539 2361 { 2540 2362 #if LAYERS_NOT_PRESENT_SEI 2541 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() ); 2542 #else 2543 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); 2363 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream ); 2364 #else 2365 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream ); 2366 2544 2367 #endif 2545 2368 } … … 2547 2370 { 2548 2371 #if LAYERS_NOT_PRESENT_SEI 2549 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() );2550 #else 2551 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );2372 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream ); 2373 #else 2374 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream ); 2552 2375 #endif 2553 2376 SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS); … … 2590 2413 #endif 2591 2414 xDecodeVPS(); 2415 #if RExt__DECODER_DEBUG_BIT_STATISTICS 2416 TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS,nalu.m_Bitstream->readByteAlignment(),0); 2417 #endif 2592 2418 #if Q0177_EOS_CHECKS 2593 2419 m_isLastNALWasEos = false; … … 2613 2439 #endif 2614 2440 return false; 2615 2441 2616 2442 case NAL_UNIT_SPS: 2617 2443 xDecodeSPS(); 2444 #if RExt__DECODER_DEBUG_BIT_STATISTICS 2445 TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS,nalu.m_Bitstream->readByteAlignment(),0); 2446 #endif 2618 2447 return false; 2619 2448 … … 2624 2453 #endif 2625 2454 ); 2455 #if RExt__DECODER_DEBUG_BIT_STATISTICS 2456 TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS,nalu.m_Bitstream->readByteAlignment(),0); 2457 #endif 2626 2458 return false; 2627 2459 2628 2460 case NAL_UNIT_PREFIX_SEI: 2629 2461 case NAL_UNIT_SUFFIX_SEI: … … 2673 2505 #endif 2674 2506 break; 2675 2507 2676 2508 case NAL_UNIT_EOS: 2677 2509 #if Q0177_EOS_CHECKS … … 2689 2521 m_pocRandomAccess = MAX_INT; 2690 2522 m_prevPOC = MAX_INT; 2691 m_bFirstSliceInPicture = true;2692 m_bFirstSliceInSequence = true;2693 2523 m_prevSliceSkipped = false; 2694 2524 m_skippedPOC = 0; 2695 2525 return false; 2696 2526 2697 2527 case NAL_UNIT_ACCESS_UNIT_DELIMITER: 2698 2528 // TODO: process AU delimiter 2699 2529 return false; 2700 2530 2701 2531 case NAL_UNIT_EOB: 2702 2532 #if P0130_EOB … … 2708 2538 #endif 2709 2539 return false; 2710 2540 2711 2541 case NAL_UNIT_FILLER_DATA: 2712 2542 #if Q0177_EOS_CHECKS … … 2714 2544 #endif 2715 2545 return false; 2716 2546 2717 2547 case NAL_UNIT_RESERVED_VCL_N10: 2718 2548 case NAL_UNIT_RESERVED_VCL_R11: … … 2721 2551 case NAL_UNIT_RESERVED_VCL_N14: 2722 2552 case NAL_UNIT_RESERVED_VCL_R15: 2723 2553 2724 2554 case NAL_UNIT_RESERVED_IRAP_VCL22: 2725 2555 case NAL_UNIT_RESERVED_IRAP_VCL23: 2726 2556 2727 2557 case NAL_UNIT_RESERVED_VCL24: 2728 2558 case NAL_UNIT_RESERVED_VCL25: … … 2733 2563 case NAL_UNIT_RESERVED_VCL30: 2734 2564 case NAL_UNIT_RESERVED_VCL31: 2735 2565 2736 2566 case NAL_UNIT_RESERVED_NVCL41: 2737 2567 case NAL_UNIT_RESERVED_NVCL42: … … 2760 2590 default: 2761 2591 assert (0); 2592 break; 2762 2593 } 2763 2594 … … 2773 2604 Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay) 2774 2605 { 2775 if ((m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_N_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_RADL) && 2606 if ((m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_N_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_RADL) && 2776 2607 m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) 2777 2608 { … … 2791 2622 * If the random access point is CRA/CRANT/BLA/BLANT, TFD pictures with POC less than the POC of the random access point are skipped. 2792 2623 * If the random access point is IDR all pictures after the random access point are decoded. 2793 * If the random access point is none of the above, a warning is issues, and decoding of pictures with POC 2794 * equal to or greater than the random access point POC is attempted. For non IDR/CRA/BLA random 2624 * If the random access point is none of the above, a warning is issues, and decoding of pictures with POC 2625 * equal to or greater than the random access point POC is attempted. For non IDR/CRA/BLA random 2795 2626 * access point there is no guarantee that the decoder will not crash. 2796 2627 */ 2797 2628 Bool TDecTop::isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay) 2798 2629 { 2799 if (iSkipFrame) 2630 if (iSkipFrame) 2800 2631 { 2801 2632 iSkipFrame--; // decrement the counter … … 2816 2647 m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. 2817 2648 } 2818 else 2649 else 2819 2650 { 2820 2651 static Bool warningMessage = false; … … 2834 2665 } 2835 2666 // if we reach here, then the picture is not skipped. 2836 return false; 2667 return false; 2837 2668 } 2838 2669 2839 2670 #if SVC_EXTENSION 2671 #if !REPN_FORMAT_IN_VPS 2672 Void TDecTop::xInitILRP(TComSPS *pcSPS) 2673 #else 2674 Void TDecTop::xInitILRP(TComSlice *slice) 2675 #endif 2676 { 2677 #if REPN_FORMAT_IN_VPS 2678 TComSPS* pcSPS = slice->getSPS(); 2679 Int bitDepthY = slice->getBitDepthY(); 2680 Int bitDepthC = slice->getBitDepthC(); 2681 Int picWidth = slice->getPicWidthInLumaSamples(); 2682 Int picHeight = slice->getPicHeightInLumaSamples(); 2683 #endif 2684 if(m_layerId>0) 2685 { 2686 #if REPN_FORMAT_IN_VPS 2687 g_bitDepth[CHANNEL_TYPE_LUMA] = bitDepthY; 2688 g_bitDepth[CHANNEL_TYPE_CHROMA] = bitDepthC; 2689 #else 2690 g_bitDepth[CHANNEL_TYPE_LUMA] = pcSPS->getBitDepthY(); 2691 g_bitDepth[CHANNEL_TYPE_CHROMA] = pcSPS->getBitDepthC(); 2692 #endif 2693 g_uiMaxCUWidth = pcSPS->getMaxCUWidth(); 2694 g_uiMaxCUHeight = pcSPS->getMaxCUHeight(); 2695 g_uiMaxCUDepth = pcSPS->getMaxCUDepth(); 2696 g_uiAddCUDepth = max (0, pcSPS->getLog2MinCodingBlockSize() - (Int)pcSPS->getQuadtreeTULog2MinSize() ); 2697 2698 Int numReorderPics[MAX_TLAYER]; 2699 #if R0156_CONF_WINDOW_IN_REP_FORMAT 2700 Window &conformanceWindow = slice->getConformanceWindow(); 2701 #else 2702 Window &conformanceWindow = pcSPS->getConformanceWindow(); 2703 #endif 2704 Window defaultDisplayWindow = pcSPS->getVuiParametersPresentFlag() ? pcSPS->getVuiParameters()->getDefaultDisplayWindow() : Window(); 2705 2706 for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++) 2707 { 2708 #if USE_DPB_SIZE_TABLE 2709 if( getCommonDecoderParams()->getTargetOutputLayerSetIdx() == 0 ) 2710 { 2711 assert( this->getLayerId() == 0 ); 2712 numReorderPics[temporalLayer] = pcSPS->getNumReorderPics(temporalLayer); 2713 } 2714 else 2715 { 2716 TComVPS *vps = slice->getVPS(); 2717 // SHM decoders will use DPB size table in the VPS to determine the number of reorder pictures. 2718 numReorderPics[temporalLayer] = vps->getMaxVpsNumReorderPics( getCommonDecoderParams()->getTargetOutputLayerSetIdx() , temporalLayer); 2719 } 2720 #else 2721 numReorderPics[temporalLayer] = pcSPS->getNumReorderPics(temporalLayer); 2722 #endif 2723 } 2724 2725 if (m_cIlpPic[0] == NULL) 2726 { 2727 for (Int j=0; j < m_numDirectRefLayers; j++) 2728 { 2729 2730 m_cIlpPic[j] = new TComPic; 2731 2732 #if AUXILIARY_PICTURES 2733 #if REPN_FORMAT_IN_VPS 2734 m_cIlpPic[j]->create(picWidth, picHeight, slice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true); 2735 #else 2736 m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), pcSPS->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true); 2737 #endif 2738 #else 2739 #if REPN_FORMAT_IN_VPS 2740 m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true); 2741 #else 2742 m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true); 2743 #endif 2744 #endif 2745 for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCtusInFrame(); i++) 2746 { 2747 m_cIlpPic[j]->getPicSym()->getCtu(i)->initCtu(m_cIlpPic[j], i); 2748 } 2749 } 2750 } 2751 } 2752 } 2753 2840 2754 #if VPS_EXTN_DIRECT_REF_LAYERS 2841 2755 TDecTop* TDecTop::getRefLayerDec( UInt refLayerIdc ) … … 2902 2816 } 2903 2817 } 2904 2818 #endif 2819 2820 #if EARLY_REF_PIC_MARKING 2821 Void TDecTop::earlyPicMarking(Int maxTemporalLayer, std::vector<Int>& targetDecLayerIdSet) 2822 { 2823 UInt currTid = m_pcPic->getTLayer(); 2824 UInt highestTid = (maxTemporalLayer >= 0) ? maxTemporalLayer : (m_pcPic->getSlice(0)->getSPS()->getMaxTLayers() - 1); 2825 UInt latestDecLayerId = m_layerId; 2826 UInt numTargetDecLayers = 0; 2827 Int targetDecLayerIdList[MAX_LAYERS]; 2828 UInt latestDecIdx = 0; 2829 TComSlice* pcSlice = m_pcPic->getSlice(0); 2830 2831 if ( currTid != highestTid ) // Marking process is only applicaple for highest decoded TLayer 2832 { 2833 return; 2834 } 2835 2836 // currPic must be marked as "used for reference" and must be a sub-layer non-reference picture 2837 if ( !((pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || 2838 pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || 2839 pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || 2840 pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || 2841 pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N || 2842 pcSlice->getNalUnitType() == NAL_UNIT_RESERVED_VCL_N10 || 2843 pcSlice->getNalUnitType() == NAL_UNIT_RESERVED_VCL_N12 || 2844 pcSlice->getNalUnitType() == NAL_UNIT_RESERVED_VCL_N14) && pcSlice->isReferenced())) 2845 { 2846 return; 2847 } 2848 2849 if ( targetDecLayerIdSet.size() == 0 ) // Cannot mark if we don't know the number of scalable layers 2850 { 2851 return; 2852 } 2853 2854 for (std::vector<Int>::iterator it = targetDecLayerIdSet.begin(); it != targetDecLayerIdSet.end(); it++) 2855 { 2856 if ( latestDecLayerId == (*it) ) 2857 { 2858 latestDecIdx = numTargetDecLayers; 2859 } 2860 targetDecLayerIdList[numTargetDecLayers++] = (*it); 2861 } 2862 2863 Int remainingInterLayerReferencesFlag = 0; 2864 #if O0225_MAX_TID_FOR_REF_LAYERS 2865 for ( Int j = latestDecIdx + 1; j < numTargetDecLayers; j++ ) 2866 { 2867 Int jLidx = pcSlice->getVPS()->getLayerIdInVps(targetDecLayerIdList[j]); 2868 if ( currTid <= pcSlice->getVPS()->getMaxTidIlRefPicsPlus1(latestDecLayerId,jLidx) - 1 ) 2869 { 2870 #else 2871 if ( currTid <= pcSlice->getVPS()->getMaxTidIlRefPicsPlus1(latestDecLayerId) - 1 ) 2872 { 2873 for ( Int j = latestDecIdx + 1; j < numTargetDecLayers; j++ ) 2874 { 2875 #endif 2876 for ( Int k = 0; k < m_ppcTDecTop[targetDecLayerIdList[j]]->getNumDirectRefLayers(); k++ ) 2877 { 2878 if ( latestDecIdx == m_ppcTDecTop[targetDecLayerIdList[j]]->getRefLayerId(k) ) 2879 { 2880 remainingInterLayerReferencesFlag = 1; 2881 } 2882 } 2883 } 2884 } 2885 2886 if ( remainingInterLayerReferencesFlag == 0 ) 2887 { 2888 pcSlice->setReferenced(false); 2889 } 2890 } 2905 2891 #endif 2906 2892
Note: See TracChangeset for help on using the changeset viewer.