1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2013, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file 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 H_3D_ARP |
---|
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 | Bool allBordersAvailable; |
---|
94 | |
---|
95 | NDBFBlockInfo():tileID(0), sliceID(0), startSU(0), endSU(0) {} //!< constructor |
---|
96 | const NDBFBlockInfo& operator= (const NDBFBlockInfo& src); //!< "=" operator |
---|
97 | }; |
---|
98 | |
---|
99 | |
---|
100 | // ==================================================================================================================== |
---|
101 | // Class definition |
---|
102 | // ==================================================================================================================== |
---|
103 | |
---|
104 | /// CU data structure class |
---|
105 | class TComDataCU |
---|
106 | { |
---|
107 | private: |
---|
108 | |
---|
109 | // ------------------------------------------------------------------------------------------------------------------- |
---|
110 | // class pointers |
---|
111 | // ------------------------------------------------------------------------------------------------------------------- |
---|
112 | |
---|
113 | TComPic* m_pcPic; ///< picture class pointer |
---|
114 | TComSlice* m_pcSlice; ///< slice header pointer |
---|
115 | TComPattern* m_pcPattern; ///< neighbour access class pointer |
---|
116 | |
---|
117 | // ------------------------------------------------------------------------------------------------------------------- |
---|
118 | // CU description |
---|
119 | // ------------------------------------------------------------------------------------------------------------------- |
---|
120 | |
---|
121 | UInt m_uiCUAddr; ///< CU address in a slice |
---|
122 | UInt m_uiAbsIdxInLCU; ///< absolute address in a CU. It's Z scan order |
---|
123 | UInt m_uiCUPelX; ///< CU position in a pixel (X) |
---|
124 | UInt m_uiCUPelY; ///< CU position in a pixel (Y) |
---|
125 | UInt m_uiNumPartition; ///< total number of minimum partitions in a CU |
---|
126 | UChar* m_puhWidth; ///< array of widths |
---|
127 | UChar* m_puhHeight; ///< array of heights |
---|
128 | UChar* m_puhDepth; ///< array of depths |
---|
129 | Int m_unitSize; ///< size of a "minimum partition" |
---|
130 | |
---|
131 | // ------------------------------------------------------------------------------------------------------------------- |
---|
132 | // CU data |
---|
133 | // ------------------------------------------------------------------------------------------------------------------- |
---|
134 | Bool* m_skipFlag; ///< array of skip flags |
---|
135 | Char* m_pePartSize; ///< array of partition sizes |
---|
136 | Char* m_pePredMode; ///< array of prediction modes |
---|
137 | Bool* m_CUTransquantBypass; ///< array of cu_transquant_bypass flags |
---|
138 | Char* m_phQP; ///< array of QP values |
---|
139 | UChar* m_puhTrIdx; ///< array of transform indices |
---|
140 | UChar* m_puhTransformSkip[3];///< array of transform skipping flags |
---|
141 | UChar* m_puhCbf[3]; ///< array of coded block flags (CBF) |
---|
142 | TComCUMvField m_acCUMvField[2]; ///< array of motion vectors |
---|
143 | TCoeff* m_pcTrCoeffY; ///< transformed coefficient buffer (Y) |
---|
144 | TCoeff* m_pcTrCoeffCb; ///< transformed coefficient buffer (Cb) |
---|
145 | TCoeff* m_pcTrCoeffCr; ///< transformed coefficient buffer (Cr) |
---|
146 | #if ADAPTIVE_QP_SELECTION |
---|
147 | Int* m_pcArlCoeffY; ///< ARL coefficient buffer (Y) |
---|
148 | Int* m_pcArlCoeffCb; ///< ARL coefficient buffer (Cb) |
---|
149 | Int* m_pcArlCoeffCr; ///< ARL coefficient buffer (Cr) |
---|
150 | Bool m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d |
---|
151 | |
---|
152 | static Int* m_pcGlbArlCoeffY; ///< ARL coefficient buffer (Y) |
---|
153 | static Int* m_pcGlbArlCoeffCb; ///< ARL coefficient buffer (Cb) |
---|
154 | static Int* m_pcGlbArlCoeffCr; ///< ARL coefficient buffer (Cr) |
---|
155 | #endif |
---|
156 | |
---|
157 | Pel* m_pcIPCMSampleY; ///< PCM sample buffer (Y) |
---|
158 | Pel* m_pcIPCMSampleCb; ///< PCM sample buffer (Cb) |
---|
159 | Pel* m_pcIPCMSampleCr; ///< PCM sample buffer (Cr) |
---|
160 | |
---|
161 | Int* m_piSliceSUMap; ///< pointer of slice ID map |
---|
162 | std::vector<NDBFBlockInfo> m_vNDFBlock; |
---|
163 | |
---|
164 | // ------------------------------------------------------------------------------------------------------------------- |
---|
165 | // neighbour access variables |
---|
166 | // ------------------------------------------------------------------------------------------------------------------- |
---|
167 | |
---|
168 | TComDataCU* m_pcCUAboveLeft; ///< pointer of above-left CU |
---|
169 | TComDataCU* m_pcCUAboveRight; ///< pointer of above-right CU |
---|
170 | TComDataCU* m_pcCUAbove; ///< pointer of above CU |
---|
171 | TComDataCU* m_pcCULeft; ///< pointer of left CU |
---|
172 | TComDataCU* m_apcCUColocated[2]; ///< pointer of temporally colocated CU's for both directions |
---|
173 | TComMvField m_cMvFieldA; ///< motion vector of position A |
---|
174 | TComMvField m_cMvFieldB; ///< motion vector of position B |
---|
175 | TComMvField m_cMvFieldC; ///< motion vector of position C |
---|
176 | TComMv m_cMvPred; ///< motion vector predictor |
---|
177 | |
---|
178 | // ------------------------------------------------------------------------------------------------------------------- |
---|
179 | // coding tool information |
---|
180 | // ------------------------------------------------------------------------------------------------------------------- |
---|
181 | |
---|
182 | Bool* m_pbMergeFlag; ///< array of merge flags |
---|
183 | UChar* m_puhMergeIndex; ///< array of merge candidate indices |
---|
184 | #if AMP_MRG |
---|
185 | Bool m_bIsMergeAMP; |
---|
186 | #endif |
---|
187 | UChar* m_puhLumaIntraDir; ///< array of intra directions (luma) |
---|
188 | UChar* m_puhChromaIntraDir; ///< array of intra directions (chroma) |
---|
189 | UChar* m_puhInterDir; ///< array of inter directions |
---|
190 | Char* m_apiMVPIdx[2]; ///< array of motion vector predictor candidates |
---|
191 | Char* m_apiMVPNum[2]; ///< array of number of possible motion vectors predictors |
---|
192 | Bool* m_pbIPCMFlag; ///< array of intra_pcm flags |
---|
193 | #if H_3D_NBDV |
---|
194 | DisInfo* m_pDvInfo; |
---|
195 | #endif |
---|
196 | #if H_3D_VSP |
---|
197 | Char* m_piVSPFlag; ///< array of VSP flags to indicate whehter a block uses VSP or not |
---|
198 | ///< 0: non-VSP; 1: VSP |
---|
199 | #if MTK_VSP_FIX_E0172 |
---|
200 | Char* m_piVSPDir; ///< 0: LIST0; 1: LIST1 |
---|
201 | #endif |
---|
202 | #endif |
---|
203 | #if H_3D_ARP |
---|
204 | UChar* m_puhARPW; |
---|
205 | #endif |
---|
206 | #if H_3D_IC |
---|
207 | Bool* m_pbICFlag; ///< array of IC flags |
---|
208 | #endif |
---|
209 | #if H_3D_DIM |
---|
210 | Pel* m_dimDeltaDC[DIM_NUM_TYPE][2]; |
---|
211 | #if H_3D_DIM_DMM |
---|
212 | UInt* m_dmmWedgeTabIdx[DMM_NUM_TYPE]; |
---|
213 | Int* m_dmm2DeltaEnd; |
---|
214 | UInt* m_dmm3IntraTabIdx; |
---|
215 | #endif |
---|
216 | #if H_3D_DIM_RBC |
---|
217 | UChar* m_pucEdgeCode; ///< array of edge code |
---|
218 | UChar* m_pucEdgeNumber; ///< total number of edge |
---|
219 | UChar* m_pucEdgeStartPos; ///< starting point position |
---|
220 | Bool* m_pbEdgeLeftFirst; ///< true if edge should be checked in left boundary first |
---|
221 | Bool* m_pbEdgePartition; ///< true if it belongs to region 1, otherwise, region 0 |
---|
222 | #endif |
---|
223 | #if H_3D_DIM_SDC |
---|
224 | Bool* m_pbSDCFlag; |
---|
225 | Pel* m_apSegmentDCOffset[2]; |
---|
226 | #endif |
---|
227 | #endif |
---|
228 | |
---|
229 | // ------------------------------------------------------------------------------------------------------------------- |
---|
230 | // misc. variables |
---|
231 | // ------------------------------------------------------------------------------------------------------------------- |
---|
232 | |
---|
233 | Bool m_bDecSubCu; ///< indicates decoder-mode |
---|
234 | Double m_dTotalCost; ///< sum of partition RD costs |
---|
235 | #if H_3D_VSO |
---|
236 | Dist m_uiTotalDistortion; ///< sum of partition distortion |
---|
237 | #else |
---|
238 | UInt m_uiTotalDistortion; ///< sum of partition distortion |
---|
239 | #endif |
---|
240 | UInt m_uiTotalBits; ///< sum of partition bits |
---|
241 | UInt m_uiTotalBins; ///< sum of partition bins |
---|
242 | UInt* m_sliceStartCU; ///< Start CU address of current slice |
---|
243 | UInt* m_sliceSegmentStartCU; ///< Start CU address of current slice |
---|
244 | Char m_codedQP; |
---|
245 | protected: |
---|
246 | |
---|
247 | /// add possible motion vector predictor candidates |
---|
248 | Bool xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
249 | Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
250 | #if H_3D_VSP |
---|
251 | #if MTK_VSP_FIX_E0172 |
---|
252 | Bool xAddVspCand( UChar ucVspMergePos, Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, |
---|
253 | Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int* vspDir ); |
---|
254 | #else |
---|
255 | Bool xAddVspCand( UChar ucVspMergePos, Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, |
---|
256 | Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag ); |
---|
257 | #endif |
---|
258 | #endif |
---|
259 | |
---|
260 | Void deriveRightBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxRB ); |
---|
261 | Bool xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx |
---|
262 | #if H_3D_TMVP |
---|
263 | , |
---|
264 | Bool bMRG = true |
---|
265 | #endif |
---|
266 | ); |
---|
267 | |
---|
268 | /// compute required bits to encode MVD (used in AMVP) |
---|
269 | UInt xGetMvdBits ( TComMv cMvd ); |
---|
270 | UInt xGetComponentBits ( Int iVal ); |
---|
271 | |
---|
272 | /// compute scaling factor from POC difference |
---|
273 | #if !H_3D_ARP |
---|
274 | Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
275 | #endif |
---|
276 | |
---|
277 | Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter ); |
---|
278 | |
---|
279 | public: |
---|
280 | TComDataCU(); |
---|
281 | virtual ~TComDataCU(); |
---|
282 | |
---|
283 | // ------------------------------------------------------------------------------------------------------------------- |
---|
284 | // create / destroy / initialize / copy |
---|
285 | // ------------------------------------------------------------------------------------------------------------------- |
---|
286 | #if H_3D_ARP |
---|
287 | Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
288 | #endif |
---|
289 | Void create ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize |
---|
290 | #if ADAPTIVE_QP_SELECTION |
---|
291 | , Bool bGlobalRMARLBuffer = false |
---|
292 | #endif |
---|
293 | ); |
---|
294 | Void destroy (); |
---|
295 | |
---|
296 | Void initCU ( TComPic* pcPic, UInt uiCUAddr ); |
---|
297 | Void initEstData ( UInt uiDepth, Int qp ); |
---|
298 | Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); |
---|
299 | Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
300 | #if H_3D_NBDV |
---|
301 | Void copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx); |
---|
302 | #endif |
---|
303 | Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
304 | Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList |
---|
305 | #if H_3D_NBDV |
---|
306 | , Bool bNBDV = false |
---|
307 | #endif |
---|
308 | ); |
---|
309 | Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
310 | |
---|
311 | Void copyToPic ( UChar uiDepth ); |
---|
312 | Void copyToPic ( UChar uiDepth, UInt uiPartIdx, UInt uiPartDepth ); |
---|
313 | |
---|
314 | // ------------------------------------------------------------------------------------------------------------------- |
---|
315 | // member functions for CU description |
---|
316 | // ------------------------------------------------------------------------------------------------------------------- |
---|
317 | |
---|
318 | TComPic* getPic () { return m_pcPic; } |
---|
319 | TComSlice* getSlice () { return m_pcSlice; } |
---|
320 | UInt& getAddr () { return m_uiCUAddr; } |
---|
321 | UInt& getZorderIdxInCU () { return m_uiAbsIdxInLCU; } |
---|
322 | UInt getSCUAddr (); |
---|
323 | UInt getCUPelX () { return m_uiCUPelX; } |
---|
324 | UInt getCUPelY () { return m_uiCUPelY; } |
---|
325 | TComPattern* getPattern () { return m_pcPattern; } |
---|
326 | |
---|
327 | UChar* getDepth () { return m_puhDepth; } |
---|
328 | UChar getDepth ( UInt uiIdx ) { return m_puhDepth[uiIdx]; } |
---|
329 | Void setDepth ( UInt uiIdx, UChar uh ) { m_puhDepth[uiIdx] = uh; } |
---|
330 | |
---|
331 | Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); |
---|
332 | #if H_3D |
---|
333 | Void getPosInPic ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ); |
---|
334 | #endif |
---|
335 | |
---|
336 | // ------------------------------------------------------------------------------------------------------------------- |
---|
337 | // member functions for CU data |
---|
338 | // ------------------------------------------------------------------------------------------------------------------- |
---|
339 | |
---|
340 | Char* getPartitionSize () { return m_pePartSize; } |
---|
341 | PartSize getPartitionSize ( UInt uiIdx ) { return static_cast<PartSize>( m_pePartSize[uiIdx] ); } |
---|
342 | Void setPartitionSize ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh; } |
---|
343 | Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
344 | Void setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
345 | |
---|
346 | Bool* getSkipFlag () { return m_skipFlag; } |
---|
347 | Bool getSkipFlag (UInt idx) { return m_skipFlag[idx]; } |
---|
348 | Void setSkipFlag ( UInt idx, Bool skip) { m_skipFlag[idx] = skip; } |
---|
349 | Void setSkipFlagSubParts ( Bool skip, UInt absPartIdx, UInt depth ); |
---|
350 | |
---|
351 | Char* getPredictionMode () { return m_pePredMode; } |
---|
352 | PredMode getPredictionMode ( UInt uiIdx ) { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } |
---|
353 | Bool* getCUTransquantBypass () { return m_CUTransquantBypass; } |
---|
354 | Bool getCUTransquantBypass( UInt uiIdx ) { return m_CUTransquantBypass[uiIdx]; } |
---|
355 | Void setPredictionMode ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh; } |
---|
356 | Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
357 | |
---|
358 | UChar* getWidth () { return m_puhWidth; } |
---|
359 | UChar getWidth ( UInt uiIdx ) { return m_puhWidth[uiIdx]; } |
---|
360 | Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh; } |
---|
361 | |
---|
362 | UChar* getHeight () { return m_puhHeight; } |
---|
363 | UChar getHeight ( UInt uiIdx ) { return m_puhHeight[uiIdx]; } |
---|
364 | Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh; } |
---|
365 | |
---|
366 | Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
367 | |
---|
368 | Char* getQP () { return m_phQP; } |
---|
369 | Char getQP ( UInt uiIdx ) { return m_phQP[uiIdx]; } |
---|
370 | Void setQP ( UInt uiIdx, Char value ){ m_phQP[uiIdx] = value; } |
---|
371 | Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
372 | Int getLastValidPartIdx ( Int iAbsPartIdx ); |
---|
373 | Char getLastCodedQP ( UInt uiAbsPartIdx ); |
---|
374 | Void setQPSubCUs ( Int qp, TComDataCU* pcCU, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf ); |
---|
375 | Void setCodedQP ( Char qp ) { m_codedQP = qp; } |
---|
376 | Char getCodedQP () { return m_codedQP; } |
---|
377 | |
---|
378 | Bool isLosslessCoded(UInt absPartIdx); |
---|
379 | |
---|
380 | UChar* getTransformIdx () { return m_puhTrIdx; } |
---|
381 | UChar getTransformIdx ( UInt uiIdx ) { return m_puhTrIdx[uiIdx]; } |
---|
382 | Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
383 | |
---|
384 | UChar* getTransformSkip ( TextType eType) { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]];} |
---|
385 | UChar getTransformSkip ( UInt uiIdx,TextType eType) { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]][uiIdx];} |
---|
386 | Void setTransformSkipSubParts ( UInt useTransformSkip, TextType eType, UInt uiAbsPartIdx, UInt uiDepth); |
---|
387 | Void setTransformSkipSubParts ( UInt useTransformSkipY, UInt useTransformSkipU, UInt useTransformSkipV, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
388 | |
---|
389 | UInt getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ); |
---|
390 | |
---|
391 | TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } |
---|
392 | |
---|
393 | TCoeff*& getCoeffY () { return m_pcTrCoeffY; } |
---|
394 | TCoeff*& getCoeffCb () { return m_pcTrCoeffCb; } |
---|
395 | TCoeff*& getCoeffCr () { return m_pcTrCoeffCr; } |
---|
396 | #if ADAPTIVE_QP_SELECTION |
---|
397 | Int*& getArlCoeffY () { return m_pcArlCoeffY; } |
---|
398 | Int*& getArlCoeffCb () { return m_pcArlCoeffCb; } |
---|
399 | Int*& getArlCoeffCr () { return m_pcArlCoeffCr; } |
---|
400 | #endif |
---|
401 | |
---|
402 | Pel*& getPCMSampleY () { return m_pcIPCMSampleY; } |
---|
403 | Pel*& getPCMSampleCb () { return m_pcIPCMSampleCb; } |
---|
404 | Pel*& getPCMSampleCr () { return m_pcIPCMSampleCr; } |
---|
405 | |
---|
406 | UChar getCbf ( UInt uiIdx, TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx]; } |
---|
407 | UChar* getCbf ( TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]]; } |
---|
408 | UChar getCbf ( UInt uiIdx, TextType eType, UInt uiTrDepth ) { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); } |
---|
409 | Void setCbf ( UInt uiIdx, TextType eType, UChar uh ) { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh; } |
---|
410 | Void clearCbf ( UInt uiIdx, TextType eType, UInt uiNumParts ); |
---|
411 | UChar getQtRootCbf ( UInt uiIdx ) { return getCbf( uiIdx, TEXT_LUMA, 0 ) || getCbf( uiIdx, TEXT_CHROMA_U, 0 ) || getCbf( uiIdx, TEXT_CHROMA_V, 0 ); } |
---|
412 | |
---|
413 | Void setCbfSubParts ( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
414 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
415 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
416 | |
---|
417 | // ------------------------------------------------------------------------------------------------------------------- |
---|
418 | // member functions for coding tool information |
---|
419 | // ------------------------------------------------------------------------------------------------------------------- |
---|
420 | |
---|
421 | Bool* getMergeFlag () { return m_pbMergeFlag; } |
---|
422 | Bool getMergeFlag ( UInt uiIdx ) { return m_pbMergeFlag[uiIdx]; } |
---|
423 | Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b; } |
---|
424 | Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
425 | |
---|
426 | UChar* getMergeIndex () { return m_puhMergeIndex; } |
---|
427 | UChar getMergeIndex ( UInt uiIdx ) { return m_puhMergeIndex[uiIdx]; } |
---|
428 | Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } |
---|
429 | Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
430 | template <typename T> |
---|
431 | Void setSubPart ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
432 | |
---|
433 | #if AMP_MRG |
---|
434 | Void setMergeAMP( Bool b ) { m_bIsMergeAMP = b; } |
---|
435 | Bool getMergeAMP( ) { return m_bIsMergeAMP; } |
---|
436 | #endif |
---|
437 | |
---|
438 | UChar* getLumaIntraDir () { return m_puhLumaIntraDir; } |
---|
439 | UChar getLumaIntraDir ( UInt uiIdx ) { return m_puhLumaIntraDir[uiIdx]; } |
---|
440 | Void setLumaIntraDir ( UInt uiIdx, UChar uh ) { m_puhLumaIntraDir[uiIdx] = uh; } |
---|
441 | Void setLumaIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
442 | |
---|
443 | UChar* getChromaIntraDir () { return m_puhChromaIntraDir; } |
---|
444 | UChar getChromaIntraDir ( UInt uiIdx ) { return m_puhChromaIntraDir[uiIdx]; } |
---|
445 | Void setChromaIntraDir ( UInt uiIdx, UChar uh ) { m_puhChromaIntraDir[uiIdx] = uh; } |
---|
446 | Void setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
447 | |
---|
448 | UChar* getInterDir () { return m_puhInterDir; } |
---|
449 | UChar getInterDir ( UInt uiIdx ) { return m_puhInterDir[uiIdx]; } |
---|
450 | Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh; } |
---|
451 | Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
452 | Bool* getIPCMFlag () { return m_pbIPCMFlag; } |
---|
453 | Bool getIPCMFlag (UInt uiIdx ) { return m_pbIPCMFlag[uiIdx]; } |
---|
454 | Void setIPCMFlag (UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } |
---|
455 | Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth); |
---|
456 | #if H_3D_NBDV |
---|
457 | Void setDvInfoSubParts ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
458 | DisInfo* getDvInfo () { return m_pDvInfo; } |
---|
459 | DisInfo getDvInfo (UInt uiIdx) { return m_pDvInfo[uiIdx]; } |
---|
460 | #endif |
---|
461 | /// get slice ID for SU |
---|
462 | Int getSUSliceID (UInt uiIdx) {return m_piSliceSUMap[uiIdx]; } |
---|
463 | |
---|
464 | /// get the pointer of slice ID map |
---|
465 | Int* getSliceSUMap () {return m_piSliceSUMap; } |
---|
466 | |
---|
467 | /// set the pointer of slice ID map |
---|
468 | Void setSliceSUMap (Int *pi) {m_piSliceSUMap = pi; } |
---|
469 | |
---|
470 | std::vector<NDBFBlockInfo>* getNDBFilterBlocks() {return &m_vNDFBlock;} |
---|
471 | Void setNDBFilterBlockBorderAvailability(UInt numLCUInPicWidth, UInt numLCUInPicHeight, UInt numSUInLCUWidth, UInt numSUInLCUHeight, UInt picWidth, UInt picHeight |
---|
472 | ,std::vector<Bool>& LFCrossSliceBoundary |
---|
473 | ,Bool bTopTileBoundary, Bool bDownTileBoundary, Bool bLeftTileBoundary, Bool bRightTileBoundary |
---|
474 | ,Bool bIndependentTileBoundaryEnabled ); |
---|
475 | #if H_3D_NBDV |
---|
476 | Void xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb ); |
---|
477 | Bool xCheckSpatialNBDV (TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo, |
---|
478 | UInt uiMvpDvPos |
---|
479 | #if H_3D_NBDV_REF |
---|
480 | , Bool bDepthRefine = false |
---|
481 | #endif |
---|
482 | ); |
---|
483 | #if MTK_NBDV_TN_FIX_E0172 |
---|
484 | Bool xGetColDisMV ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx ); |
---|
485 | #else |
---|
486 | Bool xGetColDisMV ( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx ); |
---|
487 | #endif |
---|
488 | Bool getDisMvpCandNBDV ( DisInfo* pDInfo |
---|
489 | #if H_3D_NBDV_REF |
---|
490 | , Bool bDepthRefine = false |
---|
491 | #endif |
---|
492 | ); |
---|
493 | |
---|
494 | #if H_3D_NBDV_REF |
---|
495 | Pel getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT ); |
---|
496 | Void estimateDVFromDM(Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred ); |
---|
497 | #endif //H_3D_NBDV_REF |
---|
498 | #endif |
---|
499 | #if H_3D_IV_MERGE |
---|
500 | Bool getInterViewMergeCands ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc ); |
---|
501 | #endif |
---|
502 | #if H_3D_ARP |
---|
503 | UChar* getARPW () { return m_puhARPW; } |
---|
504 | UChar getARPW ( UInt uiIdx ) { return m_puhARPW[uiIdx]; } |
---|
505 | Void setARPW ( UInt uiIdx, UChar w ) { m_puhARPW[uiIdx] = w; } |
---|
506 | Void setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
507 | Double getARPWFactor ( UInt uiIdx ); |
---|
508 | #endif |
---|
509 | #if H_3D_IC |
---|
510 | Bool* getICFlag () { return m_pbICFlag; } |
---|
511 | Bool getICFlag ( UInt uiIdx ) { return m_pbICFlag[uiIdx]; } |
---|
512 | Void setICFlag ( UInt uiIdx, Bool uh ) { m_pbICFlag[uiIdx] = uh; } |
---|
513 | Void setICFlagSubParts ( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
514 | Bool isICFlagRequired ( UInt uiAbsPartIdx ); |
---|
515 | Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false); |
---|
516 | #else |
---|
517 | // ------------------------------------------------------------------------------------------------------------------- |
---|
518 | // member functions for accessing partition information |
---|
519 | // ------------------------------------------------------------------------------------------------------------------- |
---|
520 | |
---|
521 | Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); |
---|
522 | #endif |
---|
523 | UChar getNumPartInter (); |
---|
524 | Bool isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth); |
---|
525 | |
---|
526 | #if H_3D_DIM |
---|
527 | Pel* getDimDeltaDC ( UInt dimType, UInt segId ) { return m_dimDeltaDC[dimType][segId]; } |
---|
528 | Pel getDimDeltaDC ( UInt dimType, UInt segId, UInt uiIdx ) { return m_dimDeltaDC[dimType][segId][uiIdx]; } |
---|
529 | Void setDimDeltaDC ( UInt dimType, UInt segId, UInt uiIdx, Pel val ) { m_dimDeltaDC[dimType][segId][uiIdx] = val; } |
---|
530 | #if H_3D_DIM_DMM |
---|
531 | UInt* getDmmWedgeTabIdx ( UInt dmmType ) { return m_dmmWedgeTabIdx[dmmType]; } |
---|
532 | UInt getDmmWedgeTabIdx ( UInt dmmType, UInt uiIdx ) { return m_dmmWedgeTabIdx[dmmType][uiIdx]; } |
---|
533 | Void setDmmWedgeTabIdx ( UInt dmmType, UInt uiIdx, UInt tabIdx ) { m_dmmWedgeTabIdx[dmmType][uiIdx] = tabIdx; } |
---|
534 | Void setDmmWedgeTabIdxSubParts ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
535 | |
---|
536 | Int* getDmm2DeltaEnd () { return m_dmm2DeltaEnd; } |
---|
537 | Int getDmm2DeltaEnd ( UInt uiIdx ) { return m_dmm2DeltaEnd[uiIdx]; } |
---|
538 | Void setDmm2DeltaEnd ( UInt uiIdx, Int iD ) { m_dmm2DeltaEnd[uiIdx] = iD; } |
---|
539 | Void setDmm2DeltaEndSubParts ( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
540 | |
---|
541 | UInt* getDmm3IntraTabIdx () { return m_dmm3IntraTabIdx; } |
---|
542 | UInt getDmm3IntraTabIdx ( UInt uiIdx ) { return m_dmm3IntraTabIdx[uiIdx]; } |
---|
543 | Void setDmm3IntraTabIdx ( UInt uiIdx, UInt uh ) { m_dmm3IntraTabIdx[uiIdx] = uh; } |
---|
544 | Void setDmm3IntraTabIdxSubParts ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
545 | #endif |
---|
546 | #if H_3D_DIM_RBC |
---|
547 | UChar* getEdgeCode( UInt uiIdx ) { return &m_pucEdgeCode[uiIdx * RBC_MAX_EDGE_NUM_PER_4x4]; } |
---|
548 | |
---|
549 | UChar* getEdgeNumber( ) { return m_pucEdgeNumber; } |
---|
550 | UChar getEdgeNumber( UInt uiIdx ) { return m_pucEdgeNumber[uiIdx]; } |
---|
551 | Void setEdgeNumber( UInt uiIdx, UChar val ) { m_pucEdgeNumber[uiIdx] = val; } |
---|
552 | |
---|
553 | UChar* getEdgeStartPos( ) { return m_pucEdgeStartPos; } |
---|
554 | UChar getEdgeStartPos( UInt uiIdx ) { return m_pucEdgeStartPos[uiIdx]; } |
---|
555 | Void setEdgeStartPos( UInt uiIdx, UChar val ) { m_pucEdgeStartPos[uiIdx] = val; } |
---|
556 | |
---|
557 | Bool* getEdgeLeftFirst( ) { return m_pbEdgeLeftFirst; } |
---|
558 | Bool getEdgeLeftFirst( UInt uiIdx ) { return m_pbEdgeLeftFirst[uiIdx]; } |
---|
559 | Void setEdgeLeftFirst( UInt uiIdx, Bool val ) { m_pbEdgeLeftFirst[uiIdx] = val; } |
---|
560 | |
---|
561 | Bool* getEdgePartition( UInt uiIdx ) { return &m_pbEdgePartition[uiIdx * 16]; } |
---|
562 | |
---|
563 | Void reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion ); |
---|
564 | #endif |
---|
565 | #if H_3D_DIM_SDC |
---|
566 | Bool* getSDCFlag () { return m_pbSDCFlag; } |
---|
567 | Bool getSDCFlag ( UInt uiIdx ) { return m_pbSDCFlag[uiIdx]; } |
---|
568 | Void setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
569 | |
---|
570 | Bool getSDCAvailable ( UInt uiAbsPartIdx ); |
---|
571 | |
---|
572 | Pel* getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; } |
---|
573 | Pel getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; } |
---|
574 | Void setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; } |
---|
575 | #endif |
---|
576 | #endif |
---|
577 | |
---|
578 | // ------------------------------------------------------------------------------------------------------------------- |
---|
579 | // member functions for motion vector |
---|
580 | // ------------------------------------------------------------------------------------------------------------------- |
---|
581 | |
---|
582 | Void getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); |
---|
583 | |
---|
584 | Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ); |
---|
585 | Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP); |
---|
586 | Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH); |
---|
587 | Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } |
---|
588 | Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) { return m_apiMVPIdx[eRefPicList][uiIdx]; } |
---|
589 | Char* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList]; } |
---|
590 | |
---|
591 | Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum; } |
---|
592 | Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) { return m_apiMVPNum[eRefPicList][uiIdx]; } |
---|
593 | Char* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList]; } |
---|
594 | |
---|
595 | Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
596 | Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
597 | |
---|
598 | Void clipMv ( TComMv& rcMv ); |
---|
599 | Void getMvPredLeft ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldA.getMv(); } |
---|
600 | Void getMvPredAbove ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldB.getMv(); } |
---|
601 | Void getMvPredAboveRight ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldC.getMv(); } |
---|
602 | |
---|
603 | Void compressMV (); |
---|
604 | |
---|
605 | // ------------------------------------------------------------------------------------------------------------------- |
---|
606 | // utility functions for neighbouring information |
---|
607 | // ------------------------------------------------------------------------------------------------------------------- |
---|
608 | |
---|
609 | TComDataCU* getCULeft () { return m_pcCULeft; } |
---|
610 | TComDataCU* getCUAbove () { return m_pcCUAbove; } |
---|
611 | TComDataCU* getCUAboveLeft () { return m_pcCUAboveLeft; } |
---|
612 | TComDataCU* getCUAboveRight () { return m_pcCUAboveRight; } |
---|
613 | TComDataCU* getCUColocated ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; } |
---|
614 | |
---|
615 | |
---|
616 | TComDataCU* getPULeft ( UInt& uiLPartUnitIdx, |
---|
617 | UInt uiCurrPartUnitIdx, |
---|
618 | Bool bEnforceSliceRestriction=true, |
---|
619 | Bool bEnforceTileRestriction=true ); |
---|
620 | TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx, |
---|
621 | UInt uiCurrPartUnitIdx, |
---|
622 | Bool bEnforceSliceRestriction=true, |
---|
623 | Bool planarAtLCUBoundary = false, |
---|
624 | Bool bEnforceTileRestriction=true ); |
---|
625 | TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ); |
---|
626 | TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ); |
---|
627 | TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ); |
---|
628 | |
---|
629 | TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU ); |
---|
630 | TComDataCU* getQpMinCuAbove ( UInt& aPartUnitIdx , UInt currAbsIdxInLCU ); |
---|
631 | Char getRefQP ( UInt uiCurrAbsIdxInLCU ); |
---|
632 | |
---|
633 | TComDataCU* getPUAboveRightAdi ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ); |
---|
634 | TComDataCU* getPUBelowLeftAdi ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ); |
---|
635 | |
---|
636 | Void deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
637 | Void deriveLeftBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
638 | |
---|
639 | Void deriveLeftRightTopIdxAdi ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth ); |
---|
640 | Void deriveLeftBottomIdxAdi ( UInt& ruiPartIdxLB, UInt uiPartOffset, UInt uiPartDepth ); |
---|
641 | |
---|
642 | Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); |
---|
643 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours |
---|
644 | #if H_3D_VSP |
---|
645 | , Int* vspFlag |
---|
646 | #if MTK_VSP_FIX_E0172 |
---|
647 | , Int* vspDir |
---|
648 | #endif |
---|
649 | #endif |
---|
650 | , Int& numValidMergeCand, Int mrgCandIdx = -1 ); |
---|
651 | #if H_3D_VSP |
---|
652 | Char* getVSPFlag () { return m_piVSPFlag; } |
---|
653 | Char getVSPFlag ( UInt uiIdx ) { return m_piVSPFlag[uiIdx]; } |
---|
654 | Void setVSPFlag ( UInt uiIdx, Int n ) { m_piVSPFlag[uiIdx] = n; } |
---|
655 | Void setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
656 | #if MTK_VSP_FIX_E0172 |
---|
657 | Char* getVSPDir () { return m_piVSPDir; } |
---|
658 | Char getVSPDir ( UInt uiIdx ) { return m_piVSPDir[uiIdx]; } |
---|
659 | Void setVSPDir ( UInt uiIdx, Int n ) { m_piVSPDir[uiIdx] = n; } |
---|
660 | Void setVSPDirSubParts ( Char iVSPDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
661 | #endif |
---|
662 | #endif |
---|
663 | Void deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
664 | Void deriveLeftBottomIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
665 | |
---|
666 | |
---|
667 | // ------------------------------------------------------------------------------------------------------------------- |
---|
668 | // member functions for modes |
---|
669 | // ------------------------------------------------------------------------------------------------------------------- |
---|
670 | |
---|
671 | Bool isIntra ( UInt uiPartIdx ) { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } |
---|
672 | Bool isSkipped ( UInt uiPartIdx ); ///< SKIP (no residual) |
---|
673 | Bool isBipredRestriction( UInt puIdx ); |
---|
674 | |
---|
675 | // ------------------------------------------------------------------------------------------------------------------- |
---|
676 | // member functions for symbol prediction (most probable / mode conversion) |
---|
677 | // ------------------------------------------------------------------------------------------------------------------- |
---|
678 | |
---|
679 | UInt getIntraSizeIdx ( UInt uiAbsPartIdx ); |
---|
680 | |
---|
681 | Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList ); |
---|
682 | Int getIntraDirLumaPredictor ( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode = NULL ); |
---|
683 | |
---|
684 | // ------------------------------------------------------------------------------------------------------------------- |
---|
685 | // member functions for SBAC context |
---|
686 | // ------------------------------------------------------------------------------------------------------------------- |
---|
687 | |
---|
688 | UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
689 | UInt getCtxQtCbf ( TextType eType, UInt uiTrDepth ); |
---|
690 | |
---|
691 | UInt getCtxSkipFlag ( UInt uiAbsPartIdx ); |
---|
692 | UInt getCtxInterDir ( UInt uiAbsPartIdx ); |
---|
693 | |
---|
694 | #if H_3D_ARP |
---|
695 | UInt getCTXARPWFlag ( UInt uiAbsPartIdx ); |
---|
696 | #endif |
---|
697 | #if H_3D_IC |
---|
698 | UInt getCtxICFlag ( UInt uiAbsPartIdx ); |
---|
699 | #endif |
---|
700 | UInt getSliceStartCU ( UInt pos ) { return m_sliceStartCU[pos-m_uiAbsIdxInLCU]; } |
---|
701 | UInt getSliceSegmentStartCU ( UInt pos ) { return m_sliceSegmentStartCU[pos-m_uiAbsIdxInLCU]; } |
---|
702 | UInt& getTotalBins () { return m_uiTotalBins; } |
---|
703 | // ------------------------------------------------------------------------------------------------------------------- |
---|
704 | // member functions for RD cost storage |
---|
705 | // ------------------------------------------------------------------------------------------------------------------- |
---|
706 | |
---|
707 | Double& getTotalCost() { return m_dTotalCost; } |
---|
708 | #if H_3D_VSO |
---|
709 | Dist& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
710 | #else |
---|
711 | UInt& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
712 | #endif |
---|
713 | UInt& getTotalBits() { return m_uiTotalBits; } |
---|
714 | UInt& getTotalNumPart() { return m_uiNumPartition; } |
---|
715 | |
---|
716 | UInt getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra); |
---|
717 | |
---|
718 | }; |
---|
719 | |
---|
720 | namespace RasterAddress |
---|
721 | { |
---|
722 | /** Check whether 2 addresses point to the same column |
---|
723 | * \param addrA First address in raster scan order |
---|
724 | * \param addrB Second address in raters scan order |
---|
725 | * \param numUnitsPerRow Number of units in a row |
---|
726 | * \return Result of test |
---|
727 | */ |
---|
728 | static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
729 | { |
---|
730 | // addrA % numUnitsPerRow == addrB % numUnitsPerRow |
---|
731 | return (( addrA ^ addrB ) & ( numUnitsPerRow - 1 ) ) == 0; |
---|
732 | } |
---|
733 | |
---|
734 | /** Check whether 2 addresses point to the same row |
---|
735 | * \param addrA First address in raster scan order |
---|
736 | * \param addrB Second address in raters scan order |
---|
737 | * \param numUnitsPerRow Number of units in a row |
---|
738 | * \return Result of test |
---|
739 | */ |
---|
740 | static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
741 | { |
---|
742 | // addrA / numUnitsPerRow == addrB / numUnitsPerRow |
---|
743 | return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
744 | } |
---|
745 | |
---|
746 | /** Check whether 2 addresses point to the same row or column |
---|
747 | * \param addrA First address in raster scan order |
---|
748 | * \param addrB Second address in raters scan order |
---|
749 | * \param numUnitsPerRow Number of units in a row |
---|
750 | * \return Result of test |
---|
751 | */ |
---|
752 | static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
753 | { |
---|
754 | return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow ); |
---|
755 | } |
---|
756 | |
---|
757 | /** Check whether one address points to the first column |
---|
758 | * \param addr Address in raster scan order |
---|
759 | * \param numUnitsPerRow Number of units in a row |
---|
760 | * \return Result of test |
---|
761 | */ |
---|
762 | static inline Bool isZeroCol( Int addr, Int numUnitsPerRow ) |
---|
763 | { |
---|
764 | // addr % numUnitsPerRow == 0 |
---|
765 | return ( addr & ( numUnitsPerRow - 1 ) ) == 0; |
---|
766 | } |
---|
767 | |
---|
768 | /** Check whether one address points to the first row |
---|
769 | * \param addr Address in raster scan order |
---|
770 | * \param numUnitsPerRow Number of units in a row |
---|
771 | * \return Result of test |
---|
772 | */ |
---|
773 | static inline Bool isZeroRow( Int addr, Int numUnitsPerRow ) |
---|
774 | { |
---|
775 | // addr / numUnitsPerRow == 0 |
---|
776 | return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
777 | } |
---|
778 | |
---|
779 | /** Check whether one address points to a column whose index is smaller than a given value |
---|
780 | * \param addr Address in raster scan order |
---|
781 | * \param val Given column index value |
---|
782 | * \param numUnitsPerRow Number of units in a row |
---|
783 | * \return Result of test |
---|
784 | */ |
---|
785 | static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow ) |
---|
786 | { |
---|
787 | // addr % numUnitsPerRow < val |
---|
788 | return ( addr & ( numUnitsPerRow - 1 ) ) < val; |
---|
789 | } |
---|
790 | |
---|
791 | /** Check whether one address points to a row whose index is smaller than a given value |
---|
792 | * \param addr Address in raster scan order |
---|
793 | * \param val Given row index value |
---|
794 | * \param numUnitsPerRow Number of units in a row |
---|
795 | * \return Result of test |
---|
796 | */ |
---|
797 | static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow ) |
---|
798 | { |
---|
799 | // addr / numUnitsPerRow < val |
---|
800 | return addr < val * numUnitsPerRow; |
---|
801 | } |
---|
802 | }; |
---|
803 | |
---|
804 | //! \} |
---|
805 | |
---|
806 | #endif |
---|