﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1349	HM cannot decode the 1st buffering period SEI message.	gaow02	karlsharman	"We found that current HM trunk cannot correctly decode the buffering period SEI message coded along with the 1st IDR picture. 

The code can be fixed as following:

'''After Fix:'''


{{{
Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType )
{
  //HUA_FIX: the 1st buffering period SEI cannot be correctly decoded if w/o the following fix.
  TComSPS* sps = m_parameterSetManagerDecoder.getActiveSPS();

  if(sps == NULL)
  {
      sps = m_parameterSetManagerDecoder.getPrefetchedSPS(0);
  }

  if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
  {
    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, sps, m_pDecodedSEIOutputStream );
  }
  else
  {
    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, sps, m_pDecodedSEIOutputStream );

    SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS);
    if (activeParamSets.size()>0)
    {
      SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin());
      m_parameterSetManagerDecoder.applyPrefetchedPS();
      assert(seiAps->activeSeqParameterSetId.size()>0);
      if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParameterSetId[0] ))
      {
        printf (""Warning SPS activation with Active parameter set SEI failed"");
      }
    }
  }
}

}}}

'''Before Fix:'''


{{{
Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType )
{
  if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
  {
    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream );
  }
  else
  {
    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream );

    SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS);
    if (activeParamSets.size()>0)
    {
      SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin());
      m_parameterSetManagerDecoder.applyPrefetchedPS();
      assert(seiAps->activeSeqParameterSetId.size()>0);
      if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParameterSetId[0] ))
      {
        printf (""Warning SPS activation with Active parameter set SEI failed"");
      }
    }
  }
}


}}}

Note that this may not be the best way to fix the issue. But it does help to avoid the decoder crash and allow it to correctly decode the bitstream."	defect	closed	major	HM-16.5	HM	HM-16.2	fixed		ksuehring davidf karlsharman jct-vc@…
