Ticket #89: ticket89.patch

File ticket89.patch, 14.7 KB (added by Tomohiro Ikai, 9 years ago)
  • Lib/TLibCommon/TComPrediction.cpp

     
    11941194  } else
    11951195#endif
    11961196#if H_3D_ARP
     1197#if FIX_TICKET_89_CLEAN
     1198  if (pcCU->getARPW( uiPartAddr ) > 0)
     1199  {
     1200    if (pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC() == pcCU->getSlice()->getPOC())
     1201    {
     1202      xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , bi );
     1203    }
     1204    else
     1205    {
     1206      xPredInterUniARP( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, rpcYuvPred, bi );
     1207    }
     1208  }
     1209  else
     1210  {
     1211#else
    11971212  if(pcCU->getARPW( uiPartAddr ) > 0  && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC())
    11981213  {
    11991214    xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , bi );
     
    12101225    else
    12111226    {
    12121227#endif
     1228#endif // FIX_TICKET_89_CLEAN
    12131229#if H_3D_IC
    12141230      Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() != pcCU->getSlice()->getViewIndex() );
    12151231      xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
     
    12281244      xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi );
    12291245#endif
    12301246#if H_3D_ARP
     1247#if !FIX_TICKET_89_CLEAN
    12311248    }
     1249#endif
    12321250  }
    12331251#endif
    12341252}
     
    12801298#endif
    12811299
    12821300#if H_3D_ARP
     1301#if FIX_TICKET_89_CLEAN
     1302Void TComPrediction::xPredInterUniARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi)
     1303#else
    12831304Void TComPrediction::xPredInterUniARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled )
     1305#endif
    12841306{
     1307#if FIX_TICKET_89_CLEAN
     1308  Int         iRefIdx      = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );
     1309  TComMv      cMv          = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
     1310#else
    12851311  Int         iRefIdx      = pNewMvFiled ? pNewMvFiled->getRefIdx() : pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           
    12861312  TComMv      cMv          = pNewMvFiled ? pNewMvFiled->getMv()     : pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
     1313#endif
    12871314  Bool        bTobeScaled  = false;
    12881315  TComPic* pcPicYuvBaseCol = NULL;
    12891316  TComPic* pcPicYuvBaseRef = NULL;
     
    13291356    {     
    13301357      Int iCurrPOC    = pcCU->getSlice()->getPOC();
    13311358      Int iColRefPOC  = pcCU->getSlice()->getRefPOC( eRefPicList, iRefIdx );
     1359#if FIX_TICKET_89_REFIDX
     1360      Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, arpRefIdx);
     1361#else
    13321362      Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList,  0);
     1363#endif
    13331364      Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iCurrPOC, iColRefPOC);
    13341365      if ( iScale != 4096 )
    13351366      {
    13361367        cMv = cMv.scaleMv( iScale );
    13371368      }
     1369#if FIX_TICKET_89_REFIDX
     1370      iRefIdx = arpRefIdx;
     1371#else
    13381372      iRefIdx = 0;
     1373#endif
    13391374    }
    13401375  }
    13411376
     
    13821417  }
    13831418}
    13841419
     1420#if FIX_TICKET_89_CLEAN2
     1421Bool TComPrediction::xGetMotionVectorAndRefPicListARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc, RefPicList &eRefPicListCurr )
     1422#elif FIX_TICKET_89_REFCHECK
     1423Bool TComPrediction::xCheckBiInterviewARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc, RefPicList &eRefPicListCurr )
     1424#else
    13851425Bool TComPrediction::xCheckBiInterviewARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc )
     1426#endif
    13861427{
    13871428  Int         iRefIdx       = pcCU->getCUMvField( eBaseRefPicList )->getRefIdx( uiPartAddr );
    13881429  TComMv      cDMv          = pcCU->getCUMvField( eBaseRefPicList )->getMv( uiPartAddr );
     
    14051446  {
    14061447    for(Int iList = 0; iList < (pColCU->getSlice()->isInterB() ? 2: 1); iList ++)
    14071448    {
     1449#if FIX_TICKET_89_CLEAN2 || FIX_TICKET_89_REFCHECK
     1450      eRefPicListCurr = RefPicList(iList);
     1451#else
    14081452      RefPicList eRefPicListCurr = RefPicList(iList);
     1453#endif
    14091454      Int iRef = pColCU->getCUMvField(eRefPicListCurr)->getRefIdx(uiAbsPartAddr);
    14101455      if( iRef != -1)
    14111456      {
     
    14361481  }
    14371482
    14381483  //If there is no available motion in base reference list, use ( 0, 0 )
     1484  //When availFlag is equal to 0 and RpRefIdxLW is not equal to -1, availFlag is set equal to 1, mvT is set equal to ( 0, 0 ), Z is set equal to W
    14391485  if( pcCU->getSlice()->getFirstTRefIdx( eBaseRefPicList ) >= 0 )
    14401486  {
    14411487    cBaseTMV.set( 0, 0 );
    14421488    pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic( eBaseRefPicList,  pcCU->getSlice()->getFirstTRefIdx( eBaseRefPicList ) );
    14431489    iCurrTRefPoc = pcPicYuvCurrTRef->getPOC();
     1490#if FIX_TICKET_89_CLEAN2 || FIX_TICKET_89_REFCHECK
     1491    eRefPicListCurr = eBaseRefPicList;
     1492#endif
    14441493    return true;
    14451494  }
    14461495
     
    14471496  return false;
    14481497}
    14491498
     1499#if FIX_TICKET_89_CLEAN
     1500Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi)
     1501#else
    14501502Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled )
     1503#endif
    14511504{
    14521505  Int         iRefIdx       = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           
    14531506  TComMv      cDMv          = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
     
    14601513  TComPicYuv* pcYuvBaseCol  = pcPicYuvBaseCol->getPicYuvRec();   
    14611514  Bool bTMVAvai = false;     
    14621515  TComMv cBaseTMV;
     1516#if FIX_TICKET_89_CLEAN || FIX_TICKET_89_REFCHECK
     1517  RefPicList eRefPicListCurr; // Z
     1518#endif
     1519#if !FIX_TICKET_89_CLEAN
    14631520  if( pNewMvFiled )
    14641521  {
    14651522    iRefIdx = pNewMvFiled->getRefIdx();
    14661523    cDMv = pNewMvFiled->getMv();
    14671524  }
     1525#endif
    14681526  pcCU->clipMv(cTempDMv);
    14691527
    14701528  assert(dW > 0);
     1529#if !FIX_TICKET_89_REFCHECK
    14711530  if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, pcPicYuvBaseCol->getViewIndex()))
    14721531  {
    14731532    dW = 0;
    14741533  }
     1534#endif
    14751535  Int uiLCUAddr,uiAbsPartAddr;
    14761536  Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2  + ((cDMv.getHor() + 2)>>2);
    14771537  Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2);
     
    14791539  irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX);
    14801540  irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY); 
    14811541  pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr);
     1542#if !FIX_TICKET_89_CLEAN2
    14821543  TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr );
     1544#endif
     1545#if !FIX_TICKET_89_CLEAN2
     1546  {
     1547#elif FIX_TICKET_89_CLEAN
     1548  if( pcCU->getSlice()->isInterB() )
     1549#else
    14831550  if( pcCU->getSlice()->isInterB() && !pcCU->getSlice()->getIsDepth() )
     1551#endif
    14841552  {
    14851553    RefPicList eOtherRefList = ( eRefPicList == REF_PIC_LIST_0 ) ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
    14861554    Int iOtherRefIdx = pcCU->getCUMvField( eOtherRefList )->getRefIdx( uiPartAddr );
    14871555    //The other prediction direction is temporal ARP
     1556#if FIX_TICKET_89_CLEAN || FIX_TICKET_89_REFCHECK
     1557    Bool predFlagLY  = iOtherRefIdx >= 0;
     1558    Bool ivRefFlagLY = predFlagLY && pcCU->getSlice()->getPOC() == pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx )->getPOC();
     1559    if( predFlagLY && ivRefFlagLY == 0)
     1560    {
     1561      eRefPicListCurr = eOtherRefList;
     1562#elif FIX_TICKET_89_CLEAN
     1563    // If predFlagLY is equal to 1 and ivRefFlagLY is equal to 0
     1564    if( iOtherRefIdx >= 0 && pcCU->getSlice()->getPOC() != pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx )->getPOC() )
     1565    {
     1566#else
    14881567    if( iOtherRefIdx >= 0 && pcCU->getSlice()->getViewIndex() == pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx )->getViewIndex() )
    14891568    {
     1569#endif
     1570#if !FIX_TICKET_89_REFCHECK
     1571      // move the following condition to a later stage to confirm the condition of "RpRefIdxLY is not equal to -1".
    14901572      bTMVAvai = true;
     1573#endif
    14911574      pcPicYuvBaseTRef = pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx );
    14921575      Int  iCurrPOC    = pcCU->getSlice()->getPOC();
    14931576      Int  iCurrRefPOC = pcPicYuvBaseTRef->getPOC();
    14941577      Int  iCurrRef    = pcCU->getSlice()->getFirstTRefIdx( eOtherRefList );
    14951578     
     1579      // When RpRefIdxLY is not equal to -1, the following applies:
    14961580      if( iCurrRef >= 0 )
    14971581      {
     1582#if FIX_TICKET_89_REFCHECK
     1583        bTMVAvai = true;
     1584#endif
    14981585        pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic( eOtherRefList,iCurrRef ); 
    14991586        Int iTargetPOC = pcPicYuvCurrTRef->getPOC();
    15001587        pcPicYuvBaseTRef =  pcCU->getSlice()->getBaseViewRefPic( iTargetPOC,  pcPicYuvBaseCol->getViewIndex() );
     
    15071594            cBaseTMV = cBaseTMV.scaleMv( iScale );
    15081595          }
    15091596        }
     1597#if FIX_TICKET_89_REFCHECK
     1598      }
     1599#else
     1600        // we can remove the following checks. The later check of "bTMVAvai && getArpRefPicAvailable" can take care of that.
    15101601        else
    15111602        {
    15121603          dW = 0;
     
    15161607      {
    15171608        dW = 0;
    15181609      }
     1610#endif
    15191611    }
     1612#if FIX_TICKET_89_CLEAN2
     1613    else // Otherwise (predFlagLY is equal to 0 or ivRefFlagLY is equal to 1)
     1614    {
     1615      RefPicList eRefPicListW = ( predFlagLY && ivRefFlagLY ) ? REF_PIC_LIST_0 : eRefPicList;
     1616      Int iCurrTRefPoc;
    15201617
     1618      bTMVAvai = xGetMotionVectorAndRefPicListARP( pcCU, uiPartAddr, iWidth, iHeight, eRefPicListW, pcPicYuvCurrTRef, cBaseTMV, iCurrTRefPoc, eRefPicListCurr );
     1619      pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic( iCurrTRefPoc,  pcPicYuvBaseCol->getViewIndex() );
     1620    }
     1621  }
     1622#else
    15211623    //Both prediction directions are inter-view ARP
    15221624    if ( iOtherRefIdx >= 0 && !bTMVAvai )
    15231625    {
    15241626      RefPicList eBaseList = REF_PIC_LIST_0;
    15251627      Int iCurrTRefPoc;
     1628
    15261629      bTMVAvai = ( eBaseList != eRefPicList ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx )->getViewIndex() );
    15271630
     1631#if FIX_TICKET_89_REFCHECK
    15281632      if ( bTMVAvai )
    15291633      {
     1634        bTMVAvai = xCheckBiInterviewARP( pcCU, uiPartAddr, iWidth, iHeight, eBaseList, pcPicYuvCurrTRef, cBaseTMV, iCurrTRefPoc, eRefPicListCurr );
     1635        pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic( iCurrTRefPoc,  pcPicYuvBaseCol->getViewIndex() );
     1636      }
     1637#else
     1638      if ( bTMVAvai )
     1639      {
    15301640        if( xCheckBiInterviewARP( pcCU, uiPartAddr, iWidth, iHeight, eBaseList, pcPicYuvCurrTRef, cBaseTMV, iCurrTRefPoc ) )
    15311641        {
    15321642          pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic( iCurrTRefPoc,  pcPicYuvBaseCol->getViewIndex() );
     
    15401650          dW = 0;
    15411651        }
    15421652      }
     1653#endif
    15431654    }
    15441655  }
    15451656
     
    15761687      }
    15771688    }
    15781689  }
     1690
    15791691  if (bTMVAvai == false)
    15801692  {
    15811693    bTMVAvai = true;
     
    15831695    pcPicYuvBaseTRef =  pColCU->getSlice()->getRefPic(eRefPicList,  pcCU->getSlice()->getFirstTRefIdx(eRefPicList)); 
    15841696    pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic  (eRefPicList,  pcCU->getSlice()->getFirstTRefIdx(eRefPicList));     
    15851697  }
     1698#endif // FIX_TICKET_89_CLEAN2
    15861699
    15871700  xPredInterLumaBlk  ( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ),        bTMVAvai);
    15881701  xPredInterChromaBlk( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ),        bTMVAvai);
    15891702
     1703#if FIX_TICKET_89_REFCHECK
     1704  if (bTMVAvai && pcCU->getSlice()->getArpRefPicAvailable( eRefPicListCurr, pcPicYuvBaseCol->getViewIndex()))
     1705#else
    15901706  if( dW > 0 && bTMVAvai )
     1707#endif
    15911708  {
    15921709    TComYuv*    pYuvCurrTRef    = &m_acYuvPredBase[0];
    15931710    TComYuv*    pYuvBaseTRef    = &m_acYuvPredBase[1];
  • Lib/TLibCommon/TComPrediction.h

     
    8888 
    8989  // motion compensation functions
    9090#if H_3D_ARP
     91#if FIX_TICKET_89_CLEAN
     92  Void xPredInterUniARP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false);
     93#else
    9194  Void xPredInterUniARP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false, TComMvField * pNewMvFiled = NULL );
     95#endif
     96#if FIX_TICKET_89_CLEAN2
     97  Bool xGetMotionVectorAndRefPicListARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc, RefPicList &eRefPicListCurr );
     98#elif FIX_TICKET_89_REFCHECK
     99  Bool xCheckBiInterviewARP     ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc, RefPicList& eRefPicListCurr);
     100#else
    92101  Bool xCheckBiInterviewARP     ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc );
     102#endif
     103#if FIX_TICKET_89_CLEAN
     104  Void xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi);
     105#else
    93106  Void xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled = NULL );
    94107#endif
     108#endif
    95109  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false          );
    96110  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred );
    97111#if H_3D_VSP
  • Lib/TLibCommon/TypeDef.h

     
    6767#define NTT_BUG_FIX_TK54    1
    6868#define BUG_FIX_TK65        1
    6969
     70#define FIX_TICKET_89_CLEAN 1
     71#define FIX_TICKET_89_CLEAN2 1
     72#define FIX_TICKET_89_REFIDX 1
     73#define FIX_TICKET_89_REFCHECK 1
     74
     75
    7076#define MTK_I0093           1
    7177/////////////////////////////////////////////////////////////////////////////////////////
    7278///////////////////////////////////   MAJOR DEFINES   ///////////////////////////////////