Index: branches/SHM-3.1-dev/source/Lib/TLibDecoder/NALread.cpp
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibDecoder/NALread.cpp	(revision 427)
+++ branches/SHM-3.1-dev/source/Lib/TLibDecoder/NALread.cpp	(revision 431)
@@ -126,5 +126,5 @@
   else
   {
-    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_R
+    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA_R
          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R
Index: branches/SHM-3.1-dev/source/Lib/TLibDecoder/SEIread.cpp
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibDecoder/SEIread.cpp	(revision 427)
+++ branches/SHM-3.1-dev/source/Lib/TLibDecoder/SEIread.cpp	(revision 431)
@@ -349,4 +349,5 @@
 
   /* restore primary bitstream for sei_message */
+  getBitstream()->deleteFifo();
   delete getBitstream();
   setBitstream(bs);
Index: branches/SHM-3.1-dev/source/Lib/TLibDecoder/SyntaxElementParser.cpp
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibDecoder/SyntaxElementParser.cpp	(revision 427)
+++ branches/SHM-3.1-dev/source/Lib/TLibDecoder/SyntaxElementParser.cpp	(revision 431)
@@ -52,9 +52,9 @@
   if (length < 10)
   {
-    fprintf( g_hTrace, "%-50s u(%d)  : %d\n", pSymbolName, length, rValue ); 
+    fprintf( g_hTrace, "%-50s u(%d)  : %u\n", pSymbolName, length, rValue ); 
   }
   else
   {
-    fprintf( g_hTrace, "%-50s u(%d) : %d\n", pSymbolName, length, rValue ); 
+    fprintf( g_hTrace, "%-50s u(%d) : %u\n", pSymbolName, length, rValue ); 
   }
   fflush ( g_hTrace );
@@ -65,5 +65,5 @@
   xReadUvlc (rValue);
   fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
-  fprintf( g_hTrace, "%-50s ue(v) : %d\n", pSymbolName, rValue ); 
+  fprintf( g_hTrace, "%-50s ue(v) : %u\n", pSymbolName, rValue ); 
   fflush ( g_hTrace );
 }
Index: branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 427)
+++ branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 431)
@@ -1614,7 +1614,7 @@
       READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb");
       Int iPOClsb = uiCode;
-      Int iPrevPOC = rpcSlice->getPrevPOC();
+      Int iPrevPOC = rpcSlice->getPrevTid0POC();
       Int iMaxPOClsb = 1<< sps->getBitsForPOC();
-      Int iPrevPOClsb = iPrevPOC%iMaxPOClsb;
+      Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1);
       Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb;
       Int iPOCmsb;
@@ -1738,4 +1738,10 @@
             rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt);
             rps->setCheckLTMSBPresent(j,false);
+            
+            // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present
+            if( j == offset+(numOfLtrp-numLtrpInSPS)-1 )
+            {
+              deltaPocMSBCycleLT = 0;
+            }
           }
           prevDeltaMSB = deltaPocMSBCycleLT;
Index: branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecSlice.h
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecSlice.h	(revision 427)
+++ branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecSlice.h	(revision 431)
@@ -65,5 +65,4 @@
   TDecEntropy*    m_pcEntropyDecoder;
   TDecCu*         m_pcCuDecoder;
-  UInt            m_uiCurrSliceIdx;
 
   TDecSbac*       m_pcBufferSbacDecoders;   ///< line to store temporary contexts, one per column of tiles.
Index: branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 427)
+++ branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 431)
@@ -57,6 +57,6 @@
   g_nSymbolCounter = 0;
 #endif
+  m_associatedIRAPType = NAL_UNIT_INVALID;
   m_pocCRA = 0;
-  m_prevRAPisBLA = false;
   m_pocRandomAccess = MAX_INT;          
 #if !SVC_EXTENSION
@@ -77,8 +77,6 @@
   m_pBLSyntaxFile = NULL;
 #endif
-#if HM12_RANDOM_ACCESS
   m_prevSliceSkipped = false;
   m_skippedPOC = 0;
-#endif
 }
 
@@ -700,5 +698,4 @@
 #endif
 
-#if HM12_RANDOM_ACCESS
   // set POC for dependent slices in skipped pictures
   if(m_apcSlicePilot->getDependentSliceSegmentFlag() && m_prevSliceSkipped) 
@@ -706,13 +703,13 @@
     m_apcSlicePilot->setPOC(m_skippedPOC);
   }
-#endif
+
+  m_apcSlicePilot->setAssociatedIRAPPOC(m_pocCRA);
+  m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType);
 
   // Skip pictures due to random access
   if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
   {
-#if HM12_RANDOM_ACCESS
     m_prevSliceSkipped = true;
     m_skippedPOC = m_apcSlicePilot->getPOC();
-#endif
     return false;
   }
@@ -720,15 +717,11 @@
   if (isSkipPictureForBLA(iPOCLastDisplay))
   {
-#if HM12_RANDOM_ACCESS
     m_prevSliceSkipped = true;
     m_skippedPOC = m_apcSlicePilot->getPOC();
-#endif
     return false;
   }
 
-#if HM12_RANDOM_ACCESS
   // clear previous slice skipped flag
   m_prevSliceSkipped = false;
-#endif
 
   // exit when a new picture is found
@@ -913,4 +906,23 @@
     xGetNewPicBuffer (m_apcSlicePilot, pcPic);
 
+    Bool isField = false;
+    Bool isTff = false;
+    
+    if(!m_SEIs.empty())
+    {
+      // Check if any new Picture Timing SEI has arrived
+      SEIMessages pictureTimingSEIs = extractSeisByType (m_SEIs, SEI::PICTURE_TIMING);
+      if (pictureTimingSEIs.size()>0)
+      {
+        SEIPictureTiming* pictureTiming = (SEIPictureTiming*) *(pictureTimingSEIs.begin());
+        isField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 2);
+        isTff =  (pictureTiming->m_picStruct == 1);
+      }
+    }
+    
+    //Set Field/Frame coding mode
+    m_pcPic->setField(isField);
+    m_pcPic->setTopField(isTff);
+
     // transfer any SEI messages that have been received to the picture
     pcPic->setSEIs(m_SEIs);
@@ -1052,5 +1064,5 @@
   if (bNextSlice)
   {
-    pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic );
+    pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_associatedIRAPType, m_cListPic );
     // Set reference list
 #if SVC_EXTENSION
@@ -1251,5 +1263,4 @@
       pcSlice->setScalingList ( pcSlice->getPPS()->getScalingList()  );
     }
-    pcSlice->getScalingList()->setUseTransformSkip(pcSlice->getPPS()->getUseTransformSkip());
     if(!pcSlice->getPPS()->getScalingListPresentFlag() && !pcSlice->getSPS()->getScalingListPresentFlag())
     {
@@ -1497,5 +1508,5 @@
     case NAL_UNIT_CODED_SLICE_TRAIL_R:
     case NAL_UNIT_CODED_SLICE_TRAIL_N:
-    case NAL_UNIT_CODED_SLICE_TSA_R:
+    case NAL_UNIT_CODED_SLICE_TLA_R:
     case NAL_UNIT_CODED_SLICE_TSA_N:
     case NAL_UNIT_CODED_SLICE_STSA_R:
@@ -1532,5 +1543,6 @@
 Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay)
 {
-  if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
+  if ((m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_N_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_RADL) && 
+       m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
   {
     iPOCLastDisplay++;
Index: branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.h	(revision 427)
+++ branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.h	(revision 431)
@@ -67,6 +67,6 @@
   Int                     m_iMaxRefPicNum;
   
+  NalUnitType             m_associatedIRAPType; ///< NAL unit type of the associated IRAP picture
   Int                     m_pocCRA;            ///< POC number of the latest CRA picture
-  Bool                    m_prevRAPisBLA;      ///< true if the previous RAP (CRA/CRANT/BLA/BLANT/IDR) picture is a BLA/BLANT picture
   Int                     m_pocRandomAccess;   ///< POC number of the random access point (the first IDR or CRA picture)
 
@@ -107,8 +107,6 @@
   Bool                    m_bFirstSliceInSequence;
 #endif
-#if HM12_RANDOM_ACCESS
   Bool                    m_prevSliceSkipped;
   Int                     m_skippedPOC;
-#endif
 
 #if SVC_EXTENSION
@@ -122,5 +120,5 @@
   fstream*                m_pBLReconFile;
   Int                     m_iBLSourceWidth;
-  Int                     m_iBLSourceHeight;
+  Int                     m_iBLSourceHeight;  
 #endif
 #if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS
@@ -159,9 +157,8 @@
 
   Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic);
+#if SVC_EXTENSION
 #if EARLY_REF_PIC_MARKING
   Void earlyPicMarking(Int maxTemporalLayer, std::vector<Int>& targetDecLayerIdList);
 #endif
-
-#if SVC_EXTENSION
   UInt      getLayerId            () { return m_layerId;              }
   Void      setLayerId            (UInt layer) { m_layerId = layer; }
