Changeset 438 in 3DVCSoftware for branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecTop.cpp
- Timestamp:
- 23 May 2013, 15:40:36 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecTop.cpp
r401 r438 42 42 ParameterSetManagerDecoder TDecTop::m_parameterSetManagerDecoder; 43 43 #endif 44 44 45 //! \ingroup TLibDecoder 45 46 //! \{ … … 50 51 m_iMaxRefPicNum = 0; 51 52 #if ENC_DEC_TRACE 52 #if H_MV53 if ( g_hTrace == NULL )54 {55 #endif56 53 g_hTrace = fopen( "TraceDec.txt", "wb" ); 57 54 g_bJustDoIt = g_bEncDecTraceDisable; 58 55 g_nSymbolCounter = 0; 59 #if H_MV60 }61 #endif62 56 #endif 63 57 m_pocCRA = 0; … … 100 94 } 101 95 96 102 97 Void TDecTop::init() 103 98 { … … 106 101 initROM(); 107 102 #endif 103 108 104 m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO); 109 105 m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder ); … … 153 149 } 154 150 155 #if L0323_DPB156 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded157 #else158 151 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded 159 #endif160 152 if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) 161 153 { … … 227 219 rpcListPic = &m_cListPic; 228 220 m_cCuDecoder.destroy(); 221 229 222 #if H_MV 230 223 TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer ); 231 224 TComSlice::markIvRefPicsAsUnused ( m_ivPicLists, targetDecLayerIdSet, m_parameterSetManagerDecoder.getActiveVPS(), m_layerId, poc ); 232 225 #endif 226 233 227 m_bFirstSliceInPicture = true; 234 228 … … 296 290 assert (sps != 0); 297 291 298 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot-> isIRAP()))292 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->getIdrPicFlag())) 299 293 { 300 294 printf ("Parameter set activation failed!"); … … 302 296 } 303 297 304 if( pps->getDependentSliceSegmentsEnabledFlag() )305 {306 Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1;307 308 if (m_cSliceDecoder.getCtxMemSize() != NumCtx)309 {310 m_cSliceDecoder.initCtxMem(NumCtx);311 for ( UInt st = 0; st < NumCtx; st++ )312 {313 TDecSbac* ctx = NULL;314 ctx = new TDecSbac;315 ctx->init( &m_cBinCABAC );316 m_cSliceDecoder.setCtxMem( ctx, st );317 }318 }319 }320 321 298 m_apcSlicePilot->setPPS(pps); 322 299 m_apcSlicePilot->setSPS(sps); 300 323 301 #if H_MV 324 302 m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getActiveVPS() ); 325 303 #endif 304 326 305 pps->setSPS(sps); 327 306 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1); 328 307 pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) ); 329 308 330 g_bitDepthY = sps->getBitDepthY(); 331 g_bitDepthC = sps->getBitDepthC(); 332 g_uiMaxCUWidth = sps->getMaxCUWidth(); 333 g_uiMaxCUHeight = sps->getMaxCUHeight(); 334 g_uiMaxCUDepth = sps->getMaxCUDepth(); 335 g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() ); 336 337 for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++) 309 for (Int i = 0; i < sps->getMaxCUDepth() - g_uiAddCUDepth; i++) 338 310 { 339 311 sps->setAMPAcc( i, sps->getUseAMP() ); 340 312 } 341 313 342 for (Int i = sps->get Log2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++)314 for (Int i = sps->getMaxCUDepth() - g_uiAddCUDepth; i < sps->getMaxCUDepth(); i++) 343 315 { 344 316 sps->setAMPAcc( i, 0 ); … … 346 318 347 319 m_cSAO.destroy(); 348 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight());349 m_cLoopFilter. create( sps->getMaxCUDepth());320 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight ); 321 m_cLoopFilter. create( g_uiMaxCUDepth ); 350 322 } 351 323 … … 373 345 374 346 m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType); 375 Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || 376 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || 377 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || 378 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || 379 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N); 380 m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag); 381 347 if((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N) || 348 (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) || 349 (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N)) 350 { 351 m_apcSlicePilot->setTemporalLayerNonReferenceFlag(true); 352 } 382 353 m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS 383 354 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); … … 386 357 m_apcSlicePilot->setLayerId( nalu.m_layerId ); 387 358 #endif 359 388 360 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder); 389 361 … … 399 371 #endif 400 372 #endif 373 374 if (m_apcSlicePilot->isNextSlice()) 375 { 401 376 // Skip pictures due to random access 402 377 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) … … 409 384 return false; 410 385 } 411 412 //we should only get a different poc for a new picture (with CTU address==0) 413 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (!m_apcSlicePilot->getSliceCurStartCUAddr()==0)) 414 { 415 printf ("Warning, the first slice of a picture might have been lost!\n"); 416 } 386 } 387 417 388 // exit when a new picture is found 418 if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence)389 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence) 419 390 { 420 391 if (m_prevPOC >= m_pocRandomAccess) … … 425 396 m_prevPOC = m_apcSlicePilot->getPOC(); 426 397 } 398 427 399 #if H_MV 428 400 if ( newLayerFlag ) … … 431 403 } 432 404 #endif 405 406 433 407 // actual decoding starts here 434 408 xActivateParameterSets(); … … 445 419 xCreateLostPicture(lostPoc-1); 446 420 } 421 447 422 if (m_bFirstSliceInPicture) 448 423 { … … 450 425 m_cPrediction.initTempBuff(); 451 426 m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); 427 452 428 #if H_MV 453 429 m_apcSlicePilot->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer ); 454 430 #endif 431 432 455 433 // Get a new picture buffer 456 434 xGetNewPicBuffer (m_apcSlicePilot, pcPic); … … 591 569 #endif 592 570 #endif 571 593 572 if (bNextSlice) 594 573 { 595 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA , m_cListPic);574 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA ); 596 575 // Set reference list 576 597 577 #if H_MV 598 pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer, true ); 599 #else 600 #if FIX1071 601 pcSlice->setRefPicList( m_cListPic, true ); 578 pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer ); 602 579 #else 603 580 pcSlice->setRefPicList( m_cListPic ); 604 581 #endif 605 582 606 #endif607 583 // For generalized B 608 584 // note: maybe not existed case (always L0 is copied to L1 if L1 is empty) … … 646 622 //--------------- 647 623 pcSlice->setRefPOCList(); 648 #if !L0034_COMBINED_LIST_CLEANUP649 624 pcSlice->setNoBackPredFlag( false ); 650 625 if ( pcSlice->getSliceType() == B_SLICE ) … … 663 638 } 664 639 } 665 #endif666 640 } 667 641 … … 717 691 m_cEntropyDecoder.decodePPS( pps ); 718 692 m_parameterSetManagerDecoder.storePrefetchedPPS( pps ); 693 694 if( pps->getDependentSliceSegmentsEnabledFlag() ) 695 { 696 Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1; 697 m_cSliceDecoder.initCtxMem(NumCtx); 698 for ( UInt st = 0; st < NumCtx; st++ ) 699 { 700 TDecSbac* ctx = NULL; 701 ctx = new TDecSbac; 702 ctx->init( &m_cBinCABAC ); 703 m_cSliceDecoder.setCtxMem( ctx, st ); 704 } 705 } 719 706 } 720 707 721 708 Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ) 722 709 { 723 if(nalUnitType == NAL_UNIT_S UFFIX_SEI)710 if(nalUnitType == NAL_UNIT_SEI_SUFFIX) 724 711 { 725 712 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); … … 766 753 return false; 767 754 768 case NAL_UNIT_ PREFIX_SEI:769 case NAL_UNIT_S UFFIX_SEI:755 case NAL_UNIT_SEI: 756 case NAL_UNIT_SEI_SUFFIX: 770 757 xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType ); 771 758 return false; … … 773 760 case NAL_UNIT_CODED_SLICE_TRAIL_R: 774 761 case NAL_UNIT_CODED_SLICE_TRAIL_N: 775 case NAL_UNIT_CODED_SLICE_TLA _R:762 case NAL_UNIT_CODED_SLICE_TLA: 776 763 case NAL_UNIT_CODED_SLICE_TSA_N: 777 764 case NAL_UNIT_CODED_SLICE_STSA_R: 778 765 case NAL_UNIT_CODED_SLICE_STSA_N: 779 case NAL_UNIT_CODED_SLICE_BLA _W_LP:780 case NAL_UNIT_CODED_SLICE_BLA _W_RADL:766 case NAL_UNIT_CODED_SLICE_BLA: 767 case NAL_UNIT_CODED_SLICE_BLANT: 781 768 case NAL_UNIT_CODED_SLICE_BLA_N_LP: 782 case NAL_UNIT_CODED_SLICE_IDR _W_RADL:769 case NAL_UNIT_CODED_SLICE_IDR: 783 770 case NAL_UNIT_CODED_SLICE_IDR_N_LP: 784 771 case NAL_UNIT_CODED_SLICE_CRA: 785 772 case NAL_UNIT_CODED_SLICE_RADL_N: 786 case NAL_UNIT_CODED_SLICE_ RADL_R:773 case NAL_UNIT_CODED_SLICE_DLP: 787 774 case NAL_UNIT_CODED_SLICE_RASL_N: 788 case NAL_UNIT_CODED_SLICE_ RASL_R:775 case NAL_UNIT_CODED_SLICE_TFD: 789 776 #if H_MV 790 777 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag); … … 808 795 Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay) 809 796 { 810 if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_ RASL_R|| m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))797 if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TFD || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) 811 798 { 812 799 iPOCLastDisplay++; … … 839 826 { 840 827 if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA 841 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA _W_LP828 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 842 829 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 843 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA _W_RADL)830 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT ) 844 831 { 845 832 // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT. 846 833 m_pocRandomAccess = m_apcSlicePilot->getPOC(); 847 834 } 848 else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR _W_RADL|| m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )835 else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 849 836 { 850 837 m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. … … 862 849 } 863 850 // skip the reordered pictures, if necessary 864 else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_ RASL_R|| m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))851 else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TFD || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) 865 852 { 866 853 iPOCLastDisplay++; … … 894 881 895 882 #endif 883 896 884 //! \}
Note: See TracChangeset for help on using the changeset viewer.