Index: branches/0.3-poznan-univ/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- branches/0.3-poznan-univ/source/App/TAppDecoder/TAppDecTop.cpp	(revision 47)
+++ branches/0.3-poznan-univ/source/App/TAppDecoder/TAppDecTop.cpp	(revision 48)
@@ -739,6 +739,4 @@
 Void TAppDecTop::storeSynthPicsInBuffer(Int iCoddedViewIdx,Int iCoddedViewOrderIdx, Int iCurPoc, Bool bDepth)
 {
-  Int  iLeftViewIdx  = -1;
-  Int  iRightViewIdx = -1;
   Int  iNearestViewIdx = -1;
   Bool bRenderFromLeft;
@@ -830,6 +828,4 @@
 Void TAppDecTop::storeDepthSynthPicsInBuffer(Int iCoddedViewIdx,Int iCoddedViewOrderIdx, Int iCurPoc)
 {
-  Int  iLeftViewIdx  = -1;
-  Int  iRightViewIdx = -1;
   Int  iNearestViewIdx = -1;
   Bool bRenderFromLeft;
Index: branches/0.3-poznan-univ/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/0.3-poznan-univ/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 47)
+++ branches/0.3-poznan-univ/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 48)
@@ -523,16 +523,19 @@
       size = m_iSourceWidth*m_iSourceHeight;
       depth_buf = (unsigned char *)malloc(size);
-      fread(depth_buf, 1, size, base_depth_file);
+      size_t read = fread(depth_buf, 1, size, base_depth_file);
       fclose(base_depth_file);
-      memset(histogram, 0, sizeof(histogram));
-      for (i=0; i<size;++i) histogram[depth_buf[i]]++;
-      weighted_avg = 0;
-      for (i=0; i<256; ++i) weighted_avg += i*histogram[i];
-      weighted_avg /= size;
-
-      if (weighted_avg<m_iNonlinearDepthThreshold)
+      if(read)
       {
-        m_bUseNonlinearDepth = 0;
-        printf ("\nWeighted average of depth histogram:%f < %d, turning NonlinearDepthRepresentation OFF\n", weighted_avg, m_iNonlinearDepthThreshold);
+        memset(histogram, 0, sizeof(histogram));
+        for (i=0; i<size;++i) histogram[depth_buf[i]]++;
+        weighted_avg = 0;
+        for (i=0; i<256; ++i) weighted_avg += i*histogram[i];
+        weighted_avg /= size;
+
+        if (weighted_avg<m_iNonlinearDepthThreshold)
+        {
+          m_bUseNonlinearDepth = 0;
+          printf ("\nWeighted average of depth histogram:%f < %d, turning NonlinearDepthRepresentation OFF\n", weighted_avg, m_iNonlinearDepthThreshold);
+        }
       }
     }
@@ -542,6 +545,19 @@
   if(m_bUseNonlinearDepth)
   {
+     if((Int)m_aiNonlinearDepthModel.size()== 0)
+     {
+       m_aiNonlinearDepthModel.push_back(10);
+       m_aiNonlinearDepthModel.push_back(19);
+       m_aiNonlinearDepthModel.push_back(24);
+       m_aiNonlinearDepthModel.push_back(27);
+       m_aiNonlinearDepthModel.push_back(26);
+       m_aiNonlinearDepthModel.push_back(22);
+       m_aiNonlinearDepthModel.push_back(13);
+     }
+    //10,19,24,27,26,22,13
     m_cNonlinearDepthModel.m_iNum = (Int)m_aiNonlinearDepthModel.size();
+   
     m_cNonlinearDepthModel.m_aiPoints[0]=0;
+
     for (int i=0; i<m_cNonlinearDepthModel.m_iNum; ++i)
       m_cNonlinearDepthModel.m_aiPoints[i+1] = m_aiNonlinearDepthModel[i];
Index: branches/0.3-poznan-univ/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/0.3-poznan-univ/source/App/TAppEncoder/TAppEncTop.cpp	(revision 47)
+++ branches/0.3-poznan-univ/source/App/TAppEncoder/TAppEncTop.cpp	(revision 48)
@@ -150,4 +150,7 @@
 #endif
 
+#if BITSTREAM_EXTRACTION
+    m_acTEncTopList[iViewIdx]->setLayerId                      ( ( (UInt)iViewIdx ) << 1 );
+#endif
     m_acTEncTopList[iViewIdx]->setViewId                       ( (UInt)iViewIdx );
     m_acTEncTopList[iViewIdx]->setViewOrderIdx                 ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );
@@ -359,11 +362,21 @@
 #endif
 
+#if BITSTREAM_EXTRACTION
+      m_acTEncDepthTopList[iViewIdx]->setLayerId                      ( ( ( (UInt)iViewIdx ) << 1 ) + 1 );
+#endif
       m_acTEncDepthTopList[iViewIdx]->setViewId                       ( (UInt)iViewIdx );
       m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx                 ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );
       m_acTEncDepthTopList[iViewIdx]->setIsDepth                      ( true );
+#if FLEX_CODING_ORDER
+      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
 #if DEPTH_MAP_GENERATION
       m_acTEncDepthTopList[iViewIdx]->setPredDepthMapGeneration       ( 0 );
@@ -794,7 +807,13 @@
           iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
           bThisViewContinueReadingPics = bContinueReadingPics[iViewIdx];
+#if POZNAN_SYNTH
+          if( m_uiUseCUSkip )
+          {
+            xStoreSynthPicsInBuffer(iViewIdx,false);
+          }
+#endif
 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
           // If no depth picture reconstruction for current view and current POC is available sythesize one
-          Int   iCurrPoc         = m_acTEncTopList[ 0 ]->getNextFrameId();
+          //Int   iCurrPoc2         = m_acTEncTopList[ 0 ]->getNextFrameId();
           Bool  bCurrPicDepthRec = getPicFromView( iViewIdx, iCurrPoc, true ) != NULL && getPicFromView( iViewIdx, iCurrPoc, true )->getReconMark();
           if(m_bUseTexDqpAccordingToDepth && !bCurrPicDepthRec)
@@ -825,4 +844,10 @@
             iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
             bThisViewContinueReadingDepthPics = bContinueReadingDepthPics[iViewIdx];
+#if POZNAN_SYNTH
+            if( m_uiUseCUSkip )
+            {
+              xStoreSynthPicsInBuffer(iViewIdx,true);
+            }
+#endif
             m_acTEncDepthTopList[iViewIdx]->encode( bDepthEos[iViewIdx], m_cListPicYuvDepthRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingDepthPics );
             bContinueReadingDepthPics[iViewIdx]=bThisViewContinueReadingDepthPics;
@@ -858,5 +883,5 @@
 #if FLEX_CODING_ORDER
       // If no depth picture reconstruction for current view and current POC is available sythesize one
-      Int   iCurrPoc         = m_acTEncTopList[ 0 ]->getNextFrameId();
+      //Int   iCurrPoc         = m_acTEncTopList[ 0 ]->getNextFrameId();
       Bool  bCurrPicDepthRec = getPicFromView( iViewIdx, iCurrPoc, true ) != NULL && getPicFromView( iViewIdx, iCurrPoc, true )->getReconMark();
       if(m_bUseTexDqpAccordingToDepth && !bCurrPicDepthRec)
@@ -1390,5 +1415,4 @@
   }
   
-  Int iNumberOfReferenceViews = 0;
   Int  iNearestViewIdx = -1;
   Bool bRenderFromLeft;
@@ -1477,6 +1501,4 @@
 Void TAppEncTop::xStoreDepthSynthPicsInBuffer(Int iCoddedViewIdx)
 {
-  Int  iLeftViewIdx  = -1;
-  Int  iRightViewIdx = -1;
   Int  iNearestViewIdx = -1;
   Bool bRenderFromLeft;
Index: branches/0.3-poznan-univ/source/App/TAppRenderer/TAppRendererTop.cpp
===================================================================
--- branches/0.3-poznan-univ/source/App/TAppRenderer/TAppRendererTop.cpp	(revision 47)
+++ branches/0.3-poznan-univ/source/App/TAppRenderer/TAppRendererTop.cpp	(revision 48)
@@ -308,6 +308,6 @@
             else
             {
-              Int iDistLeft  = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx ]  );
-              Int iDistRight = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iRightBaseViewIdx]  );
+              //Int iDistLeft  = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iLeftBaseViewIdx ]  );
+              //Int iDistRight = abs( m_cCameraData.getBaseId2SortedId()[0] - m_cCameraData.getBaseId2SortedId() [iRightBaseViewIdx]  );
 
               Int iFillViewIdx = (0!=iLeftBaseViewIdx)? iLeftBaseViewIdx: iRightBaseViewIdx;
