Index: branches/SHM-6-dev/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- branches/SHM-6-dev/source/App/TAppDecoder/TAppDecTop.cpp	(revision 746)
+++ branches/SHM-6-dev/source/App/TAppDecoder/TAppDecTop.cpp	(revision 798)
@@ -191,5 +191,4 @@
     InputNALUnit nalu;
     byteStreamNALUnit(bytestream, nalUnit, stats);
-
     // call actual decoding function
     Bool bNewPicture = false;
@@ -215,5 +214,9 @@
       {
         bNewPicture = m_acTDecTop[nalu.m_layerId].decode(nalu, m_iSkipFrame, m_aiPOCLastDisplay[nalu.m_layerId], curLayerId, bNewPOC);
+#if POC_RESET_IDC_DECODER
+        if ( (bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() == 3) || (m_acTDecTop[nalu.m_layerId].getParseIdc() == 0) )
+#else
         if (bNewPicture)
+#endif
         {
           bitstreamFile.clear();
@@ -225,8 +228,22 @@
           bytestream.reset();
         }
-      }
-    }
-
+#if POC_RESET_IDC_DECODER
+        else if(m_acTDecTop[nalu.m_layerId].getParseIdc() == 1) 
+        {
+          bitstreamFile.clear();
+          // This is before third parse of the NAL unit, and 
+          // location points to correct beginning of the NALU
+          bitstreamFile.seekg(location);
+          bytestream.reset();
+        }
+#endif
+      }
+    }
+
+#if POC_RESET_IDC_DECODER
+    if ((bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() == 3) || (m_acTDecTop[nalu.m_layerId].getParseIdc() == 0) || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS)
+#else
     if (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS)
+#endif
     {
 #if O0194_DIFFERENT_BITDEPTH_EL_BL
@@ -245,4 +262,11 @@
     }
 
+#if POC_RESET_IDC_DECODER
+    if( bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() == 0 )
+    {
+      outputAllPictures( nalu.m_layerId, true );
+    }
+#endif
+
     if( pcListPic )
     {
@@ -269,5 +293,11 @@
         flushAllPictures( nalu.m_layerId, outputPicturesFlag );       
       }
+
+#if POC_RESET_IDC_DECODER
+      if( bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() != 0 )
+      // New picture, slice header parsed but picture not decoded
+#else
       if( bNewPicture ) // New picture, slice header parsed but picture not decoded
+#endif
       {
 #if NO_OUTPUT_OF_PRIOR_PICS
@@ -1504,4 +1534,7 @@
                             , std::vector<Int> *listOfPocsPositionInEachLayer
                             , DpbStatus &dpbStatus
+#if POC_RESET_IDC_DECODER
+                            , Bool notOutputCurrAu
+#endif
                             )
 {
@@ -1528,20 +1561,26 @@
           vps = pic->getSlice(0)->getVPS();
         }
-
-        std::vector<Int>::iterator it;
-        if( pic->getOutputMark() ) // && pic->getPOC() > m_aiPOCLastDisplay[i])
-        {
-          it = find( listOfPocs.begin(), listOfPocs.end(), pic->getPOC() ); // Check if already included
-          if( it == listOfPocs.end() )  // New POC value - i.e. new AU - add to the list
+#if POC_RESET_IDC_DECODER
+        if( !(pic->isCurrAu() && notOutputCurrAu ) )
+        {
+#endif
+          std::vector<Int>::iterator it;
+          if( pic->getOutputMark() ) // && pic->getPOC() > m_aiPOCLastDisplay[i])
           {
-            listOfPocs.push_back( pic->getPOC() );
+            it = find( listOfPocs.begin(), listOfPocs.end(), pic->getPOC() ); // Check if already included
+            if( it == listOfPocs.end() )  // New POC value - i.e. new AU - add to the list
+            {
+              listOfPocs.push_back( pic->getPOC() );
+            }
+            listOfPocsInEachLayer         [i].push_back( pic->getPOC()    );    // POC to be output in each layer
+            listOfPocsPositionInEachLayer [i].push_back( picPositionInList  );  // For ease of access
           }
-          listOfPocsInEachLayer         [i].push_back( pic->getPOC()    );    // POC to be output in each layer
-          listOfPocsPositionInEachLayer [i].push_back( picPositionInList  );  // For ease of access
-        }
-        if( pic->getSlice(0)->isReferenced() || pic->getOutputMark() )
-        {
-          dpbStatus.m_numPicsInLayer[i]++;  // Count pictures that are "used for reference" or "needed for output"
-        }
+          if( pic->getSlice(0)->isReferenced() || pic->getOutputMark() )
+          {
+            dpbStatus.m_numPicsInLayer[i]++;  // Count pictures that are "used for reference" or "needed for output"
+          }
+#if POC_RESET_IDC_DECODER
+        }
+#endif
       }
       iterPic++;
@@ -1569,7 +1608,28 @@
   }
   assert( dpbStatus.m_numAUsNotDisplayed != -1 );
-
-
 }  
+
+#if POC_RESET_IDC_DECODER
+Void TAppDecTop::outputAllPictures(Int layerId, Bool notOutputCurrPic)
+{
+  { // All pictures in the DPB in that layer are to be output; this means other pictures would also be output
+    std::vector<Int>  listOfPocs;
+    std::vector<Int>  listOfPocsInEachLayer[MAX_LAYERS];
+    std::vector<Int>  listOfPocsPositionInEachLayer[MAX_LAYERS];
+    DpbStatus dpbStatus;
+
+    // Find the status of the DPB
+    xFindDPBStatus(listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, dpbStatus, notOutputCurrPic);
+
+    if( listOfPocs.size() )
+    {
+      while( listOfPocsInEachLayer[layerId].size() )    // As long as there picture in the layer to be output
+      {
+        bumpingProcess( listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, dpbStatus );
+      }
+    }
+  }
+}
+#endif
 #endif
 //! \}
Index: branches/SHM-6-dev/source/App/TAppDecoder/TAppDecTop.h
===================================================================
--- branches/SHM-6-dev/source/App/TAppDecoder/TAppDecTop.h	(revision 746)
+++ branches/SHM-6-dev/source/App/TAppDecoder/TAppDecTop.h	(revision 798)
@@ -107,8 +107,14 @@
 
   Void xOutputAndMarkPic( TComPic *pic, const Char *reconFile, const Int layerID, Int &pocLastDisplay, DpbStatus &dpbStatus);
+#if POC_RESET_IDC_DECODER
+  Void outputAllPictures(Int layerId, Bool notOutputCurrAu);
+#endif
   Void xFindDPBStatus( std::vector<Int> &listOfPocs
                             , std::vector<Int> *listOfPocsInEachLayer
                             , std::vector<Int> *listOfPocsPositionInEachLayer
                             , DpbStatus &dpbStatus
+#if POC_RESET_IDC_DECODER
+                            , Bool notOutputCurrAu = true
+#endif
                             );
 
