Index: /branches/SHM-4.1-dev/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/SHM-4.1-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 501)
+++ /branches/SHM-4.1-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 502)
@@ -148,4 +148,11 @@
   {
     RepFormat *repFormat = vps->getVpsRepFormat( idx );
+#if REPN_FORMAT_CONTROL_FLAG
+    repFormat->setChromaAndBitDepthVpsPresentFlag( true ); 
+    if (idx==0)
+    {
+      assert(repFormat->getChromaAndBitDepthVpsPresentFlag() == true); 
+    }
+#endif 
     repFormat->setPicWidthVpsInLumaSamples  ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceWidth()   );
     repFormat->setPicHeightVpsInLumaSamples ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceHeight()  );
Index: /branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 501)
+++ /branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 502)
@@ -436,4 +436,7 @@
 class RepFormat
 {
+#if REPN_FORMAT_CONTROL_FLAG
+  Bool m_chromaAndBitDepthVpsPresentFlag;
+#endif 
 #if AUXILIARY_PICTURES
   ChromaFormat m_chromaFormatVpsIdc;
@@ -449,4 +452,9 @@
 public:
   RepFormat();
+
+#if REPN_FORMAT_CONTROL_FLAG
+  Bool getChromaAndBitDepthVpsPresentFlag() { return m_chromaAndBitDepthVpsPresentFlag; }
+  void setChromaAndBitDepthVpsPresentFlag(Bool x) { m_chromaAndBitDepthVpsPresentFlag = x; }
+#endif 
 
 #if AUXILIARY_PICTURES
Index: /branches/SHM-4.1-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/SHM-4.1-dev/source/Lib/TLibCommon/TypeDef.h	(revision 501)
+++ /branches/SHM-4.1-dev/source/Lib/TLibCommon/TypeDef.h	(revision 502)
@@ -57,4 +57,7 @@
 #define ALIGN_TSA_STSA_PICS              1      ///< JCTVC-N0084: Alignment of TSA and STSA pictures across AU.
 #define REPN_FORMAT_IN_VPS               1      ///< JCTVC-N0092: Signal represenation format (spatial resolution, bit depth, colour format) in the VPS
+#if REPN_FORMAT_IN_VPS
+#define REPN_FORMAT_CONTROL_FLAG         1      ///< JCTVC-O0179: Add control flag in representation format to control sending of chroma and bitdepth parameters
+#endif 
 #define TIMING_INFO_NONZERO_LAYERID_SPS  1      ///< JCTVC-N0085: Semantics of vui_timing_info_present_flag to always set that flag to zero for non-zero layer ID SPS 
 #define RPL_INIT_N0316_N0082             1      ///< JCTVC-N0316, JCTVC-N0082: initial reference picture list construction 
Index: /branches/SHM-4.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/SHM-4.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 501)
+++ /branches/SHM-4.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 502)
@@ -1351,4 +1351,27 @@
 {
   UInt uiCode;
+#if REPN_FORMAT_CONTROL_FLAG
+  READ_FLAG ( uiCode, "chroma_and_bit_depth_vps_present_flag");   repFormat->setChromaAndBitDepthVpsPresentFlag(uiCode ? true : false); 
+  READ_CODE ( 16, uiCode, "pic_width_in_luma_samples" );          repFormat->setPicWidthVpsInLumaSamples ( uiCode );
+  READ_CODE ( 16, uiCode, "pic_height_in_luma_samples" );         repFormat->setPicHeightVpsInLumaSamples( uiCode );
+
+  if( repFormat->getChromaAndBitDepthVpsPresentFlag() )
+  {
+#if AUXILIARY_PICTURES
+    READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( ChromaFormat(uiCode) );
+#else
+    READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( uiCode );
+#endif
+
+    if( repFormat->getChromaFormatVpsIdc() == 3 )
+    {
+      READ_FLAG( uiCode, "separate_colour_plane_flag");        repFormat->setSeparateColourPlaneVpsFlag(uiCode ? true : false);
+    }
+
+
+    READ_CODE( 4, uiCode, "bit_depth_luma_minus8" );           repFormat->setBitDepthVpsLuma  ( uiCode + 8 );
+    READ_CODE( 4, uiCode, "bit_depth_chroma_minus8" );         repFormat->setBitDepthVpsChroma( uiCode + 8 );
+  }
+#else 
 #if AUXILIARY_PICTURES
   READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( ChromaFormat(uiCode) );
@@ -1367,5 +1390,5 @@
   READ_CODE( 4, uiCode, "bit_depth_luma_minus8" );           repFormat->setBitDepthVpsLuma  ( uiCode + 8 );
   READ_CODE( 4, uiCode, "bit_depth_chroma_minus8" );         repFormat->setBitDepthVpsChroma( uiCode + 8 );
-
+#endif 
 }
 #endif
Index: /branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 501)
+++ /branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 502)
@@ -1071,4 +1071,25 @@
 Void  TEncCavlc::codeRepFormat      ( RepFormat *repFormat )
 {
+#if REPN_FORMAT_CONTROL_FLAG
+   WRITE_FLAG ( repFormat->getChromaAndBitDepthVpsPresentFlag(), "chroma_and_bit_depth_vps_presenet_flag"); 
+
+   WRITE_CODE ( repFormat->getPicWidthVpsInLumaSamples (), 16, "pic_width_in_luma_samples" );    
+   WRITE_CODE ( repFormat->getPicHeightVpsInLumaSamples(), 16, "pic_height_in_luma_samples" );  
+
+   if ( repFormat->getChromaAndBitDepthVpsPresentFlag() )
+   {
+     WRITE_CODE( repFormat->getChromaFormatVpsIdc(), 2, "chroma_format_idc" );   
+
+     if( repFormat->getChromaFormatVpsIdc() == 3 )
+     {
+       WRITE_FLAG( repFormat->getSeparateColourPlaneVpsFlag(), "separate_colour_plane_flag");      
+     }
+
+     assert( repFormat->getBitDepthVpsLuma() >= 8 );
+     assert( repFormat->getBitDepthVpsChroma() >= 8 );
+     WRITE_CODE( repFormat->getBitDepthVpsLuma() - 8,   4, "bit_depth_luma_minus8" );           
+     WRITE_CODE( repFormat->getBitDepthVpsChroma() - 8, 4, "bit_depth_chroma_minus8" );
+   }
+#else 
   WRITE_CODE( repFormat->getChromaFormatVpsIdc(), 2, "chroma_format_idc" );    
   
@@ -1084,5 +1105,6 @@
   assert( repFormat->getBitDepthVpsChroma() >= 8 );
   WRITE_CODE( repFormat->getBitDepthVpsLuma() - 8,   4, "bit_depth_luma_minus8" );           
-  WRITE_CODE( repFormat->getBitDepthVpsChroma() - 8, 4, "bit_depth_chroma_minus8" );         
+  WRITE_CODE( repFormat->getBitDepthVpsChroma() - 8, 4, "bit_depth_chroma_minus8" );
+#endif 
 
 }
