Changeset 302 in SHVCSoftware for branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
- Timestamp:
- 28 Jun 2013, 00:40:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r300 r302 39 39 #include "TEncCavlc.h" 40 40 #include "SEIwrite.h" 41 #include <iostream> 41 42 42 //! \ingroup TLibEncoder 43 43 //! \{ … … 163 163 WRITE_UVLC( pcPPS->getSPSId(), "pps_seq_parameter_set_id" ); 164 164 WRITE_FLAG( pcPPS->getDependentSliceSegmentsEnabledFlag() ? 1 : 0, "dependent_slice_segments_enabled_flag" ); 165 #if L0255_MOVE_PPS_FLAGS166 165 WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag" ); 167 166 WRITE_CODE( pcPPS->getNumExtraSliceHeaderBits(), 3, "num_extra_slice_header_bits"); 168 #endif169 167 WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" ); 170 168 WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0, "cabac_init_present_flag" ); … … 186 184 WRITE_FLAG( pcPPS->getUseWP() ? 1 : 0, "weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) 187 185 WRITE_FLAG( pcPPS->getWPBiPred() ? 1 : 0, "weighted_bipred_flag" ); // Use of Weighting Bi-Prediction (B_SLICE) 188 #if !L0255_MOVE_PPS_FLAGS189 WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag" );190 #endif191 186 WRITE_FLAG( pcPPS->getTransquantBypassEnableFlag() ? 1 : 0, "transquant_bypass_enable_flag" ); 192 187 WRITE_FLAG( pcPPS->getTilesEnabledFlag() ? 1 : 0, "tiles_enabled_flag" ); … … 235 230 WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag"); 236 231 WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2"); 237 #if !L0255_MOVE_PPS_FLAGS238 WRITE_CODE( pcPPS->getNumExtraSliceHeaderBits(), 3, "num_extra_slice_header_bits");239 #endif240 232 WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag"); 241 233 WRITE_FLAG( 0, "pps_extension_flag" ); … … 296 288 WRITE_UVLC(defaultDisplayWindow.getWindowBottomOffset(), "def_disp_win_bottom_offset"); 297 289 } 298 #if L0043_TIMING_INFO299 290 TimingInfo *timingInfo = pcVUI->getTimingInfo(); 300 291 WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(), "vui_timing_info_present_flag"); … … 308 299 WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(), "vui_num_ticks_poc_diff_one_minus1"); 309 300 } 310 #endif311 301 WRITE_FLAG(pcVUI->getHrdParametersPresentFlag(), "hrd_parameters_present_flag"); 312 302 if( pcVUI->getHrdParametersPresentFlag() ) … … 314 304 codeHrdParameters(pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); 315 305 } 316 #if L0043_TIMING_INFO 317 } 318 #endif 319 #if !L0043_TIMING_INFO 320 WRITE_FLAG( pcVUI->getPocProportionalToTimingFlag(), "poc_proportional_to_timing_flag" ); 321 if( pcVUI->getPocProportionalToTimingFlag() && pcVUI->getHrdParameters()->getTimingInfoPresentFlag() ) 322 { 323 WRITE_UVLC( pcVUI->getNumTicksPocDiffOneMinus1(), "num_ticks_poc_diff_one_minus1" ); 324 } 325 #endif 306 } 326 307 327 308 WRITE_FLAG(pcVUI->getBitstreamRestrictionFlag(), "bitstream_restriction_flag"); … … 337 318 WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(), "motion_vectors_over_pic_boundaries_flag"); 338 319 WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(), "restricted_ref_pic_lists_flag"); 339 #if L0043_MSS_IDC340 320 WRITE_UVLC(pcVUI->getMinSpatialSegmentationIdc(), "min_spatial_segmentation_idc"); 341 #else342 WRITE_CODE(pcVUI->getMinSpatialSegmentationIdc(), 8, "min_spatial_segmentation_idc");343 #endif344 321 WRITE_UVLC(pcVUI->getMaxBytesPerPicDenom(), "max_bytes_per_pic_denom"); 345 322 WRITE_UVLC(pcVUI->getMaxBitsPerMinCuDenom(), "max_bits_per_mincu_denom"); … … 353 330 if( commonInfPresentFlag ) 354 331 { 355 #if !L0043_TIMING_INFO356 WRITE_FLAG( hrd->getTimingInfoPresentFlag() ? 1 : 0, "timing_info_present_flag" );357 if( hrd->getTimingInfoPresentFlag() )358 {359 WRITE_CODE( hrd->getNumUnitsInTick(), 32, "num_units_in_tick" );360 WRITE_CODE( hrd->getTimeScale(), 32, "time_scale" );361 }362 #endif363 332 WRITE_FLAG( hrd->getNalHrdParametersPresentFlag() ? 1 : 0 , "nal_hrd_parameters_present_flag" ); 364 333 WRITE_FLAG( hrd->getVclHrdParametersPresentFlag() ? 1 : 0 , "vcl_hrd_parameters_present_flag" ); … … 371 340 WRITE_CODE( hrd->getDuCpbRemovalDelayLengthMinus1(), 5, "du_cpb_removal_delay_length_minus1" ); 372 341 WRITE_FLAG( hrd->getSubPicCpbParamsInPicTimingSEIFlag() ? 1 : 0, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); 373 #if L0044_DU_DPB_OUTPUT_DELAY_HRD374 342 WRITE_CODE( hrd->getDpbOutputDelayDuLengthMinus1(), 5, "dpb_output_delay_du_length_minus1" ); 375 #endif376 343 } 377 344 WRITE_CODE( hrd->getBitRateScale(), 4, "bit_rate_scale" ); … … 402 369 WRITE_UVLC( hrd->getPicDurationInTcMinus1( i ), "elemental_duration_in_tc_minus1"); 403 370 } 404 #if L0372405 371 else 406 372 { … … 411 377 WRITE_UVLC( hrd->getCpbCntMinus1( i ), "cpb_cnt_minus1"); 412 378 } 413 #else414 WRITE_FLAG( hrd->getLowDelayHrdFlag( i ) ? 1 : 0, "low_delay_hrd_flag");415 WRITE_UVLC( hrd->getCpbCntMinus1( i ), "cpb_cnt_minus1");416 #endif417 379 418 380 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) … … 427 389 if( hrd->getSubPicCpbParamsPresentFlag() ) 428 390 { 429 #if L0363_DU_BIT_RATE 391 WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1"); 430 392 WRITE_UVLC( hrd->getDuBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_du_value_minus1"); 431 #endif432 WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1");433 393 } 434 394 WRITE_FLAG( hrd->getCbrFlag( i, j, nalOrVcl ) ? 1 : 0, "cbr_flag"); … … 486 446 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 487 447 { 488 #if L0323_DPB489 448 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1, "sps_max_dec_pic_buffering_minus1[i]" ); 490 #else491 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i), "sps_max_dec_pic_buffering[i]" );492 #endif493 449 WRITE_UVLC( pcSPS->getNumReorderPics(i), "sps_num_reorder_pics[i]" ); 494 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "sps_max_latency_increase [i]" );450 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "sps_max_latency_increase_plus1[i]" ); 495 451 if (!subLayerOrderingInfoPresentFlag) 496 452 { … … 639 595 WRITE_CODE( 0xffff, 16, "vps_reserved_ffff_16bits" ); 640 596 codePTL( pcVPS->getPTL(), true, pcVPS->getMaxTLayers() - 1 ); 641 #if SIGNAL_BITRATE_PICRATE_IN_VPS642 codeBitratePicRateInfo(pcVPS->getBitratePicrateInfo(), 0, pcVPS->getMaxTLayers() - 1);643 #endif644 597 const Bool subLayerOrderingInfoPresentFlag = 1; 645 598 WRITE_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag"); 646 599 for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++) 647 600 { 648 #if L0323_DPB649 601 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1, "vps_max_dec_pic_buffering_minus1[i]" ); 650 #else651 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i), "vps_max_dec_pic_buffering[i]" );652 #endif653 602 WRITE_UVLC( pcVPS->getNumReorderPics(i), "vps_num_reorder_pics[i]" ); 654 WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i), "vps_max_latency_increase [i]" );603 WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i), "vps_max_latency_increase_plus1[i]" ); 655 604 if (!subLayerOrderingInfoPresentFlag) 656 605 { … … 693 642 pcVPS->deriveLayerIdListVariables(); 694 643 #endif 695 #if L0043_TIMING_INFO696 644 TimingInfo *timingInfo = pcVPS->getTimingInfo(); 697 645 WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(), "vps_timing_info_present_flag"); … … 705 653 WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(), "vps_num_ticks_poc_diff_one_minus1"); 706 654 } 707 #endif708 655 pcVPS->setNumHrdParameters( 0 ); 709 656 WRITE_UVLC( pcVPS->getNumHrdParameters(), "vps_num_hrd_parameters" ); … … 724 671 codeHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); 725 672 } 726 #if L0043_TIMING_INFO 727 } 728 #endif 673 } 729 674 #if !VPS_EXTNS 730 675 WRITE_FLAG( 0, "vps_extension_flag" ); … … 994 939 995 940 #if FIX1071 996 // Deal withbitstream restriction stating that:997 // –If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.941 // check for bitstream restriction stating that: 942 // If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. 998 943 // Ideally this process should not be repeated for each slice in a picture 999 TComReferencePictureSet altRps;1000 Bool useAltRps = false;1001 944 #if SVC_EXTENSION 1002 945 if( pcSlice->getLayerId() == 0 ) 1003 946 #endif 1004 if (pcSlice->getRapPicFlag()) 1005 { 1006 for (Int picIdx = 0; !useAltRps && picIdx < rps->getNumberOfPictures(); picIdx++) 1007 { 1008 useAltRps = rps->getUsed(picIdx); 1009 } 1010 if (useAltRps) 1011 { 1012 memcpy(&altRps, rps, sizeof(TComReferencePictureSet)); 1013 rps = &altRps; 1014 for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++) 1015 { 1016 rps->setUsed(picIdx, false); 1017 } 1018 } 1019 } 1020 1021 if(pcSlice->getRPSidx() < 0 || useAltRps) 1022 #else 947 if (pcSlice->isIRAP()) 948 { 949 for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++) 950 { 951 assert (!rps->getUsed(picIdx)); 952 } 953 } 954 #endif 955 1023 956 if(pcSlice->getRPSidx() < 0) 1024 #endif1025 957 { 1026 958 WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); … … 1114 1046 } 1115 1047 } 1116 1117 1048 if (pcSlice->getSPS()->getTMVPFlagsPresent()) 1118 1049 { … … 1326 1257 } 1327 1258 } 1328 1329 1259 if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag()) 1330 1260 { … … 1341 1271 WRITE_CODE( pcPTL->getGeneralPTL()->getLevelIdc(), 8, "general_level_idc" ); 1342 1272 1343 #if L0363_BYTE_ALIGN1344 1273 for (Int i = 0; i < maxNumSubLayersMinus1; i++) 1345 1274 { … … 1359 1288 } 1360 1289 } 1361 #endif1362 1290 1363 1291 for(Int i = 0; i < maxNumSubLayersMinus1; i++) 1364 1292 { 1365 #if !L0363_BYTE_ALIGN1366 if(profilePresentFlag)1367 {1368 WRITE_FLAG( pcPTL->getSubLayerProfilePresentFlag(i), "sub_layer_profile_present_flag[i]" );1369 }1370 1371 WRITE_FLAG( pcPTL->getSubLayerLevelPresentFlag(i), "sub_layer_level_present_flag[i]" );1372 #endif1373 1293 if( profilePresentFlag && pcPTL->getSubLayerProfilePresentFlag(i) ) 1374 1294 { … … 1391 1311 } 1392 1312 1393 #if L0046_CONSTRAINT_FLAGS1394 1313 WRITE_FLAG(ptl->getProgressiveSourceFlag(), "general_progressive_source_flag"); 1395 1314 WRITE_FLAG(ptl->getInterlacedSourceFlag(), "general_interlaced_source_flag"); … … 1400 1319 WRITE_CODE(0 , 16, "XXX_reserved_zero_44bits[16..31]"); 1401 1320 WRITE_CODE(0 , 12, "XXX_reserved_zero_44bits[32..43]"); 1402 #elif L0363_MORE_BITS 1403 WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[0..15]"); 1404 WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[16..31]"); 1405 WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[32..47]"); 1406 #else 1407 WRITE_CODE(0 , 16, "XXX_reserved_zero_16bits[]"); 1408 #endif 1409 } 1410 #if SIGNAL_BITRATE_PICRATE_IN_VPS 1411 Void TEncCavlc::codeBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh) 1412 { 1413 for(Int i = tempLevelLow; i <= tempLevelHigh; i++) 1414 { 1415 WRITE_FLAG( info->getBitRateInfoPresentFlag(i), "bit_rate_info_present_flag[i]" ); 1416 WRITE_FLAG( info->getPicRateInfoPresentFlag(i), "pic_rate_info_present_flag[i]" ); 1417 if(info->getBitRateInfoPresentFlag(i)) 1418 { 1419 WRITE_CODE( info->getAvgBitRate(i), 16, "avg_bit_rate[i]" ); 1420 WRITE_CODE( info->getMaxBitRate(i), 16, "max_bit_rate[i]" ); 1421 } 1422 if(info->getPicRateInfoPresentFlag(i)) 1423 { 1424 WRITE_CODE( info->getConstantPicRateIdc(i), 2, "constant_pic_rate_idc[i]" ); 1425 WRITE_CODE( info->getAvgPicRate(i), 16, "avg_pic_rate[i]" ); 1426 } 1427 } 1428 } 1429 #endif 1321 } 1322 1430 1323 /** 1431 1324 - write wavefront substreams sizes for the slice header. … … 1497 1390 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 1498 1391 { 1499 #if L0116_ENTRY_POINT1500 1392 WRITE_CODE(entryPointOffset[ idx ]-1, offsetLenMinus1+1, "entry_point_offset_minus1"); 1501 #else1502 WRITE_CODE(entryPointOffset[ idx ], offsetLenMinus1+1, "entry_point_offset");1503 #endif1504 1393 } 1505 1394
Note: See TracChangeset for help on using the changeset viewer.