1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2013, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file TComPattern.h |
---|
35 | \brief neighbouring pixel access classes (header) |
---|
36 | */ |
---|
37 | |
---|
38 | #ifndef __TCOMPATTERN__ |
---|
39 | #define __TCOMPATTERN__ |
---|
40 | |
---|
41 | // Include files |
---|
42 | #include <stdio.h> |
---|
43 | #include "CommonDef.h" |
---|
44 | |
---|
45 | //! \ingroup TLibCommon |
---|
46 | //! \{ |
---|
47 | |
---|
48 | // ==================================================================================================================== |
---|
49 | // Class definition |
---|
50 | // ==================================================================================================================== |
---|
51 | |
---|
52 | class TComDataCU; |
---|
53 | |
---|
54 | /// neighbouring pixel access class for one component |
---|
55 | class TComPatternParam |
---|
56 | { |
---|
57 | private: |
---|
58 | Int m_iOffsetLeft; |
---|
59 | Int m_iOffsetAbove; |
---|
60 | Pel* m_piPatternOrigin; |
---|
61 | |
---|
62 | public: |
---|
63 | Int m_iROIWidth; |
---|
64 | Int m_iROIHeight; |
---|
65 | Int m_iPatternStride; |
---|
66 | |
---|
67 | /// return starting position of buffer |
---|
68 | Pel* getPatternOrigin() { return m_piPatternOrigin; } |
---|
69 | |
---|
70 | /// return starting position of ROI (ROI = &pattern[AboveOffset][LeftOffset]) |
---|
71 | __inline Pel* getROIOrigin() |
---|
72 | { |
---|
73 | return m_piPatternOrigin + m_iPatternStride * m_iOffsetAbove + m_iOffsetLeft; |
---|
74 | } |
---|
75 | |
---|
76 | /// set parameters from Pel buffer for accessing neighbouring pixels |
---|
77 | Void setPatternParamPel ( Pel* piTexture, |
---|
78 | Int iRoiWidth, |
---|
79 | Int iRoiHeight, |
---|
80 | Int iStride, |
---|
81 | Int iOffsetLeft, |
---|
82 | Int iOffsetAbove ); |
---|
83 | |
---|
84 | /// set parameters of one color component from CU data for accessing neighbouring pixels |
---|
85 | Void setPatternParamCU ( TComDataCU* pcCU, |
---|
86 | UChar iComp, |
---|
87 | UChar iRoiWidth, |
---|
88 | UChar iRoiHeight, |
---|
89 | Int iOffsetLeft, |
---|
90 | Int iOffsetAbove, |
---|
91 | UInt uiAbsZorderIdx ); |
---|
92 | }; |
---|
93 | |
---|
94 | /// neighbouring pixel access class for all components |
---|
95 | class TComPattern |
---|
96 | { |
---|
97 | private: |
---|
98 | TComPatternParam m_cPatternY; |
---|
99 | TComPatternParam m_cPatternCb; |
---|
100 | TComPatternParam m_cPatternCr; |
---|
101 | #if H_3D_IC |
---|
102 | Bool m_bICFlag; |
---|
103 | #endif |
---|
104 | #if LGE_INTER_SDC_E0156 |
---|
105 | Bool m_bSDCMRSADFlag; |
---|
106 | #endif |
---|
107 | static const UChar m_aucIntraFilter[5]; |
---|
108 | |
---|
109 | public: |
---|
110 | |
---|
111 | // ROI & pattern information, (ROI = &pattern[AboveOffset][LeftOffset]) |
---|
112 | Pel* getROIY() { return m_cPatternY.getROIOrigin(); } |
---|
113 | Int getROIYWidth() { return m_cPatternY.m_iROIWidth; } |
---|
114 | Int getROIYHeight() { return m_cPatternY.m_iROIHeight; } |
---|
115 | Int getPatternLStride() { return m_cPatternY.m_iPatternStride; } |
---|
116 | |
---|
117 | #if H_3D_IC |
---|
118 | Bool getICFlag() { return m_bICFlag; } |
---|
119 | Void setICFlag( Bool bICFlag ) { m_bICFlag = bICFlag; } |
---|
120 | #endif |
---|
121 | #if LGE_INTER_SDC_E0156 |
---|
122 | Bool getSDCMRSADFlag() { return m_bSDCMRSADFlag; } |
---|
123 | Void setSDCMRSADFlag( Bool bSDCMRSADFlag ) { m_bSDCMRSADFlag = bSDCMRSADFlag; } |
---|
124 | #endif |
---|
125 | |
---|
126 | // access functions of ADI buffers |
---|
127 | Int* getAdiOrgBuf ( Int iCuWidth, Int iCuHeight, Int* piAdiBuf ); |
---|
128 | Int* getAdiCbBuf ( Int iCuWidth, Int iCuHeight, Int* piAdiBuf ); |
---|
129 | Int* getAdiCrBuf ( Int iCuWidth, Int iCuHeight, Int* piAdiBuf ); |
---|
130 | |
---|
131 | Int* getPredictorPtr ( UInt uiDirMode, UInt uiWidthBits, Int* piAdiBuf ); |
---|
132 | // ------------------------------------------------------------------------------------------------------------------- |
---|
133 | // initialization functions |
---|
134 | // ------------------------------------------------------------------------------------------------------------------- |
---|
135 | |
---|
136 | /// set parameters from Pel buffers for accessing neighbouring pixels |
---|
137 | Void initPattern ( Pel* piY, |
---|
138 | Pel* piCb, |
---|
139 | Pel* piCr, |
---|
140 | Int iRoiWidth, |
---|
141 | Int iRoiHeight, |
---|
142 | Int iStride, |
---|
143 | Int iOffsetLeft, |
---|
144 | Int iOffsetAbove ); |
---|
145 | |
---|
146 | /// set parameters from CU data for accessing neighbouring pixels |
---|
147 | Void initPattern ( TComDataCU* pcCU, |
---|
148 | UInt uiPartDepth, |
---|
149 | UInt uiAbsPartIdx ); |
---|
150 | |
---|
151 | /// set luma parameters from CU data for accessing ADI data |
---|
152 | Void initAdiPattern ( TComDataCU* pcCU, |
---|
153 | UInt uiZorderIdxInPart, |
---|
154 | UInt uiPartDepth, |
---|
155 | Int* piAdiBuf, |
---|
156 | Int iOrgBufStride, |
---|
157 | Int iOrgBufHeight, |
---|
158 | Bool& bAbove, |
---|
159 | Bool& bLeft |
---|
160 | ,Bool bLMmode = false // using for LM chroma or not |
---|
161 | ); |
---|
162 | |
---|
163 | /// set chroma parameters from CU data for accessing ADI data |
---|
164 | Void initAdiPatternChroma ( TComDataCU* pcCU, |
---|
165 | UInt uiZorderIdxInPart, |
---|
166 | UInt uiPartDepth, |
---|
167 | Int* piAdiBuf, |
---|
168 | Int iOrgBufStride, |
---|
169 | Int iOrgBufHeight, |
---|
170 | Bool& bAbove, |
---|
171 | Bool& bLeft ); |
---|
172 | |
---|
173 | private: |
---|
174 | |
---|
175 | /// padding of unavailable reference samples for intra prediction |
---|
176 | Void fillReferenceSamples (Int bitDepth, 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 bLMmode = false); |
---|
177 | |
---|
178 | |
---|
179 | /// constrained intra prediction |
---|
180 | Bool isAboveLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT ); |
---|
181 | Int isAboveAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags ); |
---|
182 | Int isLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags ); |
---|
183 | Int isAboveRightAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool* bValidFlags ); |
---|
184 | Int isBelowLeftAvailable ( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags ); |
---|
185 | |
---|
186 | }; |
---|
187 | |
---|
188 | //! \} |
---|
189 | |
---|
190 | #endif // __TCOMPATTERN__ |
---|