Index: branches/HTM-DEV-0.3-dev2/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 453)
+++ branches/HTM-DEV-0.3-dev2/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 476)
@@ -717,4 +717,9 @@
 
 #endif //HHI_VSO
+
+#if H_3D_IV_MERGE
+  ("PredDepthMapGen",  m_uiPredDepthMapGeneration, (UInt)0, "generation of prediction depth maps for motion data prediction" )
+  ("MultiviewMvPred",  m_uiMultiviewMvPredMode,    (UInt)0, "usage of predicted depth maps" )
+#endif
 #endif //H_3D
   ;
@@ -1439,4 +1444,9 @@
   xConfirmPara( ((UInt) m_numberOfLayers >> 1 ) != m_cCameraData.getBaseViewNumbers().size(),   "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );
   xConfirmPara    ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5,       "CodedCamParsPrecision must be in range of 0..5" );
+#if H_3D_IV_MERGE
+  xConfirmPara    ( m_uiPredDepthMapGeneration > 2,                                   "PredDepthMapGen must be less than or equal to 2" );
+  xConfirmPara    ( m_uiMultiviewMvPredMode > 7,                                      "MultiviewMvPred must be less than or equal to 7" );  
+  xConfirmPara    ( m_uiMultiviewMvPredMode > 0 && m_uiPredDepthMapGeneration == 0 ,  "MultiviewMvPred > 0 requires PredDepthMapGen > 0" );
+#endif
 #if H_3D_VSO
     if( m_bUseVSO )
@@ -2278,4 +2288,7 @@
   printf("WVSO:%d ", m_bUseWVSO );  
 #endif
+#if H_3D_IV_MERGE
+  printf("MultiviewMvPred:%d", m_uiMultiviewMvPredMode);
+#endif
   printf("\n\n");  
 
Index: branches/HTM-DEV-0.3-dev2/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/App/TAppEncoder/TAppEncCfg.h	(revision 453)
+++ branches/HTM-DEV-0.3-dev2/source/App/TAppEncoder/TAppEncCfg.h	(revision 476)
@@ -381,4 +381,8 @@
   TAppComCamPara m_cCameraData;
   Int       m_iCodedCamParPrecision;                          ///< precision for coding of camera parameters
+#if H_3D_IV_MERGE
+  UInt      m_uiMultiviewMvPredMode;   
+  UInt      m_uiPredDepthMapGeneration;
+#endif
 #if H_3D_VSO
   Char*     m_pchVSOConfig;
Index: branches/HTM-DEV-0.3-dev2/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/App/TAppEncoder/TAppEncTop.cpp	(revision 453)
+++ branches/HTM-DEV-0.3-dev2/source/App/TAppEncoder/TAppEncTop.cpp	(revision 476)
@@ -128,8 +128,29 @@
     m_frameRcvd                 .push_back(0);
     m_acTEncTopList             .push_back(new TEncTop); 
+#if H_3D_IV_MERGE
+//    m_acTEncDepthTopList        .push_back(new TEncTop); 
+#endif
     m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv);
     m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv);
     m_picYuvRec                 .push_back(new TComList<TComPicYuv*>) ;
-
+#if H_3D_IV_MERGE
+    //m_acTEncDepthTopList[iViewIdx]->setFrameRate                    ( m_iFrameRate );
+    //m_acTEncDepthTopList[iViewIdx]->setFrameSkip                    ( m_FrameSkip );
+    //m_acTEncDepthTopList[iViewIdx]->setSourceWidth                  ( m_iSourceWidth );
+    //m_acTEncDepthTopList[iViewIdx]->setSourceHeight                 ( m_iSourceHeight );
+    //m_acTEncDepthTopList[iViewIdx]->setCroppingMode                 ( m_croppingMode );
+    //m_acTEncDepthTopList[iViewIdx]->setCropLeft                     ( m_cropLeft );
+    //m_acTEncDepthTopList[iViewIdx]->setCropRight                    ( m_cropRight );
+    //m_acTEncDepthTopList[iViewIdx]->setCropTop                      ( m_cropTop );
+    //m_acTEncDepthTopList[iViewIdx]->setCropBottom                   ( m_cropBottom );
+    //m_acTEncDepthTopList[iViewIdx]->setFrameToBeEncoded             ( m_iFrameToBeEncoded );
+    //m_acTEncDepthTopList[iViewIdx]->setViewId                       ( iViewIdx );
+    //m_acTEncDepthTopList[iViewIdx]->setIsDepth                      ( true );
+
+    //m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx                 ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );
+
+    //m_acTEncDepthTopList[iViewIdx]->setLayerId                      ( layerId );
+
+#endif
     m_ivPicLists.push_back( m_acTEncTopList[ layer ]->getListPic()  ); 
     TEncTop& m_cTEncTop = *m_acTEncTopList[ layer ];  // It is not a member, but this name helps avoiding code duplication !!!
@@ -143,4 +164,10 @@
     m_cTEncTop.setIsDepth                      ( isDepth );
     //====== Camera Parameters =========
+#if H_3D_IV_MERGE
+      //m_acTEncDepthTopList[iViewIdx]->setCamParPrecision              ( 0 );
+      //m_acTEncDepthTopList[iViewIdx]->setCamParInSliceHeader          ( false );
+      //m_acTEncDepthTopList[iViewIdx]->setCodedScale                   ( 0 );
+      //m_acTEncDepthTopList[iViewIdx]->setCodedOffset                  ( 0 );
+#endif
     m_cTEncTop.setCameraParameters             ( &m_cCameraData );     
     m_cTEncTop.setCamParPrecision              ( isDepth ? false : m_cCameraData.getCamParsCodedPrecision  () );
@@ -166,4 +193,8 @@
     m_cTEncTop.setDWeight                      ( isDepth ? m_iDWeight             : 0     );
 #endif // H_3D_VSO
+#if H_3D_IV_MERGE
+    m_cTEncTop.setMultiviewMvPredMode          ( m_uiMultiviewMvPredMode     );
+    m_cTEncTop.setPredDepthMapGeneration       ( m_uiPredDepthMapGeneration );
+#endif
 #endif // H_3D
 
@@ -189,4 +220,11 @@
   
   //====== Coding Structure ========
+#if H_3D_IV_MERGE
+      //m_acTEncDepthTopList[iViewIdx]->setIntraPeriod                  ( m_iIntraPeriod );
+      //m_acTEncDepthTopList[iViewIdx]->setDecodingRefreshType          ( m_iDecodingRefreshType );
+      //m_acTEncDepthTopList[iViewIdx]->setGOPSize                      ( m_iGOPSize );
+      //m_acTEncDepthTopList[iViewIdx]->setGopList                      ( m_GOPListsMvc[iViewIdx] );
+      //m_acTEncDepthTopList[iViewIdx]->setExtraRPSs                    ( m_extraRPSs[iViewIdx] );
+#endif
   m_cTEncTop.setIntraPeriod                  ( m_iIntraPeriod );
   m_cTEncTop.setDecodingRefreshType          ( m_iDecodingRefreshType );
@@ -207,9 +245,29 @@
     m_cTEncTop.setNumReorderPics             ( m_numReorderPics[i], i );
     m_cTEncTop.setMaxDecPicBuffering         ( m_maxDecPicBuffering[i], i );
-  }
+#if H_3D_IV_MERGE
+        m_acTEncDepthTopList[iViewIdx]->setNumReorderPics             ( m_numReorderPics[iViewIdx][i], i );
+        m_acTEncDepthTopList[iViewIdx]->setMaxDecPicBuffering         ( m_maxDecPicBuffering[iViewIdx][i], i );
+#endif
+  }
+#if H_3D_IV_MERGE
+      m_acTEncDepthTopList[iViewIdx]->setQP                           ( m_aiQP[1] );
+
+      m_acTEncDepthTopList[iViewIdx]->setTemporalLayerQPOffset        ( m_aiTLayerQPOffset );
+      m_acTEncDepthTopList[iViewIdx]->setPad                          ( m_aiPad );
+
+      m_acTEncDepthTopList[iViewIdx]->setMaxTempLayer                 ( m_maxTempLayer[iViewIdx] );
+
+      m_acTEncDepthTopList[iViewIdx]->setDisInter4x4                  ( m_bDisInter4x4);
+
+      m_acTEncDepthTopList[iViewIdx]->setUseNSQT( m_enableNSQT );
+      m_acTEncDepthTopList[iViewIdx]->setUseAMP( m_enableAMP );
+#endif
 #endif
   for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop )
   {
     m_cTEncTop.setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] );
+#if H_3D_IV_MERGE
+//        m_acTEncDepthTopList[iViewIdx]->setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] );
+#endif
   }
 #if H_MV
@@ -231,4 +289,11 @@
   
   //====== Loop/Deblock Filter ========
+#if H_3D_IV_MERGE
+      //m_acTEncDepthTopList[iViewIdx]->setLoopFilterDisable            ( m_abLoopFilterDisable[1]   );
+      //m_acTEncDepthTopList[iViewIdx]->setLoopFilterOffsetInAPS        ( m_loopFilterOffsetInAPS );
+      //m_acTEncDepthTopList[iViewIdx]->setLoopFilterBetaOffset         ( m_loopFilterBetaOffsetDiv2  );
+      //m_acTEncDepthTopList[iViewIdx]->setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
+      //m_acTEncDepthTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
+#endif
 #if H_MV
   m_cTEncTop.setLoopFilterDisable            ( m_bLoopFilterDisable[layer]);
@@ -604,5 +669,9 @@
   for(Int layer=0; layer<m_numberOfLayers; layer++)
   {
+#if H_3D_IV_MERGE
+    m_acTEncTopList[layer]->init(this );
+#else
     m_acTEncTopList[layer]->init( );
+#endif
   }
 #else
@@ -1032,3 +1101,25 @@
 }
 #endif
+#if H_3D_IV_MERGE
+TComPic* TAppEncTop::xGetPicFromView( Int viewIdx, Int poc, Bool isDepth )
+{
+  assert( ( viewIdx >= 0 ) && ( viewIdx < m_iNumberOfViews ) );
+
+  TComList<TComPic*>* apcListPic =  m_acTEncTopList[(isDepth ? 1 : 0) + viewIdx * 2]->getListPic() ;
+
+  
+
+  TComPic* pcPic = NULL;
+  for(TComList<TComPic*>::iterator it=apcListPic->begin(); it!=apcListPic->end(); it++)
+  {
+    if( (*it)->getPOC() == poc )
+    {
+      pcPic = *it ;
+      break ;
+    }
+  }
+
+  return pcPic;
+};
+#endif
 //! \}
Index: branches/HTM-DEV-0.3-dev2/source/App/TAppEncoder/TAppEncTop.h
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/App/TAppEncoder/TAppEncTop.h	(revision 453)
+++ branches/HTM-DEV-0.3-dev2/source/App/TAppEncoder/TAppEncTop.h	(revision 476)
@@ -48,4 +48,7 @@
 #if H_3D
 #include "../../Lib/TLibRenderer/TRenTop.h"
+#if H_3D_IV_MERGE
+#include "TLibCommon/TComDepthMapGenerator.h"
+#endif
 #endif
 
@@ -89,4 +92,10 @@
   TRenModel                   m_cRendererModel;   
 #endif
+
+#if H_3D_IV_MERGE
+  TComVPSAccess               m_cVPSAccess;
+  TComSPSAccess               m_cSPSAccess;
+  TComAUPicAccess             m_cAUPicAccess;
+#endif
 protected:
   // initialization
@@ -114,5 +123,7 @@
   void rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& stats);
   void printRateSummary();
-  
+#if H_3D_IV_MERGE
+  TComPic* xGetPicFromView( Int viewIdx, Int iPoc, Bool isDepth );
+#endif
 #if H_MV
   Void xSetLayerIds               ( TComVPS& vps );  
@@ -126,8 +137,17 @@
   
   Void        encode      ();                               ///< main encoding function
+#if H_3D_IV_MERGE
+  TComPic*              getPicFromView     ( Int viewIdx, Int poc, Bool isDepth ) { return xGetPicFromView( viewIdx, poc, isDepth ); }
+#endif
 #if H_MV
   TEncTop*    getTEncTop( UInt layer ) { return  m_acTEncTopList[layer]; }  ///< return pointer to encoder class for specific layer
 #else
   TEncTop&    getTEncTop  ()   { return  m_cTEncTop; }      ///< return encoder class pointer reference
+#endif
+
+#if H_3D_IV_MERGE
+  TComVPSAccess*    getVPSAccess  () { return &m_cVPSAccess;   }
+  TComSPSAccess*    getSPSAccess  () { return &m_cSPSAccess;   }
+  TComAUPicAccess*  getAUPicAccess() { return &m_cAUPicAccess; }
 #endif
 };// END CLASS DEFINITION TAppEncTop
