Changeset 443 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComYuv.cpp


Ignore:
Timestamp:
26 May 2013, 15:41:34 (11 years ago)
Author:
tech
Message:
  • Reintegrated branch 6.2-dev0 rev. 442.
  • Changed version number.
  • Added coding results.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/TComYuv.cpp

    r332 r443  
    741741  }
    742742}
     743#if QC_ARP_D0177
     744Void TComYuv::addARP(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip )
     745{
     746  addARPLuma   ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth   , uiHeight    , bClip );
     747  addARPChroma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1, uiHeight>>1 , bClip );
     748}
     749
     750Void TComYuv::addARPLuma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip )
     751{
     752  Int x, y;
     753
     754  Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx );
     755  Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx );
     756  Pel* pDst  = getLumaAddr( uiAbsPartIdx );
     757
     758  UInt iSrc0Stride = pcYuvSrc0->getStride();
     759  UInt iSrc1Stride = pcYuvSrc1->getStride();
     760  UInt iDstStride  = getStride();
     761  for ( y = uiHeight-1; y >= 0; y-- )
     762  {
     763    for ( x = uiWidth-1; x >= 0; x-- )
     764    {
     765      pDst[x] = pSrc0[x] + pSrc1[x];
     766      if( bClip )
     767        pDst[x] = Clip( pDst[x] );
     768    }
     769    pSrc0 += iSrc0Stride;
     770    pSrc1 += iSrc1Stride;
     771    pDst  += iDstStride;
     772  }
     773}
     774
     775Void TComYuv::addARPChroma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip )
     776{
     777  Int x, y;
     778
     779  Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx );
     780  Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx );
     781  Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx );
     782  Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx );
     783  Pel* pDstU = getCbAddr( uiAbsPartIdx );
     784  Pel* pDstV = getCrAddr( uiAbsPartIdx );
     785
     786  UInt  iSrc0Stride = pcYuvSrc0->getCStride();
     787  UInt  iSrc1Stride = pcYuvSrc1->getCStride();
     788  UInt  iDstStride  = getCStride();
     789  for ( y = uiHeight-1; y >= 0; y-- )
     790  {
     791    for ( x = uiWidth-1; x >= 0; x-- )
     792    {
     793      pDstU[x] = pSrcU0[x] + pSrcU1[x];
     794      pDstV[x] = pSrcV0[x] + pSrcV1[x];
     795      if( bClip )
     796      {
     797        pDstU[x] = Clip( pDstU[x] );
     798        pDstV[x] = Clip( pDstV[x] );
     799      }
     800    }
     801
     802    pSrcU0 += iSrc0Stride;
     803    pSrcU1 += iSrc1Stride;
     804    pSrcV0 += iSrc0Stride;
     805    pSrcV1 += iSrc1Stride;
     806    pDstU  += iDstStride;
     807    pDstV  += iDstStride;
     808  }
     809}
     810
     811Void TComYuv::subtractARP(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight)
     812{
     813  subtractARPLuma  ( pcYuvSrc0, pcYuvSrc1,  uiAbsPartIdx, uiWidth    , uiHeight    );
     814  subtractARPChroma( pcYuvSrc0, pcYuvSrc1,  uiAbsPartIdx, uiWidth>>1 , uiHeight>>1 );
     815}
     816
     817Void TComYuv::subtractARPLuma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight)
     818{
     819  Int x, y;
     820
     821  Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx );
     822  Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx );
     823  Pel* pDst  = getLumaAddr( uiAbsPartIdx );
     824
     825  Int  iSrc0Stride = pcYuvSrc0->getStride();
     826  Int  iSrc1Stride = pcYuvSrc1->getStride();
     827  Int  iDstStride  = getStride();
     828  for ( y = uiHeight-1; y >= 0; y-- )
     829  {
     830    for ( x = uiWidth-1; x >= 0; x-- )
     831    {
     832      pDst[x] = pSrc0[x] - pSrc1[x];
     833    }
     834    pSrc0 += iSrc0Stride;
     835    pSrc1 += iSrc1Stride;
     836    pDst  += iDstStride;
     837  }
     838}
     839
     840Void TComYuv::subtractARPChroma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight)
     841{
     842  Int x, y;
     843
     844  Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx );
     845  Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx );
     846  Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx );
     847  Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx );
     848  Pel* pDstU  = getCbAddr( uiAbsPartIdx );
     849  Pel* pDstV  = getCrAddr( uiAbsPartIdx );
     850
     851  Int  iSrc0Stride = pcYuvSrc0->getCStride();
     852  Int  iSrc1Stride = pcYuvSrc1->getCStride();
     853  Int  iDstStride  = getCStride();
     854  for ( y = uiHeight-1; y >= 0; y-- )
     855  {
     856    for ( x = uiWidth-1; x >= 0; x-- )
     857    {
     858      pDstU[x] = pSrcU0[x] - pSrcU1[x];
     859      pDstV[x] = pSrcV0[x] - pSrcV1[x];
     860    }
     861    pSrcU0 += iSrc0Stride;
     862    pSrcU1 += iSrc1Stride;
     863    pSrcV0 += iSrc0Stride;
     864    pSrcV1 += iSrc1Stride;
     865    pDstU  += iDstStride;
     866    pDstV  += iDstStride;
     867  }
     868}
     869
     870Void TComYuv::multiplyARP( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )
     871{
     872  multiplyARPLuma( uiAbsPartIdx , uiWidth , uiHeight , dW );
     873  multiplyARPChroma( uiAbsPartIdx , uiWidth >> 1 , uiHeight >> 1 , dW );
     874}
     875
     876Void TComYuv::xxMultiplyLine( Pel * pSrcDst , UInt uiWidth , UChar dW )
     877{
     878  assert( dW == 2 );
     879  for( UInt x = 0 ; x < uiWidth ; x++ )
     880    pSrcDst[x] =  pSrcDst[x] >> 1;
     881}
     882
     883Void TComYuv::multiplyARPLuma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )
     884{
     885  Pel* pDst  = getLumaAddr( uiAbsPartIdx );
     886  Int  iDstStride  = getStride();
     887  for ( Int y = uiHeight-1; y >= 0; y-- )
     888  {
     889    xxMultiplyLine( pDst , uiWidth , dW );
     890    pDst  += iDstStride;
     891  }
     892}
     893
     894Void TComYuv::multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )
     895{
     896  Pel* pDstU  = getCbAddr( uiAbsPartIdx );
     897  Pel* pDstV  = getCrAddr( uiAbsPartIdx );
     898
     899  Int  iDstStride  = getCStride();
     900  for ( Int y = uiHeight-1; y >= 0; y-- )
     901  {
     902    xxMultiplyLine( pDstU , uiWidth , dW );
     903    xxMultiplyLine( pDstV , uiWidth , dW );
     904    pDstU  += iDstStride;
     905    pDstV  += iDstStride;
     906  }
     907}
     908#endif
    743909//! \}
Note: See TracChangeset for help on using the changeset viewer.