Changeset 964 in 3DVCSoftware for trunk/source/Lib/TLibEncoder


Ignore:
Timestamp:
5 Jul 2014, 05:16:45 (11 years ago)
Author:
tech
Message:
  • Merged 11.0-dev0@963. (Update to HM 14.0 + MV-HEVC Draft 8 HLS)
  • Added coding results.
  • Changed version number.
Location:
trunk/source/Lib/TLibEncoder
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibEncoder/AnnexBwrite.h

    r872 r964  
    5858
    5959    static const Char start_code_prefix[] = {0,0,0,1};
    60     if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_PPS)
     60    if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_VPS || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_PPS)
    6161    {
    6262      /* From AVC, When any of the following conditions are fulfilled, the
  • trunk/source/Lib/TLibEncoder/NALwrite.cpp

    r884 r964  
    9191  vector<uint8_t>& rbsp   = nalu.m_Bitstream.getFIFO();
    9292
    93 #if H_MV  // This will handle situation when writing NAL with zero payload
    94   if (rbsp.size() == 0) return;
    95 #endif
     93  if (rbsp.size() == 0)
     94  {
     95    return;
     96  }
    9697
    9798  for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();)
  • trunk/source/Lib/TLibEncoder/SEIwrite.cpp

    r884 r964  
    267267Void SEIWriter::xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei)
    268268{
    269   WRITE_CODE(sei.activeVPSId,     4, "active_vps_id");
    270   WRITE_FLAG(sei.m_fullRandomAccessFlag, "full_random_access_flag");
    271   WRITE_FLAG(sei.m_noParamSetUpdateFlag, "no_param_set_update_flag");
     269  WRITE_CODE(sei.activeVPSId,     4,         "active_video_parameter_set_id");
     270  WRITE_FLAG(sei.m_selfContainedCvsFlag,     "self_contained_cvs_flag");
     271  WRITE_FLAG(sei.m_noParameterSetUpdateFlag, "no_parameter_set_update_flag");
    272272  WRITE_UVLC(sei.numSpsIdsMinus1,    "num_sps_ids_minus1");
    273273
    274   assert (sei.activeSeqParamSetId.size() == (sei.numSpsIdsMinus1 + 1));
    275 
    276   for (Int i = 0; i < sei.activeSeqParamSetId.size(); i++)
    277   {
    278     WRITE_UVLC(sei.activeSeqParamSetId[i], "active_seq_param_set_id");
    279   }
    280 
    281   UInt uiBits = m_pcBitIf->getNumberOfWrittenBits();
    282   UInt uiAlignedBits = ( 8 - (uiBits&7) ) % 8; 
    283   if(uiAlignedBits)
    284   {
    285     WRITE_FLAG(1, "alignment_bit" );
    286     uiAlignedBits--;
    287     while(uiAlignedBits--)
    288     {
    289       WRITE_FLAG(0, "alignment_bit" );
    290     }
    291   }
     274  assert (sei.activeSeqParameterSetId.size() == (sei.numSpsIdsMinus1 + 1));
     275
     276  for (Int i = 0; i < sei.activeSeqParameterSetId.size(); i++)
     277    {
     278    WRITE_UVLC(sei.activeSeqParameterSetId[i], "active_seq_parameter_set_id");
     279  }
     280  xWriteByteAlign();
    292281}
    293282
     
    478467        {
    479468          WRITE_CODE( sei.m_cameraIsoSpeedValue,    32,    "camera_iso_speed_value" );
     469        }
     470        WRITE_CODE( sei.m_exposureIndexIdc,     8,    "exposure_index_idc" );
     471        if( sei.m_exposureIndexIdc == 255) //Extended_ISO
     472        {
     473          WRITE_CODE( sei.m_exposureIndexValue,     32,    "exposure_index_value" );
    480474        }
    481475        WRITE_FLAG( sei.m_exposureCompensationValueSignFlag,           "exposure_compensation_value_sign_flag" );
  • trunk/source/Lib/TLibEncoder/TEncCavlc.cpp

    r950 r964  
    140140    WRITE_UVLC( rps->getNumberOfNegativePictures(), "num_negative_pics" );
    141141    WRITE_UVLC( rps->getNumberOfPositivePictures(), "num_positive_pics" );
     142
    142143    Int prev = 0;
    143144    for(Int j=0 ; j < rps->getNumberOfNegativePictures(); j++)
     
    276277        pcPPS->getLayerId() != 1  )
    277278    {
    278         pcPPS->setPpsExtensionTypeFlag( PPS_EX_T_3D, false );
     279#if H_MV_HLS_8_SPS_NODOC_48
     280      pcPPS->setPps3dExtensionFlag( false );
     281#else
     282      pcPPS->setPpsExtensionTypeFlag( PPS_EX_T_3D, false );
     283#endif
    279284    }
    280285  #endif
     
    283288  WRITE_FLAG( 0, "pps_extension_flag" );
    284289#else
    285   WRITE_FLAG( 1, "pps_extension_flag" );
    286 
     290  WRITE_FLAG( 1, "pps_extension_present_flag" );
     291
     292#if H_MV_HLS_8_SPS_NODOC_48
     293    WRITE_FLAG( pcPPS->getPpsRangeExtensionsFlag( ) ? 1 : 0 , "pps_range_extensions_flag" );
     294    WRITE_FLAG( pcPPS->getPpsMultilayerExtensionFlag( ) ? 1 : 0 , "pps_multilayer_extension_flag" );
     295#if !H_3D
     296    WRITE_CODE( pcPPS->getPpsExtension6bits( ), 6, "pps_extension_6bits" );
     297#else
     298    WRITE_FLAG( pcPPS->getPps3dExtensionFlag( ) ? 1 : 0 , "pps_3d_extension_flag" );
     299    WRITE_CODE( pcPPS->getPpsExtension5bits( ), 5, "pps_extension_5bits" );
     300#endif
     301    if ( pcPPS->getPpsRangeExtensionsFlag() )
     302    {
     303      assert(0);
     304    }
     305
     306    if ( pcPPS->getPpsMultilayerExtensionFlag() )
     307    {
     308      WRITE_FLAG( pcPPS->getPocResetInfoPresentFlag( ) ? 1 : 0 , "poc_reset_info_present_flag" );
     309#if H_MV_HLS_8_PPS_NODOC_NN
     310      WRITE_FLAG( 0, "pps_extension_reserved_zero_flag" );
     311#endif
     312    }
     313
     314#if H_3D
     315    if( pcPPS->getPps3dExtensionFlag( )  ) // This probably needs to be aligned with Rext and SHVC
     316    {
     317      codePPSExtension( pcPPS );
     318    }
     319#endif
     320#else
    287321  for ( Int i = 0; i < PPS_EX_T_MAX_NUM; i++ )
    288322  {
     
    305339    codePPSExtension( pcPPS );
    306340  }
     341#endif
    307342#endif
    308343
     
    822857  WRITE_FLAG( 0, "sps_extension_flag" );
    823858#else
    824   WRITE_FLAG( pcSPS->getSpsExtensionFlag(), "sps_extension_flag" );
    825 
    826   if ( pcSPS->getSpsExtensionFlag() )
    827   {
     859  WRITE_FLAG( pcSPS->getSpsExtensionPresentFlag(), "sps_extension_present_flag" );
     860
     861  if ( pcSPS->getSpsExtensionPresentFlag() )
     862  {
     863#if H_MV_HLS_8_SPS_NODOC_48
     864    WRITE_FLAG( pcSPS->getSpsRangeExtensionsFlag( ) ? 1 : 0 , "sps_range_extensions_flag" );
     865    WRITE_FLAG( pcSPS->getSpsMultilayerExtensionFlag( ) ? 1 : 0 , "sps_multilayer_extension_flag" );
     866#if !H_3D
     867    WRITE_CODE( pcSPS->getSpsExtension6bits( ), 6, "sps_extension_6bits" );
     868#else
     869    WRITE_FLAG( pcSPS->getSps3dExtensionFlag( ) ? 1 : 0 , "sps_3d_extension_flag" );
     870    WRITE_CODE( pcSPS->getSpsExtension5bits( ), 5, "sps_extension_5bits" );
     871#endif
     872 }
     873
     874  if ( pcSPS->getSpsRangeExtensionsFlag() )
     875  {
     876    assert( 0 );
     877  }
     878
     879  if ( pcSPS->getSpsMultilayerExtensionFlag() )
     880  {
     881    codeSPSExtension( pcSPS );
     882  }
     883
     884#if H_3D
     885  if ( pcSPS->getSps3dExtensionFlag() )
     886  {
     887    codeSPSExtension2( pcSPS, viewIndex, depthFlag  );
     888  }
     889
     890#endif
     891#else
    828892    for (Int i = 0; i < PS_EX_T_MAX_NUM; i++)
    829893    {
     
    848912#endif
    849913  }
     914#endif
    850915#endif
    851916}
     
    890955{
    891956  WRITE_CODE( pcVPS->getVPSId(),                    4,        "vps_video_parameter_set_id" );
     957#if H_MV_HLS_8_SYN_Q0041_03
     958  WRITE_FLAG( pcVPS->getVpsBaseLayerInternalFlag( ) ? 1 : 0 , "vps_base_layer_internal_flag" );
     959  WRITE_FLAG( 1                                             , "vps_reserved_one_bit" );
     960#else
    892961  WRITE_CODE( 3,                                    2,        "vps_reserved_three_2bits" );
     962#endif
    893963#if H_MV
    894964  WRITE_CODE( pcVPS->getMaxLayersMinus1(),       6,        "vps_max_layers_minus1" );
     
    9721042  }
    9731043#if H_MV
     1044#if H_MV_HLS_8_RPS_Q0100_36
     1045  WRITE_FLAG( pcVPS->getVpsExtensionFlag(),                     "vps_extension_flag" );
     1046#else
    9741047  WRITE_FLAG( 1,                     "vps_extension_flag" );
     1048#endif
    9751049  m_pcBitIf->writeAlignOne();
    9761050  codeVPSExtension( pcVPS );                           
     
    9961070Void TEncCavlc::codeVPSExtension( TComVPS *pcVPS )
    9971071{
     1072 
     1073#if !H_MV_HLS_8_SYN_Q0041_03
    9981074  WRITE_FLAG( pcVPS->getAvcBaseLayerFlag() ? 1 : 0,          "avc_base_layer_flag" );
     1075#endif
     1076
    9991077  WRITE_FLAG( pcVPS->getSplittingFlag() ? 1 : 0,             "splitting_flag" );
    10001078
     
    10101088
    10111089  if ( pcVPS->getSplittingFlag() )
    1012   { // Ignore old dimension id length
     1090  {
    10131091    pcVPS->setDimensionIdLen( pcVPS->getNumScalabilityTypes( ) - 1 ,pcVPS->inferLastDimsionIdLenMinus1() + 1 );       
    10141092  }   
     
    10421120  }
    10431121
    1044 
    10451122  WRITE_CODE( pcVPS->getViewIdLen( ), 4, "view_id_len" );
    10461123
     
    10681145    }
    10691146  }
     1147
    10701148  WRITE_FLAG( pcVPS->getVpsSubLayersMaxMinus1PresentFlag( ) ? 1 : 0 , "vps_sub_layers_max_minus1_present_flag" );
    10711149  if ( pcVPS->getVpsSubLayersMaxMinus1PresentFlag() )
     
    11091187  }
    11101188
    1111   WRITE_UVLC( pcVPS->getNumAddOutputLayerSets( ), "num_add_output_layer_sets" );
     1189#if H_MV_HLS_8_SYN_39_19
     1190  if ( pcVPS->getNumIndependentLayers() > 1 )
     1191  {
     1192   WRITE_UVLC( pcVPS->getNumAddLayerSets( ), "num_add_layer_sets" );
     1193  }
     1194  for (Int i = 0; i < pcVPS->getNumAddLayerSets(); i++)
     1195  {
     1196    for (Int j = 0; j < pcVPS->getNumIndependentLayers(); j++)
     1197    {
     1198      WRITE_CODE( pcVPS->getHighestLayerIdxPlus1( i, j ), pcVPS->getHighestLayerIdxPlus1Len( j )  , "highest_layer_idx_plus1" );
     1199    }
     1200  }
     1201  if (pcVPS->getNumLayerSets() > 1)
     1202  {
     1203    WRITE_UVLC( pcVPS->getNumAddOlss( ), "num_add_olss" );
     1204    WRITE_CODE( pcVPS->getDefaultOutputLayerIdc( ), 2, "default_output_layer_idc" );
     1205  }
     1206#else
     1207  WRITE_UVLC( pcVPS->getNumAddLayerSets( ), "num_add_layer_sets" );
    11121208
    11131209  if( pcVPS->getNumOutputLayerSets() > 1)
    11141210  {
    1115     WRITE_CODE( pcVPS->getDefaultTargetOutputLayerIdc( ), 2, "default_target_output_layer_idc" );
     1211    WRITE_CODE( pcVPS->getDefaultOutputLayerIdc( ), 2, "default_output_layer_idc" );
    11161212  } 
    1117 
     1213#endif
    11181214
    11191215  assert( pcVPS->getOutputLayerFlag(0, 0) == pcVPS->inferOutputLayerFlag( 0, 0 ));
    1120   assert( pcVPS->getOutputLayerSetIdxMinus1( 0 ) == -1 );
     1216  assert( pcVPS->getLayerSetIdxForOlsMinus1( 0 ) == -1 );
     1217
     1218
     1219
    11211220
    11221221  for( Int i = 1; i < pcVPS->getNumOutputLayerSets( ); i++ )
    11231222  {
     1223#if H_MV_HLS_8_SYN_39_19
     1224    if( i >= pcVPS->getNumLayerSets( ) )   
     1225#else
    11241226    if( i > pcVPS->getVpsNumLayerSetsMinus1( ) )   
     1227#endif
    11251228    {     
    1126       WRITE_UVLC( pcVPS->getOutputLayerSetIdxMinus1( i ),      "output_layer_set_idx_minus1[i]" );
    1127     }
    1128 
    1129     if ( i > pcVPS->getVpsNumLayerSetsMinus1() || pcVPS->getDefaultTargetOutputLayerIdc() == 2 )
     1229      WRITE_UVLC( pcVPS->getLayerSetIdxForOlsMinus1( i ),      "layer_set_idx_for_ols_minus1[i]" );
     1230    }
     1231
     1232    if ( i > pcVPS->getVpsNumLayerSetsMinus1() || pcVPS->getDefaultOutputLayerIdc() == 2 )
    11301233    {       
    1131       for( Int j = 0; j < pcVPS->getNumLayersInIdList( pcVPS->getLayerSetIdxForOutputLayerSet( i ) ); j++ )
     1234      for( Int j = 0; j < pcVPS->getNumLayersInIdList( pcVPS->olsIdxToLsIdx( i ) ); j++ )
    11321235      {
    11331236        WRITE_FLAG( pcVPS->getOutputLayerFlag( i, j) ? 1 : 0, "output_layer_flag" );
     
    11361239    else
    11371240    {
    1138       for( Int j = 0; j < pcVPS->getNumLayersInIdList( pcVPS->getLayerSetIdxForOutputLayerSet( i ) ) - 1; j++ )
     1241      for( Int j = 0; j < pcVPS->getNumLayersInIdList( pcVPS->olsIdxToLsIdx( i ) ) - 1; j++ )
    11391242      {             
    11401243        assert( pcVPS->getOutputLayerFlag( i , j ) == pcVPS->inferOutputLayerFlag( i, j ));
    11411244      }
    11421245    }       
     1246
    11431247
    11441248    if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
     
    11521256  }
    11531257
     1258#if !H_MV_HLS_8_PMS_Q0195_20
    11541259  WRITE_FLAG( pcVPS->getRepFormatIdxPresentFlag( ) ? 1 : 0 , "rep_format_idx_present_flag" );
    11551260  if ( pcVPS->getRepFormatIdxPresentFlag() )
     
    11571262    WRITE_UVLC( pcVPS->getVpsNumRepFormatsMinus1( ), "vps_num_rep_formats_minus1" );
    11581263  }
     1264#else
     1265  WRITE_UVLC( pcVPS->getVpsNumRepFormatsMinus1( ), "vps_num_rep_formats_minus1" );
     1266#endif
    11591267
    11601268  for (Int i = 0; i <= pcVPS->getVpsNumRepFormatsMinus1(); i++ )
    11611269  {   
     1270
    11621271    TComRepFormat* curRepFormat = pcVPS->getRepFormat(i);     
    11631272    TComRepFormat* prevRepFormat = i > 0 ? pcVPS->getRepFormat( i - 1) : NULL;
    11641273    codeRepFormat( i, curRepFormat ,  prevRepFormat);
    1165   }
    1166 
     1274
     1275  }
     1276
     1277#if H_MV_HLS_8_PMS_Q0195_20
     1278  if ( pcVPS->getVpsNumRepFormatsMinus1() > 0 )
     1279  {
     1280    WRITE_FLAG( pcVPS->getRepFormatIdxPresentFlag( ) ? 1 : 0 , "rep_format_idx_present_flag" );
     1281  }
     1282#endif
    11671283  if( pcVPS->getRepFormatIdxPresentFlag() )
    11681284  {
     1285#if H_MV_HLS_8_SYN_Q0041_03
     1286    for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 1 : 0; i <=  pcVPS->getMaxLayersMinus1(); i++ )
     1287#else
    11691288    for( Int i = 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
    1170     {
     1289#endif
     1290    {
     1291#if !H_MV_HLS_8_PMS_Q0195_20
    11711292      if( pcVPS->getVpsNumRepFormatsMinus1() > 0 )
    11721293      {
     1294#endif
    11731295        WRITE_CODE( pcVPS->getVpsRepFormatIdx(i), pcVPS->getVpsRepFormatIdxLen(), "vps_rep_format_idx[i]" );
    1174       }
    1175     }
    1176   }
     1296#if !H_MV_HLS_8_PMS_Q0195_20
     1297      }
     1298#endif
     1299    }
     1300  }
     1301#if H_MV_HLS_8_PMS_Q0195_20
     1302  else
     1303  {
     1304#if H_MV_HLS_8_SYN_Q0041_03
     1305    for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 1 : 0; i <=  pcVPS->getMaxLayersMinus1(); i++ )
     1306#else
     1307    for( Int i = 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
     1308#endif
     1309    {
     1310      assert( pcVPS->getVpsRepFormatIdx( i ) ==  pcVPS->inferVpsRepFormatIdx( i ) );
     1311    }
     1312  }
     1313#endif
     1314
    11771315
    11781316  WRITE_FLAG( pcVPS->getMaxOneActiveRefLayerFlag( ) ? 1 : 0, "max_one_active_ref_layer_flag" );
     
    11871325    }
    11881326  }
     1327
    11891328  WRITE_FLAG( 0, "vps_reserved_zero_flag" );
    11901329  codeDpbSize( pcVPS );
     
    11931332
    11941333  WRITE_FLAG( pcVPS->getDefaultDirectDependencyFlag( ) ? 1 : 0 , "default_direct_dependency_flag" );
    1195 
    11961334  if ( pcVPS->getDefaultDirectDependencyFlag( ) )
    11971335  { 
     
    11991337  }
    12001338
     1339#if H_MV_HLS_8_SYN_Q0041_03
     1340  for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ?  1 : 2; i <= pcVPS->getMaxLayersMinus1(); i++ )
     1341  {
     1342    for( Int j = pcVPS->getVpsBaseLayerInternalFlag() ?  0 : 1; j < i; j++ )
     1343#else
    12011344  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
    12021345  {
    12031346    for( Int j = 0; j < i; j++ )
     1347#endif
    12041348    {
    12051349      if (pcVPS->getDirectDependencyFlag( i, j) )
     
    12181362  } 
    12191363  WRITE_UVLC( 0, "vps_non_vui_extension_length" );
    1220   WRITE_FLAG( pcVPS->getVpsVuiPresentFlag() ? 1 : 0 , "vps_vui_present_flag" );
     1364 
     1365
     1366
     1367
     1368WRITE_FLAG( pcVPS->getVpsVuiPresentFlag() ? 1 : 0 , "vps_vui_present_flag" );
    12211369  if( pcVPS->getVpsVuiPresentFlag() )
    12221370  {
     
    12291377    pcVPSVUI->inferVpsVui( true );
    12301378  }
     1379
    12311380}
    12321381
     
    12481397  for( Int i = 1; i < vps->getNumOutputLayerSets(); i++ )
    12491398  { 
     1399#if H_MV_HLS_8_MIS_Q0102_30
     1400    Int currLsIdx = vps->olsIdxToLsIdx( i );
     1401#endif
    12501402    WRITE_FLAG( dpbSize->getSubLayerFlagInfoPresentFlag( i ) ? 1 : 0 , "sub_layer_flag_info_present_flag" );
     1403#if H_MV_HLS_8_MIS_Q0102_30
     1404    for( Int j = 0; j  <=  vps->getMaxSubLayersInLayerSetMinus1( currLsIdx ); j++ )
     1405#else
    12511406    for( Int j = 0; j  <=  vps->getMaxSubLayersInLayerSetMinus1( i ); j++ )
     1407#endif
    12521408    { 
    12531409      if( j > 0  &&  dpbSize->getSubLayerDpbInfoPresentFlag( i, j )  ) 
     
    12571413      if( dpbSize->getSubLayerDpbInfoPresentFlag( i, j ) )
    12581414      { 
    1259         for( Int k = 0; k < vps->getNumSubDpbs( vps->getLayerSetIdxForOutputLayerSet( i )); k++ )   
     1415#if H_MV_HLS_8_MIS_Q0102_30
     1416        for( Int k = 0; k < vps->getNumLayersInIdList( currLsIdx ); k++ )   
     1417#else
     1418        for( Int k = 0; k < vps->getNumSubDpbs( vps->olsIdxToLsIdx( i )); k++ )   
     1419#endif
    12601420        {
    12611421          WRITE_UVLC( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ), "max_vps_dec_pic_buffering_minus1" );
    12621422        }
    12631423        WRITE_UVLC( dpbSize->getMaxVpsNumReorderPics( i, j ), "max_vps_num_reorder_pics" );
    1264 #if H_MV_HLS7_GEN
    1265         if( vps->getNumSubDpbs( vps->getLayerSetIdxForOutputLayerSet( i ) ) != vps->getNumLayersInIdList( vps->getLayerSetIdxForOutputLayerSet( i ) ) )
    1266         {
    1267           for( Int k = 0; k < vps->getNumLayersInIdList( vps->getLayerSetIdxForOutputLayerSet( i ) ); k++ )
    1268           {
    1269             WRITE_UVLC( dpbSize->getMaxVpsLayerDecPicBuffMinus1( i, k, j ), "max_vps_layer_dec_pic_buff_minus1" );
    1270           }
    1271         }
    1272 #endif
    12731424        WRITE_UVLC( dpbSize->getMaxVpsLatencyIncreasePlus1( i, j ), "max_vps_latency_increase_plus1" );
    12741425      }
     
    12771428        if ( j > 0 )
    12781429        {
    1279           for( Int k = 0; k < vps->getNumSubDpbs( vps->getLayerSetIdxForOutputLayerSet( i ) ); k++ )   
     1430#if H_MV_HLS_8_DBP_NODOC_42
     1431          for( Int k = 0; k < vps->getNumLayersInIdList( vps->olsIdxToLsIdx( i ) ); k++ )   
     1432#else
     1433          for( Int k = 0; k < vps->getNumSubDpbs( vps->olsIdxToLsIdx( i ) ); k++ )   
     1434#endif
    12801435          {
    12811436            assert( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ) == dpbSize->getMaxVpsDecPicBufferingMinus1( i,k, j - 1 ) );
     
    12851440        }
    12861441      }
    1287     }       
    1288   } 
     1442    }
     1443  }
    12891444}
    12901445
     
    13241479  assert( pcVPSVUI );
    13251480
     1481
    13261482  WRITE_FLAG( pcVPSVUI->getCrossLayerPicTypeAlignedFlag( ) ? 1 : 0 , "cross_layer_pic_type_aligned_flag" );
    13271483  if ( !pcVPSVUI->getCrossLayerPicTypeAlignedFlag() )
     
    13371493  if( pcVPSVUI->getBitRatePresentVpsFlag( )  ||  pcVPSVUI->getPicRatePresentVpsFlag( ) )
    13381494  {
     1495#if H_MV_HLS_8_SYN_Q0041_03
     1496    for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i  <=  pcVPS->getVpsNumLayerSetsMinus1(); i++ )
     1497#else
    13391498    for( Int i = 0; i  <=  pcVPS->getVpsNumLayerSetsMinus1(); i++ )
    1340     {
     1499#endif
     1500    {
     1501#if H_MV_HLS_8_MIS_Q0102_30
     1502      for( Int j = 0; j  <=  pcVPS->getMaxSubLayersInLayerSetMinus1( i ); j++ )
     1503#else         
    13411504      for( Int j = 0; j  <=  pcVPS->getMaxTLayers(); j++ )
     1505#endif
    13421506      {
    13431507        if( pcVPSVUI->getBitRatePresentVpsFlag( ) )
     
    13991563  if( !pcVPSVUI->getTilesNotInUseFlag() )
    14001564  {     
     1565#if H_MV_HLS_8_SYN_Q0041_03
     1566    for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
     1567#else
    14011568    for( Int i = 0; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
     1569#endif
    14021570    {
    14031571      WRITE_FLAG( pcVPSVUI->getTilesInUseFlag( i ) ? 1 : 0 , "tiles_in_use_flag[i]" );
     
    14071575      }
    14081576    } 
    1409 
     1577#if H_MV_HLS_8_SYN_Q0041_03
     1578    for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 1 : 2; i  <=  pcVPS->getMaxLayersMinus1(); i++ ) 
     1579#else
    14101580    for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ ) 
     1581#endif
    14111582    {
    14121583      for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ) ; j++ )
     
    14391610      for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ); j++ )
    14401611      {
     1612#if H_MV_HLS_8_SYN_Q0041_03
     1613        if( pcVPS->getVpsBaseLayerInternalFlag() || pcVPS->getRefLayerId( pcVPS->getLayerIdInNuh( i ), j ) > 0 )
     1614        {       
     1615#endif
    14411616        WRITE_UVLC( pcVPSVUI->getMinSpatialSegmentOffsetPlus1( i, j ), "min_spatial_segment_offset_plus1" );
    14421617        if( pcVPSVUI->getMinSpatialSegmentOffsetPlus1( i, j ) > 0 )
     
    14481623          }
    14491624        }
     1625#if H_MV_HLS_8_SYN_Q0041_03
     1626        }
     1627#endif
    14501628      }
    14511629    }
     
    14951673    for( Int i = 0; i < vpsVuiBspHrdP->getNumBitstreamPartitions( h ); i++ ) 
    14961674    {
     1675#if H_MV_HLS_8_HRD_Q0101_04
     1676      for( Int j = 0; j < pcVPS->getNumLayersInIdList( h ); j++ ) 
     1677      {
     1678        WRITE_FLAG( vpsVuiBspHrdP->getLayerInBspFlag( h, i, j ) ? 1 : 0 , "layer_in_bsp_flag" );
     1679#else
    14971680      for( Int j = 0; j <= pcVPS->getMaxLayersMinus1(); j++ ) 
    14981681      {
     
    15051688          vpsVuiBspHrdP->setLayerInBspFlag( h, i, j, false ); // This inference seems to be missing in spec
    15061689        }
     1690#endif
    15071691      }
    15081692    }
     
    15101694
    15111695    if( vpsVuiBspHrdP->getNumBitstreamPartitions( h ) )
    1512     { 
    1513       WRITE_UVLC( vpsVuiBspHrdP->getNumBspSchedCombinations( h ), "num_bsp_sched_combinations" );
    1514       for( Int i = 0; i < vpsVuiBspHrdP->getNumBspSchedCombinations( h ); i++ )
     1696    {
     1697      WRITE_UVLC( vpsVuiBspHrdP->getNumBspSchedCombinationsMinus1( h ), "num_bsp_sched_combinations_minus1" );
     1698#if H_MV_HLS_8_HRD_Q0182_05
     1699      for( Int i = 0; i <= vpsVuiBspHrdP->getNumBspSchedCombinationsMinus1( h ); i++ )
     1700#else
     1701      for( Int i = 0; i < vpsVuiBspHrdP->getNumBspSchedCombinationsMinus1( h ); i++ )
     1702#endif
    15151703      {
    15161704        for( Int j = 0; j < vpsVuiBspHrdP->getNumBitstreamPartitions( h ); j++ )
    15171705        { 
     1706#if H_MV_HLS_8_HRD_Q0101_04
     1707          WRITE_CODE( vpsVuiBspHrdP->getBspCombHrdIdx( h, i, j ),  vpsVuiBspHrdP->getBspCombHrdIdxLen(), "bsp_comb_hrd_idx" );
     1708#else
    15181709          WRITE_UVLC( vpsVuiBspHrdP->getBspCombHrdIdx( h, i, j ), "bsp_comb_hrd_idx" );
     1710#endif
    15191711          WRITE_UVLC( vpsVuiBspHrdP->getBspCombSchedIdx( h, i, j ), "bsp_comb_sched_idx" );
     1712
     1713#if H_MV_HLS_8_HRD_Q0101_04
     1714          vpsVuiBspHrdP->checkBspCombHrdAndShedIdx( pcVPS, h, i, j );
     1715#endif
    15201716        } 
    15211717      }
     
    16361832  if ( pcSlice->getRapPicFlag() )
    16371833  {
     1834#if SETTING_NO_OUT_PIC_PRIOR
     1835    WRITE_FLAG( pcSlice->getNoOutputPriorPicsFlag() ? 1 : 0, "no_output_of_prior_pics_flag" );
     1836#else
    16381837    WRITE_FLAG( 0, "no_output_of_prior_pics_flag" );
     1838#endif
    16391839  }
    16401840#if PPS_FIX_DEPTH
     
    17071907      Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1);
    17081908      WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "slice_pic_order_cnt_lsb");
    1709     }
     1909#if H_MV_HLS_8_POC_Q0142_32
     1910      pcSlice->setSlicePicOrderCntLsb( picOrderCntLSB );
     1911#endif
     1912    }
     1913
    17101914#endif
    17111915    if( !pcSlice->getIdrPicFlag() )
     
    21372341    }
    21382342
     2343#if H_MV_HLS_8_POC_Q0142_32
     2344    pcSlice->checkPocResetIdc();
     2345#endif
     2346
    21392347    if( pcSlice->getPocResetIdc() !=  0 )
    21402348    {
     
    21472355      WRITE_CODE( pcSlice->getPocLsbVal( ), pcSlice->getPocLsbValLen() , "poc_lsb_val" );
    21482356    }             
    2149    
     2357#if H_MV_HLS_8_POC_Q0142_32
     2358    pcSlice->checkPocLsbVal();
     2359#endif
     2360
    21502361    if( !pcSlice->getPocMsbValRequiredFlag() /* TODO &&  pcSlice->getVPS()->getVpsPocLsbAlignedFlag() */ )
    21512362    {
    21522363      WRITE_FLAG( pcSlice->getPocMsbValPresentFlag( ) ? 1 : 0 , "poc_msb_val_present_flag" );
    21532364    }
     2365#if H_MV_HLS_8_POC_Q0146_15
     2366    else
     2367    {
     2368      assert( pcSlice->getPocMsbValPresentFlag() ==  pcSlice->inferPocMsbValPresentFlag( ) );
     2369    }
     2370#endif
    21542371   
    21552372    if( pcSlice->getPocMsbValPresentFlag() )
  • trunk/source/Lib/TLibEncoder/TEncCfg.h

    r950 r964  
    256256  Int       m_cameraIsoSpeedIdc;
    257257  Int       m_cameraIsoSpeedValue;
     258  Int       m_exposureIndexIdc;
     259  Int       m_exposureIndexValue;
    258260  Int       m_exposureCompensationValueSignFlag;
    259261  Int       m_exposureCompensationValueNumerator;
     
    495497  Void      setMaxRefPicNum                 ( Int iMaxRefPicNum )           { m_iMaxRefPicNum = iMaxRefPicNum;  }
    496498
    497   Bool      getMaxTempLayer                 ()                              { return m_maxTempLayer;              }
     499  Int       getMaxTempLayer                 ()                              { return m_maxTempLayer;              }
    498500  Void      setMaxTempLayer                 ( Int maxTempLayer )            { m_maxTempLayer = maxTempLayer;      }
    499501
     
    753755  Void  setTMISEICameraIsoSpeedValue(Int b)                  {  m_cameraIsoSpeedValue = b;  }
    754756  Int   getTMISEICameraIsoSpeedValue()                       {  return m_cameraIsoSpeedValue;  }
     757  Void  setTMISEIExposureIndexIdc(Int b)                     {  m_exposureIndexIdc = b;  }
     758  Int   getTMISEIExposurIndexIdc()                           {  return m_exposureIndexIdc;  }
     759  Void  setTMISEIExposureIndexValue(Int b)                   {  m_exposureIndexValue = b;  }
     760  Int   getTMISEIExposurIndexValue()                         {  return m_exposureIndexValue;  }
    755761  Void  setTMISEIExposureCompensationValueSignFlag(Int b)    {  m_exposureCompensationValueSignFlag = b;  }
    756762  Int   getTMISEIExposureCompensationValueSignFlag()         {  return m_exposureCompensationValueSignFlag;  }
  • trunk/source/Lib/TLibEncoder/TEncGOP.cpp

    r884 r964  
    7575  m_iNumPicCoded        = 0; //Niko
    7676  m_bFirst              = true;
     77#if ALLOW_RECOVERY_POINT_AS_RAP
     78  m_iLastRecoveryPicPOC = 0;
     79#endif
    7780 
    7881  m_pcCfg               = NULL;
     
    167170  SEIActiveParameterSets *seiActiveParameterSets = new SEIActiveParameterSets();
    168171  seiActiveParameterSets->activeVPSId = m_pcCfg->getVPS()->getVPSId();
    169   seiActiveParameterSets->m_fullRandomAccessFlag = false;
    170   seiActiveParameterSets->m_noParamSetUpdateFlag = false;
     172  seiActiveParameterSets->m_selfContainedCvsFlag = false;
     173  seiActiveParameterSets->m_noParameterSetUpdateFlag = false;
    171174  seiActiveParameterSets->numSpsIdsMinus1 = 0;
    172   seiActiveParameterSets->activeSeqParamSetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1);
    173   seiActiveParameterSets->activeSeqParamSetId[0] = sps->getSPSId();
     175  seiActiveParameterSets->activeSeqParameterSetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1);
     176  seiActiveParameterSets->activeSeqParameterSetId[0] = sps->getSPSId();
    174177  return seiActiveParameterSets;
    175178}
     
    274277       seiToneMappingInfo->m_cameraIsoSpeedValue = m_pcCfg->getTMISEICameraIsoSpeedValue();
    275278       assert( seiToneMappingInfo->m_cameraIsoSpeedValue !=0 );
     279       seiToneMappingInfo->m_exposureIndexIdc = m_pcCfg->getTMISEIExposurIndexIdc();
     280       seiToneMappingInfo->m_exposureIndexValue = m_pcCfg->getTMISEIExposurIndexValue();
     281       assert( seiToneMappingInfo->m_exposureIndexValue !=0 );
    276282       seiToneMappingInfo->m_exposureCompensationValueSignFlag = m_pcCfg->getTMISEIExposureCompensationValueSignFlag();
    277283       seiToneMappingInfo->m_exposureCompensationValueNumerator = m_pcCfg->getTMISEIExposureCompensationValueNumerator();
     
    428434  UInt *accumNalsDU = NULL;
    429435  SEIDecodingUnitInfo decodingUnitInfoSEI;
     436#if EFFICIENT_FIELD_IRAP
     437  Int IRAPGOPid = -1;
     438  Bool IRAPtoReorder = false;
     439  Bool swapIRAPForward = false;
     440  if(isField)
     441  {
     442    Int pocCurr;
     443#if !H_MV
     444    for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ )
     445#endif
     446    {
     447      // determine actual POC
     448      if(iPOCLast == 0) //case first frame or first top field
     449      {
     450        pocCurr=0;
     451      }
     452      else if(iPOCLast == 1 && isField) //case first bottom field, just like the first frame, the poc computation is not right anymore, we set the right value
     453      {
     454        pocCurr = 1;
     455      }
     456      else
     457      {
     458        pocCurr = iPOCLast - iNumPicRcvd + m_pcCfg->getGOPEntry(iGOPid).m_POC - isField;
     459      }
     460
     461      // check if POC corresponds to IRAP
     462      NalUnitType tmpUnitType = getNalUnitType(pocCurr, m_iLastIDR, isField);
     463      if(tmpUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && tmpUnitType <= NAL_UNIT_CODED_SLICE_CRA) // if picture is an IRAP
     464      {
     465        if(pocCurr%2 == 0 && iGOPid < m_iGopSize-1 && m_pcCfg->getGOPEntry(iGOPid).m_POC == m_pcCfg->getGOPEntry(iGOPid+1).m_POC-1)
     466        { // if top field and following picture in enc order is associated bottom field
     467          IRAPGOPid = iGOPid;
     468          IRAPtoReorder = true;
     469          swapIRAPForward = true;
     470          break;
     471        }
     472        if(pocCurr%2 != 0 && iGOPid > 0 && m_pcCfg->getGOPEntry(iGOPid).m_POC == m_pcCfg->getGOPEntry(iGOPid-1).m_POC+1)
     473        {
     474          // if picture is an IRAP remember to process it first
     475          IRAPGOPid = iGOPid;
     476          IRAPtoReorder = true;
     477          swapIRAPForward = false;
     478          break;
     479        }
     480      }
     481    }
     482  }
     483#endif
    430484#if !H_MV
    431485  for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ )
    432486#endif
    433487  {
     488#if EFFICIENT_FIELD_IRAP
     489    if(IRAPtoReorder)
     490    {
     491      if(swapIRAPForward)
     492      {
     493        if(iGOPid == IRAPGOPid)
     494        {
     495          iGOPid = IRAPGOPid +1;
     496        }
     497        else if(iGOPid == IRAPGOPid +1)
     498        {
     499          iGOPid = IRAPGOPid;
     500        }
     501      }
     502      else
     503      {
     504        if(iGOPid == IRAPGOPid -1)
     505        {
     506          iGOPid = IRAPGOPid;
     507        }
     508        else if(iGOPid == IRAPGOPid)
     509        {
     510          iGOPid = IRAPGOPid -1;
     511        }
     512      }
     513    }
     514#endif
    434515    UInt uiColDir = 1;
    435516    //-- For time output for each slice
     
    500581    if(pocCurr>=m_pcCfg->getFramesToBeEncoded())
    501582    {
     583#if EFFICIENT_FIELD_IRAP
     584      if(IRAPtoReorder)
     585      {
     586        if(swapIRAPForward)
     587        {
     588          if(iGOPid == IRAPGOPid)
     589          {
     590            iGOPid = IRAPGOPid +1;
     591            IRAPtoReorder = false;
     592          }
     593          else if(iGOPid == IRAPGOPid +1)
     594          {
     595            iGOPid --;
     596          }
     597        }
     598        else
     599        {
     600          if(iGOPid == IRAPGOPid)
     601          {
     602            iGOPid = IRAPGOPid -1;
     603          }
     604          else if(iGOPid == IRAPGOPid -1)
     605          {
     606            iGOPid = IRAPGOPid;
     607            IRAPtoReorder = false;
     608          }
     609        }
     610      }
     611#endif
    502612#if H_MV
    503613      delete pcBitstreamRedirect;
     
    635745    }
    636746
    637     // Do decoding refresh marking if any
    638     pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic);
    639     m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid);
    640     pcSlice->getRPS()->setNumberOfLongtermPictures(0);
     747#if EFFICIENT_FIELD_IRAP
    641748#if FIX1172
    642749    if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     
    653760    pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC);
    654761#endif
    655 
     762#endif
     763    // Do decoding refresh marking if any
     764    pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic);
     765    m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid);
     766    pcSlice->getRPS()->setNumberOfLongtermPictures(0);
     767#if EFFICIENT_FIELD_IRAP
     768#else
     769#if FIX1172
     770    if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     771      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     772      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
     773      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL
     774      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP
     775      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA )  // IRAP picture
     776    {
     777      m_associatedIRAPType = pcSlice->getNalUnitType();
     778      m_associatedIRAPPOC = pocCurr;
     779    }
     780    pcSlice->setAssociatedIRAPType(m_associatedIRAPType);
     781    pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC);
     782#endif
     783#endif
     784
     785#if ALLOW_RECOVERY_POINT_AS_RAP
     786    if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false, m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3) != 0) || (pcSlice->isIRAP())
     787#if EFFICIENT_FIELD_IRAP
     788      || (isField && pcSlice->getAssociatedIRAPType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getAssociatedIRAPType() <= NAL_UNIT_CODED_SLICE_CRA && pcSlice->getAssociatedIRAPPOC() == pcSlice->getPOC()+1)
     789#endif
     790      )
     791    {
     792      pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP(), m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3);
     793    }
     794#else
    656795    if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0) || (pcSlice->isIRAP()))
    657796    {
    658797      pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP());
    659798    }
     799#endif
    660800    pcSlice->applyReferencePictureSet(rcListPic, pcSlice->getRPS());
    661801
     
    14111551      }
    14121552      pictureTimingSEI.m_auCpbRemovalDelay = std::min<Int>(std::max<Int>(1, m_totalCoded - m_lastBPSEI), static_cast<Int>(pow(2, static_cast<double>(pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getCpbRemovalDelayLengthMinus1()+1)))); // Syntax element signalled as minus, hence the .
    1413       pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pcSlice->getPOC() - m_totalCoded;
     1553      pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(pcSlice->getSPS()->getMaxTLayers()-1) + pcSlice->getPOC() - m_totalCoded;
     1554#if EFFICIENT_FIELD_IRAP
     1555      if(IRAPGOPid > 0 && IRAPGOPid < m_iGopSize)
     1556      {
     1557        // if pictures have been swapped there is likely one more picture delay on their tid. Very rough approximation
     1558        pictureTimingSEI.m_picDpbOutputDelay ++;
     1559      }
     1560#endif
    14141561      Int factor = pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2;
    14151562      pictureTimingSEI.m_picDpbOutputDuDelay = factor * pictureTimingSEI.m_picDpbOutputDelay;
     
    15181665      sei_recovery_point.m_exactMatchingFlag = ( pcSlice->getPOC() == 0 ) ? (true) : (false);
    15191666      sei_recovery_point.m_brokenLinkFlag    = false;
     1667#if ALLOW_RECOVERY_POINT_AS_RAP
     1668      if(m_pcCfg->getDecodingRefreshType() == 3)
     1669      {
     1670        m_iLastRecoveryPicPOC = pocCurr;
     1671      }
     1672#endif
    15201673
    15211674      m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_recovery_point, pcSlice->getSPS() );
     
    16411794          }
    16421795          m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     1796
     1797#if SETTING_NO_OUT_PIC_PRIOR
     1798          if (pcSlice->isIRAP())
     1799          {
     1800            if (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP)
     1801            {
     1802              pcSlice->setNoRaslOutputFlag(true);
     1803            }
     1804            //the inference for NoOutputPriorPicsFlag
     1805            if (!m_bFirst && pcSlice->isIRAP() && pcSlice->getNoRaslOutputFlag())
     1806            {
     1807              if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)
     1808              {
     1809                pcSlice->setNoOutputPriorPicsFlag(true);
     1810              }
     1811            }
     1812          }
     1813#endif
     1814
    16431815          tmpBitsBeforeWriting = m_pcEntropyCoder->getNumberOfWrittenBits();
    16441816          m_pcEntropyCoder->encodeSliceHeader(pcSlice);
     
    21532325      std::vector<Int> temp;
    21542326      TComSlice::markCurrPic( pcPic );
     2327#if !H_MV_HLS_8_DBP_NODOC_42
    21552328      TComSlice::markIvRefPicsAsUnused   ( m_ivPicLists, temp, pcPic->getSlice(0)->getVPS(), m_layerId, pcPic->getPOC() );
     2329#endif
    21562330#endif
    21572331      m_bFirst = false;
     
    21632337
    21642338      delete[] pcSubstreamsOut;
     2339
     2340#if EFFICIENT_FIELD_IRAP
     2341    if(IRAPtoReorder)
     2342    {
     2343      if(swapIRAPForward)
     2344      {
     2345        if(iGOPid == IRAPGOPid)
     2346        {
     2347          iGOPid = IRAPGOPid +1;
     2348          IRAPtoReorder = false;
     2349        }
     2350        else if(iGOPid == IRAPGOPid +1)
     2351        {
     2352          iGOPid --;
     2353        }
     2354      }
     2355      else
     2356      {
     2357        if(iGOPid == IRAPGOPid)
     2358        {
     2359          iGOPid = IRAPGOPid -1;
     2360        }
     2361        else if(iGOPid == IRAPGOPid -1)
     2362        {
     2363          iGOPid = IRAPGOPid;
     2364          IRAPtoReorder = false;
     2365        }
     2366      }
     2367    }
     2368#endif
    21652369  }
    21662370  delete pcBitstreamRedirect;
     
    24352639    case NAL_UNIT_CODED_SLICE_CRA: return "CRA";
    24362640    case NAL_UNIT_CODED_SLICE_RADL_R:     return "RADL_R";
     2641    case NAL_UNIT_CODED_SLICE_RADL_N:     return "RADL_N";
    24372642    case NAL_UNIT_CODED_SLICE_RASL_R:     return "RASL_R";
     2643    case NAL_UNIT_CODED_SLICE_RASL_N:     return "RASL_N";
    24382644    case NAL_UNIT_VPS: return "VPS";
    24392645    case NAL_UNIT_SPS: return "SPS";
     
    28383044    return NAL_UNIT_CODED_SLICE_IDR_W_RADL;
    28393045  }
     3046#if EFFICIENT_FIELD_IRAP
     3047  if(isField && pocCurr == 1)
     3048  {
     3049    // to avoid the picture becoming an IRAP
     3050    return NAL_UNIT_CODED_SLICE_TRAIL_R;
     3051  }
     3052#endif
     3053
     3054#if ALLOW_RECOVERY_POINT_AS_RAP
     3055  if(m_pcCfg->getDecodingRefreshType() != 3 && (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0)
     3056#else
    28403057  if ((pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0)
     3058#endif
    28413059  {
    28423060    if (m_pcCfg->getDecodingRefreshType() == 1)
  • trunk/source/Lib/TLibEncoder/TEncGOP.h

    r884 r964  
    8585  Int                     m_iNumPicCoded;
    8686  Bool                    m_bFirst;
     87#if ALLOW_RECOVERY_POINT_AS_RAP
     88  Int                     m_iLastRecoveryPicPOC;
     89#endif
    8790 
    8891  //  Access channel
  • trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r872 r964  
    920920        for (y=0; y<endY; y++)
    921921        {
     922#if SAO_SGN_FUNC
     923          signLeft = (Char)sgn(srcLine[startX] - srcLine[startX-1]);
     924#else
    922925          signLeft = (Char)m_sign[srcLine[startX] - srcLine[startX-1]];
     926#endif
    923927          for (x=startX; x<endX; x++)
    924928          {
     929#if SAO_SGN_FUNC
     930            signRight =  (Char)sgn(srcLine[x] - srcLine[x+1]);
     931#else
    925932            signRight =  (Char)m_sign[srcLine[x] - srcLine[x+1]];
     933#endif
    926934            edgeType  =  signRight + signLeft;
    927935            signLeft  = -signRight;
     
    943951            for(y=0; y<skipLinesB[typeIdx]; y++)
    944952            {
     953#if SAO_SGN_FUNC
     954              signLeft = (Char)sgn(srcLine[startX] - srcLine[startX-1]);
     955#else
    945956              signLeft = (Char)m_sign[srcLine[startX] - srcLine[startX-1]];
     957#endif
    946958              for (x=startX; x<endX; x++)
    947959              {
     960#if SAO_SGN_FUNC
     961                signRight =  (Char)sgn(srcLine[x] - srcLine[x+1]);
     962#else
    948963                signRight =  (Char)m_sign[srcLine[x] - srcLine[x+1]];
     964#endif
    949965                edgeType  =  signRight + signLeft;
    950966                signLeft  = -signRight;
     
    9941010#endif
    9951011        {
     1012#if SAO_SGN_FUNC
     1013          signUpLine[x] = (Char)sgn(srcLine[x] - srcLineAbove[x]);
     1014#else
    9961015          signUpLine[x] = (Char)m_sign[srcLine[x] - srcLineAbove[x]];
     1016#endif
    9971017        }
    9981018
     
    10081028#endif
    10091029          {
     1030#if SAO_SGN_FUNC
     1031            signDown  = (Char)sgn(srcLine[x] - srcLineBelow[x]);
     1032#else
    10101033            signDown  = (Char)m_sign[srcLine[x] - srcLineBelow[x]];
     1034#endif
    10111035            edgeType  = signDown + signUpLine[x];
    10121036            signUpLine[x]= -signDown;
     
    10331057              for (x=startX; x<endX; x++)
    10341058              {
     1059#if SAO_SGN_FUNC
     1060                edgeType = sgn(srcLine[x] - srcLineBelow[x]) + sgn(srcLine[x] - srcLineAbove[x]);
     1061#else
    10351062                edgeType = m_sign[srcLine[x] - srcLineBelow[x]] + m_sign[srcLine[x] - srcLineAbove[x]];
     1063#endif
    10361064                diff [edgeType] += (orgLine[x] - srcLine[x]);
    10371065                count[edgeType] ++;
     
    10761104        for (x=startX; x<endX+1; x++)
    10771105        {
     1106#if SAO_SGN_FUNC
     1107          signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x-1]);
     1108#else
    10781109          signUpLine[x] = (Char)m_sign[srcLineBelow[x] - srcLine[x-1]];
     1110#endif
    10791111        }
    10801112
     
    10901122        for(x=firstLineStartX; x<firstLineEndX; x++)
    10911123        {
     1124#if SAO_SGN_FUNC
     1125          edgeType = sgn(srcLine[x] - srcLineAbove[x-1]) - signUpLine[x+1];
     1126#else
    10921127          edgeType = m_sign[srcLine[x] - srcLineAbove[x-1]] - signUpLine[x+1];
     1128#endif
    10931129          diff [edgeType] += (orgLine[x] - srcLine[x]);
    10941130          count[edgeType] ++;
     
    11051141          for (x=startX; x<endX; x++)
    11061142          {
     1143#if SAO_SGN_FUNC
     1144            signDown = (Char)sgn(srcLine[x] - srcLineBelow[x+1]);
     1145#else
    11071146            signDown = (Char)m_sign[srcLine[x] - srcLineBelow[x+1]] ;
     1147#endif
    11081148            edgeType = signDown + signUpLine[x];
    11091149            diff [edgeType] += (orgLine[x] - srcLine[x]);
     
    11121152            signDownLine[x+1] = -signDown;
    11131153          }
     1154#if SAO_SGN_FUNC
     1155          signDownLine[startX] = (Char)sgn(srcLineBelow[startX] - srcLine[startX-1]);
     1156#else
    11141157          signDownLine[startX] = (Char)m_sign[srcLineBelow[startX] - srcLine[startX-1]];
     1158#endif
    11151159
    11161160          signTmpLine  = signUpLine;
     
    11361180              for (x=startX; x< endX; x++)
    11371181              {
     1182#if SAO_SGN_FUNC
     1183                edgeType = sgn(srcLine[x] - srcLineBelow[x+1]) + sgn(srcLine[x] - srcLineAbove[x-1]);
     1184#else
    11381185                edgeType = m_sign[srcLine[x] - srcLineBelow[x+1]] + m_sign[srcLine[x] - srcLineAbove[x-1]];
     1186#endif
    11391187                diff [edgeType] += (orgLine[x] - srcLine[x]);
    11401188                count[edgeType] ++;
     
    11741222        for (x=startX-1; x<endX; x++)
    11751223        {
     1224#if SAO_SGN_FUNC
     1225          signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x+1]);
     1226#else
    11761227          signUpLine[x] = (Char)m_sign[srcLineBelow[x] - srcLine[x+1]];
     1228#endif
    11771229        }
    11781230
     
    11931245        for(x=firstLineStartX; x<firstLineEndX; x++)
    11941246        {
     1247#if SAO_SGN_FUNC
     1248          edgeType = sgn(srcLine[x] - srcLineAbove[x+1]) - signUpLine[x-1];
     1249#else
    11951250          edgeType = m_sign[srcLine[x] - srcLineAbove[x+1]] - signUpLine[x-1];
     1251#endif
    11961252          diff [edgeType] += (orgLine[x] - srcLine[x]);
    11971253          count[edgeType] ++;
     
    12081264          for(x=startX; x<endX; x++)
    12091265          {
     1266#if SAO_SGN_FUNC
     1267            signDown = (Char)sgn(srcLine[x] - srcLineBelow[x-1]);
     1268#else
    12101269            signDown = (Char)m_sign[srcLine[x] - srcLineBelow[x-1]] ;
     1270#endif
    12111271            edgeType = signDown + signUpLine[x];
    12121272
     
    12161276            signUpLine[x-1] = -signDown;
    12171277          }
     1278#if SAO_SGN_FUNC
     1279          signUpLine[endX-1] = (Char)sgn(srcLineBelow[endX-1] - srcLine[endX]);
     1280#else
    12181281          signUpLine[endX-1] = (Char)m_sign[srcLineBelow[endX-1] - srcLine[endX]];
     1282#endif
    12191283          srcLine  += srcStride;
    12201284          orgLine  += orgStride;
     
    12351299              for (x=startX; x<endX; x++)
    12361300              {
     1301#if SAO_SGN_FUNC
     1302                edgeType = sgn(srcLine[x] - srcLineBelow[x-1]) + sgn(srcLine[x] - srcLineAbove[x+1]);
     1303#else
    12371304                edgeType = m_sign[srcLine[x] - srcLineBelow[x-1]] + m_sign[srcLine[x] - srcLineAbove[x+1]];
     1305#endif
    12381306                diff [edgeType] += (orgLine[x] - srcLine[x]);
    12391307                count[edgeType] ++;
  • trunk/source/Lib/TLibEncoder/TEncSearch.cpp

    r950 r964  
    28092809{
    28102810  UInt    uiDepth        = pcCU->getDepth(0);
    2811   UInt    uiNumPU        = pcCU->getNumPartInter();
     2811  UInt    uiNumPU        = pcCU->getNumPartitions();
    28122812  UInt    uiInitTrDepth  = pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1;
    28132813  UInt    uiWidth        = pcCU->getWidth (0) >> uiInitTrDepth;
     
    39713971  TComMv        cMvTemp[2][33];
    39723972 
    3973   Int           iNumPart    = pcCU->getNumPartInter();
     3973  Int           iNumPart    = pcCU->getNumPartitions();
    39743974  Int           iNumPredDir = pcCU->getSlice()->isInterP() ? 1 : 2;
    39753975 
     
    56445644   
    56455645      m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST] );
    5646 #if 0 // check
    5647     {
    5648       m_pcEntropyCoder->resetBits();
    5649       m_pcEntropyCoder->encodeCoeff( pcCU, 0, pcCU->getDepth(0), pcCU->getWidth(0), pcCU->getHeight(0) );
    5650       const UInt uiBitsForCoeff = m_pcEntropyCoder->getNumberOfWrittenBits();
    5651         m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST] );
    5652       if( uiBitsForCoeff != uiBits )
    5653         assert( 0 );
    5654     }
    5655 #endif
     5646
    56565647    uiBits = 0;
    56575648    {
  • trunk/source/Lib/TLibEncoder/TEncSlice.cpp

    r950 r964  
    221221  Int depth;
    222222  {
     223#if FIX_FIELD_DEPTH   
     224    Int poc = rpcSlice->getPOC();
     225    if(isField)
     226    {
     227      poc = (poc/2)%(m_pcCfg->getGOPSize()/2);
     228    }
     229    else
     230    {
     231      poc = poc%m_pcCfg->getGOPSize();   
     232    }
     233#else
    223234    Int poc = rpcSlice->getPOC()%m_pcCfg->getGOPSize();
     235#endif
    224236    if ( poc == 0 )
    225237    {
     
    244256      }
    245257    }
     258#if FIX_FIELD_DEPTH 
     259#if HARMONIZE_GOP_FIRST_FIELD_COUPLE
     260    if(poc != 0)
     261    {
     262#endif
     263    if(isField && rpcSlice->getPOC()%2 == 1)
     264    {
     265      depth ++;
     266    }
     267#if HARMONIZE_GOP_FIRST_FIELD_COUPLE
     268  }
     269#endif
     270#endif
    246271  }
    247272 
     
    266291 
    267292  eSliceType=B_SLICE;
     293#if EFFICIENT_FIELD_IRAP
     294  if(!(isField && pocLast == 1))
     295  {
     296#endif // EFFICIENT_FIELD_IRAP
     297#if ALLOW_RECOVERY_POINT_AS_RAP
     298  if(m_pcCfg->getDecodingRefreshType() == 3)
     299  {
     300    eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0             || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
     301  }
     302  else
     303  {
     304    eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
     305  }
     306#else
    268307  eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
     308#endif
     309#if EFFICIENT_FIELD_IRAP
     310  }
     311#endif
     312#endif
    269313 
    270314  rpcSlice->setSliceType    ( eSliceType );
    271 #endif
    272315
    273316  // ------------------------------------------------------------------------------------------------------------------
     
    450493  }
    451494#else
    452 eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
     495#if EFFICIENT_FIELD_IRAP
     496  if(!(isField && pocLast == 1))
     497  {
     498#endif // EFFICIENT_FIELD_IRAP
     499#if ALLOW_RECOVERY_POINT_AS_RAP
     500  if(m_pcCfg->getDecodingRefreshType() == 3)
     501  {
     502    eSliceType = (pocLast == 0 || (pocCurr)           % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
     503
     504  }
     505  else
     506  {
     507  eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
     508  }
     509#else
     510  eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
     511#endif
     512#if EFFICIENT_FIELD_IRAP
     513  }
     514#endif // EFFICIENT_FIELD_IRAP
    453515#endif
    454516
     
    566628  // store lambda
    567629  slice->setSliceQp( sliceQP );
     630#if ADAPTIVE_QP_SELECTION
    568631  slice->setSliceQpBase ( sliceQP );
     632#endif
    569633  m_pcRdCost ->setLambda( lambda );
    570634  // for RDO
     
    11051169
    11061170        m_pcRateCtrl->setRCQP( estQP );
     1171#if ADAPTIVE_QP_SELECTION
    11071172        pcCU->getSlice()->setSliceQpBase( estQP );
     1173#endif
    11081174      }
    11091175
  • trunk/source/Lib/TLibEncoder/TEncTop.cpp

    r884 r964  
    697697  m_cSPS.setSpsInferScalingListFlag       ( m_layerId > 0 && m_cVPS->getInDirectDependencyFlag( getLayerIdInVps(), 0 ) );
    698698  m_cSPS.setSpsScalingListRefLayerId      ( 0              );
    699   m_cSPS.setSpsExtensionFlag              ( true );
     699  m_cSPS.setSpsExtensionPresentFlag              ( true );
     700#if H_MV_HLS_8_SPS_NODOC_48
     701  m_cSPS.setSpsMultilayerExtensionFlag    ( true );
     702#else
    700703  m_cSPS.setSpsExtensionTypeFlag          ( PS_EX_T_MV ,true );
     704#endif
    701705#if H_3D
     706#if H_MV_HLS_8_SPS_NODOC_48
     707  m_cSPS.setSps3dExtensionFlag            ( true );
     708#else
    702709  m_cSPS.setSpsExtensionTypeFlag          ( PS_EX_T_3D ,true );
     710#endif
    703711#endif
    704712#endif
     
    769777    m_cSPS.setNumReorderPics(m_numReorderPics[i], i);
    770778  }
     779#if H_MV_HLS_8_HRD_Q0102_08
     780  for ( Int ols = 0; ols < m_cVPS->getNumOutputLayerSets(); ols++)
     781  {
     782    // Check MaxDecPicBuffering
     783    const std::vector<Int>& targetDecLayerIdList = m_cVPS->getTargetDecLayerIdList( m_cVPS->olsIdxToLsIdx( ols ));
     784    for( Int is = 0; is < targetDecLayerIdList.size(); is++  )
     785    {
     786      m_cSPS.inferSpsMaxDecPicBufferingMinus1( m_cVPS, ols, targetDecLayerIdList[is], true );       
     787    }
     788  }
     789
     790#if H_MV_HLS_8_RPS_Q0100_36
     791  m_cVPS->inferDbpSizeLayerSetZero( &m_cSPS, true );
     792#endif
     793
     794#endif
    771795  m_cSPS.setPCMBitDepthLuma (g_uiPCMBitDepthLuma);
    772796  m_cSPS.setPCMBitDepthChroma (g_uiPCMBitDepthChroma);
     
    829853  m_cPPS.setPPSId( getLayerIdInVps() );
    830854  m_cPPS.setSPSId( getLayerIdInVps() );
    831 
     855#if H_MV_HLS_8_SPS_NODOC_48
     856  m_cPPS.setPpsMultilayerExtensionFlag    ( true );
     857#if H_3D
     858  m_cPPS.setPps3dExtensionFlag            ( true );
     859#endif
     860#else
    832861  m_cPPS.setPpsExtensionTypeFlag          ( PPS_EX_T_MV ,true );
    833862#if H_3D
    834863  m_cPPS.setPpsExtensionTypeFlag          ( PPS_EX_T_3D ,true );
     864#endif
    835865#endif
    836866#endif
Note: See TracChangeset for help on using the changeset viewer.