Ticket #599: MSBCYCLE_BUGFIX_r2479.patch

File MSBCYCLE_BUGFIX_r2479.patch, 4.2 KB (added by adarsh, 10 years ago)

Patch for MSB cycle check

  • TComSlice.cpp

     
    271271  return  pcPic;
    272272}
    273273
    274 
     274#if MSBCYCLE_BUGFIX
    275275TComPic* TComSlice::xGetLongTermRefPic (TComList<TComPic*>& rcListPic,
     276                                UInt                uiPOC, Bool msbPresent)
     277#else
     278TComPic* TComSlice::xGetLongTermRefPic (TComList<TComPic*>& rcListPic,
    276279                                UInt                uiPOC)
     280#endif
    277281{
    278282  TComList<TComPic*>::iterator  iterPic = rcListPic.begin(); 
    279283  TComPic*                      pcPic = *(iterPic);
     
    281285  while ( iterPic != rcListPic.end() )
    282286  {
    283287    pcPic = *(iterPic);
     288#if MSBCYCLE_BUGFIX
     289    if(pcPic &&
     290        ( ((pcPic->getPOC()%(1<<getSPS()->getBitsForPOC())) == (uiPOC%(1<<getSPS()->getBitsForPOC())) && !msbPresent ) ||
     291          ((pcPic->getPOC() == uiPOC)                                                                 &&  msbPresent )
     292        )
     293      )
     294#else
    284295    if(pcPic && (pcPic->getPOC()%(1<<getSPS()->getBitsForPOC())) == (uiPOC%(1<<getSPS()->getBitsForPOC())))
     296#endif
    285297    {
    286298      if(pcPic->getIsLongTerm())
    287299        return pcPic;
     
    426438  {
    427439    if(m_pcRPS->getUsed(i))
    428440    {
     441#if MSBCYCLE_BUGFIX
     442      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
     443#else
    429444      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
     445#endif
    430446      pcRefPic->setIsLongTerm(1);
    431447#if NO_MV_SCALING_IF_LONG_TERM_REF
    432448      pcRefPic->setIsUsedAsLongTerm(1);
     
    437453    }
    438454    if(pcRefPic==NULL)
    439455    {
     456#if MSBCYCLE_BUGFIX
     457      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
     458#else
    440459      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
     460#endif
    441461    }
    442462    pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); 
    443463  }
     
    9801000      {
    9811001        j++;
    9821002        rpcPic = *(iterPic++);
    983 
     1003#if MSBCYCLE_BUGFIX
     1004        Int maxPicOrderCntLsb = (1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC());
     1005        Int currPOC = rpcPic->getPicSym()->getSlice(0)->getPOC();
     1006        Int currLSB = currPOC % maxPicOrderCntLsb;
     1007        Int refPOC  = pReferencePictureSet->getPOC(i);
     1008        Int refLSB  = refPOC % maxPicOrderCntLsb;
     1009        if(rpcPic->getSlice(0)->isReferenced() &&
     1010          (
     1011            ( (currLSB == refLSB) && !pReferencePictureSet->getCheckLTMSBPresent(i)) ||
     1012            ( (currPOC == refPOC) &&  pReferencePictureSet->getCheckLTMSBPresent(i))
     1013          )
     1014        )
     1015         
     1016#else
    9841017        if((rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == (this->getPOC() + pReferencePictureSet->getDeltaPOC(i))%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced())
     1018#endif
    9851019        {
    9861020          isAvailable = 1;
    9871021          rpcPic->setIsLongTerm(1);
  • TComSlice.h

     
    14251425protected:
    14261426  TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
    14271427                         UInt                uiPOC);
     1428#if MSBCYCLE_BUGFIX
     1429    TComPic*  xGetLongTermRefPic  (TComList<TComPic*>& rcListPic,
     1430                         UInt                uiPOC, Bool msbPresent);
     1431#else
    14281432  TComPic*  xGetLongTermRefPic  (TComList<TComPic*>& rcListPic,
    14291433                         UInt                uiPOC);
     1434#endif
    14301435};// END CLASS DEFINITION TComSlice
    14311436
    14321437
  • TypeDef.h

     
    4040
    4141//! \ingroup TLibCommon
    4242//! \{
     43#define MSBCYCLE_BUGFIX  1 ////< Bug fix: MSB presence check while accessing LTRPs.
    4344#define  TEMPORAL_ID_RESTRICTION         1  ///< I0600: Semantics of temporal_id changed
    4445#define PREVREFPIC_DEFN                    1   ///< I0345: prevRefPic defined as previous reference picture that is at same or lower
    4546                                            ///< temporal layer.