Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/ContextTables.h
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/ContextTables.h	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/ContextTables.h	(revision 601)
@@ -112,5 +112,7 @@
 #if H_3D_DIM_DMM
 #define NUM_DMM1_DATA_CTX             1       ///< number of context models for DMM1 data
+#if !SEC_DMM2_E0146
 #define NUM_DMM2_DATA_CTX             1       ///< number of context models for DMM2 data
+#endif
 #define NUM_DMM3_DATA_CTX             1       ///< number of context models for DMM3 data
 #endif
@@ -388,4 +390,13 @@
 #endif
 #if H_3D_DIM
+#if ZJU_DEPTH_INTRA_MODE_E0204
+static const UChar
+INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] =
+{
+    {0,  0,  64, 168, 168, 124, CNU, 0},
+    {0, 64,   0, 183, CNU, 108,   0, 0},
+    {64, 0, CNU, CNU, 168, 109,   0, 0}
+};
+#else
 static const UChar 
 INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] =
@@ -395,4 +406,5 @@
   {64, 0, CNU,   0, CNU,   0,   0, 0}
 };
+#endif
 static const UChar 
 INIT_DDC_FLAG[3][NUM_DDC_FLAG_CTX] =
@@ -417,4 +429,5 @@
   { CNU }, 
 };
+#if !SEC_DMM2_E0146
 static const UChar
 INIT_DMM2_DATA[3][NUM_DMM2_DATA_CTX] = 
@@ -424,4 +437,5 @@
   { CNU }, 
 };
+#endif
 static const UChar
 INIT_DMM3_DATA[3][NUM_DMM3_DATA_CTX] = 
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComDataCU.cpp	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComDataCU.cpp	(revision 601)
@@ -120,5 +120,7 @@
     m_dmmWedgeTabIdx[i] = NULL;
   }
+#if !SEC_DMM2_E0146
   m_dmm2DeltaEnd    = NULL;
+#endif
   m_dmm3IntraTabIdx = NULL;
 #endif
@@ -278,5 +280,7 @@
       m_dmmWedgeTabIdx[i]    = (UInt*)xMalloc(UInt, uiNumPartition);
     }
+#if !SEC_DMM2_E0146
     m_dmm2DeltaEnd    = (Int* )xMalloc(Int,  uiNumPartition);
+#endif
     m_dmm3IntraTabIdx = (UInt*)xMalloc(UInt, uiNumPartition);
 #endif
@@ -415,5 +419,7 @@
       if ( m_dmmWedgeTabIdx[i] ) { xFree( m_dmmWedgeTabIdx[i] ); m_dmmWedgeTabIdx[i] = NULL; }
     }
+#if !SEC_DMM2_E0146
     if ( m_dmm2DeltaEnd    ) { xFree( m_dmm2DeltaEnd    ); m_dmm2DeltaEnd    = NULL; }
+#endif
     if ( m_dmm3IntraTabIdx ) { xFree( m_dmm3IntraTabIdx ); m_dmm3IntraTabIdx = NULL; }
 #endif
@@ -640,5 +646,7 @@
       memset( m_dmmWedgeTabIdx[i] + firstElement, 0,                      numElements * sizeof( *m_dmmWedgeTabIdx[i] ) );
     }
+#if !SEC_DMM2_E0146
     memset( m_dmm2DeltaEnd      + firstElement, 0,                        numElements * sizeof( *m_dmm2DeltaEnd    ) );
+#endif
     memset( m_dmm3IntraTabIdx   + firstElement, 0,                        numElements * sizeof( *m_dmm3IntraTabIdx ) );
 #endif
@@ -821,5 +829,7 @@
         m_dmmWedgeTabIdx[i] [ui] = 0;
       }
+#if !SEC_DMM2_E0146
       m_dmm2DeltaEnd    [ui] = 0;
+#endif
       m_dmm3IntraTabIdx [ui] = 0;
 #endif
@@ -936,5 +946,7 @@
     memset( m_dmmWedgeTabIdx[i], 0, sizeof(UInt) * m_uiNumPartition );
   }
+#if !SEC_DMM2_E0146
   memset( m_dmm2DeltaEnd   , 0, sizeof(Int ) * m_uiNumPartition );
+#endif
   memset( m_dmm3IntraTabIdx, 0, sizeof(UInt) * m_uiNumPartition );
 #endif
@@ -1024,5 +1036,7 @@
         m_dmmWedgeTabIdx[i] [ui] = pcCU->m_dmmWedgeTabIdx[i] [uiPartOffset+ui];
       }
+#if !SEC_DMM2_E0146
       m_dmm2DeltaEnd    [ui] = pcCU->m_dmm2DeltaEnd   [uiPartOffset+ui];
+#endif
       m_dmm3IntraTabIdx [ui] = pcCU->m_dmm3IntraTabIdx[uiPartOffset+ui];
 #endif
@@ -1182,5 +1196,7 @@
     m_dmmWedgeTabIdx[i] = pcCU->getDmmWedgeTabIdx( i ) + uiPart;
   }
+#if !SEC_DMM2_E0146
   m_dmm2DeltaEnd    = pcCU->getDmm2DeltaEnd()    + uiPart;
+#endif
   m_dmm3IntraTabIdx = pcCU->getDmm3IntraTabIdx() + uiPart;
 #endif
@@ -1388,5 +1404,7 @@
     memcpy( m_dmmWedgeTabIdx[i] + uiOffset, pcCU->getDmmWedgeTabIdx( i ), sizeof(UInt) * uiNumPartition );
   }
+#if !SEC_DMM2_E0146
   memcpy( m_dmm2DeltaEnd    + uiOffset, pcCU->getDmm2DeltaEnd()   , sizeof(Int ) * uiNumPartition );
+#endif
   memcpy( m_dmm3IntraTabIdx + uiOffset, pcCU->getDmm3IntraTabIdx(), sizeof(UInt) * uiNumPartition );
 #endif
@@ -1521,5 +1539,7 @@
     memcpy( rpcCU->getDmmWedgeTabIdx( i ) + m_uiAbsIdxInLCU, m_dmmWedgeTabIdx[i], sizeof(UInt) * m_uiNumPartition );
   }
+#if !SEC_DMM2_E0146
   memcpy( rpcCU->getDmm2DeltaEnd()    + m_uiAbsIdxInLCU, m_dmm2DeltaEnd   , sizeof(Int ) * m_uiNumPartition );
+#endif
   memcpy( rpcCU->getDmm3IntraTabIdx() + m_uiAbsIdxInLCU, m_dmm3IntraTabIdx, sizeof(UInt) * m_uiNumPartition );
 #endif
@@ -1638,5 +1658,7 @@
     memcpy( rpcCU->getDmmWedgeTabIdx( i ) + uiPartOffset, m_dmmWedgeTabIdx[i], sizeof(UInt) * uiQNumPart );
   }
+#if !SEC_DMM2_E0146
   memcpy( rpcCU->getDmm2DeltaEnd()    + uiPartOffset, m_dmm2DeltaEnd   , sizeof(Int ) * uiQNumPart );
+#endif
   memcpy( rpcCU->getDmm3IntraTabIdx() + uiPartOffset, m_dmm3IntraTabIdx, sizeof(UInt) * uiQNumPart );
 #endif
@@ -2713,5 +2735,9 @@
   // check prediction mode
   UInt uiLumaPredMode = getLumaIntraDir( uiAbsPartIdx );  
+#if LGE_SDC_REMOVE_DC_E0158
+  if( uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) )
+#else
   if( uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) )
+#endif
     return true;
   
@@ -6380,4 +6406,5 @@
   for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx; }
 }
+#if !SEC_DMM2_E0146
 Void  TComDataCU::setDmm2DeltaEndSubParts( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth )
 {
@@ -6385,4 +6412,5 @@
   for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmm2DeltaEnd[uiAbsPartIdx+ui] = iDelta; }
 }
+#endif
 Void  TComDataCU::setDmm3IntraTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth )
 {
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComDataCU.h	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComDataCU.h	(revision 601)
@@ -211,5 +211,7 @@
 #if H_3D_DIM_DMM
   UInt*         m_dmmWedgeTabIdx[DMM_NUM_TYPE]; 
+#if !SEC_DMM2_E0146
   Int*          m_dmm2DeltaEnd;
+#endif
   UInt*         m_dmm3IntraTabIdx;
 #endif
@@ -553,8 +555,10 @@
   Void  setDmmWedgeTabIdxSubParts     ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth );
 
+#if !SEC_DMM2_E0146
   Int*  getDmm2DeltaEnd               ()                      { return m_dmm2DeltaEnd;        }
   Int   getDmm2DeltaEnd               ( UInt uiIdx )          { return m_dmm2DeltaEnd[uiIdx]; }
   Void  setDmm2DeltaEnd               ( UInt uiIdx, Int iD )  { m_dmm2DeltaEnd[uiIdx] = iD;   }
   Void  setDmm2DeltaEndSubParts       ( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth );
+#endif
 
   UInt* getDmm3IntraTabIdx            ()                      { return m_dmm3IntraTabIdx;        }
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComPrediction.cpp	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComPrediction.cpp	(revision 601)
@@ -456,4 +456,5 @@
         dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]);
       } break;
+#if !SEC_DMM2_E0146
     case( DMM2_IDX ):
       {
@@ -467,4 +468,5 @@
         dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ uiTabIdx ]);
       } break;
+#endif
     case( DMM3_IDX ): 
       {
@@ -2782,5 +2784,9 @@
   {
     UInt dimType =  getDimType( pcTempCU->getLumaIntraDir( uiTempPartIdx ) );
+#if SEC_DMM2_E0146
+    if( DMM1_IDX == dimType || DMM3_IDX == dimType )
+#else
     if( DMM1_IDX == dimType || DMM2_IDX == dimType || DMM3_IDX == dimType )
+#endif
     {
       // get offset between current and reference block
@@ -2807,5 +2813,9 @@
   {
     UInt dimType = getDimType( pcTempCU->getLumaIntraDir( uiTempPartIdx ) );
+#if SEC_DMM2_E0146
+    if( DMM1_IDX == dimType || DMM3_IDX == dimType )
+#else
     if( DMM1_IDX == dimType || DMM2_IDX == dimType || DMM3_IDX == dimType )
+#endif
     {
       // get offset between current and reference block
@@ -2870,5 +2880,11 @@
     iDC += piRefBlkY[k]; 
   }
+
+#if SCU_HS_DMM4_REMOVE_DIV_E0242
+  Int cuMaxLog2Size = g_aucConvertToBit[g_uiMaxCUWidth]+2;
+  iDC = iDC >> (cuMaxLog2Size - pcCU->getDepth(0))*2;
+#else
   iDC /= (uiWidth*uiHeight);
+#endif
   piRefBlkY = cTempYuv.getLumaAddr();
 
@@ -3314,5 +3330,10 @@
 #endif
 #if H_3D_DIM_SDC
-Void TComPrediction::analyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride )
+Void TComPrediction::analyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride
+#if KWU_SDC_SIMPLE_DC_E0117
+                                         ,UInt uiIntraMode
+                                         ,Bool orgDC
+#endif
+                                        )
 {
   Int iSumDepth[2];
@@ -3321,4 +3342,32 @@
   memset(iSumPix, 0, sizeof(Int)*2);
   
+#if KWU_SDC_SIMPLE_DC_E0117
+  if (orgDC == false)
+  {
+    if ( getDimType(uiIntraMode) == DMM1_IDX )
+    {
+      UChar ucSegmentLT = pMask[0];
+      UChar ucSegmentRT = pMask[uiSize-1];
+      UChar ucSegmentLB = pMask[uiMaskStride * (uiSize-1)]; 
+      UChar ucSegmentRB = pMask[uiMaskStride * (uiSize-1) + (uiSize-1)]; 
+
+      rpSegMeans[ucSegmentLT] = pOrig[0];
+      rpSegMeans[ucSegmentRT] = pOrig[uiSize-1];
+      rpSegMeans[ucSegmentLB] = pOrig[uiStride * (uiSize-1) ];
+      rpSegMeans[ucSegmentRB] = pOrig[uiStride * (uiSize-1) + (uiSize-1) ];
+    }
+    else if (uiIntraMode == PLANAR_IDX)
+    {
+      Pel* pLeftTop = pOrig;
+      Pel* pRightTop = pOrig + (uiSize-1);
+      Pel* pLeftBottom = (pOrig+ (uiStride*(uiSize-1)));
+      Pel* pRightBottom = (pOrig+ (uiStride*(uiSize-1)) + (uiSize-1));
+
+      rpSegMeans[0] = (*pLeftTop + *pRightTop + *pLeftBottom + *pRightBottom + 2)>>2;
+    }
+    return;
+  }
+#endif
+
   Int subSamplePix;
   if ( uiSize == 64 || uiSize == 32 )
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComPrediction.h	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComPrediction.h	(revision 601)
@@ -191,5 +191,10 @@
   Void predIntraLumaDepth         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc = false );
 #if H_3D_DIM_SDC
-  Void analyzeSegmentsSDC         ( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride );
+  Void analyzeSegmentsSDC         ( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride
+#if KWU_SDC_SIMPLE_DC_E0117
+                                    ,UInt uiIntraMode 
+                                    ,Bool orgDC=false
+#endif
+    );
 #endif
 #endif
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComRdCost.cpp
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComRdCost.cpp	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComRdCost.cpp	(revision 601)
@@ -483,4 +483,41 @@
 
 }
+
+#if SCU_HS_FAST_DEPTH_INTRA_E0238
+
+UInt TComRdCost::calcVAR (Pel* pi0, Int stride, Int width, Int height, Int cuDepth)
+{ 
+  Int temp = 0;
+
+  for (Int y = 0; y < height; y++)
+  {
+    for (Int x = 0; x < width; x++)
+    {
+      temp += pi0[ y * stride + x ]; 
+    }
+  }
+
+  Int cuMaxLog2Size = g_aucConvertToBit[g_uiMaxCUWidth]+2;
+  
+  if ( width == 4 ) 
+  {
+    cuDepth = cuMaxLog2Size - 2;
+  }
+
+  temp = temp >> (cuMaxLog2Size-cuDepth) * 2;
+
+  UInt sum = 0;
+  for (Int y = 0; y < height; y++)
+  {
+    for (Int x = 0; x <  width; x++)
+    {
+      sum += (pi0[ y * stride + x ] - temp ) * (pi0[ y * stride + x ] - temp );
+    }
+  }
+  return (sum >> (cuMaxLog2Size-cuDepth)*2);
+
+}
+#endif
+
 
 #if WEIGHTED_CHROMA_DISTORTION
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComRdCost.h
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComRdCost.h	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComRdCost.h	(revision 601)
@@ -235,4 +235,7 @@
   UInt    calcHAD(Int bitDepth, Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight );
   
+#if SCU_HS_FAST_DEPTH_INTRA_E0238
+  UInt    calcVAR(Pel* pi0, Int stride, Int width, Int height, Int cuDepth);
+#endif  
   // for motion cost
 #if !FIX203
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComRom.cpp	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComRom.cpp	(revision 601)
@@ -347,7 +347,13 @@
 { //2x2   4x4   8x8 16x16 32x32 64x64
      0,    7,   10,   11,   11,   13 };
+#if LGE_PKU_DMM3_OVERLAP_E0159
+const UChar g_dmm3IntraTabIdxBits[6] =
+{ //2x2   4x4   8x8 16x16 32x32 64x64
+     0,    4,    7,    8,    8,    0 };
+#else
 const UChar g_dmm3IntraTabIdxBits[6] =
 { //2x2   4x4   8x8 16x16 32x32 64x64
      0,    6,    9,    9,    9,    0 };
+#endif
 
 extern std::vector< std::vector<TComWedgelet> >   g_dmmWedgeLists;
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComWedgelet.h
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComWedgelet.h	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComWedgelet.h	(revision 601)
@@ -50,4 +50,10 @@
 enum DIM_IDX
 {
+#if SEC_DMM2_E0146
+  DMM1_IDX = 0,
+  DMM3_IDX = 1,
+  DMM4_IDX = 2,
+  RBC_IDX  = 3
+#else
   DMM1_IDX = 0,
   DMM2_IDX = 3,
@@ -55,6 +61,11 @@
   DMM4_IDX = 2,
   RBC_IDX  = 4
+#endif
 };
+#if SEC_DMM2_E0146
+#define DMM_NUM_TYPE   3
+#else
 #define DMM_NUM_TYPE   4
+#endif
 #define RBC_NUM_TYPE   1
 #define DIM_NUM_TYPE   (DMM_NUM_TYPE+RBC_NUM_TYPE)
@@ -75,5 +86,7 @@
 #define DMM_NO_WEDGEINDEX       MAX_UINT
 #define DMM_NUM_WEDGE_REFINES   8
+#if !SEC_DMM2_E0146
 #define DMM2_DELTAEND_MAX       4
+#endif
 #define DMM3_SIMPLIFY_TR        1
 
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 601)
@@ -214,4 +214,8 @@
 #if H_3D_DIM
 #define H_3D_DIM_DMM                      1   // Depth Modeling Modes
+#if H_3D_DIM
+#define SEC_DMM2_E0146                    1   // Removal of DMM2 from DMMs
+#define ZJU_DEPTH_INTRA_MODE_E0204        1   // Simplified Binarization for depth_intra_mode
+#endif
 #define H_3D_DIM_RBC                      1   // Region Boundary Chain mode
 #define H_3D_DIM_SDC                      1   // Simplified Depth Coding method
@@ -220,4 +224,13 @@
                                               // HHI_DEPTH_INTRA_SEARCH_RAU_C0160
                                               // LG_ZEROINTRADEPTHRESI_A0087
+#define KWU_SDC_SIMPLE_DC_E0117           1   // Simplified DC calculation for SDC
+#define SCU_HS_DMM4_REMOVE_DIV_E0242      1   // DMM4 Division Removal
+#define SCU_HS_FAST_DEPTH_INTRA_E0238     1   // Fast DMM and RBC Mode Selection
+#if H_3D_DIM_SDC
+#define LGE_SDC_REMOVE_DC_E0158           1   // Removal of DC mode from SDC
+#endif
+#if H_3D_DIM_DMM
+#define LGE_PKU_DMM3_OVERLAP_E0159        1   // Removal of overlap between DMM3 and DMM1
+#endif
 #endif
 
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 601)
@@ -874,5 +874,9 @@
   // get DC prediction for each segment
   Pel apDCPredValues[2];
+#if KWU_SDC_SIMPLE_DC_E0117
+  m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode);
+#else
   m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride);
+#endif
   
   // reconstruct residual based on mask + DC residuals
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 601)
@@ -89,5 +89,7 @@
 #if H_3D_DIM_DMM
 , m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
+#if !SEC_DMM2_E0146
 , m_cDmm2DataSCModel          ( 1,             1,               NUM_DMM2_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
+#endif
 , m_cDmm3DataSCModel          ( 1,             1,               NUM_DMM3_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
 #endif
@@ -177,5 +179,7 @@
 #if H_3D_DIM_DMM
   m_cDmm1DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM1_DATA );
+#if !SEC_DMM2_E0146
   m_cDmm2DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM2_DATA );
+#endif
   m_cDmm3DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM3_DATA );
 #endif
@@ -251,5 +255,7 @@
 #if H_3D_DIM_DMM
   m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
+#if !SEC_DMM2_E0146
   m_cDmm2DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM2_DATA );
+#endif
   m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
 #endif
@@ -438,4 +444,5 @@
   ruiTabIdx = uiIdx;
 }
+#if !SEC_DMM2_E0146
 Void TDecSbac::xParseDmm2Offset( Int& riOffset )
 {
@@ -463,4 +470,5 @@
   riOffset = iDeltaEnd;
 }
+#endif
 Void TDecSbac::xParseDmm3WedgeIdx( UInt& ruiIntraIdx, Int iNumBit )
 {
@@ -1154,4 +1162,5 @@
       pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, absPartIdx, depth );
     } break;
+#if !SEC_DMM2_E0146
   case( DMM2_IDX ):
     {
@@ -1160,4 +1169,5 @@
       pcCU->setDmm2DeltaEndSubParts( iOffset, absPartIdx, depth );
     } break;
+#endif
   case( DMM3_IDX ):
     {
@@ -1227,5 +1237,7 @@
   if( puIdx == 2 )
   {
+#if !LGE_SDC_REMOVE_DC_E0158
     while( binNum < 2 && symbol )
+#endif
     {
       ctxDepthMode = puIdx*3 + binNum;
@@ -1235,6 +1247,10 @@
     }
          if( modeCode == 0 ) { dir = PLANAR_IDX; sdcFlag = 1;}
+#if LGE_SDC_REMOVE_DC_E0158
+    else if( modeCode == 1 ) { dir = 0;          sdcFlag = 0;}
+#else
     else if( modeCode == 2 ) { dir = 0;          sdcFlag = 0;}
     else if( modeCode == 3 ) { dir =     DC_IDX; sdcFlag = 1;}
+#endif
   }
   else if( puIdx == 0 )
@@ -1254,4 +1270,37 @@
   else
   {
+#if ZJU_DEPTH_INTRA_MODE_E0204
+      UInt maxBinNum = 0;
+      m_pcTDecBinIf->decodeBinEP(symbol);
+      if( symbol == 1 )
+      {
+          maxBinNum = 3;
+      }
+      else
+      {
+          maxBinNum = 2;
+          symbol = 1;
+      }
+      while( binNum<maxBinNum && symbol )
+      {
+          ctxDepthMode = puIdx*3 + ( binNum >= 2 ? 2 : binNum );
+          m_pcTDecBinIf->decodeBin(symbol,m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode));
+          modeCode = (modeCode<<1)+symbol;
+          binNum++;
+      }
+      if( maxBinNum == 3 )
+      {
+          if ( modeCode == 0 )       { dir =  PLANAR_IDX;             sdcFlag = 1;}
+          else if ( modeCode == 2 )  { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
+          else if ( modeCode == 6 )  { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;}
+          else if ( modeCode == 7 )  { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
+      }
+      else
+      {
+          if ( modeCode == 0 )       { dir = 5;                       sdcFlag = 0;}
+          else if ( modeCode == 2 )  { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 1;}
+          else if ( modeCode == 3 )  { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;}
+      }
+#else
     ctxDepthMode = puIdx*3 ;
     m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
@@ -1283,5 +1332,15 @@
       {
         binNum = 0;
+#if LGE_SDC_REMOVE_DC_E0158
+#if !SEC_DMM2_E0146
+        while( symbol && binNum < 2 )
+#endif
+#else
+#if SEC_DMM2_E0146
+        while( symbol && binNum < 2 )
+#else
         while( symbol && binNum < 3 )
+#endif
+#endif
         {
           ctxDepthMode = puIdx*3 + 2;
@@ -1298,7 +1357,21 @@
     else if( modeCode == 5  ) { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;}
     else if( modeCode == 6  ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;}
+#if LGE_SDC_REMOVE_DC_E0158
+#if SEC_DMM2_E0146
+    else if( modeCode == 7 )  { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
+#else
+    else if( modeCode == 14 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
+    else if( modeCode == 15 ) { dir = (2*DMM2_IDX+DIM_OFFSET); sdcFlag = 0;}
+#endif
+#else
     else if( modeCode == 14 ) { dir =      DC_IDX;             sdcFlag = 1;}
+#if SEC_DMM2_E0146
+    else if( modeCode == 15 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
+#else
     else if( modeCode == 30 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
     else if( modeCode == 31 ) { dir = (2*DMM2_IDX+DIM_OFFSET); sdcFlag = 0;}
+#endif
+#endif
+#endif
   }
   pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth );
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibDecoder/TDecSbac.h	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibDecoder/TDecSbac.h	(revision 601)
@@ -102,5 +102,7 @@
 #if H_3D_DIM_DMM
   Void  xParseDmm1WedgeIdx   ( UInt& ruiTabIdx, Int iNumBit );
+#if !SEC_DMM2_E0146
   Void  xParseDmm2Offset     ( Int& riOffset );
+#endif
   Void  xParseDmm3WedgeIdx   ( UInt& ruiIntraIdx, Int iNumBit );
 #endif
@@ -214,5 +216,7 @@
 #if H_3D_DIM_DMM
   ContextModel3DBuffer m_cDmm1DataSCModel;
+#if !SEC_DMM2_E0146
   ContextModel3DBuffer m_cDmm2DataSCModel;
+#endif
   ContextModel3DBuffer m_cDmm3DataSCModel;
 #endif
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 601)
@@ -95,5 +95,7 @@
 #if H_3D_DIM_DMM
 , m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
+#if !SEC_DMM2_E0146
 , m_cDmm2DataSCModel          ( 1,             1,               NUM_DMM2_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
+#endif
 , m_cDmm3DataSCModel          ( 1,             1,               NUM_DMM3_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
 #endif
@@ -175,5 +177,7 @@
 #if H_3D_DIM_DMM
   m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
+#if !SEC_DMM2_E0146
   m_cDmm2DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM2_DATA );
+#endif
   m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
 #endif
@@ -264,5 +268,7 @@
 #if H_3D_DIM_DMM
       curCost += m_cDmm1DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM1_DATA );
+#if !SEC_DMM2_E0146
       curCost += m_cDmm2DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM2_DATA );
+#endif
       curCost += m_cDmm3DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM3_DATA );
 #endif
@@ -334,5 +340,7 @@
 #if H_3D_DIM_DMM
   m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
+#if !SEC_DMM2_E0146
   m_cDmm2DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM2_DATA );
+#endif
   m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
 #endif
@@ -541,4 +549,5 @@
 }
 
+#if !SEC_DMM2_E0146
 Void TEncSbac::xCodeDmm2Offset( Int iOffset )
 {
@@ -557,4 +566,5 @@
   }
 }
+#endif
 
 Void TEncSbac::xCodeDmm3WedgeIdx( UInt uiIntraIdx, Int iNumBit )
@@ -1216,8 +1226,10 @@
       xCodeDmm1WedgeIdx( pcCU->getDmmWedgeTabIdx( dimType, absPartIdx ), g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );
     } break;
+#if !SEC_DMM2_E0146
   case( DMM2_IDX ):
     {
       xCodeDmm2Offset( pcCU->getDmm2DeltaEnd( absPartIdx ) );
     } break;
+#endif
   case( DMM3_IDX ):
     {
@@ -1268,6 +1280,26 @@
 Void TEncSbac::codeIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx )
 {
+#if ZJU_DEPTH_INTRA_MODE_E0204
+    UInt codeWordTable[3][7] =    {{0, 0, 0, 2, 0,6, 7},{0, 0, 2, 7, 3, 6, 2},{0, 1, 0, 0, 0, 0, 0}};
+    UInt codeWordLenTable[3][7] = {{0, 1, 0, 2, 0,3, 3},{1, 1, 2, 3, 2, 3, 2},{1, 1, 0, 0, 0, 0, 0}};
+#else
+#if LGE_SDC_REMOVE_DC_E0158
+#if SEC_DMM2_E0146
+  UInt codeWordTable[3][7] =    {{0, 0, 0, 2, 0,6, 7},{0, 2, 3, 4, 5, 6, 7},{0, 1, 0, 0, 0, 0, 0}};
+  UInt codeWordLenTable[3][7] = {{0, 1, 0, 2, 0,3, 3},{2, 3, 3, 3, 3, 3, 3},{1, 1, 0, 0, 0, 0, 0}};
+#else
+  UInt codeWordTable[3][8] =    { { 0, 0, 0, 2, 0, 6, 0, 7 }, { 0, 2, 3, 4, 5, 6, 15, 14 }, { 0, 1, 0, 0, 0, 0, 0, 0 } };
+  UInt codeWordLenTable[3][8] = { { 0, 1, 0, 2, 0, 3, 0, 3 }, { 2, 3, 3, 3, 3, 3,  4,  4 }, { 1, 1, 0, 0, 0, 0, 0, 0 } };
+#endif
+#else
+#if SEC_DMM2_E0146
+  UInt codeWordTable[3][8] =    {{0, 0, 0, 2, 0,6, 0, 7},{0, 2, 3, 4, 5, 6, 14, 15},{0, 2, 0, 0, 0, 0, 3, 0}};
+  UInt codeWordLenTable[3][8] = {{0, 1, 0, 2, 0,3, 0, 3},{2, 3, 3, 3, 3, 3,  4,  4},{1, 2, 0, 0, 0, 0, 2, 0}};
+#else
   UInt codeWordTable[3][9] =    {{0, 0, 0, 2, 0,6, 0, 0, 7},{0, 2, 3, 4, 5, 6, 14, 31, 30},{0, 2, 0, 0, 0, 0, 3, 0, 0}};
   UInt codeWordLenTable[3][9] = {{0, 1, 0, 2, 0,3, 0, 0, 3},{2, 3, 3, 3, 3, 3,  4,  5,  5},{1, 2, 0, 0, 0, 0, 2, 0, 0}};
+#endif
+#endif
+#endif
   UInt dir = pcCU->getLumaIntraDir( absPartIdx );
   UInt puIdx = (pcCU->getWidth(absPartIdx) == 64) ? 2 : ( (pcCU->getPartitionSize(absPartIdx) == SIZE_NxN && pcCU->getWidth(absPartIdx) == 8) ? 0 : 1 );
@@ -1285,6 +1317,19 @@
     case DMM4_IDX: codeIdx = 4; break;
     case DMM3_IDX: codeIdx = 5; break;
+#if LGE_SDC_REMOVE_DC_E0158
+#if SEC_DMM2_E0146
+    case  RBC_IDX: codeIdx = 6; break;
+#else
+    case DMM2_IDX: codeIdx = 6; break;
+    case  RBC_IDX: codeIdx = 7; break;
+#endif
+#else
+#if SEC_DMM2_E0146
+    case  RBC_IDX: codeIdx = 7; break;
+#else
     case DMM2_IDX: codeIdx = 7; break;
     case  RBC_IDX: codeIdx = 8; break;
+#endif
+#endif
     default:                    break;
     }
@@ -1297,7 +1342,22 @@
     {
       case PLANAR_IDX:  codeIdx = 0; break;
+#if !LGE_SDC_REMOVE_DC_E0158
       case DC_IDX:      codeIdx = 6; break;
+#endif
       default:          codeIdx = 2; break;
     }
+  }
+#endif
+#if ZJU_DEPTH_INTRA_MODE_E0204
+  if( puIdx==1 )
+  {
+      if( codeIdx==1 || codeIdx==2 || codeIdx==4 )
+      {
+          m_pcBinIf->encodeBinEP( 0 );
+      }
+      else
+      {
+          m_pcBinIf->encodeBinEP( 1 );
+      }
   }
 #endif
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibEncoder/TEncSbac.h
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibEncoder/TEncSbac.h	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibEncoder/TEncSbac.h	(revision 601)
@@ -121,5 +121,7 @@
 #if H_3D_DIM_DMM
   Void  xCodeDmm1WedgeIdx    ( UInt uiTabIdx, Int iNumBit );
+#if !SEC_DMM2_E0146
   Void  xCodeDmm2Offset      ( Int iOffset );
+#endif
   Void  xCodeDmm3WedgeIdx    ( UInt uiIntraIdx, Int iNumBit );
 #endif
@@ -254,5 +256,7 @@
 #if H_3D_DIM_DMM
   ContextModel3DBuffer m_cDmm1DataSCModel;
+#if !SEC_DMM2_E0146
   ContextModel3DBuffer m_cDmm2DataSCModel;
+#endif
   ContextModel3DBuffer m_cDmm3DataSCModel;
 #endif
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 601)
@@ -1900,9 +1900,17 @@
   // get DC prediction for each segment
   Pel apDCPredValues[2];
+#if KWU_SDC_SIMPLE_DC_E0117
+  analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode );
+#else
   analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride );
+#endif
   
   // get original DC for each segment
   Pel apDCOrigValues[2];
+#if KWU_SDC_SIMPLE_DC_E0117
+  analyzeSegmentsSDC(piOrg, uiStride, uiWidth, apDCOrigValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode, true );
+#else
   analyzeSegmentsSDC(piOrg, uiStride, uiWidth, apDCOrigValues, uiNumSegments, pbMask, uiMaskStride );
+#endif
   
   for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
@@ -2842,6 +2850,18 @@
     if( m_pcEncCfg->getIsDepth() && uiWidth >= DIM_MIN_SIZE && uiWidth <= DIM_MAX_SIZE && uiWidth == uiHeight )
     {
+
+#if SCU_HS_FAST_DEPTH_INTRA_E0238
+      Int  threshold    = max(((pcCU->getQP(0))>>3)-1,3);
+      Int  varThreshold = (Int)( threshold * threshold - 8 );
+      UInt varCU      = m_pcRdCost->calcVAR(piOrg, uiStride, uiWidth,uiHeight,pcCU->getDepth(0));
+#endif
+
+
 #if H_3D_DIM_DMM
-      if( m_pcEncCfg->getUseDMM() )
+      if( m_pcEncCfg->getUseDMM()
+#if SCU_HS_FAST_DEPTH_INTRA_E0238
+         && (uiRdModeList[0] != 0 || varCU >= varThreshold)
+#endif
+        )
       {
         for( UInt dmmType = 0; dmmType < DMM_NUM_TYPE; dmmType++ )
@@ -2858,4 +2878,5 @@
               biSegmentation = &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]);
             } break;
+#if !SEC_DMM2_E0146
           case( DMM2_IDX ):
             {
@@ -2869,6 +2890,16 @@
               }
             } break;
+#endif
           case( DMM3_IDX ):
             {
+#if LGE_PKU_DMM3_OVERLAP_E0159
+              TComPic*      pcPicTex = pcCU->getSlice()->getTexturePic();
+              TComDataCU* pcColTexCU = pcPicTex->getCU( pcCU->getAddr() );
+              UInt      uiTexPartIdx = pcCU->getZorderIdxInCU() + uiPartOffset;
+              Int   uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255;
+
+              if( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 )
+              {
+#endif
               UInt uiIntraTabIdx = 0;
               xSearchDmm3Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx, uiIntraTabIdx );
@@ -2876,4 +2907,7 @@
               pcCU->setDmm3IntraTabIdxSubParts( uiIntraTabIdx, uiPartOffset, uiDepth + uiInitTrDepth );
               biSegmentation = &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]);
+#if LGE_PKU_DMM3_OVERLAP_E0159
+              }
+#endif
             } break;
           case( DMM4_IDX ):
@@ -2903,5 +2937,9 @@
 #endif
 #if H_3D_DIM_RBC
-      if( m_pcEncCfg->getUseRBC() )
+      if( m_pcEncCfg->getUseRBC()
+#if SCU_HS_FAST_DEPTH_INTRA_E0238
+          && (uiRdModeList[0] != 0 || varCU >= varThreshold)
+#endif
+        )
       {
         if( xSearchRbcEdge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight ) )
@@ -7323,4 +7361,5 @@
 }
 
+#if !SEC_DMM2_E0146
 Void TEncSearch::xSearchDmm2Wedge( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd )
 {
@@ -7388,4 +7427,5 @@
   return;
 }
+#endif
 
 Void TEncSearch::xSearchDmm3Wedge( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, UInt& ruiIntraTabIdx )
Index: /branches/HTM-DEV-2.0-dev0/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- /branches/HTM-DEV-2.0-dev0/source/Lib/TLibEncoder/TEncSearch.h	(revision 600)
+++ /branches/HTM-DEV-2.0-dev0/source/Lib/TLibEncoder/TEncSearch.h	(revision 601)
@@ -352,5 +352,7 @@
   Void xSearchDmmDeltaDCs         ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 );
   Void xSearchDmm1Wedge           ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx );
+#if !SEC_DMM2_E0146
   Void xSearchDmm2Wedge           ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd );
+#endif
   Void xSearchDmm3Wedge           ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, UInt& ruiIntraTabIdx );
 #endif
