Changeset 189 in SHVCSoftware for trunk/source/Lib/TLibDecoder
- Timestamp:
- 13 May 2013, 16:58:44 (12 years ago)
- Location:
- trunk/source
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source
- Property svn:mergeinfo changed
/branches/SHM-2.0-dev/source (added) merged: 133-167,169-182,184-188
- Property svn:mergeinfo changed
-
trunk/source/Lib/TLibDecoder/NALread.cpp
r125 r189 50 50 //! \ingroup TLibDecoder 51 51 //! \{ 52 static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, Bool isVclNalUnit)52 static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, TComInputBitstream *bitstream, Bool isVclNalUnit) 53 53 { 54 54 UInt zeroCount = 0; 55 55 vector<uint8_t>::iterator it_read, it_write; 56 56 57 for (it_read = it_write = nalUnitBuf.begin(); it_read != nalUnitBuf.end(); it_read++, it_write++) 57 UInt pos = 0; 58 bitstream->clearEmulationPreventionByteLocation(); 59 for (it_read = it_write = nalUnitBuf.begin(); it_read != nalUnitBuf.end(); it_read++, it_write++, pos++) 58 60 { 59 61 assert(zeroCount < 2 || *it_read >= 0x03); 60 62 if (zeroCount == 2 && *it_read == 0x03) 61 63 { 64 bitstream->pushEmulationPreventionByteLocation( pos ); 65 pos++; 62 66 it_read++; 63 67 zeroCount = 0; … … 109 113 if ( nalu.m_temporalId ) 110 114 { 111 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA 112 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA NT115 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP 116 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL 113 117 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_N_LP 114 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR 118 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL 115 119 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP 116 120 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA … … 122 126 else 123 127 { 124 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA 128 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA_R 125 129 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N 126 130 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R … … 136 140 /* perform anti-emulation prevention */ 137 141 TComInputBitstream *pcBitstream = new TComInputBitstream(NULL); 138 convertPayloadToRBSP(nalUnitBuf, (nalUnitBuf[0] & 64) == 0);142 convertPayloadToRBSP(nalUnitBuf, pcBitstream, (nalUnitBuf[0] & 64) == 0); 139 143 140 144 nalu.m_Bitstream = new TComInputBitstream(&nalUnitBuf); 145 nalu.m_Bitstream->setEmulationPreventionByteLocation(pcBitstream->getEmulationPreventionByteLocation()); 141 146 delete pcBitstream; 142 147 readNalUnitHeader(nalu); -
trunk/source/Lib/TLibDecoder/SEIread.cpp
r125 r189 90 90 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 91 91 break; 92 #if J0149_TONE_MAPPING_SEI 93 case SEI::TONE_MAPPING_INFO: 94 fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n"); 95 break; 96 #endif 97 #if L0208_SOP_DESCRIPTION_SEI 98 case SEI::SOP_DESCRIPTION: 99 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); 100 break; 101 #endif 102 #if K0180_SCALABLE_NESTING_SEI 103 case SEI::SCALABLE_NESTING: 104 fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n"); 105 break; 106 #endif 92 107 default: 93 108 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 154 169 SEI *sei = NULL; 155 170 156 if(nalUnitType == NAL_UNIT_ SEI)171 if(nalUnitType == NAL_UNIT_PREFIX_SEI) 157 172 { 158 173 switch (payloadType) … … 219 234 xParseSEIGradualDecodingRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize); 220 235 break; 236 #if J0149_TONE_MAPPING_SEI 237 case SEI::TONE_MAPPING_INFO: 238 sei = new SEIToneMappingInfo; 239 xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize); 240 break; 241 #endif 242 #if L0208_SOP_DESCRIPTION_SEI 243 case SEI::SOP_DESCRIPTION: 244 sei = new SEISOPDescription; 245 xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize); 246 break; 247 #endif 248 #if K0180_SCALABLE_NESTING_SEI 249 case SEI::SCALABLE_NESTING: 250 sei = new SEIScalableNesting; 251 xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps); 252 break; 253 #endif 221 254 default: 222 255 for (UInt i = 0; i < payloadSize; i++) … … 284 317 { 285 318 UInt reservedPayloadExtensionData; 286 READ_ CODE (1,reservedPayloadExtensionData, "reserved_payload_extension_data");319 READ_FLAG (reservedPayloadExtensionData, "reserved_payload_extension_data"); 287 320 } 288 321 289 322 UInt dummy; 290 READ_CODE (1, dummy, "payload_bit_equal_to_one"); 291 READ_CODE (payloadBitsRemaining-1, dummy, "payload_bit_equal_to_zero"); 323 READ_FLAG (dummy, "payload_bit_equal_to_one"); payloadBitsRemaining--; 324 while (payloadBitsRemaining) 325 { 326 READ_FLAG (dummy, "payload_bit_equal_to_zero"); payloadBitsRemaining--; 327 } 292 328 } 293 329 … … 632 668 } 633 669 670 #if J0149_TONE_MAPPING_SEI 671 Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt /*payloadSize*/) 672 { 673 Int i; 674 UInt val; 675 READ_UVLC( val, "tone_map_id" ); sei.m_toneMapId = val; 676 READ_FLAG( val, "tone_map_cancel_flag" ); sei.m_toneMapCancelFlag = val; 677 678 if ( !sei.m_toneMapCancelFlag ) 679 { 680 READ_FLAG( val, "tone_map_persistence_flag" ); sei.m_toneMapPersistenceFlag = val; 681 READ_CODE( 8, val, "coded_data_bit_depth" ); sei.m_codedDataBitDepth = val; 682 READ_CODE( 8, val, "target_bit_depth" ); sei.m_targetBitDepth = val; 683 READ_UVLC( val, "model_id" ); sei.m_modelId = val; 684 switch(sei.m_modelId) 685 { 686 case 0: 687 { 688 READ_CODE( 32, val, "min_value" ); sei.m_minValue = val; 689 READ_CODE( 32, val, "max_value" ); sei.m_maxValue = val; 690 break; 691 } 692 case 1: 693 { 694 READ_CODE( 32, val, "sigmoid_midpoint" ); sei.m_sigmoidMidpoint = val; 695 READ_CODE( 32, val, "sigmoid_width" ); sei.m_sigmoidWidth = val; 696 break; 697 } 698 case 2: 699 { 700 UInt num = 1u << sei.m_targetBitDepth; 701 sei.m_startOfCodedInterval.resize(num+1); 702 for(i = 0; i < num; i++) 703 { 704 READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "start_of_coded_interval" ); 705 sei.m_startOfCodedInterval[i] = val; 706 } 707 sei.m_startOfCodedInterval[num] = 1u << sei.m_codedDataBitDepth; 708 break; 709 } 710 case 3: 711 { 712 READ_CODE( 16, val, "num_pivots" ); sei.m_numPivots = val; 713 sei.m_codedPivotValue.resize(sei.m_numPivots); 714 sei.m_targetPivotValue.resize(sei.m_numPivots); 715 for(i = 0; i < sei.m_numPivots; i++ ) 716 { 717 READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "coded_pivot_value" ); 718 sei.m_codedPivotValue[i] = val; 719 READ_CODE( ((( sei.m_targetBitDepth + 7 ) >> 3 ) << 3), val, "target_pivot_value" ); 720 sei.m_targetPivotValue[i] = val; 721 } 722 break; 723 } 724 case 4: 725 { 726 READ_CODE( 8, val, "camera_iso_speed_idc" ); sei.m_cameraIsoSpeedValue = val; 727 if( sei.m_cameraIsoSpeedValue == 255) //Extended_ISO 728 { 729 READ_CODE( 32, val, "camera_iso_speed_value" ); sei.m_cameraIsoSpeedValue = val; 730 } 731 READ_FLAG( val, "exposure_compensation_value_sign_flag" ); sei.m_exposureCompensationValueSignFlag = val; 732 READ_CODE( 16, val, "exposure_compensation_value_numerator" ); sei.m_exposureCompensationValueNumerator = val; 733 READ_CODE( 16, val, "exposure_compensation_value_denom_idc" ); sei.m_exposureCompensationValueDenomIdc = val; 734 READ_CODE( 32, val, "ref_screen_luminance_white" ); sei.m_refScreenLuminanceWhite = val; 735 READ_CODE( 32, val, "extended_range_white_level" ); sei.m_extendedRangeWhiteLevel = val; 736 READ_CODE( 16, val, "nominal_black_level_luma_code_value" ); sei.m_nominalBlackLevelLumaCodeValue = val; 737 READ_CODE( 16, val, "nominal_white_level_luma_code_value" ); sei.m_nominalWhiteLevelLumaCodeValue= val; 738 READ_CODE( 16, val, "extended_white_level_luma_code_value" ); sei.m_extendedWhiteLevelLumaCodeValue = val; 739 break; 740 } 741 default: 742 { 743 assert(!"Undefined SEIToneMapModelId"); 744 break; 745 } 746 }//switch model id 747 }// if(!sei.m_toneMapCancelFlag) 748 749 xParseByteAlign(); 750 } 751 #endif 752 753 #if L0208_SOP_DESCRIPTION_SEI 754 Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize) 755 { 756 Int iCode; 757 UInt uiCode; 758 759 READ_UVLC( uiCode, "sop_seq_parameter_set_id" ); sei.m_sopSeqParameterSetId = uiCode; 760 READ_UVLC( uiCode, "num_pics_in_sop_minus1" ); sei.m_numPicsInSopMinus1 = uiCode; 761 for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++) 762 { 763 READ_CODE( 6, uiCode, "sop_desc_vcl_nalu_type" ); sei.m_sopDescVclNaluType[i] = uiCode; 764 READ_CODE( 3, sei.m_sopDescTemporalId[i], "sop_desc_temporal_id" ); sei.m_sopDescTemporalId[i] = uiCode; 765 if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP) 766 { 767 READ_UVLC( sei.m_sopDescStRpsIdx[i], "sop_desc_st_rps_idx" ); sei.m_sopDescStRpsIdx[i] = uiCode; 768 } 769 if (i > 0) 770 { 771 READ_SVLC( iCode, "sop_desc_poc_delta" ); sei.m_sopDescPocDelta[i] = iCode; 772 } 773 } 774 775 xParseByteAlign(); 776 } 777 #endif 778 779 #if K0180_SCALABLE_NESTING_SEI 780 Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps) 781 { 782 UInt uiCode; 783 SEIMessages seis; 784 785 READ_FLAG( uiCode, "bitstream_subset_flag" ); sei.m_bitStreamSubsetFlag = uiCode; 786 READ_FLAG( uiCode, "nesting_op_flag" ); sei.m_nestingOpFlag = uiCode; 787 if (sei.m_nestingOpFlag) 788 { 789 READ_FLAG( uiCode, "default_op_flag" ); sei.m_defaultOpFlag = uiCode; 790 READ_UVLC( uiCode, "nesting_num_ops_minus1" ); sei.m_nestingNumOpsMinus1 = uiCode; 791 for (UInt i = sei.m_defaultOpFlag; i <= sei.m_nestingNumOpsMinus1; i++) 792 { 793 READ_CODE( 3, uiCode, "nesting_max_temporal_id_plus1" ); sei.m_nestingMaxTemporalIdPlus1[i] = uiCode; 794 READ_UVLC( uiCode, "nesting_op_idx" ); sei.m_nestingOpIdx[i] = uiCode; 795 } 796 } 797 else 798 { 799 READ_FLAG( uiCode, "all_layers_flag" ); sei.m_allLayersFlag = uiCode; 800 if (!sei.m_allLayersFlag) 801 { 802 READ_CODE( 3, uiCode, "nesting_no_op_max_temporal_id_plus1" ); sei.m_nestingNoOpMaxTemporalIdPlus1 = uiCode; 803 READ_UVLC( uiCode, "nesting_num_layers_minus1" ); sei.m_nestingNumLayersMinus1 = uiCode; 804 for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++) 805 { 806 READ_CODE( 6, uiCode, "nesting_layer_id" ); sei.m_nestingLayerId[i] = uiCode; 807 } 808 } 809 } 810 811 // byte alignment 812 while ( m_pcBitstream->getNumBitsRead() % 8 != 0 ) 813 { 814 UInt code; 815 READ_FLAG( code, "nesting_zero_bit" ); 816 } 817 818 sei.m_callerOwnsSEIs = false; 819 820 // read nested SEI messages 821 do { 822 xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps); 823 } while (m_pcBitstream->getNumBitsLeft() > 8); 824 825 } 826 #endif 827 634 828 Void SEIReader::xParseByteAlign() 635 829 { -
trunk/source/Lib/TLibDecoder/SEIread.h
r125 r189 70 70 Void xParseSEITemporalLevel0Index (SEITemporalLevel0Index &sei, UInt payloadSize); 71 71 Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize); 72 #if J0149_TONE_MAPPING_SEI 73 Void xParseSEIToneMappingInfo (SEIToneMappingInfo& sei, UInt payloadSize); 74 #endif 75 #if L0208_SOP_DESCRIPTION_SEI 76 Void xParseSEISOPDescription (SEISOPDescription &sei, UInt payloadSize); 77 #endif 78 #if K0180_SCALABLE_NESTING_SEI 79 Void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps); 80 #endif 72 81 Void xParseByteAlign(); 73 82 }; -
trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
r125 r189 593 593 594 594 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 595 g_bitDepthY = 8 + uiCode; 596 pcSPS->setBitDepthY(g_bitDepthY); 595 pcSPS->setBitDepthY( uiCode + 8 ); 597 596 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 598 597 599 598 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 600 g_bitDepthC = 8 + uiCode; 601 pcSPS->setBitDepthC(g_bitDepthC); 599 pcSPS->setBitDepthC( uiCode + 8 ); 602 600 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 603 601 … … 608 606 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 609 607 { 608 #if L0323_DPB 609 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1"); 610 pcSPS->setMaxDecPicBuffering( uiCode + 1, i); 611 #else 610 612 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering"); 611 613 pcSPS->setMaxDecPicBuffering( uiCode, i); 614 #endif 612 615 READ_UVLC ( uiCode, "sps_num_reorder_pics" ); 613 616 pcSPS->setNumReorderPics(uiCode, i); … … 628 631 629 632 READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" ); 630 UInt log2MinCUSize = uiCode + 3; 633 Int log2MinCUSize = uiCode + 3; 634 pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); 631 635 READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" ); 632 UInt uiMaxCUDepthCorrect = uiCode; 633 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUWidth = 1<<(log2MinCUSize + uiMaxCUDepthCorrect); 634 pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUHeight = 1<<(log2MinCUSize + uiMaxCUDepthCorrect); 636 pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); 637 Int maxCUDepthDelta = uiCode; 638 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 639 pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 635 640 READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); 636 641 … … 640 645 READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" ); pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 ); 641 646 READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" ); pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 ); 642 g_uiAddCUDepth = 0; 643 while( ( pcSPS->getMaxCUWidth() >> uiMaxCUDepthCorrect ) > ( 1 << ( pcSPS->getQuadtreeTULog2MinSize() + g_uiAddCUDepth ) ) ) 644 { 645 g_uiAddCUDepth++; 646 } 647 pcSPS->setMaxCUDepth( uiMaxCUDepthCorrect+g_uiAddCUDepth ); 648 g_uiMaxCUDepth = uiMaxCUDepthCorrect+g_uiAddCUDepth; 649 // BB: these parameters may be removed completly and replaced by the fixed values 650 pcSPS->setMinTrDepth( 0 ); 651 pcSPS->setMaxTrDepth( 1 ); 647 648 Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() ); 649 pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth ); 650 652 651 READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); 653 652 if(pcSPS->getScalingListFlag()) … … 712 711 parseVUI(pcSPS->getVuiParameters(), pcSPS); 713 712 } 713 714 #if SCALED_REF_LAYER_OFFSETS 715 if( pcSPS->getLayerId() > 0 ) 716 { 717 Int iCode; 718 Window& scaledWindow = pcSPS->getScaledRefLayerWindow(); 719 READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); 720 READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); 721 READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); 722 READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); 723 } 724 #endif 714 725 715 726 READ_FLAG( uiCode, "sps_extension_flag"); … … 746 757 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 747 758 { 759 #if L0323_DPB 760 READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); 761 #else 748 762 READ_UVLC( uiCode, "vps_max_dec_pic_buffering[i]" ); pcVPS->setMaxDecPicBuffering( uiCode, i ); 763 #endif 749 764 READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 750 765 READ_UVLC( uiCode, "vps_max_latency_increase[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); … … 785 800 } 786 801 } 802 #if DERIVE_LAYER_ID_LIST_VARIABLES 803 pcVPS->deriveLayerIdListVariables(); 804 #endif 787 805 #if L0043_TIMING_INFO 788 806 TimingInfo *timingInfo = pcVPS->getTimingInfo(); … … 900 918 } 901 919 #endif 920 #if VPS_MOVE_DIR_DEPENDENCY_FLAG 921 #if VPS_EXTN_DIRECT_REF_LAYERS 922 // For layer 0 923 vps->setNumDirectRefLayers(0, 0); 924 // For other layers 925 for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++) 926 { 927 UInt numDirectRefLayers = 0; 928 for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++) 929 { 930 READ_FLAG(uiCode, "direct_dependency_flag[i][j]" ); vps->setDirectDependencyFlag(layerCtr, refLayerCtr, uiCode? true : false); 931 if(uiCode) 932 { 933 vps->setRefLayerId(layerCtr, numDirectRefLayers, refLayerCtr); 934 numDirectRefLayers++; 935 } 936 } 937 vps->setNumDirectRefLayers(layerCtr, numDirectRefLayers); 938 } 939 #endif 940 #endif 902 941 903 942 #if VPS_EXTN_PROFILE_INFO 904 943 // Profile-tier-level signalling 944 #if VPS_PROFILE_OUTPUT_LAYERS 945 READ_CODE( 10, uiCode, "vps_number_layer_sets_minus1" ); assert( uiCode == (vps->getNumLayerSets() - 1) ); 946 READ_CODE( 6, uiCode, "vps_num_profile_tier_level_minus1"); vps->setNumProfileTierLevel( uiCode + 1 ); 947 vps->getPTLForExtnPtr()->resize(vps->getNumProfileTierLevel()); 948 for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++) 949 #else 905 950 vps->getPTLForExtnPtr()->resize(vps->getNumLayerSets()); 906 951 for(Int idx = 1; idx <= vps->getNumLayerSets() - 1; idx++) 952 #endif 907 953 { 908 954 READ_FLAG( uiCode, "vps_profile_present_flag[i]" ); vps->setProfilePresentFlag(idx, uiCode ? true : false); 909 955 if( !vps->getProfilePresentFlag(idx) ) 910 956 { 957 #if VPS_PROFILE_OUTPUT_LAYERS 958 READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); vps->setProfileLayerSetRef(idx, uiCode + 1); 959 #else 911 960 READ_UVLC( uiCode, "vps_profile_layer_set_ref_minus1[i]" ); vps->setProfileLayerSetRef(idx, uiCode + 1); 961 #endif 912 962 assert( vps->getProfileLayerSetRef(idx) < idx ); 913 963 // Copy profile information as indicated … … 918 968 #endif 919 969 970 #if VPS_PROFILE_OUTPUT_LAYERS 971 READ_FLAG( uiCode, "more_output_layer_sets_than_default_flag" ); vps->setMoreOutputLayerSetsThanDefaultFlag( uiCode ? true : false ); 972 Int numOutputLayerSets = 0; 973 if(! vps->getMoreOutputLayerSetsThanDefaultFlag() ) 974 { 975 numOutputLayerSets = vps->getNumLayerSets(); 976 } 977 else 978 { 979 READ_CODE( 10, uiCode, "num_add_output_layer_sets" ); vps->setNumAddOutputLayerSets( uiCode ); 980 numOutputLayerSets = vps->getNumLayerSets() + vps->getNumAddOutputLayerSets(); 981 } 982 if( numOutputLayerSets > 1 ) 983 { 984 READ_FLAG( uiCode, "default_one_target_output_layer_flag" ); vps->setDefaultOneTargetOutputLayerFlag( uiCode ? true : false ); 985 } 986 vps->setNumOutputLayerSets( numOutputLayerSets ); 987 988 for(i = 1; i < numOutputLayerSets; i++) 989 { 990 if( i > (vps->getNumLayerSets() - 1) ) 991 { 992 Int numBits = 1; 993 while ((1 << numBits) < (vps->getNumLayerSets() - 1)) 994 { 995 numBits++; 996 } 997 READ_CODE( numBits, uiCode, "output_layer_set_idx_minus1"); vps->setOutputLayerSetIdx( i, uiCode + 1); 998 Int lsIdx = vps->getOutputLayerSetIdx(i); 999 for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++) 1000 { 1001 READ_FLAG( uiCode, "output_layer_flag[i][j]"); vps->setOutputLayerFlag(i, j, uiCode); 1002 } 1003 } 1004 else 1005 { 1006 // i <= (vps->getNumLayerSets() - 1) 1007 // Assign OutputLayerFlag depending on default_one_target_output_layer_flag 1008 Int lsIdx = i; 1009 if( vps->getDefaultOneTargetOutputLayerFlag() ) 1010 { 1011 for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) 1012 { 1013 vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1))); 1014 } 1015 } 1016 else 1017 { 1018 for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) 1019 { 1020 vps->setOutputLayerFlag(i, j, 1); 1021 } 1022 } 1023 } 1024 Int numBits = 1; 1025 while ((1 << numBits) < (vps->getNumProfileTierLevel())) 1026 { 1027 numBits++; 1028 } 1029 READ_CODE( numBits, uiCode, "profile_level_tier_idx[i]" ); vps->setProfileLevelTierIdx(i, uiCode); 1030 } 1031 #else 920 1032 #if VPS_EXTN_OP_LAYER_SETS 921 1033 // Target output layer signalling … … 923 1035 for(i = 0; i < vps->getNumOutputLayerSets(); i++) 924 1036 { 1037 #if VPS_OUTPUT_LAYER_SET_IDX 1038 READ_UVLC( uiCode, "vps_output_layer_set_idx_minus1[i]"); vps->setOutputLayerSetIdx(i, uiCode + 1); 1039 #else 925 1040 READ_UVLC( uiCode, "vps_output_layer_set_idx[i]"); vps->setOutputLayerSetIdx(i, uiCode); 1041 #endif 926 1042 Int lsIdx = vps->getOutputLayerSetIdx(i); 927 1043 for(j = 0; j <= vps->getMaxLayerId(); j++) … … 932 1048 } 933 1049 } 934 } 935 #endif 1050 } 1051 #endif 1052 #endif 1053 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1054 READ_FLAG(uiCode, "max_one_active_ref_layer_flag" ); 1055 vps->setMaxOneActiveRefLayerFlag(uiCode); 1056 #endif 1057 1058 #if !VPS_MOVE_DIR_DEPENDENCY_FLAG 936 1059 #if VPS_EXTN_DIRECT_REF_LAYERS 937 1060 // For layer 0 … … 952 1075 vps->setNumDirectRefLayers(layerCtr, numDirectRefLayers); 953 1076 } 1077 #endif 954 1078 #endif 955 1079 } … … 1074 1198 iPOCmsb = iPrevPOCmsb; 1075 1199 } 1076 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1077 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT1200 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1201 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1078 1202 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1079 1203 { … … 1084 1208 1085 1209 TComReferencePictureSet* rps; 1210 rps = rpcSlice->getLocalRPS(); 1211 rpcSlice->setRPS(rps); 1086 1212 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 1087 1213 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 1088 1214 { 1089 rps = rpcSlice->getLocalRPS();1090 1215 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 1091 rpcSlice->setRPS(rps);1092 1216 } 1093 1217 else // use reference to short-term reference picture set in PPS … … 1106 1230 uiCode = 0; 1107 1231 } 1108 rpcSlice->setRPS(sps->getRPSList()->getReferencePictureSet(uiCode)); 1109 1110 rps = rpcSlice->getRPS(); 1232 memcpy(rps,sps->getRPSList()->getReferencePictureSet(uiCode),sizeof(TComReferencePictureSet)); 1111 1233 } 1112 1234 if(sps->getLongTermRefsPresent()) … … 1131 1253 rps->setNumberOfLongtermPictures(numOfLtrp); 1132 1254 Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); 1133 Int prev LSB = 0, prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;;1255 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; 1134 1256 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 1135 1257 { … … 1158 1280 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 1159 1281 Bool deltaFlag = false; 1160 // First LTRP || First LTRP from SH || curr LSB != prev LSB1161 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) || (pocLsbLt != prevLSB))1282 // First LTRP || First LTRP from SH 1283 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 1162 1284 { 1163 1285 deltaFlag = true; … … 1184 1306 rps->setCheckLTMSBPresent(j,false); 1185 1307 } 1186 prevLSB = pocLsbLt;1187 1308 prevDeltaMSB = deltaPocMSBCycleLT; 1188 1309 } … … 1190 1311 rps->setNumberOfPictures(offset); 1191 1312 } 1192 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1193 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT1313 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1314 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1194 1315 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1195 1316 { … … 1202 1323 rpcSlice->setRPS(rps); 1203 1324 } 1325 1326 1204 1327 if (rpcSlice->getSPS()->getTMVPFlagsPresent()) 1205 1328 { … … 1212 1335 } 1213 1336 } 1337 1338 #if REF_IDX_FRAMEWORK 1339 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1340 rpcSlice->setActiveNumILRRefIdx(0); 1341 if((sps->getLayerId() > 0) && (rpcSlice->getNumILRRefIdx() > 0) ) 1342 { 1343 READ_FLAG(uiCode,"inter_layer_pred_enabled_flag"); 1344 rpcSlice->setInterLayerPredEnabledFlag(uiCode); 1345 if( rpcSlice->getInterLayerPredEnabledFlag()) 1346 { 1347 if(rpcSlice->getNumILRRefIdx() > 1) 1348 { 1349 Int numBits = 1; 1350 while ((1 << numBits) < rpcSlice->getNumILRRefIdx()) 1351 { 1352 numBits++; 1353 } 1354 if( !rpcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) 1355 { 1356 READ_CODE( numBits, uiCode,"num_inter_layer_ref_pics_minus1" ); 1357 rpcSlice->setActiveNumILRRefIdx(uiCode + 1); 1358 } 1359 else 1360 { 1361 rpcSlice->setActiveNumILRRefIdx(1); 1362 } 1363 for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 1364 { 1365 READ_CODE( numBits,uiCode,"inter_layer_pred_layer_idc[i]" ); 1366 rpcSlice->setInterLayerPredLayerIdc(uiCode,i); 1367 } 1368 } 1369 else 1370 { 1371 rpcSlice->setActiveNumILRRefIdx(1); 1372 rpcSlice->setInterLayerPredLayerIdc(0,0); 1373 } 1374 } 1375 } 1376 #else 1377 if( rpcSlice->getLayerId() > 0 ) 1378 { 1379 rpcSlice->setNumILRRefIdx( rpcSlice->getVPS()->getNumDirectRefLayers( rpcSlice->getLayerId() ) ); 1380 } 1381 #endif 1382 #endif 1383 1214 1384 if(sps->getUseSAO()) 1215 1385 { … … 1423 1593 if(!rpcSlice->getDeblockingFilterDisable()) 1424 1594 { 1425 READ_SVLC( iCode, "beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 1426 READ_SVLC( iCode, "tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 1595 READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 1596 assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && 1597 rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); 1598 READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 1599 assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && 1600 rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); 1427 1601 } 1428 1602 } … … 1456 1630 } 1457 1631 1458 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() )1459 {1460 1632 UInt *entryPointOffset = NULL; 1461 1633 UInt numEntryPointOffsets, offsetLenMinus1; 1462 1634 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 1635 { 1463 1636 READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); 1464 1637 if (numEntryPointOffsets>0) … … 1477 1650 #endif 1478 1651 } 1652 } 1653 else 1654 { 1655 rpcSlice->setNumEntryPointOffsets ( 0 ); 1656 } 1657 1658 if(pps->getSliceHeaderExtensionPresentFlag()) 1659 { 1660 READ_UVLC(uiCode,"slice_header_extension_length"); 1661 for(Int i=0; i<uiCode; i++) 1662 { 1663 UInt ignore; 1664 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 1665 } 1666 } 1667 m_pcBitstream->readByteAlignment(); 1668 1669 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 1670 { 1671 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 1672 Int curEntryPointOffset = 0; 1673 Int prevEntryPointOffset = 0; 1674 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 1675 { 1676 curEntryPointOffset += entryPointOffset[ idx ]; 1677 1678 Int emulationPreventionByteCount = 0; 1679 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 1680 { 1681 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 1682 m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) 1683 { 1684 emulationPreventionByteCount++; 1685 } 1686 } 1687 1688 entryPointOffset[ idx ] -= emulationPreventionByteCount; 1689 prevEntryPointOffset = curEntryPointOffset; 1690 } 1479 1691 1480 1692 if ( pps->getTilesEnabledFlag() ) … … 1512 1724 } 1513 1725 } 1514 else 1515 { 1516 rpcSlice->setNumEntryPointOffsets ( 0 ); 1517 } 1518 1519 if(pps->getSliceHeaderExtensionPresentFlag()) 1520 { 1521 READ_UVLC(uiCode,"slice_header_extension_length"); 1522 for(Int i=0; i<uiCode; i++) 1523 { 1524 UInt ignore; 1525 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 1526 } 1527 } 1528 m_pcBitstream->readByteAlignment(); 1726 1529 1727 return; 1530 1728 } … … 1771 1969 // ==================================================================================================================== 1772 1970 1773 1774 /** Parse PCM alignment zero bits.1775 * \returns Void1776 */1777 Void TDecCavlc::xReadPCMAlignZero( )1778 {1779 UInt uiNumberOfBits = m_pcBitstream->getNumBitsUntilByteAligned();1780 1781 if(uiNumberOfBits)1782 {1783 UInt uiBits;1784 UInt uiSymbol;1785 1786 for(uiBits = 0; uiBits < uiNumberOfBits; uiBits++)1787 {1788 xReadFlag( uiSymbol );1789 assert( uiSymbol == 0 );1790 }1791 }1792 }1793 1794 Void TDecCavlc::xReadUnaryMaxSymbol( UInt& ruiSymbol, UInt uiMaxSymbol )1795 {1796 if (uiMaxSymbol == 0)1797 {1798 ruiSymbol = 0;1799 return;1800 }1801 1802 xReadFlag( ruiSymbol );1803 1804 if (ruiSymbol == 0 || uiMaxSymbol == 1)1805 {1806 return;1807 }1808 1809 UInt uiSymbol = 0;1810 UInt uiCont;1811 1812 do1813 {1814 xReadFlag( uiCont );1815 uiSymbol++;1816 }1817 while( uiCont && (uiSymbol < uiMaxSymbol-1) );1818 1819 if( uiCont && (uiSymbol == uiMaxSymbol-1) )1820 {1821 uiSymbol++;1822 }1823 1824 ruiSymbol = uiSymbol;1825 }1826 1827 Void TDecCavlc::xReadExGolombLevel( UInt& ruiSymbol )1828 {1829 UInt uiSymbol ;1830 UInt uiCount = 0;1831 do1832 {1833 xReadFlag( uiSymbol );1834 uiCount++;1835 }1836 while( uiSymbol && (uiCount != 13));1837 1838 ruiSymbol = uiCount-1;1839 1840 if( uiSymbol )1841 {1842 xReadEpExGolomb( uiSymbol, 0 );1843 ruiSymbol += uiSymbol+1;1844 }1845 1846 return;1847 }1848 1849 Void TDecCavlc::xReadEpExGolomb( UInt& ruiSymbol, UInt uiCount )1850 {1851 UInt uiSymbol = 0;1852 UInt uiBit = 1;1853 1854 1855 while( uiBit )1856 {1857 xReadFlag( uiBit );1858 uiSymbol += uiBit << uiCount++;1859 }1860 1861 uiCount--;1862 while( uiCount-- )1863 {1864 xReadFlag( uiBit );1865 uiSymbol += uiBit << uiCount;1866 }1867 1868 ruiSymbol = uiSymbol;1869 1870 return;1871 }1872 1873 UInt TDecCavlc::xGetBit()1874 {1875 UInt ruiCode;1876 m_pcBitstream->read( 1, ruiCode );1877 return ruiCode;1878 }1879 1880 1881 1971 /** parse explicit wp tables 1882 1972 * \param TComSlice* pcSlice … … 1895 1985 // decode delta_luma_log2_weight_denom : 1896 1986 READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom 1987 assert( uiLog2WeightDenomLuma <= 7 ); 1897 1988 if( bChroma ) 1898 1989 { 1899 1990 READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom 1900 1991 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); 1992 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7); 1901 1993 uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); 1902 1994 } … … 1937 2029 Int iDeltaWeight; 1938 2030 READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" ); // se(v): delta_luma_weight_l0[i] 2031 assert( iDeltaWeight >= -128 ); 2032 assert( iDeltaWeight <= 127 ); 1939 2033 wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom)); 1940 2034 READ_SVLC( wp[0].iOffset, "luma_offset_lX" ); // se(v): luma_offset_l0[i] 2035 assert( wp[0].iOffset >= -128 ); 2036 assert( wp[0].iOffset <= 127 ); 1941 2037 } 1942 2038 else … … 1953 2049 Int iDeltaWeight; 1954 2050 READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" ); // se(v): chroma_weight_l0[i][j] 2051 assert( iDeltaWeight >= -128 ); 2052 assert( iDeltaWeight <= 127 ); 1955 2053 wp[j].iWeight = (iDeltaWeight + (1<<wp[1].uiLog2WeightDenom)); 1956 2054 1957 2055 Int iDeltaChroma; 1958 2056 READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" ); // se(v): delta_chroma_offset_l0[i][j] 2057 assert( iDeltaChroma >= -512 ); 2058 assert( iDeltaChroma <= 511 ); 1959 2059 Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); 1960 2060 wp[j].iOffset = Clip3(-128, 127, (iDeltaChroma + pred) ); -
trunk/source/Lib/TLibDecoder/TDecCAVLC.h
r125 r189 61 61 62 62 protected: 63 Void xReadEpExGolomb ( UInt& ruiSymbol, UInt uiCount );64 Void xReadExGolombLevel ( UInt& ruiSymbol );65 Void xReadUnaryMaxSymbol ( UInt& ruiSymbol, UInt uiMaxSymbol );66 67 Void xReadPCMAlignZero ();68 69 UInt xGetBit ();70 71 63 void parseShortTermRefPicSet (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx); 72 private:73 64 74 65 public: -
trunk/source/Lib/TLibDecoder/TDecCu.cpp
r125 r189 370 370 m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]); 371 371 #endif 372 372 373 373 // Coefficient decoding 374 374 Bool bCodeDQP = getdQPFlag(); -
trunk/source/Lib/TLibDecoder/TDecGop.cpp
r125 r189 247 247 for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++) 248 248 { 249 #if REF_IDX_FRAMEWORK && VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 250 if( pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->isILR( m_layerId ) ) 251 { 252 printf( "%d(%d) ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId() ); 253 } 254 else 255 #endif 249 256 printf ("%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)); 250 257 } -
trunk/source/Lib/TLibDecoder/TDecSlice.h
r125 r189 91 91 Void initCtxMem( UInt i ); 92 92 Void setCtxMem( TDecSbac* sb, Int b ) { CTXMem[b] = sb; } 93 Int getCtxMemSize( ) { return (Int)CTXMem.size(); } 93 94 #if SVC_EXTENSION 94 95 TDecTop* getLayerDec ( UInt LayerId ) { return m_ppcTDecTop[LayerId]; } -
trunk/source/Lib/TLibDecoder/TDecTop.cpp
r125 r189 113 113 if(m_cIlpPic[i]) 114 114 { 115 //m_cIlpPic[i]->setPicYuvRec(NULL);116 115 m_cIlpPic[i]->destroy(); 117 116 delete m_cIlpPic[i]; … … 143 142 if(m_layerId>0) 144 143 { 144 g_bitDepthY = pcSPS->getBitDepthY(); 145 g_bitDepthC = pcSPS->getBitDepthC(); 146 g_uiMaxCUWidth = pcSPS->getMaxCUWidth(); 147 g_uiMaxCUHeight = pcSPS->getMaxCUHeight(); 148 g_uiMaxCUDepth = pcSPS->getMaxCUDepth(); 149 g_uiAddCUDepth = max (0, pcSPS->getLog2MinCodingBlockSize() - (Int)pcSPS->getQuadtreeTULog2MinSize() ); 150 145 151 Int numReorderPics[MAX_TLAYER]; 146 152 Window &conformanceWindow = pcSPS->getConformanceWindow(); … … 154 160 if (m_cIlpPic[0] == NULL) 155 161 { 156 for (Int j=0; j<1/*MAX_NUM_REF*/; j++) 157 { 162 for (Int j=0; j< 1/*MAX_NUM_REF*/; j++) // to be set to NumDirectRefLayers[LayerIdInVps[nuh_layer_id]] 163 { 164 158 165 m_cIlpPic[j] = new TComPic; 159 //m_cIlpPic[j]->createWithOutYuv(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, &m_cSPS, true);160 166 #if SVC_UPSAMPLING 161 167 m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true); … … 176 182 if(m_cIlpPic[0]) 177 183 { 178 //m_cIlpPic[0]->setPicYuvRec(pcPic->getFullPelBaseRec());179 184 m_cIlpPic[0]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(), m_cIlpPic[0]->getPicYuvRec()); 180 185 m_cIlpPic[0]->getSlice(0)->setPOC(pcPic->getPOC()); 181 m_cIlpPic[0]->setLayerId( 0); //set reference layerId186 m_cIlpPic[0]->setLayerId(pcPic->getSlice(0)->getBaseColPic()->getLayerId()); //set reference layerId 182 187 m_cIlpPic[0]->getPicYuvRec()->setBorderExtension(false); 183 188 m_cIlpPic[0]->getPicYuvRec()->extendPicBorder(); … … 231 236 } 232 237 238 #if L0323_DPB 239 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 240 #else 233 241 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded 242 #endif 234 243 if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) 235 244 { … … 239 248 if(m_layerId > 0) 240 249 { 250 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 251 TDecTop *pcTDecTopBase = (TDecTop *)getRefLayerDec( m_layerId ); 252 #else 241 253 TDecTop *pcTDecTopBase = (TDecTop *)getLayerDec( m_layerId-1 ); 254 #endif 242 255 //TComPic* pcPic = *(pcTDecTopBase->getListPic()->begin()); 243 256 TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec(); … … 339 352 cFillSlice.setSPS( m_parameterSetManagerDecoder[m_layerId].getFirstSPS() ); 340 353 cFillSlice.setPPS( m_parameterSetManagerDecoder[m_layerId].getFirstPPS() ); 354 cFillSlice.setVPS( m_parameterSetManagerDecoder[m_layerId].getFirstVPS() ); 341 355 cFillSlice.initSlice( m_layerId ); 342 356 #else … … 350 364 cFillPic->getSlice(0)->setSPS( m_parameterSetManagerDecoder[m_layerId].getFirstSPS() ); 351 365 cFillPic->getSlice(0)->setPPS( m_parameterSetManagerDecoder[m_layerId].getFirstPPS() ); 366 cFillPic->getSlice(0)->setVPS( m_parameterSetManagerDecoder[m_layerId].getFirstVPS() ); 352 367 cFillPic->getSlice(0)->initSlice( m_layerId ); 353 368 #else … … 405 420 assert (sps != 0); 406 421 407 if( false == m_parameterSetManagerDecoder[m_layerId].activatePPS(m_apcSlicePilot->getPPSId(), m_apcSlicePilot-> getIdrPicFlag()) )422 if( false == m_parameterSetManagerDecoder[m_layerId].activatePPS(m_apcSlicePilot->getPPSId(), m_apcSlicePilot->isIRAP()) ) 408 423 #else 409 424 m_parameterSetManagerDecoder.applyPrefetchedPS(); … … 415 430 assert (sps != 0); 416 431 417 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot-> getIdrPicFlag()))432 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP())) 418 433 #endif 419 434 { … … 422 437 } 423 438 439 if( pps->getDependentSliceSegmentsEnabledFlag() ) 440 { 441 Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1; 442 443 if (m_cSliceDecoder.getCtxMemSize() != NumCtx) 444 { 445 m_cSliceDecoder.initCtxMem(NumCtx); 446 for ( UInt st = 0; st < NumCtx; st++ ) 447 { 448 TDecSbac* ctx = NULL; 449 ctx = new TDecSbac; 450 ctx->init( &m_cBinCABAC ); 451 m_cSliceDecoder.setCtxMem( ctx, st ); 452 } 453 } 454 } 455 424 456 m_apcSlicePilot->setPPS(pps); 425 457 m_apcSlicePilot->setSPS(sps); 458 426 459 pps->setSPS(sps); 427 460 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1); 428 461 pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) ); 429 462 430 for (Int i = 0; i < sps->getMaxCUDepth() - g_uiAddCUDepth; i++) 463 g_bitDepthY = sps->getBitDepthY(); 464 g_bitDepthC = sps->getBitDepthC(); 465 g_uiMaxCUWidth = sps->getMaxCUWidth(); 466 g_uiMaxCUHeight = sps->getMaxCUHeight(); 467 g_uiMaxCUDepth = sps->getMaxCUDepth(); 468 g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() ); 469 470 for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++) 431 471 { 432 472 sps->setAMPAcc( i, sps->getUseAMP() ); 433 473 } 434 474 435 for (Int i = sps->get MaxCUDepth() - g_uiAddCUDepth; i < sps->getMaxCUDepth(); i++)475 for (Int i = sps->getLog2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++) 436 476 { 437 477 sps->setAMPAcc( i, 0 ); … … 439 479 440 480 m_cSAO.destroy(); 441 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight);442 m_cLoopFilter. create( g_uiMaxCUDepth);481 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() ); 482 m_cLoopFilter.create( sps->getMaxCUDepth() ); 443 483 } 444 484 … … 451 491 TComPic*& pcPic = m_pcPic; 452 492 #if SVC_EXTENSION 493 m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder[m_layerId].getPrefetchedVPS(0) ); 453 494 m_apcSlicePilot->initSlice( nalu.m_layerId ); 454 495 #else … … 467 508 468 509 m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType); 469 if((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N) || 470 (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) || 471 (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N)) 472 { 473 m_apcSlicePilot->setTemporalLayerNonReferenceFlag(true); 474 } 510 Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || 511 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || 512 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || 513 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || 514 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N); 515 m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag); 516 475 517 m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS 476 518 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); … … 481 523 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder); 482 524 #endif 483 if (m_apcSlicePilot->isNextSlice()) 484 { 485 // Skip pictures due to random access 486 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) 487 { 488 return false; 489 } 490 // Skip TFD pictures associated with BLA/BLANT pictures 491 if (isSkipPictureForBLA(iPOCLastDisplay)) 492 { 493 return false; 494 } 495 } 525 526 // Skip pictures due to random access 527 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) 528 { 529 return false; 530 } 531 // Skip TFD pictures associated with BLA/BLANT pictures 532 if (isSkipPictureForBLA(iPOCLastDisplay)) 533 { 534 return false; 535 } 496 536 497 537 // exit when a new picture is found … … 506 546 } 507 547 #else 508 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence) 548 //we should only get a different poc for a new picture (with CTU address==0) 549 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (!m_apcSlicePilot->getSliceCurStartCUAddr()==0)) 550 { 551 printf ("Warning, the first slice of a picture might have been lost!\n"); 552 } 553 // exit when a new picture is found 554 if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence ) 509 555 { 510 556 if (m_prevPOC >= m_pocRandomAccess) … … 537 583 { 538 584 #if AVC_BASE 539 if( m_layerId == 1 ) 540 { 541 TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin()); 542 fstream* pFile = m_ppcTDecTop[0]->getBLReconFile(); 543 const Window &conf = pBLPic->getConformanceWindow(); 544 UInt uiWidth = pBLPic->getPicYuvRec()->getWidth() - conf.getWindowLeftOffset() - conf.getWindowRightOffset(); 545 UInt uiHeight = pBLPic->getPicYuvRec()->getHeight() - conf.getWindowTopOffset() - conf.getWindowBottomOffset(); 546 547 if( pFile->good() ) 548 { 549 UInt64 uiPos = (UInt64) m_apcSlicePilot->getPOC() * uiWidth * uiHeight * 3 / 2; 550 551 pFile->seekg((UInt)uiPos, ios::beg ); 552 553 Pel* pPel = pBLPic->getPicYuvRec()->getLumaAddr(); 554 UInt uiStride = pBLPic->getPicYuvRec()->getStride(); 555 for( Int i = 0; i < uiHeight; i++ ) 556 { 557 for( Int j = 0; j < uiWidth; j++ ) 585 if( m_layerId == 1 && m_parameterSetManagerDecoder[0].getPrefetchedVPS(0)->getAvcBaseLayerFlag() ) 586 { 587 TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin()); 588 fstream* pFile = m_ppcTDecTop[0]->getBLReconFile(); 589 #if ILP_DECODED_PICTURE 590 UInt uiWidth = pBLPic->getPicYuvRec()->getWidth(); 591 UInt uiHeight = pBLPic->getPicYuvRec()->getHeight(); 592 #else 593 const Window &conf = pBLPic->getConformanceWindow(); 594 UInt uiWidth = pBLPic->getPicYuvRec()->getWidth() - conf.getWindowLeftOffset() - conf.getWindowRightOffset(); 595 UInt uiHeight = pBLPic->getPicYuvRec()->getHeight() - conf.getWindowTopOffset() - conf.getWindowBottomOffset(); 596 #endif 597 598 if( pFile->good() ) 599 { 600 UInt64 uiPos = (UInt64) m_apcSlicePilot->getPOC() * uiWidth * uiHeight * 3 / 2; 601 602 pFile->seekg((UInt)uiPos, ios::beg ); 603 604 Pel* pPel = pBLPic->getPicYuvRec()->getLumaAddr(); 605 UInt uiStride = pBLPic->getPicYuvRec()->getStride(); 606 for( Int i = 0; i < uiHeight; i++ ) 558 607 { 559 pPel[j] = pFile->get(); 608 for( Int j = 0; j < uiWidth; j++ ) 609 { 610 pPel[j] = pFile->get(); 611 } 612 pPel += uiStride; 560 613 } 561 pPel += uiStride; 562 } 563 564 pPel = pBLPic->getPicYuvRec()->getCbAddr(); 565 uiStride = pBLPic->getPicYuvRec()->getCStride(); 566 for( Int i = 0; i < uiHeight/2; i++ ) 567 { 568 for( Int j = 0; j < uiWidth/2; j++ ) 614 615 pPel = pBLPic->getPicYuvRec()->getCbAddr(); 616 uiStride = pBLPic->getPicYuvRec()->getCStride(); 617 for( Int i = 0; i < uiHeight/2; i++ ) 569 618 { 570 pPel[j] = pFile->get(); 619 for( Int j = 0; j < uiWidth/2; j++ ) 620 { 621 pPel[j] = pFile->get(); 622 } 623 pPel += uiStride; 571 624 } 572 pPel += uiStride; 573 } 574 575 pPel = pBLPic->getPicYuvRec()->getCrAddr(); 576 uiStride = pBLPic->getPicYuvRec()->getCStride(); 577 for( Int i = 0; i < uiHeight/2; i++ ) 578 { 579 for( Int j = 0; j < uiWidth/2; j++ ) 625 626 pPel = pBLPic->getPicYuvRec()->getCrAddr(); 627 uiStride = pBLPic->getPicYuvRec()->getCStride(); 628 for( Int i = 0; i < uiHeight/2; i++ ) 580 629 { 581 pPel[j] = pFile->get(); 630 for( Int j = 0; j < uiWidth/2; j++ ) 631 { 632 pPel[j] = pFile->get(); 633 } 634 pPel += uiStride; 582 635 } 583 pPel += uiStride; 584 } 585 } 586 } 636 } 637 } 587 638 #endif 588 639 … … 732 783 if (bNextSlice) 733 784 { 734 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA );785 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic ); 735 786 // Set reference list 736 #if REF_ LIST_BUGFIX787 #if REF_IDX_FRAMEWORK 737 788 if (m_layerId == 0) 738 { 739 pcSlice->setRefPicList( m_cListPic ); 740 }789 #endif 790 #if FIX1071 791 pcSlice->setRefPicList( m_cListPic, true ); 741 792 #else 742 793 pcSlice->setRefPicList( m_cListPic ); … … 747 798 { 748 799 #if AVC_BASE 749 pcSlice->setBaseColPic ( *m_ppcTDecTop[0]->getListPic()->begin() ); 800 if( m_parameterSetManagerDecoder[0].getActiveVPS()->getAvcBaseLayerFlag() ) 801 { 802 pcSlice->setBaseColPic ( *m_ppcTDecTop[0]->getListPic()->begin() ); 750 803 #if AVC_SYNTAX 751 TComPic* pBLPic = pcSlice->getBaseColPic(); 752 if( pcSlice->getPOC() == 0 ) 753 { 754 // initialize partition order. 755 UInt* piTmp = &g_auiZscanToRaster[0]; 756 initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp ); 757 initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 ); 758 } 759 pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice ); 760 pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES ); 761 #endif 762 804 TComPic* pBLPic = pcSlice->getBaseColPic(); 805 if( pcSlice->getPOC() == 0 ) 806 { 807 // initialize partition order. 808 UInt* piTmp = &g_auiZscanToRaster[0]; 809 initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp ); 810 initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 ); 811 } 812 pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice ); 813 pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES ); 814 #endif 815 } 816 else 817 { 818 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 819 TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( m_layerId ); 820 #else 821 TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); 822 #endif 823 TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); 824 pcSlice->setBaseColPic ( *cListPic, m_layerId ); 825 } 826 #else 827 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 828 TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( m_layerId ); 763 829 #else 764 830 TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); 831 #endif 765 832 TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); 766 833 pcSlice->setBaseColPic ( *cListPic, m_layerId ); … … 769 836 if ( pcPic->isSpatialEnhLayer()) 770 837 { 838 #if SCALED_REF_LAYER_OFFSETS 839 m_cPrediction.upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() ); 840 #else 771 841 m_cPrediction.upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec() ); 842 #endif 772 843 } 773 844 else … … 778 849 #endif 779 850 } 780 #endif781 851 782 852 #if REF_IDX_FRAMEWORK … … 785 855 setILRPic(pcPic); 786 856 #if REF_IDX_MFM 787 pcSlice->setRefPOCListILP(m_ppcTDecTop[m_layerId]->m_cIlpPic, pcSlice->getBaseColPic()); 788 #endif 789 #if REF_LIST_BUGFIX 790 pcSlice->setRefPicListSvc( m_cListPic, m_cIlpPic); 791 #else 792 pcSlice->addRefPicList ( m_cIlpPic, 793 1, 794 ((pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA) && 795 (pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)) ? 0: -1); 796 #endif 797 } 798 #endif 857 if( pcSlice->getSPS()->getMFMEnabledFlag() ) 858 { 859 pcSlice->setRefPOCListILP(m_ppcTDecTop[m_layerId]->m_cIlpPic, pcSlice->getBaseColPic()); 860 } 861 #endif 862 pcSlice->setRefPicList( m_cListPic, false, m_cIlpPic); 863 } 864 #endif 865 866 #endif //SVC_EXTENSION 799 867 800 868 // For generalized B … … 839 907 //--------------- 840 908 pcSlice->setRefPOCList(); 909 #if !L0034_COMBINED_LIST_CLEANUP 841 910 pcSlice->setNoBackPredFlag( false ); 842 911 if ( pcSlice->getSliceType() == B_SLICE ) … … 855 924 } 856 925 } 926 #endif 857 927 } 858 928 … … 878 948 m_cTrQuant.setUseScalingList(false); 879 949 } 950 951 #if SIMPLIFIED_MV_POS_SCALING 952 if (m_layerId > 0) 953 { 954 #if SCALED_REF_LAYER_OFFSETS 955 const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(); 956 957 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth(); 958 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight(); 959 960 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 961 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 962 #else 963 const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow(); 964 const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow(); 965 966 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 967 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 968 969 Int widthEL = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 970 Int heightEL = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 971 #endif 972 g_mvScalingFactor[m_layerId][0] = Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); 973 g_mvScalingFactor[m_layerId][1] = Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL); 974 975 g_posScalingFactor[m_layerId][0] = ((widthBL << 16) + (widthEL >> 1)) / widthEL; 976 g_posScalingFactor[m_layerId][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL; 977 } 978 #endif 880 979 881 980 // Decode a picture … … 947 1046 { 948 1047 #if SVC_EXTENSION 949 if(nalUnitType == NAL_UNIT_S EI_SUFFIX)1048 if(nalUnitType == NAL_UNIT_SUFFIX_SEI) 950 1049 { 951 1050 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveSPS() ); … … 967 1066 } 968 1067 #else 969 if(nalUnitType == NAL_UNIT_S EI_SUFFIX)1068 if(nalUnitType == NAL_UNIT_SUFFIX_SEI) 970 1069 { 971 1070 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); … … 1003 1102 case NAL_UNIT_VPS: 1004 1103 xDecodeVPS(); 1104 #if AVC_BASE 1105 if( m_parameterSetManagerDecoder[0].getPrefetchedVPS(0)->getAvcBaseLayerFlag() ) 1106 { 1107 if( !m_ppcTDecTop[0]->getBLReconFile()->good() ) 1108 { 1109 printf( "Base layer YUV input reading error\n" ); 1110 exit(EXIT_FAILURE); 1111 } 1112 #if AVC_SYNTAX 1113 if( !m_ppcTDecTop[0]->getBLSyntaxFile()->good() ) 1114 { 1115 printf( "Base layer syntax input reading error\n" ); 1116 exit(EXIT_FAILURE); 1117 } 1118 #endif 1119 } 1120 else 1121 { 1122 TComList<TComPic*> *cListPic = m_ppcTDecTop[0]->getListPic(); 1123 cListPic->clear(); 1124 } 1125 #endif 1005 1126 return false; 1006 1127 … … 1008 1129 xDecodeSPS(); 1009 1130 #if AVC_BASE 1131 if( m_parameterSetManagerDecoder[0].getPrefetchedVPS(0)->getAvcBaseLayerFlag() ) 1010 1132 { 1011 1133 TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin()); … … 1019 1141 #if AVC_SYNTAX 1020 1142 1021 pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, sps, true);1022 #else 1023 pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true);1024 #endif 1025 #else 1026 pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, onformanceWindow, defaultDisplayWindow, numReorderPics, true);1143 pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, sps, true); 1144 #else 1145 pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true); 1146 #endif 1147 #else 1148 pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), onformanceWindow, defaultDisplayWindow, numReorderPics, true); 1027 1149 #endif 1028 1150 } … … 1035 1157 return false; 1036 1158 1037 case NAL_UNIT_ SEI:1038 case NAL_UNIT_S EI_SUFFIX:1159 case NAL_UNIT_PREFIX_SEI: 1160 case NAL_UNIT_SUFFIX_SEI: 1039 1161 xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType ); 1040 1162 return false; … … 1042 1164 case NAL_UNIT_CODED_SLICE_TRAIL_R: 1043 1165 case NAL_UNIT_CODED_SLICE_TRAIL_N: 1044 case NAL_UNIT_CODED_SLICE_TLA :1166 case NAL_UNIT_CODED_SLICE_TLA_R: 1045 1167 case NAL_UNIT_CODED_SLICE_TSA_N: 1046 1168 case NAL_UNIT_CODED_SLICE_STSA_R: 1047 1169 case NAL_UNIT_CODED_SLICE_STSA_N: 1048 case NAL_UNIT_CODED_SLICE_BLA :1049 case NAL_UNIT_CODED_SLICE_BLA NT:1170 case NAL_UNIT_CODED_SLICE_BLA_W_LP: 1171 case NAL_UNIT_CODED_SLICE_BLA_W_RADL: 1050 1172 case NAL_UNIT_CODED_SLICE_BLA_N_LP: 1051 case NAL_UNIT_CODED_SLICE_IDR :1173 case NAL_UNIT_CODED_SLICE_IDR_W_RADL: 1052 1174 case NAL_UNIT_CODED_SLICE_IDR_N_LP: 1053 1175 case NAL_UNIT_CODED_SLICE_CRA: 1054 1176 case NAL_UNIT_CODED_SLICE_RADL_N: 1055 case NAL_UNIT_CODED_SLICE_ DLP:1177 case NAL_UNIT_CODED_SLICE_RADL_R: 1056 1178 case NAL_UNIT_CODED_SLICE_RASL_N: 1057 case NAL_UNIT_CODED_SLICE_ TFD:1179 case NAL_UNIT_CODED_SLICE_RASL_R: 1058 1180 #if SVC_EXTENSION 1059 1181 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, curLayerId, bNewPOC); … … 1077 1199 Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay) 1078 1200 { 1079 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))1201 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)) 1080 1202 { 1081 1203 iPOCLastDisplay++; … … 1108 1230 { 1109 1231 if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA 1110 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1232 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1111 1233 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 1112 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT)1234 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ) 1113 1235 { 1114 1236 // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT. 1115 1237 m_pocRandomAccess = m_apcSlicePilot->getPOC(); 1116 1238 } 1117 else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )1239 else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 1118 1240 { 1119 1241 m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. … … 1131 1253 } 1132 1254 // skip the reordered pictures, if necessary 1133 else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_ TFD|| m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))1255 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)) 1134 1256 { 1135 1257 iPOCLastDisplay++; … … 1140 1262 } 1141 1263 1264 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 1265 TDecTop* TDecTop::getRefLayerDec( UInt layerId ) 1266 { 1267 TComVPS* vps = m_parameterSetManagerDecoder[0].getActiveVPS(); 1268 if( vps->getNumDirectRefLayers( m_layerId ) <= 0 ) 1269 { 1270 #if ZERO_NUM_DIRECT_LAYERS 1271 return (TDecTop *)getLayerDec( 0 ); 1272 #else 1273 return NULL; 1274 #endif 1275 } 1276 1277 // currently only one reference layer is supported 1278 assert( vps->getNumDirectRefLayers( m_layerId ) == 1 ); 1279 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1280 assert( vps->getMaxOneActiveRefLayerFlag() == 1 ); 1281 #endif 1282 1283 return (TDecTop *)getLayerDec( vps->getRefLayerId( m_layerId, 0 ) ); 1284 } 1285 #endif 1286 1142 1287 //! \} -
trunk/source/Lib/TLibDecoder/TDecTop.h
r125 r189 154 154 Void setNumLayer (UInt uiNum) { m_numLayer = uiNum; } 155 155 TComList<TComPic*>* getListPic() { return &m_cListPic; } 156 Void setLayerDec(TDecTop **p) { m_ppcTDecTop = p; } 157 TDecTop* getLayerDec(UInt layer) { return m_ppcTDecTop[layer]; } 156 Void setLayerDec(TDecTop **p) { m_ppcTDecTop = p; } 157 TDecTop* getLayerDec(UInt layer) { return m_ppcTDecTop[layer]; } 158 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 159 TDecTop* getRefLayerDec(UInt layerId); 160 #endif 158 161 #if AVC_BASE 159 162 Void setBLReconFile( fstream* pFile ) { m_pBLReconFile = pFile; }
Note: See TracChangeset for help on using the changeset viewer.