Ignore:
Timestamp:
13 Aug 2015, 17:38:13 (9 years ago)
Author:
tech
Message:

Merged 14.1-update-dev1@1312.

File:
1 edited

Legend:

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

    r1179 r1313  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    6 * Copyright (c) 2010-2015, ITU/ISO/IEC
     6 * Copyright (c) 2010-2015, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    3737
    3838// Include files
    39 #include "TComSlice.h"
     39#include "CommonDef.h"
     40#include "TComYuv.h"
     41#include "TComPic.h"
     42#include "TComInterpolationFilter.h"
    4043#include "TComWeightPrediction.h"
    41 #include "TComInterpolationFilter.h"
    42 
    43 static inline Pel weightBidirY( Int w0, Pel P0, Int w1, Pel P1, Int round, Int shift, Int offset)
    44 {
    45   return ClipY( ( (w0*(P0 + IF_INTERNAL_OFFS) + w1*(P1 + IF_INTERNAL_OFFS) + round + (offset << (shift-1))) >> shift ) );
    46 }
    47 static inline Pel weightBidirC( Int w0, Pel P0, Int w1, Pel P1, Int round, Int shift, Int offset)
    48 {
    49   return ClipC( ( (w0*(P0 + IF_INTERNAL_OFFS) + w1*(P1 + IF_INTERNAL_OFFS) + round + (offset << (shift-1))) >> shift ) );
    50 }
    51 
    52 static inline Pel weightUnidirY( Int w0, Pel P0, Int round, Int shift, Int offset)
    53 {
    54   return ClipY( ( (w0*(P0 + IF_INTERNAL_OFFS) + round) >> shift ) + offset );
    55 }
    56 static inline Pel weightUnidirC( Int w0, Pel P0, Int round, Int shift, Int offset)
    57 {
    58   return ClipC( ( (w0*(P0 + IF_INTERNAL_OFFS) + round) >> shift ) + offset );
     44
     45
     46static inline Pel weightBidir( Int w0, Pel P0, Int w1, Pel P1, Int round, Int shift, Int offset, Int clipBD)
     47{
     48  return ClipBD( ( (w0*(P0 + IF_INTERNAL_OFFS) + w1*(P1 + IF_INTERNAL_OFFS) + round + (offset << (shift-1))) >> shift ), clipBD );
     49}
     50
     51
     52static inline Pel weightUnidir( Int w0, Pel P0, Int round, Int shift, Int offset, Int clipBD)
     53{
     54  return ClipBD( ( (w0*(P0 + IF_INTERNAL_OFFS) + round) >> shift ) + offset, clipBD );
    5955}
    6056
     
    6258// Class definition
    6359// ====================================================================================================================
     60
    6461TComWeightPrediction::TComWeightPrediction()
    6562{
    6663}
    6764
    68 /** weighted averaging for bi-pred
    69  * \param TComYuv* pcYuvSrc0
    70  * \param TComYuv* pcYuvSrc1
    71  * \param iPartUnitIdx
    72  * \param iWidth
    73  * \param iHeight
    74  * \param wpScalingParam *wp0
    75  * \param wpScalingParam *wp1
    76  * \param TComYuv* rpcYuvDst
    77  * \returns Void
    78  */
    79 Void TComWeightPrediction::addWeightBi( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iWidth, UInt iHeight, wpScalingParam *wp0, wpScalingParam *wp1, TComYuv* rpcYuvDst, Bool bRound )
    80 {
    81   Int x, y;
    82 
    83   Pel* pSrcY0  = pcYuvSrc0->getLumaAddr( iPartUnitIdx );
    84   Pel* pSrcU0  = pcYuvSrc0->getCbAddr  ( iPartUnitIdx );
    85   Pel* pSrcV0  = pcYuvSrc0->getCrAddr  ( iPartUnitIdx );
    86  
    87   Pel* pSrcY1  = pcYuvSrc1->getLumaAddr( iPartUnitIdx );
    88   Pel* pSrcU1  = pcYuvSrc1->getCbAddr  ( iPartUnitIdx );
    89   Pel* pSrcV1  = pcYuvSrc1->getCrAddr  ( iPartUnitIdx );
    90  
    91   Pel* pDstY   = rpcYuvDst->getLumaAddr( iPartUnitIdx );
    92   Pel* pDstU   = rpcYuvDst->getCbAddr  ( iPartUnitIdx );
    93   Pel* pDstV   = rpcYuvDst->getCrAddr  ( iPartUnitIdx );
    94  
    95   // Luma : --------------------------------------------
    96   Int w0      = wp0[0].w;
    97   Int offset  = wp0[0].offset;
    98   Int shiftNum = IF_INTERNAL_PREC - g_bitDepthY;
    99   Int shift   = wp0[0].shift + shiftNum;
    100   Int round   = shift?(1<<(shift-1)) * bRound:0;
    101   Int w1      = wp1[0].w;
    102 
    103   UInt  iSrc0Stride = pcYuvSrc0->getStride();
    104   UInt  iSrc1Stride = pcYuvSrc1->getStride();
    105   UInt  iDstStride  = rpcYuvDst->getStride();
    106   for ( y = iHeight-1; y >= 0; y-- )
    107   {
    108     for ( x = iWidth-1; x >= 0; )
    109     {
    110       // note: luma min width is 4
    111       pDstY[x] = weightBidirY(w0,pSrcY0[x], w1,pSrcY1[x], round, shift, offset); x--;
    112       pDstY[x] = weightBidirY(w0,pSrcY0[x], w1,pSrcY1[x], round, shift, offset); x--;
    113       pDstY[x] = weightBidirY(w0,pSrcY0[x], w1,pSrcY1[x], round, shift, offset); x--;
    114       pDstY[x] = weightBidirY(w0,pSrcY0[x], w1,pSrcY1[x], round, shift, offset); x--;
    115     }
    116     pSrcY0 += iSrc0Stride;
    117     pSrcY1 += iSrc1Stride;
    118     pDstY  += iDstStride;
    119   }
    120 
    121  
    122   // Chroma U : --------------------------------------------
    123   w0      = wp0[1].w;
    124   offset  = wp0[1].offset;
    125   shiftNum = IF_INTERNAL_PREC - g_bitDepthC;
    126   shift   = wp0[1].shift + shiftNum;
    127   round   = shift?(1<<(shift-1)):0;
    128   w1      = wp1[1].w;
    129 
    130   iSrc0Stride = pcYuvSrc0->getCStride();
    131   iSrc1Stride = pcYuvSrc1->getCStride();
    132   iDstStride  = rpcYuvDst->getCStride();
    133  
    134   iWidth  >>=1;
    135   iHeight >>=1;
    136  
    137   for ( y = iHeight-1; y >= 0; y-- )
    138   {
    139     for ( x = iWidth-1; x >= 0; )
    140     {
    141       // note: chroma min width is 2
    142       pDstU[x] = weightBidirC(w0,pSrcU0[x], w1,pSrcU1[x], round, shift, offset); x--;
    143       pDstU[x] = weightBidirC(w0,pSrcU0[x], w1,pSrcU1[x], round, shift, offset); x--;
    144     }
    145     pSrcU0 += iSrc0Stride;
    146     pSrcU1 += iSrc1Stride;
    147     pDstU  += iDstStride;
    148   }
    149 
    150   // Chroma V : --------------------------------------------
    151   w0      = wp0[2].w;
    152   offset  = wp0[2].offset;
    153   shift   = wp0[2].shift + shiftNum;
    154   round   = shift?(1<<(shift-1)):0;
    155   w1      = wp1[2].w;
    156 
    157   for ( y = iHeight-1; y >= 0; y-- )
    158   {
    159     for ( x = iWidth-1; x >= 0; )
    160     {
    161       // note: chroma min width is 2
    162       pDstV[x] = weightBidirC(w0,pSrcV0[x], w1,pSrcV1[x], round, shift, offset); x--;
    163       pDstV[x] = weightBidirC(w0,pSrcV0[x], w1,pSrcV1[x], round, shift, offset); x--;
    164     }
    165     pSrcV0 += iSrc0Stride;
    166     pSrcV1 += iSrc1Stride;
    167     pDstV  += iDstStride;
    168   }
    169 }
    170 
    171 /** weighted averaging for uni-pred
    172  * \param TComYuv* pcYuvSrc0
    173  * \param iPartUnitIdx
    174  * \param iWidth
    175  * \param iHeight
    176  * \param wpScalingParam *wp0
    177  * \param TComYuv* rpcYuvDst
    178  * \returns Void
    179  */
    180 Void TComWeightPrediction::addWeightUni( TComYuv* pcYuvSrc0, UInt iPartUnitIdx, UInt iWidth, UInt iHeight, wpScalingParam *wp0, TComYuv* rpcYuvDst )
    181 {
    182   Int x, y;
    183  
    184   Pel* pSrcY0  = pcYuvSrc0->getLumaAddr( iPartUnitIdx );
    185   Pel* pSrcU0  = pcYuvSrc0->getCbAddr  ( iPartUnitIdx );
    186   Pel* pSrcV0  = pcYuvSrc0->getCrAddr  ( iPartUnitIdx );
    187  
    188   Pel* pDstY   = rpcYuvDst->getLumaAddr( iPartUnitIdx );
    189   Pel* pDstU   = rpcYuvDst->getCbAddr  ( iPartUnitIdx );
    190   Pel* pDstV   = rpcYuvDst->getCrAddr  ( iPartUnitIdx );
    191  
    192   // Luma : --------------------------------------------
    193   Int w0      = wp0[0].w;
    194   Int offset  = wp0[0].offset;
    195   Int shiftNum = IF_INTERNAL_PREC - g_bitDepthY;
    196   Int shift   = wp0[0].shift + shiftNum;
    197   Int round   = shift?(1<<(shift-1)):0;
    198   UInt  iSrc0Stride = pcYuvSrc0->getStride();
    199   UInt  iDstStride  = rpcYuvDst->getStride();
    200  
    201   for ( y = iHeight-1; y >= 0; y-- )
    202   {
    203     for ( x = iWidth-1; x >= 0; )
    204     {
    205       // note: luma min width is 4
    206       pDstY[x] = weightUnidirY(w0,pSrcY0[x], round, shift, offset); x--;
    207       pDstY[x] = weightUnidirY(w0,pSrcY0[x], round, shift, offset); x--;
    208       pDstY[x] = weightUnidirY(w0,pSrcY0[x], round, shift, offset); x--;
    209       pDstY[x] = weightUnidirY(w0,pSrcY0[x], round, shift, offset); x--;
    210     }
    211     pSrcY0 += iSrc0Stride;
    212     pDstY  += iDstStride;
    213   }
    214  
    215   // Chroma U : --------------------------------------------
    216   w0      = wp0[1].w;
    217   offset  = wp0[1].offset;
    218   shiftNum = IF_INTERNAL_PREC - g_bitDepthC;
    219   shift   = wp0[1].shift + shiftNum;
    220   round   = shift?(1<<(shift-1)):0;
    221 
    222   iSrc0Stride = pcYuvSrc0->getCStride();
    223   iDstStride  = rpcYuvDst->getCStride();
    224  
    225   iWidth  >>=1;
    226   iHeight >>=1;
    227  
    228   for ( y = iHeight-1; y >= 0; y-- )
    229   {
    230     for ( x = iWidth-1; x >= 0; )
    231     {
    232       // note: chroma min width is 2
    233       pDstU[x] = weightUnidirC(w0,pSrcU0[x], round, shift, offset); x--;
    234       pDstU[x] = weightUnidirC(w0,pSrcU0[x], round, shift, offset); x--;
    235     }
    236     pSrcU0 += iSrc0Stride;
    237     pDstU  += iDstStride;
    238   }
    239 
    240   // Chroma V : --------------------------------------------
    241   w0      = wp0[2].w;
    242   offset  = wp0[2].offset;
    243   shift   = wp0[2].shift + shiftNum;
    244   round   = shift?(1<<(shift-1)):0;
    245 
    246   for ( y = iHeight-1; y >= 0; y-- )
    247   {
    248     for ( x = iWidth-1; x >= 0; )
    249     {
    250       // note: chroma min width is 2
    251       pDstV[x] = weightUnidirC(w0,pSrcV0[x], round, shift, offset); x--;
    252       pDstV[x] = weightUnidirC(w0,pSrcV0[x], round, shift, offset); x--;
    253     }
    254     pSrcV0 += iSrc0Stride;
    255     pDstV  += iDstStride;
    256   }
    257 }
     65
     66//! weighted averaging for bi-pred
     67Void TComWeightPrediction::addWeightBi( const TComYuv              *pcYuvSrc0,
     68                                        const TComYuv              *pcYuvSrc1,
     69                                        const BitDepths            &bitDepths,
     70                                        const UInt                  iPartUnitIdx,
     71                                        const UInt                  uiWidth,
     72                                        const UInt                  uiHeight,
     73                                        const WPScalingParam *const wp0,
     74                                        const WPScalingParam *const wp1,
     75                                              TComYuv        *const rpcYuvDst,
     76                                        const Bool                  bRoundLuma)
     77{
     78
     79  const Bool enableRounding[MAX_NUM_COMPONENT]={ bRoundLuma, true, true };
     80
     81  const UInt numValidComponent = pcYuvSrc0->getNumberValidComponents();
     82
     83  for(Int componentIndex=0; componentIndex<numValidComponent; componentIndex++)
     84  {
     85    const ComponentID compID=ComponentID(componentIndex);
     86
     87    const Pel* pSrc0       = pcYuvSrc0->getAddr( compID,  iPartUnitIdx );
     88    const Pel* pSrc1       = pcYuvSrc1->getAddr( compID,  iPartUnitIdx );
     89          Pel* pDst        = rpcYuvDst->getAddr( compID,  iPartUnitIdx );
     90
     91    // Luma : --------------------------------------------
     92    const Int  w0          = wp0[compID].w;
     93    const Int  offset      = wp0[compID].offset;
     94    const Int  clipBD      = bitDepths.recon[toChannelType(compID)];
     95    const Int  shiftNum    = std::max<Int>(2, (IF_INTERNAL_PREC - clipBD));
     96    const Int  shift       = wp0[compID].shift + shiftNum;
     97    const Int  round       = (enableRounding[compID] && (shift > 0)) ? (1<<(shift-1)) : 0;
     98    const Int  w1          = wp1[compID].w;
     99    const UInt csx         = pcYuvSrc0->getComponentScaleX(compID);
     100    const UInt csy         = pcYuvSrc0->getComponentScaleY(compID);
     101    const Int  iHeight     = uiHeight>>csy;
     102    const Int  iWidth      = uiWidth>>csx;
     103
     104    const UInt iSrc0Stride = pcYuvSrc0->getStride(compID);
     105    const UInt iSrc1Stride = pcYuvSrc1->getStride(compID);
     106    const UInt iDstStride  = rpcYuvDst->getStride(compID);
     107
     108    for ( Int y = iHeight-1; y >= 0; y-- )
     109    {
     110      // do it in batches of 4 (partial unroll)
     111      Int x = iWidth-1;
     112      for ( ; x >= 3; )
     113      {
     114        pDst[x] = weightBidir(w0,pSrc0[x], w1,pSrc1[x], round, shift, offset, clipBD); x--;
     115        pDst[x] = weightBidir(w0,pSrc0[x], w1,pSrc1[x], round, shift, offset, clipBD); x--;
     116        pDst[x] = weightBidir(w0,pSrc0[x], w1,pSrc1[x], round, shift, offset, clipBD); x--;
     117        pDst[x] = weightBidir(w0,pSrc0[x], w1,pSrc1[x], round, shift, offset, clipBD); x--;
     118      }
     119      for( ; x >= 0; x-- )
     120      {
     121        pDst[x] = weightBidir(w0,pSrc0[x], w1,pSrc1[x], round, shift, offset, clipBD);
     122      }
     123
     124      pSrc0 += iSrc0Stride;
     125      pSrc1 += iSrc1Stride;
     126      pDst  += iDstStride;
     127    } // y loop
     128  } // compID loop
     129}
     130
     131
     132//! weighted averaging for uni-pred
     133Void TComWeightPrediction::addWeightUni( const TComYuv        *const pcYuvSrc0,
     134                                         const BitDepths            &bitDepths,
     135                                         const UInt                  iPartUnitIdx,
     136                                         const UInt                  uiWidth,
     137                                         const UInt                  uiHeight,
     138                                         const WPScalingParam *const wp0,
     139                                               TComYuv        *const pcYuvDst )
     140{
     141  const UInt numValidComponent = pcYuvSrc0->getNumberValidComponents();
     142
     143  for(Int componentIndex=0; componentIndex<numValidComponent; componentIndex++)
     144  {
     145    const ComponentID compID=ComponentID(componentIndex);
     146
     147    const Pel* pSrc0       = pcYuvSrc0->getAddr( compID,  iPartUnitIdx );
     148          Pel* pDst        = pcYuvDst->getAddr( compID,  iPartUnitIdx );
     149
     150    // Luma : --------------------------------------------
     151    const Int  w0          = wp0[compID].w;
     152    const Int  offset      = wp0[compID].offset;
     153    const Int  clipBD      = bitDepths.recon[toChannelType(compID)];
     154    const Int  shiftNum    = std::max<Int>(2, (IF_INTERNAL_PREC - clipBD));
     155    const Int  shift       = wp0[compID].shift + shiftNum;
     156    const Int  round       = (shift > 0) ? (1<<(shift-1)) : 0;
     157    const UInt iSrc0Stride = pcYuvSrc0->getStride(compID);
     158    const UInt iDstStride  = pcYuvDst->getStride(compID);
     159    const UInt csx         = pcYuvSrc0->getComponentScaleX(compID);
     160    const UInt csy         = pcYuvSrc0->getComponentScaleY(compID);
     161    const Int  iHeight     = uiHeight>>csy;
     162    const Int  iWidth      = uiWidth>>csx;
     163
     164    for (Int y = iHeight-1; y >= 0; y-- )
     165    {
     166      Int x = iWidth-1;
     167      for ( ; x >= 3; )
     168      {
     169        pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
     170        pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
     171        pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
     172        pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
     173      }
     174      for( ; x >= 0; x--)
     175      {
     176        pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD);
     177      }
     178      pSrc0 += iSrc0Stride;
     179      pDst  += iDstStride;
     180    }
     181  }
     182}
     183
    258184
    259185//=======================================================
    260186//  getWpScaling()
    261187//=======================================================
    262 /** derivation of wp tables
    263  * \param TComDataCU* pcCU
    264  * \param iRefIdx0
    265  * \param iRefIdx1
    266  * \param wpScalingParam *&wp0
    267  * \param wpScalingParam *&wp1
    268  * \param ibdi
    269  * \returns Void
    270  */
    271 Void TComWeightPrediction::getWpScaling( TComDataCU* pcCU, Int iRefIdx0, Int iRefIdx1, wpScalingParam *&wp0, wpScalingParam *&wp1)
     188//! derivation of wp tables
     189Void TComWeightPrediction::getWpScaling(       TComDataCU *const pcCU,
     190                                         const Int               iRefIdx0,
     191                                         const Int               iRefIdx1,
     192                                               WPScalingParam  *&wp0,
     193                                               WPScalingParam  *&wp1)
    272194{
    273195  assert(iRefIdx0 >= 0 || iRefIdx1 >= 0);
    274  
    275   TComSlice*      pcSlice       = pcCU->getSlice();
    276   TComPPS*        pps           = pcCU->getSlice()->getPPS();
    277   Bool            wpBiPred = pps->getWPBiPred();
    278   wpScalingParam* pwp;
    279   Bool            bBiDir        = (iRefIdx0>=0 && iRefIdx1>=0);
    280   Bool            bUniDir       = !bBiDir;
     196
     197        TComSlice *const pcSlice  = pcCU->getSlice();
     198  const Bool             wpBiPred = pcCU->getSlice()->getPPS()->getWPBiPred();
     199  const Bool             bBiDir   = (iRefIdx0>=0 && iRefIdx1>=0);
     200  const Bool             bUniDir  = !bBiDir;
    281201
    282202  if ( bUniDir || wpBiPred )
     
    305225  }
    306226
     227  const UInt numValidComponent                    = pcCU->getPic()->getNumberValidComponents();
     228  const Bool bUseHighPrecisionPredictionWeighting = pcSlice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag();
     229
    307230  if ( bBiDir )
    308231  { // Bi-Dir case
    309     for ( Int yuv=0 ; yuv<3 ; yuv++ )
    310     {
    311       Int bitDepth = yuv ? g_bitDepthC : g_bitDepthY;
     232    for ( Int yuv=0 ; yuv<numValidComponent ; yuv++ )
     233    {
     234      const Int bitDepth            = pcSlice->getSPS()->getBitDepth(toChannelType(ComponentID(yuv)));
     235      const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (bitDepth-8));
     236
    312237      wp0[yuv].w      = wp0[yuv].iWeight;
    313       wp0[yuv].o      = wp0[yuv].iOffset * (1 << (bitDepth-8));
    314238      wp1[yuv].w      = wp1[yuv].iWeight;
    315       wp1[yuv].o      = wp1[yuv].iOffset * (1 << (bitDepth-8));
     239      wp0[yuv].o      = wp0[yuv].iOffset * offsetScalingFactor;
     240      wp1[yuv].o      = wp1[yuv].iOffset * offsetScalingFactor;
    316241      wp0[yuv].offset = wp0[yuv].o + wp1[yuv].o;
    317242      wp0[yuv].shift  = wp0[yuv].uiLog2WeightDenom + 1;
     
    324249  else
    325250  {  // Unidir
    326     pwp = (iRefIdx0>=0) ? wp0 : wp1 ;
    327     for ( Int yuv=0 ; yuv<3 ; yuv++ )
    328     {
    329       Int bitDepth = yuv ? g_bitDepthC : g_bitDepthY;
     251    WPScalingParam *const pwp = (iRefIdx0>=0) ? wp0 : wp1 ;
     252
     253    for ( Int yuv=0 ; yuv<numValidComponent ; yuv++ )
     254    {
     255      const Int bitDepth            = pcSlice->getSPS()->getBitDepth(toChannelType(ComponentID(yuv)));
     256      const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (bitDepth-8));
     257
    330258      pwp[yuv].w      = pwp[yuv].iWeight;
    331       pwp[yuv].offset = pwp[yuv].iOffset * (1 << (bitDepth-8));
     259      pwp[yuv].offset = pwp[yuv].iOffset * offsetScalingFactor;
    332260      pwp[yuv].shift  = pwp[yuv].uiLog2WeightDenom;
    333261      pwp[yuv].round  = (pwp[yuv].uiLog2WeightDenom>=1) ? (1 << (pwp[yuv].uiLog2WeightDenom-1)) : (0);
     
    336264}
    337265
    338 /** weighted prediction for bi-pred
    339  * \param TComDataCU* pcCU
    340  * \param TComYuv* pcYuvSrc0
    341  * \param TComYuv* pcYuvSrc1
    342  * \param iRefIdx0
    343  * \param iRefIdx1
    344  * \param uiPartIdx
    345  * \param iWidth
    346  * \param iHeight
    347  * \param TComYuv* rpcYuvDst
    348  * \returns Void
    349  */
    350 Void TComWeightPrediction::xWeightedPredictionBi( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* rpcYuvDst )
    351 {
    352   wpScalingParam  *pwp0, *pwp1;
    353   TComPPS         *pps = pcCU->getSlice()->getPPS();
    354   assert( pps->getWPBiPred());
     266
     267//! weighted prediction for bi-pred
     268Void TComWeightPrediction::xWeightedPredictionBi(       TComDataCU *const pcCU,
     269                                                  const TComYuv    *const pcYuvSrc0,
     270                                                  const TComYuv    *const pcYuvSrc1,
     271                                                  const Int               iRefIdx0,
     272                                                  const Int               iRefIdx1,
     273                                                  const UInt              uiPartIdx,
     274                                                  const Int               iWidth,
     275                                                  const Int               iHeight,
     276                                                        TComYuv          *rpcYuvDst )
     277{
     278  WPScalingParam  *pwp0;
     279  WPScalingParam  *pwp1;
     280
     281  assert(pcCU->getSlice()->getPPS()->getWPBiPred());
    355282
    356283  getWpScaling(pcCU, iRefIdx0, iRefIdx1, pwp0, pwp1);
     
    358285  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
    359286  {
    360     addWeightBi(pcYuvSrc0, pcYuvSrc1, uiPartIdx, iWidth, iHeight, pwp0, pwp1, rpcYuvDst );
     287    addWeightBi(pcYuvSrc0, pcYuvSrc1, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, pwp1, rpcYuvDst );
    361288  }
    362289  else if ( iRefIdx0 >= 0 && iRefIdx1 <  0 )
    363290  {
    364     addWeightUni( pcYuvSrc0, uiPartIdx, iWidth, iHeight, pwp0, rpcYuvDst );
     291    addWeightUni( pcYuvSrc0, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, rpcYuvDst );
    365292  }
    366293  else if ( iRefIdx0 <  0 && iRefIdx1 >= 0 )
    367294  {
    368     addWeightUni( pcYuvSrc1, uiPartIdx, iWidth, iHeight, pwp1, rpcYuvDst );
     295    addWeightUni( pcYuvSrc1, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp1, rpcYuvDst );
    369296  }
    370297  else
     
    374301}
    375302
    376 /** weighted prediction for uni-pred
    377  * \param TComDataCU* pcCU
    378  * \param TComYuv* pcYuvSrc
    379  * \param uiPartAddr
    380  * \param iWidth
    381  * \param iHeight
    382  * \param eRefPicList
    383  * \param TComYuv*& rpcYuvPred
    384  * \param iPartIdx
    385  * \param iRefIdx
    386  * \returns Void
    387  */
    388 Void TComWeightPrediction::xWeightedPredictionUni( TComDataCU* pcCU, TComYuv* pcYuvSrc, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iRefIdx)
    389 {
    390   wpScalingParam  *pwp, *pwpTmp;
     303
     304//! weighted prediction for uni-pred
     305Void TComWeightPrediction::xWeightedPredictionUni(       TComDataCU *const pcCU,
     306                                                   const TComYuv    *const pcYuvSrc,
     307                                                   const UInt              uiPartAddr,
     308                                                   const Int               iWidth,
     309                                                   const Int               iHeight,
     310                                                   const RefPicList        eRefPicList,
     311                                                         TComYuv          *pcYuvPred,
     312                                                   const Int               iRefIdx_input)
     313{
     314  WPScalingParam  *pwp, *pwpTmp;
     315
     316  Int iRefIdx=iRefIdx_input;
    391317  if ( iRefIdx < 0 )
    392318  {
     
    403329    getWpScaling(pcCU, -1, iRefIdx, pwpTmp, pwp);
    404330  }
    405   addWeightUni( pcYuvSrc, uiPartAddr, iWidth, iHeight, pwp, rpcYuvPred );
    406 }
    407 
    408 
     331  addWeightUni( pcYuvSrc, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartAddr, iWidth, iHeight, pwp, pcYuvPred );
     332}
Note: See TracChangeset for help on using the changeset viewer.