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-2012, 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 TComDataCU.h |
---|
35 | \brief CU data structure (header) |
---|
36 | \todo not all entities are documented |
---|
37 | */ |
---|
38 | |
---|
39 | #ifndef _TCOMDATACU_ |
---|
40 | #define _TCOMDATACU_ |
---|
41 | |
---|
42 | #include <assert.h> |
---|
43 | |
---|
44 | // Include files |
---|
45 | #include "CommonDef.h" |
---|
46 | #include "TComMotionInfo.h" |
---|
47 | #include "TComSlice.h" |
---|
48 | #include "TComRdCost.h" |
---|
49 | #include "TComPattern.h" |
---|
50 | |
---|
51 | #include <algorithm> |
---|
52 | #include <vector> |
---|
53 | |
---|
54 | //! \ingroup TLibCommon |
---|
55 | //! \{ |
---|
56 | |
---|
57 | // ==================================================================================================================== |
---|
58 | // Non-deblocking in-loop filter processing block data structure |
---|
59 | // ==================================================================================================================== |
---|
60 | |
---|
61 | /// Non-deblocking filter processing block border tag |
---|
62 | enum NDBFBlockBorderTag |
---|
63 | { |
---|
64 | SGU_L = 0, |
---|
65 | SGU_R, |
---|
66 | SGU_T, |
---|
67 | SGU_B, |
---|
68 | SGU_TL, |
---|
69 | SGU_TR, |
---|
70 | SGU_BL, |
---|
71 | SGU_BR, |
---|
72 | NUM_SGU_BORDER |
---|
73 | }; |
---|
74 | |
---|
75 | /// Non-deblocking filter processing block information |
---|
76 | struct NDBFBlockInfo |
---|
77 | { |
---|
78 | Int tileID; //!< tile ID |
---|
79 | Int sliceID; //!< slice ID |
---|
80 | UInt startSU; //!< starting SU z-scan address in LCU |
---|
81 | UInt endSU; //!< ending SU z-scan address in LCU |
---|
82 | UInt widthSU; //!< number of SUs in width |
---|
83 | UInt heightSU; //!< number of SUs in height |
---|
84 | UInt posX; //!< top-left X coordinate in picture |
---|
85 | UInt posY; //!< top-left Y coordinate in picture |
---|
86 | UInt width; //!< number of pixels in width |
---|
87 | UInt height; //!< number of pixels in height |
---|
88 | Bool isBorderAvailable[NUM_SGU_BORDER]; //!< the border availabilities |
---|
89 | Bool allBordersAvailable; |
---|
90 | |
---|
91 | NDBFBlockInfo():tileID(0), sliceID(0), startSU(0), endSU(0) {} //!< constructor |
---|
92 | const NDBFBlockInfo& operator= (const NDBFBlockInfo& src); //!< "=" operator |
---|
93 | }; |
---|
94 | |
---|
95 | |
---|
96 | // ==================================================================================================================== |
---|
97 | // Class definition |
---|
98 | // ==================================================================================================================== |
---|
99 | |
---|
100 | /// CU data structure class |
---|
101 | class TComDataCU |
---|
102 | { |
---|
103 | private: |
---|
104 | |
---|
105 | // ------------------------------------------------------------------------------------------------------------------- |
---|
106 | // class pointers |
---|
107 | // ------------------------------------------------------------------------------------------------------------------- |
---|
108 | |
---|
109 | TComPic* m_pcPic; ///< picture class pointer |
---|
110 | TComSlice* m_pcSlice; ///< slice header pointer |
---|
111 | TComPattern* m_pcPattern; ///< neighbour access class pointer |
---|
112 | |
---|
113 | // ------------------------------------------------------------------------------------------------------------------- |
---|
114 | // CU description |
---|
115 | // ------------------------------------------------------------------------------------------------------------------- |
---|
116 | |
---|
117 | UInt m_uiCUAddr; ///< CU address in a slice |
---|
118 | UInt m_uiAbsIdxInLCU; ///< absolute address in a CU. It's Z scan order |
---|
119 | UInt m_uiCUPelX; ///< CU position in a pixel (X) |
---|
120 | UInt m_uiCUPelY; ///< CU position in a pixel (Y) |
---|
121 | UInt m_uiNumPartition; ///< total number of minimum partitions in a CU |
---|
122 | UChar* m_puhWidth; ///< array of widths |
---|
123 | UChar* m_puhHeight; ///< array of heights |
---|
124 | UChar* m_puhDepth; ///< array of depths |
---|
125 | Int m_unitSize; ///< size of a "minimum partition" |
---|
126 | |
---|
127 | #if SVC_EXTENSION |
---|
128 | UInt m_layerId; ///< layer id |
---|
129 | #endif |
---|
130 | |
---|
131 | // ------------------------------------------------------------------------------------------------------------------- |
---|
132 | // CU data |
---|
133 | // ------------------------------------------------------------------------------------------------------------------- |
---|
134 | #if SKIP_FLAG |
---|
135 | Bool* m_skipFlag; ///< array of skip flags |
---|
136 | #endif |
---|
137 | Char* m_pePartSize; ///< array of partition sizes |
---|
138 | Char* m_pePredMode; ///< array of prediction modes |
---|
139 | Bool* m_CUTransquantBypass; ///< array of cu_transquant_bypass flags |
---|
140 | Char* m_phQP; ///< array of QP values |
---|
141 | UChar* m_puhTrIdx; ///< array of transform indices |
---|
142 | UChar* m_puhTransformSkip[3];///< array of transform skipping flags |
---|
143 | #if !REMOVE_NSQT |
---|
144 | UChar* m_nsqtPartIdx; ///< array of absPartIdx mapping table, map zigzag to NSQT |
---|
145 | #endif |
---|
146 | UChar* m_puhCbf[3]; ///< array of coded block flags (CBF) |
---|
147 | TComCUMvField m_acCUMvField[2]; ///< array of motion vectors |
---|
148 | TCoeff* m_pcTrCoeffY; ///< transformed coefficient buffer (Y) |
---|
149 | TCoeff* m_pcTrCoeffCb; ///< transformed coefficient buffer (Cb) |
---|
150 | TCoeff* m_pcTrCoeffCr; ///< transformed coefficient buffer (Cr) |
---|
151 | #if ADAPTIVE_QP_SELECTION |
---|
152 | Int* m_pcArlCoeffY; ///< ARL coefficient buffer (Y) |
---|
153 | Int* m_pcArlCoeffCb; ///< ARL coefficient buffer (Cb) |
---|
154 | Int* m_pcArlCoeffCr; ///< ARL coefficient buffer (Cr) |
---|
155 | bool m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d |
---|
156 | |
---|
157 | static Int* m_pcGlbArlCoeffY; ///< ARL coefficient buffer (Y) |
---|
158 | static Int* m_pcGlbArlCoeffCb; ///< ARL coefficient buffer (Cb) |
---|
159 | static Int* m_pcGlbArlCoeffCr; ///< ARL coefficient buffer (Cr) |
---|
160 | #endif |
---|
161 | |
---|
162 | Pel* m_pcIPCMSampleY; ///< PCM sample buffer (Y) |
---|
163 | Pel* m_pcIPCMSampleCb; ///< PCM sample buffer (Cb) |
---|
164 | Pel* m_pcIPCMSampleCr; ///< PCM sample buffer (Cr) |
---|
165 | |
---|
166 | Int* m_piSliceSUMap; ///< pointer of slice ID map |
---|
167 | std::vector<NDBFBlockInfo> m_vNDFBlock; |
---|
168 | |
---|
169 | // ------------------------------------------------------------------------------------------------------------------- |
---|
170 | // neighbour access variables |
---|
171 | // ------------------------------------------------------------------------------------------------------------------- |
---|
172 | |
---|
173 | TComDataCU* m_pcCUAboveLeft; ///< pointer of above-left CU |
---|
174 | TComDataCU* m_pcCUAboveRight; ///< pointer of above-right CU |
---|
175 | TComDataCU* m_pcCUAbove; ///< pointer of above CU |
---|
176 | TComDataCU* m_pcCULeft; ///< pointer of left CU |
---|
177 | TComDataCU* m_apcCUColocated[2]; ///< pointer of temporally colocated CU's for both directions |
---|
178 | TComMvField m_cMvFieldA; ///< motion vector of position A |
---|
179 | TComMvField m_cMvFieldB; ///< motion vector of position B |
---|
180 | TComMvField m_cMvFieldC; ///< motion vector of position C |
---|
181 | TComMv m_cMvPred; ///< motion vector predictor |
---|
182 | |
---|
183 | // ------------------------------------------------------------------------------------------------------------------- |
---|
184 | // coding tool information |
---|
185 | // ------------------------------------------------------------------------------------------------------------------- |
---|
186 | |
---|
187 | Bool* m_pbMergeFlag; ///< array of merge flags |
---|
188 | UChar* m_puhMergeIndex; ///< array of merge candidate indices |
---|
189 | #if AMP_MRG |
---|
190 | Bool m_bIsMergeAMP; |
---|
191 | #endif |
---|
192 | UChar* m_puhLumaIntraDir; ///< array of intra directions (luma) |
---|
193 | UChar* m_puhChromaIntraDir; ///< array of intra directions (chroma) |
---|
194 | UChar* m_puhInterDir; ///< array of inter directions |
---|
195 | Char* m_apiMVPIdx[2]; ///< array of motion vector predictor candidates |
---|
196 | Char* m_apiMVPNum[2]; ///< array of number of possible motion vectors predictors |
---|
197 | Bool m_lcuAlfEnabled[3]; |
---|
198 | Bool* m_pbIPCMFlag; ///< array of intra_pcm flags |
---|
199 | |
---|
200 | Int m_numSucIPCM; ///< the number of succesive IPCM blocks associated with the current log2CUSize |
---|
201 | Bool m_lastCUSucIPCMFlag; ///< True indicates that the last CU is IPCM and shares the same root as the current CU. |
---|
202 | |
---|
203 | // ------------------------------------------------------------------------------------------------------------------- |
---|
204 | // misc. variables |
---|
205 | // ------------------------------------------------------------------------------------------------------------------- |
---|
206 | |
---|
207 | Bool m_bDecSubCu; ///< indicates decoder-mode |
---|
208 | Double m_dTotalCost; ///< sum of partition RD costs |
---|
209 | UInt m_uiTotalDistortion; ///< sum of partition distortion |
---|
210 | UInt m_uiTotalBits; ///< sum of partition bits |
---|
211 | UInt m_uiTotalBins; ///< sum of partition bins |
---|
212 | UInt* m_uiSliceStartCU; ///< Start CU address of current slice |
---|
213 | UInt* m_uiDependentSliceStartCU; ///< Start CU address of current slice |
---|
214 | Char m_codedQP; |
---|
215 | protected: |
---|
216 | |
---|
217 | /// add possible motion vector predictor candidates |
---|
218 | Bool xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
219 | Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
220 | |
---|
221 | Void deriveRightBottomIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB ); |
---|
222 | Bool xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx ); |
---|
223 | |
---|
224 | /// compute required bits to encode MVD (used in AMVP) |
---|
225 | UInt xGetMvdBits ( TComMv cMvd ); |
---|
226 | UInt xGetComponentBits ( Int iVal ); |
---|
227 | |
---|
228 | /// compute scaling factor from POC difference |
---|
229 | Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
230 | |
---|
231 | Void xDeriveCenterIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxCenter ); |
---|
232 | Bool xGetCenterCol( UInt uiPartIdx, RefPicList eRefPicList, int iRefIdx, TComMv *pcMv ); |
---|
233 | |
---|
234 | public: |
---|
235 | TComDataCU(); |
---|
236 | virtual ~TComDataCU(); |
---|
237 | |
---|
238 | // ------------------------------------------------------------------------------------------------------------------- |
---|
239 | // create / destroy / initialize / copy |
---|
240 | // ------------------------------------------------------------------------------------------------------------------- |
---|
241 | |
---|
242 | Void create ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize |
---|
243 | #if ADAPTIVE_QP_SELECTION |
---|
244 | , Bool bGlobalRMARLBuffer = false |
---|
245 | #endif |
---|
246 | ); |
---|
247 | Void destroy (); |
---|
248 | |
---|
249 | Void initCU ( TComPic* pcPic, UInt uiCUAddr ); |
---|
250 | Void initEstData ( UInt uiDepth, Int qp ); |
---|
251 | Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); |
---|
252 | Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
253 | |
---|
254 | Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
255 | Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ); |
---|
256 | Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
257 | |
---|
258 | Void copyToPic ( UChar uiDepth ); |
---|
259 | Void copyToPic ( UChar uiDepth, UInt uiPartIdx, UInt uiPartDepth ); |
---|
260 | |
---|
261 | // ------------------------------------------------------------------------------------------------------------------- |
---|
262 | // member functions for CU description |
---|
263 | // ------------------------------------------------------------------------------------------------------------------- |
---|
264 | |
---|
265 | TComPic* getPic () { return m_pcPic; } |
---|
266 | TComSlice* getSlice () { return m_pcSlice; } |
---|
267 | UInt& getAddr () { return m_uiCUAddr; } |
---|
268 | UInt& getZorderIdxInCU () { return m_uiAbsIdxInLCU; } |
---|
269 | UInt getSCUAddr (); |
---|
270 | UInt getCUPelX () { return m_uiCUPelX; } |
---|
271 | UInt getCUPelY () { return m_uiCUPelY; } |
---|
272 | TComPattern* getPattern () { return m_pcPattern; } |
---|
273 | |
---|
274 | UChar* getDepth () { return m_puhDepth; } |
---|
275 | UChar getDepth ( UInt uiIdx ) { return m_puhDepth[uiIdx]; } |
---|
276 | Void setDepth ( UInt uiIdx, UChar uh ) { m_puhDepth[uiIdx] = uh; } |
---|
277 | |
---|
278 | Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); |
---|
279 | |
---|
280 | // ------------------------------------------------------------------------------------------------------------------- |
---|
281 | // member functions for CU data |
---|
282 | // ------------------------------------------------------------------------------------------------------------------- |
---|
283 | |
---|
284 | Char* getPartitionSize () { return m_pePartSize; } |
---|
285 | PartSize getPartitionSize ( UInt uiIdx ) { return static_cast<PartSize>( m_pePartSize[uiIdx] ); } |
---|
286 | Void setPartitionSize ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh; } |
---|
287 | Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
288 | Void setCUTransquantBypassSubParts( bool flag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
289 | |
---|
290 | #if SKIP_FLAG |
---|
291 | Bool* getSkipFlag () { return m_skipFlag; } |
---|
292 | Bool getSkipFlag (UInt idx) { return m_skipFlag[idx]; } |
---|
293 | Void setSkipFlag ( UInt idx, Bool skip) { m_skipFlag[idx] = skip; } |
---|
294 | Void setSkipFlagSubParts ( Bool skip, UInt absPartIdx, UInt depth ); |
---|
295 | #endif |
---|
296 | |
---|
297 | Char* getPredictionMode () { return m_pePredMode; } |
---|
298 | PredMode getPredictionMode ( UInt uiIdx ) { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } |
---|
299 | Bool* getCUTransquantBypass () { return m_CUTransquantBypass; } |
---|
300 | Bool getCUTransquantBypass( UInt uiIdx ) { return m_CUTransquantBypass[uiIdx]; } |
---|
301 | Void setPredictionMode ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh; } |
---|
302 | Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
303 | |
---|
304 | UChar* getWidth () { return m_puhWidth; } |
---|
305 | UChar getWidth ( UInt uiIdx ) { return m_puhWidth[uiIdx]; } |
---|
306 | Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh; } |
---|
307 | |
---|
308 | UChar* getHeight () { return m_puhHeight; } |
---|
309 | UChar getHeight ( UInt uiIdx ) { return m_puhHeight[uiIdx]; } |
---|
310 | Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh; } |
---|
311 | |
---|
312 | Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
313 | |
---|
314 | Char* getQP () { return m_phQP; } |
---|
315 | Char getQP ( UInt uiIdx ) { return m_phQP[uiIdx]; } |
---|
316 | Void setQP ( UInt uiIdx, Char value ){ m_phQP[uiIdx] = value; } |
---|
317 | Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
318 | Int getLastValidPartIdx ( Int iAbsPartIdx ); |
---|
319 | Char getLastCodedQP ( UInt uiAbsPartIdx ); |
---|
320 | Void setQPSubCUs ( Int qp, TComDataCU* pcCU, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf ); |
---|
321 | Void setCodedQP ( Char qp ) { m_codedQP = qp; } |
---|
322 | Char getCodedQP () { return m_codedQP; } |
---|
323 | |
---|
324 | Bool isLosslessCoded(UInt absPartIdx); |
---|
325 | #if !REMOVE_NSQT |
---|
326 | UChar* getNSQTPartIdx () { return m_nsqtPartIdx; } |
---|
327 | UChar getNSQTPartIdx ( UInt idx ) { return m_nsqtPartIdx[idx]; } |
---|
328 | Void setNSQTIdxSubParts ( UInt absPartIdx, UInt depth ); |
---|
329 | Void setNSQTIdxSubParts ( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt trMode ); |
---|
330 | #endif |
---|
331 | |
---|
332 | UChar* getTransformIdx () { return m_puhTrIdx; } |
---|
333 | UChar getTransformIdx ( UInt uiIdx ) { return m_puhTrIdx[uiIdx]; } |
---|
334 | Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
335 | |
---|
336 | UChar* getTransformSkip ( TextType eType) { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]];} |
---|
337 | UChar getTransformSkip ( UInt uiIdx,TextType eType) { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]][uiIdx];} |
---|
338 | Void setTransformSkipSubParts ( UInt useTransformSkip, TextType eType, UInt uiAbsPartIdx, UInt uiDepth); |
---|
339 | Void setTransformSkipSubParts ( UInt useTransformSkipY, UInt useTransformSkipU, UInt useTransformSkipV, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
340 | |
---|
341 | UInt getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ); |
---|
342 | |
---|
343 | TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } |
---|
344 | |
---|
345 | TCoeff*& getCoeffY () { return m_pcTrCoeffY; } |
---|
346 | TCoeff*& getCoeffCb () { return m_pcTrCoeffCb; } |
---|
347 | TCoeff*& getCoeffCr () { return m_pcTrCoeffCr; } |
---|
348 | #if ADAPTIVE_QP_SELECTION |
---|
349 | Int*& getArlCoeffY () { return m_pcArlCoeffY; } |
---|
350 | Int*& getArlCoeffCb () { return m_pcArlCoeffCb; } |
---|
351 | Int*& getArlCoeffCr () { return m_pcArlCoeffCr; } |
---|
352 | #endif |
---|
353 | |
---|
354 | Pel*& getPCMSampleY () { return m_pcIPCMSampleY; } |
---|
355 | Pel*& getPCMSampleCb () { return m_pcIPCMSampleCb; } |
---|
356 | Pel*& getPCMSampleCr () { return m_pcIPCMSampleCr; } |
---|
357 | |
---|
358 | UChar getCbf ( UInt uiIdx, TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx]; } |
---|
359 | UChar* getCbf ( TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]]; } |
---|
360 | UChar getCbf ( UInt uiIdx, TextType eType, UInt uiTrDepth ) { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); } |
---|
361 | Void setCbf ( UInt uiIdx, TextType eType, UChar uh ) { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh; } |
---|
362 | Void clearCbf ( UInt uiIdx, TextType eType, UInt uiNumParts ); |
---|
363 | UChar getQtRootCbf ( UInt uiIdx ) { return getCbf( uiIdx, TEXT_LUMA, 0 ) || getCbf( uiIdx, TEXT_CHROMA_U, 0 ) || getCbf( uiIdx, TEXT_CHROMA_V, 0 ); } |
---|
364 | |
---|
365 | Void setCbfSubParts ( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
366 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
367 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
368 | |
---|
369 | // ------------------------------------------------------------------------------------------------------------------- |
---|
370 | // member functions for coding tool information |
---|
371 | // ------------------------------------------------------------------------------------------------------------------- |
---|
372 | |
---|
373 | Bool* getMergeFlag () { return m_pbMergeFlag; } |
---|
374 | Bool getMergeFlag ( UInt uiIdx ) { return m_pbMergeFlag[uiIdx]; } |
---|
375 | Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b; } |
---|
376 | Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
377 | |
---|
378 | UChar* getMergeIndex () { return m_puhMergeIndex; } |
---|
379 | UChar getMergeIndex ( UInt uiIdx ) { return m_puhMergeIndex[uiIdx]; } |
---|
380 | Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } |
---|
381 | Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
382 | template <typename T> |
---|
383 | Void setSubPart ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
384 | |
---|
385 | #if AMP_MRG |
---|
386 | Void setMergeAMP( Bool b ) { m_bIsMergeAMP = b; } |
---|
387 | Bool getMergeAMP( ) { return m_bIsMergeAMP; } |
---|
388 | #endif |
---|
389 | |
---|
390 | UChar* getLumaIntraDir () { return m_puhLumaIntraDir; } |
---|
391 | UChar getLumaIntraDir ( UInt uiIdx ) { return m_puhLumaIntraDir[uiIdx]; } |
---|
392 | Void setLumaIntraDir ( UInt uiIdx, UChar uh ) { m_puhLumaIntraDir[uiIdx] = uh; } |
---|
393 | Void setLumaIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
394 | |
---|
395 | UChar* getChromaIntraDir () { return m_puhChromaIntraDir; } |
---|
396 | UChar getChromaIntraDir ( UInt uiIdx ) { return m_puhChromaIntraDir[uiIdx]; } |
---|
397 | Void setChromaIntraDir ( UInt uiIdx, UChar uh ) { m_puhChromaIntraDir[uiIdx] = uh; } |
---|
398 | Void setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
399 | |
---|
400 | UChar* getInterDir () { return m_puhInterDir; } |
---|
401 | UChar getInterDir ( UInt uiIdx ) { return m_puhInterDir[uiIdx]; } |
---|
402 | Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh; } |
---|
403 | Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
404 | Bool getAlfLCUEnabled (Int compIdx) {return m_lcuAlfEnabled[compIdx]; } |
---|
405 | Void setAlfLCUEnabled (Bool b, Int compIdx) {m_lcuAlfEnabled[compIdx] = b; } |
---|
406 | Bool* getIPCMFlag () { return m_pbIPCMFlag; } |
---|
407 | Bool getIPCMFlag (UInt uiIdx ) { return m_pbIPCMFlag[uiIdx]; } |
---|
408 | Void setIPCMFlag (UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } |
---|
409 | Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth); |
---|
410 | |
---|
411 | Int getNumSucIPCM () { return m_numSucIPCM; } |
---|
412 | Void setNumSucIPCM ( Int num ) { m_numSucIPCM = num; } |
---|
413 | Bool getLastCUSucIPCMFlag () { return m_lastCUSucIPCMFlag; } |
---|
414 | Void setLastCUSucIPCMFlag ( Bool flg ) { m_lastCUSucIPCMFlag = flg; } |
---|
415 | |
---|
416 | /// get slice ID for SU |
---|
417 | Int getSUSliceID (UInt uiIdx) {return m_piSliceSUMap[uiIdx]; } |
---|
418 | |
---|
419 | /// get the pointer of slice ID map |
---|
420 | Int* getSliceSUMap () {return m_piSliceSUMap; } |
---|
421 | |
---|
422 | /// set the pointer of slice ID map |
---|
423 | Void setSliceSUMap (Int *pi) {m_piSliceSUMap = pi; } |
---|
424 | |
---|
425 | std::vector<NDBFBlockInfo>* getNDBFilterBlocks() {return &m_vNDFBlock;} |
---|
426 | Void setNDBFilterBlockBorderAvailability(UInt numLCUInPicWidth, UInt numLCUInPicHeight, UInt numSUInLCUWidth, UInt numSUInLCUHeight, UInt picWidth, UInt picHeight |
---|
427 | ,std::vector<Bool>& LFCrossSliceBoundary |
---|
428 | ,Bool bTopTileBoundary, Bool bDownTileBoundary, Bool bLeftTileBoundary, Bool bRightTileBoundary |
---|
429 | ,Bool bIndependentTileBoundaryEnabled ); |
---|
430 | // ------------------------------------------------------------------------------------------------------------------- |
---|
431 | // member functions for accessing partition information |
---|
432 | // ------------------------------------------------------------------------------------------------------------------- |
---|
433 | |
---|
434 | Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); |
---|
435 | UChar getNumPartInter (); |
---|
436 | Bool isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth); |
---|
437 | |
---|
438 | // ------------------------------------------------------------------------------------------------------------------- |
---|
439 | // member functions for motion vector |
---|
440 | // ------------------------------------------------------------------------------------------------------------------- |
---|
441 | |
---|
442 | Void getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); |
---|
443 | |
---|
444 | #if !SPS_AMVP_CLEANUP |
---|
445 | AMVP_MODE getAMVPMode ( UInt uiIdx ); |
---|
446 | #endif |
---|
447 | Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ); |
---|
448 | Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP); |
---|
449 | Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH); |
---|
450 | Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } |
---|
451 | Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) { return m_apiMVPIdx[eRefPicList][uiIdx]; } |
---|
452 | Char* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList]; } |
---|
453 | |
---|
454 | Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum; } |
---|
455 | Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) { return m_apiMVPNum[eRefPicList][uiIdx]; } |
---|
456 | Char* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList]; } |
---|
457 | |
---|
458 | Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
459 | Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
460 | |
---|
461 | Void clipMv ( TComMv& rcMv ); |
---|
462 | Void getMvPredLeft ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldA.getMv(); } |
---|
463 | Void getMvPredAbove ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldB.getMv(); } |
---|
464 | Void getMvPredAboveRight ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldC.getMv(); } |
---|
465 | |
---|
466 | Void compressMV (); |
---|
467 | |
---|
468 | #if SVC_EXTENSION |
---|
469 | Void setLayerId (UInt layerId) { m_layerId = layerId; } |
---|
470 | UInt getLayerId () { return m_layerId; } |
---|
471 | #endif |
---|
472 | |
---|
473 | // ------------------------------------------------------------------------------------------------------------------- |
---|
474 | // utility functions for neighbouring information |
---|
475 | // ------------------------------------------------------------------------------------------------------------------- |
---|
476 | |
---|
477 | TComDataCU* getCULeft () { return m_pcCULeft; } |
---|
478 | TComDataCU* getCUAbove () { return m_pcCUAbove; } |
---|
479 | TComDataCU* getCUAboveLeft () { return m_pcCUAboveLeft; } |
---|
480 | TComDataCU* getCUAboveRight () { return m_pcCUAboveRight; } |
---|
481 | TComDataCU* getCUColocated ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; } |
---|
482 | |
---|
483 | |
---|
484 | TComDataCU* getPULeft ( UInt& uiLPartUnitIdx, |
---|
485 | UInt uiCurrPartUnitIdx, |
---|
486 | Bool bEnforceSliceRestriction=true, |
---|
487 | Bool bEnforceDependentSliceRestriction=true, |
---|
488 | Bool bEnforceTileRestriction=true ); |
---|
489 | |
---|
490 | TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx, |
---|
491 | UInt uiCurrPartUnitIdx, |
---|
492 | Bool bEnforceSliceRestriction=true, |
---|
493 | Bool bEnforceDependentSliceRestriction=true, |
---|
494 | Bool MotionDataCompresssion = false, |
---|
495 | Bool planarAtLCUBoundary = false, |
---|
496 | Bool bEnforceTileRestriction=true ); |
---|
497 | |
---|
498 | TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceDependentSliceRestriction=true, Bool MotionDataCompresssion = false ); |
---|
499 | TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceDependentSliceRestriction=true, Bool MotionDataCompresssion = false ); |
---|
500 | TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceDependentSliceRestriction=true ); |
---|
501 | |
---|
502 | TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU, Bool bEnforceSliceRestriction=true, Bool bEnforceDependentSliceRestriction=true ); |
---|
503 | TComDataCU* getQpMinCuAbove ( UInt& aPartUnitIdx , UInt currAbsIdxInLCU, Bool enforceSliceRestriction=true, Bool enforceDependentSliceRestriction=true ); |
---|
504 | Char getRefQP ( UInt uiCurrAbsIdxInLCU ); |
---|
505 | |
---|
506 | TComDataCU* getPUAboveRightAdi ( UInt& uiARPartUnitIdx, UInt uiPuWidth, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceDependentSliceRestriction=true ); |
---|
507 | TComDataCU* getPUBelowLeftAdi ( UInt& uiBLPartUnitIdx, UInt uiPuHeight, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceDependentSliceRestriction=true ); |
---|
508 | |
---|
509 | Void deriveLeftRightTopIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
510 | Void deriveLeftBottomIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
511 | |
---|
512 | Void deriveLeftRightTopIdxAdi ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth ); |
---|
513 | Void deriveLeftBottomIdxAdi ( UInt& ruiPartIdxLB, UInt uiPartOffset, UInt uiPartDepth ); |
---|
514 | |
---|
515 | Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); |
---|
516 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ); |
---|
517 | Void deriveLeftRightTopIdxGeneral ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
518 | Void deriveLeftBottomIdxGeneral ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
519 | |
---|
520 | #if SVC_MVP |
---|
521 | Bool hasEqualMotion ( UInt uiAbsPartIdx, UChar uchInterDir, TComMvField* pcMvField ); |
---|
522 | #endif |
---|
523 | |
---|
524 | // ------------------------------------------------------------------------------------------------------------------- |
---|
525 | // member functions for modes |
---|
526 | // ------------------------------------------------------------------------------------------------------------------- |
---|
527 | |
---|
528 | #if INTRA_BL |
---|
529 | Void getBaseLumaBlk ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride ); |
---|
530 | Void getBaseChromaBlk ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride, UInt uiChromaId ); |
---|
531 | #endif |
---|
532 | #if INTRA_BL |
---|
533 | Bool isIntraBL ( UInt uiPartIdx ) { return m_pePredMode[ uiPartIdx ] == MODE_INTRA_BL; } |
---|
534 | Bool isIntra ( UInt uiPartIdx ) { return m_pePredMode[ uiPartIdx ] == MODE_INTRA || m_pePredMode[ uiPartIdx ] == MODE_INTRA_BL; } |
---|
535 | #else |
---|
536 | Bool isIntra ( UInt uiPartIdx ) { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } |
---|
537 | #endif |
---|
538 | Bool isSkipped ( UInt uiPartIdx ); ///< SKIP (no residual) |
---|
539 | Bool isBipredRestriction( UInt puIdx ); |
---|
540 | |
---|
541 | // ------------------------------------------------------------------------------------------------------------------- |
---|
542 | // member functions for symbol prediction (most probable / mode conversion) |
---|
543 | // ------------------------------------------------------------------------------------------------------------------- |
---|
544 | |
---|
545 | UInt getIntraSizeIdx ( UInt uiAbsPartIdx ); |
---|
546 | Void convertTransIdx ( UInt uiAbsPartIdx, UInt uiTrIdx, UInt& ruiLumaTrMode, UInt& ruiChromaTrMode ); |
---|
547 | |
---|
548 | Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList ); |
---|
549 | Int getIntraDirLumaPredictor ( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode = NULL ); |
---|
550 | |
---|
551 | // ------------------------------------------------------------------------------------------------------------------- |
---|
552 | // member functions for SBAC context |
---|
553 | // ------------------------------------------------------------------------------------------------------------------- |
---|
554 | |
---|
555 | UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
556 | UInt getCtxQtCbf ( UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth ); |
---|
557 | |
---|
558 | UInt getCtxSkipFlag ( UInt uiAbsPartIdx ); |
---|
559 | UInt getCtxInterDir ( UInt uiAbsPartIdx ); |
---|
560 | |
---|
561 | #if INTRA_BL |
---|
562 | UInt getCtxIntraBLFlag ( UInt uiAbsPartIdx ); |
---|
563 | #endif |
---|
564 | |
---|
565 | UInt getSliceStartCU ( UInt pos ) { return m_uiSliceStartCU[pos-m_uiAbsIdxInLCU]; } |
---|
566 | UInt getDependentSliceStartCU ( UInt pos ) { return m_uiDependentSliceStartCU[pos-m_uiAbsIdxInLCU]; } |
---|
567 | UInt& getTotalBins () { return m_uiTotalBins; } |
---|
568 | // ------------------------------------------------------------------------------------------------------------------- |
---|
569 | // member functions for RD cost storage |
---|
570 | // ------------------------------------------------------------------------------------------------------------------- |
---|
571 | |
---|
572 | Double& getTotalCost() { return m_dTotalCost; } |
---|
573 | UInt& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
574 | UInt& getTotalBits() { return m_uiTotalBits; } |
---|
575 | UInt& getTotalNumPart() { return m_uiNumPartition; } |
---|
576 | |
---|
577 | UInt getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra); |
---|
578 | |
---|
579 | #if !REMOVE_NSQT |
---|
580 | Bool useNonSquareTrans( UInt uiTrMode, Int absPartIdx ); |
---|
581 | Void getNSQTSize(Int trMode, Int absPartIdx, Int &trWidth, Int &trHeight); |
---|
582 | Bool useNonSquarePU ( UInt absPartIdx); |
---|
583 | UInt getInterTUSplitDirection ( Int width, Int height, Int trLastWidth, Int trLastHeight ); |
---|
584 | UInt getNSAbsPartIdx ( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt innerQuadIdx, UInt trMode ); |
---|
585 | UInt getNSAddrChroma ( UInt uiLog2TrSizeC, UInt uiTrModeC, UInt uiQuadrant, UInt absTUPartIdx ); |
---|
586 | #endif |
---|
587 | |
---|
588 | #if SVC_COL_BLK |
---|
589 | TComDataCU* getBaseColCU( UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase ); |
---|
590 | Void scaleBaseMV( TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase ); |
---|
591 | #endif |
---|
592 | }; |
---|
593 | |
---|
594 | namespace RasterAddress |
---|
595 | { |
---|
596 | /** Check whether 2 addresses point to the same column |
---|
597 | * \param addrA First address in raster scan order |
---|
598 | * \param addrB Second address in raters scan order |
---|
599 | * \param numUnitsPerRow Number of units in a row |
---|
600 | * \return Result of test |
---|
601 | */ |
---|
602 | static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
603 | { |
---|
604 | // addrA % numUnitsPerRow == addrB % numUnitsPerRow |
---|
605 | return (( addrA ^ addrB ) & ( numUnitsPerRow - 1 ) ) == 0; |
---|
606 | } |
---|
607 | |
---|
608 | /** Check whether 2 addresses point to the same row |
---|
609 | * \param addrA First address in raster scan order |
---|
610 | * \param addrB Second address in raters scan order |
---|
611 | * \param numUnitsPerRow Number of units in a row |
---|
612 | * \return Result of test |
---|
613 | */ |
---|
614 | static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
615 | { |
---|
616 | // addrA / numUnitsPerRow == addrB / numUnitsPerRow |
---|
617 | return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
618 | } |
---|
619 | |
---|
620 | /** Check whether 2 addresses point to the same row or column |
---|
621 | * \param addrA First address in raster scan order |
---|
622 | * \param addrB Second address in raters scan order |
---|
623 | * \param numUnitsPerRow Number of units in a row |
---|
624 | * \return Result of test |
---|
625 | */ |
---|
626 | static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
627 | { |
---|
628 | return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow ); |
---|
629 | } |
---|
630 | |
---|
631 | /** Check whether one address points to the first column |
---|
632 | * \param addr Address in raster scan order |
---|
633 | * \param numUnitsPerRow Number of units in a row |
---|
634 | * \return Result of test |
---|
635 | */ |
---|
636 | static inline Bool isZeroCol( Int addr, Int numUnitsPerRow ) |
---|
637 | { |
---|
638 | // addr % numUnitsPerRow == 0 |
---|
639 | return ( addr & ( numUnitsPerRow - 1 ) ) == 0; |
---|
640 | } |
---|
641 | |
---|
642 | /** Check whether one address points to the first row |
---|
643 | * \param addr Address in raster scan order |
---|
644 | * \param numUnitsPerRow Number of units in a row |
---|
645 | * \return Result of test |
---|
646 | */ |
---|
647 | static inline Bool isZeroRow( Int addr, Int numUnitsPerRow ) |
---|
648 | { |
---|
649 | // addr / numUnitsPerRow == 0 |
---|
650 | return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
651 | } |
---|
652 | |
---|
653 | /** Check whether one address points to a column whose index is smaller than a given value |
---|
654 | * \param addr Address in raster scan order |
---|
655 | * \param val Given column index value |
---|
656 | * \param numUnitsPerRow Number of units in a row |
---|
657 | * \return Result of test |
---|
658 | */ |
---|
659 | static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow ) |
---|
660 | { |
---|
661 | // addr % numUnitsPerRow < val |
---|
662 | return ( addr & ( numUnitsPerRow - 1 ) ) < val; |
---|
663 | } |
---|
664 | |
---|
665 | /** Check whether one address points to a row whose index is smaller than a given value |
---|
666 | * \param addr Address in raster scan order |
---|
667 | * \param val Given row index value |
---|
668 | * \param numUnitsPerRow Number of units in a row |
---|
669 | * \return Result of test |
---|
670 | */ |
---|
671 | static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow ) |
---|
672 | { |
---|
673 | // addr / numUnitsPerRow < val |
---|
674 | return addr < val * numUnitsPerRow; |
---|
675 | } |
---|
676 | }; |
---|
677 | |
---|
678 | //! \} |
---|
679 | |
---|
680 | #endif |
---|