Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1101)
+++ 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
