Index: branches/HTM-DEV-2.0-dev1-NTT/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- branches/HTM-DEV-2.0-dev1-NTT/source/Lib/TLibCommon/TComPrediction.cpp	(revision 577)
+++ branches/HTM-DEV-2.0-dev1-NTT/source/Lib/TLibCommon/TComPrediction.cpp	(revision 578)
@@ -1535,28 +1535,28 @@
 #if NTT_VSP_COMMON_E0207_E0208
 // not fully support iRatioTxtPerDepth* != 1
-Void TComPrediction::xGetVirtualDepth( TComDataCU *pcCU, TComPicYuv *pcPicRefDepth, TComMv *pcMv, UInt partAddr, Int iWidth, Int iHeight, TComYuv *pcYuvDepth, Int iRatioTxtPerDepthX, Int iRatioTxtPerDepthY )
+Void TComPrediction::xGetVirtualDepth( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *mv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int ratioTxtPerDepthX, Int ratioTxtPerDepthY )
 {
   Int nTxtPerDepthX = H_3D_VSP_BLOCKSIZE;
   Int nTxtPerDepthY = H_3D_VSP_BLOCKSIZE;
 
-  Int refDepStride = pcPicRefDepth->getStride();
+  Int refDepStride = picRefDepth->getStride();
 
 #if NTT_VSP_VECTOR_CLIP_E0208
 
-  Int refDepOffset = ( (pcMv->getHor()+2) >> 2 ) + ( (pcMv->getVer()+2) >> 2 ) * refDepStride;
-
-#if 1 // // iRatioTxtPerDepthX==1 && iRatioTxtPerDepthY==1
-  Pel *refDepth    = pcPicRefDepth->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + partAddr );
-#else
-  Pel *refDepth    = pcPicRefDepth->getLumaAddr( );
-  Int iPosX, iPosY;
-  pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + partAddr, iPosX, iPosY ); // top-left position in texture
-  iPosX /= iRatioTxtPerDepthX; // texture position -> depth postion
-  iPosY /= iRatioTxtPerDepthY;
-  refDepOffset += iPosX + iPosY * refDepStride;
-
-  iWidth  /= iRatioTxtPerDepthX; // texture size -> depth size
-  iHeight /= iRatioTxtPerDepthY;
-#endif
+  Int refDepOffset  = ( (mv->getHor()+2) >> 2 ) + ( (mv->getVer()+2) >> 2 ) * refDepStride;
+  Pel *refDepth     = picRefDepth->getLumaAddr( cu->getAddr(), cu->getZorderIdxInCU() + partAddr );
+
+  if( ratioTxtPerDepthX!=1 || ratioTxtPerDepthY!=1 )
+  {
+    Int posX, posY;
+    refDepth    = picRefDepth->getLumaAddr( );
+    cu->getPic()->getPicYuvRec()->getTopLeftSamplePos( cu->getAddr(), cu->getZorderIdxInCU() + partAddr, posX, posY ); // top-left position in texture
+    posX /= ratioTxtPerDepthX; // texture position -> depth postion
+    posY /= ratioTxtPerDepthY;
+    refDepOffset += posX + posY * refDepStride;
+
+    width  /= ratioTxtPerDepthX; // texture size -> depth size
+    height /= ratioTxtPerDepthY;
+  }
 
   refDepth += refDepOffset;
@@ -1564,37 +1564,37 @@
 #else // NTT_VSP_VECTOR_CLIP_E0208
 
-  Int widthDepth = pcPicRefDepth->getWidth();
-  Int heightDepth = pcPicRefDepth->getHeight();
-  Int iPosX, iPosY;
-  pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + partAddr, iPosX, iPosY ); // top-left position in texture
-  iPosX /= iRatioTxtPerDepthX; // texture position -> depth postion
-  iPosY /= iRatioTxtPerDepthY;
+  Int widthDepth = picRefDepth->getWidth();
+  Int heightDepth = picRefDepth->getHeight();
+  Int posX, posY;
+  cu->getPic()->getPicYuvRec()->getTopLeftSamplePos( cu->getAddr(), cu->getZorderIdxInCU() + partAddr, posX, posY ); // top-left position in texture
+  posX /= ratioTxtPerDepthX; // texture position -> depth postion
+  posY /= ratioTxtPerDepthY;
   
-  iPosX = Clip3(0, widthDepth-iWidth,   iPosX + ((pcMv->getHor()+2)>>2));
-  iPosY = Clip3(0, heightDepth-iHeight, iPosY + ((pcMv->getVer()+2)>>2));
+  posX = Clip3(0, widthDepth-width,   posX + ((mv->getHor()+2)>>2));
+  posY = Clip3(0, heightDepth-height, posY + ((mv->getVer()+2)>>2));
   
-  Pel *refDepth  = pcPicRefDepth->getLumaAddr() + iPosX + iPosY * refDepStride;
+  Pel *refDepth  = picRefDepth->getLumaAddr() + posX + posY * refDepStride;
 
 #endif // NTT_VSP_VECTOR_CLIP_E0208
 
-  Int depStride = pcYuvDepth->getStride();
-  Pel *depth = pcYuvDepth->getLumaAddr();
+  Int depStride = yuvDepth->getStride();
+  Pel *depth = yuvDepth->getLumaAddr();
 
 #if NTT_VSP_ADAPTIVE_SPLIT_E0207
 
-  if( iWidth<8 || iHeight<8 )
+  if( width<8 || height<8 )
   { // no split
-    Int rightOffset = iWidth - 1;
+    Int rightOffset = width - 1;
     Int depStrideBlock = depStride * nTxtPerDepthY;
     Pel *refDepthTop = refDepth;
-    Pel *refDepthBot = refDepthTop + (iHeight-1)*refDepStride;
+    Pel *refDepthBot = refDepthTop + (height-1)*refDepStride;
 
     Pel maxDepth = refDepthTop[0] > refDepthBot[0] ? refDepthTop[0] : refDepthBot[0];
-    if( maxDepth < refDepthTop[rightOffset] ) maxDepth = refDepthTop[rightOffset];
-    if( maxDepth < refDepthBot[rightOffset] ) maxDepth = refDepthBot[rightOffset];
-
-    for( Int sY=0; sY<iHeight; sY+=nTxtPerDepthY )
-    {
-      for( Int sX=0; sX<iWidth; sX+=nTxtPerDepthX )
+    if( maxDepth < refDepthTop[rightOffset] ) { maxDepth = refDepthTop[rightOffset]; }
+    if( maxDepth < refDepthBot[rightOffset] ) { maxDepth = refDepthBot[rightOffset]; }
+
+    for( Int sY=0; sY<height; sY+=nTxtPerDepthY )
+    {
+      for( Int sX=0; sX<width; sX+=nTxtPerDepthX )
       {
         depth[sX] = maxDepth;
@@ -1623,7 +1623,7 @@
     refDepthTmp[3] = refDepthTmp[1] + refDepStrideSubBlock;
 
-    for( Int y=0; y<iHeight; y+=blocksize )
-    {
-      for( Int x=0; x<iWidth; x+=blocksize )
+    for( Int y=0; y<height; y+=blocksize )
+    {
+      for( Int x=0; x<width; x+=blocksize )
       {
         Bool ULvsBR = false, URvsBL = false;
@@ -1635,9 +1635,21 @@
         { // 4x8
           repDepth4x8[0] = refDepthTmp[0][x+offset[0]] > refDepthTmp[0][x+offset[1]] ? refDepthTmp[0][x+offset[0]] : refDepthTmp[0][x+offset[1]];
-          if( repDepth4x8[0] < refDepthTmp[3][x+offset[0]] ) repDepth4x8[0] = refDepthTmp[3][x+offset[0]];
-          if( repDepth4x8[0] < refDepthTmp[3][x+offset[1]] ) repDepth4x8[0] = refDepthTmp[3][x+offset[1]];
+          if( repDepth4x8[0] < refDepthTmp[3][x+offset[0]] )
+          {
+            repDepth4x8[0] = refDepthTmp[3][x+offset[0]];
+          }
+          if( repDepth4x8[0] < refDepthTmp[3][x+offset[1]] )
+          {
+            repDepth4x8[0] = refDepthTmp[3][x+offset[1]];
+          }
           repDepth4x8[1] = refDepthTmp[0][x+offset[2]] > refDepthTmp[0][x+offset[3]] ? refDepthTmp[0][x+offset[2]] : refDepthTmp[0][x+offset[3]];
-          if( repDepth4x8[1] < refDepthTmp[3][x+offset[2]] ) repDepth4x8[1] = refDepthTmp[3][x+offset[2]];
-          if( repDepth4x8[1] < refDepthTmp[3][x+offset[3]] ) repDepth4x8[1] = refDepthTmp[3][x+offset[3]];
+          if( repDepth4x8[1] < refDepthTmp[3][x+offset[2]] )
+          {
+            repDepth4x8[1] = refDepthTmp[3][x+offset[2]];
+          }
+          if( repDepth4x8[1] < refDepthTmp[3][x+offset[3]] )
+          {
+            repDepth4x8[1] = refDepthTmp[3][x+offset[3]];
+          }
 
           depthTmp = &depth[x];
@@ -1663,9 +1675,21 @@
         { // 8x4
           repDepth8x4[0] = refDepthTmp[0][x+offset[0]] > refDepthTmp[0][x+offset[3]] ? refDepthTmp[0][x+offset[0]] : refDepthTmp[0][x+offset[3]];
-          if( repDepth8x4[0] < refDepthTmp[1][x+offset[0]] ) repDepth8x4[0] = refDepthTmp[1][x+offset[0]];
-          if( repDepth8x4[0] < refDepthTmp[1][x+offset[3]] ) repDepth8x4[0] = refDepthTmp[1][x+offset[3]];
+          if( repDepth8x4[0] < refDepthTmp[1][x+offset[0]] )
+          {
+            repDepth8x4[0] = refDepthTmp[1][x+offset[0]];
+          }
+          if( repDepth8x4[0] < refDepthTmp[1][x+offset[3]] )
+          {
+            repDepth8x4[0] = refDepthTmp[1][x+offset[3]];
+          }
           repDepth8x4[1] = refDepthTmp[2][x+offset[0]] > refDepthTmp[2][x+offset[3]] ? refDepthTmp[2][x+offset[0]] : refDepthTmp[2][x+offset[3]];
-          if( repDepth8x4[1] < refDepthTmp[3][x+offset[0]] ) repDepth8x4[1] = refDepthTmp[3][x+offset[0]];
-          if( repDepth8x4[1] < refDepthTmp[3][x+offset[3]] ) repDepth8x4[1] = refDepthTmp[3][x+offset[3]];
+          if( repDepth8x4[1] < refDepthTmp[3][x+offset[0]] )
+          {
+            repDepth8x4[1] = refDepthTmp[3][x+offset[0]];
+          }
+          if( repDepth8x4[1] < refDepthTmp[3][x+offset[3]] )
+          {
+            repDepth8x4[1] = refDepthTmp[3][x+offset[3]];
+          }
           
           depthTmp = &depth[x];
@@ -1704,12 +1728,18 @@
   Pel *refDepthBot = refDepthTop + (nTxtPerDepthY-1)*refDepStride;
 
-  for( Int y=0; y<iHeight; y+= nTxtPerDepthY )
-  {
-    for( Int x=0; x<iWidth; x+=nTxtPerDepthX )
+  for( Int y=0; y<height; y+= nTxtPerDepthY )
+  {
+    for( Int x=0; x<width; x+=nTxtPerDepthX )
     {
       Pel maxDepth = refDepthTop[x] > refDepthBot[x] ? refDepthTop[x] : refDepthBot[x]; 
 
-      if( maxDepth < refDepthTop[x+rightOffset] ) maxDepth = refDepthTop[x+rightOffset];
-      if( maxDepth < refDepthBot[x+rightOffset] ) maxDepth = refDepthBot[x+rightOffset];
+      if( maxDepth < refDepthTop[x+rightOffset] )
+      {
+        maxDepth = refDepthTop[x+rightOffset];
+      }
+      if( maxDepth < refDepthBot[x+rightOffset] )
+      {
+        maxDepth = refDepthBot[x+rightOffset];
+      }
 
       depth[x] = maxDepth;
@@ -1724,24 +1754,24 @@
 }
 
-Void TComPrediction::xPredInterLumaBlkFromDM( TComDataCU *pcCU, TComPicYuv *pcPicRef, TComYuv *pcYuvDepth, Int* pShiftLUT, TComMv *pcMv, UInt partAddr, Int iWidth, Int iHeight, Bool bIsDepth, TComYuv *&pcYuvDst, Bool bIsBi )
+Void TComPrediction::xPredInterLumaBlkFromDM( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi )
 {
   Int nTxtPerDepthX = H_3D_VSP_BLOCKSIZE;
   Int nTxtPerDepthY = H_3D_VSP_BLOCKSIZE;
   
-  Int refStride = pcPicRef->getStride();
-  Int dstStride = pcYuvDst->getStride();
-  Int depStride = pcYuvDepth->getStride();
+  Int refStride = picRef->getStride();
+  Int dstStride = yuvDst->getStride();
+  Int depStride = yuvDepth->getStride();
   Int refStrideBlock = refStride  * nTxtPerDepthY;
   Int dstStrideBlock = dstStride * nTxtPerDepthY;
   Int depStrideBlock = depStride * nTxtPerDepthY;
 
-  Pel *ref    = pcPicRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + partAddr );
-  Pel *dst    = pcYuvDst->getLumaAddr(partAddr);
-  Pel *depth  = pcYuvDepth->getLumaAddr();
+  Pel *ref    = picRef->getLumaAddr( cu->getAddr(), cu->getZorderIdxInCU() + partAddr );
+  Pel *dst    = yuvDst->getLumaAddr(partAddr);
+  Pel *depth  = yuvDepth->getLumaAddr();
   
 #if !(NTT_VSP_DC_BUGFIX_E0208)
-  Int widthLuma = pcPicRef->getWidth();
-  Int iPosX, iPosY;
-  pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + partAddr, iPosX, iPosY ); // top-left position in texture
+  Int widthLuma = picRef->getWidth();
+  Int posX, posY;
+  cu->getPic()->getPicYuvRec()->getTopLeftSamplePos( cu->getAddr(), cu->getZorderIdxInCU() + partAddr, posX, posY ); // top-left position in texture
 #endif
 
@@ -1749,5 +1779,5 @@
 #if H_3D_VSP_CONSTRAINED
   //get LUT based horizontal reference range
-  Int range = xGetConstrainedSize(iWidth, iHeight);
+  Int range = xGetConstrainedSize(width, height);
 
   // The minimum depth value
@@ -1756,14 +1786,18 @@
 
   Pel* depthTemp, *depthInitial=depth;
-  for (Int yTxt = 0; yTxt < iHeight; yTxt++)
-  {
-    for (Int xTxt = 0; xTxt < iWidth; xTxt++)
+  for (Int yTxt = 0; yTxt < height; yTxt++)
+  {
+    for (Int xTxt = 0; xTxt < width; xTxt++)
     {
       if (depthPosX+xTxt < widthDepth)
+      {
         depthTemp = depthInitial + xTxt;
+      }
       else
+      {
         depthTemp = depthInitial + (widthDepth - depthPosX - 1);
-
-      Int disparity = pShiftLUT[ *depthTemp ]; // << iShiftPrec;
+      }
+
+      Int disparity = shiftLUT[ *depthTemp ]; // << iShiftPrec;
       Int disparityInt = disparity >> 2;
 
@@ -1771,51 +1805,63 @@
       {
         if (minRelativePos > disparityInt+xTxt)
-            minRelativePos = disparityInt+xTxt;
+        {
+          minRelativePos = disparityInt+xTxt;
+        }
       }
       else
       {
         if (maxRelativePos < disparityInt+xTxt)
-            maxRelativePos = disparityInt+xTxt;
+        {
+          maxRelativePos = disparityInt+xTxt;
+        }
       }
     }
     if (depthPosY+yTxt < heightDepth)
+    {
       depthInitial = depthInitial + depStride;
-  }
-
-  Int disparity_tmp = pShiftLUT[ *depth ]; // << iShiftPrec;
+    }
+  }
+
+  Int disparity_tmp = shiftLUT[ *depth ]; // << iShiftPrec;
   if (disparity_tmp <= 0)
+  {
     maxRelativePos = minRelativePos + range -1 ;
+  }
   else
+  {
     minRelativePos = maxRelativePos - range +1 ;
+  }
 #endif
 #endif // H_3D_VSP_BLOCKSIZE == 1
 
-  TComMv cDv(0, 0);
-
-  for ( Int yTxt = 0; yTxt < iHeight; yTxt += nTxtPerDepthY )
-  {
-    for ( Int xTxt = 0; xTxt < iWidth; xTxt += nTxtPerDepthX )
+  TComMv dv(0, 0);
+
+  for ( Int yTxt = 0; yTxt < height; yTxt += nTxtPerDepthY )
+  {
+    for ( Int xTxt = 0; xTxt < width; xTxt += nTxtPerDepthX )
     {
       Pel repDepth = depth[ xTxt ];
       assert( repDepth >= 0 && repDepth <= 255 );
 
-      Int disparity = pShiftLUT[ repDepth ]; // remove << iShiftPrec ??
+      Int disparity = shiftLUT[ repDepth ]; // remove << iShiftPrec ??
       Int xFrac = disparity & 0x3;
 
 #if NTT_VSP_DC_BUGFIX_E0208
 
-      cDv.setHor( disparity );
-      pcCU->clipMv( cDv );
-
-      Int refOffset = xTxt + (cDv.getHor() >> 2);
+      dv.setHor( disparity );
+      cu->clipMv( dv );
+
+      Int refOffset = xTxt + (dv.getHor() >> 2);
       
 #if H_3D_VSP_CONSTRAINED
       if(refOffset<minRelativePos || refOffset>maxRelativePos)
+      {
         xFrac = 0;
+      }
       refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
 #endif
 
       assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 );
-      m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bIsBi );
+      m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !isBi );
 
 #else // NTT_VSP_DC_BUGFIX_E0208
@@ -1826,18 +1872,24 @@
 #if H_3D_VSP_CONSTRAINED
         if(refOffset<minRelativePos || refOffset>maxRelativePos)
+        {
           xFrac = 0;
+        }
         refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
 #endif
-        Int absX  = iPosX + refOffset;
+        Int absX  = posX + refOffset;
 
         if (xFrac == 0)
+        {
           absX = Clip3(0, widthLuma-1, absX);
+        }
         else
+        {
           absX = Clip3(4, widthLuma-5, absX);
-
-        refOffset = absX - iPosX;
+        }
+
+        refOffset = absX - posX;
         assert( ref[refOffset] >= 0 && ref[refOffset] <= 255 );
         
-        m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !bIsBi );
+        m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !isBi );
       }
 
@@ -1852,5 +1904,5 @@
 }
 
-Void TComPrediction::xPredInterChromaBlkFromDM  ( TComDataCU *pcCU, TComPicYuv *pcPicRef, TComYuv *pcYuvDepth, Int* pShiftLUT, TComMv *pcMv, UInt partAddr, Int iWidth, Int iHeight, Bool bIsDepth, TComYuv *&pcYuvDst, Bool bIsBi )
+Void TComPrediction::xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi )
 {
 #if (H_3D_VSP_BLOCKSIZE==1)
@@ -1862,48 +1914,23 @@
 #endif
 
-  Int refStride = pcPicRef->getCStride();
-  Int dstStride = pcYuvDst->getCStride();
-  Int depStride = pcYuvDepth->getStride();
+  Int refStride = picRef->getCStride();
+  Int dstStride = yuvDst->getCStride();
+  Int depStride = yuvDepth->getStride();
   Int refStrideBlock = refStride * nTxtPerDepthY;
   Int dstStrideBlock = dstStride * nTxtPerDepthY;
   Int depStrideBlock = depStride * (nTxtPerDepthY<<1);
 
-  Pel *refCb  = pcPicRef->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + partAddr );
-  Pel *refCr  = pcPicRef->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + partAddr );
-  Pel *dstCb  = pcYuvDst->getCbAddr(partAddr);
-  Pel *dstCr  = pcYuvDst->getCrAddr(partAddr);
-  Pel *depth  = pcYuvDepth->getLumaAddr();
-
-#if 0 // not necessary??
-  if (bIsDepth)
-  {
-    Pel val = 128;
-    iHeight >>=1; // luma to chroma
-    iWidth >>=1;
-    if ( bIsBi )
-    {
-      Int shift = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement );
-      val = (val << shift) - (Pel)IF_INTERNAL_OFFS;
-    }
-    for (Int y = 0; y < iHeight; y++)
-    {
-      for (Int x = 0; x < iWidth; x++)
-      {
-        dstCb[x] = val;
-        dstCr[x] = val;
-      }
-      dstCb += dstStride;
-      dstCr += dstStride;
-    }
-    return;
-  }
-#endif
+  Pel *refCb  = picRef->getCbAddr( cu->getAddr(), cu->getZorderIdxInCU() + partAddr );
+  Pel *refCr  = picRef->getCrAddr( cu->getAddr(), cu->getZorderIdxInCU() + partAddr );
+  Pel *dstCb  = yuvDst->getCbAddr(partAddr);
+  Pel *dstCr  = yuvDst->getCrAddr(partAddr);
+  Pel *depth  = yuvDepth->getLumaAddr();
 
 #if !(NTT_VSP_DC_BUGFIX_E0208)
-  Int widthChroma = pcPicRef->getWidth() >> 1;
-  Int iPosX, iPosY;
-  pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + partAddr, iPosX, iPosY ); // top-left position in texture
-  iPosX >>= 1;
-  iPosY >>= 1;
+  Int widthChroma = picRef->getWidth() >> 1;
+  Int posX, posY;
+  cu->getPic()->getPicYuvRec()->getTopLeftSamplePos( cu->getAddr(), cu->getZorderIdxInCU() + partAddr, posX, posY ); // top-left position in texture
+  posX >>= 1;
+  posY >>= 1;
 #endif
   
@@ -1911,5 +1938,5 @@
 #if H_3D_VSP_CONSTRAINED
   //get LUT based horizontal reference range
-  Int range = xGetConstrainedSize(iWidth, iHeight, false);
+  Int range = xGetConstrainedSize(width, height, false);
 
   // The minimum depth value
@@ -1918,10 +1945,10 @@
 
   Int depthTmp;
-  for (Int yTxt=0; yTxt<iHeight; yTxt++)
-  {
-    for (Int xTxt=0; xTxt<iWidth; xTxt++)
-    {
-      depthTmp = m_pDepthBlock[xTxt+yTxt*dW];
-      Int disparity = pShiftLUT[ depthTmp ]; // << iShiftPrec;
+  for (Int yTxt=0; yTxt<height; yTxt++)
+  {
+    for (Int xTxt=0; xTxt<width; xTxt++)
+    {
+      depthTmp = m_pDepthBlock[xTxt+yTxt*width];
+      Int disparity = shiftLUT[ depthTmp ]; // << iShiftPrec;
       Int disparityInt = disparity >> 3;//in chroma resolution
 
@@ -1929,10 +1956,14 @@
       {
         if (minRelativePos > disparityInt+xTxt)
-            minRelativePos = disparityInt+xTxt;
+        {
+          minRelativePos = disparityInt+xTxt;
+        }
       }
       else
       {
         if (maxRelativePos < disparityInt+xTxt)
-            maxRelativePos = disparityInt+xTxt;
+        {
+          maxRelativePos = disparityInt+xTxt;
+        }
       }
     }
@@ -1940,38 +1971,44 @@
 
   depthTmp = m_pDepthBlock[0];
-  Int disparity_tmp = pShiftLUT[ depthTmp ]; // << iShiftPrec;
+  Int disparity_tmp = shiftLUT[ depthTmp ]; // << iShiftPrec;
   if ( disparity_tmp < 0 )
+  {
     maxRelativePos = minRelativePos + range - 1;
+  }
   else
+  {
     minRelativePos = maxRelativePos - range + 1;
+  }
 
 #endif // H_3D_VSP_CONSTRAINED
 #endif // H_3D_VSP_BLOCKSIZE == 1
 
-  TComMv cDv(0, 0);
+  TComMv dv(0, 0);
   // luma size -> chroma size
-  iHeight >>= 1;
-  iWidth  >>= 1;
-
-  for ( Int yTxt = 0; yTxt < iHeight; yTxt += nTxtPerDepthY )
-  {
-    for ( Int xTxt = 0; xTxt < iWidth; xTxt += nTxtPerDepthX )
+  height >>= 1;
+  width  >>= 1;
+
+  for ( Int yTxt = 0; yTxt < height; yTxt += nTxtPerDepthY )
+  {
+    for ( Int xTxt = 0; xTxt < width; xTxt += nTxtPerDepthX )
     {
       Pel repDepth = depth[ xTxt<<1 ];
       assert( repDepth >= 0 && repDepth <= 255 );
 
-      Int disparity = pShiftLUT[ repDepth ]; // remove << iShiftPrec;
+      Int disparity = shiftLUT[ repDepth ]; // remove << iShiftPrec;
       Int xFrac = disparity & 0x7;
       
 #if NTT_VSP_DC_BUGFIX_E0208
 
-      cDv.setHor( disparity );
-      pcCU->clipMv( cDv );
-
-      Int refOffset = xTxt + (cDv.getHor() >> 3);
+      dv.setHor( disparity );
+      cu->clipMv( dv );
+
+      Int refOffset = xTxt + (dv.getHor() >> 3);
 
 #if H_3D_VSP_CONSTRAINED
       if(refOffset<minRelativePos || refOffset>maxRelativePos)
+      {
         xFrac = 0;
+      }
       refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
 #endif
@@ -1980,6 +2017,6 @@
       assert( refCr[refOffset] >= 0 && refCr[refOffset]<= 255 );
 
-      m_if.filterHorChroma( &refCb[refOffset], refStride, &dstCb[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bIsBi );
-      m_if.filterHorChroma( &refCr[refOffset], refStride, &dstCr[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bIsBi );
+      m_if.filterHorChroma( &refCb[refOffset], refStride, &dstCb[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !isBi );
+      m_if.filterHorChroma( &refCr[refOffset], refStride, &dstCr[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !isBi );
 
 #else // NTT_VSP_DC_BUGFIX_E0208
@@ -1990,20 +2027,26 @@
 #if H_3D_VSP_CONSTRAINED
         if(refOffset<minRelativePos || refOffset>maxRelativePos)
+        {
           xFrac = 0;
+        }
         refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
 #endif
-        Int absX  = iPosX + refOffset;
+        Int absX  = posX + refOffset;
 
         if (xFrac == 0)
+        {
           absX = Clip3(0, widthChroma-1, absX);
+        }
         else
+        {
           absX = Clip3(4, widthChroma-5, absX);
-
-        refOffset = absX - iPosX;
+        }
+
+        refOffset = absX - posX;
         assert( refCb[refOffset] >= 0 && refCb[refOffset] <= 255 );
         assert( refCr[refOffset] >= 0 && refCr[refOffset] <= 255 );
 
-        m_if.filterHorChroma( &refCb[refOffset], refStride, &dstCb[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !bIsBi );
-        m_if.filterHorChroma( &refCr[refOffset], refStride, &dstCr[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !bIsBi );
+        m_if.filterHorChroma( &refCb[refOffset], refStride, &dstCb[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !isBi );
+        m_if.filterHorChroma( &refCr[refOffset], refStride, &dstCr[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !isBi );
       }
 
Index: branches/HTM-DEV-2.0-dev1-NTT/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- branches/HTM-DEV-2.0-dev1-NTT/source/Lib/TLibCommon/TComPrediction.h	(revision 577)
+++ branches/HTM-DEV-2.0-dev1-NTT/source/Lib/TLibCommon/TComPrediction.h	(revision 578)
@@ -123,7 +123,7 @@
 #if H_3D_VSP
 #if NTT_VSP_COMMON_E0207_E0208
-  Void xGetVirtualDepth           ( TComDataCU *pcCU, TComPicYuv *pcPicRefDepth, TComMv *pcDv, UInt partAddr, Int iWidth, Int iHeight, TComYuv *pcYuvDepth, Int iTxtPerDepthX=1, Int iTxtPerDepthY=1 );
-  Void xPredInterLumaBlkFromDM    ( TComDataCU *pcCU, TComPicYuv *pcPicRef, TComYuv *pcYuvDepth, Int* pShiftLUT, TComMv *pcMv, UInt partAddr, Int iWidth, Int iHeight, Bool bIsDepth, TComYuv *&pcYuvDst, Bool bIsBi );
-  Void xPredInterChromaBlkFromDM  ( TComDataCU *pcCU, TComPicYuv *pcPicRef, TComYuv *pcYuvDepth, Int* pShiftLUT, TComMv *pcMv, UInt partAddr, Int iWidth, Int iHeight, Bool bIsDepth, TComYuv *&pcYuvDst, Bool bIsBi );
+  Void xGetVirtualDepth           ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int txtPerDepthX=1, Int txtPerDepthY=1 );
+  Void xPredInterLumaBlkFromDM    ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi );
+  Void xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi );
 #else
   Void xPredInterLumaBlkFromDM  ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv* dv, UInt partAddr, Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi );
Index: branches/HTM-DEV-2.0-dev1-NTT/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-DEV-2.0-dev1-NTT/source/Lib/TLibCommon/TypeDef.h	(revision 577)
+++ branches/HTM-DEV-2.0-dev1-NTT/source/Lib/TLibCommon/TypeDef.h	(revision 578)
@@ -201,9 +201,9 @@
 #endif
 
-#define NTT_VSP_COMMON_E0207_E0208        1 // common part of JCT3V-E0207 and JCT3V-E0208
+#define NTT_VSP_COMMON_E0207_E0208        0 // common part of JCT3V-E0207 and JCT3V-E0208
 #if NTT_VSP_COMMON_E0207_E0208
-#define NTT_VSP_DC_BUGFIX_E0208           1 // bugfix for sub-PU based DC in VSP, JCT3V-E0208
-#define NTT_VSP_VECTOR_CLIP_E0208         1 // disparity vector clipping on fetching depth map in VSP, JCT3V-E0208
-#define NTT_VSP_ADAPTIVE_SPLIT_E0207      1 // adaptive sub-PU partitioning in VSP, JCT3V-E0207
+#define NTT_VSP_DC_BUGFIX_E0208           0 // bugfix for sub-PU based DC in VSP, JCT3V-E0208
+#define NTT_VSP_VECTOR_CLIP_E0208         0 // disparity vector clipping on fetching depth map in VSP, JCT3V-E0208
+#define NTT_VSP_ADAPTIVE_SPLIT_E0207      0 // adaptive sub-PU partitioning in VSP, JCT3V-E0207
 #endif
 
