Changeset 368 in 3DVCSoftware for branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder
- Timestamp:
- 3 May 2013, 17:16:12 (12 years ago)
- Location:
- branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/NALread.cpp
r367 r368 103 103 assert(forbidden_zero_bit == 0); 104 104 nalu.m_nalUnitType = (NalUnitType) bs.read(6); // nal_unit_type 105 #if H_MV 106 nalu.m_layerId = bs.read(6); // layerId 107 #else 105 108 nalu.m_reservedZero6Bits = bs.read(6); // nuh_reserved_zero_6bits 106 109 assert(nalu.m_reservedZero6Bits == 0); 110 #endif 107 111 nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1 108 112 -
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r367 r368 680 680 if (uiCode) 681 681 { 682 #if H_MV 683 READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" ); pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false); 684 #else 682 685 while ( xMoreRbspData() ) 683 686 { 684 687 READ_FLAG( uiCode, "sps_extension_data_flag"); 685 688 } 689 #endif 686 690 } 687 691 } … … 693 697 READ_CODE( 4, uiCode, "vps_video_parameter_set_id" ); pcVPS->setVPSId( uiCode ); 694 698 READ_CODE( 2, uiCode, "vps_reserved_three_2bits" ); assert(uiCode == 3); 699 #if H_MV 700 READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); pcVPS->setMaxLayers( uiCode + 1 ); 701 #else 695 702 READ_CODE( 6, uiCode, "vps_reserved_zero_6bits" ); assert(uiCode == 0); 703 #endif 696 704 READ_CODE( 3, uiCode, "vps_max_sub_layers_minus1" ); pcVPS->setMaxTLayers( uiCode + 1 ); 697 705 READ_FLAG( uiCode, "vps_temporal_id_nesting_flag" ); pcVPS->setTemporalNestingFlag( uiCode ? true:false ); 698 706 assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag()); 707 #if H_MV 708 READ_CODE( 16, uiCode, "vps_extension_offset" ); 709 #else 699 710 READ_CODE( 16, uiCode, "vps_reserved_ffff_16bits" ); assert(uiCode == 0xffff); 711 #endif 700 712 parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1); 701 713 #if SIGNAL_BITRATE_PICRATE_IN_VPS … … 727 739 728 740 assert( pcVPS->getNumHrdParameters() < MAX_VPS_OP_SETS_PLUS1 ); 741 #if H_MV 742 assert( pcVPS->getMaxNuhLayerId() < MAX_VPS_NUH_LAYER_ID_PLUS1 ); 743 READ_CODE( 6, uiCode, "vps_max_nuh_layer_id" ); pcVPS->setMaxNuhLayerId( uiCode ); 744 #else 729 745 assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 ); 730 746 READ_CODE( 6, uiCode, "vps_max_nuh_reserved_zero_layer_id" ); pcVPS->setMaxNuhReservedZeroLayerId( uiCode ); 747 #endif 731 748 READ_UVLC( uiCode, "vps_max_op_sets_minus1" ); pcVPS->setMaxOpSets( uiCode + 1 ); 732 749 for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getMaxOpSets() - 1 ); opsIdx ++ ) 733 750 { 734 751 // Operation point set 752 #if H_MV 753 for( UInt i = 0; i <= pcVPS->getMaxNuhLayerId(); i ++ ) 754 #else 735 755 for( UInt i = 0; i <= pcVPS->getMaxNuhReservedZeroLayerId(); i ++ ) 756 #endif 736 757 { 737 758 READ_FLAG( uiCode, "layer_id_included_flag[opsIdx][i]" ); pcVPS->setLayerIdIncludedFlag( uiCode == 1 ? true : false, opsIdx, i ); … … 772 793 if (uiCode) 773 794 { 795 #if H_MV 796 m_pcBitstream->readOutTrailingBits(); 797 798 READ_FLAG( uiCode, "avc_base_layer_flag" ); pcVPS->setAvcBaseLayerFlag( uiCode == 1 ? true : false ); 799 READ_FLAG( uiCode, "splitting_flag" ); pcVPS->setSplittingFlag( uiCode == 1 ? true : false ); 800 801 // Parse scalability_mask[i] 802 for( Int sIdx = 0; sIdx < MAX_NUM_SCALABILITY_TYPES; sIdx++ ) 803 { 804 READ_FLAG( uiCode, "scalability_mask[i]" ); pcVPS->setScalabilityMask( sIdx, uiCode == 1 ? true : false ); 805 } 806 807 Int numScalabilityTypes = pcVPS->getNumScalabilityTypes(); 808 809 // Parse dimension_id_len_minus1[j] 810 for( Int sIdx = 0; sIdx < numScalabilityTypes; sIdx++ ) 811 { 812 READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" ); pcVPS->setDimensionIdLen( sIdx, uiCode + 1 ); 813 } 814 815 // vps_nuh_layer_id_present_flag 816 READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" ); pcVPS->setVpsNuhLayerIdPresentFlag( uiCode == 1 ? true : false ); 817 818 // parse layer_id_in_nuh[i] and derive LayerIdInVps 819 pcVPS->setLayerIdInNuh( 0, 0 ); pcVPS->setLayerIdInVps( 0, 0 ); 820 821 for( Int layer = 1; layer <= pcVPS->getMaxLayers() - 1; layer++ ) 822 { 823 UInt layerIdInNuh; 824 if ( pcVPS->getVpsNuhLayerIdPresentFlag() ) 825 { 826 READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" ); layerIdInNuh = uiCode; 827 } 828 else 829 { 830 layerIdInNuh = layer; 831 } 832 833 pcVPS->setLayerIdInNuh( layer, layerIdInNuh ); 834 pcVPS->setLayerIdInVps( layerIdInNuh, layer ); 835 836 // parse dimension_id[i][j] 837 for( Int sIdx = 0; sIdx < numScalabilityTypes; sIdx++ ) 838 { 839 READ_CODE( pcVPS->getDimensionIdLen( sIdx ), uiCode, "dimension_id[i][j]" ); pcVPS->setDimensionId( layer, sIdx, uiCode ); 840 } 841 } 842 843 for( Int layerSet = 1; layerSet <= pcVPS->getMaxOpSets() - 1; layerSet++ ) 844 { 845 READ_FLAG( uiCode, "vps_profile_present_flag[lsIdx]" ); pcVPS->setVpsProfilePresentFlag( layerSet, uiCode == 1 ? true : false ); 846 if( pcVPS->getVpsProfilePresentFlag( layerSet ) == false ) 847 { 848 READ_UVLC( uiCode, "profile_layer_set_ref_minus1[lsIdx]" ); pcVPS->setProfileLayerSetRefMinus1( layerSet, uiCode ); 849 } 850 851 parsePTL ( pcVPS->getPTL( layerSet ), pcVPS->getVpsProfilePresentFlag( layerSet ), pcVPS->getMaxTLayers()-1); 852 if( pcVPS->getVpsProfilePresentFlag( layerSet ) == false ) 853 { 854 TComPTL temp = *pcVPS->getPTL( layerSet ); 855 *pcVPS->getPTL( layerSet ) = *pcVPS->getPTL( pcVPS->getProfileLayerSetRefMinus1( layerSet ) + 1 ); 856 pcVPS->getPTL( layerSet )->copyLevelFrom( &temp ); 857 } 858 } 859 860 READ_UVLC( uiCode, "num_output_layer_sets" ); pcVPS->setNumOutputLayerSets( uiCode ); 861 862 for( Int layerSet = 0; layerSet < pcVPS->getNumOutputLayerSets(); layerSet++ ) 863 { 864 READ_UVLC( uiCode, "output_layer_set_idx[i]" ); pcVPS->setOutputLayerSetIdx( layerSet, uiCode ); 865 for( Int layer = 0; layer <= pcVPS->getMaxNuhLayerId(); layer++ ) 866 { 867 if( pcVPS->getLayerIdIncludedFlag( pcVPS->getOutputLayerSetIdx( layerSet ), layer ) == true ) 868 { 869 READ_FLAG( uiCode, "output_layer_flag" ); pcVPS->setOutputLayerFlag( layerSet, layer, uiCode == 1 ? true : false ); 870 } 871 } 872 } 873 874 for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ ) 875 { 876 for( Int j = 0; j < i; j++ ) 877 { 878 READ_FLAG( uiCode, "direct_dependency_flag[i][j]" ); pcVPS->setDirectDependencyFlag( i, j, uiCode ); 879 } 880 } 881 882 READ_FLAG( uiCode, "vps_extension2_flag" ); 883 if (uiCode) 884 { 885 while ( xMoreRbspData() ) 886 { 887 READ_FLAG( uiCode, "vps_extension2_data_flag"); 888 } 889 } 890 891 pcVPS->checkVPSExtensionSyntax(); 892 893 pcVPS->calcIvRefLayers(); 894 895 #else 774 896 while ( xMoreRbspData() ) 775 897 { 776 898 READ_FLAG( uiCode, "vps_extension_data_flag"); 777 899 } 900 #endif 778 901 } 779 902 … … 791 914 TComPPS* pps = NULL; 792 915 TComSPS* sps = NULL; 916 #if H_MV 917 TComVPS* vps = NULL; 918 #endif 793 919 794 920 UInt firstSliceSegmentInPic; … … 805 931 //!KS: need to add error handling code here, if SPS is not available 806 932 assert(sps!=0); 933 #if H_MV 934 vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId()); 935 assert(vps!=0); 936 rpcSlice->setVPS(vps); 937 #endif 807 938 rpcSlice->setSPS(sps); 808 939 rpcSlice->setPPS(pps); … … 1392 1523 for (Int i = 0; i < maxNumSubLayersMinus1; i++) 1393 1524 { 1525 #if !H_MV 1394 1526 if(profilePresentFlag) 1395 1527 { 1528 #endif 1396 1529 READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode); 1397 } 1530 #if H_MV 1531 rpcPTL->setSubLayerProfilePresentFlag( i, profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) ); 1532 #else 1533 } 1534 #endif 1398 1535 READ_FLAG( uiCode, "sub_layer_level_present_flag[i]" ); rpcPTL->setSubLayerLevelPresentFlag (i, uiCode); 1399 1536 } -
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecGop.cpp
r367 r368 205 205 } 206 206 207 #if !H_3D 207 208 rpcPic->compressMotion(); 209 #endif 208 210 Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); 209 211 if (!pcSlice->isReferenced()) c += 32; 210 212 211 213 //-- For time output for each slice 214 #if H_MV 215 printf("\nLayer %2d POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getLayerId(), 216 pcSlice->getPOC(), 217 pcSlice->getTLayer(), 218 c, 219 pcSlice->getSliceQp() ); 220 #else 212 221 printf("\nPOC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getPOC(), 213 222 pcSlice->getTLayer(), 214 223 c, 215 224 pcSlice->getSliceQp() ); 225 #endif 216 226 217 227 m_dDecTime += (Double)(clock()-iBeforeTime) / CLOCKS_PER_SEC; … … 224 234 for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++) 225 235 { 236 #if H_MV 237 if( pcSlice->getLayerId() != pcSlice->getRefLayerId( RefPicList(iRefList), iRefIndex ) ) 238 { 239 printf( "V%d ", pcSlice->getRefLayerId( RefPicList(iRefList), iRefIndex ) ); 240 } 241 else 242 { 243 #endif 226 244 printf ("%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)); 245 #if H_MV 246 } 247 #endif 227 248 } 228 249 printf ("] "); -
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecTop.cpp
r367 r368 39 39 #include "TDecTop.h" 40 40 41 #if H_MV 42 ParameterSetManagerDecoder TDecTop::m_parameterSetManagerDecoder; 43 #endif 41 44 //! \ingroup TLibDecoder 42 45 //! \{ … … 57 60 m_bFirstSliceInPicture = true; 58 61 m_bFirstSliceInSequence = true; 62 #if H_MV 63 m_layerId = 0; 64 m_viewId = 0; 65 #if H_3D 66 m_isDepth = false; 67 #endif 68 #endif 59 69 } 60 70 … … 86 96 { 87 97 // initialize ROM 98 #if !H_MV 88 99 initROM(); 100 #endif 89 101 m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO); 90 102 m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder ); … … 100 112 { 101 113 TComPic* pcPic = *(iterPic++); 114 #if H_MV 115 if( pcPic ) 116 { 117 #endif 102 118 pcPic->destroy(); 103 119 104 120 delete pcPic; 105 121 pcPic = NULL; 122 #if H_MV 123 } 124 #endif 106 125 } 107 126 … … 110 129 m_cLoopFilter. destroy(); 111 130 131 #if !H_MV 112 132 // destroy ROM 113 133 destroyROM(); 134 #endif 114 135 } 115 136 … … 177 198 } 178 199 200 #if H_MV 201 Void TDecTop::endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic, std::vector<Int>& targetDecLayerIdSet ) 202 #else 179 203 Void TDecTop::executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic) 204 #endif 180 205 { 181 206 if (!m_pcPic) … … 195 220 rpcListPic = &m_cListPic; 196 221 m_cCuDecoder.destroy(); 222 #if H_MV 223 TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer ); 224 TComSlice::markIvRefPicsAsUnused ( m_ivPicLists, targetDecLayerIdSet, m_parameterSetManagerDecoder.getActiveVPS(), m_layerId, poc ); 225 #endif 197 226 m_bFirstSliceInPicture = true; 198 227 … … 311 340 } 312 341 342 #if H_MV 343 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag ) 344 { 345 assert( nalu.m_layerId == m_layerId ); 346 347 #else 313 348 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay ) 314 349 { 350 #endif 315 351 TComPic*& pcPic = m_pcPic; 316 352 m_apcSlicePilot->initSlice(); … … 337 373 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); 338 374 375 #if H_MV 376 m_apcSlicePilot->setLayerId( nalu.m_layerId ); 377 #endif 339 378 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder); 340 379 380 #if H_MV 381 TComVPS* vps = m_apcSlicePilot->getVPS(); 382 Int layerIdInVps = vps->getLayerIdInVps( nalu.m_layerId ); 383 384 setViewId( vps->getViewId( layerIdInVps ) ); 385 m_apcSlicePilot->setViewId( getViewId() ); 386 #if H_3D 387 setIsDepth( vps->getDepthId( layerIdInVps ) == 1 ); 388 m_apcSlicePilot->setIsDepth( getIsDepth() ); 389 #endif 390 #endif 341 391 // Skip pictures due to random access 342 392 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) … … 365 415 m_prevPOC = m_apcSlicePilot->getPOC(); 366 416 } 417 #if H_MV 418 if ( newLayerFlag ) 419 { 420 return false; 421 } 422 #endif 367 423 // actual decoding starts here 368 424 xActivateParameterSets(); … … 384 440 m_cPrediction.initTempBuff(); 385 441 m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); 442 #if H_MV 443 m_apcSlicePilot->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer ); 444 #endif 386 445 // Get a new picture buffer 387 446 xGetNewPicBuffer (m_apcSlicePilot, pcPic); … … 515 574 pcPic->setTLayer(nalu.m_temporalId); 516 575 576 #if H_MV 577 pcPic->setLayerId( nalu.m_layerId ); 578 pcPic->setViewId ( getViewId() ); 579 #if H_3D 580 pcPic->setIsDepth( getIsDepth() ); 581 #endif 582 #endif 517 583 if (bNextSlice) 518 584 { 519 585 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic ); 520 586 // Set reference list 587 #if H_MV 588 pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer, true ); 589 #else 521 590 #if FIX1071 522 591 pcSlice->setRefPicList( m_cListPic, true ); … … 525 594 #endif 526 595 596 #endif 527 597 // For generalized B 528 598 // note: maybe not existed case (always L0 is copied to L1 if L1 is empty) … … 662 732 } 663 733 734 #if H_MV 735 Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayerFlag) 736 #else 664 737 Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay) 738 #endif 665 739 { 666 740 // Initialize entropy decoder … … 703 777 case NAL_UNIT_CODED_SLICE_RASL_N: 704 778 case NAL_UNIT_CODED_SLICE_RASL_R: 779 #if H_MV 780 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag); 781 #else 705 782 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay); 783 #endif 706 784 break; 707 785 default: … … 783 861 } 784 862 863 #if H_MV 864 TComPic* TDecTop::getPic( Int poc ) 865 { 866 xGetPic( m_layerId, poc ); 867 TComList<TComPic*>* listPic = getListPic(); 868 TComPic* pcPic = NULL; 869 for(TComList<TComPic*>::iterator it=listPic->begin(); it!=listPic->end(); it++) 870 { 871 if( (*it)->getPOC() == poc ) 872 { 873 pcPic = *it ; 874 break ; 875 } 876 } 877 return pcPic; 878 } 879 880 TComPic* TDecTop::xGetPic( Int layerId, Int poc ) 881 { 882 return m_ivPicLists->getPic( layerId, poc ) ; 883 } 884 885 #endif 785 886 //! \} -
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecTop.h
r367 r368 61 61 // ==================================================================================================================== 62 62 63 #if H_MV 64 class TAppDecTop; 65 #endif 63 66 /// decoder class 64 67 class TDecTop … … 72 75 73 76 TComList<TComPic*> m_cListPic; // Dynamic buffer 77 #if H_MV 78 static ParameterSetManagerDecoder m_parameterSetManagerDecoder; // storage for parameter sets 79 #else 74 80 ParameterSetManagerDecoder m_parameterSetManagerDecoder; // storage for parameter sets 81 #endif 75 82 TComSlice* m_apcSlicePilot; 76 83 … … 98 105 Bool m_bFirstSliceInPicture; 99 106 Bool m_bFirstSliceInSequence; 107 #if H_MV 108 // For H_MV m_bFirstSliceInSequence indicates first slice in sequence of the particular layer 109 Int m_layerId; 110 Int m_viewId; 111 TComPicLists* m_ivPicLists; 112 std::vector<TComPic*> m_refPicSetInterLayer; 113 #if H_3D 114 Bool m_isDepth; 115 #endif 116 #endif 100 117 101 118 public: … … 109 126 110 127 Void init(); 128 #if H_MV 129 Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer ); 130 #else 111 131 Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay); 132 #endif 112 133 113 134 Void deletePicBuffer(); 114 135 136 #if H_MV 137 Void endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic, std::vector<Int>& targetDecLayerIdSet); 138 #else 115 139 Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic); 140 #endif 116 141 142 #if H_MV 143 TComPic* getPic ( Int poc ); 144 TComList<TComPic*>* getListPic () { return &m_cListPic; } 145 Void setIvPicLists ( TComPicLists* picLists) { m_ivPicLists = picLists; } 146 147 Int getCurrPoc () { return m_apcSlicePilot->getPOC(); } 148 Void setLayerId ( Int layer) { m_layerId = layer; } 149 Int getLayerId () { return m_layerId; } 150 Void setViewId ( Int viewId ) { m_viewId = viewId; } 151 Int getViewId () { return m_viewId; } 152 #if H_3D 153 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } 154 Bool getIsDepth () { return m_isDepth; } 155 #endif 156 #endif 117 157 protected: 118 158 Void xGetNewPicBuffer (TComSlice* pcSlice, TComPic*& rpcPic); … … 120 160 121 161 Void xActivateParameterSets(); 162 #if H_MV 163 TComPic* xGetPic( Int layerId, Int poc ); 164 Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag ); 165 #else 122 166 Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay); 167 #endif 123 168 Void xDecodeVPS(); 124 169 Void xDecodeSPS();
Note: See TracChangeset for help on using the changeset viewer.