Index: /branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 661)
+++ /branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 662)
@@ -2183,5 +2183,9 @@
 #endif
 #if REPN_FORMAT_IN_VPS
+#if Q0195_REP_FORMAT_CLEANUP
+, m_repFormatIdxPresentFlag   (false)
+#else
 , m_repFormatIdxPresentFlag   (true)
+#endif
 , m_vpsNumRepFormats          (1)
 #endif
Index: /branches/SHM-6-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/SHM-6-dev/source/Lib/TLibCommon/TypeDef.h	(revision 661)
+++ /branches/SHM-6-dev/source/Lib/TLibCommon/TypeDef.h	(revision 662)
@@ -225,4 +225,7 @@
 #define O0096_REP_FORMAT_INDEX           1      ///< JCTVC-O0096: identify SPS rep_format() with an index into the lists of formats in VPS extension.
 #define O0096_DEFAULT_DEPENDENCY_TYPE    1      ///< JCTVC-O0096: specify default dependency type for all direct reference layers
+
+#define Q0195_REP_FORMAT_CLEANUP         1      ///< JCTVC-Q0195: restructureing of rep_format() signaling
+#define REP_FORMAT_FIX                   1      ///< update_rep_format_flag should be inferred to be equal to 0
 
 #define RESAMPLING_CONSTRAINT_BUG_FIX    1
Index: /branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 661)
+++ /branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 662)
@@ -599,5 +599,9 @@
   else
   {
+#if REP_FORMAT_FIX
+    pcSPS->setUpdateRepFormatFlag( false );
+#else
     pcSPS->setUpdateRepFormatFlag( true );
+#endif
   }
 #if O0096_REP_FORMAT_INDEX
@@ -1431,4 +1435,47 @@
 
 #if REPN_FORMAT_IN_VPS
+#if Q0195_REP_FORMAT_CLEANUP
+  READ_UVLC( uiCode, "vps_num_rep_formats_minus1" );
+  vps->setVpsNumRepFormats( uiCode + 1 );
+  for(i = 0; i < vps->getVpsNumRepFormats(); i++)
+  {
+    // Read rep_format_structures
+    parseRepFormat( vps->getVpsRepFormat(i) );
+  }
+
+  // Default assignment for layer 0
+  vps->setVpsRepFormatIdx( 0, 0 );
+
+  if( vps->getVpsNumRepFormats() > 1 )
+  {
+    READ_FLAG( uiCode, "rep_format_idx_present_flag");
+    vps->setRepFormatIdxPresentFlag( uiCode ? true : false );
+  }
+  else
+  {
+    vps->setRepFormatIdxPresentFlag( false );
+  }
+  if( vps->getRepFormatIdxPresentFlag() )
+  {
+    for(i = 1; i < vps->getMaxLayers(); i++)
+    {
+      Int numBits = 1;
+      while ((1 << numBits) < (vps->getVpsNumRepFormats()))
+      {
+        numBits++;
+      }
+      READ_CODE( numBits, uiCode, "vps_rep_format_idx[i]" );
+      vps->setVpsRepFormatIdx( i, uiCode );
+    }
+  }
+  else
+  {
+    // default assignment - each layer assigned each rep_format() structure in the order signaled
+    for(i = 1; i < vps->getMaxLayers(); i++)
+    {
+      vps->setVpsRepFormatIdx( i, min( (Int)i, vps->getVpsNumRepFormats()-1 ) );
+    }
+  }
+#else
   READ_FLAG( uiCode, "rep_format_idx_present_flag");
   vps->setRepFormatIdxPresentFlag( uiCode ? true : false );
@@ -1502,4 +1549,5 @@
     }
   }
+#endif
 #endif
 #if RESOLUTION_BASED_DPB
@@ -2565,4 +2613,7 @@
       {
         format = rpcSlice->getVPS()->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc();
+#if Q0195_REP_FORMAT_CLEANUP
+         assert( (sps->getUpdateRepFormatFlag()==false && rpcSlice->getVPS()->getVpsNumRepFormats()==1) || rpcSlice->getVPS()->getVpsNumRepFormats() > 1 ); //conformance check
+#endif
       }
 #else
Index: /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 661)
+++ /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 662)
@@ -1072,4 +1072,28 @@
 
 #if REPN_FORMAT_IN_VPS
+#if Q0195_REP_FORMAT_CLEANUP
+  WRITE_UVLC( vps->getVpsNumRepFormats() - 1, "vps_num_rep_formats_minus1" );
+  for(i = 0; i < vps->getVpsNumRepFormats(); i++)
+  {
+    // Write rep_format_structures
+    codeRepFormat( vps->getVpsRepFormat(i) );
+  }
+
+  if ( vps->getVpsNumRepFormats() > 1 )
+    WRITE_FLAG( vps->getRepFormatIdxPresentFlag(), "rep_format_idx_present_flag"); 
+
+  if( vps->getRepFormatIdxPresentFlag() )
+  {
+    for(i = 1; i < vps->getMaxLayers(); i++)
+    {
+      Int numBits = 1;
+      while ((1 << numBits) < (vps->getVpsNumRepFormats()))
+      {
+        numBits++;
+      }
+      WRITE_CODE( vps->getVpsRepFormatIdx(i), numBits, "vps_rep_format_idx[i]" );
+    }
+  }
+#else
   WRITE_FLAG( vps->getRepFormatIdxPresentFlag(), "rep_format_idx_present_flag"); 
 
@@ -1118,4 +1142,5 @@
     }
   }
+#endif
 #endif
 
