Index: /branches/HTM-12.0-dev1/cfg/MV-HEVC/NonCTC/inbl_3view.cfg
===================================================================
--- /branches/HTM-12.0-dev1/cfg/MV-HEVC/NonCTC/inbl_3view.cfg	(revision 1054)
+++ /branches/HTM-12.0-dev1/cfg/MV-HEVC/NonCTC/inbl_3view.cfg	(revision 1054)
@@ -0,0 +1,123 @@
+#=============== fileio ===============
+#InputFile_0            : TREE_0_BASE_LAYER.yuv             # (View 1)
+#InputFile_1            : TREE_1_INDEP_NON_BASE_LAYER.yuv   # (View 4)
+#InputFile_2            : TREE_0_PREDICTED_LAYER_0.yuv      # (View 0)
+#InputFile_3            : TREE_1_PREDICTED_LAYER_0.yuv      # (View 3)
+#InputFile_4            : TREE_0_PREDICTED_LAYER_1.yuv      # (View 2)
+#InputFile_5            : TREE_1_PREDICTED_LAYER_1.yuv      # (View 5)
+#NumberOfLayers         : 6       
+#=============== vps ===============
+ScalabilityMask        : 2        #  Scalability Mask             ( 2: View Scalability, shall be 2 for MV-HEVC )
+DimensionIdLen         : 4        #  Number of bits to store Ids,  per scalability dimension, (m)
+ViewOrderIndex         : 0 1 2 3 4 5    #  ViewOrderIndex, per layer (m)
+LayerIdInNuh           : 0 1 2 3 4 5   #  Layer Id in NAL unit header, (0: no explicit signalling, otherwise per layer ) (m)
+SplittingFlag          : 0        #  Splitting Flag 
+ViewId                 : 1 4 0 3 2 5   #  ViewId, per ViewOrderIndex (m)
+#=============== vpslayersets ===============
+VpsNumLayerSets        : 2           #  Number of layer sets    
+LayerIdsInSet_0        : 0           #  Indices in VPS of layers in layer set 0
+LayerIdsInSet_1        : 0 2 4       #  Indices in VPS of layers in layer set 1
+LayerIdsInSet_2        :             #  Indices in VPS of layers in layer set 2
+LayerIdsInSet_3        :             #  Indices in VPS of layers in layer set 3
+LayerIdsInSet_4        :             #  Indices in VPS of layers in layer set 4
+LayerIdsInSet_5        :             #  Indices in VPS of layers in layer set 5
+LayerIdsInSet_6        :             #  Indices in VPS of layers in layer set 6
+LayerIdsInSet_7        :             #  Indices in VPS of layers in layer set 7
+LayerIdsInSet_8        :             #  Indices in VPS of layers in layer set 8
+
+NumAddLayerSets        : 1           #  Additional layer sets for indpendend decodable non-base layer
+HighestLayerIdxPlus1_0 : -1 3
+
+DefaultTargetOutputLayerIdc : 0         #  Specifies output layers of layer sets, 0: output all layers, 1: output highest layer, 2: specified by LayerIdsInDefOutputLayerSet
+OutputLayerSetIdx           : 1 1 1 1 1 2 2 2 2 2 2 #  Indices of layer sets used to derive additional output layer sets
+# TREE 0 
+LayerIdsInAddOutputLayerSet_0 : 0 2     #  Indices in VPS of output layers in additional output layer set 0
+LayerIdsInAddOutputLayerSet_1 : 0 4     #  Indices in VPS of output layers in additional output layer set 1
+LayerIdsInAddOutputLayerSet_2 : 2 4     #  Indices in VPS of output layers in additional output layer set 2
+LayerIdsInAddOutputLayerSet_3 : 2       #  Indices in VPS of output layers in additional output layer set 3
+LayerIdsInAddOutputLayerSet_4 : 4       #  Indices in VPS of output layers in additional output layer set 4
+# TREE 1
+LayerIdsInAddOutputLayerSet_5 : 1        #  Indices in VPS of output layers in additional output layer set 5
+LayerIdsInAddOutputLayerSet_6 : 1 3      #  Indices in VPS of output layers in additional output layer set 6
+LayerIdsInAddOutputLayerSet_7 : 1 5      #  Indices in VPS of output layers in additional output layer set 7
+LayerIdsInAddOutputLayerSet_8 : 3 5      #  Indices in VPS of output layers in additional output layer set 8
+LayerIdsInAddOutputLayerSet_9 : 3        #  Indices in VPS of output layers in additional output layer set 9
+LayerIdsInAddOutputLayerSet_10: 5        #  Indices in VPS of output layers in additional output layer set 10
+
+ProfileLevelTierIdx    : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  #  Indices to profile level tier (TBD)
+#=============== vpsdependencies ===============
+DirectRefLayers_1      :          #  Indices in VPS of direct reference layers 
+DirectRefLayers_2      : 0        #  Indices in VPS of direct reference layers 
+DirectRefLayers_3      : 1        #  Indices in VPS of direct reference layers 
+DirectRefLayers_4      : 0        #  Indices in VPS of direct reference layers 
+DirectRefLayers_5      : 3        #  Indices in VPS of direct reference layers 
+
+DependencyTypes_1      :          #  Dependency types of direct reference layers, 0: Sample 1: Motion 2: Sample+Motion
+DependencyTypes_2      : 2        #  Dependency types of direct reference layers, 0: Sample 1: Motion 2: Sample+Motion
+DependencyTypes_3      : 2        #  Dependency types of direct reference layers, 0: Sample 1: Motion 2: Sample+Motion
+DependencyTypes_4      : 2        #  Dependency types of direct reference layers, 0: Sample 1: Motion 2: Sample+Motion
+DependencyTypes_5      : 2        #  Dependency types of direct reference layers, 0: Sample 1: Motion 2: Sample+Motion
+#=============== codingstructure ===============
+IntraPeriod            : 24  #  Period of I-Frame ( -1 = only first)
+DecodingRefreshType    : 1        #  Random Accesss 0:none, 1:CDR, 2:IDR
+GOPSize                : 8        #  GOP Size (number of B slice = GOPSize-1)
+#                           QPfactor      betaOffsetDiv2   #ref_pics_active  reference pictures     deltaRPS     reference idcs          ilPredLayerIdc       refLayerPicPosIl_L1
+#         Type  POC QPoffset     tcOffsetDiv2      temporal_id      #ref_pics                 predict     #ref_idcs        #ActiveRefLayerPics     refLayerPicPosIl_L0   
+Frame1:     B    8     1        0.442    0            0              0           4                4         -8 -10 -12 -16     0                                          0
+Frame2:     B    4     2        0.3536   0            0              0           2                3         -4 -6  4           1       4        5         1 1 0 0 1       0
+Frame3:     B    2     3        0.3536   0            0              0           2                4         -2 -4  2 6         1       2        4         1 1 1 1         0
+Frame4:     B    1     4        0.68     0            0              0           2                4         -1  1  3 7         1       1        5         1 0 1 1 1       0
+Frame5:     B    3     4        0.68     0            0              0           2                4         -1 -3  1 5         1      -2        5         1 1 1 1 0       0
+Frame6:     B    6     3        0.3536   0            0              0           2                4         -2 -4 -6 2         1      -3        5         1 1 1 1 0       0
+Frame7:     B    5     4        0.68     0            0              0           2                4         -1 -5  1 3         1       1        5         1 0 1 1 1       0
+Frame8:     B    7     4        0.68     0            0              0           2                4         -1 -3 -7 1         1      -2        5         1 1 1 1 0       0
+    
+FrameI_l1:  I    0     0        0.442    0            0              0           0                0                            0                                          0             
+Frame1_l1:  B    8     1        0.442    0            0              0           4                4         -8 -10 -12 -16     0                                          0             
+Frame2_l1:  B    4     2        0.3536   0            0              0           2                3         -4 -6  4           1       4        5         1 1 0 0 1       0             
+Frame3_l1:  B    2     3        0.3536   0            0              0           2                4         -2 -4  2 6         1       2        4         1 1 1 1         0             
+Frame4_l1:  B    1     4        0.68     0            0              0           2                4         -1  1  3 7         1       1        5         1 0 1 1 1       0             
+Frame5_l1:  B    3     4        0.68     0            0              0           2                4         -1 -3  1 5         1      -2        5         1 1 1 1 0       0             
+Frame6_l1:  B    6     3        0.3536   0            0              0           2                4         -2 -4 -6 2         1      -3        5         1 1 1 1 0       0             
+Frame7_l1:  B    5     4        0.68     0            0              0           2                4         -1 -5  1 3         1       1        5         1 0 1 1 1       0             
+Frame8_l1:  B    7     4        0.68     0            0              0           2                4         -1 -3 -7 1         1      -2        5         1 1 1 1 0       0             
+
+FrameI_l2:  P    0     3     0.442    0        0        0        1      0                        0                                 1            0         0          -1    
+Frame1_l2:  B    8     4     0.442    0        0        0        4      4     -8 -10 -12 -16     0                                 1            0         1          -1    
+Frame2_l2:  B    4     5     0.3536   0        0        0        3      3     -4 -6  4           1     4     5     1 1 0 0 1       1            0         1          -1    
+Frame3_l2:  B    2     6     0.3536   0        0        0        3      4     -2 -4  2 6         1     2     4     1 1 1 1         1            0         1          -1    
+Frame4_l2:  B    1     7     0.68     0        0        0        3      4     -1  1  3 7         1     1     5     1 0 1 1 1       1            0         1          -1    
+Frame5_l2:  B    3     7     0.68     0        0        0        3      4     -1 -3  1 5         1    -2     5     1 1 1 1 0       1            0         2          -1    
+Frame6_l2:  B    6     6     0.3536   0        0        0        3      4     -2 -4 -6 2         1    -3     5     1 1 1 1 0       1            0         2          -1    
+Frame7_l2:  B    5     7     0.68     0        0        0        3      4     -1 -5  1 3         1     1     5     1 0 1 1 1       1            0         2          -1    
+Frame8_l2:  B    7     7     0.68     0        0        0        3      4     -1 -3 -7 1         1    -2     5     1 1 1 1 0       1            0         2          -1    
+
+FrameI_l3:  P    0     3     0.442    0        0        0        1      0                        0                                 1            0         0          -1    
+Frame1_l3:  B    8     4     0.442    0        0        0        4      4     -8 -10 -12 -16     0                                 1            0         1          -1    
+Frame2_l3:  B    4     5     0.3536   0        0        0        3      3     -4 -6  4           1     4     5     1 1 0 0 1       1            0         1          -1    
+Frame3_l3:  B    2     6     0.3536   0        0        0        3      4     -2 -4  2 6         1     2     4     1 1 1 1         1            0         1          -1    
+Frame4_l3:  B    1     7     0.68     0        0        0        3      4     -1  1  3 7         1     1     5     1 0 1 1 1       1            0         1          -1    
+Frame5_l3:  B    3     7     0.68     0        0        0        3      4     -1 -3  1 5         1    -2     5     1 1 1 1 0       1            0         2          -1    
+Frame6_l3:  B    6     6     0.3536   0        0        0        3      4     -2 -4 -6 2         1    -3     5     1 1 1 1 0       1            0         2          -1    
+Frame7_l3:  B    5     7     0.68     0        0        0        3      4     -1 -5  1 3         1     1     5     1 0 1 1 1       1            0         2          -1    
+Frame8_l3:  B    7     7     0.68     0        0        0        3      4     -1 -3 -7 1         1    -2     5     1 1 1 1 0       1            0         2          -1    
+
+FrameI_l4:  P    0     3     0.442    0        0        0        1      0                        0                                 1            0         0          -1    
+Frame1_l4:  B    8     4     0.442    0        0        0        4      4     -8 -10 -12 -16     0                                 1            0         1          -1    
+Frame2_l4:  B    4     5     0.3536   0        0        0        3      3     -4 -6  4           1     4     5     1 1 0 0 1       1            0         1          -1    
+Frame3_l4:  B    2     6     0.3536   0        0        0        3      4     -2 -4  2 6         1     2     4     1 1 1 1         1            0         1          -1    
+Frame4_l4:  B    1     7     0.68     0        0        0        3      4     -1  1  3 7         1     1     5     1 0 1 1 1       1            0         1          -1    
+Frame5_l4:  B    3     7     0.68     0        0        0        3      4     -1 -3  1 5         1    -2     5     1 1 1 1 0       1            0         2          -1    
+Frame6_l4:  B    6     6     0.3536   0        0        0        3      4     -2 -4 -6 2         1    -3     5     1 1 1 1 0       1            0         2          -1    
+Frame7_l4:  B    5     7     0.68     0        0        0        3      4     -1 -5  1 3         1     1     5     1 0 1 1 1       1            0         2          -1    
+Frame8_l4:  B    7     7     0.68     0        0        0        3      4     -1 -3 -7 1         1    -2     5     1 1 1 1 0       1            0         2          -1    
+
+FrameI_l5:  P    0     3     0.442    0        0        0        1      0                        0                                 1            0         0          -1    
+Frame1_l5:  B    8     4     0.442    0        0        0        4      4     -8 -10 -12 -16     0                                 1            0         1          -1    
+Frame2_l5:  B    4     5     0.3536   0        0        0        3      3     -4 -6  4           1     4     5     1 1 0 0 1       1            0         1          -1    
+Frame3_l5:  B    2     6     0.3536   0        0        0        3      4     -2 -4  2 6         1     2     4     1 1 1 1         1            0         1          -1    
+Frame4_l5:  B    1     7     0.68     0        0        0        3      4     -1  1  3 7         1     1     5     1 0 1 1 1       1            0         1          -1    
+Frame5_l5:  B    3     7     0.68     0        0        0        3      4     -1 -3  1 5         1    -2     5     1 1 1 1 0       1            0         2          -1    
+Frame6_l5:  B    6     6     0.3536   0        0        0        3      4     -2 -4 -6 2         1    -3     5     1 1 1 1 0       1            0         2          -1    
+Frame7_l5:  B    5     7     0.68     0        0        0        3      4     -1 -5  1 3         1     1     5     1 0 1 1 1       1            0         2          -1    
+Frame8_l5:  B    7     7     0.68     0        0        0        3      4     -1 -3 -7 1         1    -2     5     1 1 1 1 0       1            0         2          -1    
Index: /branches/HTM-12.0-dev1/cfg/MV-HEVC/baseCfg_3view.cfg
===================================================================
--- /branches/HTM-12.0-dev1/cfg/MV-HEVC/baseCfg_3view.cfg	(revision 1053)
+++ /branches/HTM-12.0-dev1/cfg/MV-HEVC/baseCfg_3view.cfg	(revision 1054)
@@ -8,4 +8,7 @@
 InputFile_1                   : newspapercc_2.yuv                               
 InputFile_2                   : newspapercc_6.yuv                              
+InputFile_3                   :                               
+InputFile_4                   :                                
+InputFile_5                   :       
 
 BitstreamFile                 : stream.bit                         
@@ -14,4 +17,7 @@
 ReconFile_1                   : rec_2.yuv                         
 ReconFile_2                   : rec_6.yuv                           
+ReconFile_3                   :                           
+ReconFile_4                   :                          
+ReconFile_5                   :                            
 
 NumberOfLayers                : 3           # number of layers to be coded
@@ -22,4 +28,5 @@
 ViewOrderIndex                : 0 1 2       # ViewOrderIndex, per layer (m)
 LayerIdInNuh                  : 0           # Layer Id in NAL unit header, (0: no explicit signalling, otherwise per layer ) (m)
+TargetEncLayerIdList          :             # Layer Id in Nuh to be encoded, (empty:-> all layers will be encode) 
 SplittingFlag                 : 0           # Splitting Flag 
 ViewId                        : 1 0 2       # ViewId, per ViewOrderIndex (m)
@@ -34,5 +41,13 @@
 LayerIdsInSet_5               : 
 LayerIdsInSet_6               : 
-
+LayerIdsInSet_7               : 
+LayerIdsInSet_8               : 
+LayerIdsInSet_9               : 
+LayerIdsInSet_10              : 
+
+NumAddLayerSets               : 0            # Specifies the number of additional layer sets
+HighestLayerIdxPlus1_0        : -1           # Highest layer idx plus 1 for the 0-th additonal layer set, per independent layer (m) (first value will be ignored)
+HighestLayerIdxPlus1_1        : -1           # Highest layer idx plus 1 for the 1-th additonal layer set, per independent layer (m) (first value will be ignored)
+HighestLayerIdxPlus1_2        : -1           # Highest layer idx plus 1 for the 2-th additonal layer set, per independent layer (m) (first value will be ignored)
 
 DefaultTargetOutputLayerIdc   : 0            # Specifies output layers of layer sets, 0: output all layers, 1: output highest layer, 2: specified by LayerIdsInDefOutputLayerSet
@@ -41,15 +56,28 @@
 LayerIdsInAddOutputLayerSet_0 : 1            # Indices in VPS of output layers in additional output layer set 0
 LayerIdsInAddOutputLayerSet_1 : 2            # Indices in VPS of output layers in additional output layer set 1
-LayerIdsInAddOutputLayerSet_2 :              # Indices in VPS of output layers in additional output layer set 1
-LayerIdsInAddOutputLayerSet_3 :              # Indices in VPS of output layers in additional output layer set 1
-LayerIdsInAddOutputLayerSet_4 :              # Indices in VPS of output layers in additional output layer set 1
-
-ProfileLevelTierIdx           : 0 0 0 0 0 0  # Indices to profile level tier (TBD)
+LayerIdsInAddOutputLayerSet_2 :              # Indices in VPS of output layers in additional output layer set 2
+LayerIdsInAddOutputLayerSet_3 :              # Indices in VPS of output layers in additional output layer set 3
+LayerIdsInAddOutputLayerSet_4 :              # Indices in VPS of output layers in additional output layer set 4
+LayerIdsInAddOutputLayerSet_5 :              # Indices in VPS of output layers in additional output layer set 5
+LayerIdsInAddOutputLayerSet_6 :              # Indices in VPS of output layers in additional output layer set 6
+LayerIdsInAddOutputLayerSet_7 :              # Indices in VPS of output layers in additional output layer set 7
+LayerIdsInAddOutputLayerSet_8 :              # Indices in VPS of output layers in additional output layer set 8
+LayerIdsInAddOutputLayerSet_9 :              # Indices in VPS of output layers in additional output layer set 9
+LayerIdsInAddOutputLayerSet_10:              # Indices in VPS of output layers in additional output layer set 10
+
+ProfileLevelTierIdx           : 0 0 0 0 0 0 0 0 0 0 0 0 0 0  # Indices to profile level tier (TBD)
 
 #======== VPS / Dependencies ================
 DirectRefLayers_1             : 0           # Indices in VPS of direct reference layers 
 DirectRefLayers_2             : 0           # Indices in VPS of direct reference layers 
+DirectRefLayers_3             :             # Indices in VPS of direct reference layers 
+DirectRefLayers_4             :             # Indices in VPS of direct reference layers 
+DirectRefLayers_5             :             # Indices in VPS of direct reference layers 
+
 DependencyTypes_1             : 2           # Dependency types of direct reference layers, 0: Sample 1: Motion 2: Sample+Motion
 DependencyTypes_2             : 2           # Dependency types of direct reference layers, 0: Sample 1: Motion 2: Sample+Motion
+DependencyTypes_3             : 2           # Dependency types of direct reference layers, 0: Sample 1: Motion 2: Sample+Motion
+DependencyTypes_4             : 2           # Dependency types of direct reference layers, 0: Sample 1: Motion 2: Sample+Motion
+DependencyTypes_5             : 2           # Dependency types of direct reference layers, 0: Sample 1: Motion 2: Sample+Motion
 
 #======== Unit definition ================
@@ -101,4 +129,34 @@
 Frame8_l2:  B    7     7     0.68     0        0        0        3      4     -1 -3 -7 1         1    -2     5     1 1 1 1 0         1          0         2          -1        
 
+FrameI_l3:
+Frame1_l3:
+Frame2_l3:
+Frame3_l3:
+Frame4_l3:
+Frame5_l3:
+Frame6_l3:
+Frame7_l3:
+Frame8_l3:
+    
+FrameI_l4:
+Frame1_l4:
+Frame2_l4:
+Frame3_l4:
+Frame4_l4:
+Frame5_l4:
+Frame6_l4:
+Frame7_l4:
+Frame8_l4:
+
+FrameI_l5:
+Frame1_l5:
+Frame2_l5:
+Frame3_l5:
+Frame4_l5:
+Frame5_l5:
+Frame6_l5:
+Frame7_l5:
+Frame8_l5:
+
 #=========== Motion Search =============
 FastSearch                    : 1           # 0:Full search  1:TZ search
Index: /branches/HTM-12.0-dev1/source/App/TAppDecoder/TAppDecCfg.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/App/TAppDecoder/TAppDecCfg.cpp	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/App/TAppDecoder/TAppDecCfg.cpp	(revision 1054)
@@ -94,4 +94,9 @@
   ("TarDecLayerIdSetFile,l", cfg_TargetDecLayerIdSetFile, string(""), "targetDecLayerIdSet file name. The file should include white space separated LayerId values to be decoded. Omitting the option or a value of -1 in the file decodes all layers.")
   ("RespectDefDispWindow,w", m_respectDefDispWindow, 0, "Only output content inside the default display window\n")
+#if H_MV
+#if H_MV_HLS10_GEN_FIX
+  ("OutputVpsInfo,v", m_outputVpsInfo, false, "Output information about the layer dependencies and layer sets")
+#endif
+#endif
   ;
   po::setDefaults(opts);
Index: /branches/HTM-12.0-dev1/source/App/TAppDecoder/TAppDecCfg.h
===================================================================
--- /branches/HTM-12.0-dev1/source/App/TAppDecoder/TAppDecCfg.h	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/App/TAppDecoder/TAppDecCfg.h	(revision 1054)
@@ -80,4 +80,7 @@
 
 #if H_MV
+#if H_MV_HLS10_GEN_FIX
+  Bool          m_outputVpsInfo;                     ///< Output VPS information 
+#endif
   Void xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName); ///< create filenames
 #endif
Index: /branches/HTM-12.0-dev1/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/App/TAppDecoder/TAppDecTop.cpp	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/App/TAppDecoder/TAppDecTop.cpp	(revision 1054)
@@ -239,23 +239,31 @@
           {
             TComVPS* vps = m_vps; 
-          if ( m_targetOptLayerSetIdx == -1 )
+            if ( m_targetOptLayerSetIdx == -1 )
+            {
+              // Not normative! Corresponds to specification by "External Means". (Should be set equal to 0, when no external means available. ) 
+              m_targetOptLayerSetIdx = vps->getVpsNumLayerSetsMinus1(); 
+            }
+
+            for (Int dI = 0; dI < m_numDecoders; dI++ )
+            {
+              m_tDecTop[decIdx]->setTargetOptLayerSetIdx( m_targetOptLayerSetIdx ); 
+            }
+
+            if ( m_targetOptLayerSetIdx < 0 || m_targetOptLayerSetIdx >= vps->getNumOutputLayerSets() )
+            {
+              fprintf(stderr, "\ntarget output layer set index must be in the range of 0 to %d, inclusive \n", vps->getNumOutputLayerSets() - 1 );            
+              exit(EXIT_FAILURE);
+            }
+            m_targetDecLayerIdSet = vps->getTargetDecLayerIdList( m_targetOptLayerSetIdx ); 
+          }
+#if H_MV_HLS10_GEN_FIX
+          if (m_outputVpsInfo )
           {
-            // Not normative! Corresponds to specification by "External Means". (Should be set equal to 0, when no external means available. ) 
-            m_targetOptLayerSetIdx = vps->getVpsNumLayerSetsMinus1(); 
+            m_vps->printLayerDependencies();
+            m_vps->printLayerSets();
+            m_vps->printPTL(); 
           }
-
-          for (Int dI = 0; dI < m_numDecoders; dI++ )
-          {
-            m_tDecTop[decIdx]->setTargetOptLayerSetIdx( m_targetOptLayerSetIdx ); 
-          }
-
-          if ( m_targetOptLayerSetIdx < 0 || m_targetOptLayerSetIdx >= vps->getNumOutputLayerSets() )
-          {
-            fprintf(stderr, "\ntarget output layer set index must be in the range of 0 to %d, inclusive \n", vps->getNumOutputLayerSets() - 1 );            
-            exit(EXIT_FAILURE);
-          }
-          m_targetDecLayerIdSet = vps->getTargetDecLayerIdList( m_targetOptLayerSetIdx ); 
-        }
-      }
+#endif
+        }
 #if H_3D
         if (nalu.m_nalUnitType == NAL_UNIT_VPS )
@@ -569,6 +577,10 @@
   Int dpbFullness = 0;
 #if H_MV
+#if H_MV_HLS10_ADD_LAYERSETS
+  TComSPS* activeSPS = m_tDecTop[ decIdx ]->getActiveSPS();
+#else
   // preliminary fix
   TComSPS* activeSPS = m_tDecTop[0]->getActiveSPS();
+#endif
 #else
   TComSPS* activeSPS = m_cTDecTop.getActiveSPS();
Index: /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1054)
@@ -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
@@ -388,5 +401,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 +410,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 +420,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")
+#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 +455,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 +643,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 +669,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 +778,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 +832,6 @@
 #endif //H_3D
   ;
-  #if H_MV
+
+#if H_MV
   // parse coding structure
   for( Int k = 0; k < MAX_NUM_LAYERS; k++ )
@@ -1067,5 +1108,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 +1222,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 +1387,7 @@
     fprintf(stderr, "******************************************************************\n");
   }
+
+
+#if !H_MV_HLS10_PTL
   if( m_profile==Profile::NONE )
   {
@@ -1303,4 +1402,5 @@
     fprintf(stderr, "***************************************************************************\n");
   }
+#endif
 
   Bool check_failed = false; /* abort if there is a fatal configuration problem */
@@ -1428,6 +1528,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 +1547,5 @@
       xConfirmPara( !isAlsoInLayerSet, "All output layers of a output layer set be included in corresponding layer set.");
     }
+#endif
   }
 
@@ -1454,5 +1559,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 +1588,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,4 +2474,11 @@
 #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 ); 
Index: /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncCfg.h	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncCfg.h	(revision 1054)
@@ -81,4 +81,7 @@
   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 
   Bool                   m_splittingFlag;                     ///< Splitting Flag
@@ -89,9 +92,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 +135,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 +190,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 +465,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 +534,28 @@
   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, " " );
+    }
+  }
+#endif
+
+
   template <typename T>
   Void xResizeVector(  std::vector<T> & rpcVector )
Index: /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1054)
@@ -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,37 @@
   xDeriveDltArray          ( vps, dlt );
 #endif
-
+#if H_MV_HLS10_GEN_FIX
+  Bool wasEmpty = true; 
+  if ( m_targetEncLayerIdList.size() == 0 )
+  {
+    for (Int i = 0; i < m_numberOfLayers; i++ )
+    {
+      m_targetEncLayerIdList.push_back( m_layerIdInNuh[ 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 )
+  {  
+    vps.printLayerDependencies();
+    vps.printLayerSets(); 
+    vps.printPTL(); 
+  }
+#endif
 
   for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++)
@@ -248,6 +280,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);
@@ -801,8 +838,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_layerIdInNuh[ layer ] ))
+      {
+        continue; 
+      }
+#endif
+
       Int frmCnt = 0;
       while ( !eos[layer] && !(frmCnt == gopSize))
@@ -844,4 +892,11 @@
       for(Int layer=0; layer < m_numberOfLayers; layer++ )
       {
+#if H_MV_HLS10_GEN_FIX
+        if (!xLayerIdInTargetEncLayerIdList( m_layerIdInNuh[ layer ] ))
+        {
+          continue; 
+        }
+#endif
+
 #if H_3D_VSO        
           if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded )
@@ -870,4 +925,10 @@
   for(Int layer=0; layer < m_numberOfLayers; layer++ )
   {
+#if H_MV_HLS10_GEN_FIX
+    if (!xLayerIdInTargetEncLayerIdList( m_layerIdInNuh[ layer ] ))
+    {
+      continue; 
+    }
+#endif
     m_acTEncTopList[layer]->printSummary( m_acTEncTopList[layer]->getNumAllPicCoded(), m_isField );
   }
@@ -1499,4 +1560,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 ); 
@@ -1506,4 +1586,5 @@
     vps.setVpsProfilePresentFlag( i, true ); 
   }
+#endif
 }
 
@@ -1525,4 +1606,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 );
@@ -1540,5 +1629,7 @@
   {  
     Int currLsIdx = vps.olsIdxToLsIdx( i ); 
+#if !H_MV_HLS10_ADD_LAYERSETS
     std::vector<Int> targetDecLayerIdList = vps.getTargetDecLayerIdList( i ); 
+#endif
     Bool subLayerFlagInfoPresentFlag = false; 
 
@@ -1546,16 +1637,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++ )
       {
@@ -1563,4 +1686,5 @@
         maxNumReorderPics = std::max( maxNumReorderPics, m_numReorderPicsMvc[ layerIdInVps ][ j ] ); 
       }
+#endif
       assert( maxNumReorderPics != MIN_INT ); 
 
@@ -1588,5 +1712,4 @@
 }
 
-
 Void TAppEncTop::xSetLayerSets( TComVPS& vps )
 {   
@@ -1610,19 +1733,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 !
@@ -1634,7 +1805,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 );       
@@ -1643,10 +1820,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 ) );       
@@ -1654,10 +1843,50 @@
     }
 
+#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
+    {
+      Int lsIdx = vps.olsIdxToLsIdx( olsIdx ); 
+      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] );
+        }
+        else
+        {
+          // 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 && 
@@ -1697,5 +1926,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++ ) 
@@ -1746,5 +1979,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 ) )  
           {
@@ -1764,4 +2001,9 @@
       }
     }
+
+#if H_MV_HLS10_VPS_VUI
+  pcVPSVUI->setSingleLayerForNonIrapFlag( m_singleLayerForNonIrapFlag );
+  pcVPSVUI->setHigherLayerIrapSkipFlag( m_higherLayerIrapSkipFlag );
+#endif
 
     pcVPSVUI->setIlpRestrictedRefLayersFlag( m_ilpRestrictedRefLayersFlag );
Index: /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncTop.h
===================================================================
--- /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncTop.h	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncTop.h	(revision 1054)
@@ -132,4 +132,60 @@
   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 )
+  { 
+    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 );
+
+    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 xSetRepFormat              ( TComVPS& vps );
   Void xSetDpbSize                ( TComVPS& vps );
@@ -137,4 +193,10 @@
   GOPEntry* xGetGopEntry( Int layerIdInVps, Int poc );
   Int  xGetMax( std::vector<Int>& vec);
+#if H_MV_HLS10_GEN_FIX
+  Bool xLayerIdInTargetEncLayerIdList( Int nuhLayerId ) 
+  {
+    return  ( std::find(m_targetEncLayerIdList.begin(), m_targetEncLayerIdList.end(), nuhLayerId) != m_targetEncLayerIdList.end()) ;
+  }
+#endif
 #endif
 #if H_3D
Index: /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComRom.cpp	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComRom.cpp	(revision 1054)
@@ -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
+
 }
 
Index: /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComRom.h
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComRom.h	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComRom.h	(revision 1054)
@@ -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.
Index: /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComSlice.cpp	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComSlice.cpp	(revision 1054)
@@ -1875,4 +1875,7 @@
 #if H_MV
   m_vpsBaseLayerInternalFlag = true; 
+#if H_MV_HLS10_GEN_VSP_BASE_LAYER_AVAIL
+  m_vpsBaseLayerAvailableFlag = true; 
+#endif
 #endif
 
@@ -1900,7 +1903,12 @@
   {
     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
+      m_profileTierLevelIdx[i][j] = false; 
+#endif
       m_outputLayerFlag[i][j] = false; 
     }
@@ -1966,5 +1974,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 +2065,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 +2100,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 +2208,5 @@
     }
   }
-
+  
   for( Int i = 0; i <= getMaxLayersMinus1(); i++ )  // Bug in spec "<" instead of "<=" 
   {
@@ -2136,5 +2228,4 @@
     countedLayerIdxFlag[ i ] = 0;
   }
- 
   for( Int i = 0, k = 0; i  <=  getMaxLayersMinus1(); i++ )
   {
@@ -2144,4 +2235,5 @@
       m_treePartitionLayerIdList[ k ][ 0 ] = iNuhLId;
       m_numLayersInTreePartition[ k ]      = 1;
+
       for( Int j = 0; j < m_numPredictedLayers[ iNuhLId ]; j++ )  
       {
@@ -2154,9 +2246,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 +2261,5 @@
   return refLayerIdInNuh;
 }
+#endif
 
 Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType )
@@ -2315,5 +2411,9 @@
 {
   assert( lsIdx >= 0 ); 
+#if H_MV_HLS10_ADD_LAYERSETS
+  assert( lsIdx <= getNumLayerSets() ); 
+#else
   assert( lsIdx <= getVpsNumLayerSetsMinus1() ); 
+#endif
   return (Int) m_layerSetLayerIdList[ lsIdx ].size(); 
 }
@@ -2341,4 +2441,8 @@
 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,4 +2456,5 @@
   }
   return dependentFlag;
+#endif
 }
 
@@ -2378,8 +2483,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 +2542,5 @@
 }
 
+#if !H_MV_HLS10_ADD_LAYERSETS
 Void TComVPS::inferDbpSizeLayerSetZero( TComSPS* sps, Bool encoder )
 {
@@ -2451,5 +2565,5 @@
   }
 }
-
+#endif
 Bool TComVPS::getAltOutputLayerFlagVar( Int i )
 {
@@ -2465,4 +2579,5 @@
 }
 
+#if !H_MV_HLS10_MAXNUMPICS
 Int TComVPS::getMaxNumPics( Int layerId )
 {
@@ -2483,5 +2598,7 @@
   return maxNumPics;
 }
-
+#endif
+
+#if !H_MV_HLS10_REF_PRED_LAYERS
 Void TComVPS::xSetRefLayerFlags( Int currLayerId )
 {
@@ -2496,5 +2613,5 @@
   }
 }
-
+#endif
 #endif // H_MV
 
@@ -2579,4 +2696,5 @@
 #endif
 
+#if !H_MV_HLS10_PPS
   m_numScaledRefLayerOffsets = 0; 
 
@@ -2590,7 +2708,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 +3086,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 +3155,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,5 +3177,5 @@
       Int maxDecPicBufferingMinus1 = vps->getDpbSize()->getMaxVpsDecPicBufferingMinus1( targetOptLayerSetIdx, layerIdx, i ) ; 
 
-      if ( encoder )
+      if ( encoder )      
       {
         assert( getMaxDecPicBuffering( i ) - 1 == maxDecPicBufferingMinus1 ); 
@@ -3049,7 +3191,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,6 +3200,10 @@
     if ( !rps->getInterRPSPrediction() )
     {
+#if H_MV_HLS10_MAXNUMPICS
+      rps->checkMaxNumPics( vps->getVpsExtensionFlag(), INT_MAX, getLayerId(), getMaxDecPicBuffering( getSpsMaxSubLayersMinus1() ) - 1 );   // INT_MAX to be replaced by DpbSize
+#else
       rps->checkMaxNumPics( vps->getVpsExtensionFlag(), vps->getMaxNumPics( currLayerId ), 
         getLayerId(), getMaxDecPicBuffering( getSpsMaxSubLayersMinus1() ) - 1 );  
+#endif
     }
   }
@@ -3425,5 +3572,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 +3647,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
 }
 
@@ -4233,4 +4388,16 @@
 , 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));
@@ -4295,5 +4462,9 @@
 
   m_vpsVuiBspHrdPresentFlag = false; 
+#if H_MV_HLS10_VPS_VUI_BSP
+  m_vpsVuiBspHrdParameters  = NULL;
+#else
   m_vpsVuiBspHrdParameters  = new TComVpsVuiBspHrdParameters();
+#endif
 }
 
@@ -4338,7 +4509,8 @@
     assert( getBitDepthVpsLumaMinus8          () == prevRepFormat->getBitDepthVpsLumaMinus8          () );
     assert( getBitDepthVpsChromaMinus8        () == prevRepFormat->getBitDepthVpsChromaMinus8        () );
-}
-}
-
+  }
+}
+
+#if !H_MV_HLS10_VPS_VUI_BSP
 Void TComVpsVuiBspHrdParameters::checkLayerInBspFlag( TComVPS* vps, Int h )
 {
@@ -4419,4 +4591,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 )
@@ -4454,5 +4727,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: /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComSlice.h	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComSlice.h	(revision 1054)
@@ -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,16 @@
   Bool m_frameOnlyConstraintFlag;
   
+#if H_MV_HLS10_PTL
+  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
 public:
   ProfileTierLevel();
@@ -230,4 +248,36 @@
   Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; }
   Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; }
+
+#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
+
 };
 
@@ -359,5 +409,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 +484,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 +589,5 @@
   Void setHrdParametermeters( Int k, TComHRD* val  ) {  m_hrdParameters[k] = val; }; 
   TComHRD* getHrdParametermeters( Int k ) {  return m_hrdParameters[k]; }; 
+#endif;
 };
 
@@ -501,4 +616,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 +693,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 +736,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 +781,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 +820,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 +839,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 +911,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 +944,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 +979,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 +1067,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 +1078,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 +1120,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; }
@@ -1002,6 +1210,11 @@
   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 ]; } 
+#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 +1246,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]; } 
@@ -1066,10 +1281,21 @@
   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 +1304,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 +1326,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]; }; 
@@ -1102,4 +1338,65 @@
   Int     getNumOutputLayersInOutputLayerSet( Int i )                      { return (Int) getTargetOptLayerIdList( i ).size(); }; 
   Int     getOlsHighestOutputLayerId( Int i )                              { return getTargetOptLayerIdList( i ).back(); };  
+
+#if H_MV_HLS10_ADD_LAYERSETS
+  Void    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    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 ];
+    }
+  };
+
+  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 );
@@ -1113,6 +1410,164 @@
 
   // helpers
+
   Bool    getInDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps, Int depth = 0 );
+#if !H_MV_HLS10_MAXNUMPICS
   Int     getMaxNumPics( Int layerId );
+#endif
+#if H_MV_HLS10_ADD_LAYERSETS
+
+  Void    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    printLayerDependencies() 
+  {
+    vector<Int> fullArray;
+    vector<Int> range; 
+    for (Int i = 0; i <= getMaxLayersMinus1(); i++ )
+    {
+      fullArray.push_back( getMaxLayersMinus1() + 1 ); 
+      range.push_back( i ); 
+    }
+    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; 
+
+  };
+
+  Void    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; 
+};
+
+
+
+  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 +2012,8 @@
   TComVPS*    m_pcVPS; 
   // SPS 
+#if H_MV_HLS10_MULTILAYERSPS
+  Int         m_spsMaxSubLayersMinus1;
+  Int         m_spsExtOrMaxSubLayersMinus1;
+#endif
   Bool        m_spsExtensionPresentFlag; 
 
@@ -1574,4 +2033,5 @@
   // SPS Extension 
   Bool        m_interViewMvVertConstraintFlag;
+#if !H_MV_HLS10_PPS
   Int         m_numScaledRefLayerOffsets;
   Int         m_scaledRefLayerId          [MAX_NUM_SCALED_REF_LAYERS];
@@ -1580,4 +2040,5 @@
   Int         m_scaledRefLayerRightOffset [MAX_NUM_LAYERS];
   Int         m_scaledRefLayerBottomOffset[MAX_NUM_LAYERS];
+#endif
 #endif
 #if H_3D
@@ -1683,4 +2144,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 +2179,30 @@
   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  )
+  {     
+    assert( getLayerId() != 0 ); 
+    if ( !atPsActivation   )
+    {
+      assert( vps == NULL );
+      if (getSpsExtOrMaxSubLayersMinus1() != 7)
+      {
+        setSpsMaxSubLayersMinus1( getSpsExtOrMaxSubLayersMinus1() );
+      }
+    }
+    else
+    {
+      assert( vps != NULL );
+      if (getSpsExtOrMaxSubLayersMinus1() == 7)
+      {
+        setSpsMaxSubLayersMinus1( vps->getMaxSubLayersMinus1() );
+      }
+    }
+  }
+
+  Bool getMultiLayerExtSpsFlag()            { return ( getLayerId() != 0  &&  getSpsExtOrMaxSubLayersMinus1() == 7 ); }
+#endif
   Void inferSpsMaxDecPicBufferingMinus1( TComVPS* vps, Int targetOptLayerSetIdx, Int currLayerId, Bool encoder );
 
@@ -1753,4 +2243,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 +2261,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 );
Index: /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TypeDef.h	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TypeDef.h	(revision 1054)
@@ -55,5 +55,5 @@
 
 #ifndef HEVC_EXT
-#define HEVC_EXT                    2
+#define HEVC_EXT                    1
 #endif
 
@@ -387,5 +387,29 @@
 /////////////////////////////////////////////////////////////////////////////////
 // TBD: Check if integration is necessary. 
+
+
+
+#define H_MV_HLS10_GEN                       0  // General changes (not tested)
+
+#define H_MV_HLS10_GEN_FIX                   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_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
@@ -463,7 +487,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
@@ -480,11 +514,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
@@ -957,8 +997,16 @@
     MAINSTILLPICTURE = 3,
 #if H_MV
+#if H_MV_HLS10_PTL
+    MULTIVIEWMAIN = 6,
+    MAIN3D = 5,
+#if H_3D
+    MAIN3D = 8, 
+#endif
+#else
     MAINSTEREO = 4,
     MAINMULTIVIEW = 5,
 #if H_3D
     MAIN3D = 6, 
+#endif
 #endif
 #endif
Index: /branches/HTM-12.0-dev1/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1054)
@@ -53,5 +53,9 @@
   }
   // To avoid mismatches
+#if H_MV_HLS10_GEN_FIX
+  fprintf( g_hTrace, "=========== Sequence Parameter Set LayerId: %d ===========\n", pSPS->getLayerId() );
+#else
   fprintf( g_hTrace, "=========== Sequence Parameter Set ===========\n" );
+#endif
 #else
   fprintf( g_hTrace, "=========== Sequence Parameter Set ID: %d ===========\n", pSPS->getSPSId() );
@@ -66,5 +70,9 @@
     return; 
   }
+#if H_MV_HLS10_GEN_FIX
+  fprintf( g_hTrace, "=========== Picture Parameter Set LayerId: %d ===========\n", pPPS->getLayerId() );
+#else
   fprintf( g_hTrace, "=========== Picture Parameter Set ===========\n" );
+#endif
 #else
   fprintf( g_hTrace, "=========== Picture Parameter Set ID: %d ===========\n", pPPS->getPPSId() );
@@ -334,4 +342,5 @@
     }
   }
+#if !H_MV_HLS10_PPS
 #if H_MV
   if ( pcPPS->getLayerId() > 0 )
@@ -347,4 +356,5 @@
   {  
 #endif
+#endif
   READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" );           pcPPS->setScalingListPresentFlag( uiCode ? true : false );
   if(pcPPS->getScalingListPresentFlag ())
@@ -352,8 +362,9 @@
     parseScalingList( pcPPS->getScalingList() );
   }
-#if H_MV
-  }
-#endif
-
+#if !H_MV_HLS10_PPS
+#if H_MV
+  }
+#endif
+#endif
   READ_FLAG( uiCode, "lists_modification_present_flag");
   pcPPS->setListsModificationPresentFlag(uiCode);
@@ -389,6 +400,10 @@
     if ( pcPPS->getPpsMultilayerExtensionFlag() )
     { 
+#if H_MV_HLS10_PPS
+      parsePPSMultilayerExtension( pcPPS ); 
+#else
       READ_FLAG( uiCode, "poc_reset_info_present_flag" ); pcPPS->setPocResetInfoPresentFlag( uiCode == 1 );
       READ_FLAG( uiCode, "pps_extension_reserved_zero_flag" );
+#endif
     }
 #if !H_3D
@@ -415,4 +430,5 @@
   }
 }
+
 
 #if H_3D
@@ -759,4 +775,5 @@
   UInt  uiCode;
   READ_CODE( 4,  uiCode, "sps_video_parameter_set_id");          pcSPS->setVPSId        ( uiCode );
+
 #if H_MV
   if ( pcSPS->getLayerId() == 0 )
@@ -765,4 +782,16 @@
     READ_CODE( 3,  uiCode, "sps_max_sub_layers_minus1" );          pcSPS->setMaxTLayers   ( uiCode+1 );
     assert(uiCode <= 6);
+#if H_MV_HLS10_MULTILAYERSPS
+#if H_MV
+  }
+  else
+  {
+    READ_CODE( 3, uiCode, "sps_ext_or_max_sub_layers_minus1" ); pcSPS->setSpsExtOrMaxSubLayersMinus1( uiCode );    
+    pcSPS->inferSpsMaxSubLayersMinus1( false, NULL );
+  }
+  if ( !pcSPS->getMultiLayerExtSpsFlag() )
+  {
+#endif
+#endif
 
     READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" );               pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false );
@@ -780,5 +809,9 @@
   assert(uiCode <= 15);
 #if H_MV
+#if H_MV_HLS10_MULTILAYERSPS
+  if ( pcSPS->getMultiLayerExtSpsFlag() )
+#else 
   if ( pcSPS->getLayerId() > 0 )
+#endif
   {
     READ_FLAG( uiCode, "update_rep_format_flag" );               pcSPS->setUpdateRepFormatFlag( uiCode == 1 );
@@ -802,6 +835,8 @@
     READ_UVLC (    uiCode, "pic_width_in_luma_samples" );          pcSPS->setPicWidthInLumaSamples ( uiCode    );
     READ_UVLC (    uiCode, "pic_height_in_luma_samples" );         pcSPS->setPicHeightInLumaSamples( uiCode    );
-#if H_MV
-  }
+#if !H_MV_HLS10_MULTILAYERSPS
+#if H_MV
+  }
+#endif
 #endif
   READ_FLAG(     uiCode, "conformance_window_flag");
@@ -816,4 +851,7 @@
     READ_UVLC(   uiCode, "conf_win_top_offset" );                conf.setWindowTopOffset   ( uiCode  );
     READ_UVLC(   uiCode, "conf_win_bottom_offset" );             conf.setWindowBottomOffset( uiCode  );    
+#if H_MV_HLS10_MULTILAYERSPS
+  }
+#endif
 #else
     READ_UVLC(   uiCode, "conf_win_left_offset" );               conf.setWindowLeftOffset  ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) );
@@ -825,5 +863,9 @@
 
 #if H_MV
+#if H_MV_HLS10_MULTILAYERSPS
+  if ( !pcSPS->getMultiLayerExtSpsFlag() )
+#else // H_MV_HLS10_GEN
   if ( pcSPS->getLayerId() == 0 )
+#endif // H_MV_HLS10_GEN
   { 
 #endif
@@ -845,5 +887,9 @@
 
 #if H_MV
+#if H_MV_HLS10_MULTILAYERSPS
+  if ( !pcSPS->getMultiLayerExtSpsFlag()) 
+#else 
   if ( pcSPS->getLayerId() == 0 ) 
+#endif
   {  
 #endif
@@ -904,5 +950,9 @@
   {
 #if H_MV
+#if H_MV_HLS10_MULTILAYERSPS
+    if ( pcSPS->getMultiLayerExtSpsFlag() )
+#else 
     if ( pcSPS->getLayerId() > 0 )
+#endif
     {    
       READ_FLAG( uiCode, "sps_infer_scaling_list_flag" ); pcSPS->setSpsInferScalingListFlag( uiCode == 1 );
@@ -1032,4 +1082,5 @@
   READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" );    pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false);
   
+#if !H_MV_HLS10_PPS
   READ_UVLC( uiCode, "num_scaled_ref_layer_offsets" ); pcSPS->setNumScaledRefLayerOffsets( uiCode );
 
@@ -1046,4 +1097,5 @@
     READ_FLAG( uiCode, "sps_multilayer_ext_reserved_zero_flag[ i ]" );
   }
+#endif
 }
 
@@ -1075,5 +1127,9 @@
 #if H_MV
   READ_FLAG( uiCode, "vps_base_layer_internal_flag" );            pcVPS->setVpsBaseLayerInternalFlag( uiCode == 1 );
+#if H_MV_HLS10_GEN_VSP_BASE_LAYER_AVAIL
+  READ_FLAG( uiCode, "vps_base_layer_available_flag" );           pcVPS->setVpsBaseLayerAvailableFlag( uiCode == 1 );
+#else
   READ_FLAG( uiCode, "vps_reserved_one_bit" );                    assert( uiCode == 1 ); 
+#endif
 #else
   READ_CODE( 2,  uiCode,  "vps_reserved_three_2bits" );           assert(uiCode == 3);
@@ -1115,5 +1171,9 @@
   READ_CODE( 6, uiCode, "vps_max_layer_id" );   pcVPS->setVpsMaxLayerId( uiCode );
 
+#if H_MV_HLS10_GEN_FIX
+  READ_UVLC(    uiCode, "vps_num_layer_sets_minus1" );  pcVPS->setVpsNumLayerSetsMinus1( uiCode );
+#else
   READ_UVLC(    uiCode, "vps_max_num_layer_sets_minus1" );               pcVPS->setVpsNumLayerSetsMinus1( uiCode );
+#endif
   for( UInt opsIdx = 1; opsIdx <= pcVPS->getVpsNumLayerSetsMinus1(); opsIdx ++ )
   {
@@ -1204,4 +1264,16 @@
   UInt uiCode; 
 
+#if H_MV_HLS10_PTL
+  if( pcVPS->getMaxLayersMinus1() > 0  &&  pcVPS->getVpsBaseLayerInternalFlag() )
+  {
+    parsePTL( pcVPS->getPTL( 1 ),0, pcVPS->getMaxSubLayersMinus1()  );  
+    
+    // Copy Profile info
+    TComPTL temp = *pcVPS->getPTL( 1 );
+    *pcVPS->getPTL( 1 ) = *pcVPS->getPTL( 0 );
+    pcVPS->getPTL( 1 )->copyLevelFrom( &temp );
+  }
+#endif 
+
   READ_FLAG( uiCode, "splitting_flag" );                          pcVPS->setSplittingFlag( uiCode == 1 ? true : false );
 
@@ -1275,4 +1347,20 @@
   }
   pcVPS->setRefLayers(); 
+
+#if H_MV_HLS10_ADD_LAYERSETS
+  if ( pcVPS->getNumIndependentLayers() > 1 ) 
+  {
+    READ_UVLC( uiCode, "num_add_layer_sets"      ); pcVPS->setNumAddLayerSets( uiCode );
+  }
+  for (Int i = 0; i < pcVPS->getNumAddLayerSets(); i++)
+  {
+    for (Int j = 1; j < pcVPS->getNumIndependentLayers(); j++)
+    {
+      READ_CODE( pcVPS->getHighestLayerIdxPlus1Len( j ) , uiCode, "highest_layer_idx_plus1" ); pcVPS->setHighestLayerIdxPlus1( i, j, uiCode );
+    }
+    pcVPS->deriveAddLayerSetLayerIdList( i );
+  }
+#endif
+
   READ_FLAG( uiCode, "vps_sub_layers_max_minus1_present_flag" ); pcVPS->setVpsSubLayersMaxMinus1PresentFlag( uiCode == 1 );
   if ( pcVPS->getVpsSubLayersMaxMinus1PresentFlag() )
@@ -1310,4 +1398,19 @@
   READ_UVLC( uiCode, "vps_num_profile_tier_level_minus1" );  pcVPS->setVpsNumProfileTierLevelMinus1( uiCode );  
 
+#if H_MV_HLS10_PTL
+  Int offsetVal =  ( pcVPS->getMaxLayersMinus1() > 0  &&  pcVPS->getVpsBaseLayerInternalFlag() ) ? 2 : 1;   
+  for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 2 : 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ )
+  {
+    READ_FLAG(  uiCode, "vps_profile_present_flag[i]" );    pcVPS->setVpsProfilePresentFlag( i, uiCode == 1 );
+    parsePTL ( pcVPS->getPTL( offsetVal ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers()-1);
+    if( !pcVPS->getVpsProfilePresentFlag( i ) )
+    {
+      TComPTL temp = *pcVPS->getPTL( offsetVal );
+      *pcVPS->getPTL( offsetVal ) = *pcVPS->getPTL( offsetVal - 1 );
+      pcVPS->getPTL( offsetVal )->copyLevelFrom( &temp );
+    }
+    offsetVal++;
+  }
+#else 
   for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ )
   {
@@ -1321,5 +1424,7 @@
     }
   }
-
+#endif 
+
+#if !H_MV_HLS10_ADD_LAYERSETS
   if ( pcVPS->getNumIndependentLayers() > 1 ) 
   {
@@ -1333,4 +1438,6 @@
     }
   }
+#endif // H_MV_HLS10_GEN
+
   if (pcVPS->getNumLayerSets() > 1)
   {
@@ -1345,4 +1452,7 @@
   pcVPS->setLayerSetIdxForOlsMinus1(0, -1); 
 
+#if H_MV_HLS10_NESSECARY_LAYER
+  pcVPS->deriveNecessaryLayerFlags( 0 ); 
+#endif 
   pcVPS->deriveTargetLayerIdList( 0 ); 
 
@@ -1368,10 +1478,24 @@
       }
     }
+#if H_MV_HLS10_NESSECARY_LAYER
+    pcVPS->deriveNecessaryLayerFlags( i ); 
+#endif
     pcVPS->deriveTargetLayerIdList( i ); 
 
+#if H_MV_HLS10_PTL
+    for ( Int j = 0; j < pcVPS->getNumLayersInIdList( pcVPS->olsIdxToLsIdx(i)); j++ )
+    {    
+      if (pcVPS->getNecessaryLayerFlag( i, j ) && pcVPS->getVpsNumProfileTierLevelMinus1() > 0 )
+      {
+        READ_CODE( pcVPS->getProfileTierLevelIdxLen(), uiCode,"profile_tier_level_idx[ i ][ j ]" );   pcVPS->setProfileTierLevelIdx( i, j, uiCode ); 
+      }
+    }
+#else
     if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
-    {      
+    { 
       READ_CODE( pcVPS->getProfileLevelTierIdxLen(), uiCode,"profile_level_tier_idx[ i ]" );   pcVPS->setProfileLevelTierIdx( i , uiCode ); 
     }
+#endif
+
     if( pcVPS->getNumOutputLayersInOutputLayerSet( i ) == 1 && pcVPS->getNumDirectRefLayers( pcVPS->getOlsHighestOutputLayerId( i ) ) > 0 )
     {
@@ -1422,5 +1546,7 @@
   }
 
+#if !H_MV_HLS10_GEN_FIX
   READ_FLAG( uiCode, "vps_reserved_zero_flag" ); 
+#endif
   parseDpbSize( pcVPS ); 
 
@@ -1484,11 +1610,11 @@
   if ( pcRepFormat->getChromaAndBitDepthVpsPresentFlag() )
   {  
-  READ_CODE( 2,  uiCode, "chroma_format_vps_idc" );          pcRepFormat->setChromaFormatVpsIdc       ( uiCode );
-  if ( pcRepFormat->getChromaFormatVpsIdc() == 3 )
-  {
-    READ_FLAG( uiCode, "separate_colour_plane_vps_flag" ); pcRepFormat->setSeparateColourPlaneVpsFlag( uiCode == 1 ); 
-  }
-  READ_CODE( 4,  uiCode, "bit_depth_vps_luma_minus8" );      pcRepFormat->setBitDepthVpsLumaMinus8    ( uiCode );
-  READ_CODE( 4,  uiCode, "bit_depth_vps_chroma_minus8" );    pcRepFormat->setBitDepthVpsChromaMinus8  ( uiCode );
+    READ_CODE( 2,  uiCode, "chroma_format_vps_idc" );          pcRepFormat->setChromaFormatVpsIdc       ( uiCode );
+    if ( pcRepFormat->getChromaFormatVpsIdc() == 3 )
+    {
+      READ_FLAG( uiCode, "separate_colour_plane_vps_flag" ); pcRepFormat->setSeparateColourPlaneVpsFlag( uiCode == 1 ); 
+    }
+    READ_CODE( 4,  uiCode, "bit_depth_vps_luma_minus8" );      pcRepFormat->setBitDepthVpsLumaMinus8    ( uiCode );
+    READ_CODE( 4,  uiCode, "bit_depth_vps_chroma_minus8" );    pcRepFormat->setBitDepthVpsChromaMinus8  ( uiCode );
   }
   else
@@ -1496,4 +1622,14 @@
     pcRepFormat->inferChromaAndBitDepth(pcPrevRepFormat, false ); 
   }
+#if H_MV_HLS10_GEN_VSP_CONF_WIN
+  READ_FLAG( uiCode, "conformance_window_vps_flag" ); pcRepFormat->setConformanceWindowVpsFlag( uiCode == 1 );
+  if ( pcRepFormat->getConformanceWindowVpsFlag() )
+  {
+    READ_UVLC( uiCode, "conf_win_vps_left_offset" ); pcRepFormat->setConfWinVpsLeftOffset( uiCode );
+    READ_UVLC( uiCode, "conf_win_vps_right_offset" ); pcRepFormat->setConfWinVpsRightOffset( uiCode );
+    READ_UVLC( uiCode, "conf_win_vps_top_offset" ); pcRepFormat->setConfWinVpsTopOffset( uiCode );
+    READ_UVLC( uiCode, "conf_win_vps_bottom_offset" ); pcRepFormat->setConfWinVpsBottomOffset( uiCode );
+  }
+#endif 
 }
 
@@ -1521,5 +1657,9 @@
   if( pcVPSVUI->getBitRatePresentVpsFlag( )  ||  pcVPSVUI->getPicRatePresentVpsFlag( ) )
   {
+#if H_MV_HLS10_VPS_VUI
+    for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i  <  pcVPS->getNumLayerSets(); i++ )
+#else
     for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i  <=  pcVPS->getVpsNumLayerSetsMinus1(); i++ )
+#endif
     {
       for( Int j = 0; j  <=  pcVPS->getMaxSubLayersInLayerSetMinus1( i ); j++ ) 
@@ -1554,5 +1694,9 @@
   else
   {
+#if H_MV_HLS10_VPS_VUI
+    pcVPSVUI->setVpsNumVideoSignalInfoMinus1( pcVPS->getMaxLayersMinus1() - pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1 ); 
+#else
     pcVPSVUI->setVpsNumVideoSignalInfoMinus1( pcVPS->getMaxLayersMinus1() ); 
+#endif
   }
 
@@ -1567,5 +1711,9 @@
   if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() && pcVPSVUI->getVpsNumVideoSignalInfoMinus1() > 0 )
   {
+#if H_MV_HLS10_VPS_VUI
+    for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
+#else
     for( Int i = 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
+#endif
     {
       READ_CODE( 4, uiCode, "vps_video_signal_info_idx" ); pcVPSVUI->setVpsVideoSignalInfoIdx( i, uiCode );
@@ -1594,6 +1742,10 @@
     {
       for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ) ; j++ )
-      {  
+      {
+#if H_MV_HLS10_REF_PRED_LAYERS
+        Int layerIdx = pcVPS->getLayerIdInVps(pcVPS->getIdDirectRefLayer(pcVPS->getLayerIdInNuh( i ) , j  ));  
+#else
         Int layerIdx = pcVPS->getLayerIdInVps(pcVPS->getRefLayerId(pcVPS->getLayerIdInNuh( i ) , j  ));  
+#endif
         if( pcVPSVUI->getTilesInUseFlag( i )  &&  pcVPSVUI->getTilesInUseFlag( layerIdx ) )  
         {
@@ -1613,5 +1765,10 @@
     }
   }
+#if H_MV_HLS10_VPS_VUI
+  READ_FLAG( uiCode, "single_layer_for_non_irap_flag" ); pcVPSVUI->setSingleLayerForNonIrapFlag( uiCode == 1 );
+  READ_FLAG( uiCode, "higher_layer_irap_skip_flag" ); pcVPSVUI->setHigherLayerIrapSkipFlag( uiCode == 1 );
+#else 
   READ_CODE( 3, uiCode, "vps_vui_reserved_zero_3bits" ); 
+#endif
   READ_FLAG( uiCode, "ilp_restricted_ref_layers_flag" ); pcVPSVUI->setIlpRestrictedRefLayersFlag( uiCode == 1 );
 
@@ -1622,5 +1779,9 @@
       for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ); j++ )
       {
+#if H_MV_HLS10_REF_PRED_LAYERS
+        if( pcVPS->getVpsBaseLayerInternalFlag() || pcVPS->getIdDirectRefLayer( pcVPS->getLayerIdInNuh( i ), j ) > 0 )
+#else
         if( pcVPS->getVpsBaseLayerInternalFlag() || pcVPS->getRefLayerId( pcVPS->getLayerIdInNuh( i ), j ) > 0 )
+#endif
         {        
           READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); pcVPSVUI->setMinSpatialSegmentOffsetPlus1( i, j, uiCode );
@@ -1661,8 +1822,102 @@
 
   TComVpsVuiBspHrdParameters*  vpsVuiBspHrdP = pcVPSVUI->getVpsVuiBspHrdParameters(); 
-  
+#if H_MV_HLS10_VPS_VUI_BSP
+  assert( vpsVuiBspHrdP == NULL ); 
+  vpsVuiBspHrdP = new TComVpsVuiBspHrdParameters; 
+  pcVPSVUI->setVpsVuiBspHrdParameters( vpsVuiBspHrdP ); 
+#else
   assert ( vpsVuiBspHrdP );
-
+#endif
   UInt uiCode; 
+#if H_MV_HLS10_VPS_VUI_BSP
+  READ_UVLC( uiCode, "vps_num_add_hrd_params" ); vpsVuiBspHrdP->setVpsNumAddHrdParams( uiCode );
+  vpsVuiBspHrdP->createAfterVpsNumAddHrdParams( pcVPS ); 
+  for( Int i = pcVPS->getNumHrdParameters(); i < pcVPS->getNumHrdParameters() + vpsVuiBspHrdP->getVpsNumAddHrdParams(); i++ )
+  {  
+    if( i > 0 )  
+    {
+      READ_FLAG( uiCode, "cprms_add_present_flag" ); vpsVuiBspHrdP->setCprmsAddPresentFlag( i, uiCode == 1 );
+    }
+    else
+    {
+       vpsVuiBspHrdP->setCprmsAddPresentFlag( i, true );
+    }
+
+    READ_UVLC( uiCode, "num_sub_layer_hrd_minus1" ); vpsVuiBspHrdP->setNumSubLayerHrdMinus1( i, uiCode );
+    TComHRD* hrdParameters = vpsVuiBspHrdP->getHrdParametermeters( i ); 
+    parseHrdParameters( hrdParameters, vpsVuiBspHrdP->getCprmsAddPresentFlag( i ), vpsVuiBspHrdP->getNumSubLayerHrdMinus1( i ) );     
+  }
+
+  vpsVuiBspHrdP->setNumPartitionsInSchemeMinus1( 0, 0, 0);
+  vpsVuiBspHrdP->createAfterNumPartitionsInSchemeMinus1( 0, 0 );
+
+  for( Int h = 0; h < pcVPS->getNumOutputLayerSets(); h++ )
+  { 
+    if ( h == 0)
+    {
+      vpsVuiBspHrdP->setNumSignalledPartitioningSchemes( h, 0 );
+    }
+    else
+    {
+      READ_UVLC( uiCode, "num_signalled_partitioning_schemes" ); vpsVuiBspHrdP->setNumSignalledPartitioningSchemes( h, uiCode );
+    }    
+    vpsVuiBspHrdP->createAfterNumSignalledPartitioningSchemes( h );
+
+    for( Int j = 0; j < vpsVuiBspHrdP->getNumSignalledPartitioningSchemes( h ) + 1; j++ )
+    { 
+      if ( j == 0 && h == 0 )
+      {
+        vpsVuiBspHrdP->setNumPartitionsInSchemeMinus1( h, j, uiCode );
+      }
+      else if( j == 0 )
+      {
+        vpsVuiBspHrdP->setNumPartitionsInSchemeMinus1( h, j, pcVPS->getNumLayersInIdList( h ) - 1 );
+      }
+      else
+      {
+        READ_UVLC( uiCode, "num_partitions_in_scheme_minus1" ); vpsVuiBspHrdP->setNumPartitionsInSchemeMinus1( h, j, uiCode );
+      }
+      vpsVuiBspHrdP->createAfterNumPartitionsInSchemeMinus1( h, j );
+
+      for( Int k = 0; k  <=  vpsVuiBspHrdP->getNumPartitionsInSchemeMinus1( h, j ); k++ )  
+      {
+        for( Int r = 0; r < pcVPS->getNumLayersInIdList(pcVPS->olsIdxToLsIdx( h ) )   ; r++ )  
+        {
+          if( h == 0 && j == 0 && k == 0 && r == 0 )
+          {
+             vpsVuiBspHrdP->setLayerIncludedInPartitionFlag( h, j, k, r, true );
+          }
+          else if ( h > 0 && j == 0 )
+          {
+             vpsVuiBspHrdP->setLayerIncludedInPartitionFlag( h, j, k, r, (k == r) );
+          }
+          else
+          {
+            READ_FLAG( uiCode, "layer_included_in_partition_flag" ); vpsVuiBspHrdP->setLayerIncludedInPartitionFlag( h, j, k, r, uiCode == 1 );
+          }          
+        }
+      }
+    }  
+    if ( h > 0 )
+    {
+      for( Int i = 0; i < vpsVuiBspHrdP->getNumSignalledPartitioningSchemes( h ) + 1; i++ )  
+      {
+        for( Int t = 0; t  <=  pcVPS->getMaxSubLayersInLayerSetMinus1( pcVPS->olsIdxToLsIdx( i ) ); t++ )
+        {  
+          READ_UVLC( uiCode, "num_bsp_schedules_minus1" ); vpsVuiBspHrdP->setNumBspSchedulesMinus1( h, i, t, uiCode );
+          vpsVuiBspHrdP->createAfterNumBspSchedulesMinus1( h, i, t );
+          for( Int j = 0; j  <=  vpsVuiBspHrdP->getNumBspSchedulesMinus1( h, i, t ); j++ )  
+          {
+            for( Int k = 0; k  <=  vpsVuiBspHrdP->getNumPartitionsInSchemeMinus1( h, j ); k++ )
+            {  
+              READ_CODE( vpsVuiBspHrdP->getBspHrdIdxLen( pcVPS ), uiCode, "bsp_hrd_idx" ); vpsVuiBspHrdP->setBspHrdIdx( h, i, t, j, k, uiCode );
+              READ_UVLC( uiCode, "bsp_sched_idx" ); vpsVuiBspHrdP->setBspSchedIdx( h, i, t, j, k, uiCode );
+            }  
+          }
+        }  
+      }
+    }
+  }  
+#else
   READ_UVLC( uiCode, "vps_num_bsp_hrd_parameters_minus1" ); vpsVuiBspHrdP->setVpsNumBspHrdParametersMinus1( uiCode );
   for( Int i = 0; i <= vpsVuiBspHrdP->getVpsNumBspHrdParametersMinus1( ); i++ )
@@ -1701,5 +1956,6 @@
     }  
   }  
-}  
+#endif  
+}
 
 Void TDecCavlc::parseVideoSignalInfo( TComVideoSignalInfo* pcVideoSignalInfo ) 
@@ -1733,5 +1989,19 @@
         for( Int k = 0; k < vps->getNumLayersInIdList( currLsIdx ); k++ )   
         {
+#if H_MV_HLS10_DBP_SIZE
+          if ( vps->getNecessaryLayerFlag( i, k ) && ( vps->getVpsBaseLayerInternalFlag() || ( vps->getLayerSetLayerIdList(vps->olsIdxToLsIdx(i),k) != 0 ) ))
+          {
+            READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1" ); dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode );
+          }
+          else
+          {
+            if ( vps->getNecessaryLayerFlag( i, k ) && ( j == 0 ) && ( k == 0 ))
+            {
+              dpbSize->setMaxVpsDecPicBufferingMinus1(i ,k, j, 0 );
+            }
+          }
+#else
           READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1" ); dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode );
+#endif
         }
         READ_UVLC( uiCode, "max_vps_num_reorder_pics" ); dpbSize->setMaxVpsNumReorderPics( i, j, uiCode );
@@ -1744,5 +2014,12 @@
           for( Int k = 0; k < vps->getNumLayersInIdList( vps->olsIdxToLsIdx( i ) ); k++ )   
           {
-            dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, dpbSize->getMaxVpsDecPicBufferingMinus1( i,k, j - 1 ) );
+#if H_MV_HLS10_DBP_SIZE
+            if ( vps->getNecessaryLayerFlag(i, k ) )
+            {            
+#endif
+              dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, dpbSize->getMaxVpsDecPicBufferingMinus1( i,k, j - 1 ) );
+#if H_MV_HLS10_DBP_SIZE
+            }
+#endif            
           }
           dpbSize->setMaxVpsNumReorderPics      ( i, j, dpbSize->getMaxVpsNumReorderPics      ( i, j - 1 ) );
@@ -1940,5 +2217,7 @@
   sps->inferScalingList( parameterSetManager->getActiveSPS( sps->getSpsScalingListRefLayerId() ) );   
   sps->inferSpsMaxDecPicBufferingMinus1( vps, targetOlsIdx, rpcSlice->getLayerId(), false ); 
+#if !H_MV_HLS10_ADD_LAYERSETS 
   vps->inferDbpSizeLayerSetZero( sps, false ); 
+#endif
 
   if ( sps->getVuiParametersPresentFlag() )
@@ -2155,5 +2434,9 @@
           rps->checkMaxNumPics( 
             vps->getVpsExtensionFlag(), 
+#if H_MV_HLS10_MAXNUMPICS
+            INT_MAX,  // To be replaced by MaxDbpSize
+#else
             vps->getMaxNumPics( rpcSlice->getLayerId() ),
+#endif
             rpcSlice->getLayerId(), 
             sps->getMaxDecPicBuffering( sps->getSpsMaxSubLayersMinus1() ) - 1 );
@@ -2268,5 +2551,9 @@
         rps->checkMaxNumPics( 
           vps->getVpsExtensionFlag(), 
+#if H_MV_HLS10_MAXNUMPICS
+            INT_MAX,  // To be replaced by MaxDbpsize
+#else
           vps->getMaxNumPics( rpcSlice->getLayerId() ),
+#endif
           rpcSlice->getLayerId(), 
           sps->getMaxDecPicBuffering( sps->getSpsMaxSubLayersMinus1() ) - 1 );
@@ -2870,7 +3157,45 @@
   ptl->setFrameOnlyConstraintFlag(uiCode ? true : false);
   
+#if H_MV_HLS10_PTL
+  if( ptl->getProfileIdc( ) ==  4 || ptl->getProfileCompatibilityFlag( 4 )  ||
+      ptl->getProfileIdc( ) ==  5 || ptl->getProfileCompatibilityFlag( 5 )  ||
+      ptl->getProfileIdc( ) ==  6 || ptl->getProfileCompatibilityFlag( 6 )  ||
+      ptl->getProfileIdc( ) ==  7 || ptl->getProfileCompatibilityFlag( 7 ) ) 
+  {
+    READ_FLAG( uiCode, "max_12bit_constraint_flag" ); ptl->setMax12bitConstraintFlag( uiCode == 1 );
+    READ_FLAG( uiCode, "max_10bit_constraint_flag" ); ptl->setMax10bitConstraintFlag( uiCode == 1 );
+    READ_FLAG( uiCode, "max_8bit_constraint_flag" ); ptl->setMax8bitConstraintFlag( uiCode == 1 );
+    READ_FLAG( uiCode, "max_422chroma_constraint_flag" ); ptl->setMax422chromaConstraintFlag( uiCode == 1 );
+    READ_FLAG( uiCode, "max_420chroma_constraint_flag" ); ptl->setMax420chromaConstraintFlag( uiCode == 1 );
+    READ_FLAG( uiCode, "max_monochrome_constraint_flag" ); ptl->setMaxMonochromeConstraintFlag( uiCode == 1 );
+    READ_FLAG( uiCode, "intra_constraint_flag" ); ptl->setIntraConstraintFlag( uiCode == 1 );
+    READ_FLAG( uiCode, "one_picture_only_constraint_flag" ); ptl->setOnePictureOnlyConstraintFlag( uiCode == 1 );
+    READ_FLAG( uiCode, "lower_bit_rate_constraint_flag" ); ptl->setLowerBitRateConstraintFlag( uiCode == 1 );    
+    READ_CODE(16, uiCode, "XXX_reserved_zero_34bits[0..15]");
+    READ_CODE(16, uiCode, "XXX_reserved_zero_34bits[16..31]");
+    READ_CODE(2 , uiCode, "XXX_reserved_zero_34bits[32..33]");
+  }
+  else
+  {
+    READ_CODE(16, uiCode, "XXX_reserved_zero_43bits[0..15]");
+    READ_CODE(16, uiCode, "XXX_reserved_zero_43bits[16..31]");
+    READ_CODE(11, uiCode, "XXX_reserved_zero_43bits[32..42]");
+  }
+  if( ( ptl->getProfileIdc() >= 1 && ptl->getProfileIdc() <= 5 )  ||
+    ptl->getProfileCompatibilityFlag( 1 ) || ptl->getProfileCompatibilityFlag( 2 )  ||
+    ptl->getProfileCompatibilityFlag( 3 ) || ptl->getProfileCompatibilityFlag( 4 )  ||
+    ptl->getProfileCompatibilityFlag( 5 ) )
+  {
+    READ_FLAG( uiCode, "inbld_flag" ); ptl->setInbldFlag( uiCode == 1 );
+  }
+  else
+  {
+    READ_FLAG(uiCode, "reserved_zero_bit");
+  }
+#else
   READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[0..15]");
   READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[16..31]");
   READ_CODE(12, uiCode, "XXX_reserved_zero_44bits[32..43]");
+#endif
 }
 
Index: /branches/HTM-12.0-dev1/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 1054)
@@ -97,4 +97,18 @@
 #endif
 
+#if H_MV_HLS10_PPS
+#if H_MV
+  Void  parsePPSMultilayerExtension( TComPPS* pcPPS )
+  {
+    UInt uiCode = 0; 
+    READ_FLAG( uiCode, "poc_reset_info_present_flag" ); pcPPS->setPocResetInfoPresentFlag( uiCode == 1 );
+    READ_FLAG( uiCode, "pps_infer_scaling_list_flag" ); pcPPS->setPpsInferScalingListFlag( uiCode == 1 );
+    READ_CODE( 6, uiCode, "pps_scaling_list_ref_layer_id" ); pcPPS->setPpsScalingListRefLayerId( uiCode );
+    READ_UVLC( uiCode, "num_ref_loc_offsets" ); assert( uiCode == 0 ); 
+  }
+#endif
+#endif
+
+
 #if H_3D
   Void  parsePPS            ( TComPPS* pcPPS, TComVPS* pcVPS );
Index: /branches/HTM-12.0-dev1/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1054)
@@ -669,5 +669,7 @@
 #if H_MV
   sps->inferSpsMaxDecPicBufferingMinus1( vps, m_targetOptLayerSetIdx, getLayerId(), false ); 
+#if !H_MV_HLS10_ADD_LAYERSETS 
   vps->inferDbpSizeLayerSetZero( sps, false ); 
+#endif
   // When the value of vps_num_rep_formats_minus1 in the active VPS is equal to 0
   if ( vps->getVpsNumRepFormatsMinus1() == 0 )
@@ -677,8 +679,32 @@
   }
   sps->checkRpsMaxNumPics( vps, getLayerId() ); 
+#if H_MV_HLS10_MULTILAYERSPS
+
+  if( sps->getLayerId() != 0 )
+  {
+    sps->inferSpsMaxSubLayersMinus1( true, vps ); 
+  }
+
+#if H_MV_HLS10_MULTILAYERSPS
+  // It is a requirement of bitstream conformance that, when the SPS is referred to by 
+  // any current picture that belongs to an independent non-base layer, the value of 
+  // MultiLayerExtSpsFlag derived from the SPS shall be equal to 0.
+
+  if ( m_layerId > 0 && vps->getNumRefLayers( m_layerId ) == 0 )
+  {  
+    assert( sps->getMultiLayerExtSpsFlag() == 0 ); 
+  }
+#endif
+
+  if( sps->getMultiLayerExtSpsFlag() )
+  {
+    sps->setTemporalIdNestingFlag( (sps->getMaxTLayers() > 1) ? vps->getTemporalNestingFlag() : true );
+  }
+#else
   if( m_layerId > 0 )
   {
     sps->setTemporalIdNestingFlag( (sps->getMaxTLayers() > 1) ? vps->getTemporalNestingFlag() : true );
   }
+#endif
 #endif
 
@@ -710,4 +736,5 @@
   sps->inferRepFormat  ( vps , m_layerId ); 
   sps->inferScalingList( m_parameterSetManagerDecoder.getActiveSPS( sps->getSpsScalingListRefLayerId() ) ); 
+
 #endif
   pps->setSPS(sps);
@@ -1658,5 +1685,9 @@
   for (Int i = 0; i < vps->getNumDirectRefLayers( getLayerId()  ); i++ )
   {
+#if H_MV_HLS10_REF_PRED_LAYERS
+    Int refLayerId = vps->getIdDirectRefLayer( m_layerId, i ); 
+#else
     Int refLayerId = vps->getRefLayerId( m_layerId, i ); 
+#endif
     allRefLayersInitilizedFlag = allRefLayersInitilizedFlag && m_layerInitilizedFlag[ refLayerId ]; 
   }
Index: /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1054)
@@ -49,5 +49,9 @@
 {
 #if H_MV_ENC_DEC_TRAC
+#if H_MV_HLS10_GEN_FIX
+  fprintf( g_hTrace, "=========== Sequence Parameter Set LayerId: %d ===========\n", pSPS->getLayerId() );
+#else
   fprintf( g_hTrace, "=========== Sequence Parameter Set ===========\n" );
+#endif
 #else
   fprintf( g_hTrace, "=========== Sequence Parameter Set ID: %d ===========\n", pSPS->getSPSId() );
@@ -58,5 +62,9 @@
 {
 #if H_MV_ENC_DEC_TRAC
+#if H_MV_HLS10_GEN_FIX
+  fprintf( g_hTrace, "=========== Picture Parameter Set LayerId: %d ===========\n", pPPS->getLayerId() );
+#else
   fprintf( g_hTrace, "=========== Picture Parameter Set ===========\n" );
+#endif
 #else
   fprintf( g_hTrace, "=========== Picture Parameter Set ID: %d ===========\n", pPPS->getPPSId() );
@@ -241,4 +249,5 @@
     }
   }
+#if !H_MV_HLS10_PPS
 #if H_MV
   if ( pcPPS->getLayerId() > 0 )
@@ -254,4 +263,5 @@
   {  
 #endif  
+#endif
   WRITE_FLAG( pcPPS->getScalingListPresentFlag() ? 1 : 0,                          "pps_scaling_list_data_present_flag" ); 
   if( pcPPS->getScalingListPresentFlag() )
@@ -259,6 +269,8 @@
     codeScalingList( m_pcSlice->getScalingList() );
   }
+#if !H_MV_HLS10_PPS 
 #if H_MV
   }
+#endif
 #endif
 #if PPS_FIX_DEPTH
@@ -301,6 +313,10 @@
     if ( pcPPS->getPpsMultilayerExtensionFlag() )
     { 
+#if H_MV_HLS10_PPS
+      codePPSMultilayerExtension( pcPPS );
+#else
       WRITE_FLAG( pcPPS->getPocResetInfoPresentFlag( ) ? 1 : 0 , "poc_reset_info_present_flag" );
       WRITE_FLAG( 0, "pps_extension_reserved_zero_flag" );
+#endif
     }
 
@@ -675,4 +691,16 @@
 #endif
   WRITE_CODE( pcSPS->getMaxTLayers() - 1,  3,       "sps_max_sub_layers_minus1" );
+#if H_MV_HLS10_MULTILAYERSPS
+#if H_MV
+  }
+  else
+  {
+    WRITE_CODE( pcSPS->getSpsExtOrMaxSubLayersMinus1( ), 3, "sps_ext_or_max_sub_layers_minus1" );
+  }
+  if ( !pcSPS->getMultiLayerExtSpsFlag() )
+  {
+#endif
+#endif
+
   WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0,                             "sps_temporal_id_nesting_flag" );
   codePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1);
@@ -682,5 +710,9 @@
   WRITE_UVLC( pcSPS->getSPSId (),                   "sps_seq_parameter_set_id" );
 #if H_MV
+#if H_MV_HLS10_MULTILAYERSPS
+    if ( pcSPS->getMultiLayerExtSpsFlag() )
+#else 
   if ( pcSPS->getLayerId() > 0 )
+#endif
   {
     WRITE_FLAG( pcSPS->getUpdateRepFormatFlag( ) ? 1 : 0 , "update_rep_format_flag" );
@@ -703,6 +735,8 @@
   WRITE_UVLC( pcSPS->getPicWidthInLumaSamples (),   "pic_width_in_luma_samples" );
   WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(),   "pic_height_in_luma_samples" );
+#if !H_MV_HLS10_MULTILAYERSPS
 #if H_MV
   }
+#endif
 #endif
   Window conf = pcSPS->getConformanceWindow();
@@ -716,6 +750,16 @@
     WRITE_UVLC( conf.getWindowBottomOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_bottom_offset" );
   }
+#if H_MV_HLS10_MULTILAYERSPS
 #if H_MV
+}
+#endif
+#endif
+
+#if H_MV
+#if H_MV_HLS10_MULTILAYERSPS
+  if ( !pcSPS->getMultiLayerExtSpsFlag() )
+#else 
   if ( pcSPS->getLayerId() == 0 )
+#endif
   { 
 #endif
@@ -727,5 +771,9 @@
   WRITE_UVLC( pcSPS->getBitsForPOC()-4,                 "log2_max_pic_order_cnt_lsb_minus4" );
 #if H_MV
+#if H_MV_HLS10_MULTILAYERSPS
+  if ( !pcSPS->getMultiLayerExtSpsFlag()) 
+#else
   if ( pcSPS->getLayerId() == 0 ) 
+#endif
   {  
 #endif
@@ -758,5 +806,9 @@
   {
 #if H_MV
+#if H_MV_HLS10_MULTILAYERSPS
+    if ( pcSPS->getMultiLayerExtSpsFlag() )
+#else 
     if ( pcSPS->getLayerId() > 0 )
+#endif
     {    
       WRITE_FLAG( pcSPS->getSpsInferScalingListFlag( ) ? 1 : 0 , "sps_infer_scaling_list_flag" );
@@ -865,5 +917,5 @@
 {
   WRITE_FLAG( pcSPS->getInterViewMvVertConstraintFlag() ? 1 : 0, "inter_view_mv_vert_constraint_flag" );
-
+#if !H_MV_HLS10_PPS
   WRITE_UVLC( pcSPS->getNumScaledRefLayerOffsets( ), "num_scaled_ref_layer_offsets" );
 
@@ -880,4 +932,5 @@
     WRITE_FLAG( 0, "sps_multilayer_ext_reserved_zero_flag[ j ]" );
   }
+#endif
 }
 #endif
@@ -904,5 +957,9 @@
 #if H_MV
   WRITE_FLAG( pcVPS->getVpsBaseLayerInternalFlag( ) ? 1 : 0 , "vps_base_layer_internal_flag" );
+#if H_MV_HLS10_GEN_VSP_BASE_LAYER_AVAIL
+  WRITE_FLAG( pcVPS->getVpsBaseLayerAvailableFlag( ) ? 1 : 0 , "vps_base_layer_available_flag" );
+#else // H_MV_HLS10_GEN
   WRITE_FLAG( 1                                             , "vps_reserved_one_bit" );
+#endif // H_MV_HLS10_GEN
 #else
   WRITE_CODE( 3,                                    2,        "vps_reserved_three_2bits" );
@@ -930,11 +987,13 @@
     }
   }
-
   assert( pcVPS->getNumHrdParameters() <= MAX_VPS_NUM_HRD_PARAMETERS );
 #if H_MV
   assert( pcVPS->getVpsMaxLayerId() < MAX_VPS_NUH_LAYER_ID_PLUS1 );
   WRITE_CODE( pcVPS->getVpsMaxLayerId(), 6,                 "vps_max_layer_id" );  
-  
+#if H_MV_HLS10_GEN_FIX
+  WRITE_UVLC( pcVPS->getVpsNumLayerSetsMinus1(),  "vps_num_layer_sets_minus1" );
+#else
   WRITE_UVLC( pcVPS->getVpsNumLayerSetsMinus1(),  "vps_max_num_layer_sets_minus1" );
+#endif
   for( UInt opsIdx = 1; opsIdx <= pcVPS->getVpsNumLayerSetsMinus1(); opsIdx ++ )
   {
@@ -1012,5 +1071,12 @@
 #if H_MV
 Void TEncCavlc::codeVPSExtension( TComVPS *pcVPS ) 
-{  
+{ 
+#if H_MV_HLS10_PTL
+  if( pcVPS->getMaxLayersMinus1() > 0  &&  pcVPS->getVpsBaseLayerInternalFlag() )
+  {
+    codePTL( pcVPS->getPTL( 1 ),0, pcVPS->getMaxSubLayersMinus1()  );
+  }
+#endif
+
   WRITE_FLAG( pcVPS->getSplittingFlag() ? 1 : 0,             "splitting_flag" );
 
@@ -1084,4 +1150,20 @@
   }
 
+#if H_MV_HLS10_ADD_LAYERSETS
+  if ( pcVPS->getNumIndependentLayers() > 1 ) 
+  {
+    WRITE_UVLC( pcVPS->getNumAddLayerSets( ), "num_add_layer_sets" );
+  }
+  for (Int i = 0; i < pcVPS->getNumAddLayerSets(); i++)
+  {
+    for (Int j = 1; j < pcVPS->getNumIndependentLayers(); j++)
+    {
+      WRITE_CODE( pcVPS->getHighestLayerIdxPlus1( i, j ), pcVPS->getHighestLayerIdxPlus1Len( j )  , "highest_layer_idx_plus1" );
+    }
+  
+  }
+#endif
+
+
   WRITE_FLAG( pcVPS->getVpsSubLayersMaxMinus1PresentFlag( ) ? 1 : 0 , "vps_sub_layers_max_minus1_present_flag" );
   if ( pcVPS->getVpsSubLayersMaxMinus1PresentFlag() )
@@ -1119,4 +1201,13 @@
   WRITE_UVLC( pcVPS->getVpsNumProfileTierLevelMinus1( ), "vps_num_profile_tier_level_minus1" );
 
+#if H_MV_HLS10_PTL
+  Int offsetVal =  ( pcVPS->getMaxLayersMinus1() > 0  &&  pcVPS->getVpsBaseLayerInternalFlag() ) ? 2 : 1;   
+  for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 2 : 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ )
+  {
+    WRITE_FLAG( pcVPS->getVpsProfilePresentFlag( i ) ? 1 : 0, "vps_profile_present_flag[i]" );
+    codePTL( pcVPS->getPTL( offsetVal ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers() - 1 );
+    offsetVal++;
+  }
+#else 
   for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ )
   {
@@ -1124,5 +1215,7 @@
     codePTL( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers() - 1 );
   }
-
+#endif
+
+#if !H_MV_HLS10_ADD_LAYERSETS
   if ( pcVPS->getNumIndependentLayers() > 1 ) 
   {
@@ -1136,4 +1229,6 @@
     }
   }
+#endif // H_MV_HLS10_GEN
+
   if (pcVPS->getNumLayerSets() > 1)
   {
@@ -1169,10 +1264,19 @@
       }
     }        
-
-
+        
+#if H_MV_HLS10_PTL
+    for ( Int j = 0; j < pcVPS->getNumLayersInIdList( pcVPS->olsIdxToLsIdx(i)); j++ )
+    {    
+      if (pcVPS->getNecessaryLayerFlag( i, j ) && pcVPS->getVpsNumProfileTierLevelMinus1() > 0 )
+      {
+        WRITE_CODE( pcVPS->getProfileTierLevelIdx( i, j ), pcVPS->getProfileTierLevelIdxLen() ,"profile_tier_level_idx[ i ][ j ]" );   
+      }
+    }
+#else
     if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
     {      
       WRITE_CODE( pcVPS->getProfileLevelTierIdx( i ), pcVPS->getProfileLevelTierIdxLen() ,"profile_level_tier_idx[ i ]" );   
     }
+#endif
     if( pcVPS->getNumOutputLayersInOutputLayerSet( i ) == 1 && pcVPS->getNumDirectRefLayers( pcVPS->getOlsHighestOutputLayerId( i ) ) > 0 )
     {
@@ -1224,5 +1328,7 @@
   }
 
+#if !H_MV_HLS10_GEN_FIX
   WRITE_FLAG( 0, "vps_reserved_zero_flag" );
+#endif
   codeDpbSize( pcVPS ); 
 
@@ -1301,5 +1407,19 @@
         for( Int k = 0; k < vps->getNumLayersInIdList( currLsIdx ); k++ )   
         {
+#if H_MV_HLS10_DBP_SIZE
+          if ( vps->getNecessaryLayerFlag( i, k ) && ( vps->getVpsBaseLayerInternalFlag() || ( vps->getLayerSetLayerIdList(vps->olsIdxToLsIdx(i),k) != 0 ) ))
+          {
+            WRITE_UVLC( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ), "max_vps_dec_pic_buffering_minus1" );
+          }
+          else
+          {
+            if ( vps->getNecessaryLayerFlag( i, k ) && ( j == 0 ) && ( k == 0 ) ) 
+            {
+              assert( dpbSize->getMaxVpsDecPicBufferingMinus1(i ,k, j ) ==  0 );
+            }
+          }
+#else
           WRITE_UVLC( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ), "max_vps_dec_pic_buffering_minus1" );
+#endif
         }
         WRITE_UVLC( dpbSize->getMaxVpsNumReorderPics( i, j ), "max_vps_num_reorder_pics" );
@@ -1312,5 +1432,12 @@
           for( Int k = 0; k < vps->getNumLayersInIdList( vps->olsIdxToLsIdx( i ) ); k++ )   
           {
-            assert( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ) == dpbSize->getMaxVpsDecPicBufferingMinus1( i,k, j - 1 ) );
+#if H_MV_HLS10_DBP_SIZE
+            if ( vps->getNecessaryLayerFlag(i, k ) )
+            {            
+#endif
+              assert( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ) == dpbSize->getMaxVpsDecPicBufferingMinus1( i,k, j - 1 ) );
+#if H_MV_HLS10_DBP_SIZE
+            }
+#endif  
           }
           assert( dpbSize->getMaxVpsNumReorderPics      ( i, j ) ==  dpbSize->getMaxVpsNumReorderPics      ( i, j - 1 ) );
@@ -1347,4 +1474,14 @@
     pcRepFormat->inferChromaAndBitDepth(pcPrevRepFormat, true ); 
   }
+#if H_MV_HLS10_GEN_VSP_CONF_WIN
+  WRITE_FLAG( pcRepFormat->getConformanceWindowVpsFlag( ) ? 1 : 0 , "conformance_window_vps_flag" );
+  if ( pcRepFormat->getConformanceWindowVpsFlag() )
+  {    
+    WRITE_UVLC( pcRepFormat->getConfWinVpsLeftOffset( ), "conf_win_vps_left_offset" );
+    WRITE_UVLC( pcRepFormat->getConfWinVpsRightOffset( ), "conf_win_vps_right_offset" );
+    WRITE_UVLC( pcRepFormat->getConfWinVpsTopOffset( ), "conf_win_vps_top_offset" );
+    WRITE_UVLC( pcRepFormat->getConfWinVpsBottomOffset( ), "conf_win_vps_bottom_offset" );
+  }
+#endif
 }
 
@@ -1371,5 +1508,9 @@
   if( pcVPSVUI->getBitRatePresentVpsFlag( )  ||  pcVPSVUI->getPicRatePresentVpsFlag( ) )
   {
+#if H_MV_HLS10_VPS_VUI
+    for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i < pcVPS->getNumLayerSets(); i++ )
+#else
     for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i  <=  pcVPS->getVpsNumLayerSetsMinus1(); i++ )
+#endif
     {
       for( Int j = 0; j  <=  pcVPS->getMaxSubLayersInLayerSetMinus1( i ); j++ ) 
@@ -1404,5 +1545,9 @@
   else
   {
+#if H_MV_HLS10_VPS_VUI
+    assert( pcVPSVUI->getVpsNumVideoSignalInfoMinus1() == pcVPS->getMaxLayersMinus1() - ( pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1)  ); 
+#else
     pcVPSVUI->setVpsNumVideoSignalInfoMinus1( pcVPS->getMaxLayersMinus1() ); 
+#endif
   }
 
@@ -1417,5 +1562,9 @@
   if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() && pcVPSVUI->getVpsNumVideoSignalInfoMinus1() > 0 )
   {
+#if H_MV_HLS10_VPS_VUI
+    for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
+#else
     for( Int i = 1; i <=  pcVPS->getMaxLayersMinus1(); i++ )
+#endif
     {
       WRITE_CODE( pcVPSVUI->getVpsVideoSignalInfoIdx( i ), 4, "vps_video_signal_info_idx" );
@@ -1445,5 +1594,9 @@
       for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ) ; j++ )
       {  
+#if H_MV_HLS10_REF_PRED_LAYERS
+        Int layerIdx = pcVPS->getLayerIdInVps(pcVPS->getIdRefLayer(pcVPS->getLayerIdInNuh( i ) , j  ));  
+#else
         Int layerIdx = pcVPS->getLayerIdInVps(pcVPS->getRefLayerId(pcVPS->getLayerIdInNuh( i ) , j  ));  
+#endif
         if( pcVPSVUI->getTilesInUseFlag( i )  &&  pcVPSVUI->getTilesInUseFlag( layerIdx ) )  
         {
@@ -1463,5 +1616,10 @@
     }
   }
+#if H_MV_HLS10_VPS_VUI
+  WRITE_FLAG( pcVPSVUI->getSingleLayerForNonIrapFlag( ) ? 1 : 0 , "single_layer_for_non_irap_flag" );
+  WRITE_FLAG( pcVPSVUI->getHigherLayerIrapSkipFlag( ) ? 1 : 0 , "higher_layer_irap_skip_flag" );
+#else
   WRITE_CODE( 0, 3, "vps_vui_reserved_zero_3bits" );
+#endif
   WRITE_FLAG( pcVPSVUI->getIlpRestrictedRefLayersFlag( ) ? 1 : 0 , "ilp_restricted_ref_layers_flag" );
 
@@ -1472,5 +1630,9 @@
       for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ); j++ )
       {
+#if H_MV_HLS10_REF_PRED_LAYERS
+        if( pcVPS->getVpsBaseLayerInternalFlag() || pcVPS->getIdRefLayer( pcVPS->getLayerIdInNuh( i ), j ) > 0 )
+#else
         if( pcVPS->getVpsBaseLayerInternalFlag() || pcVPS->getRefLayerId( pcVPS->getLayerIdInNuh( i ), j ) > 0 )
+#endif
         {        
           WRITE_UVLC( pcVPSVUI->getMinSpatialSegmentOffsetPlus1( i, j ), "min_spatial_segment_offset_plus1" );
@@ -1514,6 +1676,52 @@
 
   assert ( vpsVuiBspHrdP );
-
   
+#if H_MV_HLS10_VPS_VUI_BSP
+  WRITE_UVLC( vpsVuiBspHrdP->getVpsNumAddHrdParams( ), "vps_num_add_hrd_params" );
+
+  for( Int i = pcVPS->getNumHrdParameters(); i < pcVPS->getNumHrdParameters() + vpsVuiBspHrdP->getVpsNumAddHrdParams(); i++ )
+  {  
+    if( i > 0 )  
+    {
+      WRITE_FLAG( vpsVuiBspHrdP->getCprmsAddPresentFlag( i ) ? 1 : 0 , "cprms_add_present_flag" );
+    }
+    WRITE_UVLC( vpsVuiBspHrdP->getNumSubLayerHrdMinus1( i ), "num_sub_layer_hrd_minus1" );
+    TComHRD* hrdParameters = vpsVuiBspHrdP->getHrdParametermeters( i ); 
+    codeHrdParameters( hrdParameters, vpsVuiBspHrdP->getCprmsAddPresentFlag( i ), vpsVuiBspHrdP->getNumSubLayerHrdMinus1( i ) );     
+  }
+
+  for( Int h = 1; h < pcVPS->getNumOutputLayerSets(); h++ )
+  {  
+    WRITE_UVLC( vpsVuiBspHrdP->getNumSignalledPartitioningSchemes( h ), "num_signalled_partitioning_schemes" );
+
+    for( Int j = 1; j < vpsVuiBspHrdP->getNumSignalledPartitioningSchemes( h ) + 1; j++ )
+    {  
+      WRITE_UVLC( vpsVuiBspHrdP->getNumPartitionsInSchemeMinus1( h, j ), "num_partitions_in_scheme_minus1" );
+      for( Int k = 0; k  <=  vpsVuiBspHrdP->getNumPartitionsInSchemeMinus1( h, j ); k++ )  
+      {
+        for( Int r = 0; r < pcVPS->getNumLayersInIdList(pcVPS->olsIdxToLsIdx( h ) )   ; r++ )  
+        {
+          WRITE_FLAG( vpsVuiBspHrdP->getLayerIncludedInPartitionFlag( h, j, k, r ) ? 1 : 0 , "layer_included_in_partition_flag" );
+        }
+      }
+    }  
+    for( Int i = 0; i < vpsVuiBspHrdP->getNumSignalledPartitioningSchemes( h ) + 1; i++ )  
+    {
+      for( Int t = 0; t  <=  pcVPS->getMaxSubLayersInLayerSetMinus1( pcVPS->olsIdxToLsIdx( h ) ); t++ )
+      {  
+        WRITE_UVLC( vpsVuiBspHrdP->getNumBspSchedulesMinus1( h, i, t ), "num_bsp_schedules_minus1" );
+        for( Int j = 0; j  <=  vpsVuiBspHrdP->getNumBspSchedulesMinus1( h, i, t ); j++ )  
+        {
+          for( Int k = 0; k  <=  vpsVuiBspHrdP->getNumPartitionsInSchemeMinus1( h, j ); k++ )
+          {  
+            WRITE_CODE( vpsVuiBspHrdP->getBspHrdIdx( h, i, t, j, k ), vpsVuiBspHrdP->getBspHrdIdxLen( pcVPS ), "bsp_hrd_idx" );
+            WRITE_UVLC( vpsVuiBspHrdP->getBspSchedIdx( h, i, t, j, k ), "bsp_sched_idx" );
+          }  
+        }
+      }  
+    }
+  }  
+
+#else // H_MV_HLS10_GEN
   WRITE_UVLC( vpsVuiBspHrdP->getVpsNumBspHrdParametersMinus1( ), "vps_num_bsp_hrd_parameters_minus1" );
   for( Int i = 0; i <= vpsVuiBspHrdP->getVpsNumBspHrdParametersMinus1( ); i++ )
@@ -1552,7 +1760,7 @@
       }
     }  
-  }  
+  }
+#endif  
 }  
-
 #endif
 
@@ -2316,8 +2524,46 @@
   WRITE_FLAG(ptl->getFrameOnlyConstraintFlag(), "general_frame_only_constraint_flag");
   
+#if H_MV_HLS10_PTL
+  if( ptl->getProfileIdc( ) ==  4 || ptl->getProfileCompatibilityFlag( 4 )  ||
+    ptl->getProfileIdc( ) ==  5 || ptl->getProfileCompatibilityFlag( 5 )  ||
+    ptl->getProfileIdc( ) ==  6 || ptl->getProfileCompatibilityFlag( 6 )  ||
+    ptl->getProfileIdc( ) ==  7 || ptl->getProfileCompatibilityFlag( 7 ) ) 
+  {
+    WRITE_FLAG( ptl->getMax12bitConstraintFlag( ) ? 1 : 0 , "max_12bit_constraint_flag" );
+    WRITE_FLAG( ptl->getMax10bitConstraintFlag( ) ? 1 : 0 , "max_10bit_constraint_flag" );
+    WRITE_FLAG( ptl->getMax8bitConstraintFlag( ) ? 1 : 0 , "max_8bit_constraint_flag" );
+    WRITE_FLAG( ptl->getMax422chromaConstraintFlag( ) ? 1 : 0 , "max_422chroma_constraint_flag" );
+    WRITE_FLAG( ptl->getMax420chromaConstraintFlag( ) ? 1 : 0 , "max_420chroma_constraint_flag" );
+    WRITE_FLAG( ptl->getMaxMonochromeConstraintFlag( ) ? 1 : 0 , "max_monochrome_constraint_flag" );
+    WRITE_FLAG( ptl->getIntraConstraintFlag( ) ? 1 : 0 , "intra_constraint_flag" );
+    WRITE_FLAG( ptl->getOnePictureOnlyConstraintFlag( ) ? 1 : 0 , "one_picture_only_constraint_flag" );
+    WRITE_FLAG( ptl->getLowerBitRateConstraintFlag( ) ? 1 : 0 , "lower_bit_rate_constraint_flag" );
+    WRITE_CODE( 0, 16, "XXX_reserved_zero_34bits[0..15]");
+    WRITE_CODE( 0, 16, "XXX_reserved_zero_34bits[16..31]");
+    WRITE_CODE( 0, 2 , "XXX_reserved_zero_34bits[32..33]");
+  }
+  else
+  {
+    WRITE_CODE( 0, 16, "XXX_reserved_zero_43bits[0..15]");
+    WRITE_CODE( 0, 16, "XXX_reserved_zero_43bits[16..31]");
+    WRITE_CODE( 0, 11, "XXX_reserved_zero_43bits[32..42]");
+  }
+  if( ( ptl->getProfileIdc() >= 1 && ptl->getProfileIdc() <= 5 )  ||
+    ptl->getProfileCompatibilityFlag( 1 ) || ptl->getProfileCompatibilityFlag( 2 )  ||
+    ptl->getProfileCompatibilityFlag( 3 ) || ptl->getProfileCompatibilityFlag( 4 )  ||
+    ptl->getProfileCompatibilityFlag( 5 ) )
+  {
+    WRITE_FLAG( ptl->getInbldFlag( ) ? 1 : 0 , "inbld_flag" );
+  }
+  else
+  {
+    WRITE_FLAG(0, "reserved_zero_bit");
+  }
+#else
   WRITE_CODE(0 , 16, "XXX_reserved_zero_44bits[0..15]");
   WRITE_CODE(0 , 16, "XXX_reserved_zero_44bits[16..31]");
   WRITE_CODE(0 , 12, "XXX_reserved_zero_44bits[32..43]");
-    }
+#endif
+}
 
 /**
Index: /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncCavlc.h	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncCavlc.h	(revision 1054)
@@ -107,4 +107,16 @@
   Void  codePPS                 ( TComPPS* pcPPS );
 
+#if H_MV_HLS10_PPS
+#if H_MV
+  Void codePPSMultilayerExtension( TComPPS* pcPPS )
+  {    
+    WRITE_FLAG( pcPPS->getPocResetInfoPresentFlag( ) ? 1 : 0 , "poc_reset_info_present_flag" );
+    WRITE_FLAG( pcPPS->getPpsInferScalingListFlag( ) ? 1 : 0 , "pps_infer_scaling_list_flag" );
+    WRITE_CODE( pcPPS->getPpsScalingListRefLayerId( ), 6, "pps_scaling_list_ref_layer_id" );
+    WRITE_UVLC( 0, "num_ref_loc_offsets" );
+  }
+#endif
+#endif
+
 #if H_3D
   Void  codePPSExtension        ( TComPPS* pcPPS );
Index: /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1054)
@@ -72,4 +72,9 @@
   ContextModel::buildNextStateTable();
 #endif
+#if H_MV_HLS10_GEN_FIX
+#if H_MV
+  m_iNumSubstreams         = 0; 
+#endif
+#endif
 
   m_pcSbacCoders           = NULL;
@@ -231,6 +236,13 @@
       for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ )
       {
+#if H_MV_HLS10_GEN_FIX
+#if H_MV
+        xDelete( false, m_pppcRDSbacCoder, iDepth, iCIIdx);
+        xDelete( false, m_pppcBinCoderCABAC, iDepth, iCIIdx);
+#else
         delete m_pppcRDSbacCoder[iDepth][iCIIdx];
         delete m_pppcBinCoderCABAC[iDepth][iCIIdx];
+#endif
+#endif
       }
     }
@@ -238,11 +250,24 @@
     for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ )
     {
+#if H_MV_HLS10_GEN_FIX
+#if H_MV
+      xDelete( true, m_pppcRDSbacCoder  , iDepth);
+      xDelete( true, m_pppcBinCoderCABAC, iDepth);
+#else
       delete [] m_pppcRDSbacCoder[iDepth];
       delete [] m_pppcBinCoderCABAC[iDepth];
-    }
-    
+#endif
+#endif
+    }
+
+#if H_MV_HLS10_GEN_FIX
+#if H_MV
+     xDelete( true, m_pppcRDSbacCoder  );
+     xDelete( true, m_pppcBinCoderCABAC);
+#else
     delete [] m_pppcRDSbacCoder;
     delete [] m_pppcBinCoderCABAC;
-
+#endif
+#endif
     for ( UInt ui = 0; ui < m_iNumSubstreams; ui++ )
     {
@@ -251,6 +276,13 @@
         for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ )
         {
+#if H_MV_HLS10_GEN_FIX
+#if H_MV
+          xDelete(false, m_ppppcRDSbacCoders  ,ui, iDepth, iCIIdx);
+          xDelete(false, m_ppppcBinCodersCABAC,ui, iDepth, iCIIdx);
+#else
           delete m_ppppcRDSbacCoders  [ui][iDepth][iCIIdx];
           delete m_ppppcBinCodersCABAC[ui][iDepth][iCIIdx];
+#endif
+#endif
         }
       }
@@ -258,10 +290,37 @@
       for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ )
       {
+#if H_MV_HLS10_GEN_FIX
+#if H_MV
+        xDelete(true, m_ppppcRDSbacCoders  ,ui, iDepth);
+        xDelete(true, m_ppppcBinCodersCABAC,ui, iDepth);        
+#else
         delete [] m_ppppcRDSbacCoders  [ui][iDepth];
         delete [] m_ppppcBinCodersCABAC[ui][iDepth];
-      }
+#endif
+#endif
+      }
+
+
+#if H_MV_HLS10_GEN_FIX
+#if H_MV
+      xDelete(true, m_ppppcRDSbacCoders,   ui);
+      xDelete(true, m_ppppcBinCodersCABAC, ui);      
+#else
       delete[] m_ppppcRDSbacCoders  [ui];
       delete[] m_ppppcBinCodersCABAC[ui];
-    }
+#endif
+#endif
+    }
+#if H_MV_HLS10_GEN_FIX
+#if H_MV
+    xDelete(true, m_ppppcRDSbacCoders    ) ;
+    xDelete(true, m_ppppcBinCodersCABAC);
+    xDelete(true, m_pcSbacCoders);
+    xDelete(true, m_pcBinCoderCABACs);
+    xDelete(true, m_pcRDGoOnSbacCoders);  
+    xDelete(true, m_pcRDGoOnBinCodersCABAC);
+    xDelete(true, m_pcBitCounters);
+    xDelete(true, m_pcRdCosts);
+#else
     delete[] m_ppppcRDSbacCoders;
     delete[] m_ppppcBinCodersCABAC;
@@ -272,5 +331,7 @@
   delete[] m_pcBitCounters;
   delete[] m_pcRdCosts;
-  
+#endif
+#endif
+
 #if !H_MV
     // destroy ROM
@@ -708,7 +769,18 @@
 #if H_MV  
   m_cSPS.setUpdateRepFormatFlag           ( false );    
+#if H_MV_HLS10_MULTILAYERSPS  
+  Bool multiLayerExtensionFlag  = ( getLayerId() > 0 ) && ( m_cVPS->getNumRefLayers( getLayerId() ) > 0 ); 
+  
+  m_cSPS.setSpsExtOrMaxSubLayersMinus1( multiLayerExtensionFlag ? 7 : m_maxTempLayer - 1 );
+  if ( multiLayerExtensionFlag )
+  {
+    m_cSPS.setSpsInferScalingListFlag   ( true ); 
+    m_cSPS.setSpsScalingListRefLayerId( m_cVPS->getIdRefLayer( getLayerId(), 0 ) ); 
+  }
+#else
   m_cSPS.setSpsInferScalingListFlag       ( m_layerId > 0 && m_cVPS->getInDirectDependencyFlag( getLayerIdInVps(), 0 ) ); 
   m_cSPS.setSpsScalingListRefLayerId      ( 0              ); 
-  m_cSPS.setSpsExtensionPresentFlag              ( true ); 
+#endif
+  m_cSPS.setSpsExtensionPresentFlag       ( true ); 
   m_cSPS.setSpsMultilayerExtensionFlag    ( true ); 
 #if H_3D
@@ -791,9 +863,17 @@
     for( Int is = 0; is < targetDecLayerIdList.size(); is++  )
     {
+#if H_MV_HLS10_ADD_LAYERSETS
+      if ( m_cVPS->getNecessaryLayerFlag( ols, is ) )
+      {      
+        m_cSPS.inferSpsMaxDecPicBufferingMinus1( m_cVPS, ols, targetDecLayerIdList[is], true );       
+      }
+#else
       m_cSPS.inferSpsMaxDecPicBufferingMinus1( m_cVPS, ols, targetDecLayerIdList[is], true );       
-    }
-  }
-
+#endif
+    }
+  }
+#if !H_MV_HLS10_ADD_LAYERSETS 
   m_cVPS->inferDbpSizeLayerSetZero( &m_cSPS, true ); 
+#endif
 #endif
   m_cSPS.setPCMBitDepthLuma (g_uiPCMBitDepthLuma);
Index: /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncTop.h
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncTop.h	(revision 1053)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncTop.h	(revision 1054)
@@ -150,5 +150,48 @@
   Void  xInitPPSforTiles  ();
   Void  xInitRPS          (Bool isFieldCoding);           ///< initialize PPS from encoder options
-
+#if H_MV_HLS10_GEN_FIX
+#if H_MV
+
+  template <class T>     Void  xDelete( Bool ar, T inArray ) 
+  {
+    if( inArray != NULL)
+    {
+      if ( ar )
+      {      
+        delete[] inArray; 
+      }
+      else
+      {
+        delete inArray;
+      }
+    }
+  }
+
+  template <class T>     Void  xDelete( Bool ar, T inArray, Int idx1 ) 
+  {
+    if( inArray != NULL)
+    {
+        xDelete( ar, inArray[idx1]); 
+    }
+  }
+
+  template <class T>     Void  xDelete( Bool ar, T inArray, Int idx1, Int idx2 ) 
+  {
+    if( inArray != NULL )
+    {
+      xDelete( ar, inArray[idx1], idx2 ); 
+    }
+  }
+
+  template <class T>     Void  xDelete( Bool ar, T inArray, Int idx1, Int idx2, Int idx3 ) 
+  {
+    if( inArray != NULL )
+    {
+      xDelete( ar, inArray[idx1], idx2, idx3 ); 
+    }
+  }
+
+#endif
+#endif
 public:
   TEncTop();
