Changeset 622 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncCavlc.cpp


Ignore:
Timestamp:
11 Sep 2013, 14:40:25 (12 years ago)
Author:
tech
Message:

Merged 8.0-dev0@621 (MV-HEVC 5 HLS).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibEncoder/TEncCavlc.cpp

    r608 r622  
    229229    }
    230230  }
     231#if H_MV5
     232#if H_MV
     233  if ( pcPPS->getLayerId() > 0 )
     234  {
     235    WRITE_FLAG( pcPPS->getPpsInferScalingListFlag( ) ? 1 : 0 , "pps_infer_scaling_list_flag" );
     236  }
     237
     238  if( pcPPS->getPpsInferScalingListFlag( ) )
     239  {
     240    WRITE_CODE( pcPPS->getPpsScalingListRefLayerId( ), 6, "pps_scaling_list_ref_layer_id" );
     241  }
     242  else
     243  { 
     244#endif 
     245#endif
    231246  WRITE_FLAG( pcPPS->getScalingListPresentFlag() ? 1 : 0,                          "pps_scaling_list_data_present_flag" );
    232247  if( pcPPS->getScalingListPresentFlag() )
     
    237252    codeScalingList( m_pcSlice->getScalingList() );
    238253  }
     254#if H_MV5
     255#if H_MV
     256  }
     257#endif
     258#endif
    239259  WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag");
    240260  WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2");
     
    319339  {
    320340    WRITE_FLAG(pcVUI->getTilesFixedStructureFlag(),             "tiles_fixed_structure_flag");
     341#if !H_MV5
    321342#if H_MV
    322343    if ( pcSPS->getLayerId() > 0 )
     
    324345      WRITE_FLAG( pcVUI->getTileBoundariesAlignedFlag( ) ? 1 : 0 , "tile_boundaries_aligned_flag" );
    325346    }
     347#endif
    326348#endif
    327349    WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(),  "motion_vectors_over_pic_boundaries_flag");
     
    429451#endif
    430452  WRITE_UVLC( pcSPS->getSPSId (),                   "sps_seq_parameter_set_id" );
     453#if H_MV5
     454#if H_MV
     455  if ( pcSPS->getLayerId() > 0 )
     456  {
     457    WRITE_FLAG( pcSPS->getUpdateRepFormatFlag( ) ? 1 : 0 , "update_rep_format_flag" );
     458  }
     459
     460  if ( pcSPS->getUpdateRepFormatFlag() )
     461  {
     462#endif
     463#endif
    431464  WRITE_UVLC( pcSPS->getChromaFormatIdc (),         "chroma_format_idc" );
    432465  assert(pcSPS->getChromaFormatIdc () == 1);
     
    439472  WRITE_UVLC( pcSPS->getPicWidthInLumaSamples (),   "pic_width_in_luma_samples" );
    440473  WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(),   "pic_height_in_luma_samples" );
     474#if H_MV5
     475#if H_MV
     476  }
     477#endif
     478#endif
    441479  Window conf = pcSPS->getConformanceWindow();
    442480
     
    449487    WRITE_UVLC( conf.getWindowBottomOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_bottom_offset" );
    450488  }
    451 
     489#if H_MV5
     490#if H_MV
     491  if ( pcSPS->getUpdateRepFormatFlag() )
     492  {
     493#endif
     494#endif
    452495  WRITE_UVLC( pcSPS->getBitDepthY() - 8,             "bit_depth_luma_minus8" );
    453496  WRITE_UVLC( pcSPS->getBitDepthC() - 8,             "bit_depth_chroma_minus8" );
    454 
     497#if H_MV5
     498#if H_MV
     499  }
     500#endif
     501#endif
    455502  WRITE_UVLC( pcSPS->getBitsForPOC()-4,                 "log2_max_pic_order_cnt_lsb_minus4" );
    456503
     
    478525  if(pcSPS->getScalingListFlag())
    479526  {
     527#if H_MV5
     528#if H_MV
     529    if ( pcSPS->getLayerId() > 0 )
     530    {   
     531      WRITE_FLAG( pcSPS->getSpsInferScalingListFlag( ) ? 1 : 0 , "sps_infer_scaling_list_flag" );
     532    }
     533
     534    if ( pcSPS->getSpsInferScalingListFlag() )
     535    {
     536      WRITE_CODE( pcSPS->getSpsScalingListRefLayerId( ), 6, "sps_scaling_list_ref_layer_id" );
     537    }
     538    else
     539    {   
     540#endif
     541#endif
    480542    WRITE_FLAG( pcSPS->getScalingListPresentFlag() ? 1 : 0,                          "sps_scaling_list_data_present_flag" );
    481543    if(pcSPS->getScalingListPresentFlag())
     
    486548      codeScalingList( m_pcSlice->getScalingList() );
    487549    }
     550#if H_MV5
     551#if H_MV
     552    }
     553#endif
     554#endif
    488555  }
    489556  WRITE_FLAG( pcSPS->getUseAMP() ? 1 : 0,                                            "amp_enabled_flag" );
     
    531598  }
    532599
     600#if !H_MV5
    533601#if H_MV
    534602  WRITE_FLAG( 1, "sps_extension_flag" );
     
    586654#endif
    587655}
     656#else
     657#if !H_MV
     658  WRITE_FLAG( 0, "sps_extension_flag" );
     659#else
     660  WRITE_FLAG( 1, "sps_extension_flag" );
     661  codeSPSExtension( pcSPS );
     662#if !H_3D
     663  WRITE_FLAG( 0, "sps_extension2_flag" );
     664#else
     665  WRITE_FLAG( 1, "sps_extension2_flag" );
     666  codeSPSExtension2( pcSPS, viewIndex, depthFlag );
     667  WRITE_FLAG( 0, "sps_extension3_flag" );
     668#endif 
     669#endif
     670}
     671
     672#if H_MV
     673Void TEncCavlc::codeSPSExtension( TComSPS* pcSPS )
     674{
     675  WRITE_FLAG( pcSPS->getInterViewMvVertConstraintFlag() ? 1 : 0, "inter_view_mv_vert_constraint_flag" );
     676  WRITE_UVLC( 0, "sps_shvc_reserved_zero_idc" );
     677}
     678#endif
     679
     680#if H_3D
     681Void TEncCavlc::codeSPSExtension2( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )
     682{
     683#if H_3D_QTLPC
     684//GT: This has to go to VPS
     685if( depthFlag )
     686{
     687  WRITE_FLAG( pcSPS->getUseQTL() ? 1 : 0, "use_qtl_flag");
     688  WRITE_FLAG( pcSPS->getUsePC()  ? 1 : 0, "use_pc_flag");
     689}
     690#endif
     691  if (!depthFlag )
     692  {
     693    WRITE_UVLC( pcSPS->getCamParPrecision(), "cp_precision" );
     694    WRITE_FLAG( pcSPS->hasCamParInSliceHeader() ? 1 : 0, "cp_in_slice_header_flag" );
     695    if( !pcSPS->hasCamParInSliceHeader() )
     696    {
     697      for( UInt uiIndex = 0; uiIndex < viewIndex; uiIndex++ )
     698      {
     699        WRITE_SVLC( pcSPS->getCodedScale    ()[ uiIndex ],                                      "cp_scale" );
     700        WRITE_SVLC( pcSPS->getCodedOffset   ()[ uiIndex ],                                      "cp_off" );
     701        WRITE_SVLC( pcSPS->getInvCodedScale ()[ uiIndex ] + pcSPS->getCodedScale ()[ uiIndex ], "cp_inv_scale_plus_scale" );
     702        WRITE_SVLC( pcSPS->getInvCodedOffset()[ uiIndex ] + pcSPS->getCodedOffset()[ uiIndex ], "cp_inv_off_plus_off" );
     703      }
     704    }
     705  }
     706}
     707#endif
     708#endif
    588709
    589710Void TEncCavlc::codeVPS( TComVPS* pcVPS )
     
    592713  WRITE_CODE( 3,                                    2,        "vps_reserved_three_2bits" );
    593714#if H_MV
     715#if H_MV5
     716  WRITE_CODE( pcVPS->getMaxLayersMinus1(),       6,        "vps_max_layers_minus1" );
     717#else
    594718  WRITE_CODE( pcVPS->getMaxLayers() - 1,            6,        "vps_max_layers_minus1" );
     719#endif
    595720#else
    596721  WRITE_CODE( 0,                                    6,        "vps_reserved_zero_6bits" );
     
    675800    }
    676801  }
     802#if !H_MV5
    677803#if H_MV
    678804  WRITE_FLAG( 1,                                             "vps_extension_flag" );
     
    848974    } 
    849975  }
    850 #if H_3D_TMVP
    851976  WRITE_FLAG( pcVPS->getIvMvScalingFlag( ) ? 1 : 0 ,          "iv_mv_scaling_flag" );
    852 #endif
    853977#else
    854978  WRITE_FLAG( 0,                                             "vps_extension2_flag" );
     
    862986  return;
    863987}
     988#else
     989#if H_MV
     990  WRITE_FLAG( 1,                     "vps_extension_flag" );
     991  m_pcBitIf->writeAlignOne();
     992  codeVPSExtension( pcVPS );                           
     993#if H_3D
     994  WRITE_FLAG( 1,                     "vps_extension2_flag" );
     995  m_pcBitIf->writeAlignOne();     
     996  codeVPSExtension2( pcVPS );
     997  WRITE_FLAG( 0,                     "vps_extension3_flag" );
     998#else
     999  WRITE_FLAG( 0,                     "vps_extension2_flag" );
     1000#endif
     1001#else
     1002  WRITE_FLAG( 0,                     "vps_extension_flag" );
     1003#endif
     1004  //future extensions here..
     1005}
     1006
     1007#endif
     1008
     1009
     1010#if H_MV5
     1011#if H_MV
     1012Void TEncCavlc::codeVPSExtension( TComVPS *pcVPS )
     1013{
     1014  WRITE_FLAG( pcVPS->getAvcBaseLayerFlag() ? 1 : 0,          "avc_base_layer_flag" );
     1015  WRITE_CODE( pcVPS->getVpsVuiOffset( ), 16,                 "vps_vui_offset" );  // TBD
     1016  WRITE_FLAG( pcVPS->getSplittingFlag() ? 1 : 0,             "splitting_flag" );
     1017 
     1018  for( Int type = 0; type < MAX_NUM_SCALABILITY_TYPES; type++ )
     1019  {
     1020    WRITE_FLAG( pcVPS->getScalabilityMaskFlag( type ) ? 1 : 0,   "scalability_mask_flag[i]" );
     1021  }
     1022
     1023  for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes( ) - ( pcVPS->getSplittingFlag() ? 1 : 0 ); sIdx++ )
     1024  {
     1025    WRITE_CODE( pcVPS->getDimensionIdLen( sIdx ) - 1 , 3,    "dimension_id_len_minus1[j]");   
     1026  }
     1027
     1028  if ( pcVPS->getSplittingFlag() )
     1029  { // Ignore old dimension id length
     1030    pcVPS->setDimensionIdLen( pcVPS->getNumScalabilityTypes( ) - 1 ,pcVPS->inferLastDimsionIdLenMinus1() + 1 );       
     1031  }   
     1032
     1033  WRITE_FLAG( pcVPS->getVpsNuhLayerIdPresentFlag() ? 1 : 0,  "vps_nuh_layer_id_present_flag");
     1034
     1035  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
     1036  {
     1037    if ( pcVPS->getVpsNuhLayerIdPresentFlag() )
     1038    {     
     1039      WRITE_CODE( pcVPS->getLayerIdInNuh( i ), 6,          "layer_id_in_nuh[i]");
     1040  }
     1041    else
     1042    {
     1043      assert( pcVPS->getLayerIdInNuh( i ) == i );
     1044  }
     1045
     1046    assert(  pcVPS->getLayerIdInVps( pcVPS->getLayerIdInNuh( i ) ) == i );
     1047
     1048    for( Int j = 0; j < pcVPS->getNumScalabilityTypes() ; j++ )
     1049    {
     1050      if ( !pcVPS->getSplittingFlag() )
     1051      {
     1052        WRITE_CODE( pcVPS->getDimensionId( i, j ), pcVPS->getDimensionIdLen( j ), "dimension_id[i][j]");     
     1053      }
     1054      else
     1055      {
     1056        assert( pcVPS->getDimensionId( i, j ) ==  pcVPS->inferDimensionId( i, j )  );
     1057      }
     1058    }
     1059  }
     1060
     1061  // GT spec says: trac #39
     1062  // if ( pcVPS->getNumViews() > 1 ) 
     1063  //   However, this is a bug in the text since, view_id_len_minus1 is needed to parse view_id_val.
     1064  {
     1065    WRITE_CODE( pcVPS->getViewIdLenMinus1( ), 4, "view_id_len_minus1" );
     1066  }
     1067
     1068  for( Int i = 0; i < pcVPS->getNumViews(); i++ )
     1069  {
     1070    WRITE_CODE( pcVPS->getViewIdVal( i ), pcVPS->getViewIdLenMinus1( ) + 1, "view_id_val[i]" );
     1071  }
     1072
     1073  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
     1074  {
     1075    for( Int j = 0; j < i; j++ )
     1076    {
     1077      WRITE_FLAG( pcVPS->getDirectDependencyFlag( i, j ),    "direct_dependency_flag[i][j]" );
     1078    }
     1079  }
     1080
     1081  WRITE_FLAG( pcVPS->getMaxTidRefPresentFlag( ) ? 1 : 0 , "max_tid_ref_present_flag" );
     1082
     1083  if ( pcVPS->getMaxTidRefPresentFlag() )
     1084  {   
     1085    for( Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )
     1086    {
     1087      WRITE_CODE( pcVPS->getMaxTidIlRefPicPlus1( i ), 3,       "max_tid_il_ref_pics_plus1[i]" );
     1088    }
     1089  }
     1090
     1091  WRITE_FLAG( pcVPS->getAllRefLayersActiveFlag( ) ? 1 : 0 , "all_ref_layers_active_flag" );
     1092  WRITE_CODE( pcVPS->getVpsNumberLayerSetsMinus1( )    , 10,    "vps_number_layer_sets_minus1"      );
     1093  WRITE_CODE( pcVPS->getVpsNumProfileTierLevelMinus1( ), 6,     "vps_num_profile_tier_level_minus1" );
     1094
     1095  for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ )
     1096  {
     1097    WRITE_FLAG( pcVPS->getVpsProfilePresentFlag( i ) ? 1 : 0, "vps_profile_present_flag[i]" );
     1098    if( !pcVPS->getVpsProfilePresentFlag( i ) )
     1099    {   
     1100      WRITE_CODE( pcVPS->getProfileRefMinus1( i ), 6, "profile_ref_minus1[i]" );
     1101    }
     1102    codePTL( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers() - 1 );
     1103  }
     1104
     1105  Int numOutputLayerSets = pcVPS->getVpsNumberLayerSetsMinus1( ) + 1;
     1106
     1107  WRITE_FLAG( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) ? 1 : 0, "more_output_layer_sets_than_default_flag" );
     1108
     1109  if ( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) )
     1110  {
     1111    WRITE_CODE( pcVPS->getNumAddOutputLayerSetsMinus1( )    , 10,    "num_add_output_layer_sets_minus1"      );
     1112    numOutputLayerSets += ( pcVPS->getNumAddOutputLayerSetsMinus1( ) + 1 );
     1113  }
     1114
     1115  if( numOutputLayerSets > 1)
     1116  {
     1117    WRITE_FLAG( pcVPS->getDefaultOneTargetOutputLayerFlag( ) ? 1 : 0, "default_one_target_output_layer_flag" );
     1118  } 
     1119
     1120  for( Int i = 1; i < numOutputLayerSets; i++ )
     1121  {
     1122    if( i > pcVPS->getVpsNumberLayerSetsMinus1( ) )
     1123    {     
     1124      WRITE_UVLC( pcVPS->getOutputLayerSetIdxMinus1( i ),      "output_layer_set_idx_minus1[i]" );
     1125      for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1 ; j++ )
     1126      {
     1127        WRITE_FLAG( pcVPS->getOutputLayerFlag( i, j) ? 1 : 0, "output_layer_flag" );
     1128      }     
     1129    }
     1130    if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
     1131    {     
     1132      WRITE_CODE( pcVPS->getProfileLevelTierIdx( i ), pcVPS->getProfileLevelTierIdxLen() ,"profile_level_tier_idx[ i ]" );   
     1133    }
     1134  }
     1135
     1136  WRITE_FLAG( pcVPS->getRepFormatIdxPresentFlag( ) ? 1 : 0 , "rep_format_idx_present_flag" );
     1137  if ( pcVPS->getRepFormatIdxPresentFlag() )
     1138  {
     1139    WRITE_CODE( pcVPS->getVpsNumRepFormatsMinus1( ), 4, "vps_num_rep_formats_minus1" );
     1140  }
     1141
     1142  for (Int i = 0; i <= pcVPS->getVpsNumRepFormatsMinus1(); i++ )
     1143  {   
     1144    TComRepFormat* pcRepFormat = pcVPS->getRepFormat(i);     
     1145    codeRepFormat( pcRepFormat );
     1146  }
     1147
     1148  if( pcVPS->getRepFormatIdxPresentFlag() )
     1149  {
     1150    for( Int i = 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
     1151    {
     1152      if( pcVPS->getVpsNumRepFormatsMinus1() > 0 )
     1153      {
     1154        WRITE_CODE( pcVPS->getVpsRepFormatIdx( i ), 4, "vps_rep_format_idx" );
     1155      }
     1156    }
     1157  }
     1158
     1159  WRITE_FLAG( pcVPS->getMaxOneActiveRefLayerFlag( ) ? 1 : 0, "max_one_active_ref_layer_flag" );
     1160  WRITE_FLAG( pcVPS->getCrossLayerIrapAlignedFlag( ) ? 1 : 0 , "cross_layer_irap_aligned_flag" );
     1161  WRITE_UVLC( pcVPS->getDirectDepTypeLenMinus2 ( ),         "direct_dep_type_len_minus2");
     1162
     1163    for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
     1164    {
     1165      for( Int j = 0; j < i; j++ )
     1166      {
     1167        if (pcVPS->getDirectDependencyFlag( i, j) )
     1168        {       
     1169          assert ( pcVPS->getDirectDependencyType( i, j ) != -1 );
     1170          WRITE_CODE( pcVPS->getDirectDependencyType( i, j ),pcVPS->getDirectDepTypeLenMinus2( ) + 2,  "direct_dependency_type[i][j]" );
     1171        }
     1172      }
     1173    }
     1174   
     1175    WRITE_FLAG ( 0,                                      "vps_shvc_reserved_zero_flag" );
     1176    WRITE_FLAG( pcVPS->getVpsVuiPresentFlag( ) ? 1 : 0 , "vps_vui_present_flag" );
     1177
     1178    if( pcVPS->getVpsVuiPresentFlag() )
     1179    {
     1180      m_pcBitIf->writeAlignOne();  // vps_vui_alignment_bit_equal_to_one
     1181      codeVPSVUI( pcVPS );
     1182    }     
     1183}
     1184
     1185Void TEncCavlc::codeRepFormat( TComRepFormat* pcRepFormat )
     1186{
     1187  assert( pcRepFormat );
     1188
     1189  WRITE_CODE( pcRepFormat->getChromaFormatVpsIdc( ), 2, "chroma_format_vps_idc" );
     1190
     1191  if ( pcRepFormat->getChromaFormatVpsIdc() == 3 )
     1192  {
     1193    WRITE_FLAG( pcRepFormat->getSeparateColourPlaneVpsFlag( ) ? 1 : 0 , "separate_colour_plane_vps_flag" );
     1194  }
     1195  WRITE_CODE( pcRepFormat->getPicWidthVpsInLumaSamples( ),  16, "pic_width_vps_in_luma_samples" );
     1196  WRITE_CODE( pcRepFormat->getPicHeightVpsInLumaSamples( ), 16, "pic_height_vps_in_luma_samples" );
     1197  WRITE_CODE( pcRepFormat->getBitDepthVpsLumaMinus8( ),      4, "bit_depth_vps_luma_minus8" );
     1198  WRITE_CODE( pcRepFormat->getBitDepthVpsChromaMinus8( ),    4, "bit_depth_vps_chroma_minus8" );
     1199}
     1200
     1201Void TEncCavlc::codeVPSVUI( TComVPS* pcVPS )
     1202{
     1203  assert( pcVPS );
     1204
     1205  TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( );
     1206
     1207  assert( pcVPSVUI );
     1208
     1209  WRITE_FLAG( pcVPSVUI->getBitRatePresentVpsFlag( ) ? 1 : 0 , "bit_rate_present_vps_flag" );
     1210  WRITE_FLAG( pcVPSVUI->getPicRatePresentVpsFlag( ) ? 1 : 0 , "pic_rate_present_vps_flag" );
     1211  if( pcVPSVUI->getBitRatePresentVpsFlag( )  ||  pcVPSVUI->getPicRatePresentVpsFlag( ) )
     1212  {
     1213    for( Int i = 0; i  <=  pcVPS->getVpsNumberLayerSetsMinus1(); i++ )
     1214    {
     1215      for( Int j = 0; j  <=  pcVPS->getMaxTLayers(); j++ )
     1216      {
     1217        if( pcVPSVUI->getBitRatePresentVpsFlag( ) )
     1218        {
     1219          WRITE_FLAG( pcVPSVUI->getBitRatePresentFlag( i, j ) ? 1 : 0 , "bit_rate_present_flag" );
     1220        }
     1221        if( pcVPSVUI->getBitRatePresentVpsFlag( )  )
     1222        {
     1223          WRITE_FLAG( pcVPSVUI->getPicRatePresentFlag( i, j ) ? 1 : 0 , "pic_rate_present_flag" );
     1224        }
     1225        if( pcVPSVUI->getBitRatePresentFlag( i, j ) )
     1226        {
     1227          WRITE_CODE( pcVPSVUI->getAvgBitRate( i, j ), 16, "avg_bit_rate" );
     1228          WRITE_CODE( pcVPSVUI->getMaxBitRate( i, j ), 16, "max_bit_rate" );
     1229        }
     1230        if( pcVPSVUI->getPicRatePresentFlag( i, j ) )
     1231        {
     1232          WRITE_CODE( pcVPSVUI->getConstantPicRateIdc( i, j ), 2, "constant_pic_rate_idc" );
     1233          WRITE_CODE( pcVPSVUI->getAvgPicRate( i, j ), 16, "avg_pic_rate" );
     1234        }
     1235      }
     1236    }
     1237  }
     1238
     1239  for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
     1240  {
     1241    for( Int  j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ); j++ )
     1242    {
     1243      WRITE_FLAG( pcVPSVUI->getTileBoundariesAlignedFlag( i, j ) ? 1 : 0 , "tile_boundaries_aligned_flag" );
     1244    }
     1245  }
     1246
     1247  WRITE_FLAG( pcVPSVUI->getIlpRestrictedRefLayersFlag( ) ? 1 : 0 , "ilp_restricted_ref_layers_flag" );
     1248
     1249  if( pcVPSVUI->getIlpRestrictedRefLayersFlag( ) )
     1250  {
     1251    for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
     1252    {
     1253      for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ); j++ )
     1254      {
     1255        WRITE_UVLC( pcVPSVUI->getMinSpatialSegmentOffsetPlus1( i, j ), "min_spatial_segment_offset_plus1" );
     1256        if( pcVPSVUI->getMinSpatialSegmentOffsetPlus1( i, j ) > 0 )
     1257        {
     1258          WRITE_FLAG( pcVPSVUI->getCtuBasedOffsetEnabledFlag( i, j ) ? 1 : 0 , "ctu_based_offset_enabled_flag" );
     1259          if( pcVPSVUI->getCtuBasedOffsetEnabledFlag( i, j ) )
     1260          {
     1261            WRITE_UVLC( pcVPSVUI->getMinHorizontalCtuOffsetPlus1( i, j ), "min_horizontal_ctu_offset_plus1" );
     1262          }
     1263        }
     1264      }
     1265    }
     1266  }
     1267}
     1268#endif
     1269
     1270#if H_3D
     1271Void TEncCavlc::codeVPSExtension2( TComVPS* pcVPS )
     1272{
     1273  for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ )
     1274  {
     1275    if (i!= 0)
     1276    {
     1277      if ( !( pcVPS->getDepthId( i ) == 1 ) )
     1278      {
     1279#if H_3D_IV_MERGE
     1280        WRITE_FLAG( pcVPS->getIvMvPredFlag         ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");
     1281#endif
     1282#if H_3D_ARP
     1283        WRITE_FLAG( pcVPS->getUseAdvRP             ( i ) ? 1 : 0,  "iv_res_pred_flag[i]"  );
     1284#endif
     1285#if H_3D_NBDV_REF
     1286        WRITE_FLAG( pcVPS->getDepthRefinementFlag  ( i ) ? 1 : 0 , "depth_refinement_flag[i]");
     1287#endif
     1288#if H_3D_VSP
     1289        WRITE_FLAG( pcVPS->getViewSynthesisPredFlag( i ) ? 1 : 0 , "view_synthesis_pred_flag[i]");
     1290#endif
     1291      }         
     1292      else
     1293      {
     1294        WRITE_FLAG( pcVPS->getVpsDepthModesFlag( i ) ? 1 : 0 ,          "vps_depth_modes_flag[i]" );
     1295        //WRITE_FLAG( pcVPS->getLimQtPredFlag    ( i ) ? 1 : 0 ,          "lim_qt_pred_flag[i]"     );
     1296#if H_3D_DIM_DLT
     1297        if( pcVPS->getVpsDepthModesFlag( i ) )
     1298        {
     1299          WRITE_FLAG( pcVPS->getUseDLTFlag( i ) ? 1 : 0, "dlt_flag[i]" );
     1300        }
     1301        if( pcVPS->getUseDLTFlag( i ) )
     1302        {
     1303          // code mapping
     1304          WRITE_UVLC(pcVPS->getNumDepthValues(i), "num_depth_values_in_dlt[i]");
     1305          for(Int d=0; d<pcVPS->getNumDepthValues(i); d++)
     1306          {
     1307            WRITE_UVLC( pcVPS->idx2DepthValue(i, d), "dlt_depth_value[i][d]" );
     1308          }
     1309        }       
     1310#endif
     1311#if LGE_INTER_SDC_E0156
     1312        WRITE_FLAG( pcVPS->getInterSDCFlag( i ) ? 1 : 0, "depth_inter_SDC_flag" );
     1313#endif
     1314      }
     1315    } 
     1316  }
     1317#if H_3D_TMVP
     1318  WRITE_FLAG( pcVPS->getIvMvScalingFlag( ) ? 1 : 0 ,          "iv_mv_scaling_flag" );
     1319#endif
     1320}
     1321#endif
     1322#endif
    8641323
    8651324Void TEncCavlc::codeSliceHeader         ( TComSlice* pcSlice )
     
    9111370  {
    9121371#if H_MV   
     1372#if H_MV5
     1373    Int esb = 0;  //Don't use i, otherwise will shadow something below
     1374    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     1375    {
     1376      esb++;
     1377      WRITE_FLAG( pcSlice->getPocResetFlag( ) ? 1 : 0 , "poc_reset_flag" );
     1378    }
     1379
     1380    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     1381    {
     1382      esb++;
     1383      WRITE_FLAG( pcSlice->getDiscardableFlag( ) ? 1 : 0 , "discardable_flag" );
     1384    }
     1385
     1386    for (; esb < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++)   
     1387#else
    9131388    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
    9141389    {
     
    9171392
    9181393    for (Int i = 1; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)   
     1394#endif
    9191395#else
    9201396    for (Int i = 0; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
     
    10541530    }
    10551531#if H_MV
     1532#if H_MV5
     1533    Int layerId = pcSlice->getLayerId();
     1534    if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )
     1535    {   
     1536      WRITE_FLAG( pcSlice->getInterLayerPredEnabledFlag( ) ? 1 : 0 , "inter_layer_pred_enabled_flag" );
     1537      if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 )
     1538      {           
     1539        if( !vps->getMaxOneActiveRefLayerFlag()) 
     1540        {
     1541          WRITE_CODE( pcSlice->getNumInterLayerRefPicsMinus1( ), pcSlice->getNumInterLayerRefPicsMinus1Len( ), "num_inter_layer_ref_pics_minus1" );
     1542        }
     1543        if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) )
     1544        {       
     1545          for( Int idx = 0; idx < pcSlice->getNumActiveRefLayerPics(); idx++ )   
     1546          {
     1547            WRITE_CODE( pcSlice->getInterLayerPredLayerIdc( idx ), pcSlice->getInterLayerPredLayerIdcLen( ), "inter_layer_pred_layer_idc" );
     1548          }
     1549        }
     1550      } 
     1551    }
     1552#else
    10561553    Int layerIdInVps       = pcSlice->getLayerIdInVps();
    10571554    if( pcSlice->getLayerId() > 0 && vps->getNumDirectRefLayers( layerIdInVps ) > 0 )
     
    10761573    }
    10771574
     1575#endif
    10781576#endif
    10791577    if(pcSlice->getSPS()->getUseSAO())
     
    11801678    if ( pcSlice->getEnableTMVPFlag() )
    11811679    {
     1680#if !H_MV5
    11821681#if H_MV
    11831682      if( pcSlice->getLayerId() > 0 && pcSlice->getNumActiveMotionPredRefLayers() > 0 )
     
    11921691      {
    11931692#endif
     1693#endif
    11941694      if ( pcSlice->getSliceType() == B_SLICE )
    11951695      {
     
    12041704      }
    12051705    }
     1706#if !H_MV5
    12061707#if H_MV
    12071708    }
     1709#endif
    12081710#endif
    12091711    if ( (pcSlice->getPPS()->getUseWP() && pcSlice->getSliceType()==P_SLICE) || (pcSlice->getPPS()->getWPBiPred() && pcSlice->getSliceType()==B_SLICE) )
Note: See TracChangeset for help on using the changeset viewer.