Index: trunk/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1041)
+++ trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1066)
@@ -4177,5 +4177,9 @@
     TComPic * pcTexPic = m_pcSlice->getTexturePic();
 #if H_3D_FCO
+#if LGE_FCO_I0116
+    if (pcTexPic && pcTexPic->getReconMark())
+#else
     if (pcTexturePic->getReconMark())
+#endif
     {
 #endif    
@@ -6160,5 +6164,9 @@
   TComMv cMv; 
 #if MTK_I0093
-  Int iDisp     = getSlice()->getDepthToDisparityB( 0 )[ 1 << ( getSlice()->getSPS()->getBitDepthY() - 1 ) ];
+#if H_3D_FIX_64BIT_SHIFT
+  Int iDisp     = getSlice()->getDepthToDisparityB( 0 )[ (Int64) (1 << ( getSlice()->getSPS()->getBitDepthY() - 1 )) ];
+#else
+  Int iDisp     = getSlice()->getDepthToDisparityB( 0 )[  1 << ( getSlice()->getSPS()->getBitDepthY() - 1 ) ];
+#endif
 #else
   Int iDisp     = getSlice()->getDepthToDisparityB( 0 )[ 128 ];
Index: trunk/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 1041)
+++ trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 1066)
@@ -71,4 +71,23 @@
     c <<= 1;
   }  
+
+#if H_MV
+#if H_MV_HLS_PTL_LIMITS 
+ g_generalTierAndLevelLimits[ Level::LEVEL1   ] = TComGeneralTierAndLevelLimits(    36864,     350,  INT_MIN,   16,   1,   1 );
+ g_generalTierAndLevelLimits[ Level::LEVEL2   ] = TComGeneralTierAndLevelLimits(   122880,    1500,  INT_MIN,   16,   1,   1 );
+ g_generalTierAndLevelLimits[ Level::LEVEL2_1 ] = TComGeneralTierAndLevelLimits(   245760,    3000,  INT_MIN,   20,   1,   1 );
+ g_generalTierAndLevelLimits[ Level::LEVEL3   ] = TComGeneralTierAndLevelLimits(   552960,    6000,  INT_MIN,   30,   2,   2 );
+ g_generalTierAndLevelLimits[ Level::LEVEL3_1 ] = TComGeneralTierAndLevelLimits(   983040,   10000,  INT_MIN,   40,   3,   3 );
+ g_generalTierAndLevelLimits[ Level::LEVEL4   ] = TComGeneralTierAndLevelLimits(  2228224,   12000,    30000,   75,   5,   5 );
+ g_generalTierAndLevelLimits[ Level::LEVEL4_1 ] = TComGeneralTierAndLevelLimits(  2228224,   20000,    50000,   75,   5,   5 );
+ g_generalTierAndLevelLimits[ Level::LEVEL5   ] = TComGeneralTierAndLevelLimits(  8912896,   25000,   100000,  200,  11,  10 );
+ g_generalTierAndLevelLimits[ Level::LEVEL5_1 ] = TComGeneralTierAndLevelLimits(  8912896,   40000,   160000,  200,  11,  10 );
+ g_generalTierAndLevelLimits[ Level::LEVEL5_2 ] = TComGeneralTierAndLevelLimits(  8912896,   60000,   240000,  200,  11,  10 );
+ g_generalTierAndLevelLimits[ Level::LEVEL6   ] = TComGeneralTierAndLevelLimits( 35651584,   60000,   240000,  600,  22,  20 );
+ g_generalTierAndLevelLimits[ Level::LEVEL6_1 ] = TComGeneralTierAndLevelLimits( 35651584,  120000,   480000,  600,  22,  20 );
+ g_generalTierAndLevelLimits[ Level::LEVEL6_2 ] = TComGeneralTierAndLevelLimits( 35651584,  240000,   800000,  600,  22,  20 );
+#endif
+#endif
+
 }
 
@@ -369,9 +388,10 @@
 
 Char  g_aucConvertToBit  [ MAX_CU_SIZE+1 ];
-
+#if !MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX
 #if H_3D_IC
 UInt g_aICEnableCANDIDATE[10] = { 0, };
 UInt g_aICEnableNUM[ 10 ] = { 0, };
 Int g_lastlayer=0;
+#endif
 #endif
 #if ENC_DEC_TRACE
@@ -383,7 +403,7 @@
 UInt64 g_nSymbolCounter = 0;
 #if H_MV_ENC_DEC_TRAC
-Bool g_traceCU = true; 
-Bool g_tracePU = true; 
-Bool g_traceTU = true; 
+Bool g_traceCU = false; 
+Bool g_tracePU = false; 
+Bool g_traceTU = false; 
 Bool g_disableHLSTrace = false; 
 UInt64 g_stopAtCounter       = 0; 
Index: trunk/source/Lib/TLibCommon/TComRom.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComRom.h	(revision 1041)
+++ trunk/source/Lib/TLibCommon/TComRom.h	(revision 1066)
@@ -187,4 +187,42 @@
 // ==========================================
 
+#if H_MV_HLS_PTL_LIMITS
+class TComGeneralTierAndLevelLimits
+{
+public:
+  TComGeneralTierAndLevelLimits::TComGeneralTierAndLevelLimits
+  ( Int maxLumaPs, 
+    Int maxCPBMainTier, 
+    Int maxCPBHighTier, 
+    Int maxSliceSegmentsPerPicture, 
+    Int maxTileRows, 
+    Int maxTileCols )
+  : m_maxLumaPs                 ( maxLumaPs                     ),
+    m_maxCPBMainTier            ( maxCPBMainTier                ),
+    m_maxCPBHighTier            ( maxCPBHighTier                ),
+    m_maxSliceSegmentsPerPicture( maxSliceSegmentsPerPicture    ),
+    m_maxTileRows               ( maxTileRows                   ),
+    m_maxTileCols               ( maxTileCols                   );
+  {};
+
+  Int getMaxLumaPs                 ( ) { return m_maxLumaPs                 ; };
+  Int getMaxCPBMainTier            ( ) { return m_maxCPBMainTier            ; };
+  Int getMaxCPBHighTier            ( ) { return m_maxCPBHighTier            ; };
+  Int getMaxSliceSegmentsPerPicture( ) { return m_maxSliceSegmentsPerPicture; };
+  Int getMaxTileRows               ( ) { return m_maxTileRows               ; };
+  Int getMaxTileCols               ( ) { return m_maxTileCols               ; };
+
+private:
+  const Int m_maxLumaPs;
+  const Int m_maxCPBMainTier; 
+  const Int m_maxCPBHighTier;
+  const Int m_maxSliceSegmentsPerPicture; 
+  const Int m_maxTileRows; 
+  const Int m_maxTileCols; 
+};
+
+extern std::map< Level::Name, TComGeneralTierAndLevelLimits > g_generalTierAndLevelLimits;   
+
+#endif
 // ====================================================================================================================
 // Misc.
@@ -192,9 +230,10 @@
 
 extern       Char   g_aucConvertToBit  [ MAX_CU_SIZE+1 ];   // from width to log2(width)-2
-
+#if !MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX
 #if H_3D_IC
 extern UInt g_aICEnableCANDIDATE[10];
 extern UInt g_aICEnableNUM[ 10 ]; //10 layers
 extern Int  g_lastlayer;
+#endif
 #endif
 
Index: trunk/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 1041)
+++ trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 1066)
@@ -1,3 +1,3 @@
-﻿/* The copyright in this software is being made available under the BSD
+/*  The copyright in this software is being made available under the BSD
  * License, included below. This software may be subject to other third party
  * and contributor rights, including patent rights, and no such rights are
@@ -103,4 +103,7 @@
 , m_temporalLayerNonReferenceFlag ( false )
 , m_enableTMVPFlag                ( true )
+#if I0044_SLICE_TMVP
+, m_availableForTMVPRefFlag       ( true )
+#endif
 #if H_MV
 , m_refPicSetInterLayer0           ( NULL )
@@ -725,4 +728,7 @@
 
         assert( rpsCurrList[li][ orgIdx ] != NULL ); 
+#if DISCARDABLE_PIC_RPS
+        assert( rpsCurrList[li][ orgIdx ]->getSlice(0)->getDiscardableFlag() == 0 );    // Inter-layer RPS shall not contain picture with discardable_flag = 1.
+#endif
         m_apcRefPicList    [li][rIdx] = rpsCurrList    [li][ orgIdx ];
         m_bIsUsedAsLongTerm[li][rIdx] = usedAsLongTerm [li][ orgIdx ] ; 
@@ -1875,4 +1881,7 @@
 #if H_MV
   m_vpsBaseLayerInternalFlag = true; 
+#if H_MV_HLS10_GEN_VSP_BASE_LAYER_AVAIL
+  m_vpsBaseLayerAvailableFlag = true; 
+#endif
 #endif
 
@@ -1900,7 +1909,16 @@
   {
     m_layerSetIdxForOlsMinus1[i]  = -1; 
+#if !H_MV_HLS10_PTL
     m_profileLevelTierIdx[i]      = 0; 
+#endif
     for ( Int j = 0; j < MAX_VPS_NUH_LAYER_ID_PLUS1; j++)
     {
+#if H_MV_HLS10_PTL
+#if H_MV_HLS10_PTL_FIX
+      m_profileTierLevelIdx[i][j] = -1; 
+#else
+      m_profileTierLevelIdx[i][j] = false; 
+#endif
+#endif
       m_outputLayerFlag[i][j] = false; 
     }
@@ -1966,5 +1984,12 @@
       m_directDependencyFlag[i][j] = false;
       m_directDependencyType[i][j] = -1; 
+#if H_MV_HLS10_REF_PRED_LAYERS
+      m_dependencyFlag  [i][j]    = false; 
+      m_idDirectRefLayer[i][j]    = -1; 
+      m_idPredictedLayer[i][j]    = -1; 
+      m_idRefLayer      [i][j]    = -1; 
+#else
       m_refLayerId[i][j]           = -1; 
+#endif
       m_maxTidIlRefPicsPlus1[i][j]  = 7;
     }
@@ -2050,4 +2075,8 @@
   assert( getVpsNumRepFormatsMinus1() <= 255 ); 
 
+#if H_MV_HLS10_ADD_LAYERSETS
+  // The value of num_add_layer_sets shall be in the range of 0 to 1023, inclusive. 
+  assert( getNumAddLayerSets() >= 0 && getNumAddLayerSets() <= 1023 ); 
+#endif
   return true; 
 }
@@ -2081,4 +2110,77 @@
 Void TComVPS::setRefLayers()
 {
+
+#if H_MV_HLS10_REF_PRED_LAYERS
+  for( Int i = 0; i  <=  getMaxLayersMinus1(); i++ )
+  {
+    for( Int j = 0; j  <=  getMaxLayersMinus1(); j++ )
+    {
+      m_dependencyFlag[ i ][ j ] = getDirectDependencyFlag( i , j );
+      for( Int k = 0; k < i; k++ )
+      {
+        if( getDirectDependencyFlag(i , k )  &&  m_dependencyFlag[k][j] )
+        {
+          m_dependencyFlag[ i ][ j ] = true;
+        }
+      }
+    }
+  }
+
+  for( Int i = 0; i  <=  getMaxLayersMinus1(); i++ )
+  {
+    Int iNuhLId = getLayerIdInNuh( i );
+    Int d = 0;
+    Int r = 0;
+    Int p = 0;
+    for( Int j = 0; j  <=  getMaxLayersMinus1(); j++ )
+    {
+      Int jNuhLid = getLayerIdInNuh( j );
+      if( getDirectDependencyFlag( i , j ) )
+      {
+        m_idDirectRefLayer[iNuhLId][d++] = jNuhLid;
+      }
+      if( getDependencyFlag( i , j ) )
+      {
+        m_idRefLayer      [iNuhLId][r++] = jNuhLid;
+      }
+      if( getDependencyFlag( j , i ) )
+      {
+        m_idPredictedLayer[iNuhLId][p++] = jNuhLid;
+      }
+    }
+    m_numDirectRefLayers[ iNuhLId ] = d;
+    m_numRefLayers      [ iNuhLId ] = r;
+    m_numPredictedLayers[ iNuhLId ] = p;
+  }
+  
+  Bool layerIdInListFlag[ 64 ]; 
+  for( Int i = 0; i  <=  63; i++ )
+  {
+    layerIdInListFlag[ i ] = 0;
+  }
+
+  Int k = 0; 
+  for( Int i = 0; i  <=  getMaxLayersMinus1(); i++ )
+  {
+    Int iNuhLId = getLayerIdInNuh( i );
+    if( getNumDirectRefLayers( iNuhLId )  ==  0 )
+    {
+      m_treePartitionLayerIdList[ k ][ 0 ] = iNuhLId;
+      Int h = 1;  
+      for( Int j = 0; j < getNumPredictedLayers( iNuhLId ); j++ )  
+      {
+        Int predLId = getIdPredictedLayer( iNuhLId, j );
+        if ( !layerIdInListFlag[ predLId ] )
+        {
+          m_treePartitionLayerIdList[ k ][ h++ ] = predLId;
+          layerIdInListFlag[ predLId ] = 1; 
+        }          
+      }
+      m_numLayersInTreePartition[ k++ ] = h;
+    }
+  }
+  m_numIndependentLayers = k;
+#else // H_MV_HLS10_GEN
+
   for( Int i = 0; i  <= getMaxLayersMinus1(); i++ )
   {
@@ -2116,5 +2218,5 @@
     }
   }
-
+  
   for( Int i = 0; i <= getMaxLayersMinus1(); i++ )  // Bug in spec "<" instead of "<=" 
   {
@@ -2136,5 +2238,4 @@
     countedLayerIdxFlag[ i ] = 0;
   }
- 
   for( Int i = 0, k = 0; i  <=  getMaxLayersMinus1(); i++ )
   {
@@ -2144,4 +2245,5 @@
       m_treePartitionLayerIdList[ k ][ 0 ] = iNuhLId;
       m_numLayersInTreePartition[ k ]      = 1;
+
       for( Int j = 0; j < m_numPredictedLayers[ iNuhLId ]; j++ )  
       {
@@ -2154,9 +2256,12 @@
       }
       k++;
-    }
-    m_numIndependentLayers = k;
-  }
-}
-
+
+      m_numIndependentLayers = k;
+    }
+  }
+#endif // H_MV_HLS10_GEN
+}
+
+#if !H_MV_HLS10_REF_PRED_LAYERS
 Int TComVPS::getRefLayerId( Int layerIdInNuh, Int idx )
 {
@@ -2166,4 +2271,5 @@
   return refLayerIdInNuh;
 }
+#endif
 
 Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType )
@@ -2203,4 +2309,7 @@
   for ( i = 0; i < iNumViews ; i++ )
   {
+#if H_3D_FIX_UNINIT
+    m_bCamParPresent[i] = false; 
+#endif
     m_bCamParInSliceHeader[i] = false; 
     m_aaaiCodedScale[i] = new Int*[ 2 ];
@@ -2315,5 +2424,9 @@
 {
   assert( lsIdx >= 0 ); 
+#if H_MV_HLS10_ADD_LAYERSETS
+  assert( lsIdx <= getNumLayerSets() ); 
+#else
   assert( lsIdx <= getVpsNumLayerSetsMinus1() ); 
+#endif
   return (Int) m_layerSetLayerIdList[ lsIdx ].size(); 
 }
@@ -2339,6 +2452,11 @@
 }
 
+#if !H_MV_HLS10_REF_PRED_LAYERS
 Bool TComVPS::getInDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps, Int depth /*= 0 */ )
 {
+#if H_MV_HLS10_REF_PRED_LAYERS
+  // TBD: Remove getInDirectDependencyFlag entirely.
+  return getDependencyFlag( depLayeridInVps, refLayeridInVps );
+#else
   assert( depth < 65 ); 
   Bool dependentFlag = getDirectDependencyFlag( depLayeridInVps, refLayeridInVps ); 
@@ -2352,5 +2470,7 @@
   }
   return dependentFlag;
-}
+#endif
+}
+#endif
 
 Void TComVPS::deriveLayerSetLayerIdList()
@@ -2378,8 +2498,16 @@
 {  
   Int lsIdx = olsIdxToLsIdx( i );     
-  
+
   for( Int j = 0; j < getNumLayersInIdList( lsIdx ); j++ )
   {
-    m_targetDecLayerIdLists[i].push_back( m_layerSetLayerIdList[ lsIdx ][ j ] ); 
+#if H_MV_HLS10_NESSECARY_LAYER
+    if ( getNecessaryLayerFlag( i , j ))
+    {
+#endif
+      m_targetDecLayerIdLists[i].push_back( m_layerSetLayerIdList[ lsIdx ][ j ] ); 
+#if H_MV_HLS10_NESSECARY_LAYER
+    }
+#endif
+
     if( getOutputLayerFlag( i, j  ))
     {
@@ -2429,4 +2557,5 @@
 }
 
+#if !H_MV_HLS10_ADD_LAYERSETS
 Void TComVPS::inferDbpSizeLayerSetZero( TComSPS* sps, Bool encoder )
 {
@@ -2451,5 +2580,5 @@
   }
 }
-
+#endif
 Bool TComVPS::getAltOutputLayerFlagVar( Int i )
 {
@@ -2465,4 +2594,5 @@
 }
 
+#if !H_MV_HLS10_MAXNUMPICS
 Int TComVPS::getMaxNumPics( Int layerId )
 {
@@ -2483,5 +2613,7 @@
   return maxNumPics;
 }
-
+#endif
+
+#if !H_MV_HLS10_REF_PRED_LAYERS
 Void TComVPS::xSetRefLayerFlags( Int currLayerId )
 {
@@ -2496,4 +2628,257 @@
   }
 }
+
+#endif
+
+#if H_MV_HLS10_PTL_FIX
+Int TComVPS::inferProfileTierLevelIdx(Int i, Int j)
+{
+  Bool inferZero        = ( i == 0 && j == 0 &&  getVpsBaseLayerInternalFlag() );
+  Bool inferGreaterZero = getNecessaryLayerFlag(i,j) && ( getVpsNumProfileTierLevelMinus1() == 0 ); 
+  assert( inferZero || inferGreaterZero );
+
+  Bool ptlIdx = 0; // inference for greaterZero
+  if ( inferZero )
+  {
+    ptlIdx = getMaxLayersMinus1() > 0 ? 1 : 0; 
+    if ( inferGreaterZero )
+    {
+      assert( ptlIdx == 0 );  
+      // This should never happen since :
+      // When vps_max_layers_minus1 is greater than 0, the value of vps_num_profile_tier_level_minus1 shall be greater than or equal to 1.
+    }
+  }
+  return ptlIdx;
+}
+#endif
+
+#if H_MV_HLS10_ADD_LAYERSETS
+Void TComVPS::deriveAddLayerSetLayerIdList(Int i)
+{
+  assert( m_layerSetLayerIdList.size() ==  ( getVpsNumLayerSetsMinus1() + 1 + i ) ); 
+  std::vector<Int> layerSetLayerIdList;
+
+  for( Int treeIdx = 1; treeIdx < getNumIndependentLayers(); treeIdx++ )
+  { 
+    // The value of highest_layer_idx_plus1[ i ][ j ] shall be in the range of 0 to NumLayersInTreePartition[ j ], inclusive.
+    assert( getHighestLayerIdxPlus1( i, treeIdx ) >= 0 && getHighestLayerIdxPlus1( i, treeIdx ) <= getNumLayersInTreePartition( treeIdx ) );
+
+    for( Int layerCnt = 0; layerCnt < getHighestLayerIdxPlus1( i, treeIdx ); layerCnt++ )
+    {
+      layerSetLayerIdList.push_back( getTreePartitionLayerIdList( treeIdx, layerCnt ) );
+    }
+  }
+  m_layerSetLayerIdList.push_back( layerSetLayerIdList ); 
+
+  //It is a requirement of bitstream conformance that 
+  //NumLayersInIdList[ vps_num_layer_sets_minus1 + 1 + i ] shall be greater than 0.
+  assert( getNumLayersInIdList( getVpsNumLayerSetsMinus1() + 1 + i ) > 0 );
+}
+
+#endif
+
+#if H_MV_HLS10_NESSECARY_LAYER
+Void TComVPS::deriveNecessaryLayerFlags(Int olsIdx)
+{
+  AOF( olsIdx >= 0 && olsIdx < getNumOutputLayerSets() ); 
+  Int lsIdx = olsIdxToLsIdx( olsIdx );
+  for( Int lsLayerIdx = 0; lsLayerIdx < getNumLayersInIdList( lsIdx) ; lsLayerIdx++ )
+  {
+    m_necessaryLayerFlag[ olsIdx ][ lsLayerIdx ] = 0;
+  }
+  for( Int lsLayerIdx = 0; lsLayerIdx < getNumLayersInIdList( lsIdx ); lsLayerIdx++ )
+  {
+    if( getOutputLayerFlag( olsIdx, lsLayerIdx  ))
+    {
+      m_necessaryLayerFlag[ olsIdx ][ lsLayerIdx ] = 1;
+      Int currLayerId = getLayerSetLayerIdList( lsIdx, lsLayerIdx );
+      for( Int rLsLayerIdx = 0; rLsLayerIdx < lsLayerIdx; rLsLayerIdx++ )
+      {
+        Int refLayerId = getLayerSetLayerIdList( lsIdx, rLsLayerIdx );
+        if( getDependencyFlag( getLayerIdInVps( currLayerId ), getLayerIdInVps( refLayerId ) ) )
+        {
+          m_necessaryLayerFlag[ olsIdx ][ rLsLayerIdx ] = 1;
+        }
+      }
+    }
+  }
+  m_numNecessaryLayers[ olsIdx ] = 0;
+  for( Int lsLayerIdx = 0; lsLayerIdx < getNumLayersInIdList( lsIdx ); lsLayerIdx++ ) 
+  {
+    m_numNecessaryLayers[ olsIdx ]  +=  m_necessaryLayerFlag[ olsIdx ][ lsLayerIdx ];
+  }
+}
+#endif
+
+#if H_MV_HLS10_ADD_LAYERSETS
+Void TComVPS::printPTL()
+{
+  std::vector<Int> idx; 
+  std::vector<Int> num; 
+  std::vector< std::vector<Int> > ptlInfo; 
+
+  std::cout << std::right << std::setw(60) << std::setfill('-') << " " << std::setfill(' ') << std::endl << "PTLI" << std::endl; 
+
+  for ( Int i = 0; i <= getVpsNumProfileTierLevelMinus1(); i++ )
+  {
+    std::vector<Int> curPtlInfo;
+    ProfileTierLevel* ptl = getPTL( i )->getGeneralPTL(); 
+    curPtlInfo.push_back( (Int) ptl->getProfileIdc()  );
+    curPtlInfo.push_back( (Int) ptl->getTierFlag()    );
+    curPtlInfo.push_back( (Int) ptl->getLevelIdc()    );
+    curPtlInfo.push_back( (Int) ptl->getInbldFlag()   );
+
+    idx.push_back ( i );
+    num.push_back ( 4 ); 
+    ptlInfo.push_back( curPtlInfo );
+  } 
+
+  xPrintArray( "VpsProfileTierLevel", getVpsNumProfileTierLevelMinus1() + 1, idx, num, ptlInfo, false  ); 
+
+  num.clear(); 
+  idx.clear(); 
+  for (Int i = 0; i < getNumOutputLayerSets(); i++)
+  {
+    num.push_back ( getNumLayersInIdList( olsIdxToLsIdx( i ))  ); 
+    idx.push_back( i ); 
+  }
+
+  xPrintArray( "profile_tier_level_idx", getNumOutputLayerSets(), idx, num, m_profileTierLevelIdx, true );
+  std::cout << std::endl;
+}
+
+Void TComVPS::printLayerDependencies()
+{
+  vector<Int> fullArray;
+  vector<Int> range; 
+
+#if H_3D
+  vector<Int> depthId; 
+#endif
+
+#if H_MV_HLS10_AUX
+  vector<Int> viewOrderIndex;
+  vector<Int> auxId;
+  vector<Int> dependencyId; 
+  vector<Int> viewId; 
+#endif
+  for (Int i = 0; i <= getMaxLayersMinus1(); i++ )
+  {
+    fullArray.push_back( getMaxLayersMinus1() + 1 ); 
+    range.push_back( i ); 
+#if H_MV_HLS10_AUX      
+    viewOrderIndex.push_back( getViewIndex   ( i ) );
+    dependencyId  .push_back( getDependencyId( i ) );
+    auxId         .push_back( getAuxId       ( i ) );      
+    viewId        .push_back( getViewId      ( getLayerIdInNuh( i ) ) );
+#if H_3D  
+    depthId.push_back( getDepthId( i ) );
+#endif
+#endif
+  }
+  std::cout << std::right << std::setw(60) << std::setfill('-') << " " << std::setfill(' ') << std::endl << "Layer Dependencies" << std::endl; 
+  xPrintArray( "direct_dependency_flag", getMaxLayersMinus1()+1, range, fullArray, m_directDependencyFlag, false ); 
+  xPrintArray( "DependencyFlag", getMaxLayersMinus1()+1, range, fullArray, m_dependencyFlag, false ); 
+  xPrintArray( "layer_id_in_nuh", getMaxLayersMinus1()+1, m_layerIdInNuh, true  );     
+  xPrintArray( "IdPredictedLayer", getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numPredictedLayers, m_idPredictedLayer, true );
+  xPrintArray( "IdRefLayer"      , getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numRefLayers, m_idRefLayer, true );
+  xPrintArray( "IdDirectRefLayer", getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numDirectRefLayers, m_idDirectRefLayer, true );
+  std::cout << std::endl;
+}
+
+#if H_MV_HLS10_AUX
+Void TComVPS::printScalabilityId()
+{
+  vector<Int> layerIdxInVps; 
+
+#if H_3D
+  vector<Int> depthId; 
+#endif
+
+  vector<Int> viewOrderIndex;
+  vector<Int> auxId;
+  vector<Int> dependencyId; 
+  vector<Int> viewId; 
+
+  for (Int i = 0; i <= getMaxLayersMinus1(); i++ )
+  {
+    Int layerIdInNuh = getLayerIdInNuh( i );
+    layerIdxInVps  .push_back( i ); 
+    viewOrderIndex.push_back( getViewIndex   ( layerIdInNuh ) );
+    dependencyId  .push_back( getDependencyId( layerIdInNuh ) );
+    auxId         .push_back( getAuxId       ( layerIdInNuh ) );      
+    viewId        .push_back( getViewId      ( layerIdInNuh ) );
+#if H_3D  
+    depthId       .push_back( getDepthId     ( layerIdInNuh ) );
+#endif
+  }
+
+  std::cout << std::right << std::setw(60) << std::setfill('-') << " " << std::setfill(' ') << std::endl << "Scalability Ids" << std::endl; 
+  xPrintArray( "layerIdxInVps"  , getMaxLayersMinus1()+1, layerIdxInVps,          false );
+  xPrintArray( "layer_id_in_nuh", getMaxLayersMinus1()+1, m_layerIdInNuh, false );     
+
+  xPrintArray( "ViewOrderIndex", getMaxLayersMinus1()+1, viewOrderIndex, false );     
+  xPrintArray( "DependencyId"  , getMaxLayersMinus1()+1, dependencyId  , false );     
+  xPrintArray( "AuxId"         , getMaxLayersMinus1()+1, auxId         , false );     
+  xPrintArray( "ViewId"        , getMaxLayersMinus1()+1, viewId        , false );     
+
+  std::cout << std::endl;
+}
+#endif
+
+Void TComVPS::printLayerSets()
+{
+  vector<Int> fullArray;
+  vector<Int> numLayersInIdList; 
+  vector<Int> rangeLayerSets; 
+
+
+  for (Int i = 0; i < getNumLayerSets(); i++ )
+  {
+    numLayersInIdList.push_back( getNumLayersInIdList( i ) );       
+    rangeLayerSets.push_back( i ); 
+  }
+
+  vector<Int> rangeOutputLayerSets; 
+  vector<Int> numOutputLayersInOutputLayerSet; 
+  vector<Int> numDecLayer; 
+  vector<Int> numLayersInLayerSetForOutputLayerSet; 
+  vector<Int> vOlsIdxToLsIdx;
+  for (Int i = 0; i < getNumOutputLayerSets(); i++ )
+  {
+    vOlsIdxToLsIdx.push_back( olsIdxToLsIdx(i));
+    numOutputLayersInOutputLayerSet.push_back( getNumOutputLayersInOutputLayerSet( i ) );       
+    numDecLayer.push_back( (Int) m_targetDecLayerIdLists[ i ].size() );
+    rangeOutputLayerSets.push_back( i ); 
+    numLayersInLayerSetForOutputLayerSet.push_back( getNumLayersInIdList( olsIdxToLsIdx( i ) ) );
+  }
+
+  vector<Int> rangeIndependentLayers;
+  for(Int i = 0; i < getNumIndependentLayers(); i++ )
+  {
+    rangeIndependentLayers.push_back( i );    
+  }
+
+  vector<Int> rangeAddLayerSets;
+  vector<Int> numHighestLayerIdxPlus1; 
+  for(Int i = 0; i < getNumAddLayerSets(); i++ )
+  {
+    rangeAddLayerSets.push_back( i );    
+    numHighestLayerIdxPlus1.push_back( getNumIndependentLayers() );
+  }
+
+  std::cout << std::right << std::setw(60) << std::setfill('-') << " " << std::setfill(' ') << std::endl << "Layer Sets" << std::endl;     
+  xPrintArray( "TreePartitionLayerIdList", getNumIndependentLayers(), rangeIndependentLayers, m_numLayersInTreePartition, m_treePartitionLayerIdList, true );
+  xPrintArray( "highest_layer_idx_plus1", getNumAddLayerSets(), rangeAddLayerSets, numHighestLayerIdxPlus1, m_highestLayerIdxPlus1, true ); 
+  xPrintArray( "LayerSetLayerIdList" , (Int) getNumLayerSets()      , rangeLayerSets      , numLayersInIdList, m_layerSetLayerIdList, true );
+  xPrintArray( "OlsIdxToLsIdx", (Int) vOlsIdxToLsIdx.size(), vOlsIdxToLsIdx, true ); 
+  xPrintArray( "OutputLayerFlag"     , getNumOutputLayerSets(), rangeOutputLayerSets, numLayersInLayerSetForOutputLayerSet, m_outputLayerFlag, true );
+  xPrintArray( "TargetOptLayerIdList", getNumOutputLayerSets(), rangeOutputLayerSets, numOutputLayersInOutputLayerSet, m_targetOptLayerIdLists, true );
+  xPrintArray( "NecessaryLayerFlag"  , getNumOutputLayerSets(), rangeOutputLayerSets, numLayersInLayerSetForOutputLayerSet, m_necessaryLayerFlag   , true );
+  xPrintArray( "TargetDecLayerIdList", getNumOutputLayerSets(), rangeOutputLayerSets, numDecLayer,                     m_targetDecLayerIdLists, true );
+  std::cout << endl;
+}
+
+#endif
 
 #endif // H_MV
@@ -2579,4 +2964,5 @@
 #endif
 
+#if !H_MV_HLS10_PPS
   m_numScaledRefLayerOffsets = 0; 
 
@@ -2590,7 +2976,8 @@
     m_scaledRefLayerLeftOffset     [i] = 0;
     m_scaledRefLayerTopOffset      [i] = 0;
-    m_scaledRefLayerRightOffset    [i] = 0;
+    m_scaledRefLayerRiFghtOffset    [i] = 0;
     m_scaledRefLayerBottomOffset   [i] = 0;
   }
+#endif
 #endif
 }
@@ -2967,21 +3354,40 @@
 Void TComSPS::inferRepFormat( TComVPS* vps, Int layerIdCurr )
 {
+#if H_MV_HLS10_MULTILAYERSPS
+  if ( getMultiLayerExtSpsFlag() )
+#else
   if ( layerIdCurr > 0 )
+#endif
   { 
     Int            repFormatIdx = getUpdateRepFormatFlag() ?  getSpsRepFormatIdx() : vps->getVpsRepFormatIdx( vps->getLayerIdInVps( layerIdCurr ) ) ;
     TComRepFormat* repFormat    = vps->getRepFormat( repFormatIdx ); 
-      setChromaFormatIdc( repFormat->getChromaFormatVpsIdc() );         
-      //// ToDo: add when supported: 
-      // setSeperateColourPlaneFlag( repFormat->getSeparateColourPlaneVpsFlag() ) ; 
-
-      setPicWidthInLumaSamples ( repFormat->getPicWidthVpsInLumaSamples()  ); 
-      setPicHeightInLumaSamples( repFormat->getPicHeightVpsInLumaSamples() ); 
-
-      setBitDepthY             ( repFormat->getBitDepthVpsLumaMinus8()   + 8 ); 
-      setQpBDOffsetY           ( (Int) (6*( getBitDepthY() - 8 )) );
-
-      setBitDepthC             ( repFormat->getBitDepthVpsChromaMinus8() + 8 ); 
-      setQpBDOffsetC           ( (Int) (6* ( getBitDepthC() -8 ) ) );
-    if ( getLayerId() > 0 && getUpdateRepFormatFlag() )
+    setChromaFormatIdc( repFormat->getChromaFormatVpsIdc() );         
+    //// ToDo: add when supported: 
+    // setSeperateColourPlaneFlag( repFormat->getSeparateColourPlaneVpsFlag() ) ; 
+
+    setPicWidthInLumaSamples ( repFormat->getPicWidthVpsInLumaSamples()  ); 
+    setPicHeightInLumaSamples( repFormat->getPicHeightVpsInLumaSamples() ); 
+
+    setBitDepthY             ( repFormat->getBitDepthVpsLumaMinus8()   + 8 ); 
+    setQpBDOffsetY           ( (Int) (6*( getBitDepthY() - 8 )) );
+
+    setBitDepthC             ( repFormat->getBitDepthVpsChromaMinus8() + 8 ); 
+    setQpBDOffsetC           ( (Int) (6* ( getBitDepthC() -8 ) ) );
+ #if H_MV_HLS10_GEN_VSP_CONF_WIN
+    Window &spsConf    = getConformanceWindow();    
+
+    // Scaled later
+    spsConf.setScaledFlag( false ); 
+    spsConf.setWindowLeftOffset  ( repFormat->getConfWinVpsLeftOffset()    );
+    spsConf.setWindowRightOffset ( repFormat->getConfWinVpsRightOffset()   );
+    spsConf.setWindowTopOffset   ( repFormat->getConfWinVpsTopOffset()     );
+    spsConf.setWindowBottomOffset( repFormat->getConfWinVpsBottomOffset()  );    
+#endif
+
+#if H_MV_HLS10_MULTILAYERSPS
+   if ( getMultiLayerExtSpsFlag() && getUpdateRepFormatFlag() )
+#else 
+   if ( getLayerId() > 0 && getUpdateRepFormatFlag() )
+#endif
     {
       assert( getChromaFormatIdc()      <=  repFormat->getChromaFormatVpsIdc()         ); 
@@ -3017,5 +3423,9 @@
   const std::vector<Int>& targetDecLayerIdList = vps->getTargetDecLayerIdList( vps->olsIdxToLsIdx( targetOptLayerSetIdx )); 
 
+#if H_MV_HLS10_MULTILAYERSPS
+  if ( getMultiLayerExtSpsFlag() )
+#else
   if (getLayerId() > 0 )
+#endif
   {
     Int layerIdx = 0;         
@@ -3035,13 +3445,31 @@
       Int maxDecPicBufferingMinus1 = vps->getDpbSize()->getMaxVpsDecPicBufferingMinus1( targetOptLayerSetIdx, layerIdx, i ) ; 
 
-      if ( encoder )
+#if H_MV_HLS10_MULTILAYERSPS
+      // This preliminary fix needs to be checked.
+      Int maxNumReorderPics       = vps->getDpbSize()->getMaxVpsNumReorderPics( targetOptLayerSetIdx, i ); 
+      Int maxLatencyIncreasePlus1 = vps->getDpbSize()->getMaxVpsLatencyIncreasePlus1( targetOptLayerSetIdx, i ); 
+#endif
+      if ( encoder )      
       {
         assert( getMaxDecPicBuffering( i ) - 1 == maxDecPicBufferingMinus1 ); 
+#if H_MV_HLS10_MULTILAYERSPS
+        // This preliminary fix needs to be checked.
+        assert( getNumReorderPics( i )     == maxNumReorderPics       ); 
+        assert( getMaxLatencyIncrease( i ) == maxLatencyIncreasePlus1 ); 
+#endif    
+
       }
       else
       {
+#if !H_MV_HLS10_MULTILAYERSPS
         setMaxDecPicBuffering(i, maxDecPicBufferingMinus1 + 1 ); 
-      }
-    }
+#else
+        // This preliminary fix needs to be checked.
+        setMaxDecPicBuffering( maxDecPicBufferingMinus1 + 1 , i); 
+        setNumReorderPics    ( maxNumReorderPics, i );
+        setMaxLatencyIncrease( maxLatencyIncreasePlus1 - 1 , i); 
+#endif
+      }
+    }    
   }
 }
@@ -3049,7 +3477,8 @@
 Void TComSPS::checkRpsMaxNumPics( TComVPS* vps, Int currLayerId )
 {
+#if !H_MV_HLS10_MAXNUMPICS
   // In spec, when rps is in SPS, nuh_layer_id of SPS is used instead 
   // of nuh_layer_id of slice (currLayerId), this seems to be a bug.
-
+#endif
   for (Int i = 0; i < getRPSList()->getNumberOfReferencePictureSets(); i++ )
   {
@@ -3057,10 +3486,36 @@
     if ( !rps->getInterRPSPrediction() )
     {
+#if H_MV_HLS10_MAXNUMPICS
+      rps->checkMaxNumPics( vps->getVpsExtensionFlag(), MAX_INT, getLayerId(), getMaxDecPicBuffering( getSpsMaxSubLayersMinus1() ) - 1 );   // INT_MAX to be replaced by DpbSize
+#else
       rps->checkMaxNumPics( vps->getVpsExtensionFlag(), vps->getMaxNumPics( currLayerId ), 
         getLayerId(), getMaxDecPicBuffering( getSpsMaxSubLayersMinus1() ) - 1 );  
-    }
-  }
-}
-
+#endif
+    }
+  }
+}
+
+#if H_MV_HLS10_MULTILAYERSPS
+Void TComSPS::inferSpsMaxSubLayersMinus1(Bool atPsActivation, TComVPS* vps)
+{
+  assert( getLayerId() != 0 ); 
+  if ( !atPsActivation   )
+  {
+    assert( vps == NULL );
+    if (getSpsExtOrMaxSubLayersMinus1() != 7)
+    {
+      setSpsMaxSubLayersMinus1( getSpsExtOrMaxSubLayersMinus1() );
+    }
+  }
+  else
+  {
+    assert( vps != NULL );
+    if (getSpsExtOrMaxSubLayersMinus1() == 7)
+    {
+      setSpsMaxSubLayersMinus1( vps->getMaxSubLayersMinus1() );
+    }
+  }
+}
+#endif
 #endif
 
@@ -3425,5 +3880,9 @@
 {
   TComVPS* vps = getVPS(); 
+#if H_MV_HLS10_REF_PRED_LAYERS
+  Int refLayerIdx = vps->getLayerIdInVps( vps->getIdDirectRefLayer( getLayerId(), i ) ); 
+#else
   Int refLayerIdx = vps->getLayerIdInVps( vps->getRefLayerId( getLayerId(), i ) ); 
+#endif
 
   Bool refLayerPicFlag = ( vps->getSubLayersVpsMaxMinus1( refLayerIdx ) >=  getTLayer() )  && ( getTLayer() == 0  ) &&
@@ -3496,5 +3955,9 @@
 Int TComSlice::getRefPicLayerId( Int i )
 {
+#if H_MV_HLS10_REF_PRED_LAYERS
+  return getVPS()->getIdDirectRefLayer( getLayerId(), getInterLayerPredLayerIdc( i ) );
+#else
   return getVPS()->getRefLayerId( getLayerId(), getInterLayerPredLayerIdc( i ) );
+#endif
 }
 
@@ -3602,10 +4065,13 @@
       m_bApplyIC = true;
       Int refLayer = curLayer-1;
-      if( (refLayer>=0) && (g_aICEnableCANDIDATE[refLayer]>0) )
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX
+      Int ICEnableCandidate = getICEnableCandidate(refLayer);
+      Int ICEnableNum = getICEnableNum(refLayer);
+      if( (refLayer>=0) && (ICEnableCandidate>0) )
       {    
-        Double ratio=Double(g_aICEnableNUM[refLayer])/Double(g_aICEnableCANDIDATE[refLayer]);
+        Double ratio=Double(ICEnableNum/Double(ICEnableCandidate));
 
         if( ratio > IC_LOW_LATENCY_ENCODING_THRESHOLD)
-{
+        {
           m_bApplyIC=true;
         }
@@ -3615,7 +4081,24 @@
         }
       }
+      setICEnableCandidate(curLayer, 0);
+      setICEnableNum(curLayer, 0);
+#else
+      if( (refLayer>=0) && (g_aICEnableCANDIDATE[refLayer]>0) )
+      {    
+        Double ratio=Double(g_aICEnableNUM[refLayer])/Double(g_aICEnableCANDIDATE[refLayer]);
+
+        if( ratio > IC_LOW_LATENCY_ENCODING_THRESHOLD)
+{
+          m_bApplyIC=true;
+        }
+        else
+        {
+          m_bApplyIC=false;
+        }
+      }
       g_aICEnableNUM[curLayer]=0;
       g_aICEnableCANDIDATE[curLayer]=0;
       g_lastlayer=getDepth();
+#endif
     }
   }
@@ -3727,5 +4210,9 @@
 
 #if H_3D_DDD
+#if LGE_FCO_I0116
+  if( getIsDepth() && getViewIndex() > 0 && getVPS()->getMPIFlag(layerIdInVPS))
+#else
   if( getIsDepth() && getViewIndex() > 0 )
+#endif
   {
       TComSlice *pcTextSlice = getTexturePic()->getSlice( 0 );
@@ -4209,7 +4696,67 @@
 , m_nonPackedConstraintFlag(false)
 , m_frameOnlyConstraintFlag(false)
+#if H_MV_HLS10_PTL
+  , m_max12bitConstraintFlag      ( false )
+  , m_max10bitConstraintFlag      ( false )
+  , m_max8bitConstraintFlag       ( false )
+  , m_max422chromaConstraintFlag  ( false )
+  , m_max420chromaConstraintFlag  ( false )
+  , m_maxMonochromeConstraintFlag ( false )
+  , m_intraConstraintFlag         ( false )
+  , m_onePictureOnlyConstraintFlag( false )
+  , m_lowerBitRateConstraintFlag  ( false )
+  , m_inbldFlag                   ( false )
+#endif
 {
   ::memset(m_profileCompatibilityFlag, 0, sizeof(m_profileCompatibilityFlag));
 }
+
+#if H_MV_HLS10_PTL_INFER_FIX
+Bool ProfileTierLevel::getV2ConstraintsPresentFlag()
+{
+  return ( 
+    getProfileIdc( ) ==  4 || getProfileCompatibilityFlag( 4 ) || getProfileIdc( ) ==  5 || getProfileCompatibilityFlag( 5 )  ||
+    getProfileIdc( ) ==  6 || getProfileCompatibilityFlag( 6 ) || getProfileIdc( ) ==  7 || getProfileCompatibilityFlag( 7 ) 
+    );
+}
+
+Bool ProfileTierLevel::getInbldPresentFlag()
+{
+  return ( 
+    ( getProfileIdc() >= 1 && getProfileIdc() <= 5 )  || getProfileCompatibilityFlag( 1 ) || getProfileCompatibilityFlag( 2 ) || 
+    getProfileCompatibilityFlag( 3 ) || getProfileCompatibilityFlag( 4 )  ||   getProfileCompatibilityFlag( 5 ) 
+    );
+}
+
+Void ProfileTierLevel::copyV2ConstraintFlags(ProfileTierLevel* ptlRef)
+{
+  setMax12bitConstraintFlag         ( ptlRef->getMax12bitConstraintFlag       ( ) );
+  setMax10bitConstraintFlag         ( ptlRef->getMax10bitConstraintFlag       ( ) );
+  setMax8bitConstraintFlag          ( ptlRef->getMax8bitConstraintFlag        ( ) );
+  setMax422chromaConstraintFlag     ( ptlRef->getMax422chromaConstraintFlag   ( ) );
+  setMax420chromaConstraintFlag     ( ptlRef->getMax420chromaConstraintFlag   ( ) );
+  setMaxMonochromeConstraintFlag    ( ptlRef->getMaxMonochromeConstraintFlag  ( ) );
+  setIntraConstraintFlag            ( ptlRef->getIntraConstraintFlag          ( ) );
+  setOnePictureOnlyConstraintFlag   ( ptlRef->getOnePictureOnlyConstraintFlag ( ) );
+  setLowerBitRateConstraintFlag     ( ptlRef->getLowerBitRateConstraintFlag   ( ) );
+}
+
+Void ProfileTierLevel::copyProfile(ProfileTierLevel* ptlRef)
+{
+  setProfileSpace            ( ptlRef->getProfileSpace              ( ) );
+  setTierFlag                ( ptlRef->getTierFlag                  ( ) );
+  setProfileIdc              ( ptlRef->getProfileIdc                ( ) );
+  for (Int j = 0; j < 32; j++)
+  {      
+    setProfileCompatibilityFlag(j, ptlRef->getProfileCompatibilityFlag  ( j ) );            
+  }
+  setProgressiveSourceFlag   ( ptlRef->getProgressiveSourceFlag     ( ) );
+  setInterlacedSourceFlag    ( ptlRef->getInterlacedSourceFlag      ( ) );
+  setNonPackedConstraintFlag ( ptlRef->getNonPackedConstraintFlag   ( ) );
+  setFrameOnlyConstraintFlag ( ptlRef->getFrameOnlyConstraintFlag   ( ) );
+  copyV2ConstraintFlags      ( ptlRef );
+}
+
+#endif
 
 TComPTL::TComPTL()
@@ -4220,4 +4767,5 @@
 
 #if H_MV
+#if !H_MV_HLS10_PTL_INFER_FIX
 Void TComPTL::copyLevelFrom( TComPTL* source )
 {
@@ -4229,4 +4777,93 @@
   }
 }
+#else
+Void TComPTL::inferGeneralValues(Bool profilePresentFlag, Int k, TComPTL* refPTL)
+{
+  ProfileTierLevel* refProfileTierLevel = NULL; 
+  if ( k > 0 )
+  {    
+    assert( refPTL != NULL);
+    refProfileTierLevel = refPTL->getGeneralPTL(); 
+  }
+
+  ProfileTierLevel* curProfileTierLevel = getGeneralPTL( ); 
+
+  if( !profilePresentFlag )
+  {
+    assert( k > 0 ); 
+    assert( refProfileTierLevel != NULL ); 
+    curProfileTierLevel->copyProfile( refProfileTierLevel);
+  }
+  else
+  {
+    if ( !curProfileTierLevel->getV2ConstraintsPresentFlag() )
+    {
+      curProfileTierLevel->setMax12bitConstraintFlag         ( false );
+      curProfileTierLevel->setMax10bitConstraintFlag         ( false );
+      curProfileTierLevel->setMax8bitConstraintFlag          ( false );
+      curProfileTierLevel->setMax422chromaConstraintFlag     ( false );
+      curProfileTierLevel->setMax420chromaConstraintFlag     ( false );
+      curProfileTierLevel->setMaxMonochromeConstraintFlag    ( false );
+      curProfileTierLevel->setIntraConstraintFlag            ( false );
+      curProfileTierLevel->setOnePictureOnlyConstraintFlag   ( false );
+      curProfileTierLevel->setLowerBitRateConstraintFlag     ( false );   
+    }
+
+    if ( !curProfileTierLevel->getInbldPresentFlag() )
+    {
+      curProfileTierLevel->setInbldFlag( false ); 
+    }      
+  }
+}
+
+Void TComPTL::inferSubLayerValues(Int maxNumSubLayersMinus1, Int k, TComPTL* refPTL)
+{
+  assert( k == 0 || refPTL != NULL ); 
+
+  for (Int i = maxNumSubLayersMinus1; i >= 0; i--)
+  {
+    ProfileTierLevel* refProfileTierLevel;
+    if ( k != 0 )
+    {
+      refProfileTierLevel = refPTL->getSubLayerPTL( i );
+    }
+    else
+    {
+      if ( i == maxNumSubLayersMinus1)      
+      {
+        refProfileTierLevel = getGeneralPTL();
+      }
+      else
+      {
+        refProfileTierLevel = getSubLayerPTL( i + 1 );
+      }
+    }    
+
+    ProfileTierLevel* curProfileTierLevel = getSubLayerPTL( i ); 
+    if( !getSubLayerLevelPresentFlag( i ) )
+    {
+      curProfileTierLevel->setLevelIdc( refProfileTierLevel->getLevelIdc() ); 
+    }
+
+    if( !getSubLayerProfilePresentFlag( i ) )
+    {
+      curProfileTierLevel->copyProfile( refProfileTierLevel);
+    }
+    else
+    {
+      if ( !curProfileTierLevel->getV2ConstraintsPresentFlag() )
+      {
+        curProfileTierLevel->copyV2ConstraintFlags( refProfileTierLevel ); 
+      }
+
+      if ( !curProfileTierLevel->getInbldPresentFlag() )
+      {
+        curProfileTierLevel->setInbldFlag( refProfileTierLevel->getInbldFlag() ); 
+      }      
+    }     
+  }
+}
+
+#endif
 #endif
 //! \}
@@ -4271,5 +4908,9 @@
 
   m_vpsVuiBspHrdPresentFlag = false; 
+#if H_MV_HLS10_VPS_VUI_BSP
+  m_vpsVuiBspHrdParameters  = NULL;
+#else
   m_vpsVuiBspHrdParameters  = new TComVpsVuiBspHrdParameters();
+#endif
 }
 
@@ -4314,7 +4955,8 @@
     assert( getBitDepthVpsLumaMinus8          () == prevRepFormat->getBitDepthVpsLumaMinus8          () );
     assert( getBitDepthVpsChromaMinus8        () == prevRepFormat->getBitDepthVpsChromaMinus8        () );
-}
-}
-
+  }
+}
+
+#if !H_MV_HLS10_VPS_VUI_BSP
 Void TComVpsVuiBspHrdParameters::checkLayerInBspFlag( TComVPS* vps, Int h )
 {
@@ -4354,5 +4996,5 @@
   // When num_bitstream_partitions[ h ] is equal to 1 for any value of h in the range 1 to vps_num_layer_set_minus1, inclusive, 
   // the value of layer_in_bsp_flag[ h ][ 0 ][ j ] should be equal to 0 for at least one value of j in the range 0 to 
-  // NumLayersInIdList[ h ] − 1, inclusive. 
+  // NumLayersInIdList[ h ] ? 1, inclusive. 
 
 
@@ -4369,5 +5011,5 @@
   
   // For any value of h in the range 1 to vps_num_layer_set_minus1, inclusive, the value of layer_in_bsp_flag[ h ][ i ][ j ] 
-  // shall be equal to 1 for at most one value of i in the range of 0 to num_bitstream_partitions[ h ] − 1, inclusive. 
+  // shall be equal to 1 for at most one value of i in the range of 0 to num_bitstream_partitions[ h ] ? 1, inclusive. 
 
   for ( Int j = 0; j <= vps->getNumLayersInIdList( h ) - 1; j++ )
@@ -4395,4 +5037,105 @@
   //  assert(  getBspCombSchedIdx(h, i, j ) <= vps->getHrdParameters( getBspCombHrdIdx( h, i, j ) )->getCpbCntMinus1( highestTid ) );
 }
+#endif
+
+#if H_MV_HLS10_VPS_VUI_BSP
+
+TComVpsVuiBspHrdParameters::~TComVpsVuiBspHrdParameters()
+{
+  delete[] m_cprmsAddPresentFlag; 
+  delete[] m_numSubLayerHrdMinus1; 
+  delete[] m_hrdParameters; 
+
+  for (Int h = 0; h < m_numOls; h++)
+  {
+    if ( h > 0 )
+    {    
+      for (Int i = 0; i < getNumSignalledPartitioningSchemes(h)+1; i++)
+      {
+        for (Int t = 0; t < m_vps->getMaxSubLayersInLayerSetMinus1( m_vps->olsIdxToLsIdx(h) ) + 1; t++)
+        {        
+          for ( Int j = 0; j <= getNumBspSchedulesMinus1(h,i,j);j++ )
+          {
+            delete[] m_bspHrdIdx  [h][i][t][j]; 
+            delete[] m_bspSchedIdx[h][i][t][j];
+          }
+        }
+        delete[] m_numBspSchedulesMinus1[h][i];
+      }
+    }
+
+    for (Int j = 0; j <= getNumSignalledPartitioningSchemes(h ) + 1; j++ )
+    {
+      for (Int k = 0; k <= getNumPartitionsInSchemeMinus1(h,j); k++ )
+      {
+        delete[] m_layerIncludedInPartitionFlag[h][j][k];
+      }        
+    }
+    delete[] m_numPartitionsInSchemeMinus1[h];       
+  }
+  delete[] m_numSignalledPartitioningSchemes;
+}
+
+
+Int TComVpsVuiBspHrdParameters::getBspHrdIdxLen(TComVPS* vps)
+{
+  return gCeilLog2( vps->getNumHrdParameters() + getVpsNumAddHrdParams() );
+}
+
+Void TComVpsVuiBspHrdParameters::createAfterVpsNumAddHrdParams( TComVPS* vps )
+{
+  assert( vps == NULL ); 
+  m_vps = vps; 
+  m_offsetHrdParamIdx = vps->getNumHrdParameters(); 
+  m_numHrdParam       = vps->getNumHrdParameters() + getVpsNumAddHrdParams() - m_offsetHrdParamIdx;
+  m_numOls            = vps->getNumOutputLayerSets(); 
+
+  m_cprmsAddPresentFlag   = new Bool    [ m_numHrdParam ];
+  m_numSubLayerHrdMinus1  = new Int     [ m_numHrdParam ];
+  m_hrdParameters         = new TComHRD [ m_numHrdParam ];
+
+  m_numSignalledPartitioningSchemes = new Int    [ m_numOls ]; 
+  m_numPartitionsInSchemeMinus1     = new Int*   [ m_numOls ];
+  m_numBspSchedulesMinus1           = new Int**  [ m_numOls ]; 
+  m_bspHrdIdx                       = new Int****[ m_numOls ];
+  m_bspSchedIdx                     = new Int****[ m_numOls ];
+}
+
+Void TComVpsVuiBspHrdParameters::createAfterNumSignalledPartitioningSchemes( Int h )
+{
+  m_numPartitionsInSchemeMinus1 [h]    = new Int    [ getNumSignalledPartitioningSchemes(h) ];
+  m_layerIncludedInPartitionFlag[h]    = new Bool** [ getNumSignalledPartitioningSchemes(h) ];    
+
+  m_numBspSchedulesMinus1[h]           = new Int*   [ getNumSignalledPartitioningSchemes(h) + 1 ];
+  for (Int i = 0; i < getNumSignalledPartitioningSchemes(h) + 1; i++)
+  {
+    Int tMax = m_vps->getMaxSubLayersInLayerSetMinus1( m_vps->olsIdxToLsIdx(h) ) + 1;
+    m_numBspSchedulesMinus1[h][i] = new Int  [ tMax ];
+    m_bspHrdIdx            [h][i] = new Int**[ tMax ];
+    m_bspSchedIdx          [h][i] = new Int**[ tMax ];
+  }
+}
+
+Void TComVpsVuiBspHrdParameters::createAfterNumPartitionsInSchemeMinus1( Int h, Int j )
+{
+  m_layerIncludedInPartitionFlag[h][j] = new Bool*[ getNumPartitionsInSchemeMinus1(h,j)];
+  for( Int k = 0; k < getNumPartitionsInSchemeMinus1(h,j); k++ )
+  {
+    m_layerIncludedInPartitionFlag[h][j][k] = new Bool[ m_vps->getNumLayersInIdList( m_vps->olsIdxToLsIdx(h))];
+  }
+}
+
+Void TComVpsVuiBspHrdParameters::createAfterNumBspSchedulesMinus1( Int h, Int i, Int t )
+{
+  m_bspSchedIdx[h][i][t] = new Int* [ getNumBspSchedulesMinus1( h, i, t ) + 1 ];
+  m_bspHrdIdx  [h][i][t] = new Int* [ getNumBspSchedulesMinus1( h, i, t ) + 1 ];
+  for( Int j = 0; j < getNumBspSchedulesMinus1( h, i, t ) + 1; j++ )
+  {
+    m_bspSchedIdx[h][i][t][j] = new Int[ getNumPartitionsInSchemeMinus1( h, i ) ];
+    m_bspHrdIdx  [h][i][t][j] = new Int[ getNumPartitionsInSchemeMinus1( h, i ) ];
+  }
+}
+
+#endif
 
 Void TComVUI::inferVideoSignalInfo( TComVPS* vps, Int layerIdCurr )
@@ -4430,5 +5173,9 @@
       for (Int k = 0; k < MAX_NUM_LAYER_IDS; k++ )
       {
+#if H_MV_HLS10_ADD_LAYERSETS
+        m_maxVpsDecPicBufferingMinus1[i][k][j] = MIN_INT; 
+#else
         m_maxVpsDecPicBufferingMinus1[i][k][j] = 0; 
+#endif
       }
     }
Index: trunk/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.h	(revision 1041)
+++ trunk/source/Lib/TLibCommon/TComSlice.h	(revision 1066)
@@ -1,3 +1,3 @@
-/* The copyright in this software is being made available under the BSD
+﻿/* The copyright in this software is being made available under the BSD
  * License, included below. This software may be subject to other third party
  * and contributor rights, including patent rights, and no such rights are
@@ -45,5 +45,11 @@
 #include "TComRom.h"
 #include "TComList.h"
-
+#if H_MV_HLS10_GEN_FIX
+#if H_MV
+#include <ios>
+#include <iostream>
+#include <iomanip>
+#endif
+#endif
 //! \ingroup TLibCommon
 //! \{
@@ -201,4 +207,18 @@
   Bool m_frameOnlyConstraintFlag;
   
+#if H_MV_HLS10_PTL
+#if H_MV
+  Bool m_max12bitConstraintFlag;
+  Bool m_max10bitConstraintFlag;
+  Bool m_max8bitConstraintFlag;
+  Bool m_max422chromaConstraintFlag;
+  Bool m_max420chromaConstraintFlag;
+  Bool m_maxMonochromeConstraintFlag;
+  Bool m_intraConstraintFlag;
+  Bool m_onePictureOnlyConstraintFlag;
+  Bool m_lowerBitRateConstraintFlag;
+  Bool m_inbldFlag;
+#endif
+#endif
 public:
   ProfileTierLevel();
@@ -230,4 +250,43 @@
   Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; }
   Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; }
+
+#if H_MV
+#if H_MV_HLS10_PTL
+  Void setMax12bitConstraintFlag( Bool flag ) { m_max12bitConstraintFlag = flag; } 
+  Bool getMax12bitConstraintFlag(  ) { return m_max12bitConstraintFlag; } 
+  
+  Void setMax10bitConstraintFlag( Bool flag ) { m_max10bitConstraintFlag = flag; } 
+  Bool getMax10bitConstraintFlag(  ) { return m_max10bitConstraintFlag; } 
+  
+  Void setMax8bitConstraintFlag( Bool flag ) { m_max8bitConstraintFlag = flag; } 
+  Bool getMax8bitConstraintFlag(  ) { return m_max8bitConstraintFlag; } 
+  
+  Void setMax422chromaConstraintFlag( Bool flag ) { m_max422chromaConstraintFlag = flag; } 
+  Bool getMax422chromaConstraintFlag(  ) { return m_max422chromaConstraintFlag; } 
+  
+  Void setMax420chromaConstraintFlag( Bool flag ) { m_max420chromaConstraintFlag = flag; } 
+  Bool getMax420chromaConstraintFlag(  ) { return m_max420chromaConstraintFlag; } 
+  
+  Void setMaxMonochromeConstraintFlag( Bool flag ) { m_maxMonochromeConstraintFlag = flag; } 
+  Bool getMaxMonochromeConstraintFlag(  ) { return m_maxMonochromeConstraintFlag; } 
+  Void setIntraConstraintFlag( Bool flag ) { m_intraConstraintFlag = flag; } 
+  Bool getIntraConstraintFlag(  ) { return m_intraConstraintFlag; } 
+  
+  Void setOnePictureOnlyConstraintFlag( Bool flag ) { m_onePictureOnlyConstraintFlag = flag; } 
+  Bool getOnePictureOnlyConstraintFlag(  ) { return m_onePictureOnlyConstraintFlag; } 
+  
+  Void setLowerBitRateConstraintFlag( Bool flag ) { m_lowerBitRateConstraintFlag = flag; } 
+  Bool getLowerBitRateConstraintFlag(  ) { return m_lowerBitRateConstraintFlag; } 
+  
+  Void setInbldFlag( Bool flag ) { m_inbldFlag = flag; } 
+  Bool getInbldFlag(  ) { return m_inbldFlag; } 
+#endif
+#if H_MV_HLS10_PTL_INFER_FIX
+  Bool getV2ConstraintsPresentFlag();  
+  Bool getInbldPresentFlag();
+  Void copyV2ConstraintFlags( ProfileTierLevel* ptlRef );
+  Void copyProfile( ProfileTierLevel* ptlRef );
+#endif
+#endif
 };
 
@@ -251,5 +310,10 @@
   ProfileTierLevel* getSubLayerPTL(Int i)  { return &m_subLayerPTL[i]; }
 #if H_MV
+#if H_MV_HLS10_PTL_INFER_FIX
+  Void inferGeneralValues ( Bool profilePresentFlag  , Int k, TComPTL* refPTL );; 
+  Void inferSubLayerValues( Int maxNumSubLayersMinus1, Int k, TComPTL* refPTL );; 
+#else
   Void copyLevelFrom( TComPTL* source );
+#endif
 #endif
 };
@@ -359,5 +423,5 @@
   Void setCpbCntMinus1           ( Int layer, UInt value ) { m_HRD[layer].cpbCntMinus1 = value; }
   UInt getCpbCntMinus1           ( Int layer            )  { return m_HRD[layer].cpbCntMinus1; }
-
+  
   Void setBitRateValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl] = value; }
   UInt getBitRateValueMinus1     ( Int layer, Int cpbcnt, Int nalOrVcl             ) { return m_HRD[layer].bitRateValueMinus1[cpbcnt][nalOrVcl];  }
@@ -434,6 +498,70 @@
   Int  getMatrixCoeffsVps(  ) { return m_matrixCoeffsVps; } 
 };
+
 class TComVpsVuiBspHrdParameters
 {
+#if H_MV_HLS10_VPS_VUI_BSP
+
+  /* Not yet tested */
+private: 
+
+  Int   m_vpsNumAddHrdParams;
+  Bool* m_cprmsAddPresentFlag;
+  TComHRD* m_hrdParameters; 
+  Int*  m_numSubLayerHrdMinus1;
+  Int*  m_numSignalledPartitioningSchemes;
+  Int** m_numPartitionsInSchemeMinus1;
+
+  Bool****  m_layerIncludedInPartitionFlag;
+  Int***    m_numBspSchedulesMinus1;
+  Int*****  m_bspHrdIdx;
+  Int*****  m_bspSchedIdx;
+    
+  // Array sizes
+  Int      m_offsetHrdParamIdx;
+  Int      m_numHrdParam; 
+  Int      m_numOls; 
+  TComVPS* m_vps; 
+public:   
+
+  ~TComVpsVuiBspHrdParameters();
+  
+  Void createAfterVpsNumAddHrdParams( TComVPS* vps );
+  Void createAfterNumSignalledPartitioningSchemes(Int h );
+  Void createAfterNumPartitionsInSchemeMinus1(Int h, Int j);
+  Void createAfterNumBspSchedulesMinus1( Int h, Int i, Int t);
+
+  Void setVpsNumAddHrdParams( Int  val ) { m_vpsNumAddHrdParams = val; } 
+  Int  getVpsNumAddHrdParams(  ) { return m_vpsNumAddHrdParams; } 
+  
+  Void setCprmsAddPresentFlag( Int i, Bool flag ) { m_cprmsAddPresentFlag[i - m_offsetHrdParamIdx] = flag; } 
+  Bool getCprmsAddPresentFlag( Int i ) { return m_cprmsAddPresentFlag[i  - m_offsetHrdParamIdx]; } 
+  
+  Void setNumSubLayerHrdMinus1( Int i, Int  val ) { m_numSubLayerHrdMinus1[i  - m_offsetHrdParamIdx] = val; } 
+  Int  getNumSubLayerHrdMinus1( Int i ) { return m_numSubLayerHrdMinus1[i  - m_offsetHrdParamIdx]; } 
+  
+  Void setNumSignalledPartitioningSchemes( Int h, Int  val ) { m_numSignalledPartitioningSchemes[h] = val; } 
+  Int  getNumSignalledPartitioningSchemes( Int h ) { return m_numSignalledPartitioningSchemes[h]; } 
+  
+  Void setNumPartitionsInSchemeMinus1( Int h, Int j, Int  val ) { m_numPartitionsInSchemeMinus1[h][j] = val; } 
+  Int  getNumPartitionsInSchemeMinus1( Int h, Int j ) { return m_numPartitionsInSchemeMinus1[h][j]; } 
+  
+  Void setLayerIncludedInPartitionFlag( Int h, Int j, Int k, Int r, Bool flag ) { m_layerIncludedInPartitionFlag[h][j][k][r] = flag; } 
+  Bool getLayerIncludedInPartitionFlag( Int h, Int j, Int k, Int r ) { return m_layerIncludedInPartitionFlag[h][j][k][r]; } 
+  
+  Void setNumBspSchedulesMinus1( Int h, Int i, Int t, Int  val ) { m_numBspSchedulesMinus1[h][i][t] = val; } 
+  Int  getNumBspSchedulesMinus1( Int h, Int i, Int t ) { return m_numBspSchedulesMinus1[h][i][t]; } 
+  
+  Void setBspHrdIdx( Int h, Int i, Int t, Int j, Int k, Int  val ) { m_bspHrdIdx[h][i  - m_offsetHrdParamIdx][t][j][k] = val; } 
+  Int  getBspHrdIdx( Int h, Int i, Int t, Int j, Int k ) { return m_bspHrdIdx[h][i  - m_offsetHrdParamIdx][t][j][k]; } 
+  
+  Int  getBspHrdIdxLen( TComVPS* vps );
+
+  Void setBspSchedIdx( Int h, Int i, Int t, Int j, Int k, Int  val ) { m_bspSchedIdx[h][i - m_offsetHrdParamIdx][t][j][k] = val; } 
+  Int  getBspSchedIdx( Int h, Int i, Int t, Int j, Int k ) { return m_bspSchedIdx[h][i - m_offsetHrdParamIdx][t][j][k]; } 
+
+  Void setHrdParametermeters( Int k, TComHRD* val  ) {  *(m_hrdParameters + k ) = *val; }; 
+  TComHRD* getHrdParametermeters( Int k ) {  return m_hrdParameters + k; }; 
+#else 
 private: 
   Int  m_vpsNumBspHrdParametersMinus1;
@@ -475,4 +603,5 @@
   Void setHrdParametermeters( Int k, TComHRD* val  ) {  m_hrdParameters[k] = val; }; 
   TComHRD* getHrdParametermeters( Int k ) {  return m_hrdParameters[k]; }; 
+#endif
 };
 
@@ -501,4 +630,8 @@
   Bool m_wppNotInUseFlag;
   Bool m_wppInUseFlag                [MAX_NUM_LAYERS];
+#if H_MV_HLS10_VPS_VUI
+  Bool m_singleLayerForNonIrapFlag;
+  Bool m_higherLayerIrapSkipFlag;
+#endif
   Bool m_ilpRestrictedRefLayersFlag;
   Int  m_minSpatialSegmentOffsetPlus1[MAX_NUM_LAYERS][MAX_NUM_LAYERS];
@@ -574,4 +707,12 @@
   Void setWppInUseFlag( Int i, Bool flag ) { m_wppInUseFlag[i] = flag; } 
   Bool getWppInUseFlag( Int i ) { return m_wppInUseFlag[i]; } 
+
+#if H_MV_HLS10_VPS_VUI
+  Void setSingleLayerForNonIrapFlag( Bool flag ) { m_singleLayerForNonIrapFlag = flag; } 
+  Bool getSingleLayerForNonIrapFlag(  ) { return m_singleLayerForNonIrapFlag; } 
+
+  Void setHigherLayerIrapSkipFlag( Bool flag ) { m_higherLayerIrapSkipFlag = flag; } 
+  Bool getHigherLayerIrapSkipFlag(  ) { return m_higherLayerIrapSkipFlag; } 
+#endif
 
   Void setIlpRestrictedRefLayersFlag( Bool flag ) { m_ilpRestrictedRefLayersFlag = flag; } 
@@ -609,7 +750,26 @@
   Int  m_bitDepthVpsLumaMinus8;
   Int  m_bitDepthVpsChromaMinus8;
+#if H_MV_HLS10_GEN_VSP_CONF_WIN
+  Bool m_conformanceWindowVpsFlag;
+  Int  m_confWinVpsLeftOffset;
+  Int  m_confWinVpsRightOffset;
+  Int  m_confWinVpsTopOffset;
+  Int  m_confWinVpsBottomOffset;
+#endif
 
 public: 
+
+#if H_MV_HLS10_GEN_VSP_CONF_WIN
+  TComRepFormat()
+  { 
+  m_conformanceWindowVpsFlag = 0;
+  m_confWinVpsLeftOffset     = 0;
+  m_confWinVpsRightOffset    = 0;
+  m_confWinVpsTopOffset      = 0;
+  m_confWinVpsBottomOffset   = 0;
+  };  
+#else
   TComRepFormat() { };  
+#endif
 
   Void setChromaAndBitDepthVpsPresentFlag( Bool flag ) { m_chromaAndBitDepthVpsPresentFlag = flag; } 
@@ -635,4 +795,21 @@
   Void setBitDepthVpsChromaMinus8( Int  val ) { m_bitDepthVpsChromaMinus8 = val; } 
   Int  getBitDepthVpsChromaMinus8(  ) { return m_bitDepthVpsChromaMinus8; } 
+
+#if H_MV_HLS10_GEN_VSP_CONF_WIN
+  Void setConformanceWindowVpsFlag( Bool flag ) { m_conformanceWindowVpsFlag = flag; } 
+  Bool getConformanceWindowVpsFlag(  ) { return m_conformanceWindowVpsFlag; } 
+
+  Void setConfWinVpsLeftOffset( Int  val ) { m_confWinVpsLeftOffset = val; } 
+  Int  getConfWinVpsLeftOffset(  ) { return m_confWinVpsLeftOffset; } 
+
+  Void setConfWinVpsRightOffset( Int  val ) { m_confWinVpsRightOffset = val; } 
+  Int  getConfWinVpsRightOffset(  ) { return m_confWinVpsRightOffset; } 
+
+  Void setConfWinVpsTopOffset( Int  val ) { m_confWinVpsTopOffset = val; } 
+  Int  getConfWinVpsTopOffset(  ) { return m_confWinVpsTopOffset; } 
+
+  Void setConfWinVpsBottomOffset( Int  val ) { m_confWinVpsBottomOffset = val; } 
+  Int  getConfWinVpsBottomOffset(  ) { return m_confWinVpsBottomOffset; } 
+#endif
 };
 
@@ -657,5 +834,9 @@
 
   Void setMaxVpsDecPicBufferingMinus1( Int i, Int k, Int j, Int  val ) { m_maxVpsDecPicBufferingMinus1[i][k][j] = val; } 
+  #if H_MV_HLS10_ADD_LAYERSETS
+  Int  getMaxVpsDecPicBufferingMinus1( Int i, Int k, Int j ) { assert( m_maxVpsDecPicBufferingMinus1[i][k][j] >= 0 ); return m_maxVpsDecPicBufferingMinus1[i][k][j]; }     
+  #else
   Int  getMaxVpsDecPicBufferingMinus1( Int i, Int k, Int j ) { return m_maxVpsDecPicBufferingMinus1[i][k][j]; } 
+  #endif
 
   Void setMaxVpsNumReorderPics( Int i, Int j, Int  val ) { m_maxVpsNumReorderPics[i][j] = val; } 
@@ -672,4 +853,7 @@
 #if H_MV
   Bool        m_vpsBaseLayerInternalFlag;
+#if H_MV_HLS10_GEN_VSP_BASE_LAYER_AVAIL
+  Bool        m_vpsBaseLayerAvailableFlag;
+#endif // H_MV_HLS10_GEN
 #endif
 
@@ -741,5 +925,9 @@
   Int         m_layerSetIdxForOlsMinus1  [MAX_VPS_OUTPUTLAYER_SETS];  
   Bool        m_outputLayerFlag          [MAX_VPS_OUTPUTLAYER_SETS][MAX_VPS_NUH_LAYER_ID_PLUS1];
+#if H_MV_HLS10_PTL
+  Int         m_profileTierLevelIdx      [MAX_VPS_OUTPUTLAYER_SETS ][MAX_NUM_LAYERS];
+#else  
   Int         m_profileLevelTierIdx      [MAX_VPS_OUTPUTLAYER_SETS ];
+#endif
   Bool        m_altOutputLayerFlag       [MAX_VPS_OUTPUTLAYER_SETS];
   Bool        m_repFormatIdxPresentFlag;
@@ -770,16 +958,33 @@
   // VPS EXTENSION SEMANTICS VARIABLES
   Int         m_layerIdInVps             [MAX_NUM_LAYERS   ];
+#if H_MV_HLS10_REF_PRED_LAYERS
+  Int         m_dependencyFlag           [MAX_NUM_LAYERS][MAX_NUM_LAYERS]; 
+#endif
 
   Int         m_numDirectRefLayers       [MAX_NUM_LAYERS];
+#if H_MV_HLS10_REF_PRED_LAYERS
+  Int         m_idDirectRefLayer         [MAX_NUM_LAYERS][MAX_NUM_LAYERS];  
+#else
   Int         m_refLayerId               [MAX_NUM_LAYERS][MAX_NUM_LAYERS];  
+#endif
 
   Int         m_numRefLayers             [MAX_NUM_LAYER_IDS]; 
-  Int         m_numPredictedLayers       [MAX_NUM_LAYERS]; 
+#if H_MV_HLS10_REF_PRED_LAYERS
+  Int         m_idRefLayer               [MAX_NUM_LAYERS][MAX_NUM_LAYERS];  
+#endif
+
+
+  Int         m_numPredictedLayers       [MAX_NUM_LAYERS ]; 
+#if !H_MV_HLS10_REF_PRED_LAYERS
   Int         m_predictedLayerId         [MAX_NUM_LAYERS][MAX_NUM_LAYER_IDS];
+#else
+  Int         m_idPredictedLayer         [MAX_NUM_LAYERS][MAX_NUM_LAYER_IDS];
+#endif
   Int         m_numIndependentLayers; 
   Int         m_numLayersInTreePartition [MAX_NUM_LAYER_IDS];
   Int         m_treePartitionLayerIdList [MAX_NUM_LAYERS][MAX_NUM_LAYER_IDS];
+#if H_MV_HLS10_REF_PRED_LAYERS
   Bool        m_recursiveRefLayerFlag    [MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS]; 
-
+  #endif
   Int         m_viewIndex                [MAX_NUM_LAYERS   ];
   
@@ -788,7 +993,13 @@
   std::vector< std::vector< Int> >       m_layerSetLayerIdList; 
 
+#if H_MV_HLS10_NESSECARY_LAYER
+  Int        m_numNecessaryLayers        [MAX_VPS_OUTPUTLAYER_SETS];
+  Bool       m_necessaryLayerFlag        [MAX_VPS_OUTPUTLAYER_SETS][MAX_NUM_LAYERS]; 
+#endif
 
   Int         xGetDimBitOffset( Int j );
+#if H_MV_HLS10_REF_PRED_LAYERS
   Void        xSetRefLayerFlags( Int currLayerId );
+#endif
   // VPS EXTENSION 2 SYNTAX ELEMENTS
 #if H_3D_ARP
@@ -870,4 +1081,8 @@
   Void    setVpsBaseLayerInternalFlag( Bool flag ) { m_vpsBaseLayerInternalFlag = flag; } 
   Bool    getVpsBaseLayerInternalFlag(  )          { return m_vpsBaseLayerInternalFlag; } 
+#if H_MV_HLS10_GEN_VSP_BASE_LAYER_AVAIL
+  Void    setVpsBaseLayerAvailableFlag( Bool flag ) { m_vpsBaseLayerAvailableFlag = flag; } 
+  Bool    getVpsBaseLayerAvailableFlag(  )          { return m_vpsBaseLayerAvailableFlag; } 
+#endif
 #endif
 
@@ -877,4 +1092,7 @@
 #if H_MV    
   UInt    getMaxSubLayersMinus1()             { return m_uiMaxTLayers - 1;  }  // For consistency with draft spec
+#if H_MV_HLS10_GEN_FIX
+  Void    setMaxSubLayersMinus1(UInt val)     { m_uiMaxTLayers = (val + 1); };
+#endif
   UInt    getMaxLayersMinus1()                { return m_uiMaxLayersMinus1;  }; 
   Void    setMaxLayersMinus1(UInt l)          { m_uiMaxLayersMinus1 = l; }
@@ -916,5 +1134,9 @@
 
 #if H_MV
+#if H_MV_HLS10_PTL
+  TComPTL* getPTL( Int idx = 0 ) { return &m_pcPTL[idx]; }
+#else
   TComPTL* getPTL( Int layerSet = 0 ) { return &m_pcPTL[layerSet]; }
+#endif
 #else
   TComPTL* getPTL() { return &m_pcPTL; }
@@ -996,4 +1218,7 @@
   Void    setLayerSetIdxForOlsMinus1( Int outLayerSetIdx, Int val )        { m_layerSetIdxForOlsMinus1[ outLayerSetIdx ]  = val; } 
   Int     getLayerSetIdxForOlsMinus1( Int outLayerSetIdx )                 { return m_layerSetIdxForOlsMinus1[ outLayerSetIdx ]; } 
+#if VPS_MISC_UPDATES
+  Int     getLayerSetIdxForOlsMinus1Len( Int outLayerSetIdx )              { return gCeilLog2( getNumLayerSets() ); } 
+#endif
 
   Void    setOutputLayerFlag( Int outLayerSetIdx, Int i, Bool flag )       { m_outputLayerFlag[ outLayerSetIdx ][ i ] = flag; } 
@@ -1002,6 +1227,14 @@
   Bool    inferOutputLayerFlag( Int i, Int j );
 
+#if H_MV_HLS10_PTL
+  Void    setProfileTierLevelIdx( Int i, Int j, Int val )                  { m_profileTierLevelIdx[ i ][ j ] = val; }
+  Int     getProfileTierLevelIdx( Int i, Int j )                           { return m_profileTierLevelIdx[ i ][ j ]; } 
+#if H_MV_HLS10_PTL_FIX
+  Int     inferProfileTierLevelIdx( Int i, Int j );
+#endif
+#else
   Void    setProfileLevelTierIdx( Int outLayerSetIdx, Int val )            { m_profileLevelTierIdx[ outLayerSetIdx ] = val; }
   Int     getProfileLevelTierIdx( Int outLayerSetIdx )                     { return m_profileLevelTierIdx[ outLayerSetIdx ]; } 
+#endif
   
   Void    setAltOutputLayerFlag( Int i, Bool flag )                        { m_altOutputLayerFlag[i] = flag; } 
@@ -1033,6 +1266,8 @@
   TComDpbSize* getDpbSize( )                                               { return m_dpbSize;} 
   
+#if !H_MV_HLS10_ADD_LAYERSETS  
   Void    inferDbpSizeLayerSetZero( TComSPS* sps, Bool encoder );
-  
+#endif
+
   Void    setPocLsbNotPresentFlag( Int i, Bool flag )                      { m_pocLsbNotPresentFlag[i] = flag; } 
   Bool    getPocLsbNotPresentFlag( Int i )                                 { return m_pocLsbNotPresentFlag[i]; } 
@@ -1064,12 +1299,27 @@
 
   Int     getViewIndex    ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), VIEW_ORDER_INDEX  ); }    
+#if H_MV_HLS10_AUX
+  Int     getAuxId        ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), AUX_ID  ); }    
+  Int     getDependencyId ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), DEPENDENCY_ID  ); }    
+#endif
   Int     getNumViews();
 
+#if H_MV_HLS10_REF_PRED_LAYERS
+  Bool    getDependencyFlag( Int i, Int j )                                { return m_dependencyFlag[i][j]; }
+#endif
   Int     getNumDirectRefLayers( Int layerIdInNuh )                        { return m_numDirectRefLayers[ layerIdInNuh ];  };                               
+#if !H_MV_HLS10_REF_PRED_LAYERS
   Int     getRefLayerId        ( Int layerIdInNuh, Int idx );; 
-
+#endif
   Int     getNumRefLayers            ( Int i )        { return m_numRefLayers[i]; } 
   Int     getNumPredictedLayers      ( Int i )        { return m_numPredictedLayers[i]; } 
+
+#if !H_MV_HLS10_REF_PRED_LAYERS  
   Int     getPredictedLayerId        ( Int i, Int j ) { return m_predictedLayerId[i][j]; } 
+#else
+  Int     getIdRefLayer              ( Int i, Int j ) { assert( j >= 0 && j < getNumRefLayers      ( i )); return m_idRefLayer      [i][j]; } 
+  Int     getIdPredictedLayer        ( Int i, Int j ) { assert( j >= 0 && j < getNumPredictedLayers( i )); return m_idPredictedLayer[i][j]; } 
+  Int     getIdDirectRefLayer        ( Int i, Int j ) { assert( j >= 0 && j < getNumDirectRefLayers( i )); return m_idDirectRefLayer[i][j]; } 
+#endif
   Int     getNumIndependentLayers    (  )             { return m_numIndependentLayers; } 
   Int     getNumLayersInTreePartition( Int i )        { return m_numLayersInTreePartition[i]; } 
@@ -1078,8 +1328,16 @@
   Int     getNumLayerSets( )                                               { return getVpsNumLayerSetsMinus1() + 1 + getNumAddLayerSets();  };  
   
+#if H_MV_HLS10_ADD_LAYERSETS
+  Int     getFirstAddLayerSetIdx()                    { return getVpsNumLayerSetsMinus1() + 1; } 
+  Int     getLastAddLayerSetIdx()                     { return getFirstAddLayerSetIdx() + getNumAddLayerSets() - 1; }
+#endif
   Bool    checkVPSExtensionSyntax(); 
   Int     scalTypeToScalIdx   ( ScalabilityType scalType );
 
+#if H_MV_HLS10_PTL
+  Int     getProfileTierLevelIdxLen()                                      { return gCeilLog2( getVpsNumProfileTierLevelMinus1() + 1 ); };       
+#else
   Int     getProfileLevelTierIdxLen()                                      { return gCeilLog2( getVpsNumProfileTierLevelMinus1() + 1 ); };       
+#endif
   Int     getVpsRepFormatIdxLen()                                          { return gCeilLog2( getVpsNumRepFormatsMinus1() + 1 ); };       
 
@@ -1092,9 +1350,11 @@
   Void    deriveLayerSetLayerIdList();
 
+#if H_MV_HLS10_ADD_LAYERSETS
+  Int     olsIdxToLsIdx( Int i )                                           { return ( i < getNumLayerSets() ) ? i  : getLayerSetIdxForOlsMinus1( i ) + 1 ; };
+#else
   Int     olsIdxToLsIdx( Int i )                                           { return ( i <= getVpsNumLayerSetsMinus1() ) ? i  : getLayerSetIdxForOlsMinus1( i ) + 1 ; };
-
+#endif
   Void    initTargetLayerIdLists  ( );
   Void    deriveTargetLayerIdList ( Int i );
-
   std::vector<Int> getTargetDecLayerIdList( Int targetDecLayerSetIdx )     { return m_targetDecLayerIdLists[targetDecLayerSetIdx]; }; 
   std::vector<Int> getTargetOptLayerIdList( Int targetOptLayerSetIdx )     { return m_targetOptLayerIdLists[targetOptLayerSetIdx]; }; 
@@ -1103,8 +1363,15 @@
   Int     getOlsHighestOutputLayerId( Int i )                              { return getTargetOptLayerIdList( i ).back(); };  
 
+#if H_MV_HLS10_ADD_LAYERSETS
+  Void    deriveAddLayerSetLayerIdList( Int i );
+#endif
+#if H_MV_HLS10_NESSECARY_LAYER
+  Void    deriveNecessaryLayerFlags( Int olsIdx );;
+  Int     getNecessaryLayerFlag( Int i, Int j )                            { AOF( i >= 0 && i < getNumOutputLayerSets() ); AOF( j >= 0 && j < getNumLayersInIdList( olsIdxToLsIdx( i ) )  );  return m_necessaryLayerFlag[i][j]; };  
+#endif
+
   Int     getMaxSubLayersInLayerSetMinus1( Int i );
   Int     getHighestLayerIdxPlus1Len( Int j )                                   { return gCeilLog2( getNumLayersInTreePartition( j ) + 1 );   }; 
-
-  Bool     getAltOutputLayerFlagVar( Int i );;
+  Bool    getAltOutputLayerFlagVar( Int i );;
 
   // inference
@@ -1113,6 +1380,62 @@
 
   // helpers
+#if !H_MV_HLS10_REF_PRED_LAYERS
   Bool    getInDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps, Int depth = 0 );
+#endif
+#if !H_MV_HLS10_MAXNUMPICS
   Int     getMaxNumPics( Int layerId );
+#endif
+#if H_MV_HLS10_ADD_LAYERSETS
+  Void    printPTL();
+  Void    printLayerDependencies();
+#if H_MV_HLS10_AUX
+  Void    printScalabilityId();;
+#endif
+  Void    printLayerSets();;
+
+
+
+  template <typename T, typename S, typename U> Void xPrintArray( const Char* name, Int numElemDim1, U idx, S numElemDim2, T vec, Bool printNumber, Bool printIdx = true )
+  {
+    std::cout << std::endl; 
+    for (Int j = 0; j < numElemDim1; j++ )
+    { 
+      std::cout << std::right << std::setw(27) << name; 
+      if (printIdx)
+      {
+        std::cout << "[" << std::right << std::setw(3) << idx[ j ] << "]" ; 
+      }
+      else
+      {
+        std::cout << std::right << std::setw(5) << " "; 
+      }
+      
+      if ( printNumber )
+      {
+        std::cout << " (" << std::right << std::setw(3) << numElemDim2[j] << ")";        
+      }          
+      else
+      {
+       std::cout << std::right << std::setw(6) << " ";              
+      }
+
+      std::cout << ":";
+      for (Int i = 0; i < numElemDim2[j]; i++)
+      {
+        std::cout << std::right << std::setw(3) << vec[j][i];
+      }   
+      std::cout << std::endl; 
+    }
+  }
+
+  template <typename T> Void xPrintArray( const char* name, Int numElem, T vec, Bool printNumber  )
+  {
+    std::vector<Int> numElemDim2(1, numElem);    
+    std::vector<T>   vec2       (1,  vec    );
+    std::vector<Int> idx2       (0); 
+    xPrintArray( name, 1, idx2, numElemDim2, vec2, printNumber, false );
+  }
+#endif
+
 
   /// VPS EXTENSION 2 SYNTAX ELEMENTS
@@ -1557,4 +1880,8 @@
   TComVPS*    m_pcVPS; 
   // SPS 
+#if H_MV_HLS10_MULTILAYERSPS
+  Int         m_spsMaxSubLayersMinus1;
+  Int         m_spsExtOrMaxSubLayersMinus1;
+#endif
   Bool        m_spsExtensionPresentFlag; 
 
@@ -1574,4 +1901,5 @@
   // SPS Extension 
   Bool        m_interViewMvVertConstraintFlag;
+#if !H_MV_HLS10_PPS
   Int         m_numScaledRefLayerOffsets;
   Int         m_scaledRefLayerId          [MAX_NUM_SCALED_REF_LAYERS];
@@ -1580,4 +1908,5 @@
   Int         m_scaledRefLayerRightOffset [MAX_NUM_LAYERS];
   Int         m_scaledRefLayerBottomOffset[MAX_NUM_LAYERS];
+#endif
 #endif
 #if H_3D
@@ -1683,4 +2012,7 @@
 #if H_MV
   UInt      getSpsMaxSubLayersMinus1()                { return ( m_uiMaxTLayers - 1); }
+#if H_MV_HLS10_MULTILAYERSPS
+  Void      setSpsMaxSubLayersMinus1( UInt val )       { setMaxTLayers( val + 1 ); }
+#endif
 #endif
 
@@ -1715,4 +2047,11 @@
   TComPTL* getPTL()     { return &m_pcPTL; }
 #if H_MV
+#if H_MV_HLS10_MULTILAYERSPS
+  Void setSpsExtOrMaxSubLayersMinus1( Int  val ) { m_spsExtOrMaxSubLayersMinus1 = val; } 
+  Int  getSpsExtOrMaxSubLayersMinus1(  ) { return m_spsExtOrMaxSubLayersMinus1; } 
+  Void inferSpsMaxSubLayersMinus1( Bool atPsActivation, TComVPS* vps  );
+
+  Bool getMultiLayerExtSpsFlag()            { return ( getLayerId() != 0  &&  getSpsExtOrMaxSubLayersMinus1() == 7 ); }
+#endif
   Void inferSpsMaxDecPicBufferingMinus1( TComVPS* vps, Int targetOptLayerSetIdx, Int currLayerId, Bool encoder );
 
@@ -1753,4 +2092,5 @@
   Bool getInterViewMvVertConstraintFlag()         { return m_interViewMvVertConstraintFlag;}
 
+#if !H_MV_HLS10_PPS
   Void setNumScaledRefLayerOffsets( Int  val )    { m_numScaledRefLayerOffsets = val; } 
   Int  getNumScaledRefLayerOffsets(  )            { return m_numScaledRefLayerOffsets; } 
@@ -1770,5 +2110,7 @@
   Void setScaledRefLayerBottomOffset( Int j, Int  val ) { m_scaledRefLayerBottomOffset[j] = val; } 
   Int  getScaledRefLayerBottomOffset( Int j )           { return m_scaledRefLayerBottomOffset[j]; } 
+#endif
   // Inference 
+
   Void inferRepFormat( TComVPS* vps, Int layerIdCurr );
   Void inferScalingList( TComSPS* spsSrc );
@@ -2195,4 +2537,8 @@
 
   Bool       m_enableTMVPFlag;
+#if I0044_SLICE_TMVP
+  Bool       m_availableForTMVPRefFlag;
+#endif
+
 #if H_MV
   std::vector<TComPic*>* m_refPicSetInterLayer0; 
@@ -2255,4 +2601,8 @@
 #if MTK_SINGLE_DEPTH_MODE_I0095
   Bool      m_bApplySingleDepthMode;
+#endif
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX
+  Int *m_aICEnableCandidate;
+  Int *m_aICEnableNum;
 #endif
 public:
@@ -2527,4 +2877,8 @@
   Void      setEnableTMVPFlag     ( Bool   b )    { m_enableTMVPFlag = b; }
   Bool      getEnableTMVPFlag     ()              { return m_enableTMVPFlag;}
+#if I0044_SLICE_TMVP
+  Void      setAvailableForTMVPRefFlag     ( Bool   b )    { m_availableForTMVPRefFlag = b; }
+  Bool      getAvailableForTMVPRefFlag     ()              { return m_availableForTMVPRefFlag;}
+#endif
 
 #if H_MV
@@ -2567,4 +2921,13 @@
 #endif
 #endif
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX
+  Void    setICEnableCandidate( Int* ICEnableCandidate)   { m_aICEnableCandidate = ICEnableCandidate; };
+  Void    setICEnableNum( Int* ICEnableNum)   { m_aICEnableNum = ICEnableNum; };
+  Void    setICEnableCandidate( UInt layer, Int value)   { m_aICEnableCandidate[ layer ] = value; };
+  Void    setICEnableNum( UInt layer, Int value)   { m_aICEnableNum[ layer ] = value; };
+
+  Int    getICEnableCandidate( Int layer){ return  m_aICEnableCandidate[ layer ]; }; 
+  Int    getICEnableNum( Int layer){ return m_aICEnableNum[ layer ]; }; 
+#endif
 #if H_MV
 // Additional slice header syntax elements
Index: trunk/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- trunk/source/Lib/TLibCommon/TypeDef.h	(revision 1041)
+++ trunk/source/Lib/TLibCommon/TypeDef.h	(revision 1066)
@@ -123,4 +123,7 @@
                                               // SEC_IC_ARP_SIG_G0072, Disabling IC when ARP is enabled, option 1 in JCT3V-G0072, part 2 in JCT3V-G0121
                                               // MTK_LOW_LATENCY_IC_ENCODING_H0086  Low-latency IC encoding in JCT3V-H0086
+
+#define MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX  1  // Remove the global variables used in JCT3V-H0086
+
 
 #define SEC_IC_NEIGHBOR_CLIP_I0080        1   // Clipping of neighboring sample position, JCT3V-I0080
@@ -225,4 +228,5 @@
 #endif
 
+#define H_3D_FIX_UNINIT                   1   // Fix uninitialized flag
 #define H_3D_INTER_SDC                    1   // INTER SDC, Inter simplified depth coding
                                               // LGE_INTER_SDC_E0156 Enable inter SDC for depth coding
@@ -251,4 +255,7 @@
 
 #define H_3D_FCO                          0   // Flexible coding order for 3D
+#if H_3D_FCO
+#define LGE_FCO_I0116                     1
+#endif
 
 #define SCU_HS_FAST_INTRA_SDC_I0123       1
@@ -275,4 +282,5 @@
 #define SEC_HLS_CLEANUP_I0100             1
 
+#define H_3D_FIX_64BIT_SHIFT              1
 #endif // H_3D
 
@@ -300,5 +308,5 @@
 #define H_3D_VSO_RM_ASSERTIONS            0   // Output VSO assertions
 #define H_3D_VSO_SYNTH_DIST_OUT           0   // Output of synthesized view distortion instead of depth distortion in encoder output
-#define H_3D_VSO_FIX                      0   // This fix should be enabled after verification 
+#define H_3D_VSO_FIX                      1   // This fix should be enabled after verification 
 #endif
 
@@ -381,5 +389,46 @@
 /////////////////////////////////////////////////////////////////////////////////
 // TBD: Check if integration is necessary. 
+
+
+
+//Added by Qualcomm for HLS
+#define DISCARDABLE_PIC_RPS              1      ///< JCT3V-G0131: Inter-layer RPS and temporal RPS should not contain picture with discardable_flag equal to 1
+#define VPS_MISC_UPDATES                 1      ///< Misc updates:JCT3V-0240, 
+#define NON_REF_NAL_TYPE_DISCARDABLE     1      ///< JCT3V-G0031: If discardable picture is a non-IRAP, it must be a non-referenced sub-layer picture
+#define INFERENCE_POC_MSB_VAL_PRESENT    1      ///< JCT3V-H0042: poc_msb_val_present_flag shall be equal to 0 when slice_header_extension_length is (inferred to be ) equal to 0
+#define INFERENCE_POC_RESET_INFO_PRESENT 1      ///< JCT3V-H0042: Infer the value of poc_reset_info_present_flag to be equal to 0 when no pps extension / pps extension for multilayer.
+#define I0044_SLICE_TMVP                 1      ///< JCT3V-I0044: Regarding slice_temporal_mvp_enabled_flag
+#define I0045_BR_PR_ADD_LAYER_SET        1      ///< JCT3V-I0045: Signalling of bit-rate and picture rate for additional layer set
+#define I0045_VPS_VUI_VST_PARAMS         1      ///< JCT3V-I0045: Related to signalling of VST parameters of the base layer.
+
+
+#define H_MV_HLS10_GEN                       0  // General changes (not tested)
+
+#define H_MV_HLS10_AUX                       1 // Auxiliary pictures
+#define H_MV_HLS10_GEN_FIX                   1
+#define H_MV_FIX_LOOP_GOPSIZE                1
+#define H_MV_FIX_SUB_LAYERS_MAX_MINUS1       1
+
+#define H_MV_HLS10_GEN_VSP_CONF_WIN          1  // VPS conformance window
+#define H_MV_HLS10_GEN_VSP_BASE_LAYER_AVAIL  1  // vps_base_layer_available
+#define H_MV_HLS10_REF_PRED_LAYERS           1  // reference and predicted layer derivation
+#define H_MV_HLS10_NESSECARY_LAYER           1  // necessary layers
+#define H_MV_HLS10_ADD_LAYERSETS             1  // additional layer sets
+#define H_MV_HLS10_DBP_SIZE                  1  // dpb size syntax structure
+#define H_MV_HLS10_MAXNUMPICS                1  // constraint on number of pictures in rps  
+#define H_MV_HLS10_PTL                       1  // profile tier level
+#define H_MV_HLS10_PTL_FIX                   1  // profile tier level fix
+#define H_MV_HLS10_PTL_INBL_FIX              1  // profile tier level fix 
+#define H_MV_HLS10_PTL_INFER_FIX             1  // fix inference ptl
+#define H_MV_HLS10_MULTILAYERSPS             1  // multilayer SPS extension 
+#define H_MV_HLS10_VPS_VUI                   1  // vsp vui
+#define H_MV_HLS10_VPS_VUI_BSP               1  // vsp vui bsp
+#define H_MV_HLS10_PPS                       1  // PPS modifications
+
+#define H_MV_HLS10_VPS_VUI_BSP_STORE         0  // Currently bsp vui bsp hrd parameters are not stored, some dynamic memory allocation with upper bounds is required. 
+
+
 #define H_MV_HLS7_GEN                        0  // General changes (not tested)
+
 
 // POC
@@ -457,7 +506,17 @@
 #define MAX_NESTING_NUM_LAYER       64
 
+#if H_MV_HLS10_VPS_VUI_BSP
+#define MAX_VPS_NUM_HRD_PARAMETERS                1024
+#define MAX_NUM_SUB_LAYERS                        7
+#define MAX_NUM_SIGNALLED_PARTITIONING_SCHEMES    16
+#else
 #define MAX_VPS_NUM_HRD_PARAMETERS                1
+#endif
+
 #define MAX_VPS_OP_SETS_PLUS1                     1024
 #if H_MV
+#if H_MV_HLS10_ADD_LAYERSETS
+#define MAX_VPS_NUM_ADD_LAYER_SETS                1024
+#endif
 #define MAX_VPS_NUH_LAYER_ID_PLUS1  63
 #define MAX_NUM_SCALABILITY_TYPES   16
@@ -474,11 +533,17 @@
 #define MAX_VPS_PROFILE_TIER_LEVEL      64
 #define MAX_VPS_ADD_OUTPUT_LAYER_SETS   1024
+#if H_MV_HLS10_ADD_LAYERSETS
+#define MAX_VPS_OUTPUTLAYER_SETS        ( MAX_VPS_ADD_OUTPUT_LAYER_SETS + MAX_VPS_OP_SETS_PLUS1 + MAX_VPS_OP_SETS_PLUS1 )
+#else
 #define MAX_VPS_OUTPUTLAYER_SETS        ( MAX_VPS_ADD_OUTPUT_LAYER_SETS + MAX_VPS_OP_SETS_PLUS1 )
+#endif
 #define  MAX_NUM_VIDEO_SIGNAL_INFO      16
 #define MAX_NUM_SCALED_REF_LAYERS       MAX_NUM_LAYERS-1
+#if !H_MV_HLS10_VPS_VUI_BSP
 #define MAX_NUM_BSP_HRD_PARAMETERS      100 ///< Maximum value is actually not specified
 #define MAX_NUM_BITSTREAM_PARTITIONS    100 ///< Maximum value is actually not specified 
 #define MAX_NUM_BSP_SCHED_COMBINATION   100 ///< Maximum value is actually not specified 
 #define MAX_SUB_STREAMS                 1024
+#endif
 #else
 #define MAX_NUM_LAYER_IDS                64
@@ -951,8 +1016,15 @@
     MAINSTILLPICTURE = 3,
 #if H_MV
+#if H_MV_HLS10_PTL
+    MULTIVIEWMAIN = 6,
+#if H_3D
+    MAIN3D = 8, 
+#endif
+#else
     MAINSTEREO = 4,
     MAINMULTIVIEW = 5,
 #if H_3D
     MAIN3D = 6, 
+#endif
 #endif
 #endif
@@ -997,4 +1069,8 @@
 #endif    
     VIEW_ORDER_INDEX  = 1,
+#if H_MV_HLS10_AUX
+    DEPENDENCY_ID = 2,
+    AUX_ID = 3,
+#endif    
   };
 #endif
