Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/TDecTop.cpp
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibDecoder/TDecTop.cpp
r1196 r1313 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 * … … 38 38 #include "NALread.h" 39 39 #include "TDecTop.h" 40 41 #if H_MV 42 ParameterSetManagerDecoder TDecTop::m_parameterSetManagerDecoder; 43 #endif 40 #if NH_MV 41 ParameterSetManager TDecTop::m_parameterSetManager; 42 #endif 43 44 44 //! \ingroup TLibDecoder 45 45 //! \{ 46 46 47 #if H_3D47 #if NH_3D 48 48 CamParsCollector::CamParsCollector() 49 49 : m_bInitialized( false ) … … 81 81 82 82 Void 83 CamParsCollector::init( FILE* pCodedScaleOffsetFile,TComVPS* vps)83 CamParsCollector::init( const TComVPS* vps) 84 84 { 85 85 assert( !isInitialized() ); // Only one initialization currently supported 86 86 m_bInitialized = true; 87 87 m_vps = vps; 88 m_bCamParsVaryOverTime = false; 89 m_pCodedScaleOffsetFile = pCodedScaleOffsetFile; 88 m_bCamParsVaryOverTime = false; 90 89 m_lastPoc = -1; 91 90 m_firstReceivedPoc = -2; … … 221 220 } 222 221 223 Void 224 CamParsCollector::setSlice( TComSlice* pcSlice ) 222 Void CamParsCollector::setSlice( const TComSlice* pcSlice ) 225 223 { 226 224 if( pcSlice == 0 ) … … 293 291 294 292 295 #if H_3D_IV_MERGE 293 #if !NH_3D_FIX_TICKET_101 294 #if NH_3D_IV_MERGE 296 295 Void 297 296 CamParsCollector::copyCamParamForSlice( TComSlice* pcSlice ) … … 302 301 } 303 302 } 303 #endif 304 304 #endif 305 305 … … 348 348 #endif 349 349 350 350 351 TDecTop::TDecTop() 351 { 352 m_pcPic = 0; 353 m_iMaxRefPicNum = 0; 352 : m_iMaxRefPicNum(0) 353 , m_associatedIRAPType(NAL_UNIT_INVALID) 354 , m_pocCRA(0) 355 , m_pocRandomAccess(MAX_INT) 356 , m_cListPic() 357 #if !NH_MV 358 , m_parameterSetManager() 359 #endif 360 , m_apcSlicePilot(NULL) 361 , m_SEIs() 362 , m_cPrediction() 363 , m_cTrQuant() 364 , m_cGopDecoder() 365 , m_cSliceDecoder() 366 , m_cCuDecoder() 367 , m_cEntropyDecoder() 368 , m_cCavlcDecoder() 369 , m_cSbacDecoder() 370 , m_cBinCABAC() 371 , m_seiReader() 372 , m_cLoopFilter() 373 , m_cSAO() 374 , m_pcPic(NULL) 375 , m_prevPOC(MAX_INT) 376 , m_prevTid0POC(0) 377 , m_bFirstSliceInPicture(true) 378 , m_bFirstSliceInSequence(true) 379 , m_prevSliceSkipped(false) 380 , m_skippedPOC(0) 381 , m_bFirstSliceInBitstream(true) 382 , m_lastPOCNoOutputPriorPics(-1) 383 , m_isNoOutputPriorPics(false) 384 , m_craNoRaslOutputFlag(false) 385 #if O0043_BEST_EFFORT_DECODING 386 , m_forceDecodeBitDepth(8) 387 #endif 388 , m_pDecodedSEIOutputStream(NULL) 389 , m_warningMessageSkipPicture(false) 390 , m_prefixSEINALUs() 391 { 354 392 #if ENC_DEC_TRACE 355 #if H_MV393 #if NH_MV 356 394 if ( g_hTrace == NULL ) 357 395 { 358 396 #endif 359 g_hTrace = fopen( "TraceDec.txt", "wb" ); 397 if (g_hTrace == NULL) 398 { 399 g_hTrace = fopen( "TraceDec.txt", "wb" ); 400 } 360 401 g_bJustDoIt = g_bEncDecTraceDisable; 361 402 g_nSymbolCounter = 0; 362 #if H_MV 363 } 364 #endif 365 #endif 366 m_associatedIRAPType = NAL_UNIT_INVALID; 367 m_pocCRA = 0; 368 m_pocRandomAccess = MAX_INT; 369 m_prevPOC = MAX_INT; 370 m_bFirstSliceInPicture = true; 371 m_bFirstSliceInSequence = true; 372 m_prevSliceSkipped = false; 373 m_skippedPOC = 0; 374 #if SETTING_NO_OUT_PIC_PRIOR 375 m_bFirstSliceInBitstream = true; 376 m_lastPOCNoOutputPriorPics = -1; 377 m_craNoRaslOutputFlag = false; 378 m_isNoOutputPriorPics = false; 379 #endif 380 #if H_MV 403 #if NH_MV 404 } 405 #endif 406 #endif 407 #if NH_MV 381 408 m_isLastNALWasEos = false; 382 409 m_layerId = 0; 383 410 m_viewId = 0; 384 #if H_3D411 #if NH_3D 385 412 m_viewIndex = 0; 386 413 m_isDepth = false; 387 414 m_pcCamParsCollector = 0; 388 415 #endif 389 #if H_MV 390 m_targetOptLayerSetIdx = -1; 391 #endif 392 #endif 416 #if NH_MV 417 m_targetOlsIdx = -1; 418 #endif 419 #endif 420 393 421 } 394 422 … … 396 424 { 397 425 #if ENC_DEC_TRACE 398 fclose( g_hTrace ); 399 #endif 426 #if H_MV_ENC_DEC_TRAC_FIX 427 if (g_hTrace != stdout && g_hTrace != NULL) 428 #else 429 if (g_hTrace != stdout) 430 #endif 431 { 432 fclose( g_hTrace ); 433 #if H_MV_ENC_DEC_TRAC_FIX 434 g_hTrace = NULL; 435 #endif 436 } 437 #endif 438 while (!m_prefixSEINALUs.empty()) 439 { 440 delete m_prefixSEINALUs.front(); 441 m_prefixSEINALUs.pop_front(); 442 } 400 443 } 401 444 … … 410 453 { 411 454 m_cGopDecoder.destroy(); 412 455 413 456 delete m_apcSlicePilot; 414 457 m_apcSlicePilot = NULL; 415 458 416 459 m_cSliceDecoder.destroy(); 417 460 } … … 420 463 { 421 464 // initialize ROM 422 #if ! H_MV465 #if !NH_MV 423 466 initROM(); 424 467 #endif 425 #if H_3D468 #if NH_MV 426 469 m_cCavlcDecoder.setDecTop( this ); 427 470 #endif 428 m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO 471 m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO); 429 472 m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder ); 430 473 m_cEntropyDecoder.init(&m_cPrediction); … … 435 478 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); 436 479 Int iSize = Int( m_cListPic.size() ); 437 480 438 481 for (Int i = 0; i < iSize; i++ ) 439 482 { 440 483 TComPic* pcPic = *(iterPic++); 441 #if H_MV484 #if NH_MV 442 485 if( pcPic ) 443 486 { 444 487 #endif 445 488 pcPic->destroy(); 446 489 447 490 delete pcPic; 448 491 pcPic = NULL; 449 #if H_MV450 } 451 #endif 452 } 453 492 #if NH_MV 493 } 494 #endif 495 } 496 454 497 m_cSAO.destroy(); 455 498 456 499 m_cLoopFilter. destroy(); 457 458 #if ! H_MV500 501 #if !NH_MV 459 502 // destroy ROM 460 503 destroyROM(); … … 462 505 } 463 506 464 Void TDecTop::xGetNewPicBuffer ( TComSlice* pcSlice, TComPic*& rpcPic ) 465 { 466 Int numReorderPics[MAX_TLAYER]; 467 Window &conformanceWindow = pcSlice->getSPS()->getConformanceWindow(); 468 Window defaultDisplayWindow = pcSlice->getSPS()->getVuiParametersPresentFlag() ? pcSlice->getSPS()->getVuiParameters()->getDefaultDisplayWindow() : Window(); 469 470 #if H_MV 471 assert( conformanceWindow .getScaledFlag() ); 472 assert( defaultDisplayWindow.getScaledFlag() ); 473 #endif 474 for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++) 475 { 476 #if H_MV 477 numReorderPics[temporalLayer] = ( getLayerId() == 0 ) ? pcSlice->getSPS()->getNumReorderPics(temporalLayer) : pcSlice->getVPS()->getNumReorderPics(temporalLayer); 478 #else 479 numReorderPics[temporalLayer] = pcSlice->getSPS()->getNumReorderPics(temporalLayer); 480 #endif 481 } 482 #if H_MV 507 Void TDecTop::xGetNewPicBuffer ( const TComSPS &sps, const TComPPS &pps, TComPic*& rpcPic, const UInt temporalLayer ) 508 { 509 #if NH_MV 483 510 if ( getLayerId() == 0 ) 484 511 { 485 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer());512 m_iMaxRefPicNum = sps.getMaxDecPicBuffering(temporalLayer); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 486 513 } 487 514 else 488 515 { 489 m_iMaxRefPicNum = pcSlice->getVPS()->getMaxDecPicBuffering(pcSlice->getTLayer()); 490 #if H_MV_HLS7_GEN 516 //GTCIC 517 //m_iMaxRefPicNum = pcSlice->getVPS()->getMaxDecPicBuffering(pcSlice->getTLayer()); 518 #if H_MV_HLS7_GEN 491 519 TComVPS* vps = pcSlice->getVPS(); 492 520 TComDpbSize* dpbSize = vps->getDpbSize(); … … 498 526 } 499 527 #else 500 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded528 m_iMaxRefPicNum = sps.getMaxDecPicBuffering(temporalLayer); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 501 529 #endif 502 530 if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) 503 531 { 504 532 rpcPic = new TComPic(); 505 506 rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,507 conformanceWindow, defaultDisplayWindow, numReorderPics, true); 533 534 rpcPic->create ( sps, pps, true); 535 508 536 m_cListPic.pushBack( rpcPic ); 509 537 510 538 return; 511 539 } 512 540 513 541 Bool bBufferIsAvailable = false; 514 542 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); … … 519 547 { 520 548 rpcPic->setOutputMark(false); 521 #if H_MV549 #if NH_MV 522 550 rpcPic->setPicOutputFlag(false); 523 551 #endif … … 529 557 { 530 558 rpcPic->setOutputMark(false); 531 #if H_MV559 #if NH_MV 532 560 rpcPic->setPicOutputFlag(false); 533 561 #endif … … 538 566 } 539 567 } 540 568 541 569 if ( !bBufferIsAvailable ) 542 570 { … … 547 575 } 548 576 rpcPic->destroy(); 549 rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 550 conformanceWindow, defaultDisplayWindow, numReorderPics, true); 551 } 552 553 #if H_MV 577 rpcPic->create ( sps, pps, true); 578 } 579 #if NH_MV 554 580 Void TDecTop::endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic, std::vector<Int>& targetDecLayerIdSet ) 555 581 #else … … 562 588 return; 563 589 } 564 565 TComPic* &pcPic = m_pcPic;590 591 TComPic* pcPic = m_pcPic; 566 592 567 593 // Execute Deblock + Cleanup … … 571 597 TComSlice::sortPicList( m_cListPic ); // sorting for application output 572 598 poc = pcPic->getSlice(m_uiSliceIdx-1)->getPOC(); 573 rpcListPic = &m_cListPic; 574 m_cCuDecoder.destroy(); 575 #if H_MV599 rpcListPic = &m_cListPic; 600 m_cCuDecoder.destroy(); 601 #if NH_MV 576 602 TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); 577 603 TComSlice::markCurrPic( pcPic ); … … 582 608 } 583 609 584 #if SETTING_NO_OUT_PIC_PRIOR 585 Void TDecTop::checkNoOutputPriorPics (TComList<TComPic*>*& rpcListPic) 586 { 587 if (!rpcListPic || !m_isNoOutputPriorPics) return; 588 589 TComList<TComPic*>::iterator iterPic = rpcListPic->begin(); 590 591 while (iterPic != rpcListPic->end()) 592 { 593 TComPic*& pcPicTmp = *(iterPic++); 610 Void TDecTop::checkNoOutputPriorPics (TComList<TComPic*>* pcListPic) 611 { 612 if (!pcListPic || !m_isNoOutputPriorPics) 613 { 614 return; 615 } 616 617 TComList<TComPic*>::iterator iterPic = pcListPic->begin(); 618 619 while (iterPic != pcListPic->end()) 620 { 621 TComPic* pcPicTmp = *(iterPic++); 594 622 if (m_lastPOCNoOutputPriorPics != pcPicTmp->getPOC()) 595 623 { 596 624 pcPicTmp->setOutputMark(false); 597 #if H_MV625 #if NH_MV 598 626 pcPicTmp->setPicOutputFlag(false); 599 627 #endif … … 601 629 } 602 630 } 603 #endif 604 605 Void TDecTop::xCreateLostPicture(Int iLostPoc) 631 632 Void TDecTop::xCreateLostPicture(Int iLostPoc) 606 633 { 607 634 printf("\ninserting lost poc : %d\n",iLostPoc); 608 TComSlice cFillSlice;609 cFillSlice.setSPS( m_parameterSetManagerDecoder.getFirstSPS() );610 cFillSlice.setPPS( m_parameterSetManagerDecoder.getFirstPPS() );611 cFillSlice.initSlice();612 635 TComPic *cFillPic; 613 xGetNewPicBuffer(&cFillSlice,cFillPic); 614 cFillPic->getSlice(0)->setSPS( m_parameterSetManagerDecoder.getFirstSPS() ); 615 cFillPic->getSlice(0)->setPPS( m_parameterSetManagerDecoder.getFirstPPS() ); 636 xGetNewPicBuffer(*(m_parameterSetManager.getFirstSPS()), *(m_parameterSetManager.getFirstPPS()), cFillPic, 0); 616 637 cFillPic->getSlice(0)->initSlice(); 617 638 618 639 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); 619 640 Int closestPoc = 1000000; … … 638 659 } 639 660 cFillPic->setCurrSliceIdx(0); 640 for(Int i=0; i<cFillPic->getNumCUsInFrame(); i++)641 { 642 cFillPic->getC U(i)->initCU(cFillPic,i);661 for(Int ctuRsAddr=0; ctuRsAddr<cFillPic->getNumberOfCtusInFrame(); ctuRsAddr++) 662 { 663 cFillPic->getCtu(ctuRsAddr)->initCtu(cFillPic, ctuRsAddr); 643 664 } 644 665 cFillPic->getSlice(0)->setReferenced(true); 645 666 cFillPic->getSlice(0)->setPOC(iLostPoc); 667 xUpdatePreviousTid0POC(cFillPic->getSlice(0)); 646 668 cFillPic->setReconMark(true); 647 669 cFillPic->setOutputMark(true); … … 655 677 Void TDecTop::xActivateParameterSets() 656 678 { 657 m_parameterSetManagerDecoder.applyPrefetchedPS(); 658 659 TComPPS *pps = m_parameterSetManagerDecoder.getPPS(m_apcSlicePilot->getPPSId()); 660 assert (pps != 0); 661 662 TComSPS *sps = m_parameterSetManagerDecoder.getSPS(pps->getSPSId()); 663 assert (sps != 0); 664 665 #if H_MV 666 TComVPS* vps = m_parameterSetManagerDecoder.getVPS(sps->getVPSId()); 667 assert (vps != 0); 668 if (!m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP(), m_layerId ) ) 669 #else 670 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP())) 671 #endif 672 { 673 printf ("Parameter set activation failed!"); 674 assert (0); 675 } 676 677 #if H_MV 678 sps->inferSpsMaxDecPicBufferingMinus1( vps, m_targetOptLayerSetIdx, getLayerId(), false ); 679 if (m_bFirstSliceInPicture) 680 { 681 const TComPPS *pps = m_parameterSetManager.getPPS(m_apcSlicePilot->getPPSId()); // this is a temporary PPS object. Do not store this value 682 assert (pps != 0); 683 684 const TComSPS *sps = m_parameterSetManager.getSPS(pps->getSPSId()); // this is a temporary SPS object. Do not store this value 685 assert (sps != 0); 686 687 m_parameterSetManager.clearSPSChangedFlag(sps->getSPSId()); 688 m_parameterSetManager.clearPPSChangedFlag(pps->getPPSId()); 689 #if NH_MV 690 const TComVPS* vps = m_parameterSetManager.getVPS(sps->getVPSId()); 691 assert (vps != 0); 692 if (!m_parameterSetManager.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP(), m_layerId ) ) 693 #else 694 if (false == m_parameterSetManager.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP())) 695 #endif 696 { 697 printf ("Parameter set activation failed!"); 698 assert (0); 699 } 700 701 #if NH_MV 679 702 // When the value of vps_num_rep_formats_minus1 in the active VPS is equal to 0 680 703 if ( vps->getVpsNumRepFormatsMinus1() == 0 ) … … 684 707 } 685 708 sps->checkRpsMaxNumPics( vps, getLayerId() ); 686 687 if( sps->getLayerId() != 0 )688 {689 sps->inferSpsMaxSubLayersMinus1( true, vps );690 }691 709 692 710 // It is a requirement of bitstream conformance that, when the SPS is referred to by … … 698 716 assert( sps->getMultiLayerExtSpsFlag() == 0 ); 699 717 } 700 701 if( sps->getMultiLayerExtSpsFlag() ) 702 { 703 sps->setTemporalIdNestingFlag( (sps->getMaxTLayers() > 1) ? vps->getTemporalNestingFlag() : true ); 704 } 705 #endif 706 707 if( pps->getDependentSliceSegmentsEnabledFlag() ) 708 { 709 Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1; 710 711 if (m_cSliceDecoder.getCtxMemSize() != NumCtx) 712 { 713 m_cSliceDecoder.initCtxMem(NumCtx); 714 for ( UInt st = 0; st < NumCtx; st++ ) 715 { 716 TDecSbac* ctx = NULL; 717 ctx = new TDecSbac; 718 ctx->init( &m_cBinCABAC ); 719 m_cSliceDecoder.setCtxMem( ctx, st ); 720 } 721 } 722 } 723 724 m_apcSlicePilot->setPPS(pps); 725 m_apcSlicePilot->setSPS(sps); 726 #if H_MV 727 m_apcSlicePilot->setVPS(vps); 728 // The nuh_layer_id value of the NAL unit containing the PPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA. 729 assert( pps->getLayerId() == m_layerId || pps->getLayerId( ) == 0 || vps->getDependencyFlag( m_layerId, pps->getLayerId() ) ); 730 // The nuh_layer_id value of the NAL unit containing the SPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA. 731 assert( sps->getLayerId() == m_layerId || sps->getLayerId( ) == 0 || vps->getDependencyFlag( m_layerId, sps->getLayerId() ) ); 732 sps->inferRepFormat ( vps , m_layerId ); 733 sps->inferScalingList( m_parameterSetManagerDecoder.getActiveSPS( sps->getSpsScalingListRefLayerId() ) ); 734 735 #endif 736 pps->setSPS(sps); 737 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumTileColumnsMinus1() + 1) : 1); 738 pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) ); 739 740 g_bitDepthY = sps->getBitDepthY(); 741 g_bitDepthC = sps->getBitDepthC(); 742 g_uiMaxCUWidth = sps->getMaxCUWidth(); 743 g_uiMaxCUHeight = sps->getMaxCUHeight(); 744 g_uiMaxCUDepth = sps->getMaxCUDepth(); 745 g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() ); 746 747 for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++) 748 { 749 sps->setAMPAcc( i, sps->getUseAMP() ); 750 } 751 752 for (Int i = sps->getLog2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++) 753 { 754 sps->setAMPAcc( i, 0 ); 755 } 756 757 m_cSAO.destroy(); 758 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth() ); 759 m_cLoopFilter.create( sps->getMaxCUDepth() ); 760 } 761 762 #if H_MV 718 #endif 719 720 xParsePrefixSEImessages(); 721 722 #if RExt__HIGH_BIT_DEPTH_SUPPORT==0 723 if (sps->getSpsRangeExtension().getExtendedPrecisionProcessingFlag() || sps->getBitDepth(CHANNEL_TYPE_LUMA)>12 || sps->getBitDepth(CHANNEL_TYPE_CHROMA)>12 ) 724 { 725 printf("High bit depth support must be enabled at compile-time in order to decode this bitstream\n"); 726 assert (0); 727 exit(1); 728 } 729 #endif 730 731 // NOTE: globals were set up here originally. You can now use: 732 // g_uiMaxCUDepth = sps->getMaxTotalCUDepth(); 733 // g_uiAddCUDepth = sps->getMaxTotalCUDepth() - sps->getLog2DiffMaxMinCodingBlockSize() 734 735 // Get a new picture buffer. This will also set up m_pcPic, and therefore give us a SPS and PPS pointer that we can use. 736 xGetNewPicBuffer (*(sps), *(pps), m_pcPic, m_apcSlicePilot->getTLayer()); 737 m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); 738 #if NH_MV 739 m_apcSlicePilot->createInterLayerReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); 740 #endif 741 742 // make the slice-pilot a real slice, and set up the slice-pilot for the next slice 743 assert(m_pcPic->getNumAllocatedSlice() == (m_uiSliceIdx + 1)); 744 m_apcSlicePilot = m_pcPic->getPicSym()->swapSliceObject(m_apcSlicePilot, m_uiSliceIdx); 745 746 // we now have a real slice: 747 TComSlice *pSlice = m_pcPic->getSlice(m_uiSliceIdx); 748 749 // Update the PPS and SPS pointers with the ones of the picture. 750 pps=pSlice->getPPS(); 751 sps=pSlice->getSPS(); 752 753 #if NH_MV 754 vps=pSlice->getVPS(); 755 // The nuh_layer_id value of the NAL unit containing the PPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA. 756 assert( pps->getLayerId() == m_layerId || pps->getLayerId( ) == 0 || vps->getDependencyFlag( m_layerId, pps->getLayerId() ) ); 757 // The nuh_layer_id value of the NAL unit containing the SPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA. 758 assert( sps->getLayerId() == m_layerId || sps->getLayerId( ) == 0 || vps->getDependencyFlag( m_layerId, sps->getLayerId() ) ); 759 #endif 760 761 #if NH_3D 762 if ( !m_pcCamParsCollector->isInitialized() ) 763 { 764 m_pcCamParsCollector->init( vps ); 765 } 766 #endif 767 // Initialise the various objects for the new set of settings 768 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTotalCUDepth(), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA) ); 769 m_cLoopFilter.create( sps->getMaxTotalCUDepth() ); 770 m_cPrediction.initTempBuff(sps->getChromaFormatIdc()); 771 772 773 Bool isField = false; 774 Bool isTopField = false; 775 776 if(!m_SEIs.empty()) 777 { 778 // Check if any new Picture Timing SEI has arrived 779 SEIMessages pictureTimingSEIs = getSeisByType(m_SEIs, SEI::PICTURE_TIMING); 780 if (pictureTimingSEIs.size()>0) 781 { 782 SEIPictureTiming* pictureTiming = (SEIPictureTiming*) *(pictureTimingSEIs.begin()); 783 isField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 2) || (pictureTiming->m_picStruct == 9) || (pictureTiming->m_picStruct == 10) || (pictureTiming->m_picStruct == 11) || (pictureTiming->m_picStruct == 12); 784 isTopField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 9) || (pictureTiming->m_picStruct == 11); 785 } 786 } 787 788 //Set Field/Frame coding mode 789 m_pcPic->setField(isField); 790 m_pcPic->setTopField(isTopField); 791 792 // transfer any SEI messages that have been received to the picture 793 m_pcPic->setSEIs(m_SEIs); 794 m_SEIs.clear(); 795 796 // Recursive structure 797 m_cCuDecoder.create ( sps->getMaxTotalCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getChromaFormatIdc() ); 798 m_cCuDecoder.init ( &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction ); 799 m_cTrQuant.init ( sps->getMaxTrSize() ); 800 801 m_cSliceDecoder.create(); 802 } 803 else 804 { 805 // make the slice-pilot a real slice, and set up the slice-pilot for the next slice 806 m_pcPic->allocateNewSlice(); 807 assert(m_pcPic->getNumAllocatedSlice() == (m_uiSliceIdx + 1)); 808 m_apcSlicePilot = m_pcPic->getPicSym()->swapSliceObject(m_apcSlicePilot, m_uiSliceIdx); 809 810 TComSlice *pSlice = m_pcPic->getSlice(m_uiSliceIdx); // we now have a real slice. 811 812 const TComSPS *sps = pSlice->getSPS(); 813 const TComPPS *pps = pSlice->getPPS(); 814 815 // check that the current active PPS has not changed... 816 if (m_parameterSetManager.getSPSChangedFlag(sps->getSPSId()) ) 817 { 818 printf("Error - a new SPS has been decoded while processing a picture\n"); 819 exit(1); 820 } 821 if (m_parameterSetManager.getPPSChangedFlag(pps->getPPSId()) ) 822 { 823 printf("Error - a new PPS has been decoded while processing a picture\n"); 824 exit(1); 825 } 826 827 xParsePrefixSEImessages(); 828 829 // Check if any new SEI has arrived 830 if(!m_SEIs.empty()) 831 { 832 // Currently only decoding Unit SEI message occurring between VCL NALUs copied 833 SEIMessages &picSEI = m_pcPic->getSEIs(); 834 SEIMessages decodingUnitInfos = extractSeisByType (m_SEIs, SEI::DECODING_UNIT_INFO); 835 picSEI.insert(picSEI.end(), decodingUnitInfos.begin(), decodingUnitInfos.end()); 836 deleteSEIs(m_SEIs); 837 } 838 } 839 } 840 Void TDecTop::xParsePrefixSEIsForUnknownVCLNal() 841 { 842 while (!m_prefixSEINALUs.empty()) 843 { 844 // do nothing? 845 printf("Discarding Prefix SEI associated with unknown VCL NAL unit.\n"); 846 delete m_prefixSEINALUs.front(); 847 } 848 // TODO: discard following suffix SEIs as well? 849 } 850 851 852 Void TDecTop::xParsePrefixSEImessages() 853 { 854 while (!m_prefixSEINALUs.empty()) 855 { 856 InputNALUnit &nalu=*m_prefixSEINALUs.front(); 857 #if NH_MV 858 m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS( getLayerId() ), m_pDecodedSEIOutputStream ); 859 #else 860 m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream ); 861 #endif 862 delete m_prefixSEINALUs.front(); 863 m_prefixSEINALUs.pop_front(); 864 } 865 } 866 867 868 #if NH_MV 763 869 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag ) 764 870 { 765 assert( nalu.m_ layerId == m_layerId );871 assert( nalu.m_nuhLayerId == m_layerId ); 766 872 #else 767 873 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay ) 768 874 { 769 875 #endif 770 TComPic*& pcPic = m_pcPic;771 m_apcSlicePilot->initSlice();876 m_apcSlicePilot->initSlice(); // the slice pilot is an object to prepare for a new slice 877 // it is not associated with picture, sps or pps structures. 772 878 773 879 if (m_bFirstSliceInPicture) 774 880 { 775 m_uiSliceIdx 881 m_uiSliceIdx = 0; 776 882 } 777 883 else 778 884 { 779 m_apcSlicePilot->copySliceInfo( pcPic->getPicSym()->getSlice(m_uiSliceIdx-1) );885 m_apcSlicePilot->copySliceInfo( m_pcPic->getPicSym()->getSlice(m_uiSliceIdx-1) ); 780 886 } 781 887 m_apcSlicePilot->setSliceIdx(m_uiSliceIdx); … … 788 894 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N); 789 895 m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag); 790 791 896 m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS 792 897 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); 793 898 794 #if H_MV 899 #if ENC_DEC_TRACE 900 const UInt64 originalSymbolCount = g_nSymbolCounter; 901 #endif 902 903 #if NH_MV 795 904 m_apcSlicePilot->setRefPicSetInterLayer( & m_refPicSetInterLayer0, &m_refPicSetInterLayer1 ); 796 m_apcSlicePilot->setLayerId( nalu.m_ layerId );797 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_targetOptLayerSetIdx ); 798 #else 799 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManager Decoder);800 #endif 905 m_apcSlicePilot->setLayerId( nalu.m_nuhLayerId ); 906 #endif 907 908 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManager, m_prevTid0POC); 909 801 910 // set POC for dependent slices in skipped pictures 802 if(m_apcSlicePilot->getDependentSliceSegmentFlag() && m_prevSliceSkipped) 911 if(m_apcSlicePilot->getDependentSliceSegmentFlag() && m_prevSliceSkipped) 803 912 { 804 913 m_apcSlicePilot->setPOC(m_skippedPOC); 805 914 } 915 916 xUpdatePreviousTid0POC(m_apcSlicePilot); 806 917 807 918 m_apcSlicePilot->setAssociatedIRAPPOC(m_pocCRA); 808 919 m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType); 809 810 #if H_MV 811 TComVPS* vps = m_apcSlicePilot->getVPS(); 812 Int layerId = nalu.m_layerId; 920 #if NH_MV 921 const TComVPS* vps = m_apcSlicePilot->getVPS(); 922 Int layerId = nalu.m_nuhLayerId; 813 923 setViewId ( vps->getViewId ( layerId ) ); 814 #if H_3D924 #if NH_3D 815 925 setViewIndex( vps->getViewIndex( layerId ) ); 816 926 setIsDepth ( vps->getDepthId ( layerId ) == 1 ); … … 819 929 #endif 820 930 821 #if SETTING_NO_OUT_PIC_PRIOR822 931 //For inference of NoOutputOfPriorPicsFlag 823 932 if (m_apcSlicePilot->getRapPicFlag()) … … 865 974 } 866 975 } 867 #endif 868 869 #if FIX_POC_CRA_NORASL_OUTPUT 976 870 977 if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_craNoRaslOutputFlag) //Reset POC MSB when CRA has NoRaslOutputFlag equal to 1 871 978 { 872 Int iMaxPOClsb = 1 << m_apcSlicePilot->getSPS()->getBitsForPOC(); 979 TComPPS *pps = m_parameterSetManager.getPPS(m_apcSlicePilot->getPPSId()); 980 assert (pps != 0); 981 TComSPS *sps = m_parameterSetManager.getSPS(pps->getSPSId()); 982 assert (sps != 0); 983 Int iMaxPOClsb = 1 << sps->getBitsForPOC(); 873 984 m_apcSlicePilot->setPOC( m_apcSlicePilot->getPOC() & (iMaxPOClsb - 1) ); 874 }875 #endif 876 #if H_MV985 xUpdatePreviousTid0POC(m_apcSlicePilot); 986 } 987 #if NH_MV 877 988 xCeckNoClrasOutput(); 878 989 #endif 879 // Skip pictures due to random access 880 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) 881 { 990 991 // Skip pictures due to random access 992 993 #if NH_MV 994 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay, vps)) 995 #else 996 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) 997 #endif 998 { 882 999 m_prevSliceSkipped = true; 883 1000 m_skippedPOC = m_apcSlicePilot->getPOC(); 884 #if H_MV1001 #if NH_MV 885 1002 sliceSkippedFlag = true; 886 1003 #endif 887 888 889 890 891 1004 return false; 1005 } 1006 // Skip TFD pictures associated with BLA/BLANT pictures 1007 if (isSkipPictureForBLA(iPOCLastDisplay)) 1008 { 892 1009 m_prevSliceSkipped = true; 893 1010 m_skippedPOC = m_apcSlicePilot->getPOC(); 894 #if H_MV1011 #if NH_MV 895 1012 sliceSkippedFlag = true; 896 1013 #endif 897 898 1014 return false; 1015 } 899 1016 900 1017 // clear previous slice skipped flag … … 902 1019 903 1020 //we should only get a different poc for a new picture (with CTU address==0) 904 if ( m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (m_apcSlicePilot->getSliceCurStartCUAddr()!=0))1021 if (!m_apcSlicePilot->getDependentSliceSegmentFlag() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (m_apcSlicePilot->getSliceCurStartCtuTsAddr() != 0)) 905 1022 { 906 1023 printf ("Warning, the first slice of a picture might have been lost!\n"); 907 1024 } 1025 908 1026 // exit when a new picture is found 909 if ( m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence)1027 if (!m_apcSlicePilot->getDependentSliceSegmentFlag() && (m_apcSlicePilot->getSliceCurStartCtuTsAddr() == 0 && !m_bFirstSliceInPicture) ) 910 1028 { 911 1029 if (m_prevPOC >= m_pocRandomAccess) 912 1030 { 913 1031 m_prevPOC = m_apcSlicePilot->getPOC(); 1032 #if ENC_DEC_TRACE 1033 //rewind the trace counter since we didn't actually decode the slice 1034 g_nSymbolCounter = originalSymbolCount; 1035 #endif 914 1036 return true; 915 1037 } 916 1038 m_prevPOC = m_apcSlicePilot->getPOC(); 917 1039 } 918 #if H_MV1040 #if NH_MV 919 1041 if ( newLayerFlag ) 920 1042 { … … 928 1050 #endif 929 1051 #endif 930 // actual decoding starts here 931 #if H_MV1052 1053 #if NH_MV 932 1054 // This part needs further testing ! 933 1055 if ( m_apcSlicePilot->getPocResetFlag() ) … … 958 1080 #endif 959 1081 1082 //detect lost reference picture and insert copy of earlier frame. 1083 { 1084 Int lostPoc; 1085 while((lostPoc=m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true, m_pocRandomAccess)) > 0) 1086 { 1087 xCreateLostPicture(lostPoc-1); 1088 } 1089 } 1090 1091 if (!m_apcSlicePilot->getDependentSliceSegmentFlag()) 1092 { 1093 m_prevPOC = m_apcSlicePilot->getPOC(); 1094 } 1095 1096 // actual decoding starts here 960 1097 xActivateParameterSets(); 961 1098 962 #if H_MV 1099 m_bFirstSliceInSequence = false; 1100 m_bFirstSliceInBitstream = false; 1101 1102 1103 TComSlice* pcSlice = m_pcPic->getPicSym()->getSlice(m_uiSliceIdx); 1104 1105 // When decoding the slice header, the stored start and end addresses were actually RS addresses, not TS addresses. 1106 // Now, having set up the maps, convert them to the correct form. 1107 pcSlice->setSliceSegmentCurStartCtuTsAddr( m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceSegmentCurStartCtuTsAddr()) ); 1108 pcSlice->setSliceSegmentCurEndCtuTsAddr( m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceSegmentCurEndCtuTsAddr()) ); 1109 if(!pcSlice->getDependentSliceSegmentFlag()) 1110 { 1111 pcSlice->setSliceCurStartCtuTsAddr(m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceCurStartCtuTsAddr())); 1112 pcSlice->setSliceCurEndCtuTsAddr(m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceCurEndCtuTsAddr())); 1113 } 1114 1115 m_pcPic->setTLayer(nalu.m_temporalId); 1116 1117 #if NH_MV 963 1118 //Check Multiview Main profile constraint in G.11.1.1 964 1119 // When ViewOrderIdx[ i ] derived according to any active VPS is equal to 1 … … 966 1121 // inter_view_mv_vert_constraint_flag shall be equal to 1 967 1122 // in the sps_multilayer_extension( ) syntax structure in each active SPS for that layer. 968 if( m_apcSlicePilot->getSPS()->getPTL()->getGeneralPTL()->getProfileIdc()==Profile::MULTIVIEWMAIN1123 if( pcSlice->getSPS()->getPTL()->getGeneralPTL()->getProfileIdc()==Profile::MULTIVIEWMAIN 969 1124 && 970 m_apcSlicePilot->getVPS()->getViewOrderIdx(m_apcSlicePilot->getVPS()->getLayerIdInNuh(getLayerId()))==11125 pcSlice->getVPS()->getViewOrderIdx(pcSlice->getVPS()->getLayerIdInNuh(getLayerId()))==1 971 1126 ) 972 1127 { 973 assert( m_apcSlicePilot->getSPS()->getInterViewMvVertConstraintFlag()==1 ); 974 } 975 #endif 976 977 if (m_apcSlicePilot->isNextSlice()) 978 { 979 m_prevPOC = m_apcSlicePilot->getPOC(); 980 } 981 m_bFirstSliceInSequence = false; 982 #if SETTING_NO_OUT_PIC_PRIOR 983 m_bFirstSliceInBitstream = false; 984 #endif 985 //detect lost reference picture and insert copy of earlier frame. 986 Int lostPoc; 987 while((lostPoc=m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true, m_pocRandomAccess)) > 0) 988 { 989 xCreateLostPicture(lostPoc-1); 990 } 991 if (m_bFirstSliceInPicture) 992 { 993 // Buffer initialize for prediction. 994 m_cPrediction.initTempBuff(); 995 m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); 996 #if H_MV 997 m_apcSlicePilot->createInterLayerReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); 998 #endif 999 // Get a new picture buffer 1000 xGetNewPicBuffer (m_apcSlicePilot, pcPic); 1001 1002 Bool isField = false; 1003 Bool isTff = false; 1004 1005 if(!m_SEIs.empty()) 1006 { 1007 // Check if any new Picture Timing SEI has arrived 1008 SEIMessages pictureTimingSEIs = extractSeisByType (m_SEIs, SEI::PICTURE_TIMING); 1009 if (pictureTimingSEIs.size()>0) 1010 { 1011 SEIPictureTiming* pictureTiming = (SEIPictureTiming*) *(pictureTimingSEIs.begin()); 1012 isField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 2); 1013 isTff = (pictureTiming->m_picStruct == 1); 1014 } 1015 } 1016 1017 //Set Field/Frame coding mode 1018 m_pcPic->setField(isField); 1019 m_pcPic->setTopField(isTff); 1020 1021 // transfer any SEI messages that have been received to the picture 1022 pcPic->setSEIs(m_SEIs); 1023 m_SEIs.clear(); 1024 1025 // Recursive structure 1026 m_cCuDecoder.create ( g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight ); 1027 m_cCuDecoder.init ( &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction ); 1028 m_cTrQuant.init ( g_uiMaxCUWidth, g_uiMaxCUHeight, m_apcSlicePilot->getSPS()->getMaxTrSize()); 1029 1030 m_cSliceDecoder.create(); 1031 } 1032 else 1033 { 1034 // Check if any new SEI has arrived 1035 if(!m_SEIs.empty()) 1036 { 1037 // Currently only decoding Unit SEI message occurring between VCL NALUs copied 1038 SEIMessages &picSEI = pcPic->getSEIs(); 1039 SEIMessages decodingUnitInfos = extractSeisByType (m_SEIs, SEI::DECODING_UNIT_INFO); 1040 picSEI.insert(picSEI.end(), decodingUnitInfos.begin(), decodingUnitInfos.end()); 1041 deleteSEIs(m_SEIs); 1042 } 1043 } 1044 1045 // Set picture slice pointer 1046 TComSlice* pcSlice = m_apcSlicePilot; 1047 Bool bNextSlice = pcSlice->isNextSlice(); 1048 1049 UInt i; 1050 pcPic->getPicSym()->initTiles(pcSlice->getPPS()); 1051 1052 //generate the Coding Order Map and Inverse Coding Order Map 1053 UInt uiEncCUAddr; 1054 for(i=0, uiEncCUAddr=0; i<pcPic->getPicSym()->getNumberOfCUsInFrame(); i++, uiEncCUAddr = pcPic->getPicSym()->xCalculateNxtCUAddr(uiEncCUAddr)) 1055 { 1056 pcPic->getPicSym()->setCUOrderMap(i, uiEncCUAddr); 1057 pcPic->getPicSym()->setInverseCUOrderMap(uiEncCUAddr, i); 1058 } 1059 pcPic->getPicSym()->setCUOrderMap(pcPic->getPicSym()->getNumberOfCUsInFrame(), pcPic->getPicSym()->getNumberOfCUsInFrame()); 1060 pcPic->getPicSym()->setInverseCUOrderMap(pcPic->getPicSym()->getNumberOfCUsInFrame(), pcPic->getPicSym()->getNumberOfCUsInFrame()); 1061 1062 //convert the start and end CU addresses of the slice and dependent slice into encoding order 1063 pcSlice->setSliceSegmentCurStartCUAddr( pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceSegmentCurStartCUAddr()) ); 1064 pcSlice->setSliceSegmentCurEndCUAddr( pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceSegmentCurEndCUAddr()) ); 1065 if(pcSlice->isNextSlice()) 1066 { 1067 pcSlice->setSliceCurStartCUAddr(pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceCurStartCUAddr())); 1068 pcSlice->setSliceCurEndCUAddr(pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceCurEndCUAddr())); 1069 } 1070 1071 if (m_bFirstSliceInPicture) 1072 { 1073 if(pcPic->getNumAllocatedSlice() != 1) 1074 { 1075 pcPic->clearSliceBuffer(); 1076 } 1077 } 1078 else 1079 { 1080 pcPic->allocateNewSlice(); 1081 } 1082 assert(pcPic->getNumAllocatedSlice() == (m_uiSliceIdx + 1)); 1083 m_apcSlicePilot = pcPic->getPicSym()->getSlice(m_uiSliceIdx); 1084 pcPic->getPicSym()->setSlice(pcSlice, m_uiSliceIdx); 1085 1086 pcPic->setTLayer(nalu.m_temporalId); 1087 1088 #if H_MV 1089 pcPic->setLayerId( nalu.m_layerId ); 1090 pcPic->setViewId ( getViewId() ); 1091 #if H_3D 1092 pcPic->setViewIndex( getViewIndex() ); 1093 pcPic->setIsDepth ( getIsDepth () ); 1128 assert( pcSlice->getSPS()->getInterViewMvVertConstraintFlag()==1 ); 1129 } 1130 #endif 1131 #if NH_MV 1132 m_pcPic->setLayerId( nalu.m_nuhLayerId ); 1133 m_pcPic->setViewId ( getViewId() ); 1134 #if NH_3D 1135 m_pcPic->setViewIndex( getViewIndex() ); 1136 m_pcPic->setIsDepth ( getIsDepth () ); 1094 1137 pcSlice->setIvPicLists( m_ivPicLists ); 1095 1138 #endif 1096 1139 #endif 1097 1140 1098 1099 1100 1101 if (bNextSlice) 1141 if (!pcSlice->getDependentSliceSegmentFlag()) 1102 1142 { 1103 1143 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_associatedIRAPType, m_cListPic ); 1104 1144 // Set reference list 1105 #if H_MV1145 #if NH_MV 1106 1146 std::vector< TComPic* > tempRefPicLists[2]; 1107 1147 std::vector< Bool > usedAsLongTerm [2]; … … 1110 1150 pcSlice->getTempRefPicLists( m_cListPic, m_refPicSetInterLayer0, m_refPicSetInterLayer1, tempRefPicLists, usedAsLongTerm, numPocTotalCurr); 1111 1151 pcSlice->setRefPicList ( tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true ); 1112 #if H_3D1152 #if NH_3D_NBDV 1113 1153 pcSlice->setDefaultRefView(); 1114 1154 #endif 1115 #if H_3D_ARP1155 #if NH_3D_ARP 1116 1156 pcSlice->setARPStepNum(m_ivPicLists); 1117 if( pcSlice->getARPStepNum() > 1 )1118 {1119 // GT: This seems to be broken, not all nuh_layer_ids are necessarily present1120 for(Int iLayerId = 0; iLayerId < nalu.m_layerId; iLayerId ++ )1121 {1122 Int iViewIdx = pcSlice->getVPS()->getViewIndex(iLayerId);1123 Bool bIsDepth = ( pcSlice->getVPS()->getDepthId ( iLayerId ) == 1 );1124 if( iViewIdx<getViewIndex() && !bIsDepth )1125 {1126 pcSlice->setBaseViewRefPicList( m_ivPicLists->getPicList( iLayerId ), iViewIdx );1127 }1128 }1129 }1130 1157 #endif 1131 1158 #else … … 1133 1160 #endif 1134 1161 1135 #if H_3D1162 #if NH_3D 1136 1163 pcSlice->checkInCompPredRefLayers(); 1137 #if H_3D_IV_MERGE1164 #if NH_3D_IV_MERGE 1138 1165 #if H_3D_FCO 1139 1166 //assert( !getIsDepth() ); … … 1143 1170 #endif 1144 1171 #endif 1145 #if H_MV1172 #if NH_MV 1146 1173 if( m_layerId > 0 && !pcSlice->isIntra() && pcSlice->getEnableTMVPFlag() ) 1147 1174 { … … 1186 1213 bLowDelay = false; 1187 1214 } 1188 } 1189 } 1190 1191 pcSlice->setCheckLDC(bLowDelay); 1215 } 1216 } 1217 1218 pcSlice->setCheckLDC(bLowDelay); 1192 1219 } 1193 1220 1194 1221 //--------------- 1195 1222 pcSlice->setRefPOCList(); 1196 #if H_3D_TMVP1223 #if NH_3D_TMVP 1197 1224 if(pcSlice->getLayerId()) 1198 1225 { … … 1202 1229 } 1203 1230 1204 pcPic->setCurrSliceIdx(m_uiSliceIdx);1231 m_pcPic->setCurrSliceIdx(m_uiSliceIdx); 1205 1232 if(pcSlice->getSPS()->getScalingListFlag()) 1206 1233 { 1207 pcSlice->setScalingList ( pcSlice->getSPS()->getScalingList() );1234 TComScalingList scalingList; 1208 1235 if(pcSlice->getPPS()->getScalingListPresentFlag()) 1209 1236 { 1210 pcSlice->setScalingList ( pcSlice->getPPS()->getScalingList() ); 1211 } 1212 if(!pcSlice->getPPS()->getScalingListPresentFlag() && !pcSlice->getSPS()->getScalingListPresentFlag()) 1213 { 1214 pcSlice->setDefaultScalingList(); 1215 } 1216 m_cTrQuant.setScalingListDec(pcSlice->getScalingList()); 1237 scalingList = pcSlice->getPPS()->getScalingList(); 1238 } 1239 else if (pcSlice->getSPS()->getScalingListPresentFlag()) 1240 { 1241 scalingList = pcSlice->getSPS()->getScalingList(); 1242 } 1243 else 1244 { 1245 scalingList.setDefaultScalingList(); 1246 } 1247 m_cTrQuant.setScalingListDec(scalingList); 1217 1248 m_cTrQuant.setUseScalingList(true); 1218 1249 } 1219 1250 else 1220 1251 { 1221 m_cTrQuant.setFlatScalingList(); 1252 const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE] = 1253 { 1254 pcSlice->getSPS()->getMaxLog2TrDynamicRange(CHANNEL_TYPE_LUMA), 1255 pcSlice->getSPS()->getMaxLog2TrDynamicRange(CHANNEL_TYPE_CHROMA) 1256 }; 1257 m_cTrQuant.setFlatScalingList(maxLog2TrDynamicRange, pcSlice->getSPS()->getBitDepths()); 1222 1258 m_cTrQuant.setUseScalingList(false); 1223 1259 } 1224 1260 1225 #if H_3D_IV_MERGE 1261 #if !NH_3D_FIX_TICKET_101 1262 #if NH_3D_IV_MERGE 1226 1263 #if H_3D_FCO 1227 1264 if( !pcSlice->getIsDepth() && m_pcCamParsCollector ) … … 1233 1270 } 1234 1271 #endif 1235 1272 #endif 1236 1273 // Decode a picture 1237 m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic); 1238 #if H_3D 1274 m_cGopDecoder.decompressSlice(&(nalu.getBitstream()), m_pcPic); 1275 1276 #if NH_3D 1239 1277 if( m_pcCamParsCollector ) 1240 1278 { … … 1242 1280 } 1243 1281 #endif 1282 1244 1283 m_bFirstSliceInPicture = false; 1245 1284 m_uiSliceIdx++; … … 1248 1287 } 1249 1288 1250 Void TDecTop::xDecodeVPS( )1289 Void TDecTop::xDecodeVPS(const std::vector<UChar> &naluData) 1251 1290 { 1252 1291 TComVPS* vps = new TComVPS(); 1253 1292 1254 1293 m_cEntropyDecoder.decodeVPS( vps ); 1255 m_parameterSetManager Decoder.storePrefetchedVPS(vps);1256 } 1257 1258 Void TDecTop::xDecodeSPS( )1294 m_parameterSetManager.storeVPS(vps, naluData); 1295 } 1296 1297 Void TDecTop::xDecodeSPS(const std::vector<UChar> &naluData) 1259 1298 { 1260 1299 TComSPS* sps = new TComSPS(); 1261 #if H_MV1300 #if NH_MV 1262 1301 sps->setLayerId( getLayerId() ); 1263 1302 #endif 1264 #if H_3D 1265 // Preliminary fix. assuming that all sps refer to the same VPS. 1266 // Parsing dependency should be resolved! 1267 TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); 1268 assert( vps != 0 ); 1303 #if O0043_BEST_EFFORT_DECODING 1304 sps->setForceDecodeBitDepth(m_forceDecodeBitDepth); 1305 #endif 1306 #if NH_3D 1307 // GT: Please don't add parsing dependency of SPS from VPS here again!!! 1308 #endif 1269 1309 m_cEntropyDecoder.decodeSPS( sps ); 1270 #else 1271 m_cEntropyDecoder.decodeSPS( sps ); 1272 #endif 1273 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); 1274 } 1275 1276 Void TDecTop::xDecodePPS() 1310 m_parameterSetManager.storeSPS(sps, naluData); 1311 } 1312 1313 Void TDecTop::xDecodePPS(const std::vector<UChar> &naluData) 1277 1314 { 1278 1315 TComPPS* pps = new TComPPS(); 1279 #if H_MV1316 #if NH_MV 1280 1317 pps->setLayerId( getLayerId() ); 1281 1318 #endif 1282 #if H_3D 1283 // Assuming that all PPS indirectly refer to the same VPS via different SPS 1284 // There is no parsing dependency in decoding DLT in PPS. 1285 // The VPS information passed to decodePPS() is used to arrange the decoded DLT tables to their corresponding layers. 1286 // This is equivalent to the process of 1287 // Step 1) decoding DLT tables based on the number of depth layers, and 1288 // Step 2) mapping DLT tables to the depth layers 1289 // as described in the 3D-HEVC WD. 1290 TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); 1291 m_cEntropyDecoder.decodePPS( pps, vps ); 1292 #else 1319 #if NH_3D_DLT 1320 // create mapping from depth layer indexes to layer ids 1321 Int j=0; 1322 for( Int i=0; i<=m_parameterSetManager.getFirstVPS()->getMaxLayersMinus1(); i++ ) 1323 { 1324 Int layerId = m_parameterSetManager.getFirstVPS()->getLayerIdInNuh(i); 1325 if( m_parameterSetManager.getFirstVPS()->getDepthId(layerId) ) 1326 pps->getDLT()->setDepthIdxToLayerId(j++, layerId); 1327 } 1328 #endif 1293 1329 m_cEntropyDecoder.decodePPS( pps ); 1294 #endif 1295 m_parameterSetManagerDecoder.storePrefetchedPPS( pps ); 1296 } 1297 1298 Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ) 1299 { 1300 if(nalUnitType == NAL_UNIT_SUFFIX_SEI) 1301 { 1302 #if H_MV 1303 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS( m_layerId ) ); 1304 #else 1305 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); 1306 #endif 1307 } 1308 else 1309 { 1310 #if H_MV 1311 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS( m_layerId ) ); 1312 #else 1313 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); 1314 #endif 1315 SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS); 1316 if (activeParamSets.size()>0) 1317 { 1318 SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin()); 1319 m_parameterSetManagerDecoder.applyPrefetchedPS(); 1320 assert(seiAps->activeSeqParameterSetId.size()>0); 1321 #if H_MV 1322 if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParameterSetId[0], m_layerId )) 1323 #else 1324 if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParameterSetId[0] )) 1325 #endif 1326 { 1327 printf ("Warning SPS activation with Active parameter set SEI failed"); 1328 } 1329 } 1330 } 1331 } 1332 1333 #if H_MV 1330 1331 m_parameterSetManager.storePPS( pps, naluData); 1332 } 1333 1334 #if NH_MV 1334 1335 Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag ) 1335 1336 #else … … 1337 1338 #endif 1338 1339 { 1340 #if !NH_MV 1341 // ignore all NAL units of layers > 0 1342 if (nalu.m_nuhLayerId > 0) 1343 { 1344 fprintf (stderr, "Warning: found NAL unit with nuh_layer_id equal to %d. Ignoring.\n", nalu.m_nuhLayerId); 1345 return false; 1346 } 1347 #endif 1339 1348 // Initialize entropy decoder 1340 1349 m_cEntropyDecoder.setEntropyDecoder (&m_cCavlcDecoder); 1341 m_cEntropyDecoder.setBitstream ( nalu.m_Bitstream);1350 m_cEntropyDecoder.setBitstream (&(nalu.getBitstream())); 1342 1351 1343 1352 switch (nalu.m_nalUnitType) 1344 1353 { 1345 1354 case NAL_UNIT_VPS: 1346 xDecodeVPS( );1347 #if H_MV1355 xDecodeVPS(nalu.getBitstream().getFifo()); 1356 #if NH_MV 1348 1357 m_isLastNALWasEos = false; 1349 1358 #endif 1350 1359 return false; 1351 1360 1352 1361 case NAL_UNIT_SPS: 1353 xDecodeSPS( );1362 xDecodeSPS(nalu.getBitstream().getFifo()); 1354 1363 return false; 1355 1364 1356 1365 case NAL_UNIT_PPS: 1357 xDecodePPS( );1366 xDecodePPS(nalu.getBitstream().getFifo()); 1358 1367 return false; 1359 1368 1360 1369 case NAL_UNIT_PREFIX_SEI: 1370 // Buffer up prefix SEI messages until SPS of associated VCL is known. 1371 m_prefixSEINALUs.push_back(new InputNALUnit(nalu)); 1372 return false; 1373 1361 1374 case NAL_UNIT_SUFFIX_SEI: 1362 #if H_MV1375 #if NH_MV 1363 1376 if ( nalu.m_nalUnitType == NAL_UNIT_SUFFIX_SEI ) 1364 1377 { … … 1366 1379 } 1367 1380 #endif 1368 xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType ); 1381 if (m_pcPic) 1382 { 1383 #if NH_MV 1384 m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS( getLayerId() ), m_pDecodedSEIOutputStream ); 1385 #else 1386 m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream ); 1387 #endif 1388 } 1389 else 1390 { 1391 printf ("Note: received suffix SEI but no picture currently active.\n"); 1392 } 1369 1393 return false; 1370 1394 … … 1385 1409 case NAL_UNIT_CODED_SLICE_RASL_N: 1386 1410 case NAL_UNIT_CODED_SLICE_RASL_R: 1387 #if H_MV1411 #if NH_MV 1388 1412 if (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_R || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_N || 1389 1413 nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_R || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_N || … … 1398 1422 m_isLastNALWasEos = false; 1399 1423 } 1400 1401 1424 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag, sliceSkippedFlag ); 1402 1425 #else … … 1404 1427 #endif 1405 1428 break; 1429 1406 1430 case NAL_UNIT_EOS: 1407 #if H_MV1431 #if NH_MV 1408 1432 assert( m_isLastNALWasEos == false ); 1409 1433 //Check layer id of the nalu. if it is not 0, give a warning message and just return without doing anything. 1410 if (nalu.m_ layerId > 0)1434 if (nalu.m_nuhLayerId > 0) 1411 1435 { 1412 1436 printf( "\nThis bitstream has EOS with non-zero layer id.\n" ); … … 1419 1443 m_pocRandomAccess = MAX_INT; 1420 1444 m_prevPOC = MAX_INT; 1421 m_bFirstSliceInPicture = true;1422 m_bFirstSliceInSequence = true;1423 1445 m_prevSliceSkipped = false; 1424 1446 m_skippedPOC = 0; 1425 1447 return false; 1426 1448 1427 1449 case NAL_UNIT_ACCESS_UNIT_DELIMITER: 1428 // TODO: process AU delimiter 1450 { 1451 AUDReader audReader; 1452 UInt picType; 1453 audReader.parseAccessUnitDelimiter(&(nalu.getBitstream()),picType); 1454 printf ("Note: found NAL_UNIT_ACCESS_UNIT_DELIMITER\n"); 1429 1455 return false; 1430 1456 } 1457 1431 1458 case NAL_UNIT_EOB: 1432 1459 return false; 1433 1460 1434 1461 case NAL_UNIT_FILLER_DATA: 1435 #if H_MV 1462 { 1463 FDReader fdReader; 1464 UInt size; 1465 fdReader.parseFillerData(&(nalu.getBitstream()),size); 1466 printf ("Note: found NAL_UNIT_FILLER_DATA with %u bytes payload.\n", size); 1467 #if NH_MV 1436 1468 assert( m_isLastNALWasEos == false ); 1437 1469 #endif 1438 1470 return false; 1439 1471 } 1472 1440 1473 case NAL_UNIT_RESERVED_VCL_N10: 1441 1474 case NAL_UNIT_RESERVED_VCL_R11: … … 1444 1477 case NAL_UNIT_RESERVED_VCL_N14: 1445 1478 case NAL_UNIT_RESERVED_VCL_R15: 1446 1479 1447 1480 case NAL_UNIT_RESERVED_IRAP_VCL22: 1448 1481 case NAL_UNIT_RESERVED_IRAP_VCL23: 1449 1482 1450 1483 case NAL_UNIT_RESERVED_VCL24: 1451 1484 case NAL_UNIT_RESERVED_VCL25: … … 1456 1489 case NAL_UNIT_RESERVED_VCL30: 1457 1490 case NAL_UNIT_RESERVED_VCL31: 1458 1491 printf ("Note: found reserved VCL NAL unit.\n"); 1492 xParsePrefixSEIsForUnknownVCLNal(); 1493 return false; 1494 1459 1495 case NAL_UNIT_RESERVED_NVCL41: 1460 1496 case NAL_UNIT_RESERVED_NVCL42: … … 1464 1500 case NAL_UNIT_RESERVED_NVCL46: 1465 1501 case NAL_UNIT_RESERVED_NVCL47: 1502 printf ("Note: found reserved NAL unit.\n"); 1503 return false; 1466 1504 case NAL_UNIT_UNSPECIFIED_48: 1467 1505 case NAL_UNIT_UNSPECIFIED_49: … … 1480 1518 case NAL_UNIT_UNSPECIFIED_62: 1481 1519 case NAL_UNIT_UNSPECIFIED_63: 1520 printf ("Note: found unspecified NAL unit.\n"); 1521 return false; 1482 1522 default: 1483 1523 assert (0); 1524 break; 1484 1525 } 1485 1526 … … 1495 1536 Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay) 1496 1537 { 1497 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) && 1538 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) && 1498 1539 m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) 1499 1540 { … … 1513 1554 * 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. 1514 1555 * If the random access point is IDR all pictures after the random access point are decoded. 1515 * If the random access point is none of the above, a warning is issues, and decoding of pictures with POC 1516 * equal to or greater than the random access point POC is attempted. For non IDR/CRA/BLA random 1556 * If the random access point is none of the above, a warning is issues, and decoding of pictures with POC 1557 * equal to or greater than the random access point POC is attempted. For non IDR/CRA/BLA random 1517 1558 * access point there is no guarantee that the decoder will not crash. 1518 1559 */ 1519 Bool TDecTop::isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay) 1520 { 1521 if (iSkipFrame) 1560 #if NH_MV 1561 Bool TDecTop::isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay, const TComVPS* vps) 1562 #else 1563 Bool TDecTop::isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay ) 1564 #endif 1565 { 1566 if (iSkipFrame) 1522 1567 { 1523 1568 iSkipFrame--; // decrement the counter 1524 1569 return true; 1525 1570 } 1526 #if H_MV1571 #if NH_MV 1527 1572 else if ( !m_layerInitilizedFlag[ m_layerId ] ) // start of random access point, m_pocRandomAccess has not been set yet. 1528 1573 #else … … 1536 1581 { 1537 1582 1538 #if H_MV1539 if ( xAllRefLayersInitilized( ) )1583 #if NH_MV 1584 if ( xAllRefLayersInitilized( vps ) ) 1540 1585 { 1541 1586 m_layerInitilizedFlag[ m_layerId ] = true; … … 1553 1598 else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 1554 1599 { 1555 #if H_MV1556 if ( xAllRefLayersInitilized( ) )1600 #if NH_MV 1601 if ( xAllRefLayersInitilized( vps) ) 1557 1602 { 1558 1603 m_layerInitilizedFlag[ m_layerId ] = true; … … 1567 1612 #endif 1568 1613 } 1569 else 1570 { 1571 #if H_MV1614 else 1615 { 1616 #if NH_MV 1572 1617 static Bool warningMessage[MAX_NUM_LAYERS]; 1573 1618 static Bool warningInitFlag = false; … … 1588 1633 } 1589 1634 #else 1590 static Bool warningMessage = false; 1591 if(!warningMessage) 1635 if(!m_warningMessageSkipPicture) 1592 1636 { 1593 1637 printf("\nWarning: this is not a valid random access point and the data is discarded until the first CRA picture"); 1594 warningMessage = true;1638 m_warningMessageSkipPicture = true; 1595 1639 } 1596 1640 #endif … … 1604 1648 return true; 1605 1649 } 1606 #if H_MV 1650 // if we reach here, then the picture is not skipped. 1651 #if NH_MV 1607 1652 return !m_layerInitilizedFlag[ getLayerId() ]; 1608 1653 #else 1609 // if we reach here, then the picture is not skipped. 1610 return false; 1611 #endif 1612 } 1613 1614 #if H_MV 1654 return false; 1655 #endif 1656 } 1657 #if NH_MV 1615 1658 TComPic* TDecTop::getPic( Int poc ) 1616 1659 { … … 1672 1715 } 1673 1716 1674 Bool TDecTop::xAllRefLayersInitilized() 1675 { 1676 Bool allRefLayersInitilizedFlag = true; 1677 TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); 1717 Bool TDecTop::xAllRefLayersInitilized( const TComVPS* vps ) 1718 { 1719 Bool allRefLayersInitilizedFlag = true; 1678 1720 for (Int i = 0; i < vps->getNumDirectRefLayers( getLayerId() ); i++ ) 1679 1721 { … … 1685 1727 } 1686 1728 1687 #if H_3D 1688 Void TDecTop::setProfileIdc() 1689 { 1690 if (m_targetOptLayerSetIdx != -1 ) 1691 { 1692 TComVPS* vps = getPrefetchedVPS(); 1693 Int lsIdx = vps->olsIdxToLsIdx( m_targetOptLayerSetIdx ); 1694 Int lIdx = -1; 1695 for (Int j = 0; j < vps->getNumLayersInIdList( lsIdx ); j++ ) 1696 { 1697 if ( vps->getLayerSetLayerIdList( lsIdx, j ) == getLayerId() ) 1698 { 1699 lIdx = j; 1700 break; 1701 } 1702 } 1703 assert( lIdx != -1 ); 1704 1705 Int profileIdc = vps->getPTL( vps->getProfileTierLevelIdx( m_targetOptLayerSetIdx, lIdx ) )->getGeneralPTL()->getProfileIdc(); 1706 assert( profileIdc == 1 || profileIdc == 6 || profileIdc == 8 ); 1707 m_profileIdc = profileIdc; 1708 }; 1709 } 1710 #endif 1711 #endif 1729 1730 Void TDecTop::initFromActiveVps( const TComVPS* vps ) 1731 { 1732 if ( m_targetOlsIdx == -1 ) 1733 { 1734 // Not normative! Corresponds to specification by "External Means". (Should be set equal to 0, when no external means available. ) 1735 m_targetOlsIdx = vps->getVpsNumLayerSetsMinus1(); 1736 } 1737 #if NH_3D 1738 // Set profile 1739 Int lsIdx = vps->olsIdxToLsIdx( m_targetOlsIdx ); 1740 Int lIdx = -1; 1741 for (Int j = 0; j < vps->getNumLayersInIdList( lsIdx ); j++ ) 1742 { 1743 if ( vps->getLayerSetLayerIdList( lsIdx, j ) == getLayerId() ) 1744 { 1745 lIdx = j; 1746 break; 1747 } 1748 } 1749 assert( lIdx != -1 ); 1750 1751 Int profileIdc = vps->getPTL( vps->getProfileTierLevelIdx( m_targetOlsIdx, lIdx ) )->getGeneralPTL()->getProfileIdc(); 1752 assert( profileIdc == 1 || profileIdc == 6 || profileIdc == 8 ); 1753 m_profileIdc = profileIdc; 1754 #endif 1755 } 1756 #endif 1757 1712 1758 //! \}
Note: See TracChangeset for help on using the changeset viewer.