Index: branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/CommonDef.h
===================================================================
--- branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/CommonDef.h	(revision 325)
+++ branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/CommonDef.h	(revision 326)
@@ -140,10 +140,4 @@
 #define PDM_MERGE_POS                     0         // position of pdm in merge list (0..4)
 
-#if H3D_IVMP
-#define DMV_MERGE_POS                     4
-#else
-#define DMV_MERGE_POS                     1
-#endif
-
 #if H3D_IVMP&!H3D_NBDV
 #define PDM_AMVP_POS                      0         // position of pdm in amvp list  (0..3)
Index: branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TComDataCU.cpp	(revision 325)
+++ branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TComDataCU.cpp	(revision 326)
@@ -3694,5 +3694,5 @@
 #endif
 
-  if( iPdmDir[0] && !bNoPdmMerge && PDM_MERGE_POS == 0 )
+  if( iPdmDir[0] && !bNoPdmMerge )
   {
     abCandIsInter        [ iCount ] = true;
@@ -3725,30 +3725,6 @@
     }
     iCount ++;
-  }
-
-  if(extraMergeCand)
-  {
-    if(!bNoPdmMerge && iPdmDir[1] && DMV_MERGE_POS == 1)
-    {
-      assert(iCount < MRG_MAX_NUM_CANDS_MEM);
-      abCandIsInter        [ iCount ] = true;
-      puhInterDirNeighbours[ iCount ] = iPdmDir[1];
-      if( ( iPdmDir[1] & 1 ) == 1 )
-      {
-        pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 2 ], aiPdmRefIdx[ 2 ] );
-      }
-      if( ( iPdmDir[1] & 2 ) == 2 )
-      {
-        pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 3 ], aiPdmRefIdx[ 3 ] );
-      }
-#if H3D_NBDV
-      pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
-      pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
-#endif
-      if ( mrgCandIdx == iCount )
-          return;
-      iCount ++;
-    }    
-  }
+  }  
+  
 #endif //  H3D_IVMP 
 
@@ -3837,44 +3813,4 @@
   }
 
-#if H3D_IVMP
-  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 1 )
-  {
-    abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = iPdmInterDir;
-    if( ( iPdmInterDir & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if( ( iPdmInterDir & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if ( mrgCandIdx == iCount )
-    {
-      return;
-    }
-    iCount ++;
-  }
-#endif //  H3D_IVMP 
-
-#if MERL_VSP_COMPENSATION_C0152
-  //===== vsp 1 =====
-  if( iCount < 4 + extraMergeCand )
-    if ( !xAddVspMergeCand(1, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
-      return;
-#endif
-
   // above
   UInt uiAbovePartIdx = 0;
@@ -3949,44 +3885,4 @@
   }
 
-#if H3D_IVMP
-  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 2 )
-  {
-    abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = iPdmInterDir;
-    if( ( iPdmInterDir & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if( ( iPdmInterDir & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if ( mrgCandIdx == iCount )
-    {
-      return;
-    }
-    iCount ++;
-  }
-#endif //  H3D_IVMP 
-
-#if MERL_VSP_COMPENSATION_C0152
-  //===== vsp 2 =====
-  if( iCount < 4 + extraMergeCand )
-    if ( !xAddVspMergeCand(2, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
-      return;
-#endif
-
   // above right
   UInt uiAboveRightPartIdx = 0;
@@ -4036,38 +3932,8 @@
 
 #if H3D_IVMP
-  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 3 )
-  {
-    abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = iPdmInterDir;
-    if( ( iPdmInterDir & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if( ( iPdmInterDir & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if ( mrgCandIdx == iCount )
-    {
-      return;
-    }
-    iCount ++;
-  }
 
   if(extraMergeCand)
   {
-    if(!bNoPdmMerge && iPdmDir[1] && DMV_MERGE_POS == 4)
+    if(!bNoPdmMerge && iPdmDir[1] )
     {
       assert(iCount < MRG_MAX_NUM_CANDS_MEM);
@@ -4114,21 +3980,4 @@
 #endif // H3D_IVMP 
 
-#if MERL_VSP_COMPENSATION_C0152
-  //===== vsp 3 =====
-  if( iCount < 4 + extraMergeCand )
-    if ( !xAddVspMergeCand(3, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
-      return;
-#endif
-
-#if MERL_VSP_C0152
-#if VSP_MERGE_POS < 4
-#if H3D_IVMP
-  if( iCount < 4 + extraMergeCand )
-#else
-  if( iCount < 4 )
-#endif
-  {
-#endif
-#endif
 
   //left bottom
@@ -4177,49 +4026,5 @@
     iCount ++;
   }
-#if MERL_VSP_C0152
-#if VSP_MERGE_POS < 4
-  }
-#endif
-#endif
-  
-#if H3D_IVMP
-  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 4 )
-  {
-    abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = iPdmInterDir;
-    if( ( iPdmInterDir & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if( ( iPdmInterDir & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
-    }
-#if FIX_CU_BASED_MRG_CAND_LIST_B0136
-    else
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
-    }
-#endif
-    if ( mrgCandIdx == iCount )
-    {
-      return;
-    }
-    iCount ++;
-  }
-#endif //  H3D_IVMP 
-
-#if MERL_VSP_COMPENSATION_C0152
-  //===== vsp 4 =====
-  if( iCount < 4 + extraMergeCand )
-    if ( !xAddVspMergeCand(4, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
-      return;
-#endif
+ 
   
   // above left
@@ -5199,5 +5004,5 @@
         }
         else if ( bSearchForMvpDv && cMvPred.m_bDvMcp && bTmpIsSkipped )
-  {
+        {
           paMvpDvInfo->m_acMvCand[iList][ uiMvpDvPos ] = cMvPred;
           paMvpDvInfo->m_aVIdxCan[iList][ uiMvpDvPos ] = refViewIdx;
@@ -5212,5 +5017,5 @@
         if (picDepth && bDepthRefine)
           estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
-        
+
         cMvPred.setVer(0);
 
@@ -5276,5 +5081,5 @@
 #endif
                                 )
-            {
+{
   //// ******* Init variables ******* /////
   // Init disparity struct for results
@@ -5291,7 +5096,7 @@
       cMvpDvInfo.m_aVIdxCan[iList][iCurDvMcpCand] = 0; 
       cMvpDvInfo.m_bAvailab[iList][iCurDvMcpCand] = false; 
-          }
-        }
-  
+    }
+  }
+
   // Get Positions  
   PartSize eCUMode    = getPartitionSize( uiPartAddr );    
@@ -5308,9 +5113,9 @@
   //// ******* Get disparity from temporal neighboring blocks ******* /////
   if ( getSlice()->getPPS()->getEnableTMVPFlag() )
-        {
+  {
     TComMv cColMv;
     Int iTargetViewIdx = 0;
     Int iTStartViewIdx = 0;    
-   
+
     ///*** Derive center position ***
     UInt uiPartIdxCenter;
@@ -5329,14 +5134,14 @@
     const Int iNumCandPics = 2;
     for(Int curCandPic = 0; curCandPic < iNumCandPics; curCandPic++)
-            {
+    {
       // Get candidate picture
       RefPicList eCurRefPicList   = REF_PIC_LIST_0 ;
       Int        curCandPicRefIdx = 0;
-      
+
       if( curCandPic == 0 ) // check the co-located picture
       { 
         eCurRefPicList   = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0);
         curCandPicRefIdx = getSlice()->getColRefIdx();
-            }
+      }
       else                  // check RAP
       {
@@ -5346,11 +5151,11 @@
         eCurRefPicList   = getPic()->getRapRefList();
         curCandPicRefIdx = getPic()->getRapRefIdx();
-        }
-      
-       // Check BR and Center       
+      }
+
+      // Check BR and Center       
       if( m_pcSlice->getViewId() == getSlice()->getRefPic( eCurRefPicList, curCandPicRefIdx)->getViewId() ) 
+      {
+        for(Int curPosition = 0; curPosition < 2; curPosition++) 
         {
-        for(Int curPosition = 0; curPosition < 2; curPosition++) 
-          {
           Bool bCheck = false; 
           if ( curPosition == 0 && iLCUIdxRBNb >= 0 )
@@ -5361,16 +5166,16 @@
 
           if( bCheck )
-            {
+          {
             clipMv(cColMv);
             TComPic* picDepth = getSlice()->getRefPicBaseDepth();
-              if (picDepth && bDepthRefine)
-                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
-
-              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
-              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
+            if (picDepth && bDepthRefine)
+              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
+
+            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
+            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
             return ;
           }
         } // Loop positions
-        }
+      }
     } // Loop candidate views
   } // if TMVP Flag
@@ -5379,5 +5184,5 @@
   Bool        bCheckMcpDv = false;   
   TComDataCU* pcTmpCU     = NULL;
-  
+
 
   //// ******* Get disparity from left block ******* /////
@@ -5398,5 +5203,5 @@
   bCheckMcpDv = true; 
   if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFT ) )
-          return;
+    return;
 
 
@@ -5417,11 +5222,11 @@
 
   if(pcTmpCU != NULL )
-      {
+  {
     bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
     if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVE ) )
-        return;
-      }
-
-//// ******* Get disparity from above right block ******* /////
+      return;
+  }
+
+  //// ******* Get disparity from above right block ******* /////
   pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
 
@@ -5435,12 +5240,12 @@
 
   if(pcTmpCU != NULL )
-    {
+  {
     bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
     if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVERIGHT ) )
-          return;
-        }
-
-
-//// ******* Get disparity from below left block ******* /////
+      return;
+  }
+
+
+  //// ******* Get disparity from below left block ******* /////
   pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
 
@@ -5454,13 +5259,12 @@
 
   if( pcTmpCU != NULL )
-      {
+  {
     bCheckMcpDv = true; 
     if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFTBELOW ) )
-          return;
-        }
-
-
-//// ******* Get disparity from above left block ******* /////
-  
+      return;
+  }
+
+
+  //// ******* Get disparity from above left block ******* /////
   pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
   assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
@@ -5478,25 +5282,25 @@
     bCheckMcpDv = (( getAddr() - pcTmpCU->getAddr() ) <= 1); 
     if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVELEFT ) )
-          return;
-        }
+      return;
+  }
 
   //// ******* Search MCP blocks ******* /////
   if( cMvpDvInfo.m_bFound ) 
-      {
+  {
     for( Int curPos = 1 ; curPos < MCP_DIS_CANS - 1 ; curPos++ ) 
+    {
+      for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
+      {
+        if( cMvpDvInfo.m_bAvailab[iList][curPos] )
         {
-      for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
-          {
-        if( cMvpDvInfo.m_bAvailab[iList][curPos] )
-            {
           TComMv cDispVec = cMvpDvInfo.m_acMvCand[iList][ curPos ];
           clipMv( cDispVec );
 
           TComPic* picDepth = getSlice()->getRefPicBaseDepth();
-              if (picDepth && bDepthRefine)
+          if (picDepth && bDepthRefine)
             estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cDispVec, true);
 
           pDInfo->m_acMvCand[ pDInfo->iN]   = cDispVec;
-            pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
+          pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
           return;
         }
Index: branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TComPicYuv.cpp
===================================================================
--- branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TComPicYuv.cpp	(revision 325)
+++ branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TComPicYuv.cpp	(revision 326)
@@ -468,5 +468,5 @@
 Void TComPicYuv::setLumaTo( Pel pVal )
 {
-  xSetPels( getLumaAddr(), getStride(), getWidth(), getHeight() >> 1, pVal );
+  xSetPels( getLumaAddr(), getStride(), getWidth(), getHeight(), pVal );
 }
 
