Ticket #237: patch0.patch

File patch0.patch, 7.0 KB (added by chenm003, 13 years ago)

Patch for bug when GOPSize=1

  • source/App/TAppDecoder/TAppDecTop.cpp

    diff --git a/source/App/TAppDecoder/TAppDecTop.cpp b/source/App/TAppDecoder/TAppDecTop.cpp
    index 862128f..566dc53 100644
    a b Void TAppDecTop::decode() 
    149149        m_cTVideoIOYuvReconFile.open( m_pchReconFile, true ); // write mode
    150150        recon_opened = true;
    151151      }
     152      TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
     153      TComPic* pcPic = *(iterPic);
     154      if (pcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR) {
     155          m_iPOCLastDisplay = 0;
     156          xFlushOutput( pcListPic );
     157          m_iPOCLastDisplay = -1;
     158      }
    152159      // write reconstuction to file
    153160      xWriteOutput( pcListPic );
    154161    }
    Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic ) 
    204211  while (iterPic != pcListPic->end())
    205212  {
    206213    TComPic* pcPic = *(iterPic);
    207     if(pcPic->getReconMark() && pcPic->getPOC() > m_iPOCLastDisplay)
     214    if(pcPic->getReconMark() && pcPic->getPOC() > m_iPOCLastDisplay && pcPic->getDisplayMark())
    208215       not_displayed++;
    209216    iterPic++;
    210217  }
    Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic ) 
    216223    TComPic* pcPic = *(iterPic);
    217224   
    218225#if G1002_RPS
    219     if ( pcPic->getReconMark() && not_displayed >  m_cTDecTop.getSPS()->getMaxNumberOfReorderPictures() && pcPic->getPOC() > m_iPOCLastDisplay)
     226    if ( pcPic->getReconMark() && not_displayed >  m_cTDecTop.getSPS()->getMaxNumberOfReorderPictures() && pcPic->getPOC() > m_iPOCLastDisplay && pcPic->getDisplayMark())
    220227    {
    221228      // write to file
    222229       not_displayed--;
    Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic ) 
    232239     
    233240      // update POC of display order
    234241      m_iPOCLastDisplay = pcPic->getPOC();
     242      pcPic->setDisplayMark(false);
    235243     
    236244      // erase non-referenced picture in the reference picture list after display
    237245      if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic ) 
    269277  {
    270278    TComPic* pcPic = *(iterPic);
    271279
    272     if ( pcPic->getReconMark() && pcPic->getPOC() > m_iPOCLastDisplay)
     280    if ( pcPic->getReconMark() && pcPic->getPOC() > m_iPOCLastDisplay && pcPic->getDisplayMark())
    273281    {
    274282      // write to file
    275283      if ( m_pchReconFile )
    Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic ) 
    279287     
    280288      // update POC of display order
    281289      m_iPOCLastDisplay = pcPic->getPOC();
     290      pcPic->setDisplayMark(false);
    282291     
    283292      // erase non-referenced picture in the reference picture list after display
    284293      if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
  • source/App/TAppEncoder/TAppEncCfg.cpp

    diff --git a/source/App/TAppEncoder/TAppEncCfg.cpp b/source/App/TAppEncoder/TAppEncCfg.cpp
    index a2547f7..b4a89c5 100644
    a b Void TAppEncCfg::destroy() 
    9494#if G1002_RPS
    9595std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry)     //input
    9696{
     97  memset(&entry, 0, sizeof(entry));
    9798  in>>entry.m_iSliceType;
    9899  in>>entry.m_iPOC;
    99100  in>>entry.m_iQPOffset;
  • source/Lib/TLibCommon/TComPic.h

    diff --git a/source/Lib/TLibCommon/TComPic.h b/source/Lib/TLibCommon/TComPic.h
    index 3c8034b..a3deffc 100644
    a b private: 
    6969  TComPicYuv*           m_pcPicYuvResi;           //  Residual
    7070  Bool                  m_bReconstructed;
    7171  UInt                  m_uiCurrSliceIdx;         // Index of current slice
     72  Bool                  m_bDisplayed;
    7273 
    7374  SEImessages* m_SEIs; ///< Any SEI messages that have been received.  If !NULL we own the object.
    7475
    public: 
    123124  Void          setReconMark (Bool b) { m_bReconstructed = b;     }
    124125  Bool          getReconMark ()       { return m_bReconstructed;  }
    125126 
     127  Void          setDisplayMark (Bool b) { m_bDisplayed = b;     }
     128  Bool          getDisplayMark ()       { return m_bDisplayed;  }
     129
    126130#if AMVP_BUFFERCOMPRESS
    127131  Void          compressMotion();
    128132#endif
  • source/Lib/TLibDecoder/TDecTop.cpp

    diff --git a/source/Lib/TLibDecoder/TDecTop.cpp b/source/Lib/TLibDecoder/TDecTop.cpp
    index 11f0439..379efec 100644
    a b Void TDecTop::xGetNewPicBuffer ( TComSlice* pcSlice, TComPic*& rpcPic ) 
    201201    // mark it should be extended
    202202    rpcPic->getPicYuvRec()->setBorderExtension(false);
    203203  }
     204  rpcPic->setDisplayMark(true);
    204205}
    205206
    206207Void TDecTop::executeDeblockAndAlf(UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, Int& iSkipFrame, Int& iPOCLastDisplay)
  • source/Lib/TLibEncoder/TEncCavlc.cpp

    diff --git a/source/Lib/TLibEncoder/TEncCavlc.cpp b/source/Lib/TLibEncoder/TEncCavlc.cpp
    index 2d98ee6..ace7499 100644
    a b Void TEncCavlc::codeSliceHeader ( TComSlice* pcSlice ) 
    491491    {
    492492      WRITE_UVLC( 0, "idr_pic_id" );
    493493      WRITE_FLAG( 0, "no_output_of_prior_pics_flag" );
     494      pcSlice->setPOC(0);
    494495    }
    495496    else
    496497    {
  • source/Lib/TLibEncoder/TEncGOP.cpp

    diff --git a/source/Lib/TLibEncoder/TEncGOP.cpp b/source/Lib/TLibEncoder/TEncGOP.cpp
    index e021d5e..f74c292 100644
    a b Void TEncGOP::init ( TEncTop* pcTEncTop ) 
    110110// ====================================================================================================================
    111111// Public member functions
    112112// ====================================================================================================================
    113 Void TEncGOP::compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP)
     113Void TEncGOP::compressGOP( Int& iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP)
    114114{
    115115  TComPic*        pcPic;
    116116  TComPicYuv*     pcPicYuvRecOut;
    Void TEncGOP::compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rc 
    243243        pcSlice->setSliceType(P_SLICE);
    244244      }
    245245#endif
     246    if (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDR)
     247        iPOCLast = 0;
     248
    246249      // Set the nal unit type
    247250      pcSlice->setNalUnitType(getNalUnitType(uiPOCCurr));
    248251      // Do decoding refresh marking if any
  • source/Lib/TLibEncoder/TEncGOP.h

    diff --git a/source/Lib/TLibEncoder/TEncGOP.h b/source/Lib/TLibEncoder/TEncGOP.h
    index d212b29..996deb8 100644
    a b public: 
    116116  virtual ~TEncGOP();
    117117 
    118118  Void  init        ( TEncTop* pcTEncTop );
    119   Void  compressGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP );
     119  Void  compressGOP ( Int& iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP );
    120120 
    121121#if !G1002_RPS
    122122  Int   getHrchDepth()        { return  m_iHrchDepth; }