1 | |
---|
2 | |
---|
3 | /** \file TComPattern.h |
---|
4 | \brief neighbouring pixel access classes (header) |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef __TCOMPATTERN__ |
---|
8 | #define __TCOMPATTERN__ |
---|
9 | |
---|
10 | // Include files |
---|
11 | #include <stdio.h> |
---|
12 | #include "CommonDef.h" |
---|
13 | |
---|
14 | // ==================================================================================================================== |
---|
15 | // Class definition |
---|
16 | // ==================================================================================================================== |
---|
17 | |
---|
18 | class TComDataCU; |
---|
19 | |
---|
20 | /// neighbouring pixel access class for one component |
---|
21 | class TComPatternParam |
---|
22 | { |
---|
23 | private: |
---|
24 | Int m_iOffsetLeft; |
---|
25 | Int m_iOffsetRight; |
---|
26 | Int m_iOffsetAbove; |
---|
27 | Int m_iOffsetBottom; |
---|
28 | Pel* m_piPatternOrigin; |
---|
29 | |
---|
30 | public: |
---|
31 | Int m_iROIWidth; |
---|
32 | Int m_iROIHeight; |
---|
33 | Int m_iPatternStride; |
---|
34 | |
---|
35 | /// return starting position of buffer |
---|
36 | Pel* getPatternOrigin() { return m_piPatternOrigin; } |
---|
37 | |
---|
38 | /// return starting position of ROI (ROI = &pattern[AboveOffset][LeftOffset]) |
---|
39 | __inline Pel* getROIOrigin() |
---|
40 | { |
---|
41 | return m_piPatternOrigin + m_iPatternStride * m_iOffsetAbove + m_iOffsetLeft; |
---|
42 | } |
---|
43 | |
---|
44 | /// set parameters from Pel buffer for accessing neighbouring pixels |
---|
45 | Void setPatternParamPel ( Pel* piTexture, |
---|
46 | Int iRoiWidth, |
---|
47 | Int iRoiHeight, |
---|
48 | Int iStride, |
---|
49 | Int iOffsetLeft, |
---|
50 | Int iOffsetRight, |
---|
51 | Int iOffsetAbove, |
---|
52 | Int iOffsetBottom ); |
---|
53 | |
---|
54 | /// set parameters of one color component from CU data for accessing neighbouring pixels |
---|
55 | Void setPatternParamCU ( TComDataCU* pcCU, |
---|
56 | UChar iComp, |
---|
57 | UChar iRoiWidth, |
---|
58 | UChar iRoiHeight, |
---|
59 | Int iOffsetLeft, |
---|
60 | Int iOffsetRight, |
---|
61 | Int iOffsetAbove, |
---|
62 | Int iOffsetBottom, |
---|
63 | UInt uiPartDepth, |
---|
64 | UInt uiAbsZorderIdx, |
---|
65 | Bool bPrdDepthMap = false ); |
---|
66 | }; |
---|
67 | |
---|
68 | /// neighbouring pixel access class for all components |
---|
69 | class TComPattern |
---|
70 | { |
---|
71 | private: |
---|
72 | TComPatternParam m_cPatternY; |
---|
73 | TComPatternParam m_cPatternCb; |
---|
74 | TComPatternParam m_cPatternCr; |
---|
75 | #if MN_DC_PRED_FILTER |
---|
76 | Bool m_bAboveFlagForDCFilt; |
---|
77 | Bool m_bLeftFlagForDCFilt; |
---|
78 | Bool m_bDCPredFilterFlag; |
---|
79 | #endif |
---|
80 | |
---|
81 | #if LM_CHROMA |
---|
82 | Bool m_bLeftAvailable; |
---|
83 | Bool m_bAboveAvailable; |
---|
84 | #endif |
---|
85 | |
---|
86 | public: |
---|
87 | |
---|
88 | // ROI & pattern information, (ROI = &pattern[AboveOffset][LeftOffset]) |
---|
89 | Pel* getROIY() { return m_cPatternY.getROIOrigin(); } |
---|
90 | Int getROIYWidth() { return m_cPatternY.m_iROIWidth; } |
---|
91 | Int getROIYHeight() { return m_cPatternY.m_iROIHeight; } |
---|
92 | Int getPatternLStride() { return m_cPatternY.m_iPatternStride; } |
---|
93 | #if MN_DC_PRED_FILTER |
---|
94 | Bool getDCPredFilterFlag() { return m_bDCPredFilterFlag; } |
---|
95 | #endif |
---|
96 | |
---|
97 | // access functions of ADI buffers |
---|
98 | Int* getAdiOrgBuf ( Int iCuWidth, Int iCuHeight, Int* piAdiBuf ); |
---|
99 | Int* getAdiCbBuf ( Int iCuWidth, Int iCuHeight, Int* piAdiBuf ); |
---|
100 | Int* getAdiCrBuf ( Int iCuWidth, Int iCuHeight, Int* piAdiBuf ); |
---|
101 | |
---|
102 | #if QC_MDIS |
---|
103 | #if HHI_DISABLE_INTRA_SMOOTHING_DEPTH |
---|
104 | Int* getPredictorPtr ( UInt uiDirMode, UInt uiWidthBits, Int iCuWidth, Int iCuHeight, Int* piAdiBuf, Bool bDepth = false ); |
---|
105 | #else |
---|
106 | Int* getPredictorPtr ( UInt uiDirMode, UInt uiWidthBits, Int iCuWidth, Int iCuHeight, Int* piAdiBuf ); |
---|
107 | #endif |
---|
108 | #endif //QC_MDIS |
---|
109 | // ------------------------------------------------------------------------------------------------------------------- |
---|
110 | // initialization functions |
---|
111 | // ------------------------------------------------------------------------------------------------------------------- |
---|
112 | |
---|
113 | /// set parameters from Pel buffers for accessing neighbouring pixels |
---|
114 | Void initPattern ( Pel* piY, |
---|
115 | Pel* piCb, |
---|
116 | Pel* piCr, |
---|
117 | Int iRoiWidth, |
---|
118 | Int iRoiHeight, |
---|
119 | Int iStride, |
---|
120 | Int iOffsetLeft, |
---|
121 | Int iOffsetRight, |
---|
122 | Int iOffsetAbove, |
---|
123 | Int iOffsetBottom ); |
---|
124 | |
---|
125 | /// set parameters from CU data for accessing neighbouring pixels |
---|
126 | Void initPattern ( TComDataCU* pcCU, |
---|
127 | UInt uiPartDepth, |
---|
128 | UInt uiAbsPartIdx, |
---|
129 | Bool bPrdDepthMap = false ); |
---|
130 | |
---|
131 | /// set luma parameters from CU data for accessing ADI data |
---|
132 | Void initAdiPattern ( TComDataCU* pcCU, |
---|
133 | UInt uiZorderIdxInPart, |
---|
134 | UInt uiPartDepth, |
---|
135 | Int* piAdiBuf, |
---|
136 | Int iOrgBufStride, |
---|
137 | Int iOrgBufHeight, |
---|
138 | Bool& bAbove, |
---|
139 | Bool& bLeft, |
---|
140 | Bool bPrdDepthMap = false ); |
---|
141 | |
---|
142 | /// set chroma parameters from CU data for accessing ADI data |
---|
143 | Void initAdiPatternChroma ( TComDataCU* pcCU, |
---|
144 | UInt uiZorderIdxInPart, |
---|
145 | UInt uiPartDepth, |
---|
146 | Int* piAdiBuf, |
---|
147 | Int iOrgBufStride, |
---|
148 | Int iOrgBufHeight, |
---|
149 | Bool& bAbove, |
---|
150 | Bool& bLeft ); |
---|
151 | |
---|
152 | #if LM_CHROMA |
---|
153 | Bool isLeftAvailable() { return m_bLeftAvailable; } |
---|
154 | Bool isAboveAvailable() { return m_bAboveAvailable; } |
---|
155 | #endif |
---|
156 | |
---|
157 | #if (CONSTRAINED_INTRA_PRED || REFERENCE_SAMPLE_PADDING) |
---|
158 | private: |
---|
159 | |
---|
160 | #if REFERENCE_SAMPLE_PADDING |
---|
161 | /// padding of unavailable reference samples for intra prediction |
---|
162 | Void fillReferenceSamples ( TComDataCU* pcCU, Pel* piRoiOrigin, Int* piAdiTemp, Bool* bNeighborFlags, Int iNumIntraNeighbor, Int iUnitSize, Int iNumUnitsInCu, Int iTotalUnits, UInt uiCuWidth, UInt uiCuHeight, UInt uiWidth, UInt uiHeight, Int iPicStride, Bool bPrdDepthMap ); |
---|
163 | #endif |
---|
164 | #if CONSTRAINED_INTRA_PRED |
---|
165 | /// constrained intra prediction |
---|
166 | Bool isAboveLeftAvailableForCIP ( TComDataCU* pcCU, UInt uiPartIdxLT ); |
---|
167 | #if REFERENCE_SAMPLE_PADDING |
---|
168 | Int isAboveAvailableForCIP ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags ); |
---|
169 | Int isLeftAvailableForCIP ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags ); |
---|
170 | Int isAboveRightAvailableForCIP ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags ); |
---|
171 | Int isBelowLeftAvailableForCIP ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags ); |
---|
172 | #else |
---|
173 | Bool isAboveAvailableForCIP ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT ); |
---|
174 | Bool isLeftAvailableForCIP ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB ); |
---|
175 | Bool isAboveRightAvailableForCIP ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT ); |
---|
176 | Bool isBelowLeftAvailableForCIP ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB ); |
---|
177 | #endif |
---|
178 | #endif // CONSTRAINED_INTRA_PRED |
---|
179 | #endif |
---|
180 | }; |
---|
181 | |
---|
182 | #endif // __TCOMPATTERN__ |
---|
183 | |
---|