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 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
52 | #include "TComYuv.h" |
---|
53 | #endif |
---|
54 | |
---|
55 | #include <algorithm> |
---|
56 | #include <vector> |
---|
57 | |
---|
58 | //! \ingroup TLibCommon |
---|
59 | //! \{ |
---|
60 | |
---|
61 | // ==================================================================================================================== |
---|
62 | // Non-deblocking in-loop filter processing block data structure |
---|
63 | // ==================================================================================================================== |
---|
64 | |
---|
65 | /// Non-deblocking filter processing block border tag |
---|
66 | enum NDBFBlockBorderTag |
---|
67 | { |
---|
68 | SGU_L = 0, |
---|
69 | SGU_R, |
---|
70 | SGU_T, |
---|
71 | SGU_B, |
---|
72 | SGU_TL, |
---|
73 | SGU_TR, |
---|
74 | SGU_BL, |
---|
75 | SGU_BR, |
---|
76 | NUM_SGU_BORDER |
---|
77 | }; |
---|
78 | |
---|
79 | /// Non-deblocking filter processing block information |
---|
80 | struct NDBFBlockInfo |
---|
81 | { |
---|
82 | Int tileID; //!< tile ID |
---|
83 | Int sliceID; //!< slice ID |
---|
84 | UInt startSU; //!< starting SU z-scan address in LCU |
---|
85 | UInt endSU; //!< ending SU z-scan address in LCU |
---|
86 | UInt widthSU; //!< number of SUs in width |
---|
87 | UInt heightSU; //!< number of SUs in height |
---|
88 | UInt posX; //!< top-left X coordinate in picture |
---|
89 | UInt posY; //!< top-left Y coordinate in picture |
---|
90 | UInt width; //!< number of pixels in width |
---|
91 | UInt height; //!< number of pixels in height |
---|
92 | Bool isBorderAvailable[NUM_SGU_BORDER]; //!< the border availabilities |
---|
93 | #if LCU_SYNTAX_ALF |
---|
94 | Bool allBordersAvailable; |
---|
95 | #endif |
---|
96 | |
---|
97 | NDBFBlockInfo():tileID(0), sliceID(0), startSU(0), endSU(0) {} //!< constructor |
---|
98 | const NDBFBlockInfo& operator= (const NDBFBlockInfo& src); //!< "=" operator |
---|
99 | }; |
---|
100 | |
---|
101 | |
---|
102 | // ==================================================================================================================== |
---|
103 | // Class definition |
---|
104 | // ==================================================================================================================== |
---|
105 | |
---|
106 | /// CU data structure class |
---|
107 | class TComDataCU |
---|
108 | { |
---|
109 | private: |
---|
110 | |
---|
111 | // ------------------------------------------------------------------------------------------------------------------- |
---|
112 | // class pointers |
---|
113 | // ------------------------------------------------------------------------------------------------------------------- |
---|
114 | |
---|
115 | TComPic* m_pcPic; ///< picture class pointer |
---|
116 | TComSlice* m_pcSlice; ///< slice header pointer |
---|
117 | TComPattern* m_pcPattern; ///< neighbour access class pointer |
---|
118 | |
---|
119 | // ------------------------------------------------------------------------------------------------------------------- |
---|
120 | // CU description |
---|
121 | // ------------------------------------------------------------------------------------------------------------------- |
---|
122 | |
---|
123 | UInt m_uiCUAddr; ///< CU address in a slice |
---|
124 | UInt m_uiAbsIdxInLCU; ///< absolute address in a CU. It's Z scan order |
---|
125 | UInt m_uiCUPelX; ///< CU position in a pixel (X) |
---|
126 | UInt m_uiCUPelY; ///< CU position in a pixel (Y) |
---|
127 | UInt m_uiNumPartition; ///< total number of minimum partitions in a CU |
---|
128 | UChar* m_puhWidth; ///< array of widths |
---|
129 | UChar* m_puhHeight; ///< array of heights |
---|
130 | UChar* m_puhDepth; ///< array of depths |
---|
131 | Int m_unitSize; ///< size of a "minimum partition" |
---|
132 | #if HHI_MPI |
---|
133 | Int* m_piTextureModeDepth; ///< at which depth are prediction data inherited from texture picture ( -1 : none ) |
---|
134 | #endif |
---|
135 | |
---|
136 | // ------------------------------------------------------------------------------------------------------------------- |
---|
137 | // CU data |
---|
138 | // ------------------------------------------------------------------------------------------------------------------- |
---|
139 | |
---|
140 | Char* m_pePartSize; ///< array of partition sizes |
---|
141 | #if HHI_INTERVIEW_SKIP |
---|
142 | Bool* m_pbRenderable; ///< array of merge flags |
---|
143 | #endif |
---|
144 | Char* m_pePredMode; ///< array of prediction modes |
---|
145 | #if H0736_AVC_STYLE_QP_RANGE |
---|
146 | Char* m_phQP; ///< array of QP values |
---|
147 | #else |
---|
148 | UChar* m_phQP; ///< array of QP values |
---|
149 | #endif |
---|
150 | UChar* m_puhTrIdx; ///< array of transform indices |
---|
151 | UChar* m_nsqtPartIdx; ///< array of absPartIdx mapping table, map zigzag to NSQT |
---|
152 | UChar* m_puhCbf[3]; ///< array of coded block flags (CBF) |
---|
153 | TComCUMvField m_acCUMvField[2]; ///< array of motion vectors |
---|
154 | TCoeff* m_pcTrCoeffY; ///< transformed coefficient buffer (Y) |
---|
155 | TCoeff* m_pcTrCoeffCb; ///< transformed coefficient buffer (Cb) |
---|
156 | TCoeff* m_pcTrCoeffCr; ///< transformed coefficient buffer (Cr) |
---|
157 | #if ADAPTIVE_QP_SELECTION |
---|
158 | Int* m_pcArlCoeffY; ///< ARL coefficient buffer (Y) |
---|
159 | Int* m_pcArlCoeffCb; ///< ARL coefficient buffer (Cb) |
---|
160 | Int* m_pcArlCoeffCr; ///< ARL coefficient buffer (Cr) |
---|
161 | Bool m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d |
---|
162 | |
---|
163 | static Int* m_pcGlbArlCoeffY; ///< ARL coefficient buffer (Y) |
---|
164 | static Int* m_pcGlbArlCoeffCb; ///< ARL coefficient buffer (Cb) |
---|
165 | static Int* m_pcGlbArlCoeffCr; ///< ARL coefficient buffer (Cr) |
---|
166 | |
---|
167 | #endif |
---|
168 | |
---|
169 | Pel* m_pcIPCMSampleY; ///< PCM sample buffer (Y) |
---|
170 | Pel* m_pcIPCMSampleCb; ///< PCM sample buffer (Cb) |
---|
171 | Pel* m_pcIPCMSampleCr; ///< PCM sample buffer (Cr) |
---|
172 | |
---|
173 | Int* m_piSliceSUMap; ///< pointer of slice ID map |
---|
174 | std::vector<NDBFBlockInfo> m_vNDFBlock; |
---|
175 | |
---|
176 | // ------------------------------------------------------------------------------------------------------------------- |
---|
177 | // neighbour access variables |
---|
178 | // ------------------------------------------------------------------------------------------------------------------- |
---|
179 | |
---|
180 | TComDataCU* m_pcCUAboveLeft; ///< pointer of above-left CU |
---|
181 | TComDataCU* m_pcCUAboveRight; ///< pointer of above-right CU |
---|
182 | TComDataCU* m_pcCUAbove; ///< pointer of above CU |
---|
183 | TComDataCU* m_pcCULeft; ///< pointer of left CU |
---|
184 | TComDataCU* m_apcCUColocated[2]; ///< pointer of temporally colocated CU's for both directions |
---|
185 | TComMvField m_cMvFieldA; ///< motion vector of position A |
---|
186 | TComMvField m_cMvFieldB; ///< motion vector of position B |
---|
187 | TComMvField m_cMvFieldC; ///< motion vector of position C |
---|
188 | TComMv m_cMvPred; ///< motion vector predictor |
---|
189 | |
---|
190 | // ------------------------------------------------------------------------------------------------------------------- |
---|
191 | // coding tool information |
---|
192 | // ------------------------------------------------------------------------------------------------------------------- |
---|
193 | |
---|
194 | Bool* m_pbMergeFlag; ///< array of merge flags |
---|
195 | #if LGE_ILLUCOMP_B0045 |
---|
196 | Bool* m_pbICFlag; ///< array of IC flags |
---|
197 | #endif |
---|
198 | UChar* m_puhMergeIndex; ///< array of merge candidate indices |
---|
199 | #if MERL_VSP_C0152 |
---|
200 | Char* m_piVSPIndex; ///< array of VSP flags to indicate the current block uses synthetic predictor or not |
---|
201 | ///< value 0: non-VSP, value 1: VSP |
---|
202 | #endif |
---|
203 | #if AMP_MRG |
---|
204 | Bool m_bIsMergeAMP; |
---|
205 | #endif |
---|
206 | UChar* m_puhLumaIntraDir; ///< array of intra directions (luma) |
---|
207 | UChar* m_puhChromaIntraDir; ///< array of intra directions (chroma) |
---|
208 | UChar* m_puhInterDir; ///< array of inter directions |
---|
209 | Char* m_apiMVPIdx[2]; ///< array of motion vector predictor candidates |
---|
210 | Char* m_apiMVPNum[2]; ///< array of number of possible motion vectors predictors |
---|
211 | Bool* m_puiAlfCtrlFlag; ///< array of ALF flags |
---|
212 | Bool* m_puiTmpAlfCtrlFlag; ///< temporal array of ALF flags |
---|
213 | |
---|
214 | Bool* m_pbIPCMFlag; ///< array of intra_pcm flags |
---|
215 | |
---|
216 | #if BURST_IPCM |
---|
217 | Int m_numSucIPCM; ///< the number of succesive IPCM blocks associated with the current log2CUSize |
---|
218 | Bool m_lastCUSucIPCMFlag; ///< True indicates that the last CU is IPCM and shares the same root as the current CU. |
---|
219 | #endif |
---|
220 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
221 | Bool* m_pbResPredAvailable; ///< array of residual prediction available flags |
---|
222 | Bool* m_pbResPredFlag; ///< array of residual prediction flags |
---|
223 | #endif |
---|
224 | |
---|
225 | #if LGE_EDGE_INTRA_A0070 |
---|
226 | UChar* m_pucEdgeCode; ///< array of edge code |
---|
227 | UChar* m_pucEdgeNumber; ///< total number of edge |
---|
228 | UChar* m_pucEdgeStartPos; ///< starting point position |
---|
229 | Bool* m_pbEdgeLeftFirst; ///< true if edge should be checked in left boundary first |
---|
230 | Bool* m_pbEdgePartition; ///< true if it belongs to region 1, otherwise, region 0 |
---|
231 | #if LGE_EDGE_INTRA_DELTA_DC |
---|
232 | Int* m_piEdgeDeltaDC0; |
---|
233 | Int* m_piEdgeDeltaDC1; |
---|
234 | #endif |
---|
235 | #endif |
---|
236 | |
---|
237 | // ------------------------------------------------------------------------------------------------------------------- |
---|
238 | // misc. variables |
---|
239 | // ------------------------------------------------------------------------------------------------------------------- |
---|
240 | |
---|
241 | Bool m_bDecSubCu; ///< indicates decoder-mode |
---|
242 | Double m_dTotalCost; ///< sum of partition RD costs |
---|
243 | #if FIX_RDO_NEGDIST |
---|
244 | Dist m_uiTotalDistortion; ///< sum of partition distortion |
---|
245 | #else |
---|
246 | UInt m_uiTotalDistortion; ///< sum of partition distortion |
---|
247 | #endif |
---|
248 | UInt m_uiTotalBits; ///< sum of partition bits |
---|
249 | UInt m_uiTotalBins; ///< sum of partition bins |
---|
250 | UInt* m_uiSliceStartCU; ///< Start CU address of current slice |
---|
251 | UInt* m_uiEntropySliceStartCU; ///< Start CU address of current slice |
---|
252 | |
---|
253 | // ------------------------------------------------------------------------------------------------------------------- |
---|
254 | // depth model mode data |
---|
255 | // ------------------------------------------------------------------------------------------------------------------- |
---|
256 | #if HHI_DMM_WEDGE_INTRA |
---|
257 | UInt* m_puiWedgeFullTabIdx; |
---|
258 | Int* m_piWedgeFullDeltaDC1; |
---|
259 | Int* m_piWedgeFullDeltaDC2; |
---|
260 | |
---|
261 | UInt* m_puiWedgePredDirTabIdx; |
---|
262 | Int* m_piWedgePredDirDeltaDC1; |
---|
263 | Int* m_piWedgePredDirDeltaDC2; |
---|
264 | Int* m_piWedgePredDirDeltaEnd; |
---|
265 | #endif |
---|
266 | #if HHI_DMM_PRED_TEX |
---|
267 | UInt* m_puiWedgePredTexTabIdx; |
---|
268 | Int* m_piWedgePredTexDeltaDC1; |
---|
269 | Int* m_piWedgePredTexDeltaDC2; |
---|
270 | |
---|
271 | Int* m_piContourPredTexDeltaDC1; |
---|
272 | Int* m_piContourPredTexDeltaDC2; |
---|
273 | #endif |
---|
274 | |
---|
275 | #if RWTH_SDC_DLT_B0036 |
---|
276 | Bool* m_pbSDCFlag; |
---|
277 | Pel* m_apSegmentDCOffset[2]; |
---|
278 | #endif |
---|
279 | |
---|
280 | protected: |
---|
281 | |
---|
282 | /// add possible motion vector predictor candidates |
---|
283 | Bool xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
284 | Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
285 | #if MERL_VSP_C0152 |
---|
286 | inline Bool xAddVspMergeCand ( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount, |
---|
287 | UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDisInfo ); |
---|
288 | inline Void xInheritVspMode ( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo ) ; |
---|
289 | #endif |
---|
290 | Void deriveRightBottomIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB ); |
---|
291 | Bool xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx |
---|
292 | #if QC_TMVP_MRG_REFIDX_C0047 |
---|
293 | , |
---|
294 | Bool bMRG = 0 |
---|
295 | #endif |
---|
296 | ); |
---|
297 | #if QC_MULTI_DIS_CAN_A0097 |
---|
298 | Bool xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx ); |
---|
299 | #endif |
---|
300 | |
---|
301 | #if !AMVP_PRUNING_SIMPLIFICATION |
---|
302 | /// remove redundant candidates |
---|
303 | Void xUniqueMVPCand ( AMVPInfo* pInfo ); |
---|
304 | #endif |
---|
305 | |
---|
306 | Void xCheckCornerCand( TComDataCU* pcCorner, UInt uiCornerIdx, UInt uiIter, Bool& rbValidCand ); |
---|
307 | /// compute required bits to encode MVD (used in AMVP) |
---|
308 | UInt xGetMvdBits ( TComMv cMvd ); |
---|
309 | UInt xGetComponentBits ( Int iVal ); |
---|
310 | |
---|
311 | /// compute scaling factor from POC difference |
---|
312 | Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
313 | |
---|
314 | Void xDeriveCenterIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxCenter ); |
---|
315 | Bool xGetCenterCol( UInt uiPartIdx, RefPicList eRefPicList, int iRefIdx, TComMv *pcMv ); |
---|
316 | |
---|
317 | Void xCheckDuplicateCand(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, bool* pbCandIsInter, UInt& ruiArrayAddr); |
---|
318 | |
---|
319 | #if !BURST_IPCM |
---|
320 | Int getLastValidPartIdx ( Int iAbsPartIdx ); |
---|
321 | #endif |
---|
322 | |
---|
323 | public: |
---|
324 | TComDataCU(); |
---|
325 | virtual ~TComDataCU(); |
---|
326 | |
---|
327 | // ------------------------------------------------------------------------------------------------------------------- |
---|
328 | // create / destroy / initialize / copy |
---|
329 | // ------------------------------------------------------------------------------------------------------------------- |
---|
330 | |
---|
331 | Void create ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize |
---|
332 | #if ADAPTIVE_QP_SELECTION |
---|
333 | , Bool bGlobalRMARLBuffer = false |
---|
334 | #endif |
---|
335 | ); |
---|
336 | Void destroy (); |
---|
337 | |
---|
338 | Void initCU ( TComPic* pcPic, UInt uiCUAddr ); |
---|
339 | #if H0736_AVC_STYLE_QP_RANGE |
---|
340 | Void initEstData ( UInt uiDepth, Int qp ); |
---|
341 | Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); |
---|
342 | #else |
---|
343 | Void initEstData ( UInt uiDepth, UInt uiQP ); |
---|
344 | Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, UInt uiQP ); |
---|
345 | #endif |
---|
346 | Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
347 | |
---|
348 | Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
349 | Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ); |
---|
350 | Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
351 | |
---|
352 | Void copyToPic ( UChar uiDepth ); |
---|
353 | Void copyToPic ( UChar uiDepth, UInt uiPartIdx, UInt uiPartDepth ); |
---|
354 | |
---|
355 | // ------------------------------------------------------------------------------------------------------------------- |
---|
356 | // member functions for CU description |
---|
357 | // ------------------------------------------------------------------------------------------------------------------- |
---|
358 | |
---|
359 | TComPic* getPic () { return m_pcPic; } |
---|
360 | TComSlice* getSlice () { return m_pcSlice; } |
---|
361 | UInt& getAddr () { return m_uiCUAddr; } |
---|
362 | UInt& getZorderIdxInCU () { return m_uiAbsIdxInLCU; } |
---|
363 | UInt getSCUAddr (); |
---|
364 | UInt getCUPelX () { return m_uiCUPelX; } |
---|
365 | UInt getCUPelY () { return m_uiCUPelY; } |
---|
366 | TComPattern* getPattern () { return m_pcPattern; } |
---|
367 | |
---|
368 | UChar* getDepth () { return m_puhDepth; } |
---|
369 | UChar getDepth ( UInt uiIdx ) { return m_puhDepth[uiIdx]; } |
---|
370 | Void setDepth ( UInt uiIdx, UChar uh ) { m_puhDepth[uiIdx] = uh; } |
---|
371 | |
---|
372 | Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); |
---|
373 | Void getPosInPic ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ); |
---|
374 | #if HHI_MPI |
---|
375 | Int* getTextureModeDepth () { return m_piTextureModeDepth; } |
---|
376 | Int getTextureModeDepth ( UInt uiIdx ) { return m_piTextureModeDepth[uiIdx]; } |
---|
377 | Void setTextureModeDepth ( UInt uiIdx, Int iTextureModeDepth ){ m_piTextureModeDepth[uiIdx] = iTextureModeDepth; } |
---|
378 | Void setTextureModeDepthSubParts( Int iTextureModeDepth, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
379 | Void copyTextureMotionDataFrom( TComDataCU* pcCU, UInt uiDepth, UInt uiAbsPartIdxSrc, UInt uiAbsPartIdxDst = 0 ); |
---|
380 | #endif |
---|
381 | |
---|
382 | // ------------------------------------------------------------------------------------------------------------------- |
---|
383 | // member functions for CU data |
---|
384 | // ------------------------------------------------------------------------------------------------------------------- |
---|
385 | |
---|
386 | Char* getPartitionSize () { return m_pePartSize; } |
---|
387 | PartSize getPartitionSize ( UInt uiIdx ) { return static_cast<PartSize>( m_pePartSize[uiIdx] ); } |
---|
388 | Void setPartitionSize ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh; } |
---|
389 | Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
390 | |
---|
391 | #if HHI_INTERVIEW_SKIP |
---|
392 | Bool* getRenderable () { return m_pbRenderable; } |
---|
393 | Bool getRenderable ( UInt uiIdx ) { return m_pbRenderable[uiIdx]; } |
---|
394 | Void setRenderable ( UInt uiIdx, Bool b ) { m_pbRenderable[uiIdx] = b; } |
---|
395 | Void setRenderableSubParts ( Bool bRenderable, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
396 | #endif |
---|
397 | |
---|
398 | Char* getPredictionMode () { return m_pePredMode; } |
---|
399 | PredMode getPredictionMode ( UInt uiIdx ) { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } |
---|
400 | Void setPredictionMode ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh; } |
---|
401 | Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
402 | |
---|
403 | UChar* getWidth () { return m_puhWidth; } |
---|
404 | UChar getWidth ( UInt uiIdx ) { return m_puhWidth[uiIdx]; } |
---|
405 | Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh; } |
---|
406 | |
---|
407 | UChar* getHeight () { return m_puhHeight; } |
---|
408 | UChar getHeight ( UInt uiIdx ) { return m_puhHeight[uiIdx]; } |
---|
409 | Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh; } |
---|
410 | |
---|
411 | Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
412 | |
---|
413 | #if H0736_AVC_STYLE_QP_RANGE |
---|
414 | Char* getQP () { return m_phQP; } |
---|
415 | Char getQP ( UInt uiIdx ) { return m_phQP[uiIdx]; } |
---|
416 | Void setQP ( UInt uiIdx, Char value ){ m_phQP[uiIdx] = value; } |
---|
417 | Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
418 | #if BURST_IPCM |
---|
419 | Int getLastValidPartIdx ( Int iAbsPartIdx ); |
---|
420 | #endif |
---|
421 | Char getLastCodedQP ( UInt uiAbsPartIdx ); |
---|
422 | #else |
---|
423 | UChar* getQP () { return m_phQP; } |
---|
424 | UChar getQP ( UInt uiIdx ) { return m_phQP[uiIdx]; } |
---|
425 | Void setQP ( UInt uiIdx, UChar uh ) { m_phQP[uiIdx] = uh; } |
---|
426 | Void setQPSubParts ( UInt uiQP, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
427 | #if BURST_IPCM |
---|
428 | Int getLastValidPartIdx ( Int iAbsPartIdx ); |
---|
429 | #endif |
---|
430 | UChar getLastCodedQP ( UInt uiAbsPartIdx ); |
---|
431 | #endif |
---|
432 | |
---|
433 | #if LOSSLESS_CODING |
---|
434 | Bool isLosslessCoded(UInt absPartIdx); |
---|
435 | #endif |
---|
436 | UChar* getNSQTPartIdx () { return m_nsqtPartIdx; } |
---|
437 | UChar getNSQTPartIdx ( UInt idx ) { return m_nsqtPartIdx[idx]; } |
---|
438 | Void setNSQTIdxSubParts ( UInt absPartIdx, UInt depth ); |
---|
439 | Void setNSQTIdxSubParts ( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt trMode ); |
---|
440 | |
---|
441 | UChar* getTransformIdx () { return m_puhTrIdx; } |
---|
442 | UChar getTransformIdx ( UInt uiIdx ) { return m_puhTrIdx[uiIdx]; } |
---|
443 | Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
444 | |
---|
445 | UInt getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ); |
---|
446 | |
---|
447 | TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } |
---|
448 | |
---|
449 | TCoeff*& getCoeffY () { return m_pcTrCoeffY; } |
---|
450 | TCoeff*& getCoeffCb () { return m_pcTrCoeffCb; } |
---|
451 | TCoeff*& getCoeffCr () { return m_pcTrCoeffCr; } |
---|
452 | #if ADAPTIVE_QP_SELECTION |
---|
453 | Int*& getArlCoeffY () { return m_pcArlCoeffY; } |
---|
454 | Int*& getArlCoeffCb () { return m_pcArlCoeffCb; } |
---|
455 | Int*& getArlCoeffCr () { return m_pcArlCoeffCr; } |
---|
456 | #endif |
---|
457 | |
---|
458 | Pel*& getPCMSampleY () { return m_pcIPCMSampleY; } |
---|
459 | Pel*& getPCMSampleCb () { return m_pcIPCMSampleCb; } |
---|
460 | Pel*& getPCMSampleCr () { return m_pcIPCMSampleCr; } |
---|
461 | |
---|
462 | UChar getCbf ( UInt uiIdx, TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx]; } |
---|
463 | UChar* getCbf ( TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]]; } |
---|
464 | UChar getCbf ( UInt uiIdx, TextType eType, UInt uiTrDepth ) { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); } |
---|
465 | Void setCbf ( UInt uiIdx, TextType eType, UChar uh ) { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh; } |
---|
466 | Void clearCbf ( UInt uiIdx, TextType eType, UInt uiNumParts ); |
---|
467 | UChar getQtRootCbf ( UInt uiIdx ) { return getCbf( uiIdx, TEXT_LUMA, 0 ) || getCbf( uiIdx, TEXT_CHROMA_U, 0 ) || getCbf( uiIdx, TEXT_CHROMA_V, 0 ); } |
---|
468 | |
---|
469 | Void setCbfSubParts ( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
470 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
471 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
472 | |
---|
473 | // ------------------------------------------------------------------------------------------------------------------- |
---|
474 | // member functions for coding tool information |
---|
475 | // ------------------------------------------------------------------------------------------------------------------- |
---|
476 | |
---|
477 | Bool* getMergeFlag () { return m_pbMergeFlag; } |
---|
478 | Bool getMergeFlag ( UInt uiIdx ) { return m_pbMergeFlag[uiIdx]; } |
---|
479 | Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b; } |
---|
480 | Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
481 | |
---|
482 | UChar* getMergeIndex () { return m_puhMergeIndex; } |
---|
483 | UChar getMergeIndex ( UInt uiIdx ) { return m_puhMergeIndex[uiIdx]; } |
---|
484 | Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } |
---|
485 | Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
486 | |
---|
487 | #if MERL_VSP_C0152 |
---|
488 | Char* getVSPIndex () { return m_piVSPIndex; } |
---|
489 | Char getVSPIndex ( UInt uiIdx ) { return m_piVSPIndex[uiIdx]; } |
---|
490 | Void setVSPIndex ( UInt uiIdx, Int n ) { m_piVSPIndex[uiIdx] = n; } |
---|
491 | Void setVSPIndexSubParts( Char bVSPIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
492 | #endif |
---|
493 | |
---|
494 | template <typename T> |
---|
495 | Void setSubPart ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
496 | |
---|
497 | #if LGE_ILLUCOMP_B0045 |
---|
498 | Bool* getICFlag () { return m_pbICFlag; } |
---|
499 | Bool getICFlag ( UInt uiIdx ) { return m_pbICFlag[uiIdx]; } |
---|
500 | Void setICFlag ( UInt uiIdx, Bool uh ) { m_pbICFlag[uiIdx] = uh; } |
---|
501 | Void setICFlagSubParts ( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
502 | Bool isICFlagRequired (UInt uiAbsPartIdx); |
---|
503 | #endif |
---|
504 | |
---|
505 | #if AMP_MRG |
---|
506 | Void setMergeAMP( Bool b ) { m_bIsMergeAMP = b; } |
---|
507 | Bool getMergeAMP( ) { return m_bIsMergeAMP; } |
---|
508 | #endif |
---|
509 | |
---|
510 | UChar* getLumaIntraDir () { return m_puhLumaIntraDir; } |
---|
511 | UChar getLumaIntraDir ( UInt uiIdx ) { return m_puhLumaIntraDir[uiIdx]; } |
---|
512 | Void setLumaIntraDir ( UInt uiIdx, UChar uh ) { m_puhLumaIntraDir[uiIdx] = uh; } |
---|
513 | Void setLumaIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
514 | |
---|
515 | UChar* getChromaIntraDir () { return m_puhChromaIntraDir; } |
---|
516 | UChar getChromaIntraDir ( UInt uiIdx ) { return m_puhChromaIntraDir[uiIdx]; } |
---|
517 | Void setChromaIntraDir ( UInt uiIdx, UChar uh ) { m_puhChromaIntraDir[uiIdx] = uh; } |
---|
518 | Void setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
519 | |
---|
520 | UChar* getInterDir () { return m_puhInterDir; } |
---|
521 | UChar getInterDir ( UInt uiIdx ) { return m_puhInterDir[uiIdx]; } |
---|
522 | Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh; } |
---|
523 | Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
524 | |
---|
525 | Bool* getAlfCtrlFlag () { return m_puiAlfCtrlFlag; } |
---|
526 | Bool getAlfCtrlFlag ( UInt uiIdx ) { return m_puiAlfCtrlFlag[uiIdx]; } |
---|
527 | Void setAlfCtrlFlag ( UInt uiIdx, Bool uiFlag){ m_puiAlfCtrlFlag[uiIdx] = uiFlag; } |
---|
528 | Void setAlfCtrlFlagSubParts( Bool uiFlag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
529 | |
---|
530 | Void createTmpAlfCtrlFlag (); |
---|
531 | Void destroyTmpAlfCtrlFlag (); |
---|
532 | Void copyAlfCtrlFlagToTmp (); |
---|
533 | Void copyAlfCtrlFlagFromTmp(); |
---|
534 | |
---|
535 | Bool* getIPCMFlag () { return m_pbIPCMFlag; } |
---|
536 | Bool getIPCMFlag (UInt uiIdx ) { return m_pbIPCMFlag[uiIdx]; } |
---|
537 | Void setIPCMFlag (UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } |
---|
538 | Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth); |
---|
539 | |
---|
540 | #if BURST_IPCM |
---|
541 | Int getNumSucIPCM () { return m_numSucIPCM; } |
---|
542 | Void setNumSucIPCM ( Int num ) { m_numSucIPCM = num; } |
---|
543 | Bool getLastCUSucIPCMFlag () { return m_lastCUSucIPCMFlag; } |
---|
544 | Void setLastCUSucIPCMFlag ( Bool flg ) { m_lastCUSucIPCMFlag = flg; } |
---|
545 | #endif |
---|
546 | |
---|
547 | /// get slice ID for SU |
---|
548 | Int getSUSliceID (UInt uiIdx) {return m_piSliceSUMap[uiIdx]; } |
---|
549 | |
---|
550 | /// get the pointer of slice ID map |
---|
551 | Int* getSliceSUMap () {return m_piSliceSUMap; } |
---|
552 | |
---|
553 | /// set the pointer of slice ID map |
---|
554 | Void setSliceSUMap (Int *pi) {m_piSliceSUMap = pi; } |
---|
555 | |
---|
556 | std::vector<NDBFBlockInfo>* getNDBFilterBlocks() {return &m_vNDFBlock;} |
---|
557 | Void setNDBFilterBlockBorderAvailability(UInt numLCUInPicWidth, UInt numLCUInPicHeight, UInt numSUInLCUWidth, UInt numSUInLCUHeight, UInt picWidth, UInt picHeight |
---|
558 | ,Bool bIndependentSliceBoundaryEnabled |
---|
559 | ,Bool bTopTileBoundary, Bool bDownTileBoundary, Bool bLeftTileBoundary, Bool bRightTileBoundary |
---|
560 | ,Bool bIndependentTileBoundaryEnabled ); |
---|
561 | |
---|
562 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
563 | #if !QC_MULTI_DIS_CAN_A0097 |
---|
564 | Int getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv ); |
---|
565 | Bool getPdmMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge = false ); |
---|
566 | #else |
---|
567 | #if QC_AMVP_MRG_UNIFY_IVCAN_C0051 |
---|
568 | Bool getUnifiedMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge ); |
---|
569 | #else |
---|
570 | Bool getPdmMvPredDisCan( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge = false ); |
---|
571 | Int getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo |
---|
572 | #if QC_MRG_CANS_B0048 |
---|
573 | , Int* iPdm |
---|
574 | #endif |
---|
575 | ); |
---|
576 | #endif |
---|
577 | Void getDisMvpCand ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo ); |
---|
578 | #if LGE_DVMCP_A0126 |
---|
579 | #if QC_SIMPLE_NBDV_B0047 |
---|
580 | Void getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo |
---|
581 | #if LGE_IVMP_PARALLEL_MERGE_B0136 |
---|
582 | , Bool bParMerg = false |
---|
583 | #endif |
---|
584 | #if MERL_VSP_C0152 |
---|
585 | , Bool bDepthRefine = false |
---|
586 | #endif |
---|
587 | ); |
---|
588 | #else |
---|
589 | Void getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo, Bool bMerge=false, RefPicList eRefPicList=REF_PIC_LIST_X, Int iRefIdx=-1 |
---|
590 | #if LGE_IVMP_PARALLEL_MERGE_B0136 |
---|
591 | , Bool bParMerg = false |
---|
592 | #endif |
---|
593 | ); |
---|
594 | #endif |
---|
595 | #endif |
---|
596 | |
---|
597 | #endif |
---|
598 | |
---|
599 | #if MERL_VSP_C0152 |
---|
600 | #if LGE_SIMP_DVP_REFINE_C0112 |
---|
601 | Pel getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine = false); |
---|
602 | Void estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine = false); |
---|
603 | #else |
---|
604 | Pel getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec); |
---|
605 | Void estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred); |
---|
606 | #endif |
---|
607 | #endif |
---|
608 | Bool getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv ); |
---|
609 | #endif |
---|
610 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
611 | Bool* getResPredAvail () { return m_pbResPredAvailable; } |
---|
612 | Bool getResPredAvail ( UInt uiIdx ) { return m_pbResPredAvailable[uiIdx]; } |
---|
613 | Void setResPredAvail ( UInt uiIdx, Bool b ) { m_pbResPredAvailable[uiIdx] = b; } |
---|
614 | Void setResPredAvailSubParts ( Bool b, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
615 | |
---|
616 | Bool* getResPredFlag () { return m_pbResPredFlag; } |
---|
617 | Bool getResPredFlag ( UInt uiIdx ) { return m_pbResPredFlag[uiIdx]; } |
---|
618 | Void setResPredFlag ( UInt uiIdx, Bool b ) { m_pbResPredFlag[uiIdx] = b; } |
---|
619 | Void setResPredFlagSubParts ( Bool b, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
620 | |
---|
621 | Void setResPredIndicator ( Bool bAv, Bool bRP ) { m_pbResPredAvailable[0] = bAv; m_pbResPredFlag[0] = bRP; } |
---|
622 | #endif |
---|
623 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
624 | Bool getResidualSamples( UInt uiPartIdx, |
---|
625 | #if QC_SIMPLIFIEDIVRP_M24938 |
---|
626 | Bool bRecon , |
---|
627 | #endif |
---|
628 | TComYuv* pcYuv = 0 ); |
---|
629 | #endif |
---|
630 | // ------------------------------------------------------------------------------------------------------------------- |
---|
631 | // member functions for accessing partition information |
---|
632 | // ------------------------------------------------------------------------------------------------------------------- |
---|
633 | #if LG_RESTRICTEDRESPRED_M24766 |
---|
634 | Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false); |
---|
635 | #else |
---|
636 | Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); |
---|
637 | #endif |
---|
638 | #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 |
---|
639 | Int getResiPredMode(UInt uiPartAddr); |
---|
640 | Void getPUResiPredShift (Int *iPUPredResiShift, UInt uiAbsPartIndex); |
---|
641 | #endif |
---|
642 | UChar getNumPartInter (); |
---|
643 | Bool isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth); |
---|
644 | |
---|
645 | // ------------------------------------------------------------------------------------------------------------------- |
---|
646 | // member functions for motion vector |
---|
647 | // ------------------------------------------------------------------------------------------------------------------- |
---|
648 | |
---|
649 | Void getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); |
---|
650 | |
---|
651 | AMVP_MODE getAMVPMode ( UInt uiIdx ); |
---|
652 | #if SHARP_INTERVIEW_DECOUPLE_B0111 |
---|
653 | Void fillMvpCandBase ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ); |
---|
654 | Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo , Int iMVPIdx=-1); |
---|
655 | #else |
---|
656 | Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ); |
---|
657 | #endif |
---|
658 | #if PARALLEL_MERGE |
---|
659 | Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP); |
---|
660 | Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH); |
---|
661 | #endif |
---|
662 | Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } |
---|
663 | Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) { return m_apiMVPIdx[eRefPicList][uiIdx]; } |
---|
664 | Char* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList]; } |
---|
665 | |
---|
666 | Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum; } |
---|
667 | Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) { return m_apiMVPNum[eRefPicList][uiIdx]; } |
---|
668 | Char* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList]; } |
---|
669 | |
---|
670 | Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
671 | Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
672 | |
---|
673 | Void clipMv ( TComMv& rcMv ); |
---|
674 | Void getMvPredLeft ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldA.getMv(); } |
---|
675 | Void getMvPredAbove ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldB.getMv(); } |
---|
676 | Void getMvPredAboveRight ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldC.getMv(); } |
---|
677 | |
---|
678 | Void compressMV (); |
---|
679 | |
---|
680 | // ------------------------------------------------------------------------------------------------------------------- |
---|
681 | // utility functions for neighbouring information |
---|
682 | // ------------------------------------------------------------------------------------------------------------------- |
---|
683 | |
---|
684 | TComDataCU* getCULeft () { return m_pcCULeft; } |
---|
685 | TComDataCU* getCUAbove () { return m_pcCUAbove; } |
---|
686 | TComDataCU* getCUAboveLeft () { return m_pcCUAboveLeft; } |
---|
687 | TComDataCU* getCUAboveRight () { return m_pcCUAboveRight; } |
---|
688 | TComDataCU* getCUColocated ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; } |
---|
689 | |
---|
690 | |
---|
691 | TComDataCU* getPULeft ( UInt& uiLPartUnitIdx , UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true |
---|
692 | , Bool bEnforceTileRestriction=true |
---|
693 | ); |
---|
694 | |
---|
695 | TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx , UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true, Bool MotionDataCompresssion = false |
---|
696 | , Bool planarAtLCUBoundary = false |
---|
697 | , Bool bEnforceTileRestriction=true |
---|
698 | ); |
---|
699 | |
---|
700 | TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true, Bool MotionDataCompresssion = false ); |
---|
701 | TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true, Bool MotionDataCompresssion = false ); |
---|
702 | TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
703 | |
---|
704 | TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
705 | #if H0204_QP_PREDICTION |
---|
706 | TComDataCU* getQpMinCuAbove ( UInt& aPartUnitIdx , UInt currAbsIdxInLCU, Bool enforceSliceRestriction=true, Bool enforceEntropySliceRestriction=true ); |
---|
707 | #endif |
---|
708 | #if H0736_AVC_STYLE_QP_RANGE |
---|
709 | Char getRefQP ( UInt uiCurrAbsIdxInLCU ); |
---|
710 | #else |
---|
711 | UChar getRefQP ( UInt uiCurrAbsIdxInLCU ); |
---|
712 | #endif |
---|
713 | |
---|
714 | TComDataCU* getPUAboveRightAdi ( UInt& uiARPartUnitIdx, UInt uiPuWidth, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
715 | TComDataCU* getPUBelowLeftAdi ( UInt& uiBLPartUnitIdx, UInt uiPuHeight, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
716 | |
---|
717 | Void deriveLeftRightTopIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
718 | Void deriveLeftBottomIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
719 | |
---|
720 | Void deriveLeftRightTopIdxAdi ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth ); |
---|
721 | Void deriveLeftBottomIdxAdi ( UInt& ruiPartIdxLB, UInt uiPartOffset, UInt uiPartDepth ); |
---|
722 | |
---|
723 | Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); |
---|
724 | #if SIMP_MRG_PRUN |
---|
725 | #if MERL_VSP_C0152 |
---|
726 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* uiVSPIndexTrue, Int mrgCandIdx = -1 ); |
---|
727 | #else |
---|
728 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ); |
---|
729 | #endif |
---|
730 | #else |
---|
731 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand ); |
---|
732 | #endif |
---|
733 | Void deriveLeftRightTopIdxGeneral( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
734 | Void deriveLeftBottomIdxGeneral ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
735 | |
---|
736 | |
---|
737 | // ------------------------------------------------------------------------------------------------------------------- |
---|
738 | // member functions for modes |
---|
739 | // ------------------------------------------------------------------------------------------------------------------- |
---|
740 | |
---|
741 | Bool isIntra ( UInt uiPartIdx ) { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } |
---|
742 | Bool isSkipped ( UInt uiPartIdx ); ///< SKIP (no residual) |
---|
743 | |
---|
744 | // ------------------------------------------------------------------------------------------------------------------- |
---|
745 | // member functions for symbol prediction (most probable / mode conversion) |
---|
746 | // ------------------------------------------------------------------------------------------------------------------- |
---|
747 | |
---|
748 | UInt getIntraSizeIdx ( UInt uiAbsPartIdx ); |
---|
749 | Void convertTransIdx ( UInt uiAbsPartIdx, UInt uiTrIdx, UInt& ruiLumaTrMode, UInt& ruiChromaTrMode ); |
---|
750 | |
---|
751 | Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList ); |
---|
752 | Int getIntraDirLumaPredictor ( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode = NULL ); |
---|
753 | |
---|
754 | // ------------------------------------------------------------------------------------------------------------------- |
---|
755 | // member functions for SBAC context |
---|
756 | // ------------------------------------------------------------------------------------------------------------------- |
---|
757 | |
---|
758 | UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
759 | UInt getCtxQtCbf ( UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth ); |
---|
760 | |
---|
761 | UInt getCtxSkipFlag ( UInt uiAbsPartIdx ); |
---|
762 | #if LGE_ILLUCOMP_B0045 |
---|
763 | UInt getCtxICFlag ( UInt uiAbsPartIdx ); |
---|
764 | #endif |
---|
765 | UInt getCtxInterDir ( UInt uiAbsPartIdx ); |
---|
766 | |
---|
767 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
768 | UInt getCtxResPredFlag ( UInt uiAbsPartIdx ); |
---|
769 | #endif |
---|
770 | |
---|
771 | UInt getSliceStartCU ( UInt pos ) { return m_uiSliceStartCU[pos-m_uiAbsIdxInLCU]; } |
---|
772 | UInt getEntropySliceStartCU ( UInt pos ) { return m_uiEntropySliceStartCU[pos-m_uiAbsIdxInLCU]; } |
---|
773 | UInt& getTotalBins () { return m_uiTotalBins; } |
---|
774 | |
---|
775 | #if LGE_EDGE_INTRA_A0070 |
---|
776 | UInt getCtxEdgeIntra ( UInt uiAbsPartIdx ); |
---|
777 | #endif |
---|
778 | |
---|
779 | // ------------------------------------------------------------------------------------------------------------------- |
---|
780 | // member functions for RD cost storage |
---|
781 | // ------------------------------------------------------------------------------------------------------------------- |
---|
782 | |
---|
783 | Double& getTotalCost() { return m_dTotalCost; } |
---|
784 | #if FIX_RDO_NEGDIST |
---|
785 | Dist& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
786 | #else |
---|
787 | UInt& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
788 | #endif |
---|
789 | UInt& getTotalBits() { return m_uiTotalBits; } |
---|
790 | UInt& getTotalNumPart() { return m_uiNumPartition; } |
---|
791 | |
---|
792 | UInt getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra); |
---|
793 | |
---|
794 | Bool useNonSquareTrans( UInt uiTrMode, Int absPartIdx ); |
---|
795 | Void getNSQTSize(Int trMode, Int absPartIdx, Int &trWidth, Int &trHeight); |
---|
796 | Bool useNonSquarePU ( UInt absPartIdx); |
---|
797 | UInt getInterTUSplitDirection ( Int width, Int height, Int trLastWidth, Int trLastHeight ); |
---|
798 | UInt getNSAbsPartIdx ( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt innerQuadIdx, UInt trMode ); |
---|
799 | UInt getNSAddrChroma ( UInt uiLog2TrSizeC, UInt uiTrModeC, UInt uiQuadrant, UInt absTUPartIdx ); |
---|
800 | |
---|
801 | // ------------------------------------------------------------------------------------------------------------------- |
---|
802 | // member functions for depth model modes |
---|
803 | // ------------------------------------------------------------------------------------------------------------------- |
---|
804 | #if HHI_DMM_WEDGE_INTRA |
---|
805 | UInt* getWedgeFullTabIdx () { return m_puiWedgeFullTabIdx; } |
---|
806 | UInt getWedgeFullTabIdx ( UInt uiIdx ) { return m_puiWedgeFullTabIdx[uiIdx]; } |
---|
807 | Void setWedgeFullTabIdx ( UInt uiIdx, UInt uh ) { m_puiWedgeFullTabIdx[uiIdx] = uh; } |
---|
808 | Void setWedgeFullTabIdxSubParts ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
809 | Int* getWedgeFullDeltaDC1 () { return m_piWedgeFullDeltaDC1; } |
---|
810 | Int getWedgeFullDeltaDC1 ( UInt uiIdx ) { return m_piWedgeFullDeltaDC1[uiIdx]; } |
---|
811 | Void setWedgeFullDeltaDC1 ( UInt uiIdx, Int i ) { m_piWedgeFullDeltaDC1[uiIdx] = i; } |
---|
812 | Void setWedgeFullDeltaDC1SubParts ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
813 | Int* getWedgeFullDeltaDC2 () { return m_piWedgeFullDeltaDC2; } |
---|
814 | Int getWedgeFullDeltaDC2 ( UInt uiIdx ) { return m_piWedgeFullDeltaDC2[uiIdx]; } |
---|
815 | Void setWedgeFullDeltaDC2 ( UInt uiIdx, Int i ) { m_piWedgeFullDeltaDC2[uiIdx] = i; } |
---|
816 | Void setWedgeFullDeltaDC2SubParts ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
817 | |
---|
818 | UInt* getWedgePredDirTabIdx () { return m_puiWedgePredDirTabIdx; } |
---|
819 | UInt getWedgePredDirTabIdx ( UInt uiIdx ) { return m_puiWedgePredDirTabIdx[uiIdx]; } |
---|
820 | Void setWedgePredDirTabIdx ( UInt uiIdx, UInt uh ) { m_puiWedgePredDirTabIdx[uiIdx] = uh; } |
---|
821 | Void setWedgePredDirTabIdxSubParts ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
822 | Int* getWedgePredDirDeltaDC1 () { return m_piWedgePredDirDeltaDC1; } |
---|
823 | Int getWedgePredDirDeltaDC1 ( UInt uiIdx ) { return m_piWedgePredDirDeltaDC1[uiIdx]; } |
---|
824 | Void setWedgePredDirDeltaDC1 ( UInt uiIdx, Int i ) { m_piWedgePredDirDeltaDC1[uiIdx] = i; } |
---|
825 | Void setWedgePredDirDeltaDC1SubParts ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
826 | Int* getWedgePredDirDeltaDC2 () { return m_piWedgePredDirDeltaDC2; } |
---|
827 | Int getWedgePredDirDeltaDC2 ( UInt uiIdx ) { return m_piWedgePredDirDeltaDC2[uiIdx]; } |
---|
828 | Void setWedgePredDirDeltaDC2 ( UInt uiIdx, Int i ) { m_piWedgePredDirDeltaDC2[uiIdx] = i; } |
---|
829 | Void setWedgePredDirDeltaDC2SubParts ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
830 | Int* getWedgePredDirDeltaEnd () { return m_piWedgePredDirDeltaEnd; } |
---|
831 | Int getWedgePredDirDeltaEnd ( UInt uiIdx ) { return m_piWedgePredDirDeltaEnd[uiIdx]; } |
---|
832 | Void setWedgePredDirDeltaEnd ( UInt uiIdx, Int iD ) { m_piWedgePredDirDeltaEnd[uiIdx] = iD; } |
---|
833 | Void setWedgePredDirDeltaEndSubParts ( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
834 | #endif |
---|
835 | #if HHI_DMM_PRED_TEX |
---|
836 | UInt* getWedgePredTexTabIdx () { return m_puiWedgePredTexTabIdx; } |
---|
837 | UInt getWedgePredTexTabIdx ( UInt uiIdx ) { return m_puiWedgePredTexTabIdx[uiIdx]; } |
---|
838 | Void setWedgePredTexTabIdx ( UInt uiIdx, UInt uh ) { m_puiWedgePredTexTabIdx[uiIdx] = uh; } |
---|
839 | Void setWedgePredTexTabIdxSubParts ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
840 | Int* getWedgePredTexDeltaDC1 () { return m_piWedgePredTexDeltaDC1; } |
---|
841 | Int getWedgePredTexDeltaDC1 ( UInt uiIdx ) { return m_piWedgePredTexDeltaDC1[uiIdx]; } |
---|
842 | Void setWedgePredTexDeltaDC1 ( UInt uiIdx, Int i ) { m_piWedgePredTexDeltaDC1[uiIdx] = i; } |
---|
843 | Void setWedgePredTexDeltaDC1SubParts ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
844 | Int* getWedgePredTexDeltaDC2 () { return m_piWedgePredTexDeltaDC2; } |
---|
845 | Int getWedgePredTexDeltaDC2 ( UInt uiIdx ) { return m_piWedgePredTexDeltaDC2[uiIdx]; } |
---|
846 | Void setWedgePredTexDeltaDC2 ( UInt uiIdx, Int i ) { m_piWedgePredTexDeltaDC2[uiIdx] = i; } |
---|
847 | Void setWedgePredTexDeltaDC2SubParts ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
848 | |
---|
849 | Int* getContourPredTexDeltaDC1 () { return m_piContourPredTexDeltaDC1; } |
---|
850 | Int getContourPredTexDeltaDC1 ( UInt uiIdx ) { return m_piContourPredTexDeltaDC1[uiIdx]; } |
---|
851 | Void setContourPredTexDeltaDC1 ( UInt uiIdx, Int i ) { m_piContourPredTexDeltaDC1[uiIdx] = i; } |
---|
852 | Void setContourPredTexDeltaDC1SubParts ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
853 | Int* getContourPredTexDeltaDC2 () { return m_piContourPredTexDeltaDC2; } |
---|
854 | Int getContourPredTexDeltaDC2 ( UInt uiIdx ) { return m_piContourPredTexDeltaDC2[uiIdx]; } |
---|
855 | Void setContourPredTexDeltaDC2 ( UInt uiIdx, Int i ) { m_piContourPredTexDeltaDC2[uiIdx] = i; } |
---|
856 | Void setContourPredTexDeltaDC2SubParts ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
857 | #endif |
---|
858 | |
---|
859 | #if LGE_EDGE_INTRA_A0070 |
---|
860 | UChar* getEdgeCode( UInt uiIdx ) { return &m_pucEdgeCode[uiIdx * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4]; } |
---|
861 | UChar* getEdgeNumber( ) { return m_pucEdgeNumber; } |
---|
862 | UChar getEdgeNumber( UInt uiIdx ) { return m_pucEdgeNumber[uiIdx]; } |
---|
863 | Void setEdgeNumber( UInt uiIdx, UChar val ) { m_pucEdgeNumber[uiIdx] = val; } |
---|
864 | UChar* getEdgeStartPos( ) { return m_pucEdgeStartPos; } |
---|
865 | UChar getEdgeStartPos( UInt uiIdx ) { return m_pucEdgeStartPos[uiIdx]; } |
---|
866 | Void setEdgeStartPos( UInt uiIdx, UChar val ) { m_pucEdgeStartPos[uiIdx] = val; } |
---|
867 | Bool* getEdgeLeftFirst( ) { return m_pbEdgeLeftFirst; } |
---|
868 | Bool getEdgeLeftFirst( UInt uiIdx ) { return m_pbEdgeLeftFirst[uiIdx]; } |
---|
869 | Void setEdgeLeftFirst( UInt uiIdx, Bool val ) { m_pbEdgeLeftFirst[uiIdx] = val; } |
---|
870 | Bool* getEdgePartition( UInt uiIdx ) { return &m_pbEdgePartition[uiIdx * 16]; } |
---|
871 | Void reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion ); |
---|
872 | |
---|
873 | #if LGE_EDGE_INTRA_DELTA_DC |
---|
874 | Int* getEdgeDeltaDC0( ) { return m_piEdgeDeltaDC0; } |
---|
875 | Int* getEdgeDeltaDC1( ) { return m_piEdgeDeltaDC1; } |
---|
876 | Int getEdgeDeltaDC0( UInt uiIdx ) { return m_piEdgeDeltaDC0[uiIdx]; } |
---|
877 | Int getEdgeDeltaDC1( UInt uiIdx ) { return m_piEdgeDeltaDC1[uiIdx]; } |
---|
878 | Void setEdgeDeltaDC0( UInt uiIdx, Int val ) { m_piEdgeDeltaDC0[uiIdx] = val; } |
---|
879 | Void setEdgeDeltaDC1( UInt uiIdx, Int val ) { m_piEdgeDeltaDC1[uiIdx] = val; } |
---|
880 | #endif |
---|
881 | #endif |
---|
882 | |
---|
883 | #if RWTH_SDC_DLT_B0036 |
---|
884 | Bool* getSDCFlag () { return m_pbSDCFlag; } |
---|
885 | Bool getSDCFlag ( UInt uiIdx ) { return m_pbSDCFlag[uiIdx]; } |
---|
886 | Void setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
887 | |
---|
888 | UInt getCtxSDCFlag ( UInt uiAbsPartIdx ); |
---|
889 | |
---|
890 | Bool getSDCAvailable ( UInt uiAbsPartIdx ); |
---|
891 | |
---|
892 | Pel* getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; } |
---|
893 | Pel getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; } |
---|
894 | Void setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; } |
---|
895 | #endif |
---|
896 | }; |
---|
897 | |
---|
898 | namespace RasterAddress |
---|
899 | { |
---|
900 | /** Check whether 2 addresses point to the same column |
---|
901 | * \param addrA First address in raster scan order |
---|
902 | * \param addrB Second address in raters scan order |
---|
903 | * \param numUnitsPerRow Number of units in a row |
---|
904 | * \return Result of test |
---|
905 | */ |
---|
906 | static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
907 | { |
---|
908 | // addrA % numUnitsPerRow == addrB % numUnitsPerRow |
---|
909 | return (( addrA ^ addrB ) & ( numUnitsPerRow - 1 ) ) == 0; |
---|
910 | } |
---|
911 | |
---|
912 | /** Check whether 2 addresses point to the same row |
---|
913 | * \param addrA First address in raster scan order |
---|
914 | * \param addrB Second address in raters scan order |
---|
915 | * \param numUnitsPerRow Number of units in a row |
---|
916 | * \return Result of test |
---|
917 | */ |
---|
918 | static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
919 | { |
---|
920 | // addrA / numUnitsPerRow == addrB / numUnitsPerRow |
---|
921 | return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
922 | } |
---|
923 | |
---|
924 | /** Check whether 2 addresses point to the same row or column |
---|
925 | * \param addrA First address in raster scan order |
---|
926 | * \param addrB Second address in raters scan order |
---|
927 | * \param numUnitsPerRow Number of units in a row |
---|
928 | * \return Result of test |
---|
929 | */ |
---|
930 | static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
931 | { |
---|
932 | return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow ); |
---|
933 | } |
---|
934 | |
---|
935 | /** Check whether one address points to the first column |
---|
936 | * \param addr Address in raster scan order |
---|
937 | * \param numUnitsPerRow Number of units in a row |
---|
938 | * \return Result of test |
---|
939 | */ |
---|
940 | static inline Bool isZeroCol( Int addr, Int numUnitsPerRow ) |
---|
941 | { |
---|
942 | // addr % numUnitsPerRow == 0 |
---|
943 | return ( addr & ( numUnitsPerRow - 1 ) ) == 0; |
---|
944 | } |
---|
945 | |
---|
946 | /** Check whether one address points to the first row |
---|
947 | * \param addr Address in raster scan order |
---|
948 | * \param numUnitsPerRow Number of units in a row |
---|
949 | * \return Result of test |
---|
950 | */ |
---|
951 | static inline Bool isZeroRow( Int addr, Int numUnitsPerRow ) |
---|
952 | { |
---|
953 | // addr / numUnitsPerRow == 0 |
---|
954 | return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
955 | } |
---|
956 | |
---|
957 | /** Check whether one address points to a column whose index is smaller than a given value |
---|
958 | * \param addr Address in raster scan order |
---|
959 | * \param val Given column index value |
---|
960 | * \param numUnitsPerRow Number of units in a row |
---|
961 | * \return Result of test |
---|
962 | */ |
---|
963 | static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow ) |
---|
964 | { |
---|
965 | // addr % numUnitsPerRow < val |
---|
966 | return ( addr & ( numUnitsPerRow - 1 ) ) < val; |
---|
967 | } |
---|
968 | |
---|
969 | /** Check whether one address points to a row whose index is smaller than a given value |
---|
970 | * \param addr Address in raster scan order |
---|
971 | * \param val Given row index value |
---|
972 | * \param numUnitsPerRow Number of units in a row |
---|
973 | * \return Result of test |
---|
974 | */ |
---|
975 | static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow ) |
---|
976 | { |
---|
977 | // addr / numUnitsPerRow < val |
---|
978 | return addr < val * numUnitsPerRow; |
---|
979 | } |
---|
980 | }; |
---|
981 | |
---|
982 | //! \} |
---|
983 | |
---|
984 | #endif |
---|