Index: branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibCommon/TComDataCU.cpp	(revision 980)
+++ branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibCommon/TComDataCU.cpp	(revision 983)
@@ -60,5 +60,8 @@
   
   m_skipFlag           = NULL;
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  m_singleDepthFlag     = NULL;
+  m_apSingleDepthValue  = NULL;
+#endif  
   m_pePartSize         = NULL;
   m_pePredMode         = NULL;
@@ -182,5 +185,8 @@
 
     m_skipFlag           = new Bool[ uiNumPartition ];
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+    m_singleDepthFlag     = new Bool[ uiNumPartition ];
+    m_apSingleDepthValue  = (Pel*)xMalloc(Pel, uiNumPartition);
+#endif
     m_pePartSize         = new Char[ uiNumPartition ];
     memset( m_pePartSize, SIZE_NONE,uiNumPartition * sizeof( *m_pePartSize ) );
@@ -329,5 +335,8 @@
 
     if ( m_skipFlag           ) { delete[] m_skipFlag;          m_skipFlag          = NULL; }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+    if ( m_singleDepthFlag    ) { delete[] m_singleDepthFlag;   m_singleDepthFlag     = NULL; }
+    if ( m_apSingleDepthValue ) { xFree(m_apSingleDepthValue);  m_apSingleDepthValue  = NULL; }
+#endif
     if ( m_pePartSize         ) { delete[] m_pePartSize;        m_pePartSize        = NULL; }
     if ( m_pePredMode         ) { delete[] m_pePredMode;        m_pePredMode        = NULL; }
@@ -494,4 +503,8 @@
     TComDataCU * pcFrom = pcPic->getCU(getAddr());
     m_skipFlag[ui]   = pcFrom->getSkipFlag(ui);
+#if MTK_SINGLE_DEPTH_MODE_I0095
+    m_singleDepthFlag[ui]    = pcFrom->getSingleDepthFlag(ui);
+    m_apSingleDepthValue[ui] = pcFrom->getSingleDepthValue(ui);
+#endif
     m_pePartSize[ui] = pcFrom->getPartitionSize(ui);
     m_pePredMode[ui] = pcFrom->getPredictionMode(ui);
@@ -550,5 +563,8 @@
   {
     memset( m_skipFlag          + firstElement, false,                    numElements * sizeof( *m_skipFlag ) );
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+    memset( m_singleDepthFlag     + firstElement, false,                  numElements * sizeof( *m_singleDepthFlag ) );
+    memset( m_apSingleDepthValue  + firstElement,     0,                  numElements * sizeof( *m_apSingleDepthValue ) );
+#endif
     memset( m_pePartSize        + firstElement, SIZE_NONE,                numElements * sizeof( *m_pePartSize ) );
     memset( m_pePredMode        + firstElement, MODE_NONE,                numElements * sizeof( *m_pePredMode ) );
@@ -738,4 +754,8 @@
       m_puhTransformSkip[2][ui] = 0;
       m_skipFlag[ui]   = false;
+#if MTK_SINGLE_DEPTH_MODE_I0095
+      m_singleDepthFlag[ui]     = false;
+      m_apSingleDepthValue[ui]  = 0;
+#endif
       m_pePartSize[ui] = SIZE_NONE;
       m_pePredMode[ui] = MODE_NONE;
@@ -913,4 +933,8 @@
   {
     m_skipFlag[ui]   = false;
+#if MTK_SINGLE_DEPTH_MODE_I0095
+    m_singleDepthFlag[ui]   = false;
+    m_apSingleDepthValue[ui]= 0;
+#endif
     m_pePartSize[ui] = SIZE_NONE;
     m_pePredMode[ui] = MODE_NONE;
@@ -934,4 +958,8 @@
       m_puhTransformSkip[2][ui] = pcCU->getTransformSkip(uiPartOffset+ui,TEXT_CHROMA_V);
       m_skipFlag[ui]   = pcCU->getSkipFlag(uiPartOffset+ui);
+#if MTK_SINGLE_DEPTH_MODE_I0095
+      m_singleDepthFlag[ui]    = pcCU->getSingleDepthFlag(uiPartOffset+ui);
+      m_apSingleDepthValue[ui] = pcCU->getSingleDepthValue(uiPartOffset+ui);
+#endif
       m_pePartSize[ui] = pcCU->getPartitionSize(uiPartOffset+ui);
       m_pePredMode[ui] = pcCU->getPredictionMode(uiPartOffset+ui);
@@ -1083,5 +1111,8 @@
   
   m_skipFlag=pcCU->getSkipFlag()          + uiPart;
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  m_singleDepthFlag     = pcCU->getSingleDepthFlag()   + uiPart;
+  m_apSingleDepthValue  = pcCU->getSingleDepthValue()  + uiPart;
+#endif  
   m_phQP=pcCU->getQP()                    + uiPart;
   m_pePartSize = pcCU->getPartitionSize() + uiPart;
@@ -1221,5 +1252,8 @@
   
   m_skipFlag           = pcCU->getSkipFlag ()             + uiAbsPartIdx;
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  m_singleDepthFlag     = pcCU->getSingleDepthFlag ()             + uiAbsPartIdx;
+  m_apSingleDepthValue  = pcCU->getSingleDepthValue ()            + uiAbsPartIdx;
+#endif  
   m_pePartSize         = pcCU->getPartitionSize ()        + uiAbsPartIdx;
 #if H_3D_NBDV
@@ -1297,4 +1331,8 @@
   Int sizeInChar  = sizeof( Char ) * uiNumPartition;
   memcpy( m_skipFlag   + uiOffset, pcCU->getSkipFlag(),       sizeof( *m_skipFlag )   * uiNumPartition );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  memcpy( m_singleDepthFlag     + uiOffset, pcCU->getSingleDepthFlag(),       sizeof( *m_singleDepthFlag )   * uiNumPartition );
+  memcpy( m_apSingleDepthValue  + uiOffset, pcCU->getSingleDepthValue(),      sizeof( *m_apSingleDepthValue ) * uiNumPartition);
+#endif
   memcpy( m_phQP       + uiOffset, pcCU->getQP(),             sizeInChar                        );
   memcpy( m_pePartSize + uiOffset, pcCU->getPartitionSize(),  sizeof( *m_pePartSize ) * uiNumPartition );
@@ -1417,5 +1455,8 @@
 
   memcpy( rpcCU->getSkipFlag() + m_uiAbsIdxInLCU, m_skipFlag, sizeof( *m_skipFlag ) * m_uiNumPartition );
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  memcpy( rpcCU->getSingleDepthFlag()  + m_uiAbsIdxInLCU, m_singleDepthFlag,    sizeof( *m_singleDepthFlag ) * m_uiNumPartition );
+  memcpy( rpcCU->getSingleDepthValue() + m_uiAbsIdxInLCU, m_apSingleDepthValue, sizeof( *m_apSingleDepthValue ) * m_uiNumPartition);
+#endif
   memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, sizeInChar  );
 #if H_3D_NBDV
@@ -1533,5 +1574,8 @@
   Int sizeInChar  = sizeof( Char ) * uiQNumPart;
   memcpy( rpcCU->getSkipFlag()       + uiPartOffset, m_skipFlag,   sizeof( *m_skipFlag )   * uiQNumPart );
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  memcpy( rpcCU->getSingleDepthFlag()  + uiPartOffset, m_singleDepthFlag,    sizeof( *m_singleDepthFlag )   * uiQNumPart );
+  memcpy( rpcCU->getSingleDepthValue() + uiPartOffset, m_apSingleDepthValue, sizeof( *m_apSingleDepthValue ) * uiQNumPart);
+#endif
   memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, sizeInChar );
   memcpy( rpcCU->getPartitionSize()  + uiPartOffset, m_pePartSize, sizeof( *m_pePartSize ) * uiQNumPart );
@@ -2453,5 +2497,16 @@
   memset( m_skipFlag + absPartIdx, skip, m_pcPic->getNumPartInCU() >> ( 2 * depth ) );
 }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+Void TComDataCU::setSingleDepthFlagSubParts( Bool singleDepth, UInt absPartIdx, UInt depth )
+{
+  assert( sizeof( *m_singleDepthFlag) == 1 );
+  memset( m_singleDepthFlag + absPartIdx, singleDepth, m_pcPic->getNumPartInCU() >> ( 2 * depth ) );
+}
+
+Void TComDataCU::setSingleDepthValueSubParts(Pel singleDepthValue, UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth )
+{
+  setSubPartT<Pel>( singleDepthValue, m_apSingleDepthValue, uiAbsPartIdx, uiDepth, uiPUIdx );
+}
+#endif
 Void TComDataCU::setPredModeSubParts( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth )
 {
@@ -6092,4 +6147,61 @@
 }
 #endif
+
+#if MTK_SINGLE_DEPTH_MODE_I0095
+Bool TComDataCU::getNeighDepth (UInt uiPartIdx, UInt uiPartAddr, Pel* pNeighDepth, Int index)
+{
+
+  Bool bDepAvail = false;
+  Pel *pDepth  = this->getPic()->getPicYuvRec()->getLumaAddr();
+  Int iDepStride =  this->getPic()->getPicYuvRec()->getStride();
+
+  Int xP, yP, nPSW, nPSH;
+  this->getPartPosition(uiPartIdx, xP, yP, nPSW, nPSH);
+  UInt PicHeight=this->getPic()->getPicYuvRec()->getHeight();
+  UInt PicWidth=this->getPic()->getPicYuvRec()->getWidth();
+  switch(index)
+  {
+  case 0: // Mid Left
+    if( ( xP != 0 ) && ( ( yP + ( nPSH >> 1 ) ) < PicHeight ) )
+    {
+      *pNeighDepth = pDepth[ (yP+(nPSH>>1)) * iDepStride + (xP-1) ];
+      bDepAvail = true;
+    }
+    break;
+  case 1: // Mid Above
+    if( ( yP != 0 ) && ( ( xP + ( nPSW >> 1 ) ) < PicWidth ) )
+    {
+      *pNeighDepth = pDepth[ (yP-1) * iDepStride + (xP + (nPSW>>1)) ];
+      bDepAvail = true;
+    }
+    break;
+  case 2: // Above
+    if(yP != 0)
+    {
+      *pNeighDepth = pDepth[ (yP-1) * iDepStride + (xP) ];
+      bDepAvail = true;
+    }
+    break;
+  case 3: // Left
+    if(xP != 0)
+    {
+      *pNeighDepth = pDepth[ (yP) * iDepStride + (xP-1) ];
+      bDepAvail = true;
+    }
+    break;
+  case 4: // Above_Left
+    if(xP != 0 && yP != 0)
+    {
+      *pNeighDepth = pDepth[ (yP-1) * iDepStride + (xP-1) ];
+      bDepAvail = true;
+    }
+    break;
+  default:
+      break;
+  }
+  return bDepAvail;
+}
+
+#endif
 #if H_3D_NBDV 
 //Notes from QC:
