Index: /branches/HTM-8.2-dev0-MediaTek/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 716)
@@ -510,4 +510,8 @@
   ("AdvMultiviewResPred",      m_uiUseAdvResPred,           (UInt)1, "Usage of Advanced Residual Prediction" )
 #endif
+#if MTK_SPIVMP_F0110
+  ("SubPULog2Size", m_iSubPULog2Size, (Int)3, "Sub-PU size index: 2^n")
+#endif
+
 #if H_3D_IC
 #if SEC_ONLY_TEXTURE_IC_F0151
@@ -1486,4 +1490,9 @@
 #if H_3D_ARP
   xConfirmPara( ( 0 != m_uiUseAdvResPred ) &&  ( 1 != m_uiUseAdvResPred ), "UseAdvResPred must be 0 or 1." );
+#endif
+#if MTK_SPIVMP_F0110
+  xConfirmPara( m_iSubPULog2Size < 2,                                        "SubPULog2Size must be 2 or greater.");
+  xConfirmPara( m_iSubPULog2Size > 6,                                        "SubPULog2Size must be 6 or smaller.");
+  xConfirmPara( (1<<m_iSubPULog2Size) > m_uiMaxCUWidth,                      "SubPULog2Size must be log2(maxCUSize) or smaller.");
 #endif
 #if ADAPTIVE_QP_SELECTION
@@ -2432,4 +2441,7 @@
   printf("IvMvPred:%d ", m_ivMvPredFlag );
 #endif
+#if MTK_SPIVMP_F0110
+  printf(" SubPULog2Size:%d  " , m_iSubPULog2Size  );
+#endif
 #endif
 #if H_3D_ARP
Index: /branches/HTM-8.2-dev0-MediaTek/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/App/TAppEncoder/TAppEncCfg.h	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/App/TAppEncoder/TAppEncCfg.h	(revision 716)
@@ -119,4 +119,7 @@
 #else
   Bool                   m_ivMvPredFlag;                      ///< Interview motion vector prediction 
+#endif
+#if MTK_SPIVMP_F0110
+  Int                    m_iSubPULog2Size;                    
 #endif
 #endif
Index: /branches/HTM-8.2-dev0-MediaTek/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/App/TAppEncoder/TAppEncTop.cpp	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/App/TAppEncoder/TAppEncTop.cpp	(revision 716)
@@ -182,4 +182,7 @@
     m_cTEncTop.setUseAdvRP                     ( ( isDepth || 0==layerIdInVps ) ? 0 : m_uiUseAdvResPred );
     m_cTEncTop.setARPStepNum                   ( ( isDepth || 0==layerIdInVps ) ? 1 : H_3D_ARP_WFNR     );
+#endif
+#if MTK_SPIVMP_F0110
+    m_cTEncTop.setSubPULog2Size                 (( isDepth || 0==layerIdInVps ) ? 0 : m_iSubPULog2Size   );
 #endif
 #if H_3D_IC
@@ -1655,4 +1658,14 @@
     vps.setARPStepNum      ( layer, ( isDepth || isLayerZero ) ? 1 : H_3D_ARP_WFNR     );
 #endif  
+#if MTK_SPIVMP_F0110
+    if( isDepth )
+    {
+      vps.setSubPULog2Size         ( layer, (layer != 1) ? m_iSubPULog2Size: 0 ); 
+    }
+    else
+    {
+      vps.setSubPULog2Size         ( layer, (!isLayerZero) ? m_iSubPULog2Size: 0 ); 
+    }
+#endif
 
 #if H_3D_DIM
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComDataCU.cpp	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComDataCU.cpp	(revision 716)
@@ -146,4 +146,7 @@
   m_piVSPFlag            = NULL;
 #endif
+#if MTK_SPIVMP_F0110
+  m_pbSPIVMPFlag         = NULL;
+#endif
 #if H_3D_ARP
   m_puhARPW              = NULL;
@@ -196,4 +199,7 @@
 #if H_3D_VSP
     m_piVSPFlag          = (Char*  )xMalloc(Char,   uiNumPartition);
+#endif
+#if MTK_SPIVMP_F0110
+    m_pbSPIVMPFlag       = (Bool*  )xMalloc(Bool,   uiNumPartition);
 #endif
     m_puhLumaIntraDir    = (UChar* )xMalloc(UChar,  uiNumPartition);
@@ -356,4 +362,7 @@
     if ( m_piVSPFlag          ) { xFree(m_piVSPFlag);           m_piVSPFlag         = NULL; }
 #endif
+#if MTK_SPIVMP_F0110
+    if ( m_pbSPIVMPFlag       ) { xFree(m_pbSPIVMPFlag);           m_pbSPIVMPFlag         = NULL; }
+#endif
     if ( m_puhLumaIntraDir    ) { xFree(m_puhLumaIntraDir);     m_puhLumaIntraDir   = NULL; }
     if ( m_puhChromaIntraDir  ) { xFree(m_puhChromaIntraDir);   m_puhChromaIntraDir = NULL; }
@@ -561,4 +570,7 @@
 #if H_3D_VSP
     m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui];
+#endif
+#if MTK_SPIVMP_F0110
+    m_pbSPIVMPFlag[ui] = pcFrom->m_pbSPIVMPFlag[ui];
 #endif
     m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui];
@@ -603,4 +615,7 @@
 #if H_3D_VSP
     memset( m_piVSPFlag         + firstElement, 0,                        numElements * sizeof( *m_piVSPFlag ) );
+#endif
+#if MTK_SPIVMP_F0110
+    memset( m_pbSPIVMPFlag      + firstElement, 0,                        numElements * sizeof( *m_pbSPIVMPFlag ) );
 #endif
     memset( m_puhLumaIntraDir   + firstElement, DC_IDX,                   numElements * sizeof( *m_puhLumaIntraDir ) );
@@ -784,4 +799,7 @@
       m_piVSPFlag[ui] = 0;
 #endif
+#if MTK_SPIVMP_F0110
+      m_pbSPIVMPFlag[ui] = 0;
+#endif
       m_puhLumaIntraDir[ui] = DC_IDX;
       m_puhChromaIntraDir[ui] = 0;
@@ -883,4 +901,7 @@
 #if H_3D_VSP
   memset( m_piVSPFlag,          0, sizeof( Char  ) * m_uiNumPartition );
+#endif
+#if MTK_SPIVMP_F0110
+  memset( m_pbSPIVMPFlag,       0, sizeof( Bool  ) * m_uiNumPartition );
 #endif
   memset( m_puhLumaIntraDir,    DC_IDX, iSizeInUchar );
@@ -980,4 +1001,7 @@
       m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui];
 #endif
+#if MTK_SPIVMP_F0110
+      m_pbSPIVMPFlag[ui]=pcCU->m_pbSPIVMPFlag[uiPartOffset+ui];
+#endif
       m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui];
       m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui];
@@ -1130,4 +1154,7 @@
   m_piVSPFlag           = pcCU->getVSPFlag()          + uiPart;
 #endif
+#if MTK_SPIVMP_F0110
+  m_pbSPIVMPFlag        = pcCU->getSPIVMPFlag()          + uiPart;
+#endif
 
 #if H_3D_ARP
@@ -1285,4 +1312,7 @@
   m_piVSPFlag          = pcCU->getVSPFlag()               + uiAbsPartIdx;
   m_pDvInfo            = pcCU->getDvInfo()                + uiAbsPartIdx;
+#endif
+#if MTK_SPIVMP_F0110
+  m_pbSPIVMPFlag       = pcCU->getSPIVMPFlag()               + uiAbsPartIdx;
 #endif
 
@@ -1335,4 +1365,7 @@
 
 #endif
+#if MTK_SPIVMP_F0110
+  memcpy( m_pbSPIVMPFlag        + uiOffset, pcCU->getSPIVMPFlag(),        sizeof( Bool ) * uiNumPartition );
+#endif
   memcpy( m_puhLumaIntraDir     + uiOffset, pcCU->getLumaIntraDir(),      iSizeInUchar );
   memcpy( m_puhChromaIntraDir   + uiOffset, pcCU->getChromaIntraDir(),    iSizeInUchar );
@@ -1464,4 +1497,7 @@
   memcpy( rpcCU->getDvInfo()            + m_uiAbsIdxInLCU, m_pDvInfo,             sizeof( *m_pDvInfo ) * m_uiNumPartition );
 #endif
+#if MTK_SPIVMP_F0110
+  memcpy( rpcCU->getSPIVMPFlag()        + m_uiAbsIdxInLCU, m_pbSPIVMPFlag,        sizeof( Bool ) * m_uiNumPartition );
+#endif
   memcpy( rpcCU->getLumaIntraDir()      + m_uiAbsIdxInLCU, m_puhLumaIntraDir,     iSizeInUchar );
   memcpy( rpcCU->getChromaIntraDir()    + m_uiAbsIdxInLCU, m_puhChromaIntraDir,   iSizeInUchar );
@@ -1579,4 +1615,7 @@
 #if H_3D_VSP
   memcpy( rpcCU->getVSPFlag()           + uiPartOffset, m_piVSPFlag,           sizeof(Char) * uiQNumPart );
+#endif
+#if MTK_SPIVMP_F0110
+  memcpy( rpcCU->getSPIVMPFlag()        + uiPartOffset, m_pbSPIVMPFlag,        sizeof(Bool) * uiQNumPart );
 #endif
   memcpy( rpcCU->getLumaIntraDir()      + uiPartOffset, m_puhLumaIntraDir,     iSizeInUchar );
@@ -2705,4 +2744,11 @@
   setSubPart<UChar>( uiMergeIndex, m_puhMergeIndex, uiAbsPartIdx, uiDepth, uiPartIdx );
 }
+
+#if MTK_SPIVMP_F0110
+Void TComDataCU::setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
+{
+  setSubPart<Bool>( bSPIVMPFlag, m_pbSPIVMPFlag, uiAbsPartIdx, uiDepth, uiPartIdx );
+}
+#endif
 
 #if H_3D_VSP
@@ -3962,4 +4008,7 @@
       , InheritedVSPDisInfo*  inheritedVSPDisInfo
 #endif
+#if MTK_SPIVMP_F0110
+      , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
+#endif
       , Int& numValidMergeCand, Int mrgCandIdx
 )
@@ -4030,5 +4079,7 @@
 #if QC_DEPTH_IV_MRG_F0125
   Bool bIsDepth = getSlice()->getIsDepth();
+#if !BUGFIX_F0093
   Bool bDepthIPMCAvai = false;
+#endif
 #endif 
 
@@ -4433,4 +4484,7 @@
     , bIsDepth
 #endif
+#if MTK_SPIVMP_F0110
+    , pcMvFieldSP, puhInterDirSP
+#endif
     );
   }  
@@ -4459,24 +4513,39 @@
     Int iCnloop=0;
 
-    for(Int i = 0; i < 2; i ++)
-    {
-      iCnloop = iPosLeftAbove[i];
-      if ( iCnloop == -1 ) 
-      {
-        continue;
-      }
-      if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1])
-      {
-        bRemoveSpa                      = true;
-        break;
-      }      
-    }
+#if BUGFIX_F0093
+    if (!bIsDepth)
+    {
+#endif
+      for(Int i = 0; i < 2; i ++)
+      {
+        iCnloop = iPosLeftAbove[i];
+        if ( iCnloop == -1 ) 
+        {
+          continue;
+        }
+        if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1])
+        {
+          bRemoveSpa                      = true;
+          break;
+        }      
+      }
+#if BUGFIX_F0093
+    }
+#endif
 #if QC_DEPTH_IV_MRG_F0125
+#if BUGFIX_F0093
+    if (bIsDepth)
+#else
     if ( bIsDepth && !bRemoveSpa)
+#endif
     {
       iCnloop = iCount-1;
       for(; iCnloop >= 0; iCnloop --)
       {
+#if BUGFIX_F0093
+        if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==tmpMV[0] && pcMvFieldNeighbours[(iCnloop<<1)+1]==tmpMV[1])  // F0125 compatible with F0093
+#else
         if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
+#endif
         {
           bRemoveSpa                      = true;
@@ -4484,8 +4553,10 @@
         }
       }
+#if !BUGFIX_F0093
       if(!bRemoveSpa)
       {
         bDepthIPMCAvai = true;
       }
+#endif
     }
 #endif
@@ -4545,4 +4616,7 @@
     if (bIvMC)
     {
+#if MTK_SPIVMP_F0110
+      pbSPIVMPFlag[iCount] = true;
+#endif
       if( ( ivCandDir[0] & 1 ) == 1 )
       {
@@ -4556,15 +4630,19 @@
       puhInterDirNeighbours[ iCount ] = ivCandDir[0];
 
+#if !BUGFIX_F0093
 #if QC_DEPTH_IV_MRG_F0125
       if ( bDepthIPMCAvai || !bIsDepth )
       {
 #endif
-      if ( mrgCandIdx == iCount )
-      {
-        return;
-      }
-      iCount ++;
+#endif
+        if ( mrgCandIdx == iCount )
+        {
+          return;
+        }
+        iCount ++;
+#if !BUGFIX_F0093
 #if QC_DEPTH_IV_MRG_F0125
       }
+#endif
 #endif
     }
@@ -8112,4 +8190,55 @@
 }
 #endif
+
+#if MTK_SPIVMP_F0110
+Void TComDataCU::getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight)
+{
+  Int iSubPUSize = 1<<getSlice()->getVPS()->getSubPULog2Size(getSlice()->getLayerId());
+  iNumSPInOneLine = iPUWidth/iSubPUSize;
+  iNumSPInOneLine = iNumSPInOneLine < 1 ? 1: iNumSPInOneLine;
+  Int iNumSPInOneColumn = iPUHeight/iSubPUSize;
+  iNumSPInOneColumn = iNumSPInOneColumn < 1 ? 1: iNumSPInOneColumn;
+  iNumSP = iNumSPInOneLine * iNumSPInOneColumn;
+
+  iSPWidth = iNumSPInOneLine == 1 ? iPUWidth: iSubPUSize; 
+  iSPHeight = iNumSPInOneColumn == 1 ? iPUHeight: iSubPUSize; 
+}
+
+Void TComDataCU::getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr )
+{
+  uiBaseAbsPartIdx += m_uiAbsIdxInLCU;
+  Int iBasePelX = g_auiRasterToPelX[g_auiZscanToRaster[uiBaseAbsPartIdx]];
+  Int iBasePelY = g_auiRasterToPelY[g_auiZscanToRaster[uiBaseAbsPartIdx]];
+  Int iCurrPelX = iBasePelX + iPartIdx%iNumPartLine * iWidth;
+  Int iCurrPelY = iBasePelY + iPartIdx/iNumPartLine * iHeight;
+  Int iCurrRaster = iCurrPelY / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + iCurrPelX/getPic()->getMinCUWidth();
+  ruiPartAddr = g_auiRasterToZscan[iCurrRaster];
+  ruiPartAddr -= m_uiAbsIdxInLCU;  
+}
+
+Void TComDataCU::setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight )
+{
+  uiAbsPartIdx += getZorderIdxInCU();
+  Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]];
+  Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]];
+  Int iEndPelX = iStartPelX + iWidth;
+  Int iEndPelY = iStartPelY + iHeight;
+
+  Int iCurrRaster, uiPartAddr;
+
+  for (Int i=iStartPelY; i<iEndPelY; i+=getPic()->getMinCUHeight())
+  {
+    for (Int j=iStartPelX; j < iEndPelX; j += getPic()->getMinCUWidth())
+    {
+      iCurrRaster = i / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + j/getPic()->getMinCUWidth();
+      uiPartAddr = g_auiRasterToZscan[iCurrRaster];
+      uiPartAddr -= getZorderIdxInCU();  
+
+      m_puhInterDir[uiPartAddr] = uiDir;
+    }
+  }
+}
+#endif
+
 #if H_3D_IV_MERGE
 Bool
@@ -8118,4 +8247,7 @@
 , Bool bIsDepth           
 #endif
+#if MTK_SPIVMP_F0110
+, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
+#endif
 )
 {
@@ -8139,4 +8271,5 @@
   pcBaseRec->getTopLeftSamplePos( getAddr(), getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
 
+#if !MTK_SPIVMP_F0110
 #if QC_DEPTH_IV_MRG_F0125
   iCurrPosX  += ( iWidth  >> 1 );
@@ -8146,4 +8279,5 @@
   iCurrPosY  += ( ( iHeight - 1 ) >> 1 );
 #endif
+#endif
 
   Bool depthRefineFlag = false; 
@@ -8162,9 +8296,139 @@
 #endif
 
+#if MTK_SPIVMP_F0110
+  ////////////////////////////////
+  //////////sub-PU IvMC///////////
+  ////////////////////////////////
+  
+  Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
+  getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
+
+  for (Int i=0; i<iNumSP; i++)
+  {
+    puhInterDirSP[i] = 0;
+    pcMvFieldSP[2*i].getMv().set(0, 0);
+    pcMvFieldSP[2*i+1].getMv().set(0,0);
+    pcMvFieldSP[2*i].setRefIdx(-1);
+    pcMvFieldSP[2*i+1].setRefIdx(-1);
+  }
+
+  Int         iBaseCUAddr;
+  Int         iBaseAbsPartIdx;
+  TComDataCU* pcBaseCU;
+  Int iPartition = 0;
+  Int iInterDirLast = 0;
+  TComMvField cMvFieldLast[2];
+
+  Int iDelX = iSPWidth/2;
+  Int iDelY = iSPHeight/2;
+
+  Int         iBasePosX, iBasePosY;
+  for (Int i=iCurrPosY; i < iCurrPosY + iHeight; i += iSPHeight)
+  {
+    for (Int j = iCurrPosX; j < iCurrPosX + iWidth; j += iSPWidth)
+    {
+      iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, j + iDelX + ( (cDv.getHor() + 2 ) >> 2 ));
+      iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, i + iDelY + ( (cDv.getVer() + 2 ) >> 2 )); 
+
+      pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY, iBaseCUAddr, iBaseAbsPartIdx );
+      pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
+      if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA ))
+      {
+        for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ )
+        {
+          RefPicList  eCurrRefPicList = RefPicList( uiCurrRefListId );
+          Bool bLoop_stop = false;
+          for(Int iLoop = 0; iLoop < 2 && !bLoop_stop; ++iLoop)
+          {
+            RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 -  uiCurrRefListId ) : RefPicList( uiCurrRefListId );
+            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( eCurrRefPicList ); iPdmRefIdx++)
+                {
+                  if (iBaseRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx))
+                  {
+                    abPdmAvailable[ uiCurrRefListId ] = true;
+                    TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
+
+                    if( !bIsDepth )
+                    {
+                      cMv.setIDVFlag   (true);
+                      cMv.setIDVHor    (cDv.getHor());                  
+                      cMv.setIDVVer    (cDv.getVer());  
+                      cMv.setIDVVId    (iViewIndex); 
+                    }
+
+                    clipMv( cMv );
+                    bLoop_stop = true;
+
+                    pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iPdmRefIdx);
+                    break;
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+
+      puhInterDirSP[iPartition] = (pcMvFieldSP[2*iPartition].getRefIdx()!=-1 ? 1: 0) + (pcMvFieldSP[2*iPartition+1].getRefIdx()!=-1 ? 2: 0);
+      if (puhInterDirSP[iPartition] == 0)
+      {
+        if (iInterDirLast != 0)
+        {
+          puhInterDirSP[iPartition] = iInterDirLast;
+          pcMvFieldSP[2*iPartition] = cMvFieldLast[0];
+          pcMvFieldSP[2*iPartition + 1] = cMvFieldLast[1];
+        }
+      }
+      else
+      {
+        if (iInterDirLast ==0)
+        {
+          availableMcDc[0] = puhInterDirSP[iPartition];
+          paiPdmRefIdx  [ 0 ] = pcMvFieldSP[2*iPartition].getRefIdx();
+          pacPdmMv      [ 0 ] = pcMvFieldSP[2*iPartition].getMv();
+          paiPdmRefIdx  [ 1 ] = pcMvFieldSP[2*iPartition+1].getRefIdx();
+          pacPdmMv      [ 1 ] = pcMvFieldSP[2*iPartition+1].getMv();
+
+          if (iPartition != 0)
+          {
+            for (Int iPart = iPartition-1; iPart >= 0; iPart--)
+            {
+              puhInterDirSP[iPart] = puhInterDirSP[iPartition];
+              pcMvFieldSP[2*iPart] = pcMvFieldSP[2*iPartition];
+              pcMvFieldSP[2*iPart + 1] = pcMvFieldSP[2*iPartition + 1];
+            }
+          }
+        }
+        iInterDirLast = puhInterDirSP[iPartition];
+        cMvFieldLast[0] = pcMvFieldSP[2*iPartition];
+        cMvFieldLast[1] = pcMvFieldSP[2*iPartition + 1];
+      }
+
+      iPartition ++;
+
+    }
+  }  
+
+  iCurrPosX  += ( iWidth  >> 1 );
+  iCurrPosY  += ( iHeight >> 1 );
+#endif
+
   ////////////////////////////////
   /////// IvMC + IvMCShift ///////
   ////////////////////////////////
 
-  for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)  
+#if MTK_SPIVMP_F0110
+  for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++) 
+#else
+  for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
+#endif
   {
     // iLoopCan == 0 --> IvMC
@@ -8234,5 +8498,9 @@
     }
   }
+#if MTK_SPIVMP_F0110
+  for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++)
+#else
   for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
+#endif
   {
     availableMcDc[(iLoopCan << 1)] = ( abPdmAvailable[(iLoopCan<<2)] ? 1 : 0 ) + ( abPdmAvailable[1 + (iLoopCan<<2)] ? 2 : 0);
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComDataCU.h	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComDataCU.h	(revision 716)
@@ -198,4 +198,8 @@
                                       ///< 0: non-VSP; 1: VSP
 #endif
+#if MTK_SPIVMP_F0110
+  Bool*         m_pbSPIVMPFlag;       ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP
+                                      ///< 0: non-SPIVMP; 1: SPIVMP
+#endif
 #if H_3D_ARP
   UChar*        m_puhARPW;
@@ -531,8 +535,16 @@
   Void          getIVNStatus       ( UInt uiPartIdx,  DisInfo* pDInfo, Bool& bIVFMerge,  Int& iIVFMaxD);
 #endif
+#if MTK_SPIVMP_F0110
+  Void          getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight);
+  Void          getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr );
+  Void          setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight );
+#endif
 #if H_3D_IV_MERGE
   Bool          getInterViewMergeCands          ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc 
 #if QC_DEPTH_IV_MRG_F0125
     , Bool bIsDepth           
+#endif
+#if MTK_SPIVMP_F0110
+    , TComMvField* pcMFieldSP, UChar* puhInterDirSP
 #endif
     );   
@@ -708,8 +720,19 @@
                                             , InheritedVSPDisInfo*  inheritedVSPDisInfo
 #endif
-                                            , Int& numValidMergeCand, Int mrgCandIdx = -1 );
+#if MTK_SPIVMP_F0110
+                                            , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
+#endif
+                                            , Int& numValidMergeCand, Int mrgCandIdx = -1
+                                            );
 
 #if H_3D_VSP
   inline Void   xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount,  InheritedVSPDisInfo*  inheritedVSPDisInfo);
+
+#if MTK_SPIVMP_F0110
+  Bool*         getSPIVMPFlag        ()                        { return m_pbSPIVMPFlag;          }
+  Bool          getSPIVMPFlag        ( UInt uiIdx )            { return m_pbSPIVMPFlag[uiIdx];   }
+  Void          setSPIVMPFlag        ( UInt uiIdx, Bool n )     { m_pbSPIVMPFlag[uiIdx] = n;      }
+  Void          setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
+#endif
 
   Char*         getVSPFlag        ()                        { return m_piVSPFlag;          }
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComMotionInfo.cpp
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComMotionInfo.cpp	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComMotionInfo.cpp	(revision 716)
@@ -40,4 +40,8 @@
 #include "assert.h"
 #include <stdlib.h>
+#if MTK_SPIVMP_F0110
+#include "TComDataCU.h"
+#include "TComPic.h"
+#endif
 
 //! \ingroup TLibCommon
@@ -323,4 +327,30 @@
   setAllRefIdx( mvField.getRefIdx(), eCUMode, iPartAddr, uiDepth, iPartIdx );
 }
+
+#if MTK_SPIVMP_F0110
+Void TComCUMvField::setMvFieldSP( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight  )
+{
+  uiAbsPartIdx += pcCU->getZorderIdxInCU();
+  Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]];
+  Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]];
+  Int iEndPelX = iStartPelX + iWidth;
+  Int iEndPelY = iStartPelY + iHeight;
+
+  Int iCurrRaster, uiPartAddr;
+
+  for (Int i=iStartPelY; i<iEndPelY; i+=pcCU->getPic()->getMinCUHeight())
+  {
+    for (Int j=iStartPelX; j < iEndPelX; j += pcCU->getPic()->getMinCUWidth())
+    {
+      iCurrRaster = i / pcCU->getPic()->getMinCUHeight() * pcCU->getPic()->getNumPartInWidth() + j/pcCU->getPic()->getMinCUWidth();
+      uiPartAddr = g_auiRasterToZscan[iCurrRaster];
+      uiPartAddr -= pcCU->getZorderIdxInCU();  
+
+      m_pcMv[uiPartAddr] = cMvField.getMv();
+      m_piRefIdx[uiPartAddr] = cMvField.getRefIdx();
+    }
+  }
+}
+#endif
 
 /**Subsampling of the stored prediction mode, reference index and motion vector
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComMotionInfo.h
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComMotionInfo.h	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComMotionInfo.h	(revision 716)
@@ -43,5 +43,4 @@
 #include "CommonDef.h"
 #include "TComMv.h"
-
 //! \ingroup TLibCommon
 //! \{
@@ -51,4 +50,7 @@
 // ====================================================================================================================
 
+#if MTK_SPIVMP_F0110
+class TComDataCU;
+#endif
 /// parameters for AMVP
 typedef struct _AMVPInfo
@@ -171,4 +173,7 @@
   Void    setAllRefIdx ( Int iRefIdx,                 PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
   Void    setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
+#if MTK_SPIVMP_F0110
+  Void    setMvFieldSP ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight  );
+#endif
 
   Void setNumPartition( Int iNumPart )
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComPrediction.cpp	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComPrediction.cpp	(revision 716)
@@ -561,4 +561,84 @@
 }
 
+#if MTK_SPIVMP_F0110
+Void TComPrediction::xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr )
+{
+  for (Int i = 0; i < iNumSP; i++)
+  {
+    uiMergedSPW[i] = iSPWidth;
+    uiMergedSPH[i] = iSPHeight;
+    pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, i, iNumSPInOneLine, uiSPAddr[i]);
+  }
+  // horizontal sub-PU merge
+  for (Int i=0; i<iNumSP; i++)
+  {
+    if (i % iNumSPInOneLine == iNumSPInOneLine - 1 || uiMergedSPW[i]==0 || uiMergedSPH[i]==0)
+    {
+      continue;
+    }
+    for (Int j=i+1; j<i+iNumSPInOneLine-i%iNumSPInOneLine; j++)
+    {
+      if (xCheckTwoSPMotion(pcCU, uiSPAddr[i], uiSPAddr[j]))
+      {
+        uiMergedSPW[i] += iSPWidth;
+        uiMergedSPW[j] = uiMergedSPH[j] = 0;
+      }
+      else
+      {
+        break;
+      }
+    }
+  }
+  //vertical sub-PU merge
+  for (Int i=0; i<iNumSP-iNumSPInOneLine; i++)
+  {
+    if (uiMergedSPW[i]==0 || uiMergedSPH[i]==0)
+    {
+      continue;
+    }
+    for (Int j=i+iNumSPInOneLine; j<iNumSP; j+=iNumSPInOneLine)
+    {
+      if (xCheckTwoSPMotion(pcCU, uiSPAddr[i], uiSPAddr[j]) && uiMergedSPW[i]==uiMergedSPW[j])
+      {
+        uiMergedSPH[i] += iSPHeight;
+        uiMergedSPH[j] = uiMergedSPW[j] = 0;
+      }
+      else
+      {
+        break;
+      }
+    }
+  }
+}
+
+Bool TComPrediction::xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 )
+{
+  if( pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr1))
+  {
+    return false;
+  }
+  if( pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr1))
+  {
+    return false;
+  }
+
+  if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr0) >= 0)
+  {
+    if (pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr1))
+    {
+      return false;
+    }
+  }
+
+  if (pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr0) >= 0)
+  {
+    if (pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr1))
+    {
+      return false;
+    }
+  }
+  return true;
+}
+#endif
 
 Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx )
@@ -592,12 +672,47 @@
       else
       {
-        if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
-        {
-          xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
+#if MTK_SPIVMP_F0110
+        if ( pcCU->getSPIVMPFlag(uiPartAddr)!=0)  
+        {
+          Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
+
+          pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
+
+          UInt uiW[256], uiH[256];
+          UInt uiSPAddr[256];
+
+          xGetSubPUAddrAndMerge(pcCU, uiPartAddr, iSPWidth, iSPHeight, iNumSPInOneLine, iNumSP, uiW, uiH, uiSPAddr);
+
+          //MC
+          for (Int i = 0; i < iNumSP; i++)
+          {
+            if (uiW[i]==0 || uiH[i]==0)
+            {
+              continue;
+            }
+            if( xCheckIdenticalMotion( pcCU, uiSPAddr[i] ))
+            {
+              xPredInterUni (pcCU, uiSPAddr[i], uiW[i], uiH[i], REF_PIC_LIST_0, pcYuvPred );
+            }
+            else
+            {
+              xPredInterBi  (pcCU, uiSPAddr[i], uiW[i], uiH[i], pcYuvPred);
+            }
+          }
         }
         else
         {
-          xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
-        }
+#endif
+          if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
+          {
+            xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
+          }
+          else
+          {
+            xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
+          }
+#if MTK_SPIVMP_F0110
+        }
+#endif
       }
 #if H_3D_VSP
@@ -643,4 +758,35 @@
       else
       {
+#if MTK_SPIVMP_F0110
+       if (pcCU->getSPIVMPFlag(uiPartAddr)!=0)  
+      {
+        Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
+
+        pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
+
+        UInt uiW[256], uiH[256];
+        UInt uiSPAddr[256];
+
+        xGetSubPUAddrAndMerge(pcCU, uiPartAddr, iSPWidth, iSPHeight, iNumSPInOneLine, iNumSP, uiW, uiH, uiSPAddr);
+        //MC
+        for (Int i = 0; i < iNumSP; i++)
+        {
+          if (uiW[i]==0 || uiH[i]==0)
+          {
+            continue;
+          }
+          if( xCheckIdenticalMotion( pcCU, uiSPAddr[i] ))
+          {
+            xPredInterUni (pcCU, uiSPAddr[i], uiW[i], uiH[i], REF_PIC_LIST_0, pcYuvPred );
+          }
+          else
+          {
+            xPredInterBi  (pcCU, uiSPAddr[i], uiW[i], uiH[i], pcYuvPred);
+          }
+        }
+      }
+      else
+      {
+#endif
         if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
         {
@@ -651,4 +797,7 @@
           xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
         }
+#if MTK_SPIVMP_F0110
+       }
+#endif
       }
 #if H_3D_VSP
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComPrediction.h	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComPrediction.h	(revision 716)
@@ -142,5 +142,8 @@
   Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight );
   Bool xCheckIdenticalMotion    ( TComDataCU* pcCU, UInt PartAddr);
-
+#if MTK_SPIVMP_F0110
+  Bool xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 );
+  Void xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr );
+#endif
 #if H_3D_DIM
   // depth intra functions
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComSlice.cpp	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComSlice.cpp	(revision 716)
@@ -1838,4 +1838,7 @@
 #if H_3D_IV_MERGE
     m_ivMvPredFlag         [ i ] = false;
+#if MTK_SPIVMP_F0110
+    m_iSubPULog2Size       [ i ] = 0;
+#endif
 #endif
 #if H_3D_VSP
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComSlice.h	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComSlice.h	(revision 716)
@@ -597,4 +597,7 @@
 #if H_3D_IV_MERGE
   Bool        m_ivMvPredFlag             [ MAX_NUM_LAYERS ]; 
+#if MTK_SPIVMP_F0110
+  Int         m_iSubPULog2Size           [MAX_NUM_LAYERS   ];
+#endif
 #endif
 #if H_3D_VSP
@@ -829,4 +832,8 @@
   Void    setIvMvPredFlag     ( Int layerIdInVps, Bool val )  { m_ivMvPredFlag[ layerIdInVps ] = val; }
   Bool    getIvMvPredFlag     ( Int layerIdInVps )            { return m_ivMvPredFlag[ layerIdInVps ]; }; 
+#if MTK_SPIVMP_F0110
+  Int     getSubPULog2Size(Int layerIdInVps)           { return m_iSubPULog2Size[layerIdInVps]; }
+  Void    setSubPULog2Size(Int layerIdInVps, Int u)    { m_iSubPULog2Size[layerIdInVps] = u;}
+#endif
 #endif
 #if H_3D_VSP
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TypeDef.h	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TypeDef.h	(revision 716)
@@ -262,4 +262,6 @@
 #if H_3D_IV_MERGE
 #define QC_DEPTH_IV_MRG_F0125                   1 // JCT3V-F0125: Depth oriented Inter-view MV candidate
+#define MTK_SPIVMP_F0110                        0 // JCT3V-F0110: Sub-PU level inter-view motion prediction
+#define BUGFIX_F0093                            1 // bug fix for F0093 for depth IvMC pruning
 #endif
 
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 716)
@@ -1245,4 +1245,7 @@
     pcVPS->setARPStepNum( i, 1 );
 #endif  
+#if MTK_SPIVMP_F0110
+    pcVPS->setSubPULog2Size(i, 0);
+#endif
     if ( i != 0 )
     {
@@ -1251,4 +1254,7 @@
 #if H_3D_IV_MERGE
         READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
+#if MTK_SPIVMP_F0110
+        READ_UVLC (uiCode, "log2_sub_PU_size_minus2");     pcVPS->setSubPULog2Size(i, uiCode+2); 
+#endif
 #endif
 #if H_3D_ARP
@@ -1269,4 +1275,10 @@
         {
           READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
+        }
+#endif
+#if MTK_SPIVMP_F0110
+        if (i!=1)
+        {
+          READ_UVLC (uiCode, "log2_sub_PU_size_minus2");     pcVPS->setSubPULog2Size(i, uiCode+2); 
         }
 #endif
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibDecoder/TDecCu.cpp	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibDecoder/TDecCu.cpp	(revision 716)
@@ -403,9 +403,20 @@
     memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
-
+#if MTK_SPIVMP_F0110
+    Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
+    memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
+    TComMvField*  pcMvFieldSP;
+    UChar* puhInterDirSP;
+    pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2]; 
+    puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()]; 
+#endif
 #if ETRIKHU_MERGE_REUSE_F0093
     m_ppcCU[uiDepth]->initAvailableFlags();
     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
-    m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand, uiMergeIndex );
+    m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
+#if MTK_SPIVMP_F0110
+      , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
+#endif
+      , numValidMergeCand, uiMergeIndex );
 #else
     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand, uiMergeIndex );
@@ -457,4 +468,27 @@
       }
     }
+#if MTK_SPIVMP_F0110
+    pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); 
+    if (bSPIVMPFlag[uiMergeIndex])
+    {
+      UInt uiSPAddr;
+      Int iWidth = pcCU->getWidth(uiAbsPartIdx);
+      Int iHeight = pcCU->getHeight(uiAbsPartIdx);
+
+      Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
+
+      pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
+
+      for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
+      {
+        pcCU->getSPAbsPartIdx(uiAbsPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
+        pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
+        pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
+        pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
+      }
+    }
+    delete pcMvFieldSP;
+    delete puhInterDirSP;
+#endif
 #if !LGE_SHARP_VSP_INHERIT_F0104
 #if H_3D_IC
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 716)
@@ -213,5 +213,11 @@
   UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
 #endif
-
+#if MTK_SPIVMP_F0110
+  Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
+  TComMvField*  pcMvFieldSP;
+  UChar* puhInterDirSP;
+  pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2]; 
+  puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()]; 
+#endif
   for ( UInt ui = 0; ui < pcCU->getSlice()->getMaxNumMergeCand(); ui++ )
   {
@@ -256,8 +262,15 @@
           memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
           InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
+#if MTK_SPIVMP_F0110
+          memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
+#endif
 #if ETRIKHU_MERGE_REUSE_F0093
           pcSubCU->initAvailableFlags();
           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
-          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
+          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
+#if MTK_SPIVMP_F0110
+            , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
+#endif
+            , numValidMergeCand );
 #else
           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
@@ -290,8 +303,15 @@
         memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
         InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
+#if MTK_SPIVMP_F0110
+        memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
+#endif
 #if ETRIKHU_MERGE_REUSE_F0093
         pcSubCU->initAvailableFlags();
         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
-        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo,numValidMergeCand, uiMergeIndex );
+        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
+#if MTK_SPIVMP_F0110
+          , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
+#endif
+          ,numValidMergeCand, uiMergeIndex );
 #else
         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo,numValidMergeCand, uiMergeIndex );
@@ -325,4 +345,27 @@
         }
       }
+#if MTK_SPIVMP_F0110
+      pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );  
+      if (bSPIVMPFlag[uiMergeIndex] != 0)
+      {
+        Int iWidth, iHeight;
+        UInt uiIdx;
+        pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true );
+
+        UInt uiSPAddr;
+
+        Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
+
+        pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
+
+        for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
+        {
+          pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
+          pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
+          pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
+          pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
+        }
+      }
+#endif
     }
     else
@@ -358,4 +401,8 @@
     }
   }
+#if MTK_SPIVMP_F0110
+  delete pcMvFieldSP;
+  delete puhInterDirSP;
+#endif
   return;
 }
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 716)
@@ -1006,4 +1006,7 @@
 #if H_3D_IV_MERGE
         WRITE_FLAG( pcVPS->getIvMvPredFlag         ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");
+#if MTK_SPIVMP_F0110
+        WRITE_UVLC( pcVPS->getSubPULog2Size(i)-2, "log2_sub_PU_size_minus2[i]");
+#endif
 #endif
 #if H_3D_ARP
@@ -1023,4 +1026,10 @@
         {
           WRITE_FLAG( pcVPS->getIvMvPredFlag         ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");
+        }
+#endif
+#if MTK_SPIVMP_F0110
+        if (i!=1)
+        {
+          WRITE_UVLC( pcVPS->getSubPULog2Size(i)-2, "log2_sub_PU_size_minus2[i]");
         }
 #endif
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncCfg.h	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncCfg.h	(revision 716)
@@ -403,4 +403,7 @@
   UInt      m_uiARPStepNum;
 #endif
+#if MTK_SPIVMP_F0110
+  Int      m_iSubPULog2Size;
+#endif
 #if H_3D_IC
   Bool      m_bUseIC;
@@ -505,4 +508,8 @@
   UInt       getARPStepNum                  ()               { return m_uiARPStepNum;    }
   Void       setARPStepNum                  ( UInt  u )      { m_uiARPStepNum = u;       }
+#endif
+#if MTK_SPIVMP_F0110
+  Int        getSubPULog2Size                   ()                   { return m_iSubPULog2Size;}
+  Void       setSubPULog2Size                   (Int u)              { m_iSubPULog2Size = u; }     
 #endif
 
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncCu.cpp	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncCu.cpp	(revision 716)
@@ -1868,8 +1868,21 @@
     memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
+#if MTK_SPIVMP_F0110
+    Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
+    memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
+    TComMvField*  pcMvFieldSP;
+    UChar* puhInterDirSP;
+    pcMvFieldSP = new TComMvField[rpcTempCU->getPic()->getPicSym()->getNumPartition()*2]; 
+    puhInterDirSP = new UChar[rpcTempCU->getPic()->getPicSym()->getNumPartition()]; 
+#endif
 #if ETRIKHU_MERGE_REUSE_F0093
     rpcTempCU->initAvailableFlags();
     rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
-    rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag,inheritedVSPDisInfo, numValidMergeCand );
+    rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag,inheritedVSPDisInfo
+#if MTK_SPIVMP_F0110
+      , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
+#endif
+      , numValidMergeCand 
+      );
 #else
     rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
@@ -1910,7 +1923,33 @@
           rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth );
 #endif
-          rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
-          rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
-          rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
+#if MTK_SPIVMP_F0110
+          rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth);
+          if (bSPIVMPFlag[uiMergeCand])
+          {
+            UInt uiSPAddr;
+            Int iWidth = rpcTempCU->getWidth(0);
+            Int iHeight = rpcTempCU->getHeight(0);
+
+            Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
+
+            rpcTempCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
+
+            for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
+            {
+              rpcTempCU->getSPAbsPartIdx(0, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
+              rpcTempCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
+              rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
+              rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
+            }
+          }
+          else
+          {
+#endif
+            rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
+            rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
+            rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
+#if MTK_SPIVMP_F0110
+          }
+#endif
 #if H_3D_ARP && !QC_MTK_INTERVIEW_ARP_F0123_F0108
           if( nARPW )
@@ -2054,4 +2093,8 @@
   }
  }
+#if MTK_SPIVMP_F0110
+ delete pcMvFieldSP;
+ delete puhInterDirSP;
+#endif
 #if H_3D_ARP
  }
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 716)
@@ -3616,4 +3616,7 @@
                                  , InheritedVSPDisInfo*  inheritedVSPDisInfo
 #endif
+#if MTK_SPIVMP_F0110
+                                 , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
+#endif
                                  , Int& numValidMergeCand
                                  )
@@ -3639,4 +3642,7 @@
                                         , inheritedVSPDisInfo
 #endif
+#if MTK_SPIVMP_F0110
+                                        , pbSPIVMPFlag, pcMvFieldSP, puhInterDirSP
+#endif
                                         , numValidMergeCand
         );
@@ -3663,4 +3669,7 @@
                                       , inheritedVSPDisInfo
 #endif
+#if MTK_SPIVMP_F0110
+                                      , pbSPIVMPFlag, pcMvFieldSP, puhInterDirSP
+#endif
                                       , numValidMergeCand
       );
@@ -3691,6 +3700,29 @@
       PartSize ePartSize = pcCU->getPartitionSize( 0 );
 
-      pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
-      pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
+#if MTK_SPIVMP_F0110
+      pcCU->setSPIVMPFlagSubParts( pbSPIVMPFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx )); 
+      if (pbSPIVMPFlag[uiMergeCand])
+      {
+        UInt uiSPAddr;
+
+        Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
+
+        pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
+
+        for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
+        {
+          pcCU->getSPAbsPartIdx(uiAbsPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
+          pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
+          pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
+        }
+      }
+      else
+      {
+#endif
+        pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
+        pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
+#if MTK_SPIVMP_F0110
+      }
+#endif
 
 #if H_3D_VSP
@@ -4369,5 +4401,12 @@
       DisInfo OriginalDvInfo = pcCU->getDvInfo(uiAbsPartIdx);
 #endif
-
+#if MTK_SPIVMP_F0110
+      Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
+      memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
+      TComMvField*  pcMvFieldSP;
+      UChar* puhInterDirSP;
+      pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2]; 
+      puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()]; 
+#endif
       xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours
 #if H_3D_VSP
@@ -4375,4 +4414,7 @@
                       , inheritedVSPDisInfo
 #endif
+#if MTK_SPIVMP_F0110
+                      , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
+#endif 
                       , numValidMergeCand
                       );
@@ -4386,9 +4428,41 @@
         pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMRGIndex].m_acDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
 #endif
-        pcCU->setInterDirSubParts  ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
-        {
-          pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx );
-          pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx );
-        }
+#if MTK_SPIVMP_F0110
+        pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );  
+        if (bSPIVMPFlag[uiMRGIndex]!=0)
+        {
+          UInt uiSPAddr;
+
+          Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
+
+          pcCU->getSPPara(iRoiWidth, iRoiHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
+
+          for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
+          {
+            pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
+            pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
+            pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
+            pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
+          }
+
+          if ( pcCU->getInterDir(uiPartAddr) == 3 && pcCU->isBipredRestriction(iPartIdx) )
+          {
+            pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( TComMv(0,0), ePartSize, uiPartAddr, 0, iPartIdx);
+            pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( -1, ePartSize, uiPartAddr, 0, iPartIdx);
+            pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ));
+          }
+
+        }
+        else
+        {
+#endif
+          pcCU->setInterDirSubParts  ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
+          {
+            pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx );
+            pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx );
+          }
+#if MTK_SPIVMP_F0110
+        }
+#endif
 
         pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd    ( cMvZero,            ePartSize, uiPartAddr, 0, iPartIdx );
@@ -4402,4 +4476,7 @@
       else
       {
+#if MTK_SPIVMP_F0110        
+        pcCU->setSPIVMPFlagSubParts(0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 
+#endif
         // set ME result
         pcCU->setMergeFlagSubParts( false,        uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
@@ -4414,4 +4491,8 @@
         }
       }
+#if MTK_SPIVMP_F0110
+      delete pcMvFieldSP;
+      delete puhInterDirSP;
+#endif
     }
 
@@ -5326,5 +5407,9 @@
       dZeroCost = dCost + 1;
     }
+#if MTK_SPIVMP_F0110
+    if ( dZeroCost < dCost || pcCU->getQtRootCbf(0)==0)
+#else
     if ( dZeroCost < dCost )
+#endif
     {
       dCost        = dZeroCost;
Index: /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncSearch.h	(revision 715)
+++ /branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibEncoder/TEncSearch.h	(revision 716)
@@ -427,4 +427,7 @@
                                   , InheritedVSPDisInfo*  inheritedVSPDisInfo
 #endif
+#if MTK_SPIVMP_F0110
+                                  , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
+#endif
                                   , Int& numValidMergeCand
                                    );
