1 | |
---|
2 | |
---|
3 | /** \file TComYuv.h |
---|
4 | \brief general YUV buffer class (header) |
---|
5 | \todo this should be merged with TComPicYuv \n |
---|
6 | check usage of removeHighFreq function |
---|
7 | */ |
---|
8 | |
---|
9 | #ifndef __TCOMYUV__ |
---|
10 | #define __TCOMYUV__ |
---|
11 | #include <assert.h> |
---|
12 | #include "CommonDef.h" |
---|
13 | #include "TComPicYuv.h" |
---|
14 | |
---|
15 | // ==================================================================================================================== |
---|
16 | // Class definition |
---|
17 | // ==================================================================================================================== |
---|
18 | |
---|
19 | /// general YUV buffer class |
---|
20 | class TComYuv |
---|
21 | { |
---|
22 | private: |
---|
23 | |
---|
24 | // ------------------------------------------------------------------------------------------------------------------ |
---|
25 | // YUV buffer |
---|
26 | // ------------------------------------------------------------------------------------------------------------------ |
---|
27 | |
---|
28 | Pel* m_apiBufY; |
---|
29 | Pel* m_apiBufU; |
---|
30 | Pel* m_apiBufV; |
---|
31 | |
---|
32 | // ------------------------------------------------------------------------------------------------------------------ |
---|
33 | // Parameter for general YUV buffer usage |
---|
34 | // ------------------------------------------------------------------------------------------------------------------ |
---|
35 | |
---|
36 | UInt m_iWidth; |
---|
37 | UInt m_iHeight; |
---|
38 | UInt m_iCWidth; |
---|
39 | UInt m_iCHeight; |
---|
40 | |
---|
41 | public: |
---|
42 | |
---|
43 | TComYuv(); |
---|
44 | virtual ~TComYuv(); |
---|
45 | |
---|
46 | // ------------------------------------------------------------------------------------------------------------------ |
---|
47 | // Memory management |
---|
48 | // ------------------------------------------------------------------------------------------------------------------ |
---|
49 | |
---|
50 | Void create ( UInt iWidth, UInt iHeight ); ///< Create YUV buffer |
---|
51 | Void destroy (); ///< Destroy YUV buffer |
---|
52 | Void clear (); ///< clear YUV buffer |
---|
53 | |
---|
54 | // ------------------------------------------------------------------------------------------------------------------ |
---|
55 | // Copy, load, store YUV buffer |
---|
56 | // ------------------------------------------------------------------------------------------------------------------ |
---|
57 | |
---|
58 | // Copy YUV buffer to picture buffer |
---|
59 | Void copyToPicYuv ( TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth = 0, UInt uiPartIdx = 0 ); |
---|
60 | Void copyToPicLuma ( TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth = 0, UInt uiPartIdx = 0 ); |
---|
61 | Void copyToPicChroma ( TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth = 0, UInt uiPartIdx = 0 ); |
---|
62 | |
---|
63 | // Copy YUV buffer from picture buffer |
---|
64 | Void copyFromPicYuv ( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiAbsZorderIdx ); |
---|
65 | Void copyFromPicLuma ( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiAbsZorderIdx ); |
---|
66 | Void copyFromPicChroma ( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiAbsZorderIdx ); |
---|
67 | |
---|
68 | // Copy Small YUV buffer to the part of other Big YUV buffer |
---|
69 | Void copyToPartYuv ( TComYuv* pcYuvDst, UInt uiDstPartIdx ); |
---|
70 | Void copyToPartLuma ( TComYuv* pcYuvDst, UInt uiDstPartIdx ); |
---|
71 | Void copyToPartChroma ( TComYuv* pcYuvDst, UInt uiDstPartIdx ); |
---|
72 | |
---|
73 | // Copy the part of Big YUV buffer to other Small YUV buffer |
---|
74 | Void copyPartToYuv ( TComYuv* pcYuvDst, UInt uiSrcPartIdx ); |
---|
75 | Void copyPartToLuma ( TComYuv* pcYuvDst, UInt uiSrcPartIdx ); |
---|
76 | Void copyPartToChroma ( TComYuv* pcYuvDst, UInt uiSrcPartIdx ); |
---|
77 | |
---|
78 | // Copy YUV partition buffer to other YUV partition buffer |
---|
79 | Void copyPartToPartYuv ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiWidth, UInt uiHeight ); |
---|
80 | Void copyPartToPartLuma ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiWidth, UInt uiHeight ); |
---|
81 | Void copyPartToPartChroma ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiWidth, UInt uiHeight ); |
---|
82 | |
---|
83 | // ------------------------------------------------------------------------------------------------------------------ |
---|
84 | // Algebraic operation for YUV buffer |
---|
85 | // ------------------------------------------------------------------------------------------------------------------ |
---|
86 | |
---|
87 | // Clip(pcYuvSrc0 + pcYuvSrc1) -> m_apiBuf |
---|
88 | Void addClip ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ); |
---|
89 | Void addClipLuma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ); |
---|
90 | Void addClipChroma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ); |
---|
91 | //GT VSO |
---|
92 | Void addClipPartLuma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ); //GT |
---|
93 | //GT VSO end |
---|
94 | |
---|
95 | // pcYuvSrc0 - pcYuvSrc1 -> m_apiBuf |
---|
96 | Void subtract ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ); |
---|
97 | Void subtractLuma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ); |
---|
98 | Void subtractChroma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ); |
---|
99 | |
---|
100 | // (pcYuvSrc0 + pcYuvSrc1)/2 for YUV partition |
---|
101 | #ifdef ROUNDING_CONTROL_BIPRED |
---|
102 | Void addAvg ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iWidth, UInt iHeight, Bool bRound ); |
---|
103 | #endif |
---|
104 | Void addAvg ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iWidth, UInt iHeight ); |
---|
105 | |
---|
106 | // Remove High frequency |
---|
107 | Void removeHighFreq ( TComYuv* pcYuvSrc, UInt uiWidht, UInt uiHeight ); |
---|
108 | Void removeHighFreq ( TComYuv* pcYuvSrc, UInt uiPartIdx, UInt uiWidht, UInt uiHeight ); |
---|
109 | |
---|
110 | Void add ( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract = false ); |
---|
111 | Void addLuma ( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ); |
---|
112 | Void addChroma ( TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract ); |
---|
113 | |
---|
114 | Void clip ( Int iWidth, Int iHeight ); |
---|
115 | Void clipLuma ( Int iWidth, Int iHeight ); |
---|
116 | Void clipChroma ( Int iWidth, Int iHeight ); |
---|
117 | |
---|
118 | // ------------------------------------------------------------------------------------------------------------------ |
---|
119 | // Access function for YUV buffer |
---|
120 | // ------------------------------------------------------------------------------------------------------------------ |
---|
121 | |
---|
122 | // Access starting position of YUV buffer |
---|
123 | Pel* getLumaAddr () { return m_apiBufY; } |
---|
124 | Pel* getCbAddr () { return m_apiBufU; } |
---|
125 | Pel* getCrAddr () { return m_apiBufV; } |
---|
126 | |
---|
127 | // Access starting position of YUV partition unit buffer |
---|
128 | Pel* getLumaAddr ( UInt iPartUnitIdx ); |
---|
129 | Pel* getCbAddr ( UInt iPartUnitIdx ); |
---|
130 | Pel* getCrAddr ( UInt iPartUnitIdx ); |
---|
131 | |
---|
132 | // Access starting position of YUV transform unit buffer |
---|
133 | Pel* getLumaAddr ( UInt iTransUnitIdx, UInt iBlkSize ); |
---|
134 | Pel* getCbAddr ( UInt iTransUnitIdx, UInt iBlkSize ); |
---|
135 | Pel* getCrAddr ( UInt iTransUnitIdx, UInt iBlkSize ); |
---|
136 | |
---|
137 | // Get stride value of YUV buffer |
---|
138 | UInt getStride () { return m_iWidth; } |
---|
139 | UInt getCStride () { return m_iCWidth; } |
---|
140 | UInt getHeight () { return m_iHeight; } |
---|
141 | |
---|
142 | UInt getWidth () { return m_iWidth; } |
---|
143 | UInt getCHeight () { return m_iCHeight; } |
---|
144 | UInt getCWidth () { return m_iCWidth; } |
---|
145 | |
---|
146 | Void printout(); |
---|
147 | |
---|
148 | // ------------------------------------------------------------------------------------------------------------------ |
---|
149 | // Miscellaneous |
---|
150 | // ------------------------------------------------------------------------------------------------------------------ |
---|
151 | |
---|
152 | __inline Pel xClip (Pel x ) { return ( (x < 0) ? 0 : (x > (Pel)g_uiIBDI_MAX) ? (Pel)g_uiIBDI_MAX : x ); } |
---|
153 | |
---|
154 | #if HHI_DMM_INTRA |
---|
155 | UInt64 getLumaDistDCSAD( UInt uiPartUnitIdx, UInt iBlkSize ); |
---|
156 | UInt64 getLumaDistDCSAD( UInt iBlkSize ); |
---|
157 | #endif |
---|
158 | |
---|
159 | };// END CLASS DEFINITION TComYuv |
---|
160 | |
---|
161 | #endif // __TCOMYUV__ |
---|
162 | |
---|