Ignore:
Timestamp:
30 Jul 2014, 19:51:27 (10 years ago)
Author:
tech
Message:

Merged 11.2-dev2-Samsung@1026.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-11.2-dev0/source/Lib/TLibCommon/TComPrediction.cpp

    r1029 r1030  
    568568    pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, i, iNumSPInOneLine, uiSPAddr[i]);
    569569  }
     570#if SHARP_ARP_CHROMA_I0104
     571  if( pcCU->getARPW( uiPartAddr ) != 0 )
     572  {
     573    return;
     574  }
     575#endif
    570576  // horizontal sub-PU merge
    571577  for (Int i=0; i<iNumSP; i++)
     
    14691475  pcCU->clipMv(cMv);
    14701476  TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec();
     1477#if QC_I0129_ARP_FIX
     1478  xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 ), true );
     1479  xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 ), true );
     1480#else
    14711481  xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, true );
    14721482  xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, true );
    1473 
     1483#endif
    14741484  if( dW > 0 )
    14751485  {
     
    14791489    TComMv cMVwithDisparity = cMv + cDistparity.m_acNBDV;
    14801490    pcCU->clipMv(cMVwithDisparity);
     1491#if SHARP_ARP_CHROMA_I0104
     1492    if (iWidth <= 8)
     1493    {
     1494      pYuvB0->clear(); pYuvB1->clear();
     1495    }
     1496#endif
    14811497
    14821498    assert ( cDistparity.bDV );
     
    14871503   
    14881504    pcPicYuvRef = pcPicYuvBaseCol->getPicYuvRec();
     1505#if QC_I0129_ARP_FIX
     1506    xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, true, true );
     1507#if SHARP_ARP_CHROMA_I0104
     1508    if (iWidth > 8)
     1509#endif
     1510    xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, true, true );
     1511#else
    14891512    xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, bi, true );
    14901513    xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, bi, true );
     1514#endif
    14911515#else
    14921516    pcPicYuvRef = pcPicYuvBaseCol->getPicYuvRec();
     
    14961520   
    14971521    pcPicYuvRef = pcPicYuvBaseRef->getPicYuvRec();
     1522#if QC_I0129_ARP_FIX
     1523    xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, true, true );
     1524#if SHARP_ARP_CHROMA_I0104
     1525    if (iWidth > 8)
     1526#endif
     1527    xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, true, true );
     1528#else
    14981529    xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, bi, true );
    14991530    xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, bi, true );
    1500 
     1531#endif
    15011532    pYuvB0->subtractARP( pYuvB0 , pYuvB1 , uiPartAddr , iWidth , iHeight );
    15021533
     
    15081539  }
    15091540}
     1541
     1542#if QC_I0051_ARP_SIMP
     1543Bool TComPrediction::xCheckBiInterviewARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc )
     1544{
     1545  Int         iRefIdx       = pcCU->getCUMvField( eBaseRefPicList )->getRefIdx( uiPartAddr );
     1546  TComMv      cDMv          = pcCU->getCUMvField( eBaseRefPicList )->getMv( uiPartAddr );
     1547  TComPic* pcPicYuvBaseCol  = pcCU->getSlice()->getRefPic( eBaseRefPicList, iRefIdx ); 
     1548  TComPicYuv* pcYuvBaseCol  = pcPicYuvBaseCol->getPicYuvRec();
     1549  Int uiLCUAddr,uiAbsPartAddr;
     1550  Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2  + ((cDMv.getHor() + 2)>>2);
     1551  Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2);
     1552
     1553  irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX);
     1554  irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY); 
     1555  pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr);
     1556  TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr );
     1557
     1558  TComPic* pcPicYuvBaseTRef = NULL;
     1559  pcPicYuvCurrTRef = NULL;
     1560
     1561  //If there is available motion in base reference list, use it
     1562  if(!pColCU->isIntra(uiAbsPartAddr))
     1563  {
     1564    for(Int iList = 0; iList < (pColCU->getSlice()->isInterB() ? 2: 1); iList ++)
     1565    {
     1566      RefPicList eRefPicListCurr = RefPicList(iList);
     1567      Int iRef = pColCU->getCUMvField(eRefPicListCurr)->getRefIdx(uiAbsPartAddr);
     1568      if( iRef != -1)
     1569      {
     1570        pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicListCurr, iRef); 
     1571        Int  iCurrPOC    = pColCU->getSlice()->getPOC();
     1572        Int  iCurrRefPOC = pcPicYuvBaseTRef->getPOC();
     1573        Int  iCurrRef    = pcCU->getSlice()->getFirstTRefIdx(eRefPicListCurr);
     1574#if MTK_I0072_IVARP_SCALING_FIX
     1575        if( iCurrRef >= 0 && iCurrPOC != iCurrRefPOC)
     1576#else
     1577        if( iCurrRef >= 0)
     1578#endif
     1579        {
     1580          pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic(eRefPicListCurr,iCurrRef); 
     1581          Int iTargetPOC = pcPicYuvCurrTRef->getPOC();
     1582          pcPicYuvBaseTRef =  pcCU->getSlice()->getBaseViewRefPic(iTargetPOC,  pcPicYuvBaseCol->getViewIndex() ); 
     1583          if(pcPicYuvBaseTRef)
     1584          {
     1585            cBaseTMV = pColCU->getCUMvField(eRefPicListCurr)->getMv(uiAbsPartAddr);
     1586            Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC);
     1587            if ( iScale != 4096 )
     1588            {
     1589              cBaseTMV = cBaseTMV.scaleMv( iScale );
     1590            }
     1591            iCurrTRefPoc = iTargetPOC;
     1592            return true;
     1593          }
     1594        }
     1595      }
     1596    }
     1597  }
     1598
     1599  //If there is no available motion in base reference list, use ( 0, 0 )
     1600  if( pcCU->getSlice()->getFirstTRefIdx( eBaseRefPicList ) >= 0 )
     1601  {
     1602    cBaseTMV.set( 0, 0 );
     1603    pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic( eBaseRefPicList,  pcCU->getSlice()->getFirstTRefIdx( eBaseRefPicList ) );
     1604    iCurrTRefPoc = pcPicYuvCurrTRef->getPOC();
     1605    return true;
     1606  }
     1607
     1608  return false;
     1609}
     1610#endif
     1611
    15101612Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled )
    15111613{
     
    15411643  pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr);
    15421644  TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr );
    1543 
     1645#if QC_I0051_ARP_SIMP
     1646  if( pcCU->getSlice()->isInterB() && !pcCU->getSlice()->getIsDepth() )
     1647  {
     1648    RefPicList eOtherRefList = ( eRefPicList == REF_PIC_LIST_0 ) ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     1649    Int iOtherRefIdx = pcCU->getCUMvField( eOtherRefList )->getRefIdx( uiPartAddr );
     1650    //The other prediction direction is temporal ARP
     1651    if( iOtherRefIdx >= 0 && pcCU->getSlice()->getViewIndex() == pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx )->getViewIndex() )
     1652    {
     1653      bTMVAvai = true;
     1654      pcPicYuvBaseTRef = pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx );
     1655      Int  iCurrPOC    = pcCU->getSlice()->getPOC();
     1656      Int  iCurrRefPOC = pcPicYuvBaseTRef->getPOC();
     1657      Int  iCurrRef    = pcCU->getSlice()->getFirstTRefIdx( eOtherRefList );
     1658     
     1659      if( iCurrRef >= 0 )
     1660      {
     1661        pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic( eOtherRefList,iCurrRef ); 
     1662        Int iTargetPOC = pcPicYuvCurrTRef->getPOC();
     1663        pcPicYuvBaseTRef =  pcCU->getSlice()->getBaseViewRefPic( iTargetPOC,  pcPicYuvBaseCol->getViewIndex() );
     1664        if( pcPicYuvBaseTRef )
     1665        {
     1666          cBaseTMV = pcCU->getCUMvField( eOtherRefList )->getMv( uiPartAddr );
     1667          Int iScale = pcCU-> xGetDistScaleFactor( iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC );
     1668          if ( iScale != 4096 )
     1669          {
     1670            cBaseTMV = cBaseTMV.scaleMv( iScale );
     1671          }
     1672        }
     1673        else
     1674        {
     1675          dW = 0;
     1676        }
     1677      }
     1678      else
     1679      {
     1680        dW = 0;
     1681      }
     1682    }
     1683
     1684    //Both prediction directions are inter-view ARP
     1685    if ( iOtherRefIdx >= 0 && !bTMVAvai )
     1686    {
     1687      RefPicList eBaseList = REF_PIC_LIST_0;
     1688      Int iCurrTRefPoc;
     1689      bTMVAvai = ( eBaseList != eRefPicList ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eOtherRefList, iOtherRefIdx )->getViewIndex() );
     1690
     1691      if ( bTMVAvai )
     1692      {
     1693        if( xCheckBiInterviewARP( pcCU, uiPartAddr, iWidth, iHeight, eBaseList, pcPicYuvCurrTRef, cBaseTMV, iCurrTRefPoc ) )
     1694        {
     1695          pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic( iCurrTRefPoc,  pcPicYuvBaseCol->getViewIndex() );
     1696          if ( pcPicYuvBaseTRef == NULL )
     1697          {
     1698            dW = 0;
     1699          }
     1700        }
     1701        else
     1702        {
     1703          dW = 0;
     1704        }
     1705      }
     1706    }
     1707  }
     1708
     1709  if( !pColCU->isIntra( uiAbsPartAddr ) && !bTMVAvai )
     1710#else
    15441711  if(!pColCU->isIntra(uiAbsPartAddr))
     1712#endif
    15451713  {
    15461714    TComMvField puMVField;
     
    15551723        Int  iCurrRefPOC = pcPicYuvBaseTRef->getPOC();
    15561724        Int  iCurrRef    = pcCU->getSlice()->getFirstTRefIdx(eRefPicListCurr);
     1725#if MTK_I0072_IVARP_SCALING_FIX
     1726        if (iCurrRef >= 0 && iCurrRefPOC != iCurrPOC)
     1727#else
    15571728        if( iCurrRef >= 0)
     1729#endif
    15581730        {
    15591731          pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic(eRefPicListCurr,iCurrRef); 
     
    15821754    pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic  (eRefPicList,  pcCU->getSlice()->getFirstTRefIdx(eRefPicList));     
    15831755  }
    1584 
     1756#if QC_I0129_ARP_FIX
     1757  xPredInterLumaBlk  ( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ),        bTMVAvai);
     1758  xPredInterChromaBlk( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ),        bTMVAvai);
     1759#else
    15851760  xPredInterLumaBlk  ( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi,        bTMVAvai);
    15861761  xPredInterChromaBlk( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi,        bTMVAvai);
    1587 
     1762#endif
    15881763  if( dW > 0 && bTMVAvai )
    15891764  {
     
    15961771    pcCU->clipMv(cBaseTMV);
    15971772    pcCU->clipMv(cTempMv);
    1598 
     1773#if SHARP_ARP_CHROMA_I0104
     1774    if (iWidth <= 8)
     1775    {
     1776      pYuvCurrTRef->clear(); pYuvBaseTRef->clear();
     1777    }
     1778#endif
     1779#if QC_I0129_ARP_FIX
     1780    xPredInterLumaBlk  ( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, true,   true);
     1781#if SHARP_ARP_CHROMA_I0104
     1782    if (iWidth > 8)
     1783#endif
     1784    xPredInterChromaBlk( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, true,   true);
     1785    xPredInterLumaBlk  ( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, true,   true);
     1786#if SHARP_ARP_CHROMA_I0104
     1787    if (iWidth > 8)
     1788#endif
     1789    xPredInterChromaBlk( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, true,   true);
     1790#else
    15991791    xPredInterLumaBlk  ( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi,   true);
    16001792    xPredInterChromaBlk( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi,   true);
     
    16021794    xPredInterChromaBlk( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, bi,   true);
    16031795
     1796#endif
    16041797    pYuvCurrTRef->subtractARP( pYuvCurrTRef , pYuvBaseTRef , uiPartAddr , iWidth , iHeight ); 
    16051798    if(dW == 2)
     
    21352328  Int iRecStride = ( eType == TEXT_LUMA ) ? pRecPic->getStride() : pRecPic->getCStride();
    21362329  Int iRefStride = ( eType == TEXT_LUMA ) ? pRefPic->getStride() : pRefPic->getCStride();
     2330#if SEC_IC_NEIGHBOR_CLIP_I0080
     2331  Int iRefOffset, iHor, iVer;
     2332#else
    21372333  Int iCUPelX, iCUPelY, iRefX, iRefY, iRefOffset, iHor, iVer;
    21382334
    21392335  iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
    21402336  iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
     2337#endif
    21412338  iHor = pcCU->getSlice()->getIsDepth() ? pMv->getHor() : ( ( pMv->getHor() + 2 ) >> 2 );
    21422339  iVer = pcCU->getSlice()->getIsDepth() ? pMv->getVer() : ( ( pMv->getVer() + 2 ) >> 2 );
     2340#if !SEC_IC_NEIGHBOR_CLIP_I0080
    21432341  iRefX   = iCUPelX + iHor;
    21442342  iRefY   = iCUPelY + iVer;
     2343#endif
    21452344  if( eType != TEXT_LUMA )
    21462345  {
     
    21582357  Int precShift = std::max(0, (( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC) - 12);
    21592358
     2359#if SEC_IC_NEIGHBOR_CLIP_I0080
     2360  if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) )
     2361#else
    21602362  if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) && iCUPelY > 0 && iRefY > 0 )
     2363#endif
    21612364  {
    21622365    iRefOffset = iHor + iVer * iRefStride - iRefStride;
     
    21882391  }
    21892392
    2190 
     2393#if SEC_IC_NEIGHBOR_CLIP_I0080
     2394  if( pcCU->getPULeft( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) )
     2395#else
    21912396  if( pcCU->getPULeft( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) && iCUPelX > 0 && iRefX > 0 )
     2397#endif
    21922398  {
    21932399    iRefOffset = iHor + iVer * iRefStride - 1;
Note: See TracChangeset for help on using the changeset viewer.