Ticket #1101: SVN_HEVCSoftware_trunk_multiple_cvs_fix.patch

File SVN_HEVCSoftware_trunk_multiple_cvs_fix.patch, 5.4 KB (added by jackh, 7 years ago)
  • source/Lib/TLibDecoder/TDecTop.cpp

     
    5454  m_prevRAPisBLA = false;
    5555  m_pocRandomAccess = MAX_INT;         
    5656  m_prevPOC                = MAX_INT;
     57  m_prevSuppressOutput      = false;
    5758  m_bFirstSliceInPicture    = true;
    5859  m_bFirstSliceInSequence   = true;
     60  m_bLastNALSkipped         = false;
    5961}
    6062
    6163TDecTop::~TDecTop()
     
    255257  TComSPS *sps = m_parameterSetManagerDecoder.getSPS(pps->getSPSId());
    256258  assert (sps != 0);
    257259
     260  Bool spsChanged=sps!=m_parameterSetManagerDecoder.getActiveSPS();
    258261  if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
    259262  {
    260263    printf ("Parameter set activation failed!");
     
    291294  g_uiMaxCUDepth  = sps->getMaxCUDepth();
    292295  g_uiAddCUDepth  = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() );
    293296
     297  if (spsChanged)
     298  {
     299    for (TComList<TComPic *>::iterator It=m_cListPic.begin(); It!=m_cListPic.end(); ) {
     300      TComList<TComPic *>::iterator CIt=It++;
     301      (*CIt)->destroy();
     302      delete *CIt;
     303      m_cListPic.erase(CIt);
     304    }
     305  }
     306
    294307  for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++)
    295308  {
    296309    sps->setAMPAcc( i, sps->getUseAMP() );
     
    316329    m_uiSliceIdx     = 0;
    317330  }
    318331  m_apcSlicePilot->setSliceIdx(m_uiSliceIdx);
    319   if (!m_bFirstSliceInPicture)
     332  if (!m_bFirstSliceInPicture && !m_bLastNALSkipped)
    320333  {
    321334    m_apcSlicePilot->copySliceInfo( pcPic->getPicSym()->getSlice(m_uiSliceIdx-1) );
    322335  }
     
    334347
    335348  m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder);
    336349
     350  if (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && 
     351      m_apcSlicePilot->getSliceSegmentCurStartCUAddr() == 0) {
     352      if (nalu.m_nalUnitType==NAL_UNIT_CODED_SLICE_BLA_W_LP ||
     353       nalu.m_nalUnitType==NAL_UNIT_CODED_SLICE_BLA_W_RADL ||
     354       nalu.m_nalUnitType==NAL_UNIT_CODED_SLICE_BLA_N_LP ||
     355       nalu.m_nalUnitType==NAL_UNIT_CODED_SLICE_IDR_W_RADL ||
     356       nalu.m_nalUnitType==NAL_UNIT_CODED_SLICE_IDR_N_LP)
     357          {
     358                m_pocRandomAccess=MAX_INT;
     359          }
     360  }
    337361  // Skip pictures due to random access
    338   if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
    339   {
    340     return false;
    341   }
    342362  // Skip TFD pictures associated with BLA/BLANT pictures
    343   if (isSkipPictureForBLA(iPOCLastDisplay))
     363  if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay) || isSkipPictureForBLA(iPOCLastDisplay))
    344364  {
     365        m_bLastNALSkipped=true;
    345366    return false;
    346367  }
    347 
     368  else m_bLastNALSkipped=false;
    348369  //we should only get a different poc for a new picture (with CTU address==0)
    349370  if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (!m_apcSlicePilot->getSliceCurStartCUAddr()==0))
    350371  {
     
    353374  // exit when a new picture is found
    354375  if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence )
    355376  {
    356     if (m_prevPOC >= m_pocRandomAccess)
     377        if (!m_prevSuppressOutput)
    357378    {
    358379      m_prevPOC = m_apcSlicePilot->getPOC();
     380          m_prevSuppressOutput = m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType()==NAL_UNIT_CODED_SLICE_RASL_N || m_apcSlicePilot->getNalUnitType()==NAL_UNIT_CODED_SLICE_RASL_R);
    359381      return true;
    360382    }
    361383    m_prevPOC = m_apcSlicePilot->getPOC();
     384        m_prevSuppressOutput = m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType()==NAL_UNIT_CODED_SLICE_RASL_N || m_apcSlicePilot->getNalUnitType()==NAL_UNIT_CODED_SLICE_RASL_R);
    362385  }
    363386  // actual decoding starts here
    364387  xActivateParameterSets();
     
    366389  if (m_apcSlicePilot->isNextSlice())
    367390  {
    368391    m_prevPOC = m_apcSlicePilot->getPOC();
     392        m_prevSuppressOutput = m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType()==NAL_UNIT_CODED_SLICE_RASL_N || m_apcSlicePilot->getNalUnitType()==NAL_UNIT_CODED_SLICE_RASL_R);
    369393  }
    370394  m_bFirstSliceInSequence = false;
    371395  //detect lost reference picture and insert copy of earlier frame.
     
    620644{
    621645  if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
    622646  {
    623     m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
     647    if (!m_bLastNALSkipped) {
     648      m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
     649        }
    624650  }
    625651  else
    626652  {
     
    664690      xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType );
    665691      return false;
    666692
     693        case NAL_UNIT_EOS:
     694                m_pocRandomAccess=MAX_INT;
     695                break;
     696
    667697    case NAL_UNIT_CODED_SLICE_TRAIL_R:
    668698    case NAL_UNIT_CODED_SLICE_TRAIL_N:
    669699    case NAL_UNIT_CODED_SLICE_TLA_R:
  • source/Lib/TLibDecoder/TDecTop.h

     
    9595  TComPic*                m_pcPic;
    9696  UInt                    m_uiSliceIdx;
    9797  Int                     m_prevPOC;
     98  Bool                    m_prevSuppressOutput;
    9899  Bool                    m_bFirstSliceInPicture;
    99100  Bool                    m_bFirstSliceInSequence;
     101  Bool                    m_bLastNALSkipped;
    100102
    101103public:
    102104  TDecTop();