source: 3DVCSoftware/branches/0.3-ericsson/source/Lib/TLibCommon/TComWeightPrediction.h

Last change on this file was 2, checked in by hhi, 13 years ago

inital import

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
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
23class TComWeightPrediction
24{
25  wpScalingParam  m_wp0[3], m_wp1[3];
26  Int             m_ibdi;
27
28public:
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
46inline  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
54inline  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}
58inline  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
Note: See TracBrowser for help on using the repository browser.