Ignore:
Timestamp:
13 Nov 2015, 16:29:39 (8 years ago)
Author:
tech
Message:

Merged 15.1-dev1@1381.

File:
1 edited

Legend:

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

    r1313 r1386  
    5555}
    5656
     57static inline Pel noWeightUnidir( Pel P0, Int round, Int shift, Int offset, Int clipBD)
     58{
     59  return ClipBD( ( ((P0 + IF_INTERNAL_OFFS) + round) >> shift ) + offset, clipBD );
     60}
     61
     62static inline Pel noWeightOffsetUnidir( Pel P0, Int round, Int shift, Int clipBD)
     63{
     64  return ClipBD( ( ((P0 + IF_INTERNAL_OFFS) + round) >> shift ), clipBD );
     65}
     66
     67
    5768// ====================================================================================================================
    5869// Class definition
     
    154165    const Int  shiftNum    = std::max<Int>(2, (IF_INTERNAL_PREC - clipBD));
    155166    const Int  shift       = wp0[compID].shift + shiftNum;
    156     const Int  round       = (shift > 0) ? (1<<(shift-1)) : 0;
    157167    const UInt iSrc0Stride = pcYuvSrc0->getStride(compID);
    158168    const UInt iDstStride  = pcYuvDst->getStride(compID);
     
    162172    const Int  iWidth      = uiWidth>>csx;
    163173
     174    if (w0 != 1 << wp0[compID].shift)
     175    {
     176      const Int  round       = (shift > 0) ? (1<<(shift-1)) : 0;
    164177    for (Int y = iHeight-1; y >= 0; y-- )
    165178    {
     
    178191      pSrc0 += iSrc0Stride;
    179192      pDst  += iDstStride;
     193    }
     194  }
     195    else
     196    {
     197      const Int  round       = (shiftNum > 0) ? (1<<(shiftNum-1)) : 0;
     198      if (offset == 0)
     199      {
     200        for (Int y = iHeight-1; y >= 0; y-- )
     201        {
     202          Int x = iWidth-1;
     203          for ( ; x >= 3; )
     204          {
     205            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--;
     206            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--;
     207            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--;
     208            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--;
     209          }
     210          for( ; x >= 0; x--)
     211          {
     212            pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD);
     213          }
     214          pSrc0 += iSrc0Stride;
     215          pDst  += iDstStride;
     216        }
     217      }
     218      else
     219      {
     220        for (Int y = iHeight-1; y >= 0; y-- )
     221        {
     222          Int x = iWidth-1;
     223          for ( ; x >= 3; )
     224          {
     225            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--;
     226            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--;
     227            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--;
     228            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--;
     229          }
     230          for( ; x >= 0; x--)
     231          {
     232            pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD);
     233          }
     234          pSrc0 += iSrc0Stride;
     235          pDst  += iDstStride;
     236        }
     237      }
    180238    }
    181239  }
     
    197255        TComSlice *const pcSlice  = pcCU->getSlice();
    198256  const Bool             wpBiPred = pcCU->getSlice()->getPPS()->getWPBiPred();
    199   const Bool             bBiDir   = (iRefIdx0>=0 && iRefIdx1>=0);
    200   const Bool             bUniDir  = !bBiDir;
    201 
    202   if ( bUniDir || wpBiPred )
     257  const Bool             bBiPred  = (iRefIdx0>=0 && iRefIdx1>=0);
     258  const Bool             bUniPred = !bBiPred;
     259
     260  if ( bUniPred || wpBiPred )
    203261  { // explicit --------------------
    204262    if ( iRefIdx0 >= 0 )
     
    228286  const Bool bUseHighPrecisionPredictionWeighting = pcSlice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag();
    229287
    230   if ( bBiDir )
    231   { // Bi-Dir case
     288  if ( bBiPred )
     289  { // Bi-predictive case
    232290    for ( Int yuv=0 ; yuv<numValidComponent ; yuv++ )
    233291    {
     
    248306  }
    249307  else
    250   {  // Unidir
     308  {  // UniPred
    251309    WPScalingParam *const pwp = (iRefIdx0>=0) ? wp0 : wp1 ;
    252310
Note: See TracChangeset for help on using the changeset viewer.