Ticket #128: ticket-128bugfix.patch

File ticket-128bugfix.patch, 2.5 KB (added by nsprljan, 14 years ago)
  • source/Lib/TLibEncoder/TEncSearch.cpp

    diff --git a/source/Lib/TLibEncoder/TEncSearch.cpp b/source/Lib/TLibEncoder/TEncSearch.cpp
    index da704f0..c94122e 100644
    a b Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& 
    23592359#if DCM_COMB_LIST
    23602360    UInt          uiCostTempL0[MAX_NUM_REF];
    23612361    for (Int iNumRef=0; iNumRef < MAX_NUM_REF; iNumRef++) uiCostTempL0[iNumRef] = MAX_UINT;
     2362    UInt          uiBitsTempL0[MAX_NUM_REF];
    23622363#endif   
    23632364
    23642365    xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits);
    Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& 
    24322433#endif
    24332434            {
    24342435#if DCM_COMB_LIST
    2435               if (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag())
    2436               {
    2437                 uiCostTemp = uiCostTempL0[pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)];
    2438               }
    2439               else
    2440               {
    2441                 uiCostTemp = MAX_UINT;
    2442               }
    24432436#else
    24442437              uiCostTemp = MAX_UINT;
    24452438#endif
    Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& 
    24572450                cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)];
    24582451              }
    24592452#endif
     2453              uiCostTemp = uiCostTempL0[pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)];
     2454              /*first subtract the bit-rate part of the cost of the other list*/
     2455              uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)] );
     2456              /*correct the bit-rate part of the current ref*/
     2457              m_pcRdCost->setPredictor  ( cMvPred[iRefList][iRefIdxTemp] );
     2458              uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() );
     2459              /*calculate the correct cost*/
     2460              uiCostTemp += m_pcRdCost->getCost( uiBitsTemp );
    24602461            }
    24612462            else
    24622463            {
    Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& 
    24902491          if(iRefList==REF_PIC_LIST_0)
    24912492          {
    24922493            uiCostTempL0[iRefIdxTemp] = uiCostTemp;
     2494            uiBitsTempL0[iRefIdxTemp] = uiBitsTemp;
    24932495            if(pcCU->getSlice()->getRefIdxOfLC(REF_PIC_LIST_0, iRefIdxTemp)<0)
    24942496            {
    24952497              uiCostTemp = MAX_UINT;