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 | #if POZNAN_DBMP |
---|
40 | Void addWeightBi_DBMP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, wpScalingParam *wp1, TComYuv* rpcYuvDst, Bool bRound=true ); |
---|
41 | Void addWeightUni_DBMP( TComYuv* pcYuvSrc0, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, TComYuv* rpcYuvDst ); |
---|
42 | |
---|
43 | Void xWeightedPredictionUni_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx ); |
---|
44 | Void xWeightedPredictionBi_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iPosX, Int iPosY, TComYuv* rpcYuvDst ); |
---|
45 | #endif |
---|
46 | |
---|
47 | __inline Pel xClip ( Int x ); |
---|
48 | __inline Pel weightBidir( Int w0, Pel P0, Int w1, Pel P1, Int round, Int shift, Int offset); |
---|
49 | __inline Pel weightUnidir( Int w0, Pel P0, Int round, Int shift, Int offset); |
---|
50 | |
---|
51 | }; |
---|
52 | |
---|
53 | |
---|
54 | inline Pel TComWeightPrediction::xClip( Int x ) |
---|
55 | { |
---|
56 | Int max = (Int)g_uiIBDI_MAX; |
---|
57 | Pel pel = (Pel)( (x < 0) ? 0 : (x > max) ? max : x ); |
---|
58 | |
---|
59 | return( pel ); |
---|
60 | } |
---|
61 | |
---|
62 | inline Pel TComWeightPrediction::weightBidir( Int w0, Pel P0, Int w1, Pel P1, Int round, Int shift, Int offset) |
---|
63 | { |
---|
64 | return xClip( ( (w0*P0 + w1*P1 + round) >> shift ) + offset ); |
---|
65 | } |
---|
66 | inline Pel TComWeightPrediction::weightUnidir( Int w0, Pel P0, Int round, Int shift, Int offset) |
---|
67 | { |
---|
68 | return xClip( ( (w0*P0 + round) >> shift ) + offset ); |
---|
69 | } |
---|
70 | |
---|
71 | #endif // WEIGHT_PRED |
---|
72 | |
---|
73 | #endif |
---|
74 | |
---|
75 | |
---|