Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.cpp	(revision 193)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.cpp	(revision 213)
@@ -82,5 +82,5 @@
 Void TAppDecTop::decode()
 {
-#if VIDYO_VPS_INTEGRATION
+#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
   increaseNumberOfViews( 0, 0, 0 );
 #else
@@ -88,4 +88,12 @@
 #endif
   
+#if FLEX_CODING_ORDER_M23723
+  Int iDepthViewIdx = 0;
+  Int iTextureViewIdx=0;
+  Bool firstFrame=1;
+  Bool viewIdZero=true;
+  Int fcoIndex=0;  //when the current frame is not first frame,use FCO_index stand for viewDepth. 
+#endif
+
 #if SONY_COLPIC_AVAILABILITY
   m_tDecTop[0]->setViewOrderIdx(0);
@@ -102,4 +110,12 @@
     pcListPic[i] = NULL;
     newPicture[i] = false;
+#if FLEX_CODING_ORDER_M23723
+#if  FIX_FCO_COMP_WARNING
+    m_fcoOrder[i] = ' ';
+#else
+    m_fcoOrder[i]=NULL;
+#endif
+#endif
+
   }
 
@@ -145,4 +161,9 @@
     {
       read(nalu, nalUnit);
+#if QC_MVHEVC_B0046
+    viewDepthId = nalu.m_layerId;
+    Int depth = 0;
+    Int viewId = viewDepthId;
+#else
 #if VIDYO_VPS_INTEGRATION
       Int viewId = 0;
@@ -156,15 +177,114 @@
         depth = getVPSAccess()->getActiveVPS()->getDepthFlag(nalu.m_layerId);
       }
+#if FLEX_CODING_ORDER_M23723
+      if (viewId>0)
+      {
+        viewIdZero=false;
+      }
+      if (viewIdZero==false&&viewId==0)
+      {
+        firstFrame=0; //if viewId has been more than zero and now it set to zero again, we can see that it is not the first view
+      }
+      if (firstFrame)
+      { // if the current view is first frame, we set the viewDepthId as texture plus depth and get the FCO order 
+        viewDepthId = iDepthViewIdx+iTextureViewIdx;
+        m_fcoViewDepthId=viewDepthId;
+      }
+      else
+      {//if current view is not first frame, we set the viewDepthId depended on the FCO order
+        viewDepthId=0;
+        if (depth)
+        {
+          for (fcoIndex=0;fcoIndex<2*MAX_VIEW_NUM;fcoIndex++ )
+          {
+            if (m_fcoOrder[fcoIndex]=='D')
+            {
+              if (viewId==viewDepthId)
+                break;
+              else
+                viewDepthId++;
+            }
+          }
+        }
+        else
+        {
+          for (fcoIndex=0;fcoIndex<2*MAX_VIEW_NUM;fcoIndex++ )
+          {
+            if (m_fcoOrder[fcoIndex]=='T')
+            {
+              if (viewId==viewDepthId)
+                break;
+              else
+                viewDepthId++;
+            }
+          }
+        }
+
+        viewDepthId=fcoIndex;
+
+      }
+
+
+#else
       viewDepthId = nalu.m_layerId;   // coding order T0D0T1D1T2D2
+#endif
+    
 #else
       Int viewId = nalu.m_viewId;
       Int depth = nalu.m_isDepth ? 1 : 0;
+#if FLEX_CODING_ORDER_M23723
+      if (viewId>0)
+      {
+        viewIdZero=false;
+      }
+      if (viewIdZero==false&&viewId==0)
+      {
+        firstFrame=0;
+      }
+      if (firstFrame)
+      {
+        viewDepthId = iDepthViewIdx+iTextureViewIdx;
+        m_fcoViewDepthId=viewDepthId;
+      }
+      else
+      {
+        viewDepthId=0;
+        if (depth)
+        {
+          for (fcoIndex=0;fcoIndex<2*MAX_VIEW_NUM;fcoIndex++ )
+          {
+            if (m_fcoOrder[fcoIndex]=='D')
+            {
+              if (viewId==viewDepthId)
+                break;
+              else
+                viewDepthId++;
+            }
+          }
+        }
+        else
+        {
+          for (fcoIndex=0;fcoIndex<2*MAX_VIEW_NUM;fcoIndex++ )
+          {
+            if (m_fcoOrder[fcoIndex]=='T')
+            {
+              if (viewId==viewDepthId)
+                break;
+              else
+                viewDepthId++;
+            }
+          }
+        }
+        viewDepthId=fcoIndex;
+      }
+#else
       viewDepthId = viewId * 2 + depth;   // coding order T0D0T1D1T2D2
 #endif
-      
+#endif
+#endif
       newPicture[viewDepthId] = false;
       if( viewDepthId >= m_tDecTop.size() )      
       {
-#if VIDYO_VPS_INTEGRATION
+#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
         increaseNumberOfViews( viewDepthId, viewId, depth );
 #else
@@ -195,4 +315,14 @@
       if( !(m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) )
       {
+#if QC_MVHEVC_B0046
+        if(viewDepthId && m_tDecTop[viewDepthId]->m_bFirstNal== false)
+        {
+          m_tDecTop[viewDepthId]->m_bFirstNal = true;
+          ParameterSetManagerDecoder* pDecV0 = m_tDecTop[0]->xGetParaSetDec();
+          m_tDecTop[viewDepthId]->xCopyVPS(pDecV0->getPrefetchedVPS(0));
+          m_tDecTop[viewDepthId]->xCopySPS(pDecV0->getPrefetchedSPS(0));
+          m_tDecTop[viewDepthId]->xCopyPPS(pDecV0->getPrefetchedPPS(0));
+        }
+#endif
         newPicture[viewDepthId] = m_tDecTop[viewDepthId]->decode(nalu, m_iSkipFrame, m_pocLastDisplay[viewDepthId]);
         if (newPicture[viewDepthId])
@@ -209,4 +339,20 @@
         {
           previousPictureDecoded = true;
+#if FLEX_CODING_ORDER_M23723
+        if (firstFrame)
+        {
+            if (depth)
+            {
+                iDepthViewIdx++;
+                m_fcoOrder[viewDepthId]='D';
+            }
+            else
+           {
+                iTextureViewIdx++;
+                m_fcoOrder[viewDepthId]='T';
+           }
+          }
+
+#endif
         }
       }
@@ -218,5 +364,10 @@
     if( pcListPic[viewDepthId] )
     {
+#if QC_REM_IDV_B0046
+      Int iviewId = m_tDecTop[viewDepthId]->getViewId();
+      if( newPicture[viewDepthId] && (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR || ((nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR && iviewId) && m_tDecTop[viewDepthId]->getNalUnitTypeBaseView() == NAL_UNIT_CODED_SLICE_IDR)) )
+#else
       if( newPicture[viewDepthId] && (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR || (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDV && m_tDecTop[viewDepthId]->getNalUnitTypeBaseView() == NAL_UNIT_CODED_SLICE_IDR)) )
+#endif
       {
         xFlushOutput( pcListPic[viewDepthId], viewDepthId );
@@ -275,4 +426,13 @@
         m_tDecTop[viewDepthIdx]->destroy() ;
       }
+#if QC_MVHEVC_B0046
+      if(viewDepthIdx)
+      {
+         //Call clear function to remove the record, which has been freed during viewDepthIdx = 0 case.
+        m_tDecTop[viewDepthIdx]->xGetParaSetDec()->clearSPS();
+        m_tDecTop[viewDepthIdx]->xGetParaSetDec()->clearVPS();
+        m_tDecTop[viewDepthIdx]->xGetParaSetDec()->clearPPS();
+      }
+#endif
       delete m_tDecTop[viewDepthIdx] ; 
       m_tDecTop[viewDepthIdx] = NULL ;
@@ -416,5 +576,5 @@
   m_pocLastDisplay[viewDepthId] = -MAX_INT;
 }
-#if VIDYO_VPS_INTEGRATION
+#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
 Void  TAppDecTop::increaseNumberOfViews  ( UInt layerId, UInt viewId, UInt isDepth )
 #else
@@ -422,5 +582,5 @@
 #endif
 {
-#if VIDYO_VPS_INTEGRATION
+#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
   Int newNumberOfViewDepth = layerId + 1;
 #endif
@@ -429,5 +589,5 @@
     m_outputBitDepth = g_uiBitDepth + g_uiBitIncrement;
   }
-#if !VIDYO_VPS_INTEGRATION
+#if !VIDYO_VPS_INTEGRATION&!QC_MVHEVC_B0046
   Int viewId = (newNumberOfViewDepth-1)>>1;   // coding order T0D0T1D1T2D2
   Bool isDepth = ((newNumberOfViewDepth % 2) == 0);  // coding order T0D0T1D1T2D2
@@ -436,13 +596,11 @@
     m_useDepth = true;
 
-#if FIX_DECODING_WO_WRITING
   if ( m_pchReconFile )
   { 
-#endif
     while( m_tVideoIOYuvReconFile.size() < newNumberOfViewDepth)
     {
       m_tVideoIOYuvReconFile.push_back(new TVideoIOYuv);
       Char buffer[4];
-#if VIDYO_VPS_INTEGRATION
+#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
       sprintf(buffer,"_%i", viewId );
 #else
@@ -450,5 +608,5 @@
 #endif
       Char* nextFilename = NULL;
-#if VIDYO_VPS_INTEGRATION
+#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
       if( isDepth)
 #else
@@ -465,5 +623,5 @@
         xAppendToFileNameEnd( m_pchReconFile, buffer, nextFilename);
       }
-#if !VIDYO_VPS_INTEGRATION
+#if !VIDYO_VPS_INTEGRATION&!QC_MVHEVC_B0046
       if( isDepth || ( !isDepth && (m_tVideoIOYuvReconFile.size() % 2) == 1 ) )
 #endif
@@ -473,7 +631,5 @@
       free ( nextFilename );
     }
-#if FIX_DECODING_WO_WRITING
-  }
-#endif
+  }
 
   while( m_pocLastDisplay.size() < newNumberOfViewDepth )
@@ -484,5 +640,5 @@
   {
     m_tDecTop.push_back(new TDecTop);
-#if !VIDYO_VPS_INTEGRATION
+#if !VIDYO_VPS_INTEGRATION&!QC_MVHEVC_B0046
     if( isDepth || ( !isDepth && (m_tVideoIOYuvReconFile.size() % 2) == 1 ) )
     {
@@ -494,5 +650,5 @@
       m_tDecTop.back()->setPictureDigestEnabled(m_pictureDigestEnabled);
       m_tDecTop.back()->setCamParsCollector( &m_cCamParsCollector );
-#if !VIDYO_VPS_INTEGRATION
+#if !VIDYO_VPS_INTEGRATION&!QC_MVHEVC_B0046
     }
 #endif
@@ -502,5 +658,60 @@
 TDecTop* TAppDecTop::getTDecTop( Int viewId, Bool isDepth )
 { 
+#if FLEX_CODING_ORDER_M23723
+  Int viewnumber=0;
+  Int i=0;
+  Bool fcoFlag=0;
+  if (viewId>m_fcoViewDepthId)
+  {
+    return NULL;
+  }
+  else
+  {
+    if (isDepth)
+   {
+      for ( i=0; i<=m_fcoViewDepthId;i++)
+      {
+         if (m_fcoOrder[i]=='D')
+         {
+           if (viewnumber==viewId)
+           {
+             fcoFlag=1;
+             break;
+           }
+           else
+             viewnumber++;
+         }
+      }
+    }
+    else
+    {
+      for ( i=0; i<=m_fcoViewDepthId;i++)
+      {
+        if (m_fcoOrder[i]=='T')
+        {
+          if (viewnumber==viewId)
+          {
+            fcoFlag=1;
+            break;
+          }
+          else
+            viewnumber++;
+        }
+      }
+    }
+    if (fcoFlag)
+    {
+      return m_tDecTop[i];
+    }
+    else
+      return NULL;
+    
+  }
+
+    // coding order T0D0T1D1T2D2
+#else
   return m_tDecTop[(isDepth ? 1 : 0) + viewId * 2];  // coding order T0D0T1D1T2D2
+#endif
+ 
 } 
 
@@ -521,4 +732,7 @@
   assert( ( viewId >= 0 ) );
 
+#if FLEX_CODING_ORDER_M23723
+if (getTDecTop(viewId,isDepth))
+{
   TComList<TComPic*>* apcListPic = getTDecTop( viewId, isDepth )->getListPic();
   TComPic* pcPic = NULL;
@@ -532,4 +746,21 @@
   }
   return pcPic;
+}
+else
+  return NULL;
+#else
+
+  TComList<TComPic*>* apcListPic = getTDecTop( viewId, isDepth )->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
 }
 
@@ -557,5 +788,23 @@
   AOF(pcPicYuvAvail);
 
-  TComPic* pcPic = getPicFromView( iCodedViewIdx, iCurPoc, bDepth );
+  //TComPic* pcPic = getPicFromView( iCodedViewIdx, iCurPoc, bDepth );
+  TComPic* pcPic = NULL;
+  for( Int i=0; i<m_tDecTop.size() && pcPic==NULL; i++)
+  {
+    if( iCodedViewIdx == m_tDecTop[i]->getViewId() && bDepth == m_tDecTop[i]->getIsDepth() )
+    {
+
+       TComList<TComPic*>* apcListPic = m_tDecTop[i]->getListPic();
+       for( TComList<TComPic*>::iterator it=apcListPic->begin(); it!=apcListPic->end(); it++ )
+       {
+         if( (*it)->getPOC() == iCurPoc )
+         {
+           pcPic = *it;
+           break;
+         }
+       }
+
+    }
+  }
   pcPic->setPicYuvSynth( pcPicYuvVSP );
   pcPic->setPicYuvAvail( pcPicYuvAvail );
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.h
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.h	(revision 193)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppDecoder/TAppDecTop.h	(revision 213)
@@ -74,8 +74,13 @@
   Bool                            m_useDepth;
 
+#if FLEX_CODING_ORDER_M23723
+  Int  m_fcoViewDepthId;
+  Char m_fcoOrder[MAX_VIEW_NUM*2];
+#endif
+
   FILE*                           m_pScaleOffsetFile;
   CamParsCollector                m_cCamParsCollector;
 #if DEPTH_MAP_GENERATION
-#if VIDYO_VPS_INTEGRATION
+#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
   TComVPSAccess                   m_cVPSAccess;
 #endif
@@ -95,5 +100,5 @@
   Void  destroy           (); ///< destroy internal members
   Void  decode            (); ///< main decoding function
-#if VIDYO_VPS_INTEGRATION
+#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
   Void  increaseNumberOfViews  (UInt layerId, UInt viewId, UInt isDepth);
 #else
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 193)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 213)
@@ -74,7 +74,5 @@
 {
   m_aidQP = NULL;
-#if FIXES
   m_aidQPdepth = NULL;
-#endif
 }
 
@@ -86,10 +84,8 @@
   }
 
-#if FIXES
   if ( m_aidQPdepth )
   {
     delete[] m_aidQPdepth; m_aidQPdepth = NULL;
   }
-#endif
 
   for(Int i = 0; i< m_pchInputFileList.size(); i++ )
@@ -115,4 +111,10 @@
   if (m_pchBitstreamFile != NULL)
     free (m_pchBitstreamFile) ;
+#if FLEX_CODING_ORDER_M23723
+  if (m_pchMVCJointCodingOrder != NULL)
+  {
+    free(m_pchMVCJointCodingOrder) ;
+  }
+#endif
 #if HHI_VSO
   if (  m_pchVSOConfig != NULL)
@@ -120,5 +122,4 @@
 #endif
 
-#if FIX_MEM_LEAKS
  if ( m_pchCameraParameterFile != NULL )
    free ( m_pchCameraParameterFile ); 
@@ -139,5 +140,4 @@
    free ( m_scalingListFile );
 
-#endif   
 
 }
@@ -225,4 +225,9 @@
   string cfg_RowHeight;
   string cfg_ScalingListFile;
+
+ #if FLEX_CODING_ORDER_M23723
+  string cfg_JointCodingOrdering;
+#endif
+
   po::Options opts;
   opts.addOptions()
@@ -268,4 +273,8 @@
   
   ("NumberOfViews",         m_iNumberOfViews,    0, "Number of views")
+#if FLEX_CODING_ORDER_M23723
+  ("FCO",               m_b3DVFlexOrder,   false, "flexible coding order flag" )
+  ("FCOCodingOrder",   cfg_JointCodingOrdering,  string(""), "The coding order for joint texture-depth coding")
+#endif
   /* Unit definition parameters */
   ("MaxCUWidth",          m_uiMaxCUWidth,  64u)
@@ -298,4 +307,8 @@
   ("FastSearch", m_iFastSearch, 1, "0:Full search  1:Diamond  2:PMVFAST")
   ("SearchRange,-sr",m_iSearchRange, 96, "motion search range")
+#if DV_V_RESTRICTION_B0037
+  ("DisparitySearchRangeRestriction",m_bUseDisparitySearchRangeRestriction, false, "restrict disparity search range")
+  ("VerticalDisparitySearchRange",m_iVerticalDisparitySearchRange, 56, "vertical disparity search range")
+#endif
   ("BipredSearchRange", m_bipredSearchRange, 4, "motion search range for bipred refinement")
   ("HadamardME", m_bUseHADME, true, "hadamard ME for fractional-pel")
@@ -342,14 +355,16 @@
   ("LoopFilterBetaOffset_div2", m_loopFilterBetaOffsetDiv2, 0 )
   ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 )
+#if LGE_ILLUCOMP_B0045
+  ("IlluCompEnable",                  m_bUseIC                  , true         , "Use illumination compensation for inter-view prediction" )
+#endif
 #if DBL_CONTROL
-#if FIX_DBL_CONTROL_DEFAULT
   ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, true)
-#else
-  ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false)
-#endif
 #endif
 
   /* Camera Paremetes */
   ("CameraParameterFile,cpf", m_pchCameraParameterFile,    (Char *) 0, "Camera Parameter File Name")
+#if QC_MVHEVC_B0046
+  ("BaseViewCameraNumbers" ,  m_aiVId,     std::vector<Int>(1, MAX_VIEW_NUM), "Numbers of base views")
+#endif
   ("BaseViewCameraNumbers" ,  m_pchBaseViewCameraNumbers,  (Char *) 0, "Numbers of base views")
 
@@ -362,5 +377,5 @@
   ("LambdaScaleVSO",                  m_dLambdaScaleVSO         , (Double) 1    , "Lambda Scaling for VSO")
 
-#if HHI_VSO_LS_TABLE
+#if HHI_VSO_LS_TABLE_M23714
   ("VSOLSTable",                      m_bVSOLSTable             , true          , "Depth QP dependent video/depth rate allocation by Lagrange multiplier" )    
 #endif
@@ -377,5 +392,5 @@
 #endif
 #if LGE_WVSO_A0119
-  ("WVSO",                            m_bUseWVSO                , false         , "Use depth fidelity term for VSO" )
+  ("WVSO",                            m_bUseWVSO                , true          , "Use depth fidelity term for VSO" )
   ("VSOWeight",                       m_iVSOWeight              , 10            , "Synthesized View Distortion Change weight" )
   ("VSDWeight",                       m_iVSDWeight              , 1             , "View Synthesis Distortion estimate weight" )
@@ -383,7 +398,8 @@
 #endif
 
-#if OL_DEPTHLIMIT_A0044
-  ("DPL",                             m_bDepthPartitionLimiting , false         , "Use DepthPartitionLimiting" )
-#endif
+#if OL_QTLIMIT_PREDCODING_B0068
+  ("QTLPC",                           m_bUseQTLPC               , true         , "Use depth Quadtree Limitation + Predictive Coding" )
+#endif
+
 #endif
 
@@ -474,5 +490,9 @@
                                               "\t0: disable")
 
+#if TMVP_DEPTH_SWITCH
+  ("TMVP", m_enableTMVP, std::vector<Bool>(1,true), "Enable TMVP" )
+#else
   ("TMVP", m_enableTMVP, true, "Enable TMVP" )
+#endif
 
   ("FEN", m_bUseFastEnc, false, "fast encoder setting")
@@ -493,4 +513,8 @@
 #if HHI_MPI
   ("MVI", m_bUseMVI, false, "use motion vector inheritance for depth map coding")
+#endif
+#if RWTH_SDC_DLT_B0036
+  ("DLT", m_bUseDLT, true, "use depth lookup table for depth map coding")
+  ("SDC", m_bUseSDC, true, "use simplified depth coding tree")
 #endif
   ;
@@ -545,5 +569,43 @@
   m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
   m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
-  
+#if FLEX_CODING_ORDER_M23723
+  m_pchMVCJointCodingOrder= cfg_JointCodingOrdering.empty()?NULL:strdup(cfg_JointCodingOrdering.c_str());
+  // If flexible order is enabled and if depth comes before the texture for a view, disable VSO
+#if HHI_VSO && DISABLE_FCO_FOR_VSO
+  Bool depthComesFirst = false;
+  int iter = 0;
+  if ( m_b3DVFlexOrder )
+  {
+    for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
+    {
+      iter = 0; 
+      for ( Int ii=1; ii<12; ii+=2 )
+      {
+        Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0');
+        if ( iViewIdxCfg == iViewIdx )
+        {
+          iter ++; 
+          if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view
+          {
+            if(iter == 1)
+           { 
+            depthComesFirst = true;
+            break;
+           }
+          }
+          else
+          {
+            assert(m_pchMVCJointCodingOrder[ii-1]=='T');
+          }
+        }
+      }
+    }
+  }
+  if (depthComesFirst)
+  {
+    m_bUseVSO = false;
+  }
+#endif
+#endif
   m_pchColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str());
   m_pchRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str());
@@ -704,4 +766,13 @@
   xCleanUpVectors();
 
+
+#if TMVP_DEPTH_SWITCH
+  if ( m_enableTMVP.size() < 2)
+  {
+    m_enableTMVP.push_back( m_enableTMVP[0]  );
+  }
+#endif
+ 
+
 #if HHI_VSO
   if ( m_abUseALF .size() < 2)
@@ -732,5 +803,5 @@
 #if HHI_VSO
 
-#if HHI_VSO_LS_TABLE
+#if HHI_VSO_LS_TABLE_M23714
   // Q&D
   Double adLambdaScaleTable[] = 
@@ -796,4 +867,5 @@
 }
 #else
+#if !QC_MVHEVC_B0046
   m_cCameraData     .init     ( (UInt)m_iNumberOfViews,
     m_uiInputBitDepth,
@@ -807,10 +879,12 @@
     LOG2_DISP_PREC_LUT );
 #endif
+#endif
 
 
   // check validity of input parameters
   xCheckParameter();
+#if !QC_MVHEVC_B0046
   m_cCameraData.check( false, true );
-  
+#endif
   // print-out parameters
   xPrintParameter();
@@ -860,4 +934,7 @@
   xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2,                                     "Fast Search Mode is not supported value (0:Full search  1:Diamond  2:PMVFAST)" );
   xConfirmPara( m_iSearchRange < 0 ,                                                        "Search Range must be more than 0" );
+#if DV_V_RESTRICTION_B0037
+  xConfirmPara( m_iVerticalDisparitySearchRange <= 0 ,                                      "Vertical Disparity Search Range must be more than 0" );
+#endif
   xConfirmPara( m_bipredSearchRange < 0 ,                                                   "Search Range must be more than 0" );
   xConfirmPara( m_iMaxDeltaQP > 7,                                                          "Absolute Delta QP exceeds supported range (0 to 7)" );
@@ -1650,4 +1727,8 @@
   printf("Min PCM size                 : %d\n", 1 << m_uiPCMLog2MinSize);
   printf("Motion search range          : %d\n", m_iSearchRange );
+#if DV_V_RESTRICTION_B0037
+  printf("Disp search range restriction: %d\n", m_bUseDisparitySearchRangeRestriction );
+  printf("Vertical disp search range   : %d\n", m_iVerticalDisparitySearchRange );
+#endif
   printf("Intra period                 : %d\n", m_iIntraPeriod );
   printf("Decoding refresh type        : %d\n", m_iDecodingRefreshType );
@@ -1685,5 +1766,5 @@
     printf("VSO Negative Distortion      : %d\n",    m_bAllowNegDist ? 1 : 0);
 #endif
-#if HHI_VSO_LS_TABLE
+#if HHI_VSO_LS_TABLE_M23714
     printf("VSO LS Table                 : %d\n",    m_bVSOLSTable ? 1 : 0);    
 #endif
@@ -1769,5 +1850,7 @@
   printf(" ScalingList:%d ", m_useScalingListId );
 
+#if !TMVP_DEPTH_SWITCH
   printf("TMVP:%d ", m_enableTMVP     );
+#endif
 
 #if ADAPTIVE_QP_SELECTION
@@ -1783,4 +1866,11 @@
   printf("SAO:%d ", (m_abUseSAO [0] ? 1 : 0));
   printf("RDQ:%d ", (m_abUseRDOQ[0] ? 1 : 0) );
+#if TMVP_DEPTH_SWITCH
+  printf("TMVP:%d ", (m_enableTMVP[0] ? 1 : 0) );
+#endif
+#if LGE_ILLUCOMP_B0045
+  printf("IlluCompEnable: %d ", m_bUseIC);
+#endif
+
   printf("\n");
 
@@ -1789,4 +1879,15 @@
   printf("SAO:%d ", (m_abUseSAO [1] ? 1 : 0));
   printf("RDQ:%d ", (m_abUseRDOQ[1] ? 1 : 0));
+#if TMVP_DEPTH_SWITCH
+  printf("TMVP:%d ", (m_enableTMVP[1] ? 1 : 0) );
+#endif
+#if FLEX_CODING_ORDER_M23723
+  printf("FCO:%d ",   (m_b3DVFlexOrder ? 1: 0));
+
+  if(m_b3DVFlexOrder)
+  {
+    printf("CodingOrder: %s ", m_pchMVCJointCodingOrder);
+  }
+#endif
 #if HHI_VSO
   printf("VSO:%d ", m_bUseVSO             );
@@ -1795,6 +1896,6 @@
   printf("WVSO:%d ", m_bUseWVSO );
 #endif
-#if OL_DEPTHLIMIT_A0044
-  printf("DPL:%d ", m_bDepthPartitionLimiting);
+#if OL_QTLIMIT_PREDCODING_B0068
+  printf("QTLPC:%d ", m_bUseQTLPC);
 #endif
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
@@ -1804,6 +1905,11 @@
   printf("MVI:%d ", m_bUseMVI ? 1 : 0 );
 #endif
+#if RWTH_SDC_DLT_B0036
+  printf("SDC:%d ", m_bUseSDC ? 1 : 0 );
+  printf("DLT:%d ", m_bUseDLT ? 1 : 0 );
+#endif
 #if LGE_WVSO_A0119
-  printf("\nVSO : VSD : SAD weight = %d : %d : %d ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );
+  if ( m_bUseWVSO )
+    printf("\nVSO : VSD : SAD weight = %d : %d : %d ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );
 #endif
   printf("\n\n");
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.h	(revision 193)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncCfg.h	(revision 213)
@@ -88,4 +88,10 @@
   Int       m_iNumberOfViews;                                 ///< number Views to Encode
   Bool      m_bUsingDepthMaps;
+  
+#if FLEX_CODING_ORDER_M23723
+  Char*  m_pchMVCJointCodingOrder;      ///<  texture-depth coding order
+  Bool    m_b3DVFlexOrder;    ///<  flexible coding order flag
+#endif
+
   // coding structure
   Int       m_iIntraPeriod;                                   ///< period of I-slice (random access period)
@@ -109,4 +115,7 @@
   std::vector<Double>  m_adQP;                                ///< QP value of key-picture (floating point) [0] video, [1] depth
   std::vector<Int>     m_aiQP;                                ///< QP value of key-picture (integer) [0] video, [1] depth
+#if QC_MVHEVC_B0046
+  std::vector<Int>     m_aiVId;                                ///< view id
+#endif
   Int       m_aiTLayerQPOffset[MAX_TLAYER];                   ///< QP offset corresponding to temporal layer depth
   char*     m_pchdQPFile;                                     ///< QP offset for each slice (initialized from external file)
@@ -160,4 +169,7 @@
 #endif
   vector<Bool> m_abUseSAO;
+#if LGE_ILLUCOMP_B0045
+  Bool      m_bUseIC;                                     ///< flag for using illumination compensation for inter-view prediction
+#endif
 #if SAO_UNIT_INTERLEAVING
   Int       m_maxNumOffsetsPerPic;                            ///< SAO maximun number of offset per picture
@@ -197,4 +209,8 @@
   Int       m_iFastSearch;                                    ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST
   Int       m_iSearchRange;                                   ///< ME search range
+#if DV_V_RESTRICTION_B0037
+  Bool      m_bUseDisparitySearchRangeRestriction;            ///< restrict vertical search range for inter-view prediction
+  Int       m_iVerticalDisparitySearchRange;                  ///< ME vertical search range for inter-view prediction 
+#endif
   Int       m_bipredSearchRange;                              ///< ME search range for bipred refinement
   Bool      m_bUseFastEnc;                                    ///< flag for using fast encoder setting
@@ -258,5 +274,10 @@
   UInt      m_uiBiPredIdc;                                    ///< Use of Bi-Directional Weighting Prediction (B_SLICE): explicit(1) or implicit(2)
 
+#if TMVP_DEPTH_SWITCH
+  vector<Bool> m_enableTMVP;                                  ///< Enable TMVP [0] video, [1] depth
+#else
   Bool      m_enableTMVP;
+#endif
+
 #if MULTIBITS_DATA_HIDING
   Int       m_signHideFlag;
@@ -266,4 +287,8 @@
   Bool      m_bUseMVI;  ///< flag for using Motion Vector Inheritance for depth map coding
 #endif
+#if RWTH_SDC_DLT_B0036
+  Bool      m_bUseDLT;
+  Bool      m_bUseSDC;
+#endif
 
   Int       m_useScalingListId;                               ///< using quantization matrix
@@ -273,6 +298,7 @@
   Char*     m_pchCameraParameterFile;                         ///< camera parameter file
   Char*     m_pchBaseViewCameraNumbers;
+#if !QC_MVHEVC_B0046
   TAppComCamPara m_cCameraData;
-
+#endif
   Int       m_iCodedCamParPrecision;                          ///< precision for coding of camera parameters
 
@@ -280,5 +306,5 @@
   Char*     m_pchVSOConfig;
   Bool      m_bUseVSO;                                    ///< flag for using View Synthesis Optimization
-#if HHI_VSO_LS_TABLE
+#if HHI_VSO_LS_TABLE_M23714
   Bool      m_bVSOLSTable;                                ///< Depth QP dependent Lagrange parameter optimization (m23714)
 #endif
@@ -313,6 +339,6 @@
 #endif
 
-#if OL_DEPTHLIMIT_A0044
-  Bool      m_bDepthPartitionLimiting;
+#if OL_QTLIMIT_PREDCODING_B0068
+  Bool      m_bUseQTLPC;                                      ///< flag for using depth QuadTree Limitation + Predictive Coding
 #endif
 
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.cpp	(revision 193)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.cpp	(revision 213)
@@ -67,9 +67,15 @@
 Void TAppEncTop::xInitLibCfg()
 {
-#if VIDYO_VPS_INTEGRATION
+#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
+#if !QC_MVHEVC_B0046
   UInt layerId = 0;
+#endif
   // TODO: fix the assumption here that the temporal structures are all equal across all layers???
   m_cVPS.setMaxTLayers( m_maxTempLayer[0] );
+#if QC_MVHEVC_B0046
+  m_cVPS.setMaxLayers( m_iNumberOfViews );
+#else
   m_cVPS.setMaxLayers( m_iNumberOfViews * (m_bUsingDepthMaps ? 2:1) );
+#endif
   for(Int i = 0; i < MAX_TLAYER; i++)
   {
@@ -81,4 +87,32 @@
   for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
   {
+#if VSP_N
+#if FLEX_CODING_ORDER_M23723
+      Bool isTextureFirst = false;
+      if ( m_b3DVFlexOrder )
+      {
+        for ( Int ii=1; ii<12; ii+=2 )
+        {
+          Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0');
+          if ( iViewIdxCfg == iViewIdx )
+          {
+            if ( m_pchMVCJointCodingOrder[ii-1]=='T' )
+            {
+              isTextureFirst = true;
+            }
+            else
+            {
+              assert(m_pchMVCJointCodingOrder[ii-1]=='D');
+            }
+            break;
+          }
+        }
+      }
+      else
+      {
+        isTextureFirst = true;
+      }
+#endif
+#endif
     m_frameRcvd.push_back(0);
     m_acTEncTopList.push_back(new TEncTop); 
@@ -101,4 +135,8 @@
     m_acTEncTopList[iViewIdx]->setViewId                       ( iViewIdx );
     m_acTEncTopList[iViewIdx]->setIsDepth                      ( false );
+#if QC_MVHEVC_B0046
+    m_acTEncTopList[iViewIdx]->setLayerId                      ( iViewIdx );
+    m_cVPS.setViewId                                           ( m_aiVId[ iViewIdx ], iViewIdx );
+#else
     m_acTEncTopList[iViewIdx]->setViewOrderIdx                 ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );
 #if VIDYO_VPS_INTEGRATION
@@ -113,8 +151,16 @@
 #endif
     
+#if VSP_N
     m_acTEncTopList[iViewIdx]->setCamParPrecision              ( m_cCameraData.getCamParsCodedPrecision  () );
     m_acTEncTopList[iViewIdx]->setCamParInSliceHeader          ( m_cCameraData.getVaryingCameraParameters() );
     m_acTEncTopList[iViewIdx]->setCodedScale                   ( m_cCameraData.getCodedScale             () );
     m_acTEncTopList[iViewIdx]->setCodedOffset                  ( m_cCameraData.getCodedOffset            () );
+#else
+    m_acTEncTopList[iViewIdx]->setCamParPrecision              ( 0 );
+    m_acTEncTopList[iViewIdx]->setCamParInSliceHeader          ( false );
+    m_acTEncTopList[iViewIdx]->setCodedScale                   ( 0 );
+    m_acTEncTopList[iViewIdx]->setCodedOffset                  ( 0 );
+#endif
+#endif   
 
   //====== Coding Structure ========
@@ -170,5 +216,8 @@
     m_acTEncTopList[iViewIdx]->setSearchRange                  ( m_iSearchRange );
     m_acTEncTopList[iViewIdx]->setBipredSearchRange            ( m_bipredSearchRange );
-
+#if DV_V_RESTRICTION_B0037
+    m_acTEncTopList[iViewIdx]->setUseDisparitySearchRangeRestriction ( m_bUseDisparitySearchRangeRestriction );
+    m_acTEncTopList[iViewIdx]->setVerticalDisparitySearchRange( m_iVerticalDisparitySearchRange );
+#endif
   //====== Quality control ========
     m_acTEncTopList[iViewIdx]->setMaxDeltaQP                   ( m_iMaxDeltaQP  );
@@ -300,4 +349,7 @@
     m_acTEncTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
     m_acTEncTopList[iViewIdx]->setUseSAO               ( m_abUseSAO[0]     );
+#if LGE_ILLUCOMP_B0045
+    m_acTEncTopList[iViewIdx]->setUseIC                ( m_bUseIC          );
+#endif
 #if SAO_UNIT_INTERLEAVING
     m_acTEncTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic);
@@ -342,5 +394,9 @@
     m_acTEncTopList[iViewIdx]->setWaveFrontFlush             ( m_iWaveFrontFlush );
     m_acTEncTopList[iViewIdx]->setWaveFrontSubstreams        ( m_iWaveFrontSubstreams );
+#if TMVP_DEPTH_SWITCH
+    m_acTEncTopList[iViewIdx]->setEnableTMVP                 ( m_enableTMVP[0] );
+#else
     m_acTEncTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP );
+#endif
     m_acTEncTopList[iViewIdx]->setUseScalingListId           ( m_useScalingListId  );
     m_acTEncTopList[iViewIdx]->setScalingListFile            ( m_scalingListFile   );
@@ -364,9 +420,13 @@
     m_acTEncTopList[iViewIdx]->setUseDMM                     ( false );
 #endif
-#if OL_DEPTHLIMIT_A0044
-    m_acTEncTopList[iViewIdx]->setUseDPL                     ( false );
+#if OL_QTLIMIT_PREDCODING_B0068
+    m_acTEncTopList[iViewIdx]->setUseQTLPC                   ( false );
 #endif
 #if HHI_MPI
     m_acTEncTopList[iViewIdx]->setUseMVI( false );
+#endif
+#if RWTH_SDC_DLT_B0036
+    m_acTEncTopList[iViewIdx]->setUseDLT                      ( false );
+    m_acTEncTopList[iViewIdx]->setUseSDC                      ( false );
 #endif
 
@@ -374,4 +434,9 @@
     m_acTEncTopList[iViewIdx]->setUseVSP( m_bUseVSP );
     m_acTEncTopList[iViewIdx]->setVSPDepthDisable( m_bVSPDepthDisable );
+#if FLEX_CODING_ORDER_M23723
+    m_acTEncTopList[iViewIdx]->setIsFirstInView( isTextureFirst );
+#else
+    m_acTEncTopList[iViewIdx]->setIsFirstInView( true );
+#endif
 #endif
   }
@@ -380,4 +445,29 @@
     for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
     {
+
+#if FLEX_CODING_ORDER_M23723
+      // Detect whether depth comes before than texture for this view
+      Bool isDepthFirst = false;
+      if ( m_b3DVFlexOrder )
+      {
+        for ( Int ii=1; ii<12; ii+=2 )
+        {
+          Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0');
+          if ( iViewIdxCfg == iViewIdx )
+          {
+            if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view
+            {
+              isDepthFirst = true;
+            }
+            else
+            {
+              assert(m_pchMVCJointCodingOrder[ii-1]=='T');
+            }
+            break;
+          }
+        }
+      }
+#endif
+
       m_depthFrameRcvd.push_back(0);
       m_acTEncDepthTopList.push_back(new TEncTop); 
@@ -400,5 +490,9 @@
       m_acTEncDepthTopList[iViewIdx]->setViewId                       ( iViewIdx );
       m_acTEncDepthTopList[iViewIdx]->setIsDepth                      ( true );
+#if QC_MVHEVC_B0046
+      m_acTEncDepthTopList[iViewIdx]->setLayerId                      ( iViewIdx );
+#else
       m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx                 ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );
+#endif
 #if VIDYO_VPS_INTEGRATION
       layerId = iViewIdx * 2 + 1;
@@ -410,8 +504,16 @@
       m_cVPS.setDependentLayer                                        ( layerId-1, layerId);
 #endif
+
+#if VSP_N
+      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
 
       //====== Coding Structure ========
@@ -467,5 +569,8 @@
       m_acTEncDepthTopList[iViewIdx]->setSearchRange                  ( m_iSearchRange );
       m_acTEncDepthTopList[iViewIdx]->setBipredSearchRange            ( m_bipredSearchRange );
-
+#if DV_V_RESTRICTION_B0037
+      m_acTEncDepthTopList[iViewIdx]->setUseDisparitySearchRangeRestriction ( m_bUseDisparitySearchRangeRestriction );
+      m_acTEncDepthTopList[iViewIdx]->setVerticalDisparitySearchRange( m_iVerticalDisparitySearchRange );
+#endif
       //====== Quality control ========
       m_acTEncDepthTopList[iViewIdx]->setMaxDeltaQP                   ( m_iMaxDeltaQP  );
@@ -584,4 +689,7 @@
       m_acTEncDepthTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
       m_acTEncDepthTopList[iViewIdx]->setUseSAO               ( m_abUseSAO[1]     );
+#if LGE_ILLUCOMP_B0045
+      m_acTEncDepthTopList[iViewIdx]->setUseIC                ( false     );
+#endif
 #if SAO_UNIT_INTERLEAVING
       m_acTEncDepthTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic);
@@ -626,5 +734,9 @@
       m_acTEncDepthTopList[iViewIdx]->setWaveFrontFlush             ( m_iWaveFrontFlush );
       m_acTEncDepthTopList[iViewIdx]->setWaveFrontSubstreams        ( m_iWaveFrontSubstreams );
+#if TMVP_DEPTH_SWITCH
+      m_acTEncDepthTopList[iViewIdx]->setEnableTMVP                 ( m_enableTMVP[1] );
+#else
       m_acTEncDepthTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP );
+#endif
       m_acTEncDepthTopList[iViewIdx]->setUseScalingListId           ( m_useScalingListId  );
       m_acTEncDepthTopList[iViewIdx]->setScalingListFile            ( m_scalingListFile   );
@@ -648,9 +760,21 @@
     m_acTEncDepthTopList[iViewIdx]->setUseDMM                     ( m_bUseDMM );
 #endif
-#if OL_DEPTHLIMIT_A0044
-    m_acTEncDepthTopList[iViewIdx]->setUseDPL                      (m_bDepthPartitionLimiting);
+#if FLEX_CODING_ORDER_M23723 && HHI_DMM_PRED_TEX
+    m_acTEncDepthTopList[iViewIdx]->setUseDMM34( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseDMM );
+#endif
+
+#if OL_QTLIMIT_PREDCODING_B0068
+    m_acTEncDepthTopList[iViewIdx]->setUseQTLPC                   (m_bUseQTLPC);
 #endif
 #if HHI_MPI
-     m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI );
+#if FLEX_CODING_ORDER_M23723
+    m_acTEncDepthTopList[iViewIdx]->setUseMVI( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseMVI );
+#else
+    m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI );
+#endif
+#endif
+#if RWTH_SDC_DLT_B0036
+      m_acTEncDepthTopList[iViewIdx]->setUseDLT                   ( m_bUseDLT );
+      m_acTEncDepthTopList[iViewIdx]->setUseSDC                   ( m_bUseSDC );
 #endif
 
@@ -658,4 +782,9 @@
       m_acTEncDepthTopList[iViewIdx]->setUseVSP( m_bUseVSP );
       m_acTEncDepthTopList[iViewIdx]->setVSPDepthDisable( m_bVSPDepthDisable );
+#if FLEX_CODING_ORDER_M23723
+      m_acTEncDepthTopList[iViewIdx]->setIsFirstInView( isDepthFirst );
+#else
+      m_acTEncDepthTopList[iViewIdx]->setIsFirstInView( false );
+#endif
 #endif
     }
@@ -677,12 +806,8 @@
     if ( m_uiVSOMode == 4 )
     {
-#if HHI_VSO_SPEEDUP_A0033
 #if LGE_VSO_EARLY_SKIP_A0093
       m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );
 #else
       m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );
-#endif
-#else
-      m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, LOG2_DISP_PREC_LUT, 0 );
 #endif
 
@@ -820,4 +945,14 @@
   {
     m_acTEncTopList[iViewIdx]->init( this );
+#if QC_MVHEVC_B0046
+  //set setNumDirectRefLayer
+  Int iNumDirectRef = m_acTEncTopList[iViewIdx]->getSPS()->getNumberOfUsableInterViewRefs();
+  m_acTEncTopList[iViewIdx]->getEncTop()->getVPS()->setNumDirectRefLayer(iNumDirectRef, iViewIdx);
+  for(Int iNumIvRef = 0; iNumIvRef < iNumDirectRef; iNumIvRef ++)
+  {
+    Int iLayerId = m_acTEncTopList[iViewIdx]->getSPS()->getUsableInterViewRef(iNumIvRef);
+    m_acTEncTopList[iViewIdx]->getEncTop()->getVPS()->setDirectRefLayerId( iLayerId + iViewIdx, iViewIdx, iNumIvRef);
+  }
+#endif
   }
   for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
@@ -861,8 +996,10 @@
   TComPicYuv*       pcPicYuvOrg = new TComPicYuv;
   TComPicYuv*       pcDepthPicYuvOrg = new TComPicYuv;
+#if !QC_MVHEVC_B0046
   TComPicYuv*       pcPdmDepthOrg    = new TComPicYuv;
+#endif
   TComPicYuv*       pcPicYuvRec = NULL;
   TComPicYuv*       pcDepthPicYuvRec = NULL;
-
+  
   // initialize internal class & member variables
   xInitLibCfg();
@@ -884,4 +1021,9 @@
     eos.push_back( false );
     depthEos.push_back( false );
+    
+#if RWTH_SDC_DLT_B0036
+    if( m_bUsingDepthMaps && m_bUseDLT )
+      xAnalyzeInputBaseDepth(iViewIdx, m_iIntraPeriod);
+#endif
   }
 
@@ -957,4 +1099,5 @@
     {
       Int  iNumEncoded = 0;
+#if !QC_MVHEVC_B0046
       UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );
       if ( iNextPoc < m_iFrameToBeEncoded )
@@ -962,4 +1105,83 @@
         m_cCameraData.update( iNextPoc );
       }
+#endif
+
+#if FLEX_CODING_ORDER_M23723
+      if (m_b3DVFlexOrder)
+      {
+        Int  iNumDepthEncoded = 0;
+        iNumEncoded = 0;
+        Int i=0;
+        Int iViewIdx=0;
+        Int iNumberofDepthViews = m_bUsingDepthMaps?m_iNumberOfViews:0;
+        for (Int j=0; j < (m_iNumberOfViews+ iNumberofDepthViews); j++ )
+        {
+          if (m_pchMVCJointCodingOrder[i]=='T')
+          {
+
+            i++;
+            assert(isdigit(m_pchMVCJointCodingOrder[i]));
+            iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
+
+#if VSP_SLICE_HEADER && !VSP_CFG
+            if( m_acTEncTopList[iViewIdx]->getUseVSP() ) m_acTEncTopList[iViewIdx]->setUseVSP( (gopId%VSP_FRAME_INTERVAL==0) );
+#endif
+
+#if VSP_N
+#if VSP_SLICE_HEADER
+            if( m_acTEncTopList[iViewIdx]->getUseVSP() )
+#endif
+            if( m_bUsingDepthMaps )
+            {
+              // Forward Warping
+              xStoreVSPInBuffer( m_acTEncTopList[iViewIdx]->getVSPBuf(), m_acTEncTopList[iViewIdx]->getVSPAvailBuf(), iViewIdx, false, gopId );
+            }
+#endif
+
+            m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId );
+            xWriteOutput(bitstreamFile, iNumEncoded, outputAccessUnits, iViewIdx, false);
+            outputAccessUnits.clear();
+            i++;
+          }
+          else if ( m_pchMVCJointCodingOrder[i] == 'D')
+          {
+
+            i++;
+            if( m_bUsingDepthMaps )
+            {
+              assert(isdigit(m_pchMVCJointCodingOrder[i]));
+              iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
+#if SAIT_VSO_EST_A0033
+              if( m_bUseVSO && iNextPoc < m_iFrameToBeEncoded )
+              {
+                m_cCameraData.xSetDispCoeff( iNextPoc, iViewIdx );
+                m_acTEncDepthTopList[iViewIdx]->setDispCoeff( m_cCameraData.getDispCoeff() );
+              }
+#endif
+
+#if VSP_SLICE_HEADER && !VSP_CFG
+              if( m_acTEncDepthTopList[iViewIdx]->getUseVSP() ) m_acTEncDepthTopList[iViewIdx]->setUseVSP( (gopId%VSP_FRAME_INTERVAL==0) );
+#endif
+
+#if VSP_N
+#if VSP_SLICE_HEADER
+              if( m_acTEncDepthTopList[iViewIdx]->getUseVSP() )
+              if( !m_acTEncDepthTopList[iViewIdx]->getVSPDepthDisable() )
+#endif
+                xStoreVSPInBuffer( m_acTEncDepthTopList[iViewIdx]->getVSPBuf(), m_acTEncDepthTopList[iViewIdx]->getVSPAvailBuf(), iViewIdx, true, gopId );
+#endif
+
+              m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId );
+              xWriteOutput(bitstreamFile, iNumDepthEncoded, outputAccessUnits, iViewIdx, true);
+              outputAccessUnits.clear();
+              i++;
+            }
+          }
+        }
+      }
+      else
+      {
+
+#endif
       for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
       {
@@ -1008,4 +1230,9 @@
         }
       }
+ 
+#if FLEX_CODING_ORDER_M23723
+      }
+#endif
+
 #if HHI_INTERVIEW_SKIP || HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED
       for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
@@ -1040,6 +1267,10 @@
   pcDepthPicYuvOrg = NULL;
   
-#if FIX_MEM_LEAKS
+#if !QC_MVHEVC_B0046
+#if FIX_DEL_NULLPTR
+  if ( pcPdmDepthOrg != NULL && m_uiMultiviewMvRegMode )
+#else
   if ( pcPdmDepthOrg != NULL )
+#endif
   {
     pcPdmDepthOrg->destroy();
@@ -1048,5 +1279,4 @@
   };
 #endif
-
   
   for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
@@ -1252,5 +1482,7 @@
     case NAL_UNIT_CODED_SLICE:
 #if H0566_TLA
+#if !QC_REM_IDV_B0046
     case NAL_UNIT_CODED_SLICE_IDV:
+#endif
     case NAL_UNIT_CODED_SLICE_TLA:
     case NAL_UNIT_CODED_SLICE_CRA:
@@ -1306,16 +1538,7 @@
 #endif
 #if HHI_VSO
-#if HHI_VSO_SPEEDUP_A0033
 Void TAppEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset )
 {
-#if FIX_VSO_SETUP
   m_cRendererModel.setupPart( iHorOffset, Min( g_uiMaxCUHeight, m_iSourceHeight - iHorOffset ) ); 
-#else
-  m_cRendererModel.setHorOffset( iHorOffset ); 
-#endif
-#else
-Void TAppEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent )
-{
-#endif
   Int iEncViewSIdx = m_cCameraData.getBaseId2SortedId()[ iEncViewIdx ];
 
@@ -1455,4 +1678,80 @@
   return pcPic;
 };
+  
+#if RWTH_SDC_DLT_B0036
+Void TAppEncTop::xAnalyzeInputBaseDepth(Int iViewIdx, UInt uiNumFrames)
+{
+  TComPicYuv*       pcDepthPicYuvOrg = new TComPicYuv;
+  // allocate original YUV buffer
+  pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
+  
+  TVideoIOYuv* depthVideoFile = new TVideoIOYuv;
+  
+  UInt uiMaxDepthValue = g_uiIBDI_MAX;
+  
+  Bool abValidDepths[256];
+  
+  depthVideoFile->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth );  // read  mode
+  
+  // initialize boolean array
+  for(Int p=0; p<=uiMaxDepthValue; p++)
+    abValidDepths[p] = false;
+  
+  Int iHeight   = pcDepthPicYuvOrg->getHeight();
+  Int iWidth    = pcDepthPicYuvOrg->getWidth();
+  Int iStride   = pcDepthPicYuvOrg->getStride();
+  
+  Pel* pInDM    = pcDepthPicYuvOrg->getLumaAddr();
+  
+  for(Int uiFrame=0; uiFrame < uiNumFrames; uiFrame++ )
+  {
+    depthVideoFile->read( pcDepthPicYuvOrg, m_aiPad, false );
+    
+    // check all pixel values
+    for (Int i=0; i<iHeight; i++)
+    {
+      Int rowOffset = i*iStride;
+      
+      for (Int j=0; j<iWidth; j++)
+      {
+        Pel depthValue = pInDM[rowOffset+j];
+        abValidDepths[depthValue] = true;
+      }
+    }
+  }
+  
+  depthVideoFile->close();
+  
+  pcDepthPicYuvOrg->destroy();
+  delete pcDepthPicYuvOrg;
+  
+  // convert boolean array to idx2Depth LUT
+  UInt* auiIdx2DepthValue = (UInt*) calloc(uiMaxDepthValue, sizeof(UInt));
+  UInt uiNumDepthValues = 0;
+  for(UInt p=0; p<=uiMaxDepthValue; p++)
+  {
+    if( abValidDepths[p] == true)
+    {
+      auiIdx2DepthValue[uiNumDepthValues++] = p;
+    }
+  }
+  
+  if( uiNumFrames == 0 || ceil(Log2(uiNumDepthValues)) == ceil(Log2(g_uiIBDI_MAX)) )
+  {
+    // don't use DLT
+    m_acTEncDepthTopList[iViewIdx]->setUseDLT(false);
+    m_acTEncDepthTopList[iViewIdx]->getSPS()->setUseDLT(false);
+  }
+  
+  // assign LUT
+  if( m_acTEncDepthTopList[iViewIdx]->getUseDLT() )
+    m_acTEncDepthTopList[iViewIdx]->getSPS()->setDepthLUTs(auiIdx2DepthValue, uiNumDepthValues);
+  else
+    m_acTEncDepthTopList[iViewIdx]->getSPS()->setDepthLUTs();
+  
+  // free temporary memory
+  free(auiIdx2DepthValue);
+}
+#endif
 
 #if VSP_N
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.h
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.h	(revision 193)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppEncoder/TAppEncTop.h	(revision 213)
@@ -87,5 +87,5 @@
 #endif
 
-#if VIDYO_VPS_INTEGRATION
+#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
   TComVPS                     m_cVPS;
 #endif
@@ -141,11 +141,10 @@
 #endif
 #if HHI_VSO
-#if HHI_VSO_SPEEDUP_A0033
   Void                  setupRenModel    ( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset );
-#else
-  Void                  setupRenModel    ( Int iPoc, Int iEncViewIdx, Int iEncContent );
-#endif
 #endif
   
+#if QC_MVHEVC_B0046
+  TComVPS*          getVPS()  { return &m_cVPS; }
+#endif
 #if VIDYO_VPS_INTEGRATION
   TComVPS*          getVPS()  { return &m_cVPS; }
@@ -166,4 +165,8 @@
   Void  xStoreVSORefPicsInBuffer();                                                   ///< read in External Ref pic from file and store in buffer
 #endif
+  
+#if RWTH_SDC_DLT_B0036
+  Void  xAnalyzeInputBaseDepth(Int iViewIdx, UInt uiNumFrames);
+#endif
 
 #if VSP_N
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/RendererMain.cpp
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/RendererMain.cpp	(revision 193)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/RendererMain.cpp	(revision 213)
@@ -43,4 +43,5 @@
 int main(int argc, char* argv[])
   {
+#if !QC_MVHEVC_B0046
   TAppRendererTop  cTAppRendererTop;
 
@@ -78,4 +79,5 @@
 
   return 0;
+#endif
 }
 
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererCfg.cpp
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererCfg.cpp	(revision 193)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererCfg.cpp	(revision 213)
@@ -59,5 +59,5 @@
 // Constructor / destructor / initialization / destroy
 // ====================================================================================================================
-
+#if !QC_MVHEVC_B0046
 TAppRendererCfg::TAppRendererCfg()
 {
@@ -120,7 +120,7 @@
 
     /* File I/O */
-    ("VideoInputFileBaseName",  m_pchVideoInputFileBaseName,  (Char*) 0, "Basename to generate video input file names")
-    ("DepthInputFileBaseName",  m_pchDepthInputFileBaseName,  (Char*) 0, "Basename to generate depth input file names")
-    ("SynthOutputFileBaseName", m_pchSynthOutputFileBaseName, (Char*) 0, "Basename to generate synthesized output file names")
+    ("VideoInputFileBaseName,v",  m_pchVideoInputFileBaseName,  (Char*) 0, "Basename to generate video input file names")
+    ("DepthInputFileBaseName,d",  m_pchDepthInputFileBaseName,  (Char*) 0, "Basename to generate depth input file names")
+    ("SynthOutputFileBaseName,s", m_pchSynthOutputFileBaseName, (Char*) 0, "Basename to generate synthesized output file names")
     ("ContOutputFileNumbering", m_bContOutputFileNumbering  ,  false   , "Continuous Output File Numbering")
     ("Sweep"                  , m_bSweep                    ,  false   , "Store all views in first Output File")
@@ -137,5 +137,5 @@
 
     /* Camera Specification */
-    ("CameraParameterFile,cpf", m_pchCameraParameterFile,          (Char *) 0, "Camera Parameter File Name")
+    ("CameraParameterFile,-cpf", m_pchCameraParameterFile,          (Char *) 0, "Camera Parameter File Name")
     ("BaseViewCameraNumbers"  , m_pchBaseViewCameraNumbers,        (Char *) 0, "Numbers of base views")
     ("SynthViewCameraNumbers" , m_pchSynthViewCameraNumbers,       (Char *) 0, "Numbers of views to synthesis")
@@ -516,2 +516,3 @@
   g_uiIBDI_MAX     = ((1<<(g_uiBitDepth+g_uiBitIncrement))-1);
 }
+#endif
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererCfg.h
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererCfg.h	(revision 193)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererCfg.h	(revision 213)
@@ -50,5 +50,5 @@
 #include <string>
 #include <vector>
-
+#if !QC_MVHEVC_B0046
 // ====================================================================================================================
 // Class definition
@@ -134,5 +134,5 @@
 
 
-
+#endif
 #endif // __TAppRENDERERCFG__
 
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererTop.cpp
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererTop.cpp	(revision 193)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererTop.cpp	(revision 213)
@@ -45,5 +45,5 @@
 // Constructor / destructor / initialization / destroy
 // ====================================================================================================================
-
+#if !QC_MVHEVC_B0046
 TAppRendererTop::TAppRendererTop()
 {
@@ -532,11 +532,5 @@
 #endif
 
-#if HHI_VSO_SPEEDUP_A0033
-#if FIX_VSO_SETUP
     cCurModel.setupPart( 0, m_iSourceHeight  ); 
-#else
-    cCurModel.setHorOffset( 0 );
-#endif
-#endif
 
     for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfInputViews; iViewIdx++ )
@@ -713,11 +707,5 @@
 
   AOT( m_iLog2SamplingFactor != 0 );
-#if HHI_VSO_SPEEDUP_A0033
-#if FIX_VSO_SETUP
   cCurModel.setupPart( 0, m_iSourceHeight  ); 
-#else
-  cCurModel.setHorOffset( 0 );
-#endif
-#endif
 #if LGE_VSO_EARLY_SKIP_A0093
   cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );
@@ -1046,2 +1034,3 @@
 
 }
+#endif
Index: branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererTop.h
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererTop.h	(revision 193)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/TAppRenderer/TAppRendererTop.h	(revision 213)
@@ -50,5 +50,5 @@
 #include "../../Lib/TLibRenderer/TRenModel.h"
 
-
+#if !QC_MVHEVC_B0046
 // ====================================================================================================================
 // Class definition
@@ -87,4 +87,5 @@
 };// END CLASS DEFINITION TAppRendererTop
 
-#endif // __TAppRendererTOP__
+#endif
 
+#endif
Index: branches/HTM-4.0.1-VSP-dev0/source/App/utils/BitrateTargeting/makefile
===================================================================
--- branches/HTM-4.0.1-VSP-dev0/source/App/utils/BitrateTargeting/makefile	(revision 193)
+++ branches/HTM-4.0.1-VSP-dev0/source/App/utils/BitrateTargeting/makefile	(revision 213)
