Index: branches/0.2-poznan-univ/source/App/TAppCommon/TAppComCamPara.cpp
===================================================================
--- branches/0.2-poznan-univ/source/App/TAppCommon/TAppComCamPara.cpp	(revision 11)
+++ branches/0.2-poznan-univ/source/App/TAppCommon/TAppComCamPara.cpp	(revision 12)
@@ -76,10 +76,10 @@
 
       radLUT        [ uiSourceView ][ uiTargetView ]      = new Double*[ 2 ];
-      radLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ];
-      radLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ];
+      radLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ SizeOfLUT+1 ];
+      radLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ SizeOfLUT+1 ];
 
       raiLUT        [ uiSourceView ][ uiTargetView ]      = new Int*   [ 2 ];
-      raiLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Int    [ 257 ];
-      raiLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Int    [ 257 ];
+      raiLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Int    [ SizeOfLUT+1 ];
+      raiLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Int    [ SizeOfLUT+1 ];
     }
   }
@@ -877,8 +877,22 @@
       radShiftParams[ uiSourceView][ uiTargetView ][ 1 ] = dOffset;
 
-      for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )
-      {
+#if POZNAN_NONLINEAR_DEPTH
+      TComPowerConverter power(m_fDepthPower, (POZNAN_LUT_INCREASED_PRECISION) ? g_uiBitIncrement : 0, (POZNAN_LUT_INCREASED_PRECISION) ? g_uiBitIncrement : 0);
+#endif
+
+      for( UInt uiDepthValue = 0; uiDepthValue < SizeOfLUT; uiDepthValue++ )
+      {
+        Double  dDepthValue = (Double)uiDepthValue;
+        Int64   iDepthValue = (Int64)uiDepthValue;
+#if POZNAN_NONLINEAR_DEPTH
+        dDepthValue = power(dDepthValue);
+        iDepthValue = (Int64)(dDepthValue+0.5);
+#endif
+#if POZNAN_LUT_INCREASED_PRECISION
+        dDepthValue /= (1<<g_uiBitIncrement);
+#endif
         // real-valued look-up tables
-        Double  dShiftLuma      = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
+
+        Double  dShiftLuma      = ( dDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
         Double  dShiftChroma    = dShiftLuma / 2;
         radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;
@@ -886,5 +900,9 @@
 
         // integer-valued look-up tables
-        Int64   iTempScale      = (Int64)uiDepthValue * iScale;
+        //Int64   iDepthValue = (Int64)uiDepthValue;
+        Int64   iTempScale      = iDepthValue * iScale;
+#if POZNAN_LUT_INCREASED_PRECISION
+        iTempScale >>= g_uiBitIncrement;
+#endif
         Int64   iTestScale      = ( iTempScale + iOffset       );   // for checking accuracy of camera parameters
         Int64   iShiftLuma      = ( iTempScale + iOffsetLuma   ) >> iLog2DivLuma;
@@ -899,8 +917,8 @@
       }
 
-      radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
-      radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
-      raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
-      raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
+      radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ SizeOfLUT ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ SizeOfLUT-1 ];
+      radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ SizeOfLUT ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ SizeOfLUT-1 ];
+      raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ SizeOfLUT ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ SizeOfLUT-1 ];
+      raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ SizeOfLUT ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ SizeOfLUT-1 ];
     }
   }
@@ -1232,5 +1250,9 @@
                       Char*  pchSynthViewNumbers,
                       std::vector<Int>* paiSynthViewNumbers,
-                      Int    iLog2Precision )
+                      Int    iLog2Precision
+#if POZNAN_NONLINEAR_DEPTH
+                      ,Float fDepthPower
+#endif
+                      )
 {
   //===== set miscellaneous variables =====
@@ -1240,4 +1262,8 @@
   m_uiCamParsCodedPrecision = uiCodedCamParsPrecision;
   m_iLog2Precision          = iLog2Precision;
+
+#if POZNAN_NONLINEAR_DEPTH
+  m_fDepthPower             = fDepthPower;
+#endif
 
   xReadCameraParameterFile( pchCfgFileName );
@@ -1339,4 +1365,42 @@
 }
 
+  xReadCameraParameterFile( pchCfgFileName );
+
+  m_bSetupFromCoded         = ( m_aadCameraParameters[ 0 ].size() == 2 );
+
+  if ( m_bSetupFromCoded )
+  {
+    std::cout << "Detected decoded camera parameter file. Overwriting base view settings from cfg file. " << std::endl;
+    xSetupBaseViewsFromCoded();
+  }
+  else
+  {
+    xSetupBaseViews( pchBaseViewNumbers, uiNumBaseViews );
+  }
+
+  //===== set derived parameters =====
+  xGetViewOrderIndices( m_aiBaseId2SortedId, m_aiViewOrderIndex );
+  m_bCamParsVaryOverTime = xGetCamParsChangeFlag();
+
+
+  //===== create arrays =====
+  xCreateLUTs   ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_adBaseViewShiftLUT,  m_aiBaseViewShiftLUT,  m_adBaseViewShiftParameter,  m_aiBaseViewShiftParameter  );
+  xCreateLUTs   ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfSynthViews, m_adSynthViewShiftLUT, m_aiSynthViewShiftLUT, m_adSynthViewShiftParameter, m_aiSynthViewShiftParameter );
+  xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiCodedScale           );
+  xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiCodedOffset          );
+  xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiScaleAndOffsetSet    );
+  xInit2dArray  ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiScaleAndOffsetSet, 0 );
+
+  xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiPdmScaleNomDelta     );
+  xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiPdmOffset            );
+
+  //===== init disparity to virtual depth conversion parameters =====
+  xSetPdmConversionParams();
+
+  //===== init arrays for first frame =====
+  xSetShiftParametersAndLUT( m_uiFirstFrameId );
+}
+#endif//*/
+
 Void
 TAppComCamPara::check( Bool bCheckViewRange, Bool bCheckFrameRange )
@@ -1456,5 +1520,5 @@
 }
 
-#if POZNAN_SYNTH
+#if POZNAN_CU_SYNTH||POZNAN_CU_SKIP
 Bool
 TAppComCamPara::getNearestBaseView( Int iSynthViewIdx, Int &riNearestViewIdx, Int &riRelDistToLeft, Bool& rbRenderFromLeft)
Index: branches/0.2-poznan-univ/source/App/TAppCommon/TAppComCamPara.h
===================================================================
--- branches/0.2-poznan-univ/source/App/TAppCommon/TAppComCamPara.h	(revision 11)
+++ branches/0.2-poznan-univ/source/App/TAppCommon/TAppComCamPara.h	(revision 12)
@@ -104,4 +104,7 @@
   Int****             m_aiSynthViewShiftLUT;									///< Disparity LUT
 
+#if POZNAN_NONLINEAR_DEPTH
+  Float               m_fDepthPower;
+#endif
 
 protected:
@@ -161,5 +164,9 @@
                 Char*   pchSynthViewNumbers,
                 std::vector<Int>* paiSynthViewNumbers,
-                Int     iLog2Precision );
+                Int     iLog2Precision 
+#if POZNAN_NONLINEAR_DEPTH
+                ,Float  fDepthPower
+#endif
+                );
 
   Void init   ( UInt    uiInputBitDepth,
@@ -170,4 +177,7 @@
                 std::vector<Int>* paiSynthViewNumbers,
                 Int     iLog2Precision
+#if POZNAN_NONLINEAR_DEPTH
+                ,Float  fDepthPower
+#endif
               );
 
@@ -182,5 +192,5 @@
   Int                 synthRelNum2Idx           ( Int iRelNum );
   Bool getLeftRightBaseView( Int iSynthViewIdx, Int &riLeftViewIdx, Int &riRightViewIdx, Int &riRelDistToLeft, Bool& rbIsBaseView );
-#if POZNAN_SYNTH
+#if POZNAN_CU_SYNTH||POZNAN_CU_SKIP
   Bool getNearestBaseView( Int iSynthViewIdx, Int &riNearestViewIdx, Int &riRelDistToLeft, Bool& rbRenderFromLeft);
 #endif
@@ -189,4 +199,8 @@
   UInt                getCurFrameId             ()  { return m_iCurrentFrameId;   }
   static Void         convertNumberString       ( Char* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec );
+
+#if POZNAN_MP
+  Bool isLeftView( Int iSynthViewIdx, Int iNearestViewIdx);
+#endif
 
   // function for getting parameters and parameter arrays
Index: branches/0.2-poznan-univ/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- branches/0.2-poznan-univ/source/App/TAppDecoder/TAppDecTop.cpp	(revision 11)
+++ branches/0.2-poznan-univ/source/App/TAppDecoder/TAppDecTop.cpp	(revision 12)
@@ -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,5 +175,5 @@
     if( eNalUnitType == NAL_UNIT_SPS )
     {
-#if POZNAN_SYNTH
+#if POZNAN_CU_SKIP||POZNAN_CU_SYNTH
       if(cComSPS.getViewId()==0 && !cComSPS.isDepth()) // it should be called at first view at the begining of the stream
         initRenderer(cComSPS);
@@ -416,5 +428,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()->power(&cPicPower, 1.0f/pcSPS->getDepthPower());
+
+          m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write(&cPicPower, pcSPS->getPad());
+          cPicPower.destroy();		  
+#else
           m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() );
+#endif
         }
 
@@ -544,5 +570,5 @@
 }
 
-#if POZNAN_SYNTH
+#if POZNAN_CU_SYNTH || POZNAN_CU_SKIP
 Void TAppDecTop::initRenderer(TComSPS &cComSPS)
 {
@@ -566,5 +592,4 @@
   iNearestViewIdx = 0;
   bRenderFromLeft = iCoddedViewOrderIdx>0?true:false;
-  //m_cCamParsCollector.getNearestBaseView(iCoddedViewIdx, iNearestViewIdx, iRelDistToLeft, bRenderFromLeft);
 
   m_cAvailabilityRenderer.setShiftLUTs(
@@ -592,8 +617,23 @@
     pcPicYuvAvailView = pcPic->getPicYuvAvail();
   }
+#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
+  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];
+      ::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, false )->getPicYuvRec(), getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthView, pcPicYuvAvailView, bRenderFromLeft );
-
+      
   pcPicYuvAvailView->setBorderExtension( false );//Needed??
   pcPicYuvAvailView->extendPicBorder();//Needed??
@@ -613,5 +653,5 @@
   }
 #endif
-  
-}
-#endif
+
+}//*/
+#endif
Index: branches/0.2-poznan-univ/source/App/TAppDecoder/TAppDecTop.h
===================================================================
--- branches/0.2-poznan-univ/source/App/TAppDecoder/TAppDecTop.h	(revision 11)
+++ branches/0.2-poznan-univ/source/App/TAppDecoder/TAppDecTop.h	(revision 12)
@@ -52,8 +52,12 @@
 #include "../../Lib/TLibCommon/TComDepthMapGenerator.h"
 #include "../../Lib/TLibDecoder/TDecTop.h"
-#if POZNAN_SYNTH
+#if POZNAN_CU_SKIP || POZNAN_CU_SYNTH
 #include "../../Lib/TLibRenderer/TRenTop.h"
 #endif
 #include "TAppDecCfg.h"
+
+#if POZNAN_MP
+#include "../../Lib/TLibCommon/TComMP.h"
+#endif
 
 // ====================================================================================================================
@@ -90,8 +94,11 @@
 #endif
 
-#if POZNAN_SYNTH
+#if POZNAN_CU_SKIP || POZNAN_CU_SYNTH
   TRenTop                         m_cAvailabilityRenderer;
 #endif
 
+#if POZNAN_MP
+  TComMP*						  m_pcMP;
+#endif
 
 public:
@@ -105,5 +112,5 @@
   Void  startUsingDepth() ;
 
-#if POZNAN_SYNTH
+#if POZNAN_CU_SKIP || POZNAN_CU_SYNTH
   Void  initRenderer(TComSPS &cComSPS);
   Void  storeSynthPicsInBuffer(Int iCoddedViewIdx,Int iCoddedViewOrderIdx,Int iCurPoc,Bool bDepth);
@@ -120,4 +127,8 @@
 #endif
 
+#if POZNAN_MP
+  TComMP* getMP() { return m_pcMP; }
+#endif
+
 protected:
   Void  xCreateDecLib     (); ///< create internal classes
Index: branches/0.2-poznan-univ/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/0.2-poznan-univ/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 11)
+++ branches/0.2-poznan-univ/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 12)
@@ -127,4 +127,18 @@
 #endif
 
+#if POZNAN_STAT_JK
+  for(Int i = 0; i< m_pchStatFileList.size(); i++ )
+  {
+    if ( m_pchStatFileList[i] != NULL )
+      free (m_pchStatFileList[i]);
+  }
+
+  for(Int i = 0; i< m_pchDepthStatFileList.size(); i++ )
+  {
+    if ( m_pchDepthStatFileList[i] != NULL )
+      free (m_pchDepthStatFileList[i]);
+  }
+#endif
+
 }
 
@@ -346,8 +360,22 @@
 #endif
 #endif
+#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
+  ("textureCuDeltaQpOffset",              m_dTextureCuDeltaQpOffset,       (Double)(-2.6), "texture block QP changing tool based on coresponding depth block values - offset parameter" )
+  ("textureCuDeltaQpMul",                 m_dTextureCuDeltaQpMul,          (Double)(1),    "texture block QP changing tool based on coresponding depth block values - multiplicative parameter" )
+  ("textureCuDeltaQpOffsetTopBottomRow",  m_iTextureCuDeltaQpTopBottomRow, (Int)2,         "texture block QP changing tool - top and bottom CU rows delta QP parameter" )
+#endif
+#if POZNAN_NONLINEAR_DEPTH
+  ("DepthPower,-dpow",    m_fDepthPower,      1.0, "Depth power value (for non-linear processing)")
+#endif
+
 
   /* Compatability with old style -1 FOO or -0 FOO options. */
   ("1", doOldStyleCmdlineOn, "turn option <name> on")
   ("0", doOldStyleCmdlineOff, "turn option <name> off")
+
+#if POZNAN_STAT_JK
+  ("StatFile_%d,sf_%d",       m_pchStatFileList,       (char *) 0 , MAX_INPUT_VIEW_NUM , "Mode selection staticstics file name for view %d")
+  ("DepthStatFile_%d,sf_%d",  m_pchDepthStatFileList,  (char *) 0 , MAX_INPUT_VIEW_NUM , "Mode selection staticstics file name for depth view %d")
+#endif
   ;
 
@@ -396,4 +424,24 @@
 // GT FIX END
 
+#if POZNAN_STAT_JK
+  if ( m_bUsingDepthMaps )
+  {
+    for(Int i = 0; i < m_pchDepthStatFileList.size() ; i++)
+    {
+      if ((m_pchDepthInputFileList[i] != NULL) && (m_pchStatFileList[i] != NULL) && (i < m_iNumberOfViews) )
+      {
+        if (m_pchDepthStatFileList[i] == NULL )
+        {
+          xAppendToFileNameEnd( m_pchStatFileList[i], "_depth", m_pchDepthStatFileList[i] );
+        }
+      }
+      else
+      {
+        m_pchDepthStatFileList[i] = NULL;
+      }
+    };
+  }
+#endif  
+
   if (m_iRateGOPSize == -1)
   {
@@ -431,4 +479,21 @@
 #if HHI_VSO
   m_bUseVSO = m_bUseVSO && m_bUsingDepthMaps && (m_uiVSOMode != 0);
+#endif
+
+#if POZNAN_NONLINEAR_DEPTH
+if (m_fDepthPower<=0) 
+  {
+    Float fDepthQP = m_adQP[ m_adQP.size()  < 2 ? 0 : 1];
+    m_fDepthPower = (fDepthQP-30) *0.25/20.0 + 1.25;
+    if (m_fDepthPower<=1.0) m_fDepthPower = 1.0;
+    // QP = 30 = 1.25
+    // QP = 50 = 1.5
+    if (m_fDepthPower>=1.66) m_fDepthPower = 1.66;
+  };
+
+#if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE
+  m_fDepthPower = dequantizeDepthPower(quantizeDepthPower((Float)m_fDepthPower));
+#endif
+
 #endif
 
@@ -498,5 +563,9 @@
                                       NULL,
                                       m_cRenModStrParser.getSynthViews(),
-                                      LOG2_DISP_PREC_LUT );
+                                      LOG2_DISP_PREC_LUT 
+#if POZNAN_NONLINEAR_DEPTH                                      
+                                      ,m_fDepthPower
+#endif
+                                      );
 }
 else if ( m_bUseVSO && m_uiVSOMode != 4 )
@@ -511,5 +580,9 @@
                                       m_pchVSOConfig,
                                       NULL,
-                                      LOG2_DISP_PREC_LUT );
+                                      LOG2_DISP_PREC_LUT 
+#if POZNAN_NONLINEAR_DEPTH                                      
+                                      ,m_fDepthPower
+#endif                                      
+                                      );
 }
 else
@@ -524,5 +597,9 @@
     NULL,
     NULL,
-    LOG2_DISP_PREC_LUT );
+    LOG2_DISP_PREC_LUT 
+#if POZNAN_NONLINEAR_DEPTH                                      
+    ,m_fDepthPower
+#endif    
+    );
 }
 #else
@@ -536,5 +613,9 @@
     NULL,
     NULL,
-    LOG2_DISP_PREC_LUT );
+    LOG2_DISP_PREC_LUT 
+#if POZNAN_NONLINEAR_DEPTH                                      
+    ,m_fDepthPower
+#endif    
+    );
 #endif
 
@@ -668,4 +749,7 @@
     }
 #endif
+#if POZNAN_NONLINEAR_DEPTH
+    printf("Depth map power              : %f\n", m_fDepthPower );
+#endif
   }
 
@@ -820,4 +904,14 @@
     printf("Reconstruction Depth File %i  : %s\n", iCounter, m_pchDepthReconFileList[iCounter]);
   }
+#if POZNAN_STAT_JK
+  for( Int iCounter = 0; iCounter<m_iNumberOfViews; iCounter++)
+  {
+    printf("Statistics File %i        : %s\n", iCounter, m_pchStatFileList[iCounter]);
+  }
+  for( Int iCounter = 0; iCounter<m_iNumberOfViews; iCounter++)
+  {
+    printf("Statistics Depth File %i  : %s\n", iCounter, m_pchDepthStatFileList[iCounter]);
+  }
+#endif
   printf("Real     Format              : %dx%d %dHz\n", m_iSourceWidth - m_aiPad[0], m_iSourceHeight-m_aiPad[1], m_iFrameRate );
   printf("Internal Format              : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
@@ -912,4 +1006,46 @@
 #if MTK_SAO
 #endif
+
+#if POZNAN_MP
+  printf("POZNAN_MP(1){ ");
+
+#if POZNAN_MP_USE_DEPTH_MAP_GENERATION
+  printf("dmg=1 ");
+#else
+  printf("dmg=0 ");
+#endif
+
+#if POZNAN_MP_FILL
+  printf("fill=%d ",POZNAN_MP_FILL_TYPE);
+#else
+  printf("fill=- ");
+#endif
+
+#if POZNAN_EIVD
+  printf("EIVD(1): ");
+  printf("cand=%d ",POZNAN_EIVD_MERGE_POS);
+#if POZNAN_EIVD_CALC_PRED_DATA
+  printf("pr=1 ");
+#else
+  printf("pr=0 ");
+#endif
+#if POZNAN_EIVD_COMPRESS_ME_DATA
+  printf("comp=1 ");
+#else
+  printf("comp=0 ");
+#endif
+#if POZNAN_EIVD_USE_IN_NONANCHOR_PIC_ONLY
+  printf("na=1 ");
+#else
+  printf("na=0 ");
+#endif
+#else
+  printf("EIVD(0) ");
+#endif
+  printf("}");
+#else
+  printf("POZNAN_MP(0) ");
+#endif
+
   printf("\n");
   printf("TOOL CFG VIDEO  : ");
@@ -933,4 +1069,12 @@
 #endif
   printf("\n");
+
+  
+printf("POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH(");
+#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
+printf("1), ");
+#else
+printf("0), ");
+#endif
 
   fflush(stdout);
Index: branches/0.2-poznan-univ/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- branches/0.2-poznan-univ/source/App/TAppEncoder/TAppEncCfg.h	(revision 11)
+++ branches/0.2-poznan-univ/source/App/TAppEncoder/TAppEncCfg.h	(revision 12)
@@ -271,4 +271,20 @@
   TRenModSetupStrParser       m_cRenModStrParser;
 #endif
+
+#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
+  Double                      m_dTextureCuDeltaQpOffset;
+  Double                      m_dTextureCuDeltaQpMul;
+  Int                         m_iTextureCuDeltaQpTopBottomRow;
+#endif
+
+#if POZNAN_NONLINEAR_DEPTH
+  Double    m_fDepthPower;									  ///< Depth power value
+#endif
+
+#if POZNAN_STAT_JK
+  std::vector<char*>	   m_pchStatFileList;					///< texure statistics file names
+  std::vector<char*>	   m_pchDepthStatFileList;				///< depth statistics file names
+#endif
+
 public:
 
Index: branches/0.2-poznan-univ/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/0.2-poznan-univ/source/App/TAppEncoder/TAppEncTop.cpp	(revision 11)
+++ branches/0.2-poznan-univ/source/App/TAppEncoder/TAppEncTop.cpp	(revision 12)
@@ -141,4 +141,8 @@
     m_acTEncTopList[iViewIdx]->setUseFastEnc                   ( m_bUseFastEnc  );
 
+#if POZNAN_NONLINEAR_DEPTH
+    m_acTEncTopList[iViewIdx]->setDepthPower                   ( (Float)m_fDepthPower );
+#endif
+
 #if HHI_VSO
     m_acTEncTopList[iViewIdx]->setUseVSO                       ( false ); //GT: might be enabled later for VSO Mode 4
@@ -222,4 +226,11 @@
     m_acTEncTopList[iViewIdx]->setQpChangeOffsetVideo( m_iQpChangeOffsetVideo );
     m_acTEncTopList[iViewIdx]->setQpChangeOffsetDepth( m_iQpChangeOffsetDepth );
+
+    
+ #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
+    m_acTEncTopList[iViewIdx]->setTextureCuDeltaQpOffset( m_dTextureCuDeltaQpOffset );
+    m_acTEncTopList[iViewIdx]->setTextureCuDeltaQpMul( m_dTextureCuDeltaQpMul );
+    m_acTEncTopList[iViewIdx]->setTextureCuDeltaQpTopBottomRow( m_iTextureCuDeltaQpTopBottomRow );  
+#endif
   }
   if( m_bUsingDepthMaps )
@@ -382,4 +393,7 @@
       m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI );
 #endif
+#if POZNAN_NONLINEAR_DEPTH
+      m_acTEncDepthTopList[iViewIdx]->setDepthPower                   ( (Float)m_fDepthPower );
+#endif
 
       m_acTEncDepthTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled);
@@ -435,5 +449,5 @@
 #endif
 
-#if POZNAN_SYNTH
+#if POZNAN_CU_SYNTH||POZNAN_CU_SKIP
   //m_cAvailabilityRenderer.init(m_iSourceWidth, m_iSourceHeight,true,0,0,true, 0,0,0,0,0,0,0,1,0,0 );  //GT: simplest configuration
   m_cAvailabilityRenderer.init(m_iSourceWidth, m_iSourceHeight,true,0,LOG2_DISP_PREC_LUT,true, 0,0,0,0,0,6,4,1,0,6 );  //GT: simplest configuration
@@ -443,4 +457,14 @@
   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
+
+#if POZNAN_MP
+#if POZNAN_MP_USE_DEPTH_MAP_GENERATION
+  m_pcMP = new TComMP(m_iSourceHeight, m_iSourceWidth);
+#else
+  //m_pcMP = new TComMP(m_iSourceHeight, m_iSourceWidth, &m_cCameraData);
+  m_pcMP = new TComMP(m_iSourceHeight, m_iSourceWidth, m_cCameraData.getBaseViewShiftLUTI());
+#endif
+#endif
+
 }
 
@@ -484,4 +508,16 @@
   }
 #endif
+
+#if POZNAN_STAT_JK
+  for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++)
+  {
+	if(m_pchStatFileList[iViewIdx] != NULL) m_cStatFileList.push_back(fopen(m_pchStatFileList[iViewIdx],"w"));
+	else m_cStatFileList.push_back(NULL);
+
+	if ( m_bUsingDepthMaps && m_pchDepthStatFileList[iViewIdx] != NULL) m_cDepthStatFileList.push_back(fopen(m_pchDepthStatFileList[iViewIdx],"w"));
+	else m_cDepthStatFileList.push_back(NULL);
+  }
+#endif  
+
 }
 
@@ -490,4 +526,16 @@
 
   m_cTVideoIOBitsFile.closeBits();
+
+#if POZNAN_MP
+  if (m_pcMP) { delete m_pcMP; m_pcMP=NULL; };
+#endif
+
+#if POZNAN_STAT_JK
+  for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfExternalRefs; iViewIdx++ )
+  {
+	  if(m_cStatFileList[iViewIdx]) {fclose(m_cStatFileList[iViewIdx]); m_cStatFileList[iViewIdx]=NULL;}
+	  if(m_cDepthStatFileList[iViewIdx]) {fclose(m_cDepthStatFileList[iViewIdx]); m_cDepthStatFileList[iViewIdx]=NULL;}
+  }
+#endif
 
 #if HHI_VSO
@@ -545,4 +593,10 @@
     m_acTEncTopList[iViewIdx]->setTEncTopList( &m_acTEncTopList  );
   }
+#if POZNAN_STAT_JK
+  for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
+  {
+    m_acTEncTopList[iViewIdx]->setStatFile(m_cStatFileList[iViewIdx]);//JK
+  }
+#endif
   if ( m_bUsingDepthMaps )
   {
@@ -555,4 +609,10 @@
       m_acTEncDepthTopList[iViewIdx]->setTEncTopList( &m_acTEncDepthTopList  );
     }
+#if POZNAN_STAT_JK
+  for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
+  {
+    m_acTEncDepthTopList[iViewIdx]->setStatFile(m_cDepthStatFileList[iViewIdx]);//JK
+  }
+#endif
   }
 }
@@ -645,4 +705,7 @@
         {
           m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcPdmDepthOrg, m_aiPad, m_bUsingDepthMaps );
+#if POZNAN_NONLINEAR_DEPTH
+          pcPdmDepthOrg->power(pcPdmDepthOrg, m_fDepthPower);		  
+#endif
         }
 #endif
@@ -666,4 +729,7 @@
           // read input YUV file
           m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcDepthPicYuvOrg, m_aiPad  ) ;
+#if POZNAN_NONLINEAR_DEPTH
+          pcDepthPicYuvOrg->power(pcDepthPicYuvOrg, m_fDepthPower);		  
+#endif
           bDepthEos[iViewIdx] = ( m_acTVideoIOYuvDepthInputFileList[iViewIdx]->isEof() == 1 ?   true : false  );
           bDepthEos[iViewIdx] = ( m_iDepthFrameRcvdVector[iViewIdx] == (m_iFrameToBeEncoded - 1) ?    true : bDepthEos[iViewIdx]   );
@@ -697,5 +763,5 @@
     for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )     // Start encoding
     {
-#if POZNAN_SYNTH
+#if POZNAN_CU_SYNTH||POZNAN_CU_SKIP
       xStoreSynthPicsInBuffer(iViewIdx,false);
 #endif
@@ -716,5 +782,5 @@
       if( m_bUsingDepthMaps )
       {
-#if POZNAN_SYNTH
+#if POZNAN_CU_SYNTH||POZNAN_CU_SKIP
         xStoreSynthPicsInBuffer(iViewIdx,true);
 #endif
@@ -939,4 +1005,16 @@
   {
     riNextPocToDump++;
+#if POZNAN_NONLINEAR_DEPTH
+    if(isDepth)
+    {
+      TComPicYuv *pcPicOrg = i->second;
+      TComPicYuv *pcPicPow = new TComPicYuv; 
+      //pcPicYuvRec->createCompatibleAs(*iterPicYuvRec);
+      pcPicPow->create( pcPicOrg->getWidth(), pcPicOrg->getHeight(), pcPicOrg->getMaxCuWidth(), pcPicOrg->getMaxCuHeight(), pcPicOrg->getMaxCuDepth() );
+      //cPicPower.create(pcSPS->getWidth(), pcSPS->getHeight(), pcSPS->getMaxCUWidth(), pcSPS->getMaxCUHeight(), pcSPS->getMaxCUDepth() ); 
+      pcPicOrg->power(pcPicPow, (Float)(1.0/m_fDepthPower));		
+      rpcTVideoIOYuvReconFile->write( pcPicPow, m_aiPad );
+    } else
+#endif
     rpcTVideoIOYuvReconFile->write( i->second, m_aiPad );
     rcMap.erase( i );
@@ -1188,6 +1266,6 @@
 #endif
 
-#if POZNAN_SYNTH
-Void TAppEncTop::xStoreSynthPicsInBuffer(Int iCoddedViewIdx,Bool bDepth)
+#if POZNAN_CU_SYNTH||POZNAN_CU_SKIP
+Void TAppEncTop::xStoreSynthPicsInBuffer(Int iCoddedViewIdx, Bool bDepth)
 {
   Int iCurPoc;
@@ -1200,7 +1278,6 @@
   {
     iCurPoc = m_acTEncTopList[ iCoddedViewIdx ]->getNextFrameId();
-    if (!(m_acTEncTopList[ iCoddedViewIdx ]->currentPocWillBeCoded())) return;
-  }
-  
+  if (!(m_acTEncTopList[ iCoddedViewIdx ]->currentPocWillBeCoded())) return;
+
   Int iNumberOfReferenceViews = 0;
   UInt iSynthViewIdx;
@@ -1221,23 +1298,30 @@
 
   m_cAvailabilityRenderer.setShiftLUTs(
-    m_cCameraData.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],
-    m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
-    m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
-    m_cCameraData.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],//right
-    m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
-    m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
-    iRelDistToLeft
-  );
-    
+        m_cCameraData.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],
+        m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
+        m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
+        m_cCameraData.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],//right
+        m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
+        m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
+        iRelDistToLeft
+      );
 
   TComPicYuv* pcPicYuvERView = new TComPicYuv;
   pcPicYuvERView->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
-
   TComPic* pcPic = xGetPicFromView( iCoddedViewIdx, iCurPoc, bDepth );
   pcPic->addSynthesisBuffer();
   pcPic->addAvailabilityBuffer();
+#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
+      pcPic->addSynthesisDepthBuffer();
+      TComPicYuv* pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth();
+      m_cAvailabilityRenderer.extrapolateAvailabilityView( xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthDepthView, pcPic->getPicYuvAvail(), bRenderFromLeft );
+#if POZNAN_OUTPUT_SYNTH
+      Char acFilenameBaseD[1024];
+      ::sprintf( acFilenameBaseD,  "SynthDepth_%s_V%d.yuv", ( false ? "Dec" : "Enc" ),iCoddedViewIdx );
+      pcPicYuvSynthDepthView->dump(acFilenameBaseD, iCurPoc!=0);
+#endif
+#endif
   TComPicYuv* pcPicYuvSynthView = pcPic->getPicYuvSynth();
   TComPicYuv* pcPicYuvAvailView = pcPic->getPicYuvAvail();
-  
   //m_cAvailabilityRenderer.extrapolateAvailabilityView( xGetPicFromView( iNearestViewIdx, iCurPoc, false )->getPicYuvRec(), xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvERView, pcPicYuvAvailView, bRenderFromLeft );
   m_cAvailabilityRenderer.extrapolateAvailabilityView( xGetPicFromView( iNearestViewIdx, iCurPoc, bDepth )->getPicYuvRec(), xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthView, pcPicYuvAvailView, bRenderFromLeft );
@@ -1256,7 +1340,7 @@
 #if POZNAN_OUTPUT_AVAILABLE_MAP
   {
-  Char acFilenameBase[1024];
-  ::sprintf( acFilenameBase,  "Available_%s_%s_V%d.yuv", (bDepth?"Depth":"Tex"),( false ? "Dec" : "Enc" ),iCoddedViewIdx );
-  pcPicYuvAvailView->dump(acFilenameBase, iCurPoc!=0);
+    Char acFilenameBase[1024];
+    ::sprintf( acFilenameBase,  "Available_%s_%s_V%d.yuv", (bDepth?"Depth":"Tex"),( false ? "Dec" : "Enc" ),iCoddedViewIdx );
+    pcPicYuvAvailView->dump(acFilenameBase, iCurPoc!=0);
   }
 #endif
@@ -1268,6 +1352,4 @@
   }
 #endif
-
-      //Usun pcPicYuvERView i inne bufforki
 }
 #endif
Index: branches/0.2-poznan-univ/source/App/TAppEncoder/TAppEncTop.h
===================================================================
--- branches/0.2-poznan-univ/source/App/TAppEncoder/TAppEncTop.h	(revision 11)
+++ branches/0.2-poznan-univ/source/App/TAppEncoder/TAppEncTop.h	(revision 12)
@@ -51,4 +51,8 @@
 //GT VSO end
 
+#if POZNAN_MP
+#include "../../Lib/TLibCommon/TComMP.h"
+#endif	
+
 // ====================================================================================================================
 // Class definition
@@ -92,6 +96,15 @@
 #endif
 
-#if POZNAN_SYNTH
+#if POZNAN_CU_SKIP||POZNAN_CU_SYNTH
   TRenTop                     m_cAvailabilityRenderer;
+#endif
+
+#if POZNAN_MP
+  TComMP*				  m_pcMP;
+#endif
+
+#if POZNAN_STAT_JK
+  std::vector<FILE*>       m_cStatFileList;					    ///< texure statistics file handles
+  std::vector<FILE*>       m_cDepthStatFileList;				///< depth statistics file handles
 #endif
 
@@ -149,4 +162,8 @@
 #endif
 
+#if POZNAN_MP
+  TComMP* getMP() {return m_pcMP;}
+#endif
+
 #if HHI_VSO
 private:
@@ -160,5 +177,5 @@
 
 
-#if POZNAN_SYNTH
+#if POZNAN_CU_SYNTH
 private:
   Void  xStoreSynthPicsInBuffer(Int iCoddedViewIdx, Bool bDepth);
Index: branches/0.2-poznan-univ/source/App/TAppRenderer/TAppRendererCfg.cpp
===================================================================
--- branches/0.2-poznan-univ/source/App/TAppRenderer/TAppRendererCfg.cpp	(revision 11)
+++ branches/0.2-poznan-univ/source/App/TAppRenderer/TAppRendererCfg.cpp	(revision 12)
@@ -186,5 +186,9 @@
   {
     m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
-      m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );
+      m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, NULL, m_iLog2SamplingFactor+m_iShiftPrecision
+#if POZNAN_NONLINEAR_DEPTH      
+      ,1.0f 
+#endif
+      );
     m_iNumberOfInputViews  = (Int) m_cCameraData.getBaseViewNumbers() .size();
     m_iNumberOfOutputViews = m_iNumberOfInputViews - 1;
@@ -205,10 +209,18 @@
 
   m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
-      m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, piaTempViews, m_iLog2SamplingFactor+m_iShiftPrecision );
+      m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, piaTempViews, m_iLog2SamplingFactor+m_iShiftPrecision
+#if POZNAN_NONLINEAR_DEPTH
+      , 1.0f 
+#endif
+      );
   }
   else
   {
   m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
-      m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, m_pchSynthViewCameraNumbers, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );
+      m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, m_pchSynthViewCameraNumbers, NULL, m_iLog2SamplingFactor+m_iShiftPrecision
+#if POZNAN_NONLINEAR_DEPTH
+      ,1.0f 
+#endif
+      );
   m_iNumberOfOutputViews = (Int) m_cCameraData.getSynthViewNumbers().size();
   m_iNumberOfInputViews  = (Int) m_cCameraData.getBaseViewNumbers() .size();
