Index: trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp	(revision 1321)
@@ -156,5 +156,7 @@
 #if FAST_BIT_EST
   m_fracBits = pcTEncBinCABAC->m_fracBits;
+#if NH_MV
   D_PRINT_INDENT(g_traceEncFracBits,  "CopyState " + n2s(m_fracBits) );    
+#endif
 #endif
 }
@@ -171,7 +173,11 @@
   }
 #if FAST_BIT_EST
+#if NH_MV
   D_PRINT_INDENT( g_traceEncFracBits, "Reset Bits Before" + n2s(m_fracBits) );
+#endif
   m_fracBits &= 32767;
+#if NH_MV
   D_PRINT_INDENT( g_traceEncFracBits, "Reset Bits " + n2s(m_fracBits) );  
+#endif
 #endif
 }
Index: trunk/source/Lib/TLibEncoder/TEncBinCoderCABACCounter.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncBinCoderCABACCounter.cpp	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncBinCoderCABACCounter.cpp	(revision 1321)
@@ -59,5 +59,7 @@
   m_pcTComBitIf->write(0, UInt(m_fracBits >> 15) );
   m_fracBits &= 32767;
+#if NH_MV
   D_PRINT_INDENT( g_traceEncFracBits, "Finish " + n2s(m_fracBits) );    
+#endif
 }
 
@@ -81,5 +83,7 @@
   m_uiBinsCoded += m_binCountIncrement;
   m_fracBits += rcCtxModel.getEntropyBits( binValue );
+#if NH_MV
   D_PRINT_INDENT( g_traceEncFracBits, "EncodeBin " + n2s(m_fracBits) );    
+#endif
 
   rcCtxModel.update( binValue );
@@ -113,5 +117,7 @@
   m_uiBinsCoded += m_binCountIncrement;
   m_fracBits += 32768;
-    D_PRINT_INDENT( g_traceEncFracBits , "EncodeBinEP " + n2s(m_fracBits) );    
+#if NH_MV
+  D_PRINT_INDENT( g_traceEncFracBits , "EncodeBinEP " + n2s(m_fracBits) );
+#endif
 }
 
@@ -126,5 +132,7 @@
   m_uiBinsCoded += numBins & -m_binCountIncrement;
   m_fracBits += 32768 * numBins;
+#if NH_MV
   D_PRINT_INDENT( g_traceEncFracBits , "EncodeBinsEP " + n2s(m_fracBits) );    
+#endif
 }
 
@@ -138,5 +146,7 @@
   m_uiBinsCoded += m_binCountIncrement;
   m_fracBits += ContextModel::getEntropyBitsTrm( binValue );
+#if NH_MV
   D_PRINT_INDENT( g_traceEncFracBits , "EncodeBinTrm " + n2s(m_fracBits) );    
+#endif
 }
 
@@ -144,5 +154,7 @@
 {
   m_fracBits = (m_fracBits + 32767) & (~32767);
+#if NH_MV
   D_PRINT_INDENT( g_traceEncFracBits, "Align " + n2s(m_fracBits) );    
+#endif
 }
 
Index: trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1321)
@@ -40,5 +40,5 @@
 #include "SEIwrite.h"
 
-#if NH_3D
+#if NH_MV
 #include "TEncTop.h"
 #endif
@@ -53,4 +53,5 @@
 {
   fprintf( g_hTrace, "=========== Video Parameter Set     ===========\n" );
+}
 
 Void  xTraceSPSHeader ()
@@ -380,9 +381,5 @@
     WRITE_CODE((pcPPS->getDLT()->getDepthViewBitDepth() - 8), 4, "pps_bit_depth_for_depth_layers_minus8");
     
-#if NH_3D_DLT_FIX
     for( Int i = 0; i <= pcPPS->getDLT()->getNumDepthViews()-1; i++ )
-#else
-    for( Int i = 0; i <= pcPPS->getDLT()->getNumDepthViews(); i++ )
-#endif
     {
       Int layerId = pcPPS->getDLT()->getDepthIdxToLayerId(i);
@@ -748,5 +745,9 @@
     WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1,       "sps_max_dec_pic_buffering_minus1[i]" );
     WRITE_UVLC( pcSPS->getNumReorderPics(i),               "sps_max_num_reorder_pics[i]" );
+#if NH_MV
+    WRITE_UVLC( pcSPS->getSpsMaxLatencyIncreasePlus1(i),   "sps_max_latency_increase_plus1[i]" );
+#else
     WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i),           "sps_max_latency_increase_plus1[i]" );
+#endif
     if (!subLayerOrderingInfoPresentFlag)
     {
@@ -814,6 +815,11 @@
     codeShortTermRefPicSet( rps,false, i);
   }
+#if NH_MV
+  WRITE_FLAG( pcSPS->getLongTermRefPicsPresentFlag() ? 1 : 0,         "long_term_ref_pics_present_flag" );
+  if (pcSPS->getLongTermRefPicsPresentFlag())
+#else
   WRITE_FLAG( pcSPS->getLongTermRefsPresent() ? 1 : 0,         "long_term_ref_pics_present_flag" );
   if (pcSPS->getLongTermRefsPresent())
+#endif
   {
     WRITE_UVLC(pcSPS->getNumLongTermRefPicSPS(), "num_long_term_ref_pics_sps" );
@@ -1747,6 +1753,11 @@
   //write slice address
   const Int sliceSegmentRsAddress = pcSlice->getPic()->getPicSym()->getCtuTsToRsAddrMap(ctuTsAddress);
-
+#if NH_MV
+  // This should actually be done somewhere else and not in writing process.
+  pcSlice->setFirstSliceSegementInPicFlag( sliceSegmentRsAddress==0 ); 
+  WRITE_FLAG( pcSlice->getFirstSliceSegementInPicFlag() , "first_slice_segment_in_pic_flag" );
+#else
   WRITE_FLAG( sliceSegmentRsAddress==0, "first_slice_segment_in_pic_flag" );
+#endif
   if ( pcSlice->getRapPicFlag() )
   {
@@ -1760,5 +1771,4 @@
   else
 #endif
-
   WRITE_UVLC( pcSlice->getPPS()->getPPSId(), "slice_pic_parameter_set_id" );
   if ( pcSlice->getPPS()->getDependentSliceSegmentsEnabledFlag() && (sliceSegmentRsAddress!=0) )
@@ -1772,5 +1782,4 @@
   if ( !pcSlice->getDependentSliceSegmentFlag() )
   {
-
 #if NH_MV    
     Int esb = 0;  //Don't use i, otherwise will shadow something below
@@ -1861,5 +1870,9 @@
         }
       }
+#if NH_MV
+      if(pcSlice->getSPS()->getLongTermRefPicsPresentFlag())
+#else
       if(pcSlice->getSPS()->getLongTermRefsPresent())
+#endif
       {
         Int numLtrpInSH = rps->getNumberOfLongtermPictures();
@@ -2196,5 +2209,5 @@
     Bool isDBFEnabled = (!pcSlice->getDeblockingFilterDisable());
 
-    if(pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled ))
+      if(pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled ))
     {
       WRITE_FLAG(pcSlice->getLFCrossSliceBoundaryFlag()?1:0, "slice_loop_filter_across_slices_enabled_flag");
@@ -2204,9 +2217,5 @@
     {
       Int voiInVps = vps->getVoiInVps( pcSlice->getViewIndex() ); 
-#if NH_3D_FIX_TICKET_101
       if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) )
-#else
-      if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) && !pcSlice->getIsDepth() )
-#endif
       {
         for( Int m = 0; m < vps->getNumCp( voiInVps ); m++ )
@@ -2257,18 +2266,18 @@
       if( pcSlice->getPocMsbValRequiredFlag() )
       {
-        pcSlice->setPocMsbValPresentFlag( true );
+        pcSlice->setPocMsbCycleValPresentFlag( true );
       }
       else
       {
-        pcSlice->setPocMsbValPresentFlag( false );
-      }
-    }
-
-    if( pcSlice->getPocMsbValPresentFlag() )
+        pcSlice->setPocMsbCycleValPresentFlag( false );
+      }
+    }
+
+    if( pcSlice->getPocMsbCycleValPresentFlag() )
     {
 //      Int iMaxPOClsb = 1<< pcSlice->getSPS()->getBitsForPOC(); currently unused
 
       UInt lengthVal = 1;
-      UInt tempVal = pcSlice->getPocMsbVal() + 1;
+      UInt tempVal = pcSlice->getPocMsbCycleVal() + 1;
       assert ( tempVal );
       while( 1 != tempVal )
@@ -2314,14 +2323,14 @@
     if( !pcSlice->getPocMsbValRequiredFlag() &&  pcSlice->getVPS()->getVpsPocLsbAlignedFlag()  )
     {
-      WRITE_FLAG( pcSlice->getPocMsbValPresentFlag( ) ? 1 : 0 , "poc_msb_val_present_flag" );
+      WRITE_FLAG( pcSlice->getPocMsbCycleValPresentFlag( ) ? 1 : 0 , "poc_msb_cycle_val_present_flag" );
     }
     else
     {
-      assert( pcSlice->getPocMsbValPresentFlag() ==  pcSlice->inferPocMsbValPresentFlag( ) ); 
+      assert( pcSlice->getPocMsbCycleValPresentFlag() ==  pcSlice->inferPocMsbCycleValPresentFlag( ) ); 
     }
     
-    if( pcSlice->getPocMsbValPresentFlag() )
-    {
-      WRITE_UVLC( pcSlice->getPocMsbVal( ), "poc_msb_val" );
+    if( pcSlice->getPocMsbCycleValPresentFlag() )
+    {
+      WRITE_UVLC( pcSlice->getPocMsbCycleVal( ), "poc_msb_cycle_val" );
     }
     
@@ -2347,9 +2356,5 @@
   for (Int i = 0; i < maxNumSubLayersMinus1; i++)
   {
-#if !NH_MV
-#endif
     WRITE_FLAG( pcPTL->getSubLayerProfilePresentFlag(i), "sub_layer_profile_present_flag[i]" );
-#if !NH_MV
-#endif
     WRITE_FLAG( pcPTL->getSubLayerLevelPresentFlag(i),   "sub_layer_level_present_flag[i]" );
   }
Index: trunk/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 1321)
@@ -66,5 +66,5 @@
 
 protected:
-#if NH_3D
+#if NH_MV
   TEncTop*      m_encTop; 
 #endif
@@ -179,5 +179,5 @@
   Void codeExplicitRdpcmMode( TComTU &rTu, const ComponentID compID );
 
-#if NH_3D
+#if NH_MV
   TEncTop* getEncTop()               { return m_encTop; };
   Void     setEncTop( TEncTop* et )  {  m_encTop = et; };
Index: trunk/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1321)
@@ -764,5 +764,5 @@
     if( rpcBestCU->getSlice()->getDepthIntraSkipFlag() )
     {
-      xCheckRDCostDIS( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
+      xCheckRDCostDIS( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug) );
       rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP  );
     }
@@ -795,5 +795,5 @@
             {
 #if  NH_3D_FAST_TEXTURE_ENCODING
-              xCheckRDCostInter( rpcBestCU, rpcTempCU DEBUG_STRING_PASS_INTO(sDebug), SIZE_NxN, bFMD  );
+              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug), bFMD  );
 #else
 
@@ -1096,8 +1096,8 @@
 
         if((rpcBestCU->getSlice()->getSliceType() == I_SLICE)                                     ||
-           ((!m_pcEncCfg->getDisableIntraPUsInInterSlices()) && ( // avoid very complex intra if it is unlikely
+           ((!m_pcEncCfg->getDisableIntraPUsInInterSlices()) && (
            (rpcBestCU->getCbf( 0, COMPONENT_Y  ) != 0)                                            ||
           ((rpcBestCU->getCbf( 0, COMPONENT_Cb ) != 0) && (numberValidComponents > COMPONENT_Cb)) ||
-          ((rpcBestCU->getCbf( 0, COMPONENT_Cr ) != 0) && (numberValidComponents > COMPONENT_Cr)) 
+          ((rpcBestCU->getCbf( 0, COMPONENT_Cr ) != 0) && (numberValidComponents > COMPONENT_Cr))   // avoid very complex intra if it is unlikely
  #if NH_3D_ENC_DEPTH
             || rpcBestCU->getSlice()->getIsDepth()
@@ -1785,5 +1785,7 @@
   }
 
+#if NH_MV
   D_PRINT_INC_INDENT( g_traceModeCheck, "xCheckRDCostMerge2Nx2N" );
+#endif
 
 #if NH_3D_MLC
@@ -1970,5 +1972,7 @@
   for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual )
   {
+#if NH_MV
     D_PRINT_INC_INDENT ( g_traceModeCheck, "uiNoResidual: " + n2s( uiNoResidual) );
+#endif
 
     for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand )
@@ -1983,5 +1987,7 @@
       }
 #endif
+#if NH_MV
       D_PRINT_INC_INDENT ( g_traceModeCheck, "uiMergeCand: "+  n2s(uiMergeCand) );
+#endif
 
       if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1))
@@ -2173,5 +2179,5 @@
 
               xCheckDQP( rpcTempCU );
-              xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
+              xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(bestStr) DEBUG_STRING_PASS_INTO(tmpStr) );
             }
           }
@@ -2197,5 +2203,7 @@
         }
       }
+#if NH_MV
       D_DEC_INDENT( g_traceModeCheck ); 
+#endif
     }
 
@@ -2229,5 +2237,7 @@
       }
     }
+#if NH_MV
     D_DEC_INDENT( g_traceModeCheck ); 
+#endif
   }
   DEBUG_STRING_APPEND(sDebug, bestStr)
@@ -2239,5 +2249,7 @@
  delete[] puhInterDirSP;
 #endif
+#if NH_MV
  D_DEC_INDENT( g_traceModeCheck );
+#endif
 }
 
@@ -2265,5 +2277,7 @@
   }
 
+#if NH_MV
   D_PRINT_INC_INDENT(g_traceModeCheck,   "xCheckRDCostInter; ePartSize:" + n2s( ePartSize) );
+#endif
 
 
@@ -2354,14 +2368,16 @@
   {
 #if NH_3D_ARP
-    if( nARPWMax )
-    {
-      continue;
-    }
-    else
-#endif
-    {
-      D_DEC_INDENT( g_traceModeCheck ); 
-      return;
-    }
+        if( nARPWMax )
+        {
+          continue;
+        }
+        else
+#endif
+    {
+#if NH_MV
+        D_DEC_INDENT( g_traceModeCheck ); 
+#endif
+    return;
+  }
   }
 #endif
@@ -2468,5 +2484,5 @@
 
           xCheckDQP( rpcTempCU );
-          xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
+          xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest));
         }
 
@@ -2479,5 +2495,7 @@
   }
 #endif
+#if NH_MV
   D_DEC_INDENT( g_traceModeCheck ); 
+#endif
 }
 
@@ -2683,6 +2701,7 @@
 #endif
 #if NH_3D_DIS
-Void TEncCu::xCheckRDCostDIS( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize )
+Void TEncCu::xCheckRDCostDIS( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize DEBUG_STRING_FN_DECLARE(sDebug) )
 {
+  DEBUG_STRING_NEW(sTest)
   UInt uiDepth = rpcTempCU->getDepth( 0 );
   if( !rpcBestCU->getSlice()->getIsDepth() || (eSize != SIZE_2Nx2N))
@@ -2691,5 +2710,7 @@
   }
 
+#if NH_MV
   D_PRINT_INC_INDENT(g_traceModeCheck, "xCheckRDCostDIS" );
+#endif
 
 #if NH_3D_VSO // M5
@@ -2753,5 +2774,7 @@
   xCheckDQP( rpcTempCU );
   xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth  DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest) );
+#if NH_MV
   D_DEC_INDENT( g_traceModeCheck );  
+#endif
 }
 #endif
@@ -2777,6 +2800,8 @@
     }
   }
+#if NH_MV
   D_PRINT_INC_INDENT (g_traceModeCheck, "xCheckRDCostIntra; eSize: " + n2s(eSize) );
-  
+#endif
+
   UInt uiDepth = rpcTempCU->getDepth( 0 );
 #if NH_3D_VSO // M5
@@ -2830,29 +2855,24 @@
     m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0,          true );
   }
-#if NH_3D_DIS && !NH_3D_DIS_FIX
+  m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0,          true );
+#if NH_3D_DIS
   m_pcEntropyCoder->encodeDIS( rpcTempCU, 0,          true );
   if(!rpcTempCU->getDISFlag(0))
   {
 #endif
-  m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0,          true );
-#if NH_3D_DIS_FIX
-  m_pcEntropyCoder->encodeDIS( rpcTempCU, 0,          true );
-  if(!rpcTempCU->getDISFlag(0))
-  {
-#endif
-  m_pcEntropyCoder->encodePredMode( rpcTempCU, 0,          true );
-  m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true );
-  m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0 );
-  m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true );
+    m_pcEntropyCoder->encodePredMode( rpcTempCU, 0,          true );
+    m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true );
+    m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0 );
+    m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true );
 #if NH_3D_SDC_INTRA
     m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
 #endif
 
-  // Encode Coefficients
-  Bool bCodeDQP = getdQPFlag();
-  Bool codeChromaQpAdjFlag = getCodeChromaQpAdjFlag();
-  m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, bCodeDQP, codeChromaQpAdjFlag );
-  setCodeChromaQpAdjFlag( codeChromaQpAdjFlag );
-  setdQPFlag( bCodeDQP );
+    // Encode Coefficients
+    Bool bCodeDQP = getdQPFlag();
+    Bool codeChromaQpAdjFlag = getCodeChromaQpAdjFlag();
+    m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, bCodeDQP, codeChromaQpAdjFlag );
+    setCodeChromaQpAdjFlag( codeChromaQpAdjFlag );
+    setdQPFlag( bCodeDQP );
 #if NH_3D_DIS
   }
@@ -2877,6 +2897,8 @@
   xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest));
 
+#if NH_MV
   D_DEC_INDENT( g_traceModeCheck ); 
-  }
+#endif
+}
 
 
@@ -2912,5 +2934,4 @@
   }
 #endif
-
   rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );
 #if NH_3D_DIS
Index: trunk/source/Lib/TLibEncoder/TEncCu.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCu.h	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncCu.h	(revision 1321)
@@ -163,5 +163,5 @@
 #endif
 #if NH_3D_DIS
-  Void  xCheckRDCostDIS   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
+  Void  xCheckRDCostDIS   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize DEBUG_STRING_FN_DECLARE(sDebug) );
 #endif
   Void  xCheckRDCostIntra   ( TComDataCU *&rpcBestCU,
Index: trunk/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 1321)
@@ -119,9 +119,5 @@
 Void TEncEntropy::encodeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
 {
-#if NH_3D_FIX_TICKET_98  
   if( !pcCU->getSlice()->getDepthIntraSkipFlag() )
-#else
-  if ( !pcCU->getSlice()->getIsDepth() )
-#endif
   {
     return;
Index: trunk/source/Lib/TLibEncoder/TEncEntropy.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncEntropy.h	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncEntropy.h	(revision 1321)
@@ -140,5 +140,7 @@
   Void    resetBits                 ()                        { m_pcEntropyCoderIf->resetBits();      }
   UInt    getNumberOfWrittenBits    ()                        {
+#if NH_MV
       D_PRINT_INDENT(g_encNumberOfWrittenBits,  "NumBits: " +  n2s( m_pcEntropyCoderIf->getNumberOfWrittenBits() ))
+#endif
  return m_pcEntropyCoderIf->getNumberOfWrittenBits(); }
   Void    resetEntropy              (const TComSlice *pSlice) { m_pcEntropyCoderIf->resetEntropy(pSlice);  }
Index: trunk/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 1321)
@@ -1428,9 +1428,9 @@
           if ( gopNum == MAX_GOP)
           {
-            printf( "\nError: FrameI_l%d cannot enable inter-component prediction.\n", pcSlice->getVPS()->getLayerIdInVps( getLayerId() ) );
+            printf( "\nError: FrameI_l%d cannot enable inter-component prediction on slice level. All reference layers need to be available and at least one tool using inter-component prediction must be enabled in the SPS. \n", pcSlice->getVPS()->getLayerIdInVps( getLayerId() ) );
           }
           else
           {
-            printf( "\nError: Frame%d_l%d cannot enable inter-component prediction.\n", gopNum, pcSlice->getVPS()->getLayerIdInVps( getLayerId() ) );
+            printf( "\nError: Frame%d_l%d cannot enable inter-component prediction on slice level. All reference layers need to be available and at least one tool using inter-component prediction must be enabled in the SPS. \n", gopNum, pcSlice->getVPS()->getLayerIdInVps( getLayerId() ) );
           }
           
@@ -1441,5 +1441,4 @@
       pcSlice->checkInCompPredRefLayers(); 
     }   
-
 #if NH_3D_IV_MERGE
     // This needs to be done after initialization of 3D tool parameters.
Index: trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp	(revision 1321)
@@ -826,6 +826,7 @@
       }
 
+#if NH_MV
       D_PRINT_INDENT( g_traceSAOCost, "SAO mode " + n2s( mode ) + " Cost:  " + n2s( modeCost) );
-
+#endif
       if(modeCost < minCost)
       {
Index: trunk/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1321)
@@ -1530,5 +1530,7 @@
                                   )
 {
+#if NH_MV
   D_PRINT_INC_INDENT( g_traceModeCheck, "xRecurIntraCodingLumaQT; zeroResiFlag " + n2s(zeroResiFlag) )
+#endif
 
   TComDataCU   *pcCU          = rTu.getCU();
@@ -1713,9 +1715,5 @@
       dSingleCost   = 0.0;
 #if NH_3D_ENC_DEPTH
-#if NH_3D_ENC_DEPTH_FIX
       xIntraCodingTUBlock( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSingle, false, uiSingleDistLuma, COMPONENT_Y, rTu DEBUG_STRING_PASS_INTO(sDebug), 0, zeroResiFlag );
-#else
-      xIntraCodingTUBlock( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSingle, false, uiSingleDistLuma, COMPONENT_Y, rTu DEBUG_STRING_PASS_INTO(sDebug), zeroResiFlag );
-#endif
 #else
       pcCU ->setTransformSkipSubParts ( 0, COMPONENT_Y, uiAbsPartIdx, totalAdjustedDepthChan );
@@ -1841,5 +1839,7 @@
         }
       }
+#if NH_MV
       D_DEC_INDENT( g_traceModeCheck ); 
+#endif
       return;
     }
@@ -1888,5 +1888,7 @@
   ruiDistY += uiSingleDistLuma;
   dRDCost  += dSingleCost;
+#if NH_MV
   D_DEC_INDENT( g_traceModeCheck ); 
+#endif
 }
 
@@ -1907,5 +1909,5 @@
   TComTURecurse rTu(pcCU, 0);
   const ChromaFormat chFmt     = rTu.GetChromaFormat();
-
+  DEBUG_STRING_NEW(sTemp)
   if ( uiPredMode == 0 )
   {
@@ -2031,5 +2033,5 @@
     TComTURecurse tuRecurseCU(pcCU, 0);
     TComTURecurse tuRecurseWithPU(tuRecurseCU, false, TComTU::DONT_SPLIT);
-
+    DEBUG_STRING_NEW(sTemp)
     initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, false DEBUG_STRING_PASS_INTO(sTemp) );
 
@@ -2086,5 +2088,5 @@
       
       //===== init pattern for luma prediction =====
-      
+      DEBUG_STRING_NEW(sTemp2)
       initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, bUseFilter DEBUG_STRING_PASS_INTO(sTemp2) );
       
@@ -2212,5 +2214,4 @@
 
   //===== determine distortion =====  
-#if NH_3D_INTRA_SDC_RD_FIX
 #if NH_3D_VSO  
   if( m_pcRdCost->getUseVSO() )
@@ -2219,20 +2220,4 @@
   }
   else
-#endif
-#else
-#if NH_3D_VSO  
-  if( m_pcRdCost->getUseVSO() )
-  {
-    if( m_pcRdCost->getUseEstimatedVSD() )
-    {
-      ruiDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false );
-    }
-    else
-    {
-      ruiDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPartIdx, bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false );
-    }
-  }
-  else
-#endif
 #endif
   {
@@ -2754,5 +2739,7 @@
                                   Bool        bLumaOnly )
 {
+#if NH_MV
   D_PRINT_INC_INDENT(g_traceModeCheck, "estIntraPredDis");
+#endif
 
   UInt    uiDepth        = pcCU->getDepth(0);
@@ -2772,5 +2759,7 @@
   for( UInt uiPredMode = 0; uiPredMode < 4 ; uiPredMode++ )
   {
+#if NH_MV
     D_PRINT_INC_INDENT(g_traceModeCheck, "uiPredMode" +  n2s(uiPredMode ) );
+#endif
 
     // set context models
@@ -2796,5 +2785,7 @@
       pcPredYuv->copyPartToPartYuv(pcRecoYuv, 0, uiWidth, uiHeight);
     }
+#if NH_MV
       D_DEC_INDENT( g_traceModeCheck );  
+#endif
   } 
 
@@ -2807,5 +2798,7 @@
   //===== set distortion (rate and r-d costs are determined later) =====
   pcCU->getTotalDistortion() = uiBestDist;
+#if NH_MV
   D_DEC_INDENT( g_traceModeCheck ); 
+#endif
 }
 #endif
@@ -2826,5 +2819,7 @@
                               )
 {
+#if NH_MV
   D_PRINT_INC_INDENT( g_traceModeCheck,  "estIntraPredLumaQT");
+#endif
 
   const UInt         uiDepth               = pcCU->getDepth(0);
@@ -2882,5 +2877,7 @@
   {
     const UInt uiPartOffset=tuRecurseWithPU.GetAbsPartIdxTU();
+#if NH_MV
     D_PRINT_INC_INDENT(g_traceModeCheck, "uiPartOffset: " + n2s(uiPartOffset ) );
+#endif
 
 //  for( UInt uiPU = 0, uiPartOffset=0; uiPU < uiNumPU; uiPU++, uiPartOffset += uiQNumParts )
@@ -2927,5 +2924,5 @@
       m_pcRdCost->setDistParam(distParam, sps.getBitDepth(CHANNEL_TYPE_LUMA), piOrg, uiStride, piPred, uiStride, puRect.width, puRect.height, bUseHadamard);
 
-#if NH_3D_IC_FIX
+#if NH_3D
       distParam.bUseIC = false;
 #endif
@@ -2940,5 +2937,7 @@
         Distortion uiSad  = 0;
 #endif
+#if NH_MV
         D_PRINT_INC_INDENT(g_traceModeCheck, "preTest; uiMode " + n2s(uiMode) );
+#endif
 
         const Bool bUseFilter=TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, uiMode, puRect.width, puRect.height, chFmt, sps.getSpsRangeExtension().getIntraSmoothingDisabledFlag());
@@ -2993,5 +2992,7 @@
 
         CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList );
+#if NH_MV
         D_DEC_INDENT( g_traceModeCheck ); 
+#endif
       }
 
@@ -3193,5 +3194,7 @@
 #endif
 
+#if NH_MV
       D_PRINT_INC_INDENT(g_traceModeCheck, "Test; uiOrgMode: " + n2s(uiOrgMode) );
+#endif
 
       pcCU->setIntraDirSubParts ( CHANNEL_TYPE_LUMA, uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );
@@ -3395,5 +3398,7 @@
       } // SDC loop
 #endif
+#if NH_MV
       D_DEC_INDENT( g_traceModeCheck ); 
+#endif
     } // Mode loop
 
@@ -3554,5 +3559,7 @@
     pcCU->setSDCFlagSubParts          ( bBestUseSDC, uiPartOffset, uiDepth + uiInitTrDepth );
 #endif
+#if NH_MV
     D_DEC_INDENT( g_traceModeCheck ); 
+#endif
   } while (tuRecurseWithPU.nextSection(tuRecurseCU));
 
@@ -3583,5 +3590,7 @@
   //===== set distortion (rate and r-d costs are determined later) =====
   pcCU->getTotalDistortion() = uiOverallDistY;
+#if NH_MV
   D_DEC_INDENT( g_traceModeCheck ); 
+#endif
 }
 
@@ -3892,5 +3901,7 @@
 )
 {
+#if NH_MV
   D_PRINT_INC_INDENT(g_traceModeCheck,  "xMergeEstimation" ); 
+#endif
 
   UInt uiAbsPartIdx = 0;
@@ -4014,5 +4025,7 @@
   for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand )
   {
+#if NH_MV
     D_PRINT_INC_INDENT(g_traceModeCheck,  "uiMergeCand: " + n2s(uiMergeCand) ); 
+#endif
     Distortion uiCostCand = std::numeric_limits<Distortion>::max();
     UInt       uiBitsCand = 0;
@@ -4092,5 +4105,7 @@
     uiCostCand = uiCostCand + m_pcRdCost->getCost( uiBitsCand );
 
+#if NH_MV
     D_PRINT_INDENT( g_traceRDCost, "IP RD Cost: "  + n2s(uiCostCand)); 
+#endif
 
     if ( uiCostCand < ruiCost )
@@ -4102,7 +4117,11 @@
       uiMergeIndex = uiMergeCand;
     }
+#if NH_MV
     D_DEC_INDENT( g_traceModeCheck ); 
-  }
+#endif
+  }
+#if NH_MV
   D_DEC_INDENT( g_traceModeCheck ); 
+#endif
 }
 
@@ -4142,5 +4161,7 @@
 {
 
+#if NH_MV
   D_PRINT_INC_INDENT(g_traceModeCheck,  "predInterSearch");
+#endif
 
   for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++)
@@ -4210,5 +4231,7 @@
   for ( Int iPartIdx = 0; iPartIdx < iNumPart; iPartIdx++ )
   {
+#if NH_MV
     D_PRINT_INC_INDENT(g_traceModeCheck, "iPartIdx: " + n2s(iPartIdx) );
+#endif
 
     Distortion   uiCost[2] = { std::numeric_limits<Distortion>::max(), std::numeric_limits<Distortion>::max() };
@@ -4258,5 +4281,7 @@
     for ( Int iRefList = 0; iRefList < iNumPredDir; iRefList++ )
     {
+#if NH_MV
       D_PRINT_INC_INDENT(g_traceModeCheck,  "iRefList: " + n2s(iRefList) );
+#endif
 
       RefPicList  eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
@@ -4264,5 +4289,7 @@
       for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ )
       {
+#if NH_MV
         D_PRINT_INC_INDENT(g_traceModeCheck,  "iRefIdxTemp: " + n2s(iRefIdxTemp) );
+#endif
 
         uiBitsTemp = uiMbBits[iRefList];
@@ -4338,7 +4365,11 @@
           refIdxValidList1 = iRefIdxTemp;
         }
+#if NH_MV
         D_DEC_INDENT( g_traceModeCheck ); 
-      }
+#endif
+      }
+#if NH_MV
       D_DEC_INDENT( g_traceModeCheck ); 
+#endif
     }
 
@@ -4609,5 +4640,7 @@
         xGetInterPredictionError( pcCU, pcOrgYuv, iPartIdx, uiMEError, m_pcEncCfg->getUseHADME() );
         uiMECost = uiMEError + m_pcRdCost->getCost( uiMEBits );
+#if NH_MV
         D_PRINT_INDENT( g_traceRDCost, "IP RD Cost: "  + n2s(uiMECost)); 
+#endif
       }
 #else
@@ -4756,10 +4789,14 @@
     //  MC
     motionCompensation ( pcCU, pcPredYuv, REF_PIC_LIST_X, iPartIdx );
+#if NH_MV
     D_DEC_INDENT( g_traceModeCheck ); 
+#endif
   } //  end of for ( Int iPartIdx = 0; iPartIdx < iNumPart; iPartIdx++ )
 
   setWpScalingDistParam( pcCU, -1, REF_PIC_LIST_X );
 
+#if NH_MV
   D_DEC_INDENT( g_traceModeCheck ); 
+#endif
   return;
 }
@@ -4769,5 +4806,7 @@
 Void TEncSearch::xEstimateMvPredAMVP( TComDataCU* pcCU, TComYuv* pcOrgYuv, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMvPred, Bool bFilled, Distortion* puiDistBiP )
 {
+#if NH_MV
   D_PRINT_INC_INDENT(g_traceModeCheck, "xEstimateMvPredAMVP");
+#endif
 
   AMVPInfo*  pcAMVPInfo = pcCU->getCUMvField(eRefPicList)->getAMVPInfo();
@@ -4847,9 +4886,13 @@
     if(pcCU->getSlice()->getMvdL1ZeroFlag() && eRefPicList==REF_PIC_LIST_1)
     {
+#if NH_MV
       D_PRINT_INC_INDENT(g_traceModeCheck, "Init");
+#endif
 
       (*puiDistBiP) = xGetTemplateCost( pcCU, uiPartAddr, pcOrgYuv, &m_cYuvPredTemp, rcMvPred, 0, AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdx, iRoiWidth, iRoiHeight);
 
+#if NH_MV
       D_DEC_INDENT( g_traceModeCheck ); 
+#endif
     }
     return;
@@ -4867,5 +4910,7 @@
   for ( i = 0 ; i < pcAMVPInfo->iN; i++)
   {
+#if NH_MV
     D_PRINT_INC_INDENT(g_traceModeCheck, "Cand i=" +  n2s(i) + " X: " + n2s( pcAMVPInfo->m_acMvCand[i].getHor() ) + " Y: " + n2s( pcAMVPInfo->m_acMvCand[i].getVer() ));
+#endif
 
     Distortion uiTmpCost;
@@ -4879,5 +4924,7 @@
     }
 
+#if NH_MV
     D_DEC_INDENT( g_traceModeCheck ); 
+#endif
   }
 
@@ -4889,5 +4936,7 @@
   pcCU->setMVPNumSubParts( pcAMVPInfo->iN, eRefPicList, uiPartAddr, uiPartIdx, pcCU->getDepth(uiPartAddr));
 
+#if NH_MV
   D_DEC_INDENT( g_traceModeCheck ); 
+#endif
 
   return;
@@ -5094,5 +5143,7 @@
 Void TEncSearch::xMotionEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, RefPicList eRefPicList, TComMv* pcMvPred, Int iRefIdxPred, TComMv& rcMv, UInt& ruiBits, Distortion& ruiCost, Bool bBi  )
 {
+#if NH_MV
   D_PRINT_INC_INDENT(g_traceModeCheck,  "xMotionEstimation");
+#endif
 
   UInt          uiPartAddr;
@@ -5227,6 +5278,8 @@
   ruiCost       = (Distortion)( floor( fWeight * ( (Double)ruiCost - (Double)m_pcRdCost->getCost( uiMvBits ) ) ) + (Double)m_pcRdCost->getCost( ruiBits ) );
   
+#if NH_MV
   D_PRINT_INDENT(g_traceRDCost, "ME Cost:" + n2s(ruiCost)  );
   D_DEC_INDENT  ( g_traceModeCheck ); 
+#endif
 }
 
@@ -5788,5 +5841,7 @@
                                             Bool bSkipResidual DEBUG_STRING_FN_DECLARE(sDebug) )
 {
+#if NH_MV
   D_PRINT_INC_INDENT(g_traceModeCheck, "encodeResAndCalcRdInterCU; Skip residual: " + n2s(bSkipResidual));
+#endif
 
   assert ( !pcCU->isIntra(0) );
@@ -5883,5 +5938,7 @@
     }
 #endif
+#if NH_MV
     D_DEC_INDENT( g_traceModeCheck ); 
+#endif
 
     return;
@@ -6049,5 +6106,7 @@
   }
 #endif
+#if NH_MV
   D_DEC_INDENT( g_traceModeCheck ); 
+#endif
 }
 
@@ -6207,5 +6266,7 @@
                                            DEBUG_STRING_FN_DECLARE(sDebug) )
 {
+#if NH_MV
   D_PRINT_INC_INDENT(g_traceModeCheck, "xEstimateInterResidualQT");
+#endif
 
   TComDataCU *pcCU        = rTu.getCU();
@@ -6260,5 +6321,7 @@
   if( bCheckFull )
   {
+#if NH_MV
     D_PRINT_INC_INDENT(g_traceModeCheck,  "bCheckFull" );
+#endif
 
     Double minCost[MAX_NUM_COMPONENT][2/*0 = top (or whole TU for non-4:2:2) sub-TU, 1 = bottom sub-TU*/];
@@ -6349,5 +6412,7 @@
           for (Int transformSkipModeId = 0; transformSkipModeId < transformSkipModesToTest; transformSkipModeId++)
           {
+#if NH_MV
             D_PRINT_INC_INDENT( g_traceModeCheck && ( transformSkipModeId > 0) , "TransformSkipModeId: " + n2s(transformSkipModeId) );
+#endif
 
             pcCU->setTransformSkipPartRange(transformSkipModeId, compID, subTUAbsPartIdx, partIdxesPerSubTU);
@@ -6358,5 +6423,7 @@
               const Bool bUseCrossCPrediction = crossCPredictionModeId != 0;
 
+#if NH_MV
               D_PRINT_INC_INDENT( g_traceModeCheck, "Zero" );              
+#endif
 
               m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] );
@@ -6511,11 +6578,14 @@
               }
 
+
               DEBUG_STRING_NEW(sSingleStringTest)
-
-              D_DEC_INDENT( g_traceModeCheck ); 
-
+#if NH_MV
+                D_DEC_INDENT( g_traceModeCheck ); 
+#endif
               if( currAbsSum > 0 ) //if non-zero coefficients are present, a residual needs to be derived for further prediction
               {
+#if NH_MV
                 D_PRINT_INC_INDENT(g_traceModeCheck, "NonZero");
+#endif
 
                 if (isFirstMode)
@@ -6611,5 +6681,7 @@
                 currCompCost = nonCoeffCost;
               }
+#if NH_MV
               D_DEC_INDENT( g_traceModeCheck ); 
+#endif
 
               // evaluate
@@ -6689,5 +6761,7 @@
               }
             }
+#if NH_MV
             D_DEC_INDENT( g_traceModeCheck ); 
+#endif
           }
 
@@ -6700,5 +6774,7 @@
     } // component loop
 
+#if NH_MV
     D_PRINT_INC_INDENT(g_traceModeCheck,  "Final");
+#endif
 
     for(UInt ch = 0; ch < numValidComp; ch++)
@@ -6758,6 +6834,8 @@
       dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDist );
 
+#if NH_MV
       D_DEC_INDENT( g_traceModeCheck ); 
       D_DEC_INDENT( g_traceModeCheck ); 
+#endif
   } // check full
 
@@ -6765,5 +6843,7 @@
   if( bCheckSplit )
   {
+#if NH_MV
     D_PRINT_INC_INDENT(g_traceModeCheck,  "bCheckSplit" );
+#endif
     if( bCheckFull )
     {
@@ -6935,5 +7015,7 @@
       m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_TEST ] );
     }
+#if NH_MV
     D_DEC_INDENT( g_traceModeCheck ); 
+#endif
   }
   else
@@ -6955,6 +7037,9 @@
 #endif
   }
+#if NH_MV
   D_DEC_INDENT( g_traceModeCheck ); 
+#endif
   DEBUG_STRING_APPEND(sDebug, debug_reorder_data_inter_token[MAX_NUM_COMPONENT])
+
 }
 
Index: trunk/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 1321)
@@ -351,8 +351,9 @@
 #endif
 
+#if NH_3D_DMM
   // -------------------------------------------------------------------------------------------------------------------
   // Depth intra search
   // -------------------------------------------------------------------------------------------------------------------
-#if NH_3D_DMM
+
   Void xCalcBiSegDCs              ( Pel* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& valDC1, Pel& valDC2, Pel defaultVal, Bool subSamp = false );
   Void xSearchDmmDeltaDCs         ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 );
Index: trunk/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1321)
@@ -83,5 +83,5 @@
   m_aICEnableNum = NULL;
 #endif
-#if NH_3D
+#if NH_MV
   m_cCavlcCoder.setEncTop(this); 
 #endif
@@ -350,7 +350,5 @@
     m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcPicCurr ) );
   }
-#if NH_MV
   pcPicCurr->setLayerId( getLayerId()); 
-#endif
 #if NH_3D
   pcPicCurr->setScaleOffset( m_cameraParameters->getCodedScale(), m_cameraParameters->getCodedOffset() );
@@ -361,7 +359,8 @@
 Void TEncTop::deletePicBuffer()
 {
+
+#if !NH_MV
   TComList<TComPic*>::iterator iterPic = m_cListPic.begin();
   Int iSize = Int( m_cListPic.size() );
-
   for ( Int i = 0; i < iSize; i++ )
   {
@@ -372,4 +371,5 @@
     pcPic = NULL;
   }
+#endif
 }
 
@@ -404,5 +404,5 @@
   if( gopId == 0)
   {
-    m_cGOPEncoder.initGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut);  
+    m_cGOPEncoder.initGOP(m_iPOCLast, m_iNumPicRcvd, *(m_ivPicLists->getSubDpb( getLayerId(), false )), rcListPicYuvRecOut, accessUnitsOut);  
 #else
   if (pcPicYuvOrg != NULL)
@@ -434,5 +434,5 @@
 #if NH_MV
   }
-  m_cGOPEncoder.compressPicInGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, false, false, snrCSC, m_printFrameMSE, gopId);
+  m_cGOPEncoder.compressPicInGOP(m_iPOCLast, m_iNumPicRcvd, *(m_ivPicLists->getSubDpb(getLayerId(), false) ), rcListPicYuvRecOut, accessUnitsOut, false, false, snrCSC, m_printFrameMSE, gopId);
 
   if( gopId + 1 == m_cGOPEncoder.getGOPSize() )
@@ -574,11 +574,23 @@
   // At this point, the SPS and PPS can be considered activated - they are copied to the new TComPic.
 
+#if NH_MV
+  TComList<TComPic*>& cListPic = *(m_ivPicLists->getSubDpb(getLayerId(), false) );
+  TComSlice::sortPicList(cListPic);
+#else
   TComSlice::sortPicList(m_cListPic);
-
-
+#endif
+
+
+#if NH_MV
+  if (cListPic.size() >= (UInt)(m_iGOPSize + getMaxDecPicBuffering(MAX_TLAYER-1) + 2) )
+  {
+    TComList<TComPic*>::iterator iterPic  = cListPic.begin();
+    Int iSize = Int( cListPic.size() );
+#else
   if (m_cListPic.size() >= (UInt)(m_iGOPSize + getMaxDecPicBuffering(MAX_TLAYER-1) + 2) )
   {
     TComList<TComPic*>::iterator iterPic  = m_cListPic.begin();
     Int iSize = Int( m_cListPic.size() );
+#endif
     for ( Int i = 0; i < iSize; i++ )
     {
@@ -604,5 +616,9 @@
     }
 
+#if NH_MV
+    cListPic.pushBack( rpcPic );
+#else
     m_cListPic.pushBack( rpcPic );
+#endif
   }
   rpcPic->setReconMark (false);
@@ -1056,9 +1072,5 @@
   m_cPPS.setOutputFlagPresentFlag( false );
 #if NH_MV
-#if NH_MV_FIX_TICKET_100
   m_cPPS.setNumExtraSliceHeaderBits( 2 ); 
-#else
-  m_cPPS.setNumExtraSliceHeaderBits( 3 ); 
-#endif
 #endif
   m_cPPS.setSignHideFlag(getSignHideFlag());
Index: trunk/source/Lib/TLibEncoder/TEncTop.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncTop.h	(revision 1313)
+++ trunk/source/Lib/TLibEncoder/TEncTop.h	(revision 1321)
@@ -76,5 +76,7 @@
   Int                     m_iNumPicRcvd;                  ///< number of received pictures
   UInt                    m_uiNumAllPicCoded;             ///< number of coded pictures
+#if !NH_MV
   TComList<TComPic*>      m_cListPic;                     ///< dynamic list of pictures
+#endif
 
 #if NH_MV
@@ -170,5 +172,9 @@
   // -------------------------------------------------------------------------------------------------------------------
 
+#if NH_MV
+  TComList<TComPic*>*     getListPic            () { return  m_ivPicLists->getSubDpb( getLayerId(), false);             }
+#else
   TComList<TComPic*>*     getListPic            () { return  &m_cListPic;             }
+#endif
   TEncSearch*             getPredSearch         () { return  &m_cSearch;              }
 
