Ticket #1333: 0001-Bug-fix-set-m_pocRandomAccess-correctly.patch

File 0001-Bug-fix-set-m_pocRandomAccess-correctly.patch, 3.7 KB (added by jackh, 6 years ago)
  • source/Lib/TLibDecoder/TDecTop.cpp

    From e4b433c32881308755d4600f0013fd0a4a0b5b71 Mon Sep 17 00:00:00 2001
    From: Jack Haughton <jack.haughton@argondesign.com>
    Date: Wed, 15 Oct 2014 11:41:42 +0100
    Subject: [PATCH] Bug fix: set m_pocRandomAccess correctly
    
    ---
     source/Lib/TLibDecoder/TDecTop.cpp |   40 +++++++++++++++++++++---------------
     1 file changed, 24 insertions(+), 16 deletions(-)
    
    diff --git a/source/Lib/TLibDecoder/TDecTop.cpp b/source/Lib/TLibDecoder/TDecTop.cpp
    index d3d5970..0bacd17 100644
    a b Bool TDecTop::isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay) 
    839839    iSkipFrame--;   // decrement the counter
    840840    return true;
    841841  }
    842   else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet.
     842 
     843  if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    843844  {
    844     if (   m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA
     845    m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
     846  }
     847  else if (  (m_pocRandomAccess == MAX_INT && m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA )
    845848        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
    846849        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
    847850        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL )
    848     {
    849       // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT.
    850       m_pocRandomAccess = m_apcSlicePilot->getPOC();
    851     }
    852     else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    853     {
    854       m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
    855     }
    856     else
    857     {
    858       static Bool warningMessage = false;
     851  {
     852    // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT.
     853    m_pocRandomAccess = m_apcSlicePilot->getPOC();
     854  }
     855  else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA &&
     856    m_pocRandomAccess!=m_apcSlicePilot->getPOC())
     857  {
     858    m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in mid-CVS CRA, they are decodable.
     859  }
     860  if ( m_pocRandomAccess == MAX_INT &&
     861       m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_CRA
     862      && m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_BLA_W_LP
     863      && m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_BLA_N_LP
     864      && m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_BLA_W_RADL
     865      && m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL
     866      && m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_N_LP )
     867  {
     868    static Bool warningMessage = false;
    859869      if(!warningMessage)
    860870      {
    861871        printf("\nWarning: this is not a valid random access point and the data is discarded until the first CRA picture");
    862872        warningMessage = true;
    863873      }
    864874      return true;
    865     }
    866875  }
    867   // skip the reordered pictures, if necessary
    868   else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
     876  if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
    869877  {
    870878    iPOCLastDisplay++;
    871879    return true;