Changeset 655 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
- Timestamp:
- 23 Oct 2013, 23:01:30 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
r622 r655 229 229 } 230 230 } 231 #if H_MV5232 231 #if H_MV 233 232 if ( pcPPS->getLayerId() > 0 ) … … 243 242 { 244 243 #endif 245 #endif246 244 WRITE_FLAG( pcPPS->getScalingListPresentFlag() ? 1 : 0, "pps_scaling_list_data_present_flag" ); 247 245 if( pcPPS->getScalingListPresentFlag() ) … … 252 250 codeScalingList( m_pcSlice->getScalingList() ); 253 251 } 254 #if H_MV5255 252 #if H_MV 256 253 } 257 #endif258 254 #endif 259 255 WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag"); … … 339 335 { 340 336 WRITE_FLAG(pcVUI->getTilesFixedStructureFlag(), "tiles_fixed_structure_flag"); 341 #if !H_MV5342 #if H_MV343 if ( pcSPS->getLayerId() > 0 )344 {345 WRITE_FLAG( pcVUI->getTileBoundariesAlignedFlag( ) ? 1 : 0 , "tile_boundaries_aligned_flag" );346 }347 #endif348 #endif349 337 WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(), "motion_vectors_over_pic_boundaries_flag"); 350 338 WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(), "restricted_ref_pic_lists_flag"); … … 451 439 #endif 452 440 WRITE_UVLC( pcSPS->getSPSId (), "sps_seq_parameter_set_id" ); 453 #if H_MV5454 441 #if H_MV 455 442 if ( pcSPS->getLayerId() > 0 ) … … 460 447 if ( pcSPS->getUpdateRepFormatFlag() ) 461 448 { 462 #endif463 449 #endif 464 450 WRITE_UVLC( pcSPS->getChromaFormatIdc (), "chroma_format_idc" ); … … 472 458 WRITE_UVLC( pcSPS->getPicWidthInLumaSamples (), "pic_width_in_luma_samples" ); 473 459 WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(), "pic_height_in_luma_samples" ); 474 #if H_MV5475 460 #if H_MV 476 461 } 477 #endif478 462 #endif 479 463 Window conf = pcSPS->getConformanceWindow(); … … 487 471 WRITE_UVLC( conf.getWindowBottomOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_bottom_offset" ); 488 472 } 489 #if H_MV5490 473 #if H_MV 491 474 if ( pcSPS->getUpdateRepFormatFlag() ) 492 475 { 493 476 #endif 494 #endif495 477 WRITE_UVLC( pcSPS->getBitDepthY() - 8, "bit_depth_luma_minus8" ); 496 478 WRITE_UVLC( pcSPS->getBitDepthC() - 8, "bit_depth_chroma_minus8" ); 497 #if H_MV5498 479 #if H_MV 499 480 } 500 #endif501 481 #endif 502 482 WRITE_UVLC( pcSPS->getBitsForPOC()-4, "log2_max_pic_order_cnt_lsb_minus4" ); … … 525 505 if(pcSPS->getScalingListFlag()) 526 506 { 527 #if H_MV5528 507 #if H_MV 529 508 if ( pcSPS->getLayerId() > 0 ) … … 539 518 { 540 519 #endif 541 #endif542 520 WRITE_FLAG( pcSPS->getScalingListPresentFlag() ? 1 : 0, "sps_scaling_list_data_present_flag" ); 543 521 if(pcSPS->getScalingListPresentFlag()) … … 548 526 codeScalingList( m_pcSlice->getScalingList() ); 549 527 } 550 #if H_MV5551 528 #if H_MV 552 529 } 553 #endif554 530 #endif 555 531 } … … 598 574 } 599 575 600 #if !H_MV5601 #if H_MV602 WRITE_FLAG( 1, "sps_extension_flag" );603 WRITE_FLAG( pcSPS->getInterViewMvVertConstraintFlag() ? 1 : 0, "inter_view_mv_vert_constraint_flag" );604 //// sps_extension_vui_parameters( )605 if( pcSPS->getVuiParameters()->getBitstreamRestrictionFlag() )606 {607 WRITE_UVLC( pcSPS->getNumIlpRestrictedRefLayers( ), "num_ilp_restricted_ref_layers" );608 for( Int i = 0; i < pcSPS->getNumIlpRestrictedRefLayers( ); i++ )609 {610 WRITE_UVLC( pcSPS->getMinSpatialSegmentOffsetPlus1( i ), "min_spatial_segment_offset_plus1" );611 if( pcSPS->getMinSpatialSegmentOffsetPlus1( i ) > 0 )612 {613 WRITE_FLAG( pcSPS->getCtuBasedOffsetEnabledFlag( i ), "ctu_based_offset_enabled_flag[ i ]");614 if( pcSPS->getCtuBasedOffsetEnabledFlag( i ) )615 {616 WRITE_UVLC( pcSPS->getMinHorizontalCtuOffsetPlus1( i ), "min_horizontal_ctu_offset_plus1[ i ]");617 }618 }619 }620 }621 #if H_3D_QTLPC622 if( depthFlag )623 {624 WRITE_FLAG( pcSPS->getUseQTL() ? 1 : 0, "use_qtl_flag");625 WRITE_FLAG( pcSPS->getUsePC() ? 1 : 0, "use_pc_flag");626 }627 #endif628 //// sps_extension_vui_parameters( ) END629 WRITE_UVLC( 0, "sps_shvc_reserved_zero_idc" );630 #if !H_3D631 WRITE_FLAG( 0, "sps_extension2_flag" );632 #else633 WRITE_FLAG( 1, "sps_extension2_flag" );634 if (!depthFlag )635 {636 WRITE_UVLC( pcSPS->getCamParPrecision(), "cp_precision" );637 WRITE_FLAG( pcSPS->hasCamParInSliceHeader() ? 1 : 0, "cp_in_slice_header_flag" );638 if( !pcSPS->hasCamParInSliceHeader() )639 {640 for( UInt uiIndex = 0; uiIndex < viewIndex; uiIndex++ )641 {642 WRITE_SVLC( pcSPS->getCodedScale ()[ uiIndex ], "cp_scale" );643 WRITE_SVLC( pcSPS->getCodedOffset ()[ uiIndex ], "cp_off" );644 WRITE_SVLC( pcSPS->getInvCodedScale ()[ uiIndex ] + pcSPS->getCodedScale ()[ uiIndex ], "cp_inv_scale_plus_scale" );645 WRITE_SVLC( pcSPS->getInvCodedOffset()[ uiIndex ] + pcSPS->getCodedOffset()[ uiIndex ], "cp_inv_off_plus_off" );646 }647 }648 }649 650 WRITE_FLAG( 0, "sps_extension3_flag" );651 #endif652 #else653 WRITE_FLAG( 0, "sps_extension_flag" );654 #endif655 }656 #else657 576 #if !H_MV 658 577 WRITE_FLAG( 0, "sps_extension_flag" ); … … 706 625 } 707 626 #endif 708 #endif709 627 710 628 Void TEncCavlc::codeVPS( TComVPS* pcVPS ) … … 713 631 WRITE_CODE( 3, 2, "vps_reserved_three_2bits" ); 714 632 #if H_MV 715 #if H_MV5716 633 WRITE_CODE( pcVPS->getMaxLayersMinus1(), 6, "vps_max_layers_minus1" ); 717 #else718 WRITE_CODE( pcVPS->getMaxLayers() - 1, 6, "vps_max_layers_minus1" );719 #endif720 634 #else 721 635 WRITE_CODE( 0, 6, "vps_reserved_zero_6bits" ); … … 800 714 } 801 715 } 802 #if !H_MV5803 #if H_MV804 WRITE_FLAG( 1, "vps_extension_flag" );805 806 m_pcBitIf->writeAlignOne();807 808 WRITE_FLAG( pcVPS->getAvcBaseLayerFlag() ? 1 : 0, "avc_base_layer_flag" );809 WRITE_FLAG( pcVPS->getSplittingFlag() ? 1 : 0, "splitting_flag" );810 811 for( Int type = 0; type < MAX_NUM_SCALABILITY_TYPES; type++ )812 {813 WRITE_FLAG( pcVPS->getScalabilityMask( type ) ? 1 : 0, "scalability_mask[i]" );814 }815 816 for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes( ) - ( pcVPS->getSplittingFlag() ? 1 : 0 ); sIdx++ )817 {818 WRITE_CODE( pcVPS->getDimensionIdLen( sIdx ) - 1 , 3, "dimension_id_len_minus1[j]");819 }820 821 if ( pcVPS->getSplittingFlag() )822 { // Ignore old dimension id length823 pcVPS->setDimensionIdLen( pcVPS->getNumScalabilityTypes( ) - 1 ,pcVPS->inferLastDimsionIdLenMinus1() + 1 );824 }825 826 827 WRITE_FLAG( pcVPS->getVpsNuhLayerIdPresentFlag() ? 1 : 0, "vps_nuh_layer_id_present_flag");828 829 for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ )830 {831 if ( pcVPS->getVpsNuhLayerIdPresentFlag() && ( i > 0 ) )832 {833 WRITE_CODE( pcVPS->getLayerIdInNuh( i ), 6, "layer_id_in_nuh[i]");834 }835 else836 {837 assert( pcVPS->getLayerIdInNuh( i ) == i );838 }839 840 assert( pcVPS->getLayerIdInVps( pcVPS->getLayerIdInNuh( i ) ) == i );841 842 for( Int j = 0; j < pcVPS->getNumScalabilityTypes() ; j++ )843 {844 if ( !pcVPS->getSplittingFlag() )845 {846 WRITE_CODE( pcVPS->getDimensionId( i, j ), pcVPS->getDimensionIdLen( j ), "dimension_id[i][j]");847 }848 else849 {850 assert( pcVPS->getDimensionId( i, j ) == pcVPS->inferDimensionId( i, j ) );851 }852 }853 }854 855 for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ )856 {857 for( Int j = 0; j < i; j++ )858 {859 WRITE_FLAG( pcVPS->getDirectDependencyFlag( i, j ), "direct_dependency_flag[i][j]" );860 }861 }862 863 for( Int i = 0; i < pcVPS->getMaxLayers() - 1; i++ )864 {865 WRITE_CODE( pcVPS->getMaxTidIlRefPicPlus1( i ), 3, "max_tid_il_ref_pics_plus1[i]" );866 }867 868 WRITE_CODE( pcVPS->getVpsNumberLayerSetsMinus1( ) , 10, "vps_number_layer_sets_minus1" );869 WRITE_CODE( pcVPS->getVpsNumProfileTierLevelMinus1( ), 6, "vps_num_profile_tier_level_minus1" );870 871 for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ )872 {873 WRITE_FLAG( pcVPS->getVpsProfilePresentFlag( i ) ? 1 : 0, "vps_profile_present_flag[i]" );874 if( !pcVPS->getVpsProfilePresentFlag( i ) )875 {876 WRITE_CODE( pcVPS->getProfileRefMinus1( i ), 6, "profile_ref_minus1[i]" );877 }878 codePTL( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers() - 1 );879 }880 881 Int numOutputLayerSets = pcVPS->getVpsNumberLayerSetsMinus1( ) + 1;882 883 WRITE_FLAG( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) ? 1 : 0, "more_output_layer_sets_than_default_flag" );884 885 if ( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) )886 {887 WRITE_CODE( pcVPS->getNumAddOutputLayerSetsMinus1( ) , 10, "num_add_output_layer_sets_minus1" );888 numOutputLayerSets += ( pcVPS->getNumAddOutputLayerSetsMinus1( ) + 1 );889 }890 891 if( numOutputLayerSets > 1)892 {893 WRITE_FLAG( pcVPS->getDefaultOneTargetOutputLayerFlag( ) ? 1 : 0, "default_one_target_output_layer_flag" );894 }895 896 for( Int i = 1; i < numOutputLayerSets; i++ )897 {898 if( i > pcVPS->getVpsNumberLayerSetsMinus1( ) )899 {900 WRITE_UVLC( pcVPS->getOutputLayerSetIdxMinus1( i ), "output_layer_set_idx_minus1[i]" );901 for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1 ; j++ )902 {903 WRITE_FLAG( pcVPS->getOutputLayerFlag( i, j) ? 1 : 0, "output_layer_flag" );904 }905 }906 if ( pcVPS->getProfileLevelTierIdxLen() > 0 )907 {908 WRITE_CODE( pcVPS->getProfileLevelTierIdx( i ), pcVPS->getProfileLevelTierIdxLen() ,"profile_level_tier_idx[ i ]" );909 }910 }911 912 WRITE_FLAG( pcVPS->getMaxOneActiveRefLayerFlag( ) ? 1 : 0, "max_one_active_ref_layer_flag" );913 WRITE_UVLC( pcVPS->getDirectDepTypeLenMinus2 ( ), "direct_dep_type_len_minus2");914 915 for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ )916 {917 for( Int j = 0; j < i; j++ )918 {919 if (pcVPS->getDirectDependencyFlag( i, j) )920 {921 assert ( pcVPS->getDirectDependencyType( i, j ) != -1 );922 WRITE_CODE( pcVPS->getDirectDependencyType( i, j ),pcVPS->getDirectDepTypeLenMinus2( ) + 2, "direct_dependency_type[i][j]" );923 }924 }925 }926 927 WRITE_FLAG ( 0, "vps_shvc_reserved_zero_flag" );928 929 #if H_3D930 WRITE_FLAG( 1, "vps_extension2_flag" );931 m_pcBitIf->writeAlignOne();932 for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ )933 {934 if (i!= 0)935 {936 if ( !( pcVPS->getDepthId( i ) == 1 ) )937 {938 #if H_3D_IV_MERGE939 WRITE_FLAG( pcVPS->getIvMvPredFlag ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");940 #endif941 #if H_3D_ARP942 WRITE_FLAG( pcVPS->getUseAdvRP ( i ) ? 1 : 0, "iv_res_pred_flag[i]" );943 #endif944 #if H_3D_NBDV_REF945 WRITE_FLAG( pcVPS->getDepthRefinementFlag ( i ) ? 1 : 0 , "depth_refinement_flag[i]");946 #endif947 #if H_3D_VSP948 WRITE_FLAG( pcVPS->getViewSynthesisPredFlag( i ) ? 1 : 0 , "view_synthesis_pred_flag[i]");949 #endif950 }951 else952 {953 WRITE_FLAG( pcVPS->getVpsDepthModesFlag( i ) ? 1 : 0 , "vps_depth_modes_flag[i]" );954 //WRITE_FLAG( pcVPS->getLimQtPredFlag ( i ) ? 1 : 0 , "lim_qt_pred_flag[i]" );955 #if H_3D_DIM_DLT956 if( pcVPS->getVpsDepthModesFlag( i ) )957 {958 WRITE_FLAG( pcVPS->getUseDLTFlag( i ) ? 1 : 0, "dlt_flag[i]" );959 }960 if( pcVPS->getUseDLTFlag( i ) )961 {962 // code mapping963 WRITE_UVLC(pcVPS->getNumDepthValues(i), "num_depth_values_in_dlt[i]");964 for(Int d=0; d<pcVPS->getNumDepthValues(i); d++)965 {966 WRITE_UVLC( pcVPS->idx2DepthValue(i, d), "dlt_depth_value[i][d]" );967 }968 }969 #endif970 #if LGE_INTER_SDC_E0156971 WRITE_FLAG( pcVPS->getInterSDCFlag( i ) ? 1 : 0, "depth_inter_SDC_flag" );972 #endif973 }974 }975 }976 WRITE_FLAG( pcVPS->getIvMvScalingFlag( ) ? 1 : 0 , "iv_mv_scaling_flag" );977 #else978 WRITE_FLAG( 0, "vps_extension2_flag" );979 #endif980 #else981 WRITE_FLAG( 0, "vps_extension_flag" );982 #endif983 984 //future extensions here..985 986 return;987 }988 #else989 716 #if H_MV 990 717 WRITE_FLAG( 1, "vps_extension_flag" ); … … 1003 730 #endif 1004 731 //future extensions here.. 1005 } 1006 1007 #endif 1008 1009 1010 #if H_MV5 732 733 return; 734 } 735 736 737 1011 738 #if H_MV 1012 739 Void TEncCavlc::codeVPSExtension( TComVPS *pcVPS ) … … 1309 1036 } 1310 1037 #endif 1311 #if LGE_INTER_SDC_E01561038 #if H_3D_INTER_SDC 1312 1039 WRITE_FLAG( pcVPS->getInterSDCFlag( i ) ? 1 : 0, "depth_inter_SDC_flag" ); 1313 1040 #endif … … 1319 1046 #endif 1320 1047 } 1321 #endif1322 1048 #endif 1323 1049 … … 1370 1096 { 1371 1097 #if H_MV 1372 #if H_MV51373 1098 Int esb = 0; //Don't use i, otherwise will shadow something below 1374 1099 if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb ) … … 1385 1110 1386 1111 for (; esb < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++) 1387 #else1388 if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )1389 {1390 WRITE_FLAG( pcSlice->getDiscardableFlag( ) ? 1 : 0 , "discardable_flag" );1391 }1392 1393 for (Int i = 1; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)1394 #endif1395 1112 #else 1396 1113 for (Int i = 0; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) … … 1415 1132 if( !pcSlice->getIdrPicFlag() ) 1416 1133 { 1417 Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) %(1<<pcSlice->getSPS()->getBitsForPOC());1134 Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1); 1418 1135 WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb"); 1419 1136 TComReferencePictureSet* rps = pcSlice->getRPS(); … … 1530 1247 } 1531 1248 #if H_MV 1532 #if H_MV51533 1249 Int layerId = pcSlice->getLayerId(); 1534 1250 if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 ) … … 1550 1266 } 1551 1267 } 1552 #else1553 Int layerIdInVps = pcSlice->getLayerIdInVps();1554 if( pcSlice->getLayerId() > 0 && vps->getNumDirectRefLayers( layerIdInVps ) > 0 )1555 {1556 WRITE_FLAG( pcSlice->getInterLayerPredEnabledFlag( ) ? 1 : 0 , "inter_layer_pred_enabled_flag" );1557 if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerIdInVps ) > 1 )1558 {1559 if( !vps->getMaxOneActiveRefLayerFlag())1560 {1561 WRITE_CODE( pcSlice->getNumInterLayerRefPicsMinus1( ), pcSlice->getNumInterLayerRefPicsMinus1Len( ), "num_inter_layer_ref_pics_minus1" );1562 }1563 for( Int i = 0; i < pcSlice->getNumActiveRefLayerPics(); i++ )1564 {1565 WRITE_CODE( pcSlice->getInterLayerPredLayerIdc( i ), pcSlice->getInterLayerPredLayerIdcLen( ), "inter_layer_pred_layer_idc" );1566 }1567 }1568 }1569 1570 if( vps->getNumSamplePredRefLayers( layerIdInVps ) > 0 && pcSlice->getNumActiveRefLayerPics() > 0 )1571 {1572 WRITE_FLAG( pcSlice->getInterLayerSamplePredOnlyFlag( ) ? 1 : 0 , "inter_layer_sample_pred_only_flag" );1573 }1574 1575 #endif1576 1268 #endif 1577 1269 if(pcSlice->getSPS()->getUseSAO()) … … 1678 1370 if ( pcSlice->getEnableTMVPFlag() ) 1679 1371 { 1680 #if !H_MV51681 #if H_MV1682 if( pcSlice->getLayerId() > 0 && pcSlice->getNumActiveMotionPredRefLayers() > 0 )1683 {1684 WRITE_FLAG( pcSlice->getAltCollocatedIndicationFlag( ) ? 1 : 0 , "alt_collocated_indication_flag" );1685 }1686 if( pcSlice->getAltCollocatedIndicationFlag() && pcSlice->getNumActiveMotionPredRefLayers() > 1 )1687 {1688 WRITE_UVLC( pcSlice->getCollocatedRefLayerIdx( ), "collocated_ref_layer_idx" );1689 }1690 else1691 {1692 #endif1693 #endif1694 1372 if ( pcSlice->getSliceType() == B_SLICE ) 1695 1373 { … … 1704 1382 } 1705 1383 } 1706 #if !H_MV51707 #if H_MV1708 }1709 #endif1710 #endif1711 1384 if ( (pcSlice->getPPS()->getUseWP() && pcSlice->getSliceType()==P_SLICE) || (pcSlice->getPPS()->getWPBiPred() && pcSlice->getSliceType()==B_SLICE) ) 1712 1385 { … … 2256 1929 { 2257 1930 // Bool state = true, state2 = false; 2258 Int lsb = ltrpPOC % (1<<pcSlice->getSPS()->getBitsForPOC());1931 Int lsb = ltrpPOC & ((1<<pcSlice->getSPS()->getBitsForPOC())-1); 2259 1932 for (Int k = 0; k < pcSlice->getSPS()->getNumLongTermRefPicSPS(); k++) 2260 1933 { … … 2282 1955 } 2283 1956 2284 #if LGE_INTER_SDC_E01561957 #if H_3D_INTER_SDC 2285 1958 Void TEncCavlc::codeInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2286 1959 {
Note: See TracChangeset for help on using the changeset viewer.