1 | |
---|
2 | |
---|
3 | #ifndef __TCOMWEDGELET__ |
---|
4 | #define __TCOMWEDGELET__ |
---|
5 | |
---|
6 | // Include files |
---|
7 | #include <assert.h> |
---|
8 | #include "CommonDef.h" |
---|
9 | |
---|
10 | #include <vector> |
---|
11 | |
---|
12 | |
---|
13 | enum WedgeResolution |
---|
14 | { |
---|
15 | DOUBLE_PEL, |
---|
16 | FULL_PEL, |
---|
17 | HALF_PEL |
---|
18 | }; |
---|
19 | |
---|
20 | enum WedgeDist |
---|
21 | { |
---|
22 | WedgeDist_SAD = 0, |
---|
23 | WedgeDist_SSE = 4, |
---|
24 | }; |
---|
25 | |
---|
26 | // ==================================================================================================================== |
---|
27 | // Class definition TComWedgelet |
---|
28 | // ==================================================================================================================== |
---|
29 | class TComWedgelet |
---|
30 | { |
---|
31 | private: |
---|
32 | UChar m_uhXs; // line start X pos |
---|
33 | UChar m_uhYs; // line start Y pos |
---|
34 | UChar m_uhXe; // line end X pos |
---|
35 | UChar m_uhYe; // line end Y pos |
---|
36 | UChar m_uhOri; // orientation index |
---|
37 | WedgeResolution m_eWedgeRes; // start/end pos resolution |
---|
38 | |
---|
39 | UInt m_uiWidth; |
---|
40 | UInt m_uiHeight; |
---|
41 | |
---|
42 | Bool* m_pbPattern; |
---|
43 | |
---|
44 | Void xGenerateWedgePattern(); |
---|
45 | Void xDrawEdgeLine( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, Bool* pbPattern, Int iPatternStride ); |
---|
46 | |
---|
47 | public: |
---|
48 | TComWedgelet( UInt uiWidth, UInt uiHeight ); |
---|
49 | TComWedgelet( const TComWedgelet &rcWedge ); |
---|
50 | virtual ~TComWedgelet(); |
---|
51 | |
---|
52 | Void create ( UInt iWidth, UInt iHeight ); ///< create wedgelet pattern |
---|
53 | Void destroy(); ///< destroy wedgelet pattern |
---|
54 | Void clear (); ///< clear wedgelet pattern |
---|
55 | |
---|
56 | UInt getWidth () { return m_uiWidth; } |
---|
57 | UInt getStride () { return m_uiWidth; } |
---|
58 | UInt getHeight () { return m_uiHeight; } |
---|
59 | WedgeResolution getWedgeRes() { return m_eWedgeRes; } |
---|
60 | Bool* getPattern () { return m_pbPattern; } |
---|
61 | UChar getStartX () { return m_uhXs; } |
---|
62 | UChar getStartY () { return m_uhYs; } |
---|
63 | UChar getEndX () { return m_uhXe; } |
---|
64 | UChar getEndY () { return m_uhYe; } |
---|
65 | UChar getOri () { return m_uhOri; } |
---|
66 | |
---|
67 | Void setWedgelet( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UChar uhOri, WedgeResolution eWedgeRes ); |
---|
68 | |
---|
69 | Bool checkNotPlain(); |
---|
70 | Bool checkNotIdentical( Bool* pbRefPattern ); |
---|
71 | Bool checkNotInvIdentical( Bool* pbRefPattern ); |
---|
72 | |
---|
73 | Bool checkPredDirAbovePossible( UInt uiPredDirBlockSize, UInt uiPredDirBlockOffsett ); |
---|
74 | Bool checkPredDirLeftPossible ( UInt uiPredDirBlockSize, UInt uiPredDirBlockOffsett ); |
---|
75 | |
---|
76 | Void getPredDirStartEndAbove( UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset, Int iDeltaEnd ); |
---|
77 | Void getPredDirStartEndLeft ( UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset, Int iDeltaEnd ); |
---|
78 | }; // END CLASS DEFINITION TComWedgelet |
---|
79 | |
---|
80 | // type definition wedgelet pattern list |
---|
81 | typedef std::vector<TComWedgelet> WedgeList; |
---|
82 | |
---|
83 | // ==================================================================================================================== |
---|
84 | // Class definition TComWedgeRef |
---|
85 | // ==================================================================================================================== |
---|
86 | class TComWedgeRef |
---|
87 | { |
---|
88 | private: |
---|
89 | UChar m_uhXs; // line start X pos |
---|
90 | UChar m_uhYs; // line start Y pos |
---|
91 | UChar m_uhXe; // line end X pos |
---|
92 | UChar m_uhYe; // line end Y pos |
---|
93 | UInt m_uiRefIdx; // index of corresponding pattern of TComWedgelet object in wedge list |
---|
94 | |
---|
95 | public: |
---|
96 | TComWedgeRef() {} |
---|
97 | virtual ~TComWedgeRef() {} |
---|
98 | |
---|
99 | UChar getStartX () { return m_uhXs; } |
---|
100 | UChar getStartY () { return m_uhYs; } |
---|
101 | UChar getEndX () { return m_uhXe; } |
---|
102 | UChar getEndY () { return m_uhYe; } |
---|
103 | UInt getRefIdx () { return m_uiRefIdx; } |
---|
104 | |
---|
105 | Void setWedgeRef( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UInt uiRefIdx ) { m_uhXs = uhXs; m_uhYs = uhYs; m_uhXe = uhXe; m_uhYe = uhYe; m_uiRefIdx = uiRefIdx; } |
---|
106 | }; // END CLASS DEFINITION TComWedgeRef |
---|
107 | |
---|
108 | // type definition wedgelet reference list |
---|
109 | typedef std::vector<TComWedgeRef> WedgeRefList; |
---|
110 | |
---|
111 | // ==================================================================================================================== |
---|
112 | // Function definition roftoi (mathematically correct rounding of float to int) |
---|
113 | // ==================================================================================================================== |
---|
114 | __inline Int roftoi( Double value ) |
---|
115 | { |
---|
116 | (value < -0.5) ? (value -= 0.5) : (value += 0.5); |
---|
117 | return ( (Int)value ); |
---|
118 | } |
---|
119 | #endif // __TCOMWEDGELET__ |
---|