Index: trunk/cfg/3D-HEVC/baseCfg_2view+depth.cfg
===================================================================
--- trunk/cfg/3D-HEVC/baseCfg_2view+depth.cfg	(revision 885)
+++ trunk/cfg/3D-HEVC/baseCfg_2view+depth.cfg	(revision 950)
@@ -198,4 +198,5 @@
 AdvMultiviewResPred                 : 1                # Advanced inter-view residual prediction (0:off, 1:on)
 IlluCompEnable                      : 1                # Enable Illumination compensation ( 0: off, 1: on )   (v/d) 
+IlluCompLowLatencyEnc               : 0                # Enable low-latency Illumination compensation encoding( 0: off, 1: on )
 ViewSynthesisPred                   : 1                # View synthesis prediction 
 DepthRefinement                     : 1                # Dispary refined by depth DoNBDV
Index: trunk/cfg/3D-HEVC/baseCfg_2view.cfg
===================================================================
--- trunk/cfg/3D-HEVC/baseCfg_2view.cfg	(revision 885)
+++ trunk/cfg/3D-HEVC/baseCfg_2view.cfg	(revision 950)
@@ -173,4 +173,5 @@
 AdvMultiviewResPred                 : 1                # Advanced inter-view residual prediction (0:off, 1:on)
 IlluCompEnable                      : 1                # Enable Illumination compensation ( 0: off, 1: on ) (v/d)
+IlluCompLowLatencyEnc               : 0                # Enable low-latency Illumination compensation encoding( 0: off, 1: on )
 ViewSynthesisPred                   : 1                # View synthesis prediction 
 DepthRefinement                     : 1                # Dispary refined by depth DoNBDV
Index: trunk/cfg/3D-HEVC/baseCfg_3view+depth.cfg
===================================================================
--- trunk/cfg/3D-HEVC/baseCfg_3view+depth.cfg	(revision 885)
+++ trunk/cfg/3D-HEVC/baseCfg_3view+depth.cfg	(revision 950)
@@ -229,4 +229,5 @@
 AdvMultiviewResPred                 : 1                # Advanced inter-view residual prediction (0:off, 1:on)
 IlluCompEnable                      : 1                # Enable Illumination compensation ( 0: off, 1: on )  (v/d)
+IlluCompLowLatencyEnc               : 0                # Enable low-latency Illumination compensation encoding( 0: off, 1: on )
 ViewSynthesisPred                   : 1                # View synthesis prediction 
 DepthRefinement                     : 1                # Dispary refined by depth DoNBDV
Index: trunk/cfg/3D-HEVC/baseCfg_3view.cfg
===================================================================
--- trunk/cfg/3D-HEVC/baseCfg_3view.cfg	(revision 885)
+++ trunk/cfg/3D-HEVC/baseCfg_3view.cfg	(revision 950)
@@ -188,4 +188,5 @@
 AdvMultiviewResPred                 : 1                # Advanced inter-view residual prediction (0:off, 1:on)
 IlluCompEnable                      : 1                # Enable Illumination compensation ( 0: off, 1: on )   (v/d)
+IlluCompLowLatencyEnc               : 0                # Enable low-latency Illumination compensation encoding( 0: off, 1: on )
 ViewSynthesisPred                   : 0                # View synthesis prediction 
 DepthRefinement                     : 0                # Dispary refined by depth DoNBDV
Index: trunk/cfg/3D-HEVC/fullCfg.cfg
===================================================================
--- trunk/cfg/3D-HEVC/fullCfg.cfg	(revision 885)
+++ trunk/cfg/3D-HEVC/fullCfg.cfg	(revision 950)
@@ -253,4 +253,5 @@
 AdvMultiviewResPred                 : 1                # Advanced inter-view residual prediction (0:off, 1:on)
 IlluCompEnable                      : 1                # Enable Illumination compensation ( 0: off, 1: on ) (v/d)
+IlluCompLowLatencyEnc               : 0                # Enable low-latency Illumination compensation encoding( 0: off, 1: on )
 ViewSynthesisPred                   : 1                # View synthesis prediction 
 DepthRefinement                     : 1                # Dispary refined by depth DoNBDV
Index: trunk/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 885)
+++ trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 950)
@@ -517,4 +517,7 @@
 #if H_3D_IC
   ("IlluCompEnable",           m_abUseIC, true, "Enable illumination compensation")
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+  ("IlluCompLowLatencyEnc",    m_bUseLowLatencyICEnc, false, "Enable low-latency illumination compensation encoding")
+#endif
 #endif
 #if H_3D_INTER_SDC
@@ -2479,4 +2482,7 @@
 #if H_3D_IC
   printf( "IlluCompEnable:%d ", m_abUseIC);
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+  printf ("IlluCompLowLatencyEnc:%d ",  m_bUseLowLatencyICEnc);
+#endif
 #endif
 #if H_3D_NBDV_REF
Index: trunk/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncCfg.h	(revision 885)
+++ trunk/source/App/TAppEncoder/TAppEncCfg.h	(revision 950)
@@ -137,4 +137,7 @@
 #if H_3D_IC
   Bool   m_abUseIC;
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+  Bool  m_bUseLowLatencyICEnc;
+#endif
 #endif
 #if H_3D_NBDV_REF
Index: trunk/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 885)
+++ trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 950)
@@ -178,5 +178,5 @@
     m_cTEncTop.setDWeight                      ( isDepth ? m_iDWeight             : 0     );
 #endif // H_3D_VSO
-#if H_3D_ARP
+#if H_3D_ARP && !QC_IV_PRED_CONSTRAINT_H0137
     //====== Advanced Inter-view Residual Prediction =========
     m_cTEncTop.setUseAdvRP                     ( ( isDepth || 0==layerIdInVps ) ? 0 : m_uiUseAdvResPred );
@@ -189,4 +189,7 @@
 #if H_3D_IC
     m_cTEncTop.setUseIC                        ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC );
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+    m_cTEncTop.setUseICLowLatencyEnc           ( m_bUseLowLatencyICEnc );
+#endif
 #endif
   //========== Depth intra modes ==========
@@ -1793,7 +1796,12 @@
 
 #if H_3D_ARP
+#if QC_IV_PRED_CONSTRAINT_H0137
+    vps.setUseAdvRP        ( layer, ( isDepth || isLayerZero || !vps.getNumDirectRefLayers(layer) ) ? 0 : m_uiUseAdvResPred );
+    vps.setARPStepNum      ( layer, ( isDepth || isLayerZero || !vps.getNumDirectRefLayers(layer) ) ? 1 : H_3D_ARP_WFNR     );
+#else
     vps.setUseAdvRP        ( layer, ( isDepth || isLayerZero ) ? 0 : m_uiUseAdvResPred );
     vps.setARPStepNum      ( layer, ( isDepth || isLayerZero ) ? 1 : H_3D_ARP_WFNR     );
 #endif  
+#endif  
 #if H_3D_SPIVMP
     if( isDepth )
@@ -1812,4 +1820,12 @@
 
 #if H_3D_IV_MERGE
+#if QC_IV_PRED_CONSTRAINT_H0137
+    if( !vps.getNumDirectRefLayers(layer) )
+    {
+      vps.setIvMvPredFlag    (layer, false);
+    }
+    else
+    {
+#endif
     if( isDepth )
     {
@@ -1820,4 +1836,7 @@
       vps.setIvMvPredFlag         ( layer, !isLayerZero && m_ivMvPredFlag[0] ); 
     }
+#if QC_IV_PRED_CONSTRAINT_H0137
+    }
+#endif
 #endif
 #if H_3D_NBDV_REF
@@ -1825,5 +1844,9 @@
 #endif
 #if H_3D_VSP
+#if QC_IV_PRED_CONSTRAINT_H0137
+    vps.setViewSynthesisPredFlag( layer, !isLayerZero && !isDepth && vps.getNumDirectRefLayers(layer) && m_viewSynthesisPredFlag );         
+#else
     vps.setViewSynthesisPredFlag( layer, !isLayerZero && !isDepth && m_viewSynthesisPredFlag );         
+#endif
 #endif
 #if H_3D_DBBP
Index: trunk/source/Lib/TLibCommon/ContextTables.h
===================================================================
--- trunk/source/Lib/TLibCommon/ContextTables.h	(revision 885)
+++ trunk/source/Lib/TLibCommon/ContextTables.h	(revision 950)
@@ -110,5 +110,9 @@
 #define NUM_DMM1_DATA_CTX             1       ///< number of context models for DMM1 data
 #endif
+#if LGE_SIMP_DIM_NOT_PRESENT_FLAG_CODING_H0119_H0135
+#define NUM_ANGLE_FLAG_CTX            1
+#else
 #define NUM_ANGLE_FLAG_CTX            3
+#endif
 #endif
 
@@ -368,4 +372,13 @@
 };
 
+#if LGE_SIMP_DIM_NOT_PRESENT_FLAG_CODING_H0119_H0135
+static const UChar 
+INIT_ANGLE_FLAG[3][NUM_ANGLE_FLAG_CTX] =
+{
+  { 154 },
+  { 141 },
+  { 155 },
+};
+#else
 static const UChar 
 INIT_ANGLE_FLAG[3][NUM_ANGLE_FLAG_CTX] =
@@ -375,4 +388,5 @@
   { 155, 170, 157 },
 };
+#endif
 
 static const UChar 
@@ -430,11 +444,20 @@
 
 #if H_3D_DBBP
+#if MTK_DBBP_SIGNALING_H0094
 static const UChar INIT_DBBP_FLAG[3][DBBP_NUM_FLAG_CTX] =
 {
-  { CNU },
-  { CNU },
-  { CNU },
-};
-#endif
-
-#endif
+  { 161 },
+  { 161 },
+  { 161 },
+};
+#else
+static const UChar INIT_DBBP_FLAG[3][DBBP_NUM_FLAG_CTX] =
+{
+  { CNU },
+  { CNU },
+  { CNU },
+};
+#endif
+#endif
+
+#endif
Index: trunk/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 885)
+++ trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 950)
@@ -610,4 +610,8 @@
     memset( m_apSegmentDCOffset[1]  + firstElement,     0,                numElements * sizeof( *m_apSegmentDCOffset[1] ) );
 #endif
+#if HS_DMM_SDC_PREDICTOR_UNIFY_H0108
+    m_apDmmPredictor[0] = 0;
+    m_apDmmPredictor[1] = 0;
+#endif
 #endif
 #if H_3D_DBBP
@@ -784,4 +788,8 @@
       m_apSegmentDCOffset[1][ui] = 0;
 #endif
+#if HS_DMM_SDC_PREDICTOR_UNIFY_H0108
+      m_apDmmPredictor[0] = 0;
+      m_apDmmPredictor[1] = 0;
+#endif
 #endif
 #if H_3D_DBBP
@@ -898,4 +906,8 @@
   memset( m_apSegmentDCOffset[0], 0, sizeof(Pel) * m_uiNumPartition   );
   memset( m_apSegmentDCOffset[1], 0, sizeof(Pel) * m_uiNumPartition   );
+#endif
+#if HS_DMM_SDC_PREDICTOR_UNIFY_H0108
+  m_apDmmPredictor[0] = 0;
+  m_apDmmPredictor[1] = 0;
 #endif
 #endif
@@ -2352,4 +2364,10 @@
     
     TComMv cDv = depthRefineFlag ? DvInfo.m_acDoNBDV : DvInfo.m_acNBDV;
+#if SEC_VER_DONBDV_H0103
+    if( depthRefineFlag )
+    {
+      cDv.setVer(0);
+    }
+#endif
     
     Int depthPosX = Clip3(0,   iPictureWidth - iWidth,  iBlkX + ((cDv.getHor()+2)>>2));
@@ -2383,4 +2401,7 @@
 UInt TComDataCU::getCtxAngleFlag( UInt uiAbsPartIdx )
 {
+#if LGE_SIMP_DIM_NOT_PRESENT_FLAG_CODING_H0119_H0135
+  return 0;
+#else
   TComDataCU* pcTempCU;
   UInt        uiTempPartIdx;
@@ -2396,4 +2417,5 @@
 
   return uiCtx;
+#endif
 }
 #endif
@@ -3258,6 +3280,10 @@
  *   false: otherwise
  */
+#if ETRIKHU_CLEANUP_H0083
+inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount)
+#else
 inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
   Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo  )
+#endif
 {
   if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) || m_pcSlice->getIsDepth() || pDInfo->m_aVIdxCan == -1)
@@ -3275,5 +3301,10 @@
   }
 
+#if ETRIKHU_CLEANUP_H0083
+  TComMvField mvVSP[2];
+  UChar dirVSP;
+#else
   rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
+#endif
 
   Bool  refViewAvailFlag = false;
@@ -3290,16 +3321,28 @@
         refViewAvailFlag      = true;
         predFlag[iRefListIdX] = 1;
+#if ETRIKHU_CLEANUP_H0083
+        mvVSP[0+iRefListIdX].setMvField( pDInfo->m_acNBDV, i );
+#if H_3D_NBDV
+        mvVSP[0+iRefListIdX].getMv().setIDVFlag (false);
+#endif
+#else
         pcMvFieldNeighbours[(iCount<<1)+iRefListIdX].setMvField( pDInfo->m_acNBDV, i );
 #if H_3D_NBDV
         pcMvFieldNeighbours[(iCount<<1)+iRefListIdX].getMv().setIDVFlag (false);
 #endif
-      }
-    }
-  }
-
+#endif
+      }
+    }
+  }
+
+#if ETRIKHU_CLEANUP_H0083
+  dirVSP = (predFlag[0] | (predFlag[1] << 1));
+  m_mergCands[MRG_VSP].setCand( mvVSP, dirVSP, true, false);
+#else
   // Set values to be returned
   abCandIsInter        [iCount] = true;
   puhInterDirNeighbours[iCount] = (predFlag[0] | (predFlag[1] << 1));
   vspFlag              [iCount] = 1;
+#endif
 
   if ( mrgCandIdx == iCount )
@@ -3316,6 +3359,10 @@
 
 #if H_3D_IV_MERGE
+#if ETRIKHU_CLEANUP_H0083
+inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int* ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx )
+#else
 inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, 
   Int* ivCandRefIdx, Int iPosIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo  )
+#endif
 {
   for(Int iLoop = 0; iLoop < 2; iLoop ++ ) 
@@ -3325,8 +3372,19 @@
     {
       Int iFirDispCand = -1;
+#if ETRIKHU_CLEANUP_H0083
+      TComMvField mvIvDcShift[2];
+      UChar dirIvDcShift;
+
+      if (xGetPosFirstAvailDmvCand(MRG_IVSHIFT, iFirDispCand))
+#else
       if (xGetPosFirstAvailDmvCand(iCount, pcMvFieldNeighbours, ivCandDir, iPosIvDC, vspFlag, iFirDispCand))
+#endif
       {
         TComMv cMv;
+#if ETRIKHU_CLEANUP_H0083
+        cMv = m_mergCands[iFirDispCand].m_cMvField[0].getMv();
+#else
         cMv = pcMvFieldNeighbours[(iFirDispCand<<1)].getMv();
+#endif
         cMv.setHor(cMv.getHor()+4);
         if(m_pcSlice->getVPS()->getViewSynthesisPredFlag(m_pcSlice->getLayerIdInVps()))
@@ -3334,6 +3392,14 @@
           cMv.setVer(0);
         }
+#if !(NTT_BUG_FIX_TK54)
         clipMv( cMv );
-
+#endif
+
+#if ETRIKHU_CLEANUP_H0083
+        dirIvDcShift = m_mergCands[iFirDispCand].m_uDir;
+        mvIvDcShift[0].setMvField(cMv, m_mergCands[iFirDispCand].m_cMvField[0].getRefIdx() );
+        mvIvDcShift[1].setMvField(m_mergCands[iFirDispCand].m_cMvField[1].getMv(), m_mergCands[iFirDispCand].m_cMvField[1].getRefIdx() );
+        m_mergCands[MRG_IVSHIFT].setCand(mvIvDcShift, dirIvDcShift, false, false);
+#else
         rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
 
@@ -3342,4 +3408,5 @@
         pcMvFieldNeighbours  [ iCount << 1      ].setMvField(cMv, pcMvFieldNeighbours[( iFirDispCand << 1)].getRefIdx() );
         pcMvFieldNeighbours  [(iCount << 1) + 1 ].setMvField(pcMvFieldNeighbours[(iFirDispCand << 1) + 1].getMv(), pcMvFieldNeighbours[( iFirDispCand << 1) + 1].getRefIdx() );
+#endif
         
         if( mrgCandIdx == iCount ) 
@@ -3372,5 +3439,9 @@
       if( !iLoop && ivCandDir[0] > 0)
       {
+#if ETRIKHU_CLEANUP_H0083
+        if(tmpDir == m_mergCands[MRG_IVMC].m_uDir && m_mergCands[MRG_IVMC].m_cMvField[0]==tmpMV[0] && m_mergCands[MRG_IVMC].m_cMvField[1]==tmpMV[1])
+#else
         if(tmpDir == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0]==tmpMV[0] && pcMvFieldNeighbours[1]==tmpMV[1])
+#endif
         {
             bRemove                         = true;
@@ -3379,4 +3450,14 @@
       if(!bRemove)
       {
+#if ETRIKHU_CLEANUP_H0083
+#if H_3D_NBDV
+        if(iLoop) // For IvMcShift candidate
+        {
+          tmpMV[0].getMv().setIDVFlag (false);
+          tmpMV[1].getMv().setIDVFlag (false);
+        }
+#endif
+        m_mergCands[MRG_IVSHIFT].setCand(tmpMV, tmpDir, false, false);
+#else
         rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
 
@@ -3398,4 +3479,5 @@
         }
 #endif
+#endif
         if( mrgCandIdx == iCount )
         {
@@ -3410,4 +3492,22 @@
 } 
 
+#if ETRIKHU_CLEANUP_H0083
+inline Bool TComDataCU::xGetPosFirstAvailDmvCand(Int iCount, Int& posFirstAvailDmvCand )
+{
+  for ( Int currListPos = 0; currListPos < iCount; currListPos++ )
+  {
+    if ( !m_mergCands[currListPos].m_bAvailable || ( currListPos == MRG_IVMC ) || ( currListPos == MRG_IVDC ) || ( m_mergCands[currListPos].m_iVspFlag != 0 ))
+    {
+      continue;
+    }
+    else if((m_mergCands[currListPos].m_bAvailable) && (m_mergCands[currListPos].m_cMvField[0].getRefIdx() != -1 ) && (getSlice()->getViewIndex() != getSlice()->getRefPic(RefPicList(0), m_mergCands[currListPos].m_cMvField[0].getRefIdx())->getViewIndex()))
+    {
+      posFirstAvailDmvCand = currListPos;
+      return true;
+    }
+  }
+  return false;  
+}
+#else
 inline Bool TComDataCU::xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int* ivCandDir, Int posIvDC, Int* vspFlag, Int& posFirstAvailDmvCand )
 {
@@ -3427,8 +3527,84 @@
  return false;  
 }
+#endif
                                       
 #endif
 
 #if H_3D
+#if ETRIKHU_CLEANUP_H0083
+
+Void TComDataCU::buildMCL(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
+#if H_3D_VSP
+  , Int* vspFlag
+#endif
+#if H_3D_SPIVMP
+  , Bool* pbSPIVMPFlag
+#endif
+  , Int& numValidMergeCand
+  )
+{
+  if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0))  // for only dependent texture
+  {
+    return;
+  }
+
+  Int iCount = 0;
+  TComMv cZeroMv;
+
+  // init temporal list
+  TComMvField extMergeCandList[MRG_MAX_NUM_CANDS_MEM << 1];
+  UChar uhInterDirNeighboursExt[MRG_MAX_NUM_CANDS_MEM];
+  for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
+  {
+    uhInterDirNeighboursExt[ui] = puhInterDirNeighbours[ui];
+    extMergeCandList[ui<<1].setMvField(cZeroMv, NOT_VALID);
+    extMergeCandList[(ui<<1)+1].setMvField(cZeroMv, NOT_VALID);
+    vspFlag[ui] = 0;
+  }
+
+  // add candidates to temporal list
+  // insert MPI ... IvShift candidate
+  for (Int i=0; i<=MRG_IVSHIFT; i++)
+  {
+    if (m_mergCands[i].m_bAvailable)
+    {
+      m_mergCands[i].getCand(iCount, extMergeCandList, uhInterDirNeighboursExt, vspFlag, pbSPIVMPFlag);
+      iCount++;
+      if (iCount >= getSlice()->getMaxNumMergeCand())
+        break;
+    }
+  }
+
+  // insert remaining base candidates
+  while (iCount < getSlice()->getMaxNumMergeCand() && m_baseListidc < getSlice()->getMaxNumMergeCand())
+  {
+    uhInterDirNeighboursExt[iCount] = puhInterDirNeighbours[m_baseListidc];
+    extMergeCandList[iCount<<1].setMvField(pcMvFieldNeighbours[m_baseListidc<<1].getMv(), pcMvFieldNeighbours[m_baseListidc<<1].getRefIdx());
+    if ( getSlice()->isInterB() )
+    {
+      extMergeCandList[(iCount<<1)+1].setMvField(pcMvFieldNeighbours[(m_baseListidc<<1)+1].getMv(), pcMvFieldNeighbours[(m_baseListidc<<1)+1].getRefIdx());
+    }
+    m_baseListidc++;
+    iCount++;
+  }
+
+  for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ui++ )
+  {
+    puhInterDirNeighbours[ui] = 0;
+    pcMvFieldNeighbours[ui<<1].setMvField(cZeroMv, NOT_VALID);
+    pcMvFieldNeighbours[(ui<<1)+1].setMvField(cZeroMv, NOT_VALID);
+  }
+  // copy extMergeCandList to output
+  for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ui++ )
+  {
+    puhInterDirNeighbours[ui] = uhInterDirNeighboursExt[ui];
+    pcMvFieldNeighbours[ui<<1].setMvField(extMergeCandList[ui<<1].getMv(), extMergeCandList[ui<<1].getRefIdx());
+    if ( getSlice()->isInterB() )
+      pcMvFieldNeighbours[(ui<<1)+1].setMvField(extMergeCandList[(ui<<1)+1].getMv(), extMergeCandList[(ui<<1)+1].getRefIdx());
+  }
+  numValidMergeCand = iCount;
+  assert(iCount == getSlice()->getMaxNumMergeCand());
+}
+#else
 Void TComDataCU::rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo*  inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV)
 {
@@ -3451,4 +3627,5 @@
   return;
 }
+#endif
 
 /** Constructs a list of merging candidates
@@ -3824,9 +4001,15 @@
 #endif
 #if H_3D_VSP
+#if !ETRIKHU_CLEANUP_H0083
       , Int* vspFlag
+#endif
       , InheritedVSPDisInfo*  inheritedVSPDisInfo
 #endif
 #if H_3D_SPIVMP
+#if ETRIKHU_CLEANUP_H0083
+      , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
+#else
       , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
+#endif
 #endif
       , Int& numValidMergeCand, Int mrgCandIdx
@@ -3839,5 +4022,7 @@
   ////////////////////////////
   TComMv cZeroMv;
+#if !ETRIKHU_CLEANUP_H0083
   Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
+#endif
 #else
   Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
@@ -3905,7 +4090,11 @@
 #if H_3D_DBBP
   Bool bDBBPFlag = getDBBPFlag(uiAbsPartIdx);
+#if MTK_DIS_SPBIP8X4_H0205
+  assert(bDBBPFlag == getDBBPFlag(0));  
+#endif
 #endif
 
 #if H_3D
+#if !ETRIKHU_CLEANUP_H0083
   Int  iPosLeftAbove[2] = {-1, -1};
 
@@ -3914,5 +4103,5 @@
   Int numA1B1B0 = 0;
   Int numA0B2 = 0;
-
+#endif
 #if H_3D_NBDV
   for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++)  
@@ -3923,4 +4112,159 @@
 #endif
 
+
+#if ETRIKHU_CLEANUP_H0083
+
+
+  // Clean version for MCL construction align with WD
+  // init mergCands list
+  for (Int i = 0; i<MRG_IVSHIFT+1; i++)
+  {
+    m_mergCands[i].init();
+  }
+
+  m_baseListidc = 0;
+
+  //left
+  UInt uiLeftPartIdx = 0;
+  TComDataCU* pcCULeft = 0;
+  pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );  
+
+  if (getAvailableFlagA1())
+  {
+    m_mergCands[MRG_A1].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
+#if H_3D_VSP
+    , 
+      (pcCULeft->getVSPFlag(uiLeftPartIdx) != 0
+#if H_3D_IC
+      && !bICFlag
+#endif
+#if H_3D_ARP
+      && !bARPFlag
+#endif
+#if RWTH_DBBP_NO_SPU_H0057
+      && !bDBBPFlag
+#endif
+      )
+#endif
+      , false
+      ); 
+    m_baseListidc++;
+  }
+
+  // above
+  UInt uiAbovePartIdx = 0;
+  TComDataCU* pcCUAbove = 0;
+  pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
+
+  if (getAvailableFlagB1())
+  {
+    m_mergCands[MRG_B1].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
+#if H_3D_VSP
+    ,
+      ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) != 0) 
+#if H_3D_IC
+      && !bICFlag
+#endif
+#if H_3D_ARP
+      && !bARPFlag
+#endif
+#if RWTH_DBBP_NO_SPU_H0057
+      && !bDBBPFlag
+#endif
+      )
+#endif
+      , false
+      ); 
+    m_baseListidc++;
+  }
+
+  // above right
+  UInt uiAboveRightPartIdx = 0;
+  TComDataCU* pcCUAboveRight = 0;
+  pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
+
+  if (getAvailableFlagB0())
+  {
+    m_mergCands[MRG_B0].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
+#if H_3D_VSP
+    ,
+      ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) != 0) 
+#if H_3D_IC
+      && !bICFlag
+#endif
+#if H_3D_ARP
+      && !bARPFlag
+#endif
+#if RWTH_DBBP_NO_SPU_H0057
+      && !bDBBPFlag
+#endif
+      )
+#endif
+      , false
+      ); 
+    m_baseListidc++;
+  }
+
+  // left bottom
+  UInt uiLeftBottomPartIdx = 0;
+  TComDataCU* pcCULeftBottom = getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
+
+  if (getAvailableFlagA0())
+  {
+    m_mergCands[MRG_A0].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
+#if H_3D_VSP
+    ,
+      (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) != 0
+#if H_3D_IC
+      && !bICFlag
+#endif
+#if H_3D_ARP
+      && !bARPFlag
+#endif
+#if RWTH_DBBP_NO_SPU_H0057
+      && !bDBBPFlag
+#endif
+      )
+#endif
+      , false
+      ); 
+    m_baseListidc++;
+  }
+
+  // above left
+  UInt uiAboveLeftPartIdx = 0;
+  TComDataCU* pcCUAboveLeft = 0;
+  pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
+
+  if (getAvailableFlagB2())
+  {
+    m_mergCands[MRG_B2].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
+#if H_3D_VSP
+    ,
+      ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) != 0) 
+#if H_3D_IC
+      && !bICFlag
+#endif
+#if H_3D_ARP
+      && !bARPFlag
+#endif
+#if RWTH_DBBP_NO_SPU_H0057
+      && !bDBBPFlag
+#endif
+      )
+#endif
+      , false
+      ); 
+    m_baseListidc++;
+  }
+
+
+#if !ETRIKHU_BUGFIX_H0083
+  Bool A1_was_available = m_mergCands[MRG_A1].m_bAvailable;
+  Bool B1_was_available = m_mergCands[MRG_B1].m_bAvailable;
+#endif
+
+
+#else
   //left
   UInt uiLeftPartIdx = 0;
@@ -3938,4 +4282,7 @@
       && !bARPFlag
 #endif
+#if RWTH_DBBP_NO_SPU_H0057
+      && !bDBBPFlag
+#endif
       )
     {
@@ -3961,4 +4308,7 @@
       && !bARPFlag
 #endif
+#if RWTH_DBBP_NO_SPU_H0057
+      && !bDBBPFlag
+#endif
       )
     {
@@ -3984,4 +4334,7 @@
       && !bARPFlag
 #endif
+#if RWTH_DBBP_NO_SPU_H0057
+      && !bDBBPFlag
+#endif
       )
     {
@@ -4004,4 +4357,7 @@
 #if H_3D_ARP
       && !bARPFlag
+#endif
+#if RWTH_DBBP_NO_SPU_H0057
+      && !bDBBPFlag
 #endif
       )
@@ -4028,4 +4384,7 @@
       && !bARPFlag
 #endif
+#if RWTH_DBBP_NO_SPU_H0057
+      && !bDBBPFlag
+#endif
       )
     {
@@ -4038,4 +4397,5 @@
 
   iCountHEVC = numValidMergeCand;
+#endif
 #endif
 
@@ -4047,4 +4407,7 @@
   /////////////////////////////////////////////
 
+#if SHARP_SIMPLE_MERGE_H0062
+  bMPIFlag &= (nPSW + nPSH > 12);
+#endif
   if( bMPIFlag)
   {
@@ -4052,4 +4415,8 @@
     tmpMV[1].setMvField( cZeroMv, NOT_VALID );
     tmpDir        =  0;
+
+#if ETRIKHU_CLEANUP_H0083
+    Bool bSPIVMPFlag = false;
+#endif
 
     TComPic * pcTexPic = m_pcSlice->getTexturePic();
@@ -4090,4 +4457,67 @@
       Int         iTexPosX, iTexPosY;
       const TComMv cMvRounding( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
+#if MPI_SUBPU_DEFAULT_MV_H0077_H0099_H0111_H0133
+      
+      Int         iCenterPosX = iCurrPosX + ( ( iWidth /  iPUWidth ) >> 1 )  * iPUWidth + ( iPUWidth >> 1 );
+      Int         iCenterPosY = iCurrPosY + ( ( iHeight /  iPUHeight ) >> 1 )  * iPUHeight + (iPUHeight >> 1);
+      Int         iTexCenterCUAddr, iTexCenterAbsPartIdx;
+
+      if(iWidth == iPUWidth && iHeight == iPUHeight)
+      {
+          iCenterPosX = iCurrPosX + (iWidth >> 1);
+          iCenterPosY = iCurrPosY + (iHeight >> 1);
+      }
+
+      // derivation of center motion parameters from the collocated texture CU
+
+      pcTexRec->getCUAddrAndPartIdx( iCenterPosX , iCenterPosY , iTexCenterCUAddr, iTexCenterAbsPartIdx );
+      TComDataCU* pcDefaultCU    = pcTexPic->getCU( iTexCenterCUAddr );
+
+      if( pcDefaultCU->getPredictionMode( iTexCenterAbsPartIdx ) != MODE_INTRA )
+      {
+          for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ )
+          {
+              RefPicList  eCurrRefPicList = RefPicList( uiCurrRefListId );
+
+              TComMvField cDefaultMvField;
+              pcDefaultCU->getMvField( pcDefaultCU, iTexCenterAbsPartIdx, eCurrRefPicList, cDefaultMvField );
+              Int         iDefaultRefIdx     = cDefaultMvField.getRefIdx();
+              if (iDefaultRefIdx >= 0)
+              {
+                  Int iDefaultRefPOC = pcDefaultCU->getSlice()->getRefPOC(eCurrRefPicList, iDefaultRefIdx);
+                  for (Int iRefPicList = 0; iRefPicList < m_pcSlice->getNumRefIdx( eCurrRefPicList ); iRefPicList++)
+                  {
+                      if (iDefaultRefPOC == m_pcSlice->getRefPOC(eCurrRefPicList, iRefPicList))
+                      {
+#if ETRIKHU_CLEANUP_H0083
+                        bSPIVMPFlag = true;
+#else
+                          pbSPIVMPFlag[iCount] = true;
+#endif
+                          TComMv cMv = cDefaultMvField.getMv() + cMvRounding;
+                          cMv >>= 2;
+                          clipMv( cMv );
+                          cMvFieldSaved[eCurrRefPicList].setMvField(cMv, iRefPicList) ;
+                          break;
+                      }
+                  }
+              }
+          }
+      }
+#if ETRIKHU_CLEANUP_H0083
+      if ( bSPIVMPFlag == true )
+#else
+      if ( pbSPIVMPFlag[iCount] == true )
+#endif
+      {   
+          iInterDirSaved = (cMvFieldSaved[0].getRefIdx()!=-1 ? 1: 0) + (cMvFieldSaved[1].getRefIdx()!=-1 ? 2: 0);
+          tmpDir = iInterDirSaved;
+          tmpMV[0] = cMvFieldSaved[0];
+          tmpMV[1] = cMvFieldSaved[1];
+      }
+
+      if ( iInterDirSaved != 0 )
+      {
+#endif
       for (Int i=iCurrPosY; i < iCurrPosY + iHeight; i += iPUHeight)
       {
@@ -4110,6 +4540,8 @@
               {
                 TComMv cMv = cTexMvField.getMv() + cMvRounding;
-                cMv >>=2;
+                cMv >>=2;          
+#if !(NTT_BUG_FIX_TK54)
                 this->clipMv( cMv );
+#endif
                 pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iValidDepRef);
               }
@@ -4126,9 +4558,24 @@
             }
           }
+#if MTK_DIS_SPBIP8X4_H0205
+              if (iPUHeight + iPUWidth == 12)
+              {
+                if (puhInterDirSP[iPartition] == 3)
+                {
+                  puhInterDirSP[iPartition] = 1;
+                  pcMvFieldSP[2*iPartition + 1].setMvField(TComMv(0,0), -1);
+                }
+              }
+#endif
+#if !MPI_SUBPU_DEFAULT_MV_H0077_H0099_H0111_H0133
           else
           {
             if (iInterDirSaved ==0)
             {
+#if ETRIKHU_CLEANUP_H0083
+                  bSPIVMPFlag = true;
+#else
               pbSPIVMPFlag[iCount] = true;
+#endif
               tmpDir = puhInterDirSP[iPartition];
               tmpMV[0] = pcMvFieldSP[2*iPartition];
@@ -4149,7 +4596,11 @@
             cMvFieldSaved[1] = pcMvFieldSP[2*iPartition + 1];
           }
+#endif
           iPartition ++;
         }
       }
+#if MPI_SUBPU_DEFAULT_MV_H0077_H0099_H0111_H0133
+      }
+#endif
 #if H_3D_FCO
     }
@@ -4158,4 +4609,20 @@
     {
       Int iCnloop = 0;
+#if ETRIKHU_CLEANUP_H0083
+      for(iCnloop = 0; iCnloop < 2; iCnloop ++)
+      {
+        if ( !m_mergCands[MRG_A1+iCnloop].m_bAvailable )  // prunning to A1, B1
+        {
+          continue;
+        }
+        if (tmpDir == m_mergCands[MRG_A1+iCnloop].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+iCnloop].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+iCnloop].m_cMvField[1])
+        {
+          m_mergCands[MRG_A1+iCnloop].m_bAvailable = false;
+          break;
+        }      
+      }
+      m_mergCands[MRG_T].setCand( tmpMV, tmpDir, false, bSPIVMPFlag);
+
+#else
       Bool bRemoveSpa = false; //pruning
 
@@ -4217,5 +4684,5 @@
 
       puhInterDirNeighbours[iCount] = tmpDir;
-
+#endif
       if ( mrgCandIdx == iCount )
       {
@@ -4261,5 +4728,7 @@
             cMVField.getMv() += cAdd;
             cMVField.getMv() >>= 2;
+#if !(NTT_BUG_FIX_TK54)
             clipMv( cMVField.getMv() );
+#endif
             tmpMV[ 0 ].setMvField( cMVField.getMv(), iValidDepRef );
             tmpDir = 1;
@@ -4284,5 +4753,7 @@
             cMVField.getMv() += cAdd;
             cMVField.getMv() >>= 2;
+#if !(NTT_BUG_FIX_TK54)
             clipMv( cMVField.getMv() );
+#endif
             tmpMV[ 1 ].setMvField( cMVField.getMv(), iValidDepRef );
             tmpDir = 2;
@@ -4292,8 +4763,18 @@
       if( tmpDir != 0 )
       {
+#if !ETRIKHU_CLEANUP_H0083
         rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, 5-iCount, iCount3DV);
+#endif
         m_ucDDTmpDepth = m_pcSlice->getDepthFromDV( iDV,  iViewIdx );
         m_iUseDDDCandIdx = iCount;
 
+#if ETRIKHU_CLEANUP_H0083
+        m_mergCands[MRG_D].setCand( tmpMV, tmpDir, false, false);
+        if ( mrgCandIdx == iCount )
+        {
+          return;
+        }
+        iCount ++;
+#else
         if( tmpDir == 1 )
         {
@@ -4324,4 +4805,5 @@
           iPosLeftAbove[ 1 ] = iCount + iLeftAboveAvail;
         }
+#endif
       }
     }
@@ -4332,5 +4814,7 @@
   /////////////////////////////////////////////////////////////////
 
+#if !ETRIKHU_CLEANUP_H0083
   Int  posIvDC          = -1;
+#endif
 
   // { IvMCL0, IvMCL1, IvDCL0, IvDCL1, IvMCL0Shift, IvMCL1Shift, IvDCL0Shift, IvDCL1Shift };  
@@ -4344,7 +4828,14 @@
   Bool ivMvPredFlag   = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() );
 
+#if SHARP_SIMPLE_MERGE_H0062
+  ivMvPredFlag &= (nPSW + nPSH > 12);
+#endif
   if ( ivMvPredFlag && cDisInfo.m_aVIdxCan!=-1)
   {
+#if SEC_ADAPT_DISABLE_IVMP
+    getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir , bIsDepth, pcMvFieldSP, puhInterDirSP, bICFlag );
+#else
     getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir , bIsDepth, pcMvFieldSP, puhInterDirSP );
+#endif
   }  
 
@@ -4372,6 +4863,8 @@
 
     Bool bRemoveSpa = false; //pruning
+#if !ETRIKHU_CLEANUP_H0083
     Bool bIvMC = false;
     Int iCnloop=0;
+#endif
 
     if (!bIsDepth)
@@ -4379,4 +4872,15 @@
       for(Int i = 0; i < 2; i ++)
       {
+#if ETRIKHU_CLEANUP_H0083
+        if ( !m_mergCands[MRG_A1 + i].m_bAvailable ) // prunning to A1, B1
+        {
+          continue;
+        }
+        if (ivCandDir[0] == m_mergCands[MRG_A1+i].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1])
+        {
+          m_mergCands[MRG_A1+i].m_bAvailable = false;
+          break;
+        }      
+#else
         iCnloop = iPosLeftAbove[i];
         if ( iCnloop == -1 ) 
@@ -4389,8 +4893,15 @@
           break;
         }      
+#endif
       }
     }
     if (bIsDepth)
     {
+#if ETRIKHU_CLEANUP_H0083
+      if (m_mergCands[MRG_T].m_bAvailable && ivCandDir[0] == m_mergCands[MRG_T].m_uDir && tmpMV[0]==m_mergCands[MRG_T].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_T].m_cMvField[1])
+      {
+        bRemoveSpa                      = true;
+      }
+#else
       iCnloop = iCount-1;
       for(; iCnloop >= 0; iCnloop --)
@@ -4408,8 +4919,10 @@
         }
       }
+#endif
     }
 
     if (!bRemoveSpa)
     {
+#if !ETRIKHU_CLEANUP_H0083
       bIvMC = true;
       rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
@@ -4464,4 +4977,19 @@
     if (bIvMC)
     {
+#endif
+#if ETRIKHU_CLEANUP_H0083
+      Bool SPIVMPFlag = false;
+#if MTK_DIS_SPBIP8X4_H0205
+      if(!m_pcSlice->getIsDepth())
+#else
+      if(!m_pcSlice->getIsDepth() && getPartitionSize(0) == SIZE_2Nx2N )
+#endif
+      {
+        SPIVMPFlag = true;
+      }
+#if H_3D_DBBP
+      SPIVMPFlag &= !bDBBPFlag;
+#endif
+#else
       if(!m_pcSlice->getIsDepth() && getPartitionSize(0) == SIZE_2Nx2N )
       {
@@ -4471,4 +4999,8 @@
       pbSPIVMPFlag[iCount] &= !bDBBPFlag;
 #endif
+#endif
+#if ETRIKHU_CLEANUP_H0083
+      m_mergCands[MRG_IVMC].setCand( tmpMV, ivCandDir[0], false, SPIVMPFlag);
+#else
       if( ( ivCandDir[0] & 1 ) == 1 )
       {
@@ -4481,4 +5013,5 @@
 
       puhInterDirNeighbours[ iCount ] = ivCandDir[0];
+#endif
 
       if ( mrgCandIdx == iCount )
@@ -4498,5 +5031,9 @@
 
 #if H_3D
+#if ETRIKHU_CLEANUP_H0083
+  iCount += m_mergCands[MRG_A1].m_bAvailable + m_mergCands[MRG_B1].m_bAvailable + m_mergCands[MRG_B0].m_bAvailable;
+#else
   iCount += numA1B1B0;
+#endif
 #else
   //left
@@ -4627,10 +5164,26 @@
     for(Int i = 0; i < 2; i ++)
     {
+#if ETRIKHU_CLEANUP_H0083
+      if ( !m_mergCands[MRG_A1+i].m_bAvailable ) 
+#else
       Int iCnloop = iPosLeftAbove[i];
       if ( iCnloop == -1 ) 
+#endif
       {
         continue;
       }
+#if ETRIKHU_CLEANUP_H0083
+#if ETRIKHU_BUGFIX_H0083
+      if (ivCandDir[1] == m_mergCands[MRG_A1+i].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1])
+#else
+      Int offset = 0;
+      offset += A1_was_available;
+      offset += B1_was_available;
+      offset += m_mergCands[MRG_B0].m_bAvailable;
+      if (puhInterDirNeighbours[offset] == m_mergCands[MRG_A1+i].m_uDir && pcMvFieldNeighbours[(offset<<1)]==m_mergCands[MRG_A1+i].m_cMvField[0] && pcMvFieldNeighbours[(offset<<1)+1]==m_mergCands[MRG_A1+i].m_cMvField[1])
+#endif
+#else
       if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
+#endif
       {
         bRemoveSpa                      = true;
@@ -4640,4 +5193,11 @@
     if(!bRemoveSpa)
     {
+#if ETRIKHU_CLEANUP_H0083
+#if H_3D_NBDV
+      tmpMV[0].getMv().setIDVFlag (false);
+      tmpMV[1].getMv().setIDVFlag (false);
+#endif
+      m_mergCands[MRG_IVDC].setCand( tmpMV, ivCandDir[1], false, false);
+#else
       rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
       puhInterDirNeighbours[ iCount ] = ivCandDir[1];
@@ -4655,4 +5215,5 @@
 #endif
       posIvDC  = iCount;
+#endif
       if ( mrgCandIdx == iCount )
         return;
@@ -4682,5 +5243,15 @@
       !bARPFlag &&
 #endif
+#if SHARP_SIMPLE_MERGE_H0062
+      (nPSW + nPSH > 12) &&
+#endif
+#if RWTH_DBBP_NO_SPU_H0057
+      !bDBBPFlag &&
+#endif
+#if ETRIKHU_CLEANUP_H0083
+      xAddVspCand( mrgCandIdx, &cDisInfo, iCount ) )
+#else
       xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, iCount3DV, inheritedVSPDisInfo ) )
+#endif
   {
     return;
@@ -4698,5 +5269,9 @@
 
 #if H_3D
+#if ETRIKHU_CLEANUP_H0083
+  iCount += m_mergCands[MRG_A0].m_bAvailable + m_mergCands[MRG_B2].m_bAvailable;
+#else
   iCount += numA0B2;
+#endif
 #else
   //left bottom
@@ -4772,5 +5347,9 @@
   if(  ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() ) 
   {
+#if ETRIKHU_CLEANUP_H0083
+    if(xAddIvMRGCand( mrgCandIdx,  iCount, ivCandDir, ivCandMv, ivCandRefIdx ) )
+#else
     if(xAddIvMRGCand( mrgCandIdx,  iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag, iCount3DV, inheritedVSPDisInfo ) )
+#endif
     {
       return;
@@ -4785,4 +5364,5 @@
 
 #if H_3D
+#if !ETRIKHU_CLEANUP_H0083
   if (iCountHEVC + iCount3DV > getSlice()->getMaxNumMergeCand())
   {
@@ -4794,4 +5374,5 @@
   }
   numValidMergeCand = iCount;
+#endif
 #else
   if ( getSlice()->getEnableTMVPFlag())
@@ -6227,5 +6808,7 @@
       if( bCheck )
       {
+#if !(NTT_BUG_FIX_TK54)
         clipMv(cColMv);
+#endif
         pDInfo->m_acNBDV = cColMv;
         pDInfo->m_aVIdxCan  = iTargetViewIdx;
@@ -6296,5 +6879,7 @@
         {
           TComMv cDispVec = cIDVInfo.m_acMvCand[iList][ curPos ];
+#if !(NTT_BUG_FIX_TK54)
           clipMv( cDispVec );
+#endif
           pDInfo->m_acNBDV = cDispVec;
           pDInfo->m_aVIdxCan = cIDVInfo.m_aVIdxCan[iList][ curPos ];
@@ -6426,5 +7011,7 @@
     Pel iDisp = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT );
     cMvPred->setHor( iDisp );
+#if !(NTT_BUG_FIX_TK54)
     clipMv(*cMvPred);
+#endif
   }
 }
@@ -6452,5 +7039,7 @@
         if (refViewIdx != m_pcSlice->getViewIndex()) 
         {
+#if !(NTT_BUG_FIX_TK54)
           clipMv(cMvPred);
+#endif
           pNbDvInfo->m_acNBDV = cMvPred;
           pNbDvInfo->m_aVIdxCan = refViewIdx;
@@ -6635,4 +7224,10 @@
 
   TComMv      cDv = depthRefineFlag ? pDInfo->m_acDoNBDV : pDInfo->m_acNBDV; 
+#if SEC_VER_DONBDV_H0103
+  if( depthRefineFlag )
+  {
+    cDv.setVer(0);
+  }
+#endif
 
   Int         iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + 2 ) >> 2 ) );
@@ -6743,4 +7338,7 @@
 , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
 #endif
+#if SEC_ADAPT_DISABLE_IVMP
+, Bool bICFlag
+#endif
 )
 {
@@ -6771,4 +7369,10 @@
 
   TComMv      cDv = depthRefineFlag ? pDInfo->m_acDoNBDV : pDInfo->m_acNBDV; 
+#if SEC_VER_DONBDV_H0103
+  if( depthRefineFlag )
+  {
+    cDv.setVer(0);
+  }
+#endif
 
   Bool abPdmAvailable[8] =  {false, false, false, false, false, false, false, false};
@@ -6778,4 +7382,9 @@
     pacPdmMv[i].setIDVFlag   (false);
   }
+#endif
+
+#if SEC_ADAPT_DISABLE_IVMP
+  if(!bICFlag)
+  {
 #endif
 
@@ -6786,5 +7395,9 @@
   if(!m_pcSlice->getIsDepth())
   {
+#if MTK_DIS_SPBIP8X4_H0205
+    if (!getDBBPFlag(0))
+#else
     if( getPartitionSize(0) == SIZE_2Nx2N )
+#endif
     {
       Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
@@ -6859,5 +7472,7 @@
 #endif
 #endif
+#if !(NTT_BUG_FIX_TK54)
                     clipMv( cMv );
+#endif
                     paiPdmRefIdx  [ uiCurrRefListId ] = iPdmRefIdx;
                     pacPdmMv      [ uiCurrRefListId ] = cMv;
@@ -6917,6 +7532,8 @@
                             cMv.setIDVVId    (iViewIndex); 
                           }
-
+                          
+#if !(NTT_BUG_FIX_TK54)
                           clipMv( cMv );
+#endif
                           bLoop_stop = true;
 
@@ -6939,4 +7556,14 @@
 
             }
+#if MTK_DIS_SPBIP8X4_H0205
+            if (iSPHeight + iSPWidth == 12)
+            {
+              if (puhInterDirSP[iPartition] == 3)
+              {
+                puhInterDirSP[iPartition] = 1;
+                pcMvFieldSP[2*iPartition + 1].setMvField(TComMv(0,0), -1);
+              }
+            }
+#endif
             iPartition ++;
           }
@@ -6960,5 +7587,9 @@
     iCurrPosY  += ( iHeight >> 1 );
   }
+#if MTK_DIS_SPBIP8X4_H0205
+  for(Int iLoopCan = ( (m_pcSlice->getIsDepth() || getDBBPFlag(0)) ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++) 
+#else
   for(Int iLoopCan = ( (m_pcSlice->getIsDepth() || getPartitionSize(uiPartAddr) != SIZE_2Nx2N) ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++) 
+#endif
 #else
   for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
@@ -7018,5 +7649,7 @@
 #endif
 #endif
+#if !(NTT_BUG_FIX_TK54)
                   clipMv( cMv );
+#endif
                   paiPdmRefIdx  [ (uiCurrRefListId + (iLoopCan<<2)) ] = iPdmRefIdx;
                   pacPdmMv      [ (uiCurrRefListId + (iLoopCan<<2)) ] = cMv;
@@ -7032,5 +7665,9 @@
   }
 #if H_3D_SPIVMP
+#if H_3D_FIX_DBBP_IVMP
+  for(Int iLoopCan = ( (m_pcSlice->getIsDepth() || getDBBPFlag(0)) ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++)
+#else
   for(Int iLoopCan = ( 1 - m_pcSlice->getIsDepth() ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++) 
+#endif
 #else
   for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
@@ -7040,4 +7677,7 @@
   }
 
+#if SEC_ADAPT_DISABLE_IVMP
+  }
+#endif
 
   ////////////////////////////////
@@ -7071,5 +7711,7 @@
 #endif
             cMv.setVer( 0 );
+#if !(NTT_BUG_FIX_TK54)
             clipMv( cMv );
+#endif
             pacPdmMv      [iRefListId + 2 + (iLoopCan<<2)] = cMv;
           }
Index: trunk/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 885)
+++ trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 950)
@@ -70,6 +70,8 @@
   Bool        abMergeFlag[2];       // for two segments
   UChar       auhMergeIndex[2];     // for two segments
+#if !RWTH_DBBP_NO_SPU_H0057
   Char        ahVSPFlag[2];         // for two segments
   DisInfo     acDvInfo[2];          // for two segments
+#endif
   
   PartSize    eVirtualPartSize;
@@ -193,4 +195,7 @@
   Bool*         m_pbSDCFlag;
   Pel*          m_apSegmentDCOffset[2];
+#if HS_DMM_SDC_PREDICTOR_UNIFY_H0108
+  Pel          m_apDmmPredictor[2];
+#endif
 #endif
 #endif
@@ -233,4 +238,9 @@
 #endif
 
+#if ETRIKHU_CLEANUP_H0083
+  TComMotionCand  m_mergCands[MRG_IVSHIFT+1];
+  Int           m_baseListidc;
+#endif
+
 protected:
   
@@ -239,11 +249,23 @@
   Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
 #if H_3D_VSP
+#if ETRIKHU_CLEANUP_H0083
+  Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount);
+#else
   Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
                              Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo);
 #endif
+#endif
 #if H_3D_IV_MERGE
+#if ETRIKHU_CLEANUP_H0083
+  Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int*   ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx ); 
+#else
   Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int*   ivCandDir, TComMv* ivCandMv, 
                                Int* ivCandRefIdx, Int posIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo   ); 
+#endif
+#if ETRIKHU_CLEANUP_H0083
+  Bool          xGetPosFirstAvailDmvCand( Int iCount, Int& iFirDispCand );
+#else
   Bool          xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int*  ivCandDir, Int posIvDC, Int* vspFlag, Int& iFirDispCand );
+#endif
 #endif
 
@@ -485,5 +507,7 @@
    
 #if H_3D
+#if !ETRIKHU_CLEANUP_H0083
   Void          rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo*  inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV);
+#endif
   Bool          getDispforDepth  ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
   Bool          getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm );
@@ -508,4 +532,7 @@
 #if H_3D_SPIVMP
     , TComMvField* pcMFieldSP, UChar* puhInterDirSP
+#endif
+#if SEC_ADAPT_DISABLE_IVMP
+    , Bool bICFlag
 #endif
     );   
@@ -556,4 +583,8 @@
   Pel           getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }
   Void          setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }
+#if HS_DMM_SDC_PREDICTOR_UNIFY_H0108
+  Void          setDmmPredictor ( Pel pOffset, UInt uiSeg) { m_apDmmPredictor[uiSeg] = pOffset; }
+  Pel           getDmmPredictor ( UInt uiSeg) { return m_apDmmPredictor[uiSeg]; }
+#endif
   UInt          getCtxSDCFlag          ( UInt   uiAbsPartIdx );
   UInt          getCtxAngleFlag        ( UInt   uiAbsPartIdx );
@@ -635,5 +666,18 @@
   Bool          getAvailableFlagA0() { return m_bAvailableFlagA0;}
   Bool          getAvailableFlagB2() { return m_bAvailableFlagB2;}
+#if ETRIKHU_CLEANUP_H0083
   Void          initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0;  }
+  Void          buildMCL(TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
+#if H_3D_VSP
+    , Int* vspFlag
+#endif
+#if H_3D_SPIVMP
+    , Bool* pbSPIVMPFlag
+#endif
+    , Int& numValidMergeCand
+    );
+#else
+  Void          initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0;  }
+#endif
   Void          getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1);
   Void          xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
@@ -642,9 +686,15 @@
 #endif
 #if H_3D_VSP
+#if !ETRIKHU_CLEANUP_H0083
                                             , Int* vspFlag
+#endif
                                             , InheritedVSPDisInfo*  inheritedVSPDisInfo
 #endif
 #if H_3D_SPIVMP
+#if ETRIKHU_CLEANUP_H0083
+                                            , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
+#else
                                             , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
+#endif
 #endif
                                             , Int& numValidMergeCand, Int mrgCandIdx = -1
Index: trunk/source/Lib/TLibCommon/TComMotionInfo.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComMotionInfo.h	(revision 885)
+++ trunk/source/Lib/TLibCommon/TComMotionInfo.h	(revision 950)
@@ -198,3 +198,82 @@
 //! \}
 
+#if ETRIKHU_CLEANUP_H0083
+class TComMotionCand
+{
+public:
+  Bool                  m_bAvailable;
+  TComMvField           m_cMvField[2];
+  UChar                 m_uDir;
+#if H_3D_VSP
+  Int                   m_iVspFlag;
+#endif  
+  Bool                  m_bSPIVMPFlag;
+
+public:
+  TComMotionCand()
+  {
+    m_bAvailable = false;
+    m_uDir = 0;
+#if H_3D_VSP
+    m_iVspFlag = 0;
+#endif
+    m_bSPIVMPFlag = false;
+  }
+
+  ~TComMotionCand()
+  {
+
+  }
+
+  Void init()
+  {
+    TComMv cZeroMv;
+
+    m_bAvailable = false;
+    m_uDir = 0;
+#if H_3D_VSP
+    m_iVspFlag = 0;
+#endif
+    m_bSPIVMPFlag = false;
+    m_cMvField[0].setMvField(cZeroMv, NOT_VALID);
+    m_cMvField[1].setMvField(cZeroMv, NOT_VALID);
+  }
+
+  Void setCand(TComMvField* pcMvFieldNeighbours, UChar uhInterDirNeighbours
+#if H_3D_VSP
+    , Int vspFlag
+#endif
+    , Bool bSPIVMPFlag
+    )
+  {
+    m_bAvailable = true;
+    m_cMvField[0] = pcMvFieldNeighbours[0];
+    m_cMvField[1] = pcMvFieldNeighbours[1];
+    m_uDir = uhInterDirNeighbours;
+#if H_3D_VSP
+    m_iVspFlag = vspFlag;
+#endif
+    m_bSPIVMPFlag = bSPIVMPFlag;
+  }
+
+
+  Void getCand(Int iCount, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
+#if H_3D_VSP
+    , Int* vspFlag
+#endif
+    , Bool* pbSPIVMPFlag
+    )
+  {
+    pcMvFieldNeighbours[iCount<<1] = m_cMvField[0];
+    pcMvFieldNeighbours[(iCount<<1) + 1] = m_cMvField[1];
+    puhInterDirNeighbours[iCount] = m_uDir;
+#if H_3D_VSP
+    vspFlag[iCount] = m_iVspFlag;
+#endif
+    pbSPIVMPFlag[iCount] = m_bSPIVMPFlag;
+  }
+};
+#endif
+
+
 #endif // __TCOMMOTIONINFO__
Index: trunk/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComPrediction.cpp	(revision 885)
+++ trunk/source/Lib/TLibCommon/TComPrediction.cpp	(revision 950)
@@ -500,4 +500,8 @@
   Pel* pDst = piPred;
   xAssignBiSegDCs( pDst, uiStride, biSegPattern, patternStride, segDC1, segDC2 );
+#if HS_DMM_SDC_PREDICTOR_UNIFY_H0108
+  pcCU->setDmmPredictor(segDC1, 0);
+  pcCU->setDmmPredictor(segDC2, 1);
+#endif
 
 #if H_3D_DIM_DMM
@@ -519,5 +523,9 @@
       Int RefPOCL0 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr))->getPOC();
       Int RefPOCL1 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_1, pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr))->getPOC();
+#if MTK_ALIGN_SW_WD_BI_PRED_ARP_H0085
+      if(!pcCU->getARPW(PartAddr) && RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr))
+#else
       if(RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr))
+#endif
       {
         return true;
@@ -639,10 +647,17 @@
   
   // start mapping process
+#if !MTK_DBBP_AMP_REM_H0072
   Bool bAMPAvail = uiSize > 8;
   Int matchedPartSum[6][2] = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}; // counter for each part size and boolean option
   PartSize virtualPartSizes[6] = { SIZE_Nx2N, SIZE_2NxN, SIZE_2NxnU, SIZE_2NxnD, SIZE_nLx2N, SIZE_nRx2N };
+#else
+  Int matchedPartSum[2][2] = {{0,0},{0,0}}; // counter for each part size and boolean option
+  PartSize virtualPartSizes[2] = { SIZE_Nx2N, SIZE_2NxN};
+#endif
   
   UInt uiHalfSize = uiSize>>1;
+#if !MTK_DBBP_AMP_REM_H0072
   UInt uiQuarterSize = uiSize>>2;
+#endif
   
   for (Int y=0; y<uiSize; y+=iSubSample)
@@ -677,4 +692,5 @@
       }
       
+#if !MTK_DBBP_AMP_REM_H0072
       if( bAMPAvail )
       {
@@ -719,4 +735,5 @@
         }
       }
+#endif
     }
     
@@ -728,5 +745,9 @@
   
   Int iMaxMatchSum = 0;
-  for(Int p=0; p<6; p++)  // loop over partition sizes
+#if !MTK_DBBP_AMP_REM_H0072
+  for(Int p=0; p<6; p++)  // loop over partition
+#else
+  for(Int p=0; p<2; p++)  // loop over partition
+#endif
   {
     for( Int b=0; b<=1; b++ ) // loop over boolean options
@@ -838,4 +859,9 @@
   
   UInt  uiMaskStride= MAX_CU_SIZE;
+#if SEC_DBBP_FILTERING_H0104
+  Pel  filSrc = 0;
+  Pel* tmpTar = 0;
+  tmpTar = (Pel *)xMalloc(Pel, uiWidth*uiHeight);
+#endif
   
   // backup pointer
@@ -851,4 +877,7 @@
       
       // filtering
+#if SEC_DBBP_FILTERING_H0104
+      tmpTar[y*uiWidth+x] = piSrc[ucSegment][x];
+#else
       Bool t = (y==0)?pMaskStart[(y+1)*uiMaskStride+x]:pMaskStart[(y-1)*uiMaskStride+x];
       Bool l = (x==0)?pMaskStart[y*uiMaskStride+x+1]:pMaskStart[y*uiMaskStride+x-1];
@@ -858,11 +887,51 @@
       Bool bBlend = !((t&&l&&b&&r) || (!t&&!l&&!b&&!r));
       piDst[x] = bBlend?((piSrc[0][x]+piSrc[1][x]+1)>>1):piSrc[ucSegment][x];
+#endif
     }
     
     piSrc[0]  += uiSrcStride;
     piSrc[1]  += uiSrcStride;
+#if !SEC_DBBP_FILTERING_H0104
     piDst     += uiDstStride;
+#endif
     pMask     += uiMaskStride;
   }
+  
+#if SEC_DBBP_FILTERING_H0104
+  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 l = (x==0)?pMaskStart[y*uiMaskStride+x]:pMaskStart[y*uiMaskStride+x-1];
+      Bool b = (y==uiHeight-1)?pMaskStart[y*uiMaskStride+x]:pMaskStart[(y+1)*uiMaskStride+x];
+      Bool r = (x==uiWidth-1)?pMaskStart[y*uiMaskStride+x]:pMaskStart[y*uiMaskStride+x+1];
+      Bool c =pMaskStart[y*uiMaskStride+x];
+
+      Pel left, right, top, bottom;
+      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];
+      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];
+
+      if(!((l&&r&&c) || (!l&&!r&&!c)))
+      {
+        filSrc = Clip3( Pel( 0 ), Pel( 255 ), Pel(( left + (tmpTar[y*uiWidth+x] << 1) + right ) >> 2 ));
+      }
+      else
+      {
+        filSrc = tmpTar[y*uiWidth+x];
+      }
+
+      if(!((t&&b&&c) || (!t&&!b&&!c)))
+      {
+        filSrc = Clip3( Pel( 0 ), Pel( 255 ), Pel(( top + (filSrc << 1) + bottom ) >> 2 ));
+      }
+      piDst[x] = filSrc;
+    }
+    piDst     += uiDstStride;
+  }
+  if ( tmpTar    ) { xFree(tmpTar);             tmpTar        = NULL; }
+#endif
   
   // now combine chroma
@@ -875,4 +944,10 @@
   UInt  uiWidthC        = uiWidth >> 1;
   UInt  uiHeightC       = uiHeight >> 1;
+#if SEC_DBBP_FILTERING_H0104
+  Pel  filSrcU = 0, filSrcV = 0;
+  Pel* tmpTarU = 0, *tmpTarV = 0;
+  tmpTarU = (Pel *)xMalloc(Pel, uiWidthC*uiHeightC);
+  tmpTarV = (Pel *)xMalloc(Pel, uiWidthC*uiHeightC);
+#endif
   pMask = pMaskStart;
   
@@ -885,4 +960,8 @@
       
       // filtering
+#if SEC_DBBP_FILTERING_H0104
+      tmpTarU[y*uiWidthC+x] = piSrcU[ucSegment][x];
+      tmpTarV[y*uiWidthC+x] = piSrcV[ucSegment][x];
+#else
       Bool t = (y==0)?pMaskStart[(y+1)*2*uiMaskStride+x*2]:pMaskStart[(y-1)*2*uiMaskStride+x*2];
       Bool l = (x==0)?pMaskStart[y*2*uiMaskStride+(x+1)*2]:pMaskStart[y*2*uiMaskStride+(x-1)*2];
@@ -894,4 +973,5 @@
       piDstU[x] = bBlend?((piSrcU[0][x]+piSrcU[1][x]+1)>>1):piSrcU[ucSegment][x];
       piDstV[x] = bBlend?((piSrcV[0][x]+piSrcV[1][x]+1)>>1):piSrcV[ucSegment][x];
+#endif
     }
     
@@ -900,8 +980,60 @@
     piSrcV[0]   += uiSrcStrideC;
     piSrcV[1]   += uiSrcStrideC;
+#if !SEC_DBBP_FILTERING_H0104
     piDstU      += uiDstStrideC;
     piDstV      += uiDstStrideC;
+#endif
     pMask       += 2*uiMaskStride;
   }
+
+#if SEC_DBBP_FILTERING_H0104
+  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 l = (x==0)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[y*2*uiMaskStride+(x-1)*2];
+      Bool b = (y==uiHeightC-1)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[(y+1)*2*uiMaskStride+x*2];
+      Bool r = (x==uiWidthC-1)?pMaskStart[y*2*uiMaskStride+x*2]:pMaskStart[y*2*uiMaskStride+(x+1)*2];
+      Bool c =pMaskStart[y*2*uiMaskStride+x*2];
+
+      Pel leftU, rightU, topU, bottomU;
+      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];
+      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 leftV, rightV, topV, bottomV;
+      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];
+      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(!((l&&r&&c) || (!l&&!r&&!c)))
+      {
+        filSrcU = Clip3( Pel( 0 ), Pel( 255 ), Pel(( leftU + (tmpTarU[y*uiWidthC+x] << 1) + rightU ) >> 2 ));
+        filSrcV = Clip3( Pel( 0 ), Pel( 255 ), Pel(( leftV + (tmpTarV[y*uiWidthC+x] << 1) + rightV ) >> 2 ));
+      }
+      else
+      {
+        filSrcU = tmpTarU[y*uiWidthC+x];
+        filSrcV = tmpTarV[y*uiWidthC+x];
+      }
+
+      if(!((t&&b&&c) || (!t&&!b&&!c)))
+      {
+        filSrcU = Clip3( Pel( 0 ), Pel( 255 ), Pel(( topU + (filSrcU << 1) + bottomU ) >> 2 ));
+        filSrcV = Clip3( Pel( 0 ), Pel( 255 ), Pel(( topV + (filSrcV << 1) + bottomV ) >> 2 ));
+      }
+
+      piDstU[x] = filSrcU;
+      piDstV[x] = filSrcV;
+    }
+    piDstU      += uiDstStrideC;
+    piDstV      += uiDstStrideC;
+  }
+  if ( tmpTarU    ) { xFree(tmpTarU);             tmpTarU        = NULL; }
+  if ( tmpTarV    ) { xFree(tmpTarV);             tmpTarV        = NULL; }
+#endif
 }
 #endif
@@ -1286,8 +1418,17 @@
 
     assert ( cDistparity.bDV );
-
+    
+#if NTT_BUG_FIX_TK54
+    TComMv cNBDV = cDistparity.m_acNBDV;
+    pcCU->clipMv( cNBDV );
+    
+    pcPicYuvRef = pcPicYuvBaseCol->getPicYuvRec();
+    xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, bi, true );
+    xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, bi, true );
+#else
     pcPicYuvRef = pcPicYuvBaseCol->getPicYuvRec();
     xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cDistparity.m_acNBDV, iWidth, iHeight, pYuvB0, bi, true );
     xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cDistparity.m_acNBDV, iWidth, iHeight, pYuvB0, bi, true );
+#endif
     
     pcPicYuvRef = pcPicYuvBaseRef->getPicYuvRec();
@@ -2187,4 +2328,5 @@
   if (orgDC == false)
   {
+#if !HS_DMM_SDC_PREDICTOR_UNIFY_H0108
     if ( getDimType(uiIntraMode) == DMM1_IDX )
     {
@@ -2232,4 +2374,5 @@
     }
     else
+#endif
     {
       Pel* pLeftTop = pOrig;
Index: trunk/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 885)
+++ trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 950)
@@ -360,4 +360,9 @@
 Char  g_aucConvertToBit  [ MAX_CU_SIZE+1 ];
 
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+UInt g_aICEnableCANDIDATE[10] = { 0, };
+UInt g_aICEnableNUM[ 10 ] = { 0, };
+Int g_lastlayer=0;
+#endif
 #if ENC_DEC_TRACE
 FILE*  g_hTrace = NULL;
Index: trunk/source/Lib/TLibCommon/TComRom.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComRom.h	(revision 885)
+++ trunk/source/Lib/TLibCommon/TComRom.h	(revision 950)
@@ -189,4 +189,10 @@
 extern       Char   g_aucConvertToBit  [ MAX_CU_SIZE+1 ];   // from width to log2(width)-2
 
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+extern UInt g_aICEnableCANDIDATE[10];
+extern UInt g_aICEnableNUM[ 10 ]; //10 layers
+extern Int g_lastlayer;
+#endif
+
 #ifndef ENC_DEC_TRACE
 #define ENC_DEC_TRACE   0
Index: trunk/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 885)
+++ trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 950)
@@ -3220,6 +3220,72 @@
 #endif
 #if H_3D_IC
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+Void TComSlice::xSetApplyIC(Bool bUseLowLatencyICEnc)
+#else
 Void TComSlice::xSetApplyIC()
-{
+#endif
+{
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+  if(bUseLowLatencyICEnc)
+  {
+    Bool existInterViewRef=false;
+    TComPic* pcCurrPic = getPic();
+    TComPic* pcRefPic = NULL;
+    for ( Int i = 0; (i < getNumRefIdx( REF_PIC_LIST_0 )) && !existInterViewRef; i++ )
+    {
+      pcRefPic = getRefPic( REF_PIC_LIST_0, i );
+      if ( pcRefPic != NULL )
+      {
+        if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() )
+        {
+          existInterViewRef = true;        
+        }
+      }
+    }
+
+    for ( Int i = 0; (i < getNumRefIdx( REF_PIC_LIST_1 )) && !existInterViewRef; i++ )
+    {
+      pcRefPic = getRefPic( REF_PIC_LIST_1, i );
+      if ( pcRefPic != NULL )
+      {
+        if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() )
+        {
+          existInterViewRef = true;        
+        }
+      }
+    }
+
+    if(!existInterViewRef)
+    {
+      m_bApplyIC = false;
+    }
+    else
+    {
+      Int curLayer=getDepth();
+      if( curLayer>9) curLayer=9; // Max layer is 10
+
+      m_bApplyIC = true;
+      Int refLayer = curLayer-1;
+      if( (refLayer>=0) && (g_aICEnableCANDIDATE[refLayer]>0) )
+      {    
+        Double ratio=Double(g_aICEnableNUM[refLayer])/Double(g_aICEnableCANDIDATE[refLayer]);
+
+        if( ratio > MTK_LOW_LATENCY_IC_ENCODING_THRESHOLD_H0086)
+{
+          m_bApplyIC=true;
+        }
+        else
+        {
+          m_bApplyIC=false;
+        }
+      }
+      g_aICEnableNUM[curLayer]=0;
+      g_aICEnableCANDIDATE[curLayer]=0;
+      g_lastlayer=getDepth();
+    }
+  }
+  else
+  {
+#endif
   Int iMaxPelValue = ( 1 << g_bitDepthY ); 
   Int *aiRefOrgHist;
@@ -3295,4 +3361,7 @@
   aiCurrHist = NULL;
   aiRefOrgHist = NULL;
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+  }//if(bUseLowLatencyICEnc)
+#endif
 }
 #endif
Index: trunk/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.h	(revision 885)
+++ trunk/source/Lib/TLibCommon/TComSlice.h	(revision 950)
@@ -2179,4 +2179,7 @@
   Bool      getApplyIC()                                        { return m_bApplyIC; }
   Void      xSetApplyIC();
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+  Void      xSetApplyIC(Bool bUseLowLatencyICEnc);
+#endif
   Void      setIcSkipParseFlag( Bool b )                        { m_icSkipParseFlag = b; }
   Bool      getIcSkipParseFlag()                                { return m_icSkipParseFlag; }
Index: trunk/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- trunk/source/Lib/TLibCommon/TypeDef.h	(revision 885)
+++ trunk/source/Lib/TLibCommon/TypeDef.h	(revision 950)
@@ -65,4 +65,6 @@
 #define H_3D          ( HEVC_EXT == 2)
 
+#define NTT_BUG_FIX_TK54    1
+
 
 /////////////////////////////////////////////////////////////////////////////////////////
@@ -107,4 +109,5 @@
                                               // MTK_ARP_REF_SELECTION_G0053 ARP Reference picture selection in JCT3V-G0053 
 
+
 #define H_3D_IC                           1   // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060
                                               // Unifying rounding offset, for IC part, JCT3V-D0135
@@ -116,4 +119,5 @@
                                               // MTK_IC_FLAG_CABAC_SIMP_G0061
                                               // SEC_IC_ARP_SIG_G0072, Disabling IC when ARP is enabled, option 1 in JCT3V-G0072, part 2 in JCT3V-G0121
+
 
 #if H_3D_NBDV
@@ -157,4 +161,5 @@
                                               // SEC_DEPTH_DV_DERIVAITON_G0074, Simplification of DV derivation for depth, JCT3V-G0074
                                               // QC_DEPTH_MERGE_SIMP_G0127 Remove DV candidate and shifting candidate for depth coding
+
 
 #define H_3D_TMVP                         1   // QC_TMVP_C0047 
@@ -192,6 +197,4 @@
                                               // QC_PKU_SDC_SPLIT_G0123 Intra SDC Split
 
-
-
 #define H_3D_INTER_SDC                    1   // INTER SDC, Inter simplified depth coding
                                               // LGE_INTER_SDC_E0156 Enable inter SDC for depth coding
@@ -307,4 +310,53 @@
 #endif
 
+
+/////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////   HTM-11.0 Integrations                  //////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////
+#if H_3D
+#define  H_3D_FIX_DBBP_IVMP                1  // 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 MTK_ALIGN_SW_WD_BI_PRED_ARP_H0085 1   // Align the SW and WD for the bi-prediction ARP PUs by disallowing non-normative fast bi-prediction for ARP PUs, JCT3V-H0085
+#define MTK_LOW_LATENCY_IC_ENCODING_H0086   1 // Low-latency IC encoding in JCT3V-H0086
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+#define MTK_LOW_LATENCY_IC_ENCODING_THRESHOLD_H0086    0.1 // Threshold for low-latency IC encoding in JCT3V-H0086
+#endif
+#define SEC_ADAPT_DISABLE_IVMP            1   // Disalbing IVMP merge candidates when IC is enabled, JCT3V-H0070
+
+#define MTK_DELTA_DC_FLAG_ONE_CONTEXT_H0084_H0100_H0113     1 // Use only one context for CABAC of delta_dc_flag as in JCTVC-H0084, JCTVC-H0100 and JCTVC-H0113
+#define MTK_SDC_FLAG_FIX_H0095            1   // Remove conditional check of PCM flag based on SDC flag, JCTVC-H0095
+#define MTK_DMM_SIMP_CODE_H0092           1   // Remove CABAC context for DMM1 mode coding
+
+
+#define QC_IV_PRED_CONSTRAINT_H0137       1   // Constraint on inter-view (motion) prediction tools
+#define ETRIKHU_BUGFIX_H0083              1   // bug-fix for DV candidate pruning
+#define ETRIKHU_CLEANUP_H0083             1   // cleaned-up source code for constructing merging candidate list
+#define ETRIKHU_CLEANUP_H0083_MISSING     1   // missing guard macros added by GT
+#define SHARP_SIMPLE_MERGE_H0062          1   // Restrict 3D-HEVC merge cand in small PUs
+#define MTK_DIS_SPBIP8X4_H0205            1   // Disable bi-prediction for 8x4 and 4x8 sub PU and remove the SPIVMP 2Nx2N restriction
+
+#if H_3D_NBDV
+#define SEC_VER_DONBDV_H0103              1   // Vertical DV Restriction for DoNBDV
+#endif
+
+#if H_3D_DIM
+#define HS_DMM_SDC_PREDICTOR_UNIFY_H0108  1   // Unification of DMM and SDC predictor derivation
+#define LGE_SIMP_DIM_NOT_PRESENT_FLAG_CODING_H0119_H0135  1 // Use only one context for CABAC of dim_not_present_flag
+#define QC_SIMP_DELTADC_CODING_H0131      1   // Simplify detaDC entropy coding 
+
+#if H_3D_DIM_DLT
+#define SEC_NO_RESI_DLT_H0105             1
+#define MTK_DLT_CODING_FIX_H0091          1
+#endif
+#endif
+#if H_3D_DBBP
+#define MTK_DBBP_AMP_REM_H0072                 1
+#define RWTH_DBBP_NO_SPU_H0057                 1
+#define SEC_DBBP_FILTERING_H0104               1
+#define MTK_DBBP_SIGNALING_H0094               1    
+#endif
+
+#define MPI_SUBPU_DEFAULT_MV_H0077_H0099_H0111_H0133    1
+#endif
 /////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////   TBD                  //////////////////////////////
@@ -313,5 +365,5 @@
 // #define H_MV_HLS_7_POC_P0041_3            0 // (POC/P0041/POC reset) #3 It was remarked that we should require each non-IRAP picture that has discardable_flag equal to 1 to have NUT value indicating that it is a sub-layer non-reference picture. This was agreed. Decision: Adopt (with constraint for discardable_flag as described above) 
 // #define H_MV_HLS_7_POC_P0041_FIXES        0 // (POC/P0041/Fixes) For each non-IRAP picture that has discardable_flag equal to 1 to have NUT value indicating that it is a sub-layer non-reference picture. 
-// #define H_MV_HLS_7_POC_P0056_4            0 // (POC/P0056/layer tree poc) #4 Proposal 1: If the POC reset approach is adopted as the basis for multi-layer POC derivation, it is proposed to derive the POC anchor picture from the previous TID0 picture (that is not a RASL picture, a RADL picture or a sub-layer non-reference picture and not with discardable_flag equal to 1) of  the current layer or any of its reference layer. This is asserted to improve loss resilience and reduce bit rate overhead. Decision: Adopt Proposal 1 (with the suggested modifications  with text provided as P0297).
+// #define H_MV_HLS_7_POC_P0056_4            0 // (POC/P0056/layer tree poc) #4 Proposal 1: If the POC reset approach is adopted as the basis for multi-layer POC derivation, it is proposed to derive the POC anchor picture from the previous TID0 picture (that is not a RASL picture, a RADL picture or a sub-layer non-reference picture and not with discardable_flag equal to 1) of  the current layer or any of its reference layer. This is asserted to improve loss resilience and reduce bit rate overhead. Decision: Adopt Proposal 1 (with the suggested modifications Ewith text provided as P0297).
 
 // #define H_MV_HLS_7_SEI_P0133_28           0 // (SEI/P0133/Recovery point SEI) #28 Decision: Adopt change to recover point semantics only (-v3)
@@ -323,5 +375,4 @@
 
 #define H_MV_HLS7_GEN                        0  // General changes (not tested)
-
 
 
@@ -797,4 +848,23 @@
 };
 
+/// merging candidates
+#if ETRIKHU_CLEANUP_H0083
+enum DefaultMergCandOrder
+{
+  MRG_T = 0,            ///< MPI
+  MRG_D,                ///< DDD
+  MRG_IVMC,             ///< Temporal inter-view
+  MRG_A1,               ///< Left
+  MRG_B1,               ///< Above
+  MRG_B0,               ///< Above right
+  MRG_IVDC,             ///< Disparity inter-view
+  MRG_VSP,              ///< VSP
+  MRG_A0,               ///< Left bottom
+  MRG_B2,               ///< Above left
+  MRG_IVSHIFT,          ///< Shifted IVMC of Shifted IVDC. (These are mutually exclusive)
+  MRG_COL               ///< Temporal co-located
+};
+#endif
+
 /// coefficient scanning type used in ACS
 enum COEFF_SCAN_TYPE
Index: trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 885)
+++ trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 950)
@@ -440,4 +440,12 @@
 
             READ_FLAG(uiCode, "inter_view_dlt_pred_enable_flag[ i ]"); 
+
+#if  MTK_DLT_CODING_FIX_H0091
+            if( uiCode )
+            {
+                assert( pcDLT->getUseDLTFlag( 1 ));
+            }
+#endif
+
             pcDLT->setInterViewDltPredEnableFlag( i, (uiCode == 1) ? true : false );
 
@@ -1751,4 +1759,10 @@
 #if H_3D_IV_MERGE
         READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
+#if QC_IV_PRED_CONSTRAINT_H0137
+        if( !pcVPS->getNumDirectRefLayers(i) )
+        {
+          assert( !uiCode );         
+        }
+#endif
 #if H_3D_SPIVMP
         READ_UVLC (uiCode, "log2_sub_PU_size_minus3[i]");     pcVPS->setSubPULog2Size(i, uiCode+3); 
@@ -1757,5 +1771,10 @@
 #if H_3D_ARP
         READ_FLAG( uiCode, "iv_res_pred_flag[i]"  );       pcVPS->setUseAdvRP  ( i, uiCode ); pcVPS->setARPStepNum( i, uiCode ? H_3D_ARP_WFNR : 1 );
-
+#if QC_IV_PRED_CONSTRAINT_H0137
+        if( !pcVPS->getNumDirectRefLayers(i) )
+        {
+          assert( !uiCode );         
+        }
+#endif
 #endif
 #if H_3D_NBDV_REF
@@ -1764,4 +1783,10 @@
 #if H_3D_VSP
         READ_FLAG( uiCode, "view_synthesis_pred_flag[i]"); pcVPS->setViewSynthesisPredFlag( i, uiCode == 1 ? true : false );
+#if QC_IV_PRED_CONSTRAINT_H0137
+        if( !pcVPS->getNumDirectRefLayers(i) )
+        {
+          assert( !uiCode );         
+        }
+#endif
 #endif
 #if H_3D_DBBP
@@ -1775,4 +1800,10 @@
         {
           READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
+#if QC_IV_PRED_CONSTRAINT_H0137
+          if( !pcVPS->getNumDirectRefLayers(i) )
+          {
+            assert( !uiCode );         
+          }
+#endif
         }
 #endif
Index: trunk/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCu.cpp	(revision 885)
+++ trunk/source/Lib/TLibDecoder/TDecCu.cpp	(revision 950)
@@ -431,9 +431,24 @@
     m_ppcCU[uiDepth]->initAvailableFlags();
     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
-    m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
+    m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours 
+#if !ETRIKHU_CLEANUP_H0083
+      ,vspFlag
+#endif
+      , inheritedVSPDisInfo
 #if H_3D_SPIVMP
-      , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
+#if !ETRIKHU_CLEANUP_H0083_MISSING
+      , bSPIVMPFlag
+#endif
+      , pcMvFieldSP, puhInterDirSP
 #endif
       , numValidMergeCand, uiMergeIndex );
+
+#if ETRIKHU_CLEANUP_H0083
+    m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag
+#if H_3D_SPIVMP
+      , bSPIVMPFlag
+#endif
+      , numValidMergeCand );
+#endif
     pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
 #else
@@ -782,6 +797,13 @@
     }
     
+#if RWTH_DBBP_NO_SPU_H0057
+    AOF( pcCU->getARPW(uiPartAddr) == 0 );
+    AOF( pcCU->getICFlag(uiPartAddr) == false );
+    AOF( pcCU->getSPIVMPFlag(uiPartAddr) == false );
+    AOF( pcCU->getVSPFlag(uiPartAddr) == 0 );
+#else
     pDBBPTmpData->ahVSPFlag[uiSegment] = pcCU->getVSPFlag( uiPartAddr );
     pDBBPTmpData->acDvInfo[uiSegment] = pcCU->getDvInfo( uiPartAddr );
+#endif
   }
   
@@ -793,6 +815,8 @@
     pcCU->setInterDirSubParts( pDBBPTmpData->auhInterDir[uiSegment], 0, 0, uiDepth );
     
+#if !RWTH_DBBP_NO_SPU_H0057
     pcCU->setVSPFlagSubParts( pDBBPTmpData->ahVSPFlag[uiSegment], 0, 0, uiDepth );
     pcCU->setDvInfoSubParts( pDBBPTmpData->acDvInfo[uiSegment], 0, 0, uiDepth );
+#endif
     
     for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
@@ -816,6 +840,8 @@
     pcCU->setDBBPFlagSubParts(true, uiPartAddr, uiSegment, uiDepth);
     
+#if !RWTH_DBBP_NO_SPU_H0057
     pcCU->setVSPFlagSubParts( pDBBPTmpData->ahVSPFlag[uiSegment], uiPartAddr, uiSegment, uiDepth );
     pcCU->setDvInfoSubParts( pDBBPTmpData->acDvInfo[uiSegment], uiPartAddr, uiSegment, uiDepth );
+#endif
     
     pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[uiSegment], uiPartAddr, uiSegment, uiDepth); // interprets depth relative to LCU level
@@ -920,5 +946,5 @@
     for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     {
-#if H_3D
+#if H_3D && !SEC_NO_RESI_DLT_H0105
       if ( useDltFlag )
       {
@@ -1231,4 +1257,12 @@
   // get DC prediction for each segment
   Pel apDCPredValues[2];
+#if HS_DMM_SDC_PREDICTOR_UNIFY_H0108
+  if ( getDimType( uiLumaPredMode ) == DMM1_IDX || getDimType( uiLumaPredMode ) == DMM4_IDX )
+  {
+    apDCPredValues[0] = pcCU->getDmmPredictor( 0 );
+    apDCPredValues[1] = pcCU->getDmmPredictor( 1 );
+  }
+  else
+#endif
   m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode);
   
Index: trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 885)
+++ trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 950)
@@ -139,5 +139,10 @@
   
 #if H_3D_DBBP
+
+#if MTK_DBBP_SIGNALING_H0094
+  if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) )
+#else
   if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE )
+#endif
   {
     decodeDBBPFlag(pcCU, uiAbsPartIdx, uiDepth);
@@ -145,5 +150,7 @@
     if( pcCU->getDBBPFlag(uiAbsPartIdx) )
     {
+#if !MTK_DBBP_SIGNALING_H0094
       AOF( pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE );
+#endif
       
       // get collocated depth block
@@ -161,4 +168,11 @@
       
       pcCU->setPartSizeSubParts(eVirtualPartSize, uiAbsPartIdx, uiDepth);
+      
+#if RWTH_DBBP_NO_SPU_H0057
+      // make sure that DBBP flag is set for both segments
+      UInt uiPUOffset = ( g_auiPUOffset[UInt( eVirtualPartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4;
+      pcCU->setDBBPFlagSubParts(true, uiAbsPartIdx, 0, uiDepth);
+      pcCU->setDBBPFlagSubParts(true, uiAbsPartIdx+uiPUOffset, 1, uiDepth);
+#endif
     }
   }
@@ -196,4 +210,5 @@
     return;
   }
+#if !MTK_SDC_FLAG_FIX_H0095
 #if H_3D_DIM_SDC
   if( pcCU->getSDCFlag(uiAbsPartIdx) )
@@ -201,4 +216,5 @@
     return;
   }
+#endif
 #endif
   
@@ -292,9 +308,24 @@
           pcSubCU->initAvailableFlags();
           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
-          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
+          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours
+#if !ETRIKHU_CLEANUP_H0083
+            ,vspFlag
+#endif
+            , inheritedVSPDisInfo
 #if H_3D_SPIVMP
-            , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
+#if !ETRIKHU_CLEANUP_H0083_MISSING
+            , bSPIVMPFlag
+#endif
+            , pcMvFieldSP, puhInterDirSP
 #endif
             , numValidMergeCand );
+
+#if ETRIKHU_CLEANUP_H0083
+          pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag
+#if H_3D_SPIVMP
+            , bSPIVMPFlag
+#endif
+            , numValidMergeCand );
+#endif
           pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
 
@@ -329,9 +360,24 @@
         pcSubCU->initAvailableFlags();
         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
-        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
+        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours
+#if !ETRIKHU_CLEANUP_H0083
+          , vspFlag
+#endif
+          , inheritedVSPDisInfo
 #if H_3D_SPIVMP
-          , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
+#if !ETRIKHU_CLEANUP_H0083_MISSING
+            , bSPIVMPFlag
+#endif
+          , pcMvFieldSP, puhInterDirSP
 #endif
           ,numValidMergeCand, uiMergeIndex );
+
+#if ETRIKHU_CLEANUP_H0083
+        pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag
+#if H_3D_SPIVMP
+          , bSPIVMPFlag
+#endif
+          ,numValidMergeCand );
+#endif
         pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
         if(vspFlag[uiMergeIndex])
Index: trunk/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 885)
+++ trunk/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 950)
@@ -87,5 +87,5 @@
 , m_cDdcDataSCModel           ( 1,             1,               NUM_DDC_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
 , m_cAngleFlagSCModel         ( 1,             1,               NUM_ANGLE_FLAG_CTX            , m_contextModels + m_numContextModels, m_numContextModels)
-#if H_3D_DIM_DMM
+#if H_3D_DIM_DMM && !MTK_DMM_SIMP_CODE_H0092
 , m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
 #endif
@@ -171,5 +171,5 @@
   m_cDdcDataSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_DDC_DATA );
   m_cAngleFlagSCModel.initBuffer         ( sliceType, qp, (UChar*)INIT_ANGLE_FLAG );
-#if H_3D_DIM_DMM
+#if H_3D_DIM_DMM && !MTK_DMM_SIMP_CODE_H0092
   m_cDmm1DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM1_DATA );
 #endif
@@ -241,5 +241,5 @@
   m_cDdcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );
   m_cAngleFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );
-#if H_3D_DIM_DMM
+#if H_3D_DIM_DMM && !MTK_DMM_SIMP_CODE_H0092
   m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
 #endif
@@ -386,6 +386,9 @@
     uiCount++;
   }
+#if QC_SIMP_DELTADC_CODING_H0131
+  while( uiSymbol && ( uiCount != 3 ) );
+#else
   while( uiSymbol && ( uiCount != 13 ) );
-
+#endif
   ruiSymbol = uiCount - 1;
 
@@ -423,5 +426,9 @@
   for( Int i = 0; i < iNumBit; i++ )
   {
+#if MTK_DMM_SIMP_CODE_H0092
+      m_pcTDecBinIf->decodeBinEP( uiSymbol );
+#else
     m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm1DataSCModel.get(0, 0, 0) );
+#endif
     uiIdx += uiSymbol << i;
   }
@@ -1128,5 +1135,9 @@
   if( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() >> pcCU->getDepth( absPartIdx ) ) < 64 ) //DMM and HEVC intra modes are both allowed
   {
+#if LGE_SIMP_DIM_NOT_PRESENT_FLAG_CODING_H0119_H0135
+    m_pcTDecBinIf->decodeBin( uiSymbol, m_cAngleFlagSCModel.get( 0, 0, 0 ) );
+#else
     m_pcTDecBinIf->decodeBin( uiSymbol, m_cAngleFlagSCModel.get( 0, 0, pcCU->getCtxAngleFlag( absPartIdx ) ) );
+#endif
   }
   else
@@ -2068,7 +2079,9 @@
     UInt dir     = pcCU->getLumaIntraDir( absPartIdx );
     uiNumSegments = isDimMode( dir ) ? 2 : 1;
-
+#if MTK_DELTA_DC_FLAG_ONE_CONTEXT_H0084_H0100_H0113
+    m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get( 0, 0, 0 ) );
+#else
     m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get( 0, 0, uiNumSegments-1 ) );
-
+#endif
     if( pcCU->getSDCFlag( absPartIdx ) )
     {
@@ -2141,8 +2154,12 @@
 Void TDecSbac::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
 {
+#if !MTK_DBBP_SIGNALING_H0094
   PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
+#endif
   AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) );
   AOF( !pcCU->getSlice()->getIsDepth() );
+#if !MTK_DBBP_SIGNALING_H0094
   AOF( ePartSize == RWTH_DBBP_PACK_MODE );
+#endif
   
   UInt uiSymbol = 0;
@@ -2153,4 +2170,8 @@
   {
     pcCU->setDBBPFlagSubParts(true, uiAbsPartIdx, 0, uiDepth);
+#if MTK_DIS_SPBIP8X4_H0205
+    UInt uiCurrPartNumQ = (pcCU->getPic()->getNumPartInCU() >> (2 * uiDepth)) >> 2;
+    pcCU->setDBBPFlagSubParts(true, uiAbsPartIdx + 2*uiCurrPartNumQ, 1, uiDepth);
+#endif
   }
 }
Index: trunk/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 885)
+++ trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 950)
@@ -214,5 +214,5 @@
   ContextModel3DBuffer m_cDdcDataSCModel;
   ContextModel3DBuffer m_cAngleFlagSCModel;
-#if H_3D_DIM_DMM
+#if H_3D_DIM_DMM && !MTK_DMM_SIMP_CODE_H0092
   ContextModel3DBuffer m_cDmm1DataSCModel;
 #endif
Index: trunk/source/Lib/TLibDecoder/TDecSlice.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 885)
+++ trunk/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 950)
@@ -221,4 +221,10 @@
     }
   }
+#if  MTK_DLT_CODING_FIX_H0091
+  if( pcSlice->getPPS()->getDLT() != NULL )
+  {
+      assert( pcSlice->getSPS()->getBitDepthY() == pcSlice->getPPS()->getDLT()->getDepthViewBitDepth() );
+  }
+#endif
   for( Int iCUAddr = iStartCUAddr; !uiIsLast && iCUAddr < rpcPic->getNumCUsInFrame(); iCUAddr = rpcPic->getPicSym()->xCalculateNxtCUAddr(iCUAddr) )
   {
Index: trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 885)
+++ trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 950)
@@ -272,4 +272,12 @@
   WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag");
 
+  #if MTK_DLT_CODING_FIX_H0091
+    if(( !pcPPS->getSPS()->getVPS()->getDepthId( pcPPS->getSPS()->getLayerId() ) )||
+        pcPPS->getLayerId() != 1  )
+    {
+        pcPPS->setPpsExtensionTypeFlag( PPS_EX_T_3D, false );
+    }
+  #endif
+
 #if !H_MV
   WRITE_FLAG( 0, "pps_extension_flag" );
Index: trunk/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 885)
+++ trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 950)
@@ -401,4 +401,7 @@
 #if H_3D_IC
   Bool      m_bUseIC;
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+  Bool      m_bUseICLowLatencyEnc;
+#endif
 #endif
 #if H_3D_INTER_SDC
@@ -511,4 +514,8 @@
   Void       setUseIC                       ( Bool bVal )    { m_bUseIC = bVal; }
   Bool       getUseIC                       ()               { return m_bUseIC; }
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+  Void       setUseICLowLatencyEnc          ( Bool bVal )    { m_bUseICLowLatencyEnc = bVal; }
+  Bool       getUseICLowLatencyEnc          ()               { return m_bUseICLowLatencyEnc; }
+#endif
 #endif
 #if H_3D_INTER_SDC
Index: trunk/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 885)
+++ trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 950)
@@ -1814,10 +1814,27 @@
     rpcTempCU->initAvailableFlags();
     rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
-    rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag,inheritedVSPDisInfo
+    rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
+#if !ETRIKHU_CLEANUP_H0083
+      , vspFlag
+#endif
+      , inheritedVSPDisInfo
 #if H_3D_SPIVMP
-      , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
+#if !ETRIKHU_CLEANUP_H0083_MISSING
+      , bSPIVMPFlag
+#endif
+      , pcMvFieldSP, puhInterDirSP
 #endif
       , numValidMergeCand 
       );
+
+#if ETRIKHU_CLEANUP_H0083
+    rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours, vspFlag
+#if H_3D_SPIVMP
+      , bSPIVMPFlag
+#endif
+      , numValidMergeCand 
+      );
+#endif
+
 #else
     rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
@@ -2383,6 +2400,11 @@
     pDBBPTmpData->auhMergeIndex[uiSegment] = rpcTempCU->getMergeIndex(0);
     
+#if RWTH_DBBP_NO_SPU_H0057
+    AOF( rpcTempCU->getSPIVMPFlag(0) == false );
+    AOF( rpcTempCU->getVSPFlag(0) == 0 );
+#else
     pDBBPTmpData->ahVSPFlag[uiSegment] = rpcTempCU->getVSPFlag(0);
     pDBBPTmpData->acDvInfo[uiSegment] = rpcTempCU->getDvInfo(0);
+#endif
     
     for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
@@ -2416,6 +2438,8 @@
     rpcTempCU->setMergeIndexSubParts(pDBBPTmpData->auhMergeIndex[uiSegment], uiPartAddr, uiSegment, uhDepth);
     
+#if !RWTH_DBBP_NO_SPU_H0057
     rpcTempCU->setVSPFlagSubParts(pDBBPTmpData->ahVSPFlag[uiSegment], uiPartAddr, uiSegment, uhDepth);
     rpcTempCU->setDvInfoSubParts(pDBBPTmpData->acDvInfo[uiSegment], uiPartAddr, uiSegment, uhDepth);
+#endif
     
     for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
Index: trunk/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 885)
+++ trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 950)
@@ -163,5 +163,14 @@
     uiAbsPartIdx = 0;
   }
-
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+  else
+  {
+    g_aICEnableCANDIDATE[pcCU->getSlice()->getDepth()]++;
+    if(pcCU->getICFlag(uiAbsPartIdx))
+    {
+      g_aICEnableNUM[pcCU->getSlice()->getDepth()]++;
+    }
+  }
+#endif
   if( pcCU->isICFlagRequired( uiAbsPartIdx ) )
     m_pcEntropyCoderIf->codeICFlag( pcCU, uiAbsPartIdx );
@@ -246,5 +255,10 @@
   
 #if H_3D_DBBP
+
+#if MTK_DBBP_SIGNALING_H0094
+  if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) )
+#else
   if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE )
+#endif
   {
     encodeDBBPFlag(pcCU, uiAbsPartIdx, bRD);
@@ -252,5 +266,7 @@
     if( pcCU->getDBBPFlag(uiAbsPartIdx) )
     {
+#if !MTK_DBBP_SIGNALING_H0094
       AOF( pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE );
+#endif
       // restore virtual partition size for DBBP blocks
       pcCU->setPartSizeSubParts(eVirtualPartSize, uiAbsPartIdx, uiDepth);
@@ -274,4 +290,5 @@
     return;
   }
+#if !MTK_SDC_FLAG_FIX_H0095
 #if H_3D_DIM_SDC
   if( pcCU->getSDCFlag(uiAbsPartIdx) )
@@ -279,4 +296,5 @@
     return;
   }
+#endif
 #endif
   
Index: trunk/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 885)
+++ trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 950)
@@ -93,5 +93,5 @@
 , m_cDdcDataSCModel           ( 1,             1,               NUM_DDC_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
 , m_cAngleFlagSCModel         ( 1,             1,               NUM_ANGLE_FLAG_CTX            , m_contextModels + m_numContextModels, m_numContextModels)
-#if H_3D_DIM_DMM
+#if H_3D_DIM_DMM && !MTK_DMM_SIMP_CODE_H0092
 , m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
 #endif
@@ -169,5 +169,5 @@
   m_cDdcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );
   m_cAngleFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );
-#if H_3D_DIM_DMM
+#if H_3D_DIM_DMM && !MTK_DMM_SIMP_CODE_H0092
   m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
 #endif
@@ -255,5 +255,5 @@
       curCost += m_cDdcDataSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_DDC_DATA );
       curCost += m_cAngleFlagSCModel.calcCost         ( curSliceType, qp, (UChar*)INIT_ANGLE_FLAG );  
-#if H_3D_DIM_DMM
+#if H_3D_DIM_DMM && !MTK_DMM_SIMP_CODE_H0092
       curCost += m_cDmm1DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM1_DATA );
 #endif
@@ -319,5 +319,5 @@
   m_cDdcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );
   m_cAngleFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );
-#if H_3D_DIM_DMM
+#if H_3D_DIM_DMM && !MTK_DMM_SIMP_CODE_H0092
   m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
 #endif
@@ -482,7 +482,13 @@
     m_pcBinIf->encodeBin( 1, rcSCModel );
     UInt uiCount = 0;
+#if QC_SIMP_DELTADC_CODING_H0131
+    Bool bNoExGo = ( uiSymbol < 3 );
+
+    while( --uiSymbol && ++uiCount < 3 )
+#else
     Bool bNoExGo = (uiSymbol < 13);
 
     while( --uiSymbol && ++uiCount < 13 )
+#endif
     {
       m_pcBinIf->encodeBin( 1, rcSCModel );
@@ -520,5 +526,9 @@
   for ( Int i = 0; i < iNumBit; i++ )
   {
+#if MTK_DMM_SIMP_CODE_H0092
+      m_pcBinIf->encodeBinEP( ( uiTabIdx >> i ) & 1 );
+#else
     m_pcBinIf->encodeBin( ( uiTabIdx >> i ) & 1, m_cDmm1DataSCModel.get(0, 0, 0) );
+#endif
   }
 }
@@ -1233,5 +1243,9 @@
   if( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() >> pcCU->getDepth( absPartIdx ) ) < 64 ) //DMM and HEVC intra modes are both allowed
   {
+#if LGE_SIMP_DIM_NOT_PRESENT_FLAG_CODING_H0119_H0135
+    m_pcBinIf->encodeBin( isDimMode( dir ) ? 0 : 1, m_cAngleFlagSCModel.get( 0, 0, 0 ) );
+#else
     m_pcBinIf->encodeBin( isDimMode( dir ) ? 0 : 1, m_cAngleFlagSCModel.get( 0, 0, pcCU->getCtxAngleFlag( absPartIdx ) ) );
+#endif
   }
   if( isDimMode( dir ) )
@@ -2313,6 +2327,9 @@
       dimDeltaDC = isDimDeltaDC( dir );
     }
-
+#if MTK_DELTA_DC_FLAG_ONE_CONTEXT_H0084_H0100_H0113
+    m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get( 0, 0, 0 ) );
+#else
     m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get( 0, 0, uiNumSegments-1 ) );
+#endif
   }
   else //all-zero inter SDC is not allowed
@@ -2356,6 +2373,8 @@
 Void TEncSbac::codeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
 {
+#if !MTK_DBBP_SIGNALING_H0094
   PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
   AOF( ePartSize == RWTH_DBBP_PACK_MODE );
+#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 885)
+++ trunk/source/Lib/TLibEncoder/TEncSbac.h	(revision 950)
@@ -258,5 +258,5 @@
   ContextModel3DBuffer m_cDdcDataSCModel;
   ContextModel3DBuffer m_cAngleFlagSCModel;
-#if H_3D_DIM_DMM
+#if H_3D_DIM_DMM && !MTK_DMM_SIMP_CODE_H0092
   ContextModel3DBuffer m_cDmm1DataSCModel;
 #endif
Index: trunk/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 885)
+++ trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 950)
@@ -1146,5 +1146,5 @@
         for( UInt uiX = 0; uiX < uiWidth; uiX++ )
         {
-#if H_3D_DIM
+#if H_3D_DIM && !SEC_NO_RESI_DLT_H0105
           if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
           {
@@ -1221,5 +1221,5 @@
       for( UInt uiX = 0; uiX < uiWidth; uiX++ )
       {
-#if H_3D_DIM
+#if H_3D_DIM && !SEC_NO_RESI_DLT_H0105
         if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
         {
@@ -1989,4 +1989,12 @@
   // get DC prediction for each segment
   Pel apDCPredValues[2];
+#if HS_DMM_SDC_PREDICTOR_UNIFY_H0108
+  if ( getDimType( uiLumaPredMode ) == DMM1_IDX || getDimType( uiLumaPredMode ) == DMM4_IDX )
+  {
+    apDCPredValues[0] = pcCU->getDmmPredictor( 0 );
+    apDCPredValues[1] = pcCU->getDmmPredictor( 1 );
+  }
+  else
+#endif
   analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode );
 
@@ -3666,6 +3674,8 @@
       pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[0], 0, 0, pcCU->getDepth(0)); // interprets depth relative to LCU level
       
+#if !RWTH_DBBP_NO_SPU_H0057
       pcCU->setVSPFlagSubParts(pDBBPTmpData->ahVSPFlag[0], 0, 0, pcCU->getDepth(0));
       pcCU->setDvInfoSubParts(pDBBPTmpData->acDvInfo[0], 0, 0, pcCU->getDepth(0));
+#endif
       
       for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
@@ -3697,12 +3707,29 @@
       pcCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
 #if H_3D_VSP
+#if !ETRIKHU_CLEANUP_H0083
                                         , vspFlag
+#endif
                                         , inheritedVSPDisInfo
 #endif
 #if H_3D_SPIVMP
-                                        , pbSPIVMPFlag, pcMvFieldSP, puhInterDirSP
+#if !ETRIKHU_CLEANUP_H0083_MISSING
+        , pbSPIVMPFlag
+#endif
+        , pcMvFieldSP, puhInterDirSP
+#endif
+        , numValidMergeCand
+        );
+
+#if ETRIKHU_CLEANUP_H0083
+      pcCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours
+#if H_3D_VSP
+        , vspFlag
+#endif
+#if H_3D_SPIVMP
+        , pbSPIVMPFlag
 #endif
                                         , numValidMergeCand
         );
+#endif
 #else
       pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
@@ -3718,12 +3745,29 @@
     pcCU->xGetInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours
 #if H_3D_VSP
+#if !ETRIKHU_CLEANUP_H0083
                                       , vspFlag
+#endif
                                       , inheritedVSPDisInfo
 #endif
 #if H_3D_SPIVMP
-                                      , pbSPIVMPFlag, pcMvFieldSP, puhInterDirSP
+#if !ETRIKHU_CLEANUP_H0083_MISSING
+      , pbSPIVMPFlag 
+#endif
+      , pcMvFieldSP, puhInterDirSP
+#endif
+      , numValidMergeCand
+      );
+
+#if ETRIKHU_CLEANUP_H0083
+    pcCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
+#if H_3D_VSP
+      , vspFlag
+#endif
+#if H_3D_SPIVMP
+      , pbSPIVMPFlag
 #endif
                                       , numValidMergeCand
       );
+#endif
 #else
     pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand
Index: trunk/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 885)
+++ trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 950)
@@ -866,5 +866,9 @@
      )
   {
+#if MTK_LOW_LATENCY_IC_ENCODING_H0086
+    pcSlice ->xSetApplyIC(pcEncTop->getUseICLowLatencyEnc());
+#else
     pcSlice ->xSetApplyIC();
+#endif
     if ( pcSlice->getApplyIC() )
     {
