Index: /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1210)
+++ /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 1211)
@@ -1659,7 +1659,5 @@
 #endif
 #endif
-#if Q0108_TSA_STSA
   ("InheritCodingStruct%d",m_inheritCodingStruct, 0, MAX_LAYERS, "Predicts the GOP structure of one layer for another layer")
-#endif
 #endif //SVC_EXTENSION
   ;
@@ -1671,5 +1669,5 @@
   }
 
-#if Q0108_TSA_STSA
+#if SVC_EXTENSION
   for (Int i=1; i<MAX_LAYERS; i++)
   {
@@ -1686,5 +1684,5 @@
   const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
 
-#if Q0108_TSA_STSA
+#if SVC_EXTENSION
   for (Int i=1; i<MAX_LAYERS; i++)
   {
@@ -3232,5 +3230,4 @@
    * This permits the ability to omit a GOP structure specification */
 #if SVC_EXTENSION
-#if Q0108_TSA_STSA
   if( m_acLayerCfg[0].m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1 )
   {
@@ -3260,22 +3257,4 @@
   }
 #else
-  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
-  {
-    Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod;
-    if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) {
-      m_GOPList[0] = GOPEntry();
-      m_GOPList[0].m_QPFactor = 1;
-      m_GOPList[0].m_betaOffsetDiv2 = 0;
-      m_GOPList[0].m_tcOffsetDiv2 = 0;
-      m_GOPList[0].m_POC = 1;
-      m_GOPList[0].m_numRefPicsActive = 4;
-    }
-    else
-    {
-      xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
-    }
-  }
-#endif
-#else
   if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1)
   {
@@ -3352,9 +3331,10 @@
   }
 
-#if !Q0108_TSA_STSA
+#if SVC_EXTENSION
+  memset( m_extraRPSs, 0, sizeof( m_extraRPSs ) );
+#else
   m_extraRPSs=0;                                     
-#else
-  memset( m_extraRPSs, 0, sizeof( m_extraRPSs ) );
-#endif
+#endif
+
   //start looping through frames in coding order until we can verify that the GOP structure is correct.
   while(!verifiedGOP&&!errorGOP)
@@ -3422,8 +3402,8 @@
       {
         //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)
-#if !Q0108_TSA_STSA
+#if SVC_EXTENSION
+        m_GOPList[m_iGOPSize+m_extraRPSs[0]]=m_GOPList[curGOP];
+#else
         m_GOPList[m_iGOPSize+m_extraRPSs]=m_GOPList[curGOP];
-#else
-        m_GOPList[m_iGOPSize+m_extraRPSs[0]]=m_GOPList[curGOP];
 #endif
         Int newRefs=0;
@@ -3433,10 +3413,10 @@
           if(absPOC>=0)
           {
-#if !Q0108_TSA_STSA
+#if SVC_EXTENSION
+            m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i];
+            m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i];
+#else
             m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i];
             m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i];
-#else
-            m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i];
-            m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i];
 #endif
             newRefs++;
@@ -3462,8 +3442,8 @@
             for(Int i=0; i<newRefs; i++)
             {
-#if !Q0108_TSA_STSA
+#if SVC_EXTENSION
+              if( m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[i] == offPOC-curPOC )
+#else
               if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC)
-#else
-              if(m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[i]==offPOC-curPOC)
 #endif
               {
@@ -3481,8 +3461,8 @@
               for(Int j=0; j<newRefs; j++)
               {
-#if !Q0108_TSA_STSA
+#if SVC_EXTENSION
+                if( m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j] < offPOC-curPOC || m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j] > 0 )
+#else
                 if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]<offPOC-curPOC||m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]>0)
-#else
-                if(m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]<offPOC-curPOC||m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]>0)
 #endif
                 {
@@ -3495,14 +3475,14 @@
               for(Int j=insertPoint; j<newRefs+1; j++)
               {
-#if !Q0108_TSA_STSA
+#if SVC_EXTENSION
+                Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j];
+                Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j];
+                m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]=prev;
+                m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j]=prevUsed;
+#else
                 Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j];
                 Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j];
                 m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]=prev;
                 m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]=prevUsed;
-#else
-                Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j];
-                Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j];
-                m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]=prev;
-                m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j]=prevUsed;
 #endif
 
@@ -3518,31 +3498,29 @@
           }
         }
-#if !Q0108_TSA_STSA
-        m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs;
-        m_GOPList[m_iGOPSize+m_extraRPSs].m_POC = curPOC;
-#else
+
+#if SVC_EXTENSION
         m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefPics=newRefs;
         m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_POC = curPOC;
-#endif
-#if !Q0108_TSA_STSA
-        if (m_extraRPSs == 0)
-#else
-        if (m_extraRPSs[0] == 0)
-#endif
+
+        if( m_extraRPSs[0] == 0 )
         {
-#if !Q0108_TSA_STSA
-          m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0;
-          m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0;
-#else
           m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_interRPSPrediction = 0;
           m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefIdc = 0;
-#endif
         }
         else
         {
-#if !Q0108_TSA_STSA
+          Int rIdx =  m_iGOPSize + m_extraRPSs[0] - 1;
+#else
+        m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs;
+        m_GOPList[m_iGOPSize+m_extraRPSs].m_POC = curPOC;
+
+        if (m_extraRPSs == 0)
+        {
+          m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0;
+          m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0;
+        }
+        else
+        {
           Int rIdx =  m_iGOPSize + m_extraRPSs - 1;
-#else
-          Int rIdx =  m_iGOPSize + m_extraRPSs[0] - 1;
 #endif
           Int refPOC = m_GOPList[rIdx].m_POC;
@@ -3554,5 +3532,31 @@
             Int absPOCref = refPOC+deltaPOC;
             Int refIdc = 0;
-#if !Q0108_TSA_STSA
+
+#if SVC_EXTENSION
+            for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefPics; j++)
+            {
+              if ( (absPOCref - curPOC) == m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j])
+              {
+                if (m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j])
+                {
+                  refIdc = 1;
+                }
+                else
+                {
+                  refIdc = 2;
+                }
+              }
+            }
+            m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_refIdc[newIdc]=refIdc;
+            newIdc++;
+          }
+          m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_interRPSPrediction = 1;  
+          m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefIdc = newIdc;
+          m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_POC; 
+        }
+        curGOP=m_iGOPSize+m_extraRPSs[0];
+        m_extraRPSs[0]++;
+      }
+#else
             for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics; j++)
             {
@@ -3579,29 +3583,4 @@
         m_extraRPSs++;
       }
-#else
-            for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefPics; j++)
-            {
-              if ( (absPOCref - curPOC) == m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j])
-              {
-                if (m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j])
-                {
-                  refIdc = 1;
-                }
-                else
-                {
-                  refIdc = 2;
-                }
-              }
-            }
-            m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_refIdc[newIdc]=refIdc;
-            newIdc++;
-          }
-          m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_interRPSPrediction = 1;  
-          m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefIdc = newIdc;
-          m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_POC; 
-        }
-        curGOP=m_iGOPSize+m_extraRPSs[0];
-        m_extraRPSs[0]++;
-      }
 #endif
 
@@ -3623,5 +3602,5 @@
   xConfirmPara(errorGOP,"Invalid GOP structure given");
 
-#if SVC_EXTENSION && Q0108_TSA_STSA
+#if SVC_EXTENSION
   if( layerIdx > 0 )
   {
@@ -3872,5 +3851,5 @@
   }
 
-#if Q0108_TSA_STSA
+#if SVC_EXTENSION
   if( layerIdx > 0 )
   {
Index: /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h	(revision 1210)
+++ /branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h	(revision 1211)
@@ -158,15 +158,14 @@
   Int       m_iGOPSize;                                       ///< GOP size of hierarchical structure
 
-#if !Q0108_TSA_STSA
-  Int       m_extraRPSs;                                      ///< extra RPSs added to handle CRA
-#else
+#if SVC_EXTENSION
   Int       m_extraRPSs[MAX_LAYERS];                          ///< extra RPSs added to handle CRA
-#endif
-
-  GOPEntry  m_GOPList[MAX_GOP];                               ///< the coding structure entries from the config file
-#if Q0108_TSA_STSA
   GOPEntry  m_EhGOPList[MAX_LAYERS][MAX_GOP];                 ///< the enhancement layer coding structure entries from the config file
   Int       m_inheritCodingStruct[MAX_LAYERS];
-#endif
+  Int       m_EhMaxTempLayer[MAX_LAYERS];                    ///< Max temporal layer
+#else
+  Int       m_extraRPSs;                                      ///< extra RPSs added to handle CRA
+#endif
+
+  GOPEntry  m_GOPList[MAX_GOP];                               ///< the coding structure entries from the config file
 
   Int       m_numReorderPics[MAX_TLAYER];                     ///< total number of reorder pictures
@@ -209,7 +208,4 @@
 
   Int       m_maxTempLayer;                                  ///< Max temporal layer
-#if Q0108_TSA_STSA
-  Int       m_EhMaxTempLayer[MAX_LAYERS];                    ///< Max temporal layer
-#endif
 
 #if !LAYER_CTB
Index: /branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1210)
+++ /branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 1211)
@@ -269,15 +269,8 @@
     m_acTEncTop[layer].setDecodingRefreshType                             ( m_iDecodingRefreshType );
     m_acTEncTop[layer].setGOPSize                                         ( m_iGOPSize );
-#if Q0108_TSA_STSA
+
     m_acTEncTop[layer].setGopList                                         ( layer ? m_EhGOPList[layer] : m_GOPList );
-#else
-    m_acTEncTop[layer].setGopList                                         ( m_GOPList );
-#endif
-
-#if !Q0108_TSA_STSA
-    m_acTEncTop[layer].setExtraRPSs                                       ( m_extraRPSs );
-#else
     m_acTEncTop[layer].setExtraRPSs                                       ( m_extraRPSs[layer] );
-#endif
+
     for(Int i = 0; i < MAX_TLAYER; i++)
     {
@@ -292,7 +285,5 @@
 
     m_acTEncTop[layer].setPad                                             ( m_acLayerCfg[layer].getPad() );
-#if !Q0108_TSA_STSA
-    m_acTEncTop[layer].setMaxTempLayer                                    ( m_maxTempLayer );
-#else
+
     if (layer== 0)
     {
@@ -303,5 +294,5 @@
       m_acTEncTop[layer].setMaxTempLayer                                  ( m_EhMaxTempLayer[layer] );
     }
-#endif
+
     m_acTEncTop[layer].setUseAMP( m_enableAMP );
 
Index: /branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h	(revision 1210)
+++ /branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h	(revision 1211)
@@ -48,5 +48,4 @@
 #define BSP_INIT_ARRIVAL_SEI             1      ///< JCTVC-R0231: Make signalling of vcl_initial_arrival_delay independent of NalHrdBpPresentFlag
 
-#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
 #define Q0177_EOS_CHECKS                 1      ///< JCTVC-Q0177; Put checks on handling EOS
 #define P0130_EOB                        1      ///< JCTVC-P0130, set layer Id of EOB NALU to be fixed to 0
Index: /branches/SHM-dev/source/Lib/TLibDecoder/NALread.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibDecoder/NALread.cpp	(revision 1210)
+++ /branches/SHM-dev/source/Lib/TLibDecoder/NALread.cpp	(revision 1211)
@@ -123,5 +123,15 @@
   if ( nalu.m_temporalId )
   {
-#if !Q0108_TSA_STSA
+#if SVC_EXTENSION
+    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP
+         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL
+         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_N_LP
+         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL
+         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP
+         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA
+         && nalu.m_nalUnitType != NAL_UNIT_VPS
+         && nalu.m_nalUnitType != NAL_UNIT_SPS
+         && nalu.m_nalUnitType != NAL_UNIT_EOS);
+#else
     assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP
          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL
@@ -133,28 +143,18 @@
          && nalu.m_nalUnitType != NAL_UNIT_SPS
          && nalu.m_nalUnitType != NAL_UNIT_EOS
-         && nalu.m_nalUnitType != NAL_UNIT_EOB );
-#else
-    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_N_LP
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA
-         && nalu.m_nalUnitType != NAL_UNIT_VPS
-         && nalu.m_nalUnitType != NAL_UNIT_SPS
-         && nalu.m_nalUnitType != NAL_UNIT_EOS); 
+         && nalu.m_nalUnitType != NAL_UNIT_EOB ); 
 #endif
   }
   else
   {
-#if !Q0108_TSA_STSA
+#if SVC_EXTENSION
+    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_R
+         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
+         );
+#else
     assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_R
          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R
          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_N );
-#else
-    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_R
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
-         );
 #endif
   }
Index: /branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1210)
+++ /branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1211)
@@ -1188,44 +1188,4 @@
   m_bFirstSliceInBitstream  = false;
 
-  // Alignment of TSA and STSA pictures across AU
-#if !Q0108_TSA_STSA
-  if( m_apcSlicePilot->getLayerId() > 0 )
-  {
-    // Check for TSA alignment
-    if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N ||
-        m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R 
-         )
-    {
-      for(Int dependentLayerIdx = 0; dependentLayerIdx < m_apcSlicePilot->getVPS()->getNumDirectRefLayers(m_layerId); dependentLayerIdx++)
-      {
-        TComList<TComPic*> *cListPic = getRefLayerDec( dependentLayerIdx )->getListPic();
-        TComPic* refpicLayer = m_apcSlicePilot->getRefPic(*cListPic, m_apcSlicePilot->getPOC() );
-        if( refpicLayer )
-        {
-          assert( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N ||
-                    m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R );    // TSA pictures should be aligned among depenedent layers
-        } 
-      }
-    }
-    // Check for STSA alignment
-    if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N ||
-         m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R 
-         )
-    {
-      for(Int dependentLayerIdx = 0; dependentLayerIdx < m_apcSlicePilot->getVPS()->getNumDirectRefLayers(m_layerId); dependentLayerIdx++)
-      {
-        TComList<TComPic*> *cListPic = getRefLayerDec( dependentLayerIdx )->getListPic();
-        TComPic* refpicLayer = m_apcSlicePilot->getRefPic(*cListPic, m_apcSlicePilot->getPOC() ); // STSA pictures should be aligned among dependent layers
-        if( refpicLayer )
-
-        {
-          assert( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N ||
-                    m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R );
-        }
-      }
-    }
-  }
-#endif
-
 #else //SVC_EXTENSION
   //we should only get a different poc for a new picture (with CTU address==0)
@@ -1260,4 +1220,5 @@
   m_bFirstSliceInBitstream  = false;
 #endif //SVC_EXTENSION
+
   //detect lost reference picture and insert copy of earlier frame.
   Int lostPoc;
Index: /branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 1210)
+++ /branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 1211)
@@ -1592,61 +1592,4 @@
       if(pcSlice->isTemporalLayerSwitchingPoint(rcListPic) || pcSlice->getSPS()->getTemporalIdNestingFlag())
       {
-#if SVC_EXTENSION && !Q0108_TSA_STSA
-        if( pcSlice->getLayerId() > 0 )
-        {
-          Bool oneRefLayerTSA = false, oneRefLayerNotTSA = false;
-          for( Int i = 0; i < pcSlice->getLayerId(); i++)
-          {
-            TComList<TComPic *> *cListPic = m_ppcTEncTop[i]->getListPic();
-            TComPic *lowerLayerPic = pcSlice->getRefPic(*cListPic, pcSlice->getPOC());
-            if( lowerLayerPic && pcSlice->getVPS()->getDirectDependencyFlag(pcSlice->getLayerId(), i) )
-            {
-              if( ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N ) ||
-                  ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R ) 
-                )
-              {
-                if(pcSlice->getTemporalLayerNonReferenceFlag() )
-                {
-                  pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TSA_N);
-                }
-                else
-                {
-                  pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TSA_R );
-                }
-                oneRefLayerTSA = true;
-              }
-              else
-              {
-                oneRefLayerNotTSA = true;
-              }
-            }
-          }
-          assert( !( oneRefLayerNotTSA && oneRefLayerTSA ) ); // Only one variable should be true - failure of this assert means
-                                                                // that two independent reference layers that are not dependent on
-                                                                // each other, but are reference for current layer have inconsistency
-          if( oneRefLayerNotTSA /*&& !oneRefLayerTSA*/ )          // No reference layer is TSA - set current as TRAIL
-          {
-            if(pcSlice->getTemporalLayerNonReferenceFlag() )
-            {
-              pcSlice->setNalUnitType( NAL_UNIT_CODED_SLICE_TRAIL_N );
-            }
-            else
-            {
-              pcSlice->setNalUnitType( NAL_UNIT_CODED_SLICE_TRAIL_R );
-            }
-          }
-          else  // This means there is no reference layer picture for current picture in this AU
-          {
-            if(pcSlice->getTemporalLayerNonReferenceFlag() )
-            {
-              pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TSA_N);
-            }
-            else
-            {
-              pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TSA_R );
-            }
-          }
-        }
-#else
         if(pcSlice->getTemporalLayerNonReferenceFlag())
         {
@@ -1657,5 +1600,4 @@
           pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TSA_R);
         }
-#endif
       }
       else if(pcSlice->isStepwiseTemporalLayerSwitchingPointCandidate(rcListPic))
@@ -1691,61 +1633,4 @@
         if(isSTSA==true)
         {
-#if SVC_EXTENSION && !Q0108_TSA_STSA
-          if( pcSlice->getLayerId() > 0 )
-          {
-            Bool oneRefLayerSTSA = false, oneRefLayerNotSTSA = false;
-            for( Int i = 0; i < pcSlice->getLayerId(); i++)
-            {
-              TComList<TComPic *> *cListPic = m_ppcTEncTop[i]->getListPic();
-              TComPic *lowerLayerPic = pcSlice->getRefPic(*cListPic, pcSlice->getPOC());
-              if( lowerLayerPic && pcSlice->getVPS()->getDirectDependencyFlag(pcSlice->getLayerId(), i) )
-              {
-                if( ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N ) ||
-                    ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R ) 
-                  )
-                {
-                  if(pcSlice->getTemporalLayerNonReferenceFlag() )
-                  {
-                    pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_N);
-                  }
-                  else
-                  {
-                    pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_R );
-                  }
-                  oneRefLayerSTSA = true;
-                }
-                else
-                {
-                  oneRefLayerNotSTSA = true;
-                }
-              }
-            }
-            assert( !( oneRefLayerNotSTSA && oneRefLayerSTSA ) ); // Only one variable should be true - failure of this assert means
-                                                                  // that two independent reference layers that are not dependent on
-                                                                  // each other, but are reference for current layer have inconsistency
-            if( oneRefLayerNotSTSA /*&& !oneRefLayerSTSA*/ )          // No reference layer is STSA - set current as TRAIL
-            {
-              if(pcSlice->getTemporalLayerNonReferenceFlag() )
-              {
-                pcSlice->setNalUnitType( NAL_UNIT_CODED_SLICE_TRAIL_N );
-              }
-              else
-              {
-                pcSlice->setNalUnitType( NAL_UNIT_CODED_SLICE_TRAIL_R );
-              }
-            }
-            else  // This means there is no reference layer picture for current picture in this AU
-            {
-              if(pcSlice->getTemporalLayerNonReferenceFlag() )
-              {
-                pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_N);
-              }
-              else
-              {
-                pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_R );
-              }
-            }
-          }
-#else
           if(pcSlice->getTemporalLayerNonReferenceFlag())
           {
@@ -1756,5 +1641,4 @@
             pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_R);
           }
-#endif
         }
       }
@@ -1809,7 +1693,5 @@
       }
     }
-#endif //SVC_EXTENSION
-
-#if Q0108_TSA_STSA
+
    if( ( pcSlice->getTLayer() == 0 && pcSlice->getLayerId() > 0  )    // only for enhancement layer and with temporal layer 0
      && !( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N     
@@ -1880,5 +1762,5 @@
         }
     }
-#endif
+#endif //SVC_EXTENSION
 
 #if ADAPTIVE_QP_SELECTION
