1 | |
---|
2 | |
---|
3 | |
---|
4 | #ifndef __TRENFILTER__ |
---|
5 | #define __TRENFILTER__ |
---|
6 | |
---|
7 | #include "../TLibCommon/CommonDef.h" |
---|
8 | #include "TRenImage.h" |
---|
9 | #include "../TLibCommon/TComPredFilter.h" |
---|
10 | |
---|
11 | typedef Int (TComPredFilter::*FpChromaIntFilt) ( Pel*, Int ); |
---|
12 | |
---|
13 | class TRenFilter |
---|
14 | { |
---|
15 | public: |
---|
16 | |
---|
17 | /////////// Helpers //////// |
---|
18 | static Void setSubPelShiftLUT ( Int iLutPrec, Int** piSubPelShiftLUT, Int iShift ); |
---|
19 | static Void setupZLUT ( Bool bBlendUseDistWeight, Int iBlendZThresPerc, Int iRelDistToLeft, Int** ppiBaseShiftLUTLeft, Int** ppiBaseShiftLUTRight, Int& riBlendZThres, Int& riBlendDistWeight, Int* piInvZLUTLeft, Int* piInvZLUTRight ); |
---|
20 | static Void filledToUsedPelMap( PelImage* pcFilledImage, PelImage* pcUsedPelsImage, Int iUsedPelMapMarExt ); |
---|
21 | |
---|
22 | /////////// Copy /////////// |
---|
23 | static Void copy( Pel* pcInputPlaneData, Int iInputStride, Int iWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride); |
---|
24 | |
---|
25 | /////////// Horizontal Mirroring /////////// |
---|
26 | template <typename T> static Void mirrorHor( TRenImage<T> *pcInputImage ); |
---|
27 | //Plane |
---|
28 | template <typename T> static Void mirrorHor( TRenImagePlane<T> *pcImagePlane ); |
---|
29 | |
---|
30 | /////////// Comparison /////////// |
---|
31 | |
---|
32 | static Int64 SSE ( PelImagePlane* pcInputPlane1, PelImagePlane* pcInputPlane2 ); |
---|
33 | static Int64 SSE ( Pel* piSrc1, Int iSrcStride1, Int iWidth, Int iHeight, Pel* piSrc2, Int iSrcStride2 ); |
---|
34 | |
---|
35 | template <typename T> static Bool compare (TRenImage<T> *pcInputImage1 , TRenImage<T> *pcInputImage2); |
---|
36 | //Plane |
---|
37 | template <typename T> static Bool compare (TRenImagePlane<T>* pcInputPlane1, TRenImagePlane<T>* pcInputPlane2 ); |
---|
38 | |
---|
39 | /////////// other Filters /////////// |
---|
40 | static Void binominal ( PelImage* pcInputImage, PelImage* pcOutputPlane, UInt uiSize); |
---|
41 | static Void binominal ( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, UInt uiSize ); |
---|
42 | |
---|
43 | static Void lineMedian3( PelImage* pcImage ); |
---|
44 | static Void convRect ( PelImage* pcImage, UInt uiSize); |
---|
45 | static Void laplace ( DoubleImage* pcInputImage, DoubleImage* pcOutputImage); |
---|
46 | static Void diffHorSym ( PelImage* pcInputImage, IntImage* pcOutputImage); |
---|
47 | |
---|
48 | //Plane |
---|
49 | static Void diffHorSym (PelImagePlane* pcInputPlane, IntImagePlane* pcOutputPlane); |
---|
50 | |
---|
51 | /////////// Convolution /////////// |
---|
52 | static Void conv (PelImage* pcImage, DoubleImage* pcKernel); |
---|
53 | |
---|
54 | /////////// InterPolation /////////// |
---|
55 | static Pel interpCHSpline(Double dX, Double dS0, Double dS1, Int iQ0, Int iQ1, Int iQ2, Int iQ3); |
---|
56 | |
---|
57 | |
---|
58 | /////////// HEVC/ binomial Up and Down sampling /////////// |
---|
59 | //// Down sampling (binomial) |
---|
60 | // Horizontally |
---|
61 | static Void sampleHorDown (Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight , Pel* pcOutputPlaneData, Int iOutputStride ); |
---|
62 | static Void sampleCHorDown (Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iInputHeight, Pel* pcOutputPlaneData, Int iOutputStride ); |
---|
63 | // 444->420 and horizontally |
---|
64 | static Void sampleCDownHorDown(Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iInputHeight, Pel* pcOutputPlaneData, Int iOutputStride ); |
---|
65 | |
---|
66 | //// Up sampling (HEVC 8/4 tap) |
---|
67 | // Horizontally |
---|
68 | static Void sampleHorUp (Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ); |
---|
69 | static Void sampleCHorUp (Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ); |
---|
70 | // 420->444 and horizontally |
---|
71 | static Void sampleCUpHorUp (Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ); |
---|
72 | |
---|
73 | //// Down sampling (13 tap) |
---|
74 | |
---|
75 | static Void sampleDown2Tap13 ( Pel* pcInputPlaneData, Int iInputStride, Int iWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride ); |
---|
76 | // Plane |
---|
77 | static Void sampleHorDown2Tap13(PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad); |
---|
78 | static Void sampleVerDown2Tap13(PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad); |
---|
79 | static Void sampleDown2Tap13 (PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane); |
---|
80 | // Image |
---|
81 | static Void sampleDown2Tap13 (PelImage* pcInputImage, PelImage* pcOutputImage); |
---|
82 | static Void sampleUp2Tap13 (PelImage* pcInputImage, PelImage* pcOutImage ); |
---|
83 | private: |
---|
84 | |
---|
85 | // Helper Functions |
---|
86 | static inline Pel xMedian3 (Pel* pcData); |
---|
87 | static Void xDilate (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iSize, Bool bVerticalDir, Bool bToTopOrLeft ); |
---|
88 | |
---|
89 | // Down sampling (binomial) |
---|
90 | static Void xSampleDownHor2 (Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride ); |
---|
91 | static Void xSampleDownHor4 (Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride ); |
---|
92 | static Void xSampleDownHor8 (Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride ); |
---|
93 | |
---|
94 | static Void xSampleDownVer2 (Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iSrcHeight, Pel* piDst, Int iDstStride ); |
---|
95 | |
---|
96 | // Up sampling (8/4-Tap HEVC) |
---|
97 | static Void xInterpVerChroma(Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter); |
---|
98 | static Void xInterpHorChroma(Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter); |
---|
99 | static Void xDistributeArray(Pel* pcSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* pcDst, Int iDstStride, Int iDstStepX, Int iDstStepY ); |
---|
100 | |
---|
101 | // Binominal Filtering |
---|
102 | static Pel xFiltBinom3 (Pel* pcInputData, Int iStride ); |
---|
103 | static Pel xFiltBinom5 (Pel* pcInputData, Int iStride ); |
---|
104 | static Pel xFiltBinom7 (Pel* pcInputData, Int iStride ); |
---|
105 | static Pel xFiltBinom9 (Pel* pcInputData, Int iStride ); |
---|
106 | }; |
---|
107 | |
---|
108 | |
---|
109 | #endif //__TRENFILTER__ |
---|