Index: branches/SHM-upgrade/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibCommon/TComSlice.cpp	(revision 1002)
+++ branches/SHM-upgrade/source/Lib/TLibCommon/TComSlice.cpp	(revision 1006)
@@ -901,5 +901,9 @@
  */
 #if NO_CLRAS_OUTPUT_FLAG
+#if R0235_SMALLEST_LAYER_ID
+Void TComSlice::decodingRefreshMarking( TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag, UInt smallestLayerId )
+#else
 Void TComSlice::decodingRefreshMarking( TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag )
+#endif
 {
   if( !isIRAP() )
@@ -913,5 +917,9 @@
   // When the current picture is an IRAP picture with nuh_layer_id equal to 0 and NoClrasOutputFlag is equal to 1, 
   // all reference pictures with any value of nuh_layer_id currently in the DPB (if any) are marked as "unused for reference".
+#if R0235_SMALLEST_LAYER_ID
+  if (m_layerId == smallestLayerId && noClrasOutputFlag)
+#else
   if( m_layerId == 0 && noClrasOutputFlag )
+#endif
   {
     // mark all pictures for all layers as not used for reference
Index: branches/SHM-upgrade/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibCommon/TComSlice.h	(revision 1002)
+++ branches/SHM-upgrade/source/Lib/TLibCommon/TComSlice.h	(revision 1006)
@@ -2536,5 +2536,9 @@
   Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic);
 #if NO_CLRAS_OUTPUT_FLAG
+#if R0235_SMALLEST_LAYER_ID
+  Void      decodingRefreshMarking( TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag, UInt smallestLayerId = 0 );
+#else
   Void      decodingRefreshMarking( TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag );
+#endif
   Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag);
 #else
Index: branches/SHM-upgrade/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibCommon/TypeDef.h	(revision 1002)
+++ branches/SHM-upgrade/source/Lib/TLibCommon/TypeDef.h	(revision 1006)
@@ -81,4 +81,5 @@
 #define R0227_BR_PR_ADD_LAYER_SET        1      ///< JCTVC-R0227, Signalling of bit-rate and picture rate for additional layer set
 #define R0042_PROFILE_INDICATION         1      ///< JCTVC-R0042, Profile indication for additional layer sets
+#define R0235_SMALLEST_LAYER_ID          1      ///< JCTVC-R0235, SmallestLayerId semantics 
 
 #define Q0108_TSA_STSA                   1      ///< JCTVC-Q0108, Remove cross-layer alignment constraints of TSA and STSA pictures, enable to have different prediction structures in different layers
Index: branches/SHM-upgrade/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1002)
+++ branches/SHM-upgrade/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1006)
@@ -1525,5 +1525,9 @@
           for(Int kk = 0; kk < pcSlice->getVPS()->getNumLayersInIdList(layerSetIdxForOutputLayerSet); kk++)
           {
+#if R0235_SMALLEST_LAYER_ID
+            if( pcSlice->getVPS()->getNecessaryLayerFlag(ii, kk) && pcSlice->getLayerId() == pcSlice->getVPS()->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, kk) )
+#else
             if(pcSlice->getLayerId() == pcSlice->getVPS()->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, kk))
+#endif
             {
               chkAssert=1;
@@ -3218,5 +3222,5 @@
 #endif
       {
-        READ_CODE( numBitsForPtlIdx, uiCode, "profile_level_tier_idx[i]" ); 
+        READ_CODE( numBitsForPtlIdx, uiCode, "profile_tier_level_idx[i]" ); 
         vps->setProfileLevelTierIdx(i, j, uiCode );
 
@@ -3228,4 +3232,9 @@
         //If OpTid of the output operation point is equal to vps_max_sub_layer_minus1, the conformance is indicated by general_profile_idc being equal to 7 or general_profile_compatibility_flag[ 7 ] being equal to 1
         //The following assert may be updated / upgraded to take care of general_profile_compatibility_flag.
+#if R0235_SMALLEST_LAYER_ID
+        // The assertion below is not valid for independent non-base layers 
+        if (vps->getNumAddLayerSets() == 0)
+        {
+#endif
         if (j > 0 && vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j) != 0 && vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j - 1) != 0)
         {
@@ -3234,4 +3243,7 @@
                  vps->getPTL(vps->getProfileLevelTierIdx(i, j))->getGeneralPTL()->getProfileCompatibilityFlag(vps->getPTL(vps->getProfileLevelTierIdx(i, j - 1))->getGeneralPTL()->getProfileIdc())  );
         }
+#if R0235_SMALLEST_LAYER_ID
+        }
+#endif
 #endif
       }
@@ -3243,5 +3255,5 @@
       numBits++;
     }
-    READ_CODE( numBits, uiCode, "profile_level_tier_idx[i]" );     vps->setProfileLevelTierIdx(i, uiCode);
+    READ_CODE( numBits, uiCode, "profile_tier_level_idx[i]" );     vps->setProfileLevelTierIdx(i, uiCode);
 #endif
 #if P0300_ALT_OUTPUT_LAYER_FLAG
Index: branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1002)
+++ branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1006)
@@ -91,4 +91,7 @@
 #if SVC_EXTENSION 
   m_layerId = 0;
+#if R0235_SMALLEST_LAYER_ID
+  m_smallestLayerId = 0;
+#endif
 #if AVC_BASE
   m_pBLReconFile = NULL;
@@ -838,5 +841,22 @@
 #if OUTPUT_LAYER_SET_INDEX
   // Following check should go wherever the VPS is activated
+#if R0235_SMALLEST_LAYER_ID
+  if (!m_apcSlicePilot->getVPS()->getBaseLayerAvailableFlag())
+  {
+    assert(nalu.m_layerId != 0);
+    assert(m_apcSlicePilot->getVPS()->getNumAddLayerSets() > 0);
+    if (getCommonDecoderParams()->getTargetOutputLayerSetIdx() >= 0)
+    {
+      UInt layerIdx = m_apcSlicePilot->getVPS()->getOutputLayerSetIdx(getCommonDecoderParams()->getTargetOutputLayerSetIdx());
+      assert(layerIdx > m_apcSlicePilot->getVPS()->getVpsNumLayerSetsMinus1());
+    }
+  }
+  if (m_apcSlicePilot->getVPS()->getNumAddLayerSets() == 0)
+  {
+    checkValueOfTargetOutputLayerSetIdx(m_apcSlicePilot->getVPS());
+  }
+#else
   checkValueOfTargetOutputLayerSetIdx( m_apcSlicePilot->getVPS());
+#endif
 #endif
 #if RESOLUTION_BASED_DPB
@@ -969,5 +989,9 @@
 #if NO_OUTPUT_OF_PRIOR_PICS
 #if NO_CLRAS_OUTPUT_FLAG
+#if R0235_SMALLEST_LAYER_ID
+  if (m_layerId == m_smallestLayerId && m_apcSlicePilot->getRapPicFlag())
+#else
   if (m_layerId == 0 && m_apcSlicePilot->getRapPicFlag() )
+#endif
   {
     if (m_bFirstSliceInSequence)
@@ -1001,5 +1025,9 @@
   }
 
+#if R0235_SMALLEST_LAYER_ID
+  m_apcSlicePilot->decodingRefreshMarking( m_cListPic, m_noClrasOutputFlag, m_smallestLayerId );
+#else
   m_apcSlicePilot->decodingRefreshMarking( m_cListPic, m_noClrasOutputFlag );
+#endif
 #endif
 
@@ -2470,4 +2498,7 @@
         cListPic->clear();
       }
+#endif
+#if R0235_SMALLEST_LAYER_ID
+      xDeriveSmallestLayerId(m_parameterSetManagerDecoder.getPrefetchedVPS(0));
 #endif
       return false;
@@ -3116,5 +3147,9 @@
 Void TDecTop::xCheckLayerReset()
 {
+#if R0235_SMALLEST_LAYER_ID
+  if (m_apcSlicePilot->isIRAP() && m_layerId > m_smallestLayerId)
+#else
   if (m_apcSlicePilot->isIRAP() && m_layerId > 0)
+#endif
   {
     Bool layerResetFlag;
@@ -3200,4 +3235,41 @@
 #endif
 
+#if R0235_SMALLEST_LAYER_ID
+Void TDecTop::xDeriveSmallestLayerId(TComVPS* vps)
+{
+  UInt smallestLayerId;
+  UInt targetOlsIdx = getCommonDecoderParams()->getTargetOutputLayerSetIdx();
+  UInt targetDecLayerSetIdx = vps->getOutputLayerSetIdx(targetOlsIdx);
+  UInt lsIdx = targetDecLayerSetIdx;
+  UInt targetDecLayerIdList[MAX_LAYERS] = {0};
+
+  for (UInt i = 0, j = 0; i < vps->getNumLayersInIdList(lsIdx); i++)
+  {
+    if (vps->getNecessaryLayerFlag(targetOlsIdx, i))
+    {
+      targetDecLayerIdList[j++] = vps->getLayerSetLayerIdList(lsIdx, i);
+    }
+  }
+
+  if (targetDecLayerSetIdx <= vps->getVpsNumLayerSetsMinus1())
+  {
+    smallestLayerId = 0;
+  }
+  else if (vps->getNumLayersInIdList(targetDecLayerSetIdx) == 1)
+  {
+    smallestLayerId = 0;
+  }
+  else
+  {
+    smallestLayerId = targetDecLayerIdList[0];
+  }
+
+  for (UInt layer = 0; layer <= MAX_VPS_LAYER_ID_PLUS1 - 1; layer++)
+  {
+    m_ppcTDecTop[layer]->m_smallestLayerId = smallestLayerId;
+  }
+}
+#endif
+
 #endif //SVC_EXTENSION
 
Index: branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.h	(revision 1002)
+++ branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.h	(revision 1006)
@@ -133,4 +133,7 @@
   UInt                    m_numLayer;
   TDecTop**               m_ppcTDecTop;
+#if R0235_SMALLEST_LAYER_ID
+  UInt                    m_smallestLayerId;
+#endif
 #if P0297_VPS_POC_LSB_ALIGNED_FLAG
   Bool                    m_pocResettingFlag;
@@ -256,4 +259,7 @@
   Void      setLayerDec(TDecTop **p)    { m_ppcTDecTop = p; }
   TDecTop*  getLayerDec(UInt layer)     { return m_ppcTDecTop[layer]; }
+#if R0235_SMALLEST_LAYER_ID
+  Void      xDeriveSmallestLayerId(TComVPS* vps);
+#endif
 #if VPS_EXTN_DIRECT_REF_LAYERS
   TDecTop*  getRefLayerDec(UInt refLayerIdc);
