﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1346	wrong STSA decision	tee.jung		"In HEVC specification, STSA is noted as in below:

''Pictures following an STSA picture in decoding order with the same TemporalId as the STSA picture do not use picture prior to the STSA picture in decoding order with the same TemporalId as the STSA picture for inter prediction reference.
''

However, TEncGop.cpp decides nal_unit_type as STSA when STSA is not used for reference for pictures following an STSA picture in decoding order with the same TemporalId as the STA picture. (as shown in below)


        
{{{
Bool isSTSA=true;
        for(Int ii=iGOPid+1;(ii<m_pcCfg->getGOPSize() && isSTSA==true);ii++)
        {
          Int lTid= m_pcCfg->getGOPEntry(ii).m_temporalId;
           if(lTid==pcSlice->getTLayer())
           {
             TComReferencePictureSet* nRPS = pcSlice->getSPS()->getRPSList()->getReferencePictureSet(ii);
             for(Int jj=0;jj<nRPS->getNumberOfPictures();jj++)
             {
               if(nRPS->getUsed(jj))
               {
                 Int tPoc=m_pcCfg->getGOPEntry(ii).m_POC+nRPS->getDeltaPOC(jj);
                 Int kk=0;
                 for(kk=0;kk<m_pcCfg->getGOPSize();kk++)
                 {
                   if(m_pcCfg->getGOPEntry(kk).m_POC==tPoc)
                     break;
                 }
                 Int tTid=m_pcCfg->getGOPEntry(kk).m_temporalId;
                 if(tTid >= pcSlice->getTLayer())
                 {
                   isSTSA=false;
                   break;
                 }
               }
             }
           }
}}}


I made a quick patch for this bug, and confirmed it working.


{{{
Index: Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- Lib/TLibEncoder/TEncGOP.cpp	(revision 4178)
+++ Lib/TLibEncoder/TEncGOP.cpp	(working copy)
@@ -910,23 +910,20 @@
           if(lTid==pcSlice->getTLayer())
           {
             TComReferencePictureSet* nRPS = pcSlice->getSPS()->getRPSList()->getReferencePictureSet(ii);
-            for(Int jj=0;jj<nRPS->getNumberOfPictures();jj++)
+            for(Int jj=0;(jj<nRPS->getNumberOfPictures() && isSTSA==true);jj++)
             {
               if(nRPS->getUsed(jj))
               {
                 Int tPoc=m_pcCfg->getGOPEntry(ii).m_POC+nRPS->getDeltaPOC(jj);
                 Int kk=0;
-                for(kk=0;kk<m_pcCfg->getGOPSize();kk++)
+                for(kk=0;kk<iGOPid;kk++)
                 {
                   if(m_pcCfg->getGOPEntry(kk).m_POC==tPoc)
+                  {
+                    isSTSA=false;
                     break;
+				  }
                 }
-                Int tTid=m_pcCfg->getGOPEntry(kk).m_temporalId;
-                if(tTid >= pcSlice->getTLayer())
-                {
-                  isSTSA=false;
-                  break;
-                }
               }
             }
           }
}}}
"	defect	new	major		HM	HM-16.2			ksuehring davidf karlsharman jct-vc@…
