Ticket #1124: poc_lsb_v2.patch

File poc_lsb_v2.patch, 4.3 KB (added by bheng, 11 years ago)
  • source/Lib/TLibCommon/TComSlice.cpp

     
    235235  Int pocCycle = 1 << getSPS()->getBitsForPOC();
    236236  if (!pocHasMsb)
    237237  {
    238     poc = poc % pocCycle;
     238    poc = poc & (pocCycle - 1);
    239239  }
    240240 
    241241  while ( iterPic != rcListPic.end() )
     
    246246      Int picPoc = pcPic->getPOC();
    247247      if (!pocHasMsb)
    248248      {
    249         picPoc = picPoc % pocCycle;
     249        picPoc = picPoc & (pocCycle - 1);
    250250      }
    251251     
    252252      if (poc == picPoc)
     
    837837      }
    838838      else
    839839      {
    840         if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i)%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()))
     840        Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
     841        Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1);
     842        Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1);
     843        if(rpcPic->getIsLongTerm() && curPoc == refPoc)
    841844        {
    842845          isReference = 1;
    843846          rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i));
     
    897900      }
    898901      else
    899902      {
    900         if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i)%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced())
     903        Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
     904        Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1);
     905        Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1);
     906        if(rpcPic->getIsLongTerm() && curPoc == refPoc && rpcPic->getSlice(0)->isReferenced())
    901907        {
    902908          isAvailable = 1;
    903909        }
     
    916922        Int refPoc = pReferencePictureSet->getPOC(i);
    917923        if (!pReferencePictureSet->getCheckLTMSBPresent(i))
    918924        {
    919           curPoc = curPoc % pocCycle;
    920           refPoc = refPoc % pocCycle;
     925          curPoc = curPoc & (pocCycle - 1);
     926          refPoc = refPoc & (pocCycle - 1);
    921927        }
    922928       
    923929        if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc)
  • source/Lib/TLibDecoder/TDecCAVLC.cpp

     
    834834      Int iPOClsb = uiCode;
    835835      Int iPrevPOC = rpcSlice->getPrevPOC();
    836836      Int iMaxPOClsb = 1<< sps->getBitsForPOC();
    837       Int iPrevPOClsb = iPrevPOC%iMaxPOClsb;
     837      Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1);
    838838      Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb;
    839839      Int iPOCmsb;
    840840      if( ( iPOClsb  <  iPrevPOClsb ) && ( ( iPrevPOClsb - iPOClsb )  >=  ( iMaxPOClsb / 2 ) ) )
  • source/Lib/TLibEncoder/TEncCavlc.cpp

     
    646646
    647647    if( !pcSlice->getIdrPicFlag() )
    648648    {
    649       Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC()))%(1<<pcSlice->getSPS()->getBitsForPOC());
     649      Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1);
    650650      WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb");
    651651      TComReferencePictureSet* rps = pcSlice->getRPS();
    652652     
     
    13621362Bool TEncCavlc::findMatchingLTRP ( TComSlice* pcSlice, UInt *ltrpsIndex, Int ltrpPOC, Bool usedFlag )
    13631363{
    13641364  // Bool state = true, state2 = false;
    1365   Int lsb = ltrpPOC % (1<<pcSlice->getSPS()->getBitsForPOC());
     1365  Int lsb = ltrpPOC & ((1<<pcSlice->getSPS()->getBitsForPOC())-1);
    13661366  for (Int k = 0; k < pcSlice->getSPS()->getNumLongTermRefPicSPS(); k++)
    13671367  {
    13681368    if ( (lsb == pcSlice->getSPS()->getLtRefPicPocLsbSps(k)) && (usedFlag == pcSlice->getSPS()->getUsedByCurrPicLtSPSFlag(k)) )