Index: branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.h	(revision 683)
+++ branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.h	(revision 684)
@@ -1891,6 +1891,6 @@
 #endif
 #if Q0048_CGS_3D_ASYMLUT
-  Int     getCGSFlag()     { return m_nCGSFlag;  }
-  Void    setCGSFlag(Int n){ m_nCGSFlag = n;     }
+  Int     getCGSFlag()                { return m_nCGSFlag;  }
+  Void    setCGSFlag(Int n)           { m_nCGSFlag = n;     }
   Int     getCGSOutputBitDepthY()     { return m_nCGSOutputBitDepthY;  }
   Void    setCGSOutputBitDepthY(Int n){ m_nCGSOutputBitDepthY = n;     }
Index: branches/SHM-6-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibCommon/TypeDef.h	(revision 683)
+++ branches/SHM-6-dev/source/Lib/TLibCommon/TypeDef.h	(revision 684)
@@ -86,5 +86,5 @@
 #define O0194_JOINT_US_BITSHIFT          1      ///< JCTVC-O0194: Joint Upsampling and bit-shift
 #endif
-#define Q0048_CGS_3D_ASYMLUT             1
+#define Q0048_CGS_3D_ASYMLUT             1      ///< JCTVC-Q0048: Colour gamut scalability with look-up table
 #if Q0048_CGS_3D_ASYMLUT
 #define O0194_WEIGHTED_PREDICTION_CGS    0
Index: branches/SHM-6-dev/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibDecoder/TDecEntropy.h	(revision 683)
+++ branches/SHM-6-dev/source/Lib/TLibDecoder/TDecEntropy.h	(revision 684)
@@ -145,13 +145,10 @@
   Void    decodeSPS                   ( TComSPS* pcSPS     )    { m_pcEntropyDecoderIf->parseSPS(pcSPS);                    }
 #endif
-  Void    decodePPS                   ( TComPPS* pcPPS 
+
 #if Q0048_CGS_3D_ASYMLUT
-    , TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID
+  Void    decodePPS                   ( TComPPS* pcPPS, TCom3DAsymLUT * pc3DAsymLUT, Int nLayerID )    { m_pcEntropyDecoderIf->parsePPS(pcPPS, pc3DAsymLUT , nLayerID );                     }
+#else
+  Void    decodePPS                   ( TComPPS* pcPPS )    { m_pcEntropyDecoderIf->parsePPS(pcPPS );  }
 #endif
-    )    { m_pcEntropyDecoderIf->parsePPS(pcPPS
-#if Q0048_CGS_3D_ASYMLUT
-    , pc3DAsymLUT , nLayerID
-#endif
-    );                    }
   Void    decodeSliceHeader           ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)  { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager);         }
 
Index: branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 683)
+++ branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 684)
@@ -1553,5 +1553,7 @@
         {
           if(!m_pColorMappedPic)
+          {
             initAsymLut(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0));
+          }
           m_c3DAsymLUTPPS.colorMapping( pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(),  m_pColorMappedPic );
           pBaseColRec = m_pColorMappedPic;
@@ -1561,9 +1563,4 @@
         if( pcPic->isSpatialEnhLayer(refLayerIdc) )
         {    
-/*#if O0098_SCALED_REF_LAYER_ID
-          Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc));
-#else
-          Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
-#endif*/
 #if O0215_PHASE_ALIGNMENT
 #if O0194_JOINT_US_BITSHIFT
Index: branches/SHM-6-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp	(revision 683)
+++ branches/SHM-6-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp	(revision 684)
@@ -28,5 +28,8 @@
 {
   if( m_pColorInfo != NULL )
+  {
     destroy();
+  }
+
   TCom3DAsymLUT::create( nMaxOctantDepth , nInputBitDepth , nInputBitDepthC, nOutputBitDepth , nOutputBitDepthC, nMaxYPartNumLog2 );
   xAllocate3DArray( m_pColorInfo , xGetYSize() , xGetUSize() , xGetVSize() );
@@ -48,5 +51,8 @@
 {
   if( m_dTotalFrameBit != 0 )
+  {
     printf( "\nTotal CGS bit: %d, %.2lf%%" , m_nTotalCGSBit , m_nTotalCGSBit * 100 / m_dTotalFrameBit );
+  }
+
   destroy();
 }
@@ -95,12 +101,20 @@
         Int nP3 = Clip3( nMin , nMax , nP1 + nDeltaP13 );
         Int nP7 = Clip3( nMin , nMax , nP3 + nDeltaP37 );
-        if ( nP0 & nMask )  
+        if ( nP0 & nMask )
+        {
           nP0 -= ( nP0 & nMask );
-        if ( nP1 & nMask )  
+        }
+        if ( nP1 & nMask )
+        {
           nP1 -= ( nP1 & nMask );
-        if ( nP3 & nMask )  
+        }
+        if ( nP3 & nMask )
+        {
           nP3 -= ( nP3 & nMask );
-        if ( nP7 & nMask )  
+        }
+        if ( nP7 & nMask )
+        {
           nP7 -= ( nP7 & nMask );
+        }
         assert( !( nP0 & nMask ) && !( nP1 & nMask ) && !( nP3 & nMask ) && !( nP7 & nMask ) );
         Double dError = xxCalEstDist( N , Ys , Yy , Yu , Yv , ys , us , vs , yy , yu , yv , uu , uv , vv , YY , y0 , u0 , v0 , nLengthY , nLengthUV , nP0 , nP1 , nP3 , nP7 );
@@ -154,5 +168,5 @@
             y0 , u0 , v0 , nLengthY , nLengthUV , rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V );
         }
-    }
+      }
     }
   }
@@ -184,8 +198,11 @@
     }
     else
+    {
       break;
+    }
   }
   setResQuantBit( nBestResQuanBit );
   xSaveCuboids( m_pBestEncCuboid );
+
   return( dCurError );
 }
@@ -211,5 +228,7 @@
         Int v0 = vIdx << xGetVShift2Idx();
         for( Int idxVertex = 0 ; idxVertex < 4 ; idxVertex++ )
+        {
           rCuboid.P[idxVertex] = xGetCuboidVertexPredAll( yIdx , uIdx , vIdx , idxVertex , pCurCuboid );
+        }
 
         if( rCuboidColorInfo.N > 0 )
@@ -389,5 +408,7 @@
   Int nPartNumLog2 = 4;
   if( pSlice->getBaseColPic( pSlice->getInterLayerPredLayerIdc( 0 ) )->getSlice( 0 )->isIntra() )
+  {
     nPartNumLog2 = xGetMaxPartNumLog2();
+  }
   if( m_nPrevFrameBit[nSliceType][nSliceTempLevel] && pSlice->getPPS()->getCGSFlag() ) 
   {
Index: branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCfg.h	(revision 683)
+++ branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCfg.h	(revision 684)
@@ -911,12 +911,12 @@
 #endif
 #if Q0048_CGS_3D_ASYMLUT
-  Void      setCGSFlag(Int n)  { m_nCGSFlag = n;    }
-  Int       getCGSFlag()       { return m_nCGSFlag; }
-  Void      setCGSMaxOctantDepth(Int n)  { m_nCGSMaxOctantDepth = n;    }
-  Int       getCGSMaxOctantDepth()       { return m_nCGSMaxOctantDepth; }
+  Void      setCGSFlag(Int n)             { m_nCGSFlag = n;    }
+  Int       getCGSFlag()                  { return m_nCGSFlag; }
+  Void      setCGSMaxOctantDepth(Int n)   { m_nCGSMaxOctantDepth = n;    }
+  Int       getCGSMaxOctantDepth()        { return m_nCGSMaxOctantDepth; }
   Void      setCGSMaxYPartNumLog2(Int n)  { m_nCGSMaxYPartNumLog2 = n;    }
   Int       getCGSMaxYPartNumLog2()       { return m_nCGSMaxYPartNumLog2; }
-  Void      setCGSLUTBit(Int n)  { m_nCGSLUTBit = n;    }
-  Int       getCGSLUTBit()       { return m_nCGSLUTBit; }
+  Void      setCGSLUTBit(Int n)           { m_nCGSLUTBit = n;    }
+  Int       getCGSLUTBit()                { return m_nCGSLUTBit; }
 #endif
 #endif
Index: branches/SHM-6-dev/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 683)
+++ branches/SHM-6-dev/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 684)
@@ -79,17 +79,17 @@
 }
 
-Void TEncEntropy::encodePPS( TComPPS* pcPPS 
 #if Q0048_CGS_3D_ASYMLUT
-  , TEnc3DAsymLUT * pc3DAsymLUT
+Void TEncEntropy::encodePPS( TComPPS* pcPPS, TEnc3DAsymLUT * pc3DAsymLUT  )
+{
+  m_pcEntropyCoderIf->codePPS( pcPPS, pc3DAsymLUT );
+  return;
+}
+#else
+Void TEncEntropy::encodePPS( TComPPS* pcPPS )
+{
+  m_pcEntropyCoderIf->codePPS( pcPPS );
+  return;
+}
 #endif
-  )
-{
-  m_pcEntropyCoderIf->codePPS( pcPPS 
-#if Q0048_CGS_3D_ASYMLUT
-    , pc3DAsymLUT
-#endif
-    );
-  return;
-}
 
 Void TEncEntropy::encodeSPS( TComSPS* pcSPS )
Index: branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 683)
+++ branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 684)
@@ -981,9 +981,4 @@
         if( pcPic->isSpatialEnhLayer(refLayerIdc))
         {
-/*#if O0098_SCALED_REF_LAYER_ID
-          Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc));
-#else
-          Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
-#endif*/
 #if P0312_VERT_PHASE_ADJ
           //when PhasePositionEnableFlag is equal to 1, set vertPhasePositionFlag to 0 if BL is top field and 1 if bottom
@@ -3432,6 +3427,8 @@
 #if Q0048_CGS_3D_ASYMLUT
   pcPic->setFrameBit( (Int)uibits );
-  if( m_layerId && pcSlice->getPPS()->getCGSFlag())
+  if( m_layerId && pcSlice->getPPS()->getCGSFlag() )
+  {
     m_Enc3DAsymLUTPicUpdate.updatePicCGSBits( pcSlice , m_Enc3DAsymLUTPPS.getPPSBit() );
+  }
 #endif
 }
@@ -4159,5 +4156,7 @@
     pSlice->setCGSOverWritePPS( dErrorUpdatedPPS < dFactor * dErrorPPS );
     if( pSlice->getCGSOverWritePPS() )
+    {
       m_Enc3DAsymLUTPPS.copy3DAsymLUT( &m_Enc3DAsymLUTPicUpdate );
+    }
   }
   pSlice->getPPS()->setCGSOutputBitDepthY( m_Enc3DAsymLUTPPS.getOutputBitDepthY() );
