Changeset 738 in 3DVCSoftware


Ignore:
Timestamp:
10 Dec 2013, 13:50:12 (10 years ago)
Author:
tech
Message:

Merged HTM-9.0-dev0@731. (MV-HEVC 6 HLS)

Location:
trunk
Files:
1 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/cfg/3D-HEVC/NonCTC/allintra/baseCfg_2view+depth_AllIntra.cfg

    r735 r738  
    167167DepthRefinement                     : 1                # Dispary refined by depth DoNBDV
    168168IvMvScaling                         : 1                # Interview motion vector scaling
    169 SubPULog2Size                       : 3                            # Log2 of sub-PU size for IvMvPred (2...6)
     169SubPULog2Size                       : 3                # Log2 of sub-PU size for IvMvPred (2...6)
    170170
    171171
  • trunk/cfg/3D-HEVC/NonCTC/allintra/baseCfg_3view+depth_AllIntra.cfg

    r735 r738  
    182182DepthRefinement                     : 1                # Dispary refined by depth DoNBDV
    183183IvMvScaling                         : 1                # Interview motion vector scaling
    184 SubPULog2Size                       : 3                            # Log2 of sub-PU size for IvMvPred (2...6)
     184SubPULog2Size                       : 3                # Log2 of sub-PU size for IvMvPred (2...6)
    185185
    186186
  • trunk/source/App/TAppDecoder/TAppDecCfg.cpp

    r608 r738  
    8585  ("OutputBitDepthC,d", m_outputBitDepthC, 0, "bit depth of YUV output chroma component (default: use 0 for native depth)")
    8686#if H_MV
     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
    8790  ("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
  • trunk/source/App/TAppDecoder/TAppDecCfg.h

    r608 r738  
    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  {}
  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r655 r738  
    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     
     214#if !H_MV_6_HRD_O0217_13
    203215      Int decIdx     = xGetDecoderIdx( nalu.m_layerId , true );
    204      
     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
    210232      {
     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
     
    216245        // - nalu.isSlice() == true     
    217246
     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;
    219266
    220267        if ( nalu.isSlice() && firstSlice )
     268#endif
    221269        {
    222270          layerIdCurrPic = nalu.m_layerId;
     
    832880{
    833881  Int decIdx = -1;
     882
     883#if H_MV_6_LAYER_ID_32
     884  if ( layerId > MAX_NUM_LAYER_IDS-1 ) 
     885  {
     886    return decIdx;
     887  }
     888#endif
     889
    834890  if ( m_layerIdToDecIdx[ layerId ] != -1 )
    835891  {     
     
    850906    m_tDecTop[ decIdx ]->setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
    851907    m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists );
     908#if H_MV_LAYER_WISE_STARTUP
     909    m_tDecTop[ decIdx ]->setLayerInitilizedFlags( m_layerInitilizedFlags );
     910#endif
     911
    852912#if H_3D
    853913   m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector );
  • trunk/source/App/TAppDecoder/TAppDecTop.h

    r655 r738  
    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
  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r724 r738  
    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
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r724 r738  
    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
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r735 r738  
    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 );
     
    13321336  Int maxViewId = xGetMax( m_viewId );
    13331337
     1338#if H_MV_6_PS_O0109_22
     1339  Int viewIdLen = gCeilLog2( maxViewId + 1 );
     1340  const Int maxViewIdLen = ( 1 << 4 ) - 1;
     1341  assert( viewIdLen <= maxViewIdLen );
     1342  vps.setViewIdLen( viewIdLen );
     1343#else
    13341344  Int viewIdLenMinus1 = std::max( gCeilLog2( maxViewId + 1 ) - 1, 0 ) ;
    13351345  const Int maxViewIdLenMinus1 = ( 1 << 4 ) - 1;
    13361346  assert( viewIdLenMinus1 <= maxViewIdLenMinus1  );
    13371347  vps.setViewIdLenMinus1( viewIdLenMinus1 );
     1348#endif
    13381349  for (Int i = 0; i < m_iNumberOfViews; i++)
    13391350  {
     
    13551366    }
    13561367    }
     1368
     1369#if H_MV_6_PS_O0096_21
     1370  Int  defaultDirectDependencyType = -1;
     1371  Bool defaultDirectDependencyFlag = true;
     1372#endif
    13571373  for( Int depLayer = 1; depLayer < m_numberOfLayers; depLayer++ )
    13581374  {
     
    13631379      Int refLayer = m_directRefLayers[depLayer][i];
    13641380      vps.setDirectDependencyFlag( depLayer, refLayer, true);
     1381#if H_MV_6_PS_O0096_21
     1382      Int curDirectDependencyType = m_dependencyTypes[depLayer][i];
     1383
     1384      if ( defaultDirectDependencyType != -1 )   
     1385      {
     1386        defaultDirectDependencyFlag = defaultDirectDependencyFlag && (curDirectDependencyType == defaultDirectDependencyType );         
     1387      }
     1388      else
     1389      {
     1390        defaultDirectDependencyType = curDirectDependencyType;
     1391      }
     1392     
     1393      vps.setDirectDependencyType( depLayer, refLayer, curDirectDependencyType);       
     1394#else
    13651395      vps.setDirectDependencyType( depLayer, refLayer,m_dependencyTypes[depLayer][i]);
    1366     }
    1367   }
     1396#endif
     1397    }
     1398  }
     1399
     1400#if H_MV_6_PS_O0096_21
     1401  vps.setDefaultDirectDependencyFlag( defaultDirectDependencyFlag );       
     1402  vps.setDefaultDirectDependencyType( defaultDirectDependencyFlag ? defaultDirectDependencyType : -1 );       
     1403#endif
     1404
     1405#if H_MV_6_ILDSD_O0120_26
     1406  // Max sub layers, + presence flag
     1407  Bool subLayersMaxMinus1PresentFlag = false;
     1408  Int  subLayersMaxMinus1 = -1;
     1409  for (Int curLayerIdInVps = 0; curLayerIdInVps < m_numberOfLayers; curLayerIdInVps++ )
     1410  {
     1411    Int curSubLayersMaxMinus1 = -1;
     1412    for( Int i = 0; i < getGOPSize(); i++ )
     1413    {
     1414      GOPEntry geCur =  m_GOPListMvc[curLayerIdInVps][i];
     1415      curSubLayersMaxMinus1 = std::max( curSubLayersMaxMinus1, geCur.m_temporalId );
     1416    } 
     1417
     1418    vps.setSubLayersVpsMaxMinus1( curLayerIdInVps, curSubLayersMaxMinus1 );
     1419    if ( subLayersMaxMinus1 == -1 )
     1420    {
     1421      subLayersMaxMinus1 = curSubLayersMaxMinus1;
     1422    }
     1423    else
     1424    {
     1425      subLayersMaxMinus1PresentFlag = subLayersMaxMinus1PresentFlag || ( curSubLayersMaxMinus1 != subLayersMaxMinus1 );
     1426    }
     1427  }
     1428
     1429  vps.setVpsSubLayersMaxMinus1PresentFlag( subLayersMaxMinus1PresentFlag );
     1430#endif
     1431
    13681432
    13691433  // Max temporal id for inter layer reference pictures + presence flag
     
    13711435  for ( Int refLayerIdInVps = 0; refLayerIdInVps < m_numberOfLayers; refLayerIdInVps++)
    13721436    {
     1437#if !H_MV_6_ILDDS_O0225_30
    13731438    Int maxTid = -1;
     1439#endif
    13741440    for ( Int curLayerIdInVps = 1; curLayerIdInVps < m_numberOfLayers; curLayerIdInVps++)
    13751441      {
     1442#if H_MV_6_ILDDS_O0225_30
     1443      Int maxTid = -1;
     1444#endif
    13761445      for( Int i = 0; i < getGOPSize(); i++ )
    13771446      {       
     
    13871456        }
    13881457      }
     1458#if H_MV_6_ILDDS_O0225_30   
     1459      vps.setMaxTidIlRefPicsPlus1( refLayerIdInVps, curLayerIdInVps, maxTid + 1 );
     1460      maxTidRefPresentFlag = maxTidRefPresentFlag || ( maxTid != 6 );   
     1461    }
     1462#else
    13891463    }
    13901464    vps.setMaxTidIlRefPicPlus1( refLayerIdInVps, maxTid + 1 );
    13911465    maxTidRefPresentFlag = maxTidRefPresentFlag || ( maxTid != 6 );   
     1466#endif
    13921467  }
    13931468
     
    14061481  vps.setMaxOneActiveRefLayerFlag( maxOneActiveRefLayerFlag );
    14071482 
     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
    14081493 
    14091494  // All Ref layers active flag
     
    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( );
     
    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}
     
    16831970    if( vps.getUseDLTFlag( layer ) )
    16841971    {
     1972#if H_MV_LAYER_WISE_STARTUP
     1973      xAnalyzeInputBaseDepth(layer, max(  m_iIntraPeriod[layer], 24), &vps);
     1974#else
    16851975      xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod, 24), &vps);
     1976#endif
    16861977    }
    16871978#endif
     
    17202011}
    17212012#endif
     2013#endif
    17222014//! \}
  • trunk/source/App/TAppEncoder/TAppEncTop.h

    r655 r738  
    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 );
  • trunk/source/Lib/TLibCommon/CommonDef.h

    r736 r738  
    6060
    6161#if H_MV
    62 #define NV_VERSION        "9.0r1"               ///< Current software version
     62#define NV_VERSION        "9.1"                 ///< Current software version
    6363#define HM_VERSION        "12.0"                ///<
    6464#else
     
    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
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r655 r738  
    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
     
    530530  return getPic   ( m_vps->getLayerIdInNuh( viewIndex, depthFlag ), poc );
    531531}
    532 
     532#endif
    533533Void TComPicLists::print()
    534534{
     
    571571}
    572572
     573#if H_3D
    573574TComPicYuv* TComPicLists::getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon )
    574575
     
    593594}
    594595#endif
    595 #endif // H_3D
     596#endif
    596597#endif // H_MV
    597598
  • trunk/source/Lib/TLibCommon/TComRom.cpp

    r724 r738  
    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  )
  • trunk/source/Lib/TLibCommon/TComRom.h

    r724 r738  
    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
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r724 r738  
    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
    17121718, m_vpsVUI                 (  NULL )
     
    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++)
     
    17491763    }
    17501764  }
    1751  
     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++ )
     
    20742109  }
    20752110  return numLayersInIdList;
    2076 }
     2111#endif
     2112}
     2113
     2114#if H_MV_6_HRD_O0217_13
     2115Int    TComVPS::getNumOutputLayerSets()
     2116{
     2117  Int numOutputLayerSets = getVpsNumberLayerSetsMinus1( ) + 1;
     2118  if ( getMoreOutputLayerSetsThanDefaultFlag( ) )
     2119  {     
     2120    numOutputLayerSets += (getNumAddOutputLayerSetsMinus1( ) + 1);
     2121}
     2122  return numOutputLayerSets;
     2123}
     2124#endif
     2125
    20772126Int TComVPS::getNumViews()
    20782127{
     
    21042153  return dependentFlag;
    21052154}
     2155
     2156#if H_MV_6_HRD_O0217_13
     2157Void TComVPS::deriveLayerSetLayerIdList()
     2158{
     2159  m_layerSetLayerIdList.resize( getVpsNumLayerSetsMinus1() + 1 );
     2160  for (Int i = 0; i <= getVpsNumLayerSetsMinus1(); i++ )
     2161  {
     2162    for( Int m = 0; m  <= getVpsMaxLayerId(); m++ )
     2163    {
     2164      if( getLayerIdIncludedFlag( i, m) )
     2165      {
     2166        m_layerSetLayerIdList[ i ].push_back( m );       
     2167      }
     2168    }
     2169  }
     2170}
     2171
     2172Void TComVPS::deriveTargetLayerIdLists()
     2173{
     2174  m_targetDecLayerIdLists.resize( getNumOutputLayerSets() );
     2175  m_targetOptLayerIdLists.resize( getNumOutputLayerSets() );
     2176
     2177  for (Int targetOptLayerSetIdx = 0; targetOptLayerSetIdx < getNumOutputLayerSets(); targetOptLayerSetIdx++ )
     2178  {
     2179    Int targetDecLayerSetIdx = getOutputLayerSetIdxMinus1( targetOptLayerSetIdx ) + 1;     
     2180    Int lsIdx                = targetDecLayerSetIdx;
     2181
     2182    for( Int j = 0; j < getNumLayersInIdList( lsIdx ); j++ )
     2183    {
     2184      m_targetDecLayerIdLists[targetOptLayerSetIdx].push_back( m_layerSetLayerIdList[ lsIdx ][ j ] );
     2185      if( getOutputLayerFlag( targetOptLayerSetIdx, j  )) // This seems to be wrong in draft text
     2186      {
     2187        m_targetOptLayerIdLists[targetOptLayerSetIdx].push_back( m_layerSetLayerIdList[ lsIdx ][ j ] );
     2188      }
     2189    } 
     2190  }
     2191}
     2192#endif
    21062193#endif // H_MV
    21072194
     
    21572244, m_spsInferScalingListFlag   ( false )
    21582245, m_spsScalingListRefLayerId  ( 0 )
     2246
     2247#if !H_MV_6_PS_REP_FORM_18_19_20
    21592248, m_updateRepFormatFlag       ( true )
     2249#else
     2250, m_updateRepFormatFlag       ( false )
     2251, m_spsRepFormatIdx           ( 0 )
     2252#endif
    21602253, m_interViewMvVertConstraintFlag (false)
    21612254#endif
     
    21732266  ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps));
    21742267  ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag));
     2268#if H_MV_6_PSEM_O0142_3
     2269  m_spsExtensionFlag = false;
     2270  for( Int i = 0; i < PS_EX_T_MAX_NUM; i++ )
     2271  {
     2272    m_spsExtensionTypeFlag[ i ] = false;
     2273  }
     2274#endif
     2275#if H_MV_6_SHVC_O0098_36
     2276  m_numScaledRefLayerOffsets = 0;
     2277
     2278  for (Int i = 0; i < MAX_NUM_SCALED_REF_LAYERS; i++ )
     2279  {
     2280    m_scaledRefLayerId             [i] = -1;
     2281  }
     2282
     2283  for (Int i = 0; i < MAX_NUM_LAYERS; i++ )
     2284  {
     2285    m_scaledRefLayerLeftOffset     [i] = 0;
     2286    m_scaledRefLayerTopOffset      [i] = 0;
     2287    m_scaledRefLayerRightOffset    [i] = 0;
     2288    m_scaledRefLayerBottomOffset   [i] = 0;
     2289  }
     2290#endif
    21752291}
    21762292
     
    23532469  if ( layerIdCurr > 0 )
    23542470  {
     2471#if H_MV_6_PS_REP_FORM_18_19_20
     2472    Int            repFormatIdx = getUpdateRepFormatFlag() ?  getSpsRepFormatIdx() : vps->getVpsRepFormatIdx( vps->getLayerIdInVps( layerIdCurr ) ) ;
     2473    TComRepFormat* repFormat    = vps->getRepFormat( repFormatIdx );
     2474#else
    23552475    TComRepFormat* repFormat = vps->getRepFormat( vps->getVpsRepFormatIdx( vps->getLayerIdInVps( layerIdCurr ) ) );
    23562476    if ( !getUpdateRepFormatFlag() )
    23572477    {       
     2478#endif
    23582479      setChromaFormatIdc( repFormat->getChromaFormatVpsIdc() );         
    23592480      //// ToDo: add when supported:
     
    23682489      setBitDepthC             ( repFormat->getBitDepthVpsChromaMinus8() + 8 );
    23692490      setQpBDOffsetC           ( (Int) (6* ( getBitDepthC() -8 ) ) );
     2491#if !H_MV_6_PS_REP_FORM_18_19_20
    23702492    }
    23712493    else
     2494#else
     2495    if ( getLayerId() > 0 && getUpdateRepFormatFlag() )
     2496#endif
    23722497    {
    23732498      assert( getChromaFormatIdc()      <=  repFormat->getChromaFormatVpsIdc()         );
     
    27152840Void TComSlice::markIvRefPicsAsUnused( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc )
    27162841{
    2717   // Fill targetDecLayerIdSet with all layers if empty.
     2842  // Fill targetDecLayerIdSet with all layers if empty (at encoder side)
    27182843  if (targetDecLayerIdSet.size() == 0 )   
    27192844  {
     
    27392864    {
    27402865      TComPic* pcPic = ivPicLists->getPic( targetDecLayerIdSet[ i ], curPoc );
     2866#if H_MV_LAYER_WISE_STARTUP
     2867      if ( pcPic )
     2868      {
     2869#endif
    27412870      if( pcPic->getSlice(0)->isReferenced() && pcPic->getSlice(0)->getTemporalLayerNonReferenceFlag() )
    27422871      {
     
    27612890      }
    27622891    }
     2892#if H_MV_LAYER_WISE_STARTUP
     2893      }
     2894#endif
    27632895  }
    27642896}
     
    28162948  return pcPic;
    28172949}
     2950
     2951
     2952#if H_MV_6_ILDDS_ILREFPICS_27_34
     2953Int  TComSlice::getRefLayerPicFlag( Int i )
     2954{
     2955  TComVPS* vps = getVPS();
     2956  Int refLayerIdx = vps->getLayerIdInVps( vps->getRefLayerId( getLayerId(), i ) );
     2957
     2958  Bool refLayerPicFlag = ( vps->getSubLayersVpsMaxMinus1( refLayerIdx ) >=  getTLayer() )  &&
     2959    ( vps->getMaxTidIlRefPicsPlus1( refLayerIdx, vps->getLayerIdInVps( getLayerId() )) > getTLayer() );
     2960
     2961  return refLayerPicFlag;       
     2962}   
     2963
     2964Int TComSlice::getRefLayerPicIdc( Int j )
     2965
     2966  Int refLayerPicIdc = -1;
     2967  Int curj = 0;
     2968  for( Int i = 0;  i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ )
     2969  {
     2970    if( getRefLayerPicFlag( i ) )
     2971    {
     2972      if ( curj == j )
     2973      {
     2974        refLayerPicIdc = i;         
     2975        break;
     2976      }
     2977      curj++;
     2978    }
     2979  }
     2980
     2981  assert( curj == j );
     2982  assert( refLayerPicIdc != -1 );
     2983  return refLayerPicIdc;
     2984}
     2985
     2986Int  TComSlice::getNumRefLayerPics( )
     2987
     2988  Int numRefLayerPics = 0;
     2989  for( Int i = 0;  i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ )
     2990  {
     2991    numRefLayerPics += getRefLayerPicFlag( i );
     2992  }
     2993  return numRefLayerPics;
     2994}
     2995#endif
     2996
     2997
     2998
    28182999Int TComSlice::getNumActiveRefLayerPics()
    28193000{
     
    28263007  else if (getVPS()->getAllRefLayersActiveFlag() )
    28273008  {
     3009#if H_MV_6_ILDDS_ILREFPICS_27_34
     3010    numActiveRefLayerPics = getNumRefLayerPics();
     3011#else
    28283012    numActiveRefLayerPics = getVPS()->getNumDirectRefLayers( getLayerId() );
     3013#endif
    28293014  }
    28303015  else if ( !getInterLayerPredEnabledFlag() )
     
    28343019  else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerId() ) == 1 )
    28353020  {
     3021#if H_MV_6_ILDDS_ILREFPICS_27_34
     3022    numActiveRefLayerPics = getRefLayerPicFlag( 0 ) ? 1 : 0;
     3023#else
    28363024    numActiveRefLayerPics = 1;
     3025#endif
    28373026  }
    28383027  else
     
    34343623TComVPSVUI::TComVPSVUI()
    34353624{
     3625#if H_MV_6_PS_O0223_29
     3626  m_crossLayerIrapAlignedFlag = true;
     3627#endif
    34363628  m_bitRatePresentVpsFlag = false;
    34373629  m_picRatePresentVpsFlag = false;
     
    34613653    }
    34623654  }
    3463 }
    3464 #endif
     3655#if H_MV_6_PS_O0118_33 
     3656  for ( Int i = 0; i < MAX_NUM_VIDEO_SIGNAL_INFO; i++ )
     3657  {
     3658    m_videoSignalInfo          [i] = NULL;     
     3659  }
     3660#endif
     3661
     3662#if H_MV_6_HRD_O0164_15
     3663  m_vpsVuiBspHrdPresentFlag = false;
     3664  m_vpsVuiBspHrdParameters  = new TComVpsVuiBspHrdParameters();
     3665#endif
     3666}
     3667
     3668#if H_MV_6_PS_O0118_33
     3669TComVPSVUI::~TComVPSVUI()
     3670{
     3671  for ( Int i = 0; i < MAX_NUM_VIDEO_SIGNAL_INFO; i++ )
     3672  {
     3673    if (m_videoSignalInfo[ i ] != NULL )      delete m_videoSignalInfo[ i ];   
     3674    m_videoSignalInfo    [ i ] = NULL;
     3675  }
     3676
     3677#if H_MV_6_HRD_O0164_15
     3678  if ( m_vpsVuiBspHrdParameters ) delete m_vpsVuiBspHrdParameters;
     3679  m_vpsVuiBspHrdParameters = NULL;
     3680#endif
     3681}
     3682#endif
     3683
     3684#if H_MV_6_PS_REP_FORM_18_19_20
     3685Void TComRepFormat::inferChromaAndBitDepth( TComRepFormat* prevRepFormat, Bool encoderFlag )
     3686{
     3687  if ( !encoderFlag )
     3688  {
     3689    setChromaAndBitDepthVpsPresentFlag( prevRepFormat->getChromaAndBitDepthVpsPresentFlag() );
     3690    setSeparateColourPlaneVpsFlag     ( prevRepFormat->getSeparateColourPlaneVpsFlag     () );
     3691    setBitDepthVpsLumaMinus8          ( prevRepFormat->getBitDepthVpsLumaMinus8          () );
     3692    setBitDepthVpsChromaMinus8        ( prevRepFormat->getBitDepthVpsChromaMinus8        () );
     3693  }
     3694  else
     3695  {
     3696    assert( getChromaAndBitDepthVpsPresentFlag() == prevRepFormat->getChromaAndBitDepthVpsPresentFlag() );
     3697    assert( getSeparateColourPlaneVpsFlag     () == prevRepFormat->getSeparateColourPlaneVpsFlag     () );
     3698    assert( getBitDepthVpsLumaMinus8          () == prevRepFormat->getBitDepthVpsLumaMinus8          () );
     3699    assert( getBitDepthVpsChromaMinus8        () == prevRepFormat->getBitDepthVpsChromaMinus8        () );
     3700}
     3701}
     3702#endif
     3703
     3704#if H_MV_6_HRD_O0164_15
     3705Void TComVpsVuiBspHrdParameters::checkLayerInBspFlag( TComVPS* vps, Int h )
     3706{
     3707  // It is a requirement of bitstream conformance that bitstream partition with index j shall not include
     3708  // direct or indirect reference layers of any layers in bitstream partition i for any values of i and j
     3709  // in the range of 0 to num_bitstream_partitions[ h ] – 1, inclusive, such that i is less than j.
     3710
     3711  for ( Int partJ = 0; partJ < getNumBitstreamPartitions( h ); partJ++ )
     3712  {       
     3713    for ( Int partI = 0; partI < partJ; partI++ )
     3714    {
     3715      for ( Int layerJ = 0; layerJ < vps->getMaxLayersMinus1(); layerJ++ )
     3716      {
     3717        if ( m_layerInBspFlag[ h ][partJ][layerJ ] )
     3718        {
     3719          for ( Int layerI = 0; layerI < vps->getMaxLayersMinus1(); layerI++ )
     3720          {
     3721            if ( m_layerInBspFlag[ h ][partI][layerI] )
     3722            {
     3723              assert( !vps->getInDirectDependencyFlag( layerI, layerJ ) );
     3724            }
     3725          }
     3726        }
     3727      }
     3728    }
     3729  }
     3730}
     3731#endif
     3732#endif
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r724 r738  
    6262// ====================================================================================================================
    6363
     64#if H_MV_6_HRD_O0164_15
     65class TComVPS;
     66#endif
    6467/// Reference Picture Set class
    6568class TComReferencePictureSet
     
    403406
    404407#if H_MV
     408
     409#if H_MV_6_PS_O0118_33
     410class TComVideoSignalInfo
     411{
     412private:
     413  Int  m_videoVpsFormat;
     414  Bool m_videoFullRangeVpsFlag;
     415  Int  m_colourPrimariesVps;
     416  Int  m_transferCharacteristicsVps;
     417  Int  m_matrixCoeffsVps;
     418public:
     419  Void setVideoVpsFormat( Int  val ) { m_videoVpsFormat = val; }
     420  Int  getVideoVpsFormat(  ) { return m_videoVpsFormat; }
     421
     422  Void setVideoFullRangeVpsFlag( Bool flag ) { m_videoFullRangeVpsFlag = flag; }
     423  Bool getVideoFullRangeVpsFlag(  ) { return m_videoFullRangeVpsFlag; }
     424
     425  Void setColourPrimariesVps( Int  val ) { m_colourPrimariesVps = val; }
     426  Int  getColourPrimariesVps(  ) { return m_colourPrimariesVps; }
     427
     428  Void setTransferCharacteristicsVps( Int  val ) { m_transferCharacteristicsVps = val; }
     429  Int  getTransferCharacteristicsVps(  ) { return m_transferCharacteristicsVps; }
     430
     431  Void setMatrixCoeffsVps( Int  val ) { m_matrixCoeffsVps = val; }
     432  Int  getMatrixCoeffsVps(  ) { return m_matrixCoeffsVps; }
     433};
     434#endif
     435#if H_MV_6_HRD_O0164_15
     436class TComVpsVuiBspHrdParameters
     437{
     438private:
     439  Int  m_vpsNumBspHrdParametersMinus1;
     440  Bool m_bspCprmsPresentFlag[MAX_NUM_BSP_HRD_PARAMETERS];
     441  Int  m_numBitstreamPartitions[MAX_VPS_OP_SETS_PLUS1];
     442  Bool m_layerInBspFlag[MAX_VPS_OP_SETS_PLUS1][MAX_NUM_BSP_HRD_PARAMETERS][MAX_NUM_LAYERS];
     443  Int  m_numBspSchedCombinations[MAX_VPS_OP_SETS_PLUS1];
     444  Int  m_bspCombHrdIdx[MAX_VPS_OP_SETS_PLUS1][MAX_NUM_BSP_HRD_PARAMETERS][MAX_NUM_BSP_SCHED_COMBINATION];
     445  Int  m_bspCombSchedIdx[MAX_VPS_OP_SETS_PLUS1][MAX_NUM_BSP_HRD_PARAMETERS][MAX_NUM_BSP_SCHED_COMBINATION];
     446  TComHRD* m_hrdParameters[MAX_NUM_BSP_HRD_PARAMETERS];
     447public:
     448
     449  Void setVpsNumBspHrdParametersMinus1( Int  val ) { m_vpsNumBspHrdParametersMinus1 = val; }
     450  Int  getVpsNumBspHrdParametersMinus1(  ) { return m_vpsNumBspHrdParametersMinus1; }
     451
     452  Void setBspCprmsPresentFlag( Int i, Bool flag ) { m_bspCprmsPresentFlag[i] = flag; }
     453  Bool getBspCprmsPresentFlag( Int i ) { return m_bspCprmsPresentFlag[i]; }
     454
     455  Void setNumBitstreamPartitions( Int h, Int  val ) { m_numBitstreamPartitions[h] = val; }
     456  Int  getNumBitstreamPartitions( Int h ) { return m_numBitstreamPartitions[h]; }
     457
     458  Void setLayerInBspFlag( Int h, Int i, Int j, Bool flag ) { m_layerInBspFlag[h][i][j] = flag; }
     459  Bool getLayerInBspFlag( Int h, Int i, Int j ) { return m_layerInBspFlag[h][i][j]; }
     460  Void checkLayerInBspFlag ( TComVPS* vps, Int h ); 
     461
     462  Void setNumBspSchedCombinations( Int h, Int  val ) { m_numBspSchedCombinations[h] = val; }
     463  Int  getNumBspSchedCombinations( Int h ) { return m_numBspSchedCombinations[h]; }
     464
     465  Void setBspCombHrdIdx( Int h, Int i, Int j, Int  val ) { m_bspCombHrdIdx[h][i][j] = val; }
     466  Int  getBspCombHrdIdx( Int h, Int i, Int j ) { return m_bspCombHrdIdx[h][i][j]; }
     467
     468  Void setBspCombSchedIdx( Int h, Int i, Int j, Int  val ) { m_bspCombSchedIdx[h][i][j] = val; }
     469  Int  getBspCombSchedIdx( Int h, Int i, Int j ) { return m_bspCombSchedIdx[h][i][j]; }
     470
     471  Void setHrdParametermeters( Int k, TComHRD* val  ) {  m_hrdParameters[k] = val; };
     472  TComHRD* getHrdParametermeters( Int k ) {  return m_hrdParameters[k]; };
     473};
     474
     475#endif
    405476class TComVPSVUI
    406477{
    407478private:
     479#if H_MV_6_PS_O0223_29
     480  Bool m_crossLayerPicTypeAlignedFlag;
     481  Bool m_crossLayerIrapAlignedFlag;
     482#endif
    408483  Bool m_bitRatePresentVpsFlag;
    409484  Bool m_picRatePresentVpsFlag;
     
    414489  Int  m_constantPicRateIdc          [MAX_VPS_OP_SETS_PLUS1][MAX_TLAYER];
    415490  Int  m_avgPicRate                  [MAX_VPS_OP_SETS_PLUS1][MAX_TLAYER];
     491#if H_MV_6_O0226_37
     492  Bool m_tilesNotInUseFlag;
     493  Bool m_tilesInUseFlag              [MAX_NUM_LAYERS];
     494  Bool m_loopFilterNotAcrossTilesFlag[MAX_NUM_LAYERS];
     495#endif 
    416496  Bool m_tileBoundariesAlignedFlag   [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
     497#if H_MV_6_O0226_37
     498  Bool m_wppNotInUseFlag;
     499  Bool m_wppInUseFlag                [MAX_NUM_LAYERS];
     500#endif
    417501  Bool m_ilpRestrictedRefLayersFlag;
    418502  Int  m_minSpatialSegmentOffsetPlus1[MAX_NUM_LAYERS][MAX_NUM_LAYERS];
    419503  Bool m_ctuBasedOffsetEnabledFlag   [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
    420504  Int  m_minHorizontalCtuOffsetPlus1 [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
     505#if H_MV_6_PS_O0118_33
     506  Bool m_videoSignalInfoIdxPresentFlag;
     507  Int  m_vpsNumVideoSignalInfoMinus1;
     508  TComVideoSignalInfo* m_videoSignalInfo[MAX_NUM_VIDEO_SIGNAL_INFO];   
     509  Int  m_vpsVideoSignalInfoIdx       [MAX_NUM_VIDEO_SIGNAL_INFO];
     510#endif
     511#if H_MV_6_HRD_O0164_15
     512  Bool m_vpsVuiBspHrdPresentFlag;
     513  TComVpsVuiBspHrdParameters* m_vpsVuiBspHrdParameters;
     514#endif
    421515
    422516public:
    423   TComVPSVUI();;
     517  TComVPSVUI();
     518  ~TComVPSVUI();
     519#if H_MV_6_PS_O0223_29
     520  Void setCrossLayerPicTypeAlignedFlag( Bool flag ) { m_crossLayerPicTypeAlignedFlag = flag; }
     521  Bool getCrossLayerPicTypeAlignedFlag(  ) { return m_crossLayerPicTypeAlignedFlag; }
     522
     523  Void setCrossLayerIrapAlignedFlag( Bool flag ) { m_crossLayerIrapAlignedFlag = flag; }
     524  Bool getCrossLayerIrapAlignedFlag(  ) { return m_crossLayerIrapAlignedFlag; }
     525#endif
    424526
    425527  Void setBitRatePresentVpsFlag( Bool flag ) { m_bitRatePresentVpsFlag = flag; }
     
    447549  Int  getAvgPicRate( Int i, Int j ) { return m_avgPicRate[i][j]; }
    448550
     551#if H_MV_6_O0226_37
     552  Void setTilesNotInUseFlag( Bool flag ) { m_tilesNotInUseFlag = flag; }
     553  Bool getTilesNotInUseFlag(  ) { return m_tilesNotInUseFlag; }
     554
     555  Void setTilesInUseFlag( Int i, Bool flag ) { m_tilesInUseFlag[i] = flag; }
     556  Bool getTilesInUseFlag( Int i ) { return m_tilesInUseFlag[i]; }
     557
     558  Void setLoopFilterNotAcrossTilesFlag( Int i, Int  val ) { m_loopFilterNotAcrossTilesFlag[i] = val; }
     559  Bool getLoopFilterNotAcrossTilesFlag( Int i ) { return m_loopFilterNotAcrossTilesFlag[i]; }
     560#endif
     561
    449562  Void setTileBoundariesAlignedFlag( Int i, Int j, Bool flag ) { m_tileBoundariesAlignedFlag[i][j] = flag; }
    450563  Bool getTileBoundariesAlignedFlag( Int i, Int j ) { return m_tileBoundariesAlignedFlag[i][j]; }
    451564
     565#if H_MV_6_O0226_37
     566  Void setWppNotInUseFlag( Bool flag ) { m_wppNotInUseFlag = flag; }
     567  Bool getWppNotInUseFlag(  ) { return m_wppNotInUseFlag; }
     568
     569  Void setWppInUseFlag( Int i, Bool flag ) { m_wppInUseFlag[i] = flag; }
     570  Bool getWppInUseFlag( Int i ) { return m_wppInUseFlag[i]; }
     571#endif
     572
    452573  Void setIlpRestrictedRefLayersFlag( Bool flag ) { m_ilpRestrictedRefLayersFlag = flag; }
    453574  Bool getIlpRestrictedRefLayersFlag(  ) { return m_ilpRestrictedRefLayersFlag; }
     
    462583  Int  getMinHorizontalCtuOffsetPlus1( Int i, Int j ) { return m_minHorizontalCtuOffsetPlus1[i][j]; }
    463584
     585#if H_MV_6_PS_O0118_33
     586  Void setVideoSignalInfoIdxPresentFlag( Bool flag ) { m_videoSignalInfoIdxPresentFlag = flag; }
     587  Bool getVideoSignalInfoIdxPresentFlag(  ) { return m_videoSignalInfoIdxPresentFlag; }
     588
     589  Void    setVideoSignalInfo( Int i, TComVideoSignalInfo* val )                        { m_videoSignalInfo[i] = val;  } 
     590  TComVideoSignalInfo* getVideoSignalInfo( Int i )                                     { return m_videoSignalInfo[i]; }
     591
     592  Void setVpsNumVideoSignalInfoMinus1( Int  val ) { m_vpsNumVideoSignalInfoMinus1 = val; }
     593  Int  getVpsNumVideoSignalInfoMinus1(  ) { return m_vpsNumVideoSignalInfoMinus1; }
     594
     595  Void setVpsVideoSignalInfoIdx( Int i, Int  val ) { m_vpsVideoSignalInfoIdx[i] = val; }
     596  Int  getVpsVideoSignalInfoIdx( Int i ) { return m_vpsVideoSignalInfoIdx[i]; }
     597#endif
     598
     599#if H_MV_6_HRD_O0164_15
     600  Void setVpsVuiBspHrdPresentFlag( Bool flag ) { m_vpsVuiBspHrdPresentFlag = flag; }
     601  Bool getVpsVuiBspHrdPresentFlag(  ) { return m_vpsVuiBspHrdPresentFlag; }
     602
     603  Void setVpsVuiBspHrdParameters( TComVpsVuiBspHrdParameters* val) {  m_vpsVuiBspHrdParameters = val; }
     604  TComVpsVuiBspHrdParameters* getVpsVuiBspHrdParameters(  ) { return m_vpsVuiBspHrdParameters; }
     605#endif
    464606};
    465607
     
    467609{
    468610private:
     611#if H_MV_6_PS_REP_FORM_18_19_20
     612  Bool m_chromaAndBitDepthVpsPresentFlag;
     613#endif
    469614  Int  m_chromaFormatVpsIdc;
    470615  Bool m_separateColourPlaneVpsFlag;
     
    477622  TComRepFormat() { }; 
    478623
     624#if H_MV_6_PS_REP_FORM_18_19_20
     625  Void setChromaAndBitDepthVpsPresentFlag( Bool flag ) { m_chromaAndBitDepthVpsPresentFlag = flag; }
     626  Bool getChromaAndBitDepthVpsPresentFlag(  ) { return m_chromaAndBitDepthVpsPresentFlag; }
     627  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. 
     628  Void inferChromaAndBitDepth( TComRepFormat* prevRepFormat, Bool encoderFlag );
     629#endif
     630
    479631  Void setChromaFormatVpsIdc( Int  val ) { m_chromaFormatVpsIdc = val; }
    480632  Int  getChromaFormatVpsIdc(  ) { return m_chromaFormatVpsIdc; }
     
    494646  Void setBitDepthVpsChromaMinus8( Int  val ) { m_bitDepthVpsChromaMinus8 = val; }
    495647  Int  getBitDepthVpsChromaMinus8(  ) { return m_bitDepthVpsChromaMinus8; }
     648};
     649#endif
     650
     651#if H_MV_6_HRD_O0217_13
     652class TComDpbSize
     653{
     654private:
     655  Bool  m_subLayerFlagInfoPresentFlag[MAX_VPS_OUTPUTLAYER_SETS];
     656  Bool  m_subLayerDpbInfoPresentFlag [MAX_VPS_OUTPUTLAYER_SETS][MAX_TLAYER];
     657  Int   m_maxVpsDecPicBufferingMinus1[MAX_VPS_OUTPUTLAYER_SETS][MAX_NUM_LAYER_IDS][MAX_TLAYER];;
     658  Int   m_maxVpsNumReorderPics       [MAX_VPS_OUTPUTLAYER_SETS][MAX_TLAYER];
     659  Int   m_maxVpsLatencyIncreasePlus1 [MAX_VPS_OUTPUTLAYER_SETS][MAX_TLAYER];
     660
     661public:
     662  TComDpbSize( )
     663  {
     664    for (Int i = 0; i < MAX_VPS_OUTPUTLAYER_SETS; i++ )
     665    {     
     666      m_subLayerFlagInfoPresentFlag[i]  = false;
     667
     668      for (Int j = 0; j < MAX_TLAYER; j++  )
     669      {       
     670        m_subLayerDpbInfoPresentFlag [i][j] = ( j == 0) ;
     671        m_maxVpsNumReorderPics       [i][j] = 0;
     672        m_maxVpsLatencyIncreasePlus1 [i][j] = 0;
     673
     674        for (Int k = 0; k < MAX_NUM_LAYER_IDS; k++ )
     675        {
     676          m_maxVpsDecPicBufferingMinus1[i][k][j] = 0;
     677        }
     678      }
     679    } 
     680  } 
     681
     682  Void setSubLayerFlagInfoPresentFlag( Int i, Bool flag ) { m_subLayerFlagInfoPresentFlag[i] = flag; }
     683  Bool getSubLayerFlagInfoPresentFlag( Int i ) { return m_subLayerFlagInfoPresentFlag[i]; }
     684
     685  Void setSubLayerDpbInfoPresentFlag( Int i, Int j, Bool flag ) { m_subLayerDpbInfoPresentFlag[i][j] = flag; }
     686  Bool getSubLayerDpbInfoPresentFlag( Int i, Int j ) { return m_subLayerDpbInfoPresentFlag[i][j]; }
     687
     688  Void setMaxVpsDecPicBufferingMinus1( Int i, Int k, Int j, Int  val ) { m_maxVpsDecPicBufferingMinus1[i][k][j] = val; }
     689  Int  getMaxVpsDecPicBufferingMinus1( Int i, Int k, Int j ) { return m_maxVpsDecPicBufferingMinus1[i][k][j]; }
     690
     691  Void setMaxVpsNumReorderPics( Int i, Int j, Int  val ) { m_maxVpsNumReorderPics[i][j] = val; }
     692  Int  getMaxVpsNumReorderPics( Int i, Int j ) { return m_maxVpsNumReorderPics[i][j]; }
     693
     694  Void setMaxVpsLatencyIncreasePlus1( Int i, Int j, Int  val ) { m_maxVpsLatencyIncreasePlus1[i][j] = val; }
     695  Int  getMaxVpsLatencyIncreasePlus1( Int i, Int j ) { return m_maxVpsLatencyIncreasePlus1[i][j]; }
    496696};
    497697#endif
     
    547747  Int         m_layerIdInNuh             [MAX_NUM_LAYER_IDS];
    548748  Int         m_dimensionId              [MAX_NUM_LAYER_IDS][MAX_NUM_SCALABILITY_TYPES]; 
     749
     750#if H_MV_6_PS_O0109_22
     751  Int         m_viewIdLen;
     752#else
    549753  Int         m_viewIdLenMinus1;
     754#endif
    550755  Int         m_viewIdVal                [MAX_NUM_LAYERS];
    551756  Bool        m_directDependencyFlag     [MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS];
     757#if H_MV_6_ILDSD_O0120_26
     758  Bool        m_vpsSubLayersMaxMinus1PresentFlag;
     759  Int         m_subLayersVpsMaxMinus1    [MAX_NUM_LAYERS];
     760#endif
    552761  Bool        m_maxTidRefPresentFlag;
     762#if H_MV_6_ILDDS_O0225_30
     763  Int         m_maxTidIlRefPicsPlus1     [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
     764#else
    553765  Int         m_maxTidIlRefPicPlus1      [MAX_NUM_LAYERS];
     766#endif
    554767  Bool        m_allRefLayersActiveFlag;
    555768  Int         m_vpsNumberLayerSetsMinus1;
     
    559772  Bool        m_moreOutputLayerSetsThanDefaultFlag;
    560773  Int         m_numAddOutputLayerSetsMinus1;   
     774#if H_MV_6_PS_0109_25
     775  Int         m_defaultOneTargetOutputLayerIdc;
     776#else
    561777  Bool        m_defaultOneTargetOutputLayerFlag;
     778#endif
    562779  Int         m_outputLayerSetIdxMinus1  [MAX_VPS_OUTPUTLAYER_SETS]; 
    563780  Bool        m_outputLayerFlag          [MAX_VPS_OUTPUTLAYER_SETS][MAX_VPS_NUH_LAYER_ID_PLUS1];
    564781  Int         m_profileLevelTierIdx      [MAX_VPS_OUTPUTLAYER_SETS ];
     782#if H_MV_6_GEN_0153_28
     783  Bool        m_altOutputLayerFlag;
     784#endif
    565785  Bool        m_repFormatIdxPresentFlag;
    566786  Int         m_vpsNumRepFormatsMinus1;
     
    568788  TComRepFormat* m_repFormat             [MAX_NUM_LAYERS];
    569789  Bool        m_maxOneActiveRefLayerFlag;       
     790#if H_MV_6_MISC_O0062_31
     791  Bool        m_pocLsbNotPresentFlag     [MAX_NUM_LAYERS];
     792#endif
     793
     794#if H_MV_6_HRD_O0217_13
     795  TComDpbSize* m_dpbSize;
     796#endif
     797#if !H_MV_6_PS_O0223_29       
    570798  Bool        m_crossLayerIrapAlignedFlag;
     799#endif
    571800  Int         m_directDepTypeLenMinus2;         
     801#if H_MV_6_PS_O0096_21
     802  Bool        m_defaultDirectDependencyFlag;
     803  Int         m_defaultDirectDependencyType;
     804#endif
    572805  Bool        m_vpsVuiPresentFlag;
    573806  TComVPSVUI* m_vpsVUI;
     
    588821  Int         m_motionPredRefLayerId     [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
    589822  Int         m_viewIndex                [MAX_NUM_LAYERS   ];
     823 
     824#if H_MV_6_HRD_O0217_13
     825  std::vector< std::vector< Int> >       m_targetDecLayerIdLists;   //[TargetOptLayerSetIdx][i]
     826  std::vector< std::vector< Int> >       m_targetOptLayerIdLists;
     827  std::vector< std::vector< Int> >       m_layerSetLayerIdList;
     828#endif
     829
     830
    590831  Int         xGetDimBitOffset( Int j );
    591832 
     
    649890  UInt    getMaxTLayers  ()                   { return m_uiMaxTLayers;   }
    650891  Void    setMaxTLayers  (UInt t)             { m_uiMaxTLayers = t; }
    651  
     892#if H_MV_6_HRD_O0164_15
     893  UInt    getMaxSubLayersMinus1()             { return m_uiMaxTLayers - 1;  }  // For consistency with draft spec
     894#endif
    652895#if H_MV   
    653896  UInt    getMaxLayersMinus1()                { return m_uiMaxLayersMinus1;  };
     
    724967  Int     getDimensionId( Int layerIdInVps, Int scalIdx )                  { return m_dimensionId[layerIdInVps][scalIdx]; }
    725968
     969#if H_MV_6_PS_O0109_22
     970  Void    setViewIdLen( Int  val )                                         { m_viewIdLen = val; }
     971  Int     getViewIdLen(  )                                                 { return m_viewIdLen; }
     972#else
    726973  Void    setViewIdLenMinus1( Int  val )                                   { m_viewIdLenMinus1 = val; }
    727974  Int     getViewIdLenMinus1(  )                                           { return m_viewIdLenMinus1; }
     975#endif
    728976
    729977  Void    setViewIdVal( Int viewOrderIndex, Int  val )                     { m_viewIdVal[viewOrderIndex] = val; }
     
    731979  Void    setDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps, Bool val ) { m_directDependencyFlag[depLayeridInVps][refLayeridInVps] = val;  }
    732980  Bool    getDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps )           { return m_directDependencyFlag[depLayeridInVps][refLayeridInVps]; }
    733 
     981#if H_MV_6_ILDSD_O0120_26
     982  Void    setVpsSubLayersMaxMinus1PresentFlag( Bool flag )                 { m_vpsSubLayersMaxMinus1PresentFlag = flag; }
     983  Bool    getVpsSubLayersMaxMinus1PresentFlag(  )                          { return m_vpsSubLayersMaxMinus1PresentFlag; }
     984  Void    setSubLayersVpsMaxMinus1( Int i, Int  val )                      { m_subLayersVpsMaxMinus1[i] = val; }
     985  Int     getSubLayersVpsMaxMinus1( Int i )                                { return m_subLayersVpsMaxMinus1[i]; }
     986  Void    checkSubLayersVpsMaxMinus1( Int i )                              { assert( m_subLayersVpsMaxMinus1[i] >= 0 && m_subLayersVpsMaxMinus1[i] <= m_uiMaxTLayers - 1 ); }
     987#endif
    734988  Void    setMaxTidRefPresentFlag( Bool flag )                             { m_maxTidRefPresentFlag = flag; }
    735989  Bool    getMaxTidRefPresentFlag(  )                                      { return m_maxTidRefPresentFlag; }
     990#if H_MV_6_ILDDS_O0225_30
     991  Void    setMaxTidIlRefPicsPlus1( Int i, Int j, Int  val )                { m_maxTidIlRefPicsPlus1[i][j] = val; }
     992  Int     getMaxTidIlRefPicsPlus1( Int i, Int j )                          { return m_maxTidIlRefPicsPlus1[i][j]; }
     993#else
    736994  Void    setMaxTidIlRefPicPlus1( Int layerIdInVps, Int val )              { m_maxTidIlRefPicPlus1[ layerIdInVps ] = val;  }
    737995  Int     getMaxTidIlRefPicPlus1( Int layerIdInVps )                       { return m_maxTidIlRefPicPlus1[ layerIdInVps ]; }
     996#endif
    738997  Void    setAllRefLayersActiveFlag( Bool flag )                           { m_allRefLayersActiveFlag = flag; }
    739998  Bool    getAllRefLayersActiveFlag(  )                                    { return m_allRefLayersActiveFlag; }
     
    7491008  Void    setProfileRefMinus1( Int profileTierLevelIdx, Int val )          { m_profileRefMinus1[ profileTierLevelIdx ] = val;  }
    7501009  Int     getProfileRefMinus1( Int profileTierLevelIdx )                   { return m_profileRefMinus1[ profileTierLevelIdx ]; }
    751 
     1010#if H_MV_6_PS_O0109_23
     1011  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.
     1012#endif
    7521013  Void    setMoreOutputLayerSetsThanDefaultFlag( Bool flag )               { m_moreOutputLayerSetsThanDefaultFlag = flag; }
    7531014  Bool    getMoreOutputLayerSetsThanDefaultFlag()                          { return m_moreOutputLayerSetsThanDefaultFlag; }
     
    7561017  Int     getNumAddOutputLayerSetsMinus1( )                                { return m_numAddOutputLayerSetsMinus1; }
    7571018 
     1019#if H_MV_6_PS_0109_25 
     1020  Void    setDefaultOneTargetOutputLayerIdc( Int  val )                    { m_defaultOneTargetOutputLayerIdc = val; }
     1021  Int     getDefaultOneTargetOutputLayerIdc(  )                            { return m_defaultOneTargetOutputLayerIdc; }
     1022  Void    checkDefaultOneTargetOutputLayerIdc( )                           { assert( m_defaultOneTargetOutputLayerIdc >= 0 && m_defaultOneTargetOutputLayerIdc <= 1 ); }
     1023#else
    7581024  Void    setDefaultOneTargetOutputLayerFlag( Bool flag )                  { m_defaultOneTargetOutputLayerFlag = flag; }
    7591025  Bool    getDefaultOneTargetOutputLayerFlag( )                            { return m_defaultOneTargetOutputLayerFlag; }
     1026#endif
    7601027 
    7611028  Void    setOutputLayerSetIdxMinus1( Int outLayerSetIdx, Int val )        { m_outputLayerSetIdxMinus1[ outLayerSetIdx ]  = val; }
     
    7641031  Void    setOutputLayerFlag( Int outLayerSetIdx, Int i, Bool flag )       { m_outputLayerFlag[ outLayerSetIdx ][ i ] = flag; }
    7651032  Bool    getOutputLayerFlag( Int outLayerSetIdx, Int i )                  { return m_outputLayerFlag[ outLayerSetIdx ][ i ]; }
     1033#if H_MV_6_HRD_O0217_13
     1034  Bool    inferOutputLayerFlag( Int layerSetIdx, Int i )                   { return ( getDefaultOneTargetOutputLayerIdc( ) == 0 || ( ( getDefaultOneTargetOutputLayerIdc( ) == 1 ) && ( i == m_layerSetLayerIdList[layerSetIdx].size() - 1  ) ));  }
     1035#endif
    7661036
    7671037  Void    setProfileLevelTierIdx( Int outLayerSetIdx, Int val )            { m_profileLevelTierIdx[ outLayerSetIdx  = val ]; }
    7681038  Int     getProfileLevelTierIdx( Int outLayerSetIdx )                     { return m_profileLevelTierIdx[ outLayerSetIdx ]; }
     1039#if H_MV_6_GEN_0153_28
     1040  Void    setAltOutputLayerFlag( Bool flag )                               { m_altOutputLayerFlag = flag; }
     1041  Bool    getAltOutputLayerFlag(  )                                        { return m_altOutputLayerFlag; }
     1042#endif
    7691043
    7701044  Void    setRepFormatIdxPresentFlag( Bool flag )                          { m_repFormatIdxPresentFlag = flag; }
     
    7811055  Void    setMaxOneActiveRefLayerFlag( Bool flag)                          { m_maxOneActiveRefLayerFlag = flag; }
    7821056  Bool    getMaxOneActiveRefLayerFlag( )                                   { return m_maxOneActiveRefLayerFlag; }
     1057
     1058#if H_MV_6_HRD_O0217_13
     1059  Void    setDpbSize( TComDpbSize* val )                                   { assert( m_dpbSize != 0 ); m_dpbSize = val; }
     1060  TComDpbSize* getDpbSize( )                                               { return m_dpbSize;}
     1061#endif
     1062
     1063#if H_MV_6_MISC_O0062_31
     1064  Void    setPocLsbNotPresentFlag( Int i, Bool flag )                      { m_pocLsbNotPresentFlag[i] = flag; }
     1065  Bool    getPocLsbNotPresentFlag( Int i )                                 { return m_pocLsbNotPresentFlag[i]; }
     1066#endif
     1067#if !H_MV_6_PS_O0223_29 
    7831068  Void    setCrossLayerIrapAlignedFlag( Bool flag )                        { m_crossLayerIrapAlignedFlag = flag; }
    7841069  Bool    getCrossLayerIrapAlignedFlag(  )                                 { return m_crossLayerIrapAlignedFlag; }
     1070#endif
    7851071  Void    setDirectDepTypeLenMinus2( Int val)                              { m_directDepTypeLenMinus2 = val; }
    7861072  Int     getDirectDepTypeLenMinus2( )                                     { return m_directDepTypeLenMinus2; }
    7871073
     1074#if H_MV_6_PS_O0096_21
     1075  Void    setDefaultDirectDependencyFlag( Bool flag )                      { m_defaultDirectDependencyFlag = flag; }
     1076  Bool    getDefaultDirectDependencyFlag(  )                               { return m_defaultDirectDependencyFlag; }
     1077
     1078  Void    setDefaultDirectDependencyType( Int  val )                       { m_defaultDirectDependencyType = val; }
     1079  Int     getDefaultDirectDependencyType(  )                               { return m_defaultDirectDependencyType; }
     1080#endif
    7881081  Void    setDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps, Int val) { m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ] = val; }
    7891082  Int     getDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps)   { return m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ]; }
     
    7971090
    7981091  Int     getScalabilityId ( Int layerIdInVps, ScalabilityType scalType );
     1092#if H_MV_6_FIX_GET_VIEW_ID
     1093  Int     getViewId        ( Int layerIdInNuh )                            { return m_viewIdVal[ getViewIndex( layerIdInNuh )]; }
     1094#else
    7991095  Int     getViewId        ( Int layerIdInNuh )                            { return m_viewIdVal[ getViewIndex( getLayerIdInVps( layerIdInNuh) )]; }
     1096#endif
    8001097  Void    setRefLayers();
    8011098
     
    8101107Int     getProfileLevelTierIdxLen()                                      { return gCeilLog2( getVpsNumProfileTierLevelMinus1() + 1 ); };       
    8111108
    812   Int     getNumLayersInIdList              ( Int lsIdx );;
     1109  Int     getNumLayersInIdList ( Int lsIdx );
     1110
     1111#if H_MV_6_HRD_O0217_13
     1112  Int     getNumOutputLayerSets() ;   
     1113  Int     getNumSubDpbs( Int i )                                           { return getNumLayersInIdList( i ); }; 
     1114  Bool    isOutputLayer( Int outLayerSetIdx, Int layerIdInNuh );   
     1115#if H_MV_6_HRD_O0217_13
     1116  Void    deriveLayerSetLayerIdList();
     1117  Void    deriveTargetLayerIdLists();
     1118  std::vector<Int> getTargetDecLayerIdList( Int targetOptLayerSetIdx )     { return m_targetDecLayerIdLists[targetOptLayerSetIdx]; };
     1119  std::vector<Int> getTargetOptLayerIdList( Int targetOptLayerSetIdx )     { return m_targetDecLayerIdLists[targetOptLayerSetIdx]; };
     1120#endif
     1121#endif
     1122
    8131123
    8141124  // inference
     
    10961406  TimingInfo* getTimingInfo() { return &m_timingInfo; }
    10971407
     1408#if H_MV_6_PS_O0118_33
     1409  Void inferVideoSignalInfo( TComVPS* vps, Int layerIdCurr )
     1410  {
     1411    if ( layerIdCurr == 0 || !vps->getVpsVuiPresentFlag() )
     1412    {
     1413      return;
     1414    }
     1415
     1416    TComVPSVUI* vpsVUI = vps->getVPSVUI();
     1417    assert( vpsVUI != NULL ); 
     1418
     1419    TComVideoSignalInfo* videoSignalInfo = vpsVUI->getVideoSignalInfo( vpsVUI->getVpsVideoSignalInfoIdx( vps->getLayerIdInVps( layerIdCurr ) ) );
     1420    assert( videoSignalInfo != NULL );
     1421
     1422    setVideoFormat            ( videoSignalInfo->getVideoVpsFormat            () );
     1423    setVideoFullRangeFlag     ( videoSignalInfo->getVideoFullRangeVpsFlag     () );
     1424    setColourPrimaries        ( videoSignalInfo->getColourPrimariesVps        () );
     1425    setTransferCharacteristics( videoSignalInfo->getTransferCharacteristicsVps() );
     1426    setMatrixCoefficients     ( videoSignalInfo->getMatrixCoeffsVps           () );     
     1427  }
     1428#endif
    10981429};
    10991430
     
    11811512  TComVPS*    m_pcVPS;
    11821513  // SPS
     1514#if H_MV_6_PSEM_O0142_3
     1515  Bool        m_spsExtensionFlag;
     1516  Bool        m_spsExtensionTypeFlag[PS_EX_T_MAX_NUM];
     1517#endif
    11831518  Bool        m_spsInferScalingListFlag;
    11841519  Int         m_spsScalingListRefLayerId;
    11851520  Bool        m_updateRepFormatFlag;
     1521#if H_MV_6_PS_REP_FORM_18_19_20 
     1522  Int         m_spsRepFormatIdx;
     1523#endif
    11861524  // SPS Extension
    11871525  Bool        m_interViewMvVertConstraintFlag;
     1526#if H_MV_6_SHVC_O0098_36
     1527  Int         m_numScaledRefLayerOffsets;
     1528  Int         m_scaledRefLayerId          [MAX_NUM_SCALED_REF_LAYERS];
     1529  Int         m_scaledRefLayerLeftOffset  [MAX_NUM_LAYERS];
     1530  Int         m_scaledRefLayerTopOffset   [MAX_NUM_LAYERS];
     1531  Int         m_scaledRefLayerRightOffset [MAX_NUM_LAYERS];
     1532  Int         m_scaledRefLayerBottomOffset[MAX_NUM_LAYERS];
     1533#endif
    11881534#endif
    11891535#if H_3D
     
    13221668  TComPTL* getPTL()     { return &m_pcPTL; }
    13231669#if H_MV
     1670#if H_MV_6_PSEM_O0142_3
     1671  Void setSpsExtensionFlag( Bool flag ) { m_spsExtensionFlag = flag; }
     1672  Bool getSpsExtensionFlag( )  { return m_spsExtensionFlag; }
     1673
     1674  Void setSpsExtensionTypeFlag( Int i, Bool flag ) { m_spsExtensionTypeFlag[i] = flag; }
     1675  Bool getSpsExtensionTypeFlag( Int i ) { return m_spsExtensionTypeFlag[i]; }
     1676#endif
    13241677  Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
    13251678  TComVPS*  getVPS          () { return m_pcVPS; }
     
    13331686  Void setUpdateRepFormatFlag( Bool flag )     { m_updateRepFormatFlag = flag; }
    13341687  Bool getUpdateRepFormatFlag(  )              { return m_updateRepFormatFlag; }
     1688#if H_MV_6_PS_REP_FORM_18_19_20
     1689  Void setSpsRepFormatIdx( Int  val )          { m_spsRepFormatIdx = val; }
     1690  Int  getSpsRepFormatIdx(  )                  { return m_spsRepFormatIdx; }
     1691#endif
    13351692  // SPS Extension
    13361693  Void setInterViewMvVertConstraintFlag(Bool val) { m_interViewMvVertConstraintFlag = val; }
    13371694  Bool getInterViewMvVertConstraintFlag()         { return m_interViewMvVertConstraintFlag;}
     1695
     1696#if H_MV_6_SHVC_O0098_36
     1697  Void setNumScaledRefLayerOffsets( Int  val )    { m_numScaledRefLayerOffsets = val; }
     1698  Int  getNumScaledRefLayerOffsets(  )            { return m_numScaledRefLayerOffsets; }
     1699
     1700  Void setScaledRefLayerId( Int i, Int  val )     { m_scaledRefLayerId[i] = val; }
     1701  Int  getScaledRefLayerId( Int i )               { return m_scaledRefLayerId[i]; }
     1702
     1703  Void setScaledRefLayerLeftOffset( Int j, Int  val ) { m_scaledRefLayerLeftOffset[j] = val; }
     1704  Int  getScaledRefLayerLeftOffset( Int j )           { return m_scaledRefLayerLeftOffset[j]; }
     1705
     1706  Void setScaledRefLayerTopOffset( Int j, Int  val )  { m_scaledRefLayerTopOffset[j] = val; }
     1707  Int  getScaledRefLayerTopOffset( Int j )            { return m_scaledRefLayerTopOffset[j]; }
     1708
     1709  Void setScaledRefLayerRightOffset( Int j, Int  val ) { m_scaledRefLayerRightOffset[j] = val; }
     1710  Int  getScaledRefLayerRightOffset( Int j )           { return m_scaledRefLayerRightOffset[j]; }
     1711
     1712  Void setScaledRefLayerBottomOffset( Int j, Int  val ) { m_scaledRefLayerBottomOffset[j] = val; }
     1713  Int  getScaledRefLayerBottomOffset( Int j )           { return m_scaledRefLayerBottomOffset[j]; }
     1714#endif
    13381715  // Inference
    13391716  Void inferRepFormat( TComVPS* vps, Int layerIdCurr );
     
    17362113// Additional slice header syntax elements
    17372114  Bool       m_pocResetFlag;
     2115#if H_MV_6_RALS_O0149_11
     2116  Bool       m_crossLayerBlaFlag;
     2117#endif
    17382118  Bool       m_discardableFlag;
    17392119  Bool       m_interLayerPredEnabledFlag;
     
    20732453// Additional slice header syntax elements
    20742454
     2455#if H_MV_6_RALS_O0149_11
     2456  Void setCrossLayerBlaFlag( Bool flag ) { m_crossLayerBlaFlag = flag; }
     2457  Bool getCrossLayerBlaFlag(  ) { return m_crossLayerBlaFlag; }
     2458  Void checkCrossLayerBlaFlag ( )
     2459  {
     2460    // 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.
     2461    if ( getLayerId() != 0 || getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
     2462    {
     2463      assert( m_crossLayerBlaFlag == 0 );
     2464    }
     2465  }
     2466#endif
     2467
    20752468  Void setPocResetFlag( Bool flag ) { m_pocResetFlag = flag; }
    20762469  Bool getPocResetFlag(  ) { return m_pocResetFlag; }
     
    20912484  Int  getNumInterLayerRefPicsMinus1Len( ) { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
    20922485  Int  getInterLayerPredLayerIdcLen    ( ) { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
     2486
     2487#if H_MV_6_ILDDS_ILREFPICS_27_34
     2488  Int  getRefLayerPicFlag( Int i );
     2489  Int  getRefLayerPicIdc ( Int j );
     2490  Int  getNumRefLayerPics( );
     2491#endif
    20932492
    20942493  Int  getNumActiveRefLayerPics( );
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r735 r738  
    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 //////////////////////////////
     
    306355#define MAX_VPS_OP_SETS_PLUS1                     1024
    307356#if H_MV
     357#if H_MV_6_LAYER_ID_32
     358#define MAX_VPS_NUH_LAYER_ID_PLUS1  63
     359#else
    308360#define MAX_VPS_NUH_LAYER_ID_PLUS1  64
     361#endif
    309362#define MAX_NUM_SCALABILITY_TYPES   16
    310363#define ENC_CFG_CONSOUT_SPACE       29           
     
    329382
    330383#define MAX_CPB_CNT                     32  ///< Upper bound of (cpb_cnt_minus1 + 1)
     384#if H_MV
     385#if H_MV_6_LAYER_ID_32
     386#define MAX_NUM_LAYER_IDS               63
     387#define MAX_NUM_LAYERS                  63
     388#else
    331389#define MAX_NUM_LAYER_IDS               64
    332 #if H_MV
    333390#define MAX_NUM_LAYERS                  64
     391#endif
    334392#define MAX_VPS_PROFILE_TIER_LEVEL      64
    335393#define MAX_VPS_ADD_OUTPUT_LAYER_SETS   1024
    336394#define MAX_VPS_OUTPUTLAYER_SETS        ( MAX_VPS_ADD_OUTPUT_LAYER_SETS + MAX_VPS_OP_SETS_PLUS1 )
     395#if H_MV_6_PS_O0118_33
     396#define  MAX_NUM_VIDEO_SIGNAL_INFO      16
     397#endif
     398#if H_MV_6_SHVC_O0098_36
     399#define MAX_NUM_SCALED_REF_LAYERS       MAX_NUM_LAYERS-1
     400#endif
     401#if H_MV_6_HRD_O0164_15
     402#define MAX_NUM_BSP_HRD_PARAMETERS      100 ///< Maximum value is actually not specified
     403#define MAX_NUM_BITSTREAM_PARTITIONS    100 ///< Maximum value is actually not specified
     404#define MAX_NUM_BSP_SCHED_COMBINATION   100 ///< Maximum value is actually not specified
     405#endif
    337406#endif
    338407
     
    811880
    812881#if H_MV
     882
     883#if H_MV_6_PSEM_O0142_3
     884  enum PsExtensionTypes
     885  {
     886    PS_EX_T_MV   = 1,
     887#if H_3D
     888    PS_EX_T_3D   = 3,
     889#endif
     890    PS_EX_T_ESC  = 7,
     891    PS_EX_T_MAX_NUM = 8
     892  };
     893#endif
     894
    813895/// scalability types
    814896  enum ScalabilityType
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r724 r738  
    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
     637#if H_MV_6_PS_REP_FORM_18_19_20
     638  if ( pcSPS->getLayerId() == 0 )
     639#else
    623640  if ( pcSPS->getUpdateRepFormatFlag() )
     641#endif
    624642  {
    625643#endif
     
    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
     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
    786834        while ( xMoreRbspData() )
    787835        {
    788836          READ_FLAG( uiCode, "sps_extension_data_flag");
    789837        }
     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);
     
    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 );
    11251319
     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 );
     
    12041459  }
    12051460
     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())
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.h

    r655 r738  
    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
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r724 r738  
    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 );
     
    722732#endif
    723733#endif
     734
     735#if H_MV_LAYER_WISE_STARTUP
     736    xCeckNoClrasOutput();
     737#endif
    724738    // Skip pictures due to random access
    725739    if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
     
    727741    m_prevSliceSkipped = true;
    728742    m_skippedPOC = m_apcSlicePilot->getPOC();
     743#if H_MV_FIX_SKIP_PICTURES
     744      sliceSkippedFlag = true;
     745#endif
    729746      return false;
    730747    }
     
    734751    m_prevSliceSkipped = true;
    735752    m_skippedPOC = m_apcSlicePilot->getPOC();
     753#if H_MV_FIX_SKIP_PICTURES
     754      sliceSkippedFlag = true;
     755#endif
    736756      return false;
    737757    }
     
    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);
     
    12651293    return true;
    12661294  }
     1295#if H_MV_LAYER_WISE_STARTUP
     1296  else if ( !m_layerInitilizedFlag[ m_layerId ] ) // start of random access point, m_pocRandomAccess has not been set yet.
     1297#else
    12671298  else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet.
     1299#endif
    12681300  {
    12691301    if (   m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA
     
    12721304        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL )
    12731305    {
     1306
     1307#if H_MV_LAYER_WISE_STARTUP
     1308      if ( xAllRefLayersInitilized() )
     1309      {
     1310        m_layerInitilizedFlag[ m_layerId ] = true;
     1311        m_pocRandomAccess = m_apcSlicePilot->getPOC();
     1312      }
     1313      else
     1314      {
     1315        return true;
     1316      }
     1317#else
    12741318      // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT.
    12751319      m_pocRandomAccess = m_apcSlicePilot->getPOC();
     1320#endif
    12761321    }
    12771322    else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    12781323    {
     1324#if H_MV_LAYER_WISE_STARTUP
     1325      if ( xAllRefLayersInitilized() )
     1326      {
     1327        m_layerInitilizedFlag[ m_layerId ] = true;
    12791328      m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
    12801329    }
    12811330    else
    12821331    {
     1332        return true;
     1333      }
     1334#else
     1335      m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
     1336#endif
     1337    }
     1338    else
     1339    {
     1340#if H_MV_FIX_SKIP_PICTURES
     1341      static Bool warningMessage[MAX_NUM_LAYERS];
     1342      static Bool warningInitFlag = false;
     1343     
     1344      if (!warningInitFlag)
     1345      {
     1346        for ( Int i = 0; i < MAX_NUM_LAYERS; i++)
     1347        {
     1348          warningMessage[i] = true;
     1349        }
     1350        warningInitFlag = true;
     1351      }
     1352
     1353      if ( warningMessage[getLayerId()] )
     1354      {
     1355        printf("\nLayer%3d   No valid random access point. VCL NAL units of this layer are discarded until next layer initialization picture. ", getLayerId() );
     1356        warningMessage[m_layerId] = false;
     1357      }
     1358#else
    12831359      static Bool warningMessage = false;
    12841360      if(!warningMessage)
     
    12871363        warningMessage = true;
    12881364      }
     1365#endif
    12891366      return true;
    12901367    }
     
    12961373    return true;
    12971374  }
     1375#if H_MV_LAYER_WISE_STARTUP
     1376  return !m_layerInitilizedFlag[ getLayerId() ];
     1377#else
    12981378  // if we reach here, then the picture is not skipped.
    12991379  return false;
     1380#endif
    13001381}
    13011382
     
    13381419  }
    13391420}
     1421
     1422#if H_MV_LAYER_WISE_STARTUP
     1423Void TDecTop::xCeckNoClrasOutput()
     1424{
     1425  // This part needs further testing!
     1426  if ( getLayerId() == 0 )
     1427  {   
     1428    NalUnitType nut = m_apcSlicePilot->getNalUnitType();
     1429
     1430    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 );
     1431    Bool isIDR  = ( nut == NAL_UNIT_CODED_SLICE_IDR_W_RADL ) || ( nut == NAL_UNIT_CODED_SLICE_IDR_N_LP );
     1432    Bool noClrasOutputFlag  = isBLA || ( isIDR  &&  m_apcSlicePilot->getCrossLayerBlaFlag() );
     1433
     1434    if ( noClrasOutputFlag )
     1435    {
     1436      for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++)
     1437      {
     1438        m_layerInitilizedFlag[i] = false;
     1439      }
     1440    }
     1441  }
     1442}
     1443
     1444Bool TDecTop::xAllRefLayersInitilized()
     1445{
     1446  Bool allRefLayersInitilizedFlag = true;
     1447  TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 );
     1448  for (Int i = 0; i < vps->getNumDirectRefLayers( getLayerId()  ); i++ )
     1449  {
     1450    Int refLayerId = vps->getRefLayerId( m_layerId, i );
     1451    allRefLayersInitilizedFlag = allRefLayersInitilizedFlag && m_layerInitilizedFlag[ refLayerId ];
     1452  }
     1453
     1454  return allRefLayersInitilizedFlag;
     1455}
     1456#endif
    13401457#endif
    13411458//! \}
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r724 r738  
    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);
  • trunk/source/Lib/TLibEncoder/TEncCavlc.cpp

    r724 r738  
    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 ) 
     
    797887    WRITE_CODE( pcVPS->getViewIdVal( i ), pcVPS->getViewIdLenMinus1( ) + 1, "view_id_val[i]" );
    798888  }
     889#endif
     890
    799891
    800892  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
     
    805897    }
    806898  }
    807 
     899#if H_MV_6_ILDSD_O0120_26
     900  WRITE_FLAG( pcVPS->getVpsSubLayersMaxMinus1PresentFlag( ) ? 1 : 0 , "vps_sub_layers_max_minus1_present_flag" );
     901  if ( pcVPS->getVpsSubLayersMaxMinus1PresentFlag() )
     902  {
     903    for (Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )
     904    {
     905      WRITE_CODE( pcVPS->getSubLayersVpsMaxMinus1( i ), 3, "sub_layers_vps_max_minus1" );
     906      pcVPS->checkSubLayersVpsMaxMinus1( i );
     907    }
     908  } 
     909  else
     910  {
     911    for (Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )
     912    {
     913      assert( pcVPS->getSubLayersVpsMaxMinus1( i ) + 1 == pcVPS->getMaxTLayers( ) );   
     914    }
     915  }
     916#endif
    808917  WRITE_FLAG( pcVPS->getMaxTidRefPresentFlag( ) ? 1 : 0 , "max_tid_ref_present_flag" );
    809918
     
    812921    for( Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )
    813922    {
     923#if H_MV_6_ILDDS_O0225_30
     924      for( Int j = i + 1; j <= pcVPS->getMaxLayersMinus1(); j++ )
     925      {
     926        if ( pcVPS->getDirectDependencyFlag(j,i) )
     927        {
     928          WRITE_CODE( pcVPS->getMaxTidIlRefPicsPlus1( i, j ), 3, "max_tid_il_ref_pics_plus1" );
     929        }
     930      }
     931#else
    814932      WRITE_CODE( pcVPS->getMaxTidIlRefPicPlus1( i ), 3,       "max_tid_il_ref_pics_plus1[i]" );
     933#endif
    815934    }
    816935  }
     
    826945    {   
    827946      WRITE_CODE( pcVPS->getProfileRefMinus1( i ), 6, "profile_ref_minus1[i]" );
     947#if H_MV_6_PS_O0109_23
     948      pcVPS->checkProfileRefMinus1( i );     
     949#endif
    828950    }
    829951    codePTL( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers() - 1 );
     
    842964  if( numOutputLayerSets > 1)
    843965  {
     966#if H_MV_6_PS_0109_25
     967    WRITE_CODE( pcVPS->getDefaultOneTargetOutputLayerIdc( ), 2, "default_one_target_output_layer_idc" );
     968    pcVPS->checkDefaultOneTargetOutputLayerIdc();
     969#else
    844970    WRITE_FLAG( pcVPS->getDefaultOneTargetOutputLayerFlag( ) ? 1 : 0, "default_one_target_output_layer_flag" );
     971#endif       
    845972  } 
    846973
     974#if H_MV_6_HRD_O0217_13
     975  assert( pcVPS->getOutputLayerFlag(0, 0) == pcVPS->inferOutputLayerFlag( 0, 0 ));
     976  assert( pcVPS->getOutputLayerSetIdxMinus1( 0 ) == -1 );
     977#endif
    847978  for( Int i = 1; i < numOutputLayerSets; i++ )
    848979  {
     
    855986      }     
    856987    }
     988#if H_MV_6_HRD_O0217_13
     989    else
     990    { // These inference rules would also be helpful in spec text
     991      assert( pcVPS->getOutputLayerSetIdxMinus1(i ) ==  i - 1 );
     992      for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1; j++ )
     993      {             
     994        assert( pcVPS->getOutputLayerFlag( i , j ) == pcVPS->inferOutputLayerFlag( i, j ));
     995      }
     996    }
     997#endif
     998
    857999    if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
    8581000    {     
     
    8611003  }
    8621004
     1005#if H_MV_6_GEN_0153_28
     1006  if( pcVPS->getMaxLayersMinus1() > 0 )
     1007  {
     1008    WRITE_FLAG( pcVPS->getAltOutputLayerFlag( ) ? 1 : 0 , "alt_output_layer_flag" );
     1009  }
     1010#endif
     1011
    8631012  WRITE_FLAG( pcVPS->getRepFormatIdxPresentFlag( ) ? 1 : 0 , "rep_format_idx_present_flag" );
    8641013  if ( pcVPS->getRepFormatIdxPresentFlag() )
     
    8691018  for (Int i = 0; i <= pcVPS->getVpsNumRepFormatsMinus1(); i++ )
    8701019  {   
     1020#if H_MV_6_PS_REP_FORM_18_19_20
     1021    TComRepFormat* curRepFormat = pcVPS->getRepFormat(i);     
     1022    TComRepFormat* prevRepFormat = i > 0 ? pcVPS->getRepFormat( i - 1) : NULL;
     1023    codeRepFormat( i, curRepFormat ,  prevRepFormat);
     1024#else
    8711025    TComRepFormat* pcRepFormat = pcVPS->getRepFormat(i);     
    8721026    codeRepFormat( pcRepFormat );
     1027#endif
    8731028  }
    8741029
     
    8791034      if( pcVPS->getVpsNumRepFormatsMinus1() > 0 )
    8801035      {
     1036#if H_MV_6_PS_REP_FORM_18_19_20
     1037        WRITE_CODE( pcVPS->getVpsRepFormatIdx( i ), 8, "vps_rep_format_idx" );
     1038#else
    8811039        WRITE_CODE( pcVPS->getVpsRepFormatIdx( i ), 4, "vps_rep_format_idx" );
     1040#endif
    8821041      }
    8831042    }
     
    8851044
    8861045  WRITE_FLAG( pcVPS->getMaxOneActiveRefLayerFlag( ) ? 1 : 0, "max_one_active_ref_layer_flag" );
     1046#if H_MV_6_MISC_O0062_31
     1047  for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
     1048  {
     1049    if( pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) )  ==  0 )
     1050    {     
     1051      WRITE_FLAG( pcVPS->getPocLsbNotPresentFlag( i ) ? 1 : 0 , "poc_lsb_not_present_flag" );
     1052    }
     1053  }
     1054#endif
     1055#if H_MV_6_HRD_O0217_13
     1056  codeDpbSize( pcVPS );
     1057#endif
     1058
     1059#if !H_MV_6_PS_O0223_29
    8871060  WRITE_FLAG( pcVPS->getCrossLayerIrapAlignedFlag( ) ? 1 : 0 , "cross_layer_irap_aligned_flag" );
     1061#endif
    8881062  WRITE_UVLC( pcVPS->getDirectDepTypeLenMinus2 ( ),         "direct_dep_type_len_minus2");
    8891063
     1064#if H_MV_6_PS_O0096_21
     1065  WRITE_FLAG( pcVPS->getDefaultDirectDependencyFlag( ) ? 1 : 0 , "default_direct_dependency_flag" );
     1066
     1067  if ( pcVPS->getDefaultDirectDependencyFlag( ) )
     1068  { 
     1069    WRITE_CODE( pcVPS->getDefaultDirectDependencyType( ), pcVPS->getDirectDepTypeLenMinus2( ) + 2 , "default_direct_dependency_type" );   
     1070  }
     1071
     1072  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
     1073  {
     1074    for( Int j = 0; j < i; j++ )
     1075    {
     1076      if (pcVPS->getDirectDependencyFlag( i, j) )
     1077      {       
     1078        if ( pcVPS->getDefaultDirectDependencyFlag( ) )
     1079        { 
     1080          assert( pcVPS->getDirectDependencyType( i, j ) == pcVPS->getDefaultDirectDependencyType( ) );
     1081        }
     1082        else
     1083        {
     1084          assert ( pcVPS->getDirectDependencyType( i, j ) != -1 );
     1085          WRITE_CODE( pcVPS->getDirectDependencyType( i, j ),pcVPS->getDirectDepTypeLenMinus2( ) + 2,  "direct_dependency_type[i][j]" );
     1086        }
     1087      }
     1088    }
     1089  } 
     1090#else
    8901091    for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
    8911092    {
     
    8991100      }
    9001101    }
    901    
     1102#endif
    9021103    WRITE_FLAG ( 0,                                      "vps_shvc_reserved_zero_flag" );
     1104#if !H_MV_6_PS_O0109_24
    9031105    WRITE_FLAG( pcVPS->getVpsVuiPresentFlag( ) ? 1 : 0 , "vps_vui_present_flag" );
     1106#endif
    9041107
    9051108    if( pcVPS->getVpsVuiPresentFlag() )
     
    9091112    }     
    9101113}
    911 
     1114#if H_MV_6_PS_O0118_33
     1115Void TEncCavlc::codeVideoSignalInfo( TComVideoSignalInfo* pcVideoSignalInfo )
     1116{
     1117  assert( pcVideoSignalInfo );
     1118  WRITE_CODE( pcVideoSignalInfo->getVideoVpsFormat( ), 3, "video_vps_format" );
     1119  WRITE_FLAG( pcVideoSignalInfo->getVideoFullRangeVpsFlag( ) ? 1 : 0 , "video_full_range_vps_flag" );
     1120  WRITE_CODE( pcVideoSignalInfo->getColourPrimariesVps( ), 8, "colour_primaries_vps" );
     1121  WRITE_CODE( pcVideoSignalInfo->getTransferCharacteristicsVps( ), 8, "transfer_characteristics_vps" );
     1122  WRITE_CODE( pcVideoSignalInfo->getMatrixCoeffsVps( ), 8, "matrix_coeffs_vps" );
     1123}
     1124#endif
     1125
     1126#if H_MV_6_HRD_O0217_13
     1127Void TEncCavlc::codeDpbSize( TComVPS* vps )
     1128{
     1129  TComDpbSize* dpbSize = vps->getDpbSize();
     1130  assert ( dpbSize != 0 );
     1131
     1132  for( Int i = 1; i < vps->getNumOutputLayerSets(); i++ )
     1133  { 
     1134    WRITE_FLAG( dpbSize->getSubLayerFlagInfoPresentFlag( i ) ? 1 : 0 , "sub_layer_flag_info_present_flag" );
     1135
     1136    for( Int j = 0; j  <=  vps->getMaxTLayers() - 1 ; j++ )
     1137    { 
     1138      if( j > 0  &&  dpbSize->getSubLayerDpbInfoPresentFlag( i, j )  ) 
     1139      {
     1140        WRITE_FLAG( dpbSize->getSubLayerDpbInfoPresentFlag( i, j ) ? 1 : 0 , "sub_layer_dpb_info_present_flag" );
     1141      }
     1142      if( dpbSize->getSubLayerDpbInfoPresentFlag( i, j ) )
     1143      { 
     1144        for( Int k = 0; k < vps->getNumSubDpbs( vps->getOutputLayerSetIdxMinus1( i ) + 1 ); k++ )   // Preliminary fix does not match with spec
     1145        {
     1146          WRITE_UVLC( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ), "max_vps_dec_pic_buffering_minus1" );
     1147        }
     1148        WRITE_UVLC( dpbSize->getMaxVpsNumReorderPics( i, j ), "max_vps_num_reorder_pics" );
     1149        WRITE_UVLC( dpbSize->getMaxVpsLatencyIncreasePlus1( i, j ), "max_vps_latency_increase_plus1" );
     1150      }
     1151      else
     1152      {
     1153        if ( j > 0 )
     1154        {
     1155          for( Int k = 0; k < vps->getNumSubDpbs( vps->getOutputLayerSetIdxMinus1( i ) + 1 ); k++ )   
     1156          {
     1157            assert( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ) == dpbSize->getMaxVpsDecPicBufferingMinus1( i,k, j - 1 ) );
     1158          }
     1159          assert( dpbSize->getMaxVpsNumReorderPics      ( i, j ) ==  dpbSize->getMaxVpsNumReorderPics      ( i, j - 1 ) );
     1160          assert( dpbSize->getMaxVpsLatencyIncreasePlus1( i, j ) ==  dpbSize->getMaxVpsLatencyIncreasePlus1( i, j - 1 ) );
     1161        }
     1162      }
     1163    }       
     1164  } 
     1165}
     1166#endif
     1167
     1168#if H_MV_6_PS_REP_FORM_18_19_20
     1169Void TEncCavlc::codeRepFormat( Int i, TComRepFormat* pcRepFormat, TComRepFormat* pcPrevRepFormat )
     1170#else
    9121171Void TEncCavlc::codeRepFormat( TComRepFormat* pcRepFormat )
     1172#endif
    9131173{
    9141174  assert( pcRepFormat );
    9151175
    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   }
     1176#if H_MV_6_PS_REP_FORM_18_19_20
    9221177  WRITE_CODE( pcRepFormat->getPicWidthVpsInLumaSamples( ),  16, "pic_width_vps_in_luma_samples" );
    9231178  WRITE_CODE( pcRepFormat->getPicHeightVpsInLumaSamples( ), 16, "pic_height_vps_in_luma_samples" );
     1179  WRITE_FLAG( pcRepFormat->getChromaAndBitDepthVpsPresentFlag( ) ? 1 : 0 , "chroma_and_bit_depth_vps_present_flag" );
     1180 
     1181  pcRepFormat->checkChromaAndBitDepthVpsPresentFlag( i );
     1182
     1183  if ( pcRepFormat->getChromaAndBitDepthVpsPresentFlag() )
     1184  { 
     1185#endif
     1186  WRITE_CODE( pcRepFormat->getChromaFormatVpsIdc( ), 2, "chroma_format_vps_idc" );
     1187
     1188  if ( pcRepFormat->getChromaFormatVpsIdc() == 3 )
     1189  {
     1190    WRITE_FLAG( pcRepFormat->getSeparateColourPlaneVpsFlag( ) ? 1 : 0 , "separate_colour_plane_vps_flag" );
     1191  }
     1192#if !H_MV_6_PS_REP_FORM_18_19_20
     1193  WRITE_CODE( pcRepFormat->getPicWidthVpsInLumaSamples( ),  16, "pic_width_vps_in_luma_samples" );
     1194  WRITE_CODE( pcRepFormat->getPicHeightVpsInLumaSamples( ), 16, "pic_height_vps_in_luma_samples" );
     1195#endif
    9241196  WRITE_CODE( pcRepFormat->getBitDepthVpsLumaMinus8( ),      4, "bit_depth_vps_luma_minus8" );
    9251197  WRITE_CODE( pcRepFormat->getBitDepthVpsChromaMinus8( ),    4, "bit_depth_vps_chroma_minus8" );
     1198#if H_MV_6_PS_REP_FORM_18_19_20
     1199  }
     1200  else
     1201  {
     1202    pcRepFormat->inferChromaAndBitDepth(pcPrevRepFormat, true );
     1203  }
     1204#endif
    9261205}
    9271206
     
    9331212
    9341213  assert( pcVPSVUI );
     1214
     1215#if H_MV_6_PS_O0223_29
     1216  WRITE_FLAG( pcVPSVUI->getCrossLayerPicTypeAlignedFlag( ) ? 1 : 0 , "cross_layer_pic_type_aligned_flag" );
     1217  if ( !pcVPSVUI->getCrossLayerPicTypeAlignedFlag() )
     1218  { 
     1219    WRITE_FLAG( pcVPSVUI->getCrossLayerIrapAlignedFlag( ) ? 1 : 0 , "cross_layer_irap_aligned_flag" );
     1220  }
     1221#endif
    9351222
    9361223  WRITE_FLAG( pcVPSVUI->getBitRatePresentVpsFlag( ) ? 1 : 0 , "bit_rate_present_vps_flag" );
     
    9641251  }
    9651252
     1253#if H_MV_6_O0226_37
     1254  WRITE_FLAG( pcVPSVUI->getTilesNotInUseFlag( ) ? 1 : 0 , "tiles_not_in_use_flag" );
     1255  if( !pcVPSVUI->getTilesNotInUseFlag() )
     1256  {     
     1257    for( Int i = 0; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
     1258    {
     1259      WRITE_FLAG( pcVPSVUI->getTilesInUseFlag( i ) ? 1 : 0 , "tiles_in_use_flag[i]" );
     1260      if( pcVPSVUI->getTilesInUseFlag( i ) ) 
     1261      {
     1262        WRITE_FLAG( pcVPSVUI->getLoopFilterNotAcrossTilesFlag( i ) ? 1 : 0, "loop_filter_not_across_tiles_flag[i]" );
     1263      }
     1264    } 
     1265
     1266    for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ ) 
     1267    {
     1268      for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ) ; j++ )
     1269      { 
     1270        Int layerIdx = pcVPS->getLayerIdInVps(pcVPS->getRefLayerId(pcVPS->getLayerIdInNuh( i ) , j  )); 
     1271        if( pcVPSVUI->getTilesInUseFlag( i )  &&  pcVPSVUI->getTilesInUseFlag( layerIdx ) ) 
     1272        {
     1273          WRITE_FLAG( pcVPSVUI->getTileBoundariesAlignedFlag( i, j ) ? 1 : 0 , "tile_boundaries_aligned_flag[i][j]" );
     1274        }
     1275      } 
     1276    }
     1277  } 
     1278
     1279  WRITE_FLAG( pcVPSVUI->getWppNotInUseFlag( ) ? 1 : 0 , "wpp_not_in_use_flag" );
     1280
     1281  if( !pcVPSVUI->getWppNotInUseFlag( ) )
     1282  {
     1283    for( Int i = 0; i  <=  pcVPS->getMaxLayersMinus1(); i++ ) 
     1284    {
     1285      WRITE_FLAG( pcVPSVUI->getWppInUseFlag( i ) ? 1 : 0 , "wpp_in_use_flag[i]" );
     1286    }
     1287  }
     1288#else
    9661289  for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
    9671290  {
     
    9711294    }
    9721295  }
    973 
     1296#endif
    9741297  WRITE_FLAG( pcVPSVUI->getIlpRestrictedRefLayersFlag( ) ? 1 : 0 , "ilp_restricted_ref_layers_flag" );
    9751298
     
    9921315    }
    9931316  }
    994 }
     1317#if H_MV_6_PS_O0118_33
     1318  WRITE_FLAG( pcVPSVUI->getVideoSignalInfoIdxPresentFlag( ) ? 1 : 0 , "video_signal_info_idx_present_flag" );
     1319  if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() )
     1320  {
     1321    WRITE_CODE( pcVPSVUI->getVpsNumVideoSignalInfoMinus1( ), 4, "vps_num_video_signal_info_minus1" );
     1322  }
     1323  else
     1324  {
     1325    pcVPSVUI->setVpsNumVideoSignalInfoMinus1( pcVPS->getMaxLayersMinus1() );
     1326  }
     1327
     1328  for( Int i = 0; i <= pcVPSVUI->getVpsNumVideoSignalInfoMinus1(); i++ )
     1329  {
     1330    assert( pcVPSVUI->getVideoSignalInfo( i ) != NULL );
     1331    TComVideoSignalInfo* curVideoSignalInfo = pcVPSVUI->getVideoSignalInfo( i );
     1332    codeVideoSignalInfo( curVideoSignalInfo );     
     1333  }
     1334
     1335  if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() && pcVPSVUI->getVpsNumVideoSignalInfoMinus1() > 0 )
     1336  {
     1337    for( Int i = 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
     1338    {
     1339      WRITE_CODE( pcVPSVUI->getVpsVideoSignalInfoIdx( i ), 4, "vps_video_signal_info_idx" );
     1340      assert( pcVPSVUI->getVpsVideoSignalInfoIdx( i ) >= 0 && pcVPSVUI->getVpsVideoSignalInfoIdx( i ) <= pcVPSVUI->getVpsNumVideoSignalInfoMinus1() );
     1341    }
     1342}
     1343  else
     1344  {
     1345    for( Int i = 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
     1346    {
     1347      assert( pcVPSVUI->getVpsVideoSignalInfoIdx( i  ) == ( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() ? 0 : i ) );
     1348    }
     1349  }
     1350#endif
     1351#if H_MV_6_HRD_O0164_15
     1352  WRITE_FLAG( pcVPSVUI->getVpsVuiBspHrdPresentFlag( ) ? 1 : 0 , "vps_vui_bsp_hrd_present_flag" );
     1353  if ( pcVPSVUI->getVpsVuiBspHrdPresentFlag( ) )
     1354  {
     1355    codeVpsVuiBspHrdParameters( pcVPS );
     1356  }
     1357#endif
     1358}
     1359#if H_MV_6_HRD_O0164_15
     1360Void TEncCavlc::codeVpsVuiBspHrdParameters( TComVPS* pcVPS )
     1361{
     1362  assert( pcVPS );
     1363
     1364  TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( );
     1365
     1366  assert( pcVPSVUI );
     1367
     1368  TComVpsVuiBspHrdParameters*  vpsVuiBspHrdP = pcVPSVUI->getVpsVuiBspHrdParameters();
     1369
     1370  assert ( vpsVuiBspHrdP );
     1371
     1372 
     1373  WRITE_UVLC( vpsVuiBspHrdP->getVpsNumBspHrdParametersMinus1( ), "vps_num_bsp_hrd_parameters_minus1" );
     1374  for( Int i = 0; i <= vpsVuiBspHrdP->getVpsNumBspHrdParametersMinus1( ); i++ )
     1375  { 
     1376    if( i > 0 )
     1377    {
     1378      WRITE_FLAG( vpsVuiBspHrdP->getBspCprmsPresentFlag( i ) ? 1 : 0 , "bsp_cprms_present_flag" );
     1379    }
     1380    TComHRD* hrdParameters = vpsVuiBspHrdP->getHrdParametermeters( i );
     1381    codeHrdParameters( hrdParameters, vpsVuiBspHrdP->getBspCprmsPresentFlag( i ), pcVPS->getMaxSubLayersMinus1() );     
     1382  } 
     1383  for( Int h = 1; h <= pcVPS->getVpsNumLayerSetsMinus1(); h++ )
     1384  { 
     1385    WRITE_UVLC( vpsVuiBspHrdP->getNumBitstreamPartitions( h ), "num_bitstream_partitions" );
     1386    for( Int i = 0; i < vpsVuiBspHrdP->getNumBitstreamPartitions( h ); i++ ) 
     1387    {
     1388      for( Int j = 0; j <= pcVPS->getMaxLayersMinus1(); j++ ) 
     1389      {
     1390        if( pcVPS->getLayerIdIncludedFlag( h ,j ) )
     1391        {
     1392          WRITE_FLAG( vpsVuiBspHrdP->getLayerInBspFlag( h, i, j ) ? 1 : 0 , "layer_in_bsp_flag" );
     1393        }
     1394        else
     1395        {
     1396          vpsVuiBspHrdP->setLayerInBspFlag( h, i, j, false ); // This inference seems to be missing in spec
     1397        }
     1398      }
     1399    }
     1400    vpsVuiBspHrdP->checkLayerInBspFlag( pcVPS, h );
     1401
     1402    if( vpsVuiBspHrdP->getNumBitstreamPartitions( h ) )
     1403    { 
     1404      WRITE_UVLC( vpsVuiBspHrdP->getNumBspSchedCombinations( h ), "num_bsp_sched_combinations" );
     1405      for( Int i = 0; i < vpsVuiBspHrdP->getNumBspSchedCombinations( h ); i++ )
     1406      {
     1407        for( Int j = 0; j < vpsVuiBspHrdP->getNumBitstreamPartitions( h ); j++ )
     1408        { 
     1409          WRITE_UVLC( vpsVuiBspHrdP->getBspCombHrdIdx( h, i, j ), "bsp_comb_hrd_idx" );
     1410          WRITE_UVLC( vpsVuiBspHrdP->getBspCombSchedIdx( h, i, j ), "bsp_comb_sched_idx" );
     1411        } 
     1412      }
     1413    } 
     1414  } 
     1415
     1416#endif
     1417
    9951418#endif
    9961419
     
    11151538#if H_MV   
    11161539    Int esb = 0;  //Don't use i, otherwise will shadow something below
     1540#if !H_MV_6_RALS_O0149_11
    11171541    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
    11181542    {
     
    11201544      WRITE_FLAG( pcSlice->getPocResetFlag( ) ? 1 : 0 , "poc_reset_flag" );
    11211545    }
     1546#endif
    11221547
    11231548    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     
    11261551      WRITE_FLAG( pcSlice->getDiscardableFlag( ) ? 1 : 0 , "discardable_flag" );
    11271552    }
     1553
     1554#if H_MV_6_RALS_O0149_11
     1555    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     1556    {
     1557      esb++;
     1558      WRITE_FLAG( pcSlice->getCrossLayerBlaFlag( ) ? 1 : 0 , "cross_layer_bla_flag" );
     1559    }
     1560    pcSlice->checkCrossLayerBlaFlag( );
     1561
     1562    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     1563    {
     1564      esb++;
     1565      WRITE_FLAG( pcSlice->getPocResetFlag( ) ? 1 : 0 , "poc_reset_flag" );
     1566    }
     1567#endif
     1568
     1569
    11281570
    11291571    for (; esb < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++)   
     
    11481590    //   colour_plane_id                                      u(2)
    11491591
     1592#if H_MV_6_POC_31_35_38
     1593    if ( (pcSlice->getLayerId() > 0 && !vps->getPocLsbNotPresentFlag( pcSlice->getLayerIdInVps())) || !pcSlice->getIdrPicFlag() )
     1594    {
     1595      Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1);
     1596      WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "slice_pic_order_cnt_lsb");
     1597    }
     1598#endif
    11501599    if( !pcSlice->getIdrPicFlag() )
    11511600    {
     1601#if !H_MV_6_POC_31_35_38
    11521602      Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1);
    11531603      WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb");
     1604#endif
    11541605      TComReferencePictureSet* rps = pcSlice->getRPS();
    11551606     
     
    12651716    }
    12661717#if H_MV
     1718#if H_MV_6_ILDDS_ILREFPICS_27_34
     1719    Bool interLayerPredLayerIdcPresentFlag = false;
     1720#endif
    12671721    Int layerId = pcSlice->getLayerId();
    12681722    if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )
     
    12771731        if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) )
    12781732        {       
     1733#if H_MV_6_ILDDS_ILREFPICS_27_34
     1734          interLayerPredLayerIdcPresentFlag = true;
     1735#endif
    12791736          for( Int idx = 0; idx < pcSlice->getNumActiveRefLayerPics(); idx++ )   
    12801737          {
     
    12841741      } 
    12851742    }
     1743#if H_MV_6_ILDDS_ILREFPICS_27_34
     1744    if ( !interLayerPredLayerIdcPresentFlag )
     1745    {
     1746      for( Int i = 0; i < pcSlice->getNumActiveRefLayerPics(); i++ )   
     1747      {
     1748        assert( pcSlice->getInterLayerPredLayerIdc( i ) == pcSlice->getRefLayerPicIdc( i ) );
     1749      }
     1750    }
     1751#endif
    12861752#endif
    12871753    if(pcSlice->getSPS()->getUseSAO())
  • trunk/source/Lib/TLibEncoder/TEncCavlc.h

    r655 r738  
    8686#if H_MV
    8787  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
    8899  Void  codeRepFormat          ( TComRepFormat* pcRepFormat );
     100#endif
    89101  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 );
  • trunk/source/Lib/TLibEncoder/TEncGOP.cpp

    r724 r738  
    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.
     
    674678    GOPEntry gopEntry      = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid );     
    675679   
     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   
  • trunk/source/Lib/TLibEncoder/TEncTop.cpp

    r724 r738  
    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.