Ignore:
Timestamp:
13 Jul 2013, 10:26:41 (11 years ago)
Author:
tech
Message:

MergeMerged tags/HTM-DEV-1.0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCavlc.cpp

    r533 r534  
    338338  {
    339339    WRITE_FLAG(pcVUI->getTilesFixedStructureFlag(),             "tiles_fixed_structure_flag");
     340#if H_MV
     341    if ( pcSPS->getLayerId() > 0 )
     342    {
     343      WRITE_FLAG( pcVUI->getTileBoundariesAlignedFlag( ) ? 1 : 0 , "tile_boundaries_aligned_flag" );
     344    }
     345#endif
    340346    WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(),  "motion_vectors_over_pic_boundaries_flag");
    341347    WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(),           "restricted_ref_pic_lists_flag");
     
    452458#endif
    453459  WRITE_CODE( pcSPS->getVPSId (),          4,       "sps_video_parameter_set_id" );
     460#if H_MV
     461  if ( pcSPS->getLayerId() == 0 )
     462  {
     463#endif
    454464  WRITE_CODE( pcSPS->getMaxTLayers() - 1,  3,       "sps_max_sub_layers_minus1" );
    455465  WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0,                             "sps_temporal_id_nesting_flag" );
    456466  codePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1);
     467#if H_MV
     468}
     469#endif
    457470  WRITE_UVLC( pcSPS->getSPSId (),                   "sps_seq_parameter_set_id" );
    458471  WRITE_UVLC( pcSPS->getChromaFormatIdc (),         "chroma_format_idc" );
     
    565578  WRITE_FLAG( 1, "sps_extension_flag" );
    566579  WRITE_FLAG( pcSPS->getInterViewMvVertConstraintFlag() ? 1 : 0, "inter_view_mv_vert_constraint_flag" );
     580  ////   sps_extension_vui_parameters( )
     581  if( pcSPS->getVuiParameters()->getBitstreamRestrictionFlag() )
     582  { 
     583    WRITE_UVLC( pcSPS->getNumIlpRestrictedRefLayers( ),           "num_ilp_restricted_ref_layers" );
     584    for( Int i = 0; i < pcSPS->getNumIlpRestrictedRefLayers( ); i++ )
     585    { 
     586      WRITE_UVLC( pcSPS->getMinSpatialSegmentOffsetPlus1( i ),    "min_spatial_segment_offset_plus1" );
     587      if( pcSPS->getMinSpatialSegmentOffsetPlus1( i ) > 0 )
     588      { 
     589        WRITE_FLAG( pcSPS->getCtuBasedOffsetEnabledFlag( i ),      "ctu_based_offset_enabled_flag[ i ]");
     590        if( pcSPS->getCtuBasedOffsetEnabledFlag( i ) ) 
     591        {
     592          WRITE_UVLC( pcSPS->getMinHorizontalCtuOffsetPlus1( i ), "min_horizontal_ctu_offset_plus1[ i ]");
     593        }
     594      } 
     595    } 
     596  } 
     597  ////   sps_extension_vui_parameters( ) END
     598  WRITE_UVLC( 0, "sps_shvc_reserved_zero_idc" );
    567599#if !H_3D
    568600  WRITE_FLAG( 0, "sps_extension2_flag" );
     
    632664  assert( pcVPS->getNumHrdParameters() <= MAX_VPS_NUM_HRD_PARAMETERS );
    633665#if H_MV
    634   assert( pcVPS->getMaxNuhLayerId() < MAX_VPS_NUH_LAYER_ID_PLUS1 );
    635   WRITE_CODE( pcVPS->getMaxNuhLayerId(), 6,                 "vps_max_nuh_layer_id" );
     666  assert( pcVPS->getVpsMaxLayerId() < MAX_VPS_NUH_LAYER_ID_PLUS1 );
     667  WRITE_CODE( pcVPS->getVpsMaxLayerId(), 6,                 "vps_max_layer_id" ); 
     668 
     669  WRITE_UVLC( pcVPS->getVpsNumLayerSetsMinus1(),  "vps_max_num_layer_sets_minus1" );
     670  for( UInt opsIdx = 1; opsIdx <= pcVPS->getVpsNumLayerSetsMinus1(); opsIdx ++ )
     671  {
     672    // Operation point set
     673    for( UInt i = 0; i <= pcVPS->getVpsMaxLayerId(); i ++ )
     674    {
    636675#else
    637676  assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 );
    638677  WRITE_CODE( pcVPS->getMaxNuhReservedZeroLayerId(), 6,     "vps_max_nuh_reserved_zero_layer_id" );
    639 #endif
     678
    640679  pcVPS->setMaxOpSets(1);
    641680  WRITE_UVLC( pcVPS->getMaxOpSets() - 1,                    "vps_max_op_sets_minus1" );
     
    643682  {
    644683    // Operation point set
    645 #if H_MV
    646     for( UInt i = 0; i <= pcVPS->getMaxNuhLayerId(); i ++ )
    647 #else
    648684    for( UInt i = 0; i <= pcVPS->getMaxNuhReservedZeroLayerId(); i ++ )
    649 #endif
    650685    {
    651686      // Only applicable for version 1
    652687      pcVPS->setLayerIdIncludedFlag( true, opsIdx, i );
     688#endif
    653689      WRITE_FLAG( pcVPS->getLayerIdIncludedFlag( opsIdx, i ) ? 1 : 0, "layer_id_included_flag[opsIdx][i]" );
    654690    }
     
    701737  }
    702738
    703   for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes( ); sIdx++ )
     739  for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes( ) - ( pcVPS->getSplittingFlag() ? 1 : 0 ); sIdx++ )
    704740  {
    705741    WRITE_CODE( pcVPS->getDimensionIdLen( sIdx ) - 1 , 3,    "dimension_id_len_minus1[j]");   
    706742  }
    707743
     744  if ( pcVPS->getSplittingFlag() )
     745  { // Ignore old dimension id length
     746    pcVPS->setDimensionIdLen( pcVPS->getNumScalabilityTypes( ) - 1 ,pcVPS->inferLastDimsionIdLenMinus1() + 1 );       
     747  }   
     748
     749
    708750  WRITE_FLAG( pcVPS->getVpsNuhLayerIdPresentFlag() ? 1 : 0,  "vps_nuh_layer_id_present_flag");
    709751
    710   // already updated to JCT3V-D0220
    711   for( Int layer = 0; layer <= pcVPS->getMaxLayers() - 1; layer++ )
    712   {
    713     if ( ( layer != 0 ) && pcVPS->getVpsNuhLayerIdPresentFlag() )
    714       WRITE_CODE( pcVPS->getLayerIdInNuh( layer ), 6,          "layer_id_in_nuh[i]");
    715     for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes() ; sIdx++ )
     752  for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ )
     753  {
     754    if ( pcVPS->getVpsNuhLayerIdPresentFlag() && ( i > 0 ) )
    716755    {     
    717       WRITE_CODE( pcVPS->getDimensionId( layer, sIdx ), pcVPS->getDimensionIdLen( sIdx ), "dimension_id[i][j]");     
    718     }
    719   }
    720 
    721   for( Int layerSet = 1; layerSet <= pcVPS->getMaxOpSets() - 1; layerSet++ )
    722   {
    723     WRITE_FLAG( pcVPS->getVpsProfilePresentFlag( layerSet ) ? 1 : 0, "vps_profile_present_flag[lsIdx]" );
    724     if( pcVPS->getVpsProfilePresentFlag( layerSet ) == false )
    725     {
    726       WRITE_UVLC( pcVPS->getProfileLayerSetRefMinus1( layerSet ), "profile_layer_set_ref_minus1[lsIdx]" );
    727     }
    728     codePTL( pcVPS->getPTL( layerSet ), pcVPS->getVpsProfilePresentFlag( layerSet ), pcVPS->getMaxTLayers() - 1 );
    729   }
    730 
    731   WRITE_UVLC( pcVPS->getNumOutputLayerSets(),                "num_output_layer_sets" );
    732 
    733   for( Int layerSet = 0; layerSet < pcVPS->getNumOutputLayerSets(); layerSet++ )
    734   {
    735     WRITE_UVLC( pcVPS->getOutputLayerSetIdx( layerSet ),      "output_layer_set_idx[i]" );
    736     for( Int layer = 0; layer <= pcVPS->getMaxNuhLayerId(); layer++ )
    737     {
    738       if( pcVPS->getLayerIdIncludedFlag( pcVPS->getOutputLayerSetIdx( layerSet ), layer ) == true )
    739       {
    740         WRITE_FLAG( pcVPS->getOutputLayerFlag( layerSet, layer ) ? 1 : 0, "output_layer_flag" );
     756      WRITE_CODE( pcVPS->getLayerIdInNuh( i ), 6,          "layer_id_in_nuh[i]");
     757  }
     758    else
     759    {
     760      assert( pcVPS->getLayerIdInNuh( i ) == i );
     761  }
     762
     763    assert(  pcVPS->getLayerIdInVps( pcVPS->getLayerIdInNuh( i ) ) == i );
     764
     765    for( Int j = 0; j < pcVPS->getNumScalabilityTypes() ; j++ )
     766  {
     767      if ( !pcVPS->getSplittingFlag() )
     768    {
     769        WRITE_CODE( pcVPS->getDimensionId( i, j ), pcVPS->getDimensionIdLen( j ), "dimension_id[i][j]");     
     770      }
     771      else
     772      {
     773        assert( pcVPS->getDimensionId( i, j ) ==  pcVPS->inferDimensionId( i, j )  );
    741774      }
    742775    }
     
    750783    }
    751784  }
     785
     786  for( Int i = 0; i < pcVPS->getMaxLayers() - 1; i++ )
     787  {
     788    WRITE_CODE( pcVPS->getMaxTidIlRefPicPlus1( i ), 3,       "max_tid_il_ref_pics_plus1[i]" );
     789  }
     790
     791  WRITE_CODE( pcVPS->getVpsNumberLayerSetsMinus1( )    , 10,    "vps_number_layer_sets_minus1"      );
     792  WRITE_CODE( pcVPS->getVpsNumProfileTierLevelMinus1( ), 6,     "vps_num_profile_tier_level_minus1" );
     793
     794  for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ )
     795  {
     796    WRITE_FLAG( pcVPS->getVpsProfilePresentFlag( i ) ? 1 : 0, "vps_profile_present_flag[i]" );
     797    if( !pcVPS->getVpsProfilePresentFlag( i ) )
     798    {   
     799      WRITE_CODE( pcVPS->getProfileRefMinus1( i ), 6, "profile_ref_minus1[i]" );
     800    }
     801    codePTL( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers() - 1 );
     802  }
     803
     804  Int numOutputLayerSets = pcVPS->getVpsNumberLayerSetsMinus1( ) + 1;
     805
     806  WRITE_FLAG( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) ? 1 : 0, "more_output_layer_sets_than_default_flag" );
     807
     808  if ( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) )
     809  {
     810    WRITE_CODE( pcVPS->getNumAddOutputLayerSetsMinus1( )    , 10,    "num_add_output_layer_sets_minus1"      );
     811    numOutputLayerSets += ( pcVPS->getNumAddOutputLayerSetsMinus1( ) + 1 );
     812  }
     813
     814  if( numOutputLayerSets > 1)
     815  {
     816    WRITE_FLAG( pcVPS->getDefaultOneTargetOutputLayerFlag( ) ? 1 : 0, "default_one_target_output_layer_flag" );
     817  } 
     818
     819  for( Int i = 1; i < numOutputLayerSets; i++ )
     820  {
     821    if( i > pcVPS->getVpsNumberLayerSetsMinus1( ) )
     822    {     
     823      WRITE_UVLC( pcVPS->getOutputLayerSetIdxMinus1( i ),      "output_layer_set_idx_minus1[i]" );
     824      for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1 ; j++ )
     825      {
     826        WRITE_FLAG( pcVPS->getOutputLayerFlag( i, j) ? 1 : 0, "output_layer_flag" );
     827      }     
     828    }
     829    if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
     830    {     
     831      WRITE_CODE( pcVPS->getProfileLevelTierIdx( i ), pcVPS->getProfileLevelTierIdxLen() ,"profile_level_tier_idx[ i ]" );   
     832    }
     833  }
     834
     835  WRITE_FLAG( pcVPS->getMaxOneActiveRefLayerFlag( ) ? 1 : 0, "max_one_active_ref_layer_flag" );
     836  WRITE_UVLC( pcVPS->getDirectDepTypeLenMinus2 ( ),         "direct_dep_type_len_minus2");
     837
     838    for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ )
     839    {
     840      for( Int j = 0; j < i; j++ )
     841      {
     842        if (pcVPS->getDirectDependencyFlag( i, j) )
     843        {       
     844          assert ( pcVPS->getDirectDependencyType( i, j ) != -1 );
     845          WRITE_CODE( pcVPS->getDirectDependencyType( i, j ),pcVPS->getDirectDepTypeLenMinus2( ) + 2,  "direct_dependency_type[i][j]" );
     846        }
     847      }
     848    }
     849
     850    WRITE_FLAG ( 0,                    "vps_shvc_reserved_zero_flag" );
     851
    752852#if H_3D_GEN 
    753853  WRITE_FLAG( 1,                                             "vps_extension2_flag" );
     
    811911Void TEncCavlc::codeSliceHeader         ( TComSlice* pcSlice )
    812912{
     913#if H_MV
     914  TComVPS* vps = pcSlice->getVPS();
     915#endif
    813916#if ENC_DEC_TRACE 
    814917  xTraceSliceHeader (pcSlice);
     
    853956  if ( !pcSlice->getDependentSliceSegmentFlag() )
    854957  {
     958#if H_MV   
     959    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
     960    {
     961      WRITE_FLAG( pcSlice->getDiscardableFlag( ) ? 1 : 0 , "discardable_flag" );
     962    }
     963
     964    for (Int i = 1; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)   
     965#else
    855966    for (Int i = 0; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
     967#endif
    856968    {
    857969      assert(!!"slice_reserved_undetermined_flag[]");
     
    10161128      }
    10171129    }
     1130#if H_MV
     1131    Int layerIdInVps       = pcSlice->getLayerIdInVps();
     1132    if( pcSlice->getLayerId() > 0 && vps->getNumDirectRefLayers( layerIdInVps ) > 0 )
     1133    {   
     1134      WRITE_FLAG( pcSlice->getInterLayerPredEnabledFlag( ) ? 1 : 0 , "inter_layer_pred_enabled_flag" );
     1135      if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerIdInVps ) > 1 )
     1136      {           
     1137        if( !vps->getMaxOneActiveRefLayerFlag()) 
     1138        {
     1139          WRITE_CODE( pcSlice->getNumInterLayerRefPicsMinus1( ), pcSlice->getNumInterLayerRefPicsMinus1Len( ), "num_inter_layer_ref_pics_minus1" );
     1140        }
     1141        for( Int i = 0; i < pcSlice->getNumActiveRefLayerPics(); i++ )   
     1142        {
     1143          WRITE_CODE( pcSlice->getInterLayerPredLayerIdc( i ), pcSlice->getInterLayerPredLayerIdcLen( ), "inter_layer_pred_layer_idc" );
     1144        }
     1145      } 
     1146    }
     1147
     1148    if( vps->getNumSamplePredRefLayers( layerIdInVps ) > 0  &&  pcSlice->getNumActiveRefLayerPics() > 0 )
     1149    {
     1150      WRITE_FLAG( pcSlice->getInterLayerSamplePredOnlyFlag( ) ? 1 : 0 , "inter_layer_sample_pred_only_flag" );
     1151    }
     1152
     1153#endif
    10181154    if(pcSlice->getSPS()->getUseSAO())
    10191155    {
     
    11231259    if ( pcSlice->getEnableTMVPFlag() )
    11241260    {
     1261#if H_MV
     1262      if( pcSlice->getLayerId() > 0 && pcSlice->getNumActiveMotionPredRefLayers() > 0 )
     1263      {
     1264        WRITE_FLAG( pcSlice->getAltCollocatedIndicationFlag( ) ? 1 : 0 , "alt_collocated_indication_flag" );
     1265      }
     1266      if( pcSlice->getAltCollocatedIndicationFlag() && pcSlice->getNumActiveMotionPredRefLayers() > 1 )
     1267      {         
     1268        WRITE_UVLC( pcSlice->getCollocatedRefLayerIdx( ), "collocated_ref_layer_idx" );
     1269      }     
     1270      else
     1271      {
     1272#endif
    11251273      if ( pcSlice->getSliceType() == B_SLICE )
    11261274      {
     
    11351283      }
    11361284    }
     1285#if H_MV
     1286    }
     1287#endif
    11371288    if ( (pcSlice->getPPS()->getUseWP() && pcSlice->getSliceType()==P_SLICE) || (pcSlice->getPPS()->getWPBiPred() && pcSlice->getSliceType()==B_SLICE) )
    11381289    {
Note: See TracChangeset for help on using the changeset viewer.