Index: branches/HTM-5.1-dev3-Mediatek/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/HTM-5.1-dev3-Mediatek/source/Lib/TLibCommon/TComDataCU.cpp	(revision 234)
+++ branches/HTM-5.1-dev3-Mediatek/source/Lib/TLibCommon/TComDataCU.cpp	(revision 245)
@@ -5631,409 +5631,5 @@
   deriveLeftBottomIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLB );
 
-  UInt uiIdx = 0;
-#if MVP_AT_ENTROPYSLICE_BOUNDARY
-  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
-#else
-  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
-#endif
-#if DV_DERIVATION_PARALLEL_B0096
-  if ( uiPartIdx == 1 && (eCUMode == SIZE_Nx2N || eCUMode == SIZE_nLx2N || eCUMode == SIZE_nRx2N) )
-  {
-    pcTmpCU = NULL;
-  }
-#endif
-#if LGE_IVMP_PARALLEL_MERGE_B0136
-  if (pcTmpCU && bParMerge) 
-  {
-    if (!pcTmpCU->isDiffMER(xP -1, yP+nPSH-1, xP, yP))
-    {
-      pcTmpCU = NULL;
-    }
-  }
-#endif
-
-#if !QC_SIMPLE_NBDV_B0047
-  pcCULeft = pcTmpCU;
-  UInt uiLeftPartIdx = uiIdx;
-#endif
-
-  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
-        {
-          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)
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
-            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 )
-          {
-            aiDvMcpDvCand[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
-            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
-    }
-  }
-
-#if MVP_AT_ENTROPYSLICE_BOUNDARY
-  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
-#else
-  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);
-#endif
-#if DV_DERIVATION_PARALLEL_B0096
-  if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) )
-  {
-    pcTmpCU = NULL;
-  }
-#endif
-#if LGE_IVMP_PARALLEL_MERGE_B0136
-  if (pcTmpCU && bParMerge) 
-  {
-    if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
-    {
-      pcTmpCU = NULL;
-    }
-  }
-#endif
-
-  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
-  {
-#if LGE_DVMCP_MEM_REDUCTION_B0135
-    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
-#endif
-    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)
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
-            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
-          }
-#endif
-          return;
-        }
-#if LGE_DVMCP_MEM_REDUCTION_B0135
-        else if(iLCUAddrDiff == 0) //MCP, within same LCU
-#else
-        else // MCP 
-#endif
-        {
-          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
-          if( cTmpMvPred.m_bDvMcp  && bTmpIsSkipped )
-          {
-            aiDvMcpDvCand[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
-            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
-    }
-  }
-
-#if MVP_AT_ENTROPYSLICE_BOUNDARY
-  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
-#else
-  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);
-#endif
-#if LGE_IVMP_PARALLEL_MERGE_B0136
-  if (pcTmpCU && bParMerge) 
-  {
-    if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP))
-    {
-      pcTmpCU = NULL;
-    }
-  }
-#endif
-
-  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
-  {
-#if LGE_DVMCP_MEM_REDUCTION_B0135
-    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
-#endif
-    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)
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
-            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
-          }
-#endif
-          return;
-        }
-#if LGE_DVMCP_MEM_REDUCTION_B0135
-        else if(iLCUAddrDiff == 0)
-#else
-        else  // MCP 
-#endif
-        {
-          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
-          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
-          {
-            aiDvMcpDvCand[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
-            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
-    }
-  }
-
-#if MVP_AT_ENTROPYSLICE_BOUNDARY
-  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
-#else
-  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);
-#endif
-#if LGE_IVMP_PARALLEL_MERGE_B0136
-  if (pcTmpCU && bParMerge)
-  {
-    if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP))
-    {
-      pcTmpCU = NULL;
-    }
-  }
-#endif
-  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)
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
-            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 )
-          {
-            aiDvMcpDvCand[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
-            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
-#if MVP_AT_ENTROPYSLICE_BOUNDARY
-  pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
-  assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
-#else
-  pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);
-#endif
-#if LGE_IVMP_PARALLEL_MERGE_B0136
-  if (pcTmpCU && bParMerge) 
-  {
-    if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP))
-    {
-      pcTmpCU = NULL;
-    }
-  }
-#endif
-
-  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
-  {
-#if LGE_DVMCP_MEM_REDUCTION_B0135
-    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
-#endif
-    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)
-              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
-            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
-          }
-#endif
-          return;
-        }
-#if LGE_DVMCP_MEM_REDUCTION_B0135
-        else if(iLCUAddrDiff <= 1)
-#else
-        else // MCP 
-#endif
-        {
-          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
-          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
-          {
-            aiDvMcpDvCand[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
-            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
   // copied from getInterMergeCand()
   if ( getSlice()->getPPS()->getEnableTMVPFlag() )
@@ -6324,4 +5920,699 @@
 #endif
   } // if TMVP Flag
+#endif
+  UInt uiIdx = 0;
+#if MVP_AT_ENTROPYSLICE_BOUNDARY
+  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
+#else
+  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
+#endif
+#if DV_DERIVATION_PARALLEL_B0096
+  if ( uiPartIdx == 1 && (eCUMode == SIZE_Nx2N || eCUMode == SIZE_nLx2N || eCUMode == SIZE_nRx2N) )
+  {
+    pcTmpCU = NULL;
+  }
+#endif
+#if LGE_IVMP_PARALLEL_MERGE_B0136
+  if (pcTmpCU && bParMerge) 
+  {
+    if (!pcTmpCU->isDiffMER(xP -1, yP+nPSH-1, xP, yP))
+    {
+      pcTmpCU = NULL;
+    }
+  }
+#endif
+
+#if !QC_SIMPLE_NBDV_B0047
+  pcCULeft = pcTmpCU;
+  UInt uiLeftPartIdx = uiIdx;
+#endif
+
+  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
+        {
+          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)
+              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
+            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 )
+          {
+            aiDvMcpDvCand[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
+            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
+    }
+  }
+
+#if MVP_AT_ENTROPYSLICE_BOUNDARY
+  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
+#else
+  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);
+#endif
+#if DV_DERIVATION_PARALLEL_B0096
+  if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) )
+  {
+    pcTmpCU = NULL;
+  }
+#endif
+#if LGE_IVMP_PARALLEL_MERGE_B0136
+  if (pcTmpCU && bParMerge) 
+  {
+    if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
+    {
+      pcTmpCU = NULL;
+    }
+  }
+#endif
+
+  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
+  {
+#if LGE_DVMCP_MEM_REDUCTION_B0135
+    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
+#endif
+    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)
+              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
+            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
+            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
+          }
+#endif
+          return;
+        }
+#if LGE_DVMCP_MEM_REDUCTION_B0135
+        else if(iLCUAddrDiff == 0) //MCP, within same LCU
+#else
+        else // MCP 
+#endif
+        {
+          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
+          if( cTmpMvPred.m_bDvMcp  && bTmpIsSkipped )
+          {
+            aiDvMcpDvCand[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
+            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
+    }
+  }
+
+#if MVP_AT_ENTROPYSLICE_BOUNDARY
+  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
+#else
+  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);
+#endif
+#if LGE_IVMP_PARALLEL_MERGE_B0136
+  if (pcTmpCU && bParMerge) 
+  {
+    if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP))
+    {
+      pcTmpCU = NULL;
+    }
+  }
+#endif
+
+  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
+  {
+#if LGE_DVMCP_MEM_REDUCTION_B0135
+    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
+#endif
+    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)
+              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
+            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
+            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
+          }
+#endif
+          return;
+        }
+#if LGE_DVMCP_MEM_REDUCTION_B0135
+        else if(iLCUAddrDiff == 0)
+#else
+        else  // MCP 
+#endif
+        {
+          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
+          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
+          {
+            aiDvMcpDvCand[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
+            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
+    }
+  }
+
+#if MVP_AT_ENTROPYSLICE_BOUNDARY
+  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
+#else
+  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);
+#endif
+#if LGE_IVMP_PARALLEL_MERGE_B0136
+  if (pcTmpCU && bParMerge)
+  {
+    if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP))
+    {
+      pcTmpCU = NULL;
+    }
+  }
+#endif
+  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)
+              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
+            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 )
+          {
+            aiDvMcpDvCand[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
+            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
+#if MVP_AT_ENTROPYSLICE_BOUNDARY
+  pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
+  assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
+#else
+  pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);
+#endif
+#if LGE_IVMP_PARALLEL_MERGE_B0136
+  if (pcTmpCU && bParMerge) 
+  {
+    if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP))
+    {
+      pcTmpCU = NULL;
+    }
+  }
+#endif
+
+  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
+  {
+#if LGE_DVMCP_MEM_REDUCTION_B0135
+    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
+#endif
+    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)
+              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
+            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
+            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
+          }
+#endif
+          return;
+        }
+#if LGE_DVMCP_MEM_REDUCTION_B0135
+        else if(iLCUAddrDiff <= 1)
+#else
+        else // MCP 
+#endif
+        {
+          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
+          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
+          {
+            aiDvMcpDvCand[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
+            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
+  // copied from getInterMergeCand()
+  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
+  {
+#if !QC_SIMPLE_NBDV_B0047
+    UInt uiPUIdx = uiPartIdx;
+    UInt uiAbsPartAddr = uiPartAddr;
+
+    // col [2]
+    Int iRefIdxSkip[2] = {-1, -1};
+    if( !bMerge )
+    {
+      iRefIdxSkip[ eRefPicList0 ] = iRefIdx0;
+    }
+    else
+    {
+      for (Int i=0; i<2; i++)
+      {
+        RefPicList  eRefPicList1 = ( i==1 ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
+#if SET_MERGE_TMVP_REFIDX
+        Int iRefIdxTmp;
+        if ( uiPUIdx != 0 )
+        {
+          iRefIdxTmp = 0;
+        }
+        else
+        {    
+          iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList1)->getRefIdx(uiLeftPartIdx) : -1;
+        }
+#else      
+        Int iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList1)->getRefIdx(uiLeftPartIdx) : -1;
+#endif
+        iRefIdxSkip[i] = (iRefIdxTmp != -1) ? iRefIdxTmp : 0;
+      }
+    }
+
+    //>> MTK colocated-RightBottom
+    UInt uiPartIdxRB;
+    Int uiLCUIdx = getAddr();
+    eCUMode = getPartitionSize( 0 );
+
+    deriveRightBottomIdx( eCUMode, uiPUIdx, uiPartIdxRB );  
+
+    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
+    //UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
+
+    TComMv cColMv;
+    Int iRefIdx;
+
+    if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
+    {
+      uiLCUIdx = -1;
+    }
+    else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
+    {
+      uiLCUIdx = -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
+      {
+        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
+        uiLCUIdx = getAddr();
+      }
+      else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
+      {
+        uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
+        uiLCUIdx = -1 ; 
+      }
+      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
+      {
+        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
+        uiLCUIdx = getAddr() + 1;
+      }
+      else //is the right bottom corner of LCU                       
+      {
+        uiAbsPartAddr = 0;
+        uiLCUIdx = -1 ; 
+      }
+    }
+
+    Bool bExistMV = false;
+    UInt uiPartIdxCenter;
+    UInt uiCurLCUIdx = getAddr();
+    xDeriveCenterIdx( eCUMode, uiPUIdx, uiPartIdxCenter );
+
+    Int iTargetView, iStartView; 
+    if( !bMerge ) // AMVP
+    {
+      bExistMV = uiLCUIdx >= 0 && xGetColDisMV( eRefPicList0, iRefIdx0, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
+      if( bExistMV == false )
+      {
+        bExistMV = xGetColDisMV( eRefPicList0, iRefIdx0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iTargetView, iStartView );
+      }
+      if( bExistMV ) // DV is found
+      {
+        if( cColMv.m_bDvMcp == false ) //=> DCP, if true => DV-MCP
+        {
+          clipMv(cColMv);
+          pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 
+          pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
+          return;
+        }
+        else // DV-MCP
+        {
+          aiDvMcpDvCand[eRefPicList0][DVFROM_COL] = cColMv.getHor(); 
+          abDvMcpFlag  [eRefPicList0][DVFROM_COL] = true; 
+          bDvMcpIsFound = true;
+        }
+      }
+    }
+    else // MERGE
+    {
+      iRefIdx = iRefIdxSkip[0];
+      bExistMV = uiLCUIdx >= 0 && xGetColDisMV( REF_PIC_LIST_0, iRefIdx, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
+      if( bExistMV == false )
+      {
+        bExistMV = xGetColDisMV( REF_PIC_LIST_0, iRefIdx, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iTargetView, iStartView );
+      }
+      if( bExistMV )
+      {
+        if( cColMv.m_bDvMcp == false ) // DCP
+        {
+          clipMv(cColMv);
+          pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 
+          pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
+          return;
+        }
+        else { // // DV-MCP
+          aiDvMcpDvCand[0][DVFROM_COL] = cColMv.getHor(); 
+          abDvMcpFlag  [0][DVFROM_COL] = true; 
+          bDvMcpIsFound = true;
+        }; 
+
+        if ( getSlice()->isInterB() )
+        {       
+          iRefIdx = iRefIdxSkip[1];
+          bExistMV = uiLCUIdx >= 0 && xGetColDisMV( REF_PIC_LIST_1, iRefIdx, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
+          if( bExistMV == false )
+          {
+            bExistMV = xGetColDisMV( REF_PIC_LIST_1, iRefIdx, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iTargetView, iStartView );
+          }
+          if( bExistMV )
+          {
+            if( cColMv.m_bDvMcp == false ) // DCP
+            {
+              clipMv(cColMv);
+              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 
+              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
+              return;
+            }
+            else // DV-MCP
+            {
+              aiDvMcpDvCand[1][DVFROM_COL] = cColMv.getHor(); 
+              abDvMcpFlag  [1][DVFROM_COL] = true; 
+              bDvMcpIsFound = true;
+            }; 
+          }
+        }
+      }
+    }
+#else
+    TComMv cColMv;
+    Int iTargetViewIdx = 0;
+    Int iTStartViewIdx = 0;
+    UInt uiPartIdxRB, uiBRIdx;
+    Int uiViewIdxCurr= getSlice()->getViewId();
+    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 ( (( 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
+    {
+      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() ];
+        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU();
+      }
+      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;
+        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1;
+      }
+    }
+    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 (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)
+                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
+
+              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
+              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
+            }
+#endif
+            return ;
+          }
+        }
+
+        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)
+                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
+              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
+              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
+            }
+#endif
+          return ;
+        }
+        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)
+                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
+              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
+              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
+            }
+#endif
+            return ;
+          }
+        }
+      }
+    }
+#endif
+  } // if TMVP Flag
+#endif
 
   if( bDvMcpIsFound ) // skip dvmcp
Index: branches/HTM-5.1-dev3-Mediatek/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-5.1-dev3-Mediatek/source/Lib/TLibCommon/TypeDef.h	(revision 234)
+++ branches/HTM-5.1-dev3-Mediatek/source/Lib/TLibCommon/TypeDef.h	(revision 245)
@@ -143,5 +143,5 @@
 #define DV_DERIVATION_PARALLEL_B0096      1   // JCT3V-B0096, enable parallel derivation of disparity vector
 #define QC_SIMPLE_NBDV_B0047              1   // JCT3V-B0047
-
+#define MTK_SAIT_TEMPORAL_FIRST_ORDER     1   // JCT3V-C00141/C0097
 ///// ***** MOTION PARAMETER INHERITANCE  *********
 #define HHI_MPI                           1   // motion parameter inheritance from texture picture for depth map coding
