Index: branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/ContextTables.h
===================================================================
--- branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/ContextTables.h	(revision 778)
+++ branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/ContextTables.h	(revision 781)
@@ -107,9 +107,17 @@
 
 #if H_3D_DIM
+#if QC_GENERIC_SDC_G0122
+#define NUM_DEPTH_INTRA_MODE_CTX      1       ///< number of context models for depth intra modes
+#else
 #define NUM_DEPTH_INTRA_MODE_CTX      8       ///< number of context models for depth intra modes
+#endif
 #define NUM_DDC_FLAG_CTX              2       ///< number of context models for deltaDC flag (DMM or RBC)
 #define NUM_DDC_DATA_CTX              1       ///< number of context models for deltaDC data (DMM or RBC)
 #if H_3D_DIM_DMM
 #define NUM_DMM1_DATA_CTX             1       ///< number of context models for DMM1 data
+#endif
+#if QC_GENERIC_SDC_G0122
+#define NUM_ANGLE_FLAG_CTX            3
+#define NUM_INTRASDC_FLAG_CTX         3
 #endif
 #endif
@@ -383,4 +391,13 @@
 #endif
 #if H_3D_DIM
+#if QC_GENERIC_SDC_G0122
+static const UChar
+INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] =
+{
+  { 154, },
+  { 154, },
+  { 154, }
+};
+#else
 static const UChar
 INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] =
@@ -390,4 +407,22 @@
     {64, 0, CNU, CNU, 168, 109,   0, 0}
 };
+#endif
+
+#if QC_GENERIC_SDC_G0122
+static const UChar 
+INIT_ANGLE_FLAG[3][NUM_ANGLE_FLAG_CTX] =
+{
+  { 154, 155, 156 },
+  { 141, 185, 214 },
+  { 155, 170, 157 },
+};
+static const UChar 
+INIT_INTRASDC_FLAG[3][NUM_INTRASDC_FLAG_CTX] =
+{
+  { 214, 229, 230 },
+  { 215, 202, 174 },
+  { 213, 201, 246 },
+};
+#endif
 
 static const UChar 
Index: branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp	(revision 778)
+++ branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp	(revision 781)
@@ -2401,4 +2401,40 @@
 #endif
 
+#if QC_GENERIC_SDC_G0122
+UInt TComDataCU::getCtxSDCFlag( UInt uiAbsPartIdx )
+{
+  TComDataCU* pcTempCU;
+  UInt        uiTempPartIdx;
+  UInt        uiCtx = 0;
+
+  // Get BCBP of left PU
+  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
+  uiCtx    = ( pcTempCU && pcTempCU->isIntra( uiTempPartIdx ) ) ? pcTempCU->getSDCFlag( uiTempPartIdx ) : 0;
+
+  // Get BCBP of above PU
+  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
+  uiCtx   += ( pcTempCU && pcTempCU->isIntra( uiTempPartIdx ) ) ? pcTempCU->getSDCFlag( uiTempPartIdx ) : 0;
+
+  return uiCtx;
+}
+
+UInt TComDataCU::getCtxAngleFlag( UInt uiAbsPartIdx )
+{
+  TComDataCU* pcTempCU;
+  UInt        uiTempPartIdx;
+  UInt        uiCtx = 0;
+
+  // Get BCBP of left PU
+  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
+  uiCtx    = ( pcTempCU && pcTempCU->isIntra( uiTempPartIdx ) ) ? ( pcTempCU->getLumaIntraDir( uiTempPartIdx ) < NUM_INTRA_MODE ? 1 : 0 ) : 0;
+
+  // Get BCBP of above PU
+  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
+  uiCtx   += ( pcTempCU && pcTempCU->isIntra( uiTempPartIdx ) ) ? ( pcTempCU->getLumaIntraDir( uiTempPartIdx ) < NUM_INTRA_MODE ? 1 : 0 ) : 0;
+
+  return uiCtx;
+}
+#endif
+
 UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx )
 {
@@ -2627,5 +2663,17 @@
   if( !getSlice()->getIsDepth() || !isIntra(uiAbsPartIdx) || getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N )
     return false;
-  
+#if QC_GENERIC_SDC_G0122
+  if( isDimMode( getLumaIntraDir( uiAbsPartIdx ) ) && !isDimDeltaDC( getLumaIntraDir( uiAbsPartIdx ) ) )
+  {
+    return true;
+  }
+
+  if( getLumaIntraDir( uiAbsPartIdx ) < NUM_INTRA_MODE )
+  {
+    return true;
+  }
+
+  return false;
+#endif
   // check prediction mode
   UInt uiLumaPredMode = getLumaIntraDir( uiAbsPartIdx );  
Index: branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TComDataCU.h	(revision 778)
+++ branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TComDataCU.h	(revision 781)
@@ -571,4 +571,8 @@
   Pel           getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }
   Void          setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }
+#if QC_GENERIC_SDC_G0122
+  UInt          getCtxSDCFlag          ( UInt   uiAbsPartIdx );
+  UInt          getCtxAngleFlag        ( UInt   uiAbsPartIdx );
+#endif
 #endif
 #endif
Index: branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TComPrediction.cpp	(revision 778)
+++ branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TComPrediction.cpp	(revision 781)
@@ -416,5 +416,9 @@
 
 #if H_3D_DIM
-Void TComPrediction::predIntraLumaDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc )
+Void TComPrediction::predIntraLumaDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc
+#if QC_GENERIC_SDC_G0122
+  , TComWedgelet* dmm4Segmentation
+#endif
+  )
 {
   assert( iWidth == iHeight  );
@@ -442,6 +446,19 @@
     case( DMM4_IDX ): 
       {
+#if QC_GENERIC_SDC_G0122
+        if( dmm4Segmentation == NULL )
+        { 
+          dmmSegmentation = new TComWedgelet( iWidth, iHeight );
+          xPredContourFromTex( pcCU, uiAbsPartIdx, iWidth, iHeight, dmmSegmentation );
+        }
+        else
+        {
+          xPredContourFromTex( pcCU, uiAbsPartIdx, iWidth, iHeight, dmm4Segmentation );
+          dmmSegmentation = dmm4Segmentation;
+        }
+#else
         dmmSegmentation = new TComWedgelet( iWidth, iHeight );
         xPredContourFromTex( pcCU, uiAbsPartIdx, iWidth, iHeight, dmmSegmentation );
+#endif
       } break;
     default: assert(0);
@@ -494,5 +511,9 @@
 
 #if H_3D_DIM_DMM
+#if QC_GENERIC_SDC_G0122
+  if( dimType == DMM4_IDX && dmm4Segmentation == NULL ) { dmmSegmentation->destroy(); delete dmmSegmentation; }
+#else
   if( dimType == DMM4_IDX ) { dmmSegmentation->destroy(); delete dmmSegmentation; }
+#endif
 #endif
 }
@@ -2184,5 +2205,10 @@
   Int iSumPix[2];
   memset(iSumPix, 0, sizeof(Int)*2);
-  
+#if QC_GENERIC_SDC_G0122
+  for( Int i = 0; i < uiNumSegments; i++ )
+  {
+    rpSegMeans[i] = 0;
+  }
+#endif
   if (orgDC == false)
   {
@@ -2199,5 +2225,41 @@
       rpSegMeans[ucSegmentRB] = pOrig[uiStride * (uiSize-1) + (uiSize-1) ];
     }
+#if QC_GENERIC_SDC_G0122
+    else if( getDimType( uiIntraMode ) == DMM4_IDX )
+    {
+      Pel *ptmpOrig = pOrig;
+      Bool *ptmpMask = pMask, bBreak = false;
+      UChar ucSegment = ptmpMask? (UChar) ptmpMask[0] : 0;
+      UChar bFirstSeg = ucSegment;
+
+      rpSegMeans[ucSegment] = ptmpOrig[0];
+      for ( Int y = 0; y < uiSize; y++ )
+      {
+        for ( Int x = 0; x < uiSize; x++ )
+        {
+          ucSegment = ptmpMask[x];
+          assert( ucSegment < uiNumSegments );
+
+          if( bFirstSeg != ucSegment )
+          {
+            rpSegMeans[ucSegment] = ptmpOrig[x];
+            bBreak = true;
+            break;
+          }
+        }
+
+        if( bBreak )
+        {
+          break;
+        }
+
+        ptmpOrig  += uiStride;
+        ptmpMask  += uiMaskStride;
+      }
+    }
+    else
+#else
     else if (uiIntraMode == PLANAR_IDX)
+#endif
     {
       Pel* pLeftTop = pOrig;
Index: branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TComPrediction.h	(revision 778)
+++ branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TComPrediction.h	(revision 781)
@@ -167,5 +167,9 @@
 #if H_3D_DIM
   // Depth intra
-  Void predIntraLumaDepth         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc = false );
+  Void predIntraLumaDepth         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc = false 
+#if QC_GENERIC_SDC_G0122
+    , TComWedgelet* dmm4Segmentation = NULL
+#endif
+    );
 #if H_3D_DIM_SDC
   Void analyzeSegmentsSDC         ( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride
Index: branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 778)
+++ branches/HTM-9.3-dev3-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 781)
@@ -235,4 +235,5 @@
 #define H_3D_DELTA_DLT                    1
 #endif
+#define QC_GENERIC_SDC_G0122              1  // Generalize SDC to all depth intra modes
 
 #define H_3D_DIM_ENC                      1   // Depth Intra encoder optimizations, includes:
