Index: trunk/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 296)
+++ trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 313)
@@ -429,8 +429,15 @@
       m_cVPS.setDependentLayer                                        ( layerId-1, layerId);
 #endif
+#if FCO_FIX_SPS_CHANGE
+      m_acTEncDepthTopList[iViewIdx]->setCamParPrecision              ( m_cCameraData.getCamParsCodedPrecision  () );
+      m_acTEncDepthTopList[iViewIdx]->setCamParInSliceHeader          ( m_cCameraData.getVaryingCameraParameters() );
+      m_acTEncDepthTopList[iViewIdx]->setCodedScale                   ( m_cCameraData.getCodedScale             () );
+      m_acTEncDepthTopList[iViewIdx]->setCodedOffset                  ( m_cCameraData.getCodedOffset            () );
+#else
       m_acTEncDepthTopList[iViewIdx]->setCamParPrecision              ( 0 );
       m_acTEncDepthTopList[iViewIdx]->setCamParInSliceHeader          ( false );
       m_acTEncDepthTopList[iViewIdx]->setCodedScale                   ( 0 );
       m_acTEncDepthTopList[iViewIdx]->setCodedOffset                  ( 0 );
+#endif
 
       //====== Coding Structure ========
@@ -970,4 +977,5 @@
     {
       Int  iNumEncoded = 0;
+
 #if !QC_MVHEVC_B0046
       UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );
@@ -977,4 +985,5 @@
       }
 #endif
+
 
 #if FLEX_CODING_ORDER_M23723
@@ -994,4 +1003,16 @@
             assert(isdigit(m_pchMVCJointCodingOrder[i]));
             iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
+#if (FCO_FIX && MERL_VSP_C0152)
+            Int iCurPoc = m_acTEncTopList[iViewIdx]->getFrameId(gopId);
+            if( iCurPoc < m_acTEncTopList[iViewIdx]->getFrameToBeEncoded() && iViewIdx!=0 )
+            {
+              TComPic* pcBaseTxtPic   = getPicFromView(  0, m_acTEncTopList[iViewIdx]->getFrameId(gopId), false ); //get base view reconstructed texture
+              TComPic* pcBaseDepthPic = getPicFromView(  0, m_acTEncTopList[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
 
             m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId );
@@ -1008,4 +1029,5 @@
               assert(isdigit(m_pchMVCJointCodingOrder[i]));
               iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
+
 #if SAIT_VSO_EST_A0033
               if( m_bUseVSO && iNextPoc < m_iFrameToBeEncoded )
@@ -1015,4 +1037,14 @@
               }
 #endif
+#if (FCO_FIX && 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
               m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId );
               xWriteOutput(bitstreamFile, iNumDepthEncoded, outputAccessUnits, iViewIdx, true);
@@ -1039,4 +1071,8 @@
 
 #if MERL_VSP_C0152
+#if MERL_VSP_C0152_BugFix_ForNoDepthCase
+        if(m_bUsingDepthMaps) //VSP can be used only when depth is available as input
+        {
+#endif
         Int iCurPoc = m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId);
         if( iCurPoc < m_acTEncDepthTopList[iViewIdx]->getFrameToBeEncoded() && iViewIdx!=0 )
@@ -1049,4 +1085,18 @@
         }
         setBWVSPLUT( iViewIdx, gopId, false);
+#if MERL_VSP_C0152_BugFix_ForNoDepthCase
+        }
+        else
+        {
+          Int iCurPoc = m_acTEncTopList[iViewIdx]->getFrameId(gopId);
+          if( iCurPoc < m_acTEncTopList[iViewIdx]->getFrameToBeEncoded() && iViewIdx!=0 )
+          {
+            TEncSlice* pEncSlice = m_acTEncTopList[iViewIdx]->getSliceEncoder();
+            pEncSlice->setRefPicBaseTxt(NULL);//Initialize the base view reconstructed texture buffer
+            pEncSlice->setRefPicBaseDepth(NULL);//Initialize the base view reconstructed depth buffer
+          }
+        }
+#endif
+
 #endif
         // call encoding function for one frame
