81 const UInt iPartUnitIdx,
87 const Bool bRoundLuma)
94 for(
Int componentIndex=0; componentIndex<numValidComponent; componentIndex++)
98 const Pel* pSrc0 = pcYuvSrc0->
getAddr( compID, iPartUnitIdx );
99 const Pel* pSrc1 = pcYuvSrc1->
getAddr( compID, iPartUnitIdx );
100 Pel* pDst = rpcYuvDst->
getAddr( compID, iPartUnitIdx );
103 const Int w0 = wp0[compID].
w;
107 const Int shift = wp0[compID].
shift + shiftNum;
108 const Int round = (enableRounding[compID] && (shift > 0)) ? (1<<(shift-1)) : 0;
109 const Int w1 = wp1[compID].
w;
112 const Int iHeight = uiHeight>>csy;
113 const Int iWidth = uiWidth>>csx;
119 for (
Int y = iHeight-1; y >= 0; y-- )
125 pDst[x] =
weightBidir(w0,pSrc0[x], w1,pSrc1[x], round, shift, offset, clipBD); x--;
126 pDst[x] =
weightBidir(w0,pSrc0[x], w1,pSrc1[x], round, shift, offset, clipBD); x--;
127 pDst[x] =
weightBidir(w0,pSrc0[x], w1,pSrc1[x], round, shift, offset, clipBD); x--;
128 pDst[x] =
weightBidir(w0,pSrc0[x], w1,pSrc1[x], round, shift, offset, clipBD); x--;
132 pDst[x] =
weightBidir(w0,pSrc0[x], w1,pSrc1[x], round, shift, offset, clipBD);
135 pSrc0 += iSrc0Stride;
136 pSrc1 += iSrc1Stride;
146 const UInt iPartUnitIdx,
154 for(
Int componentIndex=0; componentIndex<numValidComponent; componentIndex++)
158 const Pel* pSrc0 = pcYuvSrc0->
getAddr( compID, iPartUnitIdx );
159 Pel* pDst = pcYuvDst->
getAddr( compID, iPartUnitIdx );
162 const Int w0 = wp0[compID].
w;
166 const Int shift = wp0[compID].
shift + shiftNum;
171 const Int iHeight = uiHeight>>csy;
172 const Int iWidth = uiWidth>>csx;
174 if (w0 != 1 << wp0[compID].shift)
176 const Int round = (shift > 0) ? (1<<(shift-1)) : 0;
177 for (
Int y = iHeight-1; y >= 0; y-- )
182 pDst[x] =
weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
183 pDst[x] =
weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
184 pDst[x] =
weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
185 pDst[x] =
weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--;
189 pDst[x] =
weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD);
191 pSrc0 += iSrc0Stride;
197 const Int round = (shiftNum > 0) ? (1<<(shiftNum-1)) : 0;
200 for (
Int y = iHeight-1; y >= 0; y-- )
214 pSrc0 += iSrc0Stride;
220 for (
Int y = iHeight-1; y >= 0; y-- )
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--;
232 pDst[x] =
noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD);
234 pSrc0 += iSrc0Stride;
253 assert(iRefIdx0 >= 0 || iRefIdx1 >= 0);
257 const Bool bBiPred = (iRefIdx0>=0 && iRefIdx1>=0);
258 const Bool bUniPred = !bBiPred;
260 if ( bUniPred || wpBiPred )
290 for (
Int yuv=0 ; yuv<numValidComponent ; yuv++ )
293 const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (bitDepth-8));
297 wp0[yuv].
o = wp0[yuv].
iOffset * offsetScalingFactor;
298 wp1[yuv].
o = wp1[yuv].
iOffset * offsetScalingFactor;
299 wp0[yuv].
offset = wp0[yuv].
o + wp1[yuv].
o;
311 for (
Int yuv=0 ; yuv<numValidComponent ; yuv++ )
314 const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (bitDepth-8));
327 const TComYuv *
const pcYuvSrc0,
328 const TComYuv *
const pcYuvSrc1,
331 const UInt uiPartIdx,
343 if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
347 else if ( iRefIdx0 >= 0 && iRefIdx1 < 0 )
351 else if ( iRefIdx0 < 0 && iRefIdx1 >= 0 )
365 const UInt uiPartAddr,
370 const Int iRefIdx_input)
374 Int iRefIdx=iRefIdx_input;
379 assert (iRefIdx >= 0);
static Pel noWeightOffsetUnidir(Pel P0, Int round, Int shift, Int clipBD)
Int getRefIdx(Int iIdx) const
Defines version information, constants and small in-line functions.
const TComSPSRExt & getSpsRangeExtension() const
Declaration of TComInterpolationFilter class.
general YUV buffer class (header)
#define IF_INTERNAL_OFFS
Offset used internally.
UInt getStride(const ComponentID id) const
Int getNumberValidComponents() const
T ClipBD(const T x, const Int bitDepth)
Int recon[MAX_NUM_CHANNEL_TYPE]
the bit depth as indicated in the SPS
#define IF_INTERNAL_PREC
Number of bits for internal precision.
UInt getComponentScaleX(const ComponentID id) const
Void addWeightBi(const TComYuv *pcYuvSrc0, const TComYuv *pcYuvSrc1, const BitDepths &bitDepths, const UInt iPartUnitIdx, const UInt uiWidth, const UInt uiHeight, const WPScalingParam *const wp0, const WPScalingParam *const wp1, TComYuv *const rpcYuvDst, const Bool bRoundLuma=true)
weighted averaging for bi-pred
static Pel noWeightUnidir(Pel P0, Int round, Int shift, Int offset, Int clipBD)
UInt getComponentScaleY(const ComponentID id) const
Int getBitDepth(ChannelType type) const
Pel * getAddr(const ComponentID id)
RefPicList
reference list index
Void getWpScaling(RefPicList e, Int iRefIdx, WPScalingParam *&wp)
get tables for weighted prediction
const BitDepths & getBitDepths() const
const TComPPS * getPPS() const
static Pel weightUnidir(Int w0, Pel P0, Int round, Int shift, Int offset, Int clipBD)
static Pel weightBidir(Int w0, Pel P0, Int w1, Pel P1, Int round, Int shift, Int offset, Int clipBD)
TComCUMvField * getCUMvField(RefPicList e)
weighting prediction class (header)
Void xWeightedPredictionBi(TComDataCU *const pcCU, const TComYuv *const pcYuvSrc0, const TComYuv *const pcYuvSrc1, const Int iRefIdx0, const Int iRefIdx1, const UInt uiPartIdx, const Int iWidth, const Int iHeight, TComYuv *pcYuvDst)
weighted prediction for bi-pred
Void getWpScaling(TComDataCU *const pcCU, const Int iRefIdx0, const Int iRefIdx1, WPScalingParam *&wp0, WPScalingParam *&wp1)
derivation of wp tables
UInt getNumberValidComponents() const
Void addWeightUni(const TComYuv *const pcYuvSrc0, const BitDepths &bitDepths, const UInt iPartUnitIdx, const UInt uiWidth, const UInt uiHeight, const WPScalingParam *const wp0, TComYuv *const rpcYuvDst)
weighted averaging for uni-pred
const TComSPS * getSPS() const
Bool getHighPrecisionOffsetsEnabledFlag() const
Void xWeightedPredictionUni(TComDataCU *const pcCU, const TComYuv *const pcYuvSrc, const UInt uiPartAddr, const Int iWidth, const Int iHeight, const RefPicList eRefPicList, TComYuv *pcYuvPred, const Int iRefIdx=-1)
weighted prediction for uni-pred