Index: branches/SHM-upgrade/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/SHM-upgrade/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 977)
+++ branches/SHM-upgrade/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 979)
@@ -888,4 +888,9 @@
   Int*    cfg_waveFrontSynchro[MAX_LAYERS];
 
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  Int*    cfg_layerSwitchOffBegin[MAX_LAYERS];
+  Int*    cfg_layerSwitchOffEnd[MAX_LAYERS];
+#endif
+
 #if MULTIPLE_PTL_SUPPORT
   Bool    tmpIntraConstraintFlag;
@@ -989,4 +994,8 @@
 #if AUXILIARY_PICTURES
     cfg_auxId[layer]                = &m_acLayerCfg[layer].m_auxId; 
+#endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+    cfg_layerSwitchOffBegin[layer] = &m_acLayerCfg[layer].m_layerSwitchOffBegin;
+    cfg_layerSwitchOffEnd[layer]   = &m_acLayerCfg[layer].m_layerSwitchOffEnd;
 #endif
 #if MULTIPLE_PTL_SUPPORT
@@ -1734,4 +1743,8 @@
   ("AdaptiveResolutionChange",     m_adaptiveResolutionChange, 0, "Adaptive resolution change frame number. Should coincide with EL RAP picture. (0: disable)")
 #endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  ("LayerSwitchOffBegin%d", cfg_layerSwitchOffBegin, 0, MAX_LAYERS, "Switch layer %d off after given poc")
+  ("LayerSwitchOffEnd%d", cfg_layerSwitchOffEnd, 0, MAX_LAYERS, "Switch layer %d on at given poc")
+#endif
 #if HIGHER_LAYER_IRAP_SKIP_FLAG
   ("SkipPictureAtArcSwitch",     m_skipPictureAtArcSwitch, false, "Code the higher layer picture in ARC up-switching as a skip picture. (0: disable)")
@@ -1948,4 +1961,23 @@
   m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat);
   m_chromaFormatIDC      = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat)));
+#endif
+
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  for (Int layer = 0; layer < MAX_LAYERS; layer++)
+  {
+    if (m_acLayerCfg[layer].m_layerSwitchOffBegin < m_acLayerCfg[layer].m_layerSwitchOffEnd)
+    {
+      if (m_iGOPSize > 0 && (m_acLayerCfg[layer].m_layerSwitchOffBegin % m_iGOPSize) != 0)
+      {
+        printf("LayerSwitchOffBegin%d: Must be multiple of GOP size.\n", layer);
+        exit(EXIT_FAILURE);
+      }
+      if (m_acLayerCfg[layer].m_iIntraPeriod > 0 && (m_acLayerCfg[layer].m_layerSwitchOffEnd % m_acLayerCfg[layer].m_iIntraPeriod) != 0)
+      {
+        printf("LayerSwitchOffEnd%d: Must be IRAP picture.\n", layer);
+        exit(EXIT_FAILURE);
+      }
+    }
+  }
 #endif
 
Index: branches/SHM-upgrade/source/App/TAppEncoder/TAppEncLayerCfg.h
===================================================================
--- branches/SHM-upgrade/source/App/TAppEncoder/TAppEncLayerCfg.h	(revision 977)
+++ branches/SHM-upgrade/source/App/TAppEncoder/TAppEncLayerCfg.h	(revision 979)
@@ -154,4 +154,9 @@
 #endif
 
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  Int       m_layerSwitchOffBegin;
+  Int       m_layerSwitchOffEnd;
+#endif
+
 #if MULTIPLE_PTL_SUPPORT
   // profile/level
Index: branches/SHM-upgrade/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/SHM-upgrade/source/App/TAppEncoder/TAppEncTop.cpp	(revision 977)
+++ branches/SHM-upgrade/source/App/TAppEncoder/TAppEncTop.cpp	(revision 979)
@@ -806,4 +806,8 @@
     m_acTEncTop[layer].setAdaptiveResolutionChange               ( m_adaptiveResolutionChange );
 #endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+    m_acTEncTop[layer].setLayerSwitchOffBegin                    (m_acLayerCfg[layer].m_layerSwitchOffBegin);
+    m_acTEncTop[layer].setLayerSwitchOffEnd                      (m_acLayerCfg[layer].m_layerSwitchOffEnd);
+#endif
 #if AUXILIARY_PICTURES
     m_acTEncTop[layer].setChromaFormatIDC                        ( m_acLayerCfg[layer].m_chromaFormatIDC );
Index: branches/SHM-upgrade/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibCommon/TypeDef.h	(revision 977)
+++ branches/SHM-upgrade/source/Lib/TLibCommon/TypeDef.h	(revision 979)
@@ -173,4 +173,5 @@
 #define VPS_EXTN_DIRECT_REF_LAYERS       1      ///< Include indication of direct dependency of layers in VPS extension
 #define M0040_ADAPTIVE_RESOLUTION_CHANGE 1
+#define R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 1
 
 #define VPS_VUI_TILES_NOT_IN_USE__FLAG   1      ///< JCTVC-O0226: VPS VUI flag to indicate tile not in use
Index: branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.cpp	(revision 977)
+++ branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.cpp	(revision 979)
@@ -105,4 +105,7 @@
   m_isLastNALWasEos = false;
 #endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  m_lastPicHasEos = false;
+#endif
 #if NO_CLRAS_OUTPUT_FLAG
   m_noClrasOutputFlag          = false;
@@ -972,4 +975,10 @@
       setNoClrasOutputFlag(true);
     }
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+    else if( m_lastPicHasEos )
+    {
+      setNoClrasOutputFlag(true);
+    }
+#endif
     else if ( m_apcSlicePilot->getBlaPicFlag() )
     {
@@ -1663,4 +1672,8 @@
     }
 #endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+    xCheckLayerReset();
+    xSetLayerInitializedFlag();
+#endif
     // Buffer initialize for prediction.
     m_cPrediction.initTempBuff(m_apcSlicePilot->getSPS()->getChromaFormatIdc());
@@ -2246,4 +2259,7 @@
 #if P0297_VPS_POC_LSB_ALIGNED_FLAG
   setFirstPicInLayerDecodedFlag(true);
+#endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  m_lastPicHasEos = false;
 #endif
 
@@ -2526,4 +2542,5 @@
 #if Q0177_EOS_CHECKS
       assert( m_isLastNALWasEos == false );
+#if !R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
       //Check layer id of the nalu. if it is not 0, give a warning message and just return without doing anything.
       if (nalu.m_layerId > 0)
@@ -2532,5 +2549,9 @@
         return false;
       }
+#endif
       m_isLastNALWasEos = true;
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+      m_lastPicHasEos = true;
+#endif
 #endif
       m_associatedIRAPType = NAL_UNIT_INVALID;
@@ -3091,4 +3112,92 @@
 }
 #endif
+
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+Void TDecTop::xCheckLayerReset()
+{
+  if (m_apcSlicePilot->isIRAP() && m_layerId > 0)
+  {
+    Bool layerResetFlag;
+    UInt dolLayerId;
+    if (m_lastPicHasEos)
+    {
+      layerResetFlag = true;
+      dolLayerId = m_layerId;
+    }
+    else if ((m_apcSlicePilot->isCRA() && m_apcSlicePilot->getHandleCraAsBlaFlag()) ||
+      (m_apcSlicePilot->isIDR() && m_apcSlicePilot->getCrossLayerBLAFlag()) || m_apcSlicePilot->isBLA())
+    {
+      layerResetFlag = true;
+      dolLayerId = m_layerId;
+    }
+    else
+    {
+      layerResetFlag = false;
+    }
+
+    if (layerResetFlag)
+    {
+      for (Int i = 0; i < m_apcSlicePilot->getVPS()->getNumPredictedLayers(dolLayerId); i++)
+      {
+        UInt iLayerId = m_apcSlicePilot->getVPS()->getPredictedLayerId(dolLayerId, i);
+        m_ppcTDecTop[iLayerId]->m_layerInitializedFlag = false;
+        m_ppcTDecTop[iLayerId]->m_firstPicInLayerDecodedFlag = false;
+      }
+
+      for (TComList<TComPic*>::iterator i = m_cListPic.begin(); i != m_cListPic.end(); i++)
+      {
+        if ((*i)->getPOC() != m_apcSlicePilot->getPOC())
+        {
+          (*i)->getSlice(0)->setReferenced(false);
+        }
+      }
+
+      for (UInt i = 0; i < m_apcSlicePilot->getVPS()->getNumPredictedLayers(dolLayerId); i++)
+      {
+        UInt predLId = m_apcSlicePilot->getVPS()->getPredictedLayerId(dolLayerId, i);
+        for (TComList<TComPic*>::iterator pic = m_ppcTDecTop[predLId]->getListPic()->begin(); pic != m_ppcTDecTop[predLId]->getListPic()->end(); pic++)
+        {
+          if ((*pic)->getSlice(0)->getPOC() != m_apcSlicePilot->getPOC())
+          {
+            (*pic)->getSlice(0)->setReferenced(false);
+          }
+        }
+      }
+    }
+  }
+}
+
+Void TDecTop::xSetLayerInitializedFlag()
+{
+  if (m_apcSlicePilot->isIRAP() && m_apcSlicePilot->getNoRaslOutputFlag())
+  {
+    if (m_layerId == 0)
+    {
+      m_ppcTDecTop[m_layerId]->setLayerInitializedFlag(true);
+    }
+    else if (!m_ppcTDecTop[m_layerId]->getLayerInitializedFlag() && m_apcSlicePilot->getVPS()->getNumDirectRefLayers(m_layerId) == 0)
+    {
+      m_ppcTDecTop[m_layerId]->setLayerInitializedFlag(true);
+    }
+    else if (!m_ppcTDecTop[m_layerId]->getLayerInitializedFlag())
+    {
+      Bool refLayersInitialized = true;
+      for (UInt j = 0; j < m_apcSlicePilot->getVPS()->getNumDirectRefLayers(m_layerId); j++)
+      {
+        UInt refLayerId = m_apcSlicePilot->getVPS()->getRefLayerId(m_layerId, j);
+        if (!m_ppcTDecTop[refLayerId]->getLayerInitializedFlag())
+        {
+          refLayersInitialized = false;
+        }
+      }
+      if (refLayersInitialized)
+      {
+        m_ppcTDecTop[m_layerId]->setLayerInitializedFlag(true);
+      }
+    }
+  }
+}
+#endif
+
 #endif //SVC_EXTENSION
 
Index: branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.h	(revision 977)
+++ branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.h	(revision 979)
@@ -124,4 +124,7 @@
   Bool                    m_isLastNALWasEos;
 #endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  Bool                    m_lastPicHasEos;
+#endif
   static UInt             m_prevPOC;        // POC of the previous slice
   static UInt             m_uiPrevLayerId;  // LayerId of the previous slice
@@ -356,4 +359,9 @@
   Void resetPocRestrictionCheckParameters();
 #endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  Void xCheckLayerReset();
+  Void xSetNoRaslOutputFlag();
+  Void xSetLayerInitializedFlag();
+#endif
 };// END CLASS DEFINITION TDecTop
 
Index: branches/SHM-upgrade/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibEncoder/TEncCfg.h	(revision 977)
+++ branches/SHM-upgrade/source/Lib/TLibEncoder/TEncCfg.h	(revision 979)
@@ -372,4 +372,8 @@
 #if M0040_ADAPTIVE_RESOLUTION_CHANGE
   Int       m_adaptiveResolutionChange;
+#endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  int       m_layerSwitchOffBegin;
+  int       m_layerSwitchOffEnd;
 #endif
 #if O0153_ALT_OUTPUT_LAYER_FLAG
@@ -1048,4 +1052,10 @@
   Int       getAdaptiveResolutionChange()      { return m_adaptiveResolutionChange; }
 #endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  Void      setLayerSwitchOffBegin(Int x)    { m_layerSwitchOffBegin = x;    }
+  Int       getLayerSwitchOffBegin()         { return m_layerSwitchOffBegin; }
+  Void      setLayerSwitchOffEnd(Int x)      { m_layerSwitchOffEnd = x;      }
+  Int       getLayerSwitchOffEnd()           { return m_layerSwitchOffEnd;   }
+#endif
 #if HIGHER_LAYER_IRAP_SKIP_FLAG
   Void      setSkipPictureAtArcSwitch(Int x) { m_skipPictureAtArcSwitch = x;    }
Index: branches/SHM-upgrade/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 977)
+++ branches/SHM-upgrade/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 979)
@@ -122,4 +122,8 @@
   m_lastPocPeriodId = -1;
 #endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  m_noRaslOutputFlag = false;
+  m_prevPicHasEos    = false;
+#endif
 #endif //SVC_EXTENSION
   return;
@@ -946,4 +950,10 @@
     }
 #endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+    if (pocCurr > m_pcEncTop->getLayerSwitchOffBegin() && pocCurr < m_pcEncTop->getLayerSwitchOffEnd())
+    {
+      continue;
+    }
+#endif
 
     if( getNalUnitType(pocCurr, m_iLastIDR, isField) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR, isField) == NAL_UNIT_CODED_SLICE_IDR_N_LP )
@@ -1100,4 +1110,8 @@
     }
 #endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+    // Set the nal unit type
+    pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR, isField));
+#endif
 #if NO_CLRAS_OUTPUT_FLAG
     if (m_layerId == 0 &&
@@ -1113,4 +1127,10 @@
         m_pcEncTop->setNoClrasOutputFlag(true);
       }
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+      else if (m_prevPicHasEos)
+      {
+        m_pcEncTop->setNoClrasOutputFlag(true);
+      }
+#endif
       else if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
             || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
@@ -1139,4 +1159,9 @@
       }
     }
+#endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+    xCheckLayerReset(pcSlice);
+    xSetNoRaslOutputFlag(pcSlice);
+    xSetLayerInitializedFlag(pcSlice);
 #endif
 #if M0040_ADAPTIVE_RESOLUTION_CHANGE
@@ -1252,6 +1277,8 @@
     }
     
+#if !R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     // Set the nal unit type
     pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR, isField));
+#endif
 #if SVC_EXTENSION
     if (m_layerId > 0)
@@ -2853,14 +2880,10 @@
       m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
 
-      pcSlice->setNoRaslOutputFlag(false);
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
       if (pcSlice->isIRAP())
       {
-        if (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP)
-        {
-          pcSlice->setNoRaslOutputFlag(true);
-        }
         //the inference for NoOutputPriorPicsFlag
         // KJS: This cannot happen at the encoder
-        if (!m_bFirst && pcSlice->isIRAP() && pcSlice->getNoRaslOutputFlag())
+        if (!m_bFirst && pcSlice->isIRAP() && m_noRaslOutputFlag)
         {
           if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)
@@ -2870,4 +2893,23 @@
         }
       }
+#else
+      pcSlice->setNoRaslOutputFlag(false);
+      if (pcSlice->isIRAP())
+      {
+        if (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP)
+        {
+          pcSlice->setNoRaslOutputFlag(true);
+        }
+        //the inference for NoOutputPriorPicsFlag
+        // KJS: This cannot happen at the encoder
+        if (!m_bFirst && pcSlice->isIRAP() && pcSlice->getNoRaslOutputFlag())
+        {
+          if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)
+          {
+            pcSlice->setNoOutputPriorPicsFlag(true);
+          }
+        }
+      }
+#endif
 
       tmpBitsBeforeWriting = m_pcEntropyCoder->getNumberOfWrittenBits();
@@ -3362,4 +3404,28 @@
       }
     }
+
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+    m_prevPicHasEos = false;
+    if (m_pcCfg->getLayerSwitchOffBegin() < m_pcCfg->getLayerSwitchOffEnd())
+    {
+      Int pocNext;
+      if (iGOPid == m_iGopSize - 1)
+      {
+        pocNext = iPOCLast - iNumPicRcvd + m_iGopSize + m_pcCfg->getGOPEntry(0).m_POC;
+      }
+      else
+      {
+        pocNext = iPOCLast - iNumPicRcvd + m_pcCfg->getGOPEntry(iGOPid + 1).m_POC;
+      }
+
+      if (pocNext > m_pcCfg->getLayerSwitchOffBegin() && pocCurr < m_pcCfg->getLayerSwitchOffEnd())
+      {
+        OutputNALUnit nalu(NAL_UNIT_EOS, pcSlice->getTLayer(), pcSlice->getLayerId());
+        m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
+        accessUnit.push_back(new NALUnitEBSP(nalu));
+        m_prevPicHasEos = true;
+      }
+    }
+#endif
 
     xResetNonNestedSEIPresentFlags();
@@ -5205,4 +5271,123 @@
 }
 #endif
+
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+Void TEncGOP::xCheckLayerReset(TComSlice *slice)
+{
+  Bool layerResetFlag;
+  Int dolLayerId;
+
+  if (slice->isIRAP() && slice->getLayerId() > 0)
+  {
+    if (m_prevPicHasEos)
+    {
+      layerResetFlag = true;
+      dolLayerId = slice->getLayerId();
+    }
+    else if ((slice->isCRA() && slice->getHandleCraAsBlaFlag()) || (slice->isIDR() && slice->getCrossLayerBLAFlag()) || slice->isBLA())
+    {
+      layerResetFlag = true;
+      dolLayerId = slice->getLayerId();
+    }
+    else
+    {
+      layerResetFlag = false;
+    }
+
+    if (layerResetFlag)
+    {
+      for (Int i = 0; i < slice->getVPS()->getNumPredictedLayers(dolLayerId); i++)
+      {
+        Int iLayerId = slice->getVPS()->getPredictedLayerId(dolLayerId, i);
+        m_ppcTEncTop[iLayerId]->setLayerInitializedFlag(false);
+        m_ppcTEncTop[iLayerId]->setFirstPicInLayerDecodedFlag(false);
+      }
+
+      // Each picture that is in the DPB and has nuh_layer_id equal to dolLayerId is marked as "unused for reference".
+      for (TComList<TComPic*>::iterator pic = m_ppcTEncTop[dolLayerId]->getListPic()->begin(); pic != m_ppcTEncTop[dolLayerId]->getListPic()->end(); pic++)
+      {
+        if ((*pic)->getSlice(0)->getPOC() != slice->getPOC())
+        {
+          (*pic)->getSlice(0)->setReferenced(false);
+        }
+      }
+
+      // Each picture that is in DPB and has nuh_layer_id equal to any value of IdPredictedLayer[dolLayerId][i]
+      // for the values of i in range of 0 to NumPredictedLayers[dolLayerId] - 1, inclusive, is marked as "unused for reference"
+      for (UInt i = 0; i < slice->getVPS()->getNumPredictedLayers(dolLayerId); i++)
+      {
+        UInt predLId = slice->getVPS()->getPredictedLayerId(dolLayerId, i);
+        for (TComList<TComPic*>::iterator pic = m_ppcTEncTop[predLId]->getListPic()->begin(); pic != m_ppcTEncTop[predLId]->getListPic()->end(); pic++)
+        {
+          if ((*pic)->getSlice(0)->getPOC() != slice->getPOC())
+          {
+            (*pic)->getSlice(0)->setReferenced(false);
+          }
+        }
+      }
+    }
+  }
+}
+
+Void TEncGOP::xSetNoRaslOutputFlag(TComSlice *slice)
+{
+  if (slice->isIRAP())
+  {
+    m_noRaslOutputFlag = slice->getHandleCraAsBlaFlag();  // default value
+    if (slice->isIDR() || slice->isBLA() || m_bFirst || m_prevPicHasEos)
+    {
+      m_noRaslOutputFlag = true;
+    }
+    else if (!m_ppcTEncTop[m_layerId]->getLayerInitializedFlag())
+    {
+      Bool refLayersInitialized = true;
+      for (UInt j = 0; j < slice->getVPS()->getNumDirectRefLayers(m_layerId); j++)
+      {
+        UInt refLayerId = slice->getVPS()->getRefLayerId(m_layerId, j);
+        if (!m_ppcTEncTop[refLayerId]->getLayerInitializedFlag())
+        {
+          refLayersInitialized = false;
+        }
+      }
+      if (refLayersInitialized)
+      {
+        m_noRaslOutputFlag = true;
+      }
+    }
+  }
+}
+
+Void TEncGOP::xSetLayerInitializedFlag(TComSlice *slice)
+{
+  if (slice->isIRAP() && m_noRaslOutputFlag)
+  {
+    if (m_layerId == 0)
+    {
+      m_ppcTEncTop[m_layerId]->setLayerInitializedFlag(true);
+    }
+    else if (!m_ppcTEncTop[m_layerId]->getLayerInitializedFlag() && slice->getVPS()->getNumDirectRefLayers(m_layerId) == 0)
+    {
+      m_ppcTEncTop[m_layerId]->setLayerInitializedFlag(true);
+    }
+    else if (!m_ppcTEncTop[m_layerId]->getLayerInitializedFlag())
+    {
+      Bool refLayersInitialized = true;
+      for (UInt j = 0; j < slice->getVPS()->getNumDirectRefLayers(m_layerId); j++)
+      {
+        UInt refLayerId = slice->getVPS()->getRefLayerId(m_layerId, j);
+        if (!m_ppcTEncTop[refLayerId]->getLayerInitializedFlag())
+        {
+          refLayersInitialized = false;
+        }
+      }
+      if (refLayersInitialized)
+      {
+        m_ppcTEncTop[m_layerId]->setLayerInitializedFlag(true);
+      }
+    }
+  }
+}
+#endif // R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+
 #endif //SVC_EXTENSION
 
Index: branches/SHM-upgrade/source/Lib/TLibEncoder/TEncGOP.h
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibEncoder/TEncGOP.h	(revision 977)
+++ branches/SHM-upgrade/source/Lib/TLibEncoder/TEncGOP.h	(revision 979)
@@ -153,4 +153,8 @@
   Int   m_lastPocPeriodId;
 #endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  Bool  m_noRaslOutputFlag;
+  Bool  m_prevPicHasEos;
+#endif
 #endif
   
@@ -280,4 +284,9 @@
   Void free_mem2DintWithPad(Int **array2D, Int iPadY, Int iPadX);
 #endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  Void xCheckLayerReset(TComSlice *slice);
+  Void xSetNoRaslOutputFlag(TComSlice *slice);
+  Void xSetLayerInitializedFlag(TComSlice *slice);
+#endif
 #endif //SVC_EXTENSION
 };// END CLASS DEFINITION TEncGOP
Index: branches/SHM-upgrade/source/Lib/TLibEncoder/TEncTop.h
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibEncoder/TEncTop.h	(revision 977)
+++ branches/SHM-upgrade/source/Lib/TLibEncoder/TEncTop.h	(revision 979)
@@ -163,4 +163,7 @@
   Int                     m_currPocMsb;
 #endif
+#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
+  Bool                    m_prevPicHasEos;
+#endif
 #endif //SVC_EXTENSION
 protected:
