Changeset 730 in 3DVCSoftware


Ignore:
Timestamp:
9 Dec 2013, 17:16:03 (10 years ago)
Author:
tech
Message:

MV HEVC 6 HLS changes.

Location:
branches/HTM-9.0-dev0
Files:
1 added
23 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-9.0-dev0/source/App/TAppDecoder/TAppDecCfg.cpp

    r608 r730  
    8585  ("OutputBitDepthC,d", m_outputBitDepthC, 0, "bit depth of YUV output chroma component (default: use 0 for native depth)")
    8686#if H_MV
    87   ("MaxLayerId,-ls", m_maxLayerId, MAX_NUM_LAYER_IDS-1, "Maximum LayerId to be decoded.")
     87#if H_MV_6_HRD_O0217_13
     88  ("TargetOptLayerSetIdx,x", m_targetOptLayerSetIdx, -1, "Target output layer set index. (default: -1, determine automatically to be equal to highest layer set index") // Should actually equal to 0 as default. However, this would cause only the base layer to be decoded. 
     89#else
     90  ("MaxLayerId,-ls", m_maxLayerId, MAX_NUM_LAYER_IDS-1, "Maximum LayerId to be decoded.")   
     91#endif
    8892#endif
    8993  ("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers")
     
    124128  if ( !cfg_TargetDecLayerIdSetFile.empty() )
    125129  {
     130#if H_MV_6_HRD_O0217_13
     131    m_targetDecLayerIdSetFileEmpty = false;     
     132#endif
    126133    FILE* targetDecLayerIdSetFile = fopen ( cfg_TargetDecLayerIdSetFile.c_str(), "r" );
    127134    if ( targetDecLayerIdSetFile )
     
    167174  }
    168175#if H_MV
     176#if H_MV_6_HRD_O0217_13
     177  m_targetDecLayerIdSet.push_back( 0 );         // Only base layer at startup
     178#else
    169179  else
    170180  {
     
    174184    }
    175185  }
     186#endif
    176187#endif
    177188
  • branches/HTM-9.0-dev0/source/App/TAppDecoder/TAppDecCfg.h

    r608 r730  
    5959  Char*         m_pchBitstreamFile;                   ///< input bitstream file name
    6060#if H_MV
     61#if H_MV_6_HRD_O0217_13
     62  Int           m_targetOptLayerSetIdx;               ///< target output layer set index
     63#endif
    6164  Int           m_maxLayerId;                         ///< maximum nuh_layer_id decoded
    6265  std::vector<Char*> m_pchReconFiles;                 ///< array of output reconstruction file name create from output reconstruction file name
     
    7477
    7578  std::vector<Int> m_targetDecLayerIdSet;             ///< set of LayerIds to be included in the sub-bitstream extraction process.
     79#if H_MV_6_HRD_O0217_13
     80  Bool          m_targetDecLayerIdSetFileEmpty;      ///< indication if target layers are given by file
     81#endif
    7682  Int           m_respectDefDispWindow;               ///< Only output content inside the default display window
    7783
     
    8389  : m_pchBitstreamFile(NULL)
    8490#if H_MV
     91#if !H_MV_6_HRD_O0217_13
    8592  , m_maxLayerId(0)
     93#endif
    8694#endif
    8795  , m_pchReconFile(NULL)
     
    9199  , m_iMaxTemporalLayer(-1)
    92100  , m_decodedPictureHashSEIEnabled(0)
     101#if H_MV_6_HRD_O0217_13
     102  , m_targetDecLayerIdSetFileEmpty(true)
     103#endif
    93104  , m_respectDefDispWindow(0)
    94105  {}
  • branches/HTM-9.0-dev0/source/App/TAppDecoder/TAppDecTop.cpp

    r655 r730  
    6161{
    6262#if H_MV
     63#if H_MV_LAYER_WISE_STARTUP
     64  for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++)
     65  {
     66    m_layerIdToDecIdx[i] = -1;
     67    m_layerInitilizedFlags[i] = false;
     68  }
     69#else
    6370  for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) m_layerIdToDecIdx[i] = -1;
     71#endif
    6472#endif
    6573#if H_3D
     
    184192    Bool newSliceDiffPoc   = false;
    185193    Bool newSliceDiffLayer = false;
     194#if H_MV_FIX_SKIP_PICTURES
     195    Bool sliceSkippedFlag = false;
     196#endif
    186197#if H_3D
    187198    Bool allLayersDecoded  = false;     
     
    201212      read(nalu, nalUnit);
    202213#if H_MV     
    203       Int decIdx     = xGetDecoderIdx( nalu.m_layerId , true );
    204      
     214#if !H_MV_6_HRD_O0217_13
     215      Int decIdx     = xGetDecoderIdx( nalu.m_layerId , true );     
     216#endif
     217#if H_MV_6_LAYER_ID_32
     218      if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) || nalu.m_layerId > MAX_NUM_LAYER_IDS-1 )
     219#else           
    205220      if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) )
     221#endif
    206222      {
    207223        bNewPicture = false;
     224#if H_MV_6_LAYER_ID_32
     225        if ( !bitstreamFile )
     226        {
     227          decIdxLastPic     = decIdxCurrPic;
     228        }
     229#endif
    208230      }
    209231      else
    210       {
     232      {
     233#if H_MV_6_HRD_O0217_13
     234        Int decIdx     = xGetDecoderIdx( nalu.m_layerId , true );     
     235#endif
    211236        newSliceDiffLayer = nalu.isSlice() && ( nalu.m_layerId != layerIdCurrPic ) && !firstSlice;
     237#if H_MV_FIX_SKIP_PICTURES
     238        newSliceDiffPoc   = m_tDecTop[decIdx]->decode(nalu, m_iSkipFrame, m_pocLastDisplay[decIdx], newSliceDiffLayer, sliceSkippedFlag );
     239#else
    212240        newSliceDiffPoc   = m_tDecTop[decIdx]->decode(nalu, m_iSkipFrame, m_pocLastDisplay[decIdx], newSliceDiffLayer );
     241#endif
    213242        // decode function only returns true when all of the following conditions are true
    214243        // - poc in particular layer changes
    215244        // - nalu does not belong to first slice in layer
    216         // - nalu.isSlice() == true     
    217 
     245        // - nalu.isSlice() == true             
     246
     247#if H_MV_6_HRD_O0217_13
     248        // Update TargetDecLayerIdList only when not specified by layer id file, specification by file might actually out of conformance.
     249        if (nalu.m_nalUnitType == NAL_UNIT_VPS && m_targetDecLayerIdSetFileEmpty )
     250        {
     251          TComVPS* vps = m_tDecTop[decIdx]->getPrefetchedVPS();
     252          if ( m_targetOptLayerSetIdx == -1 )
     253          {
     254            // Not normative! Corresponds to specification by "External Means". (Should be set equal to 0, when no external means available. )
     255            m_targetOptLayerSetIdx = vps->getVpsNumLayerSetsMinus1();
     256          }
     257
     258          m_targetDecLayerIdSet = vps->getTargetDecLayerIdList( m_targetOptLayerSetIdx );
     259        }
     260#endif
     261#if H_MV_FIX_SKIP_PICTURES
     262        bNewPicture       = ( newSliceDiffLayer || newSliceDiffPoc ) && !sliceSkippedFlag;
     263        if ( nalu.isSlice() && firstSlice && !sliceSkippedFlag )       
     264#else
    218265        bNewPicture       = newSliceDiffLayer || newSliceDiffPoc;
    219 
    220266        if ( nalu.isSlice() && firstSlice )
     267#endif
    221268        {
    222269          layerIdCurrPic = nalu.m_layerId;
     
    832879{
    833880  Int decIdx = -1;
     881
     882#if H_MV_6_LAYER_ID_32
     883  if ( layerId > MAX_NUM_LAYER_IDS-1 ) 
     884  {
     885    return decIdx;
     886  }
     887#endif
     888
    834889  if ( m_layerIdToDecIdx[ layerId ] != -1 )
    835890  {     
     
    850905    m_tDecTop[ decIdx ]->setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
    851906    m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists );
     907#if H_MV_LAYER_WISE_STARTUP
     908    m_tDecTop[ decIdx ]->setLayerInitilizedFlags( m_layerInitilizedFlags );
     909#endif
     910
    852911#if H_3D
    853912   m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector );
  • branches/HTM-9.0-dev0/source/App/TAppDecoder/TAppDecTop.h

    r655 r730  
    6767  Int                             m_numDecoders;                               ///< number of decoder instances
    6868  TComPicLists                    m_ivPicLists;                                ///< picture buffers of decoder instances
     69#if H_MV_LAYER_WISE_STARTUP
     70  Bool                            m_layerInitilizedFlags[ MAX_NUM_LAYER_IDS ]; ///< for layerwise startup
     71#endif
     72
    6973#else
    7074  TDecTop                         m_cTDecTop;                     ///< decoder class
  • branches/HTM-9.0-dev0/source/App/TAppEncoder/TAppEncCfg.cpp

    r724 r730  
    391391  ("VpsNumLayerSets",       m_vpsNumLayerSets    , 1                    , "Number of layer sets")   
    392392  ("LayerIdsInSet_%d",      m_layerIdsInSets     , std::vector<Int>(1,0), MAX_VPS_OP_SETS_PLUS1 ,"LayerIds of Layer set") 
     393#if H_MV_6_PS_0109_25
     394  ("DefaultOneTargetOutputLayerFlag"  , m_defaultOneTargetOutputLayerIdc  , 0, "Output highest layer of layer sets by default")
     395#else
    393396  ("DefaultOneTargetOutputLayerFlag", m_defaultOneTargetOutputLayerFlag,  false , "Output highest layer of layer sets by default")     
     397#endif
    394398  ("OutputLayerSetIdx",     m_outputLayerSetIdx  , std::vector<Int>(0,0), "Indices of layer sets used as additional output layer sets") 
    395399  ("LayerIdsInAddOutputLayerSet_%d", m_layerIdsInAddOutputLayerSet      , std::vector<Int>(1,0), MAX_VPS_ADD_OUTPUT_LAYER_SETS, "LayerIds of additional output layers") 
     
    448452  ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs")
    449453 
    450   // Coding structure paramters
     454  // Coding structure parameters
     455#if H_MV_LAYER_WISE_STARTUP
     456  ("IntraPeriod,-ip",         m_iIntraPeriod,std::vector<Int>(1,-1), "Intra period in frames, (-1: only first frame), per layer")
     457#else
    451458  ("IntraPeriod,-ip",         m_iIntraPeriod,              -1, "Intra period in frames, (-1: only first frame)")
     459#endif
    452460  ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR)")
    453461  ("GOPSize,g",               m_iGOPSize,                   1, "GOP size of temporal structure")
     
    624632
    625633#if H_MV
     634
     635#if H_MV_6_HRD_O0217_13
     636  // DBP Size
     637  ("SubLayerFlagInfoPresentFlag",  m_subLayerFlagInfoPresentFlag , false                                           , "SubLayerFlagInfoPresentFlag")
     638#endif
    626639  // VPS VUI
    627640  ("VpsVuiPresentFlag"           , m_vpsVuiPresentFlag           , false                                           , "VpsVuiPresentFlag           ")
     641#if H_MV_6_PS_O0223_29
     642  ("CrossLayerPicTypeAlignedFlag", m_crossLayerPicTypeAlignedFlag, false                                           , "CrossLayerPicTypeAlignedFlag")  // Could actually be derived by the encoder
     643  ("CrossLayerIrapAlignedFlag"   , m_crossLayerIrapAlignedFlag   , false                                           , "CrossLayerIrapAlignedFlag   ")  // Could actually be derived by the encoder
     644#endif
    628645  ("BitRatePresentVpsFlag"       , m_bitRatePresentVpsFlag       , false                                           , "BitRatePresentVpsFlag       ")
    629646  ("PicRatePresentVpsFlag"       , m_picRatePresentVpsFlag       , false                                           , "PicRatePresentVpsFlag       ")
     
    634651  ("ConstantPicRateIdc"          , m_constantPicRateIdc          , std::vector< Int  >(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "ConstantPicRateIdc per sub layer for the N-th layer set")
    635652  ("AvgPicRate"                  , m_avgPicRate                  , std::vector< Int  >(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "AvgPicRate         per sub layer for the N-th layer set")
     653#if H_MV_6_O0226_37
     654  ("TilesNotInUseFlag"            , m_tilesNotInUseFlag            , true                                          , "TilesNotInUseFlag            ")
     655  ("TilesInUseFlag"               , m_tilesInUseFlag               , std::vector< Bool >(1,false)                   , "TilesInUseFlag               ")
     656  ("LoopFilterNotAcrossTilesFlag" , m_loopFilterNotAcrossTilesFlag , std::vector< Bool >(1,false)                  , "LoopFilterNotAcrossTilesFlag ")
     657  ("WppNotInUseFlag"              , m_wppNotInUseFlag              , true                                          , "WppNotInUseFlag              ")
     658  ("WppInUseFlag"                 , m_wppInUseFlag                 , std::vector< Bool >(1,0)                      , "WppInUseFlag                 ")
     659#endif
    636660  ("TileBoundariesAlignedFlag"   , m_tileBoundariesAlignedFlag   , std::vector< Bool >(1,0)  ,MAX_NUM_LAYERS       , "TileBoundariesAlignedFlag    per direct reference for the N-th layer")
    637661  ("IlpRestrictedRefLayersFlag"  , m_ilpRestrictedRefLayersFlag  , false                                           , "IlpRestrictedRefLayersFlag")
     
    10501074  xResizeVector( m_bLoopFilterDisable );
    10511075  xResizeVector( m_bUseSAO );
    1052 
     1076#if H_MV_LAYER_WISE_STARTUP
     1077  xResizeVector( m_iIntraPeriod );
     1078#endif
     1079#if H_MV_6_O0226_37
     1080  xResizeVector( m_tilesInUseFlag );
     1081  xResizeVector( m_loopFilterNotAcrossTilesFlag );
     1082  xResizeVector( m_wppInUseFlag );
     1083#endif
    10531084#else
    10541085  m_aidQP = new Int[ m_framesToBeEncoded + m_iGOPSize + 1 ];
     
    13951426    for ( Int i = 0; i < m_layerIdsInSets[lsIdx].size(); i++ )
    13961427    {
     1428#if H_MV_6_LAYER_ID_32
     1429      xConfirmPara( m_layerIdsInSets[lsIdx][i] < 0 || m_layerIdsInSets[lsIdx].size() >= MAX_NUM_LAYER_IDS, "LayerIdsInSet must be greater than and less than MAX_NUM_LAYER_IDS" );
     1430#else
    13971431      xConfirmPara( m_layerIdsInSets[lsIdx][i] < 0 || m_layerIdsInSets[lsIdx].size() >= MAX_NUM_LAYER_IDS, "LayerIdsInSet must be greater than and less than 64" );
     1432#endif
    13981433    }
    13991434  }
     
    14201455    }
    14211456  }
     1457
     1458#if H_MV_6_PS_0109_25
     1459  xConfirmPara( m_defaultOneTargetOutputLayerIdc < 0 || m_defaultOneTargetOutputLayerIdc > 1, "Default one target output layer idc must be equal to 0 or equal to 1" );
     1460#endif
    14221461  xConfirmPara( m_profileLevelTierIdx.size() < m_vpsNumLayerSets + m_outputLayerSetIdx.size(), "The number of Profile Level Tier indices must be equal to the number of layer set plus the number of output layer set indices" );
    14231462
     
    14361475  xConfirmPara( m_iGOPSize < 1 ,                                                            "GOP Size must be greater or equal to 1" );
    14371476  xConfirmPara( m_iGOPSize > 1 &&  m_iGOPSize % 2,                                          "GOP Size must be a multiple of 2, if GOP Size is greater than 1" );
     1477#if H_MV_LAYER_WISE_STARTUP
     1478  for( Int layer = 0; layer < m_numberOfLayers; layer++ )
     1479  {
     1480    xConfirmPara( (m_iIntraPeriod[layer] > 0 && m_iIntraPeriod[layer] < m_iGOPSize) || m_iIntraPeriod[layer] == 0, "Intra period must be more than GOP size, or -1 , not 0" );
     1481  }
     1482#else
    14381483  xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" );
     1484#endif
    14391485  xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2,                   "Decoding Refresh Type must be equal to 0, 1 or 2" );
    14401486#if H_MV
     
    14621508  if (m_iDecodingRefreshType == 2)
    14631509  {
     1510#if H_MV_LAYER_WISE_STARTUP
     1511    for (Int i = 0; i < m_numberOfLayers; i++ )
     1512    {
     1513      xConfirmPara( m_iIntraPeriod[i] > 0 && m_iIntraPeriod[i] <= m_iGOPSize ,                      "Intra period must be larger than GOP size for periodic IDR pictures");
     1514    }
     1515#else
    14641516    xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize ,                      "Intra period must be larger than GOP size for periodic IDR pictures");
     1517#endif
    14651518  }
    14661519  xConfirmPara( (m_uiMaxCUWidth  >> m_uiMaxCUDepth) < 4,                                    "Minimum partition width size should be larger than or equal to 8");
     
    17211774  /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure
    17221775   * This permits the ability to omit a GOP structure specification */
     1776#if H_MV_LAYER_WISE_STARTUP
     1777  if (m_iIntraPeriod[layer] == 1 && m_GOPList[0].m_POC == -1) {
     1778#else
    17231779  if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) {
     1780#endif
    17241781    m_GOPList[0] = GOPEntry();
    17251782    m_GOPList[0].m_QPFactor = 1;
     
    17461803  }
    17471804  Int numOK=0;
     1805#if H_MV_LAYER_WISE_STARTUP
     1806  xConfirmPara( m_iIntraPeriod[layer] >=0&&(m_iIntraPeriod[layer]%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" );
     1807#else
    17481808  xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" );
     1809#endif
    17491810
    17501811  for(Int i=0; i<m_iGOPSize; i++)
     
    17571818 
    17581819#if H_MV
     1820#if H_MV_LAYER_WISE_STARTUP
     1821  if ( (m_iIntraPeriod[layer] != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable[layer]) )
     1822#else
    17591823  if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable[layer]) )
     1824#endif
    17601825#else
    17611826  if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) )
     
    22822347  printf("Min PCM size                 : %d\n", 1 << m_uiPCMLog2MinSize);
    22832348  printf("Motion search range          : %d\n", m_iSearchRange );
     2349#if H_MV_LAYER_WISE_STARTUP
     2350  xPrintParaVector( "Intra period", m_iIntraPeriod );
     2351#else
    22842352  printf("Intra period                 : %d\n", m_iIntraPeriod );
     2353#endif
    22852354  printf("Decoding refresh type        : %d\n", m_iDecodingRefreshType );
    22862355#if !H_MV
  • branches/HTM-9.0-dev0/source/App/TAppEncoder/TAppEncCfg.h

    r724 r730  
    8989  Int                    m_vpsNumLayerSets;                   ///< Number of layer sets
    9090  std::vector< std::vector<Int> > m_layerIdsInSets;           ///< LayerIds in vps of layer set
     91#if H_MV_6_PS_0109_25
     92  Int                    m_defaultOneTargetOutputLayerIdc;    ///< Output highest layer of layer sets by default when equal to 1
     93#else
    9194  Bool                   m_defaultOneTargetOutputLayerFlag;   ///< Output highest layer of layer sets by default 
     95#endif
    9296  std::vector<Int>       m_outputLayerSetIdx;                 ///< Indices of layer sets used as additional output layer sets 
    9397  std::vector< std::vector<Int> > m_layerIdsInAddOutputLayerSet; ///< LayerIds in vps of additional output layers
     
    98102  std::vector< std::vector<Int> > m_dependencyTypes;          ///< Dependency types of direct reference layers
    99103
     104#if H_MV_6_HRD_O0217_13
     105  // DBP Size
     106  Bool m_subLayerFlagInfoPresentFlag;
     107#endif
     108
    100109  // VPS VUI
    101110  Bool m_vpsVuiPresentFlag;
     111#if H_MV_6_PS_O0223_29
     112  Bool m_crossLayerPicTypeAlignedFlag;
     113  Bool m_crossLayerIrapAlignedFlag;
     114#endif
    102115  Bool m_bitRatePresentVpsFlag;
    103116  Bool m_picRatePresentVpsFlag;
     
    108121  std::vector< std::vector<Int  > > m_constantPicRateIdc;
    109122  std::vector< std::vector<Int  > > m_avgPicRate;
     123#if H_MV_6_O0226_37
     124  Bool                              m_tilesNotInUseFlag;
     125  std::vector< Bool >               m_tilesInUseFlag;
     126  std::vector< Bool >               m_loopFilterNotAcrossTilesFlag;
     127  Bool                              m_wppNotInUseFlag;
     128  std::vector< Bool >               m_wppInUseFlag;
     129
     130#endif
    110131  std::vector< std::vector<Bool > > m_tileBoundariesAlignedFlag; 
    111132  Bool m_ilpRestrictedRefLayersFlag;
     
    175196 
    176197  // coding structure
     198#if H_MV_LAYER_WISE_STARTUP
     199  std::vector<Int> m_iIntraPeriod;                            ///< period of I-slice (random access period)
     200#else
    177201  Int       m_iIntraPeriod;                                   ///< period of I-slice (random access period)
     202#endif
    178203  Int       m_iDecodingRefreshType;                           ///< random access type
    179204  Int       m_iGOPSize;                                       ///< GOP size of hierarchical structure
    180205#if H_MV
    181206  Int       m_extraRPSsMvc[MAX_NUM_LAYERS];                       ///< extra RPSs added to handle CRA for each layer
    182   std::vector< GOPEntry* >  m_GOPListMvc;                            ///< the coding structure entries from the config file for each layer
     207  std::vector< GOPEntry* >  m_GOPListMvc;                         ///< the coding structure entries from the config file for each layer
    183208  Int       m_numReorderPicsMvc[MAX_NUM_LAYERS][MAX_TLAYER];      ///< total number of reorder pictures for each layer
    184209  Int       m_maxDecPicBufferingMvc[MAX_NUM_LAYERS][MAX_TLAYER];  ///< total number of reference pictures needed for decoding for each layer
  • branches/HTM-9.0-dev0/source/App/TAppEncoder/TAppEncTop.cpp

    r724 r730  
    3636*/
    3737
     38
    3839#include <list>
    3940#include <fstream>
     
    118119  xSetLayerIds             ( vps );   
    119120  xSetDimensionIdAndLength ( vps );
    120   xSetDependencies( vps );
     121  xSetDependencies         ( vps );
    121122  xSetProfileTierLevel     ( vps );
    122123  xSetRepFormat            ( vps );
     
    127128  m_ivPicLists.setVPS      ( &vps );
    128129#endif
    129 
    130130
    131131  for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++)
     
    216216
    217217    m_cTEncTop.setIvPicLists                   ( &m_ivPicLists );
    218 #endif // H_MV
     218  // H_MV
    219219  m_cTEncTop.setVPS(&vps);
    220220
     
    234234 
    235235  //====== Coding Structure ========
     236#if H_MV_LAYER_WISE_STARTUP
     237  m_cTEncTop.setIntraPeriod                  ( m_iIntraPeriod[ layerIdInVps ] );
     238#else
    236239  m_cTEncTop.setIntraPeriod                  ( m_iIntraPeriod );
     240#endif
    237241  m_cTEncTop.setDecodingRefreshType          ( m_iDecodingRefreshType );
    238242  m_cTEncTop.setGOPSize                      ( m_iGOPSize );
     
    13241328    vps.setDimensionIdLen( dim, m_dimensionIdLen[ dim ] );
    13251329    for( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )
    1326 
    13271330    {       
    13281331      vps.setDimensionId( layer, dim, m_dimIds[ dim ][ layer ] );       
     
    13321335  Int maxViewId = xGetMax( m_viewId );
    13331336
     1337#if H_MV_6_PS_O0109_22
     1338  Int viewIdLen = gCeilLog2( maxViewId + 1 );
     1339  const Int maxViewIdLen = ( 1 << 4 ) - 1;
     1340  assert( viewIdLen <= maxViewIdLen );
     1341  vps.setViewIdLen( viewIdLen );
     1342#else
    13341343  Int viewIdLenMinus1 = std::max( gCeilLog2( maxViewId + 1 ) - 1, 0 ) ;
    13351344  const Int maxViewIdLenMinus1 = ( 1 << 4 ) - 1;
    13361345  assert( viewIdLenMinus1 <= maxViewIdLenMinus1  );
    13371346  vps.setViewIdLenMinus1( viewIdLenMinus1 );
     1347#endif
    13381348  for (Int i = 0; i < m_iNumberOfViews; i++)
    13391349  {
     
    13541364      vps.setDirectDependencyType( depLayer, refLayer,    -1 );
    13551365    }
    1356     }
     1366  }
     1367
     1368#if H_MV_6_PS_O0096_21
     1369  Int  defaultDirectDependencyType = -1;
     1370  Bool defaultDirectDependencyFlag = true;
     1371#endif
    13571372  for( Int depLayer = 1; depLayer < m_numberOfLayers; depLayer++ )
    13581373  {
     
    13631378      Int refLayer = m_directRefLayers[depLayer][i];
    13641379      vps.setDirectDependencyFlag( depLayer, refLayer, true);
     1380#if H_MV_6_PS_O0096_21
     1381      Int curDirectDependencyType = m_dependencyTypes[depLayer][i];
     1382
     1383      if ( defaultDirectDependencyType != -1 )   
     1384      {
     1385        defaultDirectDependencyFlag = defaultDirectDependencyFlag && (curDirectDependencyType == defaultDirectDependencyType );         
     1386      }
     1387      else
     1388      {
     1389        defaultDirectDependencyType = curDirectDependencyType;
     1390      }
     1391     
     1392      vps.setDirectDependencyType( depLayer, refLayer, curDirectDependencyType);       
     1393#else
    13651394      vps.setDirectDependencyType( depLayer, refLayer,m_dependencyTypes[depLayer][i]);
    1366     }
    1367   }
     1395#endif
     1396    }
     1397  }
     1398
     1399#if H_MV_6_PS_O0096_21
     1400  vps.setDefaultDirectDependencyFlag( defaultDirectDependencyFlag );       
     1401  vps.setDefaultDirectDependencyType( defaultDirectDependencyFlag ? defaultDirectDependencyType : -1 );       
     1402#endif
     1403
     1404#if H_MV_6_ILDSD_O0120_26
     1405  // Max sub layers, + presence flag
     1406  Bool subLayersMaxMinus1PresentFlag = false;
     1407  Int  subLayersMaxMinus1 = -1;
     1408  for (Int curLayerIdInVps = 0; curLayerIdInVps < m_numberOfLayers; curLayerIdInVps++ )
     1409  {
     1410    Int curSubLayersMaxMinus1 = -1;
     1411    for( Int i = 0; i < getGOPSize(); i++ )
     1412    {
     1413      GOPEntry geCur =  m_GOPListMvc[curLayerIdInVps][i];
     1414      curSubLayersMaxMinus1 = std::max( curSubLayersMaxMinus1, geCur.m_temporalId );
     1415    } 
     1416
     1417    vps.setSubLayersVpsMaxMinus1( curLayerIdInVps, curSubLayersMaxMinus1 );
     1418    if ( subLayersMaxMinus1 == -1 )
     1419    {
     1420      subLayersMaxMinus1 = curSubLayersMaxMinus1;
     1421    }
     1422    else
     1423    {
     1424      subLayersMaxMinus1PresentFlag = subLayersMaxMinus1PresentFlag || ( curSubLayersMaxMinus1 != subLayersMaxMinus1 );
     1425    }
     1426  }
     1427 
     1428  vps.setVpsSubLayersMaxMinus1PresentFlag( subLayersMaxMinus1PresentFlag );
     1429#endif
     1430
    13681431
    13691432  // Max temporal id for inter layer reference pictures + presence flag
    13701433  Bool maxTidRefPresentFlag = false;
    13711434  for ( Int refLayerIdInVps = 0; refLayerIdInVps < m_numberOfLayers; refLayerIdInVps++)
    1372     {
     1435  {
     1436#if !H_MV_6_ILDDS_O0225_30
    13731437    Int maxTid = -1;
     1438#endif
    13741439    for ( Int curLayerIdInVps = 1; curLayerIdInVps < m_numberOfLayers; curLayerIdInVps++)
    1375       {
     1440    {
     1441#if H_MV_6_ILDDS_O0225_30
     1442      Int maxTid = -1;
     1443#endif
    13761444      for( Int i = 0; i < getGOPSize(); i++ )
    13771445      {       
     
    13871455        }
    13881456      }
     1457#if H_MV_6_ILDDS_O0225_30   
     1458      vps.setMaxTidIlRefPicsPlus1( refLayerIdInVps, curLayerIdInVps, maxTid + 1 );
     1459      maxTidRefPresentFlag = maxTidRefPresentFlag || ( maxTid != 6 );   
     1460    }
     1461#else
    13891462    }
    13901463    vps.setMaxTidIlRefPicPlus1( refLayerIdInVps, maxTid + 1 );
    13911464    maxTidRefPresentFlag = maxTidRefPresentFlag || ( maxTid != 6 );   
     1465#endif
    13921466  }
    13931467
    13941468  vps.setMaxTidRefPresentFlag( maxTidRefPresentFlag );
     1469
    13951470  // Max one active ref layer flag
    13961471  Bool maxOneActiveRefLayerFlag = true; 
     
    14021477      maxOneActiveRefLayerFlag =  maxOneActiveRefLayerFlag && (ge.m_numActiveRefLayerPics <= 1);
    14031478    }           
    1404 }
     1479  }
    14051480
    14061481  vps.setMaxOneActiveRefLayerFlag( maxOneActiveRefLayerFlag );
    1407  
    1408  
     1482
     1483  // Poc Lsb Not Present Flag
     1484#if H_MV_6_MISC_O0062_31
     1485  for ( Int layerIdInVps = 1; layerIdInVps < m_numberOfLayers; layerIdInVps++)
     1486  {
     1487    if ( m_directRefLayers[ layerIdInVps ].size() == 0 )
     1488    {   
     1489      vps.setPocLsbNotPresentFlag( layerIdInVps,  true ); 
     1490    }
     1491  }
     1492#endif
     1493   
    14091494  // All Ref layers active flag
    14101495  Bool allRefLayersActiveFlag = true;
     
    14141499    {       
    14151500      GOPEntry ge =  m_GOPListMvc[layerIdInVps][ ( i < getGOPSize()  ? i : MAX_GOP ) ];
     1501#if H_MV_6_ILDDS_ILREFPICS_27_34
     1502      Int tId = ge.m_temporalId;  // Should be equal for all layers.
     1503     
     1504      // check if all reference layers when allRefLayerActiveFlag is equal to 1 are reference layer pictures specified in the gop entry
     1505      for (Int k = 0; k < m_directRefLayers[ layerIdInVps].size() && allRefLayersActiveFlag; k++ )
     1506      {
     1507        Int refLayerIdInVps = vps.getLayerIdInVps( m_directRefLayers[ layerIdInVps ][ k ] );
     1508        if ( vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId  && vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId )
     1509        {
     1510          Bool gopEntryFoundFlag = false;
     1511          for( Int l = 0; l < ge.m_numActiveRefLayerPics && !gopEntryFoundFlag; l++ )
     1512          {
     1513            gopEntryFoundFlag = gopEntryFoundFlag || ( ge.m_interLayerPredLayerIdc[l] == k );
     1514          }         
     1515          allRefLayersActiveFlag = allRefLayersActiveFlag && gopEntryFoundFlag; 
     1516        }       
     1517      }
     1518
     1519      // check if all inter layer reference pictures specified in the gop entry are valid reference layer pictures when allRefLayerActiveFlag is equal to 1
     1520      // (Should actually always be true)
     1521      Bool maxTidIlRefAndSubLayerMaxVaildFlag = true;
     1522      for( Int l = 0; l < ge.m_numActiveRefLayerPics; l++ )
     1523      {   
     1524        Bool referenceLayerFoundFlag = false;
     1525        for (Int k = 0; k < m_directRefLayers[ layerIdInVps].size(); k++ )
     1526        {
     1527          Int refLayerIdInVps = vps.getLayerIdInVps( m_directRefLayers[ layerIdInVps ][ k ] );
     1528
     1529          if ( vps.getMaxTidIlRefPicsPlus1(refLayerIdInVps,layerIdInVps) > tId  && vps.getSubLayersVpsMaxMinus1(refLayerIdInVps) >= tId )
     1530          {         
     1531            referenceLayerFoundFlag = referenceLayerFoundFlag || ( ge.m_interLayerPredLayerIdc[l] == k );
     1532          }         
     1533        }
     1534       maxTidIlRefAndSubLayerMaxVaildFlag = maxTidIlRefAndSubLayerMaxVaildFlag && referenceLayerFoundFlag; 
     1535      }
     1536      assert ( maxTidIlRefAndSubLayerMaxVaildFlag ); // Something wrong with MaxTidIlRefPicsPlus1 or SubLayersVpsMaxMinus1
     1537#else
    14161538      allRefLayersActiveFlag = allRefLayersActiveFlag && (ge.m_numActiveRefLayerPics == m_directRefLayers[ layerIdInVps ].size() );
     1539#endif
    14171540    }           
    14181541  }
     
    14201543  vps.setAllRefLayersActiveFlag( allRefLayersActiveFlag );
    14211544
     1545#if !H_MV_6_PS_O0223_29
    14221546  // Currently cross layer irap aligned is always true.   
    14231547  vps.setCrossLayerIrapAlignedFlag( true );
     1548#endif
    14241549  vps.setRefLayers();
    14251550};
     
    14911616  repFormat->setPicHeightVpsInLumaSamples ( m_iSourceHeight );
    14921617  repFormat->setPicWidthVpsInLumaSamples  ( m_iSourceWidth  );   
     1618#if H_MV_6_PS_REP_FORM_18_19_20
     1619  repFormat->setChromaAndBitDepthVpsPresentFlag( true );   
     1620#endif
    14931621  // ToDo not supported yet.
    14941622  //repFormat->setSeparateColourPlaneVpsFlag( );
     
    14961624  assert( vps.getRepFormat( 0 ) == NULL );
    14971625  vps.setRepFormat( 0 , repFormat );
    1498 
     1626 
    14991627  for(Int i = 0; i <= vps.getMaxLayersMinus1(); i++ )
    15001628  {
     
    15021630  }
    15031631}
     1632
     1633#if H_MV_6_HRD_O0217_13
     1634Void TAppEncTop::xSetDpbSize                ( TComVPS& vps )
     1635{
     1636  // These settings need to be verified
     1637
     1638  TComDpbSize* dpbSize = vps.getDpbSize();
     1639
     1640  assert ( dpbSize != 0 );
     1641
     1642  for( Int i = 1; i < vps.getNumOutputLayerSets(); i++ )
     1643  { 
     1644    std::vector<Int> targetDecLayerIdList = vps.getTargetDecLayerIdList( i );
     1645    dpbSize->setSubLayerFlagInfoPresentFlag( i, m_subLayerFlagInfoPresentFlag );
     1646
     1647    if ( dpbSize->getSubLayerFlagInfoPresentFlag( i ) )
     1648    {
     1649      for( Int j = 0; j  <=  vps.getMaxTLayers() - 1 ; j++ )
     1650      {   
     1651        Int maxNumReorderPics  = MIN_INT;
     1652        Int maxDecPicBuffering = MIN_INT;
     1653        Int maxLatencyIncrease = MIN_INT;
     1654
     1655        Int prevMaxNumReorderPics  = MIN_INT;
     1656        Int prevMaxDecPicBuffering = MIN_INT;
     1657        Int prevMaxLatencyIncrease = MIN_INT;
     1658
     1659        assert( vps.getNumSubDpbs( vps.getOutputLayerSetIdxMinus1( i ) + 1 ) == targetDecLayerIdList.size() );
     1660        for( Int k = 0; k < vps.getNumSubDpbs( vps.getOutputLayerSetIdxMinus1( i ) + 1 ); k++ )   
     1661        {
     1662          Int layerIdInVps = vps.getLayerIdInVps( targetDecLayerIdList[k] );           
     1663          dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, m_maxDecPicBufferingMvc[ layerIdInVps ][ j ] - 1 );
     1664        }       
     1665
     1666        for ( Int idx = 0; idx < targetDecLayerIdList.size(); idx++ )
     1667        {
     1668          Int layerIdInVps = vps.getLayerIdInVps( targetDecLayerIdList[ idx ] );
     1669          maxNumReorderPics = std::max( maxNumReorderPics, m_numReorderPicsMvc[ layerIdInVps ][ j ] );
     1670        }
     1671        assert( maxNumReorderPics != MIN_INT );
     1672        dpbSize->setMaxVpsNumReorderPics( i, j, maxNumReorderPics );
     1673
     1674        // To Be Done !
     1675        // dpbSize->setMaxVpsLatencyIncreasePlus1( i, j, uiCode );
     1676
     1677        if( j > 0 ) 
     1678        {
     1679          dpbSize->setSubLayerDpbInfoPresentFlag( i, j, prevMaxDecPicBuffering == maxDecPicBuffering && prevMaxLatencyIncrease == maxLatencyIncrease && prevMaxNumReorderPics == maxNumReorderPics );
     1680        }       
     1681
     1682        prevMaxNumReorderPics   = maxNumReorderPics;
     1683        prevMaxDecPicBuffering  = maxDecPicBuffering;
     1684        prevMaxLatencyIncrease  = maxLatencyIncrease;
     1685      } 
     1686    } 
     1687  } 
     1688}
     1689#endif
     1690
    15041691
    15051692Void TAppEncTop::xSetLayerSets( TComVPS& vps )
     
    15201707    }
    15211708  }
     1709#if H_MV_6_HRD_O0217_13
     1710  vps.deriveLayerSetLayerIdList();
     1711#endif
    15221712
    15231713  Int numAddOuputLayerSets = (Int) m_outputLayerSetIdx.size();
    15241714  // Additional output layer sets + profileLevelTierIdx
     1715#if H_MV_6_PS_0109_25
     1716  vps.setDefaultOneTargetOutputLayerIdc   ( m_defaultOneTargetOutputLayerIdc );
     1717#else
    15251718  vps.setDefaultOneTargetOutputLayerFlag   ( m_defaultOneTargetOutputLayerFlag );
     1719#endif
    15261720  vps.setMoreOutputLayerSetsThanDefaultFlag( numAddOuputLayerSets       != 0 );   
    15271721  vps.setNumAddOutputLayerSetsMinus1       ( numAddOuputLayerSets - 1        );
    15281722
     1723
     1724
     1725#if H_MV_6_HRD_O0217_13
     1726  for (Int lsIdx = 0; lsIdx < m_vpsNumLayerSets; lsIdx++)
     1727  {
     1728    if ( lsIdx > 0 )
     1729    {
     1730      vps.setProfileLevelTierIdx( lsIdx, m_profileLevelTierIdx[ lsIdx ] );
     1731    } 
     1732
     1733    vps.setOutputLayerSetIdxMinus1( lsIdx, lsIdx - 1 );
     1734
     1735    for (Int i = 0; i < m_layerIdsInSets[ lsIdx ].size(); i++ )
     1736    {
     1737      vps.setOutputLayerFlag( lsIdx, i, vps.inferOutputLayerFlag( lsIdx, i ));       
     1738    }
     1739  }
     1740#else
    15291741  for (Int lsIdx = 1; lsIdx < m_vpsNumLayerSets; lsIdx++)
    15301742  {
    15311743    vps.setProfileLevelTierIdx( lsIdx, m_profileLevelTierIdx[ lsIdx ] );
    15321744  }
     1745#endif
    15331746
    15341747  for (Int addOutLs = 0; addOutLs < numAddOuputLayerSets; addOutLs++ )
     
    15531766    }
    15541767  }
     1768#if H_MV_6_HRD_O0217_13
     1769  vps.deriveTargetLayerIdLists();
     1770#endif
    15551771}
    15561772
     
    15641780
    15651781    assert( pcVPSVUI );
     1782
     1783
     1784    // All this stuff could actually be derived by the encoder,
     1785    // however preliminary setting it from input parameters
     1786
     1787#if H_MV_6_PS_O0223_29
     1788    pcVPSVUI->setCrossLayerPicTypeAlignedFlag( m_crossLayerPicTypeAlignedFlag );
     1789    pcVPSVUI->setCrossLayerIrapAlignedFlag   ( m_crossLayerIrapAlignedFlag    );
     1790#endif
    15661791
    15671792    pcVPSVUI->setBitRatePresentVpsFlag( m_bitRatePresentVpsFlag );
     
    16021827    }
    16031828
     1829#if H_MV_6_O0226_37
     1830    pcVPSVUI->setTilesNotInUseFlag( m_tilesNotInUseFlag );
     1831
     1832    if( !pcVPSVUI->getTilesNotInUseFlag() )
     1833    {     
     1834      for( Int i = 0; i  <=  vps.getMaxLayersMinus1(); i++ )
     1835      {
     1836        pcVPSVUI->setTilesInUseFlag( i, m_tilesInUseFlag[ i ] );
     1837        if( pcVPSVUI->getTilesInUseFlag( i ) ) 
     1838        {
     1839          pcVPSVUI->setLoopFilterNotAcrossTilesFlag( i, m_loopFilterNotAcrossTilesFlag[ i ] );
     1840        }
     1841      } 
     1842
     1843      for( Int i = 1; i  <=  vps.getMaxLayersMinus1(); i++ ) 
     1844      {
     1845        for( Int j = 0; j < vps.getNumDirectRefLayers( vps.getLayerIdInNuh( i ) ) ; j++ )
     1846        { 
     1847          Int layerIdx = vps.getLayerIdInVps( vps.getRefLayerId(vps.getLayerIdInNuh( i ) , j  )); 
     1848          if( pcVPSVUI->getTilesInUseFlag( i )  &&  pcVPSVUI->getTilesInUseFlag( layerIdx ) ) 
     1849          {
     1850            pcVPSVUI->setTileBoundariesAlignedFlag( i, j, m_tileBoundariesAlignedFlag[i][j] );
     1851          }
     1852        } 
     1853      }
     1854    } 
     1855
     1856    pcVPSVUI->setWppNotInUseFlag( m_wppNotInUseFlag );
     1857
     1858    if( !pcVPSVUI->getWppNotInUseFlag( ) )
     1859    {
     1860      for( Int i = 1; i  <=  vps.getMaxLayersMinus1(); i++ ) 
     1861      {
     1862        pcVPSVUI->setWppInUseFlag( i, m_wppInUseFlag[ i ]);
     1863      }
     1864    }
     1865#else
    16041866    for( Int i = 1; i  <=  vps.getMaxLayersMinus1(); i++ )
    16051867    {
     
    16121874      }
    16131875    }
     1876#endif
    16141877
    16151878    pcVPSVUI->setIlpRestrictedRefLayersFlag( m_ilpRestrictedRefLayersFlag );
     
    16421905      }
    16431906    }     
     1907#if H_MV_6_PS_O0118_33
     1908    pcVPSVUI->setVideoSignalInfoIdxPresentFlag( true );
     1909    pcVPSVUI->setVpsNumVideoSignalInfoMinus1  ( 0    );
     1910
     1911    assert ( pcVPSVUI->getVideoSignalInfo( 0 ) == NULL );
     1912
     1913    TComVideoSignalInfo* videoSignalInfo = new TComVideoSignalInfo;
     1914
     1915    videoSignalInfo->setColourPrimariesVps        ( m_colourPrimaries );
     1916    videoSignalInfo->setMatrixCoeffsVps           ( m_matrixCoefficients );
     1917    videoSignalInfo->setTransferCharacteristicsVps( m_transferCharacteristics );
     1918    videoSignalInfo->setVideoVpsFormat            ( m_videoFormat );
     1919    videoSignalInfo->setVideoFullRangeVpsFlag     ( m_videoFullRangeFlag ); 
     1920
     1921    pcVPSVUI->setVideoSignalInfo( 0, videoSignalInfo );       
     1922
     1923    for (Int i = 0; i < m_numberOfLayers; i++)
     1924    {     
     1925      pcVPSVUI->setVpsVideoSignalInfoIdx( i, 0 );
     1926    }
     1927#endif
     1928#if H_MV_6_HRD_O0164_15
     1929    pcVPSVUI->setVpsVuiBspHrdPresentFlag( false ); // TBD
     1930#endif
    16441931  }
    16451932}
     
    16791966    if( vps.getUseDLTFlag( layer ) )
    16801967    {
     1968#if H_MV_LAYER_WISE_STARTUP
     1969      xAnalyzeInputBaseDepth(layer, max(  m_iIntraPeriod[layer], 24), &vps);
     1970#else
    16811971      xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod, 24), &vps);
     1972#endif
    16821973    }
    16831974#endif
     
    17162007}
    17172008#endif
     2009#endif
    17182010//! \}
  • branches/HTM-9.0-dev0/source/App/TAppEncoder/TAppEncTop.h

    r655 r730  
    125125  Void xSetProfileTierLevel       ( TComVPS& vps );
    126126  Void xSetRepFormat              ( TComVPS& vps );
     127#if H_MV_6_HRD_O0217_13
     128  Void xSetDpbSize                ( TComVPS& vps );
     129#endif
    127130  Void xSetVPSVUI                 ( TComVPS& vps );
    128131  GOPEntry* xGetGopEntry( Int layerIdInVps, Int poc );
  • branches/HTM-9.0-dev0/source/Lib/TLibCommon/CommonDef.h

    r725 r730  
    121121#define MAX_UINT                    0xFFFFFFFFU ///< max. value of unsigned 32-bit integer
    122122#define MAX_INT                     2147483647  ///< max. value of signed 32-bit integer
    123 #if H_3D
    124123#define MIN_INT                     (-2147483647-1) // < min. value of signed 32-bit integer
    125 #endif
     124
    126125#define MAX_INT64                   0x7FFFFFFFFFFFFFFFLL  ///< max. value of signed 64-bit integer
    127126#define MAX_DOUBLE                  1.7e+308    ///< max. value of double-type value
  • branches/HTM-9.0-dev0/source/Lib/TLibCommon/TComPic.cpp

    r655 r730  
    503503{
    504504  if ( legend )
    505     std::cout  << "LId"        << "\t" << "POC"   << "\t" << "Rec"          << "\t" << "Ref"                       << "\t" << "LT"            << std::endl;
     505    std::cout  << std::endl << "LId"        << "\t" << "POC"   << "\t" << "Rec"          << "\t" << "Ref"                       << "\t" << "LT"            <<  "\t" << "OutMark" <<  "\t" << "OutFlag" << std::endl;
    506506  else
    507     std::cout  << getLayerId() << "\t" << getPOC()<< "\t" << getReconMark() << "\t" << getSlice(0)->isReferenced() << "\t" << getIsLongTerm() << std::endl;
     507    std::cout  << getLayerId() << "\t" << getPOC()<< "\t" << getReconMark() << "\t" << getSlice(0)->isReferenced() << "\t" << getIsLongTerm() << "\t" << getOutputMark() << "\t" << getSlice(0)->getPicOutputFlag() <<std::endl;
    508508}
    509509
     
    524524  return pcPic;
    525525}
    526 
    527526#if H_3D
    528527TComPic* TComPicLists::getPic( Int viewIndex, Bool depthFlag, Int poc )
     
    530529  return getPic   ( m_vps->getLayerIdInNuh( viewIndex, depthFlag ), poc );
    531530}
    532 
     531#endif
    533532Void TComPicLists::print()
    534533{
     
    571570}
    572571
     572#if H_3D
    573573TComPicYuv* TComPicLists::getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon )
    574574
     
    576576  return getPicYuv( layerIdInNuh, poc, recon );
    577577}
     578
    578579#if H_3D_ARP
    579580TComList<TComPic*>* TComPicLists::getPicList( Int layerIdInNuh )
     
    593594}
    594595#endif
    595 #endif // H_3D
     596#endif
    596597#endif // H_MV
    597598
  • branches/HTM-9.0-dev0/source/Lib/TLibCommon/TComRom.cpp

    r724 r730  
    573573#if H_MV_ENC_DEC_TRAC
    574574#if ENC_DEC_TRACE
     575#if H_MV_FIX_TRACE_FILE
     576Void writeToTraceFile( const Char* symbolName, Int val, Bool doIt )
     577#else
    575578Void writeToTraceFile( Char* symbolName, Int val, Bool doIt )
     579#endif
    576580{
    577581  if ( ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) && doIt  )
     
    588592}
    589593
     594#if H_MV_FIX_TRACE_FILE
     595Void writeToTraceFile( const Char* symbolName, Bool doIt )
     596#else
    590597Void writeToTraceFile( Char* symbolName, Bool doIt )
     598#endif
    591599{
    592600  if ( ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) && doIt  )
  • branches/HTM-9.0-dev0/source/Lib/TLibCommon/TComRom.h

    r724 r730  
    236236
    237237
     238#if H_MV_FIX_TRACE_FILE
     239 Void           writeToTraceFile( const Char* symbolName, Int val, Bool doIt );
     240 Void           writeToTraceFile( const Char* symbolName, Bool doIt );
     241#else
    238242 Void           writeToTraceFile( Char* symbolName, Int val, Bool doIt );
    239243 Void           writeToTraceFile( Char* symbolName, Bool doIt );
     244#endif
    240245#endif
    241246#else
  • branches/HTM-9.0-dev0/source/Lib/TLibCommon/TComSlice.cpp

    r724 r730  
    110110#endif
    111111, m_pocResetFlag                  (false)
     112#if H_MV_6_RALS_O0149_11
     113, m_crossLayerBlaFlag             (false)
     114#endif
    112115, m_discardableFlag               (false)
    113116, m_interLayerPredEnabledFlag     (false)
     
    148151  for (Int i = 0; i < MAX_NUM_LAYERS; i++ )
    149152  {
    150    m_interLayerPredLayerIdc[ i ] = i;
     153    m_interLayerPredLayerIdc[ i ] = -1;
    151154  }
    152155#endif
     
    17091712, m_hrdOpSetIdx               (NULL)
    17101713, m_cprmsPresentFlag          (NULL)
     1714#if H_MV_6_HRD_O0217_13
     1715, m_dpbSize                   (NULL)
     1716#endif
    17111717#if H_MV
    1712 , m_vpsVUI                 (  NULL )
     1718, m_vpsVUI                    (NULL)
    17131719#endif
    17141720{
     
    17241730    for( Int layerId = 0; layerId < MAX_VPS_NUH_LAYER_ID_PLUS1; layerId++ )
    17251731    {
     1732#if H_MV_6_HRD_O0217_13
     1733      m_layerIdIncludedFlag[lsIdx][layerId] = (( lsIdx == 0 ) && ( layerId == 0 )) ;
     1734#else
    17261735      m_layerIdIncludedFlag[lsIdx][layerId] = false;
     1736#endif
    17271737    }
    17281738  }
     
    17381748  m_moreOutputLayerSetsThanDefaultFlag = false;   
    17391749  m_numAddOutputLayerSetsMinus1        = -1;   
     1750#if H_MV_6_PS_0109_25
     1751  m_defaultOneTargetOutputLayerIdc     = 0;
     1752#else
    17401753  m_defaultOneTargetOutputLayerFlag    = false;
     1754#endif
    17411755 
    17421756  for ( Int i = 0; i < MAX_VPS_OUTPUTLAYER_SETS; i++)
     
    17481762      m_outputLayerFlag[i][j] = false;
    17491763    }
    1750   }
    1751  
     1764  } 
     1765#if H_MV_6_GEN_0153_28
     1766  m_altOutputLayerFlag       = false;
     1767#endif
    17521768  m_maxOneActiveRefLayerFlag = false;
    17531769  m_directDepTypeLenMinus2   = 0;         
     
    17861802    m_layerIdInNuh      [i] = ( i == 0 ) ? 0 : -1;
    17871803    m_numDirectRefLayers[i] = 0;
     1804#if !H_MV_6_ILDDS_O0225_30
    17881805    m_maxTidIlRefPicPlus1[i] = 7;
     1806#endif
    17891807    m_vpsRepFormatIdx    [i] = 0;
     1808#if H_MV_6_MISC_O0062_31
     1809    m_pocLsbNotPresentFlag[i] = 0;
     1810#endif
    17901811    m_repFormat          [i] = NULL;
    17911812    m_viewIdVal          [i] = 0;
     
    18211842      m_directDependencyType[i][j] = -1;
    18221843      m_refLayerId[i][j]           = -1;
     1844#if H_MV_6_ILDDS_O0225_30     
     1845      m_maxTidIlRefPicsPlus1[i][j]  = 7;
     1846#endif
    18231847    }
    18241848
     
    18331857  }
    18341858  m_vpsVUI = new TComVPSVUI;
     1859#if H_MV_6_HRD_O0217_13
     1860  m_dpbSize = new TComDpbSize;
     1861#endif
     1862#
    18351863#if H_3D
    18361864  for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
     
    18661894#if H_MV
    18671895  if ( m_vpsVUI          != NULL )     delete m_vpsVUI;
     1896#if H_MV_6_HRD_O0217_13
     1897  if ( m_dpbSize         != NULL )     delete m_dpbSize;
     1898#endif
     1899
    18681900  for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
    18691901  {
     
    20682100  assert( lsIdx >= 0 );
    20692101  assert( lsIdx <= getVpsNumLayerSetsMinus1() );
     2102#if H_MV_6_HRD_O0217_13
     2103  return (Int) m_layerSetLayerIdList[ lsIdx ].size();
     2104#else
    20702105  Int numLayersInIdList = 0;
    20712106  for (Int layerId = 0; layerId < getVpsMaxLayerId(); layerId++ )
     
    20732108    numLayersInIdList += ( getLayerIdIncludedFlag( lsIdx, layerId ) );
    20742109  }
     2110
    20752111  return numLayersInIdList;
    2076 }
     2112#endif
     2113}
     2114
     2115#if H_MV_6_HRD_O0217_13
     2116Int    TComVPS::getNumOutputLayerSets()
     2117{
     2118  Int numOutputLayerSets = getVpsNumberLayerSetsMinus1( ) + 1;
     2119  if ( getMoreOutputLayerSetsThanDefaultFlag( ) )
     2120  {     
     2121    numOutputLayerSets += (getNumAddOutputLayerSetsMinus1( ) + 1);
     2122  }
     2123  return numOutputLayerSets;
     2124}
     2125#endif
     2126
    20772127Int TComVPS::getNumViews()
    20782128{
     
    21042154  return dependentFlag;
    21052155}
     2156
     2157#if H_MV_6_HRD_O0217_13
     2158Void TComVPS::deriveLayerSetLayerIdList()
     2159{
     2160  m_layerSetLayerIdList.resize( getVpsNumLayerSetsMinus1() + 1 );
     2161  for (Int i = 0; i <= getVpsNumLayerSetsMinus1(); i++ )
     2162  {
     2163    for( Int m = 0; m  <= getVpsMaxLayerId(); m++ )
     2164    {
     2165      if( getLayerIdIncludedFlag( i, m) )
     2166      {
     2167        m_layerSetLayerIdList[ i ].push_back( m );       
     2168      }
     2169    }
     2170  }
     2171}
     2172
     2173Void TComVPS::deriveTargetLayerIdLists()
     2174{
     2175  m_targetDecLayerIdLists.resize( getNumOutputLayerSets() );
     2176  m_targetOptLayerIdLists.resize( getNumOutputLayerSets() );
     2177
     2178  for (Int targetOptLayerSetIdx = 0; targetOptLayerSetIdx < getNumOutputLayerSets(); targetOptLayerSetIdx++ )
     2179  {
     2180    Int targetDecLayerSetIdx = getOutputLayerSetIdxMinus1( targetOptLayerSetIdx ) + 1;     
     2181    Int lsIdx                = targetDecLayerSetIdx;
     2182
     2183    for( Int j = 0; j < getNumLayersInIdList( lsIdx ); j++ )
     2184    {
     2185      m_targetDecLayerIdLists[targetOptLayerSetIdx].push_back( m_layerSetLayerIdList[ lsIdx ][ j ] );
     2186      if( getOutputLayerFlag( targetOptLayerSetIdx, j  )) // This seems to be wrong in draft text
     2187      {
     2188        m_targetOptLayerIdLists[targetOptLayerSetIdx].push_back( m_layerSetLayerIdList[ lsIdx ][ j ] );
     2189      }
     2190    } 
     2191  }
     2192}
     2193#endif
    21062194#endif // H_MV
    21072195
     
    21572245, m_spsInferScalingListFlag   ( false )
    21582246, m_spsScalingListRefLayerId  ( 0 )
     2247
     2248#if !H_MV_6_PS_REP_FORM_18_19_20
    21592249, m_updateRepFormatFlag       ( true )
     2250#else
     2251, m_updateRepFormatFlag       ( false )
     2252, m_spsRepFormatIdx           ( 0 )
     2253#endif
    21602254, m_interViewMvVertConstraintFlag (false)
    21612255#endif
     
    21732267  ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps));
    21742268  ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag));
     2269#if H_MV_6_PSEM_O0142_3
     2270  m_spsExtensionFlag = false;
     2271  for( Int i = 0; i < PS_EX_T_MAX_NUM; i++ )
     2272  {
     2273    m_spsExtensionTypeFlag[ i ] = false;
     2274  }
     2275#endif
     2276#if H_MV_6_SHVC_O0098_36
     2277  m_numScaledRefLayerOffsets = 0;
     2278
     2279  for (Int i = 0; i < MAX_NUM_SCALED_REF_LAYERS; i++ )
     2280  {
     2281    m_scaledRefLayerId             [i] = -1;
     2282  }
     2283
     2284  for (Int i = 0; i < MAX_NUM_LAYERS; i++ )
     2285  {
     2286    m_scaledRefLayerLeftOffset     [i] = 0;
     2287    m_scaledRefLayerTopOffset      [i] = 0;
     2288    m_scaledRefLayerRightOffset    [i] = 0;
     2289    m_scaledRefLayerBottomOffset   [i] = 0;
     2290  }
     2291#endif
    21752292}
    21762293
     
    23532470  if ( layerIdCurr > 0 )
    23542471  {
     2472#if H_MV_6_PS_REP_FORM_18_19_20
     2473    Int            repFormatIdx = getUpdateRepFormatFlag() ?  getSpsRepFormatIdx() : vps->getVpsRepFormatIdx( vps->getLayerIdInVps( layerIdCurr ) ) ;
     2474    TComRepFormat* repFormat    = vps->getRepFormat( repFormatIdx );
     2475#else
    23552476    TComRepFormat* repFormat = vps->getRepFormat( vps->getVpsRepFormatIdx( vps->getLayerIdInVps( layerIdCurr ) ) );
     2477
    23562478    if ( !getUpdateRepFormatFlag() )
    23572479    {       
     2480#endif
    23582481      setChromaFormatIdc( repFormat->getChromaFormatVpsIdc() );         
    23592482      //// ToDo: add when supported:
     
    23682491      setBitDepthC             ( repFormat->getBitDepthVpsChromaMinus8() + 8 );
    23692492      setQpBDOffsetC           ( (Int) (6* ( getBitDepthC() -8 ) ) );
     2493#if !H_MV_6_PS_REP_FORM_18_19_20
    23702494    }
    23712495    else
     2496#else
     2497    if ( getLayerId() > 0 && getUpdateRepFormatFlag() )
     2498#endif
    23722499    {
    23732500      assert( getChromaFormatIdc()      <=  repFormat->getChromaFormatVpsIdc()         );
     
    23982525  }
    23992526}
     2527
    24002528#endif
    24012529#if H_3D
     
    26682796#if H_MV
    26692797Void TComSlice::createInterLayerReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1 )
    2670 {
     2798{ 
    26712799  refPicSetInterLayer0.clear();
    26722800  refPicSetInterLayer1.clear();
     
    27132841
    27142842}
     2843
     2844
    27152845Void TComSlice::markIvRefPicsAsUnused( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc )
    27162846{
    2717   // Fill targetDecLayerIdSet with all layers if empty.
     2847  // Fill targetDecLayerIdSet with all layers if empty (at encoder side)
    27182848  if (targetDecLayerIdSet.size() == 0 )   
    27192849  {
     
    27222852      targetDecLayerIdSet.push_back( vps->getLayerIdInNuh( layerIdInVps ) );
    27232853    }
    2724   }     
     2854  } 
    27252855
    27262856  Int numTargetDecLayers = (Int) targetDecLayerIdSet.size();
     
    27312861    {
    27322862      break;
     2863    }       
    27332864  }       
    2734   }       
    27352865
    27362866  for( Int i = 0; i <= latestDecIdx; i++ )
     
    27392869    {
    27402870      TComPic* pcPic = ivPicLists->getPic( targetDecLayerIdSet[ i ], curPoc );
    2741       if( pcPic->getSlice(0)->isReferenced() && pcPic->getSlice(0)->getTemporalLayerNonReferenceFlag() )
    2742       {
    2743         Bool remainingInterLayerReferencesFlag = false;
    2744         for( Int j = latestDecIdx + 1; j < numTargetDecLayers; j++ )
     2871#if H_MV_LAYER_WISE_STARTUP
     2872      if ( pcPic )
     2873      {
     2874#endif
     2875        if( pcPic->getSlice(0)->isReferenced() && pcPic->getSlice(0)->getTemporalLayerNonReferenceFlag() )
    27452876        {
    2746           TComVPS* vpsSlice = pcPic->getSlice(0)->getVPS();
    2747           if ( vps->nuhLayerIdIncluded( targetDecLayerIdSet[ j ] ) )
     2877          Bool remainingInterLayerReferencesFlag = false;
     2878          for( Int j = latestDecIdx + 1; j < numTargetDecLayers; j++ )
     2879          {
     2880            TComVPS* vpsSlice = pcPic->getSlice(0)->getVPS();
     2881            if ( vps->nuhLayerIdIncluded( targetDecLayerIdSet[ j ] ) )
     2882            {
     2883              for( Int k = 0; k < vpsSlice->getNumDirectRefLayers( targetDecLayerIdSet[ j ] ); k++ )
     2884              {
     2885                if ( targetDecLayerIdSet[ i ] == vpsSlice->getRefLayerId( targetDecLayerIdSet[ j ],  k  ) )
     2886                {
     2887                  remainingInterLayerReferencesFlag = true;
     2888                }
     2889              }
     2890            }
     2891          }
     2892          if( !remainingInterLayerReferencesFlag )
    27482893          {
    2749             for( Int k = 0; k < vpsSlice->getNumDirectRefLayers( targetDecLayerIdSet[ j ] ); k++ )
    2750             {
    2751               if ( targetDecLayerIdSet[ i ] == vpsSlice->getRefLayerId( targetDecLayerIdSet[ j ],  k  ) )
    2752               {
    2753                 remainingInterLayerReferencesFlag = true;
     2894            pcPic->getSlice(0)->setReferenced( false );                   
    27542895          }
    27552896        }
    2756           }
    2757         }
    2758         if( !remainingInterLayerReferencesFlag )
    2759         {
    2760           pcPic->getSlice(0)->setReferenced( false );                   
    2761       }
    2762     }
    2763   }
    2764 }
     2897#if H_MV_LAYER_WISE_STARTUP
     2898      }
     2899#endif
     2900    }
     2901  }
    27652902}
    27662903
     
    27732910    {     
    27742911      if (rIdx == 0 && li == 0) m_apcRefPicList[li][rIdx]->print( true );
    2775        
     2912
    27762913      m_apcRefPicList[li][rIdx]->print( false );
    27772914    }
     
    28162953  return pcPic;
    28172954}
     2955
     2956
     2957#if H_MV_6_ILDDS_ILREFPICS_27_34
     2958Int  TComSlice::getRefLayerPicFlag( Int i )
     2959{
     2960  TComVPS* vps = getVPS();
     2961  Int refLayerIdx = vps->getLayerIdInVps( vps->getRefLayerId( getLayerId(), i ) );
     2962
     2963  Bool refLayerPicFlag = ( vps->getSubLayersVpsMaxMinus1( refLayerIdx ) >=  getTLayer() )  &&
     2964    ( vps->getMaxTidIlRefPicsPlus1( refLayerIdx, vps->getLayerIdInVps( getLayerId() )) > getTLayer() );
     2965
     2966  return refLayerPicFlag;       
     2967}   
     2968
     2969Int TComSlice::getRefLayerPicIdc( Int j )
     2970
     2971  Int refLayerPicIdc = -1;
     2972  Int curj = 0;
     2973  for( Int i = 0;  i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ )
     2974  {
     2975    if( getRefLayerPicFlag( i ) )
     2976    {
     2977      if ( curj == j )
     2978      {
     2979        refLayerPicIdc = i;         
     2980        break;
     2981      }
     2982      curj++;
     2983    }
     2984  }
     2985
     2986  assert( curj == j );
     2987  assert( refLayerPicIdc != -1 );
     2988  return refLayerPicIdc;
     2989}
     2990
     2991Int  TComSlice::getNumRefLayerPics( )
     2992
     2993  Int numRefLayerPics = 0;
     2994  for( Int i = 0;  i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ )
     2995  {
     2996    numRefLayerPics += getRefLayerPicFlag( i );
     2997  }
     2998  return numRefLayerPics;
     2999}
     3000#endif
     3001
     3002
     3003
    28183004Int TComSlice::getNumActiveRefLayerPics()
    28193005{
     
    28263012  else if (getVPS()->getAllRefLayersActiveFlag() )
    28273013  {
     3014#if H_MV_6_ILDDS_ILREFPICS_27_34
     3015    numActiveRefLayerPics = getNumRefLayerPics();
     3016#else
    28283017    numActiveRefLayerPics = getVPS()->getNumDirectRefLayers( getLayerId() );
     3018#endif
    28293019  }
    28303020  else if ( !getInterLayerPredEnabledFlag() )
     
    28343024  else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerId() ) == 1 )
    28353025  {
     3026#if H_MV_6_ILDDS_ILREFPICS_27_34
     3027    numActiveRefLayerPics = getRefLayerPicFlag( 0 ) ? 1 : 0;
     3028#else
    28363029    numActiveRefLayerPics = 1;
     3030#endif
    28373031  }
    28383032  else
     
    34343628TComVPSVUI::TComVPSVUI()
    34353629{
     3630#if H_MV_6_PS_O0223_29
     3631  m_crossLayerIrapAlignedFlag = true;
     3632#endif
    34363633  m_bitRatePresentVpsFlag = false;
    34373634  m_picRatePresentVpsFlag = false;
     
    34613658    }
    34623659  }
    3463 }
    3464 #endif
     3660#if H_MV_6_PS_O0118_33 
     3661  for ( Int i = 0; i < MAX_NUM_VIDEO_SIGNAL_INFO; i++ )
     3662  {
     3663    m_videoSignalInfo          [i] = NULL;     
     3664  }
     3665#endif
     3666
     3667#if H_MV_6_HRD_O0164_15
     3668  m_vpsVuiBspHrdPresentFlag = false;
     3669  m_vpsVuiBspHrdParameters  = new TComVpsVuiBspHrdParameters();
     3670#endif
     3671}
     3672
     3673#if H_MV_6_PS_O0118_33
     3674TComVPSVUI::~TComVPSVUI()
     3675{
     3676  for ( Int i = 0; i < MAX_NUM_VIDEO_SIGNAL_INFO; i++ )
     3677  {
     3678    if (m_videoSignalInfo[ i ] != NULL )      delete m_videoSignalInfo[ i ];   
     3679    m_videoSignalInfo    [ i ] = NULL;
     3680  }
     3681
     3682#if H_MV_6_HRD_O0164_15
     3683  if ( m_vpsVuiBspHrdParameters ) delete m_vpsVuiBspHrdParameters;
     3684  m_vpsVuiBspHrdParameters = NULL;
     3685#endif
     3686}
     3687#endif
     3688
     3689#if H_MV_6_PS_REP_FORM_18_19_20
     3690Void TComRepFormat::inferChromaAndBitDepth( TComRepFormat* prevRepFormat, Bool encoderFlag )
     3691{
     3692  if ( !encoderFlag )
     3693  {
     3694    setChromaAndBitDepthVpsPresentFlag( prevRepFormat->getChromaAndBitDepthVpsPresentFlag() );
     3695    setSeparateColourPlaneVpsFlag     ( prevRepFormat->getSeparateColourPlaneVpsFlag     () );
     3696    setBitDepthVpsLumaMinus8          ( prevRepFormat->getBitDepthVpsLumaMinus8          () );
     3697    setBitDepthVpsChromaMinus8        ( prevRepFormat->getBitDepthVpsChromaMinus8        () );
     3698  }
     3699  else
     3700  {
     3701    assert( getChromaAndBitDepthVpsPresentFlag() == prevRepFormat->getChromaAndBitDepthVpsPresentFlag() );
     3702    assert( getSeparateColourPlaneVpsFlag     () == prevRepFormat->getSeparateColourPlaneVpsFlag     () );
     3703    assert( getBitDepthVpsLumaMinus8          () == prevRepFormat->getBitDepthVpsLumaMinus8          () );
     3704    assert( getBitDepthVpsChromaMinus8        () == prevRepFormat->getBitDepthVpsChromaMinus8        () );
     3705  }
     3706}
     3707#endif
     3708
     3709#if H_MV_6_HRD_O0164_15
     3710Void TComVpsVuiBspHrdParameters::checkLayerInBspFlag( TComVPS* vps, Int h )
     3711{
     3712  // It is a requirement of bitstream conformance that bitstream partition with index j shall not include
     3713  // direct or indirect reference layers of any layers in bitstream partition i for any values of i and j
     3714  // in the range of 0 to num_bitstream_partitions[ h ] – 1, inclusive, such that i is less than j.
     3715
     3716  for ( Int partJ = 0; partJ < getNumBitstreamPartitions( h ); partJ++ )
     3717  {       
     3718    for ( Int partI = 0; partI < partJ; partI++ )
     3719    {
     3720      for ( Int layerJ = 0; layerJ < vps->getMaxLayersMinus1(); layerJ++ )
     3721      {
     3722        if ( m_layerInBspFlag[ h ][partJ][layerJ ] )
     3723        {
     3724          for ( Int layerI = 0; layerI < vps->getMaxLayersMinus1(); layerI++ )
     3725          {
     3726            if ( m_layerInBspFlag[ h ][partI][layerI] )
     3727            {
     3728              assert( !vps->getInDirectDependencyFlag( layerI, layerJ ) );
     3729            }
     3730          }
     3731        }
     3732      }
     3733    }
     3734  }
     3735}
     3736#endif
     3737#endif
  • branches/HTM-9.0-dev0/source/Lib/TLibCommon/TComSlice.h

    r724 r730  
    3636*/
    3737
     38
    3839#ifndef __TCOMSLICE__
    3940#define __TCOMSLICE__
     
    6263// ====================================================================================================================
    6364
     65#if H_MV_6_HRD_O0164_15
     66class TComVPS;
     67#endif
    6468/// Reference Picture Set class
    6569class TComReferencePictureSet
     
    403407
    404408#if H_MV
     409
     410#if H_MV_6_PS_O0118_33
     411class TComVideoSignalInfo
     412{
     413private:
     414  Int  m_videoVpsFormat;
     415  Bool m_videoFullRangeVpsFlag;
     416  Int  m_colourPrimariesVps;
     417  Int  m_transferCharacteristicsVps;
     418  Int  m_matrixCoeffsVps;
     419public:
     420  Void setVideoVpsFormat( Int  val ) { m_videoVpsFormat = val; }
     421  Int  getVideoVpsFormat(  ) { return m_videoVpsFormat; }
     422
     423  Void setVideoFullRangeVpsFlag( Bool flag ) { m_videoFullRangeVpsFlag = flag; }
     424  Bool getVideoFullRangeVpsFlag(  ) { return m_videoFullRangeVpsFlag; }
     425
     426  Void setColourPrimariesVps( Int  val ) { m_colourPrimariesVps = val; }
     427  Int  getColourPrimariesVps(  ) { return m_colourPrimariesVps; }
     428
     429  Void setTransferCharacteristicsVps( Int  val ) { m_transferCharacteristicsVps = val; }
     430  Int  getTransferCharacteristicsVps(  ) { return m_transferCharacteristicsVps; }
     431
     432  Void setMatrixCoeffsVps( Int  val ) { m_matrixCoeffsVps = val; }
     433  Int  getMatrixCoeffsVps(  ) { return m_matrixCoeffsVps; }
     434};
     435#endif
     436#if H_MV_6_HRD_O0164_15
     437class TComVpsVuiBspHrdParameters
     438{
     439private:
     440  Int  m_vpsNumBspHrdParametersMinus1;
     441  Bool m_bspCprmsPresentFlag[MAX_NUM_BSP_HRD_PARAMETERS];
     442  Int  m_numBitstreamPartitions[MAX_VPS_OP_SETS_PLUS1];
     443  Bool m_layerInBspFlag[MAX_VPS_OP_SETS_PLUS1][MAX_NUM_BSP_HRD_PARAMETERS][MAX_NUM_LAYERS];
     444  Int  m_numBspSchedCombinations[MAX_VPS_OP_SETS_PLUS1];
     445  Int  m_bspCombHrdIdx[MAX_VPS_OP_SETS_PLUS1][MAX_NUM_BSP_HRD_PARAMETERS][MAX_NUM_BSP_SCHED_COMBINATION];
     446  Int  m_bspCombSchedIdx[MAX_VPS_OP_SETS_PLUS1][MAX_NUM_BSP_HRD_PARAMETERS][MAX_NUM_BSP_SCHED_COMBINATION];
     447  TComHRD* m_hrdParameters[MAX_NUM_BSP_HRD_PARAMETERS];
     448public:
     449
     450  Void setVpsNumBspHrdParametersMinus1( Int  val ) { m_vpsNumBspHrdParametersMinus1 = val; }
     451  Int  getVpsNumBspHrdParametersMinus1(  ) { return m_vpsNumBspHrdParametersMinus1; }
     452
     453  Void setBspCprmsPresentFlag( Int i, Bool flag ) { m_bspCprmsPresentFlag[i] = flag; }
     454  Bool getBspCprmsPresentFlag( Int i ) { return m_bspCprmsPresentFlag[i]; }
     455
     456  Void setNumBitstreamPartitions( Int h, Int  val ) { m_numBitstreamPartitions[h] = val; }
     457  Int  getNumBitstreamPartitions( Int h ) { return m_numBitstreamPartitions[h]; }
     458
     459  Void setLayerInBspFlag( Int h, Int i, Int j, Bool flag ) { m_layerInBspFlag[h][i][j] = flag; }
     460  Bool getLayerInBspFlag( Int h, Int i, Int j ) { return m_layerInBspFlag[h][i][j]; }
     461  Void checkLayerInBspFlag ( TComVPS* vps, Int h ); 
     462
     463  Void setNumBspSchedCombinations( Int h, Int  val ) { m_numBspSchedCombinations[h] = val; }
     464  Int  getNumBspSchedCombinations( Int h ) { return m_numBspSchedCombinations[h]; }
     465
     466  Void setBspCombHrdIdx( Int h, Int i, Int j, Int  val ) { m_bspCombHrdIdx[h][i][j] = val; }
     467  Int  getBspCombHrdIdx( Int h, Int i, Int j ) { return m_bspCombHrdIdx[h][i][j]; }
     468
     469  Void setBspCombSchedIdx( Int h, Int i, Int j, Int  val ) { m_bspCombSchedIdx[h][i][j] = val; }
     470  Int  getBspCombSchedIdx( Int h, Int i, Int j ) { return m_bspCombSchedIdx[h][i][j]; }
     471
     472  Void setHrdParametermeters( Int k, TComHRD* val  ) {  m_hrdParameters[k] = val; };
     473  TComHRD* getHrdParametermeters( Int k ) {  return m_hrdParameters[k]; };
     474};
     475
     476#endif
    405477class TComVPSVUI
    406 {
     478{ 
    407479private:
     480#if H_MV_6_PS_O0223_29
     481  Bool m_crossLayerPicTypeAlignedFlag;
     482  Bool m_crossLayerIrapAlignedFlag;
     483#endif
    408484  Bool m_bitRatePresentVpsFlag;
    409485  Bool m_picRatePresentVpsFlag;
     
    413489  Int  m_maxBitRate                  [MAX_VPS_OP_SETS_PLUS1][MAX_TLAYER];
    414490  Int  m_constantPicRateIdc          [MAX_VPS_OP_SETS_PLUS1][MAX_TLAYER];
    415   Int  m_avgPicRate                  [MAX_VPS_OP_SETS_PLUS1][MAX_TLAYER];
     491  Int  m_avgPicRate                  [MAX_VPS_OP_SETS_PLUS1][MAX_TLAYER]; 
     492#if H_MV_6_O0226_37
     493  Bool m_tilesNotInUseFlag;
     494  Bool m_tilesInUseFlag              [MAX_NUM_LAYERS];
     495  Bool m_loopFilterNotAcrossTilesFlag[MAX_NUM_LAYERS];
     496#endif 
    416497  Bool m_tileBoundariesAlignedFlag   [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
     498#if H_MV_6_O0226_37
     499  Bool m_wppNotInUseFlag;
     500  Bool m_wppInUseFlag                [MAX_NUM_LAYERS];
     501#endif
    417502  Bool m_ilpRestrictedRefLayersFlag;
    418503  Int  m_minSpatialSegmentOffsetPlus1[MAX_NUM_LAYERS][MAX_NUM_LAYERS];
    419504  Bool m_ctuBasedOffsetEnabledFlag   [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
    420505  Int  m_minHorizontalCtuOffsetPlus1 [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
     506#if H_MV_6_PS_O0118_33
     507  Bool m_videoSignalInfoIdxPresentFlag;
     508  Int  m_vpsNumVideoSignalInfoMinus1;
     509  TComVideoSignalInfo* m_videoSignalInfo[MAX_NUM_VIDEO_SIGNAL_INFO];   
     510  Int  m_vpsVideoSignalInfoIdx       [MAX_NUM_VIDEO_SIGNAL_INFO];
     511#endif
     512#if H_MV_6_HRD_O0164_15
     513  Bool m_vpsVuiBspHrdPresentFlag;
     514  TComVpsVuiBspHrdParameters* m_vpsVuiBspHrdParameters;
     515#endif
    421516
    422517public:
    423   TComVPSVUI();;
     518  TComVPSVUI();
     519  ~TComVPSVUI();
     520#if H_MV_6_PS_O0223_29
     521  Void setCrossLayerPicTypeAlignedFlag( Bool flag ) { m_crossLayerPicTypeAlignedFlag = flag; }
     522  Bool getCrossLayerPicTypeAlignedFlag(  ) { return m_crossLayerPicTypeAlignedFlag; }
     523
     524  Void setCrossLayerIrapAlignedFlag( Bool flag ) { m_crossLayerIrapAlignedFlag = flag; }
     525  Bool getCrossLayerIrapAlignedFlag(  ) { return m_crossLayerIrapAlignedFlag; }
     526#endif
    424527
    425528  Void setBitRatePresentVpsFlag( Bool flag ) { m_bitRatePresentVpsFlag = flag; }
     
    447550  Int  getAvgPicRate( Int i, Int j ) { return m_avgPicRate[i][j]; }
    448551
     552#if H_MV_6_O0226_37
     553  Void setTilesNotInUseFlag( Bool flag ) { m_tilesNotInUseFlag = flag; }
     554  Bool getTilesNotInUseFlag(  ) { return m_tilesNotInUseFlag; }
     555
     556  Void setTilesInUseFlag( Int i, Bool flag ) { m_tilesInUseFlag[i] = flag; }
     557  Bool getTilesInUseFlag( Int i ) { return m_tilesInUseFlag[i]; }
     558
     559  Void setLoopFilterNotAcrossTilesFlag( Int i, Int  val ) { m_loopFilterNotAcrossTilesFlag[i] = val; }
     560  Bool getLoopFilterNotAcrossTilesFlag( Int i ) { return m_loopFilterNotAcrossTilesFlag[i]; }
     561#endif
     562
    449563  Void setTileBoundariesAlignedFlag( Int i, Int j, Bool flag ) { m_tileBoundariesAlignedFlag[i][j] = flag; }
    450564  Bool getTileBoundariesAlignedFlag( Int i, Int j ) { return m_tileBoundariesAlignedFlag[i][j]; }
    451565
     566#if H_MV_6_O0226_37
     567  Void setWppNotInUseFlag( Bool flag ) { m_wppNotInUseFlag = flag; }
     568  Bool getWppNotInUseFlag(  ) { return m_wppNotInUseFlag; }
     569
     570  Void setWppInUseFlag( Int i, Bool flag ) { m_wppInUseFlag[i] = flag; }
     571  Bool getWppInUseFlag( Int i ) { return m_wppInUseFlag[i]; }
     572#endif
     573
    452574  Void setIlpRestrictedRefLayersFlag( Bool flag ) { m_ilpRestrictedRefLayersFlag = flag; }
    453575  Bool getIlpRestrictedRefLayersFlag(  ) { return m_ilpRestrictedRefLayersFlag; }
     
    462584  Int  getMinHorizontalCtuOffsetPlus1( Int i, Int j ) { return m_minHorizontalCtuOffsetPlus1[i][j]; }
    463585
     586#if H_MV_6_PS_O0118_33
     587  Void setVideoSignalInfoIdxPresentFlag( Bool flag ) { m_videoSignalInfoIdxPresentFlag = flag; }
     588  Bool getVideoSignalInfoIdxPresentFlag(  ) { return m_videoSignalInfoIdxPresentFlag; }
     589
     590  Void    setVideoSignalInfo( Int i, TComVideoSignalInfo* val )                        { m_videoSignalInfo[i] = val;  } 
     591  TComVideoSignalInfo* getVideoSignalInfo( Int i )                                     { return m_videoSignalInfo[i]; }
     592
     593  Void setVpsNumVideoSignalInfoMinus1( Int  val ) { m_vpsNumVideoSignalInfoMinus1 = val; }
     594  Int  getVpsNumVideoSignalInfoMinus1(  ) { return m_vpsNumVideoSignalInfoMinus1; }
     595
     596  Void setVpsVideoSignalInfoIdx( Int i, Int  val ) { m_vpsVideoSignalInfoIdx[i] = val; }
     597  Int  getVpsVideoSignalInfoIdx( Int i ) { return m_vpsVideoSignalInfoIdx[i]; }
     598#endif
     599
     600#if H_MV_6_HRD_O0164_15
     601  Void setVpsVuiBspHrdPresentFlag( Bool flag ) { m_vpsVuiBspHrdPresentFlag = flag; }
     602  Bool getVpsVuiBspHrdPresentFlag(  ) { return m_vpsVuiBspHrdPresentFlag; }
     603
     604  Void setVpsVuiBspHrdParameters( TComVpsVuiBspHrdParameters* val) {  m_vpsVuiBspHrdParameters = val; }
     605  TComVpsVuiBspHrdParameters* getVpsVuiBspHrdParameters(  ) { return m_vpsVuiBspHrdParameters; }
     606#endif
    464607};
     608
    465609
    466610class TComRepFormat
    467611{
    468612private:
     613#if H_MV_6_PS_REP_FORM_18_19_20
     614  Bool m_chromaAndBitDepthVpsPresentFlag;
     615#endif
    469616  Int  m_chromaFormatVpsIdc;
    470617  Bool m_separateColourPlaneVpsFlag;
     
    477624  TComRepFormat() { }; 
    478625
     626#if H_MV_6_PS_REP_FORM_18_19_20
     627  Void setChromaAndBitDepthVpsPresentFlag( Bool flag ) { m_chromaAndBitDepthVpsPresentFlag = flag; }
     628  Bool getChromaAndBitDepthVpsPresentFlag(  ) { return m_chromaAndBitDepthVpsPresentFlag; }
     629  Void checkChromaAndBitDepthVpsPresentFlag( Int i ) { assert( i != 0 || m_chromaAndBitDepthVpsPresentFlag ); } // The value of chroma_and_bit_depth_vps_present_flag of the first rep_format( ) syntax structure in the VPS shall be equal to 1. 
     630  Void inferChromaAndBitDepth( TComRepFormat* prevRepFormat, Bool encoderFlag );
     631#endif
     632
    479633  Void setChromaFormatVpsIdc( Int  val ) { m_chromaFormatVpsIdc = val; }
    480634  Int  getChromaFormatVpsIdc(  ) { return m_chromaFormatVpsIdc; }
     
    494648  Void setBitDepthVpsChromaMinus8( Int  val ) { m_bitDepthVpsChromaMinus8 = val; }
    495649  Int  getBitDepthVpsChromaMinus8(  ) { return m_bitDepthVpsChromaMinus8; }
     650};
     651#endif
     652
     653#if H_MV_6_HRD_O0217_13
     654class TComDpbSize
     655{
     656private:
     657  Bool  m_subLayerFlagInfoPresentFlag[MAX_VPS_OUTPUTLAYER_SETS];
     658  Bool  m_subLayerDpbInfoPresentFlag [MAX_VPS_OUTPUTLAYER_SETS][MAX_TLAYER];
     659  Int   m_maxVpsDecPicBufferingMinus1[MAX_VPS_OUTPUTLAYER_SETS][MAX_NUM_LAYER_IDS][MAX_TLAYER];;
     660  Int   m_maxVpsNumReorderPics       [MAX_VPS_OUTPUTLAYER_SETS][MAX_TLAYER];
     661  Int   m_maxVpsLatencyIncreasePlus1 [MAX_VPS_OUTPUTLAYER_SETS][MAX_TLAYER];
     662
     663public:
     664  TComDpbSize( )
     665  {
     666    for (Int i = 0; i < MAX_VPS_OUTPUTLAYER_SETS; i++ )
     667    {     
     668      m_subLayerFlagInfoPresentFlag[i]  = false;
     669
     670      for (Int j = 0; j < MAX_TLAYER; j++  )
     671      {       
     672        m_subLayerDpbInfoPresentFlag [i][j] = ( j == 0) ;
     673        m_maxVpsNumReorderPics       [i][j] = 0;
     674        m_maxVpsLatencyIncreasePlus1 [i][j] = 0;
     675
     676        for (Int k = 0; k < MAX_NUM_LAYER_IDS; k++ )
     677        {
     678          m_maxVpsDecPicBufferingMinus1[i][k][j] = 0;
     679        }
     680      }
     681    } 
     682  } 
     683
     684  Void setSubLayerFlagInfoPresentFlag( Int i, Bool flag ) { m_subLayerFlagInfoPresentFlag[i] = flag; }
     685  Bool getSubLayerFlagInfoPresentFlag( Int i ) { return m_subLayerFlagInfoPresentFlag[i]; }
     686
     687  Void setSubLayerDpbInfoPresentFlag( Int i, Int j, Bool flag ) { m_subLayerDpbInfoPresentFlag[i][j] = flag; }
     688  Bool getSubLayerDpbInfoPresentFlag( Int i, Int j ) { return m_subLayerDpbInfoPresentFlag[i][j]; }
     689
     690  Void setMaxVpsDecPicBufferingMinus1( Int i, Int k, Int j, Int  val ) { m_maxVpsDecPicBufferingMinus1[i][k][j] = val; }
     691  Int  getMaxVpsDecPicBufferingMinus1( Int i, Int k, Int j ) { return m_maxVpsDecPicBufferingMinus1[i][k][j]; }
     692
     693  Void setMaxVpsNumReorderPics( Int i, Int j, Int  val ) { m_maxVpsNumReorderPics[i][j] = val; }
     694  Int  getMaxVpsNumReorderPics( Int i, Int j ) { return m_maxVpsNumReorderPics[i][j]; }
     695
     696  Void setMaxVpsLatencyIncreasePlus1( Int i, Int j, Int  val ) { m_maxVpsLatencyIncreasePlus1[i][j] = val; }
     697  Int  getMaxVpsLatencyIncreasePlus1( Int i, Int j ) { return m_maxVpsLatencyIncreasePlus1[i][j]; }
    496698};
    497699#endif
     
    547749  Int         m_layerIdInNuh             [MAX_NUM_LAYER_IDS];
    548750  Int         m_dimensionId              [MAX_NUM_LAYER_IDS][MAX_NUM_SCALABILITY_TYPES]; 
     751
     752#if H_MV_6_PS_O0109_22
     753  Int         m_viewIdLen;
     754#else
    549755  Int         m_viewIdLenMinus1;
     756#endif
    550757  Int         m_viewIdVal                [MAX_NUM_LAYERS];
    551758  Bool        m_directDependencyFlag     [MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS];
     759#if H_MV_6_ILDSD_O0120_26
     760  Bool        m_vpsSubLayersMaxMinus1PresentFlag;
     761  Int         m_subLayersVpsMaxMinus1    [MAX_NUM_LAYERS];
     762#endif
    552763  Bool        m_maxTidRefPresentFlag;
     764#if H_MV_6_ILDDS_O0225_30
     765  Int         m_maxTidIlRefPicsPlus1     [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
     766#else
    553767  Int         m_maxTidIlRefPicPlus1      [MAX_NUM_LAYERS];
     768#endif
    554769  Bool        m_allRefLayersActiveFlag;
    555770  Int         m_vpsNumberLayerSetsMinus1;
     
    559774  Bool        m_moreOutputLayerSetsThanDefaultFlag;
    560775  Int         m_numAddOutputLayerSetsMinus1;   
     776#if H_MV_6_PS_0109_25
     777  Int         m_defaultOneTargetOutputLayerIdc;
     778#else
    561779  Bool        m_defaultOneTargetOutputLayerFlag;
     780#endif
    562781  Int         m_outputLayerSetIdxMinus1  [MAX_VPS_OUTPUTLAYER_SETS]; 
    563782  Bool        m_outputLayerFlag          [MAX_VPS_OUTPUTLAYER_SETS][MAX_VPS_NUH_LAYER_ID_PLUS1];
    564783  Int         m_profileLevelTierIdx      [MAX_VPS_OUTPUTLAYER_SETS ];
     784#if H_MV_6_GEN_0153_28
     785  Bool        m_altOutputLayerFlag;
     786#endif
    565787  Bool        m_repFormatIdxPresentFlag;
    566788  Int         m_vpsNumRepFormatsMinus1;
    567789  Int         m_vpsRepFormatIdx          [MAX_NUM_LAYERS];
    568790  TComRepFormat* m_repFormat             [MAX_NUM_LAYERS];
    569   Bool        m_maxOneActiveRefLayerFlag;       
     791  Bool        m_maxOneActiveRefLayerFlag;
     792#if H_MV_6_MISC_O0062_31
     793  Bool        m_pocLsbNotPresentFlag     [MAX_NUM_LAYERS];
     794#endif
     795
     796#if H_MV_6_HRD_O0217_13
     797  TComDpbSize* m_dpbSize;
     798#endif
     799#if !H_MV_6_PS_O0223_29       
    570800  Bool        m_crossLayerIrapAlignedFlag;
     801#endif
    571802  Int         m_directDepTypeLenMinus2;         
     803#if H_MV_6_PS_O0096_21
     804  Bool        m_defaultDirectDependencyFlag;
     805  Int         m_defaultDirectDependencyType;
     806#endif
    572807  Bool        m_vpsVuiPresentFlag;
    573808  TComVPSVUI* m_vpsVUI;
     
    588823  Int         m_motionPredRefLayerId     [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
    589824  Int         m_viewIndex                [MAX_NUM_LAYERS   ];
     825 
     826#if H_MV_6_HRD_O0217_13
     827  std::vector< std::vector< Int> >       m_targetDecLayerIdLists;   //[TargetOptLayerSetIdx][i]
     828  std::vector< std::vector< Int> >       m_targetOptLayerIdLists;
     829  std::vector< std::vector< Int> >       m_layerSetLayerIdList;
     830#endif
     831
     832
    590833  Int         xGetDimBitOffset( Int j );
    591  
     834
    592835  // VPS EXTENSION 2 SYNTAX ELEMENTS
    593836#if H_3D_ARP
     
    649892  UInt    getMaxTLayers  ()                   { return m_uiMaxTLayers;   }
    650893  Void    setMaxTLayers  (UInt t)             { m_uiMaxTLayers = t; }
    651  
     894#if H_MV_6_HRD_O0164_15
     895  UInt    getMaxSubLayersMinus1()             { return m_uiMaxTLayers - 1;  }  // For consistency with draft spec
     896#endif
    652897#if H_MV   
    653898  UInt    getMaxLayersMinus1()                { return m_uiMaxLayersMinus1;  };
     
    724969  Int     getDimensionId( Int layerIdInVps, Int scalIdx )                  { return m_dimensionId[layerIdInVps][scalIdx]; }
    725970
     971#if H_MV_6_PS_O0109_22
     972  Void    setViewIdLen( Int  val )                                         { m_viewIdLen = val; }
     973  Int     getViewIdLen(  )                                                 { return m_viewIdLen; }
     974#else
    726975  Void    setViewIdLenMinus1( Int  val )                                   { m_viewIdLenMinus1 = val; }
    727976  Int     getViewIdLenMinus1(  )                                           { return m_viewIdLenMinus1; }
     977#endif
    728978
    729979  Void    setViewIdVal( Int viewOrderIndex, Int  val )                     { m_viewIdVal[viewOrderIndex] = val; }
     
    731981  Void    setDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps, Bool val ) { m_directDependencyFlag[depLayeridInVps][refLayeridInVps] = val;  }
    732982  Bool    getDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps )           { return m_directDependencyFlag[depLayeridInVps][refLayeridInVps]; }
    733 
     983#if H_MV_6_ILDSD_O0120_26
     984  Void    setVpsSubLayersMaxMinus1PresentFlag( Bool flag )                 { m_vpsSubLayersMaxMinus1PresentFlag = flag; }
     985  Bool    getVpsSubLayersMaxMinus1PresentFlag(  )                          { return m_vpsSubLayersMaxMinus1PresentFlag; }
     986  Void    setSubLayersVpsMaxMinus1( Int i, Int  val )                      { m_subLayersVpsMaxMinus1[i] = val; }
     987  Int     getSubLayersVpsMaxMinus1( Int i )                                { return m_subLayersVpsMaxMinus1[i]; }
     988  Void    checkSubLayersVpsMaxMinus1( Int i )                              { assert( m_subLayersVpsMaxMinus1[i] >= 0 && m_subLayersVpsMaxMinus1[i] <= m_uiMaxTLayers - 1 ); }
     989#endif
    734990  Void    setMaxTidRefPresentFlag( Bool flag )                             { m_maxTidRefPresentFlag = flag; }
    735991  Bool    getMaxTidRefPresentFlag(  )                                      { return m_maxTidRefPresentFlag; }
     992#if H_MV_6_ILDDS_O0225_30
     993  Void    setMaxTidIlRefPicsPlus1( Int i, Int j, Int  val )                { m_maxTidIlRefPicsPlus1[i][j] = val; }
     994  Int     getMaxTidIlRefPicsPlus1( Int i, Int j )                          { return m_maxTidIlRefPicsPlus1[i][j]; }
     995#else
    736996  Void    setMaxTidIlRefPicPlus1( Int layerIdInVps, Int val )              { m_maxTidIlRefPicPlus1[ layerIdInVps ] = val;  }
    737997  Int     getMaxTidIlRefPicPlus1( Int layerIdInVps )                       { return m_maxTidIlRefPicPlus1[ layerIdInVps ]; }
     998#endif
    738999  Void    setAllRefLayersActiveFlag( Bool flag )                           { m_allRefLayersActiveFlag = flag; }
    7391000  Bool    getAllRefLayersActiveFlag(  )                                    { return m_allRefLayersActiveFlag; }
     
    7491010  Void    setProfileRefMinus1( Int profileTierLevelIdx, Int val )          { m_profileRefMinus1[ profileTierLevelIdx ] = val;  }
    7501011  Int     getProfileRefMinus1( Int profileTierLevelIdx )                   { return m_profileRefMinus1[ profileTierLevelIdx ]; }
    751 
     1012#if H_MV_6_PS_O0109_23
     1013  Void    checkProfileRefMinus1( Int i )                                   { assert( getProfileRefMinus1( i ) + 1 <= i ); };  //  The value of profile_ref_minus1[ i ] + 1 shall be less than or equal to i.
     1014#endif
    7521015  Void    setMoreOutputLayerSetsThanDefaultFlag( Bool flag )               { m_moreOutputLayerSetsThanDefaultFlag = flag; }
    7531016  Bool    getMoreOutputLayerSetsThanDefaultFlag()                          { return m_moreOutputLayerSetsThanDefaultFlag; }
     
    7551018  Void    setNumAddOutputLayerSetsMinus1( Int val )                        { m_numAddOutputLayerSetsMinus1 = val; }
    7561019  Int     getNumAddOutputLayerSetsMinus1( )                                { return m_numAddOutputLayerSetsMinus1; }
    757  
     1020
     1021#if H_MV_6_PS_0109_25 
     1022  Void    setDefaultOneTargetOutputLayerIdc( Int  val )                    { m_defaultOneTargetOutputLayerIdc = val; }
     1023  Int     getDefaultOneTargetOutputLayerIdc(  )                            { return m_defaultOneTargetOutputLayerIdc; }
     1024  Void    checkDefaultOneTargetOutputLayerIdc( )                           { assert( m_defaultOneTargetOutputLayerIdc >= 0 && m_defaultOneTargetOutputLayerIdc <= 1 ); }
     1025#else
    7581026  Void    setDefaultOneTargetOutputLayerFlag( Bool flag )                  { m_defaultOneTargetOutputLayerFlag = flag; }
    7591027  Bool    getDefaultOneTargetOutputLayerFlag( )                            { return m_defaultOneTargetOutputLayerFlag; }
     1028#endif
    7601029 
    7611030  Void    setOutputLayerSetIdxMinus1( Int outLayerSetIdx, Int val )        { m_outputLayerSetIdxMinus1[ outLayerSetIdx ]  = val; }
     
    7641033  Void    setOutputLayerFlag( Int outLayerSetIdx, Int i, Bool flag )       { m_outputLayerFlag[ outLayerSetIdx ][ i ] = flag; }
    7651034  Bool    getOutputLayerFlag( Int outLayerSetIdx, Int i )                  { return m_outputLayerFlag[ outLayerSetIdx ][ i ]; }
     1035#if H_MV_6_HRD_O0217_13
     1036  Bool    inferOutputLayerFlag( Int layerSetIdx, Int i )                   { return ( getDefaultOneTargetOutputLayerIdc( ) == 0 || ( ( getDefaultOneTargetOutputLayerIdc( ) == 1 ) && ( i == m_layerSetLayerIdList[layerSetIdx].size() - 1  ) ));  }
     1037#endif
    7661038
    7671039  Void    setProfileLevelTierIdx( Int outLayerSetIdx, Int val )            { m_profileLevelTierIdx[ outLayerSetIdx  = val ]; }
    7681040  Int     getProfileLevelTierIdx( Int outLayerSetIdx )                     { return m_profileLevelTierIdx[ outLayerSetIdx ]; }
    769 
     1041#if H_MV_6_GEN_0153_28
     1042  Void    setAltOutputLayerFlag( Bool flag )                               { m_altOutputLayerFlag = flag; }
     1043  Bool    getAltOutputLayerFlag(  )                                        { return m_altOutputLayerFlag; }
     1044#endif
    7701045  Void    setRepFormatIdxPresentFlag( Bool flag )                          { m_repFormatIdxPresentFlag = flag; }
    7711046  Bool    getRepFormatIdxPresentFlag(  )                                   { return m_repFormatIdxPresentFlag; }
     
    7811056  Void    setMaxOneActiveRefLayerFlag( Bool flag)                          { m_maxOneActiveRefLayerFlag = flag; }
    7821057  Bool    getMaxOneActiveRefLayerFlag( )                                   { return m_maxOneActiveRefLayerFlag; }
     1058
     1059#if H_MV_6_HRD_O0217_13
     1060  Void    setDpbSize( TComDpbSize* val )                                   { assert( m_dpbSize != 0 ); m_dpbSize = val; }
     1061  TComDpbSize* getDpbSize( )                                               { return m_dpbSize;}
     1062#endif
     1063
     1064#if H_MV_6_MISC_O0062_31
     1065  Void    setPocLsbNotPresentFlag( Int i, Bool flag )                      { m_pocLsbNotPresentFlag[i] = flag; }
     1066  Bool    getPocLsbNotPresentFlag( Int i )                                 { return m_pocLsbNotPresentFlag[i]; }
     1067#endif
     1068#if !H_MV_6_PS_O0223_29 
    7831069  Void    setCrossLayerIrapAlignedFlag( Bool flag )                        { m_crossLayerIrapAlignedFlag = flag; }
    7841070  Bool    getCrossLayerIrapAlignedFlag(  )                                 { return m_crossLayerIrapAlignedFlag; }
     1071#endif
    7851072  Void    setDirectDepTypeLenMinus2( Int val)                              { m_directDepTypeLenMinus2 = val; }
    7861073  Int     getDirectDepTypeLenMinus2( )                                     { return m_directDepTypeLenMinus2; }
    7871074
     1075#if H_MV_6_PS_O0096_21
     1076  Void    setDefaultDirectDependencyFlag( Bool flag )                      { m_defaultDirectDependencyFlag = flag; }
     1077  Bool    getDefaultDirectDependencyFlag(  )                               { return m_defaultDirectDependencyFlag; }
     1078
     1079  Void    setDefaultDirectDependencyType( Int  val )                       { m_defaultDirectDependencyType = val; }
     1080  Int     getDefaultDirectDependencyType(  )                               { return m_defaultDirectDependencyType; }
     1081#endif
    7881082  Void    setDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps, Int val) { m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ] = val; }
    7891083  Int     getDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps)   { return m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ]; }
     
    7931087  TComVPSVUI* getVPSVUI(  )                                                { return m_vpsVUI;  }
    7941088  // VPS EXTENSION SEMANTICS VARIABLES
     1089
    7951090  Void    setLayerIdInVps( Int layerIdInNuh, Int val )                     { m_layerIdInVps[layerIdInNuh] = val;  }
    7961091  Int     getLayerIdInVps( Int layerIdInNuh )                              { assert( m_layerIdInVps[layerIdInNuh] >= 0 ); return m_layerIdInVps[layerIdInNuh]; }
    7971092
    7981093  Int     getScalabilityId ( Int layerIdInVps, ScalabilityType scalType );
     1094#if H_MV_6_FIX_GET_VIEW_ID
     1095  Int     getViewId        ( Int layerIdInNuh )                            { return m_viewIdVal[ getViewIndex( layerIdInNuh )]; }
     1096#else
    7991097  Int     getViewId        ( Int layerIdInNuh )                            { return m_viewIdVal[ getViewIndex( getLayerIdInVps( layerIdInNuh) )]; }
     1098#endif
    8001099  Void    setRefLayers();
    8011100
     
    8081107  Int     scalTypeToScalIdx   ( ScalabilityType scalType );
    8091108
    810 Int     getProfileLevelTierIdxLen()                                      { return gCeilLog2( getVpsNumProfileTierLevelMinus1() + 1 ); };       
    811 
    812   Int     getNumLayersInIdList              ( Int lsIdx );;
     1109  Int     getProfileLevelTierIdxLen()                                      { return gCeilLog2( getVpsNumProfileTierLevelMinus1() + 1 ); };       
     1110
     1111  Int     getNumLayersInIdList ( Int lsIdx );
     1112
     1113#if H_MV_6_HRD_O0217_13
     1114  Int     getNumOutputLayerSets() ;   
     1115  Int     getNumSubDpbs( Int i )                                           { return getNumLayersInIdList( i ); }; 
     1116  Bool    isOutputLayer( Int outLayerSetIdx, Int layerIdInNuh );   
     1117#if H_MV_6_HRD_O0217_13
     1118  Void    deriveLayerSetLayerIdList();
     1119  Void    deriveTargetLayerIdLists();
     1120  std::vector<Int> getTargetDecLayerIdList( Int targetOptLayerSetIdx )     { return m_targetDecLayerIdLists[targetOptLayerSetIdx]; };
     1121  std::vector<Int> getTargetOptLayerIdList( Int targetOptLayerSetIdx )     { return m_targetDecLayerIdLists[targetOptLayerSetIdx]; };
     1122#endif
     1123#endif
     1124
    8131125
    8141126  // inference
     
    10961408  TimingInfo* getTimingInfo() { return &m_timingInfo; }
    10971409
     1410#if H_MV_6_PS_O0118_33
     1411  Void inferVideoSignalInfo( TComVPS* vps, Int layerIdCurr )
     1412  {
     1413    if ( layerIdCurr == 0 || !vps->getVpsVuiPresentFlag() )
     1414    {
     1415      return;
     1416    }
     1417
     1418    TComVPSVUI* vpsVUI = vps->getVPSVUI();
     1419    assert( vpsVUI != NULL ); 
     1420
     1421    TComVideoSignalInfo* videoSignalInfo = vpsVUI->getVideoSignalInfo( vpsVUI->getVpsVideoSignalInfoIdx( vps->getLayerIdInVps( layerIdCurr ) ) );
     1422    assert( videoSignalInfo != NULL );
     1423
     1424    setVideoFormat            ( videoSignalInfo->getVideoVpsFormat            () );
     1425    setVideoFullRangeFlag     ( videoSignalInfo->getVideoFullRangeVpsFlag     () );
     1426    setColourPrimaries        ( videoSignalInfo->getColourPrimariesVps        () );
     1427    setTransferCharacteristics( videoSignalInfo->getTransferCharacteristicsVps() );
     1428    setMatrixCoefficients     ( videoSignalInfo->getMatrixCoeffsVps           () );     
     1429  }
     1430#endif
    10981431};
    10991432
     
    11811514  TComVPS*    m_pcVPS;
    11821515  // SPS
     1516#if H_MV_6_PSEM_O0142_3
     1517  Bool        m_spsExtensionFlag;
     1518  Bool        m_spsExtensionTypeFlag[PS_EX_T_MAX_NUM];
     1519#endif
    11831520  Bool        m_spsInferScalingListFlag;
    11841521  Int         m_spsScalingListRefLayerId;
    11851522  Bool        m_updateRepFormatFlag;
     1523#if H_MV_6_PS_REP_FORM_18_19_20 
     1524  Int         m_spsRepFormatIdx;
     1525#endif
    11861526  // SPS Extension
    11871527  Bool        m_interViewMvVertConstraintFlag;
     1528#if H_MV_6_SHVC_O0098_36
     1529  Int         m_numScaledRefLayerOffsets;
     1530  Int         m_scaledRefLayerId          [MAX_NUM_SCALED_REF_LAYERS];
     1531  Int         m_scaledRefLayerLeftOffset  [MAX_NUM_LAYERS];
     1532  Int         m_scaledRefLayerTopOffset   [MAX_NUM_LAYERS];
     1533  Int         m_scaledRefLayerRightOffset [MAX_NUM_LAYERS];
     1534  Int         m_scaledRefLayerBottomOffset[MAX_NUM_LAYERS];
     1535#endif
    11881536#endif
    11891537#if H_3D
     
    13221670  TComPTL* getPTL()     { return &m_pcPTL; }
    13231671#if H_MV
     1672#if H_MV_6_PSEM_O0142_3
     1673  Void setSpsExtensionFlag( Bool flag ) { m_spsExtensionFlag = flag; }
     1674  Bool getSpsExtensionFlag( )  { return m_spsExtensionFlag; }
     1675
     1676  Void setSpsExtensionTypeFlag( Int i, Bool flag ) { m_spsExtensionTypeFlag[i] = flag; }
     1677  Bool getSpsExtensionTypeFlag( Int i ) { return m_spsExtensionTypeFlag[i]; }
     1678#endif
    13241679  Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
    13251680  TComVPS*  getVPS          () { return m_pcVPS; }
     
    13331688  Void setUpdateRepFormatFlag( Bool flag )     { m_updateRepFormatFlag = flag; }
    13341689  Bool getUpdateRepFormatFlag(  )              { return m_updateRepFormatFlag; }
     1690#if H_MV_6_PS_REP_FORM_18_19_20
     1691  Void setSpsRepFormatIdx( Int  val )          { m_spsRepFormatIdx = val; }
     1692  Int  getSpsRepFormatIdx(  )                  { return m_spsRepFormatIdx; }
     1693#endif
    13351694  // SPS Extension
    13361695  Void setInterViewMvVertConstraintFlag(Bool val) { m_interViewMvVertConstraintFlag = val; }
    13371696  Bool getInterViewMvVertConstraintFlag()         { return m_interViewMvVertConstraintFlag;}
     1697
     1698#if H_MV_6_SHVC_O0098_36
     1699  Void setNumScaledRefLayerOffsets( Int  val )    { m_numScaledRefLayerOffsets = val; }
     1700  Int  getNumScaledRefLayerOffsets(  )            { return m_numScaledRefLayerOffsets; }
     1701
     1702  Void setScaledRefLayerId( Int i, Int  val )     { m_scaledRefLayerId[i] = val; }
     1703  Int  getScaledRefLayerId( Int i )               { return m_scaledRefLayerId[i]; }
     1704
     1705  Void setScaledRefLayerLeftOffset( Int j, Int  val ) { m_scaledRefLayerLeftOffset[j] = val; }
     1706  Int  getScaledRefLayerLeftOffset( Int j )           { return m_scaledRefLayerLeftOffset[j]; }
     1707
     1708  Void setScaledRefLayerTopOffset( Int j, Int  val )  { m_scaledRefLayerTopOffset[j] = val; }
     1709  Int  getScaledRefLayerTopOffset( Int j )            { return m_scaledRefLayerTopOffset[j]; }
     1710
     1711  Void setScaledRefLayerRightOffset( Int j, Int  val ) { m_scaledRefLayerRightOffset[j] = val; }
     1712  Int  getScaledRefLayerRightOffset( Int j )           { return m_scaledRefLayerRightOffset[j]; }
     1713
     1714  Void setScaledRefLayerBottomOffset( Int j, Int  val ) { m_scaledRefLayerBottomOffset[j] = val; }
     1715  Int  getScaledRefLayerBottomOffset( Int j )           { return m_scaledRefLayerBottomOffset[j]; }
     1716#endif
    13381717  // Inference
    13391718  Void inferRepFormat( TComVPS* vps, Int layerIdCurr );
    1340 
    13411719  Void inferScalingList( TComSPS* spsSrc );
    13421720#endif
     
    17362114// Additional slice header syntax elements
    17372115  Bool       m_pocResetFlag;
     2116#if H_MV_6_RALS_O0149_11
     2117  Bool       m_crossLayerBlaFlag;
     2118#endif
    17382119  Bool       m_discardableFlag;
    17392120  Bool       m_interLayerPredEnabledFlag;
     
    20732454// Additional slice header syntax elements
    20742455
     2456#if H_MV_6_RALS_O0149_11
     2457  Void setCrossLayerBlaFlag( Bool flag ) { m_crossLayerBlaFlag = flag; }
     2458  Bool getCrossLayerBlaFlag(  ) { return m_crossLayerBlaFlag; }
     2459  Void checkCrossLayerBlaFlag ( )
     2460  {
     2461    // cross_layer_bla_flag shall be equal to 0 for pictures with nal_unit_type not equal to IDR_W_RADL or IDR_N_LP or with nuh_layer_id not equal to 0.
     2462    if ( getLayerId() != 0 || getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
     2463    {
     2464      assert( m_crossLayerBlaFlag == 0 );
     2465    }
     2466  }
     2467#endif
     2468
    20752469  Void setPocResetFlag( Bool flag ) { m_pocResetFlag = flag; }
    20762470  Bool getPocResetFlag(  ) { return m_pocResetFlag; }
    20772471
    2078 Void setDiscardableFlag( Bool flag ) { m_discardableFlag = flag; }
    2079 Bool getDiscardableFlag(  ) { return m_discardableFlag; }
    2080 
    2081 Void setInterLayerPredEnabledFlag( Bool flag ) { m_interLayerPredEnabledFlag = flag; }
    2082 Bool getInterLayerPredEnabledFlag(  ) { return m_interLayerPredEnabledFlag; }
    2083 
    2084 Void setNumInterLayerRefPicsMinus1( Int  val ) { m_numInterLayerRefPicsMinus1 = val; }
    2085 Int  getNumInterLayerRefPicsMinus1(  ) { return m_numInterLayerRefPicsMinus1; }
    2086 
    2087 Void setInterLayerPredLayerIdc( Int i, Int  val ) { m_interLayerPredLayerIdc[i] = val; }
    2088 Int  getInterLayerPredLayerIdc( Int i ) { return m_interLayerPredLayerIdc[i]; }
     2472  Void setDiscardableFlag( Bool flag ) { m_discardableFlag = flag; }
     2473  Bool getDiscardableFlag(  ) { return m_discardableFlag; }
     2474
     2475  Void setInterLayerPredEnabledFlag( Bool flag ) { m_interLayerPredEnabledFlag = flag; }
     2476  Bool getInterLayerPredEnabledFlag(  ) { return m_interLayerPredEnabledFlag; }
     2477
     2478  Void setNumInterLayerRefPicsMinus1( Int  val ) { m_numInterLayerRefPicsMinus1 = val; }
     2479  Int  getNumInterLayerRefPicsMinus1(  ) { return m_numInterLayerRefPicsMinus1; }
     2480
     2481  Void setInterLayerPredLayerIdc( Int i, Int  val ) { m_interLayerPredLayerIdc[i] = val; }
     2482  Int  getInterLayerPredLayerIdc( Int i ) { return m_interLayerPredLayerIdc[i]; }
    20892483
    20902484  // Additional variables derived in slice header semantics
    20912485  Int  getNumInterLayerRefPicsMinus1Len( ) { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
    20922486  Int  getInterLayerPredLayerIdcLen    ( ) { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
     2487
     2488#if H_MV_6_ILDDS_ILREFPICS_27_34
     2489  Int  getRefLayerPicFlag( Int i );
     2490  Int  getRefLayerPicIdc ( Int j );
     2491  Int  getNumRefLayerPics( );
     2492#endif
    20932493
    20942494  Int  getNumActiveRefLayerPics( );
  • branches/HTM-9.0-dev0/source/Lib/TLibCommon/TypeDef.h

    r724 r730  
    243243#endif
    244244
    245 
     245/////////////////////////////////////////////////////////////////////////////////////////
     246///////////////////////////////////   HTM-9.2 Integrations //////////////////////////////
     247/////////////////////////////////////////////////////////////////////////////////////////
     248
     249// !!! PLEASE PUT MACROS RELATED TO HTM-9.2 INTEGRATIONS HERE !!!
     250// !!! PLEASE PUT MACROS RELATED TO HTM-9.2 INTEGRATIONS HERE !!!
     251// !!! PLEASE PUT MACROS RELATED TO HTM-9.2 INTEGRATIONS HERE !!!
     252// !!! PLEASE PUT MACROS RELATED TO HTM-9.2 INTEGRATIONS HERE !!!
     253// !!! PLEASE PUT MACROS RELATED TO HTM-9.2 INTEGRATIONS HERE !!!
     254
     255/////////////////////////////////////////////////////////////////////////////////////////
     256///////////////////////////////////   HTM-9.1 Integrations //////////////////////////////
     257/////////////////////////////////////////////////////////////////////////////////////////
     258
     259#define H_MV_FIX_TRACE_FILE                     1  // Fix linux compilation error related const char conversion
     260
     261#define H_MV_LAYER_WISE_STARTUP                 1  // Basic version of layer wise startup.
     262#define H_MV_FIX_SKIP_PICTURES                  1  // Fix related to skipping pictures.
     263#define H_MV_6_HRD_O0164_15                     1  // (HRD/O0164/Multilayer HRD) #15 Decision: Adopt, modified as follows: It was suggested to constrain the stalling based on the relative cpb removal times, which must be in decoding order. The "du_based_bpb_sync_flag" is not needed, in view of this. SEI in the highest layer of the layer set or (inclusive "or") VPS VUI is used to carry the parameters (at encoder discretion). SEI in higher layer and SEI in VUI do not need to repeat information available in some lower layer. Shall be after APS SEI and buffering period SEI and before all other SEI of all layers except other HRD related SEI.
     264#define H_MV_6_HRD_O0217_13                     1  // (HRD/O0217/Sub-DPB based DPB operations) #13 Decision: Adopt – Specify a separate DPB capacity for each layer – no sharing of capacity across layers – each layer has its own parameters (max pictures, max latency, max reordering). This proposal would specify distinct parameters for each "output layer set" and to change the definition of an operation point to be specific to an output layer set instead of a 'layer set". Decision: Adopted this aspect as well.
     265#define H_MV_6_SHVC_O0098_36                    1  // (SHVC/O0098/Scaled ref layer offset) #36 Modify signalling of scaled reference layer offsets to allow signalling of any lower layer, rather than just a direct reference layer, in order to enable alignment of auxiliary pictures. In further JCT-VC and JCT-3V discussion, it was also agreed to use the same offset signalling for MV-HEVC as well as SHVC
     266#define H_MV_6_GEN_0153_28                      1  //(Gen/O0153/output highest layer) #28 Add a flag in the VPS to indicate if startup process should output the highest available layer if the target output layer is not available.
     267#define H_MV_6_PS_0109_25                       1  //XXX(PS/O0109/default_one_target_output_layer_idc) #25 To change default_one_target_output_layer_flag to a two-bit default_one_target_output_layer_idc, and reserve the values 2 and 3
     268#define H_MV_6_O0226_37                         1  //(VUI/O0226/Mod tile WPP) #37 Modifications to the VUI indicators of tile and WPP alignment related syntax elements, from the r1.
     269#define H_MV_6_RALS_O0149_11                    1  //XXX (RALS/O0149/Prop2): #11 Proposal: A new slice_reserved_flag is taken into use to indicate if a base-layer IDR picture initiates the layer-wise start-up process. Decision: Adopt (the bit should not be required to be present; if present should be the bit after the discardable_flag, and discardable_flag should be the first one of the three, and the poc reset flag is not required to be present).
     270#define H_MV_6_PSEM_O0142_3                     1  // (PSEM/O0142/Conditional extension syntax) #3 Adopt JCTVC-O0142 (as a structure to be used to switch whatever extensions we define in SPS, not necessarily committing to having these extensions be separate for each extension, but the current plan unless decided otherwise is to use one flag for range extensions syntax presence and one flag for SHVC+MV-HEVC extension syntax presence)
     271#define H_MV_6_FIX_GET_VIEW_ID                  1  // Fix get view id
     272#define H_MV_6_LAYER_ID_32                      1  // (Gen/O0137,O0200,O0223,Layer id) #32 Add (editorial equivalent of) "The value of nuh_layer_id shall be in the range of 0 to 62. The value of 63 for nuh_layer_id is reserved for future use by ITU-T | ISO/IEC. Decoders shall ignore all data that follow the value 63 for nuh_layer_id in a NAL unit." and specify that vps_max_layers_minus1 shall not be equal to 63, but decoders shall allow that value to appear in the bitstream. Specify that the value 63 is interpreted the same as the value 62 (e.g., MaxLayersMinus1 = Min( 62, vps_max_layers_minus1) and subsequently refer to MaxLayersMinus1 instead of vps_max_layers_minus1)
     273#define H_MV_6_PS_O0118_33                      1  // (PS/O0118/visual signal info in vui per layer) #33 Add visual signal information (video_format, video_full_range_flag, colour_primaries, transfer_characteristics, matrix_coeffs) per layer to the VPS VUI, from v2 version of JCTVC-O0118.
     274#define H_MV_6_POC_31_35_38                     1  //XXX  Various related to POC
     275                                                   // (Misc/O0062/POC LSB present) (SH changes)
     276                                                   // (POC/O0117/Modify PicOrderCntVal of prevTid0Pic) #35 Modification of the PicOrderCntVal of prevTid0Pic and modification to the decoding process for reference picture set, to address problems found for cross-layer POC alignment.
     277                                                   // (POC/O0211/Fix ambiguity) #38 Modify POC derivation to correct an ambiguity in the spec.
     278#define H_MV_6_MISC_O0062_31                    1  // (Misc/O0062/POC LSB present) (without SH changes ) #31 The proposal's "option 3" is to add a flag in the VPS for each EL to control whether these LSBs are present or not (for IDR pictures), and when not present, the LSBs are inferred to be equal to 0. Decision: Adopted (as described herein).
     279#define H_MV_6_ILDDS_ILREFPICS_27_34            1  // Various inter layer reference picture derivation
     280                                                   // (ILDSD/O0225/max_tid_il_ref_pics RPL const.) #27 Change derivation of NumActiveRefLayerPics to consider max_tid_il_ref_pics.
     281                                                   // (ILDSD/O0120/sub_layers_vps_max_minus1 RPL const) #34 Modify inter-layer reference picture list default construction to incorporate max temporal sub-layers per layer syntax elements in VPS extension, from r2 version of JCTVC-O0120
     282#define H_MV_6_ILDDS_O0225_30                   1  // (ILDSD/O0225/signal max_tid_il_ref_pics per layer ) #30 2nd proposal of JCTVC-O0225 regarding signalling of max_tid_il_ref_pics per layer, based upon relation to SCE2 on single loop decoding. Decision: Adopted.
     283#define H_MV_6_ILDSD_O0120_26                   1  // (ILDSD/O0120/sub_layers_vps_max_minus1) #26 Add syntax elements to signal max temporal sub-layers for each layer in the VPS, with a gating flag, from JCTVC- option 2.
     284#define H_MV_6_PS_O0223_29                      1  // (PS/O0223/Cross layer alignment type) #29 Add a flag in VPS VUI to indicate cross layer pic type alignment.  Move cross_layer_irap_aligned_flag to VPS VUI and make presence condition on added flag
     285#define H_MV_6_PS_0092_17                       1  // (PS/O0092/Sharing SPS PPS) #17 Restrict sharing of SPS and PPS across layers to avoid creating problems during sub-bitstream extraction, based on modification of proposals in JCTVC-O0059 and JCTVC-O0092, reflected in the v2 version of O0092.
     286#define H_MV_6_PS_REP_FORM_18_19_20             1  //  Various Rep format
     287                                                   // (PS/O0096/rep format syntax element length ) #20 Modification of length to 8 bit as decided later in trac.
     288                                                   // (PS/O0179/Rep. Format) #18 Add flag in rep_format( ) syntax structure to control sending of chroma and bit depth related parameters, as proposed in the v2 version of JCTVC-O0179.
     289                                                   // (PS/O0096/rep format) #20 Modify the SPS syntax for layers with nuh_layer_id > 0 to signal a reference to a rep_format index in the VPS, rather than signalling explicit representation format data in the SPS, from the v2 version of JCTVC-O0096.
     290                                                   // (PS/FIX/N0092/Rep. Format) #19 Inferences.
     291#define H_MV_6_PS_O0096_21                      1  // (PS/O0096/direct_dependency_type gating flag) #21 Add a gating flag in VPS extension to condition the presence of direct dependency type, with a default type signalled, from JCTVC-O0096
     292#define H_MV_6_PS_O0109_22                      1  // (PS/O0109/view_id_len) #22 Modify the VPS extension syntax and semantics to replace view_id_len_minus1 with view_id_len, always signal that syntax element, add a constraint that (1<<view_id_len) >= NumViews, and modify view_id_val semantics to infer value of 0 when not present, from discussion of JCTVC-O0109
     293#define H_MV_6_PS_O0109_23                      1  // (PS/O0109/profile_ref_minus1 constraint) #23 Modify the semantics of profile_ref_minus1[ i ] to replace “shall be less than i” with “shall be less than or equal to i”, from discussion of JCTVC-O0109
     294#define H_MV_6_PS_O0109_24                      1  // (PS/O0109/vps_vui_present_flag move) #24 Move the vps_vui_present_flag to precede vps_vui_offset, and make vps_vui_offset conditional on that flag, from JCTVC-O0109
    246295/////////////////////////////////////////////////////////////////////////////////////////
    247296///////////////////////////////////   HTM-9.0 Integrations //////////////////////////////
     
    305354#define MAX_VPS_OP_SETS_PLUS1                     1024
    306355#if H_MV
     356#if H_MV_6_LAYER_ID_32
     357#define MAX_VPS_NUH_LAYER_ID_PLUS1  63
     358#else
    307359#define MAX_VPS_NUH_LAYER_ID_PLUS1  64
     360#endif
    308361#define MAX_NUM_SCALABILITY_TYPES   16
    309362#define ENC_CFG_CONSOUT_SPACE       29           
     
    328381
    329382#define MAX_CPB_CNT                     32  ///< Upper bound of (cpb_cnt_minus1 + 1)
     383#if H_MV
     384#if H_MV_6_LAYER_ID_32
     385#define MAX_NUM_LAYER_IDS               63
     386#define MAX_NUM_LAYERS                  63
     387#else
    330388#define MAX_NUM_LAYER_IDS               64
    331 #if H_MV
    332389#define MAX_NUM_LAYERS                  64
     390#endif
    333391#define MAX_VPS_PROFILE_TIER_LEVEL      64
    334392#define MAX_VPS_ADD_OUTPUT_LAYER_SETS   1024
    335393#define MAX_VPS_OUTPUTLAYER_SETS        ( MAX_VPS_ADD_OUTPUT_LAYER_SETS + MAX_VPS_OP_SETS_PLUS1 )
     394#if H_MV_6_PS_O0118_33
     395#define  MAX_NUM_VIDEO_SIGNAL_INFO      16
     396#endif
     397#if H_MV_6_SHVC_O0098_36
     398#define MAX_NUM_SCALED_REF_LAYERS       MAX_NUM_LAYERS-1
     399#endif
     400#if H_MV_6_HRD_O0164_15
     401#define MAX_NUM_BSP_HRD_PARAMETERS      100 ///< Maximum value is actually not specified
     402#define MAX_NUM_BITSTREAM_PARTITIONS    100 ///< Maximum value is actually not specified
     403#define MAX_NUM_BSP_SCHED_COMBINATION   100 ///< Maximum value is actually not specified
     404#endif
    336405#endif
    337406
     
    810879
    811880#if H_MV
     881
     882#if H_MV_6_PSEM_O0142_3
     883  enum PsExtensionTypes
     884  {
     885    PS_EX_T_MV   = 1,
     886#if H_3D
     887    PS_EX_T_3D   = 3,
     888#endif
     889    PS_EX_T_ESC  = 7,
     890    PS_EX_T_MAX_NUM = 8
     891  };
     892#endif
     893
    812894/// scalability types
    813895  enum ScalabilityType
  • branches/HTM-9.0-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r724 r730  
    396396
    397397  READ_FLAG(     uiCode, "video_signal_type_present_flag");           pcVUI->setVideoSignalTypePresentFlag(uiCode);
     398#if H_MV_6_PS_O0118_33
     399  assert( pcSPS->getLayerId() == 0 || !pcVUI->getVideoSignalTypePresentFlag() );
     400#endif
     401
    398402  if (pcVUI->getVideoSignalTypePresentFlag())
    399403  {
     
    582586  {
    583587    READ_FLAG( uiCode, "update_rep_format_flag" );               pcSPS->setUpdateRepFormatFlag( uiCode == 1 );
     588#if H_MV_6_PS_REP_FORM_18_19_20
     589    if ( pcSPS->getUpdateRepFormatFlag() )
     590    {
     591      READ_CODE( 8, uiCode, "sps_rep_format_idx" );                pcSPS->setSpsRepFormatIdx( uiCode );
     592    }
     593  }
     594  else
     595  {
     596#else
    584597  }
    585598 
    586599  if ( pcSPS->getUpdateRepFormatFlag() )
    587600  {
     601#endif
    588602#endif
    589603  READ_UVLC(     uiCode, "chroma_format_idc" );                  pcSPS->setChromaFormatIdc( uiCode );
     
    621635
    622636#if H_MV
    623   if ( pcSPS->getUpdateRepFormatFlag() )
    624   {
     637#if H_MV_6_PS_REP_FORM_18_19_20
     638  if ( pcSPS->getLayerId() == 0 )
     639#else
     640  if ( pcSPS->getUpdateRepFormatFlag() )   
     641#endif
     642  {
    625643#endif
    626644  READ_UVLC(     uiCode, "bit_depth_luma_minus8" );
     
    770788
    771789  READ_FLAG( uiCode, "sps_extension_flag");
    772   if (uiCode)
    773   {
     790#if H_MV_6_PSEM_O0142_3
     791  pcSPS->setSpsExtensionFlag( uiCode );
     792#endif
     793  if (pcSPS->getSpsExtensionFlag( ) )
     794  {
     795#if !H_MV_6_PSEM_O0142_3
    774796#if H_MV
    775797    parseSPSExtension( pcSPS );
     
    784806#endif
    785807#endif
    786         while ( xMoreRbspData() )
    787         {
    788           READ_FLAG( uiCode, "sps_extension_data_flag");
    789         }
     808#else   
     809    for (Int i = 0; i < PS_EX_T_MAX_NUM; i++)
     810    {
     811      READ_FLAG( uiCode, "sps_extension_type_flag" ); pcSPS->setSpsExtensionTypeFlag( i, uiCode );
     812#if H_3D
     813      assert( !pcSPS->getSpsExtensionTypeFlag( i ) || i == PS_EX_T_MV || i == PS_EX_T_3D || i == PS_EX_T_ESC );
     814#else
     815      assert( !pcSPS->getSpsExtensionTypeFlag( i ) || i == PS_EX_T_MV || i == PS_EX_T_ESC );
     816#endif
     817    } 
     818
     819    if( pcSPS->getSpsExtensionTypeFlag( PS_EX_T_MV ))
     820    {
     821      parseSPSExtension( pcSPS );
     822    }
     823
     824#if H_3D
     825    if( pcSPS->getSpsExtensionTypeFlag( PS_EX_T_3D ))
     826    {
     827      parseSPSExtension2( pcSPS, viewIndex, depthFlag  );
     828    }
     829#endif
     830
     831    if ( pcSPS->getSpsExtensionTypeFlag( PS_EX_T_ESC ))
     832    {   
     833#endif
     834      while ( xMoreRbspData() )
     835      {
     836        READ_FLAG( uiCode, "sps_extension_data_flag");
     837      }
     838#if H_MV_6_PSEM_O0142_3
     839    }
     840#else
    790841#if H_MV     
    791842#if H_3D
     
    794845    }
    795846#endif
     847#endif
    796848  }
    797849}
     
    802854  UInt uiCode;
    803855  READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" );    pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false);
     856#if !H_MV_6_SHVC_O0098_36
    804857  READ_UVLC( uiCode, "sps_shvc_reserved_zero_idc" );
     858#else
     859 
     860  READ_UVLC( uiCode, "num_scaled_ref_layer_offsets" ); pcSPS->setNumScaledRefLayerOffsets( uiCode );
     861
     862  for( Int i = 0; i < pcSPS->getNumScaledRefLayerOffsets( ); i++)
     863  {   
     864    READ_CODE( 6, uiCode, "scaled_ref_layer_id" ); pcSPS->setScaledRefLayerId( i, uiCode );
     865
     866    Int j = pcSPS->getScaledRefLayerId( i );
     867    Int iCode;
     868    READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); pcSPS->setScaledRefLayerLeftOffset( j, iCode );
     869    READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); pcSPS->setScaledRefLayerTopOffset( j, iCode );
     870    READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); pcSPS->setScaledRefLayerRightOffset( j, iCode );
     871    READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); pcSPS->setScaledRefLayerBottomOffset( j, iCode );
     872  }
     873#endif 
    805874}
    806875
     
    850919  READ_CODE( 2,  uiCode,  "vps_reserved_three_2bits" );           assert(uiCode == 3);
    851920#if H_MV
     921#if H_MV_6_LAYER_ID_32
     922  READ_CODE( 6,  uiCode,  "vps_max_layers_minus1" );              pcVPS->setMaxLayersMinus1( std::min( uiCode, (UInt) ( MAX_NUM_LAYER_IDS-1) )  );
     923#else
    852924  READ_CODE( 6,  uiCode,  "vps_max_layers_minus1" );              pcVPS->setMaxLayersMinus1( uiCode  );
     925#endif
    853926#else
    854927  READ_CODE( 6,  uiCode,  "vps_reserved_zero_6bits" );            assert(uiCode == 0);
     
    867940  for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++)
    868941  {
    869     READ_UVLC( uiCode,  "vps_max_dec_pic_buffering_minus1[i]" );     pcVPS->setMaxDecPicBuffering( uiCode + 1, i );
    870     READ_UVLC( uiCode,  "vps_num_reorder_pics[i]" );          pcVPS->setNumReorderPics( uiCode, i );
     942    READ_UVLC( uiCode,  "vps_max_dec_pic_buffering_minus1[i]" );    pcVPS->setMaxDecPicBuffering( uiCode + 1, i );
     943    READ_UVLC( uiCode,  "vps_num_reorder_pics[i]" );                pcVPS->setNumReorderPics( uiCode, i );
    871944    READ_UVLC( uiCode,  "vps_max_latency_increase_plus1[i]" );      pcVPS->setMaxLatencyIncrease( uiCode, i );
    872945
     
    876949      {
    877950        pcVPS->setMaxDecPicBuffering(pcVPS->getMaxDecPicBuffering(0), i);
    878         pcVPS->setNumReorderPics(pcVPS->getNumReorderPics(0), i);
     951        pcVPS->setNumReorderPics    (pcVPS->getNumReorderPics(0), i);
    879952        pcVPS->setMaxLatencyIncrease(pcVPS->getMaxLatencyIncrease(0), i);
    880953      }
     
    905978    }
    906979  }
     980#if H_MV_6_HRD_O0217_13
     981  pcVPS->deriveLayerSetLayerIdList();
     982#endif
    907983  TimingInfo *timingInfo = pcVPS->getTimingInfo();
    908984  READ_FLAG(       uiCode, "vps_timing_info_present_flag");         timingInfo->setTimingInfoPresentFlag      (uiCode ? true : false);
     
    9681044  UInt uiCode;
    9691045  READ_FLAG( uiCode, "avc_base_layer_flag" );                     pcVPS->setAvcBaseLayerFlag( uiCode == 1 ? true : false );
     1046#if H_MV_6_PS_O0109_24
     1047  READ_FLAG( uiCode, "vps_vui_present_flag" );                    pcVPS->setVpsVuiPresentFlag( uiCode == 1 );  if ( pcVPS->getVpsVuiPresentFlag() )
     1048  { 
     1049#endif
    9701050  READ_CODE( 16, uiCode, "vps_vui_offset" );                      pcVPS->setVpsVuiOffset( uiCode );
     1051#if H_MV_6_PS_O0109_24
     1052  }
     1053#endif
     1054
    9711055  READ_FLAG( uiCode, "splitting_flag" );                          pcVPS->setSplittingFlag( uiCode == 1 ? true : false );
    9721056
     
    10141098  }
    10151099
     1100#if H_MV_6_PS_O0109_22
     1101  READ_CODE( 4, uiCode, "view_id_len" ); pcVPS->setViewIdLen( uiCode );
     1102
     1103  if ( pcVPS->getViewIdLen( ) > 0 )
     1104  {   
     1105    for( Int i = 0; i < pcVPS->getNumViews(); i++ )
     1106    {
     1107      READ_CODE( pcVPS->getViewIdLen( ), uiCode, "view_id_val[i]" ); pcVPS->setViewIdVal( i, uiCode );
     1108    }
     1109  }
     1110  else
     1111  {
     1112    for( Int i = 0; i < pcVPS->getNumViews(); i++ )
     1113    {
     1114      pcVPS->setViewIdVal( i, 0 ); 
     1115    }
     1116  }
     1117#else
    10161118  // GT spec says: trac #39
    10171119  // if ( pcVPS->getNumViews() > 1 ) 
     
    10251127    READ_CODE( pcVPS->getViewIdLenMinus1( ) + 1, uiCode, "view_id_val[i]" ); pcVPS->setViewIdVal( i, uiCode );
    10261128  }
     1129#endif
     1130
    10271131
    10281132  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
     
    10331137    }
    10341138  }
    1035 
     1139#if H_MV_6_MISC_O0062_31
     1140  pcVPS->setRefLayers();
     1141#endif
     1142#if H_MV_6_ILDSD_O0120_26
     1143  READ_FLAG( uiCode, "vps_sub_layers_max_minus1_present_flag" ); pcVPS->setVpsSubLayersMaxMinus1PresentFlag( uiCode == 1 );
     1144  if ( pcVPS->getVpsSubLayersMaxMinus1PresentFlag() )
     1145  {
     1146    for (Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )
     1147    {
     1148      READ_CODE( 3, uiCode, "sub_layers_vps_max_minus1" ); pcVPS->setSubLayersVpsMaxMinus1( i, uiCode );   
     1149      pcVPS->checkSubLayersVpsMaxMinus1( i );
     1150
     1151    }
     1152  } 
     1153  else
     1154  {
     1155    for (Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )
     1156    {
     1157      pcVPS->setSubLayersVpsMaxMinus1( i, pcVPS->getMaxTLayers( ) - 1);   
     1158    }
     1159  }
     1160#endif
    10361161  READ_FLAG( uiCode, "max_tid_ref_present_flag" ); pcVPS->setMaxTidRefPresentFlag( uiCode == 1 );
    10371162
     
    10401165    for( Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )
    10411166    {
     1167#if H_MV_6_ILDDS_O0225_30
     1168      for( Int j = i + 1; j <= pcVPS->getMaxLayersMinus1(); j++ )
     1169      {
     1170        if ( pcVPS->getDirectDependencyFlag(j,i) )
     1171        {
     1172          READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1" ); pcVPS->setMaxTidIlRefPicsPlus1( i, j, uiCode );
     1173        }
     1174      }
     1175#else
    10421176      READ_CODE( 3, uiCode,       "max_tid_il_ref_pics_plus1[i]" );      pcVPS->setMaxTidIlRefPicPlus1( i , uiCode );
     1177#endif
    10431178    }
    10441179  }
     
    10541189    {
    10551190      READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); pcVPS->setProfileRefMinus1( i, uiCode );
     1191#if H_MV_6_PS_O0109_23
     1192      pcVPS->checkProfileRefMinus1( i );     
     1193#endif
    10561194    }
    10571195    parsePTL ( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers()-1);
     
    10761214  if( numOutputLayerSets > 1)
    10771215  {
     1216#if H_MV_6_PS_0109_25
     1217    READ_CODE( 2, uiCode, "default_one_target_output_layer_idc" ); pcVPS->setDefaultOneTargetOutputLayerIdc( uiCode );
     1218    pcVPS->checkDefaultOneTargetOutputLayerIdc();
     1219#else
    10781220    READ_FLAG( uiCode, "default_one_target_output_layer_flag" ); pcVPS->setDefaultOneTargetOutputLayerFlag(  uiCode == 1);
     1221#endif
    10791222  } 
    10801223
     1224#if H_MV_6_HRD_O0217_13
     1225  pcVPS->setOutputLayerFlag(0, 0, pcVPS->inferOutputLayerFlag( 0, 0 ));
     1226  pcVPS->setOutputLayerSetIdxMinus1(0, -1);
     1227#endif
    10811228  for( Int i = 1; i < numOutputLayerSets; i++ )
    10821229  {
     
    10891236      }       
    10901237    }
     1238#if H_MV_6_HRD_O0217_13
     1239    else
     1240    { // These inference rules would also be helpful in spec text
     1241      pcVPS->setOutputLayerSetIdxMinus1(i, i - 1 );
     1242      for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1; j++ )
     1243      {             
     1244        pcVPS->setOutputLayerFlag(i,j, pcVPS->inferOutputLayerFlag( i, j ));
     1245      }
     1246    }
     1247#endif
     1248
    10911249    if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
    10921250    {     
     
    10941252    }
    10951253  }
    1096 
     1254#if H_MV_6_GEN_0153_28
     1255  if( pcVPS->getMaxLayersMinus1() > 0 )
     1256  {
     1257    READ_FLAG( uiCode, "alt_output_layer_flag" ); pcVPS->setAltOutputLayerFlag( uiCode == 1 );
     1258  }
     1259#endif
     1260#if H_MV_6_HRD_O0217_13
     1261  pcVPS->deriveTargetLayerIdLists();
     1262#endif
    10971263  READ_FLAG( uiCode, "rep_format_idx_present_flag" ); pcVPS->setRepFormatIdxPresentFlag( uiCode == 1 );
    10981264  if ( pcVPS->getRepFormatIdxPresentFlag() )
     
    11031269  for (Int i = 0; i <= pcVPS->getVpsNumRepFormatsMinus1(); i++ )
    11041270  {
     1271#if H_MV_6_PS_REP_FORM_18_19_20
     1272    assert( pcVPS->getRepFormat(i) == NULL );
     1273    TComRepFormat* curRepFormat = new TComRepFormat();
     1274    TComRepFormat* prevRepFormat = i > 0 ? pcVPS->getRepFormat( i - 1) : NULL;
     1275    parseRepFormat( i, curRepFormat ,  prevRepFormat);
     1276    pcVPS->setRepFormat(i, curRepFormat );
     1277#else
    11051278    assert( pcVPS->getRepFormat(i) == NULL );
    11061279    TComRepFormat* repFormat = new TComRepFormat();
    11071280    parseRepFormat( repFormat );
    11081281    pcVPS->setRepFormat(i, repFormat );
     1282#endif
    11091283  }
    11101284
     
    11151289      if( pcVPS->getVpsNumRepFormatsMinus1() > 0 )
    11161290      {
     1291#if H_MV_6_PS_REP_FORM_18_19_20
     1292        READ_CODE( 8, uiCode, "vps_rep_format_idx" ); pcVPS->setVpsRepFormatIdx( i, uiCode );
     1293#else
    11171294        READ_CODE( 4, uiCode, "vps_rep_format_idx" ); pcVPS->setVpsRepFormatIdx( i, uiCode );
     1295#endif
    11181296      }
    11191297    }
     
    11211299
    11221300  READ_FLAG( uiCode, "max_one_active_ref_layer_flag" ); pcVPS->setMaxOneActiveRefLayerFlag ( uiCode == 1 );
     1301#if H_MV_6_MISC_O0062_31
     1302  for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
     1303  {
     1304    if( pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) )  ==  0 )
     1305    {     
     1306      READ_FLAG( uiCode, "poc_lsb_not_present_flag" ); pcVPS->setPocLsbNotPresentFlag( i, uiCode == 1 );
     1307    }
     1308  }
     1309#endif
     1310
     1311#if H_MV_6_HRD_O0217_13
     1312  parseDpbSize( pcVPS );
     1313#endif
     1314
     1315#if !H_MV_6_PS_O0223_29
    11231316  READ_FLAG( uiCode, "cross_layer_irap_aligned_flag" ); pcVPS->setCrossLayerIrapAlignedFlag( uiCode == 1 );
     1317#endif
    11241318  READ_UVLC( uiCode, "direct_dep_type_len_minus2")    ; pcVPS->setDirectDepTypeLenMinus2   ( uiCode );
    1125 
     1319 
     1320#if H_MV_6_PS_O0096_21
     1321  READ_FLAG( uiCode, "default_direct_dependency_flag" ); pcVPS->setDefaultDirectDependencyFlag( uiCode == 1 );
     1322  if ( pcVPS->getDefaultDirectDependencyFlag( ) )
     1323  { 
     1324    READ_CODE( pcVPS->getDirectDepTypeLenMinus2( ) + 2, uiCode, "default_direct_dependency_type" ); pcVPS->setDefaultDirectDependencyType( uiCode );
     1325  }
     1326
     1327  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
     1328  {
     1329    for( Int j = 0; j < i; j++ )
     1330    {
     1331      if (pcVPS->getDirectDependencyFlag( i, j) )
     1332      {       
     1333        if ( pcVPS->getDefaultDirectDependencyFlag( ) )
     1334        { 
     1335          pcVPS->setDirectDependencyType( i, j , pcVPS->getDefaultDirectDependencyType( ) );
     1336        }
     1337        else
     1338        {
     1339          READ_CODE( pcVPS->getDirectDepTypeLenMinus2( ) + 2,  uiCode, "direct_dependency_type[i][j]" ); pcVPS->setDirectDependencyType( i, j , uiCode);
     1340        }
     1341      }
     1342    }
     1343  } 
     1344#else
    11261345  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
    11271346  {
     
    11341353    }
    11351354  }
     1355#endif
    11361356
    11371357  READ_FLAG( uiCode, "vps_shvc_reserved_zero_flag" );
     1358#if !H_MV_6_PS_O0109_24
    11381359  READ_FLAG( uiCode, "vps_vui_present_flag" )       ; pcVPS->setVpsVuiPresentFlag( uiCode == 1 );
     1360#endif
    11391361
    11401362  if( pcVPS->getVpsVuiPresentFlag() )
     
    11451367
    11461368  pcVPS->checkVPSExtensionSyntax();
     1369#if !H_MV_6_MISC_O0062_31
    11471370  pcVPS->setRefLayers();
    1148 }
    1149 
     1371#endif
     1372}
     1373
     1374#if H_MV_6_PS_REP_FORM_18_19_20
     1375Void TDecCavlc::parseRepFormat( Int i, TComRepFormat* pcRepFormat, TComRepFormat* pcPrevRepFormat )
     1376#else
    11501377Void TDecCavlc::parseRepFormat( TComRepFormat* pcRepFormat )
     1378#endif
    11511379{
    11521380  assert( pcRepFormat );
    11531381
    11541382  UInt uiCode;
     1383
     1384#if H_MV_6_PS_REP_FORM_18_19_20
     1385  READ_CODE( 16, uiCode, "pic_width_vps_in_luma_samples" );  pcRepFormat->setPicWidthVpsInLumaSamples ( uiCode );
     1386  READ_CODE( 16, uiCode, "pic_height_vps_in_luma_samples" ); pcRepFormat->setPicHeightVpsInLumaSamples( uiCode );
     1387  READ_FLAG( uiCode, "chroma_and_bit_depth_vps_present_flag" ); pcRepFormat->setChromaAndBitDepthVpsPresentFlag( uiCode == 1 );
     1388
     1389  pcRepFormat->checkChromaAndBitDepthVpsPresentFlag( i );
     1390
     1391  if ( pcRepFormat->getChromaAndBitDepthVpsPresentFlag() )
     1392  { 
     1393#endif
    11551394  READ_CODE( 2,  uiCode, "chroma_format_vps_idc" );          pcRepFormat->setChromaFormatVpsIdc       ( uiCode );
    11561395  if ( pcRepFormat->getChromaFormatVpsIdc() == 3 )
     
    11581397    READ_FLAG( uiCode, "separate_colour_plane_vps_flag" ); pcRepFormat->setSeparateColourPlaneVpsFlag( uiCode == 1 );
    11591398  }
     1399#if !H_MV_6_PS_REP_FORM_18_19_20
    11601400  READ_CODE( 16, uiCode, "pic_width_vps_in_luma_samples" );  pcRepFormat->setPicWidthVpsInLumaSamples ( uiCode );
    11611401  READ_CODE( 16, uiCode, "pic_height_vps_in_luma_samples" ); pcRepFormat->setPicHeightVpsInLumaSamples( uiCode );
     1402#endif
    11621403  READ_CODE( 4,  uiCode, "bit_depth_vps_luma_minus8" );      pcRepFormat->setBitDepthVpsLumaMinus8    ( uiCode );
    11631404  READ_CODE( 4,  uiCode, "bit_depth_vps_chroma_minus8" );    pcRepFormat->setBitDepthVpsChromaMinus8  ( uiCode );
     1405#if H_MV_6_PS_REP_FORM_18_19_20
     1406  }
     1407  else
     1408  {
     1409    pcRepFormat->inferChromaAndBitDepth(pcPrevRepFormat, false );
     1410  }
     1411#endif
    11641412}
    11651413
     
    11741422
    11751423  UInt uiCode;
     1424#if H_MV_6_PS_O0223_29
     1425  READ_FLAG( uiCode, "cross_layer_pic_type_aligned_flag" ); pcVPSVUI->setCrossLayerPicTypeAlignedFlag( uiCode == 1 );
     1426  if ( !pcVPSVUI->getCrossLayerPicTypeAlignedFlag() )
     1427  { 
     1428    READ_FLAG( uiCode, "cross_layer_irap_aligned_flag" ); pcVPSVUI->setCrossLayerIrapAlignedFlag( uiCode == 1 );
     1429  }
     1430#endif
    11761431  READ_FLAG( uiCode, "bit_rate_present_vps_flag" ); pcVPSVUI->setBitRatePresentVpsFlag( uiCode == 1 );
    11771432  READ_FLAG( uiCode, "pic_rate_present_vps_flag" ); pcVPSVUI->setPicRatePresentVpsFlag( uiCode == 1 );
     
    12011456        }
    12021457      }
    1203     }
    1204   }
    1205 
     1458    }   
     1459  }
     1460
     1461#if H_MV_6_O0226_37
     1462  READ_FLAG( uiCode, "tiles_not_in_use_flag" ); pcVPSVUI->setTilesNotInUseFlag( uiCode == 1 );
     1463  if( !pcVPSVUI->getTilesNotInUseFlag() )
     1464  {     
     1465    for( Int i = 0; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
     1466    {
     1467      READ_FLAG( uiCode, "tiles_in_use_flag[i]" ); pcVPSVUI->setTilesInUseFlag( i, uiCode == 1 );
     1468      if( pcVPSVUI->getTilesInUseFlag( i ) ) 
     1469      {
     1470        READ_FLAG( uiCode, "loop_filter_not_across_tiles_flag[i]" ); pcVPSVUI->setLoopFilterNotAcrossTilesFlag( i, uiCode == 1 );
     1471      }
     1472    } 
     1473
     1474    for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ ) 
     1475    {
     1476      for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ) ; j++ )
     1477      { 
     1478        Int layerIdx = pcVPS->getLayerIdInVps(pcVPS->getRefLayerId(pcVPS->getLayerIdInNuh( i ) , j  )); 
     1479        if( pcVPSVUI->getTilesInUseFlag( i )  &&  pcVPSVUI->getTilesInUseFlag( layerIdx ) ) 
     1480        {
     1481          READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); pcVPSVUI->setTileBoundariesAlignedFlag( i, j, uiCode == 1 );
     1482        }
     1483      } 
     1484    }
     1485  } 
     1486 
     1487  READ_FLAG( uiCode, "wpp_not_in_use_flag" ); pcVPSVUI->setWppNotInUseFlag( uiCode == 1 );
     1488 
     1489  if( !pcVPSVUI->getWppNotInUseFlag( ))
     1490  {
     1491    for( Int i = 0; i  <=  pcVPS->getMaxLayersMinus1(); i++ ) 
     1492    {
     1493      READ_FLAG( uiCode, "wpp_in_use_flag[i]" ); pcVPSVUI->setWppInUseFlag( i, uiCode == 1 );
     1494    }
     1495  }
     1496#else
    12061497  for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
    12071498  {
     
    12111502    }
    12121503  }
     1504#endif
    12131505
    12141506  READ_FLAG( uiCode, "ilp_restricted_ref_layers_flag" ); pcVPSVUI->setIlpRestrictedRefLayersFlag( uiCode == 1 );
     
    12321524    }
    12331525  }
    1234 }
     1526
     1527#if H_MV_6_PS_O0118_33
     1528  READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); pcVPSVUI->setVideoSignalInfoIdxPresentFlag( uiCode == 1 );
     1529  if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() )
     1530  {
     1531    READ_CODE( 4, uiCode, "vps_num_video_signal_info_minus1" ); pcVPSVUI->setVpsNumVideoSignalInfoMinus1( uiCode );
     1532  }
     1533  else
     1534  {
     1535    pcVPSVUI->setVpsNumVideoSignalInfoMinus1( pcVPS->getMaxLayersMinus1() );
     1536  }
     1537
     1538  for( Int i = 0; i <= pcVPSVUI->getVpsNumVideoSignalInfoMinus1(); i++ )
     1539  {
     1540    assert( pcVPSVUI->getVideoSignalInfo( i ) == NULL );
     1541    TComVideoSignalInfo* curVideoSignalInfo = new TComVideoSignalInfo();     
     1542    parseVideoSignalInfo( curVideoSignalInfo );
     1543    pcVPSVUI->setVideoSignalInfo(i, curVideoSignalInfo );
     1544  }
     1545 
     1546  if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() && pcVPSVUI->getVpsNumVideoSignalInfoMinus1() > 0 )
     1547  {
     1548    for( Int i = 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
     1549    {
     1550      READ_CODE( 4, uiCode, "vps_video_signal_info_idx" ); pcVPSVUI->setVpsVideoSignalInfoIdx( i, uiCode );
     1551      assert( pcVPSVUI->getVpsVideoSignalInfoIdx( i ) >= 0 && pcVPSVUI->getVpsVideoSignalInfoIdx( i ) <= pcVPSVUI->getVpsNumVideoSignalInfoMinus1() );
     1552    }
     1553  }
     1554  else
     1555  {
     1556    for( Int i = 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
     1557    {
     1558      pcVPSVUI->setVpsVideoSignalInfoIdx( i, pcVPSVUI->getVideoSignalInfoIdxPresentFlag() ? 0 : i );
     1559    }
     1560  }
     1561#endif
     1562#if H_MV_6_HRD_O0164_15
     1563  READ_FLAG( uiCode, "vps_vui_bsp_hrd_present_flag" ); pcVPSVUI->setVpsVuiBspHrdPresentFlag( uiCode == 1 );
     1564  if ( pcVPSVUI->getVpsVuiBspHrdPresentFlag( ) )
     1565  {
     1566    parseVpsVuiBspHrdParameters( pcVPS );
     1567  }
     1568#endif
     1569}
     1570
     1571#if H_MV_6_HRD_O0164_15
     1572Void TDecCavlc::parseVpsVuiBspHrdParameters( TComVPS* pcVPS )
     1573{
     1574  assert( pcVPS );
     1575
     1576  TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( );
     1577
     1578  assert( pcVPSVUI );
     1579
     1580  TComVpsVuiBspHrdParameters*  vpsVuiBspHrdP = pcVPSVUI->getVpsVuiBspHrdParameters();
     1581 
     1582  assert ( vpsVuiBspHrdP );
     1583
     1584  UInt uiCode;
     1585  READ_UVLC( uiCode, "vps_num_bsp_hrd_parameters_minus1" ); vpsVuiBspHrdP->setVpsNumBspHrdParametersMinus1( uiCode );
     1586  for( Int i = 0; i <= vpsVuiBspHrdP->getVpsNumBspHrdParametersMinus1( ); i++ )
     1587  { 
     1588    if( i > 0 )
     1589    {
     1590      READ_FLAG( uiCode, "bsp_cprms_present_flag" ); vpsVuiBspHrdP->setBspCprmsPresentFlag( i, uiCode == 1 );
     1591    }
     1592    TComHRD* hrdParameters = vpsVuiBspHrdP->getHrdParametermeters( i );
     1593    parseHrdParameters( hrdParameters, vpsVuiBspHrdP->getBspCprmsPresentFlag( i ), pcVPS->getMaxSubLayersMinus1() );     
     1594  } 
     1595  for( Int h = 1; h <= pcVPS->getVpsNumLayerSetsMinus1(); h++ )
     1596  { 
     1597    READ_UVLC( uiCode, "num_bitstream_partitions" ); vpsVuiBspHrdP->setNumBitstreamPartitions( h, uiCode );
     1598    for( Int i = 0; i < vpsVuiBspHrdP->getNumBitstreamPartitions( h ); i++ ) 
     1599    {
     1600      for( Int j = 0; j <= pcVPS->getMaxLayersMinus1(); j++ ) 
     1601      {
     1602        if( pcVPS->getLayerIdIncludedFlag( h ,j ) )
     1603        {
     1604          READ_FLAG( uiCode, "layer_in_bsp_flag" ); vpsVuiBspHrdP->setLayerInBspFlag( h, i, j, uiCode == 1 );
     1605        }
     1606        else
     1607        {
     1608          vpsVuiBspHrdP->setLayerInBspFlag( h, i, j, false ); // This inference seems to be missing in spec
     1609        }
     1610      }
     1611    }
     1612    vpsVuiBspHrdP->checkLayerInBspFlag( pcVPS, h );
     1613   
     1614    if( vpsVuiBspHrdP->getNumBitstreamPartitions( h ) )
     1615    { 
     1616      READ_UVLC( uiCode, "num_bsp_sched_combinations" ); vpsVuiBspHrdP->setNumBspSchedCombinations( h, uiCode );
     1617      for( Int i = 0; i < vpsVuiBspHrdP->getNumBspSchedCombinations( h ); i++ )
     1618      {
     1619        for( Int j = 0; j < vpsVuiBspHrdP->getNumBitstreamPartitions( h ); j++ )
     1620        { 
     1621          READ_UVLC( uiCode, "bsp_comb_hrd_idx" ); vpsVuiBspHrdP->setBspCombHrdIdx( h, i, j, uiCode );
     1622          READ_UVLC( uiCode, "bsp_comb_sched_idx" ); vpsVuiBspHrdP->setBspCombSchedIdx( h, i, j, uiCode );
     1623        } 
     1624      }
     1625    } 
     1626  } 
     1627
     1628#endif
     1629
     1630#if H_MV_6_PS_O0118_33
     1631Void TDecCavlc::parseVideoSignalInfo( TComVideoSignalInfo* pcVideoSignalInfo )
     1632{
     1633  UInt uiCode;
     1634  READ_CODE( 3, uiCode, "video_vps_format" );             pcVideoSignalInfo->setVideoVpsFormat( uiCode );
     1635  READ_FLAG( uiCode, "video_full_range_vps_flag" );       pcVideoSignalInfo->setVideoFullRangeVpsFlag( uiCode == 1 );
     1636  READ_CODE( 8, uiCode, "colour_primaries_vps" );         pcVideoSignalInfo->setColourPrimariesVps( uiCode );
     1637  READ_CODE( 8, uiCode, "transfer_characteristics_vps" ); pcVideoSignalInfo->setTransferCharacteristicsVps( uiCode );
     1638  READ_CODE( 8, uiCode, "matrix_coeffs_vps" );            pcVideoSignalInfo->setMatrixCoeffsVps( uiCode );
     1639}
     1640#endif
     1641
     1642#if H_MV_6_HRD_O0217_13
     1643Void TDecCavlc::parseDpbSize( TComVPS* vps )
     1644{
     1645  UInt uiCode;
     1646  TComDpbSize* dpbSize = vps->getDpbSize();
     1647  assert ( dpbSize != 0 );
     1648
     1649  for( Int i = 1; i < vps->getNumOutputLayerSets(); i++ )
     1650  { 
     1651    READ_FLAG( uiCode, "sub_layer_flag_info_present_flag" ); dpbSize->setSubLayerFlagInfoPresentFlag( i, uiCode == 1 );
     1652
     1653    for( Int j = 0; j  <=  vps->getMaxTLayers() - 1 ; j++ )
     1654    { 
     1655      if( j > 0  &&  dpbSize->getSubLayerDpbInfoPresentFlag( i, j )  ) 
     1656      {
     1657        READ_FLAG( uiCode, "sub_layer_dpb_info_present_flag" ); dpbSize->setSubLayerDpbInfoPresentFlag( i, j, uiCode == 1 );
     1658      }
     1659      if( dpbSize->getSubLayerDpbInfoPresentFlag( i, j ) )
     1660      { 
     1661        for( Int k = 0; k < vps->getNumSubDpbs( vps->getOutputLayerSetIdxMinus1( i ) + 1 ); k++ )   
     1662        {
     1663          READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1" ); dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode );
     1664        }
     1665        READ_UVLC( uiCode, "max_vps_num_reorder_pics" ); dpbSize->setMaxVpsNumReorderPics( i, j, uiCode );
     1666        READ_UVLC( uiCode, "max_vps_latency_increase_plus1" ); dpbSize->setMaxVpsLatencyIncreasePlus1( i, j, uiCode );
     1667      }
     1668      else
     1669      {
     1670        if ( j > 0 )
     1671        {
     1672          for( Int k = 0; k < vps->getNumSubDpbs( vps->getOutputLayerSetIdxMinus1( i ) + 1 ); k++ )   
     1673          {
     1674            dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, dpbSize->getMaxVpsDecPicBufferingMinus1( i,k, j - 1 ) );
     1675          }
     1676          dpbSize->setMaxVpsNumReorderPics      ( i, j, dpbSize->getMaxVpsNumReorderPics      ( i, j - 1 ) );
     1677          dpbSize->setMaxVpsLatencyIncreasePlus1( i, j, dpbSize->getMaxVpsLatencyIncreasePlus1( i, j - 1 ) );
     1678        }
     1679      }
     1680    } 
     1681  } 
     1682}
     1683#endif
    12351684#endif
    12361685
     
    12801729        if (i!=1)
    12811730        {
    1282           READ_UVLC (uiCode, "log2_sub_PU_size_minus2");     pcVPS->setSubPULog2Size(i, uiCode+2);
     1731          READ_UVLC (uiCode, "log2_sub_PU_size_minus2[i]");     pcVPS->setSubPULog2Size(i, uiCode+2);
    12831732        }
    12841733#endif
     
    13571806  sps->inferRepFormat  ( vps , rpcSlice->getLayerId() );
    13581807  sps->inferScalingList( parameterSetManager->getActiveSPS( sps->getSpsScalingListRefLayerId() ) );   
    1359 
     1808#if H_MV_6_PS_O0118_33
     1809  if ( sps->getVuiParametersPresentFlag() )
     1810  {
     1811    sps->getVuiParameters()->inferVideoSignalInfo( vps, rpcSlice->getLayerId() );
     1812  }
     1813#endif
    13601814  rpcSlice->setVPS(vps);     
    13611815  rpcSlice->setViewId   ( vps->getViewId   ( rpcSlice->getLayerId() )      );
     
    14111865#if H_MV   
    14121866    Int esb = 0; //Don't use i, otherwise will shadow something below
     1867#if !H_MV_6_RALS_O0149_11
    14131868    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
    14141869    {
     
    14161871      READ_FLAG( uiCode, "poc_reset_flag" ); rpcSlice->setPocResetFlag( uiCode == 1 );
    14171872    }
     1873#endif
    14181874
    14191875    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     
    14221878      READ_FLAG( uiCode, "discardable_flag" ); rpcSlice->setDiscardableFlag( uiCode == 1 );
    14231879    }
     1880
     1881#if H_MV_6_RALS_O0149_11
     1882    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     1883    {
     1884      esb++;
     1885      READ_FLAG( uiCode, "cross_layer_bla_flag" ); rpcSlice->setCrossLayerBlaFlag( uiCode == 1 );
     1886    }
     1887    rpcSlice->checkCrossLayerBlaFlag( );
     1888
     1889    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     1890    {
     1891      esb++;
     1892      READ_FLAG( uiCode, "poc_reset_flag" ); rpcSlice->setPocResetFlag( uiCode == 1 );
     1893    }
     1894#endif
    14241895
    14251896    for (; esb < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++)   
     
    14451916    //   colour_plane_id                                      u(2)
    14461917
     1918
     1919#if H_MV_6_POC_31_35_38
     1920    UInt slicePicOrderCntLsb = 0;
     1921    Int iPOClsb = slicePicOrderCntLsb;  // Needed later
     1922    if ( (rpcSlice->getLayerId() > 0 && !vps->getPocLsbNotPresentFlag( rpcSlice->getLayerIdInVps())) || !rpcSlice->getIdrPicFlag() )
     1923    {
     1924      READ_CODE(sps->getBitsForPOC(), slicePicOrderCntLsb, "slice_pic_order_cnt_lsb");       
     1925    }   
     1926
     1927    Bool picOrderCntMSBZeroFlag = false;     
     1928
     1929    // as in HM code. However are all cases for IRAP picture with NoRaslOutputFlag equal to 1 covered??
     1930    picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP   );
     1931    picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL );
     1932    picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP   );
     1933    picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag ||   rpcSlice->getIdrPicFlag();
     1934
     1935    // TBD picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getLayerId() > 0 &&   !rpcSlice->getFirstPicInLayerDecodedFlag() );
     1936
     1937    Int picOrderCntMSB = 0;
     1938
     1939    if ( !picOrderCntMSBZeroFlag )
     1940    {
     1941      Int prevPicOrderCnt    = rpcSlice->getPrevTid0POC();
     1942      Int maxPicOrderCntLsb  = 1 << sps->getBitsForPOC();
     1943      Int prevPicOrderCntLsb = prevPicOrderCnt & (maxPicOrderCntLsb - 1);
     1944      Int prevPicOrderCntMsb = prevPicOrderCnt - prevPicOrderCntLsb;
     1945           
     1946      if( ( slicePicOrderCntLsb  <  prevPicOrderCntLsb ) && ( ( prevPicOrderCntLsb - slicePicOrderCntLsb )  >=  ( maxPicOrderCntLsb / 2 ) ) )
     1947      {
     1948        picOrderCntMSB = prevPicOrderCntMsb + maxPicOrderCntLsb;
     1949      }
     1950      else if( (slicePicOrderCntLsb  >  prevPicOrderCntLsb )  && ( (slicePicOrderCntLsb - prevPicOrderCntLsb )  >  ( maxPicOrderCntLsb / 2 ) ) )
     1951      {
     1952        picOrderCntMSB = prevPicOrderCntMsb - maxPicOrderCntLsb;
     1953      }
     1954      else
     1955      {
     1956        picOrderCntMSB = prevPicOrderCntMsb;
     1957      }   
     1958    }
     1959     
     1960    rpcSlice->setPOC( picOrderCntMSB + slicePicOrderCntLsb );
     1961    if ( rpcSlice->getPocResetFlag() ) 
     1962    {
     1963      rpcSlice->setPocBeforeReset   ( rpcSlice->getPOC() );
     1964      rpcSlice->setPOC              ( 0 );
     1965    }     
     1966#endif
     1967
    14471968    if( rpcSlice->getIdrPicFlag() )
    14481969    {
     1970#if !H_MV_6_POC_31_35_38
    14491971      rpcSlice->setPOC(0);
     1972#endif
    14501973      TComReferencePictureSet* rps = rpcSlice->getLocalRPS();
    14511974      rps->setNumberOfNegativePictures(0);
     
    14601983    else
    14611984    {
     1985#if !H_MV_6_POC_31_35_38
    14621986      READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb"); 
    14631987      Int iPOClsb = uiCode;
     
    14942018
    14952019      }     
     2020#endif
    14962021#endif
    14972022      TComReferencePictureSet* rps;
     
    16282153    }
    16292154#if H_MV
     2155#if H_MV_6_ILDDS_ILREFPICS_27_34
     2156    Bool interLayerPredLayerIdcPresentFlag = false;
     2157#endif
    16302158    Int layerId       = rpcSlice->getLayerId();
    1631     if( rpcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )    {   
     2159    if( rpcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )
     2160    {   
    16322161      READ_FLAG( uiCode, "inter_layer_pred_enabled_flag" ); rpcSlice->setInterLayerPredEnabledFlag( uiCode == 1 );
    16332162      if( rpcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 )
     
    16392168        if ( rpcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) )
    16402169        {
     2170#if H_MV_6_ILDDS_ILREFPICS_27_34
     2171          interLayerPredLayerIdcPresentFlag = true;
     2172#endif
    16412173          for( Int idx = 0; idx < rpcSlice->getNumActiveRefLayerPics(); idx++ )   
    16422174          {
     
    16462178      } 
    16472179    }
     2180#if H_MV_6_ILDDS_ILREFPICS_27_34
     2181    if ( !interLayerPredLayerIdcPresentFlag )
     2182    {
     2183      for( Int i = 0; i < rpcSlice->getNumActiveRefLayerPics(); i++ )   
     2184      {
     2185        rpcSlice->setInterLayerPredLayerIdc( i, rpcSlice->getRefLayerPicIdc( i ) );
     2186      }
     2187    }
     2188#endif
    16482189#endif
    16492190    if(sps->getUseSAO())
  • branches/HTM-9.0-dev0/source/Lib/TLibDecoder/TDecCAVLC.h

    r655 r730  
    7878#if H_MV
    7979  Void  parseVPSExtension   ( TComVPS* pcVPS );
     80#if H_MV_6_PS_REP_FORM_18_19_20
     81  Void  parseRepFormat      ( Int i, TComRepFormat* curRepFormat, TComRepFormat* prevRepFormat );
     82#else
    8083  Void  parseRepFormat      ( TComRepFormat* pcRepFormat );
     84#endif
    8185  Void  parseVPSVUI         ( TComVPS* pcVPS );
     86#if H_MV_6_PS_O0118_33
     87  Void parseVideoSignalInfo ( TComVideoSignalInfo* pcVideoSignalInfo );
     88#endif
     89#if H_MV_6_HRD_O0217_13
     90  Void  parseDpbSize        ( TComVPS* pcVPS );
     91#endif
     92#if H_MV_6_HRD_O0164_15
     93  Void parseVpsVuiBspHrdParameters( TComVPS* pcVPS );
     94#endif
    8295#endif
    8396
  • branches/HTM-9.0-dev0/source/Lib/TLibDecoder/TDecTop.cpp

    r724 r730  
    635635#if H_MV
    636636  m_apcSlicePilot->setVPS(vps); 
     637#if H_MV_6_PS_0092_17
     638  // The nuh_layer_id value of the NAL unit containing the PPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA.
     639  assert( pps->getLayerId() == m_layerId || pps->getLayerId( ) == 0 || vps->getInDirectDependencyFlag( m_layerId, pps->getLayerId() ) );   
     640  // The nuh_layer_id value of the NAL unit containing the SPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA.
     641  assert( sps->getLayerId() == m_layerId || sps->getLayerId( ) == 0 || vps->getInDirectDependencyFlag( m_layerId, sps->getLayerId() ) );
     642#endif
    637643  sps->inferRepFormat  ( vps , m_layerId );
    638644  sps->inferScalingList( m_parameterSetManagerDecoder.getActiveSPS( sps->getSpsScalingListRefLayerId() ) );
     
    665671
    666672#if H_MV
     673#if H_MV_FIX_SKIP_PICTURES
     674Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag  )
     675#else
    667676Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag )
     677#endif
    668678{
    669679  assert( nalu.m_layerId == m_layerId );
    670 
    671680#else
    672681Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay )
     
    722731#endif
    723732#endif
     733
     734#if H_MV_LAYER_WISE_STARTUP
     735    xCeckNoClrasOutput();
     736#endif
    724737    // Skip pictures due to random access
    725738    if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
    726739    {
    727     m_prevSliceSkipped = true;
    728     m_skippedPOC = m_apcSlicePilot->getPOC();
     740      m_prevSliceSkipped = true;
     741      m_skippedPOC = m_apcSlicePilot->getPOC();
     742#if H_MV_FIX_SKIP_PICTURES
     743      sliceSkippedFlag = true;
     744#endif
    729745      return false;
    730746    }
     
    732748    if (isSkipPictureForBLA(iPOCLastDisplay))
    733749    {
    734     m_prevSliceSkipped = true;
    735     m_skippedPOC = m_apcSlicePilot->getPOC();
     750      m_prevSliceSkipped = true;
     751      m_skippedPOC = m_apcSlicePilot->getPOC();
     752#if H_MV_FIX_SKIP_PICTURES
     753      sliceSkippedFlag = true;
     754#endif
    736755      return false;
    737756    }
     
    788807    xCreateLostPicture(lostPoc-1);
    789808  }
     809 
    790810  if (m_bFirstSliceInPicture)
    791811  {
     
    11711191
    11721192#if H_MV
     1193#if H_MV_FIX_SKIP_PICTURES
     1194Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag )
     1195#else
    11731196Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayerFlag)
     1197#endif
    11741198#else
    11751199Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay)
     
    12161240    case NAL_UNIT_CODED_SLICE_RASL_R:
    12171241#if H_MV
     1242#if H_MV_FIX_SKIP_PICTURES
     1243      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag, sliceSkippedFlag );
     1244#else
    12181245      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag);
     1246#endif
    12191247#else
    12201248      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay);
     
    12421270    return true;
    12431271  }
     1272
    12441273  return false;
    12451274}
     
    12651294    return true;
    12661295  }
     1296#if H_MV_LAYER_WISE_STARTUP
     1297  else if ( !m_layerInitilizedFlag[ m_layerId ] ) // start of random access point, m_pocRandomAccess has not been set yet.
     1298#else
    12671299  else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet.
     1300#endif
    12681301  {
    12691302    if (   m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA
     
    12721305        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL )
    12731306    {
     1307
     1308#if H_MV_LAYER_WISE_STARTUP
     1309      if ( xAllRefLayersInitilized() )
     1310      {
     1311        m_layerInitilizedFlag[ m_layerId ] = true;
     1312        m_pocRandomAccess = m_apcSlicePilot->getPOC();
     1313      }
     1314      else
     1315      {
     1316        return true;
     1317      }
     1318#else
    12741319      // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT.
    12751320      m_pocRandomAccess = m_apcSlicePilot->getPOC();
     1321#endif
    12761322    }
    12771323    else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    12781324    {
     1325#if H_MV_LAYER_WISE_STARTUP
     1326      if ( xAllRefLayersInitilized() )
     1327      {
     1328        m_layerInitilizedFlag[ m_layerId ] = true;
     1329        m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
     1330      }
     1331      else
     1332      {
     1333        return true;
     1334      }
     1335#else
    12791336      m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
     1337#endif
    12801338    }
    12811339    else
    12821340    {
     1341#if H_MV_FIX_SKIP_PICTURES
     1342      static Bool warningMessage[MAX_NUM_LAYERS];
     1343      static Bool warningInitFlag = false;
     1344     
     1345      if (!warningInitFlag)
     1346      {
     1347        for ( Int i = 0; i < MAX_NUM_LAYERS; i++)
     1348        {
     1349          warningMessage[i] = true;
     1350        }
     1351        warningInitFlag = true;
     1352      }
     1353
     1354      if ( warningMessage[getLayerId()] )
     1355      {
     1356        printf("\nLayer%3d   No valid random access point. VCL NAL units of this layer are discarded until next layer initialization picture. ", getLayerId() );
     1357        warningMessage[m_layerId] = false;
     1358      }
     1359#else
    12831360      static Bool warningMessage = false;
    12841361      if(!warningMessage)
     
    12871364        warningMessage = true;
    12881365      }
     1366#endif
    12891367      return true;
    12901368    }
     
    12961374    return true;
    12971375  }
     1376#if H_MV_LAYER_WISE_STARTUP
     1377  return !m_layerInitilizedFlag[ getLayerId() ];
     1378#else
    12981379  // if we reach here, then the picture is not skipped.
    12991380  return false;
     1381#endif
    13001382}
    13011383
     
    13381420  }
    13391421}
     1422
     1423#if H_MV_LAYER_WISE_STARTUP
     1424Void TDecTop::xCeckNoClrasOutput()
     1425{
     1426  // This part needs further testing!
     1427  if ( getLayerId() == 0 )
     1428  {   
     1429    NalUnitType nut = m_apcSlicePilot->getNalUnitType();
     1430
     1431    Bool isBLA =  ( nut == NAL_UNIT_CODED_SLICE_BLA_W_LP  )  || ( nut == NAL_UNIT_CODED_SLICE_BLA_N_LP ) || ( nut == NAL_UNIT_CODED_SLICE_BLA_W_RADL );
     1432    Bool isIDR  = ( nut == NAL_UNIT_CODED_SLICE_IDR_W_RADL ) || ( nut == NAL_UNIT_CODED_SLICE_IDR_N_LP );
     1433    Bool noClrasOutputFlag  = isBLA || ( isIDR  &&  m_apcSlicePilot->getCrossLayerBlaFlag() );
     1434
     1435    if ( noClrasOutputFlag )
     1436    {
     1437      for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++)
     1438      {
     1439        m_layerInitilizedFlag[i] = false;
     1440      }
     1441    }
     1442  }
     1443}
     1444
     1445Bool TDecTop::xAllRefLayersInitilized()
     1446{
     1447  Bool allRefLayersInitilizedFlag = true;
     1448  TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 );
     1449  for (Int i = 0; i < vps->getNumDirectRefLayers( getLayerId()  ); i++ )
     1450  {
     1451    Int refLayerId = vps->getRefLayerId( m_layerId, i );
     1452    allRefLayersInitilizedFlag = allRefLayersInitilizedFlag && m_layerInitilizedFlag[ refLayerId ];
     1453  }
     1454
     1455  return allRefLayersInitilizedFlag;
     1456}
     1457#endif
    13401458#endif
    13411459//! \}
  • branches/HTM-9.0-dev0/source/Lib/TLibDecoder/TDecTop.h

    r724 r730  
    186186  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
    187187#if H_MV
     188#if H_MV_LAYER_WISE_STARTUP
     189  Bool*                    m_layerInitilizedFlag; // initialization Layers
     190#endif
    188191  static ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
    189192#else
     
    243246  Void  init();
    244247#if H_MV 
     248#if H_MV_FIX_SKIP_PICTURES
     249  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer, Bool& sliceSkippedFlag );
     250#else
     251  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer );
     252#endif
    245253  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer );
    246254#else 
     
    260268  TComList<TComPic*>*     getListPic            ()               { return &m_cListPic;  } 
    261269  Void                    setIvPicLists         ( TComPicLists* picLists) { m_ivPicLists = picLists; }
    262  
     270#if H_MV_LAYER_WISE_STARTUP
     271  Void                    setLayerInitilizedFlags( Bool* val )    { m_layerInitilizedFlag = val; }
     272#endif
     273#if H_MV_6_HRD_O0217_13
     274  TComVPS*                getPrefetchedVPS      ()               { return m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); }; //Assuming that currently only one VPS is present.
     275#endif
    263276  Int                     getCurrPoc            ()               { return m_apcSlicePilot->getPOC(); }
    264277  Void                    setLayerId            ( Int layer)     { m_layerId = layer;   }
     
    281294#if H_MV 
    282295  TComPic*  xGetPic( Int layerId, Int poc );
     296#if H_MV_FIX_SKIP_PICTURES
     297  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag ); 
     298#else
    283299  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag ); 
     300#endif
    284301  Void      xResetPocInPicBuffer();
     302#if H_MV_LAYER_WISE_STARTUP
     303  Void      xCeckNoClrasOutput();
     304
     305  Bool      xAllRefLayersInitilized();
     306#endif
    285307#else
    286308  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
     
    291313  Void      xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType );
    292314
     315
    293316};// END CLASS DEFINITION TDecTop
    294317
  • branches/HTM-9.0-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp

    r724 r730  
    280280  }
    281281  WRITE_FLAG(pcVUI->getVideoSignalTypePresentFlag(),            "video_signal_type_present_flag");
     282#if H_MV_6_PS_O0118_33
     283  assert( pcSPS->getLayerId() == 0 || !pcVUI->getVideoSignalTypePresentFlag() );
     284#endif
    282285  if (pcVUI->getVideoSignalTypePresentFlag())
    283286  {
     
    443446  {
    444447    WRITE_FLAG( pcSPS->getUpdateRepFormatFlag( ) ? 1 : 0 , "update_rep_format_flag" );
     448#if H_MV_6_PS_REP_FORM_18_19_20   
     449    if ( pcSPS->getUpdateRepFormatFlag() )
     450    {
     451      WRITE_CODE( pcSPS->getSpsRepFormatIdx( ), 8, "sps_rep_format_idx" );
     452    }
     453  }
     454  else
     455  {
     456#else
    445457  }
    446458
    447459  if ( pcSPS->getUpdateRepFormatFlag() )
    448460  {
     461#endif
    449462#endif
    450463  WRITE_UVLC( pcSPS->getChromaFormatIdc (),         "chroma_format_idc" );
     
    472485  }
    473486#if H_MV
     487#if H_MV_6_PS_REP_FORM_18_19_20
     488  if ( pcSPS->getLayerId() == 0 )
     489#else
    474490  if ( pcSPS->getUpdateRepFormatFlag() )
     491#endif
    475492  {
    476493#endif
     
    577594  WRITE_FLAG( 0, "sps_extension_flag" );
    578595#else
     596#if H_MV_6_PSEM_O0142_3
     597  WRITE_FLAG( pcSPS->getSpsExtensionFlag(), "sps_extension_flag" );
     598
     599  if ( pcSPS->getSpsExtensionFlag() )
     600  {
     601    for (Int i = 0; i < PS_EX_T_MAX_NUM; i++)
     602    {
     603      WRITE_FLAG( pcSPS->getSpsExtensionTypeFlag( i ) ? 1 : 0 , "sps_extension_type_flag" );
     604#if H_3D
     605      assert( !pcSPS->getSpsExtensionTypeFlag( i ) || i == PS_EX_T_MV || i == PS_EX_T_3D );
     606#else
     607      assert( !pcSPS->getSpsExtensionTypeFlag( i ) || i == PS_EX_T_MV );
     608#endif
     609    } 
     610
     611    if( pcSPS->getSpsExtensionTypeFlag( PS_EX_T_MV ))
     612    {
     613      codeSPSExtension( pcSPS );
     614    }
     615
     616#if H_3D
     617    if( pcSPS->getSpsExtensionTypeFlag( PS_EX_T_3D ))
     618    {
     619      codeSPSExtension2( pcSPS, viewIndex, depthFlag );
     620    }
     621#endif
     622  }
     623#else
    579624  WRITE_FLAG( 1, "sps_extension_flag" );
    580625  codeSPSExtension( pcSPS );
     
    587632#endif 
    588633#endif
     634#endif
    589635}
    590636
     
    593639{
    594640  WRITE_FLAG( pcSPS->getInterViewMvVertConstraintFlag() ? 1 : 0, "inter_view_mv_vert_constraint_flag" );
     641
     642#if !H_MV_6_SHVC_O0098_36
    595643  WRITE_UVLC( 0, "sps_shvc_reserved_zero_idc" );
     644#else
     645  WRITE_UVLC( pcSPS->getNumScaledRefLayerOffsets( ), "num_scaled_ref_layer_offsets" );
     646
     647  for( Int i = 0; i < pcSPS->getNumScaledRefLayerOffsets( ); i++)
     648  {   
     649    WRITE_CODE( pcSPS->getScaledRefLayerId( i ), 6, "scaled_ref_layer_id" );
     650
     651    Int j = pcSPS->getScaledRefLayerId( i );
     652   
     653    WRITE_SVLC( pcSPS->getScaledRefLayerLeftOffset( j ), "scaled_ref_layer_left_offset" );
     654    WRITE_SVLC( pcSPS->getScaledRefLayerTopOffset( j ), "scaled_ref_layer_top_offset" );
     655    WRITE_SVLC( pcSPS->getScaledRefLayerRightOffset( j ), "scaled_ref_layer_right_offset" );
     656    WRITE_SVLC( pcSPS->getScaledRefLayerBottomOffset( j ), "scaled_ref_layer_bottom_offset" );
     657  }
     658#endif 
    596659}
    597660#endif
     
    740803{
    741804  WRITE_FLAG( pcVPS->getAvcBaseLayerFlag() ? 1 : 0,          "avc_base_layer_flag" );
     805#if H_MV_6_PS_O0109_24
     806  WRITE_FLAG( pcVPS->getVpsVuiPresentFlag() ? 1 : 0 , "vps_vui_present_flag" );
     807  if ( pcVPS->getVpsVuiPresentFlag() )
     808  { 
     809#endif
    742810  WRITE_CODE( pcVPS->getVpsVuiOffset( ), 16,                 "vps_vui_offset" );  // TBD
     811#if H_MV_6_PS_O0109_24
     812  }
     813#endif
    743814  WRITE_FLAG( pcVPS->getSplittingFlag() ? 1 : 0,             "splitting_flag" );
    744815 
     
    786857  }
    787858
     859
     860#if H_MV_6_PS_O0109_22
     861    WRITE_CODE( pcVPS->getViewIdLen( ), 4, "view_id_len" );
     862   
     863    if ( pcVPS->getViewIdLen( ) > 0 )
     864    {   
     865      for( Int i = 0; i < pcVPS->getNumViews(); i++ )
     866      {
     867        WRITE_CODE( pcVPS->getViewIdVal( i ), pcVPS->getViewIdLen( ), "view_id_val[i]" );
     868      }
     869    }
     870    else
     871    {
     872      for( Int i = 0; i < pcVPS->getNumViews(); i++ )
     873      {
     874        assert( pcVPS->getViewIdVal( i ) == 0 );
     875      }
     876    }
     877#else
    788878  // GT spec says: trac #39
    789879  // if ( pcVPS->getNumViews() > 1 ) 
     
    792882    WRITE_CODE( pcVPS->getViewIdLenMinus1( ), 4, "view_id_len_minus1" );
    793883  }
    794 
    795884  for( Int i = 0; i < pcVPS->getNumViews(); i++ )
    796885  {
    797886    WRITE_CODE( pcVPS->getViewIdVal( i ), pcVPS->getViewIdLenMinus1( ) + 1, "view_id_val[i]" );
    798887  }
     888#endif
     889
    799890
    800891  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
     
    805896    }
    806897  }
    807 
     898#if H_MV_6_ILDSD_O0120_26
     899  WRITE_FLAG( pcVPS->getVpsSubLayersMaxMinus1PresentFlag( ) ? 1 : 0 , "vps_sub_layers_max_minus1_present_flag" );
     900  if ( pcVPS->getVpsSubLayersMaxMinus1PresentFlag() )
     901  {
     902    for (Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )
     903    {
     904      WRITE_CODE( pcVPS->getSubLayersVpsMaxMinus1( i ), 3, "sub_layers_vps_max_minus1" );
     905      pcVPS->checkSubLayersVpsMaxMinus1( i );
     906    }
     907  } 
     908  else
     909  {
     910    for (Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )
     911    {
     912      assert( pcVPS->getSubLayersVpsMaxMinus1( i ) + 1 == pcVPS->getMaxTLayers( ) );   
     913    }
     914  }
     915#endif
    808916  WRITE_FLAG( pcVPS->getMaxTidRefPresentFlag( ) ? 1 : 0 , "max_tid_ref_present_flag" );
    809917
     
    812920    for( Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )
    813921    {
     922#if H_MV_6_ILDDS_O0225_30
     923      for( Int j = i + 1; j <= pcVPS->getMaxLayersMinus1(); j++ )
     924      {
     925        if ( pcVPS->getDirectDependencyFlag(j,i) )
     926        {
     927          WRITE_CODE( pcVPS->getMaxTidIlRefPicsPlus1( i, j ), 3, "max_tid_il_ref_pics_plus1" );
     928        }
     929      }
     930#else
    814931      WRITE_CODE( pcVPS->getMaxTidIlRefPicPlus1( i ), 3,       "max_tid_il_ref_pics_plus1[i]" );
     932#endif
    815933    }
    816934  }
     
    826944    {   
    827945      WRITE_CODE( pcVPS->getProfileRefMinus1( i ), 6, "profile_ref_minus1[i]" );
     946#if H_MV_6_PS_O0109_23
     947      pcVPS->checkProfileRefMinus1( i );     
     948#endif
    828949    }
    829950    codePTL( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers() - 1 );
     
    842963  if( numOutputLayerSets > 1)
    843964  {
     965#if H_MV_6_PS_0109_25
     966    WRITE_CODE( pcVPS->getDefaultOneTargetOutputLayerIdc( ), 2, "default_one_target_output_layer_idc" );
     967    pcVPS->checkDefaultOneTargetOutputLayerIdc();
     968#else
    844969    WRITE_FLAG( pcVPS->getDefaultOneTargetOutputLayerFlag( ) ? 1 : 0, "default_one_target_output_layer_flag" );
     970#endif       
    845971  } 
    846972
     973#if H_MV_6_HRD_O0217_13
     974  assert( pcVPS->getOutputLayerFlag(0, 0) == pcVPS->inferOutputLayerFlag( 0, 0 ));
     975  assert( pcVPS->getOutputLayerSetIdxMinus1( 0 ) == -1 );
     976#endif
    847977  for( Int i = 1; i < numOutputLayerSets; i++ )
    848978  {
     
    855985      }     
    856986    }
     987#if H_MV_6_HRD_O0217_13
     988    else
     989    { // These inference rules would also be helpful in spec text
     990      assert( pcVPS->getOutputLayerSetIdxMinus1(i ) ==  i - 1 );
     991      for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1; j++ )
     992      {             
     993        assert( pcVPS->getOutputLayerFlag( i , j ) == pcVPS->inferOutputLayerFlag( i, j ));
     994      }
     995    }
     996#endif
     997
    857998    if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
    858999    {     
     
    8611002  }
    8621003
     1004#if H_MV_6_GEN_0153_28
     1005  if( pcVPS->getMaxLayersMinus1() > 0 )
     1006  {
     1007    WRITE_FLAG( pcVPS->getAltOutputLayerFlag( ) ? 1 : 0 , "alt_output_layer_flag" );
     1008  }
     1009#endif
     1010
    8631011  WRITE_FLAG( pcVPS->getRepFormatIdxPresentFlag( ) ? 1 : 0 , "rep_format_idx_present_flag" );
    8641012  if ( pcVPS->getRepFormatIdxPresentFlag() )
     
    8691017  for (Int i = 0; i <= pcVPS->getVpsNumRepFormatsMinus1(); i++ )
    8701018  {   
     1019#if H_MV_6_PS_REP_FORM_18_19_20
     1020    TComRepFormat* curRepFormat = pcVPS->getRepFormat(i);     
     1021    TComRepFormat* prevRepFormat = i > 0 ? pcVPS->getRepFormat( i - 1) : NULL;
     1022    codeRepFormat( i, curRepFormat ,  prevRepFormat);
     1023#else
    8711024    TComRepFormat* pcRepFormat = pcVPS->getRepFormat(i);     
    8721025    codeRepFormat( pcRepFormat );
     1026#endif
    8731027  }
    8741028
     
    8791033      if( pcVPS->getVpsNumRepFormatsMinus1() > 0 )
    8801034      {
     1035#if H_MV_6_PS_REP_FORM_18_19_20
     1036        WRITE_CODE( pcVPS->getVpsRepFormatIdx( i ), 8, "vps_rep_format_idx" );
     1037#else
    8811038        WRITE_CODE( pcVPS->getVpsRepFormatIdx( i ), 4, "vps_rep_format_idx" );
     1039#endif
    8821040      }
    8831041    }
     
    8851043
    8861044  WRITE_FLAG( pcVPS->getMaxOneActiveRefLayerFlag( ) ? 1 : 0, "max_one_active_ref_layer_flag" );
     1045#if H_MV_6_MISC_O0062_31
     1046  for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
     1047  {
     1048    if( pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) )  ==  0 )
     1049    {     
     1050      WRITE_FLAG( pcVPS->getPocLsbNotPresentFlag( i ) ? 1 : 0 , "poc_lsb_not_present_flag" );
     1051    }
     1052  }
     1053#endif
     1054#if H_MV_6_HRD_O0217_13
     1055  codeDpbSize( pcVPS );
     1056#endif
     1057
     1058#if !H_MV_6_PS_O0223_29
    8871059  WRITE_FLAG( pcVPS->getCrossLayerIrapAlignedFlag( ) ? 1 : 0 , "cross_layer_irap_aligned_flag" );
     1060#endif
    8881061  WRITE_UVLC( pcVPS->getDirectDepTypeLenMinus2 ( ),         "direct_dep_type_len_minus2");
    8891062
     1063#if H_MV_6_PS_O0096_21
     1064  WRITE_FLAG( pcVPS->getDefaultDirectDependencyFlag( ) ? 1 : 0 , "default_direct_dependency_flag" );
     1065
     1066  if ( pcVPS->getDefaultDirectDependencyFlag( ) )
     1067  { 
     1068    WRITE_CODE( pcVPS->getDefaultDirectDependencyType( ), pcVPS->getDirectDepTypeLenMinus2( ) + 2 , "default_direct_dependency_type" );   
     1069  }
     1070
     1071  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
     1072  {
     1073    for( Int j = 0; j < i; j++ )
     1074    {
     1075      if (pcVPS->getDirectDependencyFlag( i, j) )
     1076      {       
     1077        if ( pcVPS->getDefaultDirectDependencyFlag( ) )
     1078        { 
     1079          assert( pcVPS->getDirectDependencyType( i, j ) == pcVPS->getDefaultDirectDependencyType( ) );
     1080        }
     1081        else
     1082        {
     1083          assert ( pcVPS->getDirectDependencyType( i, j ) != -1 );
     1084          WRITE_CODE( pcVPS->getDirectDependencyType( i, j ),pcVPS->getDirectDepTypeLenMinus2( ) + 2,  "direct_dependency_type[i][j]" );
     1085        }
     1086      }
     1087    }
     1088  } 
     1089#else
    8901090    for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
    8911091    {
     
    8991099      }
    9001100    }
    901    
     1101#endif
    9021102    WRITE_FLAG ( 0,                                      "vps_shvc_reserved_zero_flag" );
     1103#if !H_MV_6_PS_O0109_24
    9031104    WRITE_FLAG( pcVPS->getVpsVuiPresentFlag( ) ? 1 : 0 , "vps_vui_present_flag" );
     1105#endif
    9041106
    9051107    if( pcVPS->getVpsVuiPresentFlag() )
     
    9091111    }     
    9101112}
    911 
     1113#if H_MV_6_PS_O0118_33
     1114Void TEncCavlc::codeVideoSignalInfo( TComVideoSignalInfo* pcVideoSignalInfo )
     1115{
     1116  assert( pcVideoSignalInfo );
     1117  WRITE_CODE( pcVideoSignalInfo->getVideoVpsFormat( ), 3, "video_vps_format" );
     1118  WRITE_FLAG( pcVideoSignalInfo->getVideoFullRangeVpsFlag( ) ? 1 : 0 , "video_full_range_vps_flag" );
     1119  WRITE_CODE( pcVideoSignalInfo->getColourPrimariesVps( ), 8, "colour_primaries_vps" );
     1120  WRITE_CODE( pcVideoSignalInfo->getTransferCharacteristicsVps( ), 8, "transfer_characteristics_vps" );
     1121  WRITE_CODE( pcVideoSignalInfo->getMatrixCoeffsVps( ), 8, "matrix_coeffs_vps" );
     1122}
     1123#endif
     1124
     1125#if H_MV_6_HRD_O0217_13
     1126Void TEncCavlc::codeDpbSize( TComVPS* vps )
     1127{
     1128  TComDpbSize* dpbSize = vps->getDpbSize();
     1129  assert ( dpbSize != 0 );
     1130
     1131  for( Int i = 1; i < vps->getNumOutputLayerSets(); i++ )
     1132  { 
     1133    WRITE_FLAG( dpbSize->getSubLayerFlagInfoPresentFlag( i ) ? 1 : 0 , "sub_layer_flag_info_present_flag" );
     1134
     1135    for( Int j = 0; j  <=  vps->getMaxTLayers() - 1 ; j++ )
     1136    { 
     1137      if( j > 0  &&  dpbSize->getSubLayerDpbInfoPresentFlag( i, j )  ) 
     1138      {
     1139        WRITE_FLAG( dpbSize->getSubLayerDpbInfoPresentFlag( i, j ) ? 1 : 0 , "sub_layer_dpb_info_present_flag" );
     1140      }
     1141      if( dpbSize->getSubLayerDpbInfoPresentFlag( i, j ) )
     1142      { 
     1143        for( Int k = 0; k < vps->getNumSubDpbs( vps->getOutputLayerSetIdxMinus1( i ) + 1 ); k++ )   // Preliminary fix does not match with spec
     1144        {
     1145          WRITE_UVLC( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ), "max_vps_dec_pic_buffering_minus1" );
     1146        }
     1147        WRITE_UVLC( dpbSize->getMaxVpsNumReorderPics( i, j ), "max_vps_num_reorder_pics" );
     1148        WRITE_UVLC( dpbSize->getMaxVpsLatencyIncreasePlus1( i, j ), "max_vps_latency_increase_plus1" );
     1149      }
     1150      else
     1151      {
     1152        if ( j > 0 )
     1153        {
     1154          for( Int k = 0; k < vps->getNumSubDpbs( vps->getOutputLayerSetIdxMinus1( i ) + 1 ); k++ )   
     1155          {
     1156            assert( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ) == dpbSize->getMaxVpsDecPicBufferingMinus1( i,k, j - 1 ) );
     1157          }
     1158          assert( dpbSize->getMaxVpsNumReorderPics      ( i, j ) ==  dpbSize->getMaxVpsNumReorderPics      ( i, j - 1 ) );
     1159          assert( dpbSize->getMaxVpsLatencyIncreasePlus1( i, j ) ==  dpbSize->getMaxVpsLatencyIncreasePlus1( i, j - 1 ) );
     1160        }
     1161      }
     1162    }       
     1163  } 
     1164}
     1165#endif
     1166
     1167#if H_MV_6_PS_REP_FORM_18_19_20
     1168Void TEncCavlc::codeRepFormat( Int i, TComRepFormat* pcRepFormat, TComRepFormat* pcPrevRepFormat )
     1169#else
    9121170Void TEncCavlc::codeRepFormat( TComRepFormat* pcRepFormat )
     1171#endif
    9131172{
    9141173  assert( pcRepFormat );
    9151174
    916   WRITE_CODE( pcRepFormat->getChromaFormatVpsIdc( ), 2, "chroma_format_vps_idc" );
    917 
    918   if ( pcRepFormat->getChromaFormatVpsIdc() == 3 )
    919   {
    920     WRITE_FLAG( pcRepFormat->getSeparateColourPlaneVpsFlag( ) ? 1 : 0 , "separate_colour_plane_vps_flag" );
    921   }
     1175#if H_MV_6_PS_REP_FORM_18_19_20
    9221176  WRITE_CODE( pcRepFormat->getPicWidthVpsInLumaSamples( ),  16, "pic_width_vps_in_luma_samples" );
    9231177  WRITE_CODE( pcRepFormat->getPicHeightVpsInLumaSamples( ), 16, "pic_height_vps_in_luma_samples" );
     1178  WRITE_FLAG( pcRepFormat->getChromaAndBitDepthVpsPresentFlag( ) ? 1 : 0 , "chroma_and_bit_depth_vps_present_flag" );
     1179 
     1180  pcRepFormat->checkChromaAndBitDepthVpsPresentFlag( i );
     1181
     1182  if ( pcRepFormat->getChromaAndBitDepthVpsPresentFlag() )
     1183  { 
     1184#endif
     1185  WRITE_CODE( pcRepFormat->getChromaFormatVpsIdc( ), 2, "chroma_format_vps_idc" );
     1186
     1187  if ( pcRepFormat->getChromaFormatVpsIdc() == 3 )
     1188  {
     1189    WRITE_FLAG( pcRepFormat->getSeparateColourPlaneVpsFlag( ) ? 1 : 0 , "separate_colour_plane_vps_flag" );
     1190  }
     1191#if !H_MV_6_PS_REP_FORM_18_19_20
     1192  WRITE_CODE( pcRepFormat->getPicWidthVpsInLumaSamples( ),  16, "pic_width_vps_in_luma_samples" );
     1193  WRITE_CODE( pcRepFormat->getPicHeightVpsInLumaSamples( ), 16, "pic_height_vps_in_luma_samples" );
     1194#endif
    9241195  WRITE_CODE( pcRepFormat->getBitDepthVpsLumaMinus8( ),      4, "bit_depth_vps_luma_minus8" );
    9251196  WRITE_CODE( pcRepFormat->getBitDepthVpsChromaMinus8( ),    4, "bit_depth_vps_chroma_minus8" );
     1197#if H_MV_6_PS_REP_FORM_18_19_20
     1198  }
     1199  else
     1200  {
     1201    pcRepFormat->inferChromaAndBitDepth(pcPrevRepFormat, true );
     1202  }
     1203#endif
    9261204}
    9271205
     
    9331211
    9341212  assert( pcVPSVUI );
     1213
     1214#if H_MV_6_PS_O0223_29
     1215  WRITE_FLAG( pcVPSVUI->getCrossLayerPicTypeAlignedFlag( ) ? 1 : 0 , "cross_layer_pic_type_aligned_flag" );
     1216  if ( !pcVPSVUI->getCrossLayerPicTypeAlignedFlag() )
     1217  { 
     1218    WRITE_FLAG( pcVPSVUI->getCrossLayerIrapAlignedFlag( ) ? 1 : 0 , "cross_layer_irap_aligned_flag" );
     1219  }
     1220#endif
    9351221
    9361222  WRITE_FLAG( pcVPSVUI->getBitRatePresentVpsFlag( ) ? 1 : 0 , "bit_rate_present_vps_flag" );
     
    9641250  }
    9651251
     1252#if H_MV_6_O0226_37
     1253  WRITE_FLAG( pcVPSVUI->getTilesNotInUseFlag( ) ? 1 : 0 , "tiles_not_in_use_flag" );
     1254  if( !pcVPSVUI->getTilesNotInUseFlag() )
     1255  {     
     1256    for( Int i = 0; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
     1257    {
     1258      WRITE_FLAG( pcVPSVUI->getTilesInUseFlag( i ) ? 1 : 0 , "tiles_in_use_flag[i]" );
     1259      if( pcVPSVUI->getTilesInUseFlag( i ) ) 
     1260      {
     1261        WRITE_FLAG( pcVPSVUI->getLoopFilterNotAcrossTilesFlag( i ) ? 1 : 0, "loop_filter_not_across_tiles_flag[i]" );
     1262      }
     1263    } 
     1264
     1265    for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ ) 
     1266    {
     1267      for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ) ; j++ )
     1268      { 
     1269        Int layerIdx = pcVPS->getLayerIdInVps(pcVPS->getRefLayerId(pcVPS->getLayerIdInNuh( i ) , j  )); 
     1270        if( pcVPSVUI->getTilesInUseFlag( i )  &&  pcVPSVUI->getTilesInUseFlag( layerIdx ) ) 
     1271        {
     1272          WRITE_FLAG( pcVPSVUI->getTileBoundariesAlignedFlag( i, j ) ? 1 : 0 , "tile_boundaries_aligned_flag[i][j]" );
     1273        }
     1274      } 
     1275    }
     1276  } 
     1277
     1278  WRITE_FLAG( pcVPSVUI->getWppNotInUseFlag( ) ? 1 : 0 , "wpp_not_in_use_flag" );
     1279
     1280  if( !pcVPSVUI->getWppNotInUseFlag( ) )
     1281  {
     1282    for( Int i = 0; i  <=  pcVPS->getMaxLayersMinus1(); i++ ) 
     1283    {
     1284      WRITE_FLAG( pcVPSVUI->getWppInUseFlag( i ) ? 1 : 0 , "wpp_in_use_flag[i]" );
     1285    }
     1286  }
     1287#else
    9661288  for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
    9671289  {
     
    9711293    }
    9721294  }
    973 
     1295#endif
    9741296  WRITE_FLAG( pcVPSVUI->getIlpRestrictedRefLayersFlag( ) ? 1 : 0 , "ilp_restricted_ref_layers_flag" );
    9751297
     
    9921314    }
    9931315  }
    994 }
     1316#if H_MV_6_PS_O0118_33
     1317  WRITE_FLAG( pcVPSVUI->getVideoSignalInfoIdxPresentFlag( ) ? 1 : 0 , "video_signal_info_idx_present_flag" );
     1318  if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() )
     1319  {
     1320    WRITE_CODE( pcVPSVUI->getVpsNumVideoSignalInfoMinus1( ), 4, "vps_num_video_signal_info_minus1" );
     1321  }
     1322  else
     1323  {
     1324    pcVPSVUI->setVpsNumVideoSignalInfoMinus1( pcVPS->getMaxLayersMinus1() );
     1325  }
     1326
     1327  for( Int i = 0; i <= pcVPSVUI->getVpsNumVideoSignalInfoMinus1(); i++ )
     1328  {
     1329    assert( pcVPSVUI->getVideoSignalInfo( i ) != NULL );
     1330    TComVideoSignalInfo* curVideoSignalInfo = pcVPSVUI->getVideoSignalInfo( i );
     1331    codeVideoSignalInfo( curVideoSignalInfo );     
     1332  }
     1333
     1334  if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() && pcVPSVUI->getVpsNumVideoSignalInfoMinus1() > 0 )
     1335  {
     1336    for( Int i = 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
     1337    {
     1338      WRITE_CODE( pcVPSVUI->getVpsVideoSignalInfoIdx( i ), 4, "vps_video_signal_info_idx" );
     1339      assert( pcVPSVUI->getVpsVideoSignalInfoIdx( i ) >= 0 && pcVPSVUI->getVpsVideoSignalInfoIdx( i ) <= pcVPSVUI->getVpsNumVideoSignalInfoMinus1() );
     1340    }
     1341  }
     1342  else
     1343  {
     1344    for( Int i = 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
     1345    {
     1346      assert( pcVPSVUI->getVpsVideoSignalInfoIdx( i  ) == ( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() ? 0 : i ) );
     1347    }
     1348  }
     1349#endif
     1350#if H_MV_6_HRD_O0164_15
     1351  WRITE_FLAG( pcVPSVUI->getVpsVuiBspHrdPresentFlag( ) ? 1 : 0 , "vps_vui_bsp_hrd_present_flag" );
     1352  if ( pcVPSVUI->getVpsVuiBspHrdPresentFlag( ) )
     1353  {
     1354    codeVpsVuiBspHrdParameters( pcVPS );
     1355  }
     1356#endif
     1357}
     1358#if H_MV_6_HRD_O0164_15
     1359Void TEncCavlc::codeVpsVuiBspHrdParameters( TComVPS* pcVPS )
     1360{
     1361  assert( pcVPS );
     1362
     1363  TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( );
     1364
     1365  assert( pcVPSVUI );
     1366
     1367  TComVpsVuiBspHrdParameters*  vpsVuiBspHrdP = pcVPSVUI->getVpsVuiBspHrdParameters();
     1368
     1369  assert ( vpsVuiBspHrdP );
     1370
     1371 
     1372  WRITE_UVLC( vpsVuiBspHrdP->getVpsNumBspHrdParametersMinus1( ), "vps_num_bsp_hrd_parameters_minus1" );
     1373  for( Int i = 0; i <= vpsVuiBspHrdP->getVpsNumBspHrdParametersMinus1( ); i++ )
     1374  { 
     1375    if( i > 0 )
     1376    {
     1377      WRITE_FLAG( vpsVuiBspHrdP->getBspCprmsPresentFlag( i ) ? 1 : 0 , "bsp_cprms_present_flag" );
     1378    }
     1379    TComHRD* hrdParameters = vpsVuiBspHrdP->getHrdParametermeters( i );
     1380    codeHrdParameters( hrdParameters, vpsVuiBspHrdP->getBspCprmsPresentFlag( i ), pcVPS->getMaxSubLayersMinus1() );     
     1381  } 
     1382  for( Int h = 1; h <= pcVPS->getVpsNumLayerSetsMinus1(); h++ )
     1383  { 
     1384    WRITE_UVLC( vpsVuiBspHrdP->getNumBitstreamPartitions( h ), "num_bitstream_partitions" );
     1385    for( Int i = 0; i < vpsVuiBspHrdP->getNumBitstreamPartitions( h ); i++ ) 
     1386    {
     1387      for( Int j = 0; j <= pcVPS->getMaxLayersMinus1(); j++ ) 
     1388      {
     1389        if( pcVPS->getLayerIdIncludedFlag( h ,j ) )
     1390        {
     1391          WRITE_FLAG( vpsVuiBspHrdP->getLayerInBspFlag( h, i, j ) ? 1 : 0 , "layer_in_bsp_flag" );
     1392        }
     1393        else
     1394        {
     1395          vpsVuiBspHrdP->setLayerInBspFlag( h, i, j, false ); // This inference seems to be missing in spec
     1396        }
     1397      }
     1398    }
     1399    vpsVuiBspHrdP->checkLayerInBspFlag( pcVPS, h );
     1400
     1401    if( vpsVuiBspHrdP->getNumBitstreamPartitions( h ) )
     1402    { 
     1403      WRITE_UVLC( vpsVuiBspHrdP->getNumBspSchedCombinations( h ), "num_bsp_sched_combinations" );
     1404      for( Int i = 0; i < vpsVuiBspHrdP->getNumBspSchedCombinations( h ); i++ )
     1405      {
     1406        for( Int j = 0; j < vpsVuiBspHrdP->getNumBitstreamPartitions( h ); j++ )
     1407        { 
     1408          WRITE_UVLC( vpsVuiBspHrdP->getBspCombHrdIdx( h, i, j ), "bsp_comb_hrd_idx" );
     1409          WRITE_UVLC( vpsVuiBspHrdP->getBspCombSchedIdx( h, i, j ), "bsp_comb_sched_idx" );
     1410        } 
     1411      }
     1412    } 
     1413  } 
     1414
     1415#endif
     1416
    9951417#endif
    9961418
     
    11151537#if H_MV   
    11161538    Int esb = 0;  //Don't use i, otherwise will shadow something below
     1539#if !H_MV_6_RALS_O0149_11
    11171540    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
    11181541    {
     
    11201543      WRITE_FLAG( pcSlice->getPocResetFlag( ) ? 1 : 0 , "poc_reset_flag" );
    11211544    }
     1545#endif
    11221546
    11231547    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     
    11261550      WRITE_FLAG( pcSlice->getDiscardableFlag( ) ? 1 : 0 , "discardable_flag" );
    11271551    }
     1552
     1553#if H_MV_6_RALS_O0149_11
     1554    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     1555    {
     1556      esb++;
     1557      WRITE_FLAG( pcSlice->getCrossLayerBlaFlag( ) ? 1 : 0 , "cross_layer_bla_flag" );
     1558    }
     1559    pcSlice->checkCrossLayerBlaFlag( );
     1560
     1561    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     1562    {
     1563      esb++;
     1564      WRITE_FLAG( pcSlice->getPocResetFlag( ) ? 1 : 0 , "poc_reset_flag" );
     1565    }
     1566#endif
     1567
     1568
    11281569
    11291570    for (; esb < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++)   
     
    11481589    //   colour_plane_id                                      u(2)
    11491590
     1591#if H_MV_6_POC_31_35_38
     1592    if ( (pcSlice->getLayerId() > 0 && !vps->getPocLsbNotPresentFlag( pcSlice->getLayerIdInVps())) || !pcSlice->getIdrPicFlag() )
     1593    {
     1594      Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1);
     1595      WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "slice_pic_order_cnt_lsb");
     1596    }
     1597#endif
    11501598    if( !pcSlice->getIdrPicFlag() )
    11511599    {
     1600#if !H_MV_6_POC_31_35_38
    11521601      Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1);
    11531602      WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb");
     1603#endif
    11541604      TComReferencePictureSet* rps = pcSlice->getRPS();
    11551605     
     
    12651715    }
    12661716#if H_MV
     1717#if H_MV_6_ILDDS_ILREFPICS_27_34
     1718    Bool interLayerPredLayerIdcPresentFlag = false;
     1719#endif
    12671720    Int layerId = pcSlice->getLayerId();
    12681721    if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )
     
    12761729        }
    12771730        if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) )
    1278         {       
     1731        {
     1732#if H_MV_6_ILDDS_ILREFPICS_27_34
     1733          interLayerPredLayerIdcPresentFlag = true;
     1734#endif
    12791735          for( Int idx = 0; idx < pcSlice->getNumActiveRefLayerPics(); idx++ )   
    12801736          {
     
    12841740      } 
    12851741    }
     1742#if H_MV_6_ILDDS_ILREFPICS_27_34
     1743    if ( !interLayerPredLayerIdcPresentFlag )
     1744    {
     1745      for( Int i = 0; i < pcSlice->getNumActiveRefLayerPics(); i++ )   
     1746      {
     1747        assert( pcSlice->getInterLayerPredLayerIdc( i ) == pcSlice->getRefLayerPicIdc( i ) );
     1748      }
     1749    }
     1750#endif
    12861751#endif
    12871752    if(pcSlice->getSPS()->getUseSAO())
  • branches/HTM-9.0-dev0/source/Lib/TLibEncoder/TEncCavlc.h

    r655 r730  
    8585  Void  codeVPS                 ( TComVPS* pcVPS );
    8686#if H_MV
    87   Void  codeVPSExtension       ( TComVPS *pcVPS );
    88   Void  codeRepFormat          ( TComRepFormat* pcRepFormat );
    89   Void  codeVPSVUI             ( TComVPS* pcVPS );
     87  Void  codeVPSExtension        ( TComVPS *pcVPS );
     88#if H_MV_6_PS_O0118_33
     89  Void  codeVideoSignalInfo     ( TComVideoSignalInfo* pcVideoSignalInfo );
     90#endif
     91
     92#if H_MV_6_HRD_O0217_13
     93  Void  codeDpbSize   ( TComVPS* vps );
     94#endif
     95
     96#if H_MV_6_PS_REP_FORM_18_19_20
     97  Void  codeRepFormat           ( Int i, TComRepFormat* curRepFormat, TComRepFormat* prevRepFormat );
     98#else
     99  Void  codeRepFormat           ( TComRepFormat* pcRepFormat );
     100#endif
     101  Void  codeVPSVUI              ( TComVPS* pcVPS );
     102#if H_MV_6_HRD_O0164_15
     103  Void  codeVpsVuiBspHrdParameters( TComVPS* pcVPS );
     104#endif
    90105#endif
    91106  Void  codeVUI                 ( TComVUI *pcVUI, TComSPS* pcSPS );
  • branches/HTM-9.0-dev0/source/Lib/TLibEncoder/TEncGOP.cpp

    r724 r730  
    664664    refPicListModification->setRefPicListModificationFlagL1(0);
    665665#if H_MV
     666#if H_MV_6_RALS_O0149_11
     667    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
     668#else
    666669    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 1 )
     670#endif
    667671    {
    668672      // Some more sophisticated algorithm to determine discardable_flag might be added here.
     
    673677    Int numDirectRefLayers = vps    ->getNumDirectRefLayers( getLayerId() );
    674678    GOPEntry gopEntry      = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid );     
    675    
     679
     680#if H_MV_6_ILDDS_ILREFPICS_27_34
     681    Bool interLayerPredLayerIdcPresentFlag = false;
     682#endif
    676683    if ( getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && numDirectRefLayers > 0 )
    677684    {         
     
    685692        if ( gopEntry.m_numActiveRefLayerPics != vps->getNumDirectRefLayers( getLayerId() ) )
    686693        {       
     694#if H_MV_6_ILDDS_ILREFPICS_27_34
     695          interLayerPredLayerIdcPresentFlag = true;
     696#endif
    687697          for (Int i = 0; i < gopEntry.m_numActiveRefLayerPics; i++ )
    688698          {
     
    692702      }
    693703    }
     704#if H_MV_6_ILDDS_ILREFPICS_27_34
     705    if ( !interLayerPredLayerIdcPresentFlag )
     706    {
     707      for( Int i = 0; i < pcSlice->getNumActiveRefLayerPics(); i++ )   
     708      {
     709        pcSlice->setInterLayerPredLayerIdc(i, pcSlice->getRefLayerPicIdc( i ) );
     710      }
     711    }
     712#endif
     713
     714
    694715    assert( pcSlice->getNumActiveRefLayerPics() == gopEntry.m_numActiveRefLayerPics );
    695716   
  • branches/HTM-9.0-dev0/source/Lib/TLibEncoder/TEncTop.cpp

    r724 r730  
    719719
    720720#if H_MV 
     721#if H_MV_6_PS_REP_FORM_18_19_20
     722  m_cSPS.setUpdateRepFormatFlag           ( false );   
     723#else
    721724  m_cSPS.setUpdateRepFormatFlag           ( m_layerId == 0 );   
     725#endif
    722726  m_cSPS.setSpsInferScalingListFlag       ( m_layerId > 0 && m_cVPS->getInDirectDependencyFlag( getLayerIdInVps(), 0 ) );
    723727  m_cSPS.setSpsScalingListRefLayerId      ( 0              );
     728#if H_MV_6_PSEM_O0142_3
     729  m_cSPS.setSpsExtensionFlag              ( true );
     730  m_cSPS.setSpsExtensionTypeFlag          ( PS_EX_T_MV ,true );
     731#if H_3D
     732  m_cSPS.setSpsExtensionTypeFlag          ( PS_EX_T_3D ,true );
     733#endif
     734#endif
    724735#endif
    725736  m_cSPS.setPicWidthInLumaSamples         ( m_iSourceWidth      );
     
    808819    pcVUI->setOverscanInfoPresentFlag(getOverscanInfoPresentFlag());
    809820    pcVUI->setOverscanAppropriateFlag(getOverscanAppropriateFlag());
     821#if H_MV_6_PS_O0118_33
     822    pcVUI->setVideoSignalTypePresentFlag(getVideoSignalTypePresentFlag() && getLayerId() == 0 );
     823#else
    810824    pcVUI->setVideoSignalTypePresentFlag(getVideoSignalTypePresentFlag());
     825#endif
    811826    pcVUI->setVideoFormat(getVideoFormat());
    812827    pcVUI->setVideoFullRangeFlag(getVideoFullRangeFlag());
     
    922937  m_cPPS.setOutputFlagPresentFlag( false );
    923938#if H_MV
     939#if H_MV_6_RALS_O0149_11
     940  m_cPPS.setNumExtraSliceHeaderBits( 3 );
     941#else
    924942  m_cPPS.setNumExtraSliceHeaderBits( 2 );
     943#endif
    925944#endif
    926945  m_cPPS.setSignHideFlag(getSignHideFlag());
Note: See TracChangeset for help on using the changeset viewer.