Index: /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComDataCU.cpp	(revision 820)
+++ /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComDataCU.cpp	(revision 821)
@@ -2432,5 +2432,7 @@
   // DBBP is a texture coding tool
   if( getSlice()->getIsDepth() )
+  {
     return NULL;
+  }
   
 #if H_3D_FCO
@@ -2454,5 +2456,7 @@
     
     if( baseDepthPic == NULL || baseDepthPic->getPicYuvRec() == NULL )
+    {
       return NULL;
+    }
     
     depthPicYuv   = baseDepthPic->getPicYuvRec();
@@ -5939,5 +5943,7 @@
 #if H_3D_DBBP
   if( getDBBPFlag(0) )
+  {
     return true;
+  }
 #endif
 
Index: /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComPrediction.cpp	(revision 820)
+++ /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComPrediction.cpp	(revision 821)
@@ -651,13 +651,21 @@
       // SIZE_Nx2N
       if(x<uiHalfSize)  // left
+      {
         matchedPartSum[0][ucSegment]++;
+      }
       else  // right
+      {
         matchedPartSum[0][1-ucSegment]++;
+      }
       
       // SIZE_2NxN
       if(y<uiHalfSize)  // top
+      {
         matchedPartSum[1][ucSegment]++;
+      }
       else  // bottom
+      {
         matchedPartSum[1][1-ucSegment]++;
+      }
       
       if( bAMPAvail )
@@ -665,25 +673,41 @@
         // SIZE_2NxnU
         if(y<uiQuarterSize)  // top (1/4)
+        {
           matchedPartSum[2][ucSegment]++;
+        }
         else  // bottom (3/4)
+        {
           matchedPartSum[2][1-ucSegment]++;
+        }
         
         // SIZE_2NxnD
         if(y<(uiQuarterSize*3))  // top (3/4)
+        {
           matchedPartSum[3][ucSegment]++;
+        }
         else  // bottom (1/4)
+        {
           matchedPartSum[3][1-ucSegment]++;
+        }
         
         // SIZE_nLx2N
         if(x<uiQuarterSize)  // left (1/4)
+        {
           matchedPartSum[4][ucSegment]++;
+        }
         else  // right (3/4)
+        {
           matchedPartSum[4][1-ucSegment]++;
+        }
         
         // SIZE_nRx2N
         if(x<(uiQuarterSize*3))  // left (3/4)
+        {
           matchedPartSum[5][ucSegment]++;
+        }
         else  // right (1/4)
+        {
           matchedPartSum[5][1-ucSegment]++;
+        }
       }
     }
@@ -730,7 +754,11 @@
       
       if( depthPel > uiMaxDepth )
+      {
         uiMaxDepth = depthPel;
+      }
       if( depthPel < uiMinDepth )
+      {
         uiMinDepth = depthPel;
+      }
     }
     
@@ -741,5 +769,7 @@
   // don't generate mask for blocks with small depth range (encoder decision)
   if( uiMaxDepth - uiMinDepth < 10 )
+  {
     return false;
+  }
   
   AOF(uiWidth==uiHeight);
@@ -764,5 +794,7 @@
       
       if( bInvertMask )
+      {
         ucSegment = 1-ucSegment;
+      }
       
       // count pixels for each segment
@@ -782,5 +814,7 @@
   UInt uiMinPixPerSegment = (uiWidth*uiHeight) >> 3;
   if( !( uiSumPix[0] > uiMinPixPerSegment && uiSumPix[1] > uiMinPixPerSegment ) )
+  {
     return false;
+  }
   
   // all good
Index: /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRdCost.cpp
===================================================================
--- /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRdCost.cpp	(revision 820)
+++ /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRdCost.cpp	(revision 821)
@@ -327,16 +327,26 @@
   
 #if H_3D_DBBP
-  if( g_bTestVirtualParts )
+  if( m_bUseMask )
   {
     if( eDFunc >= DF_SSE && eDFunc <= DF_SSE16N )
+    {
       rcDistParam.DistFunc = TComRdCost::xGetMaskedSSE;
+    }
     else if( eDFunc >= DF_SAD && eDFunc <= DF_SADS16N )
+    {
       rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
+    }
     else if( eDFunc >= DF_HADS && eDFunc <= DF_HADS16N )
+    {
       rcDistParam.DistFunc = TComRdCost::xGetMaskedHADs;
+    }
     else if( eDFunc >= DF_VSD && eDFunc <= DF_VSD16N )
+    {
       rcDistParam.DistFunc = TComRdCost::xGetMaskedVSD;
+    }
     else if( eDFunc >= DF_SAD12 && eDFunc <= DF_SADS48 )
+    {
       rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
+    }
   }
 #endif
@@ -377,5 +387,5 @@
   
 #if H_3D_DBBP
-  if( g_bTestVirtualParts )
+  if( m_bUseMask )
   {
     rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
@@ -436,10 +446,7 @@
   
 #if H_3D_DBBP
-  if( g_bTestVirtualParts )
-  {
-    if( !bHADME )
-      rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
-    else
-      rcDistParam.DistFunc = TComRdCost::xGetMaskedHADs;
+  if( m_bUseMask )
+  {
+    rcDistParam.DistFunc = (bHADME)?TComRdCost::xGetMaskedHADs:TComRdCost::xGetMaskedSAD;
   }
 #endif
@@ -468,10 +475,7 @@
   
 #if H_3D_DBBP
-  if( g_bTestVirtualParts )
-  {
-    if( !bHadamard )
-      rcDP.DistFunc = TComRdCost::xGetMaskedSAD;
-    else
-      rcDP.DistFunc = TComRdCost::xGetMaskedHADs;
+  if( m_bUseMask )
+  {
+    rcDP.DistFunc = (bHadamard)?TComRdCost::xGetMaskedHADs:TComRdCost::xGetMaskedSAD;
   }
 #endif
@@ -735,5 +739,7 @@
     {
       if( piOrg[n] != DBBP_INVALID_SHORT )
+      {
         uiSum += abs( piOrg[n] - piCur[n] );
+      }
     }
     piOrg += iStrideOrg;
@@ -775,5 +781,7 @@
         {
           if( piOrg[x] != DBBP_INVALID_SHORT )
+          {
             uiSum += xCalcHADs8x8( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
+          }
         }
         piOrg += iOffsetOrg;
@@ -791,5 +799,7 @@
         {
           if( piOrg[x] != DBBP_INVALID_SHORT )
+          {
             uiSum += xCalcHADs16x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
+          }
         }
         piOrg += iOffsetOrg;
@@ -806,5 +816,7 @@
         {
           if( piOrg[x] != DBBP_INVALID_SHORT )
+          {
             uiSum += xCalcHADs4x16( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
+          }
         }
         piOrg += iOffsetOrg;
@@ -823,5 +835,7 @@
         {
           if( piOrg[x] != DBBP_INVALID_SHORT )
+          {
             uiSum += xCalcHADs4x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
+          }
         }
         piOrg += iOffsetOrg;
@@ -838,5 +852,7 @@
         {
           if( piOrg[x] != DBBP_INVALID_SHORT )
+          {
             uiSum += xCalcHADs2x2( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
+          }
         }
         piOrg += iOffsetOrg;
Index: /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRdCost.h
===================================================================
--- /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRdCost.h	(revision 820)
+++ /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRdCost.h	(revision 821)
@@ -184,4 +184,8 @@
 #endif
   
+#if H_3D_DBBP
+  Bool                    m_bUseMask;
+#endif
+  
 public:
   TComRdCost();
@@ -229,4 +233,8 @@
   Void    setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME=false );
   Void    setDistParam( DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false );
+#endif
+  
+#if H_3D_DBBP
+  Void    setUseMask(Bool b) { m_bUseMask = b; }
 #endif
   
Index: /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRom.cpp	(revision 820)
+++ /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRom.cpp	(revision 821)
@@ -106,8 +106,4 @@
 // ====================================================================================================================
 
-#if H_3D_DBBP
-Bool g_bTestVirtualParts;
-#endif
-
 UInt g_uiMaxCUWidth  = MAX_CU_SIZE;
 UInt g_uiMaxCUHeight = MAX_CU_SIZE;
Index: /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRom.h
===================================================================
--- /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRom.h	(revision 820)
+++ /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRom.h	(revision 821)
@@ -72,8 +72,4 @@
 // ====================================================================================================================
 
-#if H_3D_DBBP
-extern       Bool   g_bTestVirtualParts;
-#endif
-
 // flexible conversion from relative to absolute index
 extern       UInt   g_auiZscanToRaster[ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
Index: /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder/TEncCu.cpp	(revision 820)
+++ /branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder/TEncCu.cpp	(revision 821)
@@ -2438,5 +2438,7 @@
   
   if( !bValidMask )
+  {
     return;
+  }
   
   // find optimal motion/disparity vector for each segment
@@ -2458,9 +2460,9 @@
     
     // do motion estimation for this segment
-    g_bTestVirtualParts = true;
+    m_pcRdCost->setUseMask(true);
     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 );
-    g_bTestVirtualParts = false;
+    m_pcRdCost->setUseMask(false);
     
     // extract motion parameters of full block for this segment
