Index: branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenFilter.cpp
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenFilter.cpp	(revision 165)
+++ branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenFilter.cpp	(revision 166)
@@ -1154,4 +1154,45 @@
 }
 
+#if NTT_SUBPEL
+// Convert luma sample
+Void TRenFilter::sampleConv( Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride, Pel* pcDepthPlaneData, Int iDepthStride, Int** ppiFposLUT )
+{
+  TRenInterpFilter cFilter;
+
+  xDistributeArrayOnDepthCondition  ( pcInputPlaneData, iInputStride, 1 , 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 1, 1, pcDepthPlaneData, iDepthStride, 1, 1, ppiFposLUT);
+  cFilter.xCTI_FilterQuarter0Hor    ( pcInputPlaneData, iInputStride, 1, iInputWidth, iHeight, iOutputStride, 1, pcOutputPlaneData, pcDepthPlaneData, iDepthStride, 1, ppiFposLUT );
+  cFilter.xCTI_FilterHalfHor        ( pcInputPlaneData, iInputStride, 1, iInputWidth, iHeight, iOutputStride, 1, pcOutputPlaneData, pcDepthPlaneData, iDepthStride, 1, ppiFposLUT );
+  cFilter.xCTI_FilterQuarter1Hor    ( pcInputPlaneData, iInputStride, 1, iInputWidth, iHeight, iOutputStride, 1, pcOutputPlaneData, pcDepthPlaneData, iDepthStride, 1, ppiFposLUT );
+}
+
+Void TRenFilter::sampleCVerUp( Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
+{
+  xDistributeArray( pcInputPlaneData-3, iInputStride, 1, 1, iInputWidth+6, iHeight, pcOutputPlaneData              -3, iOutputStride, 1, 2 );
+  xInterpVerChroma( pcInputPlaneData-3, iInputStride, 1, 1, iInputWidth+6, iHeight, pcOutputPlaneData+iOutputStride-3, iOutputStride, 1, 2, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
+}
+
+Void TRenFilter::sampleCConv( Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride, Pel* pcDepthPlaneData, Int iDepthStride, Int** ppiFposLUT )
+{
+  // assume quater resolution depth 
+  xDistributeArrayOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 1, 1, pcDepthPlaneData, iDepthStride, 2, 2, ppiFposLUT);
+  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 1, 1, pcDepthPlaneData, iDepthStride, 2, 2, ppiFposLUT, 1, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA0 );
+  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 1, 1, pcDepthPlaneData, iDepthStride, 2, 2, ppiFposLUT, 2, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
+  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 1, 1, pcDepthPlaneData, iDepthStride, 2, 2, ppiFposLUT, 3, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA1 );
+}
+
+Void TRenFilter::sampleCConvHorUp( Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride, Pel* pcDepthPlaneData, Int iDepthStride, Int** ppiFposLUT )
+{
+  xDistributeArrayOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT);
+  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 1, &TRenInterpFilter::xCTI_Filter_VP04_C_OCT0 );
+  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 2, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA0 );
+  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 3, &TRenInterpFilter::xCTI_Filter_VP04_C_OCT1 );
+
+  pcOutputPlaneData++; pcDepthPlaneData++;
+  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 0, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
+  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 1, &TRenInterpFilter::xCTI_Filter_VP04_C_OCT2 );
+  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 2, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA1 );
+  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 3, &TRenInterpFilter::xCTI_Filter_VP04_C_OCT3 );
+}
+#endif
 
 // Down Sampling
@@ -1224,4 +1265,71 @@
   }
 }
+
+#if NTT_SUBPEL
+Void TRenFilter::xDistributeArrayOnDepthCondition(Pel* pcSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* pcDst, Int iDstStride, Int iDstStepX, Int iDstStepY, Pel* pcDep, Int iDepStride, Int iDepStepX, Int iDepStepY, Int** ppiFposLUT)
+{
+  iDstStride *= iDstStepY;
+  iSrcStride *= iSrcStepY;
+  iDepStride *= iDepStepY;
+
+  for (Int iYPos = 0; iYPos < iHeight; iYPos++ )
+  {
+    Pel* pcCurDst = pcDst;
+    Pel* pcCurSrc = pcSrc;
+    Pel* pcCurDep = pcDep;
+
+    for (Int iXPos = 0; iXPos < iWidth; iXPos ++)
+    {
+      if( ppiFposLUT[0][ *pcCurDep ] == 0 )
+      {
+        *pcCurDst = *pcCurSrc;
+      }
+      pcCurDst += iDstStepX;
+      pcCurSrc += iSrcStepX;
+      pcCurDep += iDepStepX;
+    }
+    pcDst  += iDstStride;
+    pcSrc  += iSrcStride;
+    pcDep  += iDepStride;
+  }
+}
+
+Void TRenFilter::xInterpHorChromaOnDepthCondition( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, Pel* piDep, Int iDepStride, Int iDepStepX, Int iDepStepY, Int** ppiFposLUT, Int iTargetFpos, FpChromaIntFilt fpFilter )
+{
+  Int   iSum;
+  Pel*  piSrcTmpP;
+  Pel*  piSrcTmpN;
+  Pel*  piSrcTmp;
+
+  Int   iDepX;
+
+  TRenInterpFilter cFilter;
+  for ( Int y = 0; y < iHeight; y++ )
+  {
+    piSrcTmpP = piSrc - iSrcStepX;
+    piSrcTmpN = piSrc - iSrcStepX*2;
+    iDepX = 0;
+    for ( Int x = 0; x < iWidth; x++ )
+    {
+#if 0 // NTT bugfix
+      if( abs(ppiFposLUT[0][ piDep[iDepX] ]) == iTargetFpos )
+#else
+      if( ppiFposLUT[0][ piDep[iDepX] ] == iTargetFpos || ppiFposLUT[0][ piDep[iDepX] ]+4 == iTargetFpos )
+#endif
+      {
+        piSrcTmp = ppiFposLUT[0][ piDep[ iDepX ] ] >= 0 ? piSrcTmpP : piSrcTmpN;
+        iSum      = (cFilter.*fpFilter)( piSrcTmp,  iSrcStepX );
+        piDst[x * iDstStepX ] =  Clip ((iSum +  32) >>  6 );
+      }
+      piSrcTmpP += iSrcStepX;
+      piSrcTmpN += iSrcStepX;
+      iDepX += iDepStepX;
+    }
+    piSrc += iSrcStride * iSrcStepY;
+    piDst += iDstStride * iDstStepY;
+    piDep += iDepStride * iDepStepY;
+  }
+}
+#endif
 
 
Index: branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenFilter.h
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenFilter.h	(revision 165)
+++ branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenFilter.h	(revision 166)
@@ -103,4 +103,11 @@
   static Void sampleCUpHorUp    (Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight,      Pel* pcOutputPlaneData, Int iOutputStride );
 
+#if NTT_SUBPEL
+  static Void sampleConv        (Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride, Pel* pcDepthPlaneData, Int iDepthStride, Int** ppiFposLUT );
+  static Void sampleCVerUp      (Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride );
+  static Void sampleCConv       (Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride, Pel* pcDepthPlaneData, Int iDepthStride, Int** ppiFposLUT );
+  static Void sampleCConvHorUp  (Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride, Pel* pcDepthPlaneData, Int iDepthStride, Int** ppiFposLUT );
+#endif
+
   //// Down sampling (13 tap)
 
@@ -131,4 +138,9 @@
   static Void xDistributeArray(Pel* pcSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* pcDst, Int iDstStride, Int iDstStepX, Int iDstStepY );
 
+#if NTT_SUBPEL
+  static Void xDistributeArrayOnDepthCondition(Pel* pcSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* pcDst, Int iDstStride, Int iDstStepX, Int iDstStepY, Pel* pcDep, Int iDepStride, Int iDepStepX, Int iDepStepY, Int** ppiFposLUT);
+  static Void xInterpHorChromaOnDepthCondition(Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, Pel* piDep, Int iDepStride, Int iDepStepX, Int iDepStepY, Int** ppiFposLUT, Int iTargetFpos, FpChromaIntFilt fpFilter );
+#endif
+
   // Binominal Filtering
   static Pel  xFiltBinom3     (Pel* pcInputData, Int iStride );
Index: branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenInterpFilter.h
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenInterpFilter.h	(revision 165)
+++ branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenInterpFilter.h	(revision 166)
@@ -72,5 +72,11 @@
   __inline Void xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst);
   __inline Void xCTI_FilterQuarter1Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst);
-  
+
+#if NTT_SUBPEL
+  __inline Void xCTI_FilterHalfHor    (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst, Pel* piDep, Int iDepStride, Int iDepStep, Int** ppiFposLUT);
+  __inline Void xCTI_FilterQuarter0Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst, Pel* piDep, Int iDepStride, Int iDepStep, Int** ppiFposLUT);
+  __inline Void xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst, Pel* piDep, Int iDepStride, Int iDepStep, Int** ppiFposLUT);
+#endif
+
   __inline Void xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst, Int iDstStridePel, Pel*& rpiDstPel );
   __inline Void xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst );
@@ -683,4 +689,174 @@
 }
 
+#if NTT_SUBPEL
+__inline Void TRenInterpFilter::xCTI_FilterHalfHor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst, Pel* piDep, Int iDepStride, Int iDepStep, Int** ppiFposLUT)
+{
+  Pel*  piDst    = rpiDst;
+  Int   iSum;
+  Pel*  piSrcTmp;
+  Int iSrcStep2 = iSrcStep*2;
+  Int iSrcStep3 = iSrcStep*3;
+  Int iSrcStep4 = iSrcStep*4;
+  Int iSrcStep5 = iSrcStep*5;
+  Int iSrcStep6 = iSrcStep*6;
+  Int iSrcStep7 = iSrcStep*7;
+
+  Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;
+
+  Pel *piSrcTmpP, *piSrcTmpN;
+  Int iDepX;
+
+  for ( Int y = iHeight; y != 0; y-- )
+  {
+    piSrcTmpP = &piSrc[ -3*iSrcStep ];
+    piSrcTmpN = &piSrc[ -4*iSrcStep ];
+    iDepX = 0;
+    for ( Int x = 0; x < iWidth; x++ )
+    {
+      // { -1,4,-11,40,40,-11,4,-1   } 
+#if 0 // NTT bugfix
+      if( abs(ppiFposLUT[0][ piDep[ iDepX ] ]) == 2 )
+#else
+      if( ppiFposLUT[0][ piDep[ iDepX ] ] == 2 ||  ppiFposLUT[0][ piDep[ iDepX ] ] == -2 )
+#endif
+      {
+        piSrcTmp = ppiFposLUT[0][ piDep[ iDepX ] ] > 0 ? piSrcTmpP : piSrcTmpN;
+
+        iTmp0 = piSrcTmp[        0]+piSrcTmp[iSrcStep7];
+        iTmp1 = piSrcTmp[iSrcStep]+piSrcTmp[iSrcStep6];
+        iTmp2 = piSrcTmp[iSrcStep2]+piSrcTmp[iSrcStep5];
+        iTmp3 = piSrcTmp[iSrcStep3]+piSrcTmp[iSrcStep4];
+
+        iTmpA = (iTmp3 << 2) - iTmp2;
+
+        iSum  = (   iTmp1          << 2 )
+              + (   iTmpA          << 3 )
+              + (   iTmpA          << 1 )
+              -    iTmp0 -  iTmp2;
+
+        piDst   [x * iDstStep] = Clip( (iSum +  32) >>  6 );
+      }
+      piSrcTmpP += iSrcStep;
+      piSrcTmpN += iSrcStep;
+      iDepX += iDepStep;
+    }
+    piSrc += iSrcStride;
+    piDst += iDstStride;
+    piDep += iDepStride;
+  }
+  return;
+}
+
+__inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst, Pel* piDep, Int iDepStride, Int iDepStep, Int** ppiFposLUT)
+{
+  Pel*  piDst    = rpiDst;
+  Int   iSum;
+  Pel*  piSrcTmp;
+  Int iSrcStep2 = iSrcStep*2;
+  Int iSrcStep3 = iSrcStep*3;
+  Int iSrcStep4 = iSrcStep*4;
+  Int iSrcStep5 = iSrcStep*5;
+  Int iSrcStep6 = iSrcStep*6;
+  Int iSrcStep7 = iSrcStep*7;
+
+  Int iTmp1, iTmp2;
+
+  Pel *piSrcTmpP, *piSrcTmpN;
+  Int iDepX;
+
+  for ( Int y = iHeight; y != 0; y-- )
+  {
+    piSrcTmpP = &piSrc[ -3*iSrcStep ];
+    piSrcTmpN = &piSrc[ -4*iSrcStep ];
+    iDepX = 0;
+    for ( Int x = 0; x < iWidth; x++ )
+    {
+      // {-1,   4,  -10,  57,   19,  -7,   3,   -1  },
+#if 0 // NTT bugfix
+      if( abs(ppiFposLUT[0][ piDep[ iDepX ] ]) == 1 )
+#else
+      if( ppiFposLUT[0][ piDep[ iDepX ] ] == 1 ||  ppiFposLUT[0][ piDep[ iDepX ] ] == -3 )
+#endif
+      {
+        piSrcTmp = ppiFposLUT[0][ piDep[ iDepX ] ] > 0 ? piSrcTmpP : piSrcTmpN;
+
+        iTmp1 = piSrcTmp[iSrcStep3] + piSrcTmp[iSrcStep5];
+        iTmp2 = piSrcTmp[iSrcStep6] + piSrcTmp[iSrcStep4];
+
+        iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]
+               - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 )
+               + (  piSrcTmp[iSrcStep]             << 2 )
+               - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 )
+               + (   piSrcTmp[iSrcStep4]           << 4 );
+
+        piDst   [x * iDstStep] = Clip(( (iSum +  32) >>  6 )+ piSrcTmp[iSrcStep3]);
+      }
+      piSrcTmpP += iSrcStep;
+      piSrcTmpN += iSrcStep;
+      iDepX += iDepStep;
+    }
+    piSrc += iSrcStride;
+    piDst += iDstStride;
+    piDep += iDepStride;
+  }
+  return;
+}
+
+__inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst, Pel* piDep, Int iDepStride, Int iDepStep, Int** ppiFposLUT)
+{
+  Pel*  piDst    = rpiDst;
+  Int   iSum;
+  Pel*  piSrcTmp;
+  Int iSrcStep2 = iSrcStep*2;
+  Int iSrcStep3 = iSrcStep*3;
+  Int iSrcStep4 = iSrcStep*4;
+  Int iSrcStep5 = iSrcStep*5;
+  Int iSrcStep6 = iSrcStep*6;
+  Int iSrcStep7 = iSrcStep*7;
+
+  Int  iTmp1, iTmp2;
+
+  Pel *piSrcTmpP, *piSrcTmpN;
+  Int iDepX;
+
+  for ( Int y = iHeight; y != 0; y-- )
+  {
+    piSrcTmpP = &piSrc[ -3*iSrcStep ];
+    piSrcTmpN = &piSrc[ -4*iSrcStep ];
+    iDepX = 0;
+    for ( Int x = 0; x < iWidth; x++ )
+    {
+      // {-1,   3,  -7,  19,   57,  -10,   4,   -1  },
+#if 0 // NTT bugfix
+      if( abs(ppiFposLUT[0][ piDep[ iDepX ] ]) == 3 )
+#else
+      if( ppiFposLUT[0][ piDep[ iDepX ] ] == 3 ||  ppiFposLUT[0][ piDep[ iDepX ] ] == -1 )
+#endif
+      {
+        piSrcTmp = ppiFposLUT[0][ piDep[ iDepX ] ] > 0 ? piSrcTmpP : piSrcTmpN;
+
+        iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2];
+        iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3];
+
+        iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]
+              - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 )
+              + (   piSrcTmp[iSrcStep6]           << 2 )
+              - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 )
+              + (   piSrcTmp[iSrcStep3]           << 4 );
+      
+        piDst   [x * iDstStep] = Clip( ((iSum +  32) >>  6) + piSrcTmp[iSrcStep4] );
+      }
+      piSrcTmpP += iSrcStep;
+      piSrcTmpN += iSrcStep;
+      iDepX += iDepStep;
+    }
+    piSrc += iSrcStride;
+    piDst += iDstStride;
+    piDep += iDepStride;
+  }
+  return;
+}
+#endif
+
 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
 {
Index: branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenModel.cpp
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenModel.cpp	(revision 165)
+++ branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenModel.cpp	(revision 166)
@@ -700,2 +700,3 @@
   }
 }
+
Index: branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenSingleModel.cpp
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenSingleModel.cpp	(revision 165)
+++ branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenSingleModel.cpp	(revision 166)
@@ -1943,2 +1943,3 @@
 }
 #endif
+
Index: branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenTop.cpp
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenTop.cpp	(revision 165)
+++ branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenTop.cpp	(revision 166)
@@ -127,4 +127,78 @@
 }
 
+#if NTT_SUBPEL
+Void TRenTop::xConvertInputVideoSubpel( PelImage* pcOrgInputImage, PelImage* pcConvInputImage, PelImage* pcInputDepth, Bool bMirror )
+{
+  PelImagePlane*  pcOrgPlane;
+  PelImagePlane*  pcConvPlane;
+  PelImagePlane*  pcDepthPlane;
+  PelImagePlane*  pcTmpPlane;
+
+  Int    ** ppiFposLUT = bMirror ? m_ppiFposLUTRightMirror : m_ppiFposLUTLeft;
+
+  AOT( m_iLog2SamplingFactor );
+  AOF( m_iInterpolationMode == eRenInt8Tap2 );
+
+  pcDepthPlane = pcInputDepth->getPlane( 0 );
+  pcTmpPlane = pcConvInputImage->getPlane( 0 );
+
+  AOF( m_bUVUp ); // Currently only m_bUVUp=true is supported
+  for (UInt uiPlane = 1; uiPlane < 3; uiPlane++)
+  {
+    pcOrgPlane  = pcOrgInputImage ->getPlane(uiPlane);
+    pcConvPlane = pcConvInputImage->getPlane(uiPlane);
+
+    if ( m_bUVUp )
+    {
+      TRenFilter::sampleCVerUp    (pcOrgPlane->getPlaneData(), pcOrgPlane->getStride(), pcOrgPlane->getWidth(), pcOrgPlane->getHeight()  , pcTmpPlane ->getPlaneData(), pcTmpPlane ->getStride() );
+      TRenFilter::sampleCConvHorUp(pcTmpPlane->getPlaneData(), pcTmpPlane->getStride(), pcOrgPlane->getWidth(), pcOrgPlane->getHeight()*2, pcConvPlane->getPlaneData(), pcConvPlane->getStride(), pcDepthPlane->getPlaneData(), pcDepthPlane->getStride(), ppiFposLUT );
+    }
+    else
+    {
+      TRenFilter::sampleCConv     (pcOrgPlane->getPlaneData(), pcOrgPlane->getStride(), pcOrgPlane->getWidth(), pcOrgPlane->getHeight()*2, pcConvPlane->getPlaneData(), pcConvPlane->getStride(), pcDepthPlane->getPlaneData(), pcDepthPlane->getStride(), ppiFposLUT );
+    }
+  }
+
+  pcOrgPlane  = pcOrgInputImage ->getPlane(0);
+  pcConvPlane = pcConvInputImage->getPlane(0);
+  TRenFilter::sampleConv(pcOrgPlane->getPlaneData(), pcOrgPlane->getStride(), pcOrgPlane->getWidth(), pcOrgPlane->getHeight(), pcConvPlane->getPlaneData(), pcConvPlane->getStride(), pcDepthPlane->getPlaneData(), pcDepthPlane->getStride(), ppiFposLUT);
+}
+
+Void TRenTop::xConvertInputDepthSubpel( PelImage* pcOrgInputImage, PelImage* pcConvInputImage)
+{
+  PelImagePlane*  pcOrgPlane ;
+  PelImagePlane*  pcConvPlane;
+
+  // Full Plane
+  pcOrgPlane  = pcOrgInputImage ->getPlane(0);
+  pcConvPlane = pcConvInputImage->getPlane(0);
+
+  AOT( m_iLog2SamplingFactor );
+  AOF( m_iInterpolationMode == eRenInt8Tap2 );
+
+  TRenFilter::sampleHorUp(m_iLog2SamplingFactor, pcOrgPlane->getPlaneData(), pcOrgPlane->getStride(), pcOrgPlane->getWidth(), pcOrgPlane->getHeight(), pcConvPlane->getPlaneData(), pcConvPlane->getStride());
+
+  AOF( m_bUVUp );
+  if ( !m_bUVUp ) //GT: depth down
+  {
+    // Quarter Plane
+    PelImagePlane* pcTempPlane = new PelImagePlane(pcOrgInputImage->getPlane(0)->getWidth(), ( pcOrgInputImage->getPlane(0)->getHeight() >> 1), REN_LUMA_MARGIN );
+
+    TRenFilter::sampleVerDown2Tap13(pcOrgInputImage->getPlane(0), pcTempPlane, PICYUV_PAD);
+    pcConvPlane = pcConvInputImage->getPlane(1);
+
+    if ( m_iLog2SamplingFactor == 0 )
+    {
+      TRenFilter::sampleHorDown2Tap13(pcTempPlane, pcConvPlane, 0 );
+    }
+    else
+    {
+      TRenFilter::sampleHorUp    ( m_iLog2SamplingFactor - 1, pcTempPlane->getPlaneData(), pcTempPlane->getStride(), pcTempPlane->getWidth(), pcTempPlane->getHeight(), pcConvPlane->getPlaneData(), pcConvPlane->getStride());
+    }
+    delete pcTempPlane;
+  }
+}
+#endif
+
 Void TRenTop::xConvertInputDepth( PelImage* pcOrgInputImage, PelImage* pcConvInputImage)
 {
@@ -193,4 +267,32 @@
 }
 
+#if NTT_SUBPEL
+Void TRenTop::xConvertInputDataSubpel( PelImage* pcOrgInputImage, PelImage* pcOrgInputDepth, PelImage* pcConvInputImage, PelImage* pcConvInputDepth, Bool bMirror )
+{
+  //ToDo: remove unnecessary copying
+  if ( bMirror )
+  {
+    m_pcTempImage->getPlane(0)->assign( pcOrgInputDepth->getPlane(0) );
+    TRenFilter::mirrorHor( m_pcTempImage->getPlane(0) );
+    m_pcTempImage->getPlane(0)->extendMargin();
+    xConvertInputDepthSubpel( m_pcTempImage, pcConvInputDepth );
+
+    m_pcTempImage->assign( pcOrgInputImage );
+    TRenFilter::mirrorHor( m_pcTempImage );
+    m_pcTempImage->extendMargin();
+    xConvertInputVideoSubpel( m_pcTempImage, pcConvInputImage, pcConvInputDepth, bMirror );
+  }
+  else
+  {
+    m_pcTempImage->getPlane(0)->assign( pcOrgInputDepth->getPlane(0) );
+    m_pcTempImage->getPlane(0)->extendMargin();
+    xConvertInputDepthSubpel( m_pcTempImage, pcConvInputDepth );
+
+    m_pcTempImage->assign( pcOrgInputImage );
+    m_pcTempImage->extendMargin();
+    xConvertInputVideoSubpel( m_pcTempImage, pcConvInputImage, pcConvInputDepth, bMirror );
+  }
+}
+#endif
 
 Void TRenTop::xConvertOutputData( PelImage* pcOrgOutputImage, PelImage* pcConvOutputImage, Bool bMirror )
@@ -229,4 +331,24 @@
 }
 
+#if VSP_N
+Void TRenTop::xConvertOutputDataPlane0( PelImage* pcOrgOutputImage, PelImage* pcConvOutputImage, Bool bMirror )
+{
+  Int iLog2SamplingFactor = m_iLog2SamplingFactor;
+
+  PelImagePlane* pcOrgPlane  = pcOrgOutputImage ->getPlane(0);
+  PelImagePlane* pcConvPlane = pcConvOutputImage->getPlane(0);
+
+  pcOrgPlane->extendMargin();
+
+  TRenFilter::sampleHorDown( iLog2SamplingFactor, pcOrgPlane->getPlaneData(), pcOrgPlane->getStride(), pcOrgPlane->getWidth(), pcOrgPlane->getHeight(), pcConvPlane->getPlaneData(), pcConvPlane->getStride());
+
+  if ( bMirror )
+  {
+    TRenFilter::mirrorHor( pcConvOutputImage );
+  }
+
+}
+#endif
+
 Void TRenTop::setShiftLUTs( Double** ppdShiftLUTLeft, Int** ppiShiftLUTLeft, Int** ppiBaseShiftLUTLeft, Double** ppdShiftLUTRight, Int** ppiShiftLUTRight, Int** ppiBaseShiftLUTRight,  Int iRelDistToLeft )
 {
@@ -254,4 +376,23 @@
   }
 }
+
+#if NTT_SUBPEL
+Void TRenTop::setFposLUTs( Int** ppiFposLUTLeft, Int** ppiFposLUTRight )
+{
+  m_ppiFposLUTLeft  = ppiFposLUTLeft;
+  m_ppiFposLUTRight = ppiFposLUTRight;
+
+  if (  m_ppiFposLUTRight != NULL )
+  {
+    for( UInt uiPlane = 0; uiPlane < 2; uiPlane++)
+    {
+      for (UInt uiDepthValue = 0; uiDepthValue <= 256; uiDepthValue++)
+      {
+        m_ppiFposLUTRightMirror[uiPlane][uiDepthValue] = - m_ppiFposLUTRight[uiPlane][uiDepthValue];
+      }
+    }
+  }
+}
+#endif
 
 Void TRenTop::extrapolateView( TComPicYuv* pcPicYuvVideo, TComPicYuv* pcPicYuvDepth, TComPicYuv* pcPicYuvSynthOut, Bool bRenderFromLeft )
@@ -278,4 +419,40 @@
   xCutMargin        ( &cOutputImage );
 };
+
+#if VSP_N
+Void TRenTop::extrapolateAvailabilityView( TComPicYuv* pcPicYuvVideo, TComPicYuv* pcPicYuvDepth, TComPicYuv* pcPicYuvSynthOut, TComPicYuv* pcPicYuvAvailOut, Bool bRenderFromLeft )
+{
+  AOF( m_bExtrapolate );
+  AOF( bRenderFromLeft ? m_ppiShiftLUTLeft || m_ppdShiftLUTLeft : m_ppiShiftLUTRight || m_ppdShiftLUTRight );
+  AOF( m_auiInputResolution[0] == pcPicYuvVideo->getWidth ());
+  AOF( m_auiInputResolution[1] == pcPicYuvVideo->getHeight());
+
+  PelImage cInputImage ( pcPicYuvVideo    );
+  PelImage cInputDepth ( pcPicYuvDepth    , true);
+  PelImage cOutputImage( pcPicYuvSynthOut );
+  PelImage cFillImage  ( pcPicYuvAvailOut );
+
+  m_pcOutputImage->init();
+  m_pcFilled     ->assign(REN_IS_HOLE);
+
+  xPreProcessDepth ( &cInputDepth,  &cInputDepth);
+#if NTT_SUBPEL
+  if( m_iInterpolationMode == eRenInt8Tap2 )
+    xConvertInputDataSubpel(&cInputImage, &cInputDepth, m_pcInputImage, m_pcInputDepth, !bRenderFromLeft );
+  else
+    xConvertInputData( &cInputImage, &cInputDepth, m_pcInputImage, m_pcInputDepth, !bRenderFromLeft );
+#else
+  xConvertInputData( &cInputImage, &cInputDepth, m_pcInputImage, m_pcInputDepth, !bRenderFromLeft );
+#endif
+  xShiftPixels(m_pcInputImage, m_pcInputDepth, m_pcOutputImage, m_pcFilled, bRenderFromLeft);
+  xRemBoundaryNoise ( m_pcOutputImage, m_pcFilled, m_pcOutputImage, bRenderFromLeft); // Erode
+  xFillHoles        ( m_pcOutputImage, m_pcFilled, m_pcOutputImage, bRenderFromLeft);
+  xConvertOutputData( m_pcOutputImage, &cOutputImage, !bRenderFromLeft );
+  //if (!bRenderFromLeft)  TRenFilter::mirrorHor( &cFillImage );
+  xConvertOutputDataPlane0( m_pcFilled, &cFillImage, !bRenderFromLeft );
+  xPostProcessImage (&cOutputImage, &cOutputImage);
+  xCutMargin        ( &cOutputImage );
+};
+#endif
 
 Void TRenTop::getUsedSamplesMap( TComPicYuv* pcPicYuvDepth, TComPicYuv* pcUsedSampleMap, Bool bRenderFromLeft )
@@ -751,4 +928,7 @@
   {
   case eRenIntFullPel:
+#if NTT_SUBPEL
+  case eRenInt8Tap2:
+#endif
     xShiftPlanePixelsFullPel( apcInPlane, pcDepthPlane, apcOutPlane, pcPlaneFilled, uiNumberOfPlanes);
     break;
@@ -826,8 +1006,37 @@
           }
           pcFilledData[iShiftedPos] = REN_IS_FILLED;
+
+#if NTT_SUBPEL
+          if(m_bInstantHoleFilling && (iDiff > 0) )
+          {
+            Int iRefPos = (iPrevShiftedPos == -1) ? iShiftedPos : iPrevShiftedPos;
+            
+            for (Int iCurPos = iPrevShiftedPos+1; iCurPos < iShiftedPos; iCurPos++)
+            {
+              for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
+              {
+                apcOutputData[uiCurPlane][iCurPos] =  apcOutputData[uiCurPlane][iRefPos];
+              }
+              pcFilledData[iCurPos] = REN_IS_FILLED;
+            }
+          }
+#endif
         }
         iPrevShiftedPos = iShiftedPos;
       }
     }
+#if NTT_SUBPEL
+    if( (iPrevShiftedPos+1) != iWidth )
+    {
+      for (Int iCurPos = iPrevShiftedPos+1; iCurPos < iWidth; iCurPos++)
+      {
+        for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
+        {
+          apcOutputData[uiCurPlane][iCurPos] =  apcOutputData[uiCurPlane][iPrevShiftedPos];
+        }
+        pcFilledData[iCurPos] = REN_IS_FILLED;
+      }
+    }
+#endif
     for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
     {
@@ -1450,10 +1659,10 @@
 
     for( Int iXPos = iSourcePos + 1; iXPos <  iWidth; iXPos++)
-        {
+    {
       for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
-          {
+      {
         apcOutputData[uiCurPlane][iXPos] = apcInputData[uiCurPlane][iSourcePos];
       }
-            }
+    }
 
     // Fill Left Gap
@@ -1469,6 +1678,6 @@
       {
         apcOutputData[uiCurPlane][iXPos] = apcInputData[uiCurPlane][iSourcePos];
-          }
-        }
+      }
+    }
 
     // Go to next line
@@ -2032,4 +2241,12 @@
   m_ppiShiftLUTRightMirror[0] = new Int[257];
   m_ppiShiftLUTRightMirror[1] = new Int[257];
+
+#if NTT_SUBPEL
+  m_ppiFposLUTLeft   = 0;
+  m_ppiFposLUTRight  = 0;
+  m_ppiFposLUTRightMirror    = new Int*[2];
+  m_ppiFposLUTRightMirror[0] = new Int[257];
+  m_ppiFposLUTRightMirror[1] = new Int[257];
+#endif
 
   m_aiShiftLUTCur    = 0;
@@ -2116,5 +2333,9 @@
   m_iHoleFillingMode = iHoleFillingMode;
 
+#if NTT_SUBPEL
+  m_bInstantHoleFilling   = (m_iInterpolationMode == eRenInt8Tap || m_iInterpolationMode == eRenInt8Tap2 ) && (m_iHoleFillingMode != 0 );
+#else
   m_bInstantHoleFilling   = (m_iInterpolationMode == eRenInt8Tap ) && (m_iHoleFillingMode != 0 );
+#endif
 
   // PostProcessing
@@ -2154,5 +2375,5 @@
     {
       m_aaiSubPelShift[uiEntry] = new Int[ iNumEntries ];
-        }
+    }
 
     TRenFilter::setSubPelShiftLUT(m_iRelShiftLUTPrec, m_aaiSubPelShift, -1);
@@ -2184,4 +2405,13 @@
   };
 
+#if NTT_SUBPEL
+  if ( m_ppiFposLUTRightMirror != NULL )
+  {
+    delete[] m_ppiFposLUTRightMirror[0];
+    delete[] m_ppiFposLUTRightMirror[1];
+    delete[] m_ppiFposLUTRightMirror;
+  };
+#endif
+
   if (m_piInvZLUTLeft      != NULL ) delete[] m_piInvZLUTLeft   ;
   if (m_piInvZLUTLeft      != NULL ) delete[] m_piInvZLUTRight  ;
Index: branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenTop.h
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenTop.h	(revision 165)
+++ branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenTop.h	(revision 166)
@@ -50,5 +50,9 @@
   // Interpolation Modes
 
+#if NTT_SUBPEL
+  enum { eRenIntFullPel = 0, eRenIntLinInt = 1, eRenIntLinReal = 2, eRenIntFEM = 3, eRenInt8Tap = 4, eRenInt8Tap2 = 5 };
+#else
   enum { eRenIntFullPel = 0, eRenIntLinInt = 1, eRenIntLinReal = 2, eRenIntFEM = 3, eRenInt8Tap = 4 };
+#endif
 
   // HoleFilling
@@ -93,4 +97,8 @@
                            Int**    ppiBaseShiftLUTRight,
                            Int      iRelDistLeft );
+#if NTT_SUBPEL
+  Void setFposLUTs      ( Int**    ppiFposLUTLeft, Int**    ppiFposLUTRight );
+  Void setInterpolationMode ( Int iMode ) { m_iInterpolationMode = iMode; }
+#endif
 
   // View Synthesis
@@ -99,4 +107,12 @@
                            TComPicYuv* pcPicYuvSynthOut,
                            Bool bRenderFromLeft );
+
+#if VSP_N
+  Void extrapolateAvailabilityView   ( TComPicYuv* pcPicYuvVideo,
+                                       TComPicYuv* pcPicYuvDepth,
+                                       TComPicYuv* pcPicYuvSynthOut,
+                                       TComPicYuv* pcPicYuvAvailOut,
+                                       Bool bRenderFromLeft );
+#endif
 
   Void interpolateView   ( TComPicYuv* pcPicYuvVideoLeft,
@@ -166,4 +182,12 @@
   Void xConvertInputData         ( PelImage* pcOrgInputImage, PelImage* pcOrgInputDepth, PelImage* pcConvInputImage, PelImage* pcConvInputDepth, Bool bMirror);
   Void xConvertOutputData        ( PelImage* pOrgOutputImage, PelImage* pConvOutputImage, Bool bMirror);
+#if VSP_N
+  Void xConvertOutputDataPlane0  ( PelImage* pOrgOutputImage, PelImage* pConvOutputImage, Bool bMirror);
+#endif
+#if NTT_SUBPEL
+  Void xConvertInputDataSubpel   ( PelImage* pcOrgInputImage, PelImage* pcOrgInputDepth, PelImage* pcConvInputImage, PelImage* pcConvInputDepth, Bool bMirror);
+  Void xConvertInputVideoSubpel  ( PelImage* pcOrgInputImage, PelImage* pcConvInputImage, PelImage* pcInputDepth, Bool bMirror );
+  Void xConvertInputDepthSubpel  ( PelImage* pcOrgInputImage, PelImage* pcConvInputImage);
+#endif
 
   Void xGetDataPointers          ( PelImage*& rpcInputImage,  PelImage*& rpcOutputImage, PelImage*& rpcInputDepth, PelImage*& rpcOutputDepth, PelImage*& rpcFilled, Bool bRenderDepth );
@@ -229,4 +253,9 @@
   Int**    m_ppiShiftLUTRightMirror; // For rendering the mirrored view
   Int*     m_aiShiftLUTCur;
+#if NTT_SUBPEL
+  Int**    m_ppiFposLUTLeft;
+  Int**    m_ppiFposLUTRight;
+  Int**    m_ppiFposLUTRightMirror; // For rendering the mirrored view
+#endif
 
   // Look up tables Z
