Index: branches/0.3-poznan-univ/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- branches/0.3-poznan-univ/source/App/TAppDecoder/TAppDecTop.cpp	(revision 27)
+++ branches/0.3-poznan-univ/source/App/TAppDecoder/TAppDecTop.cpp	(revision 28)
@@ -64,4 +64,8 @@
 //  m_iPOCLastDisplay  = -1;
   m_pScaleOffsetFile  = 0;
+
+#if POZNAN_MP
+  m_pcMP = NULL;
+#endif
 }
 
@@ -71,4 +75,8 @@
   
   m_apcBitstream->create( BITS_BUF_SIZE );
+
+#if POZNAN_MP
+  m_pcMP = new TComMP();
+#endif
 }
 
@@ -89,4 +97,8 @@
     free(m_pchReconFile);
   }
+
+#if POZNAN_MP
+  if(m_pcMP) { delete m_pcMP; m_pcMP = NULL; };
+#endif
 }
 
@@ -163,4 +175,8 @@
     if( eNalUnitType == NAL_UNIT_SPS )
     {
+#if POZNAN_SYNTH
+      if(cComSPS.getViewId()==0 && !cComSPS.isDepth()) // it should be called at first view at the begining of the stream
+        initRenderer(cComSPS);
+#endif
       if( cComSPS.isDepth() && (m_bUsingDepth==false) )  // expected not using depth, but bitstream are using depth
       {                                                     // know from sps
@@ -415,5 +431,19 @@
         if ( m_pchReconFile )
         {
+
+#if POZNAN_NONLINEAR_DEPTH
+          TComSPS* pcSPS = pcPic->getSlice(0)->getSPS();
+          TComPicYuv cPicPower;
+
+          //pcPic->getPicYuvRec()
+          cPicPower.create(pcSPS->getWidth(), pcSPS->getHeight(), pcSPS->getMaxCUWidth(), pcSPS->getMaxCUHeight(), pcSPS->getMaxCUDepth() ); 
+
+          pcPic->getPicYuvRec()->nonlinearDepthBackward(&cPicPower, pcSPS->getDepthPower());
+
+          m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write(&cPicPower, pcSPS->getPad());
+          cPicPower.destroy();		  
+#else
           m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() );
+#endif
         }
 
@@ -542,2 +572,164 @@
   return pcRefPic;
 }
+
+#if POZNAN_SYNTH
+Void TAppDecTop::initRenderer(TComSPS &cComSPS)
+{
+  m_cAvailabilityRenderer.init(cComSPS.getWidth(), cComSPS.getHeight(),true,0,LOG2_DISP_PREC_LUT,true, 0,0,0,0,0,6,4,1,0,6 );  //GT: simplest configuration
+}
+//*
+Void TAppDecTop::storeSynthPicsInBuffer(Int iCoddedViewIdx,Int iCoddedViewOrderIdx, Int iCurPoc, Bool bDepth)
+{
+  Int  iLeftViewIdx  = -1;
+  Int  iRightViewIdx = -1;
+  Int  iNearestViewIdx = -1;
+  Bool bRenderFromLeft;
+
+  Int iRelDistToLeft = 128;
+  if(iCoddedViewIdx==0) //First on View Coded List
+  {
+    //TComPic* pcPic = getPicFromView( iCoddedViewIdx, iCurPoc, false );
+    return;
+  }
+  iNearestViewIdx = 0;
+  //bRenderFromLeft = iCoddedViewOrderIdx>0?true:false;
+  //bRenderFromLeft = iCoddedViewOrderIdx<0?true:false;
+  //m_cCamParsCollector.getNearestBaseView(iCoddedViewIdx, iNearestViewIdx, iRelDistToLeft, bRenderFromLeft);
+  bRenderFromLeft = iCoddedViewIdx>1?true:false;
+
+  m_cAvailabilityRenderer.setShiftLUTs(
+    m_cCamParsCollector.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],
+    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
+    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
+    m_cCamParsCollector.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],//right
+    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
+    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
+    iRelDistToLeft
+  );
+
+  TComPic* pcPic = getPicFromView( iCoddedViewIdx, iCurPoc, bDepth );
+
+  TComPicYuv* pcPicYuvSynthView = pcPic->getPicYuvSynth();
+  TComPicYuv* pcPicYuvAvailView = pcPic->getPicYuvAvail();
+  if(!pcPicYuvSynthView)
+  {
+    pcPic->addSynthesisBuffer();
+    pcPicYuvSynthView = pcPic->getPicYuvSynth();
+  }
+  if(!pcPicYuvAvailView)
+  {
+    pcPic->addAvailabilityBuffer();
+    pcPicYuvAvailView = pcPic->getPicYuvAvail();
+  }
+// usun i uzyj syntezy Krzysztofa tylko przesun ja przed dekodowanie tekstury to do
+  /*
+#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
+  if(!bDepth)
+  {
+  TComPicYuv* pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth();
+  if(!pcPicYuvSynthDepthView)
+  {
+    pcPic->addSynthesisDepthBuffer();
+    pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth();
+  }
+  m_cAvailabilityRenderer.extrapolateAvailabilityView( getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthDepthView, pcPicYuvAvailView, bRenderFromLeft );
+  
+#if POZNAN_OUTPUT_SYNTH
+      Char acFilenameBaseD[1024];
+      //printf("\niNearestViewIdx: %d, iCurPoc: %d, bRenderFromLeft: %s\n", iNearestViewIdx, iCurPoc, (bRenderFromLeft)?"true":"false");
+      ::sprintf( acFilenameBaseD,  "SynthInputDepth_%s_V%d.yuv", ( true ? "Dec" : "Enc" ),iCoddedViewIdx );
+      getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec()->dump(acFilenameBaseD, iCurPoc!=0);
+      ::sprintf( acFilenameBaseD,  "SynthDepth_%s_V%d.yuv", ( true ? "Dec" : "Enc" ),iCoddedViewIdx );
+      pcPicYuvSynthDepthView->dump(acFilenameBaseD, iCurPoc!=0);
+#endif
+   }
+#endif//*/
+
+  //m_cAvailabilityRenderer.extrapolateAvailabilityView( xGetPicFromView( iNearestViewIdx, iCurPoc, false )->getPicYuvRec(), xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvERView, pcPicYuvAvailView, bRenderFromLeft );
+  m_cAvailabilityRenderer.extrapolateAvailabilityView( getPicFromView( iNearestViewIdx, iCurPoc, bDepth )->getPicYuvRec(), getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthView, pcPicYuvAvailView, bRenderFromLeft );
+
+  pcPicYuvAvailView->setBorderExtension( false );//Needed??
+  pcPicYuvAvailView->extendPicBorder();//Needed??
+
+#if POZNAN_OUTPUT_AVAILABLE_MAP
+  {
+  Char acFilenameBase[1024];
+  ::sprintf( acFilenameBase,  "Available_%s_%s_V%d.yuv", (bDepth ? "Depth":"Tex"),( true ? "Dec" : "Enc" ), iCoddedViewIdx);
+  pcPicYuvAvailView->dump(acFilenameBase, iCurPoc!=0);
+  }
+#endif
+#if POZNAN_OUTPUT_SYNTH
+  {
+  Char acFilenameBase[1024];
+  ::sprintf( acFilenameBase,  "Synth_%s_%s_V%d.yuv", (bDepth ? "Depth":"Tex"),( true ? "Dec" : "Enc" ), iCoddedViewIdx );
+  pcPicYuvSynthView->dump(acFilenameBase, iCurPoc!=0);
+  }
+#endif
+}
+#endif
+
+//*
+#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
+Void TAppDecTop::storeDepthSynthPicsInBuffer(Int iCoddedViewIdx,Int iCoddedViewOrderIdx, Int iCurPoc)
+{
+  Int  iLeftViewIdx  = -1;
+  Int  iRightViewIdx = -1;
+  Int  iNearestViewIdx = -1;
+  Bool bRenderFromLeft;
+
+  Int iRelDistToLeft = 128;
+  if(iCoddedViewIdx==0) //First on View Coded List
+  {
+    //TComPic* pcPic = getPicFromView( iCoddedViewIdx, iCurPoc, false );
+    return;
+  }
+  iNearestViewIdx = 0;
+  //bRenderFromLeft = iCoddedViewOrderIdx>0?true:false;
+  //bRenderFromLeft = iCoddedViewOrderIdx<0?true:false;
+  //m_cCamParsCollector.getNearestBaseView(iCoddedViewIdx, iNearestViewIdx, iRelDistToLeft, bRenderFromLeft);
+  bRenderFromLeft = iCoddedViewIdx>1?true:false;
+
+  m_cAvailabilityRenderer.setShiftLUTs(
+    m_cCamParsCollector.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],
+    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
+    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
+    m_cCamParsCollector.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],//right
+    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
+    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
+    iRelDistToLeft
+  );
+
+  TComPic* pcPic = getPicFromView( iCoddedViewIdx, iCurPoc, false );
+
+  TComPicYuv* pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth();
+  if(!pcPicYuvSynthDepthView)
+  {
+    pcPic->addSynthesisDepthBuffer();
+    pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth();
+  }
+  
+  Int   iWidth        = pcPicYuvSynthDepthView->getWidth      ();
+  Int   iHeight       = pcPicYuvSynthDepthView->getHeight     ();
+  UInt  uiMaxCuWidth  = pcPicYuvSynthDepthView->getMaxCuWidth ();
+  UInt  uiMaxCuHeight = pcPicYuvSynthDepthView->getMaxCuHeight();
+  UInt  uiMaxCuDepth  = pcPicYuvSynthDepthView->getMaxCuDepth ();
+
+  TComPicYuv* pcPicYuvAvailView = new TComPicYuv;
+  pcPicYuvAvailView->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
+
+  m_cAvailabilityRenderer.extrapolateAvailabilityView( getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthDepthView, pcPicYuvAvailView, bRenderFromLeft );
+  
+  pcPicYuvAvailView->destroy();
+  delete pcPicYuvAvailView;
+
+#if POZNAN_OUTPUT_SYNTH
+      Char acFilenameBaseD[1024];
+      //printf("\niNearestViewIdx: %d, iCurPoc: %d, bRenderFromLeft: %s\n", iNearestViewIdx, iCurPoc, (bRenderFromLeft)?"true":"false");
+      ::sprintf( acFilenameBaseD,  "SynthInputDepth_%s_V%d.yuv", ( true ? "Dec" : "Enc" ),iCoddedViewIdx );
+      getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec()->dump(acFilenameBaseD, iCurPoc!=0);
+      ::sprintf( acFilenameBaseD,  "SynthDepth_%s_V%d.yuv", ( true ? "Dec" : "Enc" ),iCoddedViewIdx );
+      pcPicYuvSynthDepthView->dump(acFilenameBaseD, iCurPoc!=0);
+#endif
+  
+}
+#endif//*/
Index: branches/0.3-poznan-univ/source/App/TAppDecoder/TAppDecTop.h
===================================================================
--- branches/0.3-poznan-univ/source/App/TAppDecoder/TAppDecTop.h	(revision 27)
+++ branches/0.3-poznan-univ/source/App/TAppDecoder/TAppDecTop.h	(revision 28)
@@ -52,5 +52,12 @@
 #include "../../Lib/TLibCommon/TComDepthMapGenerator.h"
 #include "../../Lib/TLibDecoder/TDecTop.h"
+#if POZNAN_SYNTH
+#include "../../Lib/TLibRenderer/TRenTop.h"
+#endif
 #include "TAppDecCfg.h"
+
+#if POZNAN_MP
+#include "../../Lib/TLibCommon/TComMP.h"
+#endif
 
 // ====================================================================================================================
@@ -87,4 +94,12 @@
 #endif
 
+#if POZNAN_SYNTH
+  TRenTop                         m_cAvailabilityRenderer;
+#endif
+
+#if POZNAN_MP
+  TComMP*						  m_pcMP;
+#endif
+
 public:
   TAppDecTop();
@@ -97,5 +112,14 @@
   Void  startUsingDepth() ;
 
-// GT FIX
+#if POZNAN_SYNTH
+  Void  initRenderer(TComSPS &cComSPS);
+  Void  storeSynthPicsInBuffer(Int iCoddedViewIdx,Int iCoddedViewOrderIdx,Int iCurPoc,Bool bDepth);
+#endif
+
+#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
+  Void storeDepthSynthPicsInBuffer(Int iCoddedViewIdx,Int iCoddedViewOrderIdx, Int iCurPoc);
+#endif
+
+ // GT FIX
   std::vector<TComPic*> getSpatialRefPics( Int iViewIdx, Int iPoc, Bool bIsDepth );
   TComPic* getPicFromView( Int iViewIdx, Int iPoc, bool bDepth );
@@ -106,4 +130,8 @@
   TComAUPicAccess*  getAUPicAccess() { return &m_cAUPicAccess; }
   TDecTop*          getDecTop0    () { return m_acTDecTopList[0]; }
+#endif
+
+#if POZNAN_MP
+  TComMP* getMP() { return m_pcMP; }
 #endif
 
