Index: trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 976)
+++ trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1039)
@@ -887,4 +887,5 @@
 {
 #if H_3D_QTLPC
+#if !MTK_I0099_VPS_EX2
 //GT: This has to go to VPS
 if( depthFlag )
@@ -893,4 +894,5 @@
   WRITE_FLAG( pcSPS->getUsePC()  ? 1 : 0, "use_pc_flag");
 }
+#endif
 #endif
 }
@@ -1558,12 +1560,27 @@
 Void TEncCavlc::codeVPSExtension2( TComVPS* pcVPS )
 { 
+#if SEC_VPS_CLEANUP_I0090
+  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
+#else
   for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ )
-  {
+#endif
+  {
+#if !SEC_VPS_CLEANUP_I0090
     if (i!= 0)
-    {
+#endif
+    {
+#if MTK_I0099_VPS_EX2
+      WRITE_FLAG( pcVPS->getIvMvPredFlag         ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");
+#if SEC_HLS_CLEANUP_I0100
+      WRITE_FLAG( pcVPS->getIvMvScalingFlag( i ) ? 1 : 0 ,       "iv_mv_scaling_flag[i]" );
+#endif
+
+#endif
       if ( !( pcVPS->getDepthId( i ) == 1 ) )
       {
 #if H_3D_IV_MERGE
+#if !MTK_I0099_VPS_EX2
         WRITE_FLAG( pcVPS->getIvMvPredFlag         ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");
+#endif
 #if H_3D_SPIVMP
         WRITE_UVLC( pcVPS->getSubPULog2Size(i)-3, "log2_sub_PU_size_minus3[i]");
@@ -1585,4 +1602,5 @@
       else
       {
+#if !MTK_I0099_VPS_EX2
         if(i!=1)
         {
@@ -1595,9 +1613,19 @@
         }
 #endif
+#endif
 #if H_3D_IV_MERGE
         WRITE_FLAG( pcVPS->getMPIFlag( i ) ? 1 : 0 ,          "mpi_flag[i]" );
 #endif
+#if MTK_I0099_VPS_EX2
+        WRITE_UVLC( pcVPS->getSubPUMPILog2Size(i)-3, "log2_mpi_sub_PU_size_minus3[i]");
+#endif
         WRITE_FLAG( pcVPS->getVpsDepthModesFlag( i ) ? 1 : 0 ,          "vps_depth_modes_flag[i]" );
-        //WRITE_FLAG( pcVPS->getLimQtPredFlag    ( i ) ? 1 : 0 ,          "lim_qt_pred_flag[i]"     ); 
+#if SEPARATE_FLAG_I0085
+        WRITE_FLAG( pcVPS->getIVPFlag( i ) ? 1 : 0 ,               "IVP_flag[i]" );
+#endif
+#if MTK_I0099_VPS_EX2
+        WRITE_FLAG( pcVPS->getLimQtPredFlag    ( i ) ? 1 : 0 ,          "lim_qt_pred_flag[i]"     ); 
+#endif
+
 #if H_3D_INTER_SDC
         WRITE_FLAG( pcVPS->getInterSDCFlag( i ) ? 1 : 0, "depth_inter_SDC_flag" );
@@ -1607,5 +1635,9 @@
   }
   WRITE_UVLC( pcVPS->getCamParPrecision(), "cp_precision" );
+#if SEC_VPS_CLEANUP_I0090
+  for (UInt viewIndex=1; viewIndex<pcVPS->getNumViews(); viewIndex++)
+#else
   for (UInt viewIndex=0; viewIndex<pcVPS->getNumViews(); viewIndex++)
+#endif
   {
     WRITE_FLAG( pcVPS->getCamParPresent(viewIndex) ? 1 : 0, "cp_present_flag[i]" );
@@ -1625,7 +1657,11 @@
     }
   }
+#if !MTK_I0099_VPS_EX2
   WRITE_UVLC( pcVPS->getSubPUMPILog2Size( ) - 3, "log2_sub_PU_MPI_size_minus3");
+#endif
 #if H_3D_TMVP
+#if !SEC_HLS_CLEANUP_I0100
   WRITE_FLAG( pcVPS->getIvMvScalingFlag( ) ? 1 : 0 ,          "iv_mv_scaling_flag" );
+#endif
 #endif
 }
@@ -2013,5 +2049,9 @@
     }
 #if H_3D_IC
+#if SEC_HLS_CLEANUP_I0100
+    else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) && !pcSlice->getIsDepth() && vps->getNumDirectRefLayers( layerId ) > 0 )
+#else
     else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) && !pcSlice->getIsDepth())
+#endif
     {
       WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "slice_ic_enable_flag" );
@@ -2022,5 +2062,10 @@
     }
 #endif
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+    if(pcSlice->getIsDepth())
+    {
+      WRITE_FLAG( pcSlice->getApplySingleDepthMode() ? 1 : 0, "slice_enable_single_depth_mode" );
+    }
+#endif
 #if H_3D_IV_MERGE
     assert(pcSlice->getMaxNumMergeCand()<=MRG_MAX_NUM_CANDS_MEM);
@@ -2408,5 +2453,10 @@
   assert(0);
 }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+Void TEncCavlc::codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx )
+{
+  assert(0);
+}
+#endif
 Void TEncCavlc::codeSplitFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
 {
Index: trunk/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 976)
+++ trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 1039)
@@ -123,4 +123,7 @@
   Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx );
   Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Void codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx );
+#endif
   Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
   Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
Index: trunk/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 976)
+++ trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 1039)
@@ -414,13 +414,23 @@
 #if H_3D_DIM
   Bool      m_useDMM;
+#if SEPARATE_FLAG_I0085
+  Bool      m_useIVP;
+#endif
   Bool      m_useSDC;
   Bool      m_useDLT;
 #endif
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Bool      m_useSingleDepthMode;
+#endif
 #if H_3D_IV_MERGE
   Bool      m_useMPI;
 #endif
+#if !MTK_I0099_VPS_EX2 || MTK_I0099_FIX
 #if H_3D_QTLPC
   Bool      m_bUseQTL;
+#if !MTK_I0099_VPS_EX2
   Bool      m_bUsePC;
+#endif
+#endif
 #endif
 #endif
@@ -1003,4 +1013,8 @@
   Bool      getUseDMM                       ()        { return m_useDMM; }
   Void      setUseDMM                       ( Bool b) { m_useDMM = b;    }
+#if SEPARATE_FLAG_I0085
+  Bool      getUseIVP                       ()        { return m_useIVP; }
+  Void      setUseIVP                       ( Bool b) { m_useIVP = b;    }
+#endif
   Bool      getUseSDC                       ()        { return m_useSDC; }
   Void      setUseSDC                       ( Bool b) { m_useSDC = b;    }
@@ -1008,9 +1022,17 @@
   Void      setUseDLT                       ( Bool b) { m_useDLT = b;    }
 #endif
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Void       setUseSingleDepthMode          ( Bool bVal )    { m_useSingleDepthMode = bVal; }
+  Bool       getUseSingleDepthMode          ()               { return m_useSingleDepthMode; }
+#endif
+#if !MTK_I0099_VPS_EX2 || MTK_I0099_FIX
 #if H_3D_QTLPC
   Void      setUseQTL                       ( Bool b ) { m_bUseQTL = b;    }
   Bool      getUseQTL                       ()         { return m_bUseQTL; }
+#if !MTK_I0099_VPS_EX2
   Void      setUsePC                        ( Bool b ) { m_bUsePC  = b;    }
   Bool      getUsePC                        ()         { return m_bUsePC;  }
+#endif
+#endif
 #endif
 #if H_3D_IV_MERGE
Index: trunk/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 976)
+++ trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1039)
@@ -409,5 +409,10 @@
 
 #if H_3D_QTLPC
+#if MTK_I0099_VPS_EX2
+  TComVPS *vps            = pcPic->getSlice(0)->getVPS();
+  Bool  bLimQtPredFalg    = vps->getLimQtPredFlag(pcPic->getSlice(0)->getLayerId()); 
+#else
   TComSPS *sps            = pcPic->getSlice(0)->getSPS();
+#endif
   TComPic *pcTexture      = rpcBestCU->getSlice()->getTexturePic();
 
@@ -531,5 +536,13 @@
       //logic for setting bTrySplit using the partition information that is stored of the texture colocated CU
 
+#if MTK_I0099_VPS_EX2
+#if MTK_I0099_FIX
+      if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg ))
+#else
+      if(depthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFalg)
+#endif
+#else
       if(depthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL())
+#endif
       {
         TComDataCU* pcTextureCU = pcTexture->getCU( rpcBestCU->getAddr() ); //Corresponding texture LCU
@@ -685,5 +698,13 @@
 
 #if H_3D_QTLPC      
+#if MTK_I0099_VPS_EX2
+#if MTK_I0099_FIX
+      if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg ))
+#else
+      if(depthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFalg)
+#endif
+#else
       if(depthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL())
+#endif
       {
         bTrySplitDQP = bTrySplit;
@@ -709,5 +730,12 @@
     }
 #endif
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+    rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP  );
+    if(rpcBestCU->getSlice()->getApplySingleDepthMode())
+    {
+      xCheckRDCostSingleDepth( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
+      rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP  );
+    }
+#endif
     if(!earlyDetectionSkipMode)
     {
@@ -1021,13 +1049,31 @@
           // speedup for inter frames
           if( rpcBestCU->getSlice()->getSliceType() == I_SLICE || 
-            rpcBestCU->getCbf( 0, TEXT_LUMA     ) != 0   ||
-            rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) != 0   ||
+              rpcBestCU->getCbf( 0, TEXT_LUMA     ) != 0   ||
+              rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) != 0   ||
               rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) != 0     
 #if H_3D_DIM_ENC
+#if HHI_DMM4_ENC_I0066
+              || rpcBestCU->getSlice()->getIsDepth()
+#else
             || ( rpcBestCU->getSlice()->getIsDepth() && rpcBestCU->getSlice()->isIRAP() )
+#endif
 #endif
             ) // avoid very complex intra if it is unlikely
           {
+#if HHI_DMM4_ENC_I0066
+            Bool bOnlyIVP = false;
+            if( rpcBestCU->getSlice()->getIsDepth() && !(rpcBestCU->getSlice()->isIRAP()) && 
+                rpcBestCU->getSlice()->getSliceType() != I_SLICE && 
+                rpcBestCU->getCbf( 0, TEXT_LUMA     ) == 0 &&
+                rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) == 0 &&
+                rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) == 0 
+              )
+            { 
+              bOnlyIVP = true;
+            }
+            xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bOnlyIVP );
+#else
             xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
+#endif
 
 #if KWU_RC_MADPRED_E0227
@@ -1048,5 +1094,9 @@
                 if( rpcTempCU->getWidth(0) > ( 1 << rpcTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) )
                 {
+#if HHI_DMM4_ENC_I0066
+                  xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN, bOnlyIVP );
+#else
                   xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN   );
+#endif
                   rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
                 }
@@ -1536,4 +1586,9 @@
     return;
   }
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  m_pcEntropyCoder->encodeSingleDepthMode( pcCU, uiAbsPartIdx );
+  if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))
+  {
+#endif
   m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx );
   
@@ -1568,5 +1623,7 @@
   m_pcEntropyCoder->encodeCoeff( pcCU, uiAbsPartIdx, uiDepth, pcCU->getWidth (uiAbsPartIdx), pcCU->getHeight(uiAbsPartIdx), bCodeDQP );
   setdQPFlag( bCodeDQP );
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  }
+#endif
   // --- write terminating bit ---
   finishCU(pcCU,uiAbsPartIdx,uiDepth);
@@ -1802,5 +1859,7 @@
     Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
     memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
+#if !FIX_TICKET_79
     InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
+#endif
 #if H_3D_SPIVMP
     Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
@@ -1815,5 +1874,7 @@
     rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
+#if !FIX_TICKET_79
       , inheritedVSPDisInfo
+#endif
 #if H_3D_SPIVMP
       , pcMvFieldSP, puhInterDirSP
@@ -1830,6 +1891,11 @@
 
 #else
+#if FIX_TICKET_79
+    rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, numValidMergeCand );
+#else
     rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
 #endif
+#endif
+
 
 #endif
@@ -1872,5 +1938,7 @@
 #if H_3D_VSP
           rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth );
+#if !FIX_TICKET_79
           rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth );
+#endif
 #endif
 #if H_3D_DDD
@@ -1971,4 +2039,7 @@
 
           rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+          rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );
+#endif
 #if H_3D_VSP // possible bug fix
           if( rpcTempCU->getSkipFlag(0) )
@@ -1986,6 +2057,28 @@
           if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )
           {
+#if FAST_SDC_OFFSET_DECISION_I0084
+            Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};
+            for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ )
+#else
             for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )
+#endif
             {
+#if FAST_SDC_OFFSET_DECISION_I0084
+              if( uiOffest > 3)
+              {
+                if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )
+                {
+                  continue;
+                }
+                if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] &&  uiOffest == 5)
+                {
+                  continue;
+                }
+                if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] &&  uiOffest == 4)
+                {
+                  continue;
+                }
+              }
+#endif
               if( rpcTempCU != rpcTempCUPre )
               {
@@ -1994,4 +2087,7 @@
               }
               rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+              rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );
+#endif
               rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
               rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
@@ -2006,4 +2102,26 @@
               }
 #endif
+#if FAST_SDC_OFFSET_DECISION_I0084
+              Int iSdcOffset = 0;
+              if(uiOffest % 2 == 0)
+              {
+                iSdcOffset = uiOffest >> 1;
+              }
+              else
+              {
+                iSdcOffset = -1 * (uiOffest >> 1);
+              }
+              m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 
+                m_ppcOrigYuv[uhDepth], 
+                ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth], 
+                m_ppcResiYuvTemp[uhDepth], 
+                m_ppcRecoYuvTemp[uhDepth],
+                iSdcOffset,
+                uhDepth );
+              if (uiOffest <= 3 )
+              {
+                dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost();
+              }
+#else
               m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 
                 m_ppcOrigYuv[uhDepth], 
@@ -2013,4 +2131,5 @@
                 uiOffest,
                 uhDepth );
+#endif
 
               xCheckDQP( rpcTempCU );
@@ -2130,5 +2249,7 @@
   
   rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );
+#endif
   rpcTempCU->setPartSizeSubParts  ( ePartSize,  0, uhDepth );
   rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
@@ -2217,6 +2338,28 @@
   if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && ePartSize == SIZE_2Nx2N)
   {
+#if FAST_SDC_OFFSET_DECISION_I0084
+    Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};
+    for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ )
+#else
     for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )
-    {
+#endif
+    {
+#if FAST_SDC_OFFSET_DECISION_I0084
+      if( uiOffest > 3)
+      {
+        if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )
+        {
+          continue;
+        }
+        if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] &&  uiOffest == 5)
+        {
+          continue;
+        }
+        if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] &&  uiOffest == 4)
+        {
+          continue;
+        }
+      }
+#endif
       if( rpcTempCU != rpcTempCUPre )
       {
@@ -2226,4 +2369,7 @@
       }
       rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+      rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );
+#endif
       rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
       rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
@@ -2239,4 +2385,26 @@
 #endif
 
+#if FAST_SDC_OFFSET_DECISION_I0084
+      Int iSdcOffset = 0;
+      if(uiOffest % 2 == 0)
+      {
+        iSdcOffset = uiOffest >> 1;
+      }
+      else
+      {
+        iSdcOffset = -1 * (uiOffest >> 1);
+      }
+      m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 
+        m_ppcOrigYuv[uhDepth],
+        ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
+        m_ppcResiYuvTemp[uhDepth],
+        m_ppcRecoYuvTemp[uhDepth],
+        iSdcOffset,
+        uhDepth );
+      if (uiOffest <= 3 )
+      {
+        dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost();
+      }
+#else
       m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 
         m_ppcOrigYuv[uhDepth],
@@ -2246,4 +2414,5 @@
         uiOffest,
         uhDepth );
+#endif
 
       xCheckDQP( rpcTempCU );
@@ -2320,5 +2489,71 @@
   }
 }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+Void TEncCu::xCheckRDCostSingleDepth( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize )
+{
+  UInt uiDepth = rpcTempCU->getDepth( 0 );
+  if( !rpcBestCU->getSlice()->getIsDepth() || (eSize != SIZE_2Nx2N))
+  {
+    return;
+  }
+  
+#if H_3D_VSO // M5
+  if( m_pcRdCost->getUseRenModel() )
+  {
+    UInt  uiWidth     = m_ppcOrigYuv[uiDepth]->getWidth   ();
+    UInt  uiHeight    = m_ppcOrigYuv[uiDepth]->getHeight  ();
+    Pel*  piSrc       = m_ppcOrigYuv[uiDepth]->getLumaAddr();
+    UInt  uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride  ();
+    m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
+  }
+#endif
+
+  rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );
+  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
+  rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth );
+  rpcTempCU->setCUTransquantBypassSubParts( rpcTempCU->getCUTransquantBypass(0), 0, uiDepth );
+
+  rpcTempCU->setTrIdxSubParts(0, 0, uiDepth);
+  rpcTempCU->setCbfSubParts(0, 1, 1, 0, uiDepth);
+  rpcTempCU->setSingleDepthFlagSubParts(true, 0, uiDepth);
+  rpcTempCU->setLumaIntraDirSubParts (DC_IDX, 0, uiDepth);
+#if H_3D_DIM_SDC
+  rpcTempCU->setSDCFlagSubParts( false, 0, uiDepth);
+#endif
+
+  UInt uiPreCalcDistC;
+  m_pcPredSearch  ->estIntraPredSingleDepth      ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, false );
+
+
+  m_ppcRecoYuvTemp[uiDepth]->copyToPicLuma(rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU() );
+  
+ 
+  m_pcEntropyCoder->resetBits();
+  if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
+  {
+    m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0,          true );
+  }
+  m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0,          true );
+  m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0,          true );
+  
+
+  m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
+  
+  rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits();
+  rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
+
+
+#if H_3D_VSO // M6
+  if( m_pcRdCost->getUseLambdaScaleVSO())  
+    rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );  
+  else
+#endif
+  rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
+ 
+
+  xCheckDQP( rpcTempCU );
+  xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth);
+}
+#endif
 Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG )
 {
@@ -2341,4 +2576,11 @@
   UInt uiHeight = rpcTempCU->getHeight(0);
   AOF( uiWidth == uiHeight );
+  
+#if SEC_DBBP_DISALLOW_8x8_I0078
+  if(uiWidth <= 8)
+  {
+    return;
+  }
+#endif
   
   rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N,  0, uhDepth );
@@ -2438,5 +2680,9 @@
   
   // reconstruct final prediction signal by combining both segments
+#if SHARP_DBBP_SIMPLE_FLTER_I0109
+  m_pcPredSearch->combineSegmentsWithMask(apPredYuv, m_ppcPredYuvTemp[uhDepth], pMask, uiWidth, uiHeight, 0, eVirtualPartSize);
+#else
   m_pcPredSearch->combineSegmentsWithMask(apPredYuv, m_ppcPredYuvTemp[uhDepth], pMask, uiWidth, uiHeight);
+#endif
   
   m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false );
@@ -2447,5 +2693,9 @@
 #endif
 
+#if HHI_DMM4_ENC_I0066
+Void TEncCu::xCheckRDCostIntra( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize, Bool bOnlyIVP )
+#else
 Void TEncCu::xCheckRDCostIntra( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize )
+#endif
 {
   UInt uiDepth = rpcTempCU->getDepth( 0 );
@@ -2463,5 +2713,7 @@
 
   rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  rpcTempCU->setSingleDepthFlagSubParts( false, 0, uiDepth );
+#endif
   rpcTempCU->setPartSizeSubParts( eSize, 0, uiDepth );
   rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth );
@@ -2473,6 +2725,9 @@
     m_pcPredSearch->preestChromaPredMode( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth] );
   }
+#if HHI_DMM4_ENC_I0066
+  m_pcPredSearch  ->estIntraPredQT      ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, bSeparateLumaChroma, bOnlyIVP );
+#else
   m_pcPredSearch  ->estIntraPredQT      ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, bSeparateLumaChroma );
-
+#endif
   m_ppcRecoYuvTemp[uiDepth]->copyToPicLuma(rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU() );
   
@@ -2488,4 +2743,9 @@
   }
   m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0,          true );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0,          true );
+  if(!rpcTempCU->getSingleDepthFlag(0))
+  {
+#endif
   m_pcEntropyCoder->encodePredMode( rpcTempCU, 0,          true );
   m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true );
@@ -2500,5 +2760,7 @@
   m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP );
   setdQPFlag( bCodeDQP );
-  
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  }
+#endif        
   m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
   
@@ -2528,5 +2790,7 @@
 
   rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  rpcTempCU->setSingleDepthFlagSubParts( false, 0, uiDepth );
+#endif
   rpcTempCU->setIPCMFlag(0, true);
   rpcTempCU->setIPCMFlagSubParts (true, 0, rpcTempCU->getDepth(0));
@@ -2545,4 +2809,7 @@
   }
   m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0,          true );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0,          true );
+#endif
   m_pcEntropyCoder->encodePredMode ( rpcTempCU, 0,          true );
   m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true );
Index: trunk/source/Lib/TLibEncoder/TEncCu.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCu.h	(revision 976)
+++ trunk/source/Lib/TLibEncoder/TEncCu.h	(revision 1039)
@@ -159,5 +159,12 @@
   Void  xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG = false );
 #endif
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Void  xCheckRDCostSingleDepth   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
+#endif
+#if HHI_DMM4_ENC_I0066
+  Void  xCheckRDCostIntra   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bOnlyIVP );
+#else
   Void  xCheckRDCostIntra   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
+#endif
   Void  xCheckDQP           ( TComDataCU*  pcCU );
   
Index: trunk/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 976)
+++ trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 1039)
@@ -119,5 +119,23 @@
   m_pcEntropyCoderIf->codeSkipFlag( pcCU, uiAbsPartIdx );
 }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+Void TEncEntropy::encodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
+{
+  if ( !pcCU->getSlice()->getIsDepth() )
+  {
+    return;
+  }
+  if(!pcCU->getSlice()->getApplySingleDepthMode())
+  {
+     return;
+  }
+  
+  if( bRD )
+  {
+    uiAbsPartIdx = 0;
+  }
+  m_pcEntropyCoderIf->codeSingleDepthMode( pcCU, uiAbsPartIdx );
+}
+#endif
 /** encode merge flag
  * \param pcCU
@@ -244,4 +262,5 @@
   
 #if H_3D_DBBP
+#if! SEC_DBBP_EXPLICIT_SIG_I0077
   PartSize eVirtualPartSize = pcCU->getPartitionSize(uiAbsPartIdx);
   if( pcCU->getDBBPFlag(uiAbsPartIdx) )
@@ -253,12 +272,25 @@
   }
 #endif
+#endif
   
   m_pcEntropyCoderIf->codePartSize( pcCU, uiAbsPartIdx, uiDepth );
   
 #if H_3D_DBBP
+#if SEC_DBBP_EXPLICIT_SIG_I0077
+#if SEC_DBBP_DISALLOW_8x8_I0078
+  if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 )
+#else
+  if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) )
+#endif
+#else
+#if SEC_DBBP_DISALLOW_8x8_I0078
+  if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && pcCU->getWidth(uiAbsPartIdx) > 8 )
+#else
   if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) )
+#endif
+#endif
   {
     encodeDBBPFlag(pcCU, uiAbsPartIdx, bRD);
-    
+#if !SEC_DBBP_EXPLICIT_SIG_I0077
     if( pcCU->getDBBPFlag(uiAbsPartIdx) )
     {
@@ -266,4 +298,5 @@
       pcCU->setPartSizeSubParts(eVirtualPartSize, uiAbsPartIdx, uiDepth);
     }
+#endif
   }
 #endif
Index: trunk/source/Lib/TLibEncoder/TEncEntropy.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncEntropy.h	(revision 976)
+++ trunk/source/Lib/TLibEncoder/TEncEntropy.h	(revision 1039)
@@ -86,4 +86,7 @@
   virtual Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
   virtual Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  virtual Void codeSingleDepthMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
+#endif
   virtual Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
   virtual Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
@@ -171,4 +174,7 @@
   Void encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
   Void encodeSkipFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Void encodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD=false );
+#endif
   Void encodePUWise       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
   Void encodeInterDirPU   ( TComDataCU* pcSubCU, UInt uiAbsPartIdx  );
Index: trunk/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 976)
+++ trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 1039)
@@ -934,5 +934,16 @@
     pcSlice->setRefPicList ( rcListPic );
 #endif
-  
+#if MTK_SINGLE_DEPTH_MODE_I0095
+    TEncTop* pcEncTop = (TEncTop*) m_pcCfg;
+    bool enableSingleDepthMode=false;
+    if(pcEncTop->getUseSingleDepthMode())
+    {
+      if(pcSlice->getIsDepth())
+      {
+        enableSingleDepthMode=true;
+      }
+    }
+    pcSlice->setApplySingleDepthMode(enableSingleDepthMode);
+#endif    
 #if H_3D_ARP
     //GT: This seems to be broken when layerId in vps is not equal to layerId in nuh
Index: trunk/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 976)
+++ trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 1039)
@@ -58,4 +58,8 @@
 , m_cCUSplitFlagSCModel       ( 1,             1,               NUM_SPLIT_FLAG_CTX            , m_contextModels + m_numContextModels, m_numContextModels )
 , m_cCUSkipFlagSCModel        ( 1,             1,               NUM_SKIP_FLAG_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
+#if MTK_SINGLE_DEPTH_MODE_I0095
+, m_cCUSingleDepthFlagSCModel        ( 1,             1,               NUM_SINGLEDEPTH_FLAG_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
+, m_cSingleDepthValueSCModel         ( 1,             1,               NUM_SINGLE_DEPTH_VALUE_DATA_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
+#endif
 , m_cCUMergeFlagExtSCModel    ( 1,             1,               NUM_MERGE_FLAG_EXT_CTX        , m_contextModels + m_numContextModels, m_numContextModels)
 , m_cCUMergeIdxExtSCModel     ( 1,             1,               NUM_MERGE_IDX_EXT_CTX         , m_contextModels + m_numContextModels, m_numContextModels)
@@ -130,4 +134,8 @@
   
   m_cCUSkipFlagSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  m_cCUSingleDepthFlagSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG );
+  m_cSingleDepthValueSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );
+#endif
   m_cCUMergeFlagExtSCModel.initBuffer    ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT);
   m_cCUMergeIdxExtSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT);
@@ -206,4 +214,8 @@
       curCost  = m_cCUSplitFlagSCModel.calcCost       ( curSliceType, qp, (UChar*)INIT_SPLIT_FLAG );
       curCost += m_cCUSkipFlagSCModel.calcCost        ( curSliceType, qp, (UChar*)INIT_SKIP_FLAG );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+      curCost += m_cCUSingleDepthFlagSCModel.calcCost        ( curSliceType, qp, (UChar*)INIT_SINGLEDEPTH_FLAG );
+      curCost += m_cSingleDepthValueSCModel.calcCost         ( curSliceType, qp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );
+#endif
       curCost += m_cCUMergeFlagExtSCModel.calcCost    ( curSliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT);
       curCost += m_cCUMergeIdxExtSCModel.calcCost     ( curSliceType, qp, (UChar*)INIT_MERGE_IDX_EXT);
@@ -243,5 +255,9 @@
       curCost += m_CUTransquantBypassFlagSCModel.calcCost( curSliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG );
 #if H_3D_DIM
+#if SEPARATE_FLAG_I0085
+    if( m_pcSlice->getVpsDepthModesFlag() || m_pcSlice->getIVPFlag() )
+#else
     if( m_pcSlice->getVpsDepthModesFlag() )
+#endif
     {
       curCost += m_cDepthIntraModeSCModel.calcCost    ( curSliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE );
@@ -275,4 +291,8 @@
   
   m_cCUSkipFlagSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  m_cCUSingleDepthFlagSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG );
+  m_cSingleDepthValueSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );
+#endif  
   m_cCUMergeFlagExtSCModel.initBuffer    ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT);
   m_cCUMergeIdxExtSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT);
@@ -434,5 +454,35 @@
   m_pcBinIf->encodeBinsEP( bins, numBins );
 }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+Void TEncSbac::codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx )
+{
+  UInt uiSymbol = pcCU->getSingleDepthFlag(uiAbsPartIdx ) ? 1 : 0;
+  m_pcBinIf->encodeBin( uiSymbol, m_cCUSingleDepthFlagSCModel.get( 0, 0, 0 ) );
+  if(uiSymbol)
+  {
+    UInt uiUnaryIdx = (UInt) pcCU->getSingleDepthValue(uiAbsPartIdx);
+    UInt uiNumCand = MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE;
+    if ( uiNumCand > 1 )
+    {
+      for( UInt ui = 0; ui < uiNumCand - 1; ++ui )
+      {
+        const UInt uiSymbol2 = ui == uiUnaryIdx ? 0 : 1;
+        if ( ui==0 )
+        {
+          m_pcBinIf->encodeBin( uiSymbol2, m_cSingleDepthValueSCModel.get( 0, 0, 0 ) );
+        }
+        else
+        {
+          m_pcBinIf->encodeBinEP( uiSymbol2 );
+        }
+        if( uiSymbol2 == 0 )
+        {
+          break;
+        }
+      }
+    }
+  }
+}
+#endif
 /** Coding of coeff_abs_level_minus3
  * \param uiSymbol value of coeff_abs_level_minus3
@@ -514,4 +564,5 @@
 #endif
 
+#if !FIX_TICKET_76
 #if H_3D_DIM_SDC
 Void TEncSbac::xCodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment )
@@ -600,4 +651,6 @@
 #endif
 #endif
+#endif
+
 
 // SBAC RD
@@ -664,5 +717,10 @@
   PartSize eSize         = pcCU->getPartitionSize( uiAbsPartIdx );
 #if H_3D_QTLPC
+#if MTK_I0099_VPS_EX2
+  TComVPS *vps           = pcCU->getPic()->getSlice(0)->getVPS();
+  Bool    bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId());
+#else
   TComSPS *sps           = pcCU->getPic()->getSlice(0)->getSPS();
+#endif
   TComPic *pcTexture     = pcCU->getSlice()->getTexturePic();
   Bool bDepthMapDetect   = (pcTexture != NULL);
@@ -673,5 +731,9 @@
   Bool depthDependent = false;
   UInt uiTexturePart = eSize;
+#if MTK_I0099_VPS_EX2
+  if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag )
+#else
   if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && sps->getUseQTL() && sps->getUsePC() )
+#endif
   {
     TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());
@@ -1031,5 +1093,10 @@
   Bool bCodeSplitFlag    = true;
 
+#if MTK_I0099_VPS_EX2
+  TComVPS *vps           = pcCU->getPic()->getSlice(0)->getVPS();
+  Bool    bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId());
+#else
   TComSPS *sps           = pcCU->getPic()->getSlice(0)->getSPS();
+#endif
   TComPic *pcTexture     = pcCU->getSlice()->getTexturePic();
   Bool bDepthMapDetect   = (pcTexture != NULL);
@@ -1038,5 +1105,9 @@
   Bool rapPic     = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);
 
+#if MTK_I0099_VPS_EX2
+  if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag  )
+#else
   if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && sps->getUseQTL() && sps->getUsePC())
+#endif
   {
     TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());
@@ -1088,5 +1159,9 @@
     dir[j] = pcCU->getLumaIntraDir( absPartIdx+partOffset*j );
 #if H_3D_DIM
+#if SEPARATE_FLAG_I0085
+    if( pcCU->getSlice()->getVpsDepthModesFlag() ||  pcCU->getSlice()->getIVPFlag() )
+#else
     if( pcCU->getSlice()->getVpsDepthModesFlag() )
+#endif
     {
       codeIntraDepth( pcCU, absPartIdx+partOffset*j );
@@ -1234,5 +1309,12 @@
     }
     //mode coding
+#if SEPARATE_FLAG_I0085
+    if( pcCU->getSlice()->getVpsDepthModesFlag() && pcCU->getSlice()->getIVPFlag())
+    {
+      m_pcBinIf->encodeBin( uiCodeIdx == 0 ? 0 : 1, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );
+    }
+#else
     m_pcBinIf->encodeBin( uiCodeIdx == 0 ? 0 : 1, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );
+#endif
   }
 }
@@ -2278,7 +2360,16 @@
   }
 
+#if HS_DMM_SIGNALLING_I0120
+  UInt uiNumSegments = isDimMode( pcCU->getLumaIntraDir( absPartIdx ) ) ? 2 : 1;
+  UInt dimDeltaDC = 1;
+#else
   UInt uiNumSegments = 0;
   UInt dimDeltaDC = 0;
-
+#endif
+
+#if HS_DMM_SIGNALLING_I0120
+  if( pcCU->isIntra( absPartIdx ) && pcCU->getSDCFlag( absPartIdx ))
+  {
+#else
   if( pcCU->isIntra( absPartIdx ) )
   {
@@ -2288,4 +2379,5 @@
     if( pcCU->getSDCFlag( absPartIdx ) )
     {
+#endif
       if( uiNumSegments == 1 )
       {
@@ -2296,4 +2388,5 @@
         dimDeltaDC = ( pcCU->getSDCSegmentDCOffset( 0, absPartIdx ) || pcCU->getSDCSegmentDCOffset( 1, absPartIdx ) ) ? 1 : 0;
       }
+#if !HS_DMM_SIGNALLING_I0120
     }
     else
@@ -2301,6 +2394,8 @@
       dimDeltaDC = isDimDeltaDC( dir );
     }
+#endif
     m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get( 0, 0, 0 ) );
   }
+#if !HS_DMM_SIGNALLING_I0120
   else //all-zero inter SDC is not allowed
   {
@@ -2308,4 +2403,5 @@
     dimDeltaDC = 1;
   }
+#endif
 
   if( dimDeltaDC )
@@ -2343,4 +2439,8 @@
 Void TEncSbac::codeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
 {
+#if SEC_DBBP_EXPLICIT_SIG_I0077
+  PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
+  AOF( ePartSize == SIZE_2NxN || ePartSize == SIZE_Nx2N );
+#endif
   AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) );
   AOF( !pcCU->getSlice()->getIsDepth() );
Index: trunk/source/Lib/TLibEncoder/TEncSbac.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSbac.h	(revision 976)
+++ trunk/source/Lib/TLibEncoder/TEncSbac.h	(revision 1039)
@@ -130,6 +130,8 @@
   Void  xCodeDmm1WedgeIdx    ( UInt uiTabIdx, Int iNumBit );
 #endif
+#if !FIX_TICKET_76
 #if H_3D_DIM_SDC
   Void  xCodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment );
+#endif
 #endif
 #endif
@@ -153,4 +155,7 @@
   Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx );
   Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Void codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx );
+#endif
   Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
   Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
@@ -219,4 +224,8 @@
   ContextModel3DBuffer m_cCUSplitFlagSCModel;
   ContextModel3DBuffer m_cCUSkipFlagSCModel;
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  ContextModel3DBuffer m_cCUSingleDepthFlagSCModel;
+  ContextModel3DBuffer m_cSingleDepthValueSCModel;
+#endif
   ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
   ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
Index: trunk/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 976)
+++ trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1039)
@@ -915,7 +915,20 @@
         }
         m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+        m_pcEntropyCoder->encodeSingleDepthMode(pcCU, 0, true );
+        if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))
+#endif
         m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
       }
-      
+#if MTK_SINGLE_DEPTH_MODE_I0095
+      else
+      {
+        m_pcEntropyCoder->encodeSingleDepthMode(pcCU, 0, true );
+      }
+#endif      
+#if MTK_SINGLE_DEPTH_MODE_I0095
+      if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))
+      {
+#endif
       m_pcEntropyCoder  ->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
 
@@ -932,5 +945,12 @@
         }
       }
-    }
+#if MTK_SINGLE_DEPTH_MODE_I0095
+    }
+#endif
+    }
+#if MTK_SINGLE_DEPTH_MODE_I0095
+      if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))
+      {
+#endif
     // luma prediction mode
     if( pcCU->getPartitionSize(0) == SIZE_2Nx2N )
@@ -975,5 +995,7 @@
     }
   }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+    }
+#endif
   }
   if( bChroma )
@@ -1837,5 +1859,66 @@
   dRDCost  += dSingleCost;
 }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+Void TEncSearch::xIntraCodingSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Int iTestDepthIdx, Pel *DepthNeighbor )
+{
+  UInt    uiWidth           = pcCU     ->getWidth   ( 0 );
+  UInt    uiHeight          = pcCU     ->getHeight  ( 0 );
+  UInt    uiStride          = pcOrgYuv ->getStride  ();
+  Pel*    piOrg             = pcOrgYuv ->getLumaAddr( uiAbsPartIdx );
+  Pel*    piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
+
+  AOF( uiWidth == uiHeight );
+  AOF( uiAbsPartIdx == 0 );
+  pcCU->setSingleDepthValueSubParts((Pel)iTestDepthIdx,uiAbsPartIdx, 0, pcCU->getDepth(0));  
+  //===== reconstruction =====
+
+  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
+  {
+    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
+    {
+    piPred[ uiX ] = DepthNeighbor[iTestDepthIdx];
+    }
+    piPred     += uiStride;
+  }
+
+  // clear UV
+  UInt  uiStrideC     = pcPredYuv->getCStride();
+  Pel   *pRecCb       = pcPredYuv->getCbAddr();
+  Pel   *pRecCr       = pcPredYuv->getCrAddr();
+
+  for (Int y=0; y<uiHeight/2; y++)
+  {
+    for (Int x=0; x<uiWidth/2; x++)
+    {
+      pRecCb[x] = 1<<(g_bitDepthC-1);
+      pRecCr[x] = 1<<(g_bitDepthC-1);
+    }
+
+    pRecCb += uiStrideC;
+    pRecCr += uiStrideC;
+  }
+
+  piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
+  //===== determine distortion =====
+#if H_3D_VSO
+  if ( m_pcRdCost->getUseVSO() )
+    ruiDist = m_pcRdCost->getDistPartVSO  ( pcCU, uiAbsPartIdx, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false );
+  else
+#endif
+    ruiDist = m_pcRdCost->getDistPart(g_bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight );
+
+  //===== determine rate and r-d cost =====
+  m_pcEntropyCoder->resetBits();
+  m_pcEntropyCoder->encodeSingleDepthMode( pcCU, 0, true );
+  UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();
+
+#if H_3D_VSO
+  if ( m_pcRdCost->getUseLambdaScaleVSO())
+    dRDCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist );
+  else
+#endif
+    dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist );
+}
+#endif
 #if H_3D_DIM_SDC
 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi  )
@@ -1887,7 +1970,16 @@
       UInt dimType   = getDimType  ( uiLumaPredMode );
       UInt patternID = pcCU->getDmmWedgeTabIdx(dimType, uiAbsPartIdx);
+#if SHARP_DMM1_I0110
+      UInt uiBaseWidth = pcCU->isDMM1UpscaleMode(uiWidth) ? pcCU->getDMM1BasePatternWidth(uiWidth) : uiWidth;
+      if ( patternID >= g_dmmWedgeLists[g_aucConvertToBit[uiBaseWidth]].size() && dimType == DMM1_IDX )
+#else
       if ( patternID >= g_dmmWedgeLists[g_aucConvertToBit[uiWidth]].size() && dimType == DMM1_IDX )
-      {
+#endif
+      {
+#if SHARP_DMM1_I0110
+        if (g_aucConvertToBit[uiBaseWidth] == 2) // Encoder method. Avoid DMM1 pattern list index exceeds the maximum DMM1 pattern number when SDC split is used.
+#else
         if (g_aucConvertToBit[uiWidth] == 2) // Encoder method. Avoid DMM1 pattern list index exceeds the maximum DMM1 pattern number when SDC split is used.
+#endif
         {                                    
           patternID = 1349;  // Split 32x32 to 16x16. 1349: Maximum DMM1 pattern number when block size is 16x16
@@ -1951,10 +2043,19 @@
     Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx);
 
+#if SHARP_DMM1_I0110
+    WedgeList* pacWedgeList  = pcCU->isDMM1UpscaleMode( uiWidth ) ? &g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])] : &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];
+#else
     WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];
+#endif
     TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx ));
 
     uiNumSegments = 2;
+#if SHARP_DMM1_I0110
+    pbMask       = pcCU->isDMM1UpscaleMode( uiWidth ) ? pcWedgelet->getScaledPattern( uiWidth ) : pcWedgelet->getPattern();
+    uiMaskStride = pcCU->isDMM1UpscaleMode( uiWidth ) ? uiWidth : pcWedgelet->getStride();
+#else
     pbMask = pcWedgelet->getPattern();
     uiMaskStride = pcWedgelet->getStride();
+#endif
   }
   if( getDimType( uiLumaPredMode ) == DMM4_IDX )
@@ -2777,7 +2878,7 @@
   pcCU->setChromIntraDirSubParts( uiBestMode, 0, pcCU->getDepth( 0 ) );
 }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
 Void 
-TEncSearch::estIntraPredQT( TComDataCU* pcCU, 
+TEncSearch::estIntraPredSingleDepth( TComDataCU* pcCU, 
                            TComYuv*    pcOrgYuv, 
                            TComYuv*    pcPredYuv, 
@@ -2786,4 +2887,104 @@
                            UInt&       ruiDistC,
                            Bool        bLumaOnly )
+{
+  UInt    uiDepth        = pcCU->getDepth(0);
+  UInt    uiWidth        = pcCU->getWidth (0);
+  UInt    uiHeight       = pcCU->getHeight(0);
+
+
+  Pel* piOrg         = pcOrgYuv ->getLumaAddr( 0, uiWidth );
+  UInt uiStride      = pcPredYuv->getStride();
+
+  Int index=0;
+  Pel testDepth;
+  Pel DepthNeighbours[5];
+  //construction of depth candidates
+  for( Int i = 0; (i < 5)  && (index<MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE) ; i++ )
+  {
+    if(!pcCU->getNeighDepth (0, 0, &testDepth, i))
+    {
+      continue;
+    }
+    DepthNeighbours[index]=testDepth;
+    index++;
+    for(Int j=0;j<index-1;j++)
+    {
+      if( (DepthNeighbours[index-1]==DepthNeighbours[j]))
+      {
+        index--;
+        break;
+      }
+    }
+  }
+
+  if(index==0)
+  {
+    DepthNeighbours[index]=1<<(g_bitDepthY-1);
+    index++;
+  }
+
+  if(index==1)
+  {
+    DepthNeighbours[index]=ClipY(DepthNeighbours[0] + 1 );
+    index++;
+  }
+
+
+  Dist   uiDist = 0;
+  Double dCost   = 0.0;
+  Dist    uiBestDist = 0;
+  Double  dBestCost   = MAX_DOUBLE;
+  Pel     pBestSingleDepthValue = 0;
+
+  for( Int testdepthidx = 0; testdepthidx < index ; testdepthidx++ )
+  {
+      // set context models
+      m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
+
+      // determine residual for partition
+      uiDist = 0;
+      dCost   = 0.0;
+#if H_3D_VSO // M36
+      if( m_pcRdCost->getUseRenModel() )
+      {
+        m_pcRdCost->setRenModelData( pcCU, 0, piOrg, uiStride, uiWidth, uiHeight );
+      }
+#endif
+      xIntraCodingSingleDepth(pcCU, 0, pcOrgYuv, pcPredYuv, uiDist, dCost, testdepthidx, DepthNeighbours);
+      // check r-d cost
+      if( dCost < dBestCost )
+      {
+        uiBestDist = uiDist;
+        dBestCost   = dCost;
+        pBestSingleDepthValue = pcCU->getSingleDepthValue(0);
+        // copy reconstruction
+        pcPredYuv->copyPartToPartYuv(pcRecoYuv, 0, uiWidth, uiHeight);
+      }
+  } // depth index loop
+
+
+  pcCU->setSingleDepthValueSubParts((Pel)pBestSingleDepthValue,0, 0, uiDepth);
+  assert(pBestSingleDepthValue>=0);
+
+  //===== reset context models =====
+  m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);
+  
+  //===== set distortion (rate and r-d costs are determined later) =====
+  pcCU->getTotalDistortion() = uiBestDist;
+}
+
+#endif 
+Void 
+TEncSearch::estIntraPredQT( TComDataCU* pcCU, 
+                            TComYuv*    pcOrgYuv, 
+                            TComYuv*    pcPredYuv, 
+                            TComYuv*    pcResiYuv, 
+                            TComYuv*    pcRecoYuv,
+                            UInt&       ruiDistC,
+                            Bool        bLumaOnly
+#if HHI_DMM4_ENC_I0066
+                          , Bool        bOnlyIVP
+#endif
+                          )
 {
   UInt    uiDepth        = pcCU->getDepth(0);
@@ -2831,4 +3032,12 @@
     Int numModesForFullRD = g_aucIntraModeNumFast[ uiWidthBit ];
     
+#if HHI_DMM4_ENC_I0066
+    if( bOnlyIVP )
+    {
+      numModesForFullRD = 0;
+    }
+    else
+    {
+#endif
     Bool doFastSearch = (numModesForFullRD != numModesAvailable);
     if (doFastSearch)
@@ -2922,10 +3131,39 @@
       }
     }
-    
+#if HHI_DMM4_ENC_I0066
+    }
+#endif
+
 #if H_3D_DIM
     //===== determine set of depth intra modes to be tested =====
     if( m_pcEncCfg->getIsDepth() && uiWidth >= DIM_MIN_SIZE && uiWidth <= DIM_MAX_SIZE && uiWidth == uiHeight )
     {
-
+#if HHI_DMM4_ENC_I0066
+#if SEPARATE_FLAG_I0085
+      if( bOnlyIVP && m_pcEncCfg->getUseIVP() )
+#else
+      if( bOnlyIVP )
+#endif
+      {
+        TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight );
+        xPredContourFromTex( pcCU, uiPartOffset, uiWidth, uiHeight, dmm4Segmentation );
+
+        Pel deltaDC1 = 0; Pel deltaDC2 = 0;
+        xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, dmm4Segmentation->getPattern(), dmm4Segmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 );
+        pcCU->setDimDeltaDC( DMM4_IDX, 0, uiPartOffset, deltaDC1 );
+        pcCU->setDimDeltaDC( DMM4_IDX, 1, uiPartOffset, deltaDC2 );
+
+#if HS_DMM_SIGNALLING_I0120
+        uiRdModeList[ numModesForFullRD++ ] = (DMM4_IDX+DIM_OFFSET);
+#else
+        uiRdModeList[ numModesForFullRD++ ] = (2*DMM4_IDX  +DIM_OFFSET);
+        if( deltaDC1 != 0 || deltaDC2 != 0 )
+          uiRdModeList[ numModesForFullRD++ ] = (2*DMM4_IDX+1+DIM_OFFSET);
+#endif
+        dmm4Segmentation->destroy(); delete dmm4Segmentation;
+      }
+      else
+      {
+#endif
 #if H_3D_FAST_DEPTH_INTRA
       Int  threshold    = max(((pcCU->getQP(0))>>3)-1,3);
@@ -2935,5 +3173,9 @@
 
 #if H_3D_DIM_DMM
+#if SEPARATE_FLAG_I0085
+      if( ( m_pcEncCfg->getUseDMM() || m_pcEncCfg->getUseIVP() )
+#else
       if( m_pcEncCfg->getUseDMM()
+#endif
 #if H_3D_FAST_DEPTH_INTRA
          && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold)
@@ -2941,5 +3183,30 @@
         )
       {
+#if SEPARATE_FLAG_I0085
+        UInt uiStart, uiEnd;
+        if( m_pcEncCfg->getUseDMM() &&  m_pcEncCfg->getUseIVP() )
+        {
+          uiStart = 0;
+          uiEnd   = 2;
+        }
+        else if( m_pcEncCfg->getUseDMM() )
+        {
+          uiStart = 0;
+          uiEnd   = 1;
+        }
+        else if( m_pcEncCfg->getUseIVP() )
+        {
+          uiStart = 1;
+          uiEnd   = 2;
+        }
+        else
+        {
+          uiStart = 0;
+          uiEnd   = 0;
+        }
+        for( UInt dmmType = uiStart; dmmType < uiEnd; dmmType++ )
+#else
         for( UInt dmmType = 0; dmmType < DMM_NUM_TYPE; dmmType++ )
+#endif
         {
 #if H_3D_FCO
@@ -2959,5 +3226,10 @@
               xSearchDmm1Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx );
               pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType,  uiPartOffset, uiDepth + uiInitTrDepth );
+#if SHARP_DMM1_I0110
+              biSegmentation = pcCU->isDMM1UpscaleMode( uiWidth ) ? 
+                  &(g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])][uiTabIdx]) : &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]);
+#else
               biSegmentation = &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]);
+#endif
             } break;
 
@@ -2974,10 +3246,27 @@
           if( biSegmentation )
           {
+#if SHARP_DMM1_I0110
+            if( dmmType == DMM1_IDX && pcCU->isDMM1UpscaleMode( uiWidth ) ){
+                xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getScaledPattern(uiWidth), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 );
+            } 
+            else
+            {
+                xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getPattern(), biSegmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 );
+            }
+#else
             xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getPattern(), biSegmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 );
+#endif
             pcCU->setDimDeltaDC( dmmType, 0, uiPartOffset, deltaDC1 );
             pcCU->setDimDeltaDC( dmmType, 1, uiPartOffset, deltaDC2 );
 
+#if HS_DMM_SIGNALLING_I0120
+            uiRdModeList[ numModesForFullRD++ ] = (dmmType  +DIM_OFFSET);
+#else
             uiRdModeList[ numModesForFullRD++ ] = (2*dmmType  +DIM_OFFSET);
+#if HHI_DMM4_ENC_I0066
+            if( deltaDC1 != 0 || deltaDC2 != 0 )
+#endif
             uiRdModeList[ numModesForFullRD++ ] = (2*dmmType+1+DIM_OFFSET);
+#endif
 
             if( DMM4_IDX == dmmType ) { biSegmentation->destroy(); delete biSegmentation; }
@@ -2985,4 +3274,7 @@
         }
       }
+#if HHI_DMM4_ENC_I0066
+      }
+#endif
 #endif
     }
@@ -2995,4 +3287,10 @@
     
     UInt    uiBestPUMode  = 0;
+#if SCU_HS_FAST_INTRA_SDC_I0123
+    UInt    uiBestPUModeConv  = 0;
+    UInt    uiSecondBestPUModeConv  = 0;
+    UInt    uiThirdBestPUModeConv  = 0;
+#endif
+
 #if H_3D_VSO
     Dist    uiBestPUDistY = 0;
@@ -3002,27 +3300,103 @@
     UInt    uiBestPUDistC = 0;
     Double  dBestPUCost   = MAX_DOUBLE;
+
+#if SCU_HS_FAST_INTRA_SDC_I0123
+    Double  dBestPUCostConv   = MAX_DOUBLE;
+    UInt varCU      = m_pcRdCost->calcVAR(piOrg, uiStride, uiWidth,uiHeight,pcCU->getDepth(0));
+    UInt rdSDC = m_pcEncCfg->getIsDepth() ? numModesForFullRD : 0;
+#endif
+
 #if H_3D_DIM_SDC
     Bool    bBestUseSDC   = false;
     Pel     apBestDCOffsets[2] = {0,0};
 #endif
+#if SCU_HS_FAST_INTRA_SDC_I0123
+    for( UInt uiMode = 0; uiMode < numModesForFullRD + rdSDC; uiMode++ )
+#else
     for( UInt uiMode = 0; uiMode < numModesForFullRD; uiMode++ )
+#endif
     {
       // set luma prediction mode
-      UInt uiOrgMode = uiRdModeList[uiMode];
+#if !SCU_HS_FAST_INTRA_SDC_I0123
+     UInt uiOrgMode = uiRdModeList[uiMode];  
+#endif
       
+#if SCU_HS_FAST_INTRA_SDC_I0123
+      UInt uiOrgMode;
+      if (uiMode < numModesForFullRD)
+      {   
+         uiOrgMode = uiRdModeList[uiMode];
+      }
+      else
+      {
+           uiOrgMode = uiRdModeList[uiMode - numModesForFullRD];
+
+           if (uiBestPUModeConv <= 1 )
+           {
+           if (uiOrgMode > 1 && varCU < 1) continue;          
+           }
+           else
+           {
+              if (uiOrgMode != uiBestPUModeConv && uiOrgMode != uiSecondBestPUModeConv && uiOrgMode != uiThirdBestPUModeConv 
+                  && uiOrgMode > 1 && uiOrgMode < NUM_INTRA_MODE && varCU < 4) 
+              continue;
+           }
+       }
+#endif
+
       pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );
       
 #if H_3D_DIM_SDC
+#if SCU_HS_FAST_INTRA_SDC_I0123
+      Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) && uiMode >= numModesForFullRD);
+#else
       Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) );
+#endif
       
       for( UInt uiSDC=0; uiSDC<=(bTestSDC?1:0); uiSDC++ )
       {
+#if SCU_HS_FAST_INTRA_SDC_I0123
+        if (!uiSDC && uiMode >= numModesForFullRD) continue;
+#endif
         pcCU->setSDCFlagSubParts( (uiSDC != 0), uiPartOffset, uiDepth + uiInitTrDepth );
+#if FAST_SDC_OFFSET_DECISION_I0084
+        Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};
+        for( Int iOffset = 1; iOffset <= 5; iOffset++ )
+#else
         for( Int iSDCDeltaResi = -2; iSDCDeltaResi <= 2; iSDCDeltaResi++ )
-        {
+#endif
+        {
+#if FAST_SDC_OFFSET_DECISION_I0084
+          Int iSDCDeltaResi = 0;
+          if(iOffset % 2 == 0)
+          {
+            iSDCDeltaResi = iOffset >> 1;
+          }
+          else
+          {
+            iSDCDeltaResi = -1 * (iOffset >> 1);
+          }
+#endif
           if( ( uiSDC == 0 ) && iSDCDeltaResi != 0 )
           {
             continue;
           }
+#if FAST_SDC_OFFSET_DECISION_I0084
+          if( iOffset > 3)
+          {
+            if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )
+            {
+              continue;
+            }
+            if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] &&  iOffset == 5)
+            {
+              continue;
+            }
+            if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] &&  iOffset == 4)
+            {
+              continue;
+            }
+          }
+#endif
 #endif
       
@@ -3070,4 +3444,10 @@
           // start encoding with SDC
           xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi );
+#if FAST_SDC_OFFSET_DECISION_I0084
+          if ( testZeroResi == 0 && iOffset <= 3 )
+          {
+            dOffsetCost [iOffset -1] = dPUCost;
+          }
+#endif
         }
         else
@@ -3077,4 +3457,13 @@
 #if H_3D_DIM_ENC
           xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost, (testZeroResi != 0) );
+#if SCU_HS_FAST_INTRA_SDC_I0123    
+      if( dPUCost < dBestPUCostConv )
+      {
+        uiThirdBestPUModeConv = uiSecondBestPUModeConv;
+        uiSecondBestPUModeConv = uiBestPUModeConv;
+        uiBestPUModeConv  = uiOrgMode;
+        dBestPUCostConv   = dPUCost;
+      }
+#endif
 #else
           xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost );
@@ -3620,5 +4009,7 @@
 #if H_3D_VSP
                                  , Int* vspFlag
+#if !FIX_TICKET_79
                                  , InheritedVSPDisInfo*  inheritedVSPDisInfo
+#endif
 #endif
 #if H_3D_SPIVMP
@@ -3680,5 +4071,5 @@
       pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand);
       pcCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
-#if H_3D_VSP
+#if H_3D_VSP && !FIX_TICKET_79
                                         , inheritedVSPDisInfo
 #endif
@@ -3710,5 +4101,5 @@
     pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand);
     pcCU->xGetInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours
-#if H_3D_VSP
+#if H_3D_VSP && !FIX_TICKET_79
                                       , inheritedVSPDisInfo
 #endif
@@ -3733,5 +4124,5 @@
 #endif
   }
-#if H_3D_VSP
+#if H_3D_VSP && !FIX_TICKET_75
   xRestrictBipredMergeCand( pcCU, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours,vspFlag, numValidMergeCand );
 #else
@@ -3765,5 +4156,7 @@
 #if H_3D_VSP
     pcCU->setVSPFlagSubParts( vspFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
+#if !FIX_TICKET_79
     pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
+#endif
 #endif
 
@@ -3865,5 +4258,5 @@
  * \returns Void
  */
-#if H_3D_VSP
+#if H_3D_VSP && !FIX_TICKET_75
 Void TEncSearch::xRestrictBipredMergeCand( TComDataCU* pcCU, UInt puIdx, TComMvField* mvFieldNeighbours, UChar* interDirNeighbours, Int* vspFlag, Int numValidMergeCand )
 #else
@@ -3875,5 +4268,5 @@
     for( UInt mergeCand = 0; mergeCand < numValidMergeCand; ++mergeCand )
     {
-#if H_3D_VSP
+#if H_3D_VSP && !FIX_TICKET_75
       if ( (interDirNeighbours[mergeCand] == 3) && (vspFlag[mergeCand] == false) )
 #else
@@ -4501,5 +4894,7 @@
       Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
       memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
+#if !FIX_TICKET_79
       InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
+#endif
       UInt uiAbsPartIdx = 0;
       Int iWidth = 0;
@@ -4519,5 +4914,7 @@
 #if H_3D_VSP
                       , vspFlag
+#if !FIX_TICKET_79
                       , inheritedVSPDisInfo
+#endif
 #endif
 #if H_3D_SPIVMP
@@ -4533,5 +4930,7 @@
 #if H_3D_VSP
         pcCU->setVSPFlagSubParts( vspFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
+#if !FIX_TICKET_79
         pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMRGIndex].m_acDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
+#endif
 #endif
 #if H_3D_DDD
@@ -6981,4 +7380,7 @@
     }
     m_pcEntropyCoder->encodeSkipFlag ( pcCU, 0, true );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+    m_pcEntropyCoder->encodeSingleDepthMode ( pcCU, 0, true );
+#endif
     m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
     m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
@@ -7435,6 +7837,11 @@
 
   Pel refDC1 = 0; Pel refDC2 = 0;
+#if SHARP_DMM1_I0110
+  WedgeList*     pacWedgeList     = pcCU->isDMM1UpscaleMode( uiWidth ) ? &g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])] : &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];
+  WedgeNodeList* pacWedgeNodeList = pcCU->isDMM1UpscaleMode( uiWidth ) ? &g_dmmWedgeNodeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])] : &g_dmmWedgeNodeLists[(g_aucConvertToBit[uiWidth])];
+#else
   WedgeList*     pacWedgeList     = &g_dmmWedgeLists    [(g_aucConvertToBit[uiWidth])];
   WedgeNodeList* pacWedgeNodeList = &g_dmmWedgeNodeLists[(g_aucConvertToBit[uiWidth])];
+#endif
 
   // coarse wedge search
@@ -7444,6 +7851,13 @@
   {
     TComWedgelet* pcWedgelet = &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx()));
+#if SHARP_DMM1_I0110
+    Bool *pbPattern = pcCU->isDMM1UpscaleMode(uiWidth) ? pcWedgelet->getScaledPattern(uiWidth) : pcWedgelet->getPattern();
+    UInt uiStride   = pcCU->isDMM1UpscaleMode(uiWidth) ? uiWidth : pcWedgelet->getStride();
+    xCalcBiSegDCs  ( piRef,  uiRefStride,  pbPattern, uiStride, refDC1, refDC2 );
+    xAssignBiSegDCs( piPred, uiPredStride, pbPattern, uiStride, refDC1, refDC2 );
+#else
     xCalcBiSegDCs  ( piRef,  uiRefStride,  pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
     xAssignBiSegDCs( piPred, uiPredStride, pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
+#endif
 
     Dist uiActDist = RDO_DIST_MAX;
@@ -7481,7 +7895,13 @@
     {
       TComWedgelet* pcWedgelet = &(pacWedgeList->at(pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId )));
+#if SHARP_DMM1_I0110
+      Bool *pbPattern = pcCU->isDMM1UpscaleMode(uiWidth) ? pcWedgelet->getScaledPattern(uiWidth) : pcWedgelet->getPattern();
+      UInt uiStride   = pcCU->isDMM1UpscaleMode(uiWidth) ? uiWidth : pcWedgelet->getStride();
+      xCalcBiSegDCs  ( piRef,  uiRefStride,  pbPattern, uiStride, refDC1, refDC2 );
+      xAssignBiSegDCs( piPred, uiPredStride, pbPattern, uiStride, refDC1, refDC2 );
+#else
       xCalcBiSegDCs  ( piRef,  uiRefStride,  pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
       xAssignBiSegDCs( piPred, uiPredStride, pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
-
+#endif
       Dist uiActDist = RDO_DIST_MAX;
 #if H_3D_VSO
Index: trunk/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 976)
+++ trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 1039)
@@ -180,5 +180,9 @@
                                   TComYuv*    pcRecoYuv,
                                   UInt&       ruiDistC,
-                                  Bool        bLumaOnly );
+                                  Bool        bLumaOnly
+#if HHI_DMM4_ENC_I0066
+                                , Bool        bOnlyIVP
+#endif
+                                );
   Void  estIntraPredChromaQT    ( TComDataCU* pcCU, 
                                   TComYuv*    pcOrgYuv, 
@@ -187,5 +191,13 @@
                                   TComYuv*    pcRecoYuv,
                                   UInt        uiPreCalcDistC );
-  
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Void  estIntraPredSingleDepth  ( TComDataCU* pcCU, 
+                                  TComYuv*    pcOrgYuv, 
+                                  TComYuv*    pcPredYuv, 
+                                  TComYuv*    pcResiYuv, 
+                                  TComYuv*    pcRecoYuv,
+                                  UInt&       ruiDistC,
+                                  Bool        bLumaOnly );
+#endif    
   
   /// encoder estimation - inter prediction (non-skip)
@@ -342,5 +354,7 @@
                                     UInt         uiAbsPartIdx,
                                     UInt         stateU0V1Both2 );
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Void xIntraCodingSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Int iTestDepthIdx, Pel * DepthNeighbor );
+#endif
 #if H_3D_DIM
   // -------------------------------------------------------------------------------------------------------------------
@@ -415,5 +429,7 @@
 #if H_3D_VSP
                                   , Int* vspFlag
+#if !FIX_TICKET_79
                                   , InheritedVSPDisInfo*  inheritedVSPDisInfo
+#endif
 #endif
 #if H_3D_SPIVMP
@@ -427,5 +443,5 @@
                                     TComMvField*    mvFieldNeighbours, 
                                     UChar*          interDirNeighbours, 
-#if H_3D_VSP
+#if H_3D_VSP && !FIX_TICKET_75
                                     Int* vspFlag,
 #endif
Index: trunk/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 976)
+++ trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1039)
@@ -744,7 +744,9 @@
   m_cSPS.setUseAMP ( m_useAMP );
 
+#if !MTK_I0099_VPS_EX2
 #if H_3D_QTLPC
   m_cSPS.setUseQTL( m_bUseQTL );
   m_cSPS.setUsePC ( m_bUsePC  );
+#endif
 #endif
 
