Index: branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1220)
+++ branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1222)
@@ -2901,5 +2901,5 @@
 #endif
     
-#if H_3D_DBBP
+#if NH_3D_DBBP
 Void TEncCavlc::codeDBBPFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx )
 {
Index: branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncCavlc.h	(revision 1220)
+++ branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncCavlc.h	(revision 1222)
@@ -136,5 +136,5 @@
   Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
 #endif
-#if H_3D_DBBP
+#if NH_3D_DBBP
   Void codeDBBPFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
 #endif
Index: branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1220)
+++ branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1222)
@@ -79,5 +79,5 @@
   m_ppcRecoYuvTemp = new TComYuv*[m_uhTotalDepth-1];
   m_ppcOrigYuv     = new TComYuv*[m_uhTotalDepth-1];
-#if H_3D_DBBP
+#if NH_3D_DBBP
   m_ppcOrigYuvDBBP = new TComYuv*[m_uhTotalDepth-1];
 #endif
@@ -105,6 +105,6 @@
 
     m_ppcOrigYuv    [i] = new TComYuv; m_ppcOrigYuv    [i]->create(uiWidth, uiHeight, chromaFormat);
-#if H_3D_DBBP
-    m_ppcOrigYuvDBBP[i] = new TComYuv; m_ppcOrigYuvDBBP[i]->create(uiWidth, uiHeight);
+#if NH_3D_DBBP
+    m_ppcOrigYuvDBBP[i] = new TComYuv; m_ppcOrigYuvDBBP[i]->create(uiWidth, uiHeight, chromaFormat);
 #endif
 
@@ -180,5 +180,5 @@
       m_ppcOrigYuv[i]->destroy();     delete m_ppcOrigYuv[i];     m_ppcOrigYuv[i] = NULL;
     }
-#if H_3D_DBBP
+#if NH_3D_DBBP
     if(m_ppcOrigYuvDBBP[i])
     {
@@ -240,5 +240,5 @@
     m_ppcOrigYuv = NULL;
   }
-#if H_3D_DBBP
+#if NH_3D_DBBP
   if(m_ppcOrigYuvDBBP)
   {
@@ -693,5 +693,5 @@
             rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
 #endif
-#if H_3D_DBBP
+#if NH_3D_DBBP
             if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
             {
@@ -1611,5 +1611,5 @@
   // prediction Info ( Intra : direction mode, Inter : Mv, reference idx )
   m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx );
-#if H_3D
+#if NH_3D_DBBP
   m_pcEntropyCoder->encodeDBBPFlag( pcCU, uiAbsPartIdx );
 #endif
@@ -2384,13 +2384,13 @@
 }
 
-#if H_3D_DBBP
+#if NH_3D_DBBP
 Void TEncCu::xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment )
 {
-  UInt  uiWidth     = pOrigYuv->getWidth ( );
-  UInt  uiHeight    = pOrigYuv->getHeight( );
-  Pel*  piSrc       = pOrigYuv->getLumaAddr( );
-  UInt  uiSrcStride = pOrigYuv->getStride();
-  Pel*  piDst       = pOrigYuvTemp->getLumaAddr( );
-  UInt  uiDstStride = pOrigYuvTemp->getStride();
+  UInt  uiWidth     = pOrigYuv->getWidth (COMPONENT_Y);
+  UInt  uiHeight    = pOrigYuv->getHeight(COMPONENT_Y);
+  Pel*  piSrc       = pOrigYuv->getAddr(COMPONENT_Y);
+  UInt  uiSrcStride = pOrigYuv->getStride(COMPONENT_Y);
+  Pel*  piDst       = pOrigYuvTemp->getAddr(COMPONENT_Y);
+  UInt  uiDstStride = pOrigYuvTemp->getStride(COMPONENT_Y);
   
   UInt  uiMaskStride= MAX_CU_SIZE;
@@ -2417,10 +2417,10 @@
   
   // now invalidate chroma
-  Pel*  piSrcU       = pOrigYuv->getCbAddr();
-  Pel*  piSrcV       = pOrigYuv->getCrAddr();
-  UInt  uiSrcStrideC = pOrigYuv->getCStride();
-  Pel*  piDstU       = pOrigYuvTemp->getCbAddr( );
-  Pel*  piDstV       = pOrigYuvTemp->getCrAddr( );
-  UInt  uiDstStrideC = pOrigYuvTemp->getCStride();
+  Pel*  piSrcU       = pOrigYuv->getAddr(COMPONENT_Cb);
+  Pel*  piSrcV       = pOrigYuv->getAddr(COMPONENT_Cr);
+  UInt  uiSrcStrideC = pOrigYuv->getStride(COMPONENT_Cb);
+  Pel*  piDstU       = pOrigYuvTemp->getAddr(COMPONENT_Cb);
+  Pel*  piDstV       = pOrigYuvTemp->getAddr(COMPONENT_Cr);
+  UInt  uiDstStrideC = pOrigYuvTemp->getStride(COMPONENT_Cb);
   pMask = pMaskStart;
   
@@ -2443,5 +2443,7 @@
   }
 }
-
+#endif
+
+#if H_3D_DIS
 Void TEncCu::xCheckRDCostDIS( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize )
 {
@@ -2517,5 +2519,7 @@
   xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth);
 }
-
+#endif
+
+#if NH_3D_DBBP
 Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG )
 {
@@ -2539,5 +2543,5 @@
   AOF( uiWidth == uiHeight );
   
-#if H_3D_DBBP
+#if NH_3D_DBBP
   // Is this correct here, was under the macro SEC_DBBP_DISALLOW_8x8_I0078, however the function is related to Single Depth Mode
   if(uiWidth <= 8)
@@ -2591,5 +2595,6 @@
     rpcTempCU->getDBBPTmpData()->eVirtualPartSize = eVirtualPartSize;
     rpcTempCU->getDBBPTmpData()->uiVirtualPartIndex = uiSegment;
-    m_pcPredSearch->predInterSearch( rpcTempCU, m_ppcOrigYuvDBBP[uhDepth], apPredYuv[uiSegment], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], false, false, bUseMRG );
+
+    m_pcPredSearch->predInterSearch( rpcTempCU, m_ppcOrigYuvDBBP[uhDepth], apPredYuv[uiSegment], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], false, bUseMRG );
     m_pcRdCost->setUseMask(false);
     
@@ -2599,7 +2604,9 @@
     pDBBPTmpData->abMergeFlag[uiSegment] = rpcTempCU->getMergeFlag(0);
     pDBBPTmpData->auhMergeIndex[uiSegment] = rpcTempCU->getMergeIndex(0);
-    
+
+#if NH_3D_VSP
     AOF( rpcTempCU->getSPIVMPFlag(0) == false );
     AOF( rpcTempCU->getVSPFlag(0) == 0 );
+#endif
     
     for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
@@ -2620,5 +2627,5 @@
   rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
   
-  UInt uiPUOffset = ( g_auiPUOffset[UInt( eVirtualPartSize )] << ( ( rpcTempCU->getSlice()->getSPS()->getMaxCUDepth() - uhDepth ) << 1 ) ) >> 4;
+  UInt uiPUOffset = ( g_auiPUOffset[UInt( eVirtualPartSize )] << ( ( rpcTempCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uhDepth ) << 1 ) ) >> 4;
   for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )
   {
@@ -2646,5 +2653,6 @@
   
   // reconstruct final prediction signal by combining both segments
-  m_pcPredSearch->combineSegmentsWithMask(apPredYuv, m_ppcPredYuvTemp[uhDepth], pMask, uiWidth, uiHeight, 0, eVirtualPartSize);
+  Int bitDepthY = rpcTempCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);
+  m_pcPredSearch->combineSegmentsWithMask(apPredYuv, m_ppcPredYuvTemp[uhDepth], pMask, uiWidth, uiHeight, 0, eVirtualPartSize, bitDepthY);
   m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false );
   
Index: branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncCu.h
===================================================================
--- branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncCu.h	(revision 1220)
+++ branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncCu.h	(revision 1222)
@@ -82,5 +82,5 @@
   TComYuv**               m_ppcOrigYuv;     ///< Original Yuv for each depth
 
-#if H_3D_DBBP
+#if NH_3D_DBBP
   TComYuv**               m_ppcOrigYuvDBBP;
 #endif
@@ -155,5 +155,5 @@
   Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
 #endif
-#if H_3D_DBBP
+#if NH_3D_DBBP
   Void  xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment );
   Void  xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG = false );
Index: branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 1220)
+++ branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 1222)
@@ -870,8 +870,13 @@
 
 #endif
-#if H_3D_DBBP
+#if NH_3D_DBBP
 Void TEncEntropy::encodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
 {
-  if( pcCU->getSlice()->getDepthBasedBlkPartFlag() && 
+  if( bRD )
+  {
+    uiAbsPartIdx = 0;
+  }
+  
+  if( pcCU->getSlice()->getDepthBasedBlkPartFlag() &&
     ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || 
       pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && 
@@ -879,8 +884,4 @@
       pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
   {
-    if( bRD )
-    {
-      uiAbsPartIdx = 0;
-    }
     m_pcEntropyCoderIf->codeDBBPFlag( pcCU, uiAbsPartIdx );
   }
Index: branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncEntropy.h
===================================================================
--- branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncEntropy.h	(revision 1220)
+++ branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncEntropy.h	(revision 1222)
@@ -94,5 +94,5 @@
   virtual Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
 #endif
-#if H_3D_DBBP
+#if NH_3D_DBBP
   virtual Void codeDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
 #endif
@@ -183,5 +183,5 @@
   Void encodeSDCFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
 #endif
-#if H_3D_DBBP
+#if NH_3D_DBBP
   Void encodeDBBPFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
 #endif
Index: branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 1220)
+++ branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 1222)
@@ -114,5 +114,5 @@
 , m_cSDCFlagSCModel                    ( 1,             1,                       NUM_SDC_FLAG_CTX                    , m_contextModels + m_numContextModels, m_numContextModels)
 #endif                                                                                                          
-#if H_3D_DBBP                                                                                                  
+#if NH_3D_DBBP
 , m_cDBBPFlagSCModel                   ( 1,             1,                       DBBP_NUM_FLAG_CTX                   , m_contextModels + m_numContextModels, m_numContextModels)
 #endif
@@ -194,5 +194,5 @@
   m_cSDCFlagSCModel.initBuffer                    ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );
 #endif                                           
-#if H_3D_DBBP                                    
+#if NH_3D_DBBP
   m_cDBBPFlagSCModel.initBuffer                   ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );
 #endif
@@ -244,5 +244,5 @@
       curCost += m_cSDCFlagSCModel.calcCost                    ( curSliceType, qp, (UChar*)INIT_SDC_FLAG );
 #endif                                                     
-#if H_3D_DBBP                                              
+#if NH_3D_DBBP
       curCost += m_cDBBPFlagSCModel.calcCost                   ( curSliceType, qp, (UChar*)INIT_DBBP_FLAG );
 #endif
@@ -321,7 +321,4 @@
   m_cSDCFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );
 #endif
-#if H_3D_DBBP
-  m_cDBBPFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );
-#endif
 
 
@@ -2650,5 +2647,5 @@
 #endif
 
-#if H_3D_DBBP
+#if NH_3D_DBBP
 Void TEncSbac::codeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
 {
Index: branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncSbac.h
===================================================================
--- branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncSbac.h	(revision 1220)
+++ branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncSbac.h	(revision 1222)
@@ -150,5 +150,5 @@
   Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
 #endif
-#if H_3D_DBBP
+#if NH_3D_DBBP
   Void codeDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
 #endif
@@ -262,5 +262,5 @@
   ContextModel3DBuffer m_cSDCFlagSCModel;
 #endif
-#if H_3D_DBBP
+#if NH_3D_DBBP
   ContextModel3DBuffer m_cDBBPFlagSCModel;
 #endif
Index: branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1220)
+++ branches/HTM-14.1-update-dev4-RWTH/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1222)
@@ -3884,5 +3884,5 @@
   UInt uiDepth = pcCU->getDepth( uiAbsPartIdx );
 
-#if H_3D_DBBP
+#if NH_3D_DBBP
   DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
   if( pcCU->getDBBPFlag(0) )
@@ -3891,5 +3891,5 @@
     AOF( iPUIdx == 0 );
     AOF( pcCU->getPartitionSize(0) == SIZE_2Nx2N );
-    AOF( pDBBPTmpData->eVirtualPartSize != SIZE_NONE );
+    AOF( pDBBPTmpData->eVirtualPartSize != NUMBER_OF_PART_SIZES );
     
     // temporary change of partition size for candidate derivation
@@ -3916,5 +3916,5 @@
 
   PartSize partSize = pcCU->getPartitionSize( 0 );
-#if H_3D_DBBP
+#if NH_3D_DBBP
   if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && pcCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(0) == false )
 #else
@@ -3978,5 +3978,5 @@
   xRestrictBipredMergeCand( pcCU, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
 
-#if H_3D_DBBP
+#if NH_3D_DBBP
   if( pcCU->getDBBPFlag(0) )
   {
@@ -4025,5 +4025,5 @@
 #endif
 #if H_3D_VSP
-#if H_3D_DBBP
+#if NH_3D_DBBP
       if ( vspFlag[uiMergeCand] && !pcCU->getDBBPFlag(0) )
 #else
@@ -4550,5 +4550,5 @@
     } // end if bTestNormalMC
 #endif
-#if H_3D_DBBP
+#if NH_3D_DBBP
     // test merge mode for DBBP (2Nx2N)
     if ( pcCU->getPartitionSize( uiPartAddr ) != SIZE_2Nx2N || pcCU->getDBBPFlag(0) )
@@ -4649,5 +4649,5 @@
 #endif
 #if H_3D_VSP
-#if H_3D_DBBP
+#if NH_3D_DBBP
         if ( vspFlag[uiMRGIndex] && !pcCU->getDBBPFlag(uiPartAddr) )
 #else
@@ -4747,5 +4747,5 @@
   {
 
-#if H_3D_DBBP
+#if NH_3D_DBBP
     DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
     if( pcCU->getDBBPFlag(0) )
@@ -4754,5 +4754,5 @@
       AOF( uiPartIdx == 0 );
       AOF( pcCU->getPartitionSize(0) == SIZE_2Nx2N );
-      AOF( pDBBPTmpData->eVirtualPartSize != SIZE_NONE );
+      AOF( pDBBPTmpData->eVirtualPartSize != NUMBER_OF_PART_SIZES );
       AOF( iRoiWidth == iRoiHeight );
       
@@ -4779,5 +4779,5 @@
 
     pcCU->fillMvpCand( uiPartIdx, uiPartAddr, eRefPicList, iRefIdx, pcAMVPInfo );
-#if H_3D_DBBP
+#if NH_3D_DBBP
     if( pcCU->getDBBPFlag(0) )
     {
@@ -7130,5 +7130,5 @@
     m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );
 #endif
-#if H_3D
+#if NH_3D_DBBP
     m_pcEntropyCoder->encodeDBBPFlag( pcCU, 0, true );
 #endif
