Changeset 622 in 3DVCSoftware for trunk/source/Lib/TLibDecoder


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

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

Location:
trunk/source/Lib/TLibDecoder
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibDecoder/SyntaxElementParser.cpp

    r608 r622  
    5050  xReadCode (length, rValue);
    5151#if H_MV_ENC_DEC_TRAC
    52   if ( g_disableHLSTrace )
     52  if ( g_disableHLSTrace || !g_HLSTraceEnable )
    5353  {
    5454    return;
     
    7171  xReadUvlc (rValue);
    7272#if H_MV_ENC_DEC_TRAC
    73   if ( g_disableHLSTrace )
     73  if ( g_disableHLSTrace  || !g_HLSTraceEnable )
    7474  {
    7575    return;
     
    8585  xReadSvlc(rValue);
    8686#if H_MV_ENC_DEC_TRAC
    87   if ( g_disableHLSTrace )
     87  if ( g_disableHLSTrace  || !g_HLSTraceEnable  )
    8888  {
    8989    return;
     
    9999  xReadFlag(rValue);
    100100#if H_MV_ENC_DEC_TRAC
    101   if ( g_disableHLSTrace )
     101  if ( g_disableHLSTrace  || !g_HLSTraceEnable )
    102102  {
    103103    return;
  • 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    }
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.h

    r608 r622  
    7676  Void  parseQtRootCbf      ( UInt uiAbsPartIdx, UInt& uiQtRootCbf );
    7777  Void  parseVPS            ( TComVPS* pcVPS );
     78#if H_MV5
     79#if H_MV
     80  Void  parseVPSExtension   ( TComVPS* pcVPS );
     81  Void  parseRepFormat      ( TComRepFormat* pcRepFormat );
     82  Void  parseVPSVUI         ( TComVPS* pcVPS );
     83#endif
     84
     85#if H_MV
     86  Void  parseSPSExtension   ( TComSPS* pcSPS ); 
     87#endif
     88#endif
    7889#if H_3D
     90#if H_MV5
     91  Void  parseVPSExtension2  ( TComVPS* pcVPS );
     92  Void  parseSPSExtension2  ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
     93#endif
    7994  Void  parseSPS            ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
    8095#else
  • trunk/source/Lib/TLibDecoder/TDecCu.cpp

    r608 r622  
    315315#if H_3D_NBDV_REF
    316316      if(pcCU->getSlice()->getVPS()->getDepthRefinementFlag( pcCU->getSlice()->getLayerIdInVps() ))  //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done.
     317      {
    317318        DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true);
     319      }
    318320      else
    319321#endif
     322      {
    320323        DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo);
     324      }
     325
     326#if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC   
     327      if ( g_decTraceDispDer )
     328      {
     329        DTRACE_CU( "RefViewIdx",  DvInfo.m_aVIdxCan );       
     330        DTRACE_CU( "MvDisp[x]", DvInfo.m_acNBDV.getHor() );
     331        DTRACE_CU( "MvDisp[y]", DvInfo.m_acNBDV.getVer() );
     332        DTRACE_CU( "MvRefinedDisp[x]", DvInfo.m_acDoNBDV.getHor() );
     333        DTRACE_CU( "MvRefinedDisp[y]", DvInfo.m_acDoNBDV.getVer() );
     334      }
     335#endif
    321336
    322337      pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth);
     
    366381    Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    367382    memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    368 #if MTK_VSP_FIX_ALIGN_WD_E0172
    369383    InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
    370384    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand, uiMergeIndex );
    371 #else
    372 #if MTK_VSP_FIX_E0172
    373     Int vspDir[MRG_MAX_NUM_CANDS_MEM];
    374     memset(vspDir, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    375     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag,vspDir, numValidMergeCand, uiMergeIndex );
    376     pcCU->setVSPDirSubParts( vspDir[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    377 #else
    378     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand, uiMergeIndex );
    379 #endif
    380 #endif// end of MTK_VSP_FIX_ALIGN_WD_E0172
    381385    pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    382386#else
    383387    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    384388#endif
    385 #if MTK_VSP_FIX_ALIGN_WD_E0172
     389#if H_3D_VSP
    386390    if(vspFlag[uiMergeIndex])
    387391    {
     
    400404        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
    401405        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
     406#if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC   
     407        if ( g_decTraceMvFromMerge )
     408        {       
     409          if ( uiRefListIdx == 0 )
     410          {
     411            DTRACE_PU( "mvL0[0]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getHor());
     412            DTRACE_PU( "mvL0[1]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getVer());
     413            DTRACE_PU( "refIdxL0   ", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx());
     414          }
     415          else
     416          {
     417            DTRACE_PU( "mvL1[0]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getHor());
     418            DTRACE_PU( "mvL1[1]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getVer());
     419            DTRACE_PU( "refIdxL1", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx());
     420          }
     421        }
     422#endif
    402423      }
    403424    }
  • trunk/source/Lib/TLibDecoder/TDecEntropy.cpp

    r608 r622  
    243243          Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    244244          memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    245 #if MTK_VSP_FIX_ALIGN_WD_E0172
    246245          InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
    247246          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
    248 #else
    249 #if MTK_VSP_FIX_E0172
    250           Int vspDir[MRG_MAX_NUM_CANDS_MEM];
    251           memset(vspDir, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    252           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, vspDir, numValidMergeCand );
    253           pcCU->setVSPDirSubParts( vspDir[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    254 #else
    255           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand );
    256 #endif
    257 #endif//end of MTK_VSP_FIX_ALIGN_WD_E0172
    258247          pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    259 #if MTK_VSP_FIX_ALIGN_WD_E0172
     248
    260249          if(vspFlag[uiMergeIndex])
    261250          {
    262251            pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth);
    263252          }
    264 #endif
    265253#else
    266254          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     
    272260      else
    273261      {
    274         uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); // Redundant line
     262        uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    275263#if H_3D_VSP
    276264        Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    277265        memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    278 #if MTK_VSP_FIX_ALIGN_WD_E0172
    279266        InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
    280267        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo,numValidMergeCand, uiMergeIndex );
    281 #else
    282 #if MTK_VSP_FIX_E0172
    283         Int vspDir[MRG_MAX_NUM_CANDS_MEM];
    284         memset(vspDir, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    285         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, vspDir,numValidMergeCand, uiMergeIndex );
    286         pcCU->setVSPDirSubParts( vspDir[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    287 #else
    288         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand, uiMergeIndex );
    289 #endif
    290 #endif//end of MTK_VSP_FIX_ALIGN_WD_E0172
    291268        pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    292 #if MTK_VSP_FIX_ALIGN_WD_E0172
    293269        if(vspFlag[uiMergeIndex])
    294270        {
    295271          pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth);
    296272        }
    297 #endif
    298273#else
    299274        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     
    327302      }
    328303    }
    329 #if MTK_VSP_FIX_E0172 || MTK_VSP_FIX_ALIGN_WD_E0172
     304#if H_3D_VSP
    330305    if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) && (pcCU->getVSPFlag(uiSubPartIdx) == false))
    331306#else
  • trunk/source/Lib/TLibDecoder/TDecSbac.cpp

    r608 r622  
    8989#if H_3D_DIM_DMM
    9090, m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
    91 #if !SEC_DMM2_E0146
     91#if !SEC_DMM2_E0146_HHIFIX
    9292, m_cDmm2DataSCModel          ( 1,             1,               NUM_DMM2_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
    9393#endif
     
    179179#if H_3D_DIM_DMM
    180180  m_cDmm1DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM1_DATA );
    181 #if !SEC_DMM2_E0146
     181#if !SEC_DMM2_E0146_HHIFIX
    182182  m_cDmm2DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM2_DATA );
    183183#endif
     
    255255#if H_3D_DIM_DMM
    256256  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
    257 #if !SEC_DMM2_E0146
     257#if !SEC_DMM2_E0146_HHIFIX
    258258  m_cDmm2DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM2_DATA );
    259259#endif
     
    444444  ruiTabIdx = uiIdx;
    445445}
    446 #if !SEC_DMM2_E0146
     446#if !SEC_DMM2_E0146_HHIFIX
    447447Void TDecSbac::xParseDmm2Offset( Int& riOffset )
    448448{
     
    584584  m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) );
    585585 
     586#if H_MV_ENC_DEC_TRAC
     587  DTRACE_CU("sdc_residual_flag[i]", uiResidual)
     588#endif
     589 
    586590  if (uiResidual)
    587591  {
    588592    // decode residual sign bit
    589593    m_pcTDecBinIf->decodeBinEP(uiSign);
     594#if H_MV_ENC_DEC_TRAC
     595    DTRACE_CU("sdc_residual_sign_flag[i]", uiSign)
     596#endif
    590597   
    591598    // decode residual magnitude
     
    617624    }
    618625    else
     626    {
    619627      uiAbsIdx = uiCount;
     628    }
     629 
     630#if H_MV_ENC_DEC_TRAC
     631    DTRACE_CU("sdc_residual_abs_minus1[i]", uiAbsIdx)
     632#endif
    620633   
    621634    uiAbsIdx += 1;
     
    11621175      pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, absPartIdx, depth );
    11631176    } break;
    1164 #if !SEC_DMM2_E0146
     1177#if !SEC_DMM2_E0146_HHIFIX
    11651178  case( DMM2_IDX ):
    11661179    {
     
    13331346        binNum = 0;
    13341347#if LGE_SDC_REMOVE_DC_E0158
    1335 #if !SEC_DMM2_E0146
     1348#if !SEC_DMM2_E0146_HHIFIX
    13361349        while( symbol && binNum < 2 )
    13371350#endif
    13381351#else
    1339 #if SEC_DMM2_E0146
     1352#if SEC_DMM2_E0146_HHIFIX
    13401353        while( symbol && binNum < 2 )
    13411354#else
     
    13581371    else if( modeCode == 6  ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;}
    13591372#if LGE_SDC_REMOVE_DC_E0158
    1360 #if SEC_DMM2_E0146
     1373#if SEC_DMM2_E0146_HHIFIX
    13611374    else if( modeCode == 7 )  { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
    13621375#else
     
    13661379#else
    13671380    else if( modeCode == 14 ) { dir =      DC_IDX;             sdcFlag = 1;}
    1368 #if SEC_DMM2_E0146
     1381#if SEC_DMM2_E0146_HHIFIX
    13691382    else if( modeCode == 15 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
    13701383#else
  • trunk/source/Lib/TLibDecoder/TDecSbac.h

    r608 r622  
    102102#if H_3D_DIM_DMM
    103103  Void  xParseDmm1WedgeIdx   ( UInt& ruiTabIdx, Int iNumBit );
    104 #if !SEC_DMM2_E0146
     104#if !SEC_DMM2_E0146_HHIFIX
    105105  Void  xParseDmm2Offset     ( Int& riOffset );
    106106#endif
     
    216216#if H_3D_DIM_DMM
    217217  ContextModel3DBuffer m_cDmm1DataSCModel;
    218 #if !SEC_DMM2_E0146
     218#if !SEC_DMM2_E0146_HHIFIX
    219219  ContextModel3DBuffer m_cDmm2DataSCModel;
    220220#endif
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r608 r622  
    436436  Window defaultDisplayWindow = pcSlice->getSPS()->getVuiParametersPresentFlag() ? pcSlice->getSPS()->getVuiParameters()->getDefaultDisplayWindow() : Window();
    437437
     438#if H_MV5
     439#if H_MV
     440    assert( conformanceWindow   .getScaledFlag() );
     441    assert( defaultDisplayWindow.getScaledFlag() );
     442#endif
     443#endif
    438444  for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++)
    439445  {
     
    512518  m_cCuDecoder.destroy();       
    513519#if H_MV
     520#if H_MV5
     521  TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); 
     522#else
    514523  TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer ); 
     524#endif
    515525  TComSlice::markCurrPic( pcPic );
    516526  TComSlice::markIvRefPicsAsUnused   ( m_ivPicLists, targetDecLayerIdSet, m_parameterSetManagerDecoder.getActiveVPS(), m_layerId, poc );
     
    581591  assert (sps != 0);
    582592
     593#if H_MV5
     594#if H_MV
     595  TComVPS* vps = m_parameterSetManagerDecoder.getVPS(sps->getVPSId());
     596  assert (vps != 0);
     597  if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP(), m_layerId ) )
     598#else
    583599  if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
     600#endif
     601#else
     602  if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
     603#endif
    584604  {
    585605    printf ("Parameter set activation failed!");
     
    607627  m_apcSlicePilot->setSPS(sps);
    608628#if H_MV
     629#if H_MV5
     630  m_apcSlicePilot->setVPS(vps); 
     631  sps->inferRepFormat  ( vps , m_layerId );
     632  sps->inferScalingList( m_parameterSetManagerDecoder.getActiveSPS( sps->getSpsScalingListRefLayerId() ) );
     633#else
    609634  m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getActiveVPS() );
     635#endif
    610636#endif
    611637  pps->setSPS(sps);
     
    669695
    670696#if H_MV
     697#if H_MV5
     698  m_apcSlicePilot->setRefPicSetInterLayer( & m_refPicSetInterLayer0, &m_refPicSetInterLayer1 );
     699#else
    671700  m_apcSlicePilot->setRefPicSetInterLayer( & m_refPicSetInterLayer );
     701#endif
    672702  m_apcSlicePilot->setLayerId( nalu.m_layerId );
    673703#endif
     
    676706#if H_MV 
    677707  TComVPS* vps     = m_apcSlicePilot->getVPS();
     708#if H_MV5
     709  Int layerId  = nalu.m_layerId;   
     710  setViewId   ( vps->getViewId   ( layerId )      ); 
     711#if H_3D
     712  setViewIndex( vps->getViewIndex( layerId )      ); 
     713  setIsDepth  ( vps->getDepthId  ( layerId ) == 1 ); 
     714  m_ivPicLists->setVPS( vps );
     715#endif
     716#else
    678717  Int layerIdInVps = vps->getLayerIdInVps( nalu.m_layerId ); 
    679718  setViewId   ( vps->getViewId   ( layerIdInVps )      ); 
     
    684723#endif
    685724#endif
     725#endif
    686726    // Skip pictures due to random access
    687727    if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
     
    723763#endif
    724764  // actual decoding starts here
     765#if H_MV5
     766#if H_MV
     767   // This part needs further testing !
     768   if ( m_apcSlicePilot->getPocResetFlag() )
     769   {   
     770     xResetPocInPicBuffer();
     771   }
     772#endif
     773#endif
    725774  xActivateParameterSets();
    726775
     
    742791    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
    743792#if H_MV
     793#if H_MV5
     794    m_apcSlicePilot->createInterLayerReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer0, m_refPicSetInterLayer1 );
     795#else
    744796    m_apcSlicePilot->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer );
     797#endif
    745798#endif
    746799    //  Get a new picture buffer
     
    888941    // Set reference list
    889942#if H_MV   
     943#if H_MV5
     944    std::vector< TComPic* > tempRefPicLists[2];
     945    std::vector< Bool     > usedAsLongTerm [2];
     946    Int       numPocTotalCurr;
     947
     948    pcSlice->getTempRefPicLists( m_cListPic, m_refPicSetInterLayer0, m_refPicSetInterLayer1, tempRefPicLists, usedAsLongTerm, numPocTotalCurr);
     949    pcSlice->setRefPicList     ( tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true );
     950#else
    890951    pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer, true );   
     952#endif
    891953#if H_3D_ARP
    892954    pcSlice->setARPStepNum();
    893955    if( pcSlice->getARPStepNum() > 1 )
    894956    {
     957      // GT: This seems to be broken, not all nuh_layer_ids are necessarily present
    895958      for(Int iLayerId = 0; iLayerId < nalu.m_layerId; iLayerId ++ )
    896959      {
     
    10211084  TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 );
    10221085  assert( vps != 0 );
     1086#if H_MV5
     1087  m_cEntropyDecoder.decodeSPS( sps, vps->getViewIndex( m_layerId ), ( vps->getDepthId( m_layerId ) == 1 ) );
     1088#else
    10231089  Int layerIdInVPS = vps->getLayerIdInVps( m_layerId );
    10241090  m_cEntropyDecoder.decodeSPS( sps, vps->getViewIndex( layerIdInVPS ), ( vps->getDepthId( layerIdInVPS ) == 1 ) );
     1091#endif
    10251092#else
    10261093  m_cEntropyDecoder.decodeSPS( sps );
     
    10321099{
    10331100  TComPPS* pps = new TComPPS();
     1101#if H_MV5
     1102#if H_MV
     1103  pps->setLayerId( getLayerId() );
     1104#endif
     1105#endif
    10341106  m_cEntropyDecoder.decodePPS( pps );
    10351107  m_parameterSetManagerDecoder.storePrefetchedPPS( pps );
     
    10401112  if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
    10411113  {
     1114#if H_MV5
     1115#if H_MV
     1116    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS( m_layerId ) );
     1117#else
    10421118    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
     1119#endif
     1120#else
     1121    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); 
     1122#endif
    10431123  }
    10441124  else
    10451125  {
     1126#if H_MV5
     1127#if H_MV
     1128    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS( m_layerId ) );
     1129#else
    10461130    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
     1131#endif
     1132#else
     1133    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
     1134#endif
    10471135    SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS);
    10481136    if (activeParamSets.size()>0)
     
    10511139      m_parameterSetManagerDecoder.applyPrefetchedPS();
    10521140      assert(seiAps->activeSeqParamSetId.size()>0);
     1141#if H_MV5
     1142#if H_MV
     1143      if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0], m_layerId ))
     1144#else
    10531145      if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0] ))
     1146#endif
     1147#else
     1148      if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0] ))
     1149#endif
    10541150      {
    10551151        printf ("Warning SPS activation with Active parameter set SEI failed");
     
    12101306}
    12111307
     1308#if H_MV5
     1309Void TDecTop::xResetPocInPicBuffer()
     1310{
     1311  TComList<TComPic*>::iterator  iterPic   = m_cListPic.begin();
     1312  while (iterPic != m_cListPic.end())
     1313  {
     1314    TComPic* pic = *(iterPic++);
     1315    if ( pic->getReconMark() )
     1316    {
     1317      for( Int i = 0; i < pic->getNumAllocatedSlice(); i++)
     1318      {
     1319        TComSlice* slice = pic->getSlice( i );
     1320        slice->setPOC ( slice->getPOC() - m_apcSlicePilot->getPocBeforeReset() );           
     1321      }         
     1322    }     
     1323  }
     1324}
     1325#endif
    12121326#endif
    12131327//! \}
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r608 r622  
    216216  Int                     m_viewId;
    217217  TComPicLists*           m_ivPicLists;
     218#if H_MV5
     219  std::vector<TComPic*>   m_refPicSetInterLayer0;
     220  std::vector<TComPic*>   m_refPicSetInterLayer1;
     221#else
    218222  std::vector<TComPic*>   m_refPicSetInterLayer;
     223#endif
    219224#if H_3D
    220225  Int                     m_viewIndex;
     
    274279  TComPic*  xGetPic( Int layerId, Int poc );
    275280  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag ); 
     281#if H_MV5
     282  Void      xResetPocInPicBuffer();
     283#endif
    276284#else
    277285  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
Note: See TracChangeset for help on using the changeset viewer.