source: 3DVCSoftware/branches/0.2-poznan-univ/source/Lib/TLibCommon/TComWeightPrediction.h @ 15

Last change on this file since 15 was 12, checked in by poznan-univ, 13 years ago

Poznan Tools

  • Depth base motion vector prediction
  • Property svn:eol-style set to native
File size: 2.9 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#if POZNAN_EIVD
40  Void  addWeightBi_EIVD( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, wpScalingParam *wp1, TComYuv* rpcYuvDst, Bool bRound=true );
41  Void  addWeightUni_EIVD( TComYuv* pcYuvSrc0, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, TComYuv* rpcYuvDst );
42
43  Void  xWeightedPredictionUni_EIVD( TComDataCU* pcCU, TComYuv* pcYuvSrc, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx );
44  Void  xWeightedPredictionBi_EIVD( 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
54inline  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
62inline  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}
66inline  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
Note: See TracBrowser for help on using the repository browser.