Ticket #746: cleanup.patch

File cleanup.patch, 12.4 KB (added by dthoang, 11 years ago)

diff patch file for suggested fix

  • source/Lib/TLibCommon/TComDataCU.cpp

    diff -rupN HM-8.0-dev/source/Lib/TLibCommon/TComDataCU.cpp HM-8.0-cleanup/source/Lib/TLibCommon/TComDataCU.cpp
    old new Void TComDataCU::getPartPosition( UInt p 
    31873187  }
    31883188}
    31893189
    3190 AMVP_MODE TComDataCU::getAMVPMode(UInt uiIdx)
    3191 {
    3192   return m_pcSlice->getSPS()->getAMVPMode(m_puhDepth[uiIdx]);
    3193 }
    3194 
    31953190/** Constructs a list of candidates for AMVP
    31963191 * \param uiPartIdx
    31973192 * \param uiPartAddr
    Void TComDataCU::fillMvpCand ( UInt uiPa 
    32753270    }
    32763271  }
    32773272 
    3278   if (getAMVPMode(uiPartAddr) == AM_NONE)  //Should be optimized later for special cases
    3279   {
    3280     assert(pInfo->iN > 0);
    3281     pInfo->iN = 1;
    3282     return;
    3283   }
    3284 
    32853273  if ( pInfo->iN == 2 )
    32863274  {
    32873275    if ( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] )
  • source/Lib/TLibCommon/TComDataCU.h

    diff -rupN HM-8.0-dev/source/Lib/TLibCommon/TComDataCU.h HM-8.0-cleanup/source/Lib/TLibCommon/TComDataCU.h
    old new public: 
    437437 
    438438  Void          getMvField            ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField );
    439439 
    440   AMVP_MODE     getAMVPMode           ( UInt uiIdx );
    441440  Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );
    442441  Bool          isDiffMER             ( Int xN, Int yN, Int xP, Int yP);
    443442  Void          getPartPosition       ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH);
  • source/Lib/TLibCommon/TComPrediction.cpp

    diff -rupN HM-8.0-dev/source/Lib/TLibCommon/TComPrediction.cpp HM-8.0-cleanup/source/Lib/TLibCommon/TComPrediction.cpp
    old new Void TComPrediction::getMvPredAMVP( TCom 
    661661{
    662662  AMVPInfo* pcAMVPInfo = pcCU->getCUMvField(eRefPicList)->getAMVPInfo();
    663663
    664   if( pcCU->getAMVPMode(uiPartAddr) == AM_NONE || (pcAMVPInfo->iN <= 1 && pcCU->getAMVPMode(uiPartAddr) == AM_EXPL) )
     664  if( pcAMVPInfo->iN <= 1 )
    665665  {
    666666    rcMvPred = pcAMVPInfo->m_acMvCand[0];
    667667
  • source/Lib/TLibCommon/TComSlice.cpp

    diff -rupN HM-8.0-dev/source/Lib/TLibCommon/TComSlice.cpp HM-8.0-cleanup/source/Lib/TLibCommon/TComSlice.cpp
    old new TComSPS::TComSPS() 
    13581358, m_scalingListEnabledFlag    (false)
    13591359{
    13601360  // AMVP parameter
    1361   ::memset( m_aeAMVPMode, 0, sizeof( m_aeAMVPMode ) );
    13621361  for ( Int i = 0; i < MAX_TLAYER; i++ )
    13631362  {
    13641363    m_uiMaxLatencyIncrease[i] = 0;
  • source/Lib/TLibCommon/TComSlice.h

    diff -rupN HM-8.0-dev/source/Lib/TLibCommon/TComSlice.h HM-8.0-cleanup/source/Lib/TLibCommon/TComSlice.h
    old new private: 
    341341  Bool        m_listsModificationPresentFlag;
    342342
    343343  // Parameter
    344   AMVP_MODE   m_aeAMVPMode[MAX_CU_DEPTH];
    345344  UInt        m_uiBitDepth;
    346345  UInt        m_uiBitIncrement;
    347346  Int         m_qpBDOffsetY;
    public: 
    506505  Bool getListsModificationPresentFlag ()          { return m_listsModificationPresentFlag; }
    507506  Void setListsModificationPresentFlag ( Bool b )  { m_listsModificationPresentFlag = b;    }
    508507
    509   // AMVP mode (for each depth)
    510   AMVP_MODE getAMVPMode ( UInt uiDepth ) { assert(uiDepth < g_uiMaxCUDepth);  return m_aeAMVPMode[uiDepth]; }
    511   Void      setAMVPMode ( UInt uiDepth, AMVP_MODE eMode) { assert(uiDepth < g_uiMaxCUDepth);  m_aeAMVPMode[uiDepth] = eMode; }
    512  
    513508  // AMP accuracy
    514509  Int       getAMPAcc   ( UInt uiDepth ) { return m_iAMPAcc[uiDepth]; }
    515510  Void      setAMPAcc   ( UInt uiDepth, Int iAccu ) { assert( uiDepth < g_uiMaxCUDepth);  m_iAMPAcc[uiDepth] = iAccu; }
  • source/Lib/TLibDecoder/TDecCAVLC.cpp

    diff -rupN HM-8.0-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp HM-8.0-cleanup/source/Lib/TLibDecoder/TDecCAVLC.cpp
    old new Void TDecCavlc::parseSPS(TComSPS* pcSPS) 
    782782  }
    783783#endif
    784784  READ_FLAG( uiCode, "sps_temporal_mvp_enable_flag" );            pcSPS->setTMVPFlagsPresent(uiCode);
    785   // AMVP mode for each depth (AM_NONE or AM_EXPL)
    786   for (Int i = 0; i < pcSPS->getMaxCUDepth(); i++)
    787   {
    788     xReadFlag( uiCode );
    789     pcSPS->setAMVPMode( i, (AMVP_MODE)uiCode );
    790   }
    791 
    792785  READ_FLAG( uiCode, "sps_extension_flag");
    793786  if (uiCode)
    794787  {
  • source/Lib/TLibDecoder/TDecEntropy.cpp

    diff -rupN HM-8.0-dev/source/Lib/TLibDecoder/TDecEntropy.cpp HM-8.0-cleanup/source/Lib/TLibDecoder/TDecEntropy.cpp
    old new Void TDecEntropy::decodeMVPIdxPU( TComDa 
    302302  iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr);
    303303  cMv = cZeroMv;
    304304
    305   if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) && (pcSubCU->getAMVPMode(uiPartAddr) == AM_EXPL) )
     305  if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) )
    306306  {
    307307    m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx );
    308308  }
  • source/Lib/TLibEncoder/TEncCavlc.cpp

    diff -rupN HM-8.0-dev/source/Lib/TLibEncoder/TEncCavlc.cpp HM-8.0-cleanup/source/Lib/TLibEncoder/TEncCavlc.cpp
    old new Void TEncCavlc::codeSPS( TComSPS* pcSPS 
    537537  }
    538538#endif
    539539  WRITE_FLAG( pcSPS->getTMVPFlagsPresent()  ? 1 : 0,           "sps_temporal_mvp_enable_flag" );
    540   // AMVP mode for each depth
    541   for (Int i = 0; i < pcSPS->getMaxCUDepth(); i++)
    542   {
    543     xWriteFlag( pcSPS->getAMVPMode(i) ? 1 : 0);
    544   }
    545 
    546540  WRITE_FLAG( 0, "sps_extension_flag" );
    547541}
    548542
  • source/Lib/TLibEncoder/TEncEntropy.cpp

    diff -rupN HM-8.0-dev/source/Lib/TLibEncoder/TEncEntropy.cpp HM-8.0-cleanup/source/Lib/TLibEncoder/TEncEntropy.cpp
    old new Void TEncEntropy::encodeMvdPU( TComDataC 
    663663
    664664Void TEncEntropy::encodeMVPIdxPU( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList )
    665665{
    666   if ( (pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList )) && (pcCU->getAMVPMode(uiAbsPartIdx) == AM_EXPL) )
     666  if ( (pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList )) )
    667667  {
    668668    m_pcEntropyCoderIf->codeMVPIdx( pcCU, uiAbsPartIdx, eRefList );
    669669  }
  • source/Lib/TLibEncoder/TEncSearch.cpp

    diff -rupN HM-8.0-dev/source/Lib/TLibEncoder/TEncSearch.cpp HM-8.0-cleanup/source/Lib/TLibEncoder/TEncSearch.cpp
    old new Void TEncSearch::predInterSearch( TComDa 
    33803380        xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
    33813381#endif
    33823382        xCopyAMVPInfo(pcCU->getCUMvField(eRefPicList)->getAMVPInfo(), &aacAMVPInfo[iRefList][iRefIdxTemp]); // must always be done ( also when AMVP_MODE = AM_NONE )
    3383         if ( pcCU->getAMVPMode(uiPartAddr) == AM_EXPL )
    3384         {         
    33853383          xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp);
    3386         }
    33873384
    33883385        if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag())
    33893386        {
    Void TEncSearch::predInterSearch( TComDa 
    35253522          uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS];
    35263523          // call ME
    35273524          xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, true );
    3528           if ( pcCU->getAMVPMode(uiPartAddr) == AM_EXPL )
    3529           {
    3530             xCopyAMVPInfo(&aacAMVPInfo[iRefList][iRefIdxTemp], pcCU->getCUMvField(eRefPicList)->getAMVPInfo());
    3531             xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp);
    3532           }
     3525          xCopyAMVPInfo(&aacAMVPInfo[iRefList][iRefIdxTemp], pcCU->getCUMvField(eRefPicList)->getAMVPInfo());
     3526          xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp);
    35333527         
    35343528          if ( uiCostTemp < uiCostBi )
    35353529          {
    Void TEncSearch::predInterSearch( TComDa 
    35563550       
    35573551        if ( !bChanged )
    35583552        {
    3559           if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] && pcCU->getAMVPMode(uiPartAddr) == AM_EXPL )
     3553          if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] )
    35603554          {
    35613555            xCopyAMVPInfo(&aacAMVPInfo[0][iRefIdxBi[0]], pcCU->getCUMvField(REF_PIC_LIST_0)->getAMVPInfo());
    35623556            xCheckBestMVP(pcCU, REF_PIC_LIST_0, cMvBi[0], cMvPredBi[0][iRefIdxBi[0]], aaiMvpIdxBi[0][iRefIdxBi[0]], uiBits[2], uiCostBi);
    Void TEncSearch::xEstimateMvPredAMVP( TC 
    38623856  iBestIdx = 0;
    38633857  cBestMv  = pcAMVPInfo->m_acMvCand[0];
    38643858#if !ZERO_MVD_EST
    3865   if( pcCU->getAMVPMode(uiPartAddr) == AM_NONE || (pcAMVPInfo->iN <= 1 && pcCU->getAMVPMode(uiPartAddr) == AM_EXPL) )
     3859  if (pcAMVPInfo->iN <= 1)
    38663860  {
    38673861    rcMvPred = cBestMv;
    38683862   
    Void TEncSearch::xEstimateMvPredAMVP( TC 
    38803874    return;
    38813875  }
    38823876#endif 
    3883   if (pcCU->getAMVPMode(uiPartAddr) == AM_EXPL && bFilled)
     3877  if (bFilled)
    38843878  {
    38853879    assert(pcCU->getMVPIdx(eRefPicList,uiPartAddr) >= 0);
    38863880    rcMvPred = pcAMVPInfo->m_acMvCand[pcCU->getMVPIdx(eRefPicList,uiPartAddr)];
    38873881    return;
    38883882  }
    38893883 
    3890   if (pcCU->getAMVPMode(uiPartAddr) == AM_EXPL)
    3891   {
    3892     m_cYuvPredTemp.clear();
     3884  m_cYuvPredTemp.clear();
    38933885#if ZERO_MVD_EST
    3894     UInt uiDist;
     3886  UInt uiDist;
    38953887#endif
    3896     //-- Check Minimum Cost.
    3897     for ( i = 0 ; i < pcAMVPInfo->iN; i++)
    3898     {
    3899       UInt uiTmpCost;
     3888  //-- Check Minimum Cost.
     3889  for ( i = 0 ; i < pcAMVPInfo->iN; i++)
     3890  {
     3891          UInt uiTmpCost;
    39003892#if ZERO_MVD_EST
    3901       uiTmpCost = xGetTemplateCost( pcCU, uiPartIdx, uiPartAddr, pcOrgYuv, &m_cYuvPredTemp, pcAMVPInfo->m_acMvCand[i], i, AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdx, iRoiWidth, iRoiHeight, uiDist );
     3893          uiTmpCost = xGetTemplateCost( pcCU, uiPartIdx, uiPartAddr, pcOrgYuv, &m_cYuvPredTemp, pcAMVPInfo->m_acMvCand[i], i, AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdx, iRoiWidth, iRoiHeight, uiDist );
    39023894#else
    3903       uiTmpCost = xGetTemplateCost( pcCU, uiPartIdx, uiPartAddr, pcOrgYuv, &m_cYuvPredTemp, pcAMVPInfo->m_acMvCand[i], i, AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdx, iRoiWidth, iRoiHeight);
     3895          uiTmpCost = xGetTemplateCost( pcCU, uiPartIdx, uiPartAddr, pcOrgYuv, &m_cYuvPredTemp, pcAMVPInfo->m_acMvCand[i], i, AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdx, iRoiWidth, iRoiHeight);
    39043896#endif     
    3905       if ( uiBestCost > uiTmpCost )
    3906       {
    3907         uiBestCost = uiTmpCost;
    3908         cBestMv   = pcAMVPInfo->m_acMvCand[i];
    3909         iBestIdx  = i;
    3910         (*puiDistBiP) = uiTmpCost;
    3911         #if ZERO_MVD_EST
    3912         (*puiDist) = uiDist;
    3913         #endif
    3914       }
    3915     }
    3916    
    3917     m_cYuvPredTemp.clear();
     3897          if ( uiBestCost > uiTmpCost )
     3898          {
     3899                  uiBestCost = uiTmpCost;
     3900                  cBestMv   = pcAMVPInfo->m_acMvCand[i];
     3901                  iBestIdx  = i;
     3902                  (*puiDistBiP) = uiTmpCost;
     3903#if ZERO_MVD_EST
     3904                  (*puiDist) = uiDist;
     3905#endif
     3906          }
    39183907  }
     3908  m_cYuvPredTemp.clear();
    39193909 
    39203910  // Setting Best MVP
    39213911  rcMvPred = cBestMv;
  • source/Lib/TLibEncoder/TEncTop.cpp

    diff -rupN HM-8.0-dev/source/Lib/TLibEncoder/TEncTop.cpp HM-8.0-cleanup/source/Lib/TLibEncoder/TEncTop.cpp
    old new Void TEncTop::xInitSPS() 
    514514#endif
    515515 
    516516  Int i;
    517 #if HHI_AMVP_OFF
    518   for ( i = 0; i < g_uiMaxCUDepth; i++ )
    519   {
    520     m_cSPS.setAMVPMode( i, AM_NONE );
    521   }
    522 #else
    523   for ( i = 0; i < g_uiMaxCUDepth; i++ )
    524   {
    525     m_cSPS.setAMVPMode( i, AM_EXPL );
    526   }
    527 #endif
    528517 
    529518  for (i = 0; i < g_uiMaxCUDepth-g_uiAddCUDepth; i++ )
    530519  {