Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.cpp	(revision 165)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.cpp	(revision 166)
@@ -262,4 +262,15 @@
     }
   }
+#if DEBUGIMGOUT
+  for(Int viewDepthIdx=0; viewDepthIdx<m_tVideoIOYuvReconDbgFile.size() ; viewDepthIdx++)
+  {
+    if( m_tVideoIOYuvReconDbgFile[viewDepthIdx] )
+    {
+      m_tVideoIOYuvReconDbgFile[viewDepthIdx]->close();
+      delete m_tVideoIOYuvReconDbgFile[viewDepthIdx]; 
+      m_tVideoIOYuvReconDbgFile[viewDepthIdx] = NULL ;
+    }
+  }
+#endif
 
   for(Int viewDepthIdx=0; viewDepthIdx<m_tDecTop.size() ; viewDepthIdx++)
@@ -330,4 +341,11 @@
 #endif
       }
+#if DEBUGIMGOUT
+#if PIC_CROPPING
+      m_tVideoIOYuvReconDbgFile[viewDepthId]->write( pcPic->getPicYuvRecDbg(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() );
+#else
+      m_tVideoIOYuvReconDbgFile[viewDepthId]->write( pcPic->getPicYuvRecDbg(), pcPic->getSlice(0)->getSPS()->getPad() );
+#endif
+#endif   
       
       // update POC of display order
@@ -388,4 +406,11 @@
 #endif
       }
+#if DEBUGIMGOUT
+#if PIC_CROPPING
+      m_tVideoIOYuvReconDbgFile[viewDepthId]->write( pcPic->getPicYuvRecDbg(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() );
+#else
+      m_tVideoIOYuvReconDbgFile[viewDepthId]->write( pcPic->getPicYuvRecDbg(), pcPic->getSlice(0)->getSPS()->getPad() );
+#endif
+#endif
       
       // update POC of display order
@@ -476,5 +501,29 @@
   }
 #endif
-
+#if DEBUGIMGOUT
+  while( m_tVideoIOYuvReconDbgFile.size() < newNumberOfViewDepth)
+  {
+    m_tVideoIOYuvReconDbgFile.push_back(new TVideoIOYuv);
+    Char buffer[4];
+    sprintf(buffer,"_%i", (Int)(m_tVideoIOYuvReconDbgFile.size()-1) / 2 );
+    Char* nextFilename = NULL;
+    if( (m_tVideoIOYuvReconDbgFile.size() % 2) == 0 )
+    {
+      Char* pchTempFilename = NULL;
+      xAppendToFileNameEnd( "DebugImg.yuv", "_depth", pchTempFilename);
+      xAppendToFileNameEnd( pchTempFilename, buffer, nextFilename);
+      free ( pchTempFilename );
+    }
+    else
+    {
+      xAppendToFileNameEnd( "DebugImg.yuv", buffer, nextFilename);
+    }
+    if( isDepth || ( !isDepth && (m_tVideoIOYuvReconDbgFile.size() % 2) == 1 ) )
+    {
+      m_tVideoIOYuvReconDbgFile.back()->open( nextFilename, true, m_outputBitDepth, g_uiBitDepth + g_uiBitIncrement );
+    }
+    free ( nextFilename );
+  }
+#endif
   while( m_pocLastDisplay.size() < newNumberOfViewDepth )
   {
@@ -533,3 +582,97 @@
   return pcPic;
 }
+
+#if VSP_N
+Void TAppDecTop::storeVSPInBuffer(TComPic* pcPicVSP, TComPic* pcPicAvail, Int iCodedViewIdx, Int iCoddedViewOrderIdx, Int iCurPoc, Bool bDepth)
+{
+  //first view does not have VSP 
+#if VSP_TEXT_ONLY
+  if((iCodedViewIdx == 0)||(bDepth))
+#else
+  if((iCodedViewIdx == 0))
+#endif
+    return;
+  pcPicVSP->getSlice(0)->setPOC( iCurPoc );
+  Int iNeighborViewId = 0;
+  Bool bRenderFromLeft;
+  //check if the neighboring view is situated to the left of the current view
+  bRenderFromLeft = ((iCoddedViewOrderIdx)>0);
+  //pointers to buffers   
+  TComPicYuv* pcPicYuvVideo = getPicFromView(iNeighborViewId, iCurPoc, bDepth)->getPicYuvRec();
+  TComPicYuv* pcPicYuvDepth = getPicFromView(iNeighborViewId, iCurPoc, true)->getPicYuvRec();
+  TComPicYuv* pcPicYuvVSP   = pcPicVSP->getPicYuvRec();
+  TComPicYuv* pcPicYuvAvail = pcPicAvail->getPicYuvRec();
+  //verifying buffers
+  AOF(pcPicYuvVideo);
+  AOF(pcPicYuvDepth);
+  AOF(pcPicYuvVSP);
+  AOF(pcPicYuvAvail);
+
+  TComPic* pcPic = getPicFromView( iCodedViewIdx, iCurPoc, bDepth );
+  pcPic->setPicYuvSynth( pcPicYuvVSP );
+  pcPic->setPicYuvAvail( pcPicYuvAvail );
+
+  //setting look-up table
+#if 0
+  m_cVSPRendererTop.setShiftLUTs(
+      m_cCamParsCollector.getBaseViewShiftLUTD()[iNeighborViewId][iCodedViewIdx],
+      m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx],
+      m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx],
+      m_cCamParsCollector.getBaseViewShiftLUTD()[iNeighborViewId][iCodedViewIdx],
+      m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx],
+      m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx],
+      -1
+      );
+#else
+#if NTT_SUBPEL
+  m_cVSPRendererTop.setShiftLUTs(
+      m_cCamParsCollector.getBaseViewShiftLUTD()[iNeighborViewId][iCodedViewIdx],
+      m_cCamParsCollector.getBaseViewIPelLUT  ()[iNeighborViewId][iCodedViewIdx],
+      NULL,
+      m_cCamParsCollector.getBaseViewShiftLUTD()[iNeighborViewId][iCodedViewIdx],
+      m_cCamParsCollector.getBaseViewIPelLUT  ()[iNeighborViewId][iCodedViewIdx],
+      NULL,
+      -1
+      );
+  m_cVSPRendererTop.setFposLUTs( 
+      m_cCamParsCollector.getBaseViewFPosLUT()[iNeighborViewId][iCodedViewIdx],
+      m_cCamParsCollector.getBaseViewFPosLUT()[iNeighborViewId][iCodedViewIdx]
+      );
+#else
+  m_cVSPRendererTop.setShiftLUTs(
+      m_cCamParsCollector.getBaseViewShiftLUTD()[iNeighborViewId][iCodedViewIdx],
+      m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx],
+      NULL,
+      m_cCamParsCollector.getBaseViewShiftLUTD()[iNeighborViewId][iCodedViewIdx],
+      m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx],
+      NULL,
+      -1
+      );
+#endif
+#endif
+
+#if NTT_SUBPEL
+  m_cVSPRendererTop.setInterpolationMode( (bDepth ? 0 : 5) );
+#endif
+
+  //extrapolate from view iNeighborViewId to the current view, storing in the VSP buffer
+  //m_cVSPRendererTop.extrapolateView(pcPicYuvVideo,pcPicYuvDepth, pcPicYuvVSP, bRenderFromLeft);
+  m_cVSPRendererTop.extrapolateAvailabilityView(pcPicYuvVideo,pcPicYuvDepth, pcPicYuvVSP, pcPicYuvAvail, bRenderFromLeft);
+
+  // mark it should be extended
+  pcPicVSP->getPicYuvRec()->setBorderExtension(false); 
+  pcPicVSP->getPicYuvRec()->extendPicBorder(); //will extend the border for prediction using pixels outside the frame
+  pcPicAvail->getPicYuvRec()->setBorderExtension(false); 
+  pcPicAvail->getPicYuvRec()->extendPicBorder();
+#if VSP_N_DUMP
+  {
+    Char acFilenameBase[1024];
+    ::sprintf(acFilenameBase,"VSP_dec_%sv%d_%dx%d_%04d.yuv",(bDepth?"D":"T"),iCodedViewIdx,pcPicYuvVSP->getWidth(), pcPicYuvVSP->getHeight(), iCurPoc);
+    pcPicYuvVSP->dump(acFilenameBase,0);
+    //pcPicYuvAvail->dump(acFilenameBase,iCurPoc!=0);
+  }
+#endif
+}
+#endif
+
 //! \}
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.h
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.h	(revision 165)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.h	(revision 166)
@@ -49,4 +49,7 @@
 #include "TLibDecoder/TDecTop.h"
 #include "TAppDecCfg.h"
+#if VSP_N
+#include "../../Lib/TLibRenderer/TRenTop.h"
+#endif
 
 //! \ingroup TAppDecoder
@@ -65,4 +68,7 @@
 
   std::vector<TVideoIOYuv*>       m_tVideoIOYuvReconFile;         ///< reconstruction YUV class
+#if DEBUGIMGOUT
+  std::vector<TVideoIOYuv*>       m_tVideoIOYuvReconDbgFile;      ///< debug YUV class
+#endif
 
   // for output control
@@ -79,4 +85,8 @@
   TComSPSAccess                   m_cSPSAccess;
   TComAUPicAccess                 m_cAUPicAccess;
+#endif
+
+#if VSP_N
+  TRenTop                         m_cVSPRendererTop;
 #endif
 
@@ -107,4 +117,10 @@
 #endif
 
+#if VSP_N
+  Bool              getUseDepth   () { return m_useDepth; }
+  TRenTop*          getVSPRendererTop(){ return &m_cVSPRendererTop; }
+  Void              storeVSPInBuffer(TComPic* pcPicVSP, TComPic* pcPicAvail, Int iCodedViewIdx, Int iCoddedViewOrderIdx, Int iCurPoc, Bool bDepth);
+#endif
+
 protected:
 //  Void  xCreateDecLib     (); ///< create internal classes
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 165)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 166)
@@ -194,25 +194,25 @@
   
   /* File, I/O and source parameters */
-  ("InputFile_%d,i_%d",       m_pchInputFileList,       (char *) 0 , MAX_VIEW_NUM , "original Yuv input file name %d")
-  ("DepthInputFile_%d,di_%d", m_pchDepthInputFileList,  (char *) 0 , MAX_VIEW_NUM , "original Yuv depth input file name %d")
-  ("ReconFile_%d,o_%d",       m_pchReconFileList,       (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv output file name %d")
-  ("DepthReconFile_%d,do_%d", m_pchDepthReconFileList,  (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv depth output file name %d")
-  ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream output file name")
-  ("CodeDepthMaps",         m_bUsingDepthMaps, false, "Encode depth maps" )
-  ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )
-  ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( double )1.0, "Lambda modifier for temporal layer 0")
-  ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( double )1.0, "Lambda modifier for temporal layer 1")
-  ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( double )1.0, "Lambda modifier for temporal layer 2")
-  ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( double )1.0, "Lambda modifier for temporal layer 3")
-  ("SourceWidth,-wdt",      m_iSourceWidth,  0, "Source picture width")
-  ("SourceHeight,-hgt",     m_iSourceHeight, 0, "Source picture height")
+  ("InputFile_%d,i_%d",       m_pchInputFileList,       (char *) 0 , MAX_VIEW_NUM ,   "original Yuv input file name %d")
+  ("DepthInputFile_%d,di_%d", m_pchDepthInputFileList,  (char *) 0 , MAX_VIEW_NUM ,   "original Yuv depth input file name %d")
+  ("ReconFile_%d,o_%d",       m_pchReconFileList,       (char *) 0 , MAX_VIEW_NUM ,   "reconstructed Yuv output file name %d")
+  ("DepthReconFile_%d,do_%d", m_pchDepthReconFileList,  (char *) 0 , MAX_VIEW_NUM ,   "reconstructed Yuv depth output file name %d")
+  ("BitstreamFile,b",         cfg_BitstreamFile,        string(""),                   "bitstream output file name")
+  ("CodeDepthMaps",           m_bUsingDepthMaps,        false,                        "Encode depth maps" )
+  ("CodedCamParsPrecision",   m_iCodedCamParPrecision,  STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )
+  ("LambdaModifier0,-LM0",    m_adLambdaModifier[ 0 ],  ( double )1.0,                "Lambda modifier for temporal layer 0")
+  ("LambdaModifier1,-LM1",    m_adLambdaModifier[ 1 ],  ( double )1.0,                "Lambda modifier for temporal layer 1")
+  ("LambdaModifier2,-LM2",    m_adLambdaModifier[ 2 ],  ( double )1.0,                "Lambda modifier for temporal layer 2")
+  ("LambdaModifier3,-LM3",    m_adLambdaModifier[ 3 ],  ( double )1.0,                "Lambda modifier for temporal layer 3")
+  ("SourceWidth,-wdt",        m_iSourceWidth,           0,                            "Source picture width")
+  ("SourceHeight,-hgt",       m_iSourceHeight,          0,                            "Source picture height")
 #if PIC_CROPPING
-  ("CroppingMode",          m_croppingMode,  0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
-  ("CropLeft",              m_cropLeft,      0, "Left cropping/padding for cropping mode 3")
-  ("CropRight",             m_cropRight,     0, "Right cropping/padding for cropping mode 3")
-  ("CropTop",               m_cropTop,       0, "Top cropping/padding for cropping mode 3")
-  ("CropBottom",            m_cropBottom,    0, "Bottom cropping/padding for cropping mode 3")
-  ("HorizontalPadding,-pdx",m_aiPad[0],      0, "horizontal source padding for cropping mode 2")
-  ("VerticalPadding,-pdy",  m_aiPad[1],      0, "vertical source padding for cropping mode 2")
+  ("CroppingMode",            m_croppingMode,           0,                            "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
+  ("CropLeft",                m_cropLeft,               0,                            "Left cropping/padding for cropping mode 3")
+  ("CropRight",               m_cropRight,              0,                            "Right cropping/padding for cropping mode 3")
+  ("CropTop",                 m_cropTop,                0,                            "Top cropping/padding for cropping mode 3")
+  ("CropBottom",              m_cropBottom,             0,                            "Bottom cropping/padding for cropping mode 3")
+  ("HorizontalPadding,-pdx",  m_aiPad[0],               0,                            "horizontal source padding for cropping mode 2")
+  ("VerticalPadding,-pdy",    m_aiPad[1],               0,                            "vertical source padding for cropping mode 2")
 #endif
   ("InputBitDepth",         m_uiInputBitDepth, 8u, "bit-depth of input file")
@@ -498,5 +498,5 @@
   m_pchRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str());
   m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
-  
+
   if ( m_bUsingDepthMaps )
   {
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.cpp	(revision 165)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.cpp	(revision 166)
@@ -697,4 +697,11 @@
 #endif
 
+#if VSP_N
+#if NTT_SUBPEL
+  m_cVSPRendererTop.init(m_iSourceWidth, m_iSourceHeight, true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 5, 1, 0, 6 );
+#else
+  m_cVSPRendererTop.init(m_iSourceWidth, m_iSourceHeight, true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 4, 1, 0, 6 );
+#endif
+#endif
 }
 
@@ -822,5 +829,5 @@
   TComPicYuv*       pcPicYuvRec = NULL;
   TComPicYuv*       pcDepthPicYuvRec = NULL;
-  
+
   // initialize internal class & member variables
   xInitLibCfg();
@@ -918,5 +925,5 @@
       if ( iNextPoc < m_iFrameToBeEncoded )
       {
-      m_cCameraData.update( iNextPoc );
+        m_cCameraData.update( iNextPoc );
       }
       for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
@@ -930,4 +937,20 @@
 #endif
         iNumEncoded = 0;
+
+#if VSP_SLICE_HEADER
+        m_acTEncTopList     [iViewIdx]->setUseVSP( (gopId%VSP_FRAME_INTERVAL==0) );
+        m_acTEncDepthTopList[iViewIdx]->setUseVSP( (gopId%VSP_FRAME_INTERVAL==0) );
+#endif
+
+#if VSP_N
+#if VSP_SLICE_HEADER
+        if( m_acTEncTopList[iViewIdx]->getUseVSP() )
+#endif
+        if( m_bUsingDepthMaps )
+        {
+          // Forward Warping
+          xStoreVSPInBuffer(m_acTEncTopList[iViewIdx]->getVSPBuf(), m_acTEncTopList[iViewIdx]->getVSPAvailBuf(), iViewIdx, false, gopId);
+        }
+#endif
         // call encoding function for one frame
         m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId );
@@ -937,4 +960,10 @@
         {
           Int  iNumDepthEncoded = 0;
+#if VSP_N
+#if VSP_SLICE_HEADER
+          if( m_acTEncDepthTopList[iViewIdx]->getUseVSP() )
+#endif
+            xStoreVSPInBuffer(m_acTEncDepthTopList[iViewIdx]->getVSPBuf(), m_acTEncDepthTopList[iViewIdx]->getVSPAvailBuf(), iViewIdx, true, gopId);
+#endif
           // call encoding function for one depth frame
           m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId );
@@ -1377,3 +1406,122 @@
 };
 
+#if VSP_N
+Void TAppEncTop::xStoreVSPInBuffer(TComPic* pcPicVSP, TComPic* pcPicAvail, Int iCodedViewIdx, Bool bDepth, Int gopId)
+{
+  //first view does not have VSP 
+#if VSP_TEXT_ONLY
+  if((iCodedViewIdx == 0)||(bDepth))
+#else
+  if((iCodedViewIdx == 0))
+#endif
+    return;
+
+  AOT( iCodedViewIdx <= 0);
+  AOT( iCodedViewIdx >= m_iNumberOfViews );
+  
+  Int iCurPoc;
+  //getting currrent POC and checking if the frame will be coded
+  if(bDepth)
+  {
+    iCurPoc = m_acTEncDepthTopList[iCodedViewIdx]->getFrameId(gopId);
+    if(iCurPoc>=m_acTEncDepthTopList[iCodedViewIdx]->getFrameToBeEncoded())
+      return;
+    //if(!(m_acTEncDepthTopList[iCodedViewIdx]->currentPocWillBeCoded())) 
+    //  return;
+  }
+  else
+  {
+    iCurPoc = m_acTEncTopList[iCodedViewIdx]->getFrameId(gopId);
+    if(iCurPoc>=m_acTEncTopList[iCodedViewIdx]->getFrameToBeEncoded())
+      return;
+    //if(!(m_acTEncTopList[iCodedViewIdx]->currentPocWillBeCoded())) 
+    //  return;
+  }
+  pcPicVSP->getSlice(0)->setPOC( iCurPoc );
+
+  Int iNeighborViewId = 0;
+  Bool bRenderFromLeft;
+  //check if the neighboring view is situated to the left of the current view
+  bRenderFromLeft = ((m_cCameraData.getBaseSortedId2Id()[iCodedViewIdx]-m_cCameraData.getBaseSortedId2Id()[iNeighborViewId])>0);
+  //pointers to buffers   
+  TComPicYuv* pcPicYuvVideo = xGetPicYuvFromView(iNeighborViewId, iCurPoc, bDepth, true );
+  TComPicYuv* pcPicYuvDepth = xGetPicYuvFromView(iNeighborViewId, iCurPoc, true, true );
+  TComPicYuv* pcPicYuvVSP   = pcPicVSP->getPicYuvRec();
+  TComPicYuv* pcPicYuvAvail = pcPicAvail->getPicYuvRec();
+  //verifying buffers
+  AOF(pcPicYuvVideo);
+  AOF(pcPicYuvDepth);
+  AOF(pcPicYuvVSP);
+  AOF(pcPicYuvAvail);
+  
+  TComPic* pcPic = getPicFromView( iCodedViewIdx, iCurPoc, bDepth );
+  pcPic->setPicYuvSynth( pcPicYuvVSP );
+  pcPic->setPicYuvAvail( pcPicYuvAvail );
+
+  //setting look-up table
+#if 0
+  m_cVSPRendererTop.setShiftLUTs(
+      m_cCameraData.getBaseViewShiftLUTD()[iNeighborViewId][iCodedViewIdx],
+      m_cCameraData.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx],
+      m_cCameraData.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx],
+      m_cCameraData.getBaseViewShiftLUTD()[iNeighborViewId][iCodedViewIdx],
+      m_cCameraData.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx],
+      m_cCameraData.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx],
+      -1
+      );
+#else
+#if NTT_SUBPEL
+  m_cVSPRendererTop.setShiftLUTs(
+      m_cCameraData.getBaseViewShiftLUTD()[iNeighborViewId][iCodedViewIdx],
+      m_cCameraData.getBaseViewIPelLUT  ()[iNeighborViewId][iCodedViewIdx],
+      NULL,
+      m_cCameraData.getBaseViewShiftLUTD()[iNeighborViewId][iCodedViewIdx],
+      m_cCameraData.getBaseViewIPelLUT  ()[iNeighborViewId][iCodedViewIdx],
+      NULL,
+      -1
+      );
+  m_cVSPRendererTop.setFposLUTs( 
+      m_cCameraData.getBaseViewFPosLUT()[iNeighborViewId][iCodedViewIdx],
+      m_cCameraData.getBaseViewFPosLUT()[iNeighborViewId][iCodedViewIdx]
+      );
+#else
+  m_cVSPRendererTop.setShiftLUTs(
+      m_cCameraData.getBaseViewShiftLUTD()[iNeighborViewId][iCodedViewIdx],
+      m_cCameraData.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx],
+      NULL,
+      m_cCameraData.getBaseViewShiftLUTD()[iNeighborViewId][iCodedViewIdx],
+      m_cCameraData.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx],
+      NULL,
+      -1
+      );
+#endif
+#endif
+
+#if NTT_SUBPEL
+  m_cVSPRendererTop.setInterpolationMode( (bDepth ? 0 : 5) );
+#endif
+
+  //extrapolate from view iNeighborViewId to the current view, storing in the VSP buffer
+  //m_cVSPRendererTop.extrapolateView(pcPicYuvVideo,pcPicYuvDepth, pcPicYuvVSP, bRenderFromLeft);
+  m_cVSPRendererTop.extrapolateAvailabilityView(pcPicYuvVideo,pcPicYuvDepth, pcPicYuvVSP, pcPicYuvAvail, bRenderFromLeft);
+
+
+  // mark it should be extended
+  pcPicVSP->getPicYuvRec()->setBorderExtension(false); 
+  pcPicVSP->getPicYuvRec()->extendPicBorder();//will extend the border for prediction using pixels outside the frame (done at the slice level as well
+  pcPicAvail->getPicYuvRec()->setBorderExtension(false); 
+  pcPicAvail->getPicYuvRec()->extendPicBorder();
+
+#if VSP_N_DUMP
+  {
+    Char acFilenameBase[1024];
+    ::sprintf(acFilenameBase,"VSP_enc_%sv%d_%dx%d.yuv",(bDepth?"D":"T"),iCodedViewIdx,m_iSourceWidth, m_iSourceHeight);
+    pcPicYuvVSP->dump(acFilenameBase,iCurPoc!=0);
+    //pcPicYuvAvail->dump(acFilenameBase,iCurPoc!=0);
+  }
+#endif
+
+}
+#endif
+
 //! \}
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.h
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.h	(revision 165)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.h	(revision 166)
@@ -99,4 +99,9 @@
   TRenTop  m_cUsedPelsRenderer;                               ///< renderer for used pels map
 #endif
+
+#if VSP_N
+  TRenTop                     m_cVSPRendererTop;
+#endif
+
 protected:
   // initialization
@@ -162,4 +167,7 @@
 #endif
 
+#if VSP_N
+  Void xStoreVSPInBuffer(TComPic* pcPicVSP, TComPic* pcPicAvail, Int iCodedViewIdx, Bool bDepth, Int gopId);
+#endif
 };// END CLASS DEFINITION TAppEncTop
 
