Ticket #1261: Ticket_1261_r0.patch

File Ticket_1261_r0.patch, 3.5 KB (added by rickard, 11 years ago)

Proposed patch for ticket 1261

  • source/App/TAppDecoder/TAppDecTop.cpp

     
    274274
    275275  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    276276  Int numPicsNotYetDisplayed = 0;
    277  
     277  Int dpbFullness = 0;
     278  TComSPS* activeSPS = m_cTDecTop.getActiveSPS();
     279  UInt numReorderPicsHighestTid;
     280  UInt maxDecPicBufferingHighestTid;
     281  UInt maxNrSublayers = activeSPS->getMaxTLayers();
     282
     283  if(m_iMaxTemporalLayer == -1 || m_iMaxTemporalLayer >= maxNrSublayers)
     284  {
     285    numReorderPicsHighestTid = activeSPS->getNumReorderPics(maxNrSublayers-1);
     286    maxDecPicBufferingHighestTid =  activeSPS->getMaxDecPicBuffering(maxNrSublayers-1);
     287  }
     288  else
     289  {
     290    numReorderPicsHighestTid = activeSPS->getNumReorderPics(m_iMaxTemporalLayer);
     291    maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(m_iMaxTemporalLayer);
     292  }
     293
    278294  while (iterPic != pcListPic->end())
    279295  {
    280296    TComPic* pcPic = *(iterPic);
    281297    if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay)
    282298    {
    283299      numPicsNotYetDisplayed++;
     300      dpbFullness++;
    284301    }
     302    else if(pcPic->getSlice( 0 )->isReferenced())
     303    {
     304      dpbFullness++;
     305    }
    285306    iterPic++;
    286307  }
    287308  iterPic   = pcListPic->begin();
     
    302323      iterPic++;
    303324      TComPic* pcPicBottom = *(iterPic);
    304325     
    305       if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed >  pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1)
    306           && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed >  pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay<0)))
     326      if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() &&
     327          (numPicsNotYetDisplayed >  numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid) &&
     328          (!(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) &&
     329          (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay < 0))
    307330      {
    308331        // write to file
    309332        numPicsNotYetDisplayed = numPicsNotYetDisplayed-2;
     
    365388    {
    366389      pcPic = *(iterPic);
    367390     
    368       if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
     391      if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay &&
     392        (numPicsNotYetDisplayed >  numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid))
    369393      {
    370394        // write to file
    371395        numPicsNotYetDisplayed--;
     396        if(pcPic->getSlice(0)->isReferenced() == false)
     397        {
     398          dpbFullness--;
     399        }
     400
    372401        if ( m_pchReconFile )
    373402        {
    374403          const Window &conf = pcPic->getConformanceWindow();
  • source/Lib/TLibDecoder/TDecTop.h

     
    119119  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay);
    120120  Void  deletePicBuffer();
    121121
     122 
     123  TComSPS* getActiveSPS() { return m_parameterSetManagerDecoder.getActiveSPS(); }
     124
     125
    122126  Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic);
    123127#if SETTING_NO_OUT_PIC_PRIOR 
    124128  Void  checkNoOutputPriorPics (TComList<TComPic*>*& rpcListPic);