Changeset 622 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/TDecCAVLC.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/TLibDecoder/TDecCAVLC.cpp

    r608 r622  
    330330    }
    331331  }
     332#if H_MV5
     333#if H_MV
     334  if ( pcPPS->getLayerId() > 0 )
     335  {
     336    READ_FLAG( uiCode, "pps_infer_scaling_list_flag" ); pcPPS->setPpsInferScalingListFlag( uiCode == 1 );   
     337  }
     338
     339  if( pcPPS->getPpsInferScalingListFlag( ) )
     340  {
     341    READ_CODE( 6, uiCode, "pps_scaling_list_ref_layer_id" ); pcPPS->setPpsScalingListRefLayerId( uiCode );
     342  }
     343  else
     344  { 
     345#endif
     346#endif
    332347  READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" );           pcPPS->setScalingListPresentFlag( uiCode ? true : false );
    333348  if(pcPPS->getScalingListPresentFlag ())
     
    335350    parseScalingList( pcPPS->getScalingList() );
    336351  }
     352#if H_MV5
     353#if H_MV
     354  }
     355#endif
     356#endif
    337357
    338358  READ_FLAG( uiCode, "lists_modification_present_flag");
     
    410430  {
    411431    Window &defDisp = pcVUI->getDefaultDisplayWindow();
     432#if !H_MV5
    412433    READ_UVLC(   uiCode, "def_disp_win_left_offset" );                defDisp.setWindowLeftOffset  ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) );
    413434    READ_UVLC(   uiCode, "def_disp_win_right_offset" );               defDisp.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) );
    414435    READ_UVLC(   uiCode, "def_disp_win_top_offset" );                 defDisp.setWindowTopOffset   ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) );
    415436    READ_UVLC(   uiCode, "def_disp_win_bottom_offset" );              defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) );
     437#else
     438#if H_MV
     439    defDisp.setScaledFlag( false );
     440    READ_UVLC(   uiCode, "def_disp_win_left_offset" );                defDisp.setWindowLeftOffset  ( uiCode );
     441    READ_UVLC(   uiCode, "def_disp_win_right_offset" );               defDisp.setWindowRightOffset ( uiCode );
     442    READ_UVLC(   uiCode, "def_disp_win_top_offset" );                 defDisp.setWindowTopOffset   ( uiCode );
     443    READ_UVLC(   uiCode, "def_disp_win_bottom_offset" );              defDisp.setWindowBottomOffset( uiCode );
     444#else
     445    READ_UVLC(   uiCode, "def_disp_win_left_offset" );                defDisp.setWindowLeftOffset  ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) );
     446    READ_UVLC(   uiCode, "def_disp_win_right_offset" );               defDisp.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) );
     447    READ_UVLC(   uiCode, "def_disp_win_top_offset" );                 defDisp.setWindowTopOffset   ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) );
     448    READ_UVLC(   uiCode, "def_disp_win_bottom_offset" );              defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) );
     449#endif
     450#endif
    416451  }
    417452  TimingInfo *timingInfo = pcVUI->getTimingInfo();
     
    436471  {
    437472    READ_FLAG(   uiCode, "tiles_fixed_structure_flag");               pcVUI->setTilesFixedStructureFlag(uiCode);
     473#if !H_MV5
    438474#if H_MV
    439475    if ( pcSPS->getLayerId() > 0 )
     
    441477      READ_FLAG( uiCode, "tile_boundaries_aligned_flag" ); pcVUI->setTileBoundariesAlignedFlag( uiCode == 1 );
    442478    }
     479#endif
    443480#endif
    444481    READ_FLAG(   uiCode, "motion_vectors_over_pic_boundaries_flag");  pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode);
     
    560597  READ_UVLC(     uiCode, "sps_seq_parameter_set_id" );           pcSPS->setSPSId( uiCode );
    561598  assert(uiCode <= 15);
     599#if H_MV5
     600#if H_MV
     601  if ( pcSPS->getLayerId() > 0 )
     602  {
     603    READ_FLAG( uiCode, "update_rep_format_flag" );               pcSPS->setUpdateRepFormatFlag( uiCode == 1 );
     604  }
    562605 
     606  if ( pcSPS->getUpdateRepFormatFlag() )
     607  {
     608#endif
     609#endif
    563610  READ_UVLC(     uiCode, "chroma_format_idc" );                  pcSPS->setChromaFormatIdc( uiCode );
    564611  assert(uiCode <= 3);
     
    572619  READ_UVLC (    uiCode, "pic_width_in_luma_samples" );          pcSPS->setPicWidthInLumaSamples ( uiCode    );
    573620  READ_UVLC (    uiCode, "pic_height_in_luma_samples" );         pcSPS->setPicHeightInLumaSamples( uiCode    );
     621#if H_MV5
     622#if H_MV
     623  }
     624#endif
     625#endif
    574626  READ_FLAG(     uiCode, "conformance_window_flag");
    575627  if (uiCode != 0)
    576628  {
    577629    Window &conf = pcSPS->getConformanceWindow();
     630#if H_MV5
     631#if H_MV
     632    // Needs to be scaled later, when ChromaFormatIdc is known.
     633    conf.setScaledFlag( false );
     634    READ_UVLC(   uiCode, "conf_win_left_offset" );               conf.setWindowLeftOffset  ( uiCode  );
     635    READ_UVLC(   uiCode, "conf_win_right_offset" );              conf.setWindowRightOffset ( uiCode  );
     636    READ_UVLC(   uiCode, "conf_win_top_offset" );                conf.setWindowTopOffset   ( uiCode  );
     637    READ_UVLC(   uiCode, "conf_win_bottom_offset" );             conf.setWindowBottomOffset( uiCode  );   
     638#else
    578639    READ_UVLC(   uiCode, "conf_win_left_offset" );               conf.setWindowLeftOffset  ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) );
    579640    READ_UVLC(   uiCode, "conf_win_right_offset" );              conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) );
    580641    READ_UVLC(   uiCode, "conf_win_top_offset" );                conf.setWindowTopOffset   ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
    581642    READ_UVLC(   uiCode, "conf_win_bottom_offset" );             conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
    582   }
    583 
     643#endif
     644#else
     645    READ_UVLC(   uiCode, "conf_win_left_offset" );               conf.setWindowLeftOffset  ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) );
     646    READ_UVLC(   uiCode, "conf_win_right_offset" );              conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) );
     647    READ_UVLC(   uiCode, "conf_win_top_offset" );                conf.setWindowTopOffset   ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
     648    READ_UVLC(   uiCode, "conf_win_bottom_offset" );             conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
     649#endif
     650  }
     651
     652#if H_MV5
     653#if H_MV
     654  if ( pcSPS->getUpdateRepFormatFlag() )
     655  {
     656#endif
     657#endif
    584658  READ_UVLC(     uiCode, "bit_depth_luma_minus8" );
    585659  assert(uiCode <= 6);
     
    591665  pcSPS->setBitDepthC( uiCode + 8 );
    592666  pcSPS->setQpBDOffsetC( (Int) (6*uiCode) );
     667#if H_MV5
     668#if H_MV
     669  }
     670#endif
     671#endif
    593672
    594673  READ_UVLC( uiCode,    "log2_max_pic_order_cnt_lsb_minus4" );   pcSPS->setBitsForPOC( 4 + uiCode );
     
    613692    pcSPS->setNumReorderPics(uiCode, i);
    614693#if H_MV
     694#if H_MV5
     695    READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]");
     696#else
    615697    READ_UVLC ( uiCode, "sps_max_latency_increase[i]");
     698#endif
    616699#else
    617     READ_UVLC ( uiCode, "sps_max_latency_increase");
     700    READ_UVLC ( uiCode, "sps_max_latency_increase_plus1");
    618701#endif
    619702    pcSPS->setMaxLatencyIncrease( uiCode, i );
     
    653736  if(pcSPS->getScalingListFlag())
    654737  {
     738#if H_MV5
     739#if H_MV
     740    if ( pcSPS->getLayerId() > 0 )
     741    {   
     742      READ_FLAG( uiCode, "sps_infer_scaling_list_flag" ); pcSPS->setSpsInferScalingListFlag( uiCode == 1 );
     743    }
     744
     745    if ( pcSPS->getSpsInferScalingListFlag() )
     746    {
     747      READ_CODE( 6, uiCode, "sps_scaling_list_ref_layer_id" ); pcSPS->setSpsScalingListRefLayerId( uiCode );
     748    }
     749    else
     750    {   
     751#endif
     752#endif
    655753    READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" );                 pcSPS->setScalingListPresentFlag ( uiCode );
    656754    if(pcSPS->getScalingListPresentFlag ())
     
    658756      parseScalingList( pcSPS->getScalingList() );
    659757    }
     758#if H_MV5
     759#if H_MV
     760    }
     761#endif
     762#endif
    660763  }
    661764  READ_FLAG( uiCode, "amp_enabled_flag" );                          pcSPS->setUseAMP( uiCode );
     
    711814  if (uiCode)
    712815  {
     816#if !H_MV5
    713817#if !H_MV
    714818    while ( xMoreRbspData() )
     
    789893  }
    790894}
     895#else
     896#if H_MV
     897    parseSPSExtension( pcSPS );
     898    READ_FLAG( uiCode, "sps_extension2_flag");
     899    if ( uiCode )
     900    {
     901#if H_3D
     902      parseSPSExtension2( pcSPS, viewIndex, depthFlag );
     903      READ_FLAG( uiCode, "sps_extension3_flag");
     904      if ( uiCode )
     905      {
     906#endif
     907#endif
     908        while ( xMoreRbspData() )
     909        {
     910          READ_FLAG( uiCode, "sps_extension_data_flag");
     911        }
     912#if H_MV     
     913#if H_3D
     914      }
     915#endif
     916    }
     917#endif
     918  }
     919}
     920#endif
     921#if H_MV5
     922Void TDecCavlc::parseSPSExtension( TComSPS* pcSPS )
     923{
     924  UInt uiCode;
     925  READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" );    pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false);
     926  READ_UVLC( uiCode, "sps_shvc_reserved_zero_idc" );
     927}
     928
     929#if H_3D
     930Void TDecCavlc::parseSPSExtension2( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )
     931{
     932  UInt uiCode;
     933#if H_3D_QTLPC
     934  //GT: This has to go to VPS
     935  if( depthFlag )
     936  {
     937    READ_FLAG( uiCode, "use_qtl_flag" );
     938    pcSPS->setUseQTL( uiCode );
     939    READ_FLAG( uiCode, "use_pc_flag" );
     940    pcSPS->setUsePC( uiCode );
     941  }
     942#endif
     943
     944  UInt uiCamParPrecision = 0;
     945  Bool bCamParSlice      = false;
     946  if ( !depthFlag )
     947  {     
     948    READ_UVLC( uiCamParPrecision, "cp_precision" );
     949    READ_FLAG( uiCode, "cp_in_slice_header_flag" );    bCamParSlice = ( uiCode == 1 );
     950    if( !bCamParSlice )
     951    {       
     952      for( UInt uiBaseIndex = 0; uiBaseIndex < viewIndex; uiBaseIndex++ )
     953      {
     954        Int iCode;
     955        READ_SVLC( iCode, "cp_scale" );                m_aaiTempScale  [ uiBaseIndex ][ viewIndex ]   = iCode;
     956        READ_SVLC( iCode, "cp_off" );                  m_aaiTempOffset [ uiBaseIndex ][ viewIndex ]   = iCode;
     957        READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale  [ viewIndex   ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ viewIndex ];
     958        READ_SVLC( iCode, "cp_inv_off_plus_off" );     m_aaiTempOffset [ viewIndex   ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ viewIndex ];
     959      }
     960    }
     961  }
     962  pcSPS->initCamParaSPS( viewIndex, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset );
     963}
     964#endif
     965#endif
    791966
    792967Void TDecCavlc::parseVPS(TComVPS* pcVPS)
     
    797972  READ_CODE( 2,  uiCode,  "vps_reserved_three_2bits" );           assert(uiCode == 3);
    798973#if H_MV
     974#if H_MV5
     975  READ_CODE( 6,  uiCode,  "vps_max_layers_minus1" );              pcVPS->setMaxLayersMinus1( uiCode  );
     976#else
    799977  READ_CODE( 6,  uiCode,  "vps_max_layers_minus1" );              pcVPS->setMaxLayers( uiCode + 1 );
     978#endif
    800979#else
    801980  READ_CODE( 6,  uiCode,  "vps_reserved_zero_6bits" );            assert(uiCode == 0);
     
    8821061  if (uiCode)
    8831062  {
     1063#if !H_MV5
    8841064#if H_MV
    8851065    m_pcBitstream->readOutTrailingBits();
     
    10991279  return;
    11001280}
     1281#else
     1282#if H_MV
     1283    m_pcBitstream->readOutTrailingBits();
     1284    parseVPSExtension( pcVPS );   
     1285    READ_FLAG( uiCode,  "vps_extension2_flag" );
     1286    if (uiCode)
     1287    {
     1288#if H_3D
     1289      m_pcBitstream->readOutTrailingBits();
     1290      parseVPSExtension2( pcVPS );   
     1291      READ_FLAG( uiCode,  "vps_extension3_flag" );
     1292      if (uiCode)
     1293      {     
     1294#endif
     1295#endif 
     1296        while ( xMoreRbspData() )
     1297        {
     1298          READ_FLAG( uiCode, "vps_extension_data_flag");
     1299        }
     1300#if H_MV
     1301#if H_3D
     1302      }
     1303#endif
     1304    }
     1305#endif
     1306  }
     1307}
     1308#endif
     1309
     1310#if H_MV5
     1311#if H_MV
     1312Void TDecCavlc::parseVPSExtension( TComVPS* pcVPS )
     1313{
     1314  UInt uiCode;
     1315  READ_FLAG( uiCode, "avc_base_layer_flag" );                     pcVPS->setAvcBaseLayerFlag( uiCode == 1 ? true : false );
     1316  READ_CODE( 16, uiCode, "vps_vui_offset" );                      pcVPS->setVpsVuiOffset( uiCode );
     1317  READ_FLAG( uiCode, "splitting_flag" );                          pcVPS->setSplittingFlag( uiCode == 1 ? true : false );
     1318
     1319  for( Int sIdx = 0; sIdx < MAX_NUM_SCALABILITY_TYPES; sIdx++ )
     1320  {
     1321    READ_FLAG( uiCode,  "scalability_mask_flag[i]" );             pcVPS->setScalabilityMaskFlag( sIdx, uiCode == 1 ? true : false );     
     1322  }
     1323
     1324  for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes( ) - ( pcVPS->getSplittingFlag() ? 1 : 0 ); sIdx++ )
     1325  {
     1326    READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" );       pcVPS->setDimensionIdLen( sIdx, uiCode + 1 );
     1327  }
     1328
     1329  if ( pcVPS->getSplittingFlag() )
     1330  {
     1331    pcVPS->setDimensionIdLen( pcVPS->getNumScalabilityTypes( ) - 1, pcVPS->inferLastDimsionIdLenMinus1() );       
     1332  }
     1333
     1334  READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" );           pcVPS->setVpsNuhLayerIdPresentFlag( uiCode == 1 ? true : false );
     1335
     1336  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
     1337  {
     1338    if ( pcVPS->getVpsNuhLayerIdPresentFlag() )
     1339    {
     1340      READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" );                pcVPS->setLayerIdInNuh( i, uiCode );
     1341    }
     1342    else
     1343    {
     1344      pcVPS->setLayerIdInNuh( i, i );;
     1345    }
     1346
     1347    pcVPS->setLayerIdInVps( pcVPS->getLayerIdInNuh( i ), i );
     1348
     1349    for( Int j = 0; j < pcVPS->getNumScalabilityTypes() ; j++ )
     1350    {
     1351      if ( !pcVPS->getSplittingFlag() )
     1352      {
     1353        READ_CODE( pcVPS->getDimensionIdLen( j ), uiCode, "dimension_id[i][j]" );  pcVPS->setDimensionId( i, j, uiCode );
     1354      }
     1355      else
     1356      {
     1357        pcVPS->setDimensionId( i, j, pcVPS->inferDimensionId( i, j)  );
     1358      }
     1359    }
     1360  }
     1361
     1362  // GT spec says: trac #39
     1363  // if ( pcVPS->getNumViews() > 1 ) 
     1364  //   However, this is a bug in the text since, view_id_len_minus1 is needed to parse view_id_val.
     1365  {
     1366    READ_CODE( 4, uiCode, "view_id_len_minus1" ); pcVPS->setViewIdLenMinus1( uiCode );
     1367  }
     1368
     1369  for( Int i = 0; i < pcVPS->getNumViews(); i++ )
     1370  {
     1371    READ_CODE( pcVPS->getViewIdLenMinus1( ) + 1, uiCode, "view_id_val[i]" ); pcVPS->setViewIdVal( i, uiCode );
     1372  }
     1373
     1374  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
     1375  {
     1376    for( Int j = 0; j < i; j++ )
     1377    {
     1378      READ_FLAG( uiCode, "direct_dependency_flag[i][j]" );             pcVPS->setDirectDependencyFlag( i, j, uiCode );
     1379    }
     1380  }
     1381
     1382  READ_FLAG( uiCode, "max_tid_ref_present_flag" ); pcVPS->setMaxTidRefPresentFlag( uiCode == 1 );
     1383
     1384  if ( pcVPS->getMaxTidRefPresentFlag() )
     1385  {   
     1386    for( Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )
     1387    {
     1388      READ_CODE( 3, uiCode,       "max_tid_il_ref_pics_plus1[i]" );      pcVPS->setMaxTidIlRefPicPlus1( i , uiCode );
     1389    }
     1390  }
     1391
     1392  READ_FLAG( uiCode, "all_ref_layers_active_flag" );             pcVPS->setAllRefLayersActiveFlag( uiCode == 1 );
     1393  READ_CODE( 10, uiCode, "vps_number_layer_sets_minus1"      );  pcVPS->setVpsNumberLayerSetsMinus1    ( uiCode );
     1394  READ_CODE( 6,  uiCode, "vps_num_profile_tier_level_minus1" );  pcVPS->setVpsNumProfileTierLevelMinus1( uiCode );
     1395
     1396  for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ )
     1397  {
     1398    READ_FLAG(  uiCode, "vps_profile_present_flag[i]" );    pcVPS->setVpsProfilePresentFlag( i, uiCode == 1 );
     1399    if( !pcVPS->getVpsProfilePresentFlag( i ) )
     1400    {
     1401      READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); pcVPS->setProfileRefMinus1( i, uiCode );
     1402    }
     1403    parsePTL ( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers()-1);
     1404    if( !pcVPS->getVpsProfilePresentFlag( i ) )
     1405    {
     1406      TComPTL temp = *pcVPS->getPTL( i );
     1407      *pcVPS->getPTL( i ) = *pcVPS->getPTL( pcVPS->getProfileRefMinus1( i ) + 1 );
     1408      pcVPS->getPTL( i )->copyLevelFrom( &temp );
     1409    }
     1410  }
     1411
     1412  Int numOutputLayerSets = pcVPS->getVpsNumberLayerSetsMinus1( ) + 1;
     1413
     1414  READ_FLAG( uiCode, "more_output_layer_sets_than_default_flag" ); pcVPS->setMoreOutputLayerSetsThanDefaultFlag( uiCode == 1 );
     1415
     1416  if ( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) )
     1417  {
     1418    READ_CODE( 10, uiCode, "num_add_output_layer_sets_minus1"      ); pcVPS->setNumAddOutputLayerSetsMinus1( uiCode );
     1419    numOutputLayerSets += ( pcVPS->getNumAddOutputLayerSetsMinus1( ) + 1);
     1420  }
     1421
     1422  if( numOutputLayerSets > 1)
     1423  {
     1424    READ_FLAG( uiCode, "default_one_target_output_layer_flag" ); pcVPS->setDefaultOneTargetOutputLayerFlag(  uiCode == 1);
     1425  } 
     1426
     1427  for( Int i = 1; i < numOutputLayerSets; i++ )
     1428  {
     1429    if( i > pcVPS->getVpsNumberLayerSetsMinus1( ) )
     1430    {       
     1431      READ_UVLC( uiCode,      "output_layer_set_idx_minus1[i]" ); pcVPS->setOutputLayerSetIdxMinus1( i, uiCode );
     1432      for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1; j++ )
     1433      {
     1434        READ_FLAG( uiCode, "output_layer_flag" ); pcVPS->setOutputLayerFlag( i, j, uiCode == 1 );
     1435      }       
     1436    }
     1437    if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
     1438    {     
     1439      READ_CODE( pcVPS->getProfileLevelTierIdxLen(), uiCode,"profile_level_tier_idx[ i ]" );   pcVPS->setProfileLevelTierIdx( i , uiCode );
     1440    }
     1441  }
     1442
     1443  READ_FLAG( uiCode, "rep_format_idx_present_flag" ); pcVPS->setRepFormatIdxPresentFlag( uiCode == 1 );
     1444  if ( pcVPS->getRepFormatIdxPresentFlag() )
     1445  {
     1446    READ_CODE( 4, uiCode, "vps_num_rep_formats_minus1" ); pcVPS->setVpsNumRepFormatsMinus1( uiCode );
     1447  }
     1448
     1449  for (Int i = 0; i <= pcVPS->getVpsNumRepFormatsMinus1(); i++ )
     1450  {
     1451    assert( pcVPS->getRepFormat(i) == NULL );
     1452    TComRepFormat* repFormat = new TComRepFormat();
     1453    parseRepFormat( repFormat );
     1454    pcVPS->setRepFormat(i, repFormat );
     1455  }
     1456
     1457  if( pcVPS->getRepFormatIdxPresentFlag() )
     1458  {
     1459    for( Int i = 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
     1460    {
     1461      if( pcVPS->getVpsNumRepFormatsMinus1() > 0 )
     1462      {
     1463        READ_CODE( 4, uiCode, "vps_rep_format_idx" ); pcVPS->setVpsRepFormatIdx( i, uiCode );
     1464      }
     1465    }
     1466  }
     1467
     1468  READ_FLAG( uiCode, "max_one_active_ref_layer_flag" ); pcVPS->setMaxOneActiveRefLayerFlag ( uiCode == 1 );
     1469  READ_FLAG( uiCode, "cross_layer_irap_aligned_flag" ); pcVPS->setCrossLayerIrapAlignedFlag( uiCode == 1 );
     1470  READ_UVLC( uiCode, "direct_dep_type_len_minus2")    ; pcVPS->setDirectDepTypeLenMinus2   ( uiCode );
     1471
     1472  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
     1473  {
     1474    for( Int j = 0; j < i; j++ )
     1475    {
     1476      if (pcVPS->getDirectDependencyFlag( i, j) )
     1477      {       
     1478        READ_CODE( pcVPS->getDirectDepTypeLenMinus2( ) + 2,  uiCode, "direct_dependency_type[i][j]" ); pcVPS->setDirectDependencyType( i, j , uiCode);
     1479      }
     1480    }
     1481  }
     1482
     1483  READ_FLAG( uiCode, "vps_shvc_reserved_zero_flag" );
     1484  READ_FLAG( uiCode, "vps_vui_present_flag" )       ; pcVPS->setVpsVuiPresentFlag( uiCode == 1 );
     1485
     1486  if( pcVPS->getVpsVuiPresentFlag() )
     1487  {
     1488    m_pcBitstream->readOutTrailingBits(); // vps_vui_alignment_bit_equal_to_one
     1489    parseVPSVUI( pcVPS );
     1490  }     
     1491
     1492  pcVPS->checkVPSExtensionSyntax();
     1493  pcVPS->setRefLayers();
     1494}
     1495
     1496Void TDecCavlc::parseRepFormat( TComRepFormat* pcRepFormat )
     1497{
     1498  assert( pcRepFormat );
     1499
     1500  UInt uiCode;
     1501  READ_CODE( 2,  uiCode, "chroma_format_vps_idc" );          pcRepFormat->setChromaFormatVpsIdc       ( uiCode );
     1502  if ( pcRepFormat->getChromaFormatVpsIdc() == 3 )
     1503  {
     1504    READ_FLAG( uiCode, "separate_colour_plane_vps_flag" ); pcRepFormat->setSeparateColourPlaneVpsFlag( uiCode == 1 );
     1505  }
     1506  READ_CODE( 16, uiCode, "pic_width_vps_in_luma_samples" );  pcRepFormat->setPicWidthVpsInLumaSamples ( uiCode );
     1507  READ_CODE( 16, uiCode, "pic_height_vps_in_luma_samples" ); pcRepFormat->setPicHeightVpsInLumaSamples( uiCode );
     1508  READ_CODE( 4,  uiCode, "bit_depth_vps_luma_minus8" );      pcRepFormat->setBitDepthVpsLumaMinus8    ( uiCode );
     1509  READ_CODE( 4,  uiCode, "bit_depth_vps_chroma_minus8" );    pcRepFormat->setBitDepthVpsChromaMinus8  ( uiCode );
     1510}
     1511
     1512
     1513Void TDecCavlc::parseVPSVUI( TComVPS* pcVPS )
     1514{
     1515  assert( pcVPS );
     1516
     1517  TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( );
     1518
     1519  assert( pcVPSVUI );
     1520
     1521  UInt uiCode;
     1522  READ_FLAG( uiCode, "bit_rate_present_vps_flag" ); pcVPSVUI->setBitRatePresentVpsFlag( uiCode == 1 );
     1523  READ_FLAG( uiCode, "pic_rate_present_vps_flag" ); pcVPSVUI->setPicRatePresentVpsFlag( uiCode == 1 );
     1524  if( pcVPSVUI->getBitRatePresentVpsFlag( )  ||  pcVPSVUI->getPicRatePresentVpsFlag( ) )
     1525  {
     1526    for( Int i = 0; i  <=  pcVPS->getVpsNumberLayerSetsMinus1(); i++ )
     1527    {
     1528      for( Int j = 0; j  <=  pcVPS->getMaxTLayers(); j++ )
     1529      {
     1530        if( pcVPSVUI->getBitRatePresentVpsFlag( ) )
     1531        {
     1532          READ_FLAG( uiCode, "bit_rate_present_flag" ); pcVPSVUI->setBitRatePresentFlag( i, j, uiCode == 1 );           
     1533        }
     1534        if( pcVPSVUI->getPicRatePresentVpsFlag( )  )
     1535        {
     1536          READ_FLAG( uiCode, "pic_rate_present_flag" ); pcVPSVUI->setPicRatePresentFlag( i, j, uiCode == 1 );
     1537        }
     1538        if( pcVPSVUI->getBitRatePresentFlag( i, j ) )
     1539        {
     1540          READ_CODE( 16, uiCode, "avg_bit_rate" ); pcVPSVUI->setAvgBitRate( i, j, uiCode );
     1541          READ_CODE( 16, uiCode, "max_bit_rate" ); pcVPSVUI->setMaxBitRate( i, j, uiCode );
     1542        }
     1543        if( pcVPSVUI->getPicRatePresentFlag( i, j ) )
     1544        {
     1545          READ_CODE( 2,  uiCode, "constant_pic_rate_idc" ); pcVPSVUI->setConstantPicRateIdc( i, j, uiCode );
     1546          READ_CODE( 16, uiCode, "avg_pic_rate" );          pcVPSVUI->setAvgPicRate( i, j, uiCode );
     1547        }
     1548      }
     1549    }
     1550  }
     1551
     1552  for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
     1553  {
     1554    for( Int  j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ); j++ )
     1555    {
     1556      READ_FLAG( uiCode, "tile_boundaries_aligned_flag" ); pcVPSVUI->setTileBoundariesAlignedFlag( i, j, uiCode == 1 );
     1557    }
     1558  }
     1559
     1560  READ_FLAG( uiCode, "ilp_restricted_ref_layers_flag" ); pcVPSVUI->setIlpRestrictedRefLayersFlag( uiCode == 1 );
     1561
     1562  if( pcVPSVUI->getIlpRestrictedRefLayersFlag( ) )
     1563  {
     1564    for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
     1565    {
     1566      for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ); j++ )
     1567      {
     1568        READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); pcVPSVUI->setMinSpatialSegmentOffsetPlus1( i, j, uiCode );
     1569        if( pcVPSVUI->getMinSpatialSegmentOffsetPlus1( i, j ) > 0 )
     1570        {
     1571          READ_FLAG( uiCode, "ctu_based_offset_enabled_flag" ); pcVPSVUI->setCtuBasedOffsetEnabledFlag( i, j, uiCode == 1 );
     1572          if( pcVPSVUI->getCtuBasedOffsetEnabledFlag( i, j ) )
     1573          {
     1574            READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1" ); pcVPSVUI->setMinHorizontalCtuOffsetPlus1( i, j, uiCode );
     1575          }
     1576        }
     1577      }
     1578    }
     1579  }
     1580}
     1581#endif
     1582
     1583#if H_3D
     1584Void TDecCavlc::parseVPSExtension2( TComVPS* pcVPS )
     1585{
     1586  UInt uiCode;
     1587  for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ )
     1588  {
     1589#if H_3D_ARP
     1590    pcVPS->setUseAdvRP  ( i, 0 );
     1591    pcVPS->setARPStepNum( i, 1 );
     1592#endif 
     1593    if ( i != 0 )
     1594    {
     1595      if( !( pcVPS->getDepthId( i ) == 1 ) )
     1596      {
     1597#if H_3D_IV_MERGE
     1598        READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
     1599#endif
     1600#if H_3D_ARP
     1601        READ_FLAG( uiCode, "iv_res_pred_flag[i]"  );       pcVPS->setUseAdvRP  ( i, uiCode ); pcVPS->setARPStepNum( i, uiCode ? H_3D_ARP_WFNR : 1 );
     1602
     1603#endif
     1604#if H_3D_NBDV_REF
     1605        READ_FLAG( uiCode, "depth_refinement_flag[i]");    pcVPS->setDepthRefinementFlag  ( i, uiCode == 1 ? true : false );
     1606#endif
     1607#if H_3D_VSP
     1608        READ_FLAG( uiCode, "view_synthesis_pred_flag[i]"); pcVPS->setViewSynthesisPredFlag( i, uiCode == 1 ? true : false );
     1609#endif
     1610      }
     1611      else
     1612      {
     1613
     1614        READ_FLAG( uiCode, "vps_depth_modes_flag[i]" );             pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false );
     1615        //          READ_FLAG( uiCode, "lim_qt_pred_flag[i]");                  pcVPS->setLimQtPreFlag     ( i, uiCode == 1 ? true : false );
     1616#if H_3D_DIM_DLT
     1617        if( pcVPS->getVpsDepthModesFlag( i ) )
     1618        {
     1619          READ_FLAG( uiCode, "dlt_flag[i]" );                       pcVPS->setUseDLTFlag( i, uiCode == 1 ? true : false );
     1620        }
     1621        if( pcVPS->getUseDLTFlag( i ) )
     1622        {
     1623          // decode mapping
     1624          UInt uiNumDepthValues;
     1625          // parse number of values in DLT
     1626          READ_UVLC(uiNumDepthValues, "num_depth_values_in_dlt[i]");
     1627
     1628          // parse actual DLT values
     1629          Int* aiIdx2DepthValue = (Int*) calloc(uiNumDepthValues, sizeof(Int));
     1630          for(Int d=0; d<uiNumDepthValues; d++)
     1631          {
     1632            READ_UVLC(uiCode, "dlt_depth_value[i][d]");
     1633            aiIdx2DepthValue[d] = (Int)uiCode;
     1634          }
     1635
     1636          pcVPS->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);
     1637
     1638          // clean memory
     1639          free(aiIdx2DepthValue);
     1640        }
     1641#endif
     1642#if LGE_INTER_SDC_E0156
     1643            READ_FLAG( uiCode, "depth_inter_SDC_flag" );              pcVPS->setInterSDCFlag( i, uiCode ? true : false );
     1644#endif
     1645      }
     1646    }
     1647  }
     1648  READ_FLAG( uiCode, "iv_mv_scaling_flag");                       pcVPS->setIvMvScalingFlag( uiCode == 1 ? true : false );
     1649}
     1650#endif
     1651#endif
    11011652
    11021653Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)
     
    11291680#if H_MV
    11301681  vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId());
     1682#if H_MV5
     1683  assert( vps != NULL );
     1684 
     1685  sps->inferRepFormat  ( vps , rpcSlice->getLayerId() );
     1686  sps->inferScalingList( parameterSetManager->getActiveSPS( sps->getSpsScalingListRefLayerId() ) );   
     1687
     1688  rpcSlice->setVPS(vps);     
     1689  rpcSlice->setViewId   ( vps->getViewId   ( rpcSlice->getLayerId() )      );
     1690  rpcSlice->setViewIndex( vps->getViewIndex( rpcSlice->getLayerId() )      ); 
     1691#if H_3D 
     1692  rpcSlice->setIsDepth  ( vps->getDepthId  ( rpcSlice->getLayerId() ) == 1 );
     1693#endif
     1694#else
    11311695  assert(vps!=0);
    11321696  rpcSlice->setVPS(vps);     
     
    11371701#endif
    11381702#endif
     1703#endif
    11391704  rpcSlice->setSPS(sps);
    11401705  rpcSlice->setPPS(pps);
     
    11821747  {
    11831748#if H_MV   
     1749#if H_MV5
     1750    Int esb = 0; //Don't use i, otherwise will shadow something below
     1751    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     1752    {
     1753      esb++;
     1754      READ_FLAG( uiCode, "poc_reset_flag" ); rpcSlice->setPocResetFlag( uiCode == 1 );
     1755    }
     1756
     1757    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     1758    {
     1759      esb++;
     1760      READ_FLAG( uiCode, "discardable_flag" ); rpcSlice->setDiscardableFlag( uiCode == 1 );
     1761    }
     1762
     1763    for (; esb < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++)   
     1764#else
    11841765    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
    11851766    {
     
    11881769
    11891770    for (Int i = 1; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)   
     1771#endif
    11901772#else
    11911773    for (Int i = 0; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
     
    12511833      }
    12521834      rpcSlice->setPOC              (iPOCmsb+iPOClsb);
    1253 
     1835#if H_MV5
     1836#if H_MV
     1837      if ( rpcSlice->getPocResetFlag() ) 
     1838      {
     1839        rpcSlice->setPocBeforeReset   ( rpcSlice->getPOC() );
     1840        rpcSlice->setPOC              ( 0 );
     1841
     1842      }     
     1843#endif
     1844#endif
    12541845      TComReferencePictureSet* rps;
    12551846      rps = rpcSlice->getLocalRPS();
     
    13791970    }
    13801971#if H_MV
     1972#if H_MV5
     1973    Int layerId       = rpcSlice->getLayerId();
     1974    if( rpcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )    {   
     1975      READ_FLAG( uiCode, "inter_layer_pred_enabled_flag" ); rpcSlice->setInterLayerPredEnabledFlag( uiCode == 1 );
     1976      if( rpcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 )
     1977      {           
     1978        if( !vps->getMaxOneActiveRefLayerFlag()) 
     1979        {
     1980          READ_CODE( rpcSlice->getNumInterLayerRefPicsMinus1Len( ), uiCode, "num_inter_layer_ref_pics_minus1" ); rpcSlice->setNumInterLayerRefPicsMinus1( uiCode );
     1981        }
     1982        if ( rpcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) )
     1983        {
     1984          for( Int idx = 0; idx < rpcSlice->getNumActiveRefLayerPics(); idx++ )   
     1985          {
     1986            READ_CODE( rpcSlice->getInterLayerPredLayerIdcLen( ), uiCode, "inter_layer_pred_layer_idc" ); rpcSlice->setInterLayerPredLayerIdc( idx, uiCode );
     1987          }
     1988        }
     1989      } 
     1990    }
     1991#else
    13811992    Int layerIdInVps       = rpcSlice->getLayerIdInVps();
    13821993    if( rpcSlice->getLayerId() > 0 && vps->getNumDirectRefLayers( layerIdInVps ) > 0 )
     
    14022013      READ_FLAG( uiCode, "inter_layer_sample_pred_only_flag" ); rpcSlice->setInterLayerSamplePredOnlyFlag( uiCode == 1 );
    14032014    }
    1404 
     2015#endif
    14052016#endif
    14062017    if(sps->getUseSAO())
     
    15442155    if ( rpcSlice->getEnableTMVPFlag() )
    15452156    {
     2157#if !H_MV5
    15462158#if H_MV
    15472159      if( rpcSlice->getLayerId() > 0 && rpcSlice->getNumActiveMotionPredRefLayers() > 0 )
     
    15572169      {
    15582170#endif
     2171#endif
    15592172      if ( rpcSlice->getSliceType() == B_SLICE )
    15602173      {
     
    15782191        rpcSlice->setColRefIdx(0);
    15792192      }
    1580 #if H_MV
    1581       }
     2193#if !H_MV5
     2194#if H_MV
     2195      }
     2196#endif
    15822197#endif
    15832198    }
Note: See TracChangeset for help on using the changeset viewer.