1 | |
---|
2 | |
---|
3 | /** \file TComWeightPrediction.h |
---|
4 | \brief weighting prediction class (header) |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef __TCOMWEIGHTPREDICTION__ |
---|
8 | #define __TCOMWEIGHTPREDICTION__ |
---|
9 | |
---|
10 | |
---|
11 | // Include files |
---|
12 | #include "TComPic.h" |
---|
13 | #include "TComMotionInfo.h" |
---|
14 | #include "TComPattern.h" |
---|
15 | #include "TComTrQuant.h" |
---|
16 | |
---|
17 | #ifdef WEIGHT_PRED |
---|
18 | |
---|
19 | // ==================================================================================================================== |
---|
20 | // Class definition |
---|
21 | // ==================================================================================================================== |
---|
22 | /// weighting prediction class |
---|
23 | class TComWeightPrediction |
---|
24 | { |
---|
25 | wpScalingParam m_wp0[3], m_wp1[3]; |
---|
26 | Int m_ibdi; |
---|
27 | |
---|
28 | public: |
---|
29 | TComWeightPrediction(); |
---|
30 | |
---|
31 | Void getWpScaling( TComDataCU* pcCU, Int iRefIdx0, Int iRefIdx1, wpScalingParam *&wp0 , wpScalingParam *&wp1 , Int ibdi=(g_uiBitDepth+g_uiBitIncrement)); |
---|
32 | |
---|
33 | Void addWeightBi( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iWidth, UInt iHeight, wpScalingParam *wp0, wpScalingParam *wp1, TComYuv* rpcYuvDst, Bool bRound=true ); |
---|
34 | Void addWeightUni( TComYuv* pcYuvSrc0, UInt iPartUnitIdx, UInt iWidth, UInt iHeight, wpScalingParam *wp0, TComYuv* rpcYuvDst ); |
---|
35 | |
---|
36 | Void xWeightedPredictionUni( TComDataCU* pcCU, TComYuv* pcYuvSrc, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx ); |
---|
37 | Void xWeightedPredictionBi( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* rpcYuvDst ); |
---|
38 | |
---|
39 | __inline Pel xClip ( Int x ); |
---|
40 | __inline Pel weightBidir( Int w0, Pel P0, Int w1, Pel P1, Int round, Int shift, Int offset); |
---|
41 | __inline Pel weightUnidir( Int w0, Pel P0, Int round, Int shift, Int offset); |
---|
42 | |
---|
43 | }; |
---|
44 | |
---|
45 | |
---|
46 | inline Pel TComWeightPrediction::xClip( Int x ) |
---|
47 | { |
---|
48 | Int max = (Int)g_uiIBDI_MAX; |
---|
49 | Pel pel = (Pel)( (x < 0) ? 0 : (x > max) ? max : x ); |
---|
50 | |
---|
51 | return( pel ); |
---|
52 | } |
---|
53 | |
---|
54 | inline Pel TComWeightPrediction::weightBidir( Int w0, Pel P0, Int w1, Pel P1, Int round, Int shift, Int offset) |
---|
55 | { |
---|
56 | return xClip( ( (w0*P0 + w1*P1 + round) >> shift ) + offset ); |
---|
57 | } |
---|
58 | inline Pel TComWeightPrediction::weightUnidir( Int w0, Pel P0, Int round, Int shift, Int offset) |
---|
59 | { |
---|
60 | return xClip( ( (w0*P0 + round) >> shift ) + offset ); |
---|
61 | } |
---|
62 | |
---|
63 | #endif // WEIGHT_PRED |
---|
64 | |
---|
65 | #endif |
---|
66 | |
---|
67 | |
---|