Index: /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1254)
+++ /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1255)
@@ -128,5 +128,5 @@
   m_pDvInfo              = NULL;
 #endif
-#if H_3D_VSP
+#if NH_3D_VSP
   m_piVSPFlag            = NULL;
 #endif
@@ -185,5 +185,5 @@
     m_pbMergeFlag        = (Bool*  )xMalloc(Bool,   uiNumPartition);
     m_puhMergeIndex      = (UChar* )xMalloc(UChar,  uiNumPartition);
-#if H_3D_VSP
+#if NH_3D_VSP
     m_piVSPFlag          = (Char*  )xMalloc(Char,   uiNumPartition);
 #endif
@@ -372,6 +372,10 @@
     }
 
-#if H_3D_VSP
-    if ( m_piVSPFlag          ) { xFree(m_piVSPFlag);           m_piVSPFlag         = NULL; }
+#if NH_3D_VSP
+    if ( m_piVSPFlag )
+    {
+      xFree(m_piVSPFlag);
+      m_piVSPFlag = NULL;
+    }
 #endif
 #if H_3D_SPIVMP
@@ -623,6 +627,6 @@
   memset( m_puhMergeIndex     , 0,                        m_uiNumPartition * sizeof( *m_puhMergeIndex ) );
 
-#if H_3D_VSP
-    m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui];
+#if NH_3D_VSP
+  memset( m_piVSPFlag         , 0,                        m_uiNumPartition * sizeof( *m_piVSPFlag ) );
 #endif
 #if H_3D_SPIVMP
@@ -638,7 +642,4 @@
     memset( m_bDISFlag          + firstElement, false,                    numElements * sizeof( *m_bDISFlag ) );
     memset( m_uiDISType         + firstElement,     0,                    numElements * sizeof( *m_uiDISType) );
-#endif
-#if H_3D_VSP
-    memset( m_piVSPFlag         + firstElement, 0,                        numElements * sizeof( *m_piVSPFlag ) );
 #endif
 #if H_3D_SPIVMP
@@ -795,6 +796,6 @@
     m_pbMergeFlag[ui]   = 0;
     m_puhMergeIndex[ui] = 0;
-#if H_3D_VSP
-      m_piVSPFlag[ui] = 0;
+#if NH_3D_VSP
+    m_piVSPFlag[ui]     = 0;
 #endif
 #if H_3D_SPIVMP
@@ -896,5 +897,5 @@
   memset( m_pbMergeFlag,        0, iSizeInBool  );
   memset( m_puhMergeIndex,      0, iSizeInUchar );
-#if H_3D_VSP
+#if NH_3D_VSP
   memset( m_piVSPFlag,          0, sizeof( Char  ) * m_uiNumPartition );
 #endif
@@ -976,7 +977,7 @@
       m_uiDISType[ui]   = pcCU->getDISType(uiPartOffset+ui);
 #endif
-#if H_3D_VSP
-      m_piVSPFlag[ui]=pcCU->m_piVSPFlag[uiPartOffset+ui];
-      m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui];
+#if NH_3D_VSP
+    m_piVSPFlag[ui] = pcCU->m_piVSPFlag[uiPartOffset+ui];
+    m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui];
 #endif
 #if H_3D_SPIVMP
@@ -1084,5 +1085,5 @@
   m_pbMergeFlag         = pcCU->getMergeFlag()        + uiPart;
   m_puhMergeIndex       = pcCU->getMergeIndex()       + uiPart;
-#if H_3D_VSP
+#if NH_3D_VSP
   m_piVSPFlag           = pcCU->getVSPFlag()          + uiPart;
 #endif
@@ -1238,5 +1239,5 @@
   m_pbMergeFlag        = pcCU->getMergeFlag()             + uiAbsPartIdx;
   m_puhMergeIndex      = pcCU->getMergeIndex()            + uiAbsPartIdx;
-#if H_3D_VSP
+#if NH_3D_VSP
   m_piVSPFlag          = pcCU->getVSPFlag()               + uiAbsPartIdx;
   m_pDvInfo            = pcCU->getDvInfo()                + uiAbsPartIdx;
@@ -1296,5 +1297,5 @@
   memcpy( m_pbMergeFlag         + uiOffset, pcCU->getMergeFlag(),         iSizeInBool  );
   memcpy( m_puhMergeIndex       + uiOffset, pcCU->getMergeIndex(),        iSizeInUchar );
-#if H_3D_VSP
+#if NH_3D_VSP
   memcpy( m_piVSPFlag           + uiOffset, pcCU->getVSPFlag(),           sizeof( Char ) * uiNumPartition );
   memcpy( m_pDvInfo             + uiOffset, pcCU->getDvInfo(),            sizeof( *m_pDvInfo ) * uiNumPartition );
@@ -1423,7 +1424,6 @@
   memcpy( pCtu->getMergeFlag()         + m_absZIdxInCtu, m_pbMergeFlag,         iSizeInBool  );
   memcpy( pCtu->getMergeIndex()        + m_absZIdxInCtu, m_puhMergeIndex,       iSizeInUchar );
-  #if H_3D_VSP
-  memcpy( rpcCU->getVSPFlag()           + m_uiAbsIdxInLCU, m_piVSPFlag,           sizeof( Char ) * m_uiNumPartition );
-  memcpy( rpcCU->getDvInfo()            + m_uiAbsIdxInLCU, m_pDvInfo,             sizeof( *m_pDvInfo ) * m_uiNumPartition );
+#if NH_3D_VSP
+  memcpy( pCtu->getVSPFlag()           + m_absZIdxInCtu, m_piVSPFlag,           sizeof( Char ) * m_uiNumPartition );
 #endif
 #if H_3D_SPIVMP
@@ -1516,7 +1516,4 @@
 #endif
 
-#if H_3D_VSP
-  memcpy( rpcCU->getVSPFlag()           + uiPartOffset, m_piVSPFlag,           sizeof(Char) * uiQNumPart );
-#endif
 #if H_3D_SPIVMP
   memcpy( rpcCU->getSPIVMPFlag()        + uiPartOffset, m_pbSPIVMPFlag,        sizeof(Bool) * uiQNumPart );
@@ -2504,14 +2501,13 @@
 #endif
 
-#if H_3D_VSP
+#if NH_3D_VSP
 Void TComDataCU::setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
 {
   setSubPart<Char>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx );
 }
-#if H_3D_VSP
 template<typename T>
 Void TComDataCU::setSubPartT( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx )
 {
-  UInt uiCurrPartNumQ = (m_pcPic->getNumPartInCU() >> (2 * uiCUDepth)) >> 2;
+  UInt uiCurrPartNumQ = (m_pcPic->getNumPartitionsInCtu() >> (2 * uiCUDepth)) >> 2;
   switch ( m_pePartSize[ uiCUAddr ] )
   {
@@ -2645,5 +2641,4 @@
 }
 #endif
-#endif
 
 Void TComDataCU::setInterDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
@@ -2731,5 +2726,5 @@
 
 // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx
-#if H_3D_IC
+#if H_3D_IC | NH_3D_VSP
 Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU)
 {
@@ -3065,6 +3060,5 @@
 }
 
-#if H_3D_VSP
-
+#if NH_3D_VSP
 /** Add a VSP merging candidate
  * \Inputs
@@ -3128,5 +3122,9 @@
 
   dirVSP = (predFlag[0] | (predFlag[1] << 1));
-  m_mergCands[MRG_VSP].setCand( mvVSP, dirVSP, true, false);
+  m_mergCands[MRG_VSP].setCand( mvVSP, dirVSP, true
+#if H_3D_SPIVMP
+    , false
+#endif
+    );
   if ( mrgCandIdx == iCount )
   {
@@ -3138,5 +3136,4 @@
   return false;
 }
-
 #endif
 
@@ -3202,5 +3199,5 @@
  */
 Void TComDataCU::buildMCL(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
-#if H_3D_VSP
+#if NH_3D_VSP
   , Int* vspFlag
 #endif
@@ -3227,5 +3224,5 @@
     extMergeCandList[ui<<1].setMvField(cZeroMv, NOT_VALID);
     extMergeCandList[(ui<<1)+1].setMvField(cZeroMv, NOT_VALID);
-#if H_3D_VSP
+#if NH_3D_VSP
     vspFlag[ui] = 0;
 #endif
@@ -3238,5 +3235,5 @@
     {
       m_mergCands[i].getCand(iCount, extMergeCandList, uhInterDirNeighboursExt
-#if H_3D_VSP
+#if NH_3D_VSP
         , vspFlag
 #endif
@@ -3313,4 +3310,7 @@
   DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
   m_cDefaultDisInfo = cDisInfo;
+#elif NH_3D_VSP
+  // for xAddVspCand()
+  DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
 #endif
 
@@ -3371,5 +3371,5 @@
   {
     m_mergCands[MRG_A1].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
-#if H_3D_VSP
+#if NH_3D_VSP
     , (pcCULeft->getVSPFlag(uiLeftPartIdx) != 0
 #if H_3D_IC
@@ -3395,5 +3395,5 @@
   {
     m_mergCands[MRG_B1].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
-#if H_3D_VSP
+#if NH_3D_VSP
     , false
 #endif
@@ -3409,7 +3409,6 @@
   {
     m_mergCands[MRG_B0].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
-#if H_3D_VSP
-    ,
-      false
+#if NH_3D_VSP
+    , false
 #endif
 #if H_3D_SPIVMP
@@ -3424,5 +3423,5 @@
   {
     m_mergCands[MRG_A0].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
-#if H_3D_VSP
+#if NH_3D_VSP
     , false
 #endif
@@ -3438,5 +3437,5 @@
   {
     m_mergCands[MRG_B2].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
-#if H_3D_VSP
+#if NH_3D_VSP
     , false
 #endif
@@ -3718,5 +3717,5 @@
   iCount += m_mergCands[MRG_A1].m_bAvailable + m_mergCands[MRG_B1].m_bAvailable;
 
-#if H_3D_VSP
+#if NH_3D_VSP
   /////////////////////////////////////////////////
   //////// VIEW SYNTHESIS PREDICTION (VSP) ////////
@@ -3748,6 +3747,4 @@
       return;
     }
-#endif
-#if H_3D_VSP
   }
 #endif
@@ -5467,5 +5464,9 @@
 Void TComDataCU::setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth )
 {
+#if NH_3D_VSP // bug fix
+  UInt uiCurrPartNumb = m_pcPic->getNumPartitionsInCtu() >> (uiDepth << 1);
+#else
   UInt uiCurrPartNumb = m_pcPic->getNumPartInCtuWidth() >> (uiDepth << 1);
+#endif
   for (UInt ui = 0; ui < uiCurrPartNumb; ui++ )
   {
@@ -5473,5 +5474,5 @@
   }
 }
-#if H_3D_VSP
+#if NH_3D_VSP
 Void TComDataCU::setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth )
 {
@@ -6084,5 +6085,5 @@
 #endif
 
-#if H_3D_VSP
+#if NH_3D_VSP
 Void TComDataCU::setMvFieldPUForVSP( TComDataCU* pcCU, UInt partAddr, Int width, Int height, RefPicList eRefPicList, Int iRefIdx, Int &vspSize )
 {
@@ -6140,10 +6141,10 @@
   TComCUMvField *cuMvField = cu->getCUMvField( refPicList );
   Int partAddrRasterSubPULine  = g_auiZscanToRaster[ partAddr ];
-  Int numPartsLine    = cu->getPic()->getNumPartInWidth();
+  Int numPartsLine    = cu->getPic()->getNumPartInCtuWidth();
 
   Int nTxtPerMvInfoX = 4; // cu->getPic()->getMinCUWidth();
   Int nTxtPerMvInfoY = 4; // cu->getPic()->getMinCUHeight();
 
-  Int refDepStride = picRefDepth->getStride();
+  Int refDepStride = picRefDepth->getStride( COMPONENT_Y );
 
   TComMv tmpMv(0, 0);
@@ -6151,5 +6152,5 @@
 
   Int refDepOffset  = ( (dv->getHor()+2) >> 2 ) + ( (dv->getVer()+2) >> 2 ) * refDepStride;
-  Pel *refDepth     = picRefDepth->getLumaAddr( cu->getAddr(), cu->getZorderIdxInCU() + partAddr ) + refDepOffset;
+  Pel *refDepth     = picRefDepth->getAddr( COMPONENT_Y, cu->getCtuRsAddr(), cu->getZorderIdxInCtu() + partAddr ) + refDepOffset;
 
   if ((height % 8))
Index: /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComDataCU.h	(revision 1254)
+++ /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComDataCU.h	(revision 1255)
@@ -170,5 +170,5 @@
   DisInfo*      m_pDvInfo;
 #endif
-#if H_3D_VSP
+#if NH_3D_VSP
   Char*         m_piVSPFlag;          ///< array of VSP flags to indicate whehter a block uses VSP or not  ///< 0: non-VSP; 1: VSP
 #endif
@@ -233,5 +233,5 @@
   Bool          xAddMVPCand           ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
   Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
-#if H_3D_VSP
+#if NH_3D_VSP
   Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount);
 #endif
@@ -255,5 +255,5 @@
   Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter );
 
-#if H_3D_VSP
+#if NH_3D_VSP
   Void xSetMvFieldForVSP  ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize );
 #endif
@@ -452,5 +452,5 @@
   template <typename T>
   Void          setSubPart            ( T bParameter, T* pbBaseCtu, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
-#if H_3D_VSP
+#if NH_3D_VSP
   template<typename T>
   Void          setSubPartT           ( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
@@ -541,4 +541,6 @@
   Bool          isICFlagRequired   ( UInt uiAbsPartIdx );
   Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false);
+#elif NH_3D_VSP
+  Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false);
 #else
   // -------------------------------------------------------------------------------------------------------------------
@@ -660,5 +662,5 @@
   Void          initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0;  }
   Void          buildMCL(TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
-#if H_3D_VSP
+#if NH_3D_VSP
     , Int* vspFlag
 #endif
@@ -676,5 +678,5 @@
   Void          getInterMergeCandidates       ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
 
-#if H_3D_VSP
+#if NH_3D_VSP
 #if H_3D_SPIVMP
   Bool*         getSPIVMPFlag        ()                        { return m_pbSPIVMPFlag;          }
Index: /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComMotionInfo.h
===================================================================
--- /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComMotionInfo.h	(revision 1254)
+++ /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComMotionInfo.h	(revision 1255)
@@ -170,5 +170,5 @@
   Void    setMvFieldSP ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight  );
 #endif
-#if H_3D_VSP
+#if NH_3D_VSP
   Void    setMv         ( Int iIdx, TComMv const & rcMv ) { m_pcMv[iIdx] = rcMv; }
   Void    setRefIdx     ( Int iIdx, Int iRefIdx )         { m_piRefIdx[iIdx] = iRefIdx; }
@@ -200,7 +200,7 @@
   TComMvField           m_cMvField[2];
   UChar                 m_uDir;
-#if H_3D_VSP
+#if NH_3D_VSP
   Int                   m_iVspFlag;
-#endif  
+#endif
 #if H_3D_SPIVMP
   Bool                  m_bSPIVMPFlag;
@@ -212,5 +212,5 @@
     m_bAvailable = false;
     m_uDir = 0;
-#if H_3D_VSP
+#if NH_3D_VSP
     m_iVspFlag = 0;
 #endif
@@ -231,5 +231,5 @@
     m_bAvailable = false;
     m_uDir = 0;
-#if H_3D_VSP
+#if NH_3D_VSP
     m_iVspFlag = 0;
 #endif
@@ -242,5 +242,5 @@
 
   Void setCand(TComMvField* pcMvFieldNeighbours, UChar uhInterDirNeighbours
-#if H_3D_VSP
+#if NH_3D_VSP
     , Int vspFlag
 #endif
@@ -254,5 +254,5 @@
     m_cMvField[1] = pcMvFieldNeighbours[1];
     m_uDir = uhInterDirNeighbours;
-#if H_3D_VSP
+#if NH_3D_VSP
     m_iVspFlag = vspFlag;
 #endif
@@ -263,5 +263,5 @@
   
   Void getCand(Int iCount, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
-#if H_3D_VSP
+#if NH_3D_VSP
     , Int* vspFlag
 #endif
@@ -274,5 +274,5 @@
     pcMvFieldNeighbours[(iCount<<1) + 1] = m_cMvField[1];
     puhInterDirNeighbours[iCount] = m_uDir;
-#if H_3D_VSP
+#if NH_3D_VSP
     vspFlag[iCount] = m_iVspFlag;
 #endif
Index: /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1254)
+++ /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1255)
@@ -82,6 +82,6 @@
     }
   }
-#if H_3D_VSP
-  m_pDepthBlock = (Int*) malloc(MAX_NUM_SPU_W*MAX_NUM_SPU_W*sizeof(Int));
+#if NH_3D_VSP
+  m_pDepthBlock = (Int*) malloc(MAX_NUM_PART_IDXS_IN_CTU_WIDTH*MAX_NUM_PART_IDXS_IN_CTU_WIDTH*sizeof(Int));
   if (m_pDepthBlock == NULL)
   {
@@ -94,5 +94,5 @@
 TComPrediction::~TComPrediction()
 {
-#if H_3D_VSP
+#if NH_3D_VSP
   if (m_pDepthBlock != NULL)
   {
@@ -186,6 +186,6 @@
     m_acYuvPredBase[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
 #endif
-#if H_3D_VSP
-    m_cYuvDepthOnVsp.create( g_uiMaxCUWidth, g_uiMaxCUHeight );
+#if NH_3D_VSP
+    m_cYuvDepthOnVsp.create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC );
 #endif
 
@@ -1205,5 +1205,5 @@
   {
     pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
-#if H_3D_VSP
+#if NH_3D_VSP
     if ( pcCU->getVSPFlag(uiPartAddr) == 0)
     {
@@ -1270,5 +1270,5 @@
 #endif
     }
-#if H_3D_VSP
+#if NH_3D_VSP
     }
     else
@@ -1291,5 +1291,5 @@
     pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
 
-#if H_3D_VSP
+#if NH_3D_VSP
     if ( pcCU->getVSPFlag(uiPartAddr) == 0 )
     {
@@ -1355,5 +1355,5 @@
 #endif
     }
-#if H_3D_VSP
+#if NH_3D_VSP
     }
     else
@@ -1425,5 +1425,5 @@
 }
 
-#if H_3D_VSP
+#if NH_3D_VSP
 Void TComPrediction::xPredInterUniVSP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi )
 {
@@ -1446,5 +1446,5 @@
 Void TComPrediction::xPredInterUniSubPU( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU, Int heightSubPU )
 {
-  UInt numPartsInLine       = pcCU->getPic()->getNumPartInWidth();
+  UInt numPartsInLine       = pcCU->getPic()->getNumPartInCtuWidth();
   UInt horiNumPartsInSubPU  = widthSubPU >> 2;
   UInt vertNumPartsInSubPU  = (heightSubPU >> 2) * numPartsInLine;
@@ -1462,11 +1462,10 @@
       pcCU->clipMv(cMv);
 
-      xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi );
-      xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi );
-
-    }
-  }
-}
-
+      xPredInterBlk( COMPONENT_Y,  pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );
+      xPredInterBlk( COMPONENT_Cb, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) );
+      xPredInterBlk( COMPONENT_Cr, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) );
+    }
+  }
+}
 #endif
 
@@ -1854,6 +1853,5 @@
 }
 
-#if H_3D_VSP
-
+#if NH_3D_VSP
 Void TComPrediction::xPredInterBiVSP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred )
 {
@@ -1877,7 +1875,6 @@
   }
 
-  xWeightedAverage( &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
-}
-
+  xWeightedAverage( &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred, pcCU->getSlice()->getSPS()->getBitDepths() );
+}
 #endif
 
Index: /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComPrediction.h	(revision 1254)
+++ /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TComPrediction.h	(revision 1255)
@@ -91,5 +91,5 @@
 #endif
 
-#if H_3D_VSP
+#if NH_3D_VSP
   Int*    m_pDepthBlock;         ///< Store a depth block, local variable, to prevent memory allocation every time
   TComYuv m_cYuvDepthOnVsp;
@@ -108,5 +108,5 @@
   Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv* pcYuvPred, Bool bi=false          );
   Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv* pcYuvPred          );
-#if H_3D_VSP
+#if NH_3D_VSP
   Void xPredInterUniVSP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false          );
   Void xPredInterBiVSP          ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred );
@@ -128,5 +128,5 @@
     , Bool bICFlag    = false
 #endif
-#if H_3D_VSP
+#if NH_3D_VSP
   Void xPredInterUniSubPU        ( TComDataCU *cu, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU=4, Int heightSubPU=4 );
 #endif
Index: /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TypeDef.h	(revision 1254)
+++ /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibCommon/TypeDef.h	(revision 1255)
@@ -72,4 +72,5 @@
 #define NH_3D_NBDV_REF                    1
 #define NH_3D_MLC                         1
+#define NH_3D_VSP                         1
 #endif
 
@@ -312,13 +313,4 @@
 /// GT: Move values which are not flags to CommonDef.h and convert to static int !!
 ///////////////////////////////////////////////////////////////////////////////////
-///// ***** VIEW SYNTHESIS PREDICTION *********
-#if H_3D_VSP
-#define H_3D_VSP_BLOCKSIZE                4   // Supported values: 1, 2, and 4
-#if H_3D_VSP_BLOCKSIZE == 1
-#define H_3D_VSP_CONSTRAINED              1   // Constrained VSP @ 1x1
-#else
-#define H_3D_VSP_CONSTRAINED              0
-#endif
-#endif
 ///// ***** ILLUMATION COMPENSATION *********
 #if H_3D_IC
Index: /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1254)
+++ /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1255)
@@ -152,5 +152,5 @@
     setIsChromaQpAdjCoded(true);
   }
-
+  
   // start from the top level CU
   xDecodeCU( pCtu, 0, 0, isLastCtuOfSliceSegment);
@@ -293,7 +293,16 @@
 if(!pcCU->getSlice()->isIntra())
   {
-#if H_3D_ARP && H_3D_IV_MERGE
-    if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getIvMvPredFlag() )
+#if NH_3D_ARP && NH_3D_IV_MERGE && NH_3D_VSP
+    if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getIvMvPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() )
 #else 
+#if NH_3D_IV_MERGE && NH_3D_VSP
+    if( pcCU->getSlice()->getIvMvPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() )
+#else
+#if NH_3D_ARP && NH_3D_VSP
+    if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() )
+#else
+#if NH_3D_VSP
+    if( pcCU->getSlice()->getViewSynthesisPredFlag() )
+#else
 #if H_3D_ARP
     if( pcCU->getSlice()->getVPS()->getUseAdvRP(pcCU->getSlice()->getLayerId()) )
@@ -303,4 +312,7 @@
 #else
     if (0)
+#endif
+#endif
+#endif
 #endif
 #endif
@@ -408,5 +420,5 @@
 
 
-#if H_3D_VSP
+#if NH_3D_VSP
     Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
     memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
@@ -433,5 +445,5 @@
 
     m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
-#if H_3D_VSP
+#if NH_3D_VSP
       , vspFlag
 #endif
@@ -441,5 +453,5 @@
       , numValidMergeCand );
 #endif
-#if H_3D_VSP
+#if NH_3D_VSP
     pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
 #endif
@@ -456,5 +468,5 @@
         pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
         pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
-#if H_3D_VSP
+#if NH_3D_VSP
         if( pcCU->getVSPFlag( uiAbsPartIdx ) != 0 )
         {
Index: /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 1254)
+++ /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 1255)
@@ -318,5 +318,5 @@
         if ( !isMerged )
         {
-#if H_3D_VSP
+#if NH_3D_VSP
           Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
           memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
@@ -337,5 +337,4 @@
             , numValidMergeCand );
           pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
-
 #else
 #if H_3D
@@ -355,5 +354,5 @@
       {
         uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
-#if H_3D_VSP
+#if NH_3D_VSP
         Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
         memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
@@ -395,5 +394,5 @@
           pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
           pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
-#if H_3D_VSP
+#if NH_3D_VSP
 #if H_3D_DBBP
           if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 && !pcCU->getDBBPFlag( uiAbsPartIdx ) )
@@ -486,5 +485,5 @@
 
 #if NH_3D_MLC
-#if H_3D_VSP
+#if NH_3D_VSP
           Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
           memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
@@ -503,5 +502,5 @@
             , numValidMergeCand );
           pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
-#if H_3D_VSP
+#if NH_3D_VSP
             , vspFlag
 #endif
@@ -510,5 +509,5 @@
 #endif
             , numValidMergeCand );
-#if H_3D_VSP
+#if NH_3D_VSP
           pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
 #endif
@@ -523,5 +522,5 @@
 
 #if NH_3D_MLC
-#if H_3D_VSP
+#if NH_3D_VSP
         Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
         memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
@@ -540,5 +539,5 @@
           ,numValidMergeCand, uiMergeIndex );
         pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
-#if H_3D_VSP
+#if NH_3D_VSP
           , vspFlag
 #endif
@@ -547,5 +546,5 @@
 #endif
           ,numValidMergeCand );
-#if H_3D_VSP
+#if NH_3D_VSP
         pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
 #endif
@@ -564,5 +563,18 @@
           pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
           pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
-
+#if NH_3D_VSP
+          if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 )
+          {
+            if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )
+            {
+              UInt dummy;
+              Int vspSize;
+              Int width, height;
+              pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 );
+              pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize );
+              pcCU->setVSPFlag( uiSubPartIdx, vspSize );
+            }
+          }
+#endif
         }
       }
Index: /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1254)
+++ /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1255)
@@ -587,7 +587,16 @@
       if( rpcTempCU->getSlice()->getSliceType() != I_SLICE )
       {
-#if H_3D_ARP && H_3D_IV_MERGE
-        if( rpcTempCU->getSlice()->getIvResPredFlag() || rpcTempCU->getSlice()->getIvMvPredFlag() )
+#if NH_3D_ARP && NH_3D_IV_MERGE && NH_3D_VSP
+        if( rpcTempCU->getSlice()->getIvResPredFlag() || rpcTempCU->getSlice()->getIvMvPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() )
 #else 
+#if NH_3D_IV_MERGE && NH_3D_VSP
+        if( rpcTempCU->getSlice()->getIvMvPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() )
+#else
+#if NH_3D_ARP && NH_3D_VSP
+        if( rpcTempCU->getSlice()->getIvResPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() )
+#else
+#if NH_3D_VSP
+        if( rpcTempCU->getSlice()->getViewSynthesisPredFlag() )
+#else
 #if H_3D_ARP
         if( rpcTempCU->getSlice()->getVPS()->getUseAdvRP(rpcTempCU->getSlice()->getLayerId()) )
@@ -597,4 +606,7 @@
 #else
         if (0)
+#endif
+#endif
+#endif
 #endif
 #endif
@@ -659,6 +671,6 @@
           rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N
 #endif
-#if H_3D_VSP
-            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
+#if NH_3D_VSP
+          rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
         }
@@ -673,6 +685,6 @@
 
         rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
-          rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
+#if NH_3D_VSP
+        rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
 
@@ -690,6 +702,6 @@
           rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
 #endif
-#if H_3D_VSP
-            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
+#if NH_3D_VSP
+          rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
 #if H_3D_DBBP
@@ -698,5 +710,5 @@
               xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU, false );
               rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode  );
-#if H_3D_VSP
+#if NH_3D_VSP
               rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -780,6 +792,6 @@
 #endif
               rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
-                rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
+#if NH_3D_VSP
+              rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
 
@@ -799,5 +811,5 @@
 #endif
             rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
+#if NH_3D_VSP
             rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -822,5 +834,5 @@
 
             rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
+#if NH_3D_VSP
             rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -861,5 +873,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
+#if NH_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -882,5 +894,5 @@
 
                 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
+#if NH_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -909,5 +921,5 @@
 
                 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
+#if NH_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -929,5 +941,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
+#if NH_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -957,5 +969,5 @@
 
                 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
+#if NH_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -977,5 +989,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
+#if NH_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -997,5 +1009,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
+#if NH_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -1018,5 +1030,5 @@
 #endif
                 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
+#if NH_3D_VSP
                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
@@ -1034,11 +1046,11 @@
             xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU );
             rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
-              rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
+#if NH_3D_VSP
+            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
             xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD );
             rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
-              rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
+#if NH_3D_VSP
+            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
 #if H_3D_QTLPC
@@ -1049,11 +1061,11 @@
             xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N );
             rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
-              rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
+#if NH_3D_VSP
+            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
             xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N );
             rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-#if H_3D_VSP
-              rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
+#if NH_3D_VSP
+            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
 #if H_3D_QTLPC
@@ -1798,9 +1810,8 @@
   rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to CTU level
 
-#if H_3D_VSP
+#if NH_3D_VSP
 #if !H_3D_ARP
   Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
   memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
-  InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
 #if NH_3D_MLC
   rpcTempCU->initAvailableFlags();
@@ -1921,5 +1932,5 @@
 
     rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours
-#if H_3D_VSP
+#if NH_3D_VSP
       , vspFlag
 #endif
@@ -1969,5 +1980,5 @@
           rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to CTU level
           rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to CTU level
-#if H_3D_VSP
+#if NH_3D_VSP
           rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth );
 #endif
@@ -1991,6 +2002,6 @@
           else
 #endif
-#if H_3D_VSP
           {
+#if NH_3D_VSP
             if ( vspFlag[uiMergeCand] )
             {
@@ -2022,11 +2033,11 @@
             {
 #endif
-          rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to CTU 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 H_3D_VSP
+            rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to CTU 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 NH_3D_VSP
             }
-          }
-#endif
+#endif
+          }
           // do MC
           m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
@@ -2062,5 +2073,5 @@
           rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );
 #endif
-#if H_3D_VSP // possible bug fix
+#if NH_3D_VSP
           if( rpcTempCU->getSkipFlag(0) )
           {
@@ -2316,9 +2327,9 @@
 
   m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false DEBUG_STRING_PASS_INTO(sTest) );
-#if H_3D_VSP // possible bug fix
-      if( rpcTempCU->getQtRootCbf(0)==0 )
-      {
-        rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);
-      }
+#if NH_3D_VSP
+  if( rpcTempCU->getQtRootCbf(0)==0 )
+  {
+    rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);
+  }
 #endif
 #if NH_3D_VSO // M4
Index: /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1254)
+++ /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1255)
@@ -3869,5 +3869,5 @@
 //! estimation of best merge coding
 Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, Distortion& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours, Int& numValidMergeCand 
-#if H_3D_VSP
+#if NH_3D_VSP
                                  , Int* vspFlag
 #endif
@@ -3936,5 +3936,5 @@
 
       pcCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours
-#if H_3D_VSP
+#if NH_3D_VSP
         , vspFlag
 #endif
@@ -3963,5 +3963,5 @@
 
     pcCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
-#if H_3D_VSP
+#if NH_3D_VSP
       , vspFlag
 #endif
@@ -4001,5 +4001,5 @@
 
     PartSize ePartSize = pcCU->getPartitionSize( 0 );
-#if H_3D_VSP
+#if NH_3D_VSP
     pcCU->setVSPFlagSubParts( vspFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
 #endif
@@ -4024,5 +4024,5 @@
     else
 #endif
-#if H_3D_VSP
+#if NH_3D_VSP
 #if H_3D_DBBP
       if ( vspFlag[uiMergeCand] && !pcCU->getDBBPFlag(0) )
@@ -4061,5 +4061,5 @@
     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 H_3D_VSP
+#if NH_3D_VSP
       }
 #endif
@@ -4207,5 +4207,5 @@
 
     pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );
-#if H_3D_VSP
+#if NH_3D_VSP
     pcCU->setVSPFlagSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr) );
 #endif
@@ -4590,5 +4590,5 @@
       Distortion uiMRGCost = std::numeric_limits<Distortion>::max();
 
-#if H_3D_VSP
+#if NH_3D_VSP
       Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
       memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
@@ -4607,7 +4607,6 @@
       puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()]; 
 #endif
-      xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours
-
-#if H_3D_VSP
+      xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand
+#if NH_3D_VSP
                       , vspFlag
 #endif
@@ -4615,5 +4614,5 @@
                       , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
 #endif 
-, numValidMergeCand);
+                      );
 
       if ( uiMRGCost < uiMECost )
@@ -4622,5 +4621,5 @@
         pcCU->setMergeFlagSubParts ( true,          uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
         pcCU->setMergeIndexSubParts( uiMRGIndex,    uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
-#if H_3D_VSP
+#if NH_3D_VSP
         pcCU->setVSPFlagSubParts( vspFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
 #endif
@@ -4648,5 +4647,5 @@
         else
 #endif
-#if H_3D_VSP
+#if NH_3D_VSP
 #if H_3D_DBBP
         if ( vspFlag[uiMRGIndex] && !pcCU->getDBBPFlag(uiPartAddr) )
@@ -4685,4 +4684,7 @@
         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 NH_3D_VSP
+          }
+#endif
 #if H_3D
           }
@@ -4704,5 +4706,5 @@
         pcCU->setMergeFlagSubParts( false,        uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
         pcCU->setInterDirSubParts ( uiMEInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
-#if H_3D_VSP
+#if NH_3D_VSP
         pcCU->setVSPFlagSubParts ( 0,             uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
         pcCU->setDvInfoSubParts(OriginalDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
Index: /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibEncoder/TEncSearch.h	(revision 1254)
+++ /branches/HTM-14.1-update-dev3-NTT/source/Lib/TLibEncoder/TEncSearch.h	(revision 1255)
@@ -409,5 +409,6 @@
                                     TComMvField* cMvFieldNeighbours,
                                     UChar*       uhInterDirNeighbours,
-#if H_3D_VSP
+                                    Int&         numValidMergeCand
+#if NH_3D_VSP
                                   , Int* vspFlag
 #endif
@@ -415,5 +416,4 @@
                                   , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
 #endif
-                                    Int&         numValidMergeCand
                                    );
 
