Index: branches/HTM-5.1-dev3-MERL/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- branches/HTM-5.1-dev3-MERL/source/App/TAppDecoder/TAppDecTop.cpp	(revision 222)
+++ branches/HTM-5.1-dev3-MERL/source/App/TAppDecoder/TAppDecTop.cpp	(revision 231)
@@ -764,3 +764,19 @@
 #endif
 }
+
+#if MERL_VSP_C0152
+Void TAppDecTop::setBWVSPLUT(TComSlice* pcSlice,  Int iCodedViewIdx,  Int iCurPoc)
+{
+  //first view does not have VSP 
+  if((iCodedViewIdx == 0)) return;
+
+  AOT( iCodedViewIdx <= 0);
+  //AOT( iCodedViewIdx >= m_iNumberOfViews );
+  Int iNeighborViewId = 0;
+  //  Int* piShiftLUT = bRenderFromLeft ? m_cCamParsCollector.getBaseViewShiftLUTI()[iCodedViewIdx][iNeighborViewId][0] : m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx][0];
+  Int* piShiftLUT = m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx][0];
+  pcSlice->setBWVSPLUTParam(piShiftLUT, 2-LOG2_DISP_PREC_LUT );
+}
+#endif
+
 //! \}
Index: branches/HTM-5.1-dev3-MERL/source/App/TAppDecoder/TAppDecTop.h
===================================================================
--- branches/HTM-5.1-dev3-MERL/source/App/TAppDecoder/TAppDecTop.h	(revision 222)
+++ branches/HTM-5.1-dev3-MERL/source/App/TAppDecoder/TAppDecTop.h	(revision 231)
@@ -112,4 +112,8 @@
 #endif
 
+#if MERL_VSP_C0152
+  Void  setBWVSPLUT( TComSlice* pcSlice, Int iCodedViewIdx, Int iCurPoc   );
+#endif
+
 protected:
 //  Void  xCreateDecLib     (); ///< create internal classes
Index: branches/HTM-5.1-dev3-MERL/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/HTM-5.1-dev3-MERL/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 222)
+++ branches/HTM-5.1-dev3-MERL/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 231)
@@ -220,25 +220,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")
@@ -254,5 +254,5 @@
   ("FrameSkip,-fs",         m_FrameSkip,         0u, "Number of frames to skip at start of input YUV")
   ("FramesToBeEncoded,f",   m_iFrameToBeEncoded, 0, "number of frames to be encoded (default=all)")
-  ("FrameToBeEncoded",        m_iFrameToBeEncoded, 0, "deprecated alias of FramesToBeEncoded")
+  ("FrameToBeEncoded",      m_iFrameToBeEncoded, 0, "deprecated alias of FramesToBeEncoded")
   
   ("NumberOfViews",         m_iNumberOfViews,    0, "Number of views")
Index: branches/HTM-5.1-dev3-MERL/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/HTM-5.1-dev3-MERL/source/App/TAppEncoder/TAppEncTop.cpp	(revision 222)
+++ branches/HTM-5.1-dev3-MERL/source/App/TAppEncoder/TAppEncTop.cpp	(revision 231)
@@ -793,5 +793,4 @@
   m_cUsedPelsRenderer.init(m_iSourceWidth, m_iSourceHeight, true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 4, 1, 0, 6 );
 #endif
-
 }
 
@@ -931,5 +930,5 @@
   TComPicYuv*       pcPicYuvRec = NULL;
   TComPicYuv*       pcDepthPicYuvRec = NULL;
-  
+
   // initialize internal class & member variables
   xInitLibCfg();
@@ -1033,5 +1032,5 @@
       if ( iNextPoc < m_iFrameToBeEncoded )
       {
-      m_cCameraData.update( iNextPoc );
+        m_cCameraData.update( iNextPoc );
       }
 #endif
@@ -1096,4 +1095,17 @@
 #endif
         iNumEncoded = 0;
+
+#if MERL_VSP_C0152
+        Int iCurPoc = m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId);
+        if( iCurPoc < m_acTEncDepthTopList[iViewIdx]->getFrameToBeEncoded() && iViewIdx!=0 )
+        {
+          TComPic* pcBaseTxtPic   = getPicFromView(  0, m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId), false ); //get base view reconstructed texture
+          TComPic* pcBaseDepthPic = getPicFromView(  0, m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId), true );  //get base view reconstructed depth
+          TEncSlice* pEncSlice = m_acTEncTopList[iViewIdx]->getSliceEncoder();
+          pEncSlice->setRefPicBaseTxt(pcBaseTxtPic);
+          pEncSlice->setRefPicBaseDepth(pcBaseDepthPic);
+        }
+        setBWVSPLUT( iViewIdx, gopId, false);
+#endif
         // call encoding function for one frame
         m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId );
@@ -1103,4 +1115,15 @@
         {
           Int  iNumDepthEncoded = 0;
+#if MERL_VSP_C0152
+        Int iCurPocDepth = m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId);
+        if( iCurPocDepth < m_acTEncDepthTopList[iViewIdx]->getFrameToBeEncoded() && iViewIdx!=0 )
+        {
+          TComPic* pcBaseDepthPic = getPicFromView(  0, m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId), true );
+          TEncSlice* pcSlice = (TEncSlice*) m_acTEncDepthTopList[iViewIdx]->getSliceEncoder();
+          pcSlice->setRefPicBaseDepth(pcBaseDepthPic);
+        }
+        setBWVSPLUT( iViewIdx, gopId, true);
+#endif
+
           // call encoding function for one depth frame
           m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId );
@@ -1634,3 +1657,30 @@
 #endif
 
+#if MERL_VSP_C0152
+Void TAppEncTop::setBWVSPLUT(Int iCodedViewIdx, Int gopId, Bool isDepth)
+{
+  //first view does not have VSP 
+  if((iCodedViewIdx == 0)) return;
+
+  AOT( iCodedViewIdx <= 0);
+  AOT( iCodedViewIdx >= m_iNumberOfViews );
+
+  Int iNeighborViewId = 0;
+  //setting look-up table
+  Int* piShiftLUT = m_cCameraData.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx][0];
+
+  if(isDepth)
+  {
+    TEncSlice* pcEncSlice = (TEncSlice*) m_acTEncDepthTopList[iCodedViewIdx]->getSliceEncoder();
+    pcEncSlice->setBWVSPLUTParam(  piShiftLUT, LOG2_DISP_PREC_LUT );
+  }
+  else
+  {
+    TEncSlice* pcEncSlice = (TEncSlice*) m_acTEncTopList[iCodedViewIdx]->getSliceEncoder();
+    pcEncSlice->setBWVSPLUTParam(  piShiftLUT, LOG2_DISP_PREC_LUT );
+  }
+
+}
+#endif
+
 //! \}
Index: branches/HTM-5.1-dev3-MERL/source/App/TAppEncoder/TAppEncTop.h
===================================================================
--- branches/HTM-5.1-dev3-MERL/source/App/TAppEncoder/TAppEncTop.h	(revision 222)
+++ branches/HTM-5.1-dev3-MERL/source/App/TAppEncoder/TAppEncTop.h	(revision 231)
@@ -99,4 +99,5 @@
   TRenTop  m_cUsedPelsRenderer;                               ///< renderer for used pels map
 #endif
+
 protected:
   // initialization
@@ -165,4 +166,7 @@
 #endif
 
+#if MERL_VSP_C0152
+  Void setBWVSPLUT( Int iCodedViewIdx, Int gopId, Bool isDepth);
+#endif
 };// END CLASS DEFINITION TAppEncTop
 
