Index: branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1216)
+++ branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1219)
@@ -557,5 +557,5 @@
   Pel deltaDC1 = pcCU->getDmmDeltaDC( dmmType, 0, uiAbsPartIdx );
   Pel deltaDC2 = pcCU->getDmmDeltaDC( dmmType, 1, uiAbsPartIdx );
-#if H_3D_DIM_DLT
+#if NH_3D_DLT
   segDC1 = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ) + deltaDC1 );
   segDC2 = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ) + deltaDC2 );
Index: branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComRom.h
===================================================================
--- branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComRom.h	(revision 1216)
+++ branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComRom.h	(revision 1219)
@@ -111,7 +111,4 @@
 __inline Void mapDmmToIntraDir( UInt& intraMode ) { if( isDmmMode( intraMode ) ) intraMode = DC_IDX; }
 __inline Void mapDmmToIntraDir(  Int& intraMode ) { if( isDmmMode( intraMode ) ) intraMode = DC_IDX; }
-#endif
-#if H_3D_DIM_SDC || H_3D_DIM_DLT
-__inline UInt numBitsForValue( UInt value ) { UInt bits = 0; while (value != 0) { value >>= 1; bits++; } return bits; };
 #endif
 // ====================================================================================================================
Index: branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComSlice.cpp	(revision 1216)
+++ branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComSlice.cpp	(revision 1219)
@@ -2827,7 +2827,4 @@
 , m_ppsScalingListRefLayerId         (0)
 , m_pocResetInfoPresentFlag          (false)
-#if H_3D
-, m_pcDLT(NULL)
-#endif
 #endif
 
@@ -2846,5 +2843,5 @@
 }
 
-#if H_3D
+#if NH_3D_DLT
 TComDLT::TComDLT()
 : m_bDltPresentFlag(false)
@@ -2852,6 +2849,4 @@
 , m_uiDepthViewBitDepth(8)
 {
-  m_uiDepthViewBitDepth = g_bitDepthY; 
-
   for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
   {
@@ -2861,6 +2856,6 @@
     // allocate some memory and initialize with default mapping
     m_iNumDepthmapValues[i] = ((1 << m_uiDepthViewBitDepth)-1)+1;
-    m_iDepthValue2Idx[i]    = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]);
-    m_iIdx2DepthValue[i]    = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]);
+    m_iDepthValue2Idx[i]    = std::vector<Int>(m_iNumDepthmapValues[i]);
+    m_iIdx2DepthValue[i]    = std::vector<Int>(m_iNumDepthmapValues[i]);
 
     //default mapping
@@ -2875,29 +2870,16 @@
 TComDLT::~TComDLT()
 {
-  for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
-  {
-    if ( m_iDepthValue2Idx[i] != NULL ) 
-    {
-      xFree( m_iDepthValue2Idx[i] );
-      m_iDepthValue2Idx[i] = NULL; 
-    }
-
-    if ( m_iIdx2DepthValue[i] != NULL ) 
-    {
-      xFree( m_iIdx2DepthValue[i] );
-      m_iIdx2DepthValue[i] = NULL; 
-    }
-  }
-}
-
-Void TComDLT::setDepthLUTs(Int layerIdInVps, Int* idxToDepthValueTable, Int iNumDepthValues)
-{
-  if( idxToDepthValueTable == NULL || iNumDepthValues == 0 ) // default mapping only
+  
+}
+
+Void TComDLT::setDepthLUTs(Int layerIdInVps, std::vector<Int> idxToDepthValueTable, Int iNumDepthValues)
+{
+  if( iNumDepthValues == 0 ) // default mapping only
     return;
 
   // copy idx2DepthValue to internal array
-  memcpy(m_iIdx2DepthValue[layerIdInVps], idxToDepthValueTable, iNumDepthValues*sizeof(UInt));
-
-  UInt uiMaxDepthValue = ((1 << g_bitDepthY)-1);
+  m_iIdx2DepthValue[layerIdInVps] = idxToDepthValueTable;
+
+  UInt uiMaxDepthValue = ((1 << m_uiDepthViewBitDepth)-1);
   for(Int p=0; p<=uiMaxDepthValue; p++)
   {
@@ -2936,5 +2918,5 @@
 }
 
-Void TComDLT::getDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTOut, UInt *puiDeltaDLTOutNum )
+Void TComDLT::getDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int>& riDeltaDLTOut, UInt&ruiDeltaDLTOutNum ) const
 {
   Bool abBM0[ 256 ];
@@ -2955,16 +2937,15 @@
   }
   
-  *puiDeltaDLTOutNum = 0;
+  ruiDeltaDLTOutNum = 0;
   for( Int i = 0; i < 256; i++ )
   {
     if( abBM0[ i ] ^ abBM1[ i ] )
     {
-      piDeltaDLTOut[ *puiDeltaDLTOutNum ] = i;
-      *puiDeltaDLTOutNum = *puiDeltaDLTOutNum + 1;
-    }
-  }
-}
-
-Void TComDLT::setDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTIn, UInt uiDeltaDLTInNum )
+      riDeltaDLTOut[ ruiDeltaDLTOutNum++ ] = i;
+    }
+  }
+}
+
+Void TComDLT::setDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int> piDeltaDLTIn, UInt uiDeltaDLTInNum )
 {
   Bool abBM0[ 256 ];
@@ -2985,7 +2966,7 @@
   }
   
-  Int aiIdx2DepthValue[256];
+  std::vector<Int> aiIdx2DepthValue(256, 0);
   UInt uiNumDepthValues = 0;
-  memset( aiIdx2DepthValue, 0, sizeof( aiIdx2DepthValue ));
+  std::fill(aiIdx2DepthValue.begin(), aiIdx2DepthValue.end(), 0);
   
   for( Int i = 0; i < 256; i++ )
Index: branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComSlice.h	(revision 1216)
+++ branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComSlice.h	(revision 1219)
@@ -1357,45 +1357,57 @@
 };
 
-#if H_3D
+#if NH_3D_DLT
 class TComDLT
 {
 private:
-  Bool        m_bDltPresentFlag;
-  Bool        m_bUseDLTFlag              [ MAX_NUM_LAYERS ];
-  Bool        m_bInterViewDltPredEnableFlag[ MAX_NUM_LAYERS ];
-
-  Int         m_iNumDepthmapValues       [ MAX_NUM_LAYERS ];
-  Int*        m_iDepthValue2Idx          [ MAX_NUM_LAYERS ];
-  Int*        m_iIdx2DepthValue          [ MAX_NUM_LAYERS ];
-
-  Int         m_iNumDepthViews;
-  UInt        m_uiDepthViewBitDepth;
+  Bool              m_bDltPresentFlag;
+  Bool              m_bUseDLTFlag                 [ MAX_NUM_LAYERS ];
+  Bool              m_bInterViewDltPredEnableFlag [ MAX_NUM_LAYERS ];
+  Bool              m_bDltBitMapRepFlag           [ MAX_NUM_LAYERS ];
+
+  Int               m_iNumDepthmapValues          [ MAX_NUM_LAYERS ];
+  std::vector<Int>  m_iDepthValue2Idx [ MAX_NUM_LAYERS ];
+  std::vector<Int>  m_iIdx2DepthValue [ MAX_NUM_LAYERS ];
+
+  Int               m_iNumDepthViews;
+  UInt              m_uiDepthViewBitDepth;
+  
+  // mapping
+  Int     m_iDepthIdxToLayerId          [ MAX_NUM_LAYERS ];
+  
+  // these are only needed at the encoder to decide on coding
 
 public:
   TComDLT();
-  ~TComDLT(); 
-
-  Bool    getDltPresentFlag  ()                           { return m_bDltPresentFlag; }
+  ~TComDLT();
+  
+  Int     getDepthIdxToLayerId(Int depthIdx) const        { return m_iDepthIdxToLayerId[depthIdx]; }
+  Void    setDepthIdxToLayerId(Int depthIdx, Int layerId) { m_iDepthIdxToLayerId[depthIdx] = layerId; }
+
+  Bool    getDltPresentFlag  ()                           const   { return m_bDltPresentFlag; }
   Void    setDltPresentFlag  ( Bool b )                   { m_bDltPresentFlag = b;    }
 
-  Bool    getUseDLTFlag      ( Int layerIdInVps )         { return m_bUseDLTFlag[ layerIdInVps ]; }
+  Bool    getUseDLTFlag      ( Int layerIdInVps )         const   { return m_bUseDLTFlag[ layerIdInVps ]; }
   Void    setUseDLTFlag      ( Int layerIdInVps, Bool b ) { m_bUseDLTFlag[ layerIdInVps ]  = b;   }
   
-  Bool    getInterViewDltPredEnableFlag( Int layerIdInVps )         { return m_bInterViewDltPredEnableFlag[ layerIdInVps ]; }
+  Bool    getInterViewDltPredEnableFlag( Int layerIdInVps )         const   { return m_bInterViewDltPredEnableFlag[ layerIdInVps ]; }
   Void    setInterViewDltPredEnableFlag( Int layerIdInVps, Bool b ) { m_bInterViewDltPredEnableFlag[ layerIdInVps ] = b;    }
+  
+  Bool    getUseBitmapRep      ( Int layerIdInVps )         const   { return m_bDltBitMapRepFlag[ layerIdInVps ]; }
+  Void    setUseBitmapRep      ( Int layerIdInVps, Bool b ) { m_bDltBitMapRepFlag[ layerIdInVps ]  = b;   }
 
   Void    setNumDepthViews   ( Int n )                    { m_iNumDepthViews = n; }
-  Int     getNumDepthViews   ()                           { return m_iNumDepthViews; }
+  Int     getNumDepthViews   ()                           const   { return m_iNumDepthViews; }
 
   Void    setDepthViewBitDepth( UInt n )                  { m_uiDepthViewBitDepth = n; }
-  UInt    getDepthViewBitDepth()                          { return m_uiDepthViewBitDepth; }
-
-  Int     getNumDepthValues( Int layerIdInVps )           { return getUseDLTFlag(layerIdInVps)?m_iNumDepthmapValues[layerIdInVps]:((1 << g_bitDepthY)-1); }
-  Int     depthValue2idx( Int layerIdInVps, Pel value )   { return getUseDLTFlag(layerIdInVps)?m_iDepthValue2Idx[layerIdInVps][value]:value; }
-  Pel     idx2DepthValue( Int layerIdInVps, UInt uiIdx )  { return getUseDLTFlag(layerIdInVps)?m_iIdx2DepthValue[layerIdInVps][ClipY(uiIdx)]:uiIdx; }
-  Void    setDepthLUTs( Int layerIdInVps, Int* idx2DepthValue = NULL, Int iNumDepthValues = 0 );
-  Int*    idx2DepthValue( Int layerIdInVps )  { return m_iIdx2DepthValue[layerIdInVps]; }
-  Void    getDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTOut, UInt *puiDeltaDLTOutNum );
-  Void    setDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTIn, UInt uiDeltaDLTInNum );
+  UInt    getDepthViewBitDepth()                          const   { return m_uiDepthViewBitDepth; }
+
+  Int     getNumDepthValues( Int layerIdInVps )           const   { return getUseDLTFlag(layerIdInVps)?m_iNumDepthmapValues[layerIdInVps]:(1 << m_uiDepthViewBitDepth); }
+  Int     depthValue2idx( Int layerIdInVps, Pel value )   const   { return getUseDLTFlag(layerIdInVps)?m_iDepthValue2Idx[layerIdInVps][value]:value; }
+  Pel     idx2DepthValue( Int layerIdInVps, UInt uiIdx )  const   { return getUseDLTFlag(layerIdInVps)?m_iIdx2DepthValue[layerIdInVps][ClipBD(uiIdx,m_uiDepthViewBitDepth)]:uiIdx; }
+  Void    setDepthLUTs( Int layerIdInVps, std::vector<Int> idx2DepthValue, Int iNumDepthValues = 0 );
+  std::vector<Int>    idx2DepthValue( Int layerIdInVps )  const   { return m_iIdx2DepthValue[layerIdInVps]; }
+  Void    getDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int>& riDeltaDLTOut, UInt& ruiDeltaDLTOutNum ) const;
+  Void    setDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int> piDeltaDLTIn, UInt uiDeltaDLTInNum );
 };
 #endif
@@ -2256,6 +2268,6 @@
 #endif
 
-#if H_3D
-  TComDLT*         m_pcDLT; 
+#if NH_3D_DLT
+  TComDLT                m_cDLT;
 #endif
 
@@ -2281,7 +2293,8 @@
   UInt                   getMaxCuDQPDepth() const                                         { return m_uiMaxCuDQPDepth;                     }
 
-#if H_3D
-  Void                   setDLT( TComDLT* pcDLT )                                         { m_pcDLT = pcDLT;                             }
-  TComDLT*               getDLT()                                                         { return m_pcDLT;                              }
+#if NH_3D_DLT
+  Void                   setDLT( TComDLT cDLT )                                           { m_cDLT = cDLT;                                }
+  const TComDLT*         getDLT() const                                                   { return &m_cDLT;                               }
+  TComDLT*               getDLT()                                                         { return &m_cDLT;                               }
 #endif
 
Index: branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TypeDef.h	(revision 1216)
+++ branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TypeDef.h	(revision 1219)
@@ -71,4 +71,5 @@
 #define NH_3D_DMM                         1   // Depth modeling modes
 #define NH_3D_SDC                         1   // Segment-wise DC coding for intra and inter
+#define NH_3D_DLT                         1   // Depth Lookup Table
 #define NH_3D_ENC_DEPTH                   1   // Encoder optimizations for depth, incl.
                                               // HHI_DEPTH_INTRA_SEARCH_RAU_C0160
Index: branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1216)
+++ branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1219)
@@ -496,8 +496,8 @@
 Void TDecCavlc::parsePps3dExtension( TComPPS* pcPPS )
 {
-#if H_3D
+#if NH_3D_DLT
   UInt uiCode = 0; 
   //
-  TComDLT* pcDLT = new TComDLT;
+  TComDLT* pcDLT = pcPPS->getDLT();
   //Ed.(GT): PPSs are copied in HM16.4. This would cause that the only the DLT pointer is copied. Therefore, a deep copy of the DLT needs to be implemented. Another option would be to use a vectors for the DLT arrays in TComDLT.
 
@@ -508,135 +508,137 @@
   {
     READ_CODE(6, uiCode, "pps_depth_layers_minus1");
-    pcDLT->setNumDepthViews( uiCode );
-
+    pcDLT->setNumDepthViews( uiCode+1 );
+    
     READ_CODE(4, uiCode, "pps_bit_depth_for_depth_views_minus8");
     pcDLT->setDepthViewBitDepth( (uiCode+8) );
-
-    //Ed.(GT): Please remove parsing dependency from VPS here !
-    for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ )
-    {
-      if ( i != 0 )
-      {
-        if( pcVPS->getDepthId( i ) == 1 ) 
-        {
-          READ_FLAG(uiCode, "dlt_flag[i]");
-          pcDLT->setUseDLTFlag(i, (uiCode == 1) ? true : false);
-
-          if ( pcDLT->getUseDLTFlag( i ) )
+    
+    for( Int i = 0; i <= pcDLT->getNumDepthViews(); i++ )
+    {
+      Int layerId = pcDLT->getDepthIdxToLayerId(i);
+      
+      READ_FLAG(uiCode, "dlt_flag[i]");
+      pcDLT->setUseDLTFlag(layerId, (uiCode == 1) ? true : false);
+      
+      if ( pcDLT->getUseDLTFlag( layerId ) )
+      {
+        Bool bDltBitMapRepFlag    = false;
+        UInt uiMaxDiff            = INT_MAX;
+        UInt uiMinDiff            = 0;
+        UInt uiCodeLength         = 0;
+        
+        READ_FLAG(uiCode, "inter_view_dlt_pred_enable_flag[ i ]");
+        
+        if( uiCode )
+        {
+          assert( pcDLT->getUseDLTFlag( 1 ));
+        }
+        pcDLT->setInterViewDltPredEnableFlag( layerId, (uiCode == 1) ? true : false );
+        
+        if ( pcDLT->getInterViewDltPredEnableFlag( layerId ) == false )
+        {
+          READ_FLAG(uiCode, "dlt_bit_map_rep_flag[ layerId ]");
+          bDltBitMapRepFlag = (uiCode == 1) ? true : false;
+        }
+        else
+        {
+          bDltBitMapRepFlag = false;
+        }
+        
+        UInt uiNumDepthValues = 0;
+        std::vector<Int> aiIdx2DepthValue(256);
+        
+        // Bit map
+        if ( bDltBitMapRepFlag )
+        {
+          for (UInt d=0; d<256; d++)
           {
-            Bool bDltBitMapRepFlag    = false;
-            UInt uiMaxDiff            = 0xffffffff;
-            UInt uiMinDiff            = 0;
-            UInt uiCodeLength         = 0;
-
-            READ_FLAG(uiCode, "inter_view_dlt_pred_enable_flag[ i ]"); 
-
-            if( uiCode )
+            READ_FLAG(uiCode, "dlt_bit_map_flag[ layerId ][ j ]");
+            if (uiCode == 1)
             {
-                assert( pcDLT->getUseDLTFlag( 1 ));
+              aiIdx2DepthValue[uiNumDepthValues] = d;
+              uiNumDepthValues++;
             }
-            pcDLT->setInterViewDltPredEnableFlag( i, (uiCode == 1) ? true : false );
-
-            if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )
+          }
+        }
+        // Diff Coding
+        else
+        {
+          READ_CODE(8, uiNumDepthValues, "num_depth_values_in_dlt[i]");   // num_entry
+          
+          {
+            // The condition if( pcVPS->getNumDepthValues(i) > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component.
+            
+            if (uiNumDepthValues > 1)
             {
-              READ_FLAG(uiCode, "dlt_bit_map_rep_flag[ layerId ]");
-              bDltBitMapRepFlag = (uiCode == 1) ? true : false; 
+              READ_CODE(8, uiCode, "max_diff[ layerId ]");
+              uiMaxDiff = uiCode;
             }
             else
             {
-              bDltBitMapRepFlag = false;
+              uiMaxDiff = 0;           // when there is only one value in DLT
             }
             
-            UInt uiNumDepthValues = 0;
-            Int  aiIdx2DepthValue[256];
-
-            // Bit map
-            if ( bDltBitMapRepFlag )
+            if (uiNumDepthValues > 2)
             {
-              for (UInt d=0; d<256; d++)
+              uiCodeLength = (UInt) gCeilLog2(uiMaxDiff + 1);
+              READ_CODE(uiCodeLength, uiCode, "min_diff_minus1[ layerId ]");
+              uiMinDiff = uiCode + 1;
+            }
+            else
+            {
+              uiMinDiff = uiMaxDiff;   // when there are only one or two values in DLT
+            }
+            
+            READ_CODE(8, uiCode, "dlt_depth_value0[layerId]");   // entry0
+            aiIdx2DepthValue[0] = uiCode;
+            
+            if (uiMaxDiff == uiMinDiff)
+            {
+              for (UInt d=1; d<uiNumDepthValues; d++)
               {
-                READ_FLAG(uiCode, "dlt_bit_map_flag[ layerId ][ j ]");
-                if (uiCode == 1)
-                {
-                  aiIdx2DepthValue[uiNumDepthValues] = d;
-                  uiNumDepthValues++;
-                }
+                aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + 0;
               }
             }
-            // Diff Coding
             else
             {
-              READ_CODE(8, uiNumDepthValues, "num_depth_values_in_dlt[i]");   // num_entry
-
+              uiCodeLength = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1);
+              for (UInt d=1; d<uiNumDepthValues; d++)
               {
-                // The condition if( pcVPS->getNumDepthValues(i) > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component. 
-
-                if (uiNumDepthValues > 1)
-                {
-                  READ_CODE(8, uiCode, "max_diff[ layerId ]"); 
-                  uiMaxDiff = uiCode;
-                }
-                else
-                {
-                  uiMaxDiff = 0;           // when there is only one value in DLT
-                }
-
-                if (uiNumDepthValues > 2)
-                {
-                  uiCodeLength = (UInt) ceil(Log2(uiMaxDiff + 1));
-                  READ_CODE(uiCodeLength, uiCode, "min_diff_minus1[ layerId ]");
-                  uiMinDiff = uiCode + 1;
-                }
-                else
-                {
-                  uiMinDiff = uiMaxDiff;   // when there are only one or two values in DLT
-                }
-
-                READ_CODE(8, uiCode, "dlt_depth_value0[layerId]");   // entry0
-                aiIdx2DepthValue[0] = uiCode;
-
-                if (uiMaxDiff == uiMinDiff)
-                {
-                  for (UInt d=1; d<uiNumDepthValues; d++)
-                  {
-                    aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + 0;
-                  }
-                }
-                else
-                {
-                  uiCodeLength = (UInt) ceil(Log2(uiMaxDiff - uiMinDiff + 1));
-                  for (UInt d=1; d<uiNumDepthValues; d++)
-                  {
-                    READ_CODE(uiCodeLength, uiCode, "dlt_depth_value_diff_minus_min[ layerId ][ j ]");
-                    aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + uiCode;
-                  }
-                }
-
+                READ_CODE(uiCodeLength, uiCode, "dlt_depth_value_diff_minus_min[ layerId ][ j ]");
+                aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + uiCode;
               }
             }
             
-            if( pcDLT->getInterViewDltPredEnableFlag( i ) )
-            {
-              // interpret decoded values as delta DLT
-              AOF( pcVPS->getDepthId( 1 ) == 1 );
-              AOF( i > 1 );
-              // assumes ref layer id to be 1
-              Int* piRefDLT = pcDLT->idx2DepthValue( 1 );
-              UInt uiRefNum = pcDLT->getNumDepthValues( 1 );
-              pcDLT->setDeltaDLT(i, piRefDLT, uiRefNum, aiIdx2DepthValue, uiNumDepthValues);
-            }
-            else
-            {
-              // store final DLT
-              pcDLT->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);
-            }
-
           }
         }
-      }
-    }
-  }
-
-  pcPPS->setDLT( pcDLT );
+        
+        if( pcDLT->getInterViewDltPredEnableFlag( layerId ) )
+        {
+          // interpret decoded values as delta DLT
+          AOF( layerId > 1 );
+          // assumes ref layer id to be 1
+          std::vector<Int> viRefDLT = pcDLT->idx2DepthValue( 1 );
+          UInt uiRefNum = pcDLT->getNumDepthValues( 1 );
+          pcDLT->setDeltaDLT(layerId, viRefDLT, uiRefNum, aiIdx2DepthValue, uiNumDepthValues);
+        }
+        else
+        {
+          // store final DLT
+          pcDLT->setDepthLUTs(layerId, aiIdx2DepthValue, uiNumDepthValues);
+        }
+        
+#ifdef DEBUG
+        printf("---------------------------------------------\n");
+        printf("LayerId: %d\n", layerId);
+        printf("getUseDLTFlag: %d\n", pcDLT->getUseDLTFlag(layerId));
+        printf("getInterViewDltPredEnableFlag: %d\n", pcDLT->getInterViewDltPredEnableFlag(layerId));
+        printf("getUseBitmapRep: %d\n", pcDLT->getUseBitmapRep(layerId));
+        printf("getNumDepthValues: %d\n", pcDLT->getNumDepthValues(layerId));
+        for(Int i=0; i<pcDLT->getNumDepthValues(layerId); i++)
+          printf("depthValue[%d] = %d\n", i, pcDLT->idx2DepthValue(layerId, i));
+#endif
+      }
+    }
+  }
 #endif
 }
Index: branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1216)
+++ branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1219)
@@ -1461,5 +1461,5 @@
   for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
   {
-#if H_3D_DIM_DLT
+#if NH_3D_DLT
     Pel   pPredIdx    = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
     Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
Index: branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1216)
+++ branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1219)
@@ -1323,4 +1323,14 @@
   // GT: Please don't add parsing dependency of SPS from VPS here again!!!
 #endif
+#if NH_3D_DLT
+  // create mapping from depth layer indexes to layer ids
+  Int j=0;
+  for( Int i=0; i<=m_parameterSetManager.getFirstVPS()->getMaxLayersMinus1(); i++ )
+  {
+    Int layerId = m_parameterSetManager.getFirstVPS()->getLayerIdInNuh(i);
+    if( m_parameterSetManager.getFirstVPS()->getDepthId(layerId) )
+      pps->getDLT()->setDepthIdxToLayerId(j++, i);
+  }
+#endif
   m_cEntropyDecoder.decodePPS( pps );
 
Index: branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1216)
+++ branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1219)
@@ -384,162 +384,118 @@
   // GT: Please add a function e.g. xSetDLT in e.g. TEncSlice to find the best DLT syntax representation and do ONLY the coding of the DLT here !!
 
-#if H_3D
-  WRITE_FLAG( pcDLT->getDltPresentFlag() ? 1 : 0, "dlt_present_flag" );
-
-  if ( pcDLT->getDltPresentFlag() )
-  {
-    WRITE_CODE(pcDLT->getNumDepthViews(), 6, "pps_depth_layers_minus1");
-    WRITE_CODE((pcDLT->getDepthViewBitDepth() - 8), 4, "pps_bit_depth_for_depth_views_minus8");
-
-    for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ )
-    {
-      if ( i != 0 )
-      {
-        if ( pcVPS->getDepthId( i ) == 1 )
-        {
-          WRITE_FLAG( pcDLT->getUseDLTFlag( i ) ? 1 : 0, "dlt_flag[i]" );
-
-          if ( pcDLT->getUseDLTFlag( i ) )
+#if NH_3D_DLT
+  WRITE_FLAG( pcPPS->getDLT()->getDltPresentFlag() ? 1 : 0, "dlt_present_flag" );
+
+  if ( pcPPS->getDLT()->getDltPresentFlag() )
+  {
+    WRITE_CODE(pcPPS->getDLT()->getNumDepthViews() - 1, 6, "pps_depth_layers_minus1");
+    WRITE_CODE((pcPPS->getDLT()->getDepthViewBitDepth() - 8), 4, "pps_bit_depth_for_depth_views_minus8");
+    
+    for( Int i = 0; i <= pcPPS->getDLT()->getNumDepthViews(); i++ )
+    {
+      Int layerId = pcPPS->getDLT()->getDepthIdxToLayerId(i);
+      
+      WRITE_FLAG( pcPPS->getDLT()->getUseDLTFlag( layerId ) ? 1 : 0, "dlt_flag[layerId]" );
+      
+      if ( pcPPS->getDLT()->getUseDLTFlag( layerId ) )
+      {
+        std::vector<Int> aiIdx2DepthValue_coded(256, 0);
+        UInt uiNumDepthValues_coded = pcPPS->getDLT()->getNumDepthValues(layerId);
+        
+        // ----------------------------- Actual coding -----------------------------
+        WRITE_FLAG( pcPPS->getDLT()->getInterViewDltPredEnableFlag( layerId ) ? 1 : 0, "inter_view_dlt_pred_enable_flag[ layerId ]");
+        if ( pcPPS->getDLT()->getInterViewDltPredEnableFlag( layerId ) == false )
+        {
+          WRITE_FLAG( pcPPS->getDLT()->getUseBitmapRep( layerId ) ? 1 : 0, "dlt_bit_map_rep_flag[ layerId ]" );
+          
+          for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ )
           {
-            WRITE_FLAG( pcDLT->getInterViewDltPredEnableFlag( i ) ? 1 : 0, "inter_view_dlt_pred_enable_flag[ i ]");
-
-            // ----------------------------- determine whether to use bit-map -----------------------------
-            Bool bDltBitMapRepFlag       = false;
-            UInt uiNumBitsNonBitMap      = 0;
-            UInt uiNumBitsBitMap         = 0;
-
-            UInt uiMaxDiff               = 0;
-            UInt uiMinDiff               = 0xffffffff;
-            UInt uiLengthMinDiff         = 0;
-            UInt uiLengthDltDiffMinusMin = 0;
-
-            UInt* puiDltDiffValues       = NULL;
-            
-            Int aiIdx2DepthValue_coded[256];
-            UInt uiNumDepthValues_coded = 0;
-            
-            uiNumDepthValues_coded = pcDLT->getNumDepthValues(i);
-            for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ )
+            aiIdx2DepthValue_coded[ui] = pcPPS->getDLT()->idx2DepthValue(layerId, ui);
+          }
+        }
+        else
+        {
+          AOF( layerId > 1 );
+          // assumes ref layer id to be 1
+          std::vector<Int> viRefDLT = pcPPS->getDLT()->idx2DepthValue( 1 );
+          UInt uiRefNum = pcPPS->getDLT()->getNumDepthValues( 1 );
+          pcPPS->getDLT()->getDeltaDLT(layerId, viRefDLT, uiRefNum, aiIdx2DepthValue_coded, uiNumDepthValues_coded);
+        }
+        
+        // bit map coding
+        if ( pcPPS->getDLT()->getUseBitmapRep( layerId ) )
+        {
+          UInt uiDltArrayIndex = 0;
+          for (UInt d=0; d < 256; d++)
+          {
+            if ( d == aiIdx2DepthValue_coded[uiDltArrayIndex] )
             {
-              aiIdx2DepthValue_coded[ui] = pcDLT->idx2DepthValue(i, ui);
-            }
-            
-            if( pcDLT->getInterViewDltPredEnableFlag( i ) )
-            {
-              AOF( pcVPS->getDepthId( 1 ) == 1 );
-              AOF( i > 1 );
-              // assumes ref layer id to be 1
-              Int* piRefDLT = pcDLT->idx2DepthValue( 1 );
-              UInt uiRefNum = pcDLT->getNumDepthValues( 1 );
-              pcDLT->getDeltaDLT(i, piRefDLT, uiRefNum, aiIdx2DepthValue_coded, &uiNumDepthValues_coded);
-            }
-
-            if ( NULL == (puiDltDiffValues = (UInt *)calloc(uiNumDepthValues_coded, sizeof(UInt))) )
-            {
-              // This should be changed to an assertion. 
-              exit(-1);
-            }
-
-            for (UInt d = 1; d < uiNumDepthValues_coded; d++)
-            {
-              puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1];
-
-              if ( uiMaxDiff < puiDltDiffValues[d] )
-              {
-                uiMaxDiff = puiDltDiffValues[d];
-              }
-
-              if ( uiMinDiff > puiDltDiffValues[d] )
-              {
-                uiMinDiff = puiDltDiffValues[d];
-              }
-            }
-
-            // counting bits
-            // diff coding branch
-            uiNumBitsNonBitMap += 8;                          // u(v) bits for num_depth_values_in_dlt[layerId] (i.e. num_entry[ layerId ])
-
-            if ( uiNumDepthValues_coded > 1 )
-            {
-              uiNumBitsNonBitMap += 8;                        // u(v) bits for max_diff[ layerId ]
-            }
-
-            if ( uiNumDepthValues_coded > 2 )
-            {
-              uiLengthMinDiff    = (UInt) ceil(Log2(uiMaxDiff + 1));
-              uiNumBitsNonBitMap += uiLengthMinDiff;          // u(v)  bits for min_diff[ layerId ]
-            }
-
-            uiNumBitsNonBitMap += 8;                          // u(v) bits for dlt_depth_value0[ layerId ]
-
-            if (uiMaxDiff > uiMinDiff)
-            {
-              uiLengthDltDiffMinusMin = (UInt) ceil(Log2(uiMaxDiff - uiMinDiff + 1));
-              uiNumBitsNonBitMap += uiLengthDltDiffMinusMin * (uiNumDepthValues_coded - 1);  // u(v) bits for dlt_depth_value_diff_minus_min[ layerId ][ j ]
-            }
-
-            // bit map branch
-            uiNumBitsBitMap = 256;   // uiNumBitsBitMap = 1 << pcDLT->getDepthViewBitDepth(); 
-
-            // determine bDltBitMapFlag
-            bDltBitMapRepFlag = (uiNumBitsBitMap > uiNumBitsNonBitMap) ? false : true;
-
-            // ----------------------------- Actual coding -----------------------------
-            if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )
-            {
-              WRITE_FLAG( bDltBitMapRepFlag ? 1 : 0, "dlt_bit_map_rep_flag[ layerId ]" );
+              WRITE_FLAG(1, "dlt_bit_map_flag[ layerId ][ j ]");
+              uiDltArrayIndex++;
             }
             else
             {
-              bDltBitMapRepFlag = false;
+              WRITE_FLAG(0, "dlt_bit_map_flag[ layerId ][ j ]");
             }
-
-            // bit map coding
-            if ( bDltBitMapRepFlag )
+          }
+        }
+        // Diff Coding
+        else
+        {
+          UInt uiMaxDiff               = 0;
+          UInt uiMinDiff               = INT_MAX;
+          UInt uiLengthMinDiff         = 0;
+          UInt uiLengthDltDiffMinusMin = 0;
+          
+          std::vector<UInt> puiDltDiffValues(uiNumDepthValues_coded, 0);
+          
+          for (UInt d = 1; d < uiNumDepthValues_coded; d++)
+          {
+            puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1];
+            
+            if ( uiMaxDiff < puiDltDiffValues[d] )
             {
-              UInt uiDltArrayIndex = 0; 
-              for (UInt d=0; d < 256; d++)
+              uiMaxDiff = puiDltDiffValues[d];
+            }
+            
+            if ( uiMinDiff > puiDltDiffValues[d] )
+            {
+              uiMinDiff = puiDltDiffValues[d];
+            }
+          }
+          
+          if ( uiNumDepthValues_coded > 2 )
+          {
+            uiLengthMinDiff    = (UInt) gCeilLog2(uiMaxDiff + 1);
+          }
+          if (uiMaxDiff > uiMinDiff)
+          {
+            uiLengthDltDiffMinusMin = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1);
+          }
+          
+          WRITE_CODE(uiNumDepthValues_coded, 8, "num_depth_values_in_dlt[layerId]");    // num_entry
+          {
+            // The condition if( uiNumDepthValues_coded > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component.
+            if ( uiNumDepthValues_coded > 1 )
+            {
+              WRITE_CODE(uiMaxDiff, 8, "max_diff[ layerId ]");        // max_diff
+            }
+            
+            if ( uiNumDepthValues_coded > 2 )
+            {
+              WRITE_CODE((uiMinDiff - 1), uiLengthMinDiff, "min_diff_minus1[ layerId ]");     // min_diff_minus1
+            }
+            
+            WRITE_CODE(aiIdx2DepthValue_coded[0], 8, "dlt_depth_value0[layerId]");          // entry0
+            
+            if (uiMaxDiff > uiMinDiff)
+            {
+              for (UInt d=1; d < uiNumDepthValues_coded; d++)
               {
-                if ( d == aiIdx2DepthValue_coded[uiDltArrayIndex] )
-                {                  
-                  WRITE_FLAG(1, "dlt_bit_map_flag[ layerId ][ j ]");
-                  uiDltArrayIndex++;
-                }
-                else
-                {
-                  WRITE_FLAG(0, "dlt_bit_map_flag[ layerId ][ j ]");
-                }
+                WRITE_CODE( (puiDltDiffValues[d] - uiMinDiff), uiLengthDltDiffMinusMin, "dlt_depth_value_diff_minus_min[ layerId ][ j ]");    // entry_value_diff_minus_min[ k ]
               }
             }
-            // Diff Coding
-            else
-            {
-              WRITE_CODE(uiNumDepthValues_coded, 8, "num_depth_values_in_dlt[i]");    // num_entry
-              {
-                // The condition if( uiNumDepthValues_coded > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component.
-                if ( uiNumDepthValues_coded > 1 )
-                {
-                  WRITE_CODE(uiMaxDiff, 8, "max_diff[ layerId ]");        // max_diff
-                }
-
-                if ( uiNumDepthValues_coded > 2 )
-                {
-                  WRITE_CODE((uiMinDiff - 1), uiLengthMinDiff, "min_diff_minus1[ layerId ]");     // min_diff_minus1
-                }
-
-                WRITE_CODE(aiIdx2DepthValue_coded[0], 8, "dlt_depth_value0[layerId]");          // entry0
-
-                if (uiMaxDiff > uiMinDiff)
-                {
-                  for (UInt d=1; d < uiNumDepthValues_coded; d++)
-                  {
-                    WRITE_CODE( (puiDltDiffValues[d] - uiMinDiff), uiLengthDltDiffMinusMin, "dlt_depth_value_diff_minus_min[ layerId ][ j ]");    // entry_value_diff_minus_min[ k ]
-                  }
-                }
-              }
-            }
-
-            free(puiDltDiffValues);
           }
+          
         }
       }
Index: branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncCfg.h	(revision 1216)
+++ branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncCfg.h	(revision 1219)
@@ -383,6 +383,6 @@
 #endif
 
-#if H_3D
-  TComDLT*  m_cDLT;
+#if NH_3D_DLT
+  TComDLT   m_cDLT;
 #endif
   Bool      m_recalculateQPAccordingToLambda;                 ///< recalculate QP value according to the lambda value
@@ -1011,7 +1011,7 @@
 #endif
 
-#if H_3D
-  Void         setDLT( TComDLT *p )                                  s{ m_cDLT = p; }
-  TComDLT*     getDLT()                                              s{ return m_cDLT; }
+#if NH_3D_DLT
+  Void         setDLT( TComDLT p )                                   { m_cDLT = p; }
+  TComDLT*     getDLT()                                              { return &m_cDLT; }
 #endif
   Void         setUseRecalculateQPAccordingToLambda (Bool b)         { m_recalculateQPAccordingToLambda = b;    }
Index: branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1216)
+++ branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1219)
@@ -2266,5 +2266,5 @@
     Pel pDCRec = ( !bZeroResidual ) ? apDCOrigValues[uiSegment] : apDCPredValues[uiSegment];
     // get residual (idx)
-#if H_3D_DIM_DLT
+#if NH_3D_DLT
     Pel pResidualIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
 #else
@@ -2288,5 +2288,5 @@
   for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
   {
-#if H_3D_DIM_DLT
+#if NH_3D_DLT
     Pel   pPredIdx    = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
     Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
@@ -7661,7 +7661,7 @@
 #endif
 
-#if H_3D_DIM_DLT
-  rDeltaDC1 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipBD(predDC1 + rDeltaDC1), bitDepthY ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 );
-  rDeltaDC2 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipBD(predDC2 + rDeltaDC2), bitDepthY ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 );
+#if NH_3D_DLT
+  rDeltaDC1 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipBD(predDC1 + rDeltaDC1, bitDepthY )) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 );
+  rDeltaDC2 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipBD(predDC2 + rDeltaDC2, bitDepthY )) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 );
 #endif
 }
Index: branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1216)
+++ branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1219)
@@ -987,6 +987,14 @@
 #endif
 
-#if H_3D
-  m_cPPS.setDLT( getDLT() );
+#if NH_3D_DLT
+  // create mapping from depth layer indexes to layer ids
+  Int j=0;
+  for( Int i=0; i<=getVPS()->getMaxLayersMinus1(); i++ )
+  {
+    Int layerId = getVPS()->getLayerIdInNuh(i);
+    if( getVPS()->getDepthId(layerId) )
+      m_cDLT.setDepthIdxToLayerId(j++, i);
+  }
+  m_cPPS.setDLT( m_cDLT );
 #endif
 
