Index: /branches/HTM-8.0-dev0/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /branches/HTM-8.0-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 614)
+++ /branches/HTM-8.0-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 615)
@@ -719,5 +719,5 @@
   ("ViewSynthesisPred",               m_viewSynthesisPredFlag,  true           , "view synthesis prediction " )  
 #endif
-#if H_3D_TMVP
+#if H_3D
   ("IvMvScaling",                     m_ivMvScalingFlag      ,  true            , "inter view motion vector scaling" )    
 #endif
@@ -2283,5 +2283,5 @@
   printf("ViewSynthesisPred:%d ", m_viewSynthesisPredFlag );
 #endif
-#if H_3D_TMVP
+#if H_3D
   printf("IvMvScaling:%d ", m_ivMvScalingFlag ? 1 : 0  );
 #endif
Index: /branches/HTM-8.0-dev0/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- /branches/HTM-8.0-dev0/source/App/TAppEncoder/TAppEncCfg.h	(revision 614)
+++ /branches/HTM-8.0-dev0/source/App/TAppEncoder/TAppEncCfg.h	(revision 615)
@@ -115,5 +115,5 @@
   Bool m_viewSynthesisPredFlag;
 #endif
-#if H_3D_TMVP
+#if H_3D
   Bool m_ivMvScalingFlag; 
 #endif
Index: /branches/HTM-8.0-dev0/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/HTM-8.0-dev0/source/App/TAppEncoder/TAppEncTop.cpp	(revision 614)
+++ /branches/HTM-8.0-dev0/source/App/TAppEncoder/TAppEncTop.cpp	(revision 615)
@@ -1242,5 +1242,5 @@
 #endif
   }  
-#if H_3D_TMVP
+#if H_3D
   vps.setIvMvScalingFlag( m_ivMvScalingFlag );   
 #endif
Index: /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComDataCU.cpp	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComDataCU.cpp	(revision 615)
@@ -146,7 +146,4 @@
 #if H_3D_VSP
   m_piVSPFlag            = NULL;
-#if MTK_VSP_FIX_E0172
-  m_piVSPDir             = NULL;
-#endif
 #endif
 #if H_3D_ARP
@@ -200,7 +197,4 @@
 #if H_3D_VSP
     m_piVSPFlag          = (Char*  )xMalloc(Char,   uiNumPartition);
-#if MTK_VSP_FIX_E0172
-    m_piVSPDir           = (Char*  )xMalloc(Char,   uiNumPartition);
-#endif
 #endif
     m_puhLumaIntraDir    = (UChar* )xMalloc(UChar,  uiNumPartition);
@@ -363,7 +357,4 @@
 #if H_3D_VSP
     if ( m_piVSPFlag          ) { xFree(m_piVSPFlag);           m_piVSPFlag         = NULL; }
-#if MTK_VSP_FIX_E0172
-    if ( m_piVSPDir           ) { xFree(m_piVSPDir  );          m_piVSPDir          = NULL; }
-#endif
 #endif
     if ( m_puhLumaIntraDir    ) { xFree(m_puhLumaIntraDir);     m_puhLumaIntraDir   = NULL; }
@@ -573,7 +564,4 @@
 #if H_3D_VSP
     m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui];
-#if MTK_VSP_FIX_E0172
-    m_piVSPDir  [ui] = pcFrom->m_piVSPDir[ui];
-#endif
 #endif
     m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui];
@@ -618,7 +606,4 @@
 #if H_3D_VSP
     memset( m_piVSPFlag         + firstElement, 0,                        numElements * sizeof( *m_piVSPFlag ) );
-#if MTK_VSP_FIX_E0172
-    memset( m_piVSPDir          + firstElement, 0,                        numElements * sizeof( *m_piVSPDir   ) );
-#endif
 #endif
     memset( m_puhLumaIntraDir   + firstElement, DC_IDX,                   numElements * sizeof( *m_puhLumaIntraDir ) );
@@ -802,7 +787,4 @@
 #if H_3D_VSP
       m_piVSPFlag[ui] = 0;
-#if MTK_VSP_FIX_E0172
-      m_piVSPDir  [ui] = 0;
-#endif
 #endif
       m_puhLumaIntraDir[ui] = DC_IDX;
@@ -906,7 +888,4 @@
 #if H_3D_VSP
   memset( m_piVSPFlag,          0, sizeof( Char  ) * m_uiNumPartition );
-#if MTK_VSP_FIX_E0172
-  memset( m_piVSPDir  ,         0, sizeInChar );
-#endif
 #endif
   memset( m_puhLumaIntraDir,    DC_IDX, iSizeInUchar );
@@ -1005,10 +984,5 @@
 #if H_3D_VSP
       m_piVSPFlag[ui]=pcCU->m_piVSPFlag[uiPartOffset+ui];
-#if MTK_VSP_FIX_ALIGN_WD_E0172
       m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui];
-#endif
-#if MTK_VSP_FIX_E0172
-      m_piVSPDir[ui]=pcCU->m_piVSPDir[uiPartOffset+ui];
-#endif
 #endif
       m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui];
@@ -1162,7 +1136,4 @@
 #if H_3D_VSP
   m_piVSPFlag           = pcCU->getVSPFlag()          + uiPart;
-#if MTK_VSP_FIX_E0172
-  m_piVSPDir            = pcCU->getVSPDir  ()         + uiPart;
-#endif
 #endif
 
@@ -1321,10 +1292,5 @@
 #if H_3D_VSP
   m_piVSPFlag          = pcCU->getVSPFlag()               + uiAbsPartIdx;
-#if MTK_VSP_FIX_ALIGN_WD_E0172
   m_pDvInfo            = pcCU->getDvInfo()                + uiAbsPartIdx;
-#endif
-#if MTK_VSP_FIX_E0172
-  m_piVSPDir           = pcCU->getVSPDir  ()              + uiAbsPartIdx;
-#endif
 #endif
 
@@ -1374,10 +1340,6 @@
 #if H_3D_VSP
   memcpy( m_piVSPFlag           + uiOffset, pcCU->getVSPFlag(),           sizeof( Char ) * uiNumPartition );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
   memcpy( m_pDvInfo             + uiOffset, pcCU->getDvInfo(),            sizeof( *m_pDvInfo ) * uiNumPartition );
-#endif
-#if MTK_VSP_FIX_E0172
-  memcpy( m_piVSPDir            + uiOffset, pcCU->getVSPDir  (),          sizeInChar );
-#endif
+
 #endif
   memcpy( m_puhLumaIntraDir     + uiOffset, pcCU->getLumaIntraDir(),      iSizeInUchar );
@@ -1509,10 +1471,5 @@
 #if H_3D_VSP
   memcpy( rpcCU->getVSPFlag()           + m_uiAbsIdxInLCU, m_piVSPFlag,           sizeof( Char ) * m_uiNumPartition );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
   memcpy( rpcCU->getDvInfo()            + m_uiAbsIdxInLCU, m_pDvInfo,             sizeof( *m_pDvInfo ) * m_uiNumPartition );
-#endif
-#if MTK_VSP_FIX_E0172
-  memcpy( rpcCU->getVSPDir  ()          + m_uiAbsIdxInLCU, m_piVSPDir  ,          sizeInChar );
-#endif
 #endif
   memcpy( rpcCU->getLumaIntraDir()      + m_uiAbsIdxInLCU, m_puhLumaIntraDir,     iSizeInUchar );
@@ -1632,7 +1589,4 @@
 #if H_3D_VSP
   memcpy( rpcCU->getVSPFlag()           + uiPartOffset, m_piVSPFlag,           sizeof(Char) * uiQNumPart );
-#if MTK_VSP_FIX_E0172
-  memcpy( rpcCU->getVSPDir  ()          + uiPartOffset, m_piVSPDir  ,          sizeInChar );
-#endif
 #endif
   memcpy( rpcCU->getLumaIntraDir()      + uiPartOffset, m_puhLumaIntraDir,     iSizeInUchar );
@@ -2761,5 +2715,5 @@
   setSubPart<Char>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx );
 }
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
 template<typename T>
 Void TComDataCU::setSubPartT( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx )
@@ -2895,10 +2849,4 @@
   }
 
-}
-#endif
-#if MTK_VSP_FIX_E0172
-Void TComDataCU::setVSPDirSubParts ( Char iVSPDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
-{
-  setSubPart<Char>( iVSPDir, m_piVSPDir, uiAbsPartIdx, uiDepth, uiPartIdx );
 }
 #endif
@@ -3355,58 +3303,39 @@
  *   false: otherwise
  */
-#if MTK_VSP_FIX_E0172
-inline Bool TComDataCU::xAddVspCand( UChar ucVspMergePos, Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
-                                    Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int* vspDir )
-#else
-inline Bool TComDataCU::xAddVspCand( UChar ucVspMergePos, Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
+inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
                                      Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag )
-#endif
-{
-  if ( ucVspMergePos != H_3D_VSP_POSITION || 0 == m_pcSlice->getViewIndex() || !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) || m_pcSlice->getIsDepth() )
+{
+  if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) || m_pcSlice->getIsDepth() )
+  {
     return false;
+  }
 
   Int refViewIdx = pDInfo->m_aVIdxCan;
   TComPic* picDepth = getSlice()->getIvPic( true, refViewIdx );
+  
   if( picDepth == NULL ) // No depth reference avail
+  {
+    // Is this allowed to happen? When not an assertion should be added here!
     return false;
-  
-  Bool refViewAvailFlag = false;
-  UChar predFlag[2] = {0, 0};
-  Int  iRefListIdX = 0;
-  Int  iRefListIdY = 0;
-  Int  i;
-#if MTK_VSP_FIX_ALIGN_WD_E0172
-  Int currViewId = m_pcSlice->getViewId();
-  Int derivedViewId = -1;
-  Int otherViewId = -1;
-#endif
-#if MTK_VSP_FIX_E0172
-  Int currViewId = m_pcSlice->getViewId();
-  Int derivedViewId = -1;
-  Int otherViewId = -1;
-#endif
-  for( iRefListIdX = 0; iRefListIdX < 2 && !refViewAvailFlag; iRefListIdX++ )
-  {
-    RefPicList eRefPicList = RefPicList( iRefListIdX );
-    for ( i = 0; i < m_pcSlice->getNumRefIdx(eRefPicList) && !refViewAvailFlag; i++ )
-    {
-      Int viewIdxRefInList = m_pcSlice->getRefPic(eRefPicList, i)->getViewIndex();
-      if ( viewIdxRefInList == refViewIdx )
-      {
-        refViewAvailFlag = true;
+  }
+  
+  Bool  refViewAvailFlag = false;
+  UChar predFlag[2]      = {0, 0};  
+  Int   refListIdY       = 0;    
+  Int   viewIdInRefListX = -1;
+  
+  for( Int iRefListIdX = 0; iRefListIdX < 2 && !refViewAvailFlag; iRefListIdX++ )
+  {
+    RefPicList eRefPicListX = RefPicList( iRefListIdX );
+    for ( Int i = 0; i < m_pcSlice->getNumRefIdx(eRefPicListX) && !refViewAvailFlag; i++ )
+    {
+      Int viewIdxRefInListX = m_pcSlice->getRefPic(eRefPicListX, i)->getViewIndex();
+      if ( viewIdxRefInListX == refViewIdx )
+      {
+        refViewAvailFlag      = true;
         predFlag[iRefListIdX] = 1;
-#if MTK_VSP_FIX_ALIGN_WD_E0172
-        derivedViewId = m_pcSlice->getRefPic(eRefPicList, i)->getViewId();
-#endif
-#if MTK_VSP_FIX_E0172
-        vspDir[iCount] = iRefListIdX;
-        derivedViewId = m_pcSlice->getRefPic(eRefPicList, i)->getViewId(); 
-#endif
-        iRefListIdY = 1 - iRefListIdX;
-#if H_3D_FIX_BVSP
+        viewIdInRefListX      = m_pcSlice->getRefPic(eRefPicListX, i)->getViewId();
+        refListIdY            = 1 - iRefListIdX;
         pcMvFieldNeighbours[(iCount<<1)+iRefListIdX].setMvField( pDInfo->m_acNBDV, i );
-#else
-        pcMvFieldNeighbours[(iCount<<1)+iRefListIdX].setMvField( pDInfo->m_acDoNBDV, i );
-#endif
 #if H_3D_NBDV
         pcMvFieldNeighbours[(iCount<<1)+iRefListIdX].getMv().setIDVFlag (false);
@@ -3418,21 +3347,24 @@
   if (m_pcSlice->isInterB() && refViewAvailFlag)
   {
-    RefPicList eRefPicList = RefPicList( iRefListIdY );
+    RefPicList eRefPicListY = RefPicList( refListIdY );
     refViewAvailFlag = false;
-    for ( i = 0; i < m_pcSlice->getNumRefIdx(eRefPicList) && !refViewAvailFlag; i++ )
-    {
-      Int viewIdxRefInList = m_pcSlice->getRefPic(eRefPicList, i)->getViewIndex();
-      if ( viewIdxRefInList != refViewIdx && viewIdxRefInList != m_pcSlice->getViewIndex() )
+    for ( Int i = 0; i < m_pcSlice->getNumRefIdx(eRefPicListY) && !refViewAvailFlag; i++ )
+    {
+      Int viewIdxRefInListY = m_pcSlice->getRefPic(eRefPicListY, i)->getViewIndex();
+      if ( viewIdxRefInListY != refViewIdx && viewIdxRefInListY != m_pcSlice->getViewIndex() )
       {
         refViewAvailFlag = true;
-        predFlag[iRefListIdY] = 1;
-#if MTK_VSP_FIX_E0172 || MTK_VSP_FIX_ALIGN_WD_E0172
-#if H_3D_FIX_BVSP
+        predFlag[refListIdY] = 1;
         TComMv  cMv = pDInfo->m_acNBDV;
-#else
-        TComMv  cMv = pDInfo->m_acDoNBDV;
-#endif
-        otherViewId = m_pcSlice->getRefPic( eRefPicList, i)->getViewId();
-        Int iScale = xGetDistScaleFactor( currViewId, otherViewId, currViewId, derivedViewId );
+        
+        Int viewIdInRefListY = m_pcSlice->getRefPic( eRefPicListY, i)->getViewId();
+        Int currViewId       = m_pcSlice->getViewId();
+        
+        //// Following might be added here when MV-HEVC 5 HLS is included (and derivations above removed): 
+        // Int viewIdInRefListX = m_pcSlice->getVPS()->getViewIdVal( refViewIdx  ); 
+        
+        Int iScale      = xGetDistScaleFactor( currViewId, viewIdInRefListY, currViewId, viewIdInRefListX );
+        
+        // Can iScale == 4096 happen?, I guess not since viewIdInRefListY is always unequal to viewIdInRefListX.
         if ( iScale != 4096 && m_pcSlice->getVPS()->getIvMvScalingFlag() ) 
         {
@@ -3445,14 +3377,7 @@
         }
         clipMv( cMv );
-        pcMvFieldNeighbours[(iCount<<1)+iRefListIdY].setMvField( cMv, i );
-#else
-#if H_3D_FIX_BVSP
-        pcMvFieldNeighbours[(iCount<<1)+iRefListIdY].setMvField( pDInfo->m_acNBDV, i );
-#else
-        pcMvFieldNeighbours[(iCount<<1)+iRefListIdY].setMvField( pDInfo->m_acDoNBDV, i );
-#endif
-#endif
+        pcMvFieldNeighbours[(iCount<<1)+refListIdY].setMvField( cMv, i );
 #if H_3D_NBDV
-        pcMvFieldNeighbours[(iCount<<1)+iRefListIdY].getMv().setIDVFlag (false);
+        pcMvFieldNeighbours[(iCount<<1)+refListIdY].getMv().setIDVFlag (false);
 #endif
       }
@@ -3461,10 +3386,12 @@
 
   // Set values to be returned
-  abCandIsInter[iCount] = true;
+  abCandIsInter        [iCount] = true;
   puhInterDirNeighbours[iCount] = (predFlag[0] | (predFlag[1] << 1));
-  vspFlag[iCount] = 1;
+  vspFlag              [iCount] = 1;
 
   if ( mrgCandIdx == iCount )
+  {
     return true;
+  }
 
   iCount++;
@@ -3475,14 +3402,15 @@
 #endif
 
-#if QC_INRIA_MTK_MRG_E0126
-inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int*   iPdmDir, TComMv* acPdmMv, 
-                                       Int* aiPdmRefIdx, Int iPosDmv, Int* vspFlag )
-{
-  for(Int iLoop = 0; iLoop  < 2; iLoop ++ ) 
-  {
+#if H_3D_IV_MERGE
+inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, 
+                                       Int* ivCandRefIdx, Int iPosIvDC, Int* vspFlag )
+{
+  for(Int iLoop = 0; iLoop < 2; iLoop ++ ) 
+  {
+    // IvDcShift (Derived from spatial Iv neighboring blocks)
     if( iLoop == 1 )
     {
       Int iFirDispCand = -1;
-      if (xFirstDmvAvai(iCount, pcMvFieldNeighbours, iPdmDir, iPosDmv, vspFlag, iFirDispCand))
+      if (xGetPosFirstAvailDmvCand(iCount, pcMvFieldNeighbours, ivCandDir, iPosIvDC, vspFlag, iFirDispCand))
       {
         TComMv cMv;
@@ -3494,40 +3422,46 @@
         }
         clipMv( cMv );
-        abCandIsInter[ iCount ] = true;
+        abCandIsInter        [ iCount ] = true;
         puhInterDirNeighbours[ iCount ] = puhInterDirNeighbours[iFirDispCand];
-        pcMvFieldNeighbours[ iCount<<1  ].setMvField(cMv, pcMvFieldNeighbours[( iFirDispCand << 1)].getRefIdx() );
-        pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField(pcMvFieldNeighbours[(iFirDispCand << 1) + 1].getMv(), pcMvFieldNeighbours[( iFirDispCand << 1) + 1].getRefIdx() );
+        pcMvFieldNeighbours  [ iCount << 1      ].setMvField(cMv, pcMvFieldNeighbours[( iFirDispCand << 1)].getRefIdx() );
+        pcMvFieldNeighbours  [(iCount << 1) + 1 ].setMvField(pcMvFieldNeighbours[(iFirDispCand << 1) + 1].getMv(), pcMvFieldNeighbours[( iFirDispCand << 1) + 1].getRefIdx() );
+        
         if( mrgCandIdx == iCount ) 
         {
           return true;
         }
+
         iCount++;
         break;
       }
     }
-    if(iPdmDir[iLoop + 2])
-    {
-      abCandIsInter[ iCount ] = true;
-      puhInterDirNeighbours[ iCount ] = iPdmDir[iLoop + 2];
-      if( ( iPdmDir[iLoop + 2] & 1 ) == 1 )
-      {
-        pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ (iLoop<<1) + 4 ], aiPdmRefIdx[ (iLoop<<1) + 4 ] ); 
-      }
-      if( ( iPdmDir[iLoop + 2] & 2 ) == 2 )
-      {
-        pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField( acPdmMv[ (iLoop<<1) + 5 ], aiPdmRefIdx[ (iLoop<<1) + 5 ] );
+
+    /// iLoop = 0 --> IvMCShift
+    /// iLoop = 1 --> IvDCShift  (Derived from IvDC)
+    if(ivCandDir[iLoop + 2])
+    {
+      abCandIsInter        [ iCount ] = true;
+      puhInterDirNeighbours[ iCount ] = ivCandDir[iLoop + 2];
+      if( ( ivCandDir[iLoop + 2] & 1 ) == 1 )
+      {
+        pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] ); 
+      }
+      if( ( ivCandDir[iLoop + 2] & 2 ) == 2 )
+      {
+        pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] );
       }
      
-      bool bRemove = false;
-      if(!iLoop && iPdmDir[0] > 0)
-      {
-        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[1]==pcMvFieldNeighbours[(iCount<<1)+1])
+      // Prune IvMC vs. IvMcShift
+      Bool bRemove = false;      
+      if( !iLoop && ivCandDir[0] > 0)
+      {
+        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0 ]== pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[1]==pcMvFieldNeighbours[(iCount<<1)+1])
         {
-            bRemove                      = true;
+            bRemove                         = true;
             abCandIsInter        [ iCount ] = false;  
-            puhInterDirNeighbours[iCount]   = 0;
+            puhInterDirNeighbours[ iCount ] = 0;
             TComMv  cZeroMv;
-            pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
-            pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
+            pcMvFieldNeighbours  [ iCount<<1   ].setMvField( cZeroMv, NOT_VALID );
+            pcMvFieldNeighbours  [(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
         }
       }
@@ -3535,5 +3469,5 @@
       {
 #if H_3D_NBDV
-        if(iLoop)
+        if(iLoop) // For IvMcShift candidate
         {
           pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
@@ -3553,15 +3487,16 @@
 } 
 
-inline Bool TComDataCU::xFirstDmvAvai( Int& iCount, TComMvField* pcMvFieldNeighbours, Int* iPdmDir, Int iPosDmv, Int* vspFlag, Int& iFirDispCand )
-{
-  for ( Int i = (iPdmDir[0] ? 1: 0); i < iCount; i++ )
-  {
-    if ( ( i == iPosDmv ) || ( vspFlag[ i ] == 1 ) )
+inline Bool TComDataCU::xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int* ivCandDir, Int posIvDC, Int* vspFlag, Int& posFirstAvailDmvCand )
+{
+  // ivCandDir[0] == true --> IvMC is available and excluded in loop over merge list. 
+  for ( Int currListPos = (ivCandDir[0] ? 1 : 0); currListPos < iCount; currListPos++ )
+  {
+    if ( ( currListPos == posIvDC ) || ( vspFlag[ currListPos ] == 1 ) )
     {
       continue;
     }
-    else if((pcMvFieldNeighbours[i<<1].getRefIdx()!=-1) && (getSlice()->getViewIndex() != getSlice()->getRefPic(RefPicList(0), pcMvFieldNeighbours[i<<1].getRefIdx())->getViewIndex()))
-    {
-      iFirDispCand = i;
+    else if((pcMvFieldNeighbours[currListPos<<1].getRefIdx() != -1 ) && (getSlice()->getViewIndex() != getSlice()->getRefPic(RefPicList(0), pcMvFieldNeighbours[currListPos<<1].getRefIdx())->getViewIndex()))
+    {
+      posFirstAvailDmvCand = currListPos;
       return true;
     }
@@ -3582,10 +3517,5 @@
 #if H_3D_VSP
       , Int* vspFlag
-#if MTK_VSP_FIX_ALIGN_WD_E0172
       , InheritedVSPDisInfo*  inheritedVSPDisInfo
-#endif
-#if MTK_VSP_FIX_E0172
-      , Int* vspDir
-#endif
 #endif
       , Int& numValidMergeCand, Int mrgCandIdx
@@ -3594,4 +3524,7 @@
   UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx;
 #if H_3D_IV_MERGE
+  ////////////////////////////
+  //////// INIT LISTS ////////
+  ////////////////////////////
   TComMv cZeroMv;
   Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
@@ -3611,4 +3544,9 @@
   }
   numValidMergeCand = getSlice()->getMaxNumMergeCand();
+#if H_3D
+  //////////////////////////////////
+  //////// DERIVE LOCATIONS ////////
+  //////////////////////////////////
+#endif
   // compute the location of the current PU
   Int xP, yP, nPSW, nPSH;
@@ -3622,33 +3560,9 @@
   deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
 #if H_3D_IV_MERGE
-  Bool ivMvPredFlag   = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() );
-
-  //===== add merge with predicted depth maps =====
-#if QC_INRIA_MTK_MRG_E0126
-  TComMv acPdmMv         [8];
-  Int aiPdmRefIdx        [8] = {-1, -1, -1, -1, -1, -1, -1, -1};
-  Int iPosDmv                = -1;
-#else 
-  TComMv  acPdmMv       [4];
-  Int     aiPdmRefIdx   [4] = {-1, -1, -1, -1};
-#endif
-  Bool    bLeftAvai         = false;
-  Int     iPosLeftAbove[2]  = {-1, -1};
-
-
-  DisInfo cDisInfo;
-
-  cDisInfo.bDV = getDvInfo(uiAbsPartIdx).bDV;
-#if H_3D_NBDV_REF
-  cDisInfo.m_acDoNBDV = getDvInfo(uiAbsPartIdx).m_acDoNBDV;
-#endif //H_3D_NBDV_REF
-  cDisInfo.m_acNBDV = getDvInfo(uiAbsPartIdx).m_acNBDV;
-  cDisInfo.m_aVIdxCan = getDvInfo(uiAbsPartIdx).m_aVIdxCan;
-#if MTK_VSP_FIX_ALIGN_WD_E0172
-  for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++)
-  {
-    inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo;
-  }
-#endif
+  
+  /////////////////////////////////////////////
+  //////// TEXTURE MERGE CANDIDATE (T) ////////
+  /////////////////////////////////////////////
+
   if( m_pcSlice->getIsDepth())
   {
@@ -3659,5 +3573,4 @@
     if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdxCenter ) )
     {
-#if MTK_TEXTURE_MRGCAND_BUGFIX_E0182
       pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
       Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1].getRefIdx() );
@@ -3699,96 +3612,58 @@
         iCount ++;
       }
-#else
-      abCandIsInter[iCount] = true;      
-      puhInterDirNeighbours[iCount] = pcTextureCU->getInterDir( uiPartIdxCenter );
-#if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
-      pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
-      if (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0)
-#else
-      if( ( puhInterDirNeighbours[iCount] & 1 ) == 1 )
-#endif
-      {
-#if !MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
-        pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
-#endif
-        TComMv cMvPred = pcMvFieldNeighbours[iCount<<1].getMv();
-
-#if H_3D_IC
-        const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
-        cMvPred+=cAdd;
-        cMvPred>>=2;
-        clipMv(cMvPred);
-#endif
-        //pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,pcMvFieldNeighbours[iCount<<1].getRefIdx());
-#if H_3D //Notes from QC: for BVSP coded blocks, the reference index shall not be equal to -1 due to the adoption of JCT3V-D0191
-        pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,pcMvFieldNeighbours[iCount<<1].getRefIdx());
-#endif
-      }
-      
-      if ( getSlice()->isInterB() )
-      {
-#if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
-        pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
-        if (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0)
-#else
-        if( ( puhInterDirNeighbours[iCount] & 2 ) == 2 )
-#endif
-        {
-#if !MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
-          pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
-#endif
-          TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv();
-#if H_3D_IC
-          const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
-          cMvPred+=cAdd;
-          cMvPred>>=2;
-          clipMv(cMvPred);
-#endif
-          pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx());
-        }
-      }
-#if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
-      puhInterDirNeighbours[iCount] = (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0)?1:0;
-      puhInterDirNeighbours[iCount] += (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0)?2:0;
-#endif
-#if H_3D_NBDV
-      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
-      if ( mrgCandIdx == iCount )
-      {
-        return;
-      }
-      iCount ++;
-#endif//Bug fix
-    }
-  }
-
-#if QC_INRIA_MTK_MRG_E0126
-  Int iPdmDir[4] = {0, 0, 0, 0};
-#else
-  Int iPdmDir[2] = {0, 0};
-#endif
+    }
+  }
+
+  //////////////////////////////////
+  //////// GET DISPARITIES  ////////
+  //////////////////////////////////
+
+  DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
+
+  for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++)
+  {
+    inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo;
+  }
+
+  /////////////////////////////////////////////////////////////////
+  //////// DERIVE IvMC, IvMCShift,IvDCShift, IvDC  Candidates /////
+  /////////////////////////////////////////////////////////////////
+
+  Int  posIvDC          = -1;
+  Bool bLeftAvai        = false;
+  Int  iPosLeftAbove[2] = {-1, -1};
+
+
+  // { IvMCL0, IvMCL1, IvDCL0, IvDCL1, IvMCL0Shift, IvMCL1Shift, IvDCL0Shift, IvDCL1Shift };  
+  // An enumerator would be appropriate here! 
+  TComMv ivCandMv    [8];
+  Int    ivCandRefIdx[8] = {-1, -1, -1, -1, -1, -1, -1, -1};
+
+  // { IvMC, IvDC, IvMCShift, IvDCShift };  
+  Int    ivCandDir   [4] = {0, 0, 0, 0};
+
+  Bool ivMvPredFlag   = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() );
   
   if ( ivMvPredFlag )
   {
-    getInterViewMergeCands(uiPUIdx, aiPdmRefIdx, acPdmMv, &cDisInfo, iPdmDir );
+    getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir );
   }  
-    
-  Int iPdmInterDir;
-
-  if( iPdmDir[0] )
+  
+  ///////////////////////////////////////////////
+  //////// INTER VIEW MOTION COMP(IvMC) /////////
+  ///////////////////////////////////////////////
+
+  if( ivCandDir[0] )
   {
     abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = iPdmDir[0];
-    iPdmInterDir                    = iPdmDir[0];
-
-    if( ( iPdmInterDir & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
-    }
-    if( ( iPdmInterDir & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
+    puhInterDirNeighbours[ iCount ] = ivCandDir[0];    
+
+    if( ( ivCandDir[0] & 1 ) == 1 )
+    {
+      pcMvFieldNeighbours[ iCount<<1    ].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] );
+    }
+    if( ( ivCandDir[0] & 2 ) == 2 )
+    {
+      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] );
     }
 
@@ -3799,4 +3674,5 @@
     iCount ++;
   } 
+
   // early termination
   if (iCount == getSlice()->getMaxNumMergeCand()) 
@@ -3806,4 +3682,9 @@
 #endif
 
+#if H_3D
+  ////////////////////////////
+  //////// LEFT (A1) /////////
+  ////////////////////////////
+#endif
   //left
   UInt uiLeftPartIdx = 0;
@@ -3852,17 +3733,9 @@
 #if H_3D_VSP
       if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1)
-#if MTK_VSP_FIX_E0172 || MTK_VSP_FIX_ALIGN_WD_E0172
-      {
-#endif
+      {
         vspFlag[iCount] = 1;
-#if MTK_VSP_FIX_ALIGN_WD_E0172
         xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo);
       }
 #endif
-#if MTK_VSP_FIX_E0172
-        vspDir[iCount] = pcCULeft->getVSPDir( uiLeftPartIdx );
-      }
-#endif
-#endif
       if ( mrgCandIdx == iCount )
       {
@@ -3871,5 +3744,5 @@
       iCount ++;
     }
-#else
+#else // H_3D_IV_MERGE 
     if ( mrgCandIdx == iCount )
     {
@@ -3877,5 +3750,5 @@
     }
     iCount ++;
-#endif
+#endif // H_3D_IV_MERGE 
   }
   
@@ -3885,4 +3758,9 @@
     return;
   }
+#if H_3D
+  ////////////////////////////
+  //////// ABOVE (B1) ////////
+  ////////////////////////////
+#endif
   // above
   UInt uiAbovePartIdx = 0;
@@ -3917,9 +3795,10 @@
         puhInterDirNeighbours[iCount]   = 0;
 
-        pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
+        pcMvFieldNeighbours[iCount<<1]    .setMvField( cZeroMv, NOT_VALID );
         pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
         break;
       }
     }
+
     if(!bRemoveSpa)
     {
@@ -3931,17 +3810,10 @@
 #if H_3D_VSP
       if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1)
-#if MTK_VSP_FIX_E0172 || MTK_VSP_FIX_ALIGN_WD_E0172
-      {
-#endif
+      {
+
         vspFlag[iCount] = 1;
-#if MTK_VSP_FIX_ALIGN_WD_E0172
         xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo);
       }
 #endif
-#if MTK_VSP_FIX_E0172
-        vspDir[iCount] = pcCUAbove->getVSPDir( uiAbovePartIdx );
-      }
-#endif
-#endif
       if ( mrgCandIdx == iCount )
       {
@@ -3950,5 +3822,5 @@
       iCount ++;
     }
-#else
+#else // H_3D_IV_MERGE 
     if ( mrgCandIdx == iCount )
     {
@@ -3956,5 +3828,5 @@
     }
     iCount ++;
-#endif
+#endif // H_3D_IV_MERGE 
   }
   // early termination
@@ -3963,4 +3835,10 @@
     return;
   }
+
+#if H_3D
+  //////////////////////////////////
+  //////// ABOVE RIGHT (B0) ////////
+  //////////////////////////////////
+#endif
 
   // above right
@@ -3988,16 +3866,8 @@
 #if H_3D_VSP
     if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1)
-#if MTK_VSP_FIX_E0172 || MTK_VSP_FIX_ALIGN_WD_E0172
-    {
-#endif
+    {
       vspFlag[iCount] = 1;
-#if MTK_VSP_FIX_ALIGN_WD_E0172
       xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo);
     }
-#endif
-#if MTK_VSP_FIX_E0172
-      vspDir[iCount] = pcCUAboveRight->getVSPDir( uiAboveRightPartIdx);
-    }
-#endif
 #endif
     if ( mrgCandIdx == iCount )
@@ -4014,16 +3884,20 @@
 
 #if H_3D_IV_MERGE 
-  if( iPdmDir[1] )
+  /////////////////////////////////////////////
+  //////// INTER VIEW DISP COMP (IvDC) ////////
+  /////////////////////////////////////////////
+
+  if( ivCandDir[1] )
   {
     assert(iCount < getSlice()->getMaxNumMergeCand());
     abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = iPdmDir[1];
-    if( ( iPdmDir[1] & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 2 ], aiPdmRefIdx[ 2 ] );
-    }
-    if( ( iPdmDir[1] & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 3 ], aiPdmRefIdx[ 3 ] );
+    puhInterDirNeighbours[ iCount ] = ivCandDir[1];
+    if( ( ivCandDir[1] & 1 ) == 1 )
+    {
+      pcMvFieldNeighbours[ iCount<<1    ].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] );
+    }
+    if( ( ivCandDir[1] & 2 ) == 2 )
+    {
+      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
     }
 
@@ -4032,6 +3906,8 @@
     {
       Int iCnloop = iPosLeftAbove[i];
-      if(iCnloop == -1) 
+      if ( iCnloop == -1 ) 
+      {
         continue;
+      }
       if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
       {
@@ -4051,7 +3927,5 @@
       pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
 #endif
-#if QC_INRIA_MTK_MRG_E0126
-      iPosDmv  = iCount;
-#endif
+      posIvDC  = iCount;
       if ( mrgCandIdx == iCount )
         return;
@@ -4065,16 +3939,26 @@
     }
   } 
-#endif
+#endif // H_3D_IV_MERGE 
 
 #if H_3D_VSP
-#if MTK_VSP_FIX_E0172
-  if ( xAddVspCand( H_3D_VSP_POSITION, mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, vspDir ) )
-#else
-  if ( xAddVspCand( H_3D_VSP_POSITION, mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) )
-#endif
+  /////////////////////////////////////////////////
+  //////// VIEW SYNTHESIS PREDICTION (VSP) ////////
+  /////////////////////////////////////////////////
+
+  if ( xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) )
+  {
     return;
+  }
+
   // early termination
   if (iCount == getSlice()->getMaxNumMergeCand())
+  {
     return;
+  }
+#endif
+#if H_3D
+  ///////////////////////////////////
+  //////// LEFT BOTTOM (A0) ////////
+  ///////////////////////////////////
 #endif
 
@@ -4103,16 +3987,8 @@
 #if H_3D_VSP
     if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1)
-#if MTK_VSP_FIX_E0172 || MTK_VSP_FIX_ALIGN_WD_E0172
-    {
-#endif
+    {
       vspFlag[iCount] = 1;
-#if MTK_VSP_FIX_ALIGN_WD_E0172
       xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo);
     }
-#endif
-#if MTK_VSP_FIX_E0172
-      vspDir[iCount] = pcCULeftBottom->getVSPDir( uiLeftBottomPartIdx);
-    }
-#endif
 #endif
     if ( mrgCandIdx == iCount )
@@ -4127,4 +4003,10 @@
     return;
   }
+#if H_3D
+  ///////////////////////////////////
+  //////// LEFT ABOVE (B2) ////////
+  ///////////////////////////////////
+#endif
+
   // above left 
   if( iCount < 4 )
@@ -4154,16 +4036,8 @@
 #if H_3D_VSP
       if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1)
-#if MTK_VSP_FIX_E0172 || MTK_VSP_FIX_ALIGN_WD_E0172
-      {
-#endif
+      {
         vspFlag[iCount] = 1;
-#if MTK_VSP_FIX_ALIGN_WD_E0172
         xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo);
       }
-#endif
-#if MTK_VSP_FIX_E0172
-        vspDir[iCount] = pcCUAboveLeft->getVSPDir( uiAboveLeftPartIdx);
-      }
-#endif
 #endif
       if ( mrgCandIdx == iCount )
@@ -4179,8 +4053,12 @@
     return;
   }
-#if QC_INRIA_MTK_MRG_E0126
+#if H_3D_IV_MERGE
+  ////////////////////////////////////////////////////
+  //////// SHIFTED IV (IvMCShift + IvDCShift) ////////
+  ////////////////////////////////////////////////////
+
   if(  ivMvPredFlag  ) 
   {
-    if(xAddIvMRGCand( mrgCandIdx,  iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, iPdmDir, acPdmMv, aiPdmRefIdx, iPosDmv, vspFlag))
+    if(xAddIvMRGCand( mrgCandIdx,  iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag))
     {
       return;
@@ -4192,4 +4070,9 @@
     }
   }
+#endif
+#if H_3D
+  /////////////////////////////////
+  //////// Collocate (COL) ////////
+  /////////////////////////////////
 #endif
   if ( getSlice()->getEnableTMVPFlag())
@@ -4311,7 +4194,11 @@
       Bool bValid = true;
       if ( vspFlag[i] == 1 || vspFlag[j] == 1 )
+      {
         bValid = false;
+      }
       if( !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) )
+      {
         assert(bValid == true);
+      }
 #endif
 #if H_3D_VSP
@@ -4374,5 +4261,5 @@
   numValidMergeCand = uiArrayAddr;
 }
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
 inline Void TComDataCU::xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount, InheritedVSPDisInfo*  inheritedVSPDisInfo)
 {
@@ -6011,5 +5898,5 @@
   }
 }
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
 Void TComDataCU::setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth )
 {
@@ -6150,6 +6037,7 @@
 TComDataCU::getInterViewMergeCands(UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc )
 {
-  TComSlice*    pcSlice         = getSlice ();  
-  Int iViewIndex = pDInfo->m_aVIdxCan;
+  TComSlice*    pcSlice = getSlice ();  
+  Int iViewIndex        = pDInfo->m_aVIdxCan;
+  
   //--- get base CU/PU and check prediction mode ---
   TComPic*    pcBasePic   = pcSlice->getIvPic( false, iViewIndex );
@@ -6174,38 +6062,27 @@
   TComMv      cDv = depthRefineFlag ? pDInfo->m_acDoNBDV : pDInfo->m_acNBDV; 
   
-#if !QC_INRIA_MTK_MRG_E0126
-  Int         iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + 2 ) >> 2 ) );
-  Int         iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (cDv.getVer() + 2 ) >> 2 )); 
-
-  Int         iBaseCUAddr;
-  Int         iBaseAbsPartIdx;
-  pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx );
-
-  TComDataCU* pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
-#endif
-#if QC_INRIA_MTK_MRG_E0126
   Bool abPdmAvailable[8] =  {false, false, false, false, false, false, false, false};
-#else
-  Bool abPdmAvailable[4] = {false, false, false, false};
-#endif
 #if H_3D_NBDV
-#if QC_INRIA_MTK_MRG_E0126
   for( Int i = 0; i < 8; i++)
-#else
-  for( Int i = 0; i < 4; i++)
-#endif
   {
     pacPdmMv[i].setIDVFlag   (false);
   }
 #endif
-#if QC_INRIA_MTK_MRG_E0126
-  for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
-  {
+
+  ////////////////////////////////
+  /////// IvMC + IvMCShift ///////
+  ////////////////////////////////
+
+  for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)  
+  {
+    // iLoopCan == 0 --> IvMC
+    // iLoopCan == 1 --> IvMCShift 
+
     Int         iBaseCUAddr;
     Int         iBaseAbsPartIdx;
 
-    Int offsetW = (iLoopCan == 0) ? 0 : ( ((iWidth/2)*4)  + 4 );
+    Int offsetW = (iLoopCan == 0) ? 0 : ( ((iWidth /2)*4) + 4 );
     Int offsetH = (iLoopCan == 0) ? 0 : ( ((iHeight/2)*4) + 4 );
-    
+
     Int         iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + offsetW + 2 ) >> 2 ) );
     Int         iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (cDv.getVer() + offsetH + 2 ) >> 2 ) ); 
@@ -6213,28 +6090,28 @@
 
     TComDataCU* pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
-#endif
-  if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA ))
-  {
-    for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ )
-    {
-      RefPicList  eCurrRefPicList = RefPicList( uiCurrRefListId );
-
-      Bool stopLoop = false;
-      for(Int iLoop = 0; iLoop < 2 && !stopLoop; ++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)
+    if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA ))
+    {
+      // Loop reference picture list of current slice (X in spec). 
+      for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ )       
+      {
+        RefPicList  eCurrRefPicList = RefPicList( uiCurrRefListId );
+
+        Bool stopLoop = false;
+        // Loop reference picture list of candidate slice (Y in spec)
+        for(Int iLoop = 0; iLoop < 2 && !stopLoop; ++iLoop)
         {
-          Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx);
-          if (iBaseRefPOC != pcSlice->getPOC())    
+          RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 -  uiCurrRefListId ) : RefPicList( uiCurrRefListId );
+          TComMvField cBaseMvField;
+          pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField );
+          Int         iBaseRefIdx     = cBaseMvField.getRefIdx();
+          if (iBaseRefIdx >= 0)
           {
-            for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eCurrRefPicList ); iPdmRefIdx++)
+            Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx);
+            if (iBaseRefPOC != pcSlice->getPOC())    
             {
-              if (iBaseRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx))
+              for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eCurrRefPicList ); iPdmRefIdx++)
               {
-#if QC_INRIA_MTK_MRG_E0126
+                if (iBaseRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx))
+                {
                   abPdmAvailable[ (uiCurrRefListId + (iLoopCan<<2)) ] = true;
                   TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
@@ -6243,28 +6120,12 @@
                   cMv.setIDVHor    (cDv.getHor());                  
                   cMv.setIDVVer    (cDv.getVer());  
-#if MTK_DVMCP_FIX_E0172
                   cMv.setIDVVId    (iViewIndex); 
-#endif
 #endif
                   clipMv( cMv );
                   paiPdmRefIdx  [ (uiCurrRefListId + (iLoopCan<<2)) ] = iPdmRefIdx;
                   pacPdmMv      [ (uiCurrRefListId + (iLoopCan<<2)) ] = cMv;
-#else
-                abPdmAvailable[ uiCurrRefListId ] = true;
-                TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
-#if H_3D_NBDV 
-                cMv.setIDVFlag   (true);
-                cMv.setIDVHor    (cDv.getHor());                  
-                cMv.setIDVVer    (cDv.getVer());  
-#if MTK_DVMCP_FIX_E0172
-                cMv.setIDVVId    (iViewIndex); 
-#endif
-#endif
-                clipMv( cMv );
-                paiPdmRefIdx  [ uiCurrRefListId ] = iPdmRefIdx;
-                pacPdmMv      [ uiCurrRefListId ] = cMv;
-#endif
-                stopLoop = true;
-                break;
+                  stopLoop = true;
+                  break;
+                }
               }
             }
@@ -6274,15 +6135,14 @@
     }
   }
-#if QC_INRIA_MTK_MRG_E0126
-  }
-#endif
-#if QC_INRIA_MTK_MRG_E0126
   for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
   {
     availableMcDc[(iLoopCan << 1)] = ( abPdmAvailable[(iLoopCan<<2)] ? 1 : 0 ) + ( abPdmAvailable[1 + (iLoopCan<<2)] ? 2 : 0);
   }
-#else
-  availableMcDc[0] = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 );
-#endif
+  
+  
+  ////////////////////////////////
+  /////// IvDC + IvDCShift ///////
+  ////////////////////////////////
+  
   for( Int iRefListId = 0; iRefListId < 2 ; iRefListId++ )
   {
@@ -6291,11 +6151,6 @@
     for( Int iPdmRefIdx = 0; iPdmRefIdx < iNumRefPics; iPdmRefIdx++ )
     {
-#if MTK_DIVMC_FIX_E0172
       if(( pcSlice->getRefPOC( eRefPicListDMV, iPdmRefIdx ) == pcSlice->getPOC()) && (pcSlice->getRefPic( eRefPicListDMV, iPdmRefIdx )->getViewIndex() == pDInfo->m_aVIdxCan))
-#else
-      if( pcSlice->getRefPOC( eRefPicListDMV, iPdmRefIdx ) == pcSlice->getPOC())
-#endif
-      {
-#if QC_INRIA_MTK_MRG_E0126
+      {
         for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
         {
@@ -6312,27 +6167,11 @@
         }
         break;
-#else
-        abPdmAvailable[ iRefListId+2 ] = true;
-        paiPdmRefIdx  [ iRefListId+2 ] = iPdmRefIdx;
-
-#if H_3D_NBDV_REF
-        TComMv cMv = depthRefineFlag ? pDInfo->m_acDoNBDV : pDInfo->m_acNBDV; 
-#endif // H_3D_NBDV_REF
-        cMv.setVer(0);
-        clipMv( cMv );
-        pacPdmMv      [ iRefListId + 2] = cMv;
-        break;
-#endif
-      }
-    }
-  }
-#if QC_INRIA_MTK_MRG_E0126
+      }
+    }
+  }
   for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
   {
     availableMcDc[1 + (iLoopCan << 1)] = ( abPdmAvailable[2 + (iLoopCan<<2)] ? 1 : 0 ) + ( abPdmAvailable[3 + (iLoopCan<<2)] ? 2 : 0 );
   }
-#else
-  availableMcDc[1] = ( abPdmAvailable[2] ? 1 : 0 ) + ( abPdmAvailable[3] ? 2 : 0 );
-#endif
   return false;
 }
Index: /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComDataCU.h	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComDataCU.h	(revision 615)
@@ -197,7 +197,4 @@
   Char*         m_piVSPFlag;          ///< array of VSP flags to indicate whehter a block uses VSP or not
                                       ///< 0: non-VSP; 1: VSP
-#if MTK_VSP_FIX_E0172
-  Char*         m_piVSPDir;           ///< 0: LIST0; 1: LIST1
-#endif
 #endif
 #if H_3D_ARP
@@ -256,16 +253,11 @@
   Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
 #if H_3D_VSP
-#if MTK_VSP_FIX_E0172
-  Bool          xAddVspCand( UChar ucVspMergePos, Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
-                             Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int* vspDir );
-#else
-  Bool          xAddVspCand( UChar ucVspMergePos, Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
+  Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
                              Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag );
 #endif
-#endif
-#if QC_INRIA_MTK_MRG_E0126
-  Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int*   iPdmDir, TComMv* acPdmMv, 
-                               Int* aiPdmRefIdx, Int iPosDmv, Int* vspFlag ); 
-  Bool          xFirstDmvAvai( Int& iCount, TComMvField* pcMvFieldNeighbours, Int*  iPdmDir, Int iPosDmv, Int* vspFlag, Int& iFirDispCand );
+#if H_3D_IV_MERGE
+  Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int*   ivCandDir, TComMv* ivCandMv, 
+                               Int* ivCandRefIdx, Int posIvDC, Int* vspFlag ); 
+  Bool          xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int*  ivCandDir, Int posIvDC, Int* vspFlag, Int& iFirDispCand );
 #endif
 
@@ -442,5 +434,5 @@
   template <typename T>
   Void          setSubPart            ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
   template<typename T>
   Void          setSubPartT           ( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
@@ -471,7 +463,5 @@
 #if H_3D_NBDV
   Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
   Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);
-#endif
   DisInfo*      getDvInfo             ()                        { return m_pDvInfo;                 }
   DisInfo       getDvInfo             (UInt uiIdx)              { return m_pDvInfo[uiIdx];          }
@@ -682,14 +672,7 @@
 #if H_3D_VSP
                                             , Int* vspFlag
-#if MTK_VSP_FIX_ALIGN_WD_E0172
                                             , InheritedVSPDisInfo*  inheritedVSPDisInfo
-#endif
-#if MTK_VSP_FIX_E0172
-                                            , Int* vspDir
-#endif
-#endif
                                             , Int& numValidMergeCand, Int mrgCandIdx = -1 );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
-  inline Void xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount,  InheritedVSPDisInfo*  inheritedVSPDisInfo);
+  inline Void   xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount,  InheritedVSPDisInfo*  inheritedVSPDisInfo);
 #endif
 #if H_3D_VSP
@@ -698,10 +681,4 @@
   Void          setVSPFlag        ( UInt uiIdx, Int n )     { m_piVSPFlag[uiIdx] = n;      }
   Void          setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
-#if MTK_VSP_FIX_E0172
-  Char*         getVSPDir          ()                        { return m_piVSPDir;                           }
-  Char          getVSPDir          ( UInt uiIdx )            { return m_piVSPDir[uiIdx];                  }
-  Void          setVSPDir          ( UInt uiIdx, Int n )     { m_piVSPDir[uiIdx] = n;  }
-  Void          setVSPDirSubParts  ( Char iVSPDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
-#endif
 #endif
   Void          deriveLeftRightTopIdxGeneral  ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
Index: /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComMotionInfo.h
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComMotionInfo.h	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComMotionInfo.h	(revision 615)
@@ -77,5 +77,5 @@
 } IDVInfo;
 #endif
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
 typedef struct _InheritedVSPDisCand 
 {
Index: /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComMv.h
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComMv.h	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComMv.h	(revision 615)
@@ -58,7 +58,5 @@
   Short m_iIDVHor;    
   Short m_iIDVVer;   
-#if MTK_DVMCP_FIX_E0172
   Short m_iIDVVId;  //view index of the IDV
-#endif
 #endif
 public:
@@ -75,7 +73,5 @@
   , m_iIDVHor(0)
   , m_iIDVVer(0)
-#if MTK_DVMCP_FIX_E0172
   , m_iIDVVId(0) 
-#endif
 #endif
   {
@@ -89,7 +85,5 @@
   , m_iIDVHor(0)
   , m_iIDVVer(0)
-#if MTK_DVMCP_FIX_E0172
-  , m_iIDVVId(0) 
-#endif
+  , m_iIDVVId(0)
 #endif
   {
@@ -106,7 +100,5 @@
  #if H_3D_NBDV
    m_bIDV = false; m_iIDVHor = m_iIDVVer = 0;
-#if MTK_DVMCP_FIX_E0172
    m_iIDVVId = 0; 
-#endif
 #endif
   }
@@ -131,7 +123,6 @@
   Short getIDVVer () const { return m_iIDVVer;       }
   Bool  getIDVFlag() const { return m_bIDV;          }
-#if MTK_DVMCP_FIX_E0172
   Short getIDVVId () const { return m_iIDVVId;       }
-#endif
+
 #endif
   // ------------------------------------------------------------------------------------------------------------------
Index: /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComPrediction.cpp	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComPrediction.cpp	(revision 615)
@@ -588,5 +588,5 @@
     pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
 #if H_3D_VSP
-    if ( 0 == pcCU->getVSPFlag(uiPartAddr) )
+    if ( pcCU->getVSPFlag(uiPartAddr) == 0)
     {
 #endif
@@ -622,7 +622,11 @@
     {
       if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
+      {
         xPredInterUniVSP( pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
+      }
       else
+      {
         xPredInterBiVSP ( pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
+      }
     }
 #endif
@@ -635,5 +639,5 @@
 
 #if H_3D_VSP
-    if ( 0 == pcCU->getVSPFlag(uiPartAddr) )
+    if ( pcCU->getVSPFlag(uiPartAddr) == 0 )
     {
 #endif
@@ -669,7 +673,11 @@
     {
       if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
+      {
         xPredInterUniVSP( pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
+      }
       else
+      {
         xPredInterBiVSP ( pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
+      }
     }
 #endif
@@ -722,12 +730,5 @@
 {
   // Get depth reference
-#if MTK_VSP_FIX_E0172 
-  Int vspDir = pcCU->getVSPDir( uiPartAddr );
-  RefPicList privateRefPicList = (vspDir == 0) ? REF_PIC_LIST_0 : REF_PIC_LIST_1;
-  Int privateRefIdx = pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr );
-  Int depthRefViewIdx = pcCU->getSlice()->getRefPic(privateRefPicList, privateRefIdx)->getViewIndex();
-#else
-  Int depthRefViewIdx = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan;
-#endif
+  Int       depthRefViewIdx = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan;
   TComPic* pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx );
   assert(pRefPicBaseDepth != NULL);
@@ -748,13 +749,5 @@
 
   // Do compensation
-#if MTK_VSP_FIX_ALIGN_WD_E0172 
   TComMv cDv  = pcCU->getDvInfo(uiPartAddr).m_acNBDV;
-#else
-#if MTK_VSP_FIX_E0172
-  TComMv cDv  = pcCU->getCUMvField( privateRefPicList )->getMv( uiPartAddr );
-#else
-  TComMv cDv  = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); // cDv is the disparity vector derived from the neighbors
-#endif
-#endif // end of MTK_VSP_FIX_ALIGN_WD_E0172 
   pcCU->clipMv(cDv);
 
@@ -935,5 +928,7 @@
 
     if ( iRefIdx[iRefList] < 0 )
+    {
       continue;
+    }
     assert( iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList) );
 
Index: /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComSlice.cpp	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComSlice.cpp	(revision 615)
@@ -1510,5 +1510,5 @@
     }
 #endif
-#if H_3D_TMVP
+#if H_3D
     m_ivMvScalingFlag = true; 
 #endif
Index: /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 615)
@@ -504,5 +504,5 @@
   Int*        m_iIdx2DepthValue          [MAX_NUM_LAYERS   ];
 #endif
-#if H_3D_TMVP
+#if H_3D
   Bool        m_ivMvScalingFlag; 
 #endif
@@ -716,8 +716,6 @@
 #endif
 
-#if H_3D_TMVP
   Bool    getIvMvScalingFlag   (  )                       { return m_ivMvScalingFlag; }
   Void    setIvMvScalingFlag   ( Bool b )                 { m_ivMvScalingFlag = b;    }  
-#endif
 #if LGE_INTER_SDC_E0156
   Bool    getInterSDCFlag      ( Int layerIdInVps )           { return m_bInterSDCFlag[layerIdInVps]; }
@@ -1640,5 +1638,5 @@
   TComPic*  getIvPic            ( Bool depthFlag, Int viewIndex){ return  m_ivPicsCurrPoc[ depthFlag ? 1 : 0 ][ viewIndex ]; }
 #endif
-#if H_3D_IV_MERGE
+#if H_3D
   TComPic*  getTexturePic       ()                              { return  m_ivPicsCurrPoc[0][ m_viewIndex ]; }
 #endif
Index: /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 615)
@@ -92,4 +92,5 @@
                                               // QC_CU_NBDV_D0181
                                               // SEC_DEFAULT_DV_D0112
+                                              // MTK_DVMCP_FIX_E0172               1 // fix the mismatch between software and WD for DV derivation from DVMCP blocks, issue 2 in JCT3V-E0172
 #define H_3D_ARP                          1   // Advanced residual prediction (ARP), JCT3V-D0177
 #define H_3D_IC                           1   // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060
@@ -110,5 +111,5 @@
                                               // QC_D0191: Clean up
                                               // LG_D0092: Multiple VSP candidate allowed
-
+                                              // MTK_VSP_FIX_ALIGN_WD_E0172
 #define H_3D_IV_MERGE                     1   // Inter-view motion merge candidate
                                               // HHI_INTER_VIEW_MOTION_PRED 
@@ -119,4 +120,5 @@
                                               // QC_AMVP_MRG_UNIFY_IVCAN_C0051     
                                               // TEXTURE MERGING CANDIDATE     , JCT3V-C0137
+                                              // QC_INRIA_MTK_MRG_E0126            
 #define H_3D_TMVP                         1   // QC_TMVP_C0047 
                                               // Sony_M23639
@@ -161,10 +163,4 @@
 #define MTK_DIVMC_FIX_E0172               1 // fix the issue of derivation of disparity inter-view merge candidate, issue 5 in JCT3V-E0172
 #define MTK_NBDV_TN_FIX_E0172             1 // fix the issue of DV derivation from the temporal neighboring blocks, issue 7 in JCT3V-E0172
-#define MTK_DVMCP_FIX_E0172               1 // fix the mismatch between software and WD for DV derivation from DVMCP blocks, issue 2 in JCT3V-E0172
-#define MTK_VSP_FIX_ALIGN_WD_E0172        1 // fix the issues related to VSP merge candidate, issue 3, 4 in JCT3V-E0172, using an implementation aligned with WD
-
-#if !MTK_VSP_FIX_ALIGN_WD_E0172
-#define MTK_VSP_FIX_E0172                 1 // fix the issues related to VSP merge candidate, issue 3, 4 in JCT3V-E0172
-#endif
 #endif // MTK_RVS_BUGFIX_E0172
 
@@ -174,8 +170,4 @@
 #endif
 #endif // H_3D_NBDV
-
-#if H_3D_IV_MERGE
-#define QC_INRIA_MTK_MRG_E0126            1   // additional merge candidates JCT3V-E0126
-#endif
 
 #if H_3D_DIM
@@ -271,5 +263,4 @@
 ///// ***** VIEW SYNTHESIS PREDICTION *********
 #if H_3D_VSP
-#define H_3D_VSP_POSITION                 3   // The only supported position
 #define H_3D_VSP_BLOCKSIZE                4   // Supported values: 1, 2, and 4
 #if H_3D_VSP_BLOCKSIZE == 1
Index: /branches/HTM-8.0-dev0/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 615)
@@ -366,22 +366,11 @@
     Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
     memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
-#if MTK_VSP_FIX_ALIGN_WD_E0172
     InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand, uiMergeIndex );
-#else
-#if MTK_VSP_FIX_E0172
-    Int vspDir[MRG_MAX_NUM_CANDS_MEM];
-    memset(vspDir, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
-    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag,vspDir, numValidMergeCand, uiMergeIndex );
-    pcCU->setVSPDirSubParts( vspDir[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
-#else
-    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand, uiMergeIndex );
-#endif
-#endif// end of MTK_VSP_FIX_ALIGN_WD_E0172
     pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
 #else
     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
 #endif
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
     if(vspFlag[uiMergeIndex])
     {
Index: /branches/HTM-8.0-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 615)
@@ -243,24 +243,12 @@
           Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
           memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
-#if MTK_VSP_FIX_ALIGN_WD_E0172
           InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
-#else
-#if MTK_VSP_FIX_E0172
-          Int vspDir[MRG_MAX_NUM_CANDS_MEM];
-          memset(vspDir, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
-          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, vspDir, numValidMergeCand );
-          pcCU->setVSPDirSubParts( vspDir[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
-#else
-          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand );
-#endif
-#endif//end of MTK_VSP_FIX_ALIGN_WD_E0172
           pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+
           if(vspFlag[uiMergeIndex])
           {
             pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth);
           }
-#endif
 #else
           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
@@ -276,24 +264,11 @@
         Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
         memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
-#if MTK_VSP_FIX_ALIGN_WD_E0172
         InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo,numValidMergeCand, uiMergeIndex );
-#else
-#if MTK_VSP_FIX_E0172
-        Int vspDir[MRG_MAX_NUM_CANDS_MEM];
-        memset(vspDir, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
-        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, vspDir,numValidMergeCand, uiMergeIndex );
-        pcCU->setVSPDirSubParts( vspDir[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
-#else
-        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand, uiMergeIndex );
-#endif
-#endif//end of MTK_VSP_FIX_ALIGN_WD_E0172
         pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
         if(vspFlag[uiMergeIndex])
         {
           pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth);
         }
-#endif
 #else
         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
@@ -327,5 +302,5 @@
       }
     }
-#if MTK_VSP_FIX_E0172 || MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
     if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) && (pcCU->getVSPFlag(uiSubPartIdx) == false))
 #else
Index: /branches/HTM-8.0-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 615)
@@ -848,7 +848,5 @@
     }  
   }
-#if H_3D_TMVP
   WRITE_FLAG( pcVPS->getIvMvScalingFlag( ) ? 1 : 0 ,          "iv_mv_scaling_flag" );
-#endif
 #else
   WRITE_FLAG( 0,                                             "vps_extension2_flag" );
Index: /branches/HTM-8.0-dev0/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibEncoder/TEncCu.cpp	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibEncoder/TEncCu.cpp	(revision 615)
@@ -416,5 +416,5 @@
 
   Bool    bTrySplitDQP  = true;
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
   DisInfo DvInfo; 
   DvInfo.bDV = false;
@@ -530,13 +530,4 @@
 
 #if H_3D_NBDV
-#if !MTK_VSP_FIX_ALIGN_WD_E0172
-      DisInfo DvInfo; 
-      DvInfo.bDV = false;
-      DvInfo.m_acNBDV.setZero();
-      DvInfo.m_aVIdxCan = 0;
-#if H_3D_NBDV_REF
-      DvInfo.m_acDoNBDV.setZero();
-#endif
-#endif
       if( rpcTempCU->getSlice()->getSliceType() != I_SLICE )
       {
@@ -598,5 +589,5 @@
           xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );  rpcTempCU->initEstData( uiDepth, iQP );//by Competition for inter_2Nx2N
 #endif
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
           rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -611,5 +602,5 @@
 #endif
         rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
         rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -638,5 +629,5 @@
             xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );  rpcTempCU->initEstData( uiDepth, iQP );
 #endif
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
             rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -725,5 +716,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -745,5 +736,5 @@
 #endif
             rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
             rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -765,5 +756,5 @@
 #endif
             rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
             rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -804,5 +795,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -824,5 +815,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -848,5 +839,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -868,5 +859,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -894,5 +885,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -914,5 +905,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -934,5 +925,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -954,5 +945,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -968,10 +959,10 @@
               xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU );
               rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
               rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
               xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD );
               rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
               rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -983,10 +974,10 @@
               xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N );
               rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
               rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
               xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N );
               rpcTempCU->initEstData( uiDepth, iQP );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
               rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -1761,16 +1752,6 @@
   Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
   memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
-#if MTK_VSP_FIX_ALIGN_WD_E0172
   InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
   rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag,inheritedVSPDisInfo, numValidMergeCand );
-#else
-#if MTK_VSP_FIX_E0172
-  Int vspDir[MRG_MAX_NUM_CANDS_MEM];
-  memset(vspDir, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
-  rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag,vspDir, numValidMergeCand );
-#else
-  rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, numValidMergeCand );
-#endif
-#endif//end of MTK_VSP_FIX_ALIGN_WD_E0172
 #else
   rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
@@ -1840,10 +1821,5 @@
 #if H_3D_VSP
           rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
           rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth );
-#endif
-#if MTK_VSP_FIX_E0172
-          rpcTempCU->setVSPDirSubParts( vspDir[uiMergeCand], 0, 0, uhDepth );
-#endif
 #endif
           rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
Index: /branches/HTM-8.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 615)
@@ -3603,10 +3603,5 @@
 #if H_3D_VSP
                                  , Int* vspFlag
-#if MTK_VSP_FIX_ALIGN_WD_E0172
                                  , InheritedVSPDisInfo*  inheritedVSPDisInfo
-#endif
-#if MTK_VSP_FIX_E0172
-                                 , Int* vspDir
-#endif
 #endif
                                  , Int& numValidMergeCand
@@ -3628,10 +3623,5 @@
 #if H_3D_VSP
                                    , vspFlag
-#if MTK_VSP_FIX_ALIGN_WD_E0172
                                    , inheritedVSPDisInfo
-#endif
-#if MTK_VSP_FIX_E0172
-                                   , vspDir
-#endif
 #endif
                                    , numValidMergeCand
@@ -3645,18 +3635,11 @@
 #if H_3D_VSP
                                  , vspFlag
-#if MTK_VSP_FIX_ALIGN_WD_E0172
                                  , inheritedVSPDisInfo
-#endif
-#if MTK_VSP_FIX_E0172
-                                 , vspDir
-#endif
 #endif
                                  , numValidMergeCand
                                  );
   }
-#if MTK_VSP_FIX_E0172 || MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
   xRestrictBipredMergeCand( pcCU, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours,vspFlag, numValidMergeCand );
-#else
-  xRestrictBipredMergeCand( pcCU, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
 #endif
 
@@ -3675,10 +3658,5 @@
 #if H_3D_VSP
       pcCU->setVSPFlagSubParts( vspFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
       pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
-#endif
-#if MTK_VSP_FIX_E0172
-      pcCU->setVSPDirSubParts( vspDir[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
-#endif
 #endif
 
@@ -3710,5 +3688,5 @@
  * \returns Void
  */
-#if MTK_VSP_FIX_E0172 || MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
 Void TEncSearch::xRestrictBipredMergeCand( TComDataCU* pcCU, UInt puIdx, TComMvField* mvFieldNeighbours, UChar* interDirNeighbours, Int* vspFlag, Int numValidMergeCand )
 #else
@@ -3720,5 +3698,5 @@
     for( UInt mergeCand = 0; mergeCand < numValidMergeCand; ++mergeCand )
     {
-#if MTK_VSP_FIX_E0172 || MTK_VSP_FIX_ALIGN_WD_E0172
+#if H_3D_VSP
       if ( (interDirNeighbours[mergeCand] == 3) && (vspFlag[mergeCand] == false) )
 #else
@@ -3851,7 +3829,4 @@
 #if H_3D_VSP
     pcCU->setVSPFlagSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr) );
-#if MTK_VSP_FIX_E0172
-    pcCU->setVSPDirSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr) );
-#endif
 #endif
     
@@ -4349,5 +4324,4 @@
       Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
       memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
-#if MTK_VSP_FIX_ALIGN_WD_E0172
       InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
       UInt uiAbsPartIdx = 0;
@@ -4357,19 +4331,9 @@
       DisInfo OriginalDvInfo = pcCU->getDvInfo(uiAbsPartIdx);
 #endif
-#if MTK_VSP_FIX_E0172
-      Int vspDir[MRG_MAX_NUM_CANDS_MEM];
-      memset(vspDir, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
-#endif
-#endif
 
       xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours
 #if H_3D_VSP
                       , vspFlag
-#if MTK_VSP_FIX_ALIGN_WD_E0172
                       , inheritedVSPDisInfo
-#endif
-#if MTK_VSP_FIX_E0172
-                      , vspDir
-#endif
 #endif
                       , numValidMergeCand
@@ -4382,10 +4346,5 @@
 #if H_3D_VSP
         pcCU->setVSPFlagSubParts( vspFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
         pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMRGIndex].m_acDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
-#endif
-#if MTK_VSP_FIX_E0172
-        pcCU->setVSPDirSubParts( vspDir[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
-#endif
 #endif
         pcCU->setInterDirSubParts  ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
@@ -4410,10 +4369,5 @@
 #if H_3D_VSP
         pcCU->setVSPFlagSubParts ( 0,             uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
-#if MTK_VSP_FIX_ALIGN_WD_E0172
         pcCU->setDvInfoSubParts(OriginalDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
-#endif
-#if MTK_VSP_FIX_E0172
-        pcCU->setVSPDirSubParts ( 0,             uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
-#endif
 #endif
         {
Index: /branches/HTM-8.0-dev0/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- /branches/HTM-8.0-dev0/source/Lib/TLibEncoder/TEncSearch.h	(revision 614)
+++ /branches/HTM-8.0-dev0/source/Lib/TLibEncoder/TEncSearch.h	(revision 615)
@@ -431,10 +431,5 @@
 #if H_3D_VSP
                                   , Int* vspFlag
-#if MTK_VSP_FIX_ALIGN_WD_E0172
                                   , InheritedVSPDisInfo*  inheritedVSPDisInfo
-#endif
-#if MTK_VSP_FIX_E0172
-                                  , Int* vspDir
-#endif
 #endif
                                   , Int& numValidMergeCand
@@ -445,7 +440,5 @@
                                     TComMvField*    mvFieldNeighbours, 
                                     UChar*          interDirNeighbours, 
-#if MTK_VSP_FIX_E0172 || MTK_VSP_FIX_ALIGN_WD_E0172
                                     Int* vspFlag,
-#endif
                                     Int             numValidMergeCand );
 
