Index: trunk/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 976)
+++ trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1039)
@@ -378,6 +378,12 @@
 #if H_3D_DIM
   ("DMM",                   m_useDMM,           true,  "Depth intra model modes")
+#if SEPARATE_FLAG_I0085
+  ("IVP",                   m_useIVP,           true,  "intra-view prediction")
+#endif
   ("SDC",                   m_useSDC,           true,  "Simplified depth coding")
   ("DLT",                   m_useDLT,           true,  "Depth lookup table")
+#endif
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  ("SingleDepthMode",    m_useSingleDepthMode, true, "Single depth mode")                         
 #endif
 #endif
@@ -761,7 +767,14 @@
 
 #endif //HHI_VSO
+#if MTK_I0099_VPS_EX2
+  ("LimQtPredFlag",                   m_bLimQtPredFlag          , true          , "Use Predictive Coding with QTL" )
+#endif
+#if !MTK_I0099_VPS_EX2 || MTK_I0099_FIX
 #if H_3D_QTLPC
   ("QTL",                             m_bUseQTL                 , true          , "Use depth Quadtree Limitation" )
+#if !MTK_I0099_VPS_EX2
   ("PC",                              m_bUsePC                  , true          , "Use Predictive Coding with QTL" )
+#endif
+#endif
 #endif
 #if H_3D_IV_MERGE
@@ -1402,5 +1415,9 @@
     for ( Int i = 0; i < m_layerIdsInSets[lsIdx].size(); i++ )
     {
+#if FIX_TICKET_61
+      xConfirmPara( m_layerIdsInSets[lsIdx][i] < 0 || m_layerIdsInSets[lsIdx][i] >= MAX_NUM_LAYER_IDS, "LayerIdsInSet must be greater than 0 and less than MAX_NUM_LAYER_IDS" ); 
+#else
       xConfirmPara( m_layerIdsInSets[lsIdx][i] < 0 || m_layerIdsInSets[lsIdx].size() >= MAX_NUM_LAYER_IDS, "LayerIdsInSet must be greater than and less than MAX_NUM_LAYER_IDS" ); 
+#endif
     }
   }
@@ -2491,7 +2508,14 @@
   printf("WVSO:%d ", m_bUseWVSO );  
 #endif
+#if MTK_I0099_VPS_EX2
+  printf("LimQtPredFlag:%d ", m_bLimQtPredFlag ? 1 : 0);
+#endif
+#if !MTK_I0099_VPS_EX2 || MTK_I0099_FIX
 #if H_3D_QTLPC
   printf("QTL:%d ", m_bUseQTL);
+#if !MTK_I0099_VPS_EX2
   printf("PC:%d " , m_bUsePC );
+#endif
+#endif
 #endif
 #if H_3D_IV_MERGE
@@ -2520,6 +2544,12 @@
 #if H_3D_DIM
   printf("DMM:%d ", m_useDMM );
+#if SEPARATE_FLAG_I0085
+  printf("IVP:%d ", m_useIVP );
+#endif
   printf("SDC:%d ", m_useSDC );
   printf("DLT:%d ", m_useDLT );
+#endif
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  printf("SingleDepthMode:%d ",    m_useSingleDepthMode);
 #endif
 #if H_3D_INTER_SDC
Index: trunk/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncCfg.h	(revision 976)
+++ trunk/source/App/TAppEncoder/TAppEncCfg.h	(revision 1039)
@@ -131,4 +131,7 @@
   Int                    m_iSubPUMPILog2Size;                    
 #endif
+#endif
+#if MTK_I0099_VPS_EX2
+  Bool                   m_bLimQtPredFlag;
 #endif
 #if H_3D_ARP                                                  /// < flag and number of weighting factors in ARP
@@ -470,10 +473,20 @@
 #if H_3D_DIM
   Bool      m_useDMM;                                        ///< flag for using DMM
+#if SEPARATE_FLAG_I0085
+  Bool      m_useIVP;
+#endif
   Bool      m_useSDC;                                        ///< flag for using SDC
   Bool      m_useDLT;                                        ///< flag for using DLT
 #endif
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Bool     m_useSingleDepthMode;                          ///< flag for using single depth mode
+#endif
+#if !MTK_I0099_VPS_EX2 || MTK_I0099_FIX
 #if H_3D_QTLPC
   Bool      m_bUseQTL;                                        ///< flag for using depth QuadTree Limitation
+#if !MTK_I0099_VPS_EX2
   Bool      m_bUsePC;                                         ///< flag for using Predictive Coding with QTL
+#endif
+#endif
 #endif
 #if H_3D_INTER_SDC
Index: trunk/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 976)
+++ trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1039)
@@ -199,10 +199,20 @@
 #if H_3D_DIM
     m_cTEncTop.setUseDMM                       ( isDepth ? m_useDMM               : false );
+#if SEPARATE_FLAG_I0085
+    m_cTEncTop.setUseIVP                       ( isDepth ? m_useIVP               : false );
+#endif
     m_cTEncTop.setUseSDC                       ( isDepth ? m_useSDC               : false );
     m_cTEncTop.setUseDLT                       ( isDepth ? m_useDLT               : false );
 #endif
+#if MTK_SINGLE_DEPTH_MODE_I0095
+    m_cTEncTop.setUseSingleDepthMode           ( isDepth ? m_useSingleDepthMode   : false );
+#endif
+#if !MTK_I0099_VPS_EX2 || MTK_I0099_FIX
 #if H_3D_QTLPC
     m_cTEncTop.setUseQTL                       ( isDepth ? m_bUseQTL               : false );
+#if !MTK_I0099_VPS_EX2    
     m_cTEncTop.setUsePC                        ( isDepth ? m_bUsePC                : false );
+#endif
+#endif
 #endif
     //====== Depth Inter SDC =========
@@ -1815,4 +1825,7 @@
     {
       vps.setSubPULog2Size         ( layer, (layer != 1) ? 6: 0 ); 
+#if MTK_I0099_VPS_EX2
+      vps.setSubPUMPILog2Size      ( layer, (!isLayerZero) ? m_iSubPUMPILog2Size: 0 ); 
+#endif
     }
     else
@@ -1824,4 +1837,7 @@
 #if H_3D_DIM
     vps.setVpsDepthModesFlag( layer, isDepth && !isLayerZero && (m_useDMM || m_useSDC || m_useDLT ) );
+#if SEPARATE_FLAG_I0085
+    vps.setIVPFlag          ( layer, isDepth && !isLayerZero && m_useIVP );
+#endif
 #endif
 
@@ -1830,4 +1846,7 @@
     {
       vps.setIvMvPredFlag    (layer, false);
+#if SEC_HLS_CLEANUP_I0100
+      vps.setIvMvScalingFlag (layer, false); 
+#endif
     }
     else
@@ -1841,5 +1860,11 @@
         vps.setIvMvPredFlag         ( layer, !isLayerZero && m_ivMvPredFlag[0] ); 
       }
-    }
+#if SEC_HLS_CLEANUP_I0100
+      vps.setIvMvScalingFlag (layer, m_ivMvScalingFlag); 
+#endif
+    }
+#endif
+#if MTK_I0099_VPS_EX2
+    vps.setLimQtPredFlag         ( layer, isDepth && m_bLimQtPredFlag ); 
 #endif
 #if H_3D_NBDV_REF
@@ -1859,9 +1884,13 @@
 #endif
   }  
+#if !MTK_I0099_VPS_EX2
 #if H_3D_SPIVMP
   vps.setSubPUMPILog2Size( m_iSubPUMPILog2Size );
 #endif
+#endif
 #if H_3D
+#if !SEC_HLS_CLEANUP_I0100
   vps.setIvMvScalingFlag( m_ivMvScalingFlag );   
+#endif
 #endif
 }
Index: trunk/source/Lib/TAppCommon/program_options_lite.h
===================================================================
--- trunk/source/Lib/TAppCommon/program_options_lite.h	(revision 976)
+++ trunk/source/Lib/TAppCommon/program_options_lite.h	(revision 1039)
@@ -378,10 +378,18 @@
         std::string cDescBuffer;
 
+#if !FIX_TICKET_62
         cNameBuffer       .resize( name.size() + 10 );
         cDescBuffer.resize( desc.size() + 10 );
+#endif
 
         storage.resize(uiMaxNum);
         for ( unsigned int uiK = 0; uiK < uiMaxNum; uiK++ )
         {
+
+#if FIX_TICKET_62
+          cNameBuffer       .resize( name.size() + 10 );
+          cDescBuffer.resize( desc.size() + 10 );
+#endif
+
           Bool duplicate = (uiK != 0); 
           // isn't there are sprintf function for string??
Index: trunk/source/Lib/TLibCommon/ContextTables.h
===================================================================
--- trunk/source/Lib/TLibCommon/ContextTables.h	(revision 976)
+++ trunk/source/Lib/TLibCommon/ContextTables.h	(revision 1039)
@@ -51,5 +51,8 @@
 #define NUM_SPLIT_FLAG_CTX            3       ///< number of context models for split flag
 #define NUM_SKIP_FLAG_CTX             3       ///< number of context models for skip flag
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+#define NUM_SINGLEDEPTH_FLAG_CTX                     1
+#define NUM_SINGLE_DEPTH_VALUE_DATA_CTX              1       
+#endif
 #define NUM_MERGE_FLAG_EXT_CTX        1       ///< number of context models for merge flag of merge extended
 #define NUM_MERGE_IDX_EXT_CTX         1       ///< number of context models for merge index of merge extended
@@ -150,5 +153,20 @@
   { CNU,  CNU,  CNU, }, 
 };
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+static const UChar 
+INIT_SINGLEDEPTH_FLAG[3][NUM_SINGLEDEPTH_FLAG_CTX] =  
+{
+  { 185 }, 
+  { 185 }, 
+  { 185 }, 
+};
+static const UChar
+INIT_SINGLE_DEPTH_VALUE_DATA[3][NUM_SINGLE_DEPTH_VALUE_DATA_CTX] = 
+{
+  { 137 }, 
+  { 137 }, 
+  { 137 }, 
+};
+#endif
 static const UChar
 INIT_MERGE_FLAG_EXT[3][NUM_MERGE_FLAG_EXT_CTX] = 
@@ -432,9 +450,15 @@
 static const UChar INIT_DBBP_FLAG[3][DBBP_NUM_FLAG_CTX] =
 {
+#if SEC_DBBP_EXPLICIT_SIG_I0077
+  { CNU },
+  { CNU },
+  { CNU },
+#else
   { 161 },
   { 161 },
   { 161 },
-};
-#endif
-
-#endif
+#endif
+};
+#endif
+
+#endif
Index: trunk/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 976)
+++ trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1039)
@@ -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 )
 {
@@ -2622,5 +2677,9 @@
   }
 
+#if HS_DMM_SIGNALLING_I0120
+  if( isDimMode( getLumaIntraDir( uiAbsPartIdx ) ) )
+#else
   if( isDimMode( getLumaIntraDir( uiAbsPartIdx ) ) && !isDimDeltaDC( getLumaIntraDir( uiAbsPartIdx ) ) )
+#endif
   {
     return true;
@@ -2635,5 +2694,9 @@
   // check prediction mode
   UInt uiLumaPredMode = getLumaIntraDir( uiAbsPartIdx );  
+#if HS_DMM_SIGNALLING_I0120
+  if( uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX  ) )
+#else
   if( uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) )
+#endif
     return true;
   
@@ -3310,4 +3373,5 @@
   for(Int iLoop = 0; iLoop < 2; iLoop ++ ) 
   {
+#if !SEC_SIMP_SHIFTED_DV_I0086
     // IvDcShift (Derived from spatial Iv neighboring blocks)
     if( iLoop == 1 )
@@ -3343,4 +3407,5 @@
       }
     }
+#endif
 
     /// iLoop = 0 --> IvMCShift
@@ -3390,4 +3455,5 @@
 } 
 
+#if !SEC_SIMP_SHIFTED_DV_I0086
 inline Bool TComDataCU::xGetPosFirstAvailDmvCand(Int iCount, Int& posFirstAvailDmvCand )
 {
@@ -3406,4 +3472,5 @@
   return false;  
 }
+#endif
                                       
 #endif
@@ -3854,5 +3921,5 @@
 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
 #endif
-#if H_3D_VSP
+#if H_3D_VSP && !FIX_TICKET_79
       , InheritedVSPDisInfo*  inheritedVSPDisInfo
 #endif
@@ -3884,8 +3951,10 @@
   //////////////////////////////////
   DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
+#if !FIX_TICKET_79
   for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++)
   {
     inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo;   // To prevent run-time error, this code must be executed always for merging process.
   }
+#endif
   m_cDefaultDisInfo = cDisInfo;
 
@@ -4178,5 +4247,7 @@
                 TComMv cMv = cDefaultMvField.getMv() + cMvRounding;
                 cMv >>= 2;
+#if !FIX_TICKET_68
                 clipMv( cMv );
+#endif
                 cMvFieldSaved[eCurrRefPicList].setMvField(cMv, iRefPicList) ;
                 break;
@@ -5250,5 +5321,5 @@
 #endif
 
-
+#if !FIX_TICKET_76
 #if H_3D_VSP
 inline Void TComDataCU::xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount, InheritedVSPDisInfo*  inheritedVSPDisInfo)
@@ -5257,4 +5328,5 @@
   inheritedVSPDisInfo[iCount].m_acDvInfo.m_aVIdxCan = pcCURef->getDvInfo(uiAbsPartIdx).m_aVIdxCan;
 }
+#endif
 #endif
 /** Check whether the current PU and a spatial neighboring PU are in a same ME region.
@@ -5900,5 +5972,9 @@
     Int iColRefViewId  = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewIndex(); 
     iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId );
+#if SEC_HLS_CLEANUP_I0100
+    if ( iScale != 4096 && m_pcSlice->getVPS()->getIvMvScalingFlag(getSlice()->getLayerIdInVps()) ) 
+#else
     if ( iScale != 4096 && m_pcSlice->getVPS()->getIvMvScalingFlag() ) 
+#endif
     {
       rcMv = cColMv.scaleMv( iScale );
@@ -6083,5 +6159,9 @@
 
   TComMv cMv; 
+#if MTK_I0093
+  Int iDisp     = getSlice()->getDepthToDisparityB( 0 )[ 1 << ( getSlice()->getSPS()->getBitDepthY() - 1 ) ];
+#else
   Int iDisp     = getSlice()->getDepthToDisparityB( 0 )[ 128 ];
+#endif
   cMv.setHor(iDisp);
   cMv.setVer(0);
@@ -6091,4 +6171,61 @@
   return true;
 }
+#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 
@@ -6650,5 +6787,9 @@
   if( getSlice()->getIsDepth() )
   {
+#if MTK_I0099_VPS_EX2
+    iSubPUSize = 1<<getSlice()->getVPS()->getSubPUMPILog2Size(getSlice()->getLayerId());
+#else
     iSubPUSize = 1 << getSlice()->getVPS()->getSubPUMPILog2Size();
+#endif
   }
 
Index: trunk/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 976)
+++ trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 1039)
@@ -110,4 +110,8 @@
   // -------------------------------------------------------------------------------------------------------------------
   Bool*         m_skipFlag;           ///< array of skip flags
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Bool*         m_singleDepthFlag;           ///< array of single depth flags
+  Pel*          m_apSingleDepthValue;
+#endif
   Char*         m_pePartSize;         ///< array of partition sizes
   Char*         m_pePredMode;         ///< array of prediction modes
@@ -246,5 +250,7 @@
 #if H_3D_IV_MERGE
   Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int*   ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx ); 
+#if! SEC_SIMP_SHIFTED_DV_I0086
   Bool          xGetPosFirstAvailDmvCand( Int iCount, Int& iFirDispCand );
+#endif
 #endif
 
@@ -347,5 +353,15 @@
   Void         setSkipFlag           ( UInt idx, Bool skip)     { m_skipFlag[idx] = skip;   }
   Void         setSkipFlagSubParts   ( Bool skip, UInt absPartIdx, UInt depth );
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Bool*        getSingleDepthFlag            ()                        { return m_singleDepthFlag;          }
+  Bool         getSingleDepthFlag            (UInt idx)                { return m_singleDepthFlag[idx];     }
+  Void         setSingleDepthFlag           ( UInt idx, Bool singleDepth)     { m_singleDepthFlag[idx] = singleDepth;   }
+  Void         setSingleDepthFlagSubParts   ( Bool singleDepth, UInt absPartIdx, UInt depth );
+
+  Pel*         getSingleDepthValue( ) { return m_apSingleDepthValue; }
+  Pel          getSingleDepthValue            (UInt idx)                { return m_apSingleDepthValue[idx];     }
+  Void         setSingleDepthValue           ( UInt idx, Pel pDepthValue)     { m_apSingleDepthValue[idx] = pDepthValue;   }
+  Void         setSingleDepthValueSubParts   (Pel singleDepthValue, UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth );
+#endif  
   Char*         getPredictionMode     ()                        { return m_pePredMode;        }
   PredMode      getPredictionMode     ( UInt uiIdx )            { return static_cast<PredMode>( m_pePredMode[uiIdx] ); }
@@ -489,5 +505,7 @@
   Bool          getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm );
 #endif
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+   Bool          getNeighDepth (UInt uiPartIdx, UInt uiPartAddr, Pel* pNeighDepth, Int index);
+#endif
 #if H_3D_NBDV_REF
   Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT );
@@ -652,5 +670,5 @@
   Void          getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
 #endif
-#if H_3D_VSP
+#if H_3D_VSP && !FIX_TICKET_79
                                             , InheritedVSPDisInfo*  inheritedVSPDisInfo
 #endif
@@ -662,5 +680,7 @@
 
 #if H_3D_VSP
+#if !FIX_TICKET_76
   inline Void   xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount,  InheritedVSPDisInfo*  inheritedVSPDisInfo);
+#endif
 
 #if H_3D_SPIVMP
@@ -750,4 +770,10 @@
 
 #endif
+
+#if SHARP_DMM1_I0110
+  Bool         isDMM1UpscaleMode       ( UInt uiWidth ){ Bool bDMM1UpsampleModeFlag = true; UInt uiBaseWidth = 16; if( uiBaseWidth >= uiWidth ){ bDMM1UpsampleModeFlag = false; } return bDMM1UpsampleModeFlag; };
+  UInt         getDMM1BasePatternWidth ( UInt uiWidth ){ UInt uiBaseWidth = 16; if( uiBaseWidth >= uiWidth ){ uiBaseWidth =  uiWidth; } return uiBaseWidth; }
+#endif
+
 };
 
Index: trunk/source/Lib/TLibCommon/TComMotionInfo.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComMotionInfo.h	(revision 976)
+++ trunk/source/Lib/TLibCommon/TComMotionInfo.h	(revision 1039)
@@ -79,5 +79,5 @@
 } IDVInfo;
 #endif
-#if H_3D_VSP
+#if H_3D_VSP && !FIX_TICKET_79
 typedef struct _InheritedVSPDisCand 
 {
Index: trunk/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComPrediction.cpp	(revision 976)
+++ trunk/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1039)
@@ -423,5 +423,7 @@
 
   UInt dimType    = getDimType  ( uiIntraMode );
-  Bool dimDeltaDC = isDimDeltaDC( uiIntraMode );    
+#if !HS_DMM_SIGNALLING_I0120
+  Bool dimDeltaDC = isDimDeltaDC( uiIntraMode );
+#endif
   Bool isDmmMode  = (dimType <  DMM_NUM_TYPE);
 
@@ -438,5 +440,11 @@
     case( DMM1_IDX ): 
       {
+#if SHARP_DMM1_I0110
+        dmmSegmentation = pcCU->isDMM1UpscaleMode((UInt)iWidth) ? 
+            &(g_dmmWedgeLists[ g_aucConvertToBit[pcCU->getDMM1BasePatternWidth((UInt)iWidth)] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]) : 
+            &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]);
+#else
         dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]);
+#endif
       } break;
     case( DMM4_IDX ): 
@@ -456,6 +464,19 @@
     }
     assert( dmmSegmentation );
+#if SHARP_DMM1_I0110
+    if( dimType == DMM1_IDX && pcCU->isDMM1UpscaleMode((UInt)iWidth) ) 
+    {
+        biSegPattern = dmmSegmentation->getScaledPattern((UInt)iWidth);
+        patternStride = iWidth;
+    } 
+    else 
+    { 
+        biSegPattern  = dmmSegmentation->getPattern();
+        patternStride = dmmSegmentation->getStride ();
+    }
+#else
     biSegPattern  = dmmSegmentation->getPattern();
     patternStride = dmmSegmentation->getStride ();
+#endif
   }
 #endif
@@ -474,5 +495,9 @@
   Pel segDC1 = 0;
   Pel segDC2 = 0;
+#if HS_DMM_SIGNALLING_I0120
+  if( !pcCU->getSDCFlag( uiAbsPartIdx ) )
+#else
   if( dimDeltaDC )
+#endif
   {
     Pel deltaDC1 = pcCU->getDimDeltaDC( dimType, 0, uiAbsPartIdx );
@@ -543,4 +568,10 @@
     pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, i, iNumSPInOneLine, uiSPAddr[i]);
   }
+#if SHARP_ARP_CHROMA_I0104
+  if( pcCU->getARPW( uiPartAddr ) != 0 )
+  {
+    return;
+  }
+#endif
   // horizontal sub-PU merge
   for (Int i=0; i<iNumSP; i++)
@@ -714,4 +745,20 @@
   Int uiMinDepth = MAX_INT;
   Int uiMaxDepth = 0;
+#if SEC_DBBP_DMM4_THRESHOLD_I0076
+  iSumDepth  = pDepthPels[ 0 ];
+  iSumDepth += pDepthPels[ uiWidth - 1 ];
+  iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) ];
+  iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ];
+
+  uiMinDepth = pDepthPels[ 0 ];
+  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiWidth - 1 ]);
+  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) ]);
+  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]);
+
+  uiMaxDepth = pDepthPels[ 0 ];
+  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiWidth - 1 ]);
+  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) ]);
+  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]);
+#else
   for (Int y=0; y<uiHeight; y++)
   {
@@ -734,4 +781,5 @@
     pDepthPels += uiDepthStride;
   }
+#endif
   
   // don't generate mask for blocks with small depth range (encoder decision)
@@ -742,6 +790,10 @@
   
   AOF(uiWidth==uiHeight);
+#if SEC_DBBP_DMM4_THRESHOLD_I0076
+  Int iMean = iSumDepth >> 2;
+#else
   Int iSizeInBits = g_aucConvertToBit[uiWidth]+2;
   Int iMean = iSumDepth >> iSizeInBits*2;       // iMean /= (uiWidth*uiHeight);
+#endif
   
   // start again for segmentation
@@ -790,5 +842,9 @@
 }
 
+#if SHARP_DBBP_SIMPLE_FLTER_I0109
+Void TComPrediction::combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize )
+#else
 Void TComPrediction::combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr )
+#endif
 {
   Pel*  piSrc[2]    = {pInYuv[0]->getLumaAddr(uiPartAddr), pInYuv[1]->getLumaAddr(uiPartAddr)};
@@ -798,5 +854,7 @@
   
   UInt  uiMaskStride= MAX_CU_SIZE;
+#if !SHARP_DBBP_SIMPLE_FLTER_I0109
   Pel  filSrc = 0;
+#endif
   Pel* tmpTar = 0;
   tmpTar = (Pel *)xMalloc(Pel, uiWidth*uiHeight);
@@ -822,4 +880,42 @@
   }
   
+#if SHARP_DBBP_SIMPLE_FLTER_I0109
+  if (partSize == SIZE_Nx2N)
+  {
+    for (Int y=0; y<uiHeight; y++)
+    {
+      for (Int x=0; x<uiWidth; x++)
+      {
+        Bool l = (x==0)?pMaskStart[y*uiMaskStride+x]:pMaskStart[y*uiMaskStride+x-1];
+        Bool r = (x==uiWidth-1)?pMaskStart[y*uiMaskStride+x]:pMaskStart[y*uiMaskStride+x+1];
+        
+        Pel left, right;
+        left   = (x==0)          ? tmpTar[y*uiWidth+x] : tmpTar[y*uiWidth+x-1];
+        right  = (x==uiWidth-1)  ? tmpTar[y*uiWidth+x] : tmpTar[y*uiWidth+x+1];
+        
+        piDst[x] = (l!=r) ? ClipY( Pel(( left + (tmpTar[y*uiWidth+x] << 1) + right ) >> 2 )) : tmpTar[y*uiWidth+x]; 
+      }
+      piDst     += uiDstStride;
+    }
+  }
+  else // SIZE_2NxN
+  {
+    for (Int y=0; y<uiHeight; y++)
+    {
+      for (Int x=0; x<uiWidth; x++)
+      {
+        Bool t = (y==0)?pMaskStart[y*uiMaskStride+x]:pMaskStart[(y-1)*uiMaskStride+x];
+        Bool b = (y==uiHeight-1)?pMaskStart[y*uiMaskStride+x]:pMaskStart[(y+1)*uiMaskStride+x];
+        
+        Pel top, bottom;
+        top    = (y==0)          ? tmpTar[y*uiWidth+x] : tmpTar[(y-1)*uiWidth+x];
+        bottom = (y==uiHeight-1) ? tmpTar[y*uiWidth+x] : tmpTar[(y+1)*uiWidth+x];
+        
+        piDst[x] = (t!=b) ? ClipY( Pel(( top + (tmpTar[y*uiWidth+x] << 1) + bottom ) >> 2 )) : tmpTar[y*uiWidth+x];
+      }
+      piDst     += uiDstStride;
+    }
+  }
+#else
   for (Int y=0; y<uiHeight; y++)
   {
@@ -855,4 +951,6 @@
     piDst     += uiDstStride;
   }
+#endif
+
   if ( tmpTar    ) { xFree(tmpTar);             tmpTar        = NULL; }
   
@@ -891,4 +989,72 @@
   }
 
+#if SHARP_DBBP_SIMPLE_FLTER_I0109
+  if (partSize == SIZE_Nx2N)
+  {
+    for (Int y=0; y<uiHeightC; y++)
+    {
+      for (Int x=0; x<uiWidthC; x++)
+      {
+        Bool l = (x==0)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[y*2*uiMaskStride+(x-1)*2];
+        Bool r = (x==uiWidthC-1)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[y*2*uiMaskStride+(x+1)*2];
+
+        Pel leftU, rightU;
+        leftU   = (x==0)           ? tmpTarU[y*uiWidthC+x] : tmpTarU[y*uiWidthC+x-1];
+        rightU  = (x==uiWidthC-1)  ? tmpTarU[y*uiWidthC+x] : tmpTarU[y*uiWidthC+x+1];
+        Pel leftV, rightV;
+        leftV   = (x==0)           ? tmpTarV[y*uiWidthC+x] : tmpTarV[y*uiWidthC+x-1];
+        rightV  = (x==uiWidthC-1)  ? tmpTarV[y*uiWidthC+x] : tmpTarV[y*uiWidthC+x+1];
+
+        if (l!=r)
+        {
+          filSrcU = ClipC( Pel(( leftU + (tmpTarU[y*uiWidthC+x] << 1) + rightU ) >> 2 ));
+          filSrcV = ClipC( Pel(( leftV + (tmpTarV[y*uiWidthC+x] << 1) + rightV ) >> 2 ));
+        }
+        else
+        {
+          filSrcU = tmpTarU[y*uiWidthC+x];
+          filSrcV = tmpTarV[y*uiWidthC+x];
+        }
+        piDstU[x] = filSrcU;
+        piDstV[x] = filSrcV;
+      }
+      piDstU      += uiDstStrideC;
+      piDstV      += uiDstStrideC;
+    }
+  }
+  else
+  {
+    for (Int y=0; y<uiHeightC; y++)
+    {
+      for (Int x=0; x<uiWidthC; x++)
+      {
+        Bool t = (y==0)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[(y-1)*2*uiMaskStride+x*2];
+        Bool b = (y==uiHeightC-1)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[(y+1)*2*uiMaskStride+x*2];
+
+        Pel topU, bottomU;
+        topU    = (y==0)           ? tmpTarU[y*uiWidthC+x] : tmpTarU[(y-1)*uiWidthC+x];
+        bottomU = (y==uiHeightC-1) ? tmpTarU[y*uiWidthC+x] : tmpTarU[(y+1)*uiWidthC+x];
+        Pel topV, bottomV;
+        topV    = (y==0)           ? tmpTarV[y*uiWidthC+x] : tmpTarV[(y-1)*uiWidthC+x];
+        bottomV = (y==uiHeightC-1) ? tmpTarV[y*uiWidthC+x] : tmpTarV[(y+1)*uiWidthC+x];
+
+        if (t!=b)
+        {
+          filSrcU = ClipC( Pel(( topU + (tmpTarU[y*uiWidthC+x] << 1) + bottomU ) >> 2 ));
+          filSrcV = ClipC( Pel(( topV + (tmpTarV[y*uiWidthC+x] << 1) + bottomV ) >> 2 ));
+        }
+        else
+        {
+          filSrcU = tmpTarU[y*uiWidthC+x];
+          filSrcV = tmpTarV[y*uiWidthC+x];
+        }
+        piDstU[x] = filSrcU;
+        piDstV[x] = filSrcV;
+      }
+      piDstU      += uiDstStrideC;
+      piDstV      += uiDstStrideC;
+    }
+  }
+#else
   for (Int y=0; y<uiHeightC; y++)
   {
@@ -936,4 +1102,5 @@
     piDstV      += uiDstStrideC;
   }
+#endif
   if ( tmpTarU    ) { xFree(tmpTarU);             tmpTarU        = NULL; }
   if ( tmpTarV    ) { xFree(tmpTarV);             tmpTarV        = NULL; }
@@ -1308,7 +1475,11 @@
   pcCU->clipMv(cMv);
   TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec();
+#if QC_I0129_ARP_FIX
+  xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 ), true );
+  xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 ), true );
+#else
   xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, true );
   xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, true );
-
+#endif
   if( dW > 0 )
   {
@@ -1318,4 +1489,10 @@
     TComMv cMVwithDisparity = cMv + cDistparity.m_acNBDV;
     pcCU->clipMv(cMVwithDisparity);
+#if SHARP_ARP_CHROMA_I0104
+    if (iWidth <= 8)
+    {
+      pYuvB0->clear(); pYuvB1->clear();
+    }
+#endif
 
     assert ( cDistparity.bDV );
@@ -1326,6 +1503,14 @@
     
     pcPicYuvRef = pcPicYuvBaseCol->getPicYuvRec();
+#if QC_I0129_ARP_FIX
+    xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, true, true );
+#if SHARP_ARP_CHROMA_I0104
+    if (iWidth > 8)
+#endif
+    xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, true, true );
+#else
     xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, bi, true );
     xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, bi, true );
+#endif
 #else
     pcPicYuvRef = pcPicYuvBaseCol->getPicYuvRec();
@@ -1335,7 +1520,14 @@
     
     pcPicYuvRef = pcPicYuvBaseRef->getPicYuvRec();
+#if QC_I0129_ARP_FIX
+    xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, true, true );
+#if SHARP_ARP_CHROMA_I0104
+    if (iWidth > 8)
+#endif
+    xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, true, true );
+#else
     xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, bi, true );
     xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, bi, true );
-
+#endif
     pYuvB0->subtractARP( pYuvB0 , pYuvB1 , uiPartAddr , iWidth , iHeight );
 
@@ -1347,4 +1539,75 @@
   }
 }
+
+#if QC_I0051_ARP_SIMP
+Bool TComPrediction::xCheckBiInterviewARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc )
+{
+  Int         iRefIdx       = pcCU->getCUMvField( eBaseRefPicList )->getRefIdx( uiPartAddr );
+  TComMv      cDMv          = pcCU->getCUMvField( eBaseRefPicList )->getMv( uiPartAddr );
+  TComPic* pcPicYuvBaseCol  = pcCU->getSlice()->getRefPic( eBaseRefPicList, iRefIdx );  
+  TComPicYuv* pcYuvBaseCol  = pcPicYuvBaseCol->getPicYuvRec();
+  Int uiLCUAddr,uiAbsPartAddr;
+  Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2  + ((cDMv.getHor() + 2)>>2);
+  Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2);
+
+  irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX);
+  irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY);  
+  pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr);
+  TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr );
+
+  TComPic* pcPicYuvBaseTRef = NULL;
+  pcPicYuvCurrTRef = NULL;
+
+  //If there is available motion in base reference list, use it
+  if(!pColCU->isIntra(uiAbsPartAddr))
+  {
+    for(Int iList = 0; iList < (pColCU->getSlice()->isInterB() ? 2: 1); iList ++)
+    {
+      RefPicList eRefPicListCurr = RefPicList(iList);
+      Int iRef = pColCU->getCUMvField(eRefPicListCurr)->getRefIdx(uiAbsPartAddr);
+      if( iRef != -1)
+      {
+        pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicListCurr, iRef);  
+        Int  iCurrPOC    = pColCU->getSlice()->getPOC();
+        Int  iCurrRefPOC = pcPicYuvBaseTRef->getPOC();
+        Int  iCurrRef    = pcCU->getSlice()->getFirstTRefIdx(eRefPicListCurr);
+#if MTK_I0072_IVARP_SCALING_FIX
+        if( iCurrRef >= 0 && iCurrPOC != iCurrRefPOC)
+#else
+        if( iCurrRef >= 0)
+#endif
+        {
+          pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic(eRefPicListCurr,iCurrRef);  
+          Int iTargetPOC = pcPicYuvCurrTRef->getPOC();
+          pcPicYuvBaseTRef =  pcCU->getSlice()->getBaseViewRefPic(iTargetPOC,  pcPicYuvBaseCol->getViewIndex() );  
+          if(pcPicYuvBaseTRef)
+          {
+            cBaseTMV = pColCU->getCUMvField(eRefPicListCurr)->getMv(uiAbsPartAddr);
+            Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC);
+            if ( iScale != 4096 )
+            {
+              cBaseTMV = cBaseTMV.scaleMv( iScale );
+            }
+            iCurrTRefPoc = iTargetPOC;
+            return true;
+          }
+        }
+      }
+    }
+  }
+
+  //If there is no available motion in base reference list, use ( 0, 0 )
+  if( pcCU->getSlice()->getFirstTRefIdx( eBaseRefPicList ) >= 0 )
+  {
+    cBaseTMV.set( 0, 0 );
+    pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic( eBaseRefPicList,  pcCU->getSlice()->getFirstTRefIdx( eBaseRefPicList ) );
+    iCurrTRefPoc = pcPicYuvCurrTRef->getPOC();
+    return true;
+  }
+
+  return false;
+}
+#endif
+
 Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled )
 {
@@ -1380,6 +1643,72 @@
   pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr);
   TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr );
-
+#if QC_I0051_ARP_SIMP
+  if( pcCU->getSlice()->isInterB() && !pcCU->getSlice()->getIsDepth() )
+  {
+    RefPicList eOtherRefList = ( eRefPicList == REF_PIC_LIST_0 ) ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
+    Int iOtherRefIdx = pcCU->getCUMvField( eOtherRefList )->getRefIdx( uiPartAddr );
+    //The other prediction direction is temporal ARP
+    if( iOtherRefIdx >= 0 && pcCU->getSlice()->getViewIndex() == pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx )->getViewIndex() )
+    {
+      bTMVAvai = true;
+      pcPicYuvBaseTRef = pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx );
+      Int  iCurrPOC    = pcCU->getSlice()->getPOC();
+      Int  iCurrRefPOC = pcPicYuvBaseTRef->getPOC();
+      Int  iCurrRef    = pcCU->getSlice()->getFirstTRefIdx( eOtherRefList );
+      
+      if( iCurrRef >= 0 )
+      {
+        pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic( eOtherRefList,iCurrRef );  
+        Int iTargetPOC = pcPicYuvCurrTRef->getPOC();
+        pcPicYuvBaseTRef =  pcCU->getSlice()->getBaseViewRefPic( iTargetPOC,  pcPicYuvBaseCol->getViewIndex() );
+        if( pcPicYuvBaseTRef )
+        {
+          cBaseTMV = pcCU->getCUMvField( eOtherRefList )->getMv( uiPartAddr );
+          Int iScale = pcCU-> xGetDistScaleFactor( iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC );
+          if ( iScale != 4096 )
+          {
+            cBaseTMV = cBaseTMV.scaleMv( iScale );
+          }
+        }
+        else
+        {
+          dW = 0;
+        }
+      }
+      else
+      {
+        dW = 0;
+      }
+    }
+
+    //Both prediction directions are inter-view ARP
+    if ( iOtherRefIdx >= 0 && !bTMVAvai )
+    {
+      RefPicList eBaseList = REF_PIC_LIST_0;
+      Int iCurrTRefPoc;
+      bTMVAvai = ( eBaseList != eRefPicList ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx )->getViewIndex() );
+
+      if ( bTMVAvai )
+      {
+        if( xCheckBiInterviewARP( pcCU, uiPartAddr, iWidth, iHeight, eBaseList, pcPicYuvCurrTRef, cBaseTMV, iCurrTRefPoc ) )
+        {
+          pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic( iCurrTRefPoc,  pcPicYuvBaseCol->getViewIndex() );
+          if ( pcPicYuvBaseTRef == NULL )
+          {
+            dW = 0;
+          }
+        }
+        else
+        {
+          dW = 0;
+        }
+      }
+    }
+  }
+
+  if( !pColCU->isIntra( uiAbsPartAddr ) && !bTMVAvai )
+#else
   if(!pColCU->isIntra(uiAbsPartAddr))
+#endif
   {
     TComMvField puMVField;
@@ -1394,5 +1723,9 @@
         Int  iCurrRefPOC = pcPicYuvBaseTRef->getPOC();
         Int  iCurrRef    = pcCU->getSlice()->getFirstTRefIdx(eRefPicListCurr);
+#if MTK_I0072_IVARP_SCALING_FIX
+        if (iCurrRef >= 0 && iCurrRefPOC != iCurrPOC)
+#else
         if( iCurrRef >= 0)
+#endif
         {
           pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic(eRefPicListCurr,iCurrRef);  
@@ -1421,8 +1754,11 @@
     pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic  (eRefPicList,  pcCU->getSlice()->getFirstTRefIdx(eRefPicList));      
   }
-
+#if QC_I0129_ARP_FIX
+  xPredInterLumaBlk  ( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ),        bTMVAvai);
+  xPredInterChromaBlk( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ),        bTMVAvai);
+#else
   xPredInterLumaBlk  ( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi,        bTMVAvai);
   xPredInterChromaBlk( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi,        bTMVAvai);
-
+#endif
   if( dW > 0 && bTMVAvai ) 
   {
@@ -1435,5 +1771,22 @@
     pcCU->clipMv(cBaseTMV);
     pcCU->clipMv(cTempMv);
-
+#if SHARP_ARP_CHROMA_I0104
+    if (iWidth <= 8)
+    {
+      pYuvCurrTRef->clear(); pYuvBaseTRef->clear();
+    }
+#endif
+#if QC_I0129_ARP_FIX
+    xPredInterLumaBlk  ( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, true,   true);
+#if SHARP_ARP_CHROMA_I0104
+    if (iWidth > 8)
+#endif
+    xPredInterChromaBlk( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, true,   true);
+    xPredInterLumaBlk  ( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, true,   true); 
+#if SHARP_ARP_CHROMA_I0104
+    if (iWidth > 8)
+#endif
+    xPredInterChromaBlk( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, true,   true); 
+#else
     xPredInterLumaBlk  ( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi,   true);
     xPredInterChromaBlk( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi,   true);
@@ -1441,4 +1794,5 @@
     xPredInterChromaBlk( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, bi,   true); 
 
+#endif
     pYuvCurrTRef->subtractARP( pYuvCurrTRef , pYuvBaseTRef , uiPartAddr , iWidth , iHeight );  
     if(dW == 2)
@@ -1974,12 +2328,18 @@
   Int iRecStride = ( eType == TEXT_LUMA ) ? pRecPic->getStride() : pRecPic->getCStride();
   Int iRefStride = ( eType == TEXT_LUMA ) ? pRefPic->getStride() : pRefPic->getCStride();
+#if SEC_IC_NEIGHBOR_CLIP_I0080
+  Int iRefOffset, iHor, iVer;
+#else
   Int iCUPelX, iCUPelY, iRefX, iRefY, iRefOffset, iHor, iVer;
 
   iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
   iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
+#endif
   iHor = pcCU->getSlice()->getIsDepth() ? pMv->getHor() : ( ( pMv->getHor() + 2 ) >> 2 );
   iVer = pcCU->getSlice()->getIsDepth() ? pMv->getVer() : ( ( pMv->getVer() + 2 ) >> 2 );
+#if !SEC_IC_NEIGHBOR_CLIP_I0080
   iRefX   = iCUPelX + iHor;
   iRefY   = iCUPelY + iVer;
+#endif
   if( eType != TEXT_LUMA )
   {
@@ -1997,5 +2357,9 @@
   Int precShift = std::max(0, (( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC) - 12);
 
+#if SEC_IC_NEIGHBOR_CLIP_I0080
+  if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) )
+#else
   if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) && iCUPelY > 0 && iRefY > 0 )
+#endif
   {
     iRefOffset = iHor + iVer * iRefStride - iRefStride;
@@ -2027,6 +2391,9 @@
   }
 
-
+#if SEC_IC_NEIGHBOR_CLIP_I0080
+  if( pcCU->getPULeft( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) )
+#else
   if( pcCU->getPULeft( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) && iCUPelX > 0 && iRefX > 0 )
+#endif
   {
     iRefOffset = iHor + iVer * iRefStride - 1;
@@ -2061,4 +2428,13 @@
     iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 1 );
   }
+
+#if FIX_TICKET_71
+  if( iCountShift == 0 )
+  {
+    a = ( 1 << IC_CONST_SHIFT );
+    b = 0;
+    return;
+  }
+#endif
 
   xy += xx >> IC_REG_COST_SHIFT;
@@ -2177,4 +2553,11 @@
   // find contour for texture luma block
   UInt iDC = 0;
+#if SEC_DBBP_DMM4_THRESHOLD_I0076
+  iDC  = piRefBlkY[ 0 ];
+  iDC += piRefBlkY[ uiWidth - 1 ];
+  iDC += piRefBlkY[ uiWidth * (uiHeight - 1) ];
+  iDC += piRefBlkY[ uiWidth * (uiHeight - 1) + uiWidth - 1 ];
+  iDC = iDC >> 2;
+#else
   for( UInt k = 0; k < (uiWidth*uiHeight); k++ ) 
   { 
@@ -2184,4 +2567,5 @@
   Int cuMaxLog2Size = g_aucConvertToBit[g_uiMaxCUWidth]+2;   // 
   iDC = iDC >> (cuMaxLog2Size - pcCU->getDepth(0))*2;        //  iDC /= (uiWidth*uiHeight);
+#endif
 
   piRefBlkY = cTempYuv.getLumaAddr();
Index: trunk/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComPrediction.h	(revision 976)
+++ trunk/source/Lib/TLibCommon/TComPrediction.h	(revision 1039)
@@ -90,4 +90,7 @@
 #if H_3D_ARP
   Void xPredInterUniARP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false, TComMvField * pNewMvFiled = NULL );
+#if QC_I0051_ARP_SIMP
+  Bool xCheckBiInterviewARP     ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc );
+#endif
   Void xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled = NULL );
 #endif
@@ -176,5 +179,9 @@
   PartSize      getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize);
   Bool          getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask );
+#if SHARP_DBBP_SIMPLE_FLTER_I0109
+  Void          combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize );
+#else
   Void          combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr = 0 );
+#endif
 #endif
 
Index: trunk/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 976)
+++ trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 1039)
@@ -336,7 +336,13 @@
   HALF_PEL,    //   8x8
   FULL_PEL,    //  16x16
+#if SHARP_DMM1_I0110
+  FULL_PEL,    //  32x32
+  FULL_PEL,    //  64x64
+  FULL_PEL     // 128x128
+#else
   DOUBLE_PEL,  //  32x32
   DOUBLE_PEL,  //  64x64
   DOUBLE_PEL   // 128x128
+#endif
 };
 
@@ -348,4 +354,8 @@
 { //2x2   4x4   8x8 16x16 32x32 64x64
      0,    4,    7,    8,    8,    0 };
+
+#if SHARP_DMM1_I0110
+Bool g_wedgePattern[32*32];
+#endif
 
 extern std::vector< std::vector<TComWedgelet> >   g_dmmWedgeLists;
@@ -646,5 +656,9 @@
   if( !g_dmmWedgeLists.empty() ) return;
 
+#if SHARP_DMM1_I0110
+  for( UInt ui = g_aucConvertToBit[DIM_MIN_SIZE]; ui < (g_aucConvertToBit[DIM_MAX_SIZE]); ui++ )
+#else
   for( UInt ui = g_aucConvertToBit[DIM_MIN_SIZE]; ui < (g_aucConvertToBit[DIM_MAX_SIZE]+1); ui++ )
+#endif
   {
     UInt uiWedgeBlockSize = ((UInt)DIM_MIN_SIZE)<<ui;
@@ -730,5 +744,7 @@
   switch( eWedgeRes )
   {
+#if !SHARP_DMM1_I0110
   case( DOUBLE_PEL ): { uiBlockSize = (uiWidth>>1); break; }
+#endif
   case(   FULL_PEL ): { uiBlockSize =  uiWidth;     break; }
   case(   HALF_PEL ): { uiBlockSize = (uiWidth<<1); break; }
Index: trunk/source/Lib/TLibCommon/TComRom.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComRom.h	(revision 976)
+++ trunk/source/Lib/TLibCommon/TComRom.h	(revision 1039)
@@ -166,4 +166,8 @@
 extern const UChar                                           g_dmm3IntraTabIdxBits[6];
 
+#if SHARP_DMM1_I0110
+extern Bool                                                  g_wedgePattern[32*32];
+#endif 
+
 extern       std::vector< std::vector<TComWedgelet> >        g_dmmWedgeLists;
 extern       std::vector< std::vector<TComWedgeRef> >        g_dmmWedgeRefLists;
Index: trunk/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 976)
+++ trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 1039)
@@ -139,4 +139,7 @@
 , m_depthToDisparityF             ( NULL )
 #endif
+#if MTK_SINGLE_DEPTH_MODE_I0095
+, m_bApplySingleDepthMode         (false)
+#endif
 #endif
 {
@@ -644,5 +647,9 @@
   
   TComPic**             refPicSetStCurr    [2] = { RefPicSetStCurr0, RefPicSetStCurr1 };
+#if FIX_WARNING
+  Int numPocStCurr[2] = { (Int)NumPocStCurr0, (Int)NumPocStCurr1 }; 
+#else
   Int numPocStCurr[2] = { NumPocStCurr0, NumPocStCurr1 }; 
+#endif
 
   for (Int li = 0; li < ((m_eSliceType==B_SLICE) ? 2 : 1); li++)
@@ -1091,4 +1098,7 @@
     m_interLayerPredLayerIdc[ layer ] = pSrc->m_interLayerPredLayerIdc[ layer ]; 
   }
+#endif
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  m_bApplySingleDepthMode = pSrc->m_bApplySingleDepthMode;
 #endif
 #if H_3D_IC
@@ -1942,5 +1952,12 @@
     m_viewIndex         [i] = -1; 
     m_vpsDepthModesFlag [i] = false;
+#if SEC_HLS_CLEANUP_I0100
+    m_ivMvScalingFlag[i] = true; 
+#else
     m_ivMvScalingFlag = true; 
+#endif
+#if SEPARATE_FLAG_I0085
+    m_bIVPFlag [i]      = false;
+#endif
 #endif
 
@@ -1974,4 +1991,7 @@
 #endif
 #endif
+#if MTK_I0099_VPS_EX2
+    m_bLimQtPredFlag       [ i ] = false;
+#endif
 #if H_3D_VSP
     m_viewSynthesisPredFlag[ i ] = false;
@@ -1982,4 +2002,7 @@
 #if H_3D_INTER_SDC
     m_bInterSDCFlag        [ i ] = false;
+#endif
+#if SEPARATE_FLAG_I0085
+    m_bIVPFlag             [ i ] = false;
 #endif
 #if H_3D_DBBP
@@ -2502,7 +2525,9 @@
 , m_pcmLog2MaxSize            (  5)
 , m_uiPCMLog2MinSize          (  7)
+#if !MTK_I0099_VPS_EX2
 #if H_3D_QTLPC
 , m_bUseQTL                   (false)
 , m_bUsePC                    (false)
+#endif
 #endif
 , m_bitDepthY                 (  8)
@@ -2774,6 +2799,7 @@
     // allocate some memory and initialize with default mapping
     m_iNumDepthmapValues[i] = ((1 << m_uiDepthViewBitDepth)-1)+1;
+#if !FIX_TICKET_77
     m_iBitsPerDepthValue[i] = numBitsForValue(m_iNumDepthmapValues[i]);
-
+#endif
     m_iDepthValue2Idx[i]    = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]);
     m_iIdx2DepthValue[i]    = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]);
@@ -2864,5 +2890,7 @@
   // update DLT variables
   m_iNumDepthmapValues[layerIdInVps] = iNumDepthValues;
+#if !FIX_TICKET_77
   m_iBitsPerDepthValue[layerIdInVps] = numBitsForValue(m_iNumDepthmapValues[layerIdInVps]);
+#endif
 }
 
Index: trunk/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.h	(revision 976)
+++ trunk/source/Lib/TLibCommon/TComSlice.h	(revision 1039)
@@ -798,8 +798,18 @@
 #if H_3D_IV_MERGE
   Bool        m_ivMvPredFlag             [ MAX_NUM_LAYERS ]; 
+#if SEC_HLS_CLEANUP_I0100
+  Bool        m_ivMvScalingFlag          [ MAX_NUM_LAYERS ]; 
+#endif
 #if H_3D_SPIVMP
   Int         m_iSubPULog2Size           [MAX_NUM_LAYERS   ];
+#if MTK_I0099_VPS_EX2
+  Int         m_iSubPUMPILog2Size        [MAX_NUM_LAYERS   ];
+#else
   Int         m_iSubPUMPILog2Size;
 #endif
+#endif
+#endif
+#if MTK_I0099_VPS_EX2
+  Bool        m_bLimQtPredFlag           [ MAX_NUM_LAYERS ];
 #endif
 #if H_3D_VSP
@@ -810,4 +820,7 @@
 #endif
   Bool        m_vpsDepthModesFlag        [MAX_NUM_LAYERS   ];
+#if SEPARATE_FLAG_I0085
+  Bool        m_bIVPFlag                 [MAX_NUM_LAYERS   ];
+#endif
 
 #if H_3D
@@ -817,5 +830,9 @@
   Int         ***m_aaaiCodedScale ;
   Int         ***m_aaaiCodedOffset;
+
+#if !SEC_HLS_CLEANUP_I0100
   Bool        m_ivMvScalingFlag; 
+#endif
+
 #endif
 #if H_3D_INTER_SDC
@@ -1130,7 +1147,16 @@
   Int     getSubPULog2Size(Int layerIdInVps)           { return m_iSubPULog2Size[layerIdInVps]; }
   Void    setSubPULog2Size(Int layerIdInVps, Int u)    { m_iSubPULog2Size[layerIdInVps] = u;}
+#if MTK_I0099_VPS_EX2
+  Int     getSubPUMPILog2Size(Int layerIdInVps)           { return m_iSubPUMPILog2Size[layerIdInVps]; }
+  Void    setSubPUMPILog2Size(Int layerIdInVps, Int u)    { m_iSubPUMPILog2Size[layerIdInVps] = u;}
+#else
   Int     getSubPUMPILog2Size( )           { return m_iSubPUMPILog2Size; }
   Void    setSubPUMPILog2Size( Int u )     { m_iSubPUMPILog2Size = u;    }
 #endif
+#endif
+#endif
+#if MTK_I0099_VPS_EX2
+  Void    setLimQtPredFlag    ( Int layerIdInVps, Bool val )  { m_bLimQtPredFlag[ layerIdInVps ] = val; }
+  Bool    getLimQtPredFlag    ( Int layerIdInVps ) { return m_bLimQtPredFlag[layerIdInVps];}
 #endif
 #if H_3D_VSP
@@ -1144,7 +1170,17 @@
   Void    setVpsDepthModesFlag( Int layerIdInVps, Bool val )               { m_vpsDepthModesFlag[ layerIdInVps ] = val; }
   Bool    getVpsDepthModesFlag( Int layerIdInVps )                         { return m_vpsDepthModesFlag[ layerIdInVps ]; }
-
+#if SEPARATE_FLAG_I0085
+  Void    setIVPFlag( Int layerIdInVps, Bool val )                    { m_bIVPFlag[ layerIdInVps ] = val; }
+  Bool    getIVPFlag( Int layerIdInVps )                              { return m_bIVPFlag[ layerIdInVps ]; }
+#endif
+
+#if SEC_HLS_CLEANUP_I0100
+  Bool    getIvMvScalingFlag   ( Int layerIdInVps )                        { return m_ivMvScalingFlag[ layerIdInVps ]; }
+  Void    setIvMvScalingFlag   (Int layerIdInVps, Bool b )                 { m_ivMvScalingFlag[ layerIdInVps ] = b;    }  
+#else
   Bool    getIvMvScalingFlag   (  )                       { return m_ivMvScalingFlag; }
   Void    setIvMvScalingFlag   ( Bool b )                 { m_ivMvScalingFlag = b;    }  
+#endif
+
 #if H_3D_INTER_SDC
   Bool    getInterSDCFlag      ( Int layerIdInVps )           { return m_bInterSDCFlag[layerIdInVps]; }
@@ -1171,5 +1207,7 @@
   Bool        m_bInterViewDltPredEnableFlag[ MAX_NUM_LAYERS ];
 
+#if !FIX_TICKET_77
   Int         m_iBitsPerDepthValue       [ MAX_NUM_LAYERS ];
+#endif
   Int         m_iNumDepthmapValues       [ MAX_NUM_LAYERS ];
   Int*        m_iDepthValue2Idx          [ MAX_NUM_LAYERS ];
@@ -1198,8 +1236,14 @@
   UInt    getDepthViewBitDepth()                          { return m_uiDepthViewBitDepth; }
 
+#if !FIX_TICKET_77
   Int     getBitsPerDepthValue( Int layerIdInVps )        { return getUseDLTFlag(layerIdInVps)?m_iBitsPerDepthValue[layerIdInVps]:g_bitDepthY; }
+#endif
   Int     getNumDepthValues( Int layerIdInVps )           { return getUseDLTFlag(layerIdInVps)?m_iNumDepthmapValues[layerIdInVps]:((1 << g_bitDepthY)-1); }
   Int     depthValue2idx( Int layerIdInVps, Pel value )   { return getUseDLTFlag(layerIdInVps)?m_iDepthValue2Idx[layerIdInVps][value]:value; }
+#if RWTH_DLT_CLIP_I0057
+  Pel     idx2DepthValue( Int layerIdInVps, UInt uiIdx )  { return getUseDLTFlag(layerIdInVps)?m_iIdx2DepthValue[layerIdInVps][ClipY(uiIdx)]:uiIdx; }
+#else
   Pel     idx2DepthValue( Int layerIdInVps, UInt uiIdx )  { return getUseDLTFlag(layerIdInVps)?m_iIdx2DepthValue[layerIdInVps][uiIdx]:uiIdx; }
+#endif
   Void    setDepthLUTs( Int layerIdInVps, Int* idx2DepthValue = NULL, Int iNumDepthValues = 0 );
 #if H_3D_DELTA_DLT
@@ -1466,7 +1510,9 @@
   Bool        m_useAMP;
 
+#if !MTK_I0099_VPS_EX2
 #if H_3D_QTLPC
   Bool        m_bUseQTL;
   Bool        m_bUsePC;
+#endif
 #endif
   // Parameter
@@ -1732,4 +1778,5 @@
 
 #endif
+#if !MTK_I0099_VPS_EX2
 #if H_3D_QTLPC
   Void setUseQTL( Bool b ) { m_bUseQTL = b;    }
@@ -1737,4 +1784,5 @@
   Void setUsePC ( Bool b ) { m_bUsePC  = b;    }
   Bool getUsePC ()         { return m_bUsePC;  }
+#endif
 #endif
 #if H_MV
@@ -2205,5 +2253,7 @@
   UInt         m_aiDDDShift    [MAX_NUM_LAYERS];
 #endif
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Bool      m_bApplySingleDepthMode;
+#endif
 public:
   TComSlice();
@@ -2275,4 +2325,8 @@
 #if H_3D
   TComPic*  getTexturePic       ()                              { return  m_ivPicsCurrPoc[0][ m_viewIndex ]; }
+#endif
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Void      setApplySingleDepthMode( Bool b )                                { m_bApplySingleDepthMode = b; }
+  Bool      getApplySingleDepthMode()                                        { return m_bApplySingleDepthMode; }
 #endif
 #if H_3D_IC
@@ -2509,5 +2563,7 @@
   Int* getDepthToDisparityF( Int refViewIdx ) { return m_depthToDisparityF[ refViewIdx ]; }; 
   Bool getVpsDepthModesFlag  ()  { return getVPS()->getVpsDepthModesFlag( getVPS()->getLayerIdInVps( m_layerId ) ); }
-
+#if SEPARATE_FLAG_I0085
+  Bool getIVPFlag       ()  { return getVPS()->getIVPFlag( getVPS()->getLayerIdInVps( m_layerId ) ); }
+#endif
 #endif
 #if H_MV
Index: trunk/source/Lib/TLibCommon/TComWedgelet.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComWedgelet.cpp	(revision 976)
+++ trunk/source/Lib/TLibCommon/TComWedgelet.cpp	(revision 1039)
@@ -68,4 +68,7 @@
                                                             m_uiHeight ( rcWedge.m_uiHeight  ),
                                                             m_pbPattern( (Bool*)xMalloc( Bool, (m_uiWidth * m_uiHeight) ) )
+#if SHARP_DMM1_I0110
+                                                            ,m_pbScaledPattern( g_wedgePattern )
+#endif
 {
   ::memcpy( m_pbPattern, rcWedge.m_pbPattern, sizeof(Bool) * (m_uiWidth * m_uiHeight));
@@ -85,4 +88,7 @@
 
   m_pbPattern = (Bool*)xMalloc( Bool, (m_uiWidth * m_uiHeight) );
+#if SHARP_DMM1_I0110
+  m_pbScaledPattern = g_wedgePattern;
+#endif
 }
 
@@ -181,9 +187,12 @@
   switch( m_eWedgeRes )
   {
+#if !SHARP_DMM1_I0110
   case( DOUBLE_PEL ): { uiTempBlockSize =  m_uiWidth;     uhXs = (m_uhXs<<1); uhYs = (m_uhYs<<1); uhXe = (m_uhXe<<1); uhYe = (m_uhYe<<1); } break;
+#endif
   case(   FULL_PEL ): { uiTempBlockSize =  m_uiWidth;     uhXs =  m_uhXs;     uhYs =  m_uhYs;     uhXe =  m_uhXe;     uhYe =  m_uhYe;     } break;
   case(   HALF_PEL ): { uiTempBlockSize = (m_uiWidth<<1); uhXs =  m_uhXs;     uhYs =  m_uhYs;     uhXe =  m_uhXe;     uhYe =  m_uhYe;     } break;
   }
 
+#if !SHARP_DMM1_I0110
   if( m_eWedgeRes == DOUBLE_PEL) // adjust line-end for DOUBLE_PEL resolution
   {
@@ -194,4 +203,5 @@
     if( m_uhOri == 5 ) { uhXs = uiTempBlockSize-1; }
   }
+#endif
 
   Bool* pbTempPattern = new Bool[ (uiTempBlockSize * uiTempBlockSize) ];
@@ -223,5 +233,7 @@
   switch( m_eWedgeRes )
   {
+#if !SHARP_DMM1_I0110
   case( DOUBLE_PEL ): { for( UInt k = 0; k < (m_uiWidth * m_uiHeight); k++ ) { m_pbPattern[k] = pbTempPattern[k]; }; } break;
+#endif
   case(   FULL_PEL ): { for( UInt k = 0; k < (m_uiWidth * m_uiHeight); k++ ) { m_pbPattern[k] = pbTempPattern[k]; }; } break;
   case(   HALF_PEL ): // sub-sampling by factor 2
@@ -315,4 +327,25 @@
 }
 
+#if SHARP_DMM1_I0110
+Bool* TComWedgelet::getScaledPattern(UInt uiDstSize)
+{
+    Bool *pbSrcPat = this->getPattern();
+    UInt uiSrcSize = this->getStride();
+
+    Int scale = (g_aucConvertToBit[uiDstSize] - g_aucConvertToBit[uiSrcSize]);
+    assert(scale>=0);
+    for (Int y=0; y<uiDstSize; y++)
+    {
+       for (Int x=0; x<uiDstSize; x++)
+       {
+           Int srcX = x>>scale;
+           Int srcY = y>>scale;
+           m_pbScaledPattern[y*uiDstSize + x] = pbSrcPat[ srcY*uiSrcSize + srcX ];
+       }
+   }
+   return m_pbScaledPattern;
+}
+#endif
+
 TComWedgeNode::TComWedgeNode()
 {
Index: trunk/source/Lib/TLibCommon/TComWedgelet.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComWedgelet.h	(revision 976)
+++ trunk/source/Lib/TLibCommon/TComWedgelet.h	(revision 1039)
@@ -58,7 +58,17 @@
 #define DIM_NO_IDX     MAX_UINT
 
+#if HS_DMM_SIGNALLING_I0120
+__inline UInt getDimType  ( Int intraMode ) 
+{ 
+    Int dimType = intraMode-DIM_OFFSET; 
+    return (dimType >= 0 && dimType < DIM_NUM_TYPE) ? (UInt)dimType : DIM_NO_IDX; 
+}
+#else
 __inline UInt getDimType  ( Int intraMode ) { Int dimType = (intraMode-DIM_OFFSET)/2; return (dimType >= 0 && dimType < DIM_NUM_TYPE) ? (UInt)dimType : DIM_NO_IDX; }
+#endif
 __inline Bool isDimMode   ( Int intraMode ) { return (getDimType( intraMode ) < DIM_NUM_TYPE); }
+#if !HS_DMM_SIGNALLING_I0120
 __inline Bool isDimDeltaDC( Int intraMode ) { return (isDimMode( intraMode ) && ((intraMode-DIM_OFFSET)%2) == 1); }
+#endif
 #endif
 
@@ -69,5 +79,7 @@
 enum WedgeResolution
 {
+#if !SHARP_DMM1_I0110
   DOUBLE_PEL,
+#endif
   FULL_PEL,
   HALF_PEL
@@ -94,4 +106,7 @@
 
   Bool* m_pbPattern;
+#if SHARP_DMM1_I0110
+  Bool* m_pbScaledPattern;
+#endif
 
   Void  xGenerateWedgePattern();
@@ -119,4 +134,7 @@
   Bool            getIsCoarse() { return m_bIsCoarse; }
   UInt            getAng     () { return m_uiAng; }
+#if SHARP_DMM1_I0110
+  Bool*           getScaledPattern(UInt uiWidth);
+#endif
 
   Void  setWedgelet( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UChar uhOri, WedgeResolution eWedgeRes, Bool bIsCoarse = false );
Index: trunk/source/Lib/TLibCommon/TComYuv.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComYuv.cpp	(revision 976)
+++ trunk/source/Lib/TLibCommon/TComYuv.cpp	(revision 1039)
@@ -689,4 +689,8 @@
   UInt iSrc1Stride = pcYuvSrc1->getStride();
   UInt iDstStride  = getStride();
+#if QC_I0129_ARP_FIX
+  Int iIFshift = IF_INTERNAL_PREC - g_bitDepthY;
+  Int iOffSet  = ( 1 << ( iIFshift - 1 ) ) + IF_INTERNAL_OFFS;
+#endif
   for ( y = uiHeight-1; y >= 0; y-- )
   {
@@ -696,5 +700,9 @@
       if( bClip )
       {
+#if QC_I0129_ARP_FIX
+        pDst[x] = ClipY( ( pDst[x] + iOffSet ) >> iIFshift );
+#else
         pDst[x] = ClipY( pDst[x] );
+#endif
       }
     }
@@ -719,4 +727,8 @@
   UInt  iSrc1Stride = pcYuvSrc1->getCStride();
   UInt  iDstStride  = getCStride();
+#if QC_I0129_ARP_FIX
+  Int iIFshift = IF_INTERNAL_PREC - g_bitDepthC;
+  Int iOffSet  = ( 1 << ( iIFshift - 1 ) ) + IF_INTERNAL_OFFS;
+#endif
   for ( y = uiHeight-1; y >= 0; y-- )
   {
@@ -727,6 +739,11 @@
       if( bClip )
       {
+#if QC_I0129_ARP_FIX
+        pDstU[x] = ClipC( ( pDstU[x] + iOffSet ) >> iIFshift );
+        pDstV[x] = ClipC( ( pDstV[x] + iOffSet ) >> iIFshift );
+#else
         pDstU[x] = ClipC( pDstU[x] );
         pDstV[x] = ClipC( pDstV[x] );
+#endif
       }
     }
@@ -744,4 +761,7 @@
 {
   subtractARPLuma  ( pcYuvSrc0, pcYuvSrc1,  uiAbsPartIdx, uiWidth    , uiHeight    );
+#if SHARP_ARP_CHROMA_I0104
+  if (uiWidth > 8)
+#endif
   subtractARPChroma( pcYuvSrc0, pcYuvSrc1,  uiAbsPartIdx, uiWidth>>1 , uiHeight>>1 );
 }
@@ -803,4 +823,7 @@
 {
   multiplyARPLuma( uiAbsPartIdx , uiWidth , uiHeight , dW );
+#if SHARP_ARP_CHROMA_I0104
+  if (uiWidth > 8)
+#endif
   multiplyARPChroma( uiAbsPartIdx , uiWidth >> 1 , uiHeight >> 1 , dW );
 }
Index: trunk/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- trunk/source/Lib/TLibCommon/TypeDef.h	(revision 976)
+++ trunk/source/Lib/TLibCommon/TypeDef.h	(revision 1039)
@@ -68,4 +68,5 @@
 #define BUG_FIX_TK65        1
 
+#define MTK_I0093           1
 /////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////   MAJOR DEFINES   ///////////////////////////////////  
@@ -123,4 +124,6 @@
                                               // MTK_LOW_LATENCY_IC_ENCODING_H0086  Low-latency IC encoding in JCT3V-H0086
 
+#define SEC_IC_NEIGHBOR_CLIP_I0080        1   // Clipping of neighboring sample position, JCT3V-I0080
+
 
 #if H_3D_NBDV
@@ -172,4 +175,6 @@
                                               // MTK_DIS_SPBIP8X4_H0205        Disable bi-prediction for 8x4 and 4x8 sub PU and remove the SPIVMP 2Nx2N restriction
                                               // SEC_ADAPT_DISABLE_IVMP        Disalbing IVMP merge candidates when IC is enabled, JCT3V-H0070
+
+#define SEC_SIMP_SHIFTED_DV_I0086         1   // Simplification of Shifted DV candidate, JCT3V-I0086
 
 #define H_3D_TMVP                         1   // QC_TMVP_C0047 
@@ -215,4 +220,8 @@
                                               // MTK_DLT_CODING_FIX_H0091 
 
+#define MTK_SINGLE_DEPTH_MODE_I0095       1   // Single depth mode proposed in JCT3V-I0095
+#if MTK_SINGLE_DEPTH_MODE_I0095
+#define MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE            2 // size of the sample candidate list
+#endif
 
 #define H_3D_INTER_SDC                    1   // INTER SDC, Inter simplified depth coding
@@ -233,4 +242,9 @@
                                               // H_3D_FIX_DBBP_IVMP        Fix . Enable IVMP is always disabled, when DBBP is enabled. The original intention is to disable Sub-PU IVMP when DBBP is enabled, not to disable IVMP itself. 
 
+#define SEC_DBBP_EXPLICIT_SIG_I0077       1   // Remove the partition derivation and signal dbbp_flag only when the partion mode is 2NxN/Nx2N, JCT3V-I0077
+#define SEC_DBBP_DISALLOW_8x8_I0078       1   // Disallow DBBP in 8x8 CU, JCT3V-I0078
+#define SHARP_DBBP_SIMPLE_FLTER_I0109     1   // Simple condition and one dimensional dilter for DBBP
+#define SEC_DBBP_DMM4_THRESHOLD_I0076     1   // Simplification of threshold derivation for DBBP and DMM4, JCT3V-I0076
+
 
 #define H_3D_DDD                          1   // Disparity derived depth coding
@@ -238,5 +252,5 @@
 #define H_3D_FCO                          0   // Flexible coding order for 3D
 
-
+#define SCU_HS_FAST_INTRA_SDC_I0123       1
 
 // OTHERS
@@ -250,4 +264,7 @@
 #endif
 
+#define MTK_I0099_VPS_EX2                 1  ///< JCT3V-I0099, sub-PU size signaling and lim_qt_pred_flag in VPS extension 2
+#define MTK_I0099_FIX                     1  ///< Fix the problem of removing encoder only QTL 
+
 // Rate Control
 #define KWU_FIX_URQ                       1
@@ -255,4 +272,7 @@
 #define KWU_RC_MADPRED_E0227              0  ///< JCT3V-E0227, inter-view MAD prediction
 
+#define SEC_VPS_CLEANUP_I0090             1
+#define SEC_HLS_CLEANUP_I0100             1
+
 #endif // H_3D
 
@@ -262,4 +282,14 @@
 ///////////////////////////////////   DERIVED DEFINES ///////////////////////////////////  
 /////////////////////////////////////////////////////////////////////////////////////////
+
+// Fixes
+#define FIX_TICKET_79                     1    // Unused VSP code
+#define FIX_TICKET_75                     1    // Bi-pred restriction bug in VSP
+#define FIX_TICKET_68                     1    // MV clipping bug in the sub-PU MPI default MV generation
+#define FIX_TICKET_71                     1    // IC parameters is meaningless in HTM when no training samples are available
+#define FIX_TICKET_77                     1    // Unused variable m_iBitsPerDepthValue
+#define FIX_TICKET_76                     1    // unused functions
+#define FIX_TICKET_62                     1    // buffer overflow for print
+#define FIX_TICKET_61                     1    // layerIdsInSets size check
 
 ///// ***** VIEW SYNTHESIS OPTIMIZAION *********
@@ -283,4 +313,8 @@
 #if H_3D_ARP
 #define H_3D_ARP_WFNR                     3
+#define QC_I0129_ARP_FIX                  1
+#define QC_I0051_ARP_SIMP                 1
+#define SHARP_ARP_CHROMA_I0104            1
+#define MTK_I0072_IVARP_SCALING_FIX       1
 #endif
 
@@ -290,11 +324,18 @@
 #define H_3D_DIM_SDC                      1   // Simplified Depth Coding method
 #define H_3D_DIM_DLT                      1   // Depth Lookup Table
+#define HS_DMM_SIGNALLING_I0120  1   
+#define SHARP_DMM1_I0110                  1   // LUT size reduction for DMM1 proposed in JCT3V-I0110 
+#define FIX_WARNING                       1   // fix narrowing conversion of NumPocStCurr0,NumPocStCurr1 at TComSlice.cpp
+#define FAST_SDC_OFFSET_DECISION_I0084    1
+#define SEPARATE_FLAG_I0085               1
 
 #if H_3D_DIM_DLT
 #define H_3D_DELTA_DLT                    1
+#define RWTH_DLT_CLIP_I0057               1
 #endif
 #define H_3D_DIM_ENC                      1   // Depth Intra encoder optimizations, includes:
                                               // HHI_DEPTH_INTRA_SEARCH_RAU_C0160
                                               // LG_ZEROINTRADEPTHRESI_A0087
+#define HHI_DMM4_ENC_I0066                1
 #endif
 ///// ***** VIEW SYNTHESIS PREDICTION *********
@@ -381,6 +422,5 @@
 
 // OTHERS
-//#define H_MV_HLS_8_HSB_Q0041_03  0 // #3  (HS     /Q0041/hybrid scalability) The proposed text was endorsed, with non-editorial open issues considered as follows 
-:// #define H_MV_HLS_7_OTHER_P0187_1          0 // (OTHER/P0187/NoOutputOfPriorPicsFlag) #1 Inference of NoOutputOfPriorPicsFlag and proposes to take into account colour format and bit depth for the inference in addition to spatial resolution 
+//#define H_MV_HLS_8_HSB_Q0041_03  0 // #3  (HS     /Q0041/hybrid scalability) The proposed text was endorsed, with non-editorial open issues considered as follows ?// #define H_MV_HLS_7_OTHER_P0187_1          0 // (OTHER/P0187/NoOutputOfPriorPicsFlag) #1 Inference of NoOutputOfPriorPicsFlag and proposes to take into account colour format and bit depth for the inference in addition to spatial resolution 
 //#define H_MV_HLS_8_MIS_Q0078_24  0 // #24 (MISC   /Q0078/scan and pic type) , Items 3 b,c and 4, clarifying which pictures in an output layer sets are applied the values of general_progressive_source_flag, general_interlaced_source_flag, general_non_packed_constraint_flag and general_frame_only_constraint_flag.
 //#define H_MV_HLS_7_HRD_P0138_6   0 //     (HRD/P0138/HRD parameters for bitstreams excluding) #6 Decision: Adopt (as revised in updated contribution, with the specification of a flag in the BP SEI (HRD/P0192/sub-DPB) #12 Establish sub-DPBs based on the representation format indicated at the VPS level. It was suggested that the expressed shared capacity limit would need to be less than or equal to the sum of the individual capacity limits. Decision: Adopt as modified. Further study is encouraged on profile/level constraint selections. 
Index: trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 976)
+++ trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1039)
@@ -1051,4 +1051,5 @@
 Void TDecCavlc::parseSPSExtension2( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )
 { 
+#if !MTK_I0099_VPS_EX2
   UInt uiCode; 
 #if H_3D_QTLPC
@@ -1061,4 +1062,5 @@
     pcSPS->setUsePC( uiCode );
   }
+#endif
 #endif
 }
@@ -1756,5 +1758,9 @@
 {
   UInt uiCode; 
+#if SEC_VPS_CLEANUP_I0090
+  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
+#else
   for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ )
+#endif
   {
 #if H_3D_ARP
@@ -1765,10 +1771,20 @@
     pcVPS->setSubPULog2Size(i, 0);
 #endif
+#if !SEC_VPS_CLEANUP_I0090
     if ( i != 0 )
-    {
+#endif
+    {
+#if MTK_I0099_VPS_EX2
+      READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
+#if SEC_HLS_CLEANUP_I0100
+      READ_FLAG( uiCode, "iv_mv_scaling_flag[i]");       pcVPS->setIvMvScalingFlag         ( i, uiCode == 1 ? true : false );
+#endif
+#endif
       if( !( pcVPS->getDepthId( i ) == 1 ) )
       {
 #if H_3D_IV_MERGE
+#if !MTK_I0099_VPS_EX2
         READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
+#endif
         if( !pcVPS->getNumDirectRefLayers(i) )
         {
@@ -1802,4 +1818,5 @@
       else
       {
+#if !MTK_I0099_VPS_EX2
 #if H_3D_IV_MERGE
         if(i!=1)
@@ -1818,9 +1835,18 @@
         }
 #endif
+#endif
 #if H_3D_IV_MERGE
         READ_FLAG( uiCode, "mpi_flag[i]" );             pcVPS->setMPIFlag( i, uiCode == 1 ? true : false );
 #endif
+#if MTK_I0099_VPS_EX2
+        READ_UVLC (uiCode, "log2_mpi_sub_PU_size_minus3[i]");     pcVPS->setSubPUMPILog2Size(i, uiCode+3);
+#endif
         READ_FLAG( uiCode, "vps_depth_modes_flag[i]" );             pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false );
-        //          READ_FLAG( uiCode, "lim_qt_pred_flag[i]");                  pcVPS->setLimQtPreFlag     ( i, uiCode == 1 ? true : false ); 
+#if SEPARATE_FLAG_I0085
+        READ_FLAG( uiCode, "ivp_flag[i]" );                   pcVPS->setIVPFlag( i, uiCode == 1 ? true : false );
+#endif
+#if MTK_I0099_VPS_EX2
+        READ_FLAG( uiCode, "lim_qt_pred_flag[i]");                  pcVPS->setLimQtPredFlag     ( i, uiCode == 1 ? true : false ); 
+#endif
 #if H_3D_INTER_SDC
             READ_FLAG( uiCode, "depth_inter_SDC_flag" );              pcVPS->setInterSDCFlag( i, uiCode ? true : false );
@@ -1835,5 +1861,9 @@
 
   READ_UVLC( uiCamParPrecision, "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
   {
     pcVPS->setCamParPresent         ( viewIndex, false );
@@ -1857,6 +1887,10 @@
     }
   }
+#if !MTK_I0099_VPS_EX2
   READ_UVLC (uiCode, "log2_sub_PU_MPI_size_minus3");              pcVPS->setSubPUMPILog2Size( uiCode + 3 ); 
+#endif
+#if !SEC_HLS_CLEANUP_I0100
   READ_FLAG( uiCode, "iv_mv_scaling_flag");                       pcVPS->setIvMvScalingFlag( uiCode == 1 ? true : false ); 
+#endif
 }
 #endif
@@ -2459,5 +2493,9 @@
     }
 #if H_3D_IC
+#if SEC_HLS_CLEANUP_I0100
+    else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) && !rpcSlice->getIsDepth() && vps->getNumDirectRefLayers( layerId ) > 0 )
+#else
     else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) && !rpcSlice->getIsDepth())
+#endif
     {
       UInt uiCodeTmp = 0;
@@ -2471,4 +2509,12 @@
         rpcSlice->setIcSkipParseFlag( uiCodeTmp );
       }
+    }
+#endif
+#if MTK_SINGLE_DEPTH_MODE_I0095
+    if(rpcSlice->getIsDepth())
+    {
+      UInt uiCodeTmp = 0;
+      READ_FLAG( uiCodeTmp, "slice_enable_single_depth_mode" );
+      rpcSlice->setApplySingleDepthMode(uiCodeTmp);
     }
 #endif
@@ -2843,5 +2889,10 @@
   assert(0);
 }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+Void TDecCavlc::parseSingleDepthMode( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
+{
+  assert(0);
+}
+#endif
 Void TDecCavlc::parseCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
 {
Index: trunk/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 976)
+++ trunk/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 1039)
@@ -119,4 +119,7 @@
   
   Void  parseSkipFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Void  parseSingleDepthMode        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
+#endif  
   Void  parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
   Void parseMergeFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
Index: trunk/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCu.cpp	(revision 976)
+++ trunk/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1039)
@@ -420,5 +420,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];
@@ -432,5 +434,7 @@
     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours 
+#if !FIX_TICKET_79
       , inheritedVSPDisInfo
+#endif
 #if H_3D_SPIVMP
       , pcMvFieldSP, puhInterDirSP
@@ -453,5 +457,5 @@
 #endif
 #endif
-#if H_3D_VSP
+#if H_3D_VSP && !FIX_TICKET_79
     if(vspFlag[uiMergeIndex])
     {
@@ -542,5 +546,9 @@
     return;
   }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  m_pcEntropyDecoder->decodeSingleDepthMode( pcCU, uiAbsPartIdx, uiDepth );
+  if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))
+  {
+#endif
   m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth );
   m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
@@ -572,4 +580,7 @@
   m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, uiCurrWidth, uiCurrHeight, bCodeDQP );
   setdQPFlag( bCodeDQP );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  }
+#endif
   xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
 #if H_3D_IV_MERGE
@@ -671,8 +682,18 @@
       break;
     case MODE_INTRA:
+#if MTK_SINGLE_DEPTH_MODE_I0095
+      if( m_ppcCU[uiDepth]->getSingleDepthFlag(0) )
+        xReconIntraSingleDepth( m_ppcCU[uiDepth], 0, uiDepth );
+#if H_3D_DIM_SDC
+      else if( m_ppcCU[uiDepth]->getSDCFlag(0) )
+        xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );
+#endif
+      else
+#else
 #if H_3D_DIM_SDC
       if( m_ppcCU[uiDepth]->getSDCFlag(0) )
         xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );
       else
+#endif
 #endif
       xReconIntraQT( m_ppcCU[uiDepth], uiDepth );
@@ -709,5 +730,80 @@
   }
 }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+Void TDecCu::xReconIntraSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
+{
+  UInt uiWidth        = pcCU->getWidth  ( 0 );
+  UInt uiHeight       = pcCU->getHeight ( 0 );
+
+  TComYuv* pcRecoYuv  = m_ppcYuvReco[uiDepth];
+
+  UInt    uiStride    = pcRecoYuv->getStride  ();
+  Pel*    piReco      = pcRecoYuv->getLumaAddr( uiAbsPartIdx );
+
+
+  AOF( uiWidth == uiHeight );
+  AOF( uiAbsPartIdx == 0 );
+
+  //construction of depth candidates
+  Pel testDepth;
+  Pel DepthNeighbours[5];
+  Int index =0;
+  for( Int i = 0; (i < 5) && (index<MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE) ; i++ )
+  {
+    if(!pcCU->getNeighDepth (0, uiAbsPartIdx, &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++;
+  }
+
+  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
+  {
+    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
+    {
+      piReco[ uiX ] =DepthNeighbours[(Int)pcCU->getSingleDepthValue(uiAbsPartIdx)];
+    }
+    piReco     += uiStride;
+  }
+
+  // clear UV
+  UInt  uiStrideC     = pcRecoYuv->getCStride();
+  Pel   *pRecCb       = pcRecoYuv->getCbAddr();
+  Pel   *pRecCr       = pcRecoYuv->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;
+  }
+}
+#endif
 #if H_3D_INTER_SDC
 Void TDecCu::xReconInterSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
@@ -832,5 +928,9 @@
   
   // reconstruct final prediction signal by combining both segments
+#if SHARP_DBBP_SIMPLE_FLTER_I0109
+  m_pcPrediction->combineSegmentsWithMask(apSegPredYuv, m_ppcYuvReco[uiDepth], pMask, pcCU->getWidth(0), pcCU->getHeight(0), 0, ePartSize);
+#else
   m_pcPrediction->combineSegmentsWithMask(apSegPredYuv, m_ppcYuvReco[uiDepth], pMask, pcCU->getWidth(0), pcCU->getHeight(0));
+#endif
   
   // inter recon
@@ -1206,11 +1306,21 @@
   {
     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 )
Index: trunk/source/Lib/TLibDecoder/TDecCu.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCu.h	(revision 976)
+++ trunk/source/Lib/TLibDecoder/TDecCu.h	(revision 1039)
@@ -123,4 +123,7 @@
   Void setdQPFlag               ( Bool b )                { m_bDecodeDQP = b;           }
   Void xFillPCMBuffer           (TComDataCU* pCU, UInt depth);
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Void xReconIntraSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
+#endif
 #if H_3D_DIM_SDC
   Void xReconIntraSDC           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
Index: trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 976)
+++ trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 1039)
@@ -52,5 +52,18 @@
   m_pcEntropyDecoderIf->parseSkipFlag( pcCU, uiAbsPartIdx, uiDepth );
 }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+Void TDecEntropy::decodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
+{
+  if ( !pcCU->getSlice()->getIsDepth() )
+  {
+    return;
+  }
+  if(!pcCU->getSlice()->getApplySingleDepthMode())
+  {
+     return;
+  }
+  m_pcEntropyDecoderIf->parseSingleDepthMode( pcCU, uiAbsPartIdx, uiDepth );
+}
+#endif
 Void TDecEntropy::decodeCUTransquantBypassFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
 {
@@ -140,8 +153,20 @@
 #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
   {
     decodeDBBPFlag(pcCU, uiAbsPartIdx, uiDepth);
-    
+#if !SEC_DBBP_EXPLICIT_SIG_I0077    
     if( pcCU->getDBBPFlag(uiAbsPartIdx) )
     {
@@ -167,4 +192,5 @@
       pcCU->setDBBPFlagSubParts(true, uiAbsPartIdx+uiPUOffset, 1, uiDepth);
     }
+#endif
   }
 #endif
@@ -285,5 +311,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
           memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
@@ -292,5 +320,7 @@
           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
           pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours
+#if !FIX_TICKET_79
             , inheritedVSPDisInfo
+#endif
 #if H_3D_SPIVMP
             , pcMvFieldSP, puhInterDirSP
@@ -304,8 +334,10 @@
           pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
 
+#if !FIX_TICKET_79
           if(vspFlag[uiMergeIndex])
           {
             pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth);
           }
+#endif
 #else
 #if H_3D
@@ -328,5 +360,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
         memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
@@ -335,5 +369,7 @@
         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
         pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours
+#if !FIX_TICKET_79
           , inheritedVSPDisInfo
+#endif
 #if H_3D_SPIVMP
           , pcMvFieldSP, puhInterDirSP
@@ -346,8 +382,10 @@
           ,numValidMergeCand );
         pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
+#if !FIX_TICKET_79
         if(vspFlag[uiMergeIndex])
         {
           pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth);
         }
+#endif
 #else
 #if H_3D
@@ -447,5 +485,5 @@
 #endif
     }
-#if H_3D_VSP
+#if H_3D_VSP && !FIX_TICKET_75
     if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) && (pcCU->getVSPFlag(uiSubPartIdx) == 0))
 #else
Index: trunk/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecEntropy.h	(revision 976)
+++ trunk/source/Lib/TLibDecoder/TDecEntropy.h	(revision 1039)
@@ -89,4 +89,7 @@
 public:
   virtual Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  virtual Void parseSingleDepthMode       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
+#endif
   virtual Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
   virtual Void parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
@@ -176,4 +179,7 @@
   Void decodeSplitFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
   Void decodeSkipFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  Void decodeSingleDepthMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) ;
+#endif
   Void decodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
   Void decodeMergeFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
Index: trunk/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 976)
+++ trunk/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 1039)
@@ -52,4 +52,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)
@@ -132,4 +136,8 @@
   m_cCUSplitFlagSCModel.initBuffer       ( sliceType, qp, (UChar*)INIT_SPLIT_FLAG );
   m_cCUSkipFlagSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_SKIP_FLAG );
+#if MTK_SINGLE_DEPTH_MODE_I0095
+  m_cCUSingleDepthFlagSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_SINGLEDEPTH_FLAG );
+  m_cSingleDepthValueSCModel.initBuffer         ( sliceType, qp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );
+#endif
   m_cCUMergeFlagExtSCModel.initBuffer    ( sliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT );
   m_cCUMergeIdxExtSCModel.initBuffer     ( sliceType, qp, (UChar*)INIT_MERGE_IDX_EXT );
@@ -199,4 +207,8 @@
   m_cCUSplitFlagSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_SPLIT_FLAG );
   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 );
@@ -420,4 +432,5 @@
 #endif
 
+#if !FIX_TICKET_76
 #if H_3D_DIM_SDC
 Void TDecSbac::xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment )
@@ -499,5 +512,5 @@
 #endif
 #endif
-
+#endif
 /** Parse I_PCM information. 
  * \param pcCU
@@ -636,5 +649,52 @@
 #endif
 }
-
+#if MTK_SINGLE_DEPTH_MODE_I0095
+Void TDecSbac::parseSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
+{
+  pcCU->setSingleDepthFlagSubParts( false,        uiAbsPartIdx, uiDepth );
+  UInt uiSymbol = 0;
+  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSingleDepthFlagSCModel.get( 0, 0, 0 ) );
+  if( uiSymbol )
+  {
+    pcCU->setSingleDepthFlagSubParts( true,        uiAbsPartIdx, uiDepth );
+    pcCU->setSkipFlagSubParts( false,        uiAbsPartIdx, uiDepth );
+    pcCU->setSDCFlagSubParts( false,        uiAbsPartIdx, uiDepth );
+    pcCU->setPredModeSubParts( MODE_INTRA,  uiAbsPartIdx, uiDepth );
+    pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
+    pcCU->setLumaIntraDirSubParts (DC_IDX, uiAbsPartIdx, uiDepth );
+    pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth );
+    pcCU->setMergeFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );
+    pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth);
+    pcCU->setCbfSubParts(0, 1, 1, uiAbsPartIdx, uiDepth);
+
+    UInt absValDeltaDC = 0;
+
+    UInt uiUnaryIdx = 0;
+    UInt uiNumCand = MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE;
+    if ( uiNumCand > 1 )
+    {
+      for( ; uiUnaryIdx < uiNumCand - 1; ++uiUnaryIdx )
+      {
+        UInt uiSymbol2 = 0;
+        if ( uiUnaryIdx==0 )
+        {
+          m_pcTDecBinIf->decodeBin( uiSymbol2, m_cSingleDepthValueSCModel.get( 0, 0, 0 ) );
+        }
+        else
+        {
+          m_pcTDecBinIf->decodeBinEP( uiSymbol2);
+        }
+        if( uiSymbol2 == 0 )
+        {
+          break;
+        }
+      }
+    }
+    absValDeltaDC = uiUnaryIdx;
+    pcCU->setSingleDepthValueSubParts((Pel)absValDeltaDC,uiAbsPartIdx, 0, uiDepth);
+  }
+}
+
+#endif
 /** parse merge flag
  * \param pcCU
@@ -721,5 +781,10 @@
   Bool bParseSplitFlag    = 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);
@@ -728,5 +793,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 && bLimQtPredFlag)
+#else
   if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL() && sps->getUsePC())
+#endif
   {
     TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());
@@ -770,5 +839,10 @@
 #if H_3D_QTLPC
   Bool bParsePartSize    = 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);
@@ -779,5 +853,9 @@
   Bool depthDependent = false;
   UInt uiTexturePart = uiMode;
+#if MTK_I0099_VPS_EX2
+  if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && bLimQtPredFlag )
+#else
   if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL() && sps->getUsePC())
+#endif
   {
     TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());
@@ -990,5 +1068,9 @@
   {
 #if H_3D_DIM
+#if SEPARATE_FLAG_I0085
+    if( pcCU->getSlice()->getVpsDepthModesFlag() || pcCU->getSlice()->getIVPFlag() )
+#else
     if( pcCU->getSlice()->getVpsDepthModesFlag() )
+#endif
     {
       parseIntraDepth( pcCU, absPartIdx+partOffset*j, depth );
@@ -1132,13 +1214,60 @@
   if( uiIsDimMode )
   {
+#if SEPARATE_FLAG_I0085
+    if( pcCU->getSlice()->getVpsDepthModesFlag() && pcCU->getSlice()->getIVPFlag() )
+    {
+      m_pcTDecBinIf->decodeBin( uiSymbol, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );
+      if( !uiSymbol )
+      {
+#if HS_DMM_SIGNALLING_I0120
+        pcCU->setLumaIntraDirSubParts( DIM_OFFSET, absPartIdx, depth );
+#else
+        pcCU->setLumaIntraDirSubParts( ( 2 * DMM1_IDX + DIM_OFFSET ), absPartIdx, depth );
+#endif
+      }
+      else
+      {
+#if HS_DMM_SIGNALLING_I0120
+        pcCU->setLumaIntraDirSubParts( ( 1+ DIM_OFFSET ), absPartIdx, depth );
+#else
+        pcCU->setLumaIntraDirSubParts( ( 2 * DMM4_IDX + DIM_OFFSET ), absPartIdx, depth );
+#endif
+      }
+    }
+    else if ( pcCU->getSlice()->getVpsDepthModesFlag() )
+    {
+#if HS_DMM_SIGNALLING_I0120
+      pcCU->setLumaIntraDirSubParts( DIM_OFFSET, absPartIdx, depth );
+#else
+      pcCU->setLumaIntraDirSubParts( ( 2 * DMM1_IDX + DIM_OFFSET ), absPartIdx, depth );
+#endif
+    }
+    else if( pcCU->getSlice()->getIVPFlag() )
+    {
+#if HS_DMM_SIGNALLING_I0120
+      pcCU->setLumaIntraDirSubParts( ( 1+ DIM_OFFSET ), absPartIdx, depth );
+#else
+      pcCU->setLumaIntraDirSubParts( ( 2 * DMM4_IDX + DIM_OFFSET ), absPartIdx, depth );
+#endif
+    }
+#else
     m_pcTDecBinIf->decodeBin( uiSymbol, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );
     if( !uiSymbol )
     {
+#if HS_DMM_SIGNALLING_I0120
+      pcCU->setLumaIntraDirSubParts( DIM_OFFSET, absPartIdx, depth );
+#else
       pcCU->setLumaIntraDirSubParts( ( 2 * DMM1_IDX + DIM_OFFSET ), absPartIdx, depth );
+#endif
     }
     else
     {
+#if HS_DMM_SIGNALLING_I0120
+      pcCU->setLumaIntraDirSubParts( ( 1+ DIM_OFFSET ), absPartIdx, depth );
+#else
       pcCU->setLumaIntraDirSubParts( ( 2 * DMM4_IDX + DIM_OFFSET ), absPartIdx, depth );
-    }
+#endif
+    }
+#endif
   }
 }
@@ -2053,18 +2182,31 @@
   }
 
+#if HS_DMM_SIGNALLING_I0120
+  UInt symbol = 1;
+  UInt uiNumSegments = isDimMode( pcCU->getLumaIntraDir( absPartIdx ) ) ? 2 : 1;
+#else
   UInt symbol = 0;
   UInt uiNumSegments = 0;
-
+#endif
+
+#if HS_DMM_SIGNALLING_I0120
+  if( pcCU->isIntra( absPartIdx ) && pcCU->getSDCFlag( absPartIdx ))
+  {
+#else
   if( pcCU->isIntra( absPartIdx ) )
   {
     UInt dir     = pcCU->getLumaIntraDir( absPartIdx );
     uiNumSegments = isDimMode( dir ) ? 2 : 1;
+#endif
     m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get( 0, 0, 0 ) );
+#if !HS_DMM_SIGNALLING_I0120
     if( pcCU->getSDCFlag( absPartIdx ) )
     {
+#endif
       assert( pcCU->getPartitionSize( absPartIdx ) == SIZE_2Nx2N );
       pcCU->setTrIdxSubParts( 0, absPartIdx, depth );
       pcCU->setCbfSubParts( 1, 1, 1, absPartIdx, depth );
     }
+#if !HS_DMM_SIGNALLING_I0120
     else
     {
@@ -2077,4 +2219,5 @@
     symbol = 1;
   }
+#endif
 
 
@@ -2138,4 +2281,11 @@
   m_pcTDecBinIf->decodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) );
   
+#if SEC_DBBP_EXPLICIT_SIG_I0077
+  PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
+  AOF( ePartSize == SIZE_2NxN || ePartSize == SIZE_Nx2N );
+  UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4;
+  pcCU->setDBBPFlagSubParts(uiSymbol, uiAbsPartIdx, 0, uiDepth);
+  pcCU->setDBBPFlagSubParts(uiSymbol, uiAbsPartIdx+uiPUOffset, 1, uiDepth);
+#else
   if( uiSymbol )
   {
@@ -2144,4 +2294,5 @@
     pcCU->setDBBPFlagSubParts(true, uiAbsPartIdx + 2*uiCurrPartNumQ, 1, uiDepth);
   }
+#endif
 }
 #endif
Index: trunk/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 976)
+++ trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 1039)
@@ -129,4 +129,7 @@
   
   Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
+#if MTK_SINGLE_DEPTH_MODE_I0095  
+  Void parseSingleDepthMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
+#endif  
   Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
   Void parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
@@ -179,4 +182,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/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
 
