Index: branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 28)
+++ branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 41)
@@ -348,14 +348,16 @@
 #endif
 #if POZNAN_NONLINEAR_DEPTH
-      // Depth power coefficient
-#if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE
-      UInt  uiCode = quantizeDepthPower(pcSPS->getDepthPower());  
-      xWriteCode(uiCode, 8); 
-#else
-      float fCode  = pcSPS->getDepthPower();
-      UInt  uiCode = *((UInt*)&fCode);
-      //uiCode &= ~0x80000000;
-      xWriteCode(uiCode, sizeof(float)*8); // we do not send sign?;
-#endif
+      if( pcSPS->getUseNonlinearDepth() )
+      {
+        xWriteFlag( 1 ); //Nonlinear Depth Representation
+        // Nonlinear Depth Model coefficient
+        xWriteUvlc(pcSPS->getNonlinearDepthModel().m_iNum);
+        for (int i=1; i<=pcSPS->getNonlinearDepthModel().m_iNum; ++i)
+          xWriteUvlc(pcSPS->getNonlinearDepthModel().m_aiPoints[i]);
+      }
+      else
+      {
+        xWriteFlag( 0 ); // Don't use Nonlinear Depth Representation
+      }
 #endif
     }
Index: branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCfg.h	(revision 28)
+++ branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCfg.h	(revision 41)
@@ -159,4 +159,7 @@
   Bool m_bUseDMM;
 #endif
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+  Bool m_bUseDMM34;
+#endif
 #if HHI_MPI
   Bool m_bUseMVI;
@@ -232,5 +235,6 @@
 #endif
 #if POZNAN_NONLINEAR_DEPTH
-  Float 	m_fDepthPower;
+  TComNonlinearDepthModel  m_cNonlinearDepthModel;
+  Bool        m_bUseNonlinearDepth;
 #endif
 
@@ -335,8 +339,9 @@
 
 #if POZNAN_NONLINEAR_DEPTH
-  inline Float   getDepthPower()               { return m_fDepthPower; }
-  inline Void    setDepthPower(Float p)        { m_fDepthPower = p; }
-#else
- inline Float    getDepthPower()               { return 1.0f; }
+  inline TComNonlinearDepthModel&   getNonlinearDepthModel()                                    { return m_cNonlinearDepthModel; }
+  inline Void                       setNonlinearDepthModel( TComNonlinearDepthModel &rp )       { m_cNonlinearDepthModel = rp; }
+
+  Void                              setUseNonlinearDepth  ( Bool bVal )                         { m_bUseNonlinearDepth = bVal; }
+  bool                              getUseNonlinearDepth  ()                                    { return m_bUseNonlinearDepth; }
 #endif
 
@@ -457,5 +462,8 @@
   Bool getUseDMM()        { return m_bUseDMM; }
 #endif
-
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+  Void setUseDMM34( Bool b) { m_bUseDMM34 = b;    }
+  Bool getUseDMM34()        { return m_bUseDMM34; }
+#endif
 #if LM_CHROMA
   Bool getUseLMChroma                       ()      { return m_bUseLMChroma;        }
Index: branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 28)
+++ branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 41)
@@ -175,7 +175,10 @@
 // GT FIX
   std::vector<TComPic*> apcSpatRefPics = m_pcEncTop->getEncTop()->getSpatialRefPics( pcPic->getViewIdx(), pcSlice->getPOC(), m_pcEncTop->isDepthCoder() );
-  TComPic * const pcTexturePic = m_pcEncTop->isDepthCoder() ? m_pcEncTop->getEncTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), false ) : NULL;
+  TComPic * const pcTexturePic = ( m_pcEncTop->isDepthCoder()) ? m_pcEncTop->getEncTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), false ) : NULL;
+  TComPic * const pcDepthPic   = (!m_pcEncTop->isDepthCoder()) ? m_pcEncTop->getEncTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), true  ) : NULL; 
   assert( ! m_pcEncTop->isDepthCoder() || pcTexturePic != NULL );
+  assert(   m_pcEncTop->isDepthCoder() || pcDepthPic   != NULL );
   pcSlice->setTexturePic( pcTexturePic );
+  pcSlice->setDepthPic  ( pcDepthPic   );
 
   pcSlice->setRefPicListFromGOPSTring( rcListPic, apcSpatRefPics );
Index: branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 28)
+++ branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 41)
@@ -1178,4 +1178,11 @@
 #endif
 #if HHI_DMM_PRED_TEX
+#if FLEX_CODING_ORDER
+    if ( !pcCU->getSlice()->getSPS()->getUseDMM34() )
+    {
+      assert( uiDir != DMM_WEDGE_PREDTEX_D_IDX );
+      assert( uiDir != DMM_CONTOUR_PREDTEX_D_IDX );
+    }
+#endif
     if( uiDir == DMM_WEDGE_PREDTEX_D_IDX )     { xCodeWedgePredTexDeltaInfo  ( pcCU, uiAbsPartIdx ); }
     if( uiDir == DMM_CONTOUR_PREDTEX_D_IDX )   { xCodeContourPredTexDeltaInfo( pcCU, uiAbsPartIdx ); }
Index: branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 28)
+++ branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 41)
@@ -1934,4 +1934,8 @@
 #endif
 #if HHI_DMM_PRED_TEX
+#if FLEX_CODING_ORDER
+      if ( pcCU->getSlice()->getSPS()->getUseDMM34() )
+      {
+#endif
       TComYuv cTempYuv; cTempYuv.create( uiWidth, uiHeight ); cTempYuv.clear();
       Pel* piTempY      = cTempYuv.getLumaAddr();
@@ -1968,4 +1972,7 @@
 
       cTempYuv.destroy();
+#if FLEX_CODING_ORDER
+      }
+#endif
 #endif
     }
@@ -1996,5 +2003,9 @@
 #else
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+      if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getUseDMM34() ) )
+#else
       if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight ) )
+#endif
         continue;
 #endif
@@ -2084,5 +2095,9 @@
 #else
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+      if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getUseDMM34() ) )
+#else
       if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight ) )
+#endif
         continue;
 #endif
@@ -2727,5 +2742,9 @@
 }
 
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight, Bool bDMMAvailable34 )
+#else
 Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight )
+#endif
 {
   if( uiMode <= MAX_MODE_ID_INTRA_DIR ) return true;
@@ -2755,4 +2774,10 @@
       bDMMAvailable = false;
     }
+#if FLEX_CODING_ORDER
+    if ( !bDMMAvailable34 )
+    {
+      bDMMAvailable = false;
+    }
+#endif
   }
 
Index: branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.h	(revision 28)
+++ branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.h	(revision 41)
@@ -210,5 +210,10 @@
   Bool predIntraLumaDMMAvailable( UInt         uiMode, 
                                   UInt         uiWidth, 
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+                                  UInt         uiHeight, 
+                                  Bool         bDMMAvailable34 );
+#else
                                   UInt         uiHeight );
+#endif
 #endif
 #if HHI_DMM_WEDGE_INTRA
Index: branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncTop.cpp	(revision 28)
+++ branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncTop.cpp	(revision 41)
@@ -304,6 +304,9 @@
 
   bool bSomethingCoded = false ;
-
+#if FLEX_CODING_ORDER  
+  if (TEncTop::m_bPicWaitingForCoding )
+#else
   if (m_bPicWaitingForCoding )
+#endif
   {
     std::map<Int, TComPic*>::iterator cIter = m_acInputPicMap.find( (Int)m_cSeqIter.getPoc() );
@@ -659,7 +662,8 @@
 #endif
 
-#if POZNAN_NONLINEAR_DEPTH
-  m_cSPS.setDepthPower  ( m_fDepthPower );
-  // OLGIERD: ToDo - QP-Tex should not use getDepthPower() from texture SPS.
+#if POZNAN_NONLINEAR_DEPTH 
+  m_cSPS.setNonlinearDepthModel  ( m_cNonlinearDepthModel );
+  m_cSPS.setUseNonlinearDepth    ( m_bUseNonlinearDepth );
+  // OLGIERD: ToDo - QP-Tex should not use getNonlinearDepthModel() from texture SPS.
 #endif
 
