Changeset 537 in 3DVCSoftware for branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCAVLC.cpp
- Timestamp:
- 13 Jul 2013, 15:51:26 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCAVLC.cpp
r536 r537 224 224 Int iCode; 225 225 226 READ_UVLC( uiCode, "pps_pic_parameter_set_id"); pcPPS->setPPSId (uiCode); 227 READ_UVLC( uiCode, "pps_seq_parameter_set_id"); pcPPS->setSPSId (uiCode); 226 READ_UVLC( uiCode, "pps_pic_parameter_set_id"); 227 assert(uiCode <= 63); 228 pcPPS->setPPSId (uiCode); 229 230 READ_UVLC( uiCode, "pps_seq_parameter_set_id"); 231 assert(uiCode <= 15); 232 pcPPS->setSPSId (uiCode); 233 228 234 READ_FLAG( uiCode, "dependent_slice_segments_enabled_flag" ); pcPPS->setDependentSliceSegmentsEnabledFlag ( uiCode == 1 ); 229 #if L0255_MOVE_PPS_FLAGS230 235 READ_FLAG( uiCode, "output_flag_present_flag" ); pcPPS->setOutputFlagPresentFlag( uiCode==1 ); 231 236 232 237 READ_CODE(3, uiCode, "num_extra_slice_header_bits"); pcPPS->setNumExtraSliceHeaderBits(uiCode); 233 #endif234 238 READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode ); 235 239 236 240 READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false ); 237 241 238 #if L0323_LIMIT_DEFAULT_LIST_SIZE239 242 READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1"); 240 243 assert(uiCode <= 14); … … 244 247 assert(uiCode <= 14); 245 248 pcPPS->setNumRefIdxL1DefaultActive(uiCode+1); 246 #else247 READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1"); pcPPS->setNumRefIdxL0DefaultActive(uiCode+1);248 READ_UVLC(uiCode, "num_ref_idx_l1_default_active_minus1"); pcPPS->setNumRefIdxL1DefaultActive(uiCode+1);249 #endif250 249 251 250 READ_SVLC(iCode, "init_qp_minus26" ); pcPPS->setPicInitQPMinus26(iCode); … … 282 281 pcPPS->setWPBiPred( uiCode==1 ); 283 282 284 #if !L0255_MOVE_PPS_FLAGS285 READ_FLAG( uiCode, "output_flag_present_flag" );286 pcPPS->setOutputFlagPresentFlag( uiCode==1 );287 #endif288 283 READ_FLAG( uiCode, "transquant_bypass_enable_flag"); 289 284 pcPPS->setTransquantBypassEnableFlag(uiCode ? true : false); … … 347 342 pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode); 348 343 349 #if !L0255_MOVE_PPS_FLAGS350 READ_CODE(3, uiCode, "num_extra_slice_header_bits");351 pcPPS->setNumExtraSliceHeaderBits(uiCode);352 #endif353 344 READ_FLAG( uiCode, "slice_segment_header_extension_present_flag"); 354 345 pcPPS->setSliceHeaderExtensionPresentFlag(uiCode); … … 424 415 READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); 425 416 } 426 #if L0043_TIMING_INFO427 417 TimingInfo *timingInfo = pcVUI->getTimingInfo(); 428 418 READ_FLAG( uiCode, "vui_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); … … 436 426 READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 437 427 } 438 #endif439 428 READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); 440 429 if( pcVUI->getHrdParametersPresentFlag() ) … … 442 431 parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); 443 432 } 444 #if L0043_TIMING_INFO 445 } 446 #endif 447 #if !L0043_TIMING_INFO 448 READ_FLAG( uiCode, "poc_proportional_to_timing_flag" ); pcVUI->setPocProportionalToTimingFlag(uiCode ? true : false); 449 if( pcVUI->getPocProportionalToTimingFlag() && pcVUI->getHrdParameters()->getTimingInfoPresentFlag() ) 450 { 451 READ_UVLC( uiCode, "num_ticks_poc_diff_one_minus1" ); pcVUI->setNumTicksPocDiffOneMinus1(uiCode); 452 } 453 #endif 433 } 454 434 READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode); 455 435 if (pcVUI->getBitstreamRestrictionFlag()) … … 464 444 READ_FLAG( uiCode, "motion_vectors_over_pic_boundaries_flag"); pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode); 465 445 READ_FLAG( uiCode, "restricted_ref_pic_lists_flag"); pcVUI->setRestrictedRefPicListsFlag(uiCode); 466 #if L0043_MSS_IDC467 446 READ_UVLC( uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode); 468 447 assert(uiCode < 4096); 469 #else470 READ_CODE( 8, uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode);471 #endif472 448 READ_UVLC( uiCode, "max_bytes_per_pic_denom" ); pcVUI->setMaxBytesPerPicDenom(uiCode); 473 449 READ_UVLC( uiCode, "max_bits_per_mincu_denom" ); pcVUI->setMaxBitsPerMinCuDenom(uiCode); … … 482 458 if( commonInfPresentFlag ) 483 459 { 484 #if !L0043_TIMING_INFO485 READ_FLAG( uiCode, "timing_info_present_flag" ); hrd->setTimingInfoPresentFlag( uiCode == 1 ? true : false );486 if( hrd->getTimingInfoPresentFlag() )487 {488 READ_CODE( 32, uiCode, "num_units_in_tick" ); hrd->setNumUnitsInTick( uiCode );489 READ_CODE( 32, uiCode, "time_scale" ); hrd->setTimeScale( uiCode );490 }491 #endif492 460 READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false ); 493 461 READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false ); … … 500 468 READ_CODE( 5, uiCode, "du_cpb_removal_delay_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode ); 501 469 READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false ); 502 #if L0044_DU_DPB_OUTPUT_DELAY_HRD503 470 READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1" ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode ); 504 #endif505 471 } 506 472 READ_CODE( 4, uiCode, "bit_rate_scale" ); hrd->setBitRateScale( uiCode ); … … 527 493 hrd->setFixedPicRateWithinCvsFlag( i, true ); 528 494 } 529 #if L0372530 495 hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present 531 496 hrd->setCpbCntMinus1 ( i, 0 ); // Infered to be 0 when not present 532 #endif533 497 if( hrd->getFixedPicRateWithinCvsFlag( i ) ) 534 498 { 535 499 READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" ); hrd->setPicDurationInTcMinus1( i, uiCode ); 536 500 } 537 #if L0372538 501 else 539 502 { … … 544 507 READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); 545 508 } 546 #else547 READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false );548 READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode );549 #endif550 509 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 551 510 { … … 559 518 if( hrd->getSubPicCpbParamsPresentFlag() ) 560 519 { 561 #if L0363_DU_BIT_RATE 520 READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); 562 521 READ_UVLC( uiCode, "bit_rate_du_value_minus1" ); hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode ); 563 #endif564 READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );565 522 } 566 523 READ_FLAG( uiCode, "cbr_flag" ); hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false ); … … 588 545 #endif 589 546 READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); 547 assert(uiCode <= 6); 548 590 549 READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); 591 550 if ( pcSPS->getMaxTLayers() == 1 ) … … 594 553 assert( uiCode == 1 ); 595 554 } 555 596 556 parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); 597 557 #if H_MV … … 599 559 #endif 600 560 READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); 561 assert(uiCode <= 15); 562 601 563 READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( uiCode ); 564 assert(uiCode <= 3); 602 565 // in the first version we only support chroma_format_idc equal to 1 (4:2:0), so separate_colour_plane_flag cannot appear in the bitstream 603 566 assert (uiCode == 1); … … 620 583 621 584 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 585 assert(uiCode <= 6); 622 586 pcSPS->setBitDepthY( uiCode + 8 ); 623 587 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 624 588 625 589 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 590 assert(uiCode <= 6); 626 591 pcSPS->setBitDepthC( uiCode + 8 ); 627 592 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 628 593 629 594 READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); 595 assert(uiCode <= 12); 630 596 631 597 UInt subLayerOrderingInfoPresentFlag; 632 598 READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); 599 633 600 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 634 601 { 635 #if L0323_DPB636 602 #if H_MV 637 603 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]"); … … 640 606 #endif 641 607 pcSPS->setMaxDecPicBuffering( uiCode + 1, i); 642 #else643 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering");644 pcSPS->setMaxDecPicBuffering( uiCode, i);645 #endif646 608 #if H_MV 647 609 READ_UVLC ( uiCode, "sps_num_reorder_pics[i]" ); … … 711 673 712 674 READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); 675 assert(uiCode <= 64); 713 676 pcSPS->createRPSList(uiCode); 714 677 … … 838 801 #endif 839 802 parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1); 840 #if SIGNAL_BITRATE_PICRATE_IN_VPS841 parseBitratePicRateInfo( pcVPS->getBitratePicrateInfo(), 0, pcVPS->getMaxTLayers() - 1);842 #endif843 803 UInt subLayerOrderingInfoPresentFlag; 844 804 READ_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag"); 845 805 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 846 806 { 847 #if L0323_DPB848 807 READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); 849 #else850 READ_UVLC( uiCode, "vps_max_dec_pic_buffering[i]" ); pcVPS->setMaxDecPicBuffering( uiCode, i );851 #endif852 808 READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 853 READ_UVLC( uiCode, "vps_max_latency_increase [i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i );809 READ_UVLC( uiCode, "vps_max_latency_increase_plus1[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); 854 810 855 811 if (!subLayerOrderingInfoPresentFlag) … … 887 843 } 888 844 } 889 #if L0043_TIMING_INFO890 845 TimingInfo *timingInfo = pcVPS->getTimingInfo(); 891 846 READ_FLAG( uiCode, "vps_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); … … 899 854 READ_UVLC( uiCode, "vps_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 900 855 } 901 #endif902 856 READ_UVLC( uiCode, "vps_num_hrd_parameters" ); pcVPS->setNumHrdParameters( uiCode ); 903 857 … … 915 869 parseHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); 916 870 } 917 #if L0043_TIMING_INFO 918 } 919 #endif 871 } 920 872 READ_FLAG( uiCode, "vps_extension_flag" ); 921 873 if (uiCode) … … 1311 1263 uiCode = 0; 1312 1264 } 1313 memcpy(rps,sps->getRPSList()->getReferencePictureSet(uiCode),sizeof(TComReferencePictureSet));1265 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); 1314 1266 } 1315 1267 if(sps->getLongTermRefsPresent()) … … 1736 1688 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 1737 1689 { 1738 #if L0116_ENTRY_POINT1739 1690 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); 1740 1691 entryPointOffset[ idx ] = uiCode + 1; 1741 #else1742 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset");1743 entryPointOffset[ idx ] = uiCode;1744 #endif1745 1692 } 1746 1693 } … … 1791 1738 { 1792 1739 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 1740 1741 // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header 1742 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 1743 { 1744 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation ) 1745 { 1746 endOfSliceHeaderLocation++; 1747 } 1748 } 1749 1793 1750 Int curEntryPointOffset = 0; 1794 1751 Int prevEntryPointOffset = 0; … … 1858 1815 READ_CODE( 8, uiCode, "general_level_idc" ); rpcPTL->getGeneralPTL()->setLevelIdc(uiCode); 1859 1816 1860 #if L0363_BYTE_ALIGN1861 1817 for (Int i = 0; i < maxNumSubLayersMinus1; i++) 1862 1818 { … … 1882 1838 } 1883 1839 } 1884 #endif1885 1840 1886 1841 for(Int i = 0; i < maxNumSubLayersMinus1; i++) 1887 1842 { 1888 #if !L0363_BYTE_ALIGN1889 if(profilePresentFlag)1890 {1891 READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode);1892 }1893 READ_FLAG( uiCode, "sub_layer_level_present_flag[i]" ); rpcPTL->setSubLayerLevelPresentFlag (i, uiCode);1894 #endif1895 1843 if( profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) ) 1896 1844 { … … 1914 1862 READ_FLAG( uiCode, "XXX_profile_compatibility_flag[][j]"); ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0); 1915 1863 } 1916 #if L0046_CONSTRAINT_FLAGS1917 1864 READ_FLAG(uiCode, "general_progressive_source_flag"); 1918 1865 ptl->setProgressiveSourceFlag(uiCode ? true : false); … … 1930 1877 READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[16..31]"); 1931 1878 READ_CODE(12, uiCode, "XXX_reserved_zero_44bits[32..43]"); 1932 #elif L0363_MORE_BITS 1933 READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[0..15]"); 1934 READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[16..31]"); 1935 READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[32..47]"); 1936 #else 1937 READ_CODE(16, uiCode, "XXX_reserved_zero_16bits[]"); assert( uiCode == 0 ); 1938 #endif 1939 } 1940 #if SIGNAL_BITRATE_PICRATE_IN_VPS 1941 Void TDecCavlc::parseBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh) 1942 { 1943 UInt uiCode; 1944 for(Int i = tempLevelLow; i <= tempLevelHigh; i++) 1945 { 1946 READ_FLAG( uiCode, "bit_rate_info_present_flag[i]" ); info->setBitRateInfoPresentFlag(i, uiCode ? true : false); 1947 READ_FLAG( uiCode, "pic_rate_info_present_flag[i]" ); info->setPicRateInfoPresentFlag(i, uiCode ? true : false); 1948 if(info->getBitRateInfoPresentFlag(i)) 1949 { 1950 READ_CODE( 16, uiCode, "avg_bit_rate[i]" ); info->setAvgBitRate(i, uiCode); 1951 READ_CODE( 16, uiCode, "max_bit_rate[i]" ); info->setMaxBitRate(i, uiCode); 1952 } 1953 if(info->getPicRateInfoPresentFlag(i)) 1954 { 1955 READ_CODE( 2, uiCode, "constant_pic_rate_idc[i]" ); info->setConstantPicRateIdc(i, uiCode); 1956 READ_CODE( 16, uiCode, "avg_pic_rate[i]" ); info->setAvgPicRate(i, uiCode); 1957 } 1958 } 1959 } 1960 #endif 1879 } 1880 1961 1881 Void TDecCavlc::parseTerminatingBit( UInt& ruiBit ) 1962 1882 {
Note: See TracChangeset for help on using the changeset viewer.