Index: /branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h	(revision 1103)
+++ /branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h	(revision 1104)
@@ -255,6 +255,4 @@
 #define R0157_RESTRICT_PPSID_FOR_CGS_LUT 1      ///< JCTVC-R0157: when pps_pic_parameter_set_id greater than or equal to 8, colour_mapping_enabled_flag shall be equal to 0
 
-#define VPS_FIX_TO_MATCH_SPEC            1
-
 /// scalability types
 enum ScalabilityType
Index: /branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1103)
+++ /branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1104)
@@ -3041,9 +3041,5 @@
   for(i = 1; i < numOutputLayerSets; i++)
   {
-#if VPS_FIX_TO_MATCH_SPEC
     if( vps->getNumLayerSets() > 2 && i >= vps->getNumLayerSets() )
-#else
-    if( i > (vps->getNumLayerSets() - 1) )
-#endif
     {
       Int numBits = 1;
@@ -3060,15 +3056,7 @@
     Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx(i);
 #if Q0078_ADD_LAYER_SETS
-#if VPS_FIX_TO_MATCH_SPEC
     if( i > vps->getVpsNumLayerSetsMinus1() || vps->getDefaultTargetOutputLayerIdc() == 2 )
 #else
-    if( i > vps->getVpsNumLayerSetsMinus1() || vps->getDefaultTargetOutputLayerIdc() >= 2 )
-#endif
-#else
-#if VPS_FIX_TO_MATCH_SPEC
     if( i > (vps->getNumLayerSets() - 1) || vps->getDefaultTargetOutputLayerIdc() == 2 )
-#else
-    if( i > (vps->getNumLayerSets() - 1) || vps->getDefaultTargetOutputLayerIdc() >= 2 )
-#endif
 #endif
     {
@@ -3113,9 +3101,5 @@
     for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet) ; j++)
     {
-#if VPS_FIX_TO_MATCH_SPEC
       if( vps->getNecessaryLayerFlag(i, j) && (vps->getNumProfileTierLevel()-1) > 0 )
-#else
-      if( vps->getNecessaryLayerFlag(i, j) )
-#endif
       {
         READ_CODE( numBitsForPtlIdx, uiCode, "profile_tier_level_idx[i]" ); 
@@ -3317,9 +3301,5 @@
   if( vps->getRepFormatIdxPresentFlag() )
   {
-#if VPS_FIX_TO_MATCH_SPEC
     for( i = vps->getBaseLayerInternalFlag() ? 1 : 0; i < vps->getMaxLayers(); i++ )
-#else
-    for (i = 1; i < vps->getMaxLayers(); i++)
-#endif
     {
       Int numBits = 1;
@@ -3452,15 +3432,7 @@
 #endif
 
-#if VPS_FIX_TO_MATCH_SPEC
   for( i = vps->getBaseLayerInternalFlag() ? 1 : 2; i < vps->getMaxLayers(); i++ )
-#else
-  for(i = 1; i < vps->getMaxLayers(); i++)
-#endif
-  {
-#if VPS_FIX_TO_MATCH_SPEC
+  {
     for( j = vps->getBaseLayerInternalFlag() ? 0 : 1; j < i; j++ )
-#else
-    for(j = 0; j < i; j++)
-#endif
     {
       if (vps->getDirectDependencyFlag(i, j))
@@ -3820,9 +3792,5 @@
             uiCode=0;
 
-#if VPS_FIX_TO_MATCH_SPEC
         if( vps->getNecessaryLayerFlag(i, k) && ( vps->getBaseLayerInternalFlag() || vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, k) ) )
-#else
-        if(vps->getBaseLayerInternalFlag() || ( vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, k) !=  0 ) )
-#endif
 #endif
           READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1[i][k][j]" ); vps->setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode );
@@ -4070,9 +4038,5 @@
   if (!uiCode)
   {
-#if VPS_FIX_TO_MATCH_SPEC
     for( i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++ )
-#else
-    for (i = 0; i < vps->getMaxLayers(); i++)
-#endif
     {
       READ_FLAG( uiCode, "tiles_in_use_flag[ i ]" ); vps->setTilesInUseFlag(i, (uiCode == 1));
@@ -4088,9 +4052,5 @@
 #endif
 
-#if VPS_FIX_TO_MATCH_SPEC
       for( i = vps->getBaseLayerInternalFlag() ? 1 : 2; i < vps->getMaxLayers(); i++ )
-#else
-      for (i = 1; i < vps->getMaxLayers(); i++)
-#endif
     {
       for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
@@ -4113,9 +4073,5 @@
   if (!uiCode)
   {
-#if VPS_FIX_TO_MATCH_SPEC
       for (i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++)
-#else
-      for (i = 0; i < vps->getMaxLayers(); i++)
-#endif
     {
       READ_FLAG( uiCode, "wpp_in_use_flag[ i ]" ); vps->setWppInUseFlag(i, (uiCode == 1));
@@ -4146,8 +4102,6 @@
       for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
       {
-#if VPS_FIX_TO_MATCH_SPEC
         if( vps->getBaseLayerInternalFlag() || vps->getRefLayerId(vps->getLayerIdInNuh(i), j) )
         {
-#endif
           READ_UVLC( uiCode, "min_spatial_segment_offset_plus1[i][j]" ); vps->setMinSpatialSegmentOffsetPlus1( i, j, uiCode );
           if( vps->getMinSpatialSegmentOffsetPlus1(i,j ) > 0 )
@@ -4159,7 +4113,5 @@
             }
           }
-#if VPS_FIX_TO_MATCH_SPEC
-        }
-#endif
+        }
       }
     }
@@ -4575,17 +4527,11 @@
     }
   }
-#if VPS_FIX_TO_MATCH_SPEC
   if( vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams() > 0 )
   {
-#endif
     for (Int h = 1; h < vps->getNumOutputLayerSets(); h++)
     {
       Int lsIdx = vps->getOutputLayerSetIdx(h);
       READ_UVLC(uiCode, "num_signalled_partitioning_schemes[h]"); vps->setNumSignalledPartitioningSchemes(h, uiCode);
-#if VPS_FIX_TO_MATCH_SPEC
       for (Int j = 1; j < vps->getNumSignalledPartitioningSchemes(h) + 1; j++)
-#else
-      for (Int j = 0; j < vps->getNumSignalledPartitioningSchemes(h); j++)
-#endif
       {
         READ_UVLC(uiCode, "num_partitions_in_scheme_minus1[h][j]"); vps->setNumPartitionsInSchemeMinus1(h, j, uiCode);
@@ -4605,11 +4551,6 @@
           for (Int j = 0; j <= vps->getNumBspSchedulesMinus1(h, i, t); j++)
           {
-#if VPS_FIX_TO_MATCH_SPEC
             for( Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, i); k++ )
-#else
-            for (Int k = 0; k < vps->getNumPartitionsInSchemeMinus1(h, i); k++)
-#endif
             {
-#if VPS_FIX_TO_MATCH_SPEC
               if( vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams() > 1 )
               {
@@ -4621,7 +4562,4 @@
                 READ_CODE(numBits, uiCode, "bsp_comb_hrd_idx[h][i][t][j][k]");      vps->setBspHrdIdx(h, i, t, j, k, uiCode);
               }
-#else
-              READ_UVLC(uiCode, "bsp_comb_hrd_idx[h][i][t][j][k]");      vps->setBspHrdIdx(h, i, t, j, k, uiCode);
-#endif
               READ_UVLC(uiCode, "bsp_comb_sched_idx[h][i][t][j][k]");    vps->setBspSchedIdx(h, i, t, j, k, uiCode);
             }
@@ -4634,7 +4572,5 @@
 
     }
-#if VPS_FIX_TO_MATCH_SPEC
-  }
-#endif
+  }
 }
 #endif
Index: /branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1103)
+++ /branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1104)
@@ -2248,9 +2248,5 @@
   {
     Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx(i);
-#if VPS_FIX_TO_MATCH_SPEC
     if( vps->getNumLayerSets() > 2 && i >= vps->getNumLayerSets() )
-#else
-    if( i > (vps->getNumLayerSets() - 1) )
-#endif
     {
       Int numBits = 1;
@@ -2281,9 +2277,5 @@
     for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet) ; j++)
     {
-#if VPS_FIX_TO_MATCH_SPEC
       if( vps->getNecessaryLayerFlag(i, j) && (vps->getNumProfileTierLevel() - 1) > 0 )
-#else
-      if( vps->getNecessaryLayerFlag(i, j) )
-#endif
       {
         WRITE_CODE( vps->getProfileLevelTierIdx(i, j), numBitsForPtlIdx, "profile_level_tier_idx[i]" );
@@ -2354,9 +2346,5 @@
   if( vps->getRepFormatIdxPresentFlag() )
   {
-#if VPS_FIX_TO_MATCH_SPEC
     for( i = vps->getBaseLayerInternalFlag() ? 1 : 0; i < vps->getMaxLayers(); i++ )
-#else
-    for(i = 1; i < vps->getMaxLayers(); i++)
-#endif
     {
       Int numBits = 1;
@@ -2447,15 +2435,7 @@
   else
   {
-#if VPS_FIX_TO_MATCH_SPEC
     for( i = vps->getBaseLayerInternalFlag() ? 1 : 2; i < vps->getMaxLayers(); i++ )
-#else
-    for(i = 1; i < vps->getMaxLayers(); i++)
-#endif
-    {
-#if VPS_FIX_TO_MATCH_SPEC
+    {
       for( j = vps->getBaseLayerInternalFlag() ? 0 : 1; j < i; j++ )
-#else
-      for(j = 0; j < i; j++)
-#endif
       {
         if (vps->getDirectDependencyFlag(i, j))
@@ -2666,9 +2646,5 @@
         {
 #if DPB_INTERNAL_BL_SIG
-#if VPS_FIX_TO_MATCH_SPEC
         if( vps->getNecessaryLayerFlag(i, k) && (vps->getBaseLayerInternalFlag() || (vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, k) != 0)) )
-#else
-        if(vps->getBaseLayerInternalFlag()  || ( vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, k)   !=  0 ) )
-#endif
 #endif
           WRITE_UVLC( vps->getMaxVpsDecPicBufferingMinus1( i, k, j ), "max_vps_dec_pic_buffering_minus1[i][k][j]" );
@@ -2797,9 +2773,5 @@
   if (!vps->getTilesNotInUseFlag())
   {
-#if VPS_FIX_TO_MATCH_SPEC
     for( i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++ )
-#else
-    for(i = 0; i < vps->getMaxLayers(); i++)
-#endif
     {
       WRITE_FLAG( vps->getTilesInUseFlag(i) ? 1 : 0 , "tiles_in_use_flag[ i ]" );
@@ -2811,9 +2783,5 @@
 #endif
 
-#if VPS_FIX_TO_MATCH_SPEC
     for( i = vps->getBaseLayerInternalFlag() ? 1 : 2; i < vps->getMaxLayers(); i++ )
-#else
-    for(i = 1; i < vps->getMaxLayers(); i++)
-#endif
     {
       for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
@@ -2836,9 +2804,5 @@
   if (!vps->getWppNotInUseFlag())
   {
-#if VPS_FIX_TO_MATCH_SPEC
     for( i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++ )
-#else
-    for(i = 0; i < vps->getMaxLayers(); i++)
-#endif
     {
       WRITE_FLAG( vps->getWppInUseFlag(i) ? 1 : 0 , "wpp_in_use_flag[ i ]" );
@@ -2869,8 +2833,6 @@
       for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
       {
-#if VPS_FIX_TO_MATCH_SPEC
         if (vps->getBaseLayerInternalFlag() || vps->getRefLayerId(vps->getLayerIdInNuh(i), j))
         {
-#endif
           WRITE_UVLC(vps->getMinSpatialSegmentOffsetPlus1( i, j),    "min_spatial_segment_offset_plus1[i][j]");
 
@@ -2884,7 +2846,5 @@
             }
           }
-#if VPS_FIX_TO_MATCH_SPEC
-        }
-#endif
+        }
       }  
     }
@@ -3231,57 +3191,44 @@
   }
 
-#if VPS_FIX_TO_MATCH_SPEC
   if( vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams() > 0 )
   {
-#endif
-  for( Int h = 1; h < vps->getNumOutputLayerSets(); h++ )
-  {
-    Int lsIdx = vps->getOutputLayerSetIdx( h );
-    WRITE_UVLC( vps->getNumSignalledPartitioningSchemes(h), "num_signalled_partitioning_schemes[h]");
-
-#if VPS_FIX_TO_MATCH_SPEC
-    for( Int j = 1; j < vps->getNumSignalledPartitioningSchemes(h) + 1; j++ )
-#else
-    for( Int j = 0; j < vps->getNumSignalledPartitioningSchemes(h); j++ )
-#endif
-    {
-      WRITE_UVLC( vps->getNumPartitionsInSchemeMinus1(h, j), "num_partitions_in_scheme_minus1[h][j]" );
-      for( Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, j); k++ )
-      {
-        for( Int r = 0; r < vps->getNumLayersInIdList( lsIdx ); r++ )
-        {
-          WRITE_FLAG( vps->getLayerIncludedInPartitionFlag(h, j, k, r), "layer_included_in_partition_flag[h][j][k][r]" );
-        }
-      }
-    }
-
-    for( Int i = 0; i < vps->getNumSignalledPartitioningSchemes(h) + 1; i++ )
-    {
-      for( Int t = 0; t <= vps->getMaxSLayersInLayerSetMinus1(lsIdx); t++ )
-      {
-        WRITE_UVLC(vps->getNumBspSchedulesMinus1(h, i, t), "num_bsp_schedules_minus1[h][i][t]");
-
-        for( Int j = 0; j <= vps->getNumBspSchedulesMinus1(h, i, t); j++ )
-        {
-#if VPS_FIX_TO_MATCH_SPEC
-          for (Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, i); k++)
-#else
-          for( Int k = 0; k < vps->getNumPartitionsInSchemeMinus1(h, i); k++ )
-#endif
+    for( Int h = 1; h < vps->getNumOutputLayerSets(); h++ )
+    {
+      Int lsIdx = vps->getOutputLayerSetIdx( h );
+      WRITE_UVLC( vps->getNumSignalledPartitioningSchemes(h), "num_signalled_partitioning_schemes[h]");
+
+      for( Int j = 1; j < vps->getNumSignalledPartitioningSchemes(h) + 1; j++ )
+      {
+        WRITE_UVLC( vps->getNumPartitionsInSchemeMinus1(h, j), "num_partitions_in_scheme_minus1[h][j]" );
+        for( Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, j); k++ )
+        {
+          for( Int r = 0; r < vps->getNumLayersInIdList( lsIdx ); r++ )
           {
-#if VPS_FIX_TO_MATCH_SPEC
-            if (vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams() > 1)
+            WRITE_FLAG( vps->getLayerIncludedInPartitionFlag(h, j, k, r), "layer_included_in_partition_flag[h][j][k][r]" );
+          }
+        }
+      }
+
+      for( Int i = 0; i < vps->getNumSignalledPartitioningSchemes(h) + 1; i++ )
+      {
+        for( Int t = 0; t <= vps->getMaxSLayersInLayerSetMinus1(lsIdx); t++ )
+        {
+          WRITE_UVLC(vps->getNumBspSchedulesMinus1(h, i, t), "num_bsp_schedules_minus1[h][i][t]");
+
+          for( Int j = 0; j <= vps->getNumBspSchedulesMinus1(h, i, t); j++ )
+          {
+            for (Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, i); k++)
             {
-              Int numBits = 1;
-              while ((1 << numBits) < (vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams()))
+              if (vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams() > 1)
               {
-                numBits++;
+                Int numBits = 1;
+                while ((1 << numBits) < (vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams()))
+                {
+                  numBits++;
+                }
+                WRITE_CODE(vps->getBspHrdIdx(h, i, t, j, k), numBits, "bsp_comb_hrd_idx[h][i][t][j][k]");
               }
-              WRITE_CODE(vps->getBspHrdIdx(h, i, t, j, k), numBits, "bsp_comb_hrd_idx[h][i][t][j][k]");
+              WRITE_UVLC( vps->getBspSchedIdx(h, i, t, j, k), "bsp_comb_sched_idx[h][i][t][j][k]");
             }
-#else
-            WRITE_UVLC( vps->getBspHrdIdx(h, i, t, j, k),   "bsp_comb_hrd_idx[h][i][t][j][k]");
-#endif
-            WRITE_UVLC( vps->getBspSchedIdx(h, i, t, j, k), "bsp_comb_sched_idx[h][i][t][j][k]");
           }
         }
@@ -3289,7 +3236,4 @@
     }
   }
-#if VPS_FIX_TO_MATCH_SPEC
-  }
-#endif
 }
 #endif
