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 1059)
+++ /branches/HTM-12.0-dev1/cfg/MV-HEVC/NonCTC/inbl_3view.cfg	(revision 1060)
@@ -8,10 +8,11 @@
 #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)
+ScalabilityMask        : 10        #  Scalability Mask             ( 2: View Scalability, shall be 2 for MV-HEVC )
+DimensionIdLen         : 4 4       #  Number of bits to store Ids,  per scalability dimension, (m)
+ViewOrderIndex         : 0 0 1 1 2 2    #  ViewOrderIndex, per layer (m)
+AuxId                  : 0 2 0 2 0 2
 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)
+ViewId                 : 1 0 2    #  ViewId, per ViewOrderIndex (m)
 #=============== vpslayersets ===============
 VpsNumLayerSets        : 2           #  Number of layer sets    
@@ -26,5 +27,5 @@
 LayerIdsInSet_8        :             #  Indices in VPS of layers in layer set 8
 
-NumAddLayerSets        : 1           #  Additional layer sets for indpendend decodable non-base layer
+NumAddLayerSets        : 1           #  Additional layer sets for independent decodable non-base layer
 HighestLayerIdxPlus1_0 : -1 3
 
Index: /branches/HTM-12.0-dev1/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/App/TAppDecoder/TAppDecTop.cpp	(revision 1059)
+++ /branches/HTM-12.0-dev1/source/App/TAppDecoder/TAppDecTop.cpp	(revision 1060)
@@ -260,4 +260,7 @@
           if (m_outputVpsInfo )
           {
+#if H_MV_HLS10_AUX
+            m_vps->printScalabilityId();
+#endif
             m_vps->printLayerDependencies();
             m_vps->printLayerSets();
Index: /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1059)
+++ /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1060)
@@ -380,5 +380,9 @@
   ("NumberOfLayers",        m_numberOfLayers     , 1,                     "Number of layers")
 #if !H_3D
+#if H_MV_HLS10_AUX
+  ("ScalabilityMask",       m_scalabilityMask    , 2                    , "Scalability Mask: 2: Multiview, 8: Auxiliary, 10: Multiview + Auxiliary")    
+#else
   ("ScalabilityMask",       m_scalabilityMask    , 2                    , "Scalability Mask")    
+#endif
 #else
   ("ScalabilityMask",       m_scalabilityMask    , 3                    , "Scalability Mask, 1: Texture 3: Texture + Depth ")    
@@ -387,4 +391,7 @@
   ("ViewOrderIndex",        m_viewOrderIndex     , std::vector<Int>(1,0), "View Order Index per layer")
   ("ViewId",                m_viewId             , std::vector<Int>(1,0), "View Id per View Order Index")
+#if H_MV_HLS10_AUX
+  ("AuxId",                 m_auxId              , std::vector<Int>(1,0), "AuxId per layer")
+#endif
 #if H_3D
   ("DepthFlag",             m_depthFlag          , std::vector<Int>(1,0), "Depth Flag")
@@ -1075,4 +1082,7 @@
   }
   m_iNumberOfViews = (Int) uniqueViewOrderIndices.size(); 
+#if H_MV_HLS10_AUX
+  xResizeVector( m_auxId );
+#endif
 
 #if H_3D
@@ -1421,5 +1431,9 @@
   xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");
 #else
+#if H_MV_HLS10_AUX
+  xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 8 && m_scalabilityMask != 10, "Scalability Mask must be equal to 2, 8 or 10");
+#else
   xConfirmPara( m_scalabilityMask != 2 , "Scalability Mask must be equal to 2. ");
+#endif
 #endif
 
@@ -1432,5 +1446,16 @@
 
   m_dimIds.push_back( m_viewOrderIndex );   
-  xConfirmPara(  m_dimensionIdLen.size() < m_dimIds.size(), "DimensionIdLen must be given for all dimensions. "   );   Int dimBitOffset[MAX_NUM_SCALABILITY_TYPES+1]; 
+#if H_MV_HLS10_AUX
+  for (Int i = 0; i < m_auxId.size(); i++)
+  {
+    xConfirmPara( !( ( m_auxId[i] >= 0 && m_auxId[i] <= 2 ) || ( m_auxId[i] >= 128 && m_auxId[i] <= 159 ) ) , "AuxId shall be in the range of 0 to 2, inclusive, or 128 to 159, inclusive");
+  }
+  if ( m_scalabilityMask & ( 1 << AUX_ID ) )
+  {
+    m_dimIds.push_back ( m_auxId );
+  }
+#endif  
+  xConfirmPara(  m_dimensionIdLen.size() < m_dimIds.size(), "DimensionIdLen must be given for all dimensions. "   );
+  Int dimBitOffset[MAX_NUM_SCALABILITY_TYPES+1]; 
 
   dimBitOffset[ 0 ] = 0; 
@@ -2483,4 +2508,7 @@
   xPrintParaVector( "ViewIdVal"     , m_viewId ); 
   xPrintParaVector( "ViewOrderIndex", m_viewOrderIndex ); 
+#if H_MV_HLS10_AUX
+  xPrintParaVector( "AuxId", m_auxId );
+#endif
 #endif
 #if H_3D
Index: /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncCfg.h	(revision 1059)
+++ /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncCfg.h	(revision 1060)
@@ -78,4 +78,7 @@
   std::vector<Int>       m_viewId;                            ///< view id
   std::vector<Int>       m_viewOrderIndex;                    ///< view order index  
+#if H_MV_HLS10_AUX
+  std::vector<Int>       m_auxId;                             ///< auxiliary id
+#endif
 #if H_3D
   std::vector<Int>       m_depthFlag;                         ///< depth flag
Index: /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1059)
+++ /branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1060)
@@ -171,4 +171,7 @@
   if ( m_outputVpsInfo )
   {  
+#if H_MV_HLS10_AUX
+    vps.printScalabilityId();
+#endif
     vps.printLayerDependencies();
     vps.printLayerSets(); 
@@ -1864,6 +1867,15 @@
         {
           vps.setProfileTierLevelIdx(olsIdx, j, m_profileTierLevelIdx[olsIdx][j] );
+#if H_MV_HLS10_PTL_FIX
+          if( !vps.getNecessaryLayerFlag(olsIdx,j) && m_profileTierLevelIdx[ olsIdx ][ j ] != -1 )
+          {
+            fprintf( stderr, "Warning: The %d-th layer in the %d-th OLS is not necessary such that profileTierLevelIdx[%d][%d] will be ignored. Set value to -1 to suppress warning.\n", j,olsIdx,olsIdx,j ); 
+          }          
+        }
+        else if ( vps.getNecessaryLayerFlag(olsIdx,j) )
+#else
         }
         else
+#endif
         {
           // setting default values
Index: /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComRom.h
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComRom.h	(revision 1059)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComRom.h	(revision 1060)
@@ -239,5 +239,5 @@
 
 #ifndef ENC_DEC_TRACE
-#define ENC_DEC_TRACE   0
+#define ENC_DEC_TRACE   1
 #endif
 
Index: /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComSlice.cpp	(revision 1059)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComSlice.cpp	(revision 1060)
@@ -1915,5 +1915,9 @@
     {
 #if H_MV_HLS10_PTL
+#if H_MV_HLS10_PTL_FIX
+      m_profileTierLevelIdx[i][j] = -1; 
+#else
       m_profileTierLevelIdx[i][j] = false; 
+#endif
 #endif
       m_outputLayerFlag[i][j] = false; 
Index: /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComSlice.h	(revision 1059)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TComSlice.h	(revision 1060)
@@ -1216,4 +1216,25 @@
   Void    setProfileTierLevelIdx( Int i, Int j, Int val )                  { m_profileTierLevelIdx[ i ][ j ] = val; }
   Int     getProfileTierLevelIdx( Int i, Int j )                           { return m_profileTierLevelIdx[ i ][ j ]; } 
+#if H_MV_HLS10_PTL
+  Int     inferProfileTierLevelIdx( Int i, Int j )
+  {
+    Bool inferZero        = ( i == 0 && j == 0 &&  getVpsBaseLayerInternalFlag() );
+    Bool inferGreaterZero = getNecessaryLayerFlag(i,j) && ( getVpsNumProfileTierLevelMinus1() == 0 ); 
+    assert( inferZero || inferGreaterZero );
+
+    Bool ptlIdx = 0; // inference for greaterZero
+    if ( inferZero )
+    {
+      ptlIdx = getMaxLayersMinus1() > 0 ? 1 : 0; 
+      if ( inferGreaterZero )
+      {
+        assert( ptlIdx == 0 );  
+        // This should never happen since :
+        // When vps_max_layers_minus1 is greater than 0, the value of vps_num_profile_tier_level_minus1 shall be greater than or equal to 1.
+      }
+    }
+    return ptlIdx;     
+  }
+#endif
 #else
   Void    setProfileLevelTierIdx( Int outLayerSetIdx, Int val )            { m_profileLevelTierIdx[ outLayerSetIdx ] = val; }
@@ -1282,4 +1303,8 @@
 
   Int     getViewIndex    ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), VIEW_ORDER_INDEX  ); }    
+#if H_MV_HLS10_AUX
+  Int     getAuxId        ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), AUX_ID  ); }    
+  Int     getDependencyId ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), DEPENDENCY_ID  ); }    
+#endif
   Int     getNumViews();
 
@@ -1460,8 +1485,28 @@
     vector<Int> fullArray;
     vector<Int> range; 
+
+#if H_3D
+    vector<Int> depthId; 
+#endif
+
+#if H_MV_HLS10_AUX
+    vector<Int> viewOrderIndex;
+    vector<Int> auxId;
+    vector<Int> dependencyId; 
+    vector<Int> viewId; 
+#endif
     for (Int i = 0; i <= getMaxLayersMinus1(); i++ )
     {
       fullArray.push_back( getMaxLayersMinus1() + 1 ); 
       range.push_back( i ); 
+#if H_MV_HLS10_AUX      
+      viewOrderIndex.push_back( getViewIndex   ( i ) );
+      dependencyId  .push_back( getDependencyId( i ) );
+      auxId         .push_back( getAuxId       ( i ) );      
+      viewId        .push_back( getViewId      ( getLayerIdInNuh( i ) ) );
+#if H_3D  
+      depthId.push_back( getDepthId( i ) );
+#endif
+#endif
     }
     std::cout << std::right << std::setw(60) << std::setfill('-') << " " << std::setfill(' ') << std::endl << "Layer Dependencies" << std::endl; 
@@ -1475,4 +1520,46 @@
 
   };
+
+#if H_MV_HLS10_AUX
+  Void    printScalabilityId() 
+  {    
+    vector<Int> layerIdxInVps; 
+
+#if H_3D
+    vector<Int> depthId; 
+#endif
+
+    vector<Int> viewOrderIndex;
+    vector<Int> auxId;
+    vector<Int> dependencyId; 
+    vector<Int> viewId; 
+
+    for (Int i = 0; i <= getMaxLayersMinus1(); i++ )
+    {
+      Int layerIdInNuh = getLayerIdInNuh( i );
+      layerIdxInVps  .push_back( i ); 
+      viewOrderIndex.push_back( getViewIndex   ( layerIdInNuh ) );
+      dependencyId  .push_back( getDependencyId( layerIdInNuh ) );
+      auxId         .push_back( getAuxId       ( layerIdInNuh ) );      
+      viewId        .push_back( getViewId      ( layerIdInNuh ) );
+#if H_3D  
+      depthId       .push_back( getDepthId     ( layerIdInNuh ) );
+#endif
+    }
+
+    std::cout << std::right << std::setw(60) << std::setfill('-') << " " << std::setfill(' ') << std::endl << "Scalability Ids" << std::endl; 
+    xPrintArray( "layerIdxInVps"  , getMaxLayersMinus1()+1, layerIdxInVps,          false );
+    xPrintArray( "layer_id_in_nuh", getMaxLayersMinus1()+1, m_layerIdInNuh, false );     
+    
+    xPrintArray( "ViewOrderIndex", getMaxLayersMinus1()+1, viewOrderIndex, false );     
+    xPrintArray( "DependencyId"  , getMaxLayersMinus1()+1, dependencyId  , false );     
+    xPrintArray( "AuxId"         , getMaxLayersMinus1()+1, auxId         , false );     
+    xPrintArray( "ViewId"        , getMaxLayersMinus1()+1, viewId        , false );     
+
+    std::cout << std::endl; 
+  };
+#endif
+
+
 
   Void    printLayerSets() 
Index: /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TypeDef.h	(revision 1059)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibCommon/TypeDef.h	(revision 1060)
@@ -403,4 +403,5 @@
 #define H_MV_HLS10_GEN                       0  // General changes (not tested)
 
+#define H_MV_HLS10_AUX                       1 // Auxiliary pictures
 #define H_MV_HLS10_GEN_FIX                   1
 
@@ -413,4 +414,5 @@
 #define H_MV_HLS10_MAXNUMPICS                1  // constraint on number of pictures in rps  
 #define H_MV_HLS10_PTL                       1  // profile tier level
+#define H_MV_HLS10_PTL_FIX                   1  // profile tier level
 #define H_MV_HLS10_MULTILAYERSPS             1  // multilayer SPS extension 
 #define H_MV_HLS10_VPS_VUI                   1  // vsp vui
@@ -1062,4 +1064,8 @@
 #endif    
     VIEW_ORDER_INDEX  = 1,
+#if H_MV_HLS10_AUX
+    DEPENDENCY_ID = 2,
+    AUX_ID = 3,
+#endif    
   };
 #endif
Index: /branches/HTM-12.0-dev1/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1059)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1060)
@@ -1457,4 +1457,10 @@
   pcVPS->deriveTargetLayerIdList( 0 ); 
 
+#if H_MV_HLS10_PTL_FIX
+  if (pcVPS->getVpsBaseLayerInternalFlag() )
+  {  
+    pcVPS->setProfileTierLevelIdx(0,0, pcVPS->inferProfileTierLevelIdx(0,0) );
+  }
+#endif
   for( Int i = 1; i < pcVPS->getNumOutputLayerSets( ); i++ )
   {
@@ -1494,4 +1500,10 @@
         READ_CODE( pcVPS->getProfileTierLevelIdxLen(), uiCode,"profile_tier_level_idx[ i ][ j ]" );   pcVPS->setProfileTierLevelIdx( i, j, uiCode ); 
       }
+#if H_MV_HLS10_PTL_FIX
+      if (pcVPS->getNecessaryLayerFlag( i, j ) && pcVPS->getVpsNumProfileTierLevelMinus1() == 0 )
+      {
+        pcVPS->setProfileTierLevelIdx( i , j, pcVPS->inferProfileTierLevelIdx( i, j) );
+      }
+#endif
     }
 #else
Index: /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1059)
+++ /branches/HTM-12.0-dev1/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1060)
@@ -1241,4 +1241,10 @@
 
 
+#if H_MV_HLS10_PTL_FIX
+  if (pcVPS->getVpsBaseLayerInternalFlag() )
+  {  
+    assert( pcVPS->getProfileTierLevelIdx(0,0) == pcVPS->inferProfileTierLevelIdx(0,0) );
+  }
+#endif
 
 
@@ -1276,4 +1282,11 @@
         WRITE_CODE( pcVPS->getProfileTierLevelIdx( i, j ), pcVPS->getProfileTierLevelIdxLen() ,"profile_tier_level_idx[ i ][ j ]" );   
       }
+#if H_MV_HLS10_PTL_FIX
+      if (pcVPS->getNecessaryLayerFlag( i, j ) && pcVPS->getVpsNumProfileTierLevelMinus1() == 0 )
+      {
+        assert( pcVPS->getProfileTierLevelIdx( i , j ) == pcVPS->inferProfileTierLevelIdx( i, j ) );
+      }
+#endif
+
     }
 #else
