Index: /branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h	(revision 850)
+++ /branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h	(revision 851)
@@ -2499,4 +2499,20 @@
   Bool     isRASL()   { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_R); }
 
+#if POC_RESET_RESTRICTIONS
+  Bool     isIDR()    { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
+                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP); }
+  Bool     isCRA()    { return m_eNalUnitType == NAL_UNIT_CODED_SLICE_CRA; }
+  Bool     isBLA()    { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP
+                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL
+                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP ); }
+  Bool     isSLNR()   { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_N
+                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_TSA_N
+                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_STSA_N
+                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_N
+                                  || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_N
+                                  || m_eNalUnitType == NAL_UNIT_RESERVED_VCL_N10
+                                  || m_eNalUnitType == NAL_UNIT_RESERVED_VCL_N12
+                                  || m_eNalUnitType == NAL_UNIT_RESERVED_VCL_N14 ); }
+#endif
 #if POC_RESET_FLAG
   Bool      getPocResetFlag  ()                              { return m_bPocResetFlag;       }
Index: /branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h	(revision 850)
+++ /branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h	(revision 851)
@@ -49,4 +49,5 @@
 #define REMOVE_BSP_HRD_SEI               1      ///< R0010: Remove bitstream partition HRD SEI message.
 #define NESTING_SEI_EXTENSIBILITY        1      ///< R0221: Signalling the number of SEI messages in bitstream partition nesting SEI message
+#define POC_RESET_RESTRICTIONS           1      ///< Restrictions on semantics of POC reset-related syntax elements.
 #define O0137_MAX_LAYERID                1      ///< JCTVC-O0137, JCTVC-O0200, JCTVC-O0223: restrict nuh_layer_id and vps_max_layers_minus1
 
Index: /branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 850)
+++ /branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 851)
@@ -3439,4 +3439,23 @@
   {
     READ_CODE( 2, uiCode,       "poc_reset_idc"); rpcSlice->setPocResetIdc(uiCode);
+#if POC_RESET_RESTRICTIONS
+    /* The value of poc_reset_idc shall not be equal to 1 or 2 for a RASL picture, a RADL picture, 
+       a sub-layer non-reference picture, or a picture that has TemporalId greater than 0, 
+       or a picture that has discardable_flag equal to 1. */
+    if( rpcSlice->getPocResetIdc() == 1 || rpcSlice->getPocResetIdc() == 2 )
+    {
+      assert( !rpcSlice->isRASL() );
+      assert( !rpcSlice->isRADL() );
+      assert( !rpcSlice->isSLNR() );
+      assert( rpcSlice->getTLayer() == 0 );
+      assert( rpcSlice->getDiscardableFlag() == 0 );
+    }
+
+    // The value of poc_reset_idc of a CRA or BLA picture shall be less than 3.
+    if( rpcSlice->getPocResetIdc() == 3)
+    {
+      assert( ! ( rpcSlice->isCRA() || rpcSlice->isBLA() ) );
+    }
+#endif
   }
   else
Index: /branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 850)
+++ /branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 851)
@@ -43,4 +43,15 @@
 UInt  TDecTop::m_uiPrevLayerId = MAX_UINT;
 Bool  TDecTop::m_bFirstSliceInSequence = true;
+#if POC_RESET_RESTRICTIONS
+Bool  TDecTop::m_checkPocRestrictionsForCurrAu       = false;
+Int   TDecTop::m_pocResetIdcOrCurrAu                 = -1;
+Bool  TDecTop::m_baseLayerIdrFlag                    = false;
+Bool  TDecTop::m_baseLayerPicPresentFlag             = false;
+Bool  TDecTop::m_baseLayerIrapFlag                   = false;
+Bool  TDecTop::m_nonBaseIdrPresentFlag               = false;
+Int   TDecTop::m_nonBaseIdrType                      = -1;
+Bool  TDecTop::m_picNonIdrWithRadlPresentFlag        = false;
+Bool  TDecTop::m_picNonIdrNoLpPresentFlag            = false;
+#endif
 #endif
 
@@ -104,4 +115,8 @@
 #if Q0074_SEI_COLOR_MAPPING
   m_ColorMapping = new TDecColorMapping();
+#endif
+
+#if POC_RESET_RESTRICTIONS
+  resetPocRestrictionCheckParameters();
 #endif
 }
@@ -940,4 +955,7 @@
 
   m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType);
+#if POC_RESET_RESTRICTIONS
+  m_apcSlicePilot->setTLayer( nalu.m_temporalId );
+#endif
   Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N ||
                            m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N   ||
@@ -1116,4 +1134,8 @@
     if(( m_layerId < m_uiPrevLayerId) ||( ( m_layerId == m_uiPrevLayerId) && bNewPOC)) // Decoding a lower layer than or same layer as previous - mark all earlier pictures as not in current AU
     {
+#if POC_RESET_RESTRICTIONS
+      // New access unit; reset all variables related to POC reset restrictions
+      resetPocRestrictionCheckParameters();
+#endif
       markAllPicsAsNoCurrAu();
     }
@@ -1132,5 +1154,5 @@
     {
       m_parseIdc = 3; // Proceed to decoding POC and RPS
-    }  
+    }
   }
 #endif
@@ -1622,4 +1644,88 @@
 #if POC_RESET_IDC_DECODER
     pcPic->setCurrAuFlag( true );
+#if POC_RESET_RESTRICTIONS
+    if( pcPic->getLayerId() > 0 && m_apcSlicePilot->isIDR() && !m_nonBaseIdrPresentFlag )
+    {
+      // IDR picture with nuh_layer_id > 0 present
+      m_nonBaseIdrPresentFlag = true;
+      m_nonBaseIdrType = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL);
+    }
+    else
+    {
+      if( m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL )
+      {
+        // Picture with nal_unit_type not equal IDR_W_RADL present
+        m_picNonIdrWithRadlPresentFlag = true;
+      }
+      if( m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_N_LP )
+      {
+        // Picture with nal_unit_type not equal IDR_N_LP present
+        m_picNonIdrNoLpPresentFlag = true;
+      }
+    }
+    if( !m_checkPocRestrictionsForCurrAu )  // Will be true for the first slice/picture of the AU
+    {
+      m_checkPocRestrictionsForCurrAu = true;
+      m_pocResetIdcOrCurrAu = m_apcSlicePilot->getPocResetIdc();
+      if( pcPic->getLayerId() == 0 )
+      {
+        // Base layer picture is present
+        m_baseLayerPicPresentFlag = true;
+        if( m_apcSlicePilot->isIRAP() )
+        {
+          // Base layer picture is IRAP
+          m_baseLayerIrapFlag = true;
+        }
+        if( m_apcSlicePilot->isIDR() )
+        {
+          // Base layer picture is IDR
+          m_baseLayerIdrFlag = true;
+        }
+        else
+        {
+          if( m_apcSlicePilot->getVPS()->getBaseLayerInternalFlag())
+          {
+            /* When the picture with nuh_layer_id equal to 0 in an access unit is not an IDR picture 
+            and vps_base_layer_internal_flag is equal to 1, the value of poc_reset_idc shall not be equal to 2 
+            for any picture in the access unit. */
+            assert( m_apcSlicePilot->getPocResetIdc() != 2 );
+          }
+        }
+      }
+    }
+    else
+    {
+      // The value of poc_reset_idc of all coded pictures that are present in the bitstream in an access unit shall be the same.
+      assert( m_pocResetIdcOrCurrAu == m_apcSlicePilot->getPocResetIdc() );
+
+      /* When the picture in an access unit with nuh_layer_id equal to 0 is an IRAP picture and vps_base_layer_internal_flag is equal to 1 
+      and there is at least one other picture in the same access unit that is not an IRAP picture, 
+      the value of poc_reset_idc shall be equal to 1 or 2 for all pictures in the access unit. */
+      if( m_baseLayerPicPresentFlag && m_baseLayerIrapFlag && !m_apcSlicePilot->isIRAP() && m_apcSlicePilot->getVPS()->getBaseLayerInternalFlag() )
+      {
+        assert( m_apcSlicePilot->getPocResetIdc() == 1 || m_apcSlicePilot->getPocResetIdc() == 2 );
+      }
+
+      /* When the picture with nuh_layer_id equal to 0 in an access unit is an IDR picture and 
+      vps_base_layer_internal_flag is equal to 1 and there is at least one non-IDR picture in the same access unit, 
+      the value of poc_reset_idc shall be equal to 2 for all pictures in the access unit. */
+      if( m_baseLayerPicPresentFlag && m_baseLayerIdrFlag && !m_apcSlicePilot->isIDR() && m_apcSlicePilot->getVPS()->getBaseLayerInternalFlag() )
+      {
+        assert( m_apcSlicePilot->getPocResetIdc() == 2 );
+      }
+
+      /* When there is at least one picture that has nuh_layer_id greater than 0 and that is an IDR picture 
+      with a particular value of nal_unit_type in an access unit and there is at least one other coded picture 
+      that is present in the bitstream in the same access unit with a different value of nal_unit_type, 
+      the value of poc_reset_idc shall be equal to 1 or 2 for all pictures in the access unit. */
+      if( m_nonBaseIdrPresentFlag && 
+            ( m_nonBaseIdrType == 1 && m_picNonIdrWithRadlPresentFlag  
+             || m_nonBaseIdrType == 0 && m_picNonIdrNoLpPresentFlag )
+        )
+      {
+        assert( m_apcSlicePilot->getPocResetIdc() == 1 || m_apcSlicePilot->getPocResetIdc() == 2 );
+      }
+    }
+#endif
 #endif
 
@@ -2675,5 +2781,18 @@
 }
 #endif
-
+#if POC_RESET_RESTRICTIONS
+Void TDecTop::resetPocRestrictionCheckParameters()
+{
+  TDecTop::m_checkPocRestrictionsForCurrAu       = false;
+  TDecTop::m_pocResetIdcOrCurrAu                 = -1;
+  TDecTop::m_baseLayerIdrFlag                    = false;
+  TDecTop::m_baseLayerPicPresentFlag             = false;
+  TDecTop::m_baseLayerIrapFlag                   = false;
+  TDecTop::m_nonBaseIdrPresentFlag               = false;
+  TDecTop::m_nonBaseIdrType                      = -1;
+  TDecTop::m_picNonIdrWithRadlPresentFlag        = false;
+  TDecTop::m_picNonIdrNoLpPresentFlag            = false;
+}
+#endif
 #endif //SVC_EXTENSION
 
Index: /branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- /branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h	(revision 850)
+++ /branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h	(revision 851)
@@ -213,4 +213,16 @@
 #endif
 
+#if POC_RESET_RESTRICTIONS
+  static Bool                    m_checkPocRestrictionsForCurrAu;
+  static Int                     m_pocResetIdcOrCurrAu;
+  static Bool                    m_baseLayerIdrFlag;
+  static Bool                    m_baseLayerPicPresentFlag;
+  static Bool                    m_baseLayerIrapFlag;
+  static Bool                    m_nonBaseIdrPresentFlag;
+  static Int                     m_nonBaseIdrType;
+  static Bool                    m_picNonIdrWithRadlPresentFlag;
+  static Bool                    m_picNonIdrNoLpPresentFlag;
+#endif
+
   TDecTop();
   virtual ~TDecTop();
@@ -357,7 +369,11 @@
   Void initAsymLut(TComSlice *pcSlice);
 #endif
+#if POC_RESET_RESTRICTIONS
+  Void resetPocRestrictionCheckParameters();
+#endif
 };// END CLASS DEFINITION TDecTop
 
 
+
 //! \}
 
