Index: /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1175)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1176)
@@ -2486,5 +2486,5 @@
       READ_FLAG(uiCode, "slice_sao_luma_flag");  rpcSlice->setSaoEnabledFlag((Bool)uiCode);
 #if H_3D_DISABLE_CHROMA
-      if( !rpcSlice->getIsDepth() )
+      if( rpcSlice->getSPS()->getChromaFormatIdc() != 0 )
       {
       READ_FLAG(uiCode, "slice_sao_chroma_flag");  rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode);
@@ -3271,5 +3271,5 @@
   wpScalingParam  *wp;
 #if H_3D_DISABLE_CHROMA
-  Bool            bChroma     = !pcSlice->getIsDepth();
+  Bool            bChroma     = ( pcSlice->getSPS()->getChromaFormatIdc() != 0 ); 
 #else
   Bool            bChroma     = true; // color always present in HEVC ?
Index: /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 1175)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 1176)
@@ -184,5 +184,5 @@
     if(!pcCU->getSDCFlag(uiAbsPartIdx) && !pcCU->getSlice()->getIsDepth() )
 #else
-    if(!pcCU->getSlice()->getIsDepth() )
+    if(!pcCU->getSDCFlag(uiAbsPartIdx) && pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0  )
 #endif
 #else
@@ -867,5 +867,5 @@
     {
 #if H_3D_DISABLE_CHROMA
-      if (!pcCU->getSlice()->getIsDepth() )      
+      if (pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 )      
       {
       if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) )
@@ -1061,5 +1061,5 @@
     assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 );
 #if H_3D_DISABLE_CHROMA
-    if (!pcCU->getSlice()->getIsDepth() )
+    if (pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 )
     {
       assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );
Index: /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 1175)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 1176)
@@ -503,5 +503,5 @@
 
 #if H_3D_DISABLE_CHROMA
-    if( !pcCU->getSlice()->getIsDepth() )
+    if( pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 )
     {    
 #endif
Index: /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1175)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1176)
@@ -1659,5 +1659,9 @@
   // Encode Coefficients
   Bool bCodeDQP = getdQPFlag();
+#if H_3D_DISABLE_CHROMA
+  m_pcEntropyCoder->encodeCoeff( pcCU, uiAbsPartIdx, uiDepth, pcCU->getWidth (uiAbsPartIdx), pcCU->getHeight(uiAbsPartIdx), bCodeDQP, false );
+#else
   m_pcEntropyCoder->encodeCoeff( pcCU, uiAbsPartIdx, uiDepth, pcCU->getWidth (uiAbsPartIdx), pcCU->getHeight(uiAbsPartIdx), bCodeDQP );
+#endif
   setdQPFlag( bCodeDQP );
 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
@@ -2858,5 +2862,11 @@
   // Encode Coefficients
   Bool bCodeDQP = getdQPFlag();
+#if H_3D_DISABLE_CHROMA
+  m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP, true );
+#else
   m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP );
+#endif
+
+
   setdQPFlag( bCodeDQP );
 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
Index: /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 1175)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 1176)
@@ -304,5 +304,9 @@
 }
 
+#if H_3D_DISABLE_CHROMA
+Void TEncEntropy::xEncodeTransform( TComDataCU* pcCU,UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP, Bool rd )
+#else
 Void TEncEntropy::xEncodeTransform( TComDataCU* pcCU,UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP )
+#endif
 {
 
@@ -325,5 +329,11 @@
   UInt cbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
   UInt cbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
-
+#if H_3D_DISABLE_CHROMA
+  if( !rd && pcCU->getSlice()->getSPS()->getChromaFormatIdc() == 0 )
+  {
+    cbfU = 0;
+    cbfV = 0;
+  }
+#endif
   if(uiTrIdx==0)
   {
@@ -342,4 +352,11 @@
       cbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
       cbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
+#if H_3D_DISABLE_CHROMA
+      if( !rd && pcCU->getSlice()->getSPS()->getChromaFormatIdc() == 0 )
+      {
+        cbfU = 0;
+        cbfV = 0;
+      }
+#endif
     }
   }
@@ -383,5 +400,5 @@
   {
 #if H_3D_DISABLE_CHROMA
-    if (!pcCU->getSlice()->getIsDepth() )
+    if (pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 || rd)
     {
       if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr - 1 ) )
@@ -394,15 +411,4 @@
       }
     }
-    else
-    {
-      if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr - 1 ) )
-      {
-        assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr ) == 0 );
-      }
-      if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr - 1 ) )
-      {
-        assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr ) == 0  );
-      }
-    }
 #else
     if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr - 1 ) )
@@ -418,6 +424,14 @@
   else if( uiLog2TrafoSize == 2 )
   {
+#if H_3D_DISABLE_CHROMA
+    if ( rd && pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 )
+    {
     assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr ) == pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr - 1 ) );
     assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr ) == pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr - 1 ) );
+  }
+#else
+    assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr ) == pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr - 1 ) );
+    assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr ) == pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr - 1 ) );
+#endif
   }
   
@@ -432,4 +446,16 @@
     const UInt partNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
     
+#if H_3D_DISABLE_CHROMA
+    xEncodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP, rd );
+
+    uiAbsPartIdx += partNum;  offsetLuma += size;  offsetChroma += (size>>2);
+    xEncodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP ,rd );
+
+    uiAbsPartIdx += partNum;  offsetLuma += size;  offsetChroma += (size>>2);
+    xEncodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP, rd );
+
+    uiAbsPartIdx += partNum;  offsetLuma += size;  offsetChroma += (size>>2);
+    xEncodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP, rd );
+#else
     xEncodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP );
 
@@ -442,4 +468,5 @@
     uiAbsPartIdx += partNum;  offsetLuma += size;  offsetChroma += (size>>2);
     xEncodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP );
+#endif
   }
   else
@@ -458,5 +485,11 @@
 #endif
     
+#if H_3D_DISABLE_CHROMA
+    Bool notcbfUV = !rd && pcCU->getSlice()->getSPS()->getChromaFormatIdc() == 0 ? 1 : ( !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, 0 ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, 0 ) ) ;
+    if( pcCU->getPredictionMode(uiAbsPartIdx) != MODE_INTRA && 
+      uiDepth == pcCU->getDepth( uiAbsPartIdx ) && notcbfUV ) 
+#else
     if( pcCU->getPredictionMode(uiAbsPartIdx) != MODE_INTRA && uiDepth == pcCU->getDepth( uiAbsPartIdx ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, 0 ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, 0 ) )
+#endif
     {
       assert( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, 0 ) );
@@ -548,5 +581,5 @@
 #if H_3D_DIM_SDC
 #if H_3D_DISABLE_CHROMA
-    if(!pcCU->getSDCFlag(uiAbsPartIdx) && !pcCU->getSlice()->getIsDepth() )
+    if(!pcCU->getSDCFlag(uiAbsPartIdx) && ( !pcCU->getSlice()->getIsDepth() || bRD ) ) 
 #else
     if(!pcCU->getSDCFlag(uiAbsPartIdx))
@@ -719,5 +752,9 @@
  * \param uiHeight
  */
+#if H_3D_DISABLE_CHROMA
+Void TEncEntropy::encodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP, Bool rd )
+#else
 Void TEncEntropy::encodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP )
+#endif
 {
   UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight();
@@ -794,5 +831,9 @@
   }
   
+#if H_3D_DISABLE_CHROMA
+  xEncodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, bCodeDQP, rd);
+#else
   xEncodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, bCodeDQP);
+#endif
 }
 
Index: /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncEntropy.h
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncEntropy.h	(revision 1175)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncEntropy.h	(revision 1176)
@@ -226,7 +226,13 @@
 
 private:
+#if H_3D_DISABLE_CHROMA
+  Void xEncodeTransform        ( TComDataCU* pcCU,UInt offsetLumaOffset, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP, Bool rd );
+public:
+  Void encodeCoeff             ( TComDataCU* pcCU,                 UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP, Bool rd );
+#else
   Void xEncodeTransform        ( TComDataCU* pcCU,UInt offsetLumaOffset, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP );
 public:
   Void encodeCoeff             ( TComDataCU* pcCU,                 UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP );
+#endif
   
   Void encodeCoeffNxN         ( TComDataCU* pcCU, TCoeff* pcCoeff, UInt uiAbsPartIdx, UInt uiTrWidth, UInt uiTrHeight, UInt uiDepth, TextType eType );
Index: /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1175)
+++ /branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1176)
@@ -2329,5 +2329,9 @@
 
   Bool bDummy = false;
+#if H_3D_DISABLE_CHROMA
+  m_pcEntropyCoder->encodeCoeff( pcCU, 0, pcCU->getDepth( 0 ), uiWidth, uiHeight, bDummy, true );
+#else
   m_pcEntropyCoder->encodeCoeff( pcCU, 0, pcCU->getDepth( 0 ), uiWidth, uiHeight, bDummy );
+#endif
   UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();
 
@@ -7541,5 +7545,9 @@
 #endif
     Bool bDummy = false;
+#if H_3D_DISABLE_CHROMA
+    m_pcEntropyCoder->encodeCoeff   ( pcCU, 0, pcCU->getDepth(0), pcCU->getWidth(0), pcCU->getHeight(0), bDummy, true );
+#else
     m_pcEntropyCoder->encodeCoeff   ( pcCU, 0, pcCU->getDepth(0), pcCU->getWidth(0), pcCU->getHeight(0), bDummy );
+#endif
     
     ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits();
