Changeset 446 in 3DVCSoftware for branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder
- Timestamp:
- 26 May 2013, 16:22:23 (11 years ago)
- Location:
- branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/AnnexBread.h
r324 r446 43 43 #include <vector> 44 44 45 #include " TLibCommon/TypeDef.h"45 #include "../TLibCommon/TypeDef.h" 46 46 47 47 //! \ingroup TLibDecoder -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/NALread.cpp
r438 r446 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); -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/NALread.h
r324 r446 39 39 #pragma once 40 40 41 #include " TLibCommon/TypeDef.h"42 #include " TLibCommon/TComBitStream.h"43 #include " TLibCommon/NAL.h"41 #include "../TLibCommon/TypeDef.h" 42 #include "../TLibCommon/TComBitStream.h" 43 #include "../TLibCommon/NAL.h" 44 44 45 45 //! \ingroup TLibDecoder -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/SEIread.cpp
r438 r446 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 { -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/SEIread.h
r438 r446 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 }; -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/SyntaxElementParser.h
r324 r446 43 43 #endif // _MSC_VER > 1000 44 44 45 #include " TLibCommon/TComRom.h"45 #include "../TLibCommon/TComRom.h" 46 46 47 47 #if ENC_DEC_TRACE -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r438 r446 68 68 TDecCavlc::TDecCavlc() 69 69 { 70 #if H_3D 71 m_aaiTempScale = new Int* [ MAX_NUM_LAYERS ]; 72 m_aaiTempOffset = new Int* [ MAX_NUM_LAYERS ]; 73 for( UInt uiVId = 0; uiVId < MAX_NUM_LAYERS; uiVId++ ) 74 { 75 m_aaiTempScale [ uiVId ] = new Int [ MAX_NUM_LAYERS ]; 76 m_aaiTempOffset [ uiVId ] = new Int [ MAX_NUM_LAYERS ]; 77 } 78 #endif 70 79 } 71 80 72 81 TDecCavlc::~TDecCavlc() 73 82 { 74 83 #if H_3D 84 for( UInt uiVId = 0; uiVId < MAX_NUM_LAYERS; uiVId++ ) 85 { 86 delete [] m_aaiTempScale [ uiVId ]; 87 delete [] m_aaiTempOffset [ uiVId ]; 88 } 89 delete [] m_aaiTempScale; 90 delete [] m_aaiTempOffset; 91 #endif 75 92 } 76 93 … … 173 190 rps->printDeltaPOC(); 174 191 #endif 175 }176 177 /** copy SAO parameter178 * \param dst179 * \param src180 */181 inline Void copySaoOneLcuParam(SaoLcuParam* dst, SaoLcuParam* src)182 {183 Int i;184 dst->partIdx = src->partIdx;185 dst->typeIdx = src->typeIdx;186 if (dst->typeIdx != -1)187 {188 dst->subTypeIdx = src->subTypeIdx ;189 dst->length = src->length;190 for (i=0;i<dst->length;i++)191 {192 dst->offset[i] = src->offset[i];193 }194 }195 else196 {197 dst->length = 0;198 for (i=0;i<SAO_BO_LEN;i++)199 {200 dst->offset[i] = 0;201 }202 }203 192 } 204 193 … … 400 389 401 390 READ_FLAG( uiCode, "field_seq_flag"); pcVUI->setFieldSeqFlag(uiCode); 402 assert(pcVUI->getFieldSeqFlag() == false); // not supported yet403 391 404 392 READ_FLAG(uiCode, "frame_field_info_present_flag"); pcVUI->setFrameFieldInfoPresentFlag(uiCode); … … 554 542 } 555 543 544 #if H_3D 545 Void TDecCavlc::parseSPS(TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) 546 #else 556 547 Void TDecCavlc::parseSPS(TComSPS* pcSPS) 548 #endif 557 549 { 558 550 #if ENC_DEC_TRACE … … 593 585 594 586 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 595 g_bitDepthY = 8 + uiCode; 596 pcSPS->setBitDepthY(g_bitDepthY); 587 pcSPS->setBitDepthY( uiCode + 8 ); 597 588 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 598 589 599 590 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 600 g_bitDepthC = 8 + uiCode; 601 pcSPS->setBitDepthC(g_bitDepthC); 591 pcSPS->setBitDepthC( uiCode + 8 ); 602 592 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 603 593 … … 608 598 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 609 599 { 600 #if L0323_DPB 601 #if H_MV 602 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]"); 603 #else 604 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1"); 605 #endif 606 pcSPS->setMaxDecPicBuffering( uiCode + 1, i); 607 #else 610 608 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering"); 611 609 pcSPS->setMaxDecPicBuffering( uiCode, i); 610 #endif 611 #if H_MV 612 READ_UVLC ( uiCode, "sps_num_reorder_pics[i]" ); 613 #else 612 614 READ_UVLC ( uiCode, "sps_num_reorder_pics" ); 615 #endif 613 616 pcSPS->setNumReorderPics(uiCode, i); 617 #if H_MV 618 READ_UVLC ( uiCode, "sps_max_latency_increase[i]"); 619 #else 614 620 READ_UVLC ( uiCode, "sps_max_latency_increase"); 621 #endif 615 622 pcSPS->setMaxLatencyIncrease( uiCode, i ); 616 623 … … 628 635 629 636 READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" ); 630 UInt log2MinCUSize = uiCode + 3; 637 Int log2MinCUSize = uiCode + 3; 638 pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); 631 639 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); 640 pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); 641 Int maxCUDepthDelta = uiCode; 642 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 643 pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 635 644 READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); 636 645 … … 640 649 READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" ); pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 ); 641 650 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 ); 651 652 Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() ); 653 pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth ); 654 652 655 READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); 653 656 if(pcSPS->getScalingListFlag()) … … 710 713 if (uiCode) 711 714 { 715 #if !H_MV 712 716 while ( xMoreRbspData() ) 713 717 { 714 718 READ_FLAG( uiCode, "sps_extension_data_flag"); 715 719 } 720 #else 721 READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" ); pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false); 722 READ_FLAG( uiCode, "sps_extension2_flag"); 723 if ( uiCode ) 724 { 725 #if !H_3D 726 while ( xMoreRbspData() ) 727 { 728 READ_FLAG( uiCode, "sps_extension_data_flag"); 729 } 730 #else 731 UInt uiCamParPrecision = 0; 732 Bool bCamParSlice = false; 733 if ( !depthFlag ) 734 { 735 READ_UVLC( uiCamParPrecision, "cp_precision" ); 736 READ_FLAG( uiCode, "cp_in_slice_header_flag" ); bCamParSlice = ( uiCode == 1 ); 737 if( !bCamParSlice ) 738 { 739 for( UInt uiBaseIndex = 0; uiBaseIndex < viewIndex; uiBaseIndex++ ) 740 { 741 Int iCode; 742 READ_SVLC( iCode, "cp_scale" ); m_aaiTempScale [ uiBaseIndex ][ viewIndex ] = iCode; 743 READ_SVLC( iCode, "cp_off" ); m_aaiTempOffset [ uiBaseIndex ][ viewIndex ] = iCode; 744 READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale [ viewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ viewIndex ]; 745 READ_SVLC( iCode, "cp_inv_off_plus_off" ); m_aaiTempOffset [ viewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ viewIndex ]; 746 } 747 } 748 } 749 pcSPS->initCamParaSPS( viewIndex, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset ); 750 READ_FLAG( uiCode, "sps_extension3_flag"); 751 if ( uiCode ) 752 { 753 while ( xMoreRbspData() ) 754 { 755 READ_FLAG( uiCode, "sps_extension_data_flag"); 756 } 757 } 758 #endif // !H_3D 759 } 760 #endif // !H_MV 716 761 } 717 762 } … … 744 789 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 745 790 { 791 #if L0323_DPB 792 READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); 793 #else 746 794 READ_UVLC( uiCode, "vps_max_dec_pic_buffering[i]" ); pcVPS->setMaxDecPicBuffering( uiCode, i ); 795 #endif 747 796 READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 748 797 READ_UVLC( uiCode, "vps_max_latency_increase[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); … … 839 888 840 889 // parse layer_id_in_nuh[i] and derive LayerIdInVps 841 pcVPS->setLayerIdInNuh( 0, 0 ); pcVPS->setLayerIdInVps( 0, 0 ); 842 843 for( Int layer = 1; layer <= pcVPS->getMaxLayers() - 1; layer++ ) 890 // already updated to JCT3V-D0220 891 for( Int layer = 0; layer <= pcVPS->getMaxLayers() - 1; layer++ ) 844 892 { 845 893 UInt layerIdInNuh; 846 if ( pcVPS->getVpsNuhLayerIdPresentFlag() )894 if ( pcVPS->getVpsNuhLayerIdPresentFlag() && ( layer != 0 ) ) 847 895 { 848 896 READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" ); layerIdInNuh = uiCode; … … 922 970 #endif 923 971 } 924 972 973 #if H_3D 974 pcVPS->initViewIndex(); 975 #endif 976 925 977 return; 926 978 } … … 956 1008 vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId()); 957 1009 assert(vps!=0); 958 rpcSlice->setVPS(vps); 1010 rpcSlice->setVPS(vps); 1011 rpcSlice->setViewId ( vps->getViewId ( rpcSlice->getLayerIdInVps() ) ); 1012 #if H_3D 1013 rpcSlice->setViewIndex( vps->getViewIndex( rpcSlice->getLayerIdInVps() ) ); 1014 rpcSlice->setIsDepth ( vps->getDepthId ( rpcSlice->getLayerIdInVps() ) == 1 ); 1015 #endif 959 1016 #endif 960 1017 rpcSlice->setSPS(sps); … … 1052 1109 iPOCmsb = iPrevPOCmsb; 1053 1110 } 1054 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1055 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT1111 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1112 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1056 1113 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1057 1114 { … … 1062 1119 1063 1120 TComReferencePictureSet* rps; 1121 rps = rpcSlice->getLocalRPS(); 1122 rpcSlice->setRPS(rps); 1064 1123 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 1065 1124 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 1066 1125 { 1067 rps = rpcSlice->getLocalRPS();1068 1126 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 1069 rpcSlice->setRPS(rps);1070 1127 } 1071 1128 else // use reference to short-term reference picture set in PPS … … 1084 1141 uiCode = 0; 1085 1142 } 1086 rpcSlice->setRPS(sps->getRPSList()->getReferencePictureSet(uiCode)); 1087 1088 rps = rpcSlice->getRPS(); 1143 memcpy(rps,sps->getRPSList()->getReferencePictureSet(uiCode),sizeof(TComReferencePictureSet)); 1089 1144 } 1090 1145 if(sps->getLongTermRefsPresent()) … … 1109 1164 rps->setNumberOfLongtermPictures(numOfLtrp); 1110 1165 Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); 1111 Int prev LSB = 0, prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;;1166 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; 1112 1167 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 1113 1168 { … … 1136 1191 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 1137 1192 Bool deltaFlag = false; 1138 // First LTRP || First LTRP from SH || curr LSB != prev LSB1139 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) || (pocLsbLt != prevLSB))1193 // First LTRP || First LTRP from SH 1194 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 1140 1195 { 1141 1196 deltaFlag = true; … … 1162 1217 rps->setCheckLTMSBPresent(j,false); 1163 1218 } 1164 prevLSB = pocLsbLt;1165 1219 prevDeltaMSB = deltaPocMSBCycleLT; 1166 1220 } … … 1168 1222 rps->setNumberOfPictures(offset); 1169 1223 } 1170 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1171 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT1224 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1225 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1172 1226 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1173 1227 { … … 1243 1297 1244 1298 if(refPicListModification->getRefPicListModificationFlagL0()) 1245 { 1299 { 1246 1300 uiCode = 0; 1247 1301 Int i = 0; … … 1401 1455 if(!rpcSlice->getDeblockingFilterDisable()) 1402 1456 { 1403 READ_SVLC( iCode, "beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 1404 READ_SVLC( iCode, "tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 1457 READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 1458 assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && 1459 rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); 1460 READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 1461 assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && 1462 rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); 1405 1463 } 1406 1464 } … … 1434 1492 } 1435 1493 1436 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() )1437 {1438 1494 UInt *entryPointOffset = NULL; 1439 1495 UInt numEntryPointOffsets, offsetLenMinus1; 1440 1496 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 1497 { 1441 1498 READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); 1442 1499 if (numEntryPointOffsets>0) … … 1455 1512 #endif 1456 1513 } 1514 } 1515 else 1516 { 1517 rpcSlice->setNumEntryPointOffsets ( 0 ); 1518 } 1519 1520 if(pps->getSliceHeaderExtensionPresentFlag()) 1521 { 1522 READ_UVLC(uiCode,"slice_header_extension_length"); 1523 #if H_3D 1524 if( rpcSlice->getSPS()->hasCamParInSliceHeader() ) 1525 { 1526 UInt uiViewIndex = rpcSlice->getViewIndex(); 1527 for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ ) 1528 { 1529 READ_SVLC( iCode, "cp_scale" ); m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ] = iCode; 1530 READ_SVLC( iCode, "cp_off" ); m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ] = iCode; 1531 READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale [ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ]; 1532 READ_SVLC( iCode, "cp_inv_off_plus_off" ); m_aaiTempOffset[ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ]; 1533 } 1534 rpcSlice->setCamparaSlice( m_aaiTempScale, m_aaiTempOffset ); 1535 } 1536 1537 READ_FLAG(uiCode,"slice_segment_header_extension2_flag"); 1538 if ( uiCode ) 1539 { 1540 READ_UVLC(uiCode,"slice_header_extension2_length"); 1541 for(Int i=0; i<uiCode; i++) 1542 { 1543 UInt ignore; 1544 READ_CODE(8,ignore,"slice_header_extension2_data_byte"); 1545 } 1546 } 1547 } 1548 #else 1549 for(Int i=0; i<uiCode; i++) 1550 { 1551 UInt ignore; 1552 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 1553 } 1554 } 1555 #endif 1556 m_pcBitstream->readByteAlignment(); 1557 1558 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 1559 { 1560 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 1561 Int curEntryPointOffset = 0; 1562 Int prevEntryPointOffset = 0; 1563 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 1564 { 1565 curEntryPointOffset += entryPointOffset[ idx ]; 1566 1567 Int emulationPreventionByteCount = 0; 1568 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 1569 { 1570 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 1571 m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) 1572 { 1573 emulationPreventionByteCount++; 1574 } 1575 } 1576 1577 entryPointOffset[ idx ] -= emulationPreventionByteCount; 1578 prevEntryPointOffset = curEntryPointOffset; 1579 } 1457 1580 1458 1581 if ( pps->getTilesEnabledFlag() ) … … 1490 1613 } 1491 1614 } 1492 else 1493 { 1494 rpcSlice->setNumEntryPointOffsets ( 0 ); 1495 } 1496 1497 if(pps->getSliceHeaderExtensionPresentFlag()) 1498 { 1499 READ_UVLC(uiCode,"slice_header_extension_length"); 1500 for(Int i=0; i<uiCode; i++) 1501 { 1502 UInt ignore; 1503 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 1504 } 1505 } 1506 m_pcBitstream->readByteAlignment(); 1615 1507 1616 return; 1508 1617 } … … 1755 1864 // ==================================================================================================================== 1756 1865 1757 1758 /** Parse PCM alignment zero bits.1759 * \returns Void1760 */1761 Void TDecCavlc::xReadPCMAlignZero( )1762 {1763 UInt uiNumberOfBits = m_pcBitstream->getNumBitsUntilByteAligned();1764 1765 if(uiNumberOfBits)1766 {1767 UInt uiBits;1768 UInt uiSymbol;1769 1770 for(uiBits = 0; uiBits < uiNumberOfBits; uiBits++)1771 {1772 xReadFlag( uiSymbol );1773 assert( uiSymbol == 0 );1774 }1775 }1776 }1777 1778 Void TDecCavlc::xReadUnaryMaxSymbol( UInt& ruiSymbol, UInt uiMaxSymbol )1779 {1780 if (uiMaxSymbol == 0)1781 {1782 ruiSymbol = 0;1783 return;1784 }1785 1786 xReadFlag( ruiSymbol );1787 1788 if (ruiSymbol == 0 || uiMaxSymbol == 1)1789 {1790 return;1791 }1792 1793 UInt uiSymbol = 0;1794 UInt uiCont;1795 1796 do1797 {1798 xReadFlag( uiCont );1799 uiSymbol++;1800 }1801 while( uiCont && (uiSymbol < uiMaxSymbol-1) );1802 1803 if( uiCont && (uiSymbol == uiMaxSymbol-1) )1804 {1805 uiSymbol++;1806 }1807 1808 ruiSymbol = uiSymbol;1809 }1810 1811 Void TDecCavlc::xReadExGolombLevel( UInt& ruiSymbol )1812 {1813 UInt uiSymbol ;1814 UInt uiCount = 0;1815 do1816 {1817 xReadFlag( uiSymbol );1818 uiCount++;1819 }1820 while( uiSymbol && (uiCount != 13));1821 1822 ruiSymbol = uiCount-1;1823 1824 if( uiSymbol )1825 {1826 xReadEpExGolomb( uiSymbol, 0 );1827 ruiSymbol += uiSymbol+1;1828 }1829 1830 return;1831 }1832 1833 Void TDecCavlc::xReadEpExGolomb( UInt& ruiSymbol, UInt uiCount )1834 {1835 UInt uiSymbol = 0;1836 UInt uiBit = 1;1837 1838 1839 while( uiBit )1840 {1841 xReadFlag( uiBit );1842 uiSymbol += uiBit << uiCount++;1843 }1844 1845 uiCount--;1846 while( uiCount-- )1847 {1848 xReadFlag( uiBit );1849 uiSymbol += uiBit << uiCount;1850 }1851 1852 ruiSymbol = uiSymbol;1853 1854 return;1855 }1856 1857 UInt TDecCavlc::xGetBit()1858 {1859 UInt ruiCode;1860 m_pcBitstream->read( 1, ruiCode );1861 return ruiCode;1862 }1863 1864 1865 1866 /** parse explicit wp tables 1866 1867 * \param TComSlice* pcSlice … … 1879 1880 // decode delta_luma_log2_weight_denom : 1880 1881 READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom 1882 assert( uiLog2WeightDenomLuma <= 7 ); 1881 1883 if( bChroma ) 1882 1884 { 1883 1885 READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom 1884 1886 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); 1887 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7); 1885 1888 uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); 1886 1889 } … … 1921 1924 Int iDeltaWeight; 1922 1925 READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" ); // se(v): delta_luma_weight_l0[i] 1926 assert( iDeltaWeight >= -128 ); 1927 assert( iDeltaWeight <= 127 ); 1923 1928 wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom)); 1924 1929 READ_SVLC( wp[0].iOffset, "luma_offset_lX" ); // se(v): luma_offset_l0[i] 1930 assert( wp[0].iOffset >= -128 ); 1931 assert( wp[0].iOffset <= 127 ); 1925 1932 } 1926 1933 else … … 1937 1944 Int iDeltaWeight; 1938 1945 READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" ); // se(v): chroma_weight_l0[i][j] 1946 assert( iDeltaWeight >= -128 ); 1947 assert( iDeltaWeight <= 127 ); 1939 1948 wp[j].iWeight = (iDeltaWeight + (1<<wp[1].uiLog2WeightDenom)); 1940 1949 1941 1950 Int iDeltaChroma; 1942 1951 READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" ); // se(v): delta_chroma_offset_l0[i][j] 1952 assert( iDeltaChroma >= -512 ); 1953 assert( iDeltaChroma <= 511 ); 1943 1954 Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); 1944 1955 wp[j].iOffset = Clip3(-128, 127, (iDeltaChroma + pred) ); -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecCAVLC.h
r438 r446 61 61 62 62 protected: 63 Void xReadEpExGolomb ( UInt& ruiSymbol, UInt uiCount ); 64 Void xReadExGolombLevel ( UInt& ruiSymbol ); 65 Void xReadUnaryMaxSymbol ( UInt& ruiSymbol, UInt uiMaxSymbol ); 63 void parseShortTermRefPicSet (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx); 66 64 67 Void xReadPCMAlignZero (); 68 69 UInt xGetBit (); 70 71 void parseShortTermRefPicSet (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx); 72 private: 73 65 #if H_3D 66 Int** m_aaiTempScale; 67 Int** m_aaiTempOffset; 68 #endif 74 69 public: 75 70 … … 81 76 Void parseQtRootCbf ( UInt uiAbsPartIdx, UInt& uiQtRootCbf ); 82 77 Void parseVPS ( TComVPS* pcVPS ); 78 #if H_3D 79 Void parseSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ); 80 #else 83 81 Void parseSPS ( TComSPS* pcSPS ); 82 #endif 84 83 Void parsePPS ( TComPPS* pcPPS); 85 84 Void parseVUI ( TComVUI* pcVUI, TComSPS* pcSPS ); -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecEntropy.h
r324 r446 39 39 #define __TDECENTROPY__ 40 40 41 #include " TLibCommon/CommonDef.h"42 #include " TLibCommon/TComBitStream.h"43 #include " TLibCommon/TComSlice.h"44 #include " TLibCommon/TComPic.h"45 #include " TLibCommon/TComPrediction.h"46 #include " TLibCommon/TComSampleAdaptiveOffset.h"41 #include "../TLibCommon/CommonDef.h" 42 #include "../TLibCommon/TComBitStream.h" 43 #include "../TLibCommon/TComSlice.h" 44 #include "../TLibCommon/TComPic.h" 45 #include "../TLibCommon/TComPrediction.h" 46 #include "../TLibCommon/TComSampleAdaptiveOffset.h" 47 47 48 48 class TDecSbac; … … 66 66 67 67 virtual Void parseVPS ( TComVPS* pcVPS ) = 0; 68 #if H_3D 69 virtual Void parseSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) = 0; 70 #else 68 71 virtual Void parseSPS ( TComSPS* pcSPS ) = 0; 72 #endif 69 73 virtual Void parsePPS ( TComPPS* pcPPS ) = 0; 70 74 … … 129 133 Void resetEntropy ( TComSlice* p) { m_pcEntropyDecoderIf->resetEntropy(p); } 130 134 Void decodeVPS ( TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parseVPS(pcVPS); } 135 #if H_3D 136 Void decodeSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) { m_pcEntropyDecoderIf->parseSPS(pcSPS, viewIndex, depthFlag ); } 137 #else 131 138 Void decodeSPS ( TComSPS* pcSPS ) { m_pcEntropyDecoderIf->parseSPS(pcSPS); } 139 #endif 132 140 Void decodePPS ( TComPPS* pcPPS ) { m_pcEntropyDecoderIf->parsePPS(pcPPS); } 133 141 Void decodeSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager) { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager); } -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecGop.cpp
r438 r446 208 208 rpcPic->compressMotion(); 209 209 #endif 210 211 210 Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); 212 211 if (!pcSlice->isReferenced()) c += 32; 213 212 214 213 //-- For time output for each slice 215 216 214 #if H_MV 217 215 printf("\nLayer %2d POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getLayerId(), -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecSbac.h
r324 r446 76 76 Void setBitstream ( TComInputBitstream* p ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); } 77 77 Void parseVPS ( TComVPS* /*pcVPS*/ ) {} 78 #if H_3D 79 Void parseSPS ( TComSPS* /*pcSPS*/ , Int /*viewIndex*/, Bool /*depthFlag*/ ) {} 80 #else 78 81 Void parseSPS ( TComSPS* /*pcSPS*/ ) {} 82 #endif 79 83 Void parsePPS ( TComPPS* /*pcPPS*/ ) {} 80 84 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecSlice.h
r438 r446 84 84 Void initCtxMem( UInt i ); 85 85 Void setCtxMem( TDecSbac* sb, Int b ) { CTXMem[b] = sb; } 86 Int getCtxMemSize( ) { return (Int)CTXMem.size(); } 86 87 }; 87 88 -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecTop.cpp
r438 r446 42 42 ParameterSetManagerDecoder TDecTop::m_parameterSetManagerDecoder; 43 43 #endif 44 45 44 //! \ingroup TLibDecoder 46 45 //! \{ 47 46 47 #if H_3D 48 CamParsCollector::CamParsCollector() 49 : m_bInitialized( false ) 50 { 51 m_aaiCodedOffset = new Int* [ MAX_NUM_LAYERS ]; 52 m_aaiCodedScale = new Int* [ MAX_NUM_LAYERS ]; 53 m_aiViewId = new Int [ MAX_NUM_LAYERS ]; 54 m_aiLayerIdx = new Int [ MAX_NUM_LAYERS ]; 55 56 m_bViewReceived = new Bool [ MAX_NUM_LAYERS ]; 57 for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ ) 58 { 59 m_aaiCodedOffset [ uiId ] = new Int [ MAX_NUM_LAYERS ]; 60 m_aaiCodedScale [ uiId ] = new Int [ MAX_NUM_LAYERS ]; 61 } 62 63 xCreateLUTs( (UInt)MAX_NUM_LAYERS, (UInt)MAX_NUM_LAYERS, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 64 m_iLog2Precision = LOG2_DISP_PREC_LUT; 65 m_uiBitDepthForLUT = 8; // fixed 66 } 67 68 CamParsCollector::~CamParsCollector() 69 { 70 for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ ) 71 { 72 delete [] m_aaiCodedOffset [ uiId ]; 73 delete [] m_aaiCodedScale [ uiId ]; 74 } 75 delete [] m_aaiCodedOffset; 76 delete [] m_aaiCodedScale; 77 delete [] m_aiViewId; 78 delete [] m_bViewReceived; 79 80 xDeleteArray( m_adBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 ); 81 xDeleteArray( m_aiBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 ); 82 } 83 84 Void 85 CamParsCollector::init( FILE* pCodedScaleOffsetFile ) 86 { 87 m_bInitialized = true; 88 m_pCodedScaleOffsetFile = pCodedScaleOffsetFile; 89 m_uiCamParsCodedPrecision = 0; 90 m_bCamParsVaryOverTime = false; 91 m_iLastViewIndex = -1; 92 m_iLastPOC = -1; 93 m_uiMaxViewIndex = 0; 94 } 95 96 Void 97 CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT) 98 { 99 100 uiNumberSourceViews = std::max( (UInt) 1, uiNumberSourceViews ); 101 uiNumberTargetViews = std::max( (UInt) 1, uiNumberTargetViews ); 102 103 radLUT = new Double***[ uiNumberSourceViews ]; 104 raiLUT = new Int ***[ uiNumberSourceViews ]; 105 106 for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ ) 107 { 108 radLUT [ uiSourceView ] = new Double**[ uiNumberTargetViews ]; 109 raiLUT [ uiSourceView ] = new Int **[ uiNumberTargetViews ]; 110 111 for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ ) 112 { 113 radLUT [ uiSourceView ][ uiTargetView ] = new Double*[ 2 ]; 114 radLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ]; 115 radLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ]; 116 117 raiLUT [ uiSourceView ][ uiTargetView ] = new Int* [ 2 ]; 118 raiLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Int [ 257 ]; 119 raiLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Int [ 257 ]; 120 } 121 } 122 } 123 124 Void 125 CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT) 126 { 127 Int iLog2DivLuma = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision; AOF( iLog2DivLuma > 0 ); 128 Int iLog2DivChroma = iLog2DivLuma + 1; 129 130 iOffset <<= m_uiBitDepthForLUT; 131 132 Double dScale = (Double) iScale / (( Double ) ( 1 << iLog2DivLuma )); 133 Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma )); 134 135 // offsets including rounding offsets 136 Int64 iOffsetLuma = iOffset + ( ( 1 << iLog2DivLuma ) >> 1 ); 137 Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 ); 138 139 140 for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ ) 141 { 142 143 // real-valued look-up tables 144 Double dShiftLuma = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision ); 145 Double dShiftChroma = dShiftLuma / 2; 146 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma; 147 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma; 148 149 // integer-valued look-up tables 150 Int64 iTempScale = (Int64)uiDepthValue * iScale; 151 Int64 iShiftLuma = ( iTempScale + iOffsetLuma ) >> iLog2DivLuma; 152 Int64 iShiftChroma = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma; 153 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma; 154 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma; 155 } 156 157 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; 158 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; 159 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; 160 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; 161 } 162 163 Void 164 CamParsCollector::uninit() 165 { 166 m_bInitialized = false; 167 } 168 169 Void 170 CamParsCollector::setSlice( TComSlice* pcSlice ) 171 { 172 173 if( pcSlice == 0 ) 174 { 175 AOF( xIsComplete() ); 176 if( m_bCamParsVaryOverTime || m_iLastPOC == 0 ) 177 { 178 xOutput( m_iLastPOC ); 179 } 180 return; 181 } 182 183 if ( pcSlice->getIsDepth()) 184 { 185 return; 186 } 187 188 Bool bFirstAU = ( pcSlice->getPOC() == 0 ); 189 Bool bFirstSliceInAU = ( pcSlice->getPOC() != Int ( m_iLastPOC ) ); 190 Bool bFirstSliceInView = ( pcSlice->getViewIndex() != UInt( m_iLastViewIndex ) || bFirstSliceInAU ); 191 192 AOT( bFirstSliceInAU && pcSlice->getViewIndex() != 0 ); 193 AOT( !bFirstSliceInAU && pcSlice->getViewIndex() < UInt( m_iLastViewIndex ) ); 194 195 AOT( !bFirstSliceInAU && pcSlice->getViewIndex() > UInt( m_iLastViewIndex + 1 ) ); 196 197 AOT( !bFirstAU && pcSlice->getViewIndex() > m_uiMaxViewIndex ); 198 199 if ( !bFirstSliceInView ) 200 { 201 if( m_bCamParsVaryOverTime ) // check consistency of slice parameters here 202 { 203 UInt uiViewIndex = pcSlice->getViewIndex(); 204 for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < uiViewIndex; uiBaseViewIndex++ ) 205 { 206 AOF( m_aaiCodedScale [ uiBaseViewIndex ][ uiViewIndex ] == pcSlice->getCodedScale () [ uiBaseViewIndex ] ); 207 AOF( m_aaiCodedOffset[ uiBaseViewIndex ][ uiViewIndex ] == pcSlice->getCodedOffset () [ uiBaseViewIndex ] ); 208 AOF( m_aaiCodedScale [ uiViewIndex ][ uiBaseViewIndex ] == pcSlice->getInvCodedScale () [ uiBaseViewIndex ] ); 209 AOF( m_aaiCodedOffset[ uiViewIndex ][ uiBaseViewIndex ] == pcSlice->getInvCodedOffset() [ uiBaseViewIndex ] ); 210 } 211 } 212 return; 213 } 214 215 if( bFirstSliceInAU ) 216 { 217 if( !bFirstAU ) 218 { 219 AOF( xIsComplete() ); 220 xOutput( m_iLastPOC ); 221 } 222 ::memset( m_bViewReceived, false, MAX_NUM_LAYERS * sizeof( Bool ) ); 223 } 224 225 UInt uiViewIndex = pcSlice->getViewIndex(); 226 m_bViewReceived[ uiViewIndex ] = true; 227 if( bFirstAU ) 228 { 229 m_uiMaxViewIndex = std::max( m_uiMaxViewIndex, uiViewIndex ); 230 m_aiViewId[ uiViewIndex ] = pcSlice->getViewId(); 231 if( uiViewIndex == 1 ) 232 { 233 m_uiCamParsCodedPrecision = pcSlice->getSPS()->getCamParPrecision (); 234 m_bCamParsVaryOverTime = pcSlice->getSPS()->hasCamParInSliceHeader (); 235 } 236 else if( uiViewIndex > 1 ) 237 { 238 AOF( m_uiCamParsCodedPrecision == pcSlice->getSPS()->getCamParPrecision () ); 239 AOF( m_bCamParsVaryOverTime == pcSlice->getSPS()->hasCamParInSliceHeader () ); 240 } 241 for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ ) 242 { 243 if( m_bCamParsVaryOverTime ) 244 { 245 m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedScale () [ uiBaseIndex ]; 246 m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedOffset () [ uiBaseIndex ]; 247 m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedScale () [ uiBaseIndex ]; 248 m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedOffset() [ uiBaseIndex ]; 249 xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); 250 xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); 251 } 252 else 253 { 254 m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ] = pcSlice->getSPS()->getCodedScale () [ uiBaseIndex ]; 255 m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ] = pcSlice->getSPS()->getCodedOffset () [ uiBaseIndex ]; 256 m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ] = pcSlice->getSPS()->getInvCodedScale () [ uiBaseIndex ]; 257 m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ] = pcSlice->getSPS()->getInvCodedOffset() [ uiBaseIndex ]; 258 xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 259 xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 260 } 261 } 262 } 263 else 264 { 265 AOF( m_aiViewId[ uiViewIndex ] == pcSlice->getViewId() ); 266 if( m_bCamParsVaryOverTime ) 267 { 268 for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ ) 269 { 270 m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedScale () [ uiBaseIndex ]; 271 m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedOffset () [ uiBaseIndex ]; 272 m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedScale () [ uiBaseIndex ]; 273 m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedOffset() [ uiBaseIndex ]; 274 275 xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 276 xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 277 } 278 } 279 } 280 281 m_iLastViewIndex = (Int)pcSlice->getViewIndex(); 282 m_iLastPOC = (Int)pcSlice->getPOC(); 283 } 284 285 Bool 286 CamParsCollector::xIsComplete() 287 { 288 for( UInt uiView = 0; uiView <= m_uiMaxViewIndex; uiView++ ) 289 { 290 if( m_bViewReceived[ uiView ] == 0 ) 291 { 292 return false; 293 } 294 } 295 return true; 296 } 297 298 Void 299 CamParsCollector::xOutput( Int iPOC ) 300 { 301 if( m_pCodedScaleOffsetFile ) 302 { 303 if( iPOC == 0 ) 304 { 305 fprintf( m_pCodedScaleOffsetFile, "# ViewIndex ViewId\n" ); 306 fprintf( m_pCodedScaleOffsetFile, "#----------- ------------\n" ); 307 for( UInt uiViewIndex = 0; uiViewIndex <= m_uiMaxViewIndex; uiViewIndex++ ) 308 { 309 fprintf( m_pCodedScaleOffsetFile, "%12d %12d\n", uiViewIndex, m_aiViewId[ uiViewIndex ] ); 310 } 311 fprintf( m_pCodedScaleOffsetFile, "\n\n"); 312 fprintf( m_pCodedScaleOffsetFile, "# StartFrame EndFrame TargetView BaseView CodedScale CodedOffset Precision\n" ); 313 fprintf( m_pCodedScaleOffsetFile, "#----------- ------------ ------------ ------------ ------------ ------------ ------------\n" ); 314 } 315 if( iPOC == 0 || m_bCamParsVaryOverTime ) 316 { 317 Int iS = iPOC; 318 Int iE = ( m_bCamParsVaryOverTime ? iPOC : ~( 1 << 31 ) ); 319 for( UInt uiViewIndex = 0; uiViewIndex <= m_uiMaxViewIndex; uiViewIndex++ ) 320 { 321 for( UInt uiBaseIndex = 0; uiBaseIndex <= m_uiMaxViewIndex; uiBaseIndex++ ) 322 { 323 if( uiViewIndex != uiBaseIndex ) 324 { 325 fprintf( m_pCodedScaleOffsetFile, "%12d %12d %12d %12d %12d %12d %12d\n", 326 iS, iE, uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_uiCamParsCodedPrecision ); 327 } 328 } 329 } 330 } 331 } 332 } 333 #endif 48 334 TDecTop::TDecTop() 49 335 { … … 51 337 m_iMaxRefPicNum = 0; 52 338 #if ENC_DEC_TRACE 339 #if H_MV 340 if ( g_hTrace == NULL ) 341 { 342 #endif 53 343 g_hTrace = fopen( "TraceDec.txt", "wb" ); 54 344 g_bJustDoIt = g_bEncDecTraceDisable; 55 345 g_nSymbolCounter = 0; 346 #if H_MV 347 } 348 #endif 56 349 #endif 57 350 m_pocCRA = 0; … … 65 358 m_viewId = 0; 66 359 #if H_3D 360 m_viewIndex = 0; 67 361 m_isDepth = false; 362 m_pcCamParsCollector = 0; 68 363 #endif 69 364 #endif … … 94 389 } 95 390 96 97 391 Void TDecTop::init() 98 392 { … … 101 395 initROM(); 102 396 #endif 103 104 397 m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO); 105 398 m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder ); … … 149 442 } 150 443 444 #if L0323_DPB 445 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 446 #else 151 447 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded 448 #endif 152 449 if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) 153 450 { … … 219 516 rpcListPic = &m_cListPic; 220 517 m_cCuDecoder.destroy(); 221 222 518 #if H_MV 223 519 TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer ); 224 520 TComSlice::markIvRefPicsAsUnused ( m_ivPicLists, targetDecLayerIdSet, m_parameterSetManagerDecoder.getActiveVPS(), m_layerId, poc ); 225 521 #endif 226 227 522 m_bFirstSliceInPicture = true; 228 523 … … 290 585 assert (sps != 0); 291 586 292 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot-> getIdrPicFlag()))587 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP())) 293 588 { 294 589 printf ("Parameter set activation failed!"); … … 296 591 } 297 592 593 if( pps->getDependentSliceSegmentsEnabledFlag() ) 594 { 595 Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1; 596 597 if (m_cSliceDecoder.getCtxMemSize() != NumCtx) 598 { 599 m_cSliceDecoder.initCtxMem(NumCtx); 600 for ( UInt st = 0; st < NumCtx; st++ ) 601 { 602 TDecSbac* ctx = NULL; 603 ctx = new TDecSbac; 604 ctx->init( &m_cBinCABAC ); 605 m_cSliceDecoder.setCtxMem( ctx, st ); 606 } 607 } 608 } 609 298 610 m_apcSlicePilot->setPPS(pps); 299 611 m_apcSlicePilot->setSPS(sps); 300 301 612 #if H_MV 302 613 m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getActiveVPS() ); 303 614 #endif 304 305 615 pps->setSPS(sps); 306 616 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1); 307 617 pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) ); 308 618 309 for (Int i = 0; i < sps->getMaxCUDepth() - g_uiAddCUDepth; i++) 619 g_bitDepthY = sps->getBitDepthY(); 620 g_bitDepthC = sps->getBitDepthC(); 621 g_uiMaxCUWidth = sps->getMaxCUWidth(); 622 g_uiMaxCUHeight = sps->getMaxCUHeight(); 623 g_uiMaxCUDepth = sps->getMaxCUDepth(); 624 g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() ); 625 626 for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++) 310 627 { 311 628 sps->setAMPAcc( i, sps->getUseAMP() ); 312 629 } 313 630 314 for (Int i = sps->get MaxCUDepth() - g_uiAddCUDepth; i < sps->getMaxCUDepth(); i++)631 for (Int i = sps->getLog2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++) 315 632 { 316 633 sps->setAMPAcc( i, 0 ); … … 318 635 319 636 m_cSAO.destroy(); 320 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight);321 m_cLoopFilter. create( g_uiMaxCUDepth);637 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() ); 638 m_cLoopFilter.create( sps->getMaxCUDepth() ); 322 639 } 323 640 … … 345 662 346 663 m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType); 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 } 664 Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || 665 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || 666 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || 667 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || 668 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N); 669 m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag); 670 353 671 m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS 354 672 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); … … 357 675 m_apcSlicePilot->setLayerId( nalu.m_layerId ); 358 676 #endif 359 360 677 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder); 361 678 362 679 #if H_MV 363 680 TComVPS* vps = m_apcSlicePilot->getVPS(); 364 Int layerIdInVps = vps->getLayerIdInVps( nalu.m_layerId ); 365 366 setViewId( vps->getViewId( layerIdInVps ) ); 367 m_apcSlicePilot->setViewId( getViewId() ); 681 Int layerIdInVps = vps->getLayerIdInVps( nalu.m_layerId ); 682 setViewId ( vps->getViewId ( layerIdInVps ) ); 368 683 #if H_3D 369 setIsDepth( vps->getDepthId( layerIdInVps ) == 1 ); 370 m_apcSlicePilot->setIsDepth( getIsDepth() ); 371 #endif 372 #endif 373 374 if (m_apcSlicePilot->isNextSlice()) 375 { 684 setViewIndex( vps->getViewIndex( layerIdInVps ) ); 685 setIsDepth ( vps->getDepthId ( layerIdInVps ) == 1 ); 686 m_ivPicLists->setVPS( vps ); 687 #endif 688 #endif 376 689 // Skip pictures due to random access 377 690 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) … … 384 697 return false; 385 698 } 386 } 387 699 700 //we should only get a different poc for a new picture (with CTU address==0) 701 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (!m_apcSlicePilot->getSliceCurStartCUAddr()==0)) 702 { 703 printf ("Warning, the first slice of a picture might have been lost!\n"); 704 } 388 705 // exit when a new picture is found 389 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence)706 if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence ) 390 707 { 391 708 if (m_prevPOC >= m_pocRandomAccess) … … 396 713 m_prevPOC = m_apcSlicePilot->getPOC(); 397 714 } 398 399 715 #if H_MV 400 716 if ( newLayerFlag ) … … 403 719 } 404 720 #endif 405 406 407 721 // actual decoding starts here 408 722 xActivateParameterSets(); … … 419 733 xCreateLostPicture(lostPoc-1); 420 734 } 421 422 735 if (m_bFirstSliceInPicture) 423 736 { … … 425 738 m_cPrediction.initTempBuff(); 426 739 m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); 427 428 740 #if H_MV 429 741 m_apcSlicePilot->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer ); 430 742 #endif 431 432 433 743 // Get a new picture buffer 434 744 xGetNewPicBuffer (m_apcSlicePilot, pcPic); … … 566 876 pcPic->setViewId ( getViewId() ); 567 877 #if H_3D 568 pcPic->set IsDepth( getIsDepth() );569 #endif 570 #endif 571 878 pcPic->setViewIndex( getViewIndex() ); 879 pcPic->setIsDepth ( getIsDepth () ); 880 #endif 881 #endif 572 882 if (bNextSlice) 573 883 { 574 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA );884 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic ); 575 885 // Set reference list 576 577 886 #if H_MV 578 pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer ); 887 pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer, true ); 888 #else 889 #if FIX1071 890 pcSlice->setRefPicList( m_cListPic, true ); 579 891 #else 580 892 pcSlice->setRefPicList( m_cListPic ); 581 893 #endif 582 894 895 #endif 583 896 // For generalized B 584 897 // note: maybe not existed case (always L0 is copied to L1 if L1 is empty) … … 622 935 //--------------- 623 936 pcSlice->setRefPOCList(); 937 #if !L0034_COMBINED_LIST_CLEANUP 624 938 pcSlice->setNoBackPredFlag( false ); 625 939 if ( pcSlice->getSliceType() == B_SLICE ) … … 638 952 } 639 953 } 954 #endif 640 955 } 641 956 … … 664 979 // Decode a picture 665 980 m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic); 666 981 #if H_3D 982 if( m_pcCamParsCollector ) 983 { 984 m_pcCamParsCollector->setSlice( pcSlice ); 985 } 986 #endif 667 987 m_bFirstSliceInPicture = false; 668 988 m_uiSliceIdx++; … … 682 1002 { 683 1003 TComSPS* sps = new TComSPS(); 1004 #if H_3D 1005 // Preliminary fix. assuming that all sps refer to the same SPS. 1006 // Parsing dependency should be resolved! 1007 TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); 1008 assert( vps != 0 ); 1009 Int layerIdInVPS = vps->getLayerIdInVps( m_layerId ); 1010 m_cEntropyDecoder.decodeSPS( sps, vps->getViewIndex( layerIdInVPS ), ( vps->getDepthId( layerIdInVPS ) == 1 ) ); 1011 #else 684 1012 m_cEntropyDecoder.decodeSPS( sps ); 1013 #endif 685 1014 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); 686 1015 } … … 691 1020 m_cEntropyDecoder.decodePPS( pps ); 692 1021 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 }706 1022 } 707 1023 708 1024 Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ) 709 1025 { 710 if(nalUnitType == NAL_UNIT_S EI_SUFFIX)1026 if(nalUnitType == NAL_UNIT_SUFFIX_SEI) 711 1027 { 712 1028 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); … … 753 1069 return false; 754 1070 755 case NAL_UNIT_ SEI:756 case NAL_UNIT_S EI_SUFFIX:1071 case NAL_UNIT_PREFIX_SEI: 1072 case NAL_UNIT_SUFFIX_SEI: 757 1073 xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType ); 758 1074 return false; … … 760 1076 case NAL_UNIT_CODED_SLICE_TRAIL_R: 761 1077 case NAL_UNIT_CODED_SLICE_TRAIL_N: 762 case NAL_UNIT_CODED_SLICE_TLA :1078 case NAL_UNIT_CODED_SLICE_TLA_R: 763 1079 case NAL_UNIT_CODED_SLICE_TSA_N: 764 1080 case NAL_UNIT_CODED_SLICE_STSA_R: 765 1081 case NAL_UNIT_CODED_SLICE_STSA_N: 766 case NAL_UNIT_CODED_SLICE_BLA :767 case NAL_UNIT_CODED_SLICE_BLA NT:1082 case NAL_UNIT_CODED_SLICE_BLA_W_LP: 1083 case NAL_UNIT_CODED_SLICE_BLA_W_RADL: 768 1084 case NAL_UNIT_CODED_SLICE_BLA_N_LP: 769 case NAL_UNIT_CODED_SLICE_IDR :1085 case NAL_UNIT_CODED_SLICE_IDR_W_RADL: 770 1086 case NAL_UNIT_CODED_SLICE_IDR_N_LP: 771 1087 case NAL_UNIT_CODED_SLICE_CRA: 772 1088 case NAL_UNIT_CODED_SLICE_RADL_N: 773 case NAL_UNIT_CODED_SLICE_ DLP:1089 case NAL_UNIT_CODED_SLICE_RADL_R: 774 1090 case NAL_UNIT_CODED_SLICE_RASL_N: 775 case NAL_UNIT_CODED_SLICE_ TFD:1091 case NAL_UNIT_CODED_SLICE_RASL_R: 776 1092 #if H_MV 777 1093 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag); … … 795 1111 Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay) 796 1112 { 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))1113 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)) 798 1114 { 799 1115 iPOCLastDisplay++; … … 826 1142 { 827 1143 if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA 828 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1144 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 829 1145 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 830 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT)1146 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ) 831 1147 { 832 1148 // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT. 833 1149 m_pocRandomAccess = m_apcSlicePilot->getPOC(); 834 1150 } 835 else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )1151 else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 836 1152 { 837 1153 m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. … … 849 1165 } 850 1166 // skip the reordered pictures, if necessary 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))1167 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)) 852 1168 { 853 1169 iPOCLastDisplay++; … … 881 1197 882 1198 #endif 883 884 1199 //! \} -
branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecTop.h
r438 r446 64 64 class TAppDecTop; 65 65 #endif 66 66 #if H_3D 67 class CamParsCollector 68 { 69 public: 70 CamParsCollector (); 71 ~CamParsCollector (); 72 73 Void init ( FILE* pCodedScaleOffsetFile ); 74 Void uninit (); 75 Void setSlice ( TComSlice* pcSlice ); 76 77 Bool isInitialized() const { return m_bInitialized; } 78 Int**** getBaseViewShiftLUTI() { return m_aiBaseViewShiftLUT; } 79 80 private: 81 Bool xIsComplete (); 82 Void xOutput ( Int iPOC ); 83 84 private: 85 Bool m_bInitialized; 86 FILE* m_pCodedScaleOffsetFile; 87 88 Int** m_aaiCodedOffset; 89 Int** m_aaiCodedScale; 90 Int* m_aiViewId; 91 Int* m_aiLayerIdx; 92 93 Bool* m_bViewReceived; 94 UInt m_uiCamParsCodedPrecision; 95 Bool m_bCamParsVaryOverTime; 96 Int m_iLastViewIndex; 97 Int m_iLastPOC; 98 UInt m_uiMaxViewIndex; 99 100 101 UInt m_uiBitDepthForLUT; 102 UInt m_iLog2Precision; 103 UInt m_uiInputBitDepth; 104 105 // look-up tables 106 Double**** m_adBaseViewShiftLUT; ///< Disparity LUT 107 Int**** m_aiBaseViewShiftLUT; ///< Disparity LUT 108 Void xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT); 109 Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT); 110 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 ); 111 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize1, UInt uiSize2 ); 112 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize ); 113 114 }; 115 116 template <class T> 117 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 ) 118 { 119 if( rpt ) 120 { 121 for( UInt uiK = 0; uiK < uiSize1; uiK++ ) 122 { 123 for( UInt uiL = 0; uiL < uiSize2; uiL++ ) 124 { 125 for( UInt uiM = 0; uiM < uiSize3; uiM++ ) 126 { 127 delete[] rpt[ uiK ][ uiL ][ uiM ]; 128 } 129 delete[] rpt[ uiK ][ uiL ]; 130 } 131 delete[] rpt[ uiK ]; 132 } 133 delete[] rpt; 134 } 135 rpt = NULL; 136 }; 137 138 139 template <class T> 140 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2 ) 141 { 142 if( rpt ) 143 { 144 for( UInt uiK = 0; uiK < uiSize1; uiK++ ) 145 { 146 for( UInt uiL = 0; uiL < uiSize2; uiL++ ) 147 { 148 delete[] rpt[ uiK ][ uiL ]; 149 } 150 delete[] rpt[ uiK ]; 151 } 152 delete[] rpt; 153 } 154 rpt = NULL; 155 }; 156 157 158 template <class T> 159 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize ) 160 { 161 if( rpt ) 162 { 163 for( UInt uiK = 0; uiK < uiSize; uiK++ ) 164 { 165 delete[] rpt[ uiK ]; 166 } 167 delete[] rpt; 168 } 169 rpt = NULL; 170 }; 171 172 #endif //H_3D 67 173 /// decoder class 68 174 class TDecTop … … 81 187 ParameterSetManagerDecoder m_parameterSetManagerDecoder; // storage for parameter sets 82 188 #endif 83 84 189 TComSlice* m_apcSlicePilot; 85 190 … … 114 219 std::vector<TComPic*> m_refPicSetInterLayer; 115 220 #if H_3D 221 Int m_viewIndex; 116 222 Bool m_isDepth; 223 CamParsCollector* m_pcCamParsCollector; 117 224 #endif 118 225 #endif … … 142 249 #endif 143 250 144 145 251 #if H_MV 146 252 TComPic* getPic ( Int poc ); … … 154 260 Int getViewId () { return m_viewId; } 155 261 #if H_3D 262 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 263 Int getViewIndex () { return m_viewIndex; } 156 264 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } 157 265 Bool getIsDepth () { return m_isDepth; } 158 #endif 159 #endif 160 266 Void setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; } 267 #endif 268 #endif 161 269 protected: 162 270 Void xGetNewPicBuffer (TComSlice* pcSlice, TComPic*& rpcPic);
Note: See TracChangeset for help on using the changeset viewer.