Index: branches/HTM-6.2-dev3-RWTH-Fix/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- branches/HTM-6.2-dev3-RWTH-Fix/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 414)
+++ branches/HTM-6.2-dev3-RWTH-Fix/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 415)
@@ -37,13 +37,4 @@
 
 #include "TDecSbac.h"
-
-#if RWTH_SDC_DLT_B0036
-#define GetNumDepthValues()     (pcCU->getSlice()->getSPS()->getNumDepthValues())
-#define GetBitsPerDepthValue()  (pcCU->getSlice()->getSPS()->getBitsPerDepthValue())
-#if LGE_CONCATENATE_D0141
-#define PrefixThreshold ( ((GetNumDepthValues() * 3) >> 2) )
-#define BitsPerSuffix ( (UInt)ceil( Log2(GetNumDepthValues() - PrefixThreshold) ) )
-#endif
-#endif
 
 //! \ingroup TLibDecoder
@@ -2658,5 +2649,5 @@
   Int  iIdx       = 0;
   
-  UInt uiMaxResidualBits  = GetBitsPerDepthValue();
+  UInt uiMaxResidualBits  = pcCU->getSlice()->getSPS()->getBitsPerDepthValue();
   assert( uiMaxResidualBits <= g_uiBitDepth );
   
@@ -2680,5 +2671,7 @@
     //prefix part
     UInt uiCount = 0;
-    for ( UInt ui = 0; ui < PrefixThreshold; ui++)
+    UInt uiNumDepthValues = pcCU->getSlice()->getSPS()->getNumDepthValues();
+    UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2);
+    for ( UInt ui = 0; ui < uiPrefixThreshold; ui++)
     {
         m_pcTDecBinIf->decodeBin( uiBit, m_cSDCResidualSCModel.get(0, 0, 0) );
@@ -2689,7 +2682,7 @@
     }
     //suffix part
-    if ( uiCount == PrefixThreshold )
-    {
-        for ( UInt ui = 0; ui < BitsPerSuffix; ui++ )
+    if ( uiCount == uiPrefixThreshold )
+    {
+        for ( UInt ui = 0; ui < ( (UInt)ceil( Log2(uiNumDepthValues - uiPrefixThreshold) ) ); ui++ )
         {
             m_pcTDecBinIf->decodeBinEP( uiBit );
Index: branches/HTM-6.2-dev3-RWTH-Fix/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- branches/HTM-6.2-dev3-RWTH-Fix/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 414)
+++ branches/HTM-6.2-dev3-RWTH-Fix/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 415)
@@ -41,13 +41,4 @@
 #include <map>
 #include <algorithm>
-
-#if RWTH_SDC_DLT_B0036
-#define GetNumDepthValues()     (pcCU->getSlice()->getSPS()->getNumDepthValues())
-#define GetBitsPerDepthValue()  (pcCU->getSlice()->getSPS()->getBitsPerDepthValue())
-#if LGE_CONCATENATE_D0141
-#define PrefixThreshold ( ((GetNumDepthValues() * 3) >> 2) )
-#define BitsPerSuffix ( (UInt)ceil( Log2(GetNumDepthValues() - PrefixThreshold) ) )
-#endif
-#endif
 
 //! \ingroup TLibEncoder
@@ -2657,5 +2648,5 @@
 #endif
   
-  UInt uiMaxResidualBits  = GetBitsPerDepthValue();
+  UInt uiMaxResidualBits  = pcCU->getSlice()->getSPS()->getBitsPerDepthValue();
   assert( uiMaxResidualBits <= g_uiBitDepth );
   
@@ -2675,6 +2666,7 @@
     m_pcBinIf->encodeBin( uiSign, m_cSDCResidualSignFlagSCModel.get( 0, uiSegment, 0 ) ); //TODO depthmap: more sophisticated context selection
 #endif
-        
-    assert(uiAbsIdx < GetNumDepthValues());
+    
+    UInt uiNumDepthValues = pcCU->getSlice()->getSPS()->getNumDepthValues();
+    assert(uiAbsIdx < uiNumDepthValues);
     
     // encode residual magnitude
@@ -2688,5 +2680,6 @@
         UInt l = uiAbsIdx;
         UInt k = 0;
-        while ( l > 0 && k < PrefixThreshold )
+        UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2);
+        while ( l > 0 && k < uiPrefixThreshold )
         {
             m_pcBinIf->encodeBin( 1, m_cSDCResidualSCModel.get(0, 0, 0) );
@@ -2694,11 +2687,11 @@
             k++;
         }
-        if ( uiAbsIdx < PrefixThreshold )
+        if ( uiAbsIdx < uiPrefixThreshold )
             m_pcBinIf->encodeBin( 0, m_cSDCResidualSCModel.get(0, 0, 0) );
         //suffix part
         else
         {
-            uiAbsIdx -= PrefixThreshold;
-            UInt uiSuffixLength = BitsPerSuffix;
+            uiAbsIdx -= uiPrefixThreshold;
+            UInt uiSuffixLength = ( (UInt)ceil( Log2(uiNumDepthValues - uiPrefixThreshold) ) );
             UInt uiBitInfo = 0;
             for ( Int i = 0; i < uiSuffixLength; i++)
