Index: /trunk/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 331)
+++ /trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 332)
@@ -368,5 +368,5 @@
 #endif
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   ("QTLPC",                           m_bUseQTLPC               , true         , "Use depth Quadtree Limitation + Predictive Coding" )
 #endif
@@ -1695,5 +1695,5 @@
   printf("WVSO:%d ", m_bUseWVSO );
 #endif
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   printf("QTLPC:%d ", m_bUseQTLPC);
 #endif
Index: /trunk/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- /trunk/source/App/TAppEncoder/TAppEncCfg.h	(revision 331)
+++ /trunk/source/App/TAppEncoder/TAppEncCfg.h	(revision 332)
@@ -313,5 +313,5 @@
 #endif
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   Bool      m_bUseQTLPC;                                      ///< flag for using depth QuadTree Limitation + Predictive Coding
 #endif
Index: /trunk/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 331)
+++ /trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 332)
@@ -357,5 +357,5 @@
     m_acTEncTopList[iViewIdx]->setUseDMM                     ( false );
 #endif
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
     m_acTEncTopList[iViewIdx]->setUseQTLPC                   ( false );
 #endif
@@ -595,5 +595,9 @@
       m_acTEncDepthTopList[iViewIdx]->setUseSAO               ( m_abUseSAO[1]     );
 #if LGE_ILLUCOMP_B0045
+#if LGE_ILLUCOMP_DEPTH_C0046
+      m_acTEncDepthTopList[iViewIdx]->setUseIC                ( m_abUseIC[1] );
+#else
       m_acTEncDepthTopList[iViewIdx]->setUseIC                ( false     );
+#endif
 #endif
 #if INTER_VIEW_VECTOR_SCALING_C0115
@@ -659,5 +663,5 @@
 #endif
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
     m_acTEncDepthTopList[iViewIdx]->setUseQTLPC                   (m_bUseQTLPC);
 #endif
Index: /trunk/source/Lib/TLibCommon/CommonDef.h
===================================================================
--- /trunk/source/Lib/TLibCommon/CommonDef.h	(revision 331)
+++ /trunk/source/Lib/TLibCommon/CommonDef.h	(revision 332)
@@ -140,10 +140,4 @@
 #define PDM_MERGE_POS                     0         // position of pdm in merge list (0..4)
 
-#if H3D_IVMP
-#define DMV_MERGE_POS                     4
-#else
-#define DMV_MERGE_POS                     1
-#endif
-
 #if H3D_IVMP&!H3D_NBDV
 #define PDM_AMVP_POS                      0         // position of pdm in amvp list  (0..3)
Index: /trunk/source/Lib/TLibCommon/ContextTables.h
===================================================================
--- /trunk/source/Lib/TLibCommon/ContextTables.h	(revision 331)
+++ /trunk/source/Lib/TLibCommon/ContextTables.h	(revision 332)
@@ -434,9 +434,5 @@
 
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
-#if FIX_DMM_CTX_INIT_C0034
 static const UChar
-#else
-static const Short
-#endif
 INIT_DMM_FLAG[3][NUM_DMM_FLAG_CTX] =
 {
@@ -452,9 +448,5 @@
 };
 
-#if FIX_DMM_CTX_INIT_C0034
 static const UChar
-#else
-static const Short
-#endif
 INIT_DMM_MODE[3][NUM_DMM_MODE_CTX] =
 {
@@ -470,9 +462,5 @@
 };
 
-#if FIX_DMM_CTX_INIT_C0034
 static const UChar
-#else
-static const Short
-#endif
 INIT_DMM_DATA[3][NUM_DMM_DATA_CTX] = 
 {
Index: /trunk/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 332)
@@ -3165,5 +3165,5 @@
 }
 
-#if LG_RESTRICTEDRESPRED_M24766
+#if H3D_IVRP
 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU)
 {
@@ -3250,73 +3250,4 @@
 #endif
 
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-Int TComDataCU::getResiPredMode(UInt uiPartAddr)
-{
-  Int iAddResiShift = -1;
-
-  for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++)
-  {
-    RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
-    Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr);
-    if(iBestRefIdx >= 0 && getSlice()->getViewId() == getSlice()->getRefViewId(eRefList, iBestRefIdx))
-      iAddResiShift++;
-  }
-
-  return iAddResiShift;
-}
-
-Void TComDataCU::getPUResiPredShift(Int *iPUResiPredShift, UInt uiAbsPartIndex)
-{
-  UInt uiPartSize = getPartitionSize(uiAbsPartIndex);
-  UInt uiPartAddr;
-  Int iWidth, iHeight;
-  Int iAddResiShift;
-
-  if(uiPartSize == SIZE_2Nx2N)
-  {
-    iAddResiShift = getResiPredMode(uiAbsPartIndex);
-    for(UInt i = 0; i < 4; i++)
-      iPUResiPredShift[i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiAbsPartIndex) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
-    return;
-  }
-
-  if(uiPartSize == SIZE_2NxN || uiPartSize == SIZE_2NxnU || uiPartSize == SIZE_2NxnD)
-  {
-    for(UInt i = 0; i < 2; i++)
-    {
-      getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true);
-      uiPartAddr += uiAbsPartIndex;
-      iAddResiShift = getResiPredMode(uiPartAddr);
-      iPUResiPredShift[2*i] = iPUResiPredShift[2*i+1] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
-    }
-    return;
-  }
-
-  if(uiPartSize == SIZE_Nx2N || uiPartSize == SIZE_nLx2N || uiPartSize == SIZE_nRx2N)
-  {
-    for(UInt i = 0; i < 2; i++)
-    {
-      getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true);
-      uiPartAddr += uiAbsPartIndex;
-      iAddResiShift = getResiPredMode(uiPartAddr);
-      iPUResiPredShift[i] = iPUResiPredShift[2+i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
-    }
-    return;
-  }
-
-  if(uiPartSize == SIZE_NxN)
-  {
-    for(UInt i = 0; i < 4; i++)
-    {
-      getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true);
-      uiPartAddr += uiAbsPartIndex;
-      iAddResiShift = getResiPredMode(uiPartAddr);
-      iPUResiPredShift[i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
-    }
-  }
-
-}
-#endif
-
 Void TComDataCU::getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField )
 {
@@ -3653,5 +3584,5 @@
 #endif //H3D_NBDV
 
-#if MTK_MDIVRP_C0138
+#if H3D_IVRP
   Bool bDVAvail = true;
 #endif
@@ -3668,5 +3599,5 @@
 #if MERL_VSP_C0152
             , true
-#endif
+#endif      
 );
   }
@@ -3693,5 +3624,5 @@
     cDisInfo.m_acMvCand[0].setVer(0);
     cDisInfo.m_aVIdxCan[0] = 0;
-#if MTK_MDIVRP_C0138
+#if H3D_IVRP
     bDVAvail = false;
 #endif
@@ -3748,10 +3679,6 @@
 
   Int iPdmDir[2] = {0, 0};
-#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
   getUnifiedMvPredCan(uiPUIdx, REF_PIC_LIST_0, 0, aiPdmRefIdx, acPdmMv, &cDisInfo, iPdmDir, true);
   Int iPdmInterDir;
-#else
-  Int     iPdmInterDir      = cDisInfo.iN==0? 0:getPdmMergeCandidateDisCan ( uiPUIdx, aiPdmRefIdx, acPdmMv, &cDisInfo, iPdmDir );
-#endif
 #else // H3D_NBDV
   Int iPdmDir[2] = {0, 0};
@@ -3760,5 +3687,5 @@
   iPdmDir[1] = iPdmInterDir; 
 #endif // H3D_NBDV
-#if MTK_MDIVRP_C0138
+#if H3D_IVRP
   if (m_pcSlice->getSPS()->getMultiviewResPredMode()==1 && iPdmDir[0] && !bNoPdmMerge && cCurPS == SIZE_2Nx2N && bDVAvail)
   {
@@ -3767,5 +3694,5 @@
 #endif
 
-  if( iPdmDir[0] && !bNoPdmMerge && PDM_MERGE_POS == 0 )
+  if( iPdmDir[0] && !bNoPdmMerge )
   {
     abCandIsInter        [ iCount ] = true;
@@ -3798,30 +3725,6 @@
     }
     iCount ++;
-  }
-
-  if(extraMergeCand)
-  {
-    if(!bNoPdmMerge && iPdmDir[1] && DMV_MERGE_POS == 1)
-    {
-      assert(iCount < MRG_MAX_NUM_CANDS_MEM);
-      abCandIsInter        [ iCount ] = true;
-      puhInterDirNeighbours[ iCount ] = iPdmDir[1];
-      if( ( iPdmDir[1] & 1 ) == 1 )
-      {
-        pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 2 ], aiPdmRefIdx[ 2 ] );
-      }
-      if( ( iPdmDir[1] & 2 ) == 2 )
-      {
-        pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 3 ], aiPdmRefIdx[ 3 ] );
-      }
-#if H3D_NBDV
-      pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
-      pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
-#endif
-      if ( mrgCandIdx == iCount )
-          return;
-      iCount ++;
-    }    
-  }
+  }  
+  
 #endif //  H3D_IVMP 
 
@@ -3910,44 +3813,4 @@
   }
 
-#if H3D_IVMP
-  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 1 )
-  {
-    abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = iPdmInterDir;
-    if( ( iPdmInterDir & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if( ( iPdmInterDir & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if ( mrgCandIdx == iCount )
-    {
-      return;
-    }
-    iCount ++;
-  }
-#endif //  H3D_IVMP 
-
-#if MERL_VSP_COMPENSATION_C0152
-  //===== vsp 1 =====
-  if( iCount < 4 + extraMergeCand )
-    if ( !xAddVspMergeCand(1, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
-      return;
-#endif
-
   // above
   UInt uiAbovePartIdx = 0;
@@ -4022,44 +3885,4 @@
   }
 
-#if H3D_IVMP
-  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 2 )
-  {
-    abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = iPdmInterDir;
-    if( ( iPdmInterDir & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if( ( iPdmInterDir & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if ( mrgCandIdx == iCount )
-    {
-      return;
-    }
-    iCount ++;
-  }
-#endif //  H3D_IVMP 
-
-#if MERL_VSP_COMPENSATION_C0152
-  //===== vsp 2 =====
-  if( iCount < 4 + extraMergeCand )
-    if ( !xAddVspMergeCand(2, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
-      return;
-#endif
-
   // above right
   UInt uiAboveRightPartIdx = 0;
@@ -4109,38 +3932,8 @@
 
 #if H3D_IVMP
-  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 3 )
-  {
-    abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = iPdmInterDir;
-    if( ( iPdmInterDir & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if( ( iPdmInterDir & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if ( mrgCandIdx == iCount )
-    {
-      return;
-    }
-    iCount ++;
-  }
 
   if(extraMergeCand)
   {
-    if(!bNoPdmMerge && iPdmDir[1] && DMV_MERGE_POS == 4)
+    if(!bNoPdmMerge && iPdmDir[1] )
     {
       assert(iCount < MRG_MAX_NUM_CANDS_MEM);
@@ -4187,21 +3980,4 @@
 #endif // H3D_IVMP 
 
-#if MERL_VSP_COMPENSATION_C0152
-  //===== vsp 3 =====
-  if( iCount < 4 + extraMergeCand )
-    if ( !xAddVspMergeCand(3, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
-      return;
-#endif
-
-#if MERL_VSP_C0152
-#if VSP_MERGE_POS < 4
-#if H3D_IVMP
-  if( iCount < 4 + extraMergeCand )
-#else
-  if( iCount < 4 )
-#endif
-  {
-#endif
-#endif
 
   //left bottom
@@ -4250,49 +4026,5 @@
     iCount ++;
   }
-#if MERL_VSP_C0152
-#if VSP_MERGE_POS < 4
-  }
-#endif
-#endif
-  
-#if H3D_IVMP
-  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 4 )
-  {
-    abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = iPdmInterDir;
-    if( ( iPdmInterDir & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if( ( iPdmInterDir & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if ( mrgCandIdx == iCount )
-    {
-      return;
-    }
-    iCount ++;
-  }
-#endif //  H3D_IVMP 
-
-#if MERL_VSP_COMPENSATION_C0152
-  //===== vsp 4 =====
-  if( iCount < 4 + extraMergeCand )
-    if ( !xAddVspMergeCand(4, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
-      return;
-#endif
+ 
   
   // above left
@@ -5164,37 +4896,23 @@
 
 #if MERL_VSP_C0152
-#if LGE_SIMP_DVP_REFINE_C0112
-Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine)
-#else
-Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec)
-#endif
+Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iBlkWidth, Int iBlkHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine)
 {
   Int depStride =  pcBaseViewDepthPicYuv->getStride();
 
-  Int width  = pcBaseViewDepthPicYuv->getWidth();
-  Int height = pcBaseViewDepthPicYuv->getHeight();
-#if MTK_DVPREFINE_BVSP_BUG_FIX
-  Int depthPosX = Clip3(0,   width - iWidth,  iBlkX + (mv->getHor()>>2));
-  Int depthPosY = Clip3(0,   height - iHeight,  iBlkY + (mv->getVer()>>2));
-#else
-  Int depthPosX = Clip3(0,   width - iWidth  - 1,  iBlkX + (mv->getHor()>>2));
-  Int depthPosY = Clip3(0,   height- iHeight - 1,  iBlkY + (mv->getVer()>>2));
-#endif
-  Pel *depth  = pcBaseViewDepthPicYuv->getLumaAddr() + depthPosX + depthPosY * depStride;
-  Pel  maxDepth = 0;
-#if LGE_SIMP_DVP_REFINE_C0112
+  Int iPictureWidth  = pcBaseViewDepthPicYuv->getWidth();
+  Int iPictureHeight = pcBaseViewDepthPicYuv->getHeight();
+
+  Int depthPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + (mv->getHor()>>2));
+  Int depthPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + (mv->getVer()>>2));
+
+  Pel *pDepthPel   = pcBaseViewDepthPicYuv->getLumaAddr() + depthPosX + depthPosY * depStride;
+  Pel  maxDepthVal = 0;
+
   if ( bSimpleDvpRefine )
   {
-#if MTK_DVPREFINE_BVSP_BUG_FIX
-    Int depthStartPosX = Clip3(0,   width - iWidth,  iBlkX + (mv->getHor()>>2));
-    Int depthStartPosY = Clip3(0,   height - iHeight,  iBlkY + (mv->getVer()>>2));
-    Int depthEndPosX = Clip3(0,   width - 1,  iBlkX + iWidth - 1  + (mv->getHor()>>2));
-    Int depthEndPosY = Clip3(0,   height - 1,  iBlkY + iHeight - 1 + (mv->getVer()>>2));
-#else
-    Int depthStartPosX = Clip3(0,   width - iWidth  - 1,  iBlkX + (mv->getHor()>>2));
-    Int depthStartPosY = Clip3(0,   height- iHeight - 1,  iBlkY + (mv->getVer()>>2));
-    Int depthEndPosX = Clip3(0,   width - iWidth  - 1,  iBlkX + iWidth  + (mv->getHor()>>2));
-    Int depthEndPosY = Clip3(0,   height- iHeight - 1,  iBlkY + iHeight + (mv->getVer()>>2));
-#endif
+    Int depthStartPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + (mv->getHor()>>2));
+    Int depthStartPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + (mv->getVer()>>2));
+    Int depthEndPosX   = Clip3(0,   iPictureWidth - 1,  iBlkX + iBlkWidth - 1 + (mv->getHor()>>2));
+    Int depthEndPosY   = Clip3(0,   iPictureHeight - 1,  iBlkY + iBlkHeight - 1 + (mv->getVer()>>2));
     Int iCenterX = (depthStartPosX + depthEndPosX) >> 1;
     Int iCenterY = (depthStartPosY + depthEndPosY) >> 1;
@@ -5209,40 +4927,26 @@
     for (Int i = 0; i < 5; i++)
     {
-      if (maxDepth < aiDepth[i])
-        maxDepth = aiDepth[i];
+      if (maxDepthVal < aiDepth[i])
+        maxDepthVal = aiDepth[i];
     }
   }
   else
   {
-    for (Int j = 0; j < iHeight; j++)
-    {
-      for (Int i = 0; i < iWidth; i++)
-      {
-        if (maxDepth < depth[i])
-          maxDepth = depth[i];
-      }
-      depth += depStride;
-    }
-  }
-#else
-  for (Int j = 0; j < iHeight; j++)
-  {
-    for (Int i = 0; i < iWidth; i++)
-    {
-      if (maxDepth < depth[i])
-        maxDepth = depth[i];
-    }
-    depth += depStride;
-  }
-#endif
-  Int disparity = aiShiftLUT[ maxDepth ] << iShiftPrec;
-
-  return disparity;
-}
-#if LGE_SIMP_DVP_REFINE_C0112
+    for (Int j = 0; j < iBlkHeight; j++)
+    {
+      for (Int i = 0; i < iBlkWidth; i++)
+      {
+        if (maxDepthVal < pDepthPel[i])
+          maxDepthVal = pDepthPel[i];
+  }
+      pDepthPel += depStride;
+    }
+  }
+
+  Int iDisp = aiShiftLUT[ maxDepthVal ] << iShiftPrec;
+
+  return iDisp;
+}
 Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine)
-#else
-Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred)
-#endif
 {
   if (picDepth)
@@ -5257,11 +4961,9 @@
     Int* aiShiftLUT;
     Int  iShiftPrec;
+
     getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec);
-#if LGE_SIMP_DVP_REFINE_C0112
-    Pel x = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec, bSimpleDvpRefine );
-#else
-    Pel x = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec);
-#endif
-    cMvPred->setHor(x);
+
+    Pel iDisp = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec, bSimpleDvpRefine );
+    cMvPred->setHor( iDisp );
     clipMv(*cMvPred);
   }
@@ -5270,5 +4972,109 @@
 
 #if H3D_NBDV
-Void TComDataCU::getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo , Bool bParMerge
+
+Bool TComDataCU::xCheckSpatialNBDV( TComDataCU* pcTmpCU, UInt uiIdx, UInt uiPartIdx, UInt uiPartAddr, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, McpDisInfo* paMvpDvInfo, UInt uiMvpDvPos, Bool bDepthRefine )
+{
+  if( pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
+  {
+    Bool bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
+    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
+    {
+      RefPicList eRefPicList = RefPicList(iList);
+      Int      refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
+      TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
+
+      if( refId >= 0)
+      {
+        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId );
+        if (refViewIdx != m_pcSlice->getViewId()) // DCP
+        {          
+          clipMv(cMvPred);
+
+          TComPic* picDepth = getSlice()->getRefPicBaseDepth();
+
+          if (picDepth && bDepthRefine)
+            estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
+
+          pNbDvInfo->m_acMvCand[ pNbDvInfo->iN   ] = cMvPred;
+          pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN++ ] = refViewIdx;
+
+          return true;
+        }
+        else if ( bSearchForMvpDv && cMvPred.m_bDvMcp && bTmpIsSkipped )
+        {
+          assert( uiMvpDvPos < MCP_DIS_CANS );
+          paMvpDvInfo->m_acMvCand[iList][ uiMvpDvPos ] = TComMv( cMvPred.m_iDvMcpDispX, cMvPred.m_iDvMcpDispY );
+          paMvpDvInfo->m_aVIdxCan[iList][ uiMvpDvPos ] = 0; // works only for CTC
+          paMvpDvInfo->m_bAvailab[iList][ uiMvpDvPos ] = true;
+          paMvpDvInfo->m_bFound                        = true; 
+        }
+      }
+#if MERL_VSP_C0152
+      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
+      { 
+        TComPic* picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
+        if (picDepth && bDepthRefine)
+          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
+
+        cMvPred.setVer(0);
+
+        pNbDvInfo->m_acMvCand[ pNbDvInfo->iN]   = cMvPred;
+        pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN++] = 0; // refViewIdx;
+        return true;
+      }
+#endif
+    }
+  }
+  return false; 
+}
+
+
+Void TComDataCU::xDeriveRightBottomNbIdx( PartSize eCUMode, UInt uiPartIdx, Int &riLCUIdxRBNb, Int &riPartIdxRBNb )
+{
+  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();  
+  Int uiLCUIdx = getAddr();
+
+  UInt uiPartIdxRB;
+  deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB );  
+  UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
+
+  if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
+  {
+    riLCUIdxRBNb  = -1;
+    riPartIdxRBNb = -1;
+  }
+  else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
+  {
+    riLCUIdxRBNb  = -1;
+    riPartIdxRBNb = -1;
+  }
+  else
+  {
+    if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU 
+      ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
+    {
+      riPartIdxRBNb = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
+      riLCUIdxRBNb  = uiLCUIdx; 
+    }
+    else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
+    {
+      riPartIdxRBNb = -1;
+      riLCUIdxRBNb  = -1;
+    }
+    else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
+    {
+      riPartIdxRBNb = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
+      riLCUIdxRBNb = uiLCUIdx + 1;
+    }
+    else //is the right bottom corner of LCU                       
+    {
+      riPartIdxRBNb = -1;
+      riLCUIdxRBNb  = -1;
+    }
+  }
+}
+
+
+Void TComDataCU::getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerge
 #if MERL_VSP_C0152
                                 , Bool bDepthRefine
@@ -5276,203 +5082,109 @@
                                 )
 {
-  PartSize eCUMode = getPartitionSize( uiPartAddr );
-  TComDataCU* pcTmpCU = NULL;
-  pDInfo->iN = 0;
-
-  RefPicList eRefPicList = REF_PIC_LIST_0 ;
-  //-- Get Spatial MV
-  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
-  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
-
-  const Int iNumofDvMCP = 7;
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
-  Int   aiDvMcpDvCandX[2][iNumofDvMCP] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
-  Int   aiDvMcpDvCandY[2][iNumofDvMCP] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
-#else
-  Int   aiDvMcpDvCand[2][iNumofDvMCP] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
-#endif
-  Bool  abDvMcpFlag  [2][iNumofDvMCP] = {{false,},{false,}}; 
-  TComMv cTmpMvPred, cMv;
-  Bool  bTmpIsSkipped = false;
-  Bool  bDvMcpIsFound = false;
-  Int   iLCUAddrDiff = 0;
-
+  //// ******* Init variables ******* /////
+  // Init disparity struct for results
+  pDInfo->iN = 0;    
+
+  // Init struct for disparities from MCP neighboring blocks
+  McpDisInfo cMvpDvInfo;
+  cMvpDvInfo.m_bFound = false; 
+  for (UInt iCurDvMcpCand = 0; iCurDvMcpCand < MCP_DIS_CANS; iCurDvMcpCand++)
+  {
+    for (UInt iList = 0; iList < 2; iList++)
+    {
+      cMvpDvInfo.m_acMvCand[iList][iCurDvMcpCand].setZero();
+      cMvpDvInfo.m_aVIdxCan[iList][iCurDvMcpCand] = 0; 
+      cMvpDvInfo.m_bAvailab[iList][iCurDvMcpCand] = false; 
+    }
+  }
+
+  // Get Positions  
+  PartSize eCUMode    = getPartitionSize( uiPartAddr );    
+  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;  
+
+  deriveLeftRightTopIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLT, uiPartIdxRT );
+  deriveLeftBottomIdxGeneral  ( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLB );
+
+  // Get parameters for parallel merge
   Int xP, yP, nPSW, nPSH;
   if( bParMerge)
     this->getPartPosition(uiPartIdx, xP, yP, nPSW, nPSH);
 
-  deriveLeftRightTopIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLT, uiPartIdxRT );
-  deriveLeftBottomIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLB );
-
-#if MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097
-  // copied from getInterMergeCand()
+  //// ******* Get disparity from temporal neighboring blocks ******* /////
   if ( getSlice()->getPPS()->getEnableTMVPFlag() )
   {
     TComMv cColMv;
     Int iTargetViewIdx = 0;
-    Int iTStartViewIdx = 0;
-    UInt uiPartIdxRB, uiBRIdx;
-#if !MTK_SIMPLIFY_DVTC_C0135
-    Int uiViewIdxCurr= getSlice()->getViewId();
-#endif
+    Int iTStartViewIdx = 0;    
+
+    ///*** Derive center position ***
     UInt uiPartIdxCenter;
+    Int  uiLCUIdx   = getAddr();
+
     xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter );
 
-    Int uiLCUIdx = getAddr();
-    Int uiLCUnew = uiLCUIdx;
-    eCUMode = getPartitionSize( 0 );
-    deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB );  
-    uiBRIdx = uiPartIdxLT;
-    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
-#if MTK_SIMPLIFY_DVTC_C0135
-    if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
-    {
-      uiLCUnew = -1;
-    }
-    else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
-    {
-      uiLCUnew = -1;
-    }
-    else
-#else
-    if ( (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) &&(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ))  // image boundary check
-#endif
-    {
-      if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU 
-      ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
-      {
-        uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
-      }
-      else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
-      {
-        uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
-#if MTK_SIMPLIFY_DVTC_C0135
-        uiLCUnew = -1;
-#else
-        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU();
-#endif
-      }
-      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
-      {
-        uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
-        uiLCUnew = uiLCUIdx + 1;
-      }
-      else //is the right bottom corner of LCU                       
-      {
-        uiBRIdx = 0;
-#if MTK_SIMPLIFY_DVTC_C0135
-        uiLCUnew = -1;
-#else
-        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1;
-#endif
-      }
-    }
-    const Int iNumofCandPic = 2;
-    for(Int i =0; i < iNumofCandPic; i++)
-    {
-      Int lpRef=0;
-      if(i == 0)
-      {   //check the col-located picture
-        eRefPicList = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0);
-#if COLLOCATED_REF_IDX
-        lpRef = getSlice()->getColRefIdx();
-#else
-        Int lpRef = 0;
-#endif
-      }
-      else
-      {
-        if(!(getPic()->getRapbCheck()))
+    ///*** Derive bottom right neighbour position ***
+    eCUMode          = getPartitionSize( 0 ); // Necessary?    
+    Int iLCUIdxRBNb  = -1;    
+    Int iPartIdxRBNb = -1;
+
+    xDeriveRightBottomNbIdx( eCUMode, uiPartIdx, iLCUIdxRBNb, iPartIdxRBNb );
+
+    ///*** Search temporal candidate pictures for disparity vector ***
+    const Int iNumCandPics = 2;
+    for(Int curCandPic = 0; curCandPic < iNumCandPics; curCandPic++)
+    {
+      // Get candidate picture
+      RefPicList eCurRefPicList   = REF_PIC_LIST_0 ;
+      Int        curCandPicRefIdx = 0;
+
+      if( curCandPic == 0 ) // check the co-located picture
+      { 
+        eCurRefPicList   = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0);
+        curCandPicRefIdx = getSlice()->getColRefIdx();
+      }
+      else                  // check RAP
+      {
+        if( !(getPic()->getRapbCheck()) )
           break;
-        eRefPicList=getPic()->getRapRefList();
-        lpRef=getPic()->getRapRefIdx();
-      }
-
-      if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() ) 
-      {
-#if !MTK_SIMPLIFY_DVTC_C0135
-        if (uiViewIdxCurr > 1)  
+
+        eCurRefPicList   = getPic()->getRapRefList();
+        curCandPicRefIdx = getPic()->getRapRefIdx();
+      }
+
+      // Check BR and Center       
+      if( m_pcSlice->getViewId() == getSlice()->getRefPic( eCurRefPicList, curCandPicRefIdx)->getViewId() ) 
+      {
+        for(Int curPosition = 0; curPosition < 2; curPosition++) 
         {
-#endif
-          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
+          Bool bCheck = false; 
+          if ( curPosition == 0 && iLCUIdxRBNb >= 0 )
+            bCheck = xGetColDisMV( eCurRefPicList, curCandPicRefIdx, iLCUIdxRBNb, iPartIdxRBNb,  cColMv, iTargetViewIdx, iTStartViewIdx);
+
+          if (curPosition == 1 )
+            bCheck = xGetColDisMV( eCurRefPicList, curCandPicRefIdx, uiLCUIdx,   uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx );
+
+          if( bCheck )
           {
             clipMv(cColMv);
-#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
+            TComPic* picDepth = getSlice()->getRefPicBaseDepth();
+            if (picDepth && bDepthRefine)
+              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
+
             pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
             pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
-#else
-            {
-              TComPic* picDepth = NULL;
-              picDepth = getSlice()->getRefPicBaseDepth();
-              if (picDepth && bDepthRefine)
-#if LGE_SIMP_DVP_REFINE_C0112
-                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
-#else
-                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
-#endif
-
-              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
-              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
-            }
-#endif
             return ;
           }
-#if !MTK_SIMPLIFY_DVTC_C0135
-        }
-#endif
-        if(xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx ))
-        {
-          clipMv(cColMv);
-#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
-            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
-#else
-            {
-              TComPic* picDepth = NULL;
-              picDepth = getSlice()->getRefPicBaseDepth();
-              if (picDepth && bDepthRefine)
-#if LGE_SIMP_DVP_REFINE_C0112
-                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
-#else
-                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
-#endif
-              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
-              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
-            }
-#endif
-          return ;
-        }
-#if !MTK_SIMPLIFY_DVTC_C0135
-        if(uiViewIdxCurr == 1)  
-        {
-          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) ) 
-          {
-            clipMv(cColMv);
-#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
-            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
-#else
-            {
-              TComPic* picDepth = NULL;
-              picDepth = getSlice()->getRefPicBaseDepth();
-              if (picDepth && bDepthRefine)
-#if LGE_SIMP_DVP_REFINE_C0112
-                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
-#else
-                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
-#endif
-              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
-              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
-            }
-#endif
-            return ;
-          }
-        }
-#endif
-      }
-    }
+        } // Loop positions
+      }
+    } // Loop candidate views
   } // if TMVP Flag
-#endif
+
   UInt uiIdx = 0;
+  Bool        bCheckMcpDv = false;   
+  TComDataCU* pcTmpCU     = NULL;
+
+
+  //// ******* Get disparity from left block ******* /////
   pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
   if ( uiPartIdx == 1 && (eCUMode == SIZE_Nx2N || eCUMode == SIZE_nLx2N || eCUMode == SIZE_nRx2N) )
@@ -5489,592 +5201,108 @@
   }
 
-  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
-  {
-    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
-    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
-    {
-      eRefPicList = RefPicList(iList);
-      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
-      if( refId >= 0)
-      {
-        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
-        if (refViewIdx != m_pcSlice->getViewId()) // DCP
+  bCheckMcpDv = true; 
+  if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFT, bDepthRefine ) )
+    return;
+
+
+  //// ******* Get disparity from above block ******* /////
+  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
+  if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) )
+  {
+    pcTmpCU = NULL;
+  }
+
+  if (pcTmpCU && bParMerge) 
+  {
+    if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
+    {
+      pcTmpCU = NULL;
+    }
+  }
+
+  if(pcTmpCU != NULL )
+  {
+    bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
+    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVE, bDepthRefine ) )
+      return;
+  }
+
+  //// ******* Get disparity from above right block ******* /////
+  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
+
+  if (pcTmpCU && bParMerge) 
+  {
+    if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP))
+    {
+      pcTmpCU = NULL;
+    }
+  }
+
+  if(pcTmpCU != NULL )
+  {
+    bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
+    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVERIGHT, bDepthRefine ) )
+      return;
+  }
+
+
+  //// ******* Get disparity from below left block ******* /////
+  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
+
+  if (pcTmpCU && bParMerge)
+  {
+    if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP))
+    {
+      pcTmpCU = NULL;
+    }
+  }
+
+  if( pcTmpCU != NULL )
+  {
+    bCheckMcpDv = true; 
+    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFTBELOW, bDepthRefine ) )
+      return;
+  }
+
+
+  //// ******* Get disparity from above left block ******* /////
+  pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
+  assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
+
+  if (pcTmpCU && bParMerge) 
+  {
+    if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP))
+    {
+      pcTmpCU = NULL;
+    }
+  }
+
+  if( pcTmpCU != NULL )
+  {
+    bCheckMcpDv = (( getAddr() - pcTmpCU->getAddr() ) <= 1); 
+    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVELEFT, bDepthRefine ) )
+      return;
+  }
+
+  //// ******* Search MCP blocks ******* /////
+  if( cMvpDvInfo.m_bFound ) 
+  {
+    for( Int curPos = 0 ; curPos < MCP_DIS_CANS ; curPos++ ) 
+    {
+      for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
+      {
+        if( cMvpDvInfo.m_bAvailab[iList][curPos] )
         {
-          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
-          clipMv(cMvPred);
-#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
-          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 
-          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
-#else
-          {
-            TComPic* picDepth = NULL;
-            picDepth = getSlice()->getRefPicBaseDepth();
-            if (picDepth && bDepthRefine)
-#if LGE_SIMP_DVP_REFINE_C0112
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
-#else
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
-#endif
-            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
-          }
-#endif
+          TComMv cDispVec = cMvpDvInfo.m_acMvCand[iList][ curPos ];
+          clipMv( cDispVec );
+
+          TComPic* picDepth = getSlice()->getRefPicBaseDepth();
+          if (picDepth && bDepthRefine)
+            estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cDispVec, true);
+
+          pDInfo->m_acMvCand[ pDInfo->iN]   = cDispVec;
+          pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
           return;
         }
-        else // MCP 
-        {
-          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
-          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
-          {
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
-            aiDvMcpDvCandX[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
-            aiDvMcpDvCandY[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispY;
-#else
-            aiDvMcpDvCand[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
-#endif
-            abDvMcpFlag  [iList][DVFROM_LEFT] = true; 
-            bDvMcpIsFound = true;
-          }
-        }
-      }
-#if MERL_VSP_C0152
-      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
-      {
-        TComPic* picDepth = NULL;
-        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
-        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
-        if (picDepth && bDepthRefine)
-          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
-        myMv.setVer(0);
-
-        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
-        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
-        return;
-      }
-#endif
-    }
-  }
-
-  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
-  if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) )
-  {
-    pcTmpCU = NULL;
-  }
-
-  if (pcTmpCU && bParMerge) 
-  {
-    if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
-    {
-      pcTmpCU = NULL;
-    }
-  }
-
-  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
-  {
-    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
-    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
-    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
-    {
-      eRefPicList = RefPicList(iList);
-      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
-      if( refId >= 0)
-      {
-        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
-        if (refViewIdx!= m_pcSlice->getViewId())
-        {
-          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
-          clipMv(cMvPred);
-#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
-          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 
-          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
-#else
-          {
-            TComPic* picDepth = NULL;
-            picDepth = getSlice()->getRefPicBaseDepth();
-            if (picDepth && bDepthRefine)
-#if LGE_SIMP_DVP_REFINE_C0112
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
-#else
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
-#endif
-            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
-          }
-#endif
-          return;
-        }
-        else if(iLCUAddrDiff == 0) //MCP, within same LCU
-        {
-          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
-          if( cTmpMvPred.m_bDvMcp  && bTmpIsSkipped )
-          {
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
-            aiDvMcpDvCandX[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
-            aiDvMcpDvCandY[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispY;
-#else
-            aiDvMcpDvCand[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
-#endif
-            abDvMcpFlag  [iList][DVFROM_ABOVE] = true; 
-            bDvMcpIsFound = true;
-          }
-        }
-      }
-#if MERL_VSP_C0152
-      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
-      {
-        TComPic* picDepth = NULL;
-        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
-        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
-        if (picDepth && bDepthRefine)
-          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
-        myMv.setVer(0);
-
-        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
-        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
-        return;
-      }
-#endif
-    }
-  }
-
-  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
-
-  if (pcTmpCU && bParMerge) 
-  {
-    if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP))
-    {
-      pcTmpCU = NULL;
-    }
-  }
-
-  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
-  {
-    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
-    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
-    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
-    {
-      eRefPicList = RefPicList(iList);
-      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
-      if( refId >= 0)
-      {
-        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
-        if (refViewIdx!= m_pcSlice->getViewId())
-        {
-          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
-          clipMv(cMvPred);
-#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
-          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 
-          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
-#else
-          {
-            TComPic* picDepth = NULL;
-            picDepth = getSlice()->getRefPicBaseDepth();
-            if (picDepth && bDepthRefine)
-#if LGE_SIMP_DVP_REFINE_C0112
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
-#else
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
-#endif
-            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
-          }
-#endif
-          return;
-        }
-        else if(iLCUAddrDiff == 0)
-        {
-          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
-          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
-          {
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
-            aiDvMcpDvCandX[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
-            aiDvMcpDvCandY[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispY;
-#else
-            aiDvMcpDvCand[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
-#endif
-            abDvMcpFlag  [iList][DVFROM_ABOVERIGHT] = true; 
-            bDvMcpIsFound = true;
-          }
-        }
-      }
-#if MERL_VSP_C0152
-      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
-      {
-        TComPic* picDepth = NULL;
-        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
-        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
-        if (picDepth && bDepthRefine)
-          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
-        myMv.setVer(0);
-
-        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
-        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
-        return;
-      }
-#endif
-    }
-  }
-
-  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
-
-  if (pcTmpCU && bParMerge)
-  {
-    if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP))
-    {
-      pcTmpCU = NULL;
-    }
-  }
-
-  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
-  {
-    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
-    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
-    {
-      eRefPicList = RefPicList(iList);
-      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
-      if( refId >= 0)
-      {
-        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
-        if (refViewIdx!= m_pcSlice->getViewId())
-        {
-          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
-          clipMv(cMvPred);
-#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
-          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 
-          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
-#else
-          {
-            TComPic* picDepth = NULL;
-            picDepth = getSlice()->getRefPicBaseDepth();
-            if (picDepth && bDepthRefine)
-#if LGE_SIMP_DVP_REFINE_C0112
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
-#else
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
-#endif
-            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
-          }
-#endif
-          return;
-        }
-        else // MCP 
-        {
-          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
-          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
-          {
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
-            aiDvMcpDvCandX[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
-            aiDvMcpDvCandY[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispY;
-#else
-            aiDvMcpDvCand[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
-#endif
-            abDvMcpFlag  [iList][DVFROM_LEFTBELOW] = true; 
-            bDvMcpIsFound = true;
-          }
-        }
-      }
-#if MERL_VSP_C0152
-      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
-      {
-        TComPic* picDepth = NULL;
-        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
-        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
-        if (picDepth && bDepthRefine)
-          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
-        myMv.setVer(0);
-
-        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
-        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
-        return;
-      }
-#endif
-    }
-  }
-
-  // Above predictor search
-  pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
-  assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
-
-  if (pcTmpCU && bParMerge) 
-  {
-    if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP))
-    {
-      pcTmpCU = NULL;
-    }
-  }
-
-  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
-  {
-    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
-
-    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
-    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
-    {
-      eRefPicList = RefPicList(iList);
-      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
-      if( refId >= 0)
-      {
-        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
-        if (refViewIdx!= m_pcSlice->getViewId())
-        {
-          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
-          clipMv(cMvPred);
-#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
-          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 
-          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
-#else
-          {
-            TComPic* picDepth = NULL;
-            picDepth = getSlice()->getRefPicBaseDepth();
-            if (picDepth && bDepthRefine)
-#if LGE_SIMP_DVP_REFINE_C0112
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
-#else
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
-#endif
-            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
-          }
-#endif
-          return;
-        }
-        else if(iLCUAddrDiff <= 1)
-        {
-          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
-          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
-          {
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
-            aiDvMcpDvCandX[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
-            aiDvMcpDvCandY[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispY;
-#else
-            aiDvMcpDvCand[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
-#endif
-            abDvMcpFlag  [iList][DVFROM_ABOVELEFT] = true; 
-            bDvMcpIsFound = true;
-          }
-        }
-      }
-#if MERL_VSP_C0152
-      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
-      {
-        TComPic* picDepth = NULL;
-        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
-        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
-        if (picDepth && bDepthRefine)
-          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
-        myMv.setVer(0);
-
-        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
-        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
-        return;
-      }
-#endif
-    }
-  }
-#if !MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097
-  // copied from getInterMergeCand()
-  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
-  {
-    TComMv cColMv;
-    Int iTargetViewIdx = 0;
-    Int iTStartViewIdx = 0;
-    UInt uiPartIdxRB, uiBRIdx;
-#if !MTK_SIMPLIFY_DVTC_C0135
-    Int uiViewIdxCurr= getSlice()->getViewId();
-#endif
-    UInt uiPartIdxCenter;
-    xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter );
-
-    Int uiLCUIdx = getAddr();
-    Int uiLCUnew = uiLCUIdx;
-    eCUMode = getPartitionSize( 0 );
-    deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB );  
-    uiBRIdx = uiPartIdxLT;
-    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
-#if MTK_SIMPLIFY_DVTC_C0135
-    if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
-    {
-      uiLCUnew = -1;
-    }
-    else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
-    {
-      uiLCUnew = -1;
-    }
-    else
-#else
-    if ( (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) &&(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ))  // image boundary check
-#endif
-    {
-      if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU 
-      ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
-      {
-        uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
-      }
-      else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
-      {
-        uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
-#if MTK_SIMPLIFY_DVTC_C0135
-        uiLCUnew = -1;
-#else
-        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU();
-#endif
-      }
-      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
-      {
-        uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
-        uiLCUnew = uiLCUIdx + 1;
-      }
-      else //is the right bottom corner of LCU                       
-      {
-        uiBRIdx = 0;
-#if MTK_SIMPLIFY_DVTC_C0135
-        uiLCUnew = -1;
-#else
-        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1;
-#endif
-      }
-    }
-    const Int iNumofCandPic = 2;
-    for(Int i =0; i < iNumofCandPic; i++)
-    {
-      Int lpRef=0;
-      if(i == 0)
-      {   //check the col-located picture
-        eRefPicList = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0);
-#if COLLOCATED_REF_IDX
-        lpRef = getSlice()->getColRefIdx();
-#else
-        Int lpRef = 0;
-#endif
-      }
-      else
-      {
-        if(!(getPic()->getRapbCheck()))
-          break;
-        eRefPicList=getPic()->getRapRefList();
-        lpRef=getPic()->getRapRefIdx();
-      }
-
-      if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() ) 
-      {
-#if !MTK_SIMPLIFY_DVTC_C0135
-        if (uiViewIdxCurr > 1)  
-        {
-#endif
-          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
-          {
-            clipMv(cColMv);
-#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
-            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
-#else
-            {
-              TComPic* picDepth = NULL;
-              picDepth = getSlice()->getRefPicBaseDepth();
-              if (picDepth && bDepthRefine)
-#if LGE_SIMP_DVP_REFINE_C0112
-                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
-#else
-                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
-#endif
-
-              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
-              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
-            }
-#endif
-            return ;
-          }
-#if !MTK_SIMPLIFY_DVTC_C0135
-        }
-#endif
-        if(xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx ))
-        {
-          clipMv(cColMv);
-#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
-            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
-#else
-            {
-              TComPic* picDepth = NULL;
-              picDepth = getSlice()->getRefPicBaseDepth();
-              if (picDepth && bDepthRefine)
-#if LGE_SIMP_DVP_REFINE_C0112
-                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
-#else
-                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
-#endif
-              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
-              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
-            }
-#endif
-          return ;
-        }
-#if !MTK_SIMPLIFY_DVTC_C0135
-        if(uiViewIdxCurr == 1)  
-        {
-          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) ) 
-          {
-            clipMv(cColMv);
-#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
-            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
-#else
-            {
-              TComPic* picDepth = NULL;
-              picDepth = getSlice()->getRefPicBaseDepth();
-              if (picDepth && bDepthRefine)
-#if LGE_SIMP_DVP_REFINE_C0112
-                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
-#else
-                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
-#endif
-              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
-              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
-            }
-#endif
-            return ;
-          }
-        }
-#endif
-      }
-    }
-  } // if TMVP Flag
-#endif
-
-  if( bDvMcpIsFound ) // skip dvmcp
-  {
-    for( Int i=1 ; i<iNumofDvMCP-1 ; i++ ) // 5 spatial
-    {
-      for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
-      {
-        if( abDvMcpFlag[iList][i]==true )
-        {
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
-          TComMv dv( aiDvMcpDvCandX[iList][ i ], aiDvMcpDvCandY[iList][ i ] );
-#else
-          TComMv dv( aiDvMcpDvCand[iList][ i ], 0 );
-#endif
-          clipMv( dv );
-#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
-          pDInfo->m_acMvCand[ pDInfo->iN] = dv;
-          pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
-#else
-          {
-            TComPic* picDepth = NULL;
-            picDepth = getSlice()->getRefPicBaseDepth();
-            if (picDepth && bDepthRefine)
-#if LGE_SIMP_DVP_REFINE_C0112
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &dv, true);
-#else
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &dv);
-#endif
-            pDInfo->m_acMvCand[ pDInfo->iN] = dv;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
-          }
-#endif
-          return;
-        }
-
       }
     }
@@ -6131,4 +5359,5 @@
 #endif
               ); 
+
 #if FCO_DVP_REFINE_C0132_C0170
       if(getPic()->getDepthCoded() )
@@ -6153,23 +5382,13 @@
         cDisInfo.m_aVIdxCan[0] = 0;
       }
-#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
       Int paiPdmRefIdx[4] = {-1, -1, -1, -1};
       Int iPdmDir[4]      = {-1, -1, -1, -1};
-#if QC_C0051_FIXED_BY_MTK
       TComMv cPdmMvPred[4];
-#else
-      TComMv cPdmMvPred[2];
-#endif
       cPdmMvPred[0].m_bDvMcp = cPdmMvPred[1].m_bDvMcp = false; 
       if(getUnifiedMvPredCan(uiPartIdx, eRefPicList, iRefIdx, paiPdmRefIdx, cPdmMvPred, &cDisInfo, iPdmDir, false))
-#else // QC_AMVP_MRG_UNIFY_IVCAN_C0051
-      TComMv  cPdmMvPred;
-      if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
-#endif // QC_AMVP_MRG_UNIFY_IVCAN_C0051
 #else // H3D_NBDV
       if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
 #endif
 
-#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
       {
         clipMv( cPdmMvPred[0] );
@@ -6180,14 +5399,4 @@
         pInfo->m_acMvCand[0].set(0,0);
       }
-#else
-      {
-        clipMv( cPdmMvPred );
-        pInfo->m_acMvCand[0] = cPdmMvPred;
-      }
-      else
-      {
-        pInfo->m_acMvCand[0].set(0,0);
-      }
-#endif
     }
   }
@@ -6771,5 +5980,4 @@
   iColViewIdx = pColCU->getSlice()->getViewId();
 #if MERL_VSP_C0152
-  //TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
   if( pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr) < 0)
   {
@@ -6786,12 +5994,5 @@
     if(pColCU->getSlice()->isInterB())
     {
-#if !QC_NBDV_LDB_FIX_C0055
-      if(ilist == 0 )
-        eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(1-getSlice()->getColDir());
-      else
-        eColRefPicList = getSlice()->getCheckLDC() ? (eRefPicList== REF_PIC_LIST_0? REF_PIC_LIST_1:REF_PIC_LIST_0 ): RefPicList(getSlice()->getColDir());
-#else
         eColRefPicList = RefPicList(ilist);
-#endif
     }
 
@@ -7933,5 +7134,4 @@
 }
 #else //H3D_NBDV
-#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
 Bool
 TComDataCU::getUnifiedMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge )
@@ -7943,22 +7143,4 @@
   return false;
 }
-#else
-Int
-TComDataCU::getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm )
-{
-  TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator();
-  ROFRS( pcDepthMapGenerator, 0 );
-  return pcDepthMapGenerator->getPdmMergeCandidate( this, uiPartIdx, paiPdmRefIdx, pacPdmMv, pDInfo, iPdm );
-}
-Bool
-TComDataCU::getPdmMvPredDisCan( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge )
-{
-  TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator();
-  ROFRS( pcDepthMapGenerator, false );
-  if (pDInfo->iN > 0 && pcDepthMapGenerator->getDisCanPdmMvPred(this, uiPartIdx, eRefPicList, iRefIdx, rcMv, pDInfo, bMerge )) //bug fix li
-    return true;
-  return false;
-}
-#endif
 #endif //H3D_NBDV
 
@@ -8000,5 +7182,7 @@
   else
 #endif
-  getDisMvpCandNBDV( 0, 0,  &cDisInfo, false );
+
+  getDisMvpCandNBDV( 0, 0,  &cDisInfo, false );  
+
   if( cDisInfo.iN == 0)
   {
@@ -8008,9 +7192,5 @@
   else
   {
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
     Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0], bRecon );       
-#else
-    Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0].getHor(), bRecon ); 
-#endif
     m_pePartSize[0] = m_peSaved;
     return bAvailable;
Index: /trunk/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 332)
@@ -287,4 +287,6 @@
   );
 #if H3D_NBDV
+  Void          xDeriveRightBottomNbIdx( PartSize eCUMode, UInt uiPartIdx, Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb );
+  Bool          xCheckSpatialNBDV( TComDataCU* pcTmpCU, UInt uiIdx, UInt uiPartIdx, UInt uiPartAddr, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, McpDisInfo* paMvpDvInfo, UInt uiMvpDvPos, Bool bDepthRefine );
   Bool          xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
 #endif 
@@ -533,10 +535,5 @@
   Bool          getPdmMvPred              ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge = false );
 #else //!H3D_NBDV
-#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
   Bool          getUnifiedMvPredCan       ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge );
-#else //QC_AMVP_MRG_UNIFY_IVCAN_C0051
-  Bool          getPdmMvPredDisCan        ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge = false );
-  Int           getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm );
-#endif //QC_AMVP_MRG_UNIFY_IVCAN_C0051
   Void          getDisMvpCand        ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo );
   Void          getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerg = false
@@ -550,11 +547,6 @@
 
 #if MERL_VSP_C0152
-#if LGE_SIMP_DVP_REFINE_C0112
   Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine = false);
   Void          estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine = false);
-#else
-  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec);
-  Void          estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred);
-#endif
 #endif
   Bool          getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv );
@@ -579,12 +571,6 @@
   // member functions for accessing partition information
   // -------------------------------------------------------------------------------------------------------------------
-#if LG_RESTRICTEDRESPRED_M24766
+#if H3D_IVRP
   Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false);
-#else
-  Void          getPartIndexAndSize   ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight );
-#endif
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-  Int           getResiPredMode(UInt uiPartAddr);
-  Void          getPUResiPredShift (Int *iPUPredResiShift, UInt uiAbsPartIndex);
 #endif
   UChar         getNumPartInter       ();
@@ -601,6 +587,4 @@
   Void          fillMvpCandBase       ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );
   Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo , Int iMVPIdx=-1);
-#else
-  Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );
 #endif
   Bool          isDiffMER             ( Int xN, Int yN, Int xP, Int yP);
@@ -831,4 +815,6 @@
   Pel           getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }
   Void          setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }
+ 
+
 #endif
 };
Index: /trunk/source/Lib/TLibCommon/TComDepthMapGenerator.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComDepthMapGenerator.cpp	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComDepthMapGenerator.cpp	(revision 332)
@@ -605,5 +605,4 @@
 
 #if H3D_IVMP
-#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
 Bool
 TComDepthMapGenerator::getPdmCandidate(TComDataCU* pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge )
@@ -636,9 +635,6 @@
   for( UInt uiBId = 0; uiBId < m_uiCurrViewId && iValid==0; uiBId++ )
   {
-#if MTK_C0138_FIXED
+
     UInt        uiBaseId    = uiBId;
-#else
-    UInt        uiBaseId    = m_auiBaseIdList[ uiBId ];
-#endif
     TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( uiBaseId );
     for( Int iRefListId = 0; iRefListId < 2 && iValid==0; iRefListId++ )
@@ -785,330 +781,4 @@
   return false;
 }
-#else // QC_AMVP_MRG_UNIFY_IVCAN_C0051
-#if H3D_NBDV
-Int
-TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm )
-#else
-Int
-TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv )
-#endif 
-{
-  AOF  ( m_bCreated && m_bInit );
-
-#if !H3D_NBDV
-  ROFRS( m_bPDMAvailable, 0 );
-#endif
-
-  TComSlice*    pcSlice     = pcCU->getSlice ();
-  TComSPS*      pcSPS       = pcSlice->getSPS();
-  AOF  ( pcSPS->getViewId() == m_uiCurrViewId );
-  Bool          bPdmMerge   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE );
-  ROTRS( !bPdmMerge, 0 );
-
-  Bool abPdmAvailable[4] = {false, false, false, false};
-
-  Int iValid = 0;
-  Int iViewId = 0;
-  for( UInt uiBId = 0; uiBId < m_uiCurrViewId && iValid==0; uiBId++ )
-  {
-    UInt        uiBaseId    = m_auiBaseIdList[ uiBId ];
-    TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( uiBaseId );
-    for( Int iRefListId = 0; iRefListId < 2 && iValid==0; iRefListId++ )
-    {
-      RefPicList  eRefPicListTest = RefPicList( iRefListId );
-      Int         iNumRefPics = pcSlice->getNumRefIdx( eRefPicListTest ) ;
-      for( Int iRefIndex = 0; iRefIndex < iNumRefPics; iRefIndex++ )
-      { 
-        if(pcBasePic->getPOC() == pcSlice->getRefPic( eRefPicListTest, iRefIndex )->getPOC() 
-          && pcBasePic->getViewId() == pcSlice->getRefPic( eRefPicListTest, iRefIndex )->getViewId())
-        {
-          iValid=1;
-          iViewId = uiBaseId;
-          break;
-        }
-      }
-    }
-  }
-  if (iValid == 0)
-    return 0;
-
-  //--- get base CU/PU and check prediction mode ---
-  TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( iViewId );
-  TComPicYuv* pcBaseRec   = pcBasePic->getPicYuvRec   ();
-
-#if H3D_NBDV
-  Int  iCurrPosX, iCurrPosY;
-  UInt          uiPartAddr;
-  Int           iWidth;
-  Int           iHeight;
-
-  pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight );
-  pcBaseRec->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
-  iCurrPosX  += ( ( iWidth  - 1 ) >> 1 );
-  iCurrPosY  += ( ( iHeight - 1 ) >> 1 );
-
-  Int         iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (pDInfo->m_acMvCand[0].getHor() + 2 ) >> 2 ) );
-  Int         iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (pDInfo->m_acMvCand[0].getVer() + 2 ) >> 2 )); 
-  Int         iBaseCUAddr;
-  Int         iBaseAbsPartIdx;
-  pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx );
-#else
-  Int  iPrdDepth, iCurrPosX, iCurrPosY;
-  Bool bAvailable  = xGetPredDepth( pcCU, uiPartIdx, iPrdDepth, &iCurrPosX, &iCurrPosY );
-  AOF( bAvailable );
-  TComPicYuv* pcBasePdm   = pcBasePic->getPredDepthMap();
-  Int         iDisparity  = xGetDisparityFromVirtDepth( iViewId, iPrdDepth );
-  Int         iShiftX     = m_uiSubSampExpX + 2;
-  Int         iAddX       = ( 1 << iShiftX ) >> 1;
-  Int         iBasePosX   = Clip3( 0, pcBasePdm->getWidth () - 1, iCurrPosX + ( ( iDisparity + iAddX ) >> iShiftX ) );
-  Int         iBasePosY   = Clip3( 0, pcBasePdm->getHeight() - 1, iCurrPosY                               );
-  Int         iBaseCUAddr;
-  Int         iBaseAbsPartIdx;
-  pcBaseRec->getCUAddrAndPartIdx( iBasePosX<< m_uiSubSampExpX , iBasePosY<< m_uiSubSampExpY , iBaseCUAddr, iBaseAbsPartIdx );
-#endif 
-
-  TComDataCU* pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
-
-  if( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTER || pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_SKIP )
-  {
-    for( UInt uiBaseRefListId = 0; uiBaseRefListId < 2; uiBaseRefListId++ )
-    {
-      RefPicList  eBaseRefPicList = RefPicList( uiBaseRefListId );
-      TComMvField cBaseMvField;
-      pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField );
-      Int         iBaseRefIdx     = cBaseMvField.getRefIdx();
-
-      if (iBaseRefIdx >= 0)
-      {
-        Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx);
-        if (iBaseRefPOC != pcSlice->getPOC())    
-        {
-          for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eBaseRefPicList ); iPdmRefIdx++)
-          {
-            if (iBaseRefPOC == pcSlice->getRefPOC(eBaseRefPicList, iPdmRefIdx))
-            {
-              abPdmAvailable[ uiBaseRefListId ] = true;
-              paiPdmRefIdx  [ uiBaseRefListId ] = iPdmRefIdx;
-              TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
-#if H3D_NBDV
-              cMv.m_bDvMcp = true;
-              cMv.m_iDvMcpDispX = pDInfo->m_acMvCand[0].getHor();
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
-              cMv.m_iDvMcpDispY = pDInfo->m_acMvCand[0].getVer();
-#endif
-#endif //H3D_NBDV
-              pcCU->clipMv( cMv );
-              pacPdmMv      [ uiBaseRefListId ] = cMv;
-              break;
-            }
-          }
-        }
-      }
-    }
-  }
-  Int iPdmInterDir = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 );
-
-  iPdm[0] = iPdmInterDir;
-    for( Int iRefListId = 0; iRefListId < 2 ; iRefListId++ )
-    {
-      RefPicList  eRefPicList       = RefPicList( iRefListId );
-      Int         iNumRefPics       = pcSlice->getNumRefIdx( eRefPicList );
-      for( Int iPdmRefIdx = 0; iPdmRefIdx < iNumRefPics; iPdmRefIdx++ )
-      {
-        if( pcSlice->getRefPOC( eRefPicList, iPdmRefIdx ) == pcSlice->getPOC())
-        {
-          abPdmAvailable[ iRefListId+2 ] = true;
-          paiPdmRefIdx  [ iRefListId+2 ] = iPdmRefIdx;
-#if H3D_NBDV
-          TComMv cMv = pDInfo->m_acMvCand[0]; 
-          cMv.setVer(0);
-#else
-          TComMv cMv(iDisparity, 0);
-#endif
-          pcCU->clipMv( cMv );
-          pacPdmMv      [ iRefListId + 2] = cMv;
-          break;
-        }
-      }
-    }
-    iPdmInterDir = ( abPdmAvailable[2] ? 1 : 0 ) + ( abPdmAvailable[3] ? 2 : 0 ) ;
-    iPdm[1] = iPdmInterDir;
-
-  return iPdmInterDir;
-}
-
-#if H3D_NBDV
-Bool
-TComDepthMapGenerator::getDisCanPdmMvPred    ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge )
-{
-  rcMv.m_bDvMcp = false;
-  AOF  ( m_bCreated && m_bInit );
-  AOF  ( iRefIdx >= 0 );
-  AOF  ( pcCU );
-  TComSlice*    pcSlice     = pcCU->getSlice ();
-  TComSPS*      pcSPS       = pcSlice->getSPS();
-  AOF  ( pcSPS->getViewId() == m_uiCurrViewId );
-  TComPic*      pcRefPic    = pcSlice->getRefPic( eRefPicList, iRefIdx );
-  UInt          uiRefViewId = pcRefPic->getSPS()->getViewId();
-  Int           iRefPoc     = pcRefPic->getPOC();
-  Bool          bInterview  = ( uiRefViewId < m_uiCurrViewId );
-  AOT(  bInterview && iRefPoc != pcSlice->getPOC() );
-  AOT( !bInterview && iRefPoc == pcSlice->getPOC() );
-  Bool          bPdmIView   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_IVIEW ) == PDM_USE_FOR_IVIEW );
-  Bool          bPdmInter   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_INTER ) == PDM_USE_FOR_INTER );
-  Bool          bPdmMerge   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE );
-  ROTRS( ( bInterview && !bMerge ) && !bPdmIView, false );
-  ROTRS( (!bInterview && !bMerge ) && !bPdmInter, false );
-  ROTRS(                  bMerge   && !bPdmMerge, false );
-  Int  iCurrPosX, iCurrPosY;
-  TComMv cDisMv;
-
-  if( bInterview )
-  {
-    rcMv = pDInfo->m_acMvCand[0]; 
-    rcMv.setVer(0);
-    return      true;
-  }
-  for( UInt uiBId = 0; uiBId < m_uiCurrViewId; uiBId++ )
-  {
-    UInt        uiBaseId    = uiBId; 
-
-    if (m_uiCurrViewId >1 && uiBaseId ==1 ) 
-      continue;
-
-    TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( uiBaseId );
-    TComPicYuv* pcBaseRec   = pcBasePic->getPicYuvRec   ();
-    UInt          uiPartAddr;
-    Int           iWidth;
-    Int           iHeight;
-
-    pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight );
-    pcBaseRec->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
-    iCurrPosX  += ( ( iWidth  - 1 ) >> 1 );
-    iCurrPosY  += ( ( iHeight - 1 ) >> 1 );
-    Int         iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (pDInfo->m_acMvCand[0].getHor() + 2 ) >> 2 ) );
-    Int         iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (pDInfo->m_acMvCand[0].getVer() + 2 ) >> 2 ));  
-    Int         iBaseCUAddr;
-    Int         iBaseAbsPartIdx;
-    pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx );
-    TComDataCU* pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
-    if( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) != MODE_INTER && pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) != MODE_SKIP )
-    {
-      continue;
-    }
-    for( UInt uiBaseRefListId = 0; uiBaseRefListId < 2; uiBaseRefListId++ )
-    {
-      RefPicList  eBaseRefPicList = RefPicList( uiBaseRefListId );
-      TComMvField cBaseMvField;
-      pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField );
-      Int         iBaseRefIdx     = cBaseMvField.getRefIdx();
-      Int         iBaseRefPoc     = ( iBaseRefIdx >= 0 ? pcBaseCU->getSlice()->getRefPic( eBaseRefPicList, iBaseRefIdx )->getPOC() : -(1<<30) );
-      if( iBaseRefIdx >= 0 && iBaseRefPoc == iRefPoc )
-      {
-        rcMv.set( cBaseMvField.getHor(), cBaseMvField.getVer() );
-        // save disparity vector when a merge candidate for IVMP is set as DV-MCP
-        if( bMerge ) 
-        {
-          rcMv.m_bDvMcp = true;
-          rcMv.m_iDvMcpDispX = pDInfo->m_acMvCand[0].getHor(); 
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
-          rcMv.m_iDvMcpDispY = pDInfo->m_acMvCand[0].getVer();
-#endif
-        }
-        else { // AMVP ?
-          rcMv.m_bDvMcp = false;
-        }
-        return true;
-      }
-    }
-  }
-  return false;
-}
-#else // H3D_NBDV
-Bool  
-TComDepthMapGenerator::getPdmMvPred( TComDataCU* pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge )
-{
-  AOF  ( m_bCreated && m_bInit );
-  AOF  ( iRefIdx >= 0 );
-  AOF  ( pcCU );
-  ROFRS( m_bPDMAvailable, false );
-
-  TComSlice*    pcSlice     = pcCU->getSlice ();
-  TComPic*      pcPic       = pcCU->getPic   ();
-  TComSPS*      pcSPS       = pcSlice->getSPS();
-  AOF  ( pcPic->getPredDepthMap() );
-  AOF  ( pcSPS->getViewId() == m_uiCurrViewId );
-  
-  TComPic*      pcRefPic    = pcSlice->getRefPic( eRefPicList, iRefIdx );
-  UInt          uiRefViewId = pcRefPic->getSPS()->getViewId();
-  Int           iRefPoc     = pcRefPic->getPOC();
-  Bool          bInterview  = ( uiRefViewId < m_uiCurrViewId );
-  AOT(  bInterview && iRefPoc != pcSlice->getPOC() );
-  AOT( !bInterview && iRefPoc == pcSlice->getPOC() );
-
-  Bool          bPdmIView   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_IVIEW ) == PDM_USE_FOR_IVIEW );
-  Bool          bPdmInter   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_INTER ) == PDM_USE_FOR_INTER );
-  Bool          bPdmMerge   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE );
-  ROTRS( ( bInterview && !bMerge ) && !bPdmIView, false );
-  ROTRS( (!bInterview && !bMerge ) && !bPdmInter, false );
-  ROTRS(                  bMerge   && !bPdmMerge, false );
-
-  //===== get predicted depth for middle position of current PU =====  
-  Int  iPrdDepth, iCurrPosX, iCurrPosY;
-  Bool bAvailable  = xGetPredDepth( pcCU, uiPartIdx, iPrdDepth, &iCurrPosX, &iCurrPosY );
-  AOF( bAvailable );
-  
-  //===== inter-view motion vector prediction =====
-  if( bInterview )
-  {
-    Int         iDisparity  = xGetDisparityFromVirtDepth( uiRefViewId, iPrdDepth );
-    rcMv.set  ( iDisparity, 0 );
-    return      true;
-  }
-  
-  //===== inter motion vector prediction =====
-  for( UInt uiBId = 0; uiBId < m_uiCurrViewId; uiBId++ )
-  {
-    //--- get base CU/PU and check prediction mode ---
-    UInt        uiBaseId    = m_auiBaseIdList[ uiBId ];
-#if PDM_REMOVE_DEPENDENCE
-    if( uiBaseId != 0)
-      continue;
-#endif
-    TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( uiBaseId );
-    TComPicYuv* pcBasePdm   = pcBasePic->getPredDepthMap();
-    TComPicYuv* pcBaseRec   = pcBasePic->getPicYuvRec   ();
-    Int         iDisparity  = xGetDisparityFromVirtDepth( uiBaseId, iPrdDepth );
-    Int         iShiftX     = m_uiSubSampExpX + 2;
-    Int         iAddX       = ( 1 << iShiftX ) >> 1;
-    Int         iBasePosX   = Clip3( 0, pcBasePdm->getWidth () - 1, iCurrPosX + ( ( iDisparity + iAddX ) >> iShiftX ) );
-    Int         iBasePosY   = Clip3( 0, pcBasePdm->getHeight() - 1, iCurrPosY                               );
-    Int         iBaseCUAddr;
-    Int         iBaseAbsPartIdx;
-    pcBaseRec->getCUAddrAndPartIdx( iBasePosX << m_uiSubSampExpX, iBasePosY << m_uiSubSampExpY, iBaseCUAddr, iBaseAbsPartIdx );
-    TComDataCU* pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
-    if( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) != MODE_INTER && pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) != MODE_SKIP )
-    {
-      continue;
-    }
-
-    for( UInt uiBaseRefListId = 0; uiBaseRefListId < 2; uiBaseRefListId++ )
-    {
-      RefPicList  eBaseRefPicList = RefPicList( uiBaseRefListId );
-      TComMvField cBaseMvField;
-      pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField );
-      Int         iBaseRefIdx     = cBaseMvField.getRefIdx();
-      Int         iBaseRefPoc     = ( iBaseRefIdx >= 0 ? pcBaseCU->getSlice()->getRefPic( eBaseRefPicList, iBaseRefIdx )->getPOC() : -(1<<30) );
-      if( iBaseRefIdx >= 0 && iBaseRefPoc == iRefPoc )
-      {
-        rcMv.set( cBaseMvField.getHor(), cBaseMvField.getVer() );
-        return true;
-      }
-    }
-  }
-  return false;
-}
-#endif // H3D_NBDV
-#endif // QC_AMVP_MRG_UNIFY_IVCAN_C0051
 
 
Index: /trunk/source/Lib/TLibCommon/TComDepthMapGenerator.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComDepthMapGenerator.h	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComDepthMapGenerator.h	(revision 332)
@@ -152,11 +152,5 @@
 #if H3D_IVMP
 #if H3D_NBDV
-#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
   Bool  getPdmCandidate       ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge );
-#else
-  Int   getPdmMergeCandidate  ( TComDataCU*   pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm );
-  Bool  getPdmMvPredDisCan    ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge );
-  Bool  getDisCanPdmMvPred    ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge );
-#endif
 #else
   Int   getPdmMergeCandidate  ( TComDataCU*   pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv );
Index: /trunk/source/Lib/TLibCommon/TComMotionInfo.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComMotionInfo.h	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComMotionInfo.h	(revision 332)
@@ -66,4 +66,13 @@
   Int    iN;                                ///< number of motion vector predictor candidates
 } DisInfo;
+
+typedef struct _McpDisCand
+{
+  TComMv m_acMvCand[2][ MCP_DIS_CANS ];            ///< array of motion vector predictor candidates
+  Int    m_aVIdxCan[2][ MCP_DIS_CANS ];            ///< array of motion vector predictor candidates
+  Bool   m_bAvailab[2][ MCP_DIS_CANS ];
+  Bool   m_bFound;                                 ///< number of motion vector predictor candidates
+} McpDisInfo;
+
 #endif 
 // Class definition
Index: /trunk/source/Lib/TLibCommon/TComMv.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComMv.h	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComMv.h	(revision 332)
@@ -60,7 +60,5 @@
   Bool  m_bDvMcp;       // is dv-mcp ?
   Int   m_iDvMcpDispX;  // disparity for dv-mcp
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
   Int   m_iDvMcpDispY;  // disparity for dv-mcp
-#endif
 #endif
 
@@ -75,7 +73,5 @@
   , m_bDvMcp(false)
   , m_iDvMcpDispX(0)
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
   , m_iDvMcpDispY(0)
-#endif
 #endif
   {
@@ -88,7 +84,5 @@
   , m_bDvMcp(false)
   , m_iDvMcpDispX(0)
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
   , m_iDvMcpDispY(0)
-#endif
 #endif
   {
Index: /trunk/source/Lib/TLibCommon/TComPic.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComPic.cpp	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComPic.cpp	(revision 332)
@@ -85,5 +85,5 @@
   m_aaiCodedScale     = 0;
   m_aaiCodedOffset    = 0;
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   m_bReduceBitsQTL    = 0;
 #endif
Index: /trunk/source/Lib/TLibCommon/TComPic.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComPic.h	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComPic.h	(revision 332)
@@ -121,5 +121,5 @@
   Int**                 m_aaiCodedOffset;
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   Bool                  m_bReduceBitsQTL;
 #endif
@@ -203,5 +203,5 @@
 #endif
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   Bool          getReduceBitsFlag ()             { return m_bReduceBitsQTL;     }
   Void          setReduceBitsFlag ( Bool bFlag ) { m_bReduceBitsQTL = bFlag;    }
Index: /trunk/source/Lib/TLibCommon/TComPicYuv.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComPicYuv.cpp	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComPicYuv.cpp	(revision 332)
@@ -468,5 +468,5 @@
 Void TComPicYuv::setLumaTo( Pel pVal )
 {
-  xSetPels( getLumaAddr(), getStride(), getWidth(), getHeight() >> 1, pVal );
+  xSetPels( getLumaAddr(), getStride(), getWidth(), getHeight(), pVal );
 }
 
Index: /trunk/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComPrediction.cpp	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComPrediction.cpp	(revision 332)
@@ -636,5 +636,4 @@
 #endif
       {
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
         xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
@@ -642,15 +641,7 @@
         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
 #endif
-#else
-#if MERL_VSP_C0152
-        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true );
-#else
-        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true );
-#endif
-#endif
       }
       else
       {
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
         xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
@@ -658,11 +649,4 @@
         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
 #endif
-#else
-#if MERL_VSP_C0152
-        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
-#else
-        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
-#endif
-#endif
       }
 #if LGE_ILLUCOMP_B0045
@@ -677,11 +661,6 @@
     else
     {
-#if DEPTH_MAP_GENERATION
       if( xCheckIdenticalMotion( pcCU, uiPartAddr ) && !bPrdDepthMap )
-#else
-      if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
-#endif
-      {
-#if DEPTH_MAP_GENERATION
+      {
 #if MERL_VSP_C0152
         xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
@@ -689,15 +668,7 @@
         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
 #endif
-#else
-#if MERL_VSP_C0152
-        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false );
-#else
-        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false );
-#endif
-#endif
       }
       else
       {
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
         xPredInterBi  (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
@@ -705,11 +676,4 @@
         xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
 #endif
-#else
-#if MERL_VSP_C0152
-        xPredInterBi  (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx );
-#else
-        xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx );
-#endif
-#endif
       }
     }
@@ -721,5 +685,4 @@
     pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
 
-#if DEPTH_MAP_GENERATION
     if( bPrdDepthMap )
     {
@@ -727,5 +690,4 @@
       iHeight >>= uiSubSampExpY;
     }
-#endif
 
     if ( eRefPicList != REF_PIC_LIST_X )
@@ -737,5 +699,4 @@
 #endif
       {
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
         xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
@@ -743,15 +704,7 @@
         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
 #endif 
-#else
-#if MERL_VSP_C0152
-        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true );
-#else
-        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true );
-#endif
-#endif
   }
   else
   {
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
         xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
@@ -759,13 +712,5 @@
         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
 #endif
-#else
-#if MERL_VSP_C0152
-        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
-#else
-        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
-#endif
-#endif
-      }
-#if DEPTH_MAP_GENERATION
+      }
 #if MERL_VSP_C0152
       xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
@@ -773,11 +718,5 @@
       xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
 #endif
-#else
-#if MERL_VSP_C0152
-      xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
-#else
-      xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
-#endif
-#endif
+
 #if LGE_ILLUCOMP_B0045
       if( pcCU->getSlice()->getPPS()->getUseWP() && !pcCU->getICFlag(uiPartAddr))
@@ -793,5 +732,4 @@
       if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
       {
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
         xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
@@ -799,15 +737,7 @@
         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
 #endif
-#else
-#if MERL_VSP_C0152
-        xPredInterUni (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false );
-#else
-        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false );
-#endif
-#endif   
       }
       else
       {
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
         xPredInterBi  (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
@@ -815,11 +745,4 @@
         xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
 #endif   
-#else
-#if MERL_VSP_C0152
-        xPredInterBi  (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx );
-#else
-        xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx );
-#endif 
-#endif
       }
     }
@@ -828,5 +751,5 @@
 }
 
-#if MTK_MDIVRP_C0138
+#if H3D_IVRP
 Void TComPrediction::residualPrediction(TComDataCU* pcCU, TComYuv* pcYuvPred, TComYuv* pcYuvResPred)
 {
@@ -847,16 +770,8 @@
 #endif
 
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
 Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi )
 #else
 Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi )
-#endif
-#else
-#if MERL_VSP_C0152
-Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi )
-#else
-Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi )
-#endif
 #endif
 {
@@ -887,9 +802,7 @@
   {
     UInt uiRShift = 0;
-#if PDM_REMOVE_DEPENDENCE
     if( pcCU->getPic()->getStoredPDMforV2() == 1 )
       xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPredDepthMapTemp(), uiPartAddr, &cMv, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, rpcYuvPred, uiRShift, 0 );
     else
-#endif
       xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPredDepthMap(), uiPartAddr, &cMv, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, rpcYuvPred, uiRShift, 0 );
 
@@ -1001,5 +914,4 @@
 
 
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
 Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap )
@@ -1007,11 +919,4 @@
 Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap )
 #endif
-#else
-#if MERL_VSP_C0152
-Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred, Int iPartIdx )
-#else
-Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred, Int iPartIdx )
-#endif
-#endif
 {
   TComYuv* pcMbYuv;
@@ -1050,16 +955,8 @@
     if( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 )
     {
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
       xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
 #else
       xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
-#endif
-#else
-#if MERL_VSP_C0152
-      xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true );
-#else
-      xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true );
-#endif
 #endif
     }
@@ -1073,5 +970,4 @@
 #endif
       {
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
         xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
@@ -1079,26 +975,11 @@
         xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
 #endif
-#else
-#if MERL_VSP_C0152
-        xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true );
-#else
-        xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true );
-#endif
-#endif
       }
       else
       {
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
         xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
 #else
         xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
-#endif
-#else
-#if MERL_VSP_C0152
-        xPredInterUni ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, false );
-#else
-        xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, false );
-#endif
 #endif
       }
@@ -1132,5 +1013,4 @@
   else
   {
-#if DEPTH_MAP_GENERATION
     if ( bPrdDepthMap )
     {
@@ -1146,7 +1026,4 @@
       xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
     }
-#else
-    xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
-#endif
   }
 }
@@ -1155,5 +1032,4 @@
 
 Void 
-#if DEPTH_MAP_GENERATION
 TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset 
 #if LGE_ILLUCOMP_DEPTH_C0046
@@ -1161,9 +1037,5 @@
 #endif
 )
-#else
-TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset )
-#endif
-{
-#if DEPTH_MAP_GENERATION
+{
   Int     iShiftX     = 2 + uiSubSampExpX;
   Int     iShiftY     = 2 + uiSubSampExpY;
@@ -1182,23 +1054,4 @@
   Int     iDstStride  = rpcYuv->getStride();
   Int     iRefOffset  = iHor + iVer * iRefStride;
-#else
-  Int     iFPelMask   = ~3;
-  Int     iRefStride  = pcPicYuvRef->getStride();
-  Int     iDstStride  = rpcYuv->getStride();
-  Int     iHor        = ( pcMv->getHor() + 2 ) & iFPelMask;
-  Int     iVer        = ( pcMv->getVer() + 2 ) & iFPelMask;
-#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
-  if( pcCU->getSlice()->getSPS()->isDepth() )
-  {
-    iHor = pcMv->getHor() * 4;
-    iVer = pcMv->getVer() * 4;
-}
-#endif
-#if !QC_MVHEVC_B0046
-  Int     ixFrac      = iHor & 0x3;
-  Int     iyFrac      = iVer & 0x3;
-#endif
-  Int     iRefOffset  = ( iHor >> 2 ) + ( iVer >> 2 ) * iRefStride;
-#endif
 
   Pel*    piRefY      = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
@@ -1454,11 +1307,6 @@
   Int dstStride = dstPic->getStride();
   Int depStride =  pPicBaseDepth->getStride();
-#if MTK_DVPREFINE_BVSP_BUG_FIX
   Int depthPosX = Clip3(0,   widthLuma - size_x,  (posX/nTxtPerDepthX) + (mv->getHor()>>2));
   Int depthPosY = Clip3(0,   heightLuma- size_y,  (posY/nTxtPerDepthY) + (mv->getVer()>>2));
-#else
-  Int depthPosX = Clip3(0,   widthLuma - size_x - 1,  (posX/nTxtPerDepthX) + (mv->getHor()>>2));
-  Int depthPosY = Clip3(0,   heightLuma- size_y - 1,  (posY/nTxtPerDepthY) + (mv->getVer()>>2));
-#endif
   Pel *ref    = refPic->getLumaAddr() + posX + posY * refStride;
   Pel *dst    = dstPic->getLumaAddr(partAddr);
@@ -1618,9 +1466,5 @@
     depthPosX = posX * nDepthPerTxtX + (mv->getHor()>>2);        //mv denotes the disparity for VSP
   }
-#if MTK_DVPREFINE_BVSP_BUG_FIX
   depthPosX = Clip3(0, widthDepth - (size_x<<1), depthPosX);
-#else
-  depthPosX = Clip3(0, widthDepth - (size_x<<1) - 1, depthPosX);
-#endif
   if ( heightChroma > heightDepth )
   {
@@ -1635,9 +1479,5 @@
     depthPosY = posY * nDepthPerTxtY + (mv->getVer()>>2);     //mv denotes the disparity for VSP
   }
-#if MTK_DVPREFINE_BVSP_BUG_FIX
   depthPosY = Clip3(0, heightDepth - (size_y<<1), depthPosY);
-#else
-  depthPosY = Clip3(0, heightDepth - (size_y<<1) - 1, depthPosY);
-#endif
 
   Pel *refCb  = refPic->getCbAddr() + posX + posY * refStride;
@@ -2384,11 +2224,6 @@
   iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
   iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
-#if FIX_LGE_ILLUCOMP_B0045
   iRefX   = iCUPelX + (pMv->getHor() >> 2);
   iRefY   = iCUPelY + (pMv->getVer() >> 2);
-#else
-  iRefX   = iCUPelX + (pMv->getHor() >> 3);
-  iRefY   = iCUPelY + (pMv->getVer() >> 3);
-#endif
   uiWidth = pcCU->getWidth(0) >> 1;
   uiHeight = pcCU->getHeight(0) >> 1;
@@ -3037,13 +2872,4 @@
   getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft );
 
-#if HHI_DMM_DELTADC_Q1_C0034
-#else
-  if( bDelta ) 
-  {
-    xDeltaDCQuantScaleUp( pcCU, iDeltaDC1 );
-    xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 );
-  }
-#endif
-
   // assign wedge pred DCs to prediction
   if( bDelta ) { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip ( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); }
@@ -3064,13 +2890,4 @@
   piMask += iMaskStride+1;
   getWedgePredDCs( pcContourWedge, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft );
-
-#if HHI_DMM_DELTADC_Q1_C0034
-#else
-  if( bDelta ) 
-  {
-    xDeltaDCQuantScaleUp( pcCU, iDeltaDC1 );
-    xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 );
-  }
-#endif
 
   // assign wedge pred DCs to prediction
@@ -3249,13 +3066,4 @@
   getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft );
 
-#if HHI_DMM_DELTADC_Q1_C0034
-#else
-  if( bDelta ) 
-  {
-    xDeltaDCQuantScaleUp( pcCU, iDeltaDC1 );
-    xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 );
-  }
-#endif
-
   // assign wedge pred DCs to prediction
   if( bDelta ) { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); }
@@ -3292,13 +3100,4 @@
   piMask += iMaskStride+1;
   getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft );
-
-#if HHI_DMM_DELTADC_Q1_C0034
-#else
-  if( bDelta ) 
-  {
-    xDeltaDCQuantScaleUp( pcCU, iDeltaDC1 );
-    xDeltaDCQuantScaleUp( pcCU, iDeltaDC2 );
-  }
-#endif
 
   // assign wedge pred DCs to prediction
Index: /trunk/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComPrediction.h	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComPrediction.h	(revision 332)
@@ -86,5 +86,4 @@
   
   // motion compensation functions
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
   Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,       UInt uiAbsPartIdx,        Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0, Bool bi=false );
@@ -92,13 +91,5 @@
   Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0, Bool bi=false );
 #endif
-#else
-#if MERL_VSP_C0152
-  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,       UInt uiAbsPartIdx,        Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false          );
-#else
-  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false          );
-#endif
-#endif
-
-#if DEPTH_MAP_GENERATION
+
 #if MERL_VSP_C0152
   Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,       UInt uiAbsPartIdx,   Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
@@ -111,12 +102,5 @@
 #endif
       );
-#else
-#if MERL_VSP_C0152
-  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,     UInt uiAbsPartIdx,     Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred, Int iPartIdx          );
-#else
-  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred, Int iPartIdx          );
-#endif
-  Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset );
-#endif
+
 #if MERL_VSP_C0152
   Void xPredInterUniBWVSP         ( TComDataCU* pcCU,                          UInt uiPartAddr, UInt uiAbsPartIdx,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi=false );
@@ -179,5 +163,4 @@
   
   // inter
-#if DEPTH_MAP_GENERATION
 #if MERL_VSP_C0152
   Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1, Bool bPrdDepthMap = false, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 );
@@ -185,13 +168,6 @@
   Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1, Bool bPrdDepthMap = false, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 );
 #endif
-#else
-#if MERL_VSP_C0152
-  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx,, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
-#else
-  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
-#endif
-#endif
-
-#if MTK_MDIVRP_C0138
+
+#if H3D_IVRP
   Void residualPrediction         (TComDataCU* pcCU, TComYuv* pcYuvPred, TComYuv* pcYuvResPred);
 #endif
Index: /trunk/source/Lib/TLibCommon/TComResidualGenerator.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComResidualGenerator.cpp	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComResidualGenerator.cpp	(revision 332)
@@ -184,5 +184,5 @@
   AOF  ( pcPic );
 
-#if MTK_MDIVRP_C0138
+#if H3D_IVRP
   if (pcPic->getSPS()->getViewId() != 0)
   {
@@ -227,11 +227,6 @@
 
 #if H3D_NBDV
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
 Bool
 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp, Bool bRecon  ) 
-#else
-Bool
-TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp, Bool bRecon  ) 
-#endif
 #else
 Bool
@@ -248,9 +243,5 @@
   pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iXPos, iYPos );
 #if H3D_NBDV
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
-  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon);   
-#else
   return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon); 
-#endif
 #else
   return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, bRecon); 
@@ -259,21 +250,12 @@
   
 #if H3D_NBDV
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
 Bool
 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, Bool bRecon)  
 #else
 Bool
-TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp, Bool bRecon) 
-#endif
-#else
-Bool
 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Bool bRecon) 
 #endif
 {
-#if MTK_C0138_FIXED
   UInt  uiBaseViewId  = 0;
-#else
-  UInt  uiBaseViewId  = m_pcDepthMapGenerator->getBaseViewId( 0 );
-#endif
   if( !pcYuv )
   {
@@ -282,17 +264,9 @@
   UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos;
 #if H3D_NBDV
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
   xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon  );
-#else
-  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon  );
-#endif
 #else
   xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, &uiXPosInRefView , &uiYPosInRefView , bRecon    );
 #endif
-#if MTK_MDIVRP_C0138
   return true;
-#else
-  return xIsNonZeroByCBF( uiBaseViewId , uiXPosInRefView , uiYPosInRefView , uiBlkWidth , uiBlkHeight );
-#endif
 }
 
@@ -411,7 +385,4 @@
   Pel*    pRes      = pcCUResidual->getLumaAddr();
   UInt    uiLumaTrMode, uiChromaTrMode;
-#if LG_RESTRICTEDRESPRED_M24766  && !MTK_MDIVRP_C0138
-  Int     iPUPredResiShift[4];
-#endif
   pcCU->convertTransIdx             ( 0, pcCU->getTransformIdx( 0 ), uiLumaTrMode, uiChromaTrMode );
     m_pcTrQuant->setQPforQuant      ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
@@ -429,19 +400,4 @@
   m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff );
 
-#if !MTK_MDIVRP_C0138
-  if( pcCU->getResPredFlag( 0 ) )
-  {
-    AOF( pcCU->getResPredAvail( 0 ) );
-    Bool bOK = pcCU->getResidualSamples( 0, true, m_ppcYuvTmp[0] );
-    AOF( bOK );
-#if LG_RESTRICTEDRESPRED_M24766
-    pcCU->getPUResiPredShift(iPUPredResiShift, 0);
-    pcCUResidual->add(iPUPredResiShift, pcCU->getPartitionSize(0), m_ppcYuvTmp[0], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) );
-#else
-    pcCUResidual->add( m_ppcYuvTmp[0], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) );
-#endif
-  }
-#endif
-
   //===== clear inter-view predicted parts =====
   for( UInt uiPartIdx = 0; uiPartIdx < pcCU->getNumPartInter(); uiPartIdx++ )
@@ -500,13 +456,7 @@
 
 #if H3D_NBDV
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
 Void  
 TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp
                                              ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon )
-#else // MTK_RELEASE_DV_CONSTRAINT_C0129
-Void  
-TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp 
-                                             ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon)
-#endif // MTK_RELEASE_DV_CONSTRAINT_C0129
 #else // H3D_NBDV
 Void  
@@ -531,10 +481,6 @@
   //===== get disparity =====
 #if H3D_NBDV
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
   Int iDisparity_y = iDisp.getVer();
   Int iDisparity   = iDisp.getHor();
-#else
-  Int iDisparity = iDisp;
-#endif
 #else //H3D_NBDV
   Int           iMidPosX    = Int( uiXPos + ( ( uiBlkWidth  - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpX();
@@ -549,5 +495,4 @@
   Int           iYRefPosX0  = Int( uiXPos )     + ( iDisparity >> 2 );
   Int           iYRefPosX1  = iYRefPosX0        + 1;
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
   Int           iYMaxPosY   = Int( uiPicHeight ) - 1;
   Int           iYWeight3   = ( iDisparity_y & 3 );
@@ -555,14 +500,9 @@
   Int           iYRefPosY0  = Max( 0, Min( iYMaxPosY, Int( uiYPos )     + ( iDisparity_y >> 2 )) );
   Int           iYRefPosY1  = Max( 0, Min( iYMaxPosY, iYRefPosY0 + 1 ));
-#endif
   Int           iYMaxPosX   = Int( uiPicWidth ) - 1;
   Int           iSrcStrideY = pcBaseRes->getStride   ();
   Int           iDesStrideY = pcYuv    ->getStride   ();
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
   Pel*          pSrcSamplesY0= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY0 * iSrcStrideY;
   Pel*          pSrcSamplesY1= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY1 * iSrcStrideY;
-#else
-  Pel*          pSrcSamplesY= pcBaseRes->getLumaAddr ( 0 ) + uiYPos * iSrcStrideY;
-#endif
   Pel*          pDesSamplesY= pcYuv    ->getLumaAddr ();
 
@@ -575,9 +515,5 @@
     return;
 
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
   for(   Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY0 += iSrcStrideY, pSrcSamplesY1 += iSrcStrideY, pDesSamplesY += iDesStrideY )
-#else
-  for(   Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY += iSrcStrideY, pDesSamplesY += iDesStrideY )
-#endif
   {
     for( Int iX = 0; iX < iYWidth; iX++ )
@@ -585,12 +521,8 @@
       Int iXPic0        = Max( 0, Min( iYMaxPosX, iYRefPosX0 + iX ) );
       Int iXPic1        = Max( 0, Min( iYMaxPosX, iYRefPosX1 + iX ) );
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
       Pel Temp1,Temp2;
       Temp1 =( iYWeight0 * pSrcSamplesY0[iXPic0] + iYWeight1 * pSrcSamplesY0[iXPic1] + 2 ) >> 2;
       Temp2 =( iYWeight0 * pSrcSamplesY1[iXPic0] + iYWeight1 * pSrcSamplesY1[iXPic1] + 2 ) >> 2;
       pDesSamplesY[iX]  = ( iYWeight2 * Temp1 + iYWeight3 * Temp2 + 2 ) >> 2;
-#else
-      pDesSamplesY[iX]  = ( iYWeight0 * pSrcSamplesY[iXPic0] + iYWeight1 * pSrcSamplesY[iXPic1] + 2 ) >> 2;
-#endif
     }
   }
@@ -603,5 +535,4 @@
   Int           iCRefPosX0  = Int( uiXPos     >> 1 ) + ( iDisparity >> 3 );
   Int           iCRefPosX1  = iCRefPosX0             + 1;
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
   Int           iCMaxPosY   = Int( uiPicHeight >> 1 ) - 1;
   Int           iCWeight3   = ( iDisparity_y & 7 );
@@ -609,33 +540,16 @@
   Int           iCRefPosY0  = Max( 0, Min( iCMaxPosY, Int( uiYPos >> 1 )     + ( iDisparity_y >> 3 )) );
   Int           iCRefPosY1  = Max( 0, Min( iCMaxPosY, iCRefPosY0 + 1 ));
-#endif
   Int           iCMaxPosX   = Int( uiPicWidth >> 1 ) - 1;
   Int           iSrcStrideC = pcBaseRes->getCStride();
   Int           iDesStrideC = pcYuv    ->getCStride();
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
-#if FIX_CHROMA_RESIDUAL_C0129
+
   Pel*          pSrcSamplesU0= pcBaseRes->getCbAddr ( 0 ) + iCRefPosY0 * iSrcStrideC;
   Pel*          pSrcSamplesU1= pcBaseRes->getCbAddr ( 0 ) + iCRefPosY1 * iSrcStrideC;
   Pel*          pSrcSamplesV0= pcBaseRes->getCrAddr ( 0 ) + iCRefPosY0 * iSrcStrideC;
   Pel*          pSrcSamplesV1= pcBaseRes->getCrAddr ( 0 ) + iCRefPosY1 * iSrcStrideC;
-#else
-  Pel*          pSrcSamplesU0= pcBaseRes->getCbAddr ( 0 ) + ( iCRefPosY0 >> 1 ) * iSrcStrideC;
-  Pel*          pSrcSamplesU1= pcBaseRes->getCbAddr ( 0 ) + ( iCRefPosY1 >> 1 ) * iSrcStrideC;
-  Pel*          pSrcSamplesV0= pcBaseRes->getCrAddr ( 0 ) + ( iCRefPosY0 >> 1 ) * iSrcStrideC;
-  Pel*          pSrcSamplesV1= pcBaseRes->getCrAddr ( 0 ) + ( iCRefPosY1 >> 1 ) * iSrcStrideC;
-#endif
-#else
-  Pel*          pSrcSamplesU= pcBaseRes->getCbAddr ( 0 ) + ( uiYPos >> 1 ) * iSrcStrideC;
-  Pel*          pSrcSamplesV= pcBaseRes->getCrAddr ( 0 ) + ( uiYPos >> 1 ) * iSrcStrideC;
-#endif
   Pel*          pDesSamplesU= pcYuv    ->getCbAddr ();
   Pel*          pDesSamplesV= pcYuv    ->getCrAddr ();
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
   for(   Int iY = 0; iY < iCHeight; iY++, pSrcSamplesU0 += iSrcStrideC, pSrcSamplesU1 += iSrcStrideC, pDesSamplesU += iDesStrideC,
                                           pSrcSamplesV0 += iSrcStrideC, pSrcSamplesV1 += iSrcStrideC, pDesSamplesV += iDesStrideC )
-#else
-  for(   Int iY = 0; iY < iCHeight; iY++, pSrcSamplesU += iSrcStrideC, pDesSamplesU += iDesStrideC,
-                                          pSrcSamplesV += iSrcStrideC, pDesSamplesV += iDesStrideC )
-#endif
   {
     for( Int iX = 0; iX < iCWidth; iX++ )
@@ -643,5 +557,4 @@
       Int iXPic0        = Max( 0, Min( iCMaxPosX, iCRefPosX0 + iX ) );
       Int iXPic1        = Max( 0, Min( iCMaxPosX, iCRefPosX1 + iX ) );
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
       Pel Temp1,Temp2;
       Temp1 =( iCWeight0 * pSrcSamplesU0[iXPic0] + iCWeight1 * pSrcSamplesU0[iXPic1] + 4 ) >> 3;
@@ -651,8 +564,4 @@
       Temp2 =( iCWeight0 * pSrcSamplesV1[iXPic0] + iCWeight1 * pSrcSamplesV1[iXPic1] + 4 ) >> 3;
       pDesSamplesV[iX]  = ( iCWeight2 * Temp1 + iCWeight3 * Temp2 + 4 ) >> 3;
-#else
-      pDesSamplesU[iX]  = ( iCWeight0 * pSrcSamplesU[iXPic0] + iCWeight1 * pSrcSamplesU[iXPic1] + 4 ) >> 3;
-      pDesSamplesV[iX]  = ( iCWeight0 * pSrcSamplesV[iXPic0] + iCWeight1 * pSrcSamplesV[iXPic1] + 4 ) >> 3;
-#endif
     }
   }
Index: /trunk/source/Lib/TLibCommon/TComResidualGenerator.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComResidualGenerator.h	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComResidualGenerator.h	(revision 332)
@@ -70,11 +70,6 @@
 
 #if H3D_NBDV
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
   Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp_x, Bool bRecon );
   Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , TComMv iDisp_x, Bool bRecon );
-#else
-  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, Int iDisp, Bool bRecon ); 
-  Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , Int iDisp, Bool bRecon ); 
-#endif
 #else // H3D_NBDV
   Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, Bool bRecon ); 
@@ -90,9 +85,5 @@
   Void  xClearResidual        (                      TComYuv* pcCUResidual, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight );
 #if H3D_NBDV
-#if MTK_RELEASE_DV_CONSTRAINT_C0129
   Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  );    
-#else
-  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  ); 
-#endif
 #else
   Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  ); 
Index: /trunk/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 332)
@@ -306,9 +306,5 @@
 
 #if RWTH_SDC_DLT_B0036
-#if SAIT_SDC_C0096
 UInt g_auiSDCPredModes[RWTH_SDC_NUM_PRED_MODES] = { DC_IDX, DMM_WEDGE_FULL_IDX, PLANAR_IDX };
-#else
-UInt g_auiSDCPredModes[RWTH_SDC_NUM_PRED_MODES] = { DC_IDX, DMM_WEDGE_FULL_IDX, DMM_WEDGE_PREDDIR_IDX, PLANAR_IDX };
-#endif
 #endif
 
Index: /trunk/source/Lib/TLibCommon/TComRom.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComRom.h	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComRom.h	(revision 332)
@@ -194,9 +194,5 @@
 
 #if RWTH_SDC_DLT_B0036
-#if SAIT_SDC_C0096
 #define RWTH_SDC_NUM_PRED_MODES 3
-#else
-#define RWTH_SDC_NUM_PRED_MODES 4
-#endif
 extern      UInt g_auiSDCPredModes[RWTH_SDC_NUM_PRED_MODES];
 #endif
Index: /trunk/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 332)
@@ -1546,5 +1546,5 @@
 , m_bUseDMM34                   (false)
 #endif
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
 , m_bUseQTLPC                 (false)
 #endif
Index: /trunk/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComSlice.h	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComSlice.h	(revision 332)
@@ -375,5 +375,5 @@
 #endif
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   Bool m_bUseQTLPC;
 #endif
@@ -617,5 +617,5 @@
 #endif
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   Void setUseQTLPC( Bool b ) { m_bUseQTLPC = b;    }
   Bool getUseQTLPC()         { return m_bUseQTLPC; }
Index: /trunk/source/Lib/TLibCommon/TComYuv.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComYuv.cpp	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComYuv.cpp	(revision 332)
@@ -392,12 +392,4 @@
 }
 
-#if LG_RESTRICTEDRESPRED_M24766  && !MTK_MDIVRP_C0138
-Void
-TComYuv::add(Int *iPUResiPredShift, PartSize uhPartitionSize,  TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract )
-{
-  addLuma   (iPUResiPredShift, uhPartitionSize, pcYuvAdd, iWidth,    iHeight,    bSubtract );
-  addChroma (iPUResiPredShift, uhPartitionSize, pcYuvAdd, iWidth>>1, iHeight>>1, bSubtract );
-}
-#else
 Void
 TComYuv::add( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract )
@@ -406,40 +398,8 @@
   addChroma ( pcYuvAdd, iWidth>>1, iHeight>>1, bSubtract );
 }
-#endif
-
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-Void
-TComYuv::getPUXYOffset(PartSize uhPartitionSize, Int iWidth, Int iHeight, Int &iXOffset, Int &iYOffset)
-{
-  switch(uhPartitionSize)
-  {    
-  case SIZE_2NxN:
-    iXOffset = iWidth;      iYOffset = iHeight >> 1;   break;
-  case SIZE_2NxnU:
-    iXOffset = iWidth;      iYOffset = iHeight >> 2;   break;
-  case SIZE_2NxnD: 
-    iXOffset = iWidth;      iYOffset = (iHeight >> 1) + (iHeight >> 2);   break;
-  case SIZE_Nx2N:
-    iXOffset = iWidth >> 1; iYOffset = iHeight; break;
-  case SIZE_nLx2N:
-    iXOffset = iWidth >> 2; iYOffset = iHeight; break;
-  case SIZE_nRx2N:
-    iXOffset = (iWidth >> 1) + (iWidth >> 2); iYOffset = iHeight; break;
-  case SIZE_NxN:
-    iXOffset = iWidth >> 1; iYOffset = iHeight >> 1;  break;
-  default:
-    assert(uhPartitionSize == SIZE_2Nx2N);
-    iXOffset = iWidth;     iYOffset = iHeight;    break;
-  }
-}
-#endif
-
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-Void 
-TComYuv::addLuma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract )
-#else
+
+
 Void
 TComYuv::addLuma( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract )
-#endif
 {
   Int   iScale      = ( bSubtract ? -1 : 1 );
@@ -449,47 +409,4 @@
   Pel*  pDstSamples = getLumaAddr();
 
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-  Int iXOffset, iYOffset;
-
-  getPUXYOffset(uhPartitionSize, iWidth, iHeight, iXOffset, iYOffset);
-
-  for( Int iY = 0; iY < iYOffset; iY++, pDstSamples += iDstStride, pAddSamples += iAddStride )
-  {
-    if(iPUResiPredShift[0] >= 0)
-    {
-      for( Int iX = 0; iX < iXOffset; iX++ )
-      {
-        pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[0]);
-      }
-    }
-
-    if(iPUResiPredShift[1] >= 0)
-    {
-      for( Int iX = iXOffset; iX < iWidth; iX++ )
-      {
-        pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[1]);
-      }
-    }
-  }
-
-  for( Int iY = iYOffset; iY < iHeight; iY++, pDstSamples += iDstStride, pAddSamples += iAddStride )
-  {
-    if(iPUResiPredShift[2] >= 0)
-    {
-      for( Int iX = 0; iX < iXOffset; iX++ )
-      {
-        pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[2]);
-      }
-    }
-
-    if(iPUResiPredShift[3] >= 0)
-    {
-      for( Int iX = iXOffset; iX < iWidth; iX++ )
-      {
-        pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[3]);
-      }
-    }
-  }
-#else
   for( Int iY = 0; iY < iHeight; iY++, pDstSamples += iDstStride, pAddSamples += iAddStride )
   {
@@ -499,14 +416,8 @@
     }
   }
-#endif
-}
-
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-Void 
-TComYuv::addChroma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract )
-#else
+}
+
 Void
 TComYuv::addChroma( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract )
-#endif
 {
   Int   iScale        = ( bSubtract ? -1 : 1 );
@@ -518,53 +429,4 @@
   Pel*  pDstSamplesCr = getCrAddr();
 
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-  Int iXOffset, iYOffset;
- 
-  getPUXYOffset(uhPartitionSize, iWidth, iHeight, iXOffset, iYOffset);
-
-  for( Int iY = 0; iY < iYOffset; iY++, pDstSamplesCb += iDstStride, pAddSamplesCb += iAddStride,
-    pDstSamplesCr += iDstStride, pAddSamplesCr += iAddStride  )
-  {
-    if(iPUResiPredShift[0] >= 0)
-    {
-      for( Int iX = 0; iX < iXOffset; iX++ )
-      {
-        pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[0]);
-        pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[0]);
-      }
-    }
-
-    if(iPUResiPredShift[1] >= 0)
-    {
-      for( Int iX = iXOffset; iX < iWidth; iX++ )
-      {
-        pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[1]);
-        pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[1]);
-      }
-    }
-  }
-
-  for( Int iY = iYOffset; iY < iHeight; iY++, pDstSamplesCb += iDstStride, pAddSamplesCb += iAddStride,
-    pDstSamplesCr += iDstStride, pAddSamplesCr += iAddStride  )
-  {
-    if(iPUResiPredShift[2] >= 0)
-    {
-      for( Int iX = 0; iX < iXOffset; iX++ )
-      {
-        pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[2]);
-        pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[2]);
-      }
-    }
-
-    if(iPUResiPredShift[3] >= 0)
-    {
-      for( Int iX = iXOffset; iX < iWidth; iX++ )
-      {
-        pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[3]);
-        pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[3]);
-      }
-    }
-  }
-#else
   for( Int iY = 0; iY < iHeight; iY++, pDstSamplesCb += iDstStride, pAddSamplesCb += iAddStride,
                                        pDstSamplesCr += iDstStride, pAddSamplesCr += iAddStride  )
@@ -576,5 +438,4 @@
     }
   }
-#endif
 }
 
@@ -676,11 +537,4 @@
 }
 
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-Void TComYuv::subtract(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )
-{
-  subtractLuma  (iPUResiPredShift, uhPartitionSize, pcYuvSrc0, pcYuvSrc1,  uiTrUnitIdx, uiPartSize    );
-  subtractChroma(iPUResiPredShift, uhPartitionSize, pcYuvSrc0, pcYuvSrc1,  uiTrUnitIdx, uiPartSize>>1 );
-}
-#else
 Void TComYuv::subtract( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )
 {
@@ -688,11 +542,6 @@
   subtractChroma( pcYuvSrc0, pcYuvSrc1,  uiTrUnitIdx, uiPartSize>>1 );
 }
-#endif
-
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-Void TComYuv::subtractLuma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )
-#else
+
 Void TComYuv::subtractLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )
-#endif
 {
   Int x, y;
@@ -706,26 +555,9 @@
   Int  iDstStride  = getStride();
 
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-  Int iXOffset, iYOffset;
-
-  getPUXYOffset(uhPartitionSize, uiPartSize, uiPartSize, iXOffset, iYOffset);
-
-#if FIX_LG_RESTRICTEDRESPRED_M24766
-  for ( y = 0; y < iYOffset; y++ )
-  {
-    if(iPUResiPredShift[0] >= 0)
-    {
-      for ( x = 0; x < iXOffset; x++ )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[0]);
-      }
-    }
-
-    if(iPUResiPredShift[1] >= 0)
-    {
-      for ( x = iXOffset; x < uiPartSize; x++ )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[1]);
-      }
+  for ( y = uiPartSize-1; y >= 0; y-- )
+  {
+    for ( x = uiPartSize-1; x >= 0; x-- )
+    {
+      pDst[x] = pSrc0[x] - pSrc1[x];
     }
     pSrc0 += iSrc0Stride;
@@ -733,90 +565,7 @@
     pDst  += iDstStride;
   }
-
-  for ( y = iYOffset; y < uiPartSize; y++ )
-  {
-    if(iPUResiPredShift[2] >= 0)
-    {
-      for ( x = 0; x < iXOffset; x++ )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
-      }
-    }
-
-    if(iPUResiPredShift[3] >= 0)
-    {
-      for ( x = iXOffset; x < uiPartSize; x++ )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
-      }
-    }
-    pSrc0 += iSrc0Stride;
-    pSrc1 += iSrc1Stride;
-    pDst  += iDstStride;
-  }
-#else
-  for ( y = uiPartSize-1; y >= iYOffset; y-- )
-  {
-    if(iPUResiPredShift[3] >= 0)
-    {
-      for ( x = uiPartSize-1; x >= iXOffset; x-- )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
-      }
-    }
-
-    if(iPUResiPredShift[2] >= 0)
-    {
-      for ( x = iXOffset-1; x >= 0; x-- )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
-      }
-    }
-    pSrc0 += iSrc0Stride;
-    pSrc1 += iSrc1Stride;
-    pDst  += iDstStride;
-  }
-
-  for ( y = iYOffset-1; y >= 0; y-- )
-  {
-    if(iPUResiPredShift[1] >= 0)
-    {
-      for ( x = uiPartSize-1; x >= iXOffset; x-- )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
-      }
-    }
-
-    if(iPUResiPredShift[0] >= 0)
-    {
-      for ( x = iXOffset-1; x >= 0; x-- )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
-      }
-    }
-    pSrc0 += iSrc0Stride;
-    pSrc1 += iSrc1Stride;
-    pDst  += iDstStride;
-  }
-#endif
-#else
-  for ( y = uiPartSize-1; y >= 0; y-- )
-  {
-    for ( x = uiPartSize-1; x >= 0; x-- )
-    {
-      pDst[x] = pSrc0[x] - pSrc1[x];
-    }
-    pSrc0 += iSrc0Stride;
-    pSrc1 += iSrc1Stride;
-    pDst  += iDstStride;
-  }
-#endif
-}
-
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-Void TComYuv::subtractChroma(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )
-#else
+}
+
 Void TComYuv::subtractChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )
-#endif
 {
   Int x, y;
@@ -832,28 +581,10 @@
   Int  iSrc1Stride = pcYuvSrc1->getCStride();
   Int  iDstStride  = getCStride();
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-  Int iXOffset, iYOffset;
- 
-  getPUXYOffset(uhPartitionSize, uiPartSize, uiPartSize, iXOffset, iYOffset);
-
-#if FIX_LG_RESTRICTEDRESPRED_M24766
-  for ( y = 0; y < iYOffset; y++ )
-  {
-    if(iPUResiPredShift[0] >= 0)
-    {
-      for ( x = 0; x < iXOffset; x++ )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[0]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[0]);
-      }
-    }
-
-    if(iPUResiPredShift[1] >= 0)
-    {
-      for ( x = iXOffset; x < uiPartSize; x++ )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[1]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[1]);
-      }
+  for ( y = uiPartSize-1; y >= 0; y-- )
+  {
+    for ( x = uiPartSize-1; x >= 0; x-- )
+    {
+      pDstU[x] = pSrcU0[x] - pSrcU1[x];
+      pDstV[x] = pSrcV0[x] - pSrcV1[x];
     }
     pSrcU0 += iSrc0Stride;
@@ -864,102 +595,4 @@
     pDstV  += iDstStride;
   }
-
-  for ( y = iYOffset; y < uiPartSize; y++ )
-  {
-    if(iPUResiPredShift[2] >= 0)
-    {
-      for ( x = 0; x < iXOffset; x++ )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[2]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[2]);
-      }
-    }
-
-    if(iPUResiPredShift[3] >= 0)
-    {
-      for ( x = iXOffset; x < uiPartSize; x++ )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[3]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[3]);
-      }
-    }
-    pSrcU0 += iSrc0Stride;
-    pSrcU1 += iSrc1Stride;
-    pSrcV0 += iSrc0Stride;
-    pSrcV1 += iSrc1Stride;
-    pDstU  += iDstStride;
-    pDstV  += iDstStride;
-  }
-#else
-  for ( y = uiPartSize-1; y >= iYOffset; y-- )
-  {
-    if(iPUResiPredShift[3] >= 0)
-    {
-      for ( x = uiPartSize-1; x >= iXOffset; x-- )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[3]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[3]);
-      }
-    }
-
-    if(iPUResiPredShift[2] >= 0)
-    {
-      for ( x = iXOffset-1; x >= 0; x-- )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[2]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[2]);
-      }
-    }
-    pSrcU0 += iSrc0Stride;
-    pSrcU1 += iSrc1Stride;
-    pSrcV0 += iSrc0Stride;
-    pSrcV1 += iSrc1Stride;
-    pDstU  += iDstStride;
-    pDstV  += iDstStride;
-  }
-
-  for ( y = iYOffset-1; y >= 0; y-- )
-  {
-    if(iPUResiPredShift[1] >= 0)
-    {
-      for ( x = uiPartSize-1; x >= iXOffset; x-- )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[1]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[1]);
-      }
-    }
-
-    if(iPUResiPredShift[0] >= 0)
-    {
-      for ( x = iXOffset-1; x >= 0; x-- )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[0]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[0]);
-      }
-    }
-    pSrcU0 += iSrc0Stride;
-    pSrcU1 += iSrc1Stride;
-    pSrcV0 += iSrc0Stride;
-    pSrcV1 += iSrc1Stride;
-    pDstU  += iDstStride;
-    pDstV  += iDstStride;
-  }
-#endif
-#else
-  for ( y = uiPartSize-1; y >= 0; y-- )
-  {
-    for ( x = uiPartSize-1; x >= 0; x-- )
-    {
-      pDstU[x] = pSrcU0[x] - pSrcU1[x];
-      pDstV[x] = pSrcV0[x] - pSrcV1[x];
-    }
-    pSrcU0 += iSrc0Stride;
-    pSrcU1 += iSrc1Stride;
-    pSrcV0 += iSrc0Stride;
-    pSrcV1 += iSrc1Stride;
-    pDstU  += iDstStride;
-    pDstV  += iDstStride;
-  }
-#endif
 }
 
Index: /trunk/source/Lib/TLibCommon/TComYuv.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComYuv.h	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TComYuv.h	(revision 332)
@@ -146,14 +146,7 @@
   Void    addClipPartLuma   ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ); //GT
 
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-  //  pcYuvSrc0 - pcYuvSrc1 -> m_apiBuf
-  Void    subtract          (Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize );
-  Void    subtractLuma      (Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize );
-  Void    subtractChroma    (Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize );
-#else
   Void    subtract          ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize );
   Void    subtractLuma      ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize );
   Void    subtractChroma    ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize );
-#endif
   
   //  (pcYuvSrc0 + pcYuvSrc1)/2 for YUV partition
@@ -166,14 +159,7 @@
   //   Remove High frequency
   Void    removeHighFreq    ( TComYuv* pcYuvSrc, UInt uiPartIdx, UInt uiWidht, UInt uiHeight );
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-  Void    getPUXYOffset     (PartSize uhPartitionSize, Int iWidth, Int iHeight, Int &iXOffset, Int &iYOffset);
-  Void    add               (Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract = false );
-  Void    addLuma           (Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract );
-  Void    addChroma         (Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract );
-#else
   Void    add               ( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract = false );
   Void    addLuma           ( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract );
   Void    addChroma         ( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract );
-#endif
 
   Void    clip              ( Int iWidth, Int iHeight );
Index: /trunk/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TypeDef.h	(revision 331)
+++ /trunk/source/Lib/TLibCommon/TypeDef.h	(revision 332)
@@ -57,19 +57,14 @@
 #define HHI_DMM_PRED_TEX                  1   // depth model modes dependent on texture (inter-component Wedgelet and Contour prediction )
                                               // HHIQC_DMMFASTSEARCH_B0039, fast Wedgelet search for DMM modes 1 and 3
+                                              // HHI_DMM_DELTADC_Q1_C0034   JCT3V-C0034: no quantization and fast encoder search for DMM delta DC values
+                                              // FIX_DMM_CTX_INIT_C0034 JCT3V-C0034 fix for wrong init type of DMM contexts (UChar instead of Short)
 
 #define LGE_EDGE_INTRA_A0070              1   // JCT3V-A0070
-
-#define HHI_DMM_DELTADC_Q1_C0034          1   // JCT3V-C0034: no quantization and fast encoder search for DMM delta DC values
-#if ( HHI_DMM_PRED_TEX || HHI_DMM_WEDGE_INTRA ) && HHI_DMM_PRED_TEX
 #define LGE_DMM3_SIMP_C0044               1
-#endif
-#define FIX_DMM_CTX_INIT_C0034            1   // JCT3V-C0034 fix for wrong init type of DMM contexts (UChar instead of Short)
 
 ///// ***** SDC *********
 #define RWTH_SDC_DLT_B0036                1   // JCT3V-B0036: Simplified Depth Coding + Depth Lookup Table
-#if RWTH_SDC_DLT_B0036
-#define SAIT_SDC_C0096                    1   // JCT3V-C0096: Improved Simple Depth Coding(removal of DMM2 among four SDC modes(DC, Planar, DMM1 and DMM2))
-#endif
-#define FIX_SDC_ENC_C0143                 1   // JCT3V-C0143 fix for unnecessary encoder checks in case of SDC
+                                              // SAIT_SDC_C0096 JCT3V-C0096: Improved Simple Depth Coding(removal of DMM2 among four SDC modes(DC, Planar, DMM1 and DMM2))
+                                              // FIX_SDC_ENC_C0143, JCT3V-C0143 fix for unnecessary encoder checks in case of SDC
 
 ///// ***** TMVP/AMVP *********
@@ -87,6 +82,6 @@
                                               // OL_DISMV_POS_B0069            , different pos for disparity MV candidate, B0069
                                               // MTK_INTERVIEW_MERGE_A0049     , second part
-#define QC_AMVP_MRG_UNIFY_IVCAN_C0051     1
-#define QC_C0051_FIXED_BY_MTK             1   // Bug fix for C0051 implementation
+                                              // QC_C0051_FIXED_BY_MTK             1   // Bug fix for C0051 implementation
+                                              // QC_AMVP_MRG_UNIFY_IVCAN_C0051     1
 
 
@@ -95,14 +90,8 @@
                                               // HHI_INTER_VIEW_RESIDUAL_PRED
                                               // QC_SIMPLIFIEDIVRP_M24938 
-#if H3D_IVRP       
-#define LG_RESTRICTEDRESPRED_M24766       1   // Restricted inter-view residual prediction
-#define FIX_LG_RESTRICTEDRESPRED_M24766   1
-#else                                  
-#define LG_RESTRICTEDRESPRED_M24766       0
-#endif
-
-#define MTK_MDIVRP_C0138                  1   // Mode-dependent inter-view residual prediction
-#define MTK_C0138_FIXED                   1   // Fix for IBP coding structure in view direction (not CTC)
-
+                                              // MTK_C0138_FIXED                   // Fix for IBP coding structure in view direction (not CTC)
+                                              // MTK_MDIVRP_C0138
+                                              // LG_RESTRICTEDRESPRED_M24766       1   // Restricted inter-view residual prediction
+                                              // FIX_LG_RESTRICTEDRESPRED_M24766   1
 
 ///// ***** DISPARITY VECTOR DERIVATION *********
@@ -117,9 +106,9 @@
                                               // FIX_LGE_IVMP_PARALLEL_MERGE_B0136
 
-#define QC_NBDV_LDB_FIX_C0055             1   // JCT3V-C0055
-#define MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097     1   // JCT3V-C0141/C0097
-#define MTK_RELEASE_DV_CONSTRAINT_C0129   1   // JCT3V-C0129
-#define MTK_SIMPLIFY_DVTC_C0135           1   // JCT3V-C0135
-#define FIX_CHROMA_RESIDUAL_C0129         1 
+                                              // QC_NBDV_LDB_FIX_C0055
+                                              // MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097
+                                              // MTK_RELEASE_DV_CONSTRAINT_C0129   
+                                              // MTK_SIMPLIFY_DVTC_C0135           
+                                              // FIX_CHROMA_RESIDUAL_C0129         
 
 ///// ***** MOTION PARAMETER INHERITANCE  *********
@@ -145,7 +134,7 @@
 ///// ***** ILLUMINATION COMPENSATON *********
 #define LGE_ILLUCOMP_B0045                1   // JCT2-B0045 Illumination compensation for Luma and Chroma
+                                              // LGE_ILLUCOMP_B0045_ENCSIMP
+                                              // FIX_LGE_ILLUCOMP_B0045            
 #if LGE_ILLUCOMP_B0045
-#define LGE_ILLUCOMP_B0045_ENCSIMP        1
-#define FIX_LGE_ILLUCOMP_B0045            1
 #define LGE_ILLUCOMP_DEPTH_C0046          1   // JCT2-C0046 Apply illumination compensation to depth
 #if LGE_ILLUCOMP_DEPTH_C0046
@@ -158,6 +147,6 @@
 
 ///// ***** QUADTREE LIMITATION *********
-#define OL_QTLIMIT_PREDCODING_B0068       1    //JCT3V-B0068
-#define HHI_QTLPC_RAU_OFF_C0160           1   // JCT3V-C0160 change 2: quadtree limitation and predictive coding switched off in random access units 
+#define H3D_QTL                            1 // OL_QTLIMIT_dPREDCODING_B0068 //JCT3V-B0068
+                                             // HHI_QTLPC_RAU_OFF_C0160     // JCT3V-C0160 change 2: quadtree limitation and predictive coding switched off in random access units 
 
 ///// ***** OTHERS *********
@@ -186,4 +175,6 @@
 ///// ***** VSP *********
 #define MERL_VSP_C0152                    1 // JCT3V-C0152: 1: enable VSP-related tools; 0: disable VSP-related tools
+                                            // LGE_SIMP_DVP_REFINE_C0112            
+                                            // MERL_MTK_VSP_DVP_REFINE_C0152_C0131
 #if MERL_VSP_C0152
 #define MERL_VSP_C0152_BugFix_ForNoDepthCase     1// MERL bugfix for test condition of no depth
@@ -205,16 +196,13 @@
 
 #define MERL_VSP_COMPENSATION_C0152          1 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add   (nocand).
-#define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  1 // JCT3V-C0152 && JCT3V-C0131: 1: refine disparity vector using a warped depth block; 0: not to refine  (mvp2off).
+
 
 #define MERL_VSP_BLOCKSIZE_C0152             4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4.
 #define VSP_MERGE_POS                        5 // JCT3V-C0152: fixed position of VSP candidate in merge list, supported values: 5.
-#define LGE_SIMP_DVP_REFINE_C0112            1 // JCT3V-C0112: 1: simplification of refining disparity vector using a warped depth block
-#define MTK_DVPREFINE_BVSP_BUG_FIX               1
+                                               //MTK_DVPREFINE_BVSP_BUG_FIX               1
 
 #else // !MERL_VSP_C0152
 #define MERL_VSP_COMPENSATION_C0152          0 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add
-#define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  0 // JCT3V-C0152 && JCT3V-C0131: 1: refine disparity vector using a warped depth block; 0: not to refine
 #define MERL_VSP_BLOCKSIZE_C0152             4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4.
-#define LGE_SIMP_DVP_REFINE_C0112            0 // JCT3V-C0112: 1: simplification of refining disparity vector using a warped depth block
 #endif
 
@@ -223,4 +211,5 @@
 #if H3D_NBDV                    
 #define DIS_CANS                          1
+#define MCP_DIS_CANS                      7
 #endif                                  
 
Index: /trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 331)
+++ /trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 332)
@@ -1206,5 +1206,5 @@
 #endif
 #endif
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068
+#if HHI_MPI || H3D_QTL
 Void TDecCavlc::parseSPS(TComSPS* pcSPS, Bool bIsDepth)
 #else
@@ -1447,5 +1447,5 @@
     }
 #endif
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
     if( bIsDepth )
     {
Index: /trunk/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 331)
+++ /trunk/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 332)
@@ -114,5 +114,5 @@
   Void  parseVPS            ( TComVPS* pcVPS );
 #endif
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068
+#if HHI_MPI || H3D_QTL
   Void  parseSPS            ( TComSPS* pcSPS, Bool bIsDepth );
 #else
Index: /trunk/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecCu.cpp	(revision 331)
+++ /trunk/source/Lib/TLibDecoder/TDecCu.cpp	(revision 332)
@@ -409,7 +409,4 @@
     }
 #endif
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-    m_pcEntropyDecoder->decodeResPredFlag( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth], 0 );
-#endif
     xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
     return;
@@ -460,10 +457,4 @@
 #endif
 
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-  if( !pcCU->isIntra( uiAbsPartIdx ) )
-  {
-    m_pcEntropyDecoder->decodeResPredFlag    ( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth], 0 );
-  }
-#endif
 #if LGE_ILLUCOMP_DEPTH_C0046 && HHI_MPI
   }
@@ -679,5 +670,5 @@
   m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
 #endif
-#if MTK_MDIVRP_C0138
+#if H3D_IVRP
   if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0))
   {
@@ -691,24 +682,4 @@
 #endif
 
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-  if( pcCU->getResPredFlag( 0 ) )
-  {
-    AOF( pcCU->getResPredAvail( 0 ) );
-    Bool bOK = pcCU->getResidualSamples( 0, 
-#if QC_SIMPLIFIEDIVRP_M24938
-      true,
-#endif
-      m_ppcYuvResPred[uiDepth] );
-    AOF( bOK );
-#if LG_RESTRICTEDRESPRED_M24766
-    Int iPUResiPredShift[4];
-    pcCU->getPUResiPredShift(iPUResiPredShift, 0);
-    m_ppcYuvReco[uiDepth]->add(iPUResiPredShift, pcCU->getPartitionSize(0), m_ppcYuvResPred[uiDepth], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) );
-#else
-    m_ppcYuvReco[uiDepth]->add( m_ppcYuvResPred[uiDepth], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) );
-#endif
-  }
-#endif
-
   // inter recon
   xDecodeInterTexture( pcCU, 0, uiDepth );
@@ -722,9 +693,5 @@
   {
 #if H3D_IVRP
-#if MTK_MDIVRP_C0138
     if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0))
-#else
-    if( pcCU->getResPredFlag( 0 ) )
-#endif
     {
       m_ppcYuvReco[uiDepth]->clip( pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) );
Index: /trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 331)
+++ /trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 332)
@@ -108,39 +108,4 @@
 }
 
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-Void
-TDecEntropy::decodeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx )
-{
-  Bool  bResPredAvailable   = false;
-  Bool  bResPredFlag        = false;
-
-  Bool  bResPredAllowed     =                    (!pcCU->getSlice()->getSPS()->isDepth                () );
-  bResPredAllowed           = bResPredAllowed && ( pcCU->getSlice()->getSPS()->getViewId              () );
-  bResPredAllowed           = bResPredAllowed && ( pcCU->getSlice()->getSPS()->getMultiviewResPredMode() );
-  bResPredAllowed           = bResPredAllowed && (!pcCU->isIntra           ( uiAbsPartIdx )              );
-
-  // check if supported
-  if( bResPredAllowed )
-  {
-    bResPredAvailable       = pcSubCU->getResidualSamples( uiPUIdx , false  );
-  }
-
-  // read from bitstream
-  if( bResPredAvailable )
-  {
-#if LG_RESTRICTEDRESPRED_M24766
-    Int iPUResiPredShift[4];
-    pcCU->getPUResiPredShift(iPUResiPredShift, uiAbsPartIdx);
-    if(iPUResiPredShift[0] >= 0 || iPUResiPredShift[1] >= 0  || iPUResiPredShift[2] >= 0  || iPUResiPredShift[3] >= 0 )
-#endif
-    m_pcEntropyDecoderIf->parseResPredFlag( pcCU, bResPredFlag, uiAbsPartIdx, uiDepth );
-  }
-
-  // set data
-  pcCU->setResPredAvailSubParts ( bResPredAvailable, uiAbsPartIdx, uiPUIdx, uiDepth );
-  pcCU->setResPredFlagSubParts  ( bResPredFlag,      uiAbsPartIdx, uiPUIdx, uiDepth );
-}
-#endif
-
 Void TDecEntropy::decodeSplitFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
 {
Index: /trunk/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecEntropy.h	(revision 331)
+++ /trunk/source/Lib/TLibDecoder/TDecEntropy.h	(revision 332)
@@ -72,5 +72,5 @@
   virtual Void  parseVPS                  ( TComVPS* pcVPS )                       = 0;
 #endif
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068
+#if HHI_MPI || H3D_QTL
   virtual Void  parseSPS                  ( TComSPS* pcSPS, Bool bIsDepth )                       = 0;
 #else
@@ -171,5 +171,5 @@
 #endif
   
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068
+#if HHI_MPI || H3D_QTL
   Void    decodeSPS                   ( TComSPS* pcSPS, Bool bIsDepth ) { m_pcEntropyDecoderIf->parseSPS(pcSPS, bIsDepth); }
 #else
@@ -198,7 +198,4 @@
   Void decodeMergeFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
   Void decodeMergeIndex        ( TComDataCU* pcSubCU, UInt uiPartIdx, UInt uiPartAddr, PartSize eCUMode, UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, UInt uiDepth );
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-  Void decodeResPredFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx );
-#endif
   Void decodePredMode          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
   Void decodePartSize          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
Index: /trunk/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 331)
+++ /trunk/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 332)
@@ -707,5 +707,5 @@
   UInt uiSymbol;
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   Bool bParseSplitFlag    = true;
 
@@ -715,10 +715,6 @@
   Bool bIntraSliceDetect  = (pcCU->getSlice()->getSliceType() == I_SLICE);
 
-#if HHI_QTLPC_RAU_OFF_C0160
   Bool rapPic     = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);
   if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTLPC())
-#else
-  if(bDepthMapDetect && !bIntraSliceDetect && sps->getUseQTLPC())
-#endif
   {
     TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());
@@ -733,5 +729,5 @@
     DTRACE_CABAC_VL( g_nSymbolCounter++ )
     DTRACE_CABAC_T( "\tSplitFlag\n" )
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   }
   else
@@ -755,5 +751,5 @@
   PartSize eMode;
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   Bool bParsePartSize    = true;
   TComSPS *sps           = pcCU->getPic()->getSlice(0)->getSPS();
@@ -762,10 +758,6 @@
   Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);
 
-#if HHI_QTLPC_RAU_OFF_C0160
   Bool rapPic     = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);
   if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTLPC())
-#else
-  if(bDepthMapDetect && !bIntraSliceDetect && sps->getUseQTLPC())
-#endif
   {
     TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());
@@ -781,5 +773,5 @@
   if ( pcCU->isIntra( uiAbsPartIdx ) )
   {
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
     if(bParsePartSize)
     {
@@ -791,5 +783,5 @@
       }
       eMode = uiSymbol ? SIZE_2Nx2N : SIZE_NxN;
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
     }
 #endif
@@ -809,5 +801,5 @@
   else
   {
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
     if(bParsePartSize)
     {
@@ -849,5 +841,5 @@
         }
       }
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
     }
 #endif
Index: /trunk/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 331)
+++ /trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 332)
@@ -88,5 +88,5 @@
   Void  parseVPS                  ( TComVPS* pcVPS )  {}
 #endif
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068
+#if HHI_MPI || H3D_QTL
   Void  parseSPS                  ( TComSPS* pcSPS, Bool bIsDepth ) {}
 #else
Index: /trunk/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecTop.cpp	(revision 331)
+++ /trunk/source/Lib/TLibDecoder/TDecTop.cpp	(revision 332)
@@ -1257,5 +1257,5 @@
   TComRPSList* rps = new TComRPSList();
   sps->setRPSList(rps);
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068
+#if HHI_MPI || H3D_QTL
   m_cEntropyDecoder.decodeSPS( sps, m_isDepth );
 #else
Index: /trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 331)
+++ /trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 332)
@@ -442,5 +442,5 @@
 #endif
 #endif
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 
+#if HHI_MPI || H3D_QTL 
 Void TEncCavlc::codeSPS( TComSPS* pcSPS, Bool bIsDepth )
 #else
@@ -632,5 +632,5 @@
 #endif
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   if( bIsDepth )
   {
Index: /trunk/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 331)
+++ /trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 332)
@@ -114,5 +114,5 @@
 #endif
 
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 
+#if HHI_MPI || H3D_QTL 
   Void  codeSPS                 ( TComSPS* pcSPS, Bool bIsDepth );
 #else
Index: /trunk/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 331)
+++ /trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 332)
@@ -309,5 +309,5 @@
 #endif
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   Bool     m_bUseQTLPC;
 #endif
@@ -790,5 +790,5 @@
 #endif
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   Void      setUseQTLPC( Bool b ) { m_bUseQTLPC = b;    }
   Bool      getUseQTLPC()         { return m_bUseQTLPC; }
Index: /trunk/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 331)
+++ /trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 332)
@@ -420,5 +420,5 @@
   TComPic* pcPic = rpcBestCU->getPic();
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   TComSPS *sps         = pcPic->getSlice(0)->getSPS();
   TComPic *pcTexture   = rpcBestCU->getSlice()->getTexturePic();
@@ -427,7 +427,5 @@
   Bool  bIntraSliceDetect = (rpcBestCU->getSlice()->getSliceType() == I_SLICE);
 
-#if HHI_QTLPC_RAU_OFF_C0160
   Bool rapPic     = (rpcBestCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || rpcBestCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);
-#endif
 
   Bool bTry2NxN = true;
@@ -571,12 +569,8 @@
       rpcTempCU->initEstData( uiDepth, iQP );
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
       //logic for setting bTrySplit using the partition information that is stored of the texture colocated CU
 
-#if HHI_QTLPC_RAU_OFF_C0160
       if(depthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTLPC())
-#else
-      if(depthMapDetect && !bIntraSliceDetect && sps->getUseQTLPC())
-#endif
       {
         TComDataCU* pcTextureCU = pcTexture->getCU( rpcBestCU->getAddr() ); //Corresponding texture LCU
@@ -602,20 +596,6 @@
       {
 #if H3D_IVRP
-#if MTK_MDIVRP_C0138
         Bool  bResPredAvailable   = false;
         UInt uiResPrdId = 0; 
-#else
-        // check availability of residual prediction
-        Bool  bResPredAvailable   = false;
-        Bool  bResPredAllowed     =                    (!rpcBestCU->getSlice()->getSPS()->isDepth                () );
-        bResPredAllowed           = bResPredAllowed && ( rpcBestCU->getSlice()->getSPS()->getViewId              () );
-        bResPredAllowed           = bResPredAllowed && ( rpcBestCU->getSlice()->getSPS()->getMultiviewResPredMode() );
-        if( bResPredAllowed )
-        {
-          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, true , m_ppcResPredTmp[uiDepth] );
-        }
-
-        for( UInt uiResPrdId = 0; uiResPrdId < ( bResPredAvailable ? 2 : 1 ); uiResPrdId++ )
-#endif
         {
           Bool bResPredFlag  = ( uiResPrdId > 0 );
@@ -648,5 +628,5 @@
             }
           }
-#if LGE_ILLUCOMP_B0045_ENCSIMP
+#if LGE_ILLUCOMP_B0045
           if(bICFlag && rpcBestCU->getMergeFlag(0) && !rpcBestCU->getICFlag(0))
           {
@@ -661,5 +641,5 @@
             rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
 #endif
-#if FIX_LGE_ILLUCOMP_B0045
+#if LGE_ILLUCOMP_B0045
             rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
 #endif
@@ -684,15 +664,11 @@
       } // != I_SLICE
 
-#if LGE_ILLUCOMP_B0045_ENCSIMP
+#if LGE_ILLUCOMP_B0045
     bICEnabled = rpcBestCU->getICFlag(0);
 #endif
 
-#if OL_QTLIMIT_PREDCODING_B0068
-
-#if HHI_QTLPC_RAU_OFF_C0160
+#if H3D_QTL
+
       if(depthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTLPC())
-#else
-      if(depthMapDetect && !bIntraSliceDetect  && sps->getUseQTLPC())
-#endif
       {
         bTrySplitDQP = bTrySplit;
@@ -712,5 +688,5 @@
           bTrySplitDQP = bTrySplit;
         }
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
       }
 #endif
@@ -739,20 +715,6 @@
       {
 #if H3D_IVRP
-#if MTK_MDIVRP_C0138
         Bool  bResPredAvailable   = false;
         UInt uiResPrdId = 0; 
-#else
-        // check availability of residual prediction
-        Bool  bResPredAvailable   = false;
-        Bool  bResPredAllowed     =                    (!rpcBestCU->getSlice()->getSPS()->isDepth                () );
-        bResPredAllowed           = bResPredAllowed && ( rpcBestCU->getSlice()->getSPS()->getViewId              () );
-        bResPredAllowed           = bResPredAllowed && ( rpcBestCU->getSlice()->getSPS()->getMultiviewResPredMode() );
-        if( bResPredAllowed )
-        {
-          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, true, m_ppcResPredTmp[uiDepth] );
-        }
-
-        for( UInt uiResPrdId = 0; uiResPrdId < ( bResPredAvailable ? 2 : 1 ); uiResPrdId++ )
-#endif
         {
           Bool bResPredFlag  = ( uiResPrdId > 0 );
@@ -772,5 +734,5 @@
               if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && doNotBlockPu)
               {
-#if OL_QTLIMIT_PREDCODING_B0068 //try InterNxN
+#if H3D_QTL //try InterNxN
                 if(bTrySplit)
                 {
@@ -785,5 +747,5 @@
 #endif
                   rpcTempCU->initEstData( uiDepth, iQP );
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
                 }
 #endif
@@ -793,5 +755,5 @@
 
           { // 2NxN, Nx2N
-#if OL_QTLIMIT_PREDCODING_B0068 //try Nx2N
+#if H3D_QTL //try Nx2N
             if(bTryNx2N)
             {
@@ -802,5 +764,5 @@
                 rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
 #endif
-#if FIX_LGE_ILLUCOMP_B0045
+#if LGE_ILLUCOMP_B0045
                 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
 #endif
@@ -816,9 +778,9 @@
                 }
               }
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
             }
 #endif
 
-#if OL_QTLIMIT_PREDCODING_B0068 //try 2NxN
+#if H3D_QTL //try 2NxN
             if(bTry2NxN)
             {
@@ -829,5 +791,5 @@
                 rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
 #endif
-#if FIX_LGE_ILLUCOMP_B0045
+#if LGE_ILLUCOMP_B0045
                 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
 #endif
@@ -843,5 +805,5 @@
                 }
               }
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
             }
 #endif
@@ -866,5 +828,5 @@
             if ( bTestAMP_Hor )
             {
-#if OL_QTLIMIT_PREDCODING_B0068 //try 2NxnU & 2NxnD
+#if H3D_QTL //try 2NxnU & 2NxnD
               if(bTry2NxN)
               {
@@ -875,5 +837,5 @@
                   rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
 #endif
-#if FIX_LGE_ILLUCOMP_B0045
+#if LGE_ILLUCOMP_B0045
                   rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
 #endif
@@ -894,5 +856,5 @@
                   rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
 #endif
-#if FIX_LGE_ILLUCOMP_B0045
+#if LGE_ILLUCOMP_B0045
                   rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
 #endif
@@ -908,5 +870,5 @@
                   }
                 }
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
               }
 #endif
@@ -915,5 +877,5 @@
             else if ( bTestMergeAMP_Hor ) 
             {
-#if OL_QTLIMIT_PREDCODING_B0068 //try 2NxnU & 2NxnD Merge
+#if H3D_QTL //try 2NxnU & 2NxnD Merge
               if(bTry2NxN)
               {
@@ -924,5 +886,5 @@
                   rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
 #endif
-#if FIX_LGE_ILLUCOMP_B0045
+#if LGE_ILLUCOMP_B0045
                   rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
 #endif
@@ -943,5 +905,5 @@
                   rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
 #endif
-#if FIX_LGE_ILLUCOMP_B0045
+#if LGE_ILLUCOMP_B0045
                   rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
 #endif
@@ -957,5 +919,5 @@
                   }
                 }
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
               }
 #endif
@@ -966,5 +928,5 @@
             if ( bTestAMP_Ver )
             {
-#if OL_QTLIMIT_PREDCODING_B0068 //try nLx2N & nRx2N
+#if H3D_QTL //try nLx2N & nRx2N
               if(bTryNx2N)
               {
@@ -975,5 +937,5 @@
                   rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
 #endif
-#if FIX_LGE_ILLUCOMP_B0045
+#if LGE_ILLUCOMP_B0045
                   rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
 #endif
@@ -994,5 +956,5 @@
                   rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
 #endif
-#if FIX_LGE_ILLUCOMP_B0045
+#if LGE_ILLUCOMP_B0045
                   rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
 #endif
@@ -1004,5 +966,5 @@
                   rpcTempCU->initEstData( uiDepth, iQP );
                 }
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
               }
 #endif
@@ -1011,5 +973,5 @@
             else if ( bTestMergeAMP_Ver )
             {
-#if OL_QTLIMIT_PREDCODING_B0068 //try nLx2N & nRx2N (Merge)
+#if H3D_QTL //try nLx2N & nRx2N (Merge)
               if(bTryNx2N)
               {
@@ -1020,5 +982,5 @@
                   rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
 #endif
-#if FIX_LGE_ILLUCOMP_B0045
+#if LGE_ILLUCOMP_B0045
                   rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
 #endif
@@ -1039,5 +1001,5 @@
                   rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
 #endif
-#if FIX_LGE_ILLUCOMP_B0045
+#if LGE_ILLUCOMP_B0045
                   rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
 #endif
@@ -1049,5 +1011,5 @@
                   rpcTempCU->initEstData( uiDepth, iQP );
                 }
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
               }
 #endif
@@ -1143,5 +1105,5 @@
           if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
           {
-#if OL_QTLIMIT_PREDCODING_B0068 //Try IntraNxN
+#if H3D_QTL //Try IntraNxN
             if(bTrySplit)
             {
@@ -1155,5 +1117,5 @@
                 rpcTempCU->initEstData( uiDepth, iQP );
               }
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
             }
 #endif
@@ -1805,7 +1767,4 @@
         );
 #endif
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-    m_pcEntropyCoder->encodeResPredFlag( pcCU, uiAbsPartIdx, 0 );
-#endif
     finishCU(pcCU,uiAbsPartIdx,uiDepth);
     return;
@@ -1839,10 +1798,4 @@
 #endif
         );
-#endif
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-    if( !pcCU->isIntra( uiAbsPartIdx ) )
-    {
-      m_pcEntropyCoder->encodeResPredFlag( pcCU, uiAbsPartIdx, 0 );
-    }
 #endif
 #if HHI_MPI
@@ -1880,8 +1833,4 @@
   Int numValidMergeCand = 0;
 
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-  Bool  bResPrdAvail  = rpcTempCU->getResPredAvail( 0 );
-  Bool  bResPrdFlag   = rpcTempCU->getResPredFlag ( 0 );
-#endif
 #if LGE_ILLUCOMP_B0045
   Bool  bICFlag = rpcTempCU->getICFlag(0);
@@ -1916,5 +1865,5 @@
   rpcTempCU->getInterMergeCandidates( 0, 0, uhDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
 #endif
-#if MTK_MDIVRP_C0138
+#if H3D_IVRP
   Bool bResPredAvail = rpcTempCU->getResPredAvail(0);
 #endif
@@ -1978,10 +1927,5 @@
 
 #if H3D_IVRP
-#if MTK_MDIVRP_C0138
           rpcTempCU->setResPredAvailSubParts(bResPredAvail, 0, 0, uhDepth);
-#else
-          rpcTempCU->setResPredAvailSubParts( bResPrdAvail, 0, 0, uhDepth );
-          rpcTempCU->setResPredFlagSubParts ( bResPrdFlag,  0, 0, uhDepth );
-#endif
 #endif
 #if LGE_ILLUCOMP_B0045
@@ -2001,5 +1945,5 @@
             m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
 #endif
-#if MTK_MDIVRP_C0138
+#if H3D_IVRP
             if (uiMergeCand == 0 && rpcTempCU->getResPredAvail(0))
             {
@@ -2020,5 +1964,5 @@
               m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
 #endif
-#if MTK_MDIVRP_C0138
+#if H3D_IVRP
               if (uiMergeCand == 0 && rpcTempCU->getResPredAvail(0))
               {
@@ -2120,22 +2064,9 @@
 #endif
   rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
-  
-#if H3D_IVRP
-#if !LG_RESTRICTEDRESPRED_M24766
-  if( rpcTempCU->getResPredFlag( 0 ) )
-  { // subtract residual prediction from original in motion search
-    m_ppcOrigYuv[uhDepth]->add( m_ppcResPredTmp [uhDepth], rpcTempCU->getWidth( 0 ), rpcTempCU->getHeight( 0 ), true );
-  }
-#endif
-#endif
 
 #if AMP_MRG
   rpcTempCU->setMergeAMP (true);
   #if HHI_INTERVIEW_SKIP
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-  m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcResPredTmp[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bSkipRes, bUseMRG);
-#else
   m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bSkipRes, bUseMRG  );
-#endif
 #else
   m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], false, bUseMRG );
@@ -2146,13 +2077,4 @@
 #else  
   m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] );
-#endif
-#endif
-
-#if H3D_IVRP
-#if !LG_RESTRICTEDRESPRED_M24766
-  if( rpcTempCU->getResPredFlag( 0 ) )
-  { // add residual prediction to original again
-    m_ppcOrigYuv[uhDepth]->add( m_ppcResPredTmp [uhDepth], rpcTempCU->getWidth( 0 ), rpcTempCU->getHeight( 0 ) );
-  }
 #endif
 #endif
Index: /trunk/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 331)
+++ /trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 332)
@@ -122,5 +122,5 @@
 #endif
 
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 
+#if HHI_MPI || H3D_QTL 
 Void TEncEntropy::encodeSPS( TComSPS* pcSPS, Bool bIsDepth )
 {
@@ -455,28 +455,4 @@
 }
 
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-Void
-TEncEntropy::encodeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx, Bool bRD )
-{
-  if( bRD )
-  {
-    uiAbsPartIdx = 0;
-  }
-
-  // check whether flag is coded
-  ROTVS( pcCU->getSlice()->getSPS()->isDepth                () );
-  ROFVS( pcCU->getSlice()->getSPS()->getViewId              () );
-  ROFVS( pcCU->getSlice()->getSPS()->getMultiviewResPredMode() );
-  ROTVS( pcCU->isIntra           ( uiAbsPartIdx )              );
-  ROFVS( pcCU->getResPredAvail   ( uiAbsPartIdx )              );
-#if LG_RESTRICTEDRESPRED_M24766
-  Int iPUResiPredShift[4];
-  pcCU->getPUResiPredShift(iPUResiPredShift, uiAbsPartIdx);
-  if(iPUResiPredShift[0] >= 0 || iPUResiPredShift[1] >= 0  || iPUResiPredShift[2] >= 0  || iPUResiPredShift[3] >= 0 )
-#endif
-  // encode flag
-  m_pcEntropyCoderIf->codeResPredFlag( pcCU, uiAbsPartIdx );
-}
-#endif
 
 /** parse the fixed length code (smaller than one max value) in ALF
Index: /trunk/source/Lib/TLibEncoder/TEncEntropy.h
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncEntropy.h	(revision 331)
+++ /trunk/source/Lib/TLibEncoder/TEncEntropy.h	(revision 332)
@@ -80,5 +80,5 @@
 #endif
 
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 
+#if HHI_MPI || H3D_QTL 
   virtual Void  codeSPS                 ( TComSPS* pcSPS, Bool bIsDepth )                       = 0;
 #else
@@ -222,5 +222,5 @@
 #endif
   // SPS
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 
+#if HHI_MPI || H3D_QTL 
   Void encodeSPS               ( TComSPS* pcSPS, Bool bIsDepth );
 #else
@@ -250,7 +250,4 @@
   Void encodeMergeFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx );
   Void encodeMergeIndex   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx, Bool bRD = false );
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-  Void encodeResPredFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx, Bool bRD = false );
-#endif
   Void encodeAlfCtrlFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
 
Index: /trunk/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 331)
+++ /trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 332)
@@ -887,5 +887,5 @@
         m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
         pcSlice->getSPS()->setNumSubstreams( pcSlice->getPPS()->getNumSubstreams() );
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068
+#if HHI_MPI || H3D_QTL
         m_pcEntropyCoder->encodeSPS(pcSlice->getSPS(), m_pcEncTop->getIsDepth());
 #else
Index: /trunk/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 331)
+++ /trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 332)
@@ -376,5 +376,5 @@
 #endif
 
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 
+#if HHI_MPI || H3D_QTL 
 Void TEncSbac::codeSPS( TComSPS* pcSPS, Bool bIsDepth )
 #else
@@ -578,5 +578,5 @@
   PartSize eSize         = pcCU->getPartitionSize( uiAbsPartIdx );
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   TComSPS *sps           = pcCU->getPic()->getSlice(0)->getSPS();
   TComPic *pcTexture     = pcCU->getSlice()->getTexturePic();
@@ -584,10 +584,6 @@
   Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);
  
-#if HHI_QTLPC_RAU_OFF_C0160
   Bool rapPic     = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);
   if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTLPC() && pcCU->getPic()->getReduceBitsFlag())
-#else
-  if(bDepthMapDetect && !bIntraSliceDetect && sps->getUseQTLPC() && pcCU->getPic()->getReduceBitsFlag())
-#endif
   {
     TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());
@@ -855,5 +851,5 @@
   assert( uiCtx < 3 );
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   Bool bCodeSplitFlag    = true;
 
@@ -863,10 +859,6 @@
   Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);
 
-#if HHI_QTLPC_RAU_OFF_C0160
   Bool rapPic     = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);
   if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTLPC() && pcCU->getPic()->getReduceBitsFlag())
-#else
-  if(bDepthMapDetect && !bIntraSliceDetect && sps->getUseQTLPC() && pcCU->getPic()->getReduceBitsFlag())
-#endif
   {
     TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());
Index: /trunk/source/Lib/TLibEncoder/TEncSbac.h
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncSbac.h	(revision 331)
+++ /trunk/source/Lib/TLibEncoder/TEncSbac.h	(revision 332)
@@ -102,5 +102,5 @@
 #endif
   
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 
+#if HHI_MPI || H3D_QTL 
   Void  codeSPS                 ( TComSPS* pcSPS, Bool bIsDepth );
 #else
Index: /trunk/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 331)
+++ /trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 332)
@@ -2311,9 +2311,5 @@
       for( UInt uiSDC=0; uiSDC<=uiUseSDC; uiSDC++ )
       {
-#if FIX_SDC_ENC_C0143
         for( UInt uiRes = 0; uiRes<=uiSDC; uiRes++ )
-#else
-        for( UInt uiRes = 0; uiRes<=uiUseSDC; uiRes++ )
-#endif
         {
 #endif
@@ -2909,29 +2905,21 @@
  * \returns Void
  */
+
+Void TEncSearch::xMergeEstimation( TComDataCU*     pcCU,
+                                 TComYuv*        pcYuvOrg,
+                                 Int             iPUIdx,
+                                 UInt&           uiInterDir,
+                                 TComMvField*    pacMvField,
+                                 UInt&           uiMergeIndex,
+                                 UInt&           ruiCost
 #if CU_BASED_MRG_CAND_LIST
-#if LG_RESTRICTEDRESPRED_M24766
-Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, TComYuv* rpcResiPredYuv, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours, Int& numValidMergeCand )
-#else
-Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours, Int& numValidMergeCand )
-#endif
-#else
-#if LG_RESTRICTEDRESPRED_M24766
-#if MERL_VSP_C0152 || MTK_MDIVRP_C0138
-#if !MTK_MDIVRP_C0138
-Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, TComYuv* rpcResiPredYuv, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, Int* iVSPIndexTrue )
-#endif
-#if !MERL_VSP_C0152
-Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost )
-#endif
-#if MERL_VSP_C0152 && MTK_MDIVRP_C0138
-Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, Int* iVSPIndexTrue  )
-#endif
-#else
-Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, TComYuv* rpcResiPredYuv, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost )
-#endif
-#else
-Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost )
-#endif
-#endif
+                                 , TComMvField* cMvFieldNeighbours,  
+                                 UChar* uhInterDirNeighbours,
+                                 Int& numValidMergeCand
+#endif
+#if MERL_VSP_C0152
+                                 , Int* iVSPIndexTrue
+#endif
+                                 )
 {
 #if !CU_BASED_MRG_CAND_LIST
@@ -2985,8 +2973,4 @@
   const int maxNumMergeCand = MRG_MAX_NUM_CANDS_SIGNALED + ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 );
 #endif
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-  Int iPUResiPredShift[4];
-  Int iLastAddResiShift = -1000;
-#endif
   ruiCost = MAX_UINT;
   for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand )
@@ -3014,33 +2998,4 @@
         }
         pcCU->setVSPIndexSubParts( iVSPIdx, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
-      }
-#endif
-#if LG_RESTRICTEDRESPRED_M24766  && !MTK_MDIVRP_C0138
-      Int iAddResiShift;
-      UInt uiPartAddr;
-      Int iRoiWidth, iRoiHeight;
-
-      pcCU->getPartIndexAndSize( iPUIdx, uiPartAddr, iRoiWidth, iRoiHeight );
-      iAddResiShift = pcCU->getResiPredMode(uiPartAddr);
-      iAddResiShift = (pcCU->getSlice()->getPPS()->getUseWP() || pcCU->getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1 - iAddResiShift : -1);
-
-      if( pcCU->getResPredFlag( 0 ))
-      { // subtract residual prediction from original in motion search
-        if(iLastAddResiShift != iAddResiShift)
-        {
-          //add subtracted residual last time
-          if(iLastAddResiShift >= 0)
-          {
-            iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = iLastAddResiShift;
-            pcYuvOrg->add(iPUResiPredShift, ePartSize, rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ));
-          }
-          //subtract residual
-          if(iAddResiShift >= 0)
-          {
-            iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = iAddResiShift;
-            pcYuvOrg->add(iPUResiPredShift, ePartSize, rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ), true );
-          }
-          iLastAddResiShift = iAddResiShift;
-        }
       }
 #endif
@@ -3066,11 +3021,4 @@
     }
   }
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-  if( pcCU->getResPredFlag( 0 ) && iLastAddResiShift >= 0)
-  {
-    iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = iLastAddResiShift;
-    pcYuvOrg->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ));
-  }
-#endif
 }
 
@@ -3085,9 +3033,5 @@
  */
 #if AMP_MRG
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv* rpcResiPredYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG )
-#else
 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG)
-#endif
 #else
 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes )
@@ -3188,7 +3132,4 @@
     for (Int iNumRef=0; iNumRef < MAX_NUM_REF; iNumRef++) uiCostTempL0[iNumRef] = MAX_UINT;
     UInt          uiBitsTempL0[MAX_NUM_REF];
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-    Int iPUResiPredShift[4] = {0, 0, 0, 0};
-#endif
     xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits);
     
@@ -3209,7 +3150,4 @@
     {
 #endif
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-      Bool bLastResiFlag = false;
-#endif
 
     //  Uni-directional prediction
@@ -3220,21 +3158,4 @@
       for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ )
       {
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-        if( pcCU->getResPredFlag( 0 ))
-        {
-          if(pcCU->getSlice()->getViewId() == pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp))
-          { // subtract residual prediction from original in motion search
-            if(!bLastResiFlag)
-              pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ), true );
-            bLastResiFlag = true;
-          }
-          else
-          {
-            if(bLastResiFlag)
-              pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ));
-            bLastResiFlag = false;
-          }
-        }
-#endif
         uiBitsTemp = uiMbBits[iRefList];
         if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 )
@@ -3394,16 +3315,7 @@
       }
     }
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-    if( pcCU->getResPredFlag( 0 ) && bLastResiFlag)
-    { // subtract residual prediction from original in motion search
-      pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ));
-    }
-#endif
     //  Bi-directional prediction
     if ( pcCU->getSlice()->isInterB() )
     {
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-      Int iLastAddResiShift = -1000;
-#endif
       cMvBi[0] = cMv[0];            cMvBi[1] = cMv[1];
       iRefIdxBi[0] = iRefIdx[0];    iRefIdxBi[1] = iRefIdx[1];
@@ -3499,35 +3411,4 @@
 #else
           uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS];
-#endif
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-          Int iAddResiShift = -1, iPredFrom = 0;
-          Int iBestRefIdx = pcCU->getCUMvField(eRefPicList == REF_PIC_LIST_0 ? REF_PIC_LIST_1 : REF_PIC_LIST_0)->getRefIdx(uiPartAddr);
-
-          iPredFrom = iBestRefIdx >= 0 ? 3 : 1;
-          if(iBestRefIdx >= 0 && pcCU->getSlice()->getViewId() == pcCU->getSlice()->getRefViewId(eRefPicList == REF_PIC_LIST_0 ? REF_PIC_LIST_1 : REF_PIC_LIST_0, iBestRefIdx))
-            iAddResiShift++;
-          if(pcCU->getSlice()->getViewId() == pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp))
-            iAddResiShift++;
-          iAddResiShift = (pcCU->getSlice()->getPPS()->getUseWP() || iPredFrom != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
-
-          if( pcCU->getResPredFlag( 0 ) )
-          {
-            if(iLastAddResiShift != iAddResiShift)
-            {
-              //add substracted residual last time
-              if(iLastAddResiShift >= 0 )
-              {
-                iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = iLastAddResiShift;
-                pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ));
-              }
-              //substract residual
-              if(iAddResiShift >= 0)
-              {
-                iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = iAddResiShift;
-                pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ), true );
-              }
-              iLastAddResiShift = iAddResiShift;
-            }
-          }
 #endif
           // call ME
@@ -3581,11 +3462,4 @@
         }
       } // for loop-iter
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-      if( pcCU->getResPredFlag( 0 ) && iLastAddResiShift >= 0)
-      {
-        iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = iLastAddResiShift;
-        pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ));
-      }
-#endif
     } // if (B_SLICE)
 #if ZERO_MVD_EST
@@ -3796,21 +3670,6 @@
       if (bTestNormalMC)
       {
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-        Int iAddResiShift = pcCU->getResiPredMode(uiPartAddr);
-        iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = \
-          (pcCU->getSlice()->getPPS()->getUseWP() || pcCU->getInterDir(uiPartAddr) != 3)? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
-        if(pcCU->getResPredFlag(0) && iAddResiShift >= 0)
-        {
-          pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ), true);
-        }
-#endif
         xGetInterPredictionError( pcCU, pcOrgYuv, iPartIdx, uiMEError, m_pcEncCfg->getUseHADME() );
         uiMECost = uiMEError + m_pcRdCost->getCost( uiMEBits );
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-        if(pcCU->getResPredFlag(0) && iAddResiShift >= 0)
-        {
-          pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ));
-        }
-#endif
       }
 #else
@@ -3827,35 +3686,15 @@
       // find Merge result
       UInt uiMRGCost = MAX_UINT;
+
+
+xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost
 #if CU_BASED_MRG_CAND_LIST
-#if LG_RESTRICTEDRESPRED_M24766
-      xMergeEstimation( pcCU, pcOrgYuv, rpcResiPredYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
-#else
-      xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
-#endif
-#else
-#if LG_RESTRICTEDRESPRED_M24766
-#if MERL_VSP_C0152 || MTK_MDIVRP_C0138
-
-#if !MTK_MDIVRP_C0138
-      xMergeEstimation( pcCU, pcOrgYuv, rpcResiPredYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost,  iVSPIndexTrue );
-#endif
-
-#if !MERL_VSP_C0152
-      xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost );
-#endif
-
-#if MERL_VSP_C0152 && MTK_MDIVRP_C0138
-      xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost,  iVSPIndexTrue );
-#endif
-
-#else
-      xMergeEstimation( pcCU, pcOrgYuv, rpcResiPredYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost );
-#endif
-
-
-#else
-      xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost );
-#endif
-#endif
+                 , cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand,
+#endif
+#if MERL_VSP_C0152
+                 , iVSPIndexTrue
+#endif
+        );
+
       if ( uiMRGCost < uiMECost )
       {
@@ -4775,7 +4614,4 @@
   UInt      uiWidth      = pcCU->getWidth ( 0 );
   UInt      uiHeight     = pcCU->getHeight( 0 );
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-  Int       iPUResiPredShift[4];
-#endif
   //  No residual coding : SKIP mode
   if ( ePredMode == MODE_SKIP && bSkipRes )
@@ -4785,23 +4621,9 @@
     pcYuvPred->copyToPartYuv( rpcYuvRec, 0 );
     
-#if MTK_MDIVRP_C0138
+#if H3D_IVRP
     if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0))
     {
       rpcYuvRec->clip( uiWidth, uiHeight );
     }
-#else
-#if H3D_IVRP
-    // add residual prediction
-    if( pcCU->getResPredFlag( 0 ) )
-    {
-#if LG_RESTRICTEDRESPRED_M24766
-      pcCU->getPUResiPredShift(iPUResiPredShift, 0);
-      rpcYuvRec->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcYuvResPrd, uiWidth, uiHeight );
-#else
-      rpcYuvRec->add( rpcYuvResPrd, uiWidth, uiHeight );
-#endif
-      rpcYuvRec->clip( uiWidth, uiHeight );
-    }
-#endif
 #endif
 
@@ -4853,7 +4675,4 @@
       );
 #endif
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-    m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true );
-#endif
 #if HHI_MPI
     }
@@ -4922,22 +4741,5 @@
   else
   {
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-    iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = 0;
-    rpcYuvResi->subtract(iPUResiPredShift, pcCU->getPartitionSize(0), pcYuvOrg, pcYuvPred, 0, uiWidth );
-#else
   rpcYuvResi->subtract( pcYuvOrg, pcYuvPred, 0, uiWidth );
-#endif
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-    // subtract residual prediction
-    if( pcCU->getResPredFlag( 0 ) )
-    {
-#if LG_RESTRICTEDRESPRED_M24766
-      pcCU->getPUResiPredShift(iPUResiPredShift, 0);
-      rpcYuvResi->subtract(iPUResiPredShift, pcCU->getPartitionSize(0), rpcYuvResi, rpcYuvResPrd, 0, uiWidth );
-#else
-      rpcYuvResi->subtract( rpcYuvResi, rpcYuvResPrd, 0, uiWidth );
-#endif
-    }
-#endif
   }
 #else
@@ -5134,22 +4936,4 @@
 #endif
   }
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-  // add residual prediction
-  if( pcCU->getResPredFlag( 0 ) )
-  {
-    pcYuvPred->copyToPartYuv( rpcYuvRec, 0 );
-#if LG_RESTRICTEDRESPRED_M24766
-    pcCU->getPUResiPredShift(iPUResiPredShift, 0);
-    rpcYuvRec->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcYuvResPrd,   uiWidth, uiHeight );
-    iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = 0;
-    rpcYuvRec->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcYuvResiBest, uiWidth, uiHeight );
-#else
-    rpcYuvRec->add( rpcYuvResPrd,   uiWidth, uiHeight );
-    rpcYuvRec->add( rpcYuvResiBest, uiWidth, uiHeight );
-#endif
-    rpcYuvRec->clip( uiWidth, uiHeight );
-  }
-  else
-#endif
   rpcYuvRec->addClip ( pcYuvPred, rpcYuvResiBest, 0, uiWidth );
   
@@ -6170,7 +5954,4 @@
       );
 #endif
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-    m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true );
-#endif
     ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits();
   }
@@ -6196,7 +5977,4 @@
 #endif
       );
-#endif
-#if H3D_IVRP && !MTK_MDIVRP_C0138
-    m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true );
 #endif
 #if HHI_MPI
@@ -6534,10 +6312,4 @@
     Int iFullDeltaDC2 = riDeltaDC2;
 
-#if HHI_DMM_DELTADC_Q1_C0034
-#else
-    xDeltaDCQuantScaleDown( pcCU, iFullDeltaDC1 );
-    xDeltaDCQuantScaleDown( pcCU, iFullDeltaDC2 );
-#endif
-
     Dist uiBestDist     = RDO_DIST_MAX;
     UInt  uiBestQStepDC1 = 0;
@@ -6551,5 +6323,4 @@
     uiDeltaDC2Max += (uiDeltaDC2Max>>1);
 
-#if HHI_DMM_DELTADC_Q1_C0034
     // limit search range to [0, IBDI_MAX]
     if( iFullDeltaDC1 <  0 && uiDeltaDC1Max >                abs(iPredDC1) ) { uiDeltaDC1Max =                abs(iPredDC1); }
@@ -6698,68 +6469,8 @@
       }
     }
-#else
-    for( UInt uiQStepDC1 = 1; uiQStepDC1 <= uiDeltaDC1Max; uiQStepDC1++  )
-    {
-      Int iLevelDeltaDC1 = (Int)(uiQStepDC1) * (Int)(( iFullDeltaDC1 < 0 ) ? -1 : 1);
-      xDeltaDCQuantScaleUp( pcCU, iLevelDeltaDC1 );
-
-      Int iTestDC1 = Clip( iPredDC1 + iLevelDeltaDC1 );
-      for( UInt uiQStepDC2 = 1; uiQStepDC2 <= uiDeltaDC2Max; uiQStepDC2++  )
-      {
-        Int iLevelDeltaDC2 = (Int)(uiQStepDC2) * (Int)(( iFullDeltaDC2 < 0 ) ? -1 : 1);
-        xDeltaDCQuantScaleUp( pcCU, iLevelDeltaDC2 );
-
-        Int iTestDC2 = Clip( iPredDC2 + iLevelDeltaDC2 );
-
-        assignWedgeDCs2Pred( pcWedgelet, piPredic, uiStride, iTestDC1, iTestDC2 );
-        
-        Dist uiActDist = RDO_DIST_MAX;
-#if SAIT_VSO_EST_A0033
-        if ( m_pcRdCost->getUseEstimatedVSD() )
-        {          
-          TComPicYuv* pcVirRec = m_pcRdCost->getVideoRecPicYuv();
-          TComPicYuv* pcVirOrg = m_pcRdCost->getDepthPicYuv();
-          uiActDist = m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, pcVirRec->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirOrg->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirRec->getStride(), uiWidth, uiHeight );
-#if LGE_WVSO_A0119
-          if ( m_pcRdCost->getUseWVSO() )
-          {    
-            Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
-            Int iVSDWeight = m_pcRdCost->getVSDWeight() * m_pcRdCost->getVSDWeight();
-            Dist iD = (Dist) m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false, DF_SAD );
-            uiActDist = (iDWeight * iD + iVSDWeight * (Dist) uiActDist) / ( iDWeight + iVSDWeight);
-          }
-#endif // LGE_WVSO_A0119
-        }
-        else       
-#endif // SAIT_VSO_EST_A0033
-        {        
-          uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPredic, uiStride,  piOrig, uiStride, uiWidth, uiHeight, false, 0 );
-#if LGE_WVSO_A0119
-          if ( m_pcRdCost->getUseWVSO() )
-          {    
-            Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
-            Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
-            Dist iD = (Dist) m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false, DF_SAD );
-            uiActDist = (iDWeight * iD + iVSOWeight * (Dist) uiActDist) / ( iDWeight + iVSOWeight);
-          }
-#endif // LGE_WVSO_A0119
-        }
-
-        if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )
-        {
-          uiBestDist     = uiActDist;
-          uiBestQStepDC1 = uiQStepDC1;
-          uiBestQStepDC2 = uiQStepDC2;
-        }
-      }
-    }
-#endif
+
     iFullDeltaDC1 = (Int)(uiBestQStepDC1) * (Int)(( iFullDeltaDC1 < 0 ) ? -1 : 1);
     iFullDeltaDC2 = (Int)(uiBestQStepDC2) * (Int)(( iFullDeltaDC2 < 0 ) ? -1 : 1);
-#if HHI_DMM_DELTADC_Q1_C0034
-#else
-    xDeltaDCQuantScaleUp( pcCU, iFullDeltaDC1 );
-    xDeltaDCQuantScaleUp( pcCU, iFullDeltaDC2 );
-#endif
+
     riDeltaDC1 = iFullDeltaDC1;
     riDeltaDC2 = iFullDeltaDC2;
@@ -6767,9 +6478,4 @@
 #endif
 
-#if HHI_DMM_DELTADC_Q1_C0034
-#else
-  xDeltaDCQuantScaleDown( pcCU, riDeltaDC1 );
-  xDeltaDCQuantScaleDown( pcCU, riDeltaDC2 );
-#endif
 }
 #endif
Index: /trunk/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 331)
+++ /trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 332)
@@ -196,7 +196,4 @@
   Void predInterSearch          ( TComDataCU* pcCU,
                                   TComYuv*    pcOrgYuv,
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-                                  TComYuv*    rpcResiPredYuv,
-#endif
                                   TComYuv*&   rpcPredYuv,
                                   TComYuv*&   rpcResiYuv,
@@ -501,7 +498,4 @@
   Void xMergeEstimation           ( TComDataCU*     pcCU,
                                     TComYuv*        pcYuvOrg,
-#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
-                                    TComYuv*        rpcResiPredYuv, 
-#endif
                                     Int             iPartIdx,
                                     UInt&           uiInterDir,
Index: /trunk/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 331)
+++ /trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 332)
@@ -1193,5 +1193,5 @@
     }
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
     rpcPic->setReduceBitsFlag(true);
 #endif
@@ -1235,5 +1235,5 @@
     }
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
     rpcPic->setReduceBitsFlag(false);
 #endif
Index: /trunk/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 331)
+++ /trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 332)
@@ -703,5 +703,5 @@
 #endif
 
-#if OL_QTLIMIT_PREDCODING_B0068
+#if H3D_QTL
   m_cSPS.setUseQTLPC( m_bUseQTLPC );
 #endif
Index: /trunk/source/Lib/TLibExtractor/TExtrTop.cpp
===================================================================
--- /trunk/source/Lib/TLibExtractor/TExtrTop.cpp	(revision 331)
+++ /trunk/source/Lib/TLibExtractor/TExtrTop.cpp	(revision 332)
@@ -79,5 +79,5 @@
      TComRPSList cRPS;
      cSPS.setRPSList( &cRPS );
-#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068
+#if HHI_MPI || H3D_QTL
 #if VIDYO_VPS_INTEGRATION
      m_cEntropyDecoder.decodeSPS( &cSPS, m_cVPS.getDepthFlag(uiLayerId) );
