Index: trunk/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1039)
+++ trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1066)
@@ -241,8 +241,16 @@
   {"main-still-picture", Profile::MAINSTILLPICTURE},
 #if H_MV
+#if H_MV_HLS10_PTL
+  {"multiview-main", Profile::MULTIVIEWMAIN},
+#if H_3D
+  {"3d-main"       , Profile::MAIN3D},
+#endif
+
+#else
   {"main-stereo",    Profile::MAINSTEREO},
   {"main-multiview", Profile::MAINMULTIVIEW},
 #if H_3D
   {"main-3d"    , Profile::MAIN3D},
+#endif
 #endif
 #endif
@@ -333,4 +341,9 @@
 #if H_MV
   vector<Int>   cfg_dimensionLength; 
+#if H_MV_HLS10_PTL
+  string        cfg_profiles;
+  string        cfg_levels; 
+  string        cfg_tiers; 
+#endif
 #if H_3D 
   cfg_dimensionLength.push_back( 2  );  // depth
@@ -367,5 +380,9 @@
   ("NumberOfLayers",        m_numberOfLayers     , 1,                     "Number of layers")
 #if !H_3D
+#if H_MV_HLS10_AUX
+  ("ScalabilityMask",       m_scalabilityMask    , 2                    , "Scalability Mask: 2: Multiview, 8: Auxiliary, 10: Multiview + Auxiliary")    
+#else
   ("ScalabilityMask",       m_scalabilityMask    , 2                    , "Scalability Mask")    
+#endif
 #else
   ("ScalabilityMask",       m_scalabilityMask    , 3                    , "Scalability Mask, 1: Texture 3: Texture + Depth ")    
@@ -374,4 +391,7 @@
   ("ViewOrderIndex",        m_viewOrderIndex     , std::vector<Int>(1,0), "View Order Index per layer")
   ("ViewId",                m_viewId             , std::vector<Int>(1,0), "View Id per View Order Index")
+#if H_MV_HLS10_AUX
+  ("AuxId",                 m_auxId              , std::vector<Int>(1,0), "AuxId per layer")
+#endif
 #if H_3D
   ("DepthFlag",             m_depthFlag          , std::vector<Int>(1,0), "Depth Flag")
@@ -388,5 +408,8 @@
 #endif
 #endif
-  ("LayerIdInNuh",          m_layerIdInNuh       , std::vector<Int>(1,0), "LayerId in Nuh")
+#if H_MV_HLS10_GEN_FIX
+  ("TargetEncLayerIdList",  m_targetEncLayerIdList, std::vector<Int>(0,0), "LayerIds in Nuh to be encoded")  
+#endif
+  ("LayerIdInNuh",          m_layerIdInNuh       , std::vector<Int>(1,0), "LayerId in Nuh")  
   ("SplittingFlag",         m_splittingFlag      , false                , "Splitting Flag")    
 
@@ -394,4 +417,8 @@
   ("VpsNumLayerSets",       m_vpsNumLayerSets    , 1                    , "Number of layer sets")    
   ("LayerIdsInSet_%d",      m_layerIdsInSets     , std::vector<Int>(1,0), MAX_VPS_OP_SETS_PLUS1 ,"LayerIds of Layer set")  
+#if H_MV_HLS10_ADD_LAYERSETS
+  ("NumAddLayerSets"     , m_numAddLayerSets     , 0                                              , "NumAddLayerSets     ")
+  ("HighestLayerIdxPlus1_%d", m_highestLayerIdxPlus1, std::vector< Int  >(0,0)  ,MAX_VPS_NUM_ADD_LAYER_SETS, "HighestLayerIdxPlus1")
+#endif
   ("DefaultTargetOutputLayerIdc"     , m_defaultOutputLayerIdc     , 0, "Specifies output layers of layer sets, 0: output all layers, 1: output highest layer, 2: specified by LayerIdsInDefOutputLayerSet")
   ("OutputLayerSetIdx",     m_outputLayerSetIdx  , std::vector<Int>(0,0), "Indices of layer sets used as additional output layer sets")  
@@ -400,6 +427,10 @@
   ("LayerIdsInDefOutputLayerSet_%d", m_layerIdsInDefOutputLayerSet      , std::vector<Int>(0,0), MAX_VPS_OP_SETS_PLUS1, "Indices in VPS of output layers in layer set")  
   ("AltOutputLayerFlag",    m_altOutputLayerFlag , std::vector<Bool>(1,0), "Alt output layer flag")
+  
+#if H_MV_HLS10_PTL
+  ("ProfileTierLevelIdx_%d",  m_profileTierLevelIdx, std::vector<Int>(0), MAX_NUM_LAYERS, "Indices to profile level tier for ols")
+#else
   ("ProfileLevelTierIdx",   m_profileLevelTierIdx, std::vector<Int>(1,0), "Indices to profile level tier")
-  
+#endif
   // Layer dependencies
   ("DirectRefLayers_%d",    m_directRefLayers    , std::vector<Int>(0,0), MAX_NUM_LAYERS, "LayerIds of direct reference layers")
@@ -431,8 +462,14 @@
   
   // Profile and level
+#if H_MV_HLS10_PTL
+  ("Profile", cfg_profiles,   string(""),           "Profile in VpsProfileTierLevel (Indication only)")
+  ("Level",   cfg_levels ,    string(""),           "Level indication in VpsProfileTierLevel (Indication only)")
+  ("Tier",    cfg_tiers  ,    string(""),           "Tier indication in VpsProfileTierLevel (Indication only)")
+  ("InblFlag",m_inblFlag ,    std::vector<Bool>(0), "InblFlags in VpsProfileTierLevel (Indication only)" )
+#else
   ("Profile", m_profile,   Profile::NONE, "Profile to be used when encoding (Incomplete)")
   ("Level",   m_level,     Level::NONE,   "Level limit to be used, eg 5.1 (Incomplete)")
   ("Tier",    m_levelTier, Level::MAIN,   "Tier to use for interpretation of --Level")
-
+#endif
   ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive")
   ("InterlacedSource",  m_interlacedSourceFlag,  false, "Indicate that source is interlaced")
@@ -613,5 +650,7 @@
 #endif
 #if H_MV
-
+#if H_MV_HLS10_GEN_FIX
+// A lot of this stuff could should actually be derived by the encoder.
+#endif // H_MV_HLS10_GEN
   // VPS VUI
   ("VpsVuiPresentFlag"           , m_vpsVuiPresentFlag           , false                                           , "VpsVuiPresentFlag           ")
@@ -637,4 +676,8 @@
   ("CtuBasedOffsetEnabledFlag"   , m_ctuBasedOffsetEnabledFlag   , std::vector< Bool >(1,0)  ,MAX_NUM_LAYERS       , "CtuBasedOffsetEnabledFlag    per direct reference for the N-th layer")
   ("MinHorizontalCtuOffsetPlus1" , m_minHorizontalCtuOffsetPlus1 , std::vector< Int  >(1,0)  ,MAX_NUM_LAYERS       , "MinHorizontalCtuOffsetPlus1  per direct reference for the N-th layer")
+#if H_MV_HLS10_VPS_VUI
+  ("SingleLayerForNonIrapFlag", m_singleLayerForNonIrapFlag, false                                          , "SingleLayerForNonIrapFlag")
+  ("HigherLayerIrapSkipFlag"  , m_higherLayerIrapSkipFlag  , false                                          , "HigherLayerIrapSkipFlag  ")
+#endif
 #endif
 
@@ -742,4 +785,8 @@
   ("SEISubBitstreamAvgBitRate",               m_sbPropAvgBitRate,             std::vector< Int  >(1,0)  ,"Specifies average bit rate of the i-th sub-bitstream")
   ("SEISubBitstreamMaxBitRate",               m_sbPropMaxBitRate,             std::vector< Int  >(1,0)  ,"Specifies maximum bit rate of the i-th sub-bitstream")
+
+#if H_MV_HLS10_GEN_FIX
+  ("OutputVpsInfo",                           m_outputVpsInfo,                false                     ,"Output information about the layer dependencies and layer sets")
+#endif
 #endif
 #if H_3D
@@ -792,5 +839,6 @@
 #endif //H_3D
   ;
-  #if H_MV
+
+#if H_MV
   // parse coding structure
   for( Int k = 0; k < MAX_NUM_LAYERS; k++ )
@@ -1034,4 +1082,7 @@
   }
   m_iNumberOfViews = (Int) uniqueViewOrderIndices.size(); 
+#if H_MV_HLS10_AUX
+  xResizeVector( m_auxId );
+#endif
 
 #if H_3D
@@ -1067,5 +1118,9 @@
   xResizeVector( m_wppInUseFlag ); 
 
+#if H_MV_HLS10_ADD_LAYERSETS
+  for (Int olsIdx = 0; olsIdx < m_vpsNumLayerSets + m_numAddLayerSets + (Int) m_outputLayerSetIdx.size(); olsIdx++)
+#else
   for (Int olsIdx = 0; olsIdx < m_vpsNumLayerSets + (Int) m_outputLayerSetIdx.size(); olsIdx++)
+#endif
   {    
     m_altOutputLayerFlag.push_back( false );      
@@ -1177,4 +1232,55 @@
     }
   }
+
+#if H_MV
+#if H_MV_HLS10_PTL
+  // parse PTL
+  Bool anyEmpty = false; 
+  if( cfg_profiles.empty() )
+  {
+#if H_3D
+    cfg_profiles = string("main main 3d-main");
+#else
+    cfg_profiles = string("main main multiview-main");    
+#endif
+    fprintf(stderr, "\nWarning: No profiles given, using defaults: %s", cfg_profiles.c_str() );
+    anyEmpty = true; 
+  }
+
+  if( cfg_levels.empty() )
+  {
+    cfg_levels = string("none none none");
+    fprintf(stderr, "\nWarning: No levels given, using defaults: %s", cfg_levels.c_str() );
+    anyEmpty = true; 
+  }
+
+  if( cfg_tiers.empty() )
+  {
+    cfg_tiers = string("main main main");
+    fprintf(stderr, "\nWarning: No tiers given, using defaults: %s", cfg_tiers.c_str());
+    anyEmpty = true; 
+  }
+
+  if( m_inblFlag.empty() )
+  {
+    fprintf(stderr, "\nWarning: No inblFlags given, using defaults:");
+    for( Int i = 0; i < 3; i++)
+    {
+      m_inblFlag.push_back( false );
+      fprintf(stderr," %d", (Int) m_inblFlag[i]);
+    }
+    anyEmpty = true; 
+  }   
+
+  if ( anyEmpty )
+  {
+    fprintf( stderr, "\n" );
+  }
+
+  xReadStrToEnum( cfg_profiles, m_profile   ); 
+  xReadStrToEnum( cfg_levels,   m_level     ); 
+  xReadStrToEnum( cfg_tiers ,   m_levelTier ); 
+#endif
+#endif
 #if H_3D
   // set global varibles
@@ -1291,4 +1397,7 @@
     fprintf(stderr, "******************************************************************\n");
   }
+
+
+#if !H_MV_HLS10_PTL
   if( m_profile==Profile::NONE )
   {
@@ -1303,4 +1412,5 @@
     fprintf(stderr, "***************************************************************************\n");
   }
+#endif
 
   Bool check_failed = false; /* abort if there is a fatal configuration problem */
@@ -1321,5 +1431,9 @@
   xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");
 #else
+#if H_MV_HLS10_AUX
+  xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 8 && m_scalabilityMask != 10, "Scalability Mask must be equal to 2, 8 or 10");
+#else
   xConfirmPara( m_scalabilityMask != 2 , "Scalability Mask must be equal to 2. ");
+#endif
 #endif
 
@@ -1332,5 +1446,16 @@
 
   m_dimIds.push_back( m_viewOrderIndex );   
-  xConfirmPara(  m_dimensionIdLen.size() < m_dimIds.size(), "DimensionIdLen must be given for all dimensions. "   );   Int dimBitOffset[MAX_NUM_SCALABILITY_TYPES+1]; 
+#if H_MV_HLS10_AUX
+  for (Int i = 0; i < m_auxId.size(); i++)
+  {
+    xConfirmPara( !( ( m_auxId[i] >= 0 && m_auxId[i] <= 2 ) || ( m_auxId[i] >= 128 && m_auxId[i] <= 159 ) ) , "AuxId shall be in the range of 0 to 2, inclusive, or 128 to 159, inclusive");
+  }
+  if ( m_scalabilityMask & ( 1 << AUX_ID ) )
+  {
+    m_dimIds.push_back ( m_auxId );
+  }
+#endif  
+  xConfirmPara(  m_dimensionIdLen.size() < m_dimIds.size(), "DimensionIdLen must be given for all dimensions. "   );
+  Int dimBitOffset[MAX_NUM_SCALABILITY_TYPES+1]; 
 
   dimBitOffset[ 0 ] = 0; 
@@ -1428,6 +1553,10 @@
   {   
     Int refLayerSetIdx = m_outputLayerSetIdx[ lsIdx ]; 
+#if H_MV_HLS10_ADD_LAYERSETS
+    xConfirmPara(  refLayerSetIdx < 0 || refLayerSetIdx >= m_vpsNumLayerSets + m_numAddLayerSets, "Output layer set idx must be greater or equal to 0 and less than the VpsNumLayerSets plus NumAddLayerSets." );
+#else
     xConfirmPara(  refLayerSetIdx < 0 || refLayerSetIdx >= m_vpsNumLayerSets, "Output layer set idx must be greater or equal to 0 and less than the VpsNumLayerSets." );
-
+#endif
+#if !H_MV_HLS10_ADD_LAYERSETS
     for (Int i = 0; i < m_layerIdsInAddOutputLayerSet[ lsIdx ].size(); i++)
     {
@@ -1443,4 +1572,5 @@
       xConfirmPara( !isAlsoInLayerSet, "All output layers of a output layer set be included in corresponding layer set.");
     }
+#endif
   }
 
@@ -1454,5 +1584,12 @@
       anyDefaultOutputFlag = anyDefaultOutputFlag || ( m_layerIdsInDefOutputLayerSet[lsIdx].size() != 0 );
     }    
+#if H_MV_HLS10_ADD_LAYERSETS
+    if ( anyDefaultOutputFlag )
+    {    
+      printf( "\nWarning: Ignoring LayerIdsInDefOutputLayerSet parameters, since defaultTargetOuputLayerIdc is not equal 2.\n" );    
+    }
+#else
     printf( "\nWarning: Ignoring LayerIdsInDefOutputLayerSet parameters, since defaultTargetOuputLayerIdc is not equal 2.\n" );    
+#endif
   }
   else  
@@ -1476,8 +1613,29 @@
   }
 
+#if H_MV_HLS10_ADD_LAYERSETS
+  xConfirmPara( m_altOutputLayerFlag.size() < m_vpsNumLayerSets + m_numAddLayerSets + m_outputLayerSetIdx.size(), "The number of alt output layer flags must be equal to the number of layer set additional output layer sets plus the number of output layer set indices" );
+#else
   xConfirmPara( m_altOutputLayerFlag.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" );
-  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" );
-
-  // Layer Dependencies  
+#endif
+
+  // PTL
+#if H_MV_HLS10_PTL
+    xConfirmPara( ( m_profile.size() != m_inblFlag.size() || m_profile.size() != m_level.size()  ||  m_profile.size() != m_levelTier.size() ), "The number of Profiles, Levels, Tiers and InblFlags must be equal." ); 
+
+    if ( m_numberOfLayers > 1)
+    {
+      xConfirmPara( m_profile.size() <= 1, "The number of profiles, tiers, levels, and inblFlags must be greater than 1.");
+      xConfirmPara( m_inblFlag[0], "VpsProfileTierLevel[0] must have inblFlag equal to 0");
+      if (m_profile.size() > 1 )
+      {
+        xConfirmPara( m_profile[0]  != m_profile[1], "The profile in VpsProfileTierLevel[1] must be equal to the profile in VpsProfileTierLevel[0].");
+        xConfirmPara( m_inblFlag[0] != m_inblFlag[1], "inblFlag in VpsProfileTierLevel[1] must be equal to the inblFlag in VpsProfileTierLevel[0].");
+      }
+    }
+#else
+    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" );
+#endif
+
+    // Layer Dependencies  
   for (Int i = 0; i < m_numberOfLayers; i++ )
   {
@@ -2341,6 +2499,16 @@
 #endif
 #if H_MV
+#if H_MV_HLS10_GEN_FIX
+  xPrintParaVector( "NuhLayerId"     , m_layerIdInNuh ); 
+  if ( m_targetEncLayerIdList.size() > 0)
+  {
+    xPrintParaVector( "TargetEncLayerIdList"     , m_targetEncLayerIdList ); 
+  }
+#endif
   xPrintParaVector( "ViewIdVal"     , m_viewId ); 
   xPrintParaVector( "ViewOrderIndex", m_viewOrderIndex ); 
+#if H_MV_HLS10_AUX
+  xPrintParaVector( "AuxId", m_auxId );
+#endif
 #endif
 #if H_3D
Index: trunk/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncCfg.h	(revision 1039)
+++ trunk/source/App/TAppEncoder/TAppEncCfg.h	(revision 1066)
@@ -78,6 +78,12 @@
   std::vector<Int>       m_viewId;                            ///< view id
   std::vector<Int>       m_viewOrderIndex;                    ///< view order index  
+#if H_MV_HLS10_AUX
+  std::vector<Int>       m_auxId;                             ///< auxiliary id
+#endif
 #if H_3D
   std::vector<Int>       m_depthFlag;                         ///< depth flag
+#endif
+#if H_MV_HLS10_GEN_FIX
+  std::vector<Int>       m_targetEncLayerIdList;              ///< layer Ids in Nuh to be encoded
 #endif
   std::vector<Int>       m_layerIdInNuh;                      ///< layer Id in Nuh for each layer 
@@ -89,9 +95,17 @@
   Int                    m_vpsNumLayerSets;                   ///< Number of layer sets
   std::vector< std::vector<Int> > m_layerIdsInSets;           ///< LayerIds in vps of layer set 
-  Int                    m_defaultOutputLayerIdc;       ///< Specifies output layers of layer sets, 0: output all layers, 1: output highest layers, 2: specified by LayerIdsInDefOuputLayerSet
+#if H_MV_HLS10_ADD_LAYERSETS
+  Int                    m_numAddLayerSets;                    ///< Number of additional layer sets
+  std::vector< std::vector<Int> > m_highestLayerIdxPlus1;      ///< HighestLayerIdxPlus1 for each additional layer set and each independent layer (value with index 0 will be ignored)
+#endif
+  Int                    m_defaultOutputLayerIdc;             ///< Specifies output layers of layer sets, 0: output all layers, 1: output highest layers, 2: specified by LayerIdsInDefOuputLayerSet
   std::vector<Int>       m_outputLayerSetIdx;                 ///< Indices of layer sets used as additional output layer sets  
   std::vector< std::vector<Int> > m_layerIdsInAddOutputLayerSet; ///< LayerIds in vps of additional output layers
   std::vector< std::vector<Int> > m_layerIdsInDefOutputLayerSet; ///< Indices in vps of output layers in layer sets
+#if H_MV_HLS10_ADD_LAYERSETS
+  std::vector< std::vector< Int > > m_profileTierLevelIdx;      ///< Indices of of profile, per layer in layer set
+#else
   std::vector<Int>       m_profileLevelTierIdx;               ///< Indices of of profile level tier
+#endif
   std::vector<Bool>      m_altOutputLayerFlag;                ///< Alt output layer flag
 
@@ -124,4 +138,9 @@
   std::vector< std::vector<Bool > > m_ctuBasedOffsetEnabledFlag;
   std::vector< std::vector<Int  > > m_minHorizontalCtuOffsetPlus1;
+#if H_MV_HLS10_VPS_VUI
+  Bool m_singleLayerForNonIrapFlag;
+  Bool m_higherLayerIrapSkipFlag;
+#endif // H_MV_HLS10_VPS_VUI
+
 
 #if H_3D_IV_MERGE
@@ -174,12 +193,21 @@
   
   // profile/level
+#if H_MV_HLS10_PTL
+#if H_MV
+  std::vector< Profile::Name > m_profile;
+  std::vector< Level::Tier   > m_levelTier;
+  std::vector< Level::Name   > m_level;
+  std::vector< Bool          > m_inblFlag; 
+#else
   Profile::Name m_profile;
   Level::Tier   m_levelTier;
   Level::Name   m_level;
+#endif
+#endif
+
   Bool m_progressiveSourceFlag;
   Bool m_interlacedSourceFlag;
   Bool m_nonPackedConstraintFlag;
   Bool m_frameOnlyConstraintFlag;
-  
   // coding structure
 #if H_MV
@@ -440,4 +468,7 @@
   std::vector<Int>  m_sbPropAvgBitRate;
   std::vector<Int>  m_sbPropMaxBitRate;
+#if H_MV_HLS10_GEN_FIX
+  Bool              m_outputVpsInfo;
+#endif
 #endif
 #if H_3D
@@ -506,4 +537,29 @@
   Void  xPrintUsage     ();                                   ///< print usage
 #if H_MV
+
+#if H_MV_HLS10_PTL
+  template<typename T>
+  Void xReadStrToEnum(string in, std::vector<T> &val)
+  {
+    val.clear(); 
+
+    char* cElement = NULL;
+    char* cString = new char[in.size()+1];
+    strcpy(cString, in.c_str());
+
+    cElement = strtok( cString, " " );
+    while ( cElement != NULL )
+    {
+      T profile;       
+      std::istringstream ss( cElement ); 
+      ss >> profile; 
+      val.push_back( profile ); 
+      cElement = strtok( NULL, " " );
+    }
+    delete[] cString;
+  }
+#endif
+
+
   template <typename T>
   Void xResizeVector(  std::vector<T> & rpcVector )
Index: trunk/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1039)
+++ trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1066)
@@ -133,7 +133,7 @@
   xSetLayerIds             ( vps );   
   xSetDimensionIdAndLength ( vps );
-  xSetDependencies( vps );
+  xSetDependencies         ( vps );
+  xSetRepFormat            ( vps ); 
   xSetProfileTierLevel     ( vps ); 
-  xSetRepFormat            ( vps ); 
   xSetLayerSets            ( vps ); 
   xSetDpbSize              ( vps ); 
@@ -144,5 +144,39 @@
   xDeriveDltArray          ( vps, dlt );
 #endif
-
+#if H_MV_HLS10_GEN_FIX
+  if ( m_targetEncLayerIdList.size() == 0 )
+  {
+    for (Int i = 0; i < m_numberOfLayers; i++ )
+    {
+      m_targetEncLayerIdList.push_back( vps.getLayerIdInNuh( i ) );
+    }
+  }
+  for( Int i = (Int) m_targetEncLayerIdList.size()-1 ; i >= 0 ; i--)
+  {
+    Int iNuhLayerId = m_targetEncLayerIdList[i]; 
+    Bool allRefLayersPresent = true; 
+    for( Int j = 0; j < vps.getNumRefLayers( iNuhLayerId ); j++)
+    {
+      allRefLayersPresent = allRefLayersPresent && xLayerIdInTargetEncLayerIdList( vps.getIdRefLayer( iNuhLayerId, j) );
+    }
+    if ( !allRefLayersPresent )
+    {
+      printf("\nCannot encode layer with nuh_layer_id equal to %d since not all reference layers are in TargetEncLayerIdList\n", iNuhLayerId);
+      m_targetEncLayerIdList.erase( m_targetEncLayerIdList.begin() + i  );
+    }
+  }
+#endif
+
+#if H_MV_HLS10_ADD_LAYERSETS
+  if ( m_outputVpsInfo )
+  {  
+#if H_MV_HLS10_AUX
+    vps.printScalabilityId();
+#endif
+    vps.printLayerDependencies();
+    vps.printLayerSets(); 
+    vps.printPTL(); 
+  }
+#endif
 
   for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++)
@@ -200,5 +234,9 @@
     m_cTEncTop.setUseDMM                       ( isDepth ? m_useDMM               : false );
 #if SEPARATE_FLAG_I0085
+#if LGE_FCO_I0116
+    m_cTEncTop.setUseIVP                       ( vps.getViewIndex( layerId ) == 0 && isDepth ? m_useIVP               : false );
+#else
     m_cTEncTop.setUseIVP                       ( isDepth ? m_useIVP               : false );
+#endif
 #endif
     m_cTEncTop.setUseSDC                       ( isDepth ? m_useSDC               : false );
@@ -210,5 +248,9 @@
 #if !MTK_I0099_VPS_EX2 || MTK_I0099_FIX
 #if H_3D_QTLPC
+#if LGE_FCO_I0116
+    m_cTEncTop.setUseQTL                       ( vps.getViewIndex( layerId ) == 0 && isDepth ? m_bUseQTL               : false );
+#else
     m_cTEncTop.setUseQTL                       ( isDepth ? m_bUseQTL               : false );
+#endif
 #if !MTK_I0099_VPS_EX2    
     m_cTEncTop.setUsePC                        ( isDepth ? m_bUsePC                : false );
@@ -224,5 +266,9 @@
 #endif
 #if H_3D_IV_MERGE
-    m_cTEncTop.setUseMPI               ( isDepth ? m_bMPIFlag    : false );
+#if LGE_FCO_I0116
+    m_cTEncTop.setUseMPI                       ( vps.getViewIndex( layerId ) == 0 && isDepth ? m_bMPIFlag    : false );
+#else
+    m_cTEncTop.setUseMPI                       ( isDepth ? m_bMPIFlag    : false );
+#endif
 #endif
 #endif // H_3D
@@ -236,6 +282,11 @@
 #endif
 
+#if H_MV
+  m_cTEncTop.setProfile(m_profile[0]);
+  m_cTEncTop.setLevel  (m_levelTier[0], m_level[0]);
+#else
   m_cTEncTop.setProfile(m_profile);
   m_cTEncTop.setLevel(m_levelTier, m_level);
+#endif
   m_cTEncTop.setProgressiveSourceFlag(m_progressiveSourceFlag);
   m_cTEncTop.setInterlacedSourceFlag(m_interlacedSourceFlag);
@@ -789,8 +840,19 @@
   
 #if H_MV
+#if H_MV_HLS10_GEN_FIX
+  while ( (m_targetEncLayerIdList.size() != 0 ) && !allEos )
+#else
   while ( !allEos )
+#endif
   {
     for(Int layer=0; layer < m_numberOfLayers; layer++ )
     {
+#if H_MV_HLS10_GEN_FIX
+      if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) ))
+      {
+        continue; 
+      }
+#endif
+
       Int frmCnt = 0;
       while ( !eos[layer] && !(frmCnt == gopSize))
@@ -832,4 +894,11 @@
       for(Int layer=0; layer < m_numberOfLayers; layer++ )
       {
+#if H_MV_HLS10_GEN_FIX
+        if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) ))
+        {
+          continue; 
+        }
+#endif
+
 #if H_3D_VSO        
           if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded )
@@ -858,4 +927,10 @@
   for(Int layer=0; layer < m_numberOfLayers; layer++ )
   {
+#if H_MV_HLS10_GEN_FIX
+    if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) ))
+    {
+      continue; 
+    }
+#endif
     m_acTEncTopList[layer]->printSummary( m_acTEncTopList[layer]->getNumAllPicCoded(), m_isField );
   }
@@ -1321,8 +1396,10 @@
   // Max sub layers, + presence flag
   Bool subLayersMaxMinus1PresentFlag = false; 
+#if !H_MV_FIX_SUB_LAYERS_MAX_MINUS1
   Int  subLayersMaxMinus1 = -1; 
+#endif
   for (Int curLayerIdInVps = 0; curLayerIdInVps < m_numberOfLayers; curLayerIdInVps++ )
-  {
-    Int curSubLayersMaxMinus1 = -1; 
+  {    
+    Int curSubLayersMaxMinus1 = 0; 
     for( Int i = 0; i < getGOPSize(); i++ ) 
     {
@@ -1332,4 +1409,5 @@
 
     vps.setSubLayersVpsMaxMinus1( curLayerIdInVps, curSubLayersMaxMinus1 ); 
+#if !H_MV_FIX_SUB_LAYERS_MAX_MINUS1
     if ( subLayersMaxMinus1 == -1 )
     {
@@ -1340,4 +1418,7 @@
       subLayersMaxMinus1PresentFlag = subLayersMaxMinus1PresentFlag || ( curSubLayersMaxMinus1 != subLayersMaxMinus1 ); 
     }
+#else
+    subLayersMaxMinus1PresentFlag = subLayersMaxMinus1PresentFlag || ( curSubLayersMaxMinus1 != vps.getMaxSubLayersMinus1() );
+#endif
   }
 
@@ -1348,18 +1429,30 @@
   Bool maxTidRefPresentFlag = false; 
   for ( Int refLayerIdInVps = 0; refLayerIdInVps < m_numberOfLayers; refLayerIdInVps++)
-    {
+  {
     for ( Int curLayerIdInVps = 1; curLayerIdInVps < m_numberOfLayers; curLayerIdInVps++)
-      {
+    {
       Int maxTid = -1; 
+#if H_MV_FIX_LOOP_GOPSIZE
+      for( Int i = 0; i < ( getGOPSize() + 1); i++ ) 
+      {        
+        GOPEntry geCur =  m_GOPListMvc[curLayerIdInVps][( i < getGOPSize()  ? i : MAX_GOP )];
+        GOPEntry geRef =  m_GOPListMvc[refLayerIdInVps][( i < getGOPSize()  ? i : MAX_GOP )];
+#else
       for( Int i = 0; i < getGOPSize(); i++ ) 
       {        
         GOPEntry geCur =  m_GOPListMvc[curLayerIdInVps][i];
-        GOPEntry geRef =  m_GOPListMvc[refLayerIdInVps][i];
-        
+        GOPEntry geRef =  m_GOPListMvc[refLayerIdInVps][i];     
+#endif
         for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++)
         {        
           if ( m_directRefLayers[ curLayerIdInVps ][ geCur.m_interLayerPredLayerIdc[ j ]] == refLayerIdInVps )
           {
+#if H_MV_FIX_LOOP_GOPSIZE
+            Bool refAlwaysIntra = ( i == getGOPSize() ) && ( m_iIntraPeriod[ curLayerIdInVps ] % m_iIntraPeriod[ refLayerIdInVps ] == 0 );
+            Bool refLayerZero   = ( i == getGOPSize() ) && ( refLayerIdInVps == 0 );
+            maxTid = std::max( maxTid, ( refAlwaysIntra || refLayerZero ) ? 0 : geRef.m_temporalId ); 
+#else
             maxTid = std::max( maxTid, geRef.m_temporalId ); 
+#endif
           }
         }
@@ -1487,4 +1580,23 @@
 Void TAppEncTop::xSetProfileTierLevel( TComVPS& vps )
 { 
+#if H_MV_HLS10_PTL
+
+  // SET PTL
+  assert( m_profile.size() == m_level.size() && m_profile.size() == m_levelTier.size() ); 
+  vps.setVpsNumProfileTierLevelMinus1( (Int) m_profile.size() - 1 );
+  for ( Int ptlIdx = 0; ptlIdx <= vps.getVpsNumProfileTierLevelMinus1(); ptlIdx++ )
+  {
+    if ( ptlIdx > 1 )
+    {
+      Bool vpsProfilePresentFlag = ( m_profile[ptlIdx] != m_profile[ptlIdx - 1] )
+        || ( m_inblFlag[ptlIdx ] != m_inblFlag[ptlIdx - 1] ); 
+      vps.setVpsProfilePresentFlag( ptlIdx, vpsProfilePresentFlag ); 
+    }
+
+    xSetProfileTierLevel( vps, ptlIdx, -1, m_profile[ptlIdx], m_level[ptlIdx], 
+      m_levelTier[ ptlIdx ], m_progressiveSourceFlag, m_interlacedSourceFlag,
+      m_nonPackedConstraintFlag, m_frameOnlyConstraintFlag,  m_inblFlag[ptlIdx] );     
+  }  
+#else
   const Int vpsNumProfileTierLevelMinus1 = 0; //TBD
   vps.setVpsNumProfileTierLevelMinus1( vpsNumProfileTierLevelMinus1 ); 
@@ -1494,6 +1606,58 @@
     vps.setVpsProfilePresentFlag( i, true ); 
   }
-}
-
+#endif
+}
+
+#if H_MV_HLS10_PTL
+Void TAppEncTop::xSetProfileTierLevel(TComVPS& vps, Int profileTierLevelIdx, Int subLayer, Profile::Name profile, Level::Name level, Level::Tier tier, Bool progressiveSourceFlag, Bool interlacedSourceFlag, Bool nonPackedConstraintFlag, Bool frameOnlyConstraintFlag, Bool inbldFlag)
+{
+  TComPTL* ptlStruct = vps.getPTL( profileTierLevelIdx );    
+  assert( ptlStruct != NULL ); 
+
+  ProfileTierLevel* ptl; 
+  if ( subLayer == -1 )
+  {
+    ptl = ptlStruct->getGeneralPTL();
+  }
+  else
+  {
+    ptl = ptlStruct->getSubLayerPTL(  subLayer );
+  }
+
+  assert( ptl != NULL );
+
+  ptl->setProfileIdc( profile );
+  ptl->setTierFlag  ( tier    );
+  ptl->setLevelIdc  ( level   );
+  ptl->setProfileCompatibilityFlag( profile, true );
+#if H_MV_HLS10_PTL_INBL_FIX
+  ptl->setInbldFlag( inbldFlag );
+#endif
+
+  switch ( profile )
+  {
+  case Profile::MAIN:
+    break; 
+  case Profile::MULTIVIEWMAIN:
+#if H_3D
+  case Profile::MAIN3D:
+#endif
+    ptl->setMax12bitConstraintFlag      ( true  ); 
+    ptl->setMax12bitConstraintFlag      ( true  );
+    ptl->setMax10bitConstraintFlag      ( true  );
+    ptl->setMax8bitConstraintFlag       ( true  );
+    ptl->setMax422chromaConstraintFlag  ( true  );
+    ptl->setMax420chromaConstraintFlag  ( true  );
+    ptl->setMaxMonochromeConstraintFlag ( false );
+    ptl->setIntraConstraintFlag         ( false ); 
+    ptl->setOnePictureOnlyConstraintFlag( false );
+    ptl->setLowerBitRateConstraintFlag  ( true  );        
+    break; 
+  default:
+    assert( 0 ); // other profiles currently not supported
+    break; 
+  }
+}
+#endif
 
 Void TAppEncTop::xSetRepFormat( TComVPS& vps )
@@ -1513,4 +1677,12 @@
   //repFormat->setSeparateColourPlaneVpsFlag( );
 
+#if H_MV_HLS10_GEN_VSP_CONF_WIN
+  repFormat->setConformanceWindowVpsFlag( true );
+  repFormat->setConfWinVpsLeftOffset    ( m_confLeft   / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() ) );
+  repFormat->setConfWinVpsRightOffset   ( m_confRight  / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() )  );
+  repFormat->setConfWinVpsTopOffset     ( m_confTop    / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() )  );
+  repFormat->setConfWinVpsBottomOffset  ( m_confBottom / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() ) ); 
+#endif
+
   assert( vps.getRepFormat( 0 ) == NULL ); 
   vps.setRepFormat( 0 , repFormat );
@@ -1528,5 +1700,7 @@
   {  
     Int currLsIdx = vps.olsIdxToLsIdx( i ); 
+#if !H_MV_HLS10_ADD_LAYERSETS
     std::vector<Int> targetDecLayerIdList = vps.getTargetDecLayerIdList( i ); 
+#endif
     Bool subLayerFlagInfoPresentFlag = false; 
 
@@ -1534,16 +1708,48 @@
     {   
       Bool subLayerDpbInfoPresentFlag = false; 
+#if !H_MV_HLS10_ADD_LAYERSETS
       assert( vps.getNumLayersInIdList( currLsIdx ) == targetDecLayerIdList.size() ); 
+#endif
       for( Int k = 0; k < vps.getNumLayersInIdList( currLsIdx ); k++ )   
       {
+#if H_MV_HLS10_DBP_SIZE
+        Int layerIdInVps = vps.getLayerIdInVps( vps.getLayerSetLayerIdList( currLsIdx, k ) );
+        if ( vps.getNecessaryLayerFlag( i,k ) && ( vps.getVpsBaseLayerInternalFlag() || vps.getLayerSetLayerIdList( currLsIdx, k ) != 0 ) )
+        {       
+          dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, m_maxDecPicBufferingMvc[ layerIdInVps ][ j ] - 1 );
+          if ( j > 0 )
+          {
+            subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ) != dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j - 1 ) );
+          }
+        }
+        else
+        {
+          if (vps.getNecessaryLayerFlag(i,k) && j == 0 && k == 0 )
+          {          
+            dpbSize->setMaxVpsDecPicBufferingMinus1(i, k ,j, 0 ); 
+          }
+        }
+#else
         Int layerIdInVps = vps.getLayerIdInVps( targetDecLayerIdList[k] );           
         dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, m_maxDecPicBufferingMvc[ layerIdInVps ][ j ] - 1 );
+
         if ( j > 0 )
         {
           subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ) != dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j - 1 ) );
         }
+#endif
       }        
 
       Int maxNumReorderPics = MIN_INT;
+#if H_MV_HLS10_DBP_SIZE
+      for ( Int idx = 0; idx < vps.getNumLayersInIdList( currLsIdx ); idx++ )
+      {
+        if (vps.getNecessaryLayerFlag(i, idx ))
+        {        
+          Int layerIdInVps = vps.getLayerIdInVps( vps.getLayerSetLayerIdList(currLsIdx, idx) );        
+          maxNumReorderPics = std::max( maxNumReorderPics, m_numReorderPicsMvc[ layerIdInVps ][ j ] ); 
+        }
+      }
+#else
       for ( Int idx = 0; idx < targetDecLayerIdList.size(); idx++ )
       {
@@ -1551,4 +1757,5 @@
         maxNumReorderPics = std::max( maxNumReorderPics, m_numReorderPicsMvc[ layerIdInVps ][ j ] ); 
       }
+#endif
       assert( maxNumReorderPics != MIN_INT ); 
 
@@ -1576,5 +1783,4 @@
 }
 
-
 Void TAppEncTop::xSetLayerSets( TComVPS& vps )
 {   
@@ -1598,19 +1804,67 @@
   // Additional output layer sets + profileLevelTierIdx
   vps.setDefaultOutputLayerIdc      ( m_defaultOutputLayerIdc );   
+#if H_MV_HLS10_ADD_LAYERSETS
+  if( vps.getNumIndependentLayers() == 0 && m_numAddLayerSets > 0  )
+  {
+    fprintf( stderr, "\nWarning: Ignoring additional layer sets since NumIndependentLayers is equal to 0.\n");            
+  }
+  else
+  {
+    vps.setNumAddLayerSets( m_numAddLayerSets ); 
+    if ( m_highestLayerIdxPlus1.size() < vps.getNumAddLayerSets() ) 
+    {
+      fprintf(stderr, "\nError: Number of highestLayerIdxPlus1 parameters must be greater than or equal to NumAddLayerSets\n");
+      exit(EXIT_FAILURE);
+    }
+
+    for (Int i = 0; i < vps.getNumAddLayerSets(); i++)
+    {
+      if ( m_highestLayerIdxPlus1[ i ].size() < vps.getNumIndependentLayers() ) 
+      {
+        fprintf(stderr, "Error: Number of elements in highestLayerIdxPlus1[ %d ] parameters must be greater than or equal to NumIndependentLayers(= %d)\n", i, vps.getNumIndependentLayers());
+        exit(EXIT_FAILURE);
+      }
+
+      for (Int j = 1; j < vps.getNumIndependentLayers(); j++)
+      {
+        if ( m_highestLayerIdxPlus1[ i ][ j ]  < 0 || m_highestLayerIdxPlus1[ i ][ j ] > vps.getNumLayersInTreePartition( j ) ) 
+        {
+          fprintf(stderr, "Error: highestLayerIdxPlus1[ %d ][ %d ] shall be in the range of 0 to NumLayersInTreePartition[ %d ] (= %d ), inclusive. \n", i, j, j, vps.getNumLayersInTreePartition( j ) );
+          exit(EXIT_FAILURE);
+        }
+        vps.setHighestLayerIdxPlus1( i, j, m_highestLayerIdxPlus1[ i ][ j ] ); 
+      }
+      vps.deriveAddLayerSetLayerIdList( i );
+    }        
+  }  
+#else
   vps.setNumAddLayerSets            ( 0                             );  
+#endif
   vps.setNumAddOlss                 ( numAddOuputLayerSets          ); 
   vps.initTargetLayerIdLists(); 
 
+#if H_MV_HLS10_ADD_LAYERSETS
+  for (Int olsIdx = 0; olsIdx < vps.getNumLayerSets() + numAddOuputLayerSets; olsIdx++)
+  {
+    Int addOutLsIdx = olsIdx - vps.getNumLayerSets();     
+#else
   for (Int olsIdx = 0; olsIdx < m_vpsNumLayerSets + numAddOuputLayerSets; olsIdx++)
   {
     Int addOutLsIdx = olsIdx - m_vpsNumLayerSets;     
-    
+#endif    
     vps.setLayerSetIdxForOlsMinus1( olsIdx, ( ( addOutLsIdx < 0 ) ?  olsIdx  : m_outputLayerSetIdx[ addOutLsIdx ] ) - 1 ); 
 
+#if H_MV_HLS10_ADD_LAYERSETS
+    Int lsIdx = vps.olsIdxToLsIdx( olsIdx );
+#else
     std::vector<Int>& layerIdList    = m_layerIdsInSets[ vps.olsIdxToLsIdx( olsIdx ) ];
-
+#endif
     if (vps.getDefaultOutputLayerIdc() == 2 || addOutLsIdx >= 0 )
     { 
+#if H_MV_HLS10_ADD_LAYERSETS
+      for ( Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++)
+#else
       for ( Int i = 0; i < layerIdList.size(); i++)
+#endif
       {
         vps.setOutputLayerFlag( olsIdx, i, ( olsIdx == 0 && i == 0 ) ? vps.inferOutputLayerFlag(olsIdx, i ) : false ); // This is a software only fix for a bug in the spec. In spec outputLayerFlag neither present nor inferred for this case !
@@ -1622,7 +1876,13 @@
       for (Int j = 0; j < outLayerIdList.size(); j++)
       {   
+#if H_MV_HLS10_ADD_LAYERSETS
+        for ( Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++)
+        {
+          if ( vps.getLayerSetLayerIdList( lsIdx, i ) == outLayerIdList[ j ] )
+#else
         for (Int i = 0; i < layerIdList.size(); i++ )
         {
           if ( layerIdList[ i ] == outLayerIdList[ j ] )
+#endif
           {
             vps.setOutputLayerFlag( olsIdx, i, true );       
@@ -1631,10 +1891,22 @@
           }
         }
-        assert( outputLayerInLayerSetFlag ); // The output layer is not not in the layer set.
+#if H_MV_HLS10_ADD_LAYERSETS
+        if ( !outputLayerInLayerSetFlag )
+        {
+          fprintf(stderr, "Error: Output layer %d in output layer set %d not in corresponding layer set %d \n", outLayerIdList[ j ], olsIdx , lsIdx );
+          exit(EXIT_FAILURE);
+        }
+#else
+        assert( outputLayerInLayerSetFlag ); // The output layer is not in the layer set.
+#endif
       }
     }
     else
     {
+#if H_MV_HLS10_ADD_LAYERSETS
+      for ( Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++)
+#else
       for ( Int i = 0; i < layerIdList.size(); i++)
+#endif
       {
         vps.setOutputLayerFlag( olsIdx, i, vps.inferOutputLayerFlag( olsIdx, i ) );       
@@ -1642,10 +1914,58 @@
     }
 
+#if H_MV_HLS10_NESSECARY_LAYER
+    vps.deriveNecessaryLayerFlags( olsIdx ); 
+#endif
     vps.deriveTargetLayerIdList(  olsIdx ); 
 
+#if H_MV_HLS10_PTL
+    // SET profile_tier_level_index. 
+    if ( olsIdx == 0 )
+    {   
+      vps.setProfileTierLevelIdx( 0, 0 , vps.getMaxLayersMinus1() > 0 ? 1 : 0 ); 
+    }
+    else
+    {
+      if( (Int) m_profileTierLevelIdx[ olsIdx ].size() < vps.getNumLayersInIdList( lsIdx ) )
+      {
+        fprintf( stderr, "Warning: Not enough profileTierLevelIdx values given for the %d-th OLS. Inferring default values.\n", olsIdx ); 
+      }
+      for (Int j = 0; j < vps.getNumLayersInIdList( lsIdx ); j++)
+      {
+        if( j < (Int) m_profileTierLevelIdx[ olsIdx ].size() )
+        {
+          vps.setProfileTierLevelIdx(olsIdx, j, m_profileTierLevelIdx[olsIdx][j] );
+#if H_MV_HLS10_PTL_FIX
+          if( !vps.getNecessaryLayerFlag(olsIdx,j) && m_profileTierLevelIdx[ olsIdx ][ j ] != -1 )
+          {
+            fprintf( stderr, "Warning: The %d-th layer in the %d-th OLS is not necessary such that profileTierLevelIdx[%d][%d] will be ignored. Set value to -1 to suppress warning.\n", j,olsIdx,olsIdx,j ); 
+          }          
+        }
+        else if ( vps.getNecessaryLayerFlag(olsIdx,j) )
+#else
+        }
+        else
+#endif
+        {
+          // setting default values
+          if ( j == 0 || vps.getVpsNumProfileTierLevelMinus1() < 1 )
+          {
+            // set base layer as default
+            vps.setProfileTierLevelIdx(olsIdx, j, 1 );
+          }
+          else
+          {
+            // set VpsProfileTierLevel[2] as default
+            vps.setProfileTierLevelIdx(olsIdx, j, 2 ); 
+          }
+        }
+      }
+    }
+#else
     if ( olsIdx > 0 ) 
     {
       vps.setProfileLevelTierIdx( olsIdx, m_profileLevelTierIdx[ olsIdx ] ); 
     }
+#endif
    
     if ( vps.getNumOutputLayersInOutputLayerSet( olsIdx ) == 1 && 
@@ -1685,5 +2005,9 @@
     if( pcVPSVUI->getBitRatePresentVpsFlag( )  ||  pcVPSVUI->getPicRatePresentVpsFlag( ) )
     {
+#if H_MV_HLS10_VPS_VUI
+      for( Int i = 0; i  <  vps.getNumLayerSets(); i++ )
+#else
       for( Int i = 0; i  <=  vps.getVpsNumLayerSetsMinus1(); i++ )
+#endif
       {
         for( Int j = 0; j  <=  vps.getMaxTLayers(); j++ ) 
@@ -1734,5 +2058,9 @@
         for( Int j = 0; j < vps.getNumDirectRefLayers( vps.getLayerIdInNuh( i ) ) ; j++ )
         {  
+#if H_MV_HLS10_REF_PRED_LAYERS
+          Int layerIdx = vps.getLayerIdInVps( vps.getIdDirectRefLayer(vps.getLayerIdInNuh( i ) , j  ));  
+#else
           Int layerIdx = vps.getLayerIdInVps( vps.getRefLayerId(vps.getLayerIdInNuh( i ) , j  ));  
+#endif
           if( pcVPSVUI->getTilesInUseFlag( i )  &&  pcVPSVUI->getTilesInUseFlag( layerIdx ) )  
           {
@@ -1752,4 +2080,9 @@
       }
     }
+
+#if H_MV_HLS10_VPS_VUI
+  pcVPSVUI->setSingleLayerForNonIrapFlag( m_singleLayerForNonIrapFlag );
+  pcVPSVUI->setHigherLayerIrapSkipFlag( m_higherLayerIrapSkipFlag );
+#endif
 
     pcVPSVUI->setIlpRestrictedRefLayersFlag( m_ilpRestrictedRefLayersFlag );
@@ -1808,5 +2141,15 @@
   }
 }
-#endif
+#if H_MV_HLS10_GEN_FIX
+Bool TAppEncTop::xLayerIdInTargetEncLayerIdList(Int nuhLayerId)
+{
+  return  ( std::find(m_targetEncLayerIdList.begin(), m_targetEncLayerIdList.end(), nuhLayerId) != m_targetEncLayerIdList.end()) ;
+}
+#endif
+
+
+#endif
+
+
 #if H_3D
 Void TAppEncTop::xSetVPSExtension2( TComVPS& vps )
@@ -1816,4 +2159,7 @@
     Bool isDepth      = ( vps.getDepthId( layer ) == 1 ) ;
     Bool isLayerZero  = ( layer == 0 ); 
+#if LGE_FCO_I0116
+    Bool isDepthFirst = (layer > 1 ? true : false);
+#endif
 
 #if H_3D_ARP
@@ -1838,5 +2184,9 @@
     vps.setVpsDepthModesFlag( layer, isDepth && !isLayerZero && (m_useDMM || m_useSDC || m_useDLT ) );
 #if SEPARATE_FLAG_I0085
+#if LGE_FCO_I0116
+    vps.setIVPFlag          ( layer, isDepth && !isLayerZero && m_useIVP && !isDepthFirst );
+#else
     vps.setIVPFlag          ( layer, isDepth && !isLayerZero && m_useIVP );
+#endif
 #endif
 #endif
@@ -1866,5 +2216,9 @@
 #endif
 #if MTK_I0099_VPS_EX2
+#if LGE_FCO_I0116
+    vps.setLimQtPredFlag         ( layer, isDepth && m_bLimQtPredFlag && !isDepthFirst ); 
+#else
     vps.setLimQtPredFlag         ( layer, isDepth && m_bLimQtPredFlag ); 
+#endif
 #endif
 #if H_3D_NBDV_REF
@@ -1881,5 +2235,9 @@
 #endif
 #if H_3D_IV_MERGE
+#if LGE_FCO_I0116
+    vps.setMPIFlag( layer, !isLayerZero && isDepth && m_bMPIFlag && !isDepthFirst );
+#else
     vps.setMPIFlag( layer, !isLayerZero && isDepth && m_bMPIFlag );
+#endif
 #endif
   }  
Index: trunk/source/App/TAppEncoder/TAppEncTop.h
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncTop.h	(revision 1039)
+++ trunk/source/App/TAppEncoder/TAppEncTop.h	(revision 1066)
@@ -132,4 +132,12 @@
   Void xSetLayerSets              ( TComVPS& vps );
   Void xSetProfileTierLevel       ( TComVPS& vps );
+
+#if H_MV_HLS10_PTL
+  Void xSetProfileTierLevel( TComVPS& vps, Int profileTierLevelIdx, Int subLayer,                              
+                             Profile::Name profile, Level::Name level, Level::Tier tier, 
+                             Bool progressiveSourceFlag, Bool interlacedSourceFlag, 
+                             Bool nonPackedConstraintFlag, Bool frameOnlyConstraintFlag, 
+                             Bool inbldFlag );
+#endif
   Void xSetRepFormat              ( TComVPS& vps );
   Void xSetDpbSize                ( TComVPS& vps );
@@ -137,4 +145,7 @@
   GOPEntry* xGetGopEntry( Int layerIdInVps, Int poc );
   Int  xGetMax( std::vector<Int>& vec);
+#if H_MV_HLS10_GEN_FIX
+  Bool xLayerIdInTargetEncLayerIdList( Int nuhLayerId );
+#endif
 #endif
 #if H_3D
