Index: branches/HTM-9.1-dev0-ZTE/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/App/TAppEncoder/TAppEncTop.cpp	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/App/TAppEncoder/TAppEncTop.cpp	(revision 748)
@@ -76,4 +76,8 @@
 #endif
   
+#if DLT_DIFF_CODING_IN_PPS
+  TComDLT& dlt = m_dlt;
+#endif
+
 #if H_MV
   Int maxTempLayer = -1; 
@@ -125,5 +129,8 @@
 #if H_3D
   xSetVPSExtension2        ( vps ); 
-  m_ivPicLists.setVPS      ( &vps ); 
+  m_ivPicLists.setVPS      ( &vps );
+#if DLT_DIFF_CODING_IN_PPS
+  xDeriveDltArray          ( vps, dlt );
+#endif
 #endif
 
@@ -218,4 +225,8 @@
   // H_MV
   m_cTEncTop.setVPS(&vps);
+
+#if DLT_DIFF_CODING_IN_PPS
+  m_cTEncTop.setDLT(&dlt);
+#endif
 
   m_cTEncTop.setProfile(m_profile);
@@ -1247,5 +1258,9 @@
 
 #if H_3D_DIM_DLT
+#if DLT_DIFF_CODING_IN_PPS
+Void TAppEncTop::xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt)
+#else
 Void TAppEncTop::xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps)
+#endif
 {
   TComPicYuv*       pcDepthPicYuvOrg = new TComPicYuv;
@@ -1307,11 +1322,20 @@
   if( uiNumFrames == 0 || numBitsForValue(iNumDepthValues) == g_bitDepthY )
   {
+#if DLT_DIFF_CODING_IN_PPS
+    dlt->setUseDLTFlag(layer, false);
+#else
     // don't use DLT
     vps->setUseDLTFlag(layer, false);
+#endif
   }
   
   // assign LUT
+#if DLT_DIFF_CODING_IN_PPS
+  if( dlt->getUseDLTFlag(layer) )
+    dlt->setDepthLUTs(layer, aiIdx2DepthValue, iNumDepthValues);
+#else
   if( vps->getUseDLTFlag(layer) )
     vps->setDepthLUTs(layer, aiIdx2DepthValue, iNumDepthValues);
+#endif
   
   // free temporary memory
@@ -1967,4 +1991,5 @@
 #endif
 #if H_3D_DIM_DLT
+#if !DLT_DIFF_CODING_IN_PPS
     vps.setUseDLTFlag( layer , isDepth && m_useDLT );
     if( vps.getUseDLTFlag( layer ) )
@@ -1976,4 +2001,5 @@
 #endif
     }
+#endif
 #endif
 #endif
@@ -2011,4 +2037,32 @@
 }
 #endif
+
+#if DLT_DIFF_CODING_IN_PPS
+Void TAppEncTop::xDeriveDltArray( TComVPS& vps, TComDLT& dlt )
+{
+  Int  iNumDepthViews  = 0;
+  Bool bDltPresentFlag = false;
+
+  for ( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )
+  {
+    Bool isDepth = ( vps.getDepthId( layer ) == 1 );
+
+    if ( isDepth )
+    {
+      iNumDepthViews++;
+    }
+
+    dlt.setUseDLTFlag( layer , isDepth && m_useDLT );
+    if( dlt.getUseDLTFlag( layer ) )
+    {
+      xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod[layer], 24), &vps, &dlt);
+      bDltPresentFlag = bDltPresentFlag || dlt.getUseDLTFlag(layer);
+    }
+  }
+
+  dlt.setDltPresentFlag( bDltPresentFlag );
+  dlt.setNumDepthViews ( iNumDepthViews  );
+}
+#endif
 #endif
 //! \}
Index: branches/HTM-9.1-dev0-ZTE/source/App/TAppEncoder/TAppEncTop.h
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/App/TAppEncoder/TAppEncTop.h	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/App/TAppEncoder/TAppEncTop.h	(revision 748)
@@ -86,4 +86,8 @@
 #endif
 
+#if DLT_DIFF_CODING_IN_PPS
+  TComDLT                    m_dlt;                         ///< dlt
+#endif
+
   UInt m_essentialBytes;
   UInt m_totalBytes;
@@ -135,6 +139,13 @@
   Void xSetVPSExtension2( TComVPS& vps );
 #endif
+#if DLT_DIFF_CODING_IN_PPS
+  Void xDeriveDltArray( TComVPS& vps, TComDLT& dlt );
+#endif
 #if H_3D_DIM_DLT
+#if DLT_DIFF_CODING_IN_PPS
+  Void  xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt);
+#else
   Void  xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps);
+#endif
 #endif
 public:
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibCommon/TComPrediction.cpp	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibCommon/TComPrediction.cpp	(revision 748)
@@ -506,6 +506,11 @@
     {
 #if H_3D_DIM_DLT
+#if DLT_DIFF_CODING_IN_PPS
+      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 );
+#else
       segDC1 = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ) + deltaDC1 );
       segDC2 = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ) + deltaDC2 );
+#endif
 #else
       segDC1 = ClipY( predDC1 + deltaDC1 );
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibCommon/TComSlice.cpp	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibCommon/TComSlice.cpp	(revision 748)
@@ -1816,4 +1816,5 @@
     m_vpsDepthModesFlag [i] = false;
 #if H_3D_DIM_DLT
+#if !DLT_DIFF_CODING_IN_PPS
     m_bUseDLTFlag         [i] = false;
     
@@ -1832,4 +1833,5 @@
     }
 #endif
+#endif
 #if H_3D
     m_ivMvScalingFlag = true; 
@@ -1902,4 +1904,5 @@
     if (m_repFormat[ i ] != NULL )      delete m_repFormat[ i ];    
 #if H_3D_DIM_DLT
+#if !DLT_DIFF_CODING_IN_PPS
     if ( m_iDepthValue2Idx[i] != 0 ) 
     {
@@ -1914,4 +1917,5 @@
     }
 #endif
+#endif
   }
 #endif
@@ -1919,4 +1923,5 @@
 
 #if H_3D_DIM_DLT
+#if !DLT_DIFF_CODING_IN_PPS
   Void TComVPS::setDepthLUTs(Int layerIdInVps, Int* idxToDepthValueTable, Int iNumDepthValues)
   {
@@ -1979,4 +1984,5 @@
     m_iBitsPerDepthValue[layerIdInVps] = numBitsForValue(m_iNumDepthmapValues[layerIdInVps]);
   }
+#endif
 #endif
 
@@ -2444,4 +2450,7 @@
 , m_ppsInferScalingListFlag(false)
 , m_ppsScalingListRefLayerId(0)
+#if DLT_DIFF_CODING_IN_PPS
+, m_pcDLT(NULL)
+#endif
 #endif
 {
@@ -2463,4 +2472,113 @@
   delete m_scalingList;
 }
+
+#if DLT_DIFF_CODING_IN_PPS
+TComDLT::TComDLT()
+: m_bDltPresentFlag(false)
+, m_iNumDepthViews(0)
+, m_uiDepthViewBitDepth(8)
+{
+  m_uiDepthViewBitDepth = g_bitDepthY; 
+
+  for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
+  {
+    m_bUseDLTFlag                 [i] = false;
+    m_bInterViewDltPredEnableFlag [i] = false;
+
+    // allocate some memory and initialize with default mapping
+    m_iNumDepthmapValues[i] = ((1 << m_uiDepthViewBitDepth)-1)+1;
+    m_iBitsPerDepthValue[i] = numBitsForValue(m_iNumDepthmapValues[i]);
+
+    m_iDepthValue2Idx[i]    = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]);
+    m_iIdx2DepthValue[i]    = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]);
+
+    //default mapping
+    for (Int d=0; d<m_iNumDepthmapValues[i]; d++)
+    {
+      m_iDepthValue2Idx[i][d] = d;
+      m_iIdx2DepthValue[i][d] = d;
+    }
+  }
+}
+
+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
+    return;
+
+  // copy idx2DepthValue to internal array
+  memcpy(m_iIdx2DepthValue[layerIdInVps], idxToDepthValueTable, iNumDepthValues*sizeof(UInt));
+
+  UInt uiMaxDepthValue = ((1 << g_bitDepthY)-1);
+  for(Int p=0; p<=uiMaxDepthValue; p++)
+  {
+    Int iIdxDown    = 0;
+    Int iIdxUp      = iNumDepthValues-1;
+    Bool bFound     = false;
+
+    // iterate over indices to find lower closest depth
+    Int i = 1;
+    while(!bFound && i<iNumDepthValues)
+    {
+      if( m_iIdx2DepthValue[layerIdInVps][i] > p )
+      {
+        iIdxDown  = i-1;
+        bFound    = true;
+      }
+
+      i++;
+    }
+    // iterate over indices to find upper closest depth
+    i = iNumDepthValues-2;
+    bFound = false;
+    while(!bFound && i>=0)
+    {
+      if( m_iIdx2DepthValue[layerIdInVps][i] < p )
+      {
+        iIdxUp  = i+1;
+        bFound    = true;
+      }
+
+      i--;
+    }
+
+    // assert monotony
+    assert(iIdxDown<=iIdxUp);
+
+    // assign closer depth value/idx
+    if( abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxDown]) < abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxUp]) )
+    {
+      m_iDepthValue2Idx[layerIdInVps][p] = iIdxDown;
+    }
+    else
+    {
+      m_iDepthValue2Idx[layerIdInVps][p] = iIdxUp;
+    }
+
+  }
+
+  // update DLT variables
+  m_iNumDepthmapValues[layerIdInVps] = iNumDepthValues;
+  m_iBitsPerDepthValue[layerIdInVps] = numBitsForValue(m_iNumDepthmapValues[layerIdInVps]);
+}
+#endif
 
 #if H_MV
@@ -3707,5 +3825,5 @@
   // It is a requirement of bitstream conformance that bitstream partition with index j shall not include 
   // direct or indirect reference layers of any layers in bitstream partition i for any values of i and j 
-  // in the range of 0 to num_bitstream_partitions[ h ]  1, inclusive, such that i is less than j.
+  // in the range of 0 to num_bitstream_partitions[ h ] ?1, inclusive, such that i is less than j.
 
   for ( Int partJ = 0; partJ < getNumBitstreamPartitions( h ); partJ++ )
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibCommon/TComSlice.h	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibCommon/TComSlice.h	(revision 748)
@@ -849,5 +849,7 @@
 #endif
   Bool        m_vpsDepthModesFlag        [MAX_NUM_LAYERS   ];
+
 #if H_3D_DIM_DLT
+#if !DLT_DIFF_CODING_IN_PPS
   Bool        m_bUseDLTFlag              [MAX_NUM_LAYERS   ];
   
@@ -857,4 +859,6 @@
   Int*        m_iIdx2DepthValue          [MAX_NUM_LAYERS   ];
 #endif
+#endif
+
 #if H_3D
   Bool        m_ivMvScalingFlag; 
@@ -1157,5 +1161,7 @@
   Void    setVpsDepthModesFlag( Int layerIdInVps, Bool val )               { m_vpsDepthModesFlag[ layerIdInVps ] = val; }
   Bool    getVpsDepthModesFlag( Int layerIdInVps )                         { return m_vpsDepthModesFlag[ layerIdInVps ]; }
+
 #if H_3D_DIM_DLT
+#if !DLT_DIFF_CODING_IN_PPS
   Bool    getUseDLTFlag      ( Int layerIdInVps )                         { return m_bUseDLTFlag[ layerIdInVps ]; }
   Void    setUseDLTFlag      ( Int layerIdInVps, Bool b ) { m_bUseDLTFlag[ layerIdInVps ]  = b;          }
@@ -1167,4 +1173,5 @@
   Void    setDepthLUTs( Int layerIdInVps, Int* idx2DepthValue = NULL, Int iNumDepthValues = 0 );
 #endif
+#endif
 
   Bool    getIvMvScalingFlag   (  )                       { return m_ivMvScalingFlag; }
@@ -1181,4 +1188,48 @@
 #endif
 };
+
+#if DLT_DIFF_CODING_IN_PPS
+class TComDLT
+{
+private:
+  Bool        m_bDltPresentFlag;
+  Bool        m_bUseDLTFlag              [ MAX_NUM_LAYERS ];
+  Bool        m_bInterViewDltPredEnableFlag[ MAX_NUM_LAYERS ];
+
+  Int         m_iBitsPerDepthValue       [ 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;
+
+public:
+  TComDLT();
+  ~TComDLT(); 
+
+  Bool    getDltPresentFlag  ()                           { return m_bDltPresentFlag; }
+  Void    setDltPresentFlag  ( Bool b )                   { m_bDltPresentFlag = b;    }
+
+  Bool    getUseDLTFlag      ( Int layerIdInVps )         { return m_bUseDLTFlag[ layerIdInVps ]; }
+  Void    setUseDLTFlag      ( Int layerIdInVps, Bool b ) { m_bUseDLTFlag[ layerIdInVps ]  = b;   }
+
+  Bool    getInterViewDltPredEnableFlag( Int layerIdInVps )         { return m_bInterViewDltPredEnableFlag[ layerIdInVps ]; }
+  Void    setInterViewDltPredEnableFlag( Int layerIdInVps, Bool b ) { m_bInterViewDltPredEnableFlag[ layerIdInVps ] = b;    }
+
+
+  Void    setNumDepthViews   ( Int n )                    { m_iNumDepthViews = n; }
+  Int     getNumDepthViews   ()                           { return m_iNumDepthViews; }
+
+  Void    setDepthViewBitDepth( UInt n )                  { m_uiDepthViewBitDepth = n; }
+  UInt    getDepthViewBitDepth()                          { return m_uiDepthViewBitDepth; }
+
+  Int     getBitsPerDepthValue( Int layerIdInVps )        { return getUseDLTFlag(layerIdInVps)?m_iBitsPerDepthValue[layerIdInVps]:g_bitDepthY; }
+  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][uiIdx]:uiIdx; }
+  Void    setDepthLUTs( Int layerIdInVps, Int* idx2DepthValue = NULL, Int iNumDepthValues = 0 );
+};
+#endif
 
 class Window
@@ -1840,4 +1891,9 @@
   Int  m_ppsScalingListRefLayerId;
 #endif
+
+#if DLT_DIFF_CODING_IN_PPS
+  TComDLT*  m_pcDLT; 
+#endif
+
 public:
   TComPPS();
@@ -1864,4 +1920,9 @@
   Void      setMinCuDQPSize     ( UInt u ) { m_uiMinCuDQPSize = u;    }
   UInt      getMinCuDQPSize     ()         { return m_uiMinCuDQPSize; }
+
+#if DLT_DIFF_CODING_IN_PPS
+  Void      setDLT              ( TComDLT* pcDLT ) { m_pcDLT = pcDLT; }
+  TComDLT*  getDLT              ()                 { return m_pcDLT; }
+#endif
 
   Void      setChromaCbQpOffset( Int i ) { m_chromaCbQpOffset = i;    }
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibCommon/TypeDef.h	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibCommon/TypeDef.h	(revision 748)
@@ -215,4 +215,13 @@
 #define H_3D_DIM_SDC                      1   // Simplified Depth Coding method
 #define H_3D_DIM_DLT                      1   // Depth Lookup Table
+
+#if H_3D_DIM_DLT
+#define DLT_DIFF_CODING_IN_PPS            1   // moving DLT syntax elements from VPS to PPS and differential coding of DLT values
+                                              // JCT3V-F0131, JCT3V-F0139
+#if DLT_DIFF_CODING_IN_PPS
+#define Log2( n ) ( log((double)n) / log(2.0) )
+#endif
+#endif
+
 #define H_3D_DIM_ENC                      1   // Depth Intra encoder optimizations, includes:
                                               // HHI_DEPTH_INTRA_SEARCH_RAU_C0160
@@ -262,5 +271,5 @@
 #define H_MV_FIX_SKIP_PICTURES                  1  // Fix related to skipping pictures. 
 #define H_MV_6_HRD_O0164_15                     1  // (HRD/O0164/Multilayer HRD) #15 Decision: Adopt, modified as follows: It was suggested to constrain the stalling based on the relative cpb removal times, which must be in decoding order. The "du_based_bpb_sync_flag" is not needed, in view of this. SEI in the highest layer of the layer set or (inclusive "or") VPS VUI is used to carry the parameters (at encoder discretion). SEI in higher layer and SEI in VUI do not need to repeat information available in some lower layer. Shall be after APS SEI and buffering period SEI and before all other SEI of all layers except other HRD related SEI.
-#define H_MV_6_HRD_O0217_13                     1  // (HRD/O0217/Sub-DPB based DPB operations) #13 Decision: Adopt  Specify a separate DPB capacity for each layer  no sharing of capacity across layers  each layer has its own parameters (max pictures, max latency, max reordering). This proposal would specify distinct parameters for each "output layer set" and to change the definition of an operation point to be specific to an output layer set instead of a 'layer set". Decision: Adopted this aspect as well.
+#define H_MV_6_HRD_O0217_13                     1  // (HRD/O0217/Sub-DPB based DPB operations) #13 Decision: Adopt ?Specify a separate DPB capacity for each layer ?no sharing of capacity across layers ?each layer has its own parameters (max pictures, max latency, max reordering). This proposal would specify distinct parameters for each "output layer set" and to change the definition of an operation point to be specific to an output layer set instead of a 'layer set". Decision: Adopted this aspect as well.
 #define H_MV_6_SHVC_O0098_36                    1  // (SHVC/O0098/Scaled ref layer offset) #36 Modify signalling of scaled reference layer offsets to allow signalling of any lower layer, rather than just a direct reference layer, in order to enable alignment of auxiliary pictures. In further JCT-VC and JCT-3V discussion, it was also agreed to use the same offset signalling for MV-HEVC as well as SHVC
 #define H_MV_6_GEN_0153_28                      1  //(Gen/O0153/output highest layer) #28 Add a flag in the VPS to indicate if startup process should output the highest available layer if the target output layer is not available.
@@ -291,5 +300,5 @@
 #define H_MV_6_PS_O0096_21                      1  // (PS/O0096/direct_dependency_type gating flag) #21 Add a gating flag in VPS extension to condition the presence of direct dependency type, with a default type signalled, from JCTVC-O0096 
 #define H_MV_6_PS_O0109_22                      1  // (PS/O0109/view_id_len) #22 Modify the VPS extension syntax and semantics to replace view_id_len_minus1 with view_id_len, always signal that syntax element, add a constraint that (1<<view_id_len) >= NumViews, and modify view_id_val semantics to infer value of 0 when not present, from discussion of JCTVC-O0109 
-#define H_MV_6_PS_O0109_23                      1  // (PS/O0109/profile_ref_minus1 constraint) #23 Modify the semantics of profile_ref_minus1[ i ] to replace shall be less than i with shall be less than or equal to i, from discussion of JCTVC-O0109 
+#define H_MV_6_PS_O0109_23                      1  // (PS/O0109/profile_ref_minus1 constraint) #23 Modify the semantics of profile_ref_minus1[ i ] to replace shall be less than i?with shall be less than or equal to i? from discussion of JCTVC-O0109 
 #define H_MV_6_PS_O0109_24                      1  // (PS/O0109/vps_vui_present_flag move) #24 Move the vps_vui_present_flag to precede vps_vui_offset, and make vps_vui_offset conditional on that flag, from JCTVC-O0109
 /////////////////////////////////////////////////////////////////////////////////////////
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 748)
@@ -215,5 +215,9 @@
 }
 
+#if DLT_DIFF_CODING_IN_PPS
+Void TDecCavlc::parsePPS(TComPPS* pcPPS, TComVPS* pcVPS )
+#else
 Void TDecCavlc::parsePPS(TComPPS* pcPPS)
+#endif
 {
 #if ENC_DEC_TRACE  
@@ -364,10 +368,152 @@
   if (uiCode)
   {
-    while ( xMoreRbspData() )
-    {
-      READ_FLAG( uiCode, "pps_extension_data_flag");
-    }
-  }
-}
+#if DLT_DIFF_CODING_IN_PPS
+    parsePPSExtension( pcPPS, pcVPS );
+    READ_FLAG( uiCode, "pps_extension2_flag");
+    if ( uiCode )
+    {
+#endif
+      while ( xMoreRbspData() )
+      {
+        READ_FLAG( uiCode, "pps_extension_data_flag");
+      }
+#if DLT_DIFF_CODING_IN_PPS
+    }
+#endif
+  }
+}
+
+#if DLT_DIFF_CODING_IN_PPS
+Void TDecCavlc::parsePPSExtension( TComPPS* pcPPS, TComVPS* pcVPS )
+{
+  UInt uiCode = 0; 
+  TComDLT* pcDLT = new TComDLT;
+
+  READ_FLAG(uiCode, "dlt_present_flag");
+  pcDLT->setDltPresentFlag( (uiCode == 1) ? true : false );
+
+  if ( pcDLT->getDltPresentFlag() )
+  {
+    READ_CODE(6, uiCode, "pps_depth_layers_minus1");
+    pcDLT->setNumDepthViews( uiCode );
+
+    READ_CODE(4, uiCode, "pps_bit_depth_for_depth_views_minus8");
+    pcDLT->setDepthViewBitDepth( (uiCode+8) );
+
+    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 ) )
+          {
+            UInt uiNumDepthValues     = 0;
+            Bool bDltBitMapRepFlag    = false;
+            UInt uiMaxDiff            = 0xffffffff;
+            UInt uiMinDiff            = 0;
+            UInt uiCodeLength         = 0;
+            UInt uiDiffMaxMinDltValue = 0;
+
+            READ_FLAG(uiCode, "inter_view_dlt_pred_enable_flag[ i ]"); 
+            pcDLT->setInterViewDltPredEnableFlag( i, (uiCode == 1) ? true : false );
+
+            if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )
+            {
+              READ_FLAG(uiCode, "dlt_bit_map_rep_flag[ layerId ]");
+              bDltBitMapRepFlag = (uiCode == 1) ? true : false; 
+            }
+            else
+            {
+              bDltBitMapRepFlag = false;
+            }
+
+            // Bit map
+            if ( bDltBitMapRepFlag )
+            {
+              UInt uiNumDepthValues = 0;
+              Int  aiIdx2DepthValue[256]; 
+
+              for (UInt d=0; d<256; d++)
+              {
+                READ_FLAG(uiCode, "dlt_bit_map_flag[ layerId ][ j ]");
+                if (uiCode == 1)
+                {
+                  aiIdx2DepthValue[uiNumDepthValues] = d;
+                  uiNumDepthValues++;
+                }
+              }
+
+              pcDLT->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);
+            }
+            // Diff Coding
+            else
+            {
+              READ_CODE(8, uiNumDepthValues, "num_depth_values_in_dlt[i]");   // num_entry
+
+              if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )       // Single-view DLT Diff Coding
+              {
+                // 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. 
+
+                Int* aiIdx2DepthValue = (Int*) calloc(uiNumDepthValues, sizeof(Int));
+
+                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;
+                  }
+                }
+
+                pcDLT->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);
+
+                free(aiIdx2DepthValue);
+              }              
+            }
+          }
+        }
+      }
+    }
+  }
+
+  pcPPS->setDLT( pcDLT );
+}
+#endif
 
 Void  TDecCavlc::parseVUI(TComVUI* pcVUI, TComSPS *pcSPS)
@@ -1738,4 +1884,5 @@
         //          READ_FLAG( uiCode, "lim_qt_pred_flag[i]");                  pcVPS->setLimQtPreFlag     ( i, uiCode == 1 ? true : false ); 
 #if H_3D_DIM_DLT
+#if !DLT_DIFF_CODING_IN_PPS
         if( pcVPS->getVpsDepthModesFlag( i ) )
         {
@@ -1762,4 +1909,5 @@
           free(aiIdx2DepthValue);
         }
+#endif
 #endif
 #if H_3D_INTER_SDC
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 748)
@@ -105,4 +105,12 @@
   Void  parseSPS            ( TComSPS* pcSPS );
 #endif
+
+#if DLT_DIFF_CODING_IN_PPS
+  Void  parsePPS            ( TComPPS* pcPPS, TComVPS* pcVPS );
+  Void  parsePPSExtension   ( TComPPS* pcPPS, TComVPS* pcVPS );
+#else
+  Void  parsePPS            ( TComPPS* pcPPS);
+#endif
+
   Void  parsePPS            ( TComPPS* pcPPS);
   Void  parseVUI            ( TComVUI* pcVUI, TComSPS* pcSPS );
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecCu.cpp	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecCu.cpp	(revision 748)
@@ -781,7 +781,15 @@
     {
 #if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
-        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
+#if DLT_DIFF_CODING_IN_PPS
+      if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
+#else
+      if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
+#endif
         {
-            pReco    [ uiX ] = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
+#if DLT_DIFF_CODING_IN_PPS
+          pReco    [ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
+#else
+          pReco    [ uiX ] = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
+#endif
         }
         else
@@ -1000,8 +1008,14 @@
   {
 #if H_3D_DIM_DLT
+#if DLT_DIFF_CODING_IN_PPS
+    Pel   pPredIdx    = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
+    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
+    Pel   pRecoValue  = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
+#else
     Pel   pPredIdx    = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
     Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     Pel   pRecoValue  = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
-    
+#endif
+
     apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
 #else
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecEntropy.h	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecEntropy.h	(revision 748)
@@ -71,5 +71,9 @@
   virtual Void  parseSPS                  ( TComSPS* pcSPS )                                      = 0;
 #endif
+#if DLT_DIFF_CODING_IN_PPS
+  virtual Void  parsePPS                  ( TComPPS* pcPPS, TComVPS* pcVPS )                      = 0;
+#else
   virtual Void  parsePPS                  ( TComPPS* pcPPS )                                      = 0;
+#endif
 
   virtual Void parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)       = 0;
@@ -148,5 +152,9 @@
   Void    decodeSPS                   ( TComSPS* pcSPS     )    { m_pcEntropyDecoderIf->parseSPS(pcSPS);                    }
 #endif
+#if DLT_DIFF_CODING_IN_PPS
+  Void    decodePPS                   ( TComPPS* pcPPS, TComVPS* pcVPS )    { m_pcEntropyDecoderIf->parsePPS(pcPPS, pcVPS);                    }
+#else
   Void    decodePPS                   ( TComPPS* pcPPS )    { m_pcEntropyDecoderIf->parsePPS(pcPPS);                    }
+#endif
   Void    decodeSliceHeader           ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)  { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager);         }
 
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 748)
@@ -568,5 +568,9 @@
   
 #if H_3D_DIM_DLT
+#if DLT_DIFF_CODING_IN_PPS
+  UInt uiMaxResidualBits = pcCU->getSlice()->getPPS()->getDLT()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );
+#else
   UInt uiMaxResidualBits = pcCU->getSlice()->getVPS()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );
+#endif
 #else
   UInt uiMaxResidualBits = g_bitDepthY;
@@ -592,5 +596,9 @@
     UInt uiCount = 0;
 #if H_3D_DIM_DLT
+#if DLT_DIFF_CODING_IN_PPS
+    UInt uiNumDepthValues = pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
+#else
     UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
+#endif
 #else
     UInt uiNumDepthValues = ((1 << g_bitDepthY)-1);
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecSbac.h	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecSbac.h	(revision 748)
@@ -81,5 +81,9 @@
   Void  parseSPS                  ( TComSPS* /*pcSPS*/ ) {}
 #endif
+#if DLT_DIFF_CODING_IN_PPS
+  Void  parsePPS                  ( TComPPS* /*pcPPS*/, TComVPS* /*pcVPS*/ ) {}
+#else
   Void  parsePPS                  ( TComPPS* /*pcPPS*/ ) {}
+#endif
 
   Void  parseSliceHeader          ( TComSlice*& /*rpcSlice*/, ParameterSetManagerDecoder* /*parameterSetManager*/) {}
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecTop.cpp	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecTop.cpp	(revision 748)
@@ -1151,5 +1151,17 @@
   pps->setLayerId( getLayerId() ); 
 #endif
+#if DLT_DIFF_CODING_IN_PPS
+  // Assuming that all PPS indirectly refer to the same VPS via different SPS
+  // There is no parsing dependency in decoding DLT in PPS. 
+  // The VPS information passed to decodePPS() is used to arrange the decoded DLT tables to their corresponding layers. 
+  // This is equivalent to the process of 
+  //   Step 1) decoding DLT tables based on the number of depth layers, and
+  //   Step 2) mapping DLT tables to the depth layers
+  // as descripted in the 3D-HEVC WD. 
+  TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 );
+  m_cEntropyDecoder.decodePPS( pps, vps );
+#else
   m_cEntropyDecoder.decodePPS( pps );
+#endif
   m_parameterSetManagerDecoder.storePrefetchedPPS( pps );
 }
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 748)
@@ -256,6 +256,173 @@
   WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2");
   WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag");
+
+#if !DLT_DIFF_CODING_IN_PPS
   WRITE_FLAG( 0, "pps_extension_flag" );
-}
+#else
+  WRITE_FLAG( 1, "pps_extension_flag" );
+  codePPSExtension( pcPPS ); 
+  WRITE_FLAG( 0, "pps_extension2_flag" );
+#endif
+}
+
+#if DLT_DIFF_CODING_IN_PPS
+Void  TEncCavlc::codePPSExtension        ( TComPPS* pcPPS )
+{
+  // Assuming that all PPS indirectly refer to the same VPS via different SPS
+  // There is no parsing dependency in decoding DLT in PPS. 
+  // The VPS information passed to decodePPS() is used to arrange the decoded DLT tables to their corresponding layers. 
+  // This is equivalent to the process of 
+  //   Step 1) decoding DLT tables based on the number of depth layers, and
+  //   Step 2) mapping DLT tables to the depth layers
+  // as descripted in the 3D-HEVC WD.
+  TComVPS* pcVPS = pcPPS->getSPS()->getVPS();
+
+  TComDLT* pcDLT = pcPPS->getDLT();
+
+  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 ) )
+          {
+            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;
+
+            if ( NULL == (puiDltDiffValues = (UInt *)calloc(pcDLT->getNumDepthValues(i), sizeof(UInt))) )
+            {
+              exit(-1);
+            }
+
+            for (UInt d = 1; d < pcDLT->getNumDepthValues(i); d++)
+            {
+              puiDltDiffValues[d] = pcDLT->idx2DepthValue(i, d) - pcDLT->idx2DepthValue(i, (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 ( pcDLT->getNumDepthValues(i) > 1 )
+            {
+              uiNumBitsNonBitMap += 8;                        // u(v) bits for max_diff[ layerId ]
+            }
+
+            if ( pcDLT->getNumDepthValues(i) > 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 * (pcDLT->getNumDepthValues(i) - 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 ]" );
+            }
+            else
+            {
+              bDltBitMapRepFlag = false;
+            }
+
+            // bit map coding
+            if ( bDltBitMapRepFlag )
+            {
+              UInt uiDltArrayIndex = 0; 
+              for (UInt d=0; d < 256; d++)
+              {
+                if ( d == pcDLT->idx2DepthValue(i, uiDltArrayIndex) )
+                {                  
+                  WRITE_FLAG(1, "dlt_bit_map_flag[ layerId ][ j ]");
+                  uiDltArrayIndex++;
+                }
+                else
+                {
+                  WRITE_FLAG(0, "dlt_bit_map_flag[ layerId ][ j ]");
+                }
+              }
+            }
+            // Diff Coding
+            else
+            {
+              WRITE_CODE(pcDLT->getNumDepthValues(i), 8, "num_depth_values_in_dlt[layerId]");    // num_entry
+
+              if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )   // Single-view DLT Diff Coding
+              {
+                // 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 ( pcDLT->getNumDepthValues(i) > 1 )
+                {
+                  WRITE_CODE(uiMaxDiff, 8, "max_diff[ layerId ]");        // max_diff
+                }
+
+                if ( pcDLT->getNumDepthValues(i) > 2 )
+                {
+                  WRITE_CODE((uiMinDiff - 1), uiLengthMinDiff, "min_diff_minus1[ layerId ]");     // min_diff_minus1
+                }
+
+                WRITE_CODE(pcDLT->idx2DepthValue(i, 0), 8, "dlt_depth_value0[layerId]");          // entry0
+
+                if (uiMaxDiff > uiMinDiff)
+                {
+                  for (UInt d=1; d < pcDLT->getNumDepthValues(i); d++)
+                  {
+                    WRITE_CODE( (puiDltDiffValues[d] - uiMinDiff), uiLengthDltDiffMinusMin, "dlt_depth_value_diff_minus_min[ layerId ][ j ]");    // entry_value_diff_minus_min[ k ]
+                  }
+                }
+              }
+            }
+
+            free(puiDltDiffValues);
+          }
+        }
+      }
+    }
+  }
+}
+#endif
 
 Void TEncCavlc::codeVUI( TComVUI *pcVUI, TComSPS* pcSPS )
@@ -1463,4 +1630,5 @@
         //WRITE_FLAG( pcVPS->getLimQtPredFlag    ( i ) ? 1 : 0 ,          "lim_qt_pred_flag[i]"     ); 
 #if H_3D_DIM_DLT
+#if !DLT_DIFF_CODING_IN_PPS
         if( pcVPS->getVpsDepthModesFlag( i ) )
         {
@@ -1475,5 +1643,6 @@
             WRITE_UVLC( pcVPS->idx2DepthValue(i, d), "dlt_depth_value[i][d]" );
           }
-        }        
+        }
+#endif
 #endif
 #if H_3D_INTER_SDC
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCavlc.h	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCavlc.h	(revision 748)
@@ -116,4 +116,9 @@
 #endif
   Void  codePPS                 ( TComPPS* pcPPS );
+
+#if DLT_DIFF_CODING_IN_PPS
+  Void  codePPSExtension        ( TComPPS* pcPPS );
+#endif
+
   Void  codeSliceHeader         ( TComSlice* pcSlice );
   Void  codePTL                 ( TComPTL* pcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1);
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCfg.h	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCfg.h	(revision 748)
@@ -330,4 +330,9 @@
   TComVPS                    m_cVPS;
 #endif
+
+#if DLT_DIFF_CODING_IN_PPS
+  TComDLT*  m_cDLT;
+#endif
+
   Bool      m_recalculateQPAccordingToLambda;                 ///< recalculate QP value according to the lambda value
   Int       m_activeParameterSetsSEIEnabled;                  ///< enable active parameter set SEI message 
@@ -441,4 +446,7 @@
   , m_isDepth(false)
   , m_bUseVSO(false)
+#endif
+#if DLT_DIFF_CODING_IN_PPS
+  , m_cDLT(NULL)
 #endif
 #endif
@@ -867,4 +875,10 @@
   TComVPS *getVPS() { return &m_cVPS; }
 #endif
+
+#if DLT_DIFF_CODING_IN_PPS
+  Void      setDLT           ( TComDLT *p ) { m_cDLT = p; }
+  TComDLT*  getDLT           ()             { return m_cDLT; }
+#endif
+
   Void      setUseRecalculateQPAccordingToLambda ( Bool b ) { m_recalculateQPAccordingToLambda = b;    }
   Bool      getUseRecalculateQPAccordingToLambda ()         { return m_recalculateQPAccordingToLambda; }
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 748)
@@ -632,5 +632,9 @@
 
 #if H_3D_DIM_DLT
+#if DLT_DIFF_CODING_IN_PPS
+  UInt uiMaxResidualBits = pcCU->getSlice()->getPPS()->getDLT()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );
+#else
   UInt uiMaxResidualBits = pcCU->getSlice()->getVPS()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );
+#endif
 #else
   UInt uiMaxResidualBits = g_bitDepthY;
@@ -653,5 +657,9 @@
     
 #if H_3D_DIM_DLT
-    UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
+#if DLT_DIFF_CODING_IN_PPS
+      UInt uiNumDepthValues = pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
+#else
+      UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
+#endif
 #else
     UInt uiNumDepthValues = ((1 << g_bitDepthY)-1);
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 748)
@@ -1127,7 +1127,15 @@
       {
 #if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
-          if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
+#if DLT_DIFF_CODING_IN_PPS
+        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
+#else
+        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
+#endif
           {
-              pResi[ uiX ] = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pOrg[ uiX ] ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] );
+#if DLT_DIFF_CODING_IN_PPS
+            pResi[ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pOrg[ uiX ] ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] );
+#else
+            pResi[ uiX ] = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pOrg[ uiX ] ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] );
+#endif
           }
           else
@@ -1202,7 +1210,15 @@
       {
 #if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
-          if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
+#if DLT_DIFF_CODING_IN_PPS
+        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
+#else
+        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
+#endif
           {
-              pReco    [ uiX ] = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
+#if DLT_DIFF_CODING_IN_PPS
+            pReco    [ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
+#else
+            pReco    [ uiX ] = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
+#endif
           }
           else
@@ -1935,5 +1951,9 @@
     // get residual (idx)
 #if H_3D_DIM_DLT
+#if DLT_DIFF_CODING_IN_PPS
+    Pel pResidualIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
+#else
     Pel pResidualIdx = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
+#endif
 #else
     Pel pResidualIdx = pDCRec - apDCPredValues[uiSegment];
@@ -1949,8 +1969,14 @@
   {
 #if H_3D_DIM_DLT
+#if DLT_DIFF_CODING_IN_PPS
+    Pel   pPredIdx    = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
+    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
+    Pel   pRecoValue  = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
+#else
     Pel   pPredIdx    = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
     Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     Pel   pRecoValue  = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
-    
+#endif
+
     apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
 #else
@@ -7346,6 +7372,11 @@
 
 #if H_3D_DIM_DLT
+#if DLT_DIFF_CODING_IN_PPS
+  rDeltaDC1 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC1 + rDeltaDC1) ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 );
+  rDeltaDC2 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC2 + rDeltaDC2) ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 );
+#else
   rDeltaDC1 = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC1 + rDeltaDC1) ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 );
   rDeltaDC2 = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC2 + rDeltaDC2) ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 );
+#endif
 #endif
 }
Index: branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncTop.cpp	(revision 746)
+++ branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncTop.cpp	(revision 748)
@@ -299,4 +299,8 @@
 {
   // initialize SPS
+#if DLT_DIFF_CODING_IN_PPS
+  // Assuming that all PPS indirectly refer to the same VPS via different SPS
+  m_cSPS.setVPS(m_cVPS);
+#endif
   xInitSPS();
   
@@ -870,4 +874,9 @@
   m_cPPS.setSPSId( getLayerIdInVps() );
 #endif
+
+#if DLT_DIFF_CODING_IN_PPS
+  m_cPPS.setDLT( getDLT() );
+#endif
+
   m_cPPS.setConstrainedIntraPred( m_bUseConstrainedIntraPred );
   Bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false;
