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 | #endif |
---|
200 | #if H_3D_ARP |
---|
201 | UChar* m_puhARPW; |
---|
202 | #endif |
---|
203 | #if H_3D_IC |
---|
204 | Bool* m_pbICFlag; ///< array of IC flags |
---|
205 | #endif |
---|
206 | #if H_3D_DIM |
---|
207 | Pel* m_dimDeltaDC[DIM_NUM_TYPE][2]; |
---|
208 | #if H_3D_DIM_DMM |
---|
209 | UInt* m_dmmWedgeTabIdx[DMM_NUM_TYPE]; |
---|
210 | UInt* m_dmm3IntraTabIdx; |
---|
211 | #endif |
---|
212 | #if H_3D_DIM_RBC |
---|
213 | UChar* m_pucEdgeCode; ///< array of edge code |
---|
214 | UChar* m_pucEdgeNumber; ///< total number of edge |
---|
215 | UChar* m_pucEdgeStartPos; ///< starting point position |
---|
216 | Bool* m_pbEdgeLeftFirst; ///< true if edge should be checked in left boundary first |
---|
217 | Bool* m_pbEdgePartition; ///< true if it belongs to region 1, otherwise, region 0 |
---|
218 | #endif |
---|
219 | #if H_3D_DIM_SDC |
---|
220 | Bool* m_pbSDCFlag; |
---|
221 | Pel* m_apSegmentDCOffset[2]; |
---|
222 | #endif |
---|
223 | #endif |
---|
224 | #if H_3D_INTER_SDC |
---|
225 | Bool* m_pbInterSDCFlag; |
---|
226 | Int* m_apSegmentInterDCOffset[4]; |
---|
227 | UChar* m_pucInterSDCMask; |
---|
228 | #endif |
---|
229 | |
---|
230 | // ------------------------------------------------------------------------------------------------------------------- |
---|
231 | // misc. variables |
---|
232 | // ------------------------------------------------------------------------------------------------------------------- |
---|
233 | |
---|
234 | Bool m_bDecSubCu; ///< indicates decoder-mode |
---|
235 | Double m_dTotalCost; ///< sum of partition RD costs |
---|
236 | #if H_3D_VSO |
---|
237 | Dist m_uiTotalDistortion; ///< sum of partition distortion |
---|
238 | #else |
---|
239 | UInt m_uiTotalDistortion; ///< sum of partition distortion |
---|
240 | #endif |
---|
241 | UInt m_uiTotalBits; ///< sum of partition bits |
---|
242 | UInt m_uiTotalBins; ///< sum of partition bins |
---|
243 | UInt* m_sliceStartCU; ///< Start CU address of current slice |
---|
244 | UInt* m_sliceSegmentStartCU; ///< Start CU address of current slice |
---|
245 | Char m_codedQP; |
---|
246 | protected: |
---|
247 | |
---|
248 | /// add possible motion vector predictor candidates |
---|
249 | Bool xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
250 | Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
251 | #if H_3D_VSP |
---|
252 | Bool xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, |
---|
253 | Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag ); |
---|
254 | #endif |
---|
255 | #if H_3D_IV_MERGE |
---|
256 | Bool xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, |
---|
257 | Int* ivCandRefIdx, Int posIvDC, Int* vspFlag ); |
---|
258 | Bool xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int* ivCandDir, Int posIvDC, Int* vspFlag, Int& iFirDispCand ); |
---|
259 | #endif |
---|
260 | |
---|
261 | Void deriveRightBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxRB ); |
---|
262 | Bool xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx |
---|
263 | #if H_3D_TMVP |
---|
264 | , |
---|
265 | Bool bMRG = true |
---|
266 | #endif |
---|
267 | ); |
---|
268 | |
---|
269 | /// compute required bits to encode MVD (used in AMVP) |
---|
270 | UInt xGetMvdBits ( TComMv cMvd ); |
---|
271 | UInt xGetComponentBits ( Int iVal ); |
---|
272 | |
---|
273 | /// compute scaling factor from POC difference |
---|
274 | #if !H_3D_ARP |
---|
275 | Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
276 | #endif |
---|
277 | |
---|
278 | Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter ); |
---|
279 | |
---|
280 | public: |
---|
281 | TComDataCU(); |
---|
282 | virtual ~TComDataCU(); |
---|
283 | |
---|
284 | // ------------------------------------------------------------------------------------------------------------------- |
---|
285 | // create / destroy / initialize / copy |
---|
286 | // ------------------------------------------------------------------------------------------------------------------- |
---|
287 | #if H_3D_ARP |
---|
288 | Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
289 | #endif |
---|
290 | Void create ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize |
---|
291 | #if ADAPTIVE_QP_SELECTION |
---|
292 | , Bool bGlobalRMARLBuffer = false |
---|
293 | #endif |
---|
294 | ); |
---|
295 | Void destroy (); |
---|
296 | |
---|
297 | Void initCU ( TComPic* pcPic, UInt uiCUAddr ); |
---|
298 | Void initEstData ( UInt uiDepth, Int qp ); |
---|
299 | Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); |
---|
300 | Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
301 | #if H_3D_NBDV |
---|
302 | Void copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx); |
---|
303 | #endif |
---|
304 | Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
305 | Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList |
---|
306 | #if H_3D_NBDV |
---|
307 | , Bool bNBDV = false |
---|
308 | #endif |
---|
309 | ); |
---|
310 | Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
311 | |
---|
312 | Void copyToPic ( UChar uiDepth ); |
---|
313 | Void copyToPic ( UChar uiDepth, UInt uiPartIdx, UInt uiPartDepth ); |
---|
314 | |
---|
315 | // ------------------------------------------------------------------------------------------------------------------- |
---|
316 | // member functions for CU description |
---|
317 | // ------------------------------------------------------------------------------------------------------------------- |
---|
318 | |
---|
319 | TComPic* getPic () { return m_pcPic; } |
---|
320 | TComSlice* getSlice () { return m_pcSlice; } |
---|
321 | UInt& getAddr () { return m_uiCUAddr; } |
---|
322 | UInt& getZorderIdxInCU () { return m_uiAbsIdxInLCU; } |
---|
323 | UInt getSCUAddr (); |
---|
324 | UInt getCUPelX () { return m_uiCUPelX; } |
---|
325 | UInt getCUPelY () { return m_uiCUPelY; } |
---|
326 | TComPattern* getPattern () { return m_pcPattern; } |
---|
327 | |
---|
328 | UChar* getDepth () { return m_puhDepth; } |
---|
329 | UChar getDepth ( UInt uiIdx ) { return m_puhDepth[uiIdx]; } |
---|
330 | Void setDepth ( UInt uiIdx, UChar uh ) { m_puhDepth[uiIdx] = uh; } |
---|
331 | |
---|
332 | Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); |
---|
333 | #if H_3D |
---|
334 | Void getPosInPic ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ); |
---|
335 | #endif |
---|
336 | |
---|
337 | // ------------------------------------------------------------------------------------------------------------------- |
---|
338 | // member functions for CU data |
---|
339 | // ------------------------------------------------------------------------------------------------------------------- |
---|
340 | |
---|
341 | Char* getPartitionSize () { return m_pePartSize; } |
---|
342 | PartSize getPartitionSize ( UInt uiIdx ) { return static_cast<PartSize>( m_pePartSize[uiIdx] ); } |
---|
343 | Void setPartitionSize ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh; } |
---|
344 | Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
345 | Void setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
346 | |
---|
347 | Bool* getSkipFlag () { return m_skipFlag; } |
---|
348 | Bool getSkipFlag (UInt idx) { return m_skipFlag[idx]; } |
---|
349 | Void setSkipFlag ( UInt idx, Bool skip) { m_skipFlag[idx] = skip; } |
---|
350 | Void setSkipFlagSubParts ( Bool skip, UInt absPartIdx, UInt depth ); |
---|
351 | |
---|
352 | Char* getPredictionMode () { return m_pePredMode; } |
---|
353 | PredMode getPredictionMode ( UInt uiIdx ) { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } |
---|
354 | Bool* getCUTransquantBypass () { return m_CUTransquantBypass; } |
---|
355 | Bool getCUTransquantBypass( UInt uiIdx ) { return m_CUTransquantBypass[uiIdx]; } |
---|
356 | Void setPredictionMode ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh; } |
---|
357 | Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
358 | |
---|
359 | UChar* getWidth () { return m_puhWidth; } |
---|
360 | UChar getWidth ( UInt uiIdx ) { return m_puhWidth[uiIdx]; } |
---|
361 | Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh; } |
---|
362 | |
---|
363 | UChar* getHeight () { return m_puhHeight; } |
---|
364 | UChar getHeight ( UInt uiIdx ) { return m_puhHeight[uiIdx]; } |
---|
365 | Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh; } |
---|
366 | |
---|
367 | Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
368 | |
---|
369 | Char* getQP () { return m_phQP; } |
---|
370 | Char getQP ( UInt uiIdx ) { return m_phQP[uiIdx]; } |
---|
371 | Void setQP ( UInt uiIdx, Char value ){ m_phQP[uiIdx] = value; } |
---|
372 | Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
373 | Int getLastValidPartIdx ( Int iAbsPartIdx ); |
---|
374 | Char getLastCodedQP ( UInt uiAbsPartIdx ); |
---|
375 | Void setQPSubCUs ( Int qp, TComDataCU* pcCU, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf ); |
---|
376 | Void setCodedQP ( Char qp ) { m_codedQP = qp; } |
---|
377 | Char getCodedQP () { return m_codedQP; } |
---|
378 | |
---|
379 | Bool isLosslessCoded(UInt absPartIdx); |
---|
380 | |
---|
381 | UChar* getTransformIdx () { return m_puhTrIdx; } |
---|
382 | UChar getTransformIdx ( UInt uiIdx ) { return m_puhTrIdx[uiIdx]; } |
---|
383 | Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
384 | |
---|
385 | UChar* getTransformSkip ( TextType eType) { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]];} |
---|
386 | UChar getTransformSkip ( UInt uiIdx,TextType eType) { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]][uiIdx];} |
---|
387 | Void setTransformSkipSubParts ( UInt useTransformSkip, TextType eType, UInt uiAbsPartIdx, UInt uiDepth); |
---|
388 | Void setTransformSkipSubParts ( UInt useTransformSkipY, UInt useTransformSkipU, UInt useTransformSkipV, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
389 | |
---|
390 | UInt getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ); |
---|
391 | |
---|
392 | TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } |
---|
393 | |
---|
394 | TCoeff*& getCoeffY () { return m_pcTrCoeffY; } |
---|
395 | TCoeff*& getCoeffCb () { return m_pcTrCoeffCb; } |
---|
396 | TCoeff*& getCoeffCr () { return m_pcTrCoeffCr; } |
---|
397 | #if ADAPTIVE_QP_SELECTION |
---|
398 | Int*& getArlCoeffY () { return m_pcArlCoeffY; } |
---|
399 | Int*& getArlCoeffCb () { return m_pcArlCoeffCb; } |
---|
400 | Int*& getArlCoeffCr () { return m_pcArlCoeffCr; } |
---|
401 | #endif |
---|
402 | |
---|
403 | Pel*& getPCMSampleY () { return m_pcIPCMSampleY; } |
---|
404 | Pel*& getPCMSampleCb () { return m_pcIPCMSampleCb; } |
---|
405 | Pel*& getPCMSampleCr () { return m_pcIPCMSampleCr; } |
---|
406 | |
---|
407 | UChar getCbf ( UInt uiIdx, TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx]; } |
---|
408 | UChar* getCbf ( TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]]; } |
---|
409 | UChar getCbf ( UInt uiIdx, TextType eType, UInt uiTrDepth ) { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); } |
---|
410 | Void setCbf ( UInt uiIdx, TextType eType, UChar uh ) { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh; } |
---|
411 | Void clearCbf ( UInt uiIdx, TextType eType, UInt uiNumParts ); |
---|
412 | UChar getQtRootCbf ( UInt uiIdx ) { return getCbf( uiIdx, TEXT_LUMA, 0 ) || getCbf( uiIdx, TEXT_CHROMA_U, 0 ) || getCbf( uiIdx, TEXT_CHROMA_V, 0 ); } |
---|
413 | |
---|
414 | Void setCbfSubParts ( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
415 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
416 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
417 | |
---|
418 | // ------------------------------------------------------------------------------------------------------------------- |
---|
419 | // member functions for coding tool information |
---|
420 | // ------------------------------------------------------------------------------------------------------------------- |
---|
421 | |
---|
422 | Bool* getMergeFlag () { return m_pbMergeFlag; } |
---|
423 | Bool getMergeFlag ( UInt uiIdx ) { return m_pbMergeFlag[uiIdx]; } |
---|
424 | Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b; } |
---|
425 | Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
426 | |
---|
427 | UChar* getMergeIndex () { return m_puhMergeIndex; } |
---|
428 | UChar getMergeIndex ( UInt uiIdx ) { return m_puhMergeIndex[uiIdx]; } |
---|
429 | Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } |
---|
430 | Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
431 | template <typename T> |
---|
432 | Void setSubPart ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
433 | #if H_3D_VSP |
---|
434 | template<typename T> |
---|
435 | Void setSubPartT ( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
436 | #endif |
---|
437 | #if AMP_MRG |
---|
438 | Void setMergeAMP( Bool b ) { m_bIsMergeAMP = b; } |
---|
439 | Bool getMergeAMP( ) { return m_bIsMergeAMP; } |
---|
440 | #endif |
---|
441 | |
---|
442 | UChar* getLumaIntraDir () { return m_puhLumaIntraDir; } |
---|
443 | UChar getLumaIntraDir ( UInt uiIdx ) { return m_puhLumaIntraDir[uiIdx]; } |
---|
444 | Void setLumaIntraDir ( UInt uiIdx, UChar uh ) { m_puhLumaIntraDir[uiIdx] = uh; } |
---|
445 | Void setLumaIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
446 | |
---|
447 | UChar* getChromaIntraDir () { return m_puhChromaIntraDir; } |
---|
448 | UChar getChromaIntraDir ( UInt uiIdx ) { return m_puhChromaIntraDir[uiIdx]; } |
---|
449 | Void setChromaIntraDir ( UInt uiIdx, UChar uh ) { m_puhChromaIntraDir[uiIdx] = uh; } |
---|
450 | Void setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
451 | |
---|
452 | UChar* getInterDir () { return m_puhInterDir; } |
---|
453 | UChar getInterDir ( UInt uiIdx ) { return m_puhInterDir[uiIdx]; } |
---|
454 | Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh; } |
---|
455 | Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
456 | Bool* getIPCMFlag () { return m_pbIPCMFlag; } |
---|
457 | Bool getIPCMFlag (UInt uiIdx ) { return m_pbIPCMFlag[uiIdx]; } |
---|
458 | Void setIPCMFlag (UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } |
---|
459 | Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth); |
---|
460 | #if H_3D_NBDV |
---|
461 | Void setDvInfoSubParts ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
462 | Void setDvInfoSubParts ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth); |
---|
463 | DisInfo* getDvInfo () { return m_pDvInfo; } |
---|
464 | DisInfo getDvInfo (UInt uiIdx) { return m_pDvInfo[uiIdx]; } |
---|
465 | #endif |
---|
466 | /// get slice ID for SU |
---|
467 | Int getSUSliceID (UInt uiIdx) {return m_piSliceSUMap[uiIdx]; } |
---|
468 | |
---|
469 | /// get the pointer of slice ID map |
---|
470 | Int* getSliceSUMap () {return m_piSliceSUMap; } |
---|
471 | |
---|
472 | /// set the pointer of slice ID map |
---|
473 | Void setSliceSUMap (Int *pi) {m_piSliceSUMap = pi; } |
---|
474 | |
---|
475 | std::vector<NDBFBlockInfo>* getNDBFilterBlocks() {return &m_vNDFBlock;} |
---|
476 | Void setNDBFilterBlockBorderAvailability(UInt numLCUInPicWidth, UInt numLCUInPicHeight, UInt numSUInLCUWidth, UInt numSUInLCUHeight, UInt picWidth, UInt picHeight |
---|
477 | ,std::vector<Bool>& LFCrossSliceBoundary |
---|
478 | ,Bool bTopTileBoundary, Bool bDownTileBoundary, Bool bLeftTileBoundary, Bool bRightTileBoundary |
---|
479 | ,Bool bIndependentTileBoundaryEnabled ); |
---|
480 | #if H_3D_NBDV |
---|
481 | Void xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb ); |
---|
482 | Bool xCheckSpatialNBDV (TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo, |
---|
483 | UInt uiMvpDvPos |
---|
484 | #if H_3D_NBDV_REF |
---|
485 | , Bool bDepthRefine = false |
---|
486 | #endif |
---|
487 | ); |
---|
488 | Bool xGetColDisMV ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx ); |
---|
489 | Bool getDisMvpCandNBDV ( DisInfo* pDInfo |
---|
490 | #if H_3D_NBDV_REF |
---|
491 | , Bool bDepthRefine = false |
---|
492 | #endif |
---|
493 | ); |
---|
494 | |
---|
495 | #if QC_DEPTH_IV_MRG_F0125 |
---|
496 | Bool getDispNeighBlocks ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp); |
---|
497 | Bool getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm ); |
---|
498 | #endif |
---|
499 | |
---|
500 | #if H_3D_NBDV_REF |
---|
501 | Pel getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT ); |
---|
502 | Void estimateDVFromDM(Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred ); |
---|
503 | #endif //H_3D_NBDV_REF |
---|
504 | #endif |
---|
505 | #if H_3D_FAST_TEXTURE_ENCODING |
---|
506 | Void getIVNStatus ( UInt uiPartIdx, DisInfo* pDInfo, Bool& bIVFMerge, Int& iIVFMaxD); |
---|
507 | #endif |
---|
508 | #if H_3D_IV_MERGE |
---|
509 | Bool getInterViewMergeCands ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc |
---|
510 | #if QC_DEPTH_IV_MRG_F0125 |
---|
511 | , Bool bIsDepth |
---|
512 | #endif |
---|
513 | ); |
---|
514 | #endif |
---|
515 | #if H_3D_ARP |
---|
516 | UChar* getARPW () { return m_puhARPW; } |
---|
517 | UChar getARPW ( UInt uiIdx ) { return m_puhARPW[uiIdx]; } |
---|
518 | Void setARPW ( UInt uiIdx, UChar w ) { m_puhARPW[uiIdx] = w; } |
---|
519 | Void setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
520 | Double getARPWFactor ( UInt uiIdx ); |
---|
521 | #endif |
---|
522 | #if H_3D_IC |
---|
523 | Bool* getICFlag () { return m_pbICFlag; } |
---|
524 | Bool getICFlag ( UInt uiIdx ) { return m_pbICFlag[uiIdx]; } |
---|
525 | Void setICFlag ( UInt uiIdx, Bool uh ) { m_pbICFlag[uiIdx] = uh; } |
---|
526 | Void setICFlagSubParts ( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
527 | Bool isICFlagRequired ( UInt uiAbsPartIdx ); |
---|
528 | Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false); |
---|
529 | #else |
---|
530 | // ------------------------------------------------------------------------------------------------------------------- |
---|
531 | // member functions for accessing partition information |
---|
532 | // ------------------------------------------------------------------------------------------------------------------- |
---|
533 | |
---|
534 | Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); |
---|
535 | #endif |
---|
536 | UChar getNumPartInter (); |
---|
537 | Bool isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth); |
---|
538 | |
---|
539 | #if H_3D_DIM |
---|
540 | Pel* getDimDeltaDC ( UInt dimType, UInt segId ) { return m_dimDeltaDC[dimType][segId]; } |
---|
541 | Pel getDimDeltaDC ( UInt dimType, UInt segId, UInt uiIdx ) { return m_dimDeltaDC[dimType][segId][uiIdx]; } |
---|
542 | Void setDimDeltaDC ( UInt dimType, UInt segId, UInt uiIdx, Pel val ) { m_dimDeltaDC[dimType][segId][uiIdx] = val; } |
---|
543 | #if H_3D_DIM_DMM |
---|
544 | UInt* getDmmWedgeTabIdx ( UInt dmmType ) { return m_dmmWedgeTabIdx[dmmType]; } |
---|
545 | UInt getDmmWedgeTabIdx ( UInt dmmType, UInt uiIdx ) { return m_dmmWedgeTabIdx[dmmType][uiIdx]; } |
---|
546 | Void setDmmWedgeTabIdx ( UInt dmmType, UInt uiIdx, UInt tabIdx ) { m_dmmWedgeTabIdx[dmmType][uiIdx] = tabIdx; } |
---|
547 | Void setDmmWedgeTabIdxSubParts ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
548 | |
---|
549 | UInt* getDmm3IntraTabIdx () { return m_dmm3IntraTabIdx; } |
---|
550 | UInt getDmm3IntraTabIdx ( UInt uiIdx ) { return m_dmm3IntraTabIdx[uiIdx]; } |
---|
551 | Void setDmm3IntraTabIdx ( UInt uiIdx, UInt uh ) { m_dmm3IntraTabIdx[uiIdx] = uh; } |
---|
552 | Void setDmm3IntraTabIdxSubParts ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
553 | #endif |
---|
554 | #if H_3D_DIM_RBC |
---|
555 | UChar* getEdgeCode( UInt uiIdx ) { return &m_pucEdgeCode[uiIdx * RBC_MAX_EDGE_NUM_PER_4x4]; } |
---|
556 | |
---|
557 | UChar* getEdgeNumber( ) { return m_pucEdgeNumber; } |
---|
558 | UChar getEdgeNumber( UInt uiIdx ) { return m_pucEdgeNumber[uiIdx]; } |
---|
559 | Void setEdgeNumber( UInt uiIdx, UChar val ) { m_pucEdgeNumber[uiIdx] = val; } |
---|
560 | |
---|
561 | UChar* getEdgeStartPos( ) { return m_pucEdgeStartPos; } |
---|
562 | UChar getEdgeStartPos( UInt uiIdx ) { return m_pucEdgeStartPos[uiIdx]; } |
---|
563 | Void setEdgeStartPos( UInt uiIdx, UChar val ) { m_pucEdgeStartPos[uiIdx] = val; } |
---|
564 | |
---|
565 | Bool* getEdgeLeftFirst( ) { return m_pbEdgeLeftFirst; } |
---|
566 | Bool getEdgeLeftFirst( UInt uiIdx ) { return m_pbEdgeLeftFirst[uiIdx]; } |
---|
567 | Void setEdgeLeftFirst( UInt uiIdx, Bool val ) { m_pbEdgeLeftFirst[uiIdx] = val; } |
---|
568 | |
---|
569 | Bool* getEdgePartition( UInt uiIdx ) { return &m_pbEdgePartition[uiIdx * 16]; } |
---|
570 | |
---|
571 | Void reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion ); |
---|
572 | #endif |
---|
573 | #if H_3D_DIM_SDC |
---|
574 | Bool* getSDCFlag () { return m_pbSDCFlag; } |
---|
575 | Bool getSDCFlag ( UInt uiIdx ) { return m_pbSDCFlag[uiIdx]; } |
---|
576 | Void setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
577 | |
---|
578 | Bool getSDCAvailable ( UInt uiAbsPartIdx ); |
---|
579 | |
---|
580 | Pel* getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; } |
---|
581 | Pel getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; } |
---|
582 | Void setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; } |
---|
583 | #endif |
---|
584 | #endif |
---|
585 | #if H_3D_INTER_SDC |
---|
586 | Bool* getInterSDCFlag () { return m_pbInterSDCFlag; } |
---|
587 | Bool getInterSDCFlag ( UInt uiIdx ) { return m_pbInterSDCFlag[uiIdx]; } |
---|
588 | Void setInterSDCFlagSubParts ( Bool bInterSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
589 | UInt getCtxInterSDCFlag ( UInt uiAbsPartIdx ); |
---|
590 | Int* getInterSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentInterDCOffset[uiSeg]; } |
---|
591 | Int getInterSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentInterDCOffset[uiSeg][uiPartIdx]; } |
---|
592 | Void setInterSDCSegmentDCOffset( Int pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentInterDCOffset[uiSeg][uiPartIdx] = pOffset; } |
---|
593 | |
---|
594 | Void xSetInterSDCCUMask( TComDataCU *pcCU, UChar *pMask ); |
---|
595 | |
---|
596 | UChar* getInterSDCMask () { return m_pucInterSDCMask; } |
---|
597 | #endif |
---|
598 | |
---|
599 | // ------------------------------------------------------------------------------------------------------------------- |
---|
600 | // member functions for motion vector |
---|
601 | // ------------------------------------------------------------------------------------------------------------------- |
---|
602 | |
---|
603 | Void getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); |
---|
604 | |
---|
605 | Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ); |
---|
606 | Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP); |
---|
607 | Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH); |
---|
608 | Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } |
---|
609 | Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) { return m_apiMVPIdx[eRefPicList][uiIdx]; } |
---|
610 | Char* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList]; } |
---|
611 | |
---|
612 | Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum; } |
---|
613 | Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) { return m_apiMVPNum[eRefPicList][uiIdx]; } |
---|
614 | Char* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList]; } |
---|
615 | |
---|
616 | Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
617 | Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
618 | |
---|
619 | Void clipMv ( TComMv& rcMv ); |
---|
620 | Void getMvPredLeft ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldA.getMv(); } |
---|
621 | Void getMvPredAbove ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldB.getMv(); } |
---|
622 | Void getMvPredAboveRight ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldC.getMv(); } |
---|
623 | #if H_3D |
---|
624 | Void compressMV ( Int scale ); |
---|
625 | #else |
---|
626 | Void compressMV (); |
---|
627 | #endif |
---|
628 | // ------------------------------------------------------------------------------------------------------------------- |
---|
629 | // utility functions for neighbouring information |
---|
630 | // ------------------------------------------------------------------------------------------------------------------- |
---|
631 | |
---|
632 | TComDataCU* getCULeft () { return m_pcCULeft; } |
---|
633 | TComDataCU* getCUAbove () { return m_pcCUAbove; } |
---|
634 | TComDataCU* getCUAboveLeft () { return m_pcCUAboveLeft; } |
---|
635 | TComDataCU* getCUAboveRight () { return m_pcCUAboveRight; } |
---|
636 | TComDataCU* getCUColocated ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; } |
---|
637 | |
---|
638 | |
---|
639 | TComDataCU* getPULeft ( UInt& uiLPartUnitIdx, |
---|
640 | UInt uiCurrPartUnitIdx, |
---|
641 | Bool bEnforceSliceRestriction=true, |
---|
642 | Bool bEnforceTileRestriction=true ); |
---|
643 | TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx, |
---|
644 | UInt uiCurrPartUnitIdx, |
---|
645 | Bool bEnforceSliceRestriction=true, |
---|
646 | Bool planarAtLCUBoundary = false, |
---|
647 | Bool bEnforceTileRestriction=true ); |
---|
648 | TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ); |
---|
649 | TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ); |
---|
650 | TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ); |
---|
651 | |
---|
652 | TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU ); |
---|
653 | TComDataCU* getQpMinCuAbove ( UInt& aPartUnitIdx , UInt currAbsIdxInLCU ); |
---|
654 | Char getRefQP ( UInt uiCurrAbsIdxInLCU ); |
---|
655 | |
---|
656 | TComDataCU* getPUAboveRightAdi ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ); |
---|
657 | TComDataCU* getPUBelowLeftAdi ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ); |
---|
658 | |
---|
659 | Void deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
660 | Void deriveLeftBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
661 | |
---|
662 | Void deriveLeftRightTopIdxAdi ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth ); |
---|
663 | Void deriveLeftBottomIdxAdi ( UInt& ruiPartIdxLB, UInt uiPartOffset, UInt uiPartDepth ); |
---|
664 | |
---|
665 | Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); |
---|
666 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours |
---|
667 | #if H_3D_VSP |
---|
668 | , Int* vspFlag |
---|
669 | , InheritedVSPDisInfo* inheritedVSPDisInfo |
---|
670 | #endif |
---|
671 | , Int& numValidMergeCand, Int mrgCandIdx = -1 ); |
---|
672 | |
---|
673 | #if H_3D_VSP |
---|
674 | inline Void xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount, InheritedVSPDisInfo* inheritedVSPDisInfo); |
---|
675 | |
---|
676 | Char* getVSPFlag () { return m_piVSPFlag; } |
---|
677 | Char getVSPFlag ( UInt uiIdx ) { return m_piVSPFlag[uiIdx]; } |
---|
678 | Void setVSPFlag ( UInt uiIdx, Int n ) { m_piVSPFlag[uiIdx] = n; } |
---|
679 | Void setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
680 | #endif |
---|
681 | Void deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
682 | Void deriveLeftBottomIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
683 | |
---|
684 | |
---|
685 | // ------------------------------------------------------------------------------------------------------------------- |
---|
686 | // member functions for modes |
---|
687 | // ------------------------------------------------------------------------------------------------------------------- |
---|
688 | |
---|
689 | Bool isIntra ( UInt uiPartIdx ) { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } |
---|
690 | Bool isSkipped ( UInt uiPartIdx ); ///< SKIP (no residual) |
---|
691 | Bool isBipredRestriction( UInt puIdx ); |
---|
692 | |
---|
693 | // ------------------------------------------------------------------------------------------------------------------- |
---|
694 | // member functions for symbol prediction (most probable / mode conversion) |
---|
695 | // ------------------------------------------------------------------------------------------------------------------- |
---|
696 | |
---|
697 | UInt getIntraSizeIdx ( UInt uiAbsPartIdx ); |
---|
698 | |
---|
699 | Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList ); |
---|
700 | Int getIntraDirLumaPredictor ( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode = NULL ); |
---|
701 | |
---|
702 | // ------------------------------------------------------------------------------------------------------------------- |
---|
703 | // member functions for SBAC context |
---|
704 | // ------------------------------------------------------------------------------------------------------------------- |
---|
705 | |
---|
706 | UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
707 | UInt getCtxQtCbf ( TextType eType, UInt uiTrDepth ); |
---|
708 | |
---|
709 | UInt getCtxSkipFlag ( UInt uiAbsPartIdx ); |
---|
710 | UInt getCtxInterDir ( UInt uiAbsPartIdx ); |
---|
711 | |
---|
712 | #if H_3D_ARP |
---|
713 | UInt getCTXARPWFlag ( UInt uiAbsPartIdx ); |
---|
714 | #endif |
---|
715 | #if H_3D_IC |
---|
716 | UInt getCtxICFlag ( UInt uiAbsPartIdx ); |
---|
717 | #endif |
---|
718 | UInt getSliceStartCU ( UInt pos ) { return m_sliceStartCU[pos-m_uiAbsIdxInLCU]; } |
---|
719 | UInt getSliceSegmentStartCU ( UInt pos ) { return m_sliceSegmentStartCU[pos-m_uiAbsIdxInLCU]; } |
---|
720 | UInt& getTotalBins () { return m_uiTotalBins; } |
---|
721 | // ------------------------------------------------------------------------------------------------------------------- |
---|
722 | // member functions for RD cost storage |
---|
723 | // ------------------------------------------------------------------------------------------------------------------- |
---|
724 | |
---|
725 | Double& getTotalCost() { return m_dTotalCost; } |
---|
726 | #if H_3D_VSO |
---|
727 | Dist& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
728 | #else |
---|
729 | UInt& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
730 | #endif |
---|
731 | UInt& getTotalBits() { return m_uiTotalBits; } |
---|
732 | UInt& getTotalNumPart() { return m_uiNumPartition; } |
---|
733 | |
---|
734 | UInt getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra); |
---|
735 | |
---|
736 | }; |
---|
737 | |
---|
738 | namespace RasterAddress |
---|
739 | { |
---|
740 | /** Check whether 2 addresses point to the same column |
---|
741 | * \param addrA First address in raster scan order |
---|
742 | * \param addrB Second address in raters scan order |
---|
743 | * \param numUnitsPerRow Number of units in a row |
---|
744 | * \return Result of test |
---|
745 | */ |
---|
746 | static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
747 | { |
---|
748 | // addrA % numUnitsPerRow == addrB % numUnitsPerRow |
---|
749 | return (( addrA ^ addrB ) & ( numUnitsPerRow - 1 ) ) == 0; |
---|
750 | } |
---|
751 | |
---|
752 | /** Check whether 2 addresses point to the same row |
---|
753 | * \param addrA First address in raster scan order |
---|
754 | * \param addrB Second address in raters scan order |
---|
755 | * \param numUnitsPerRow Number of units in a row |
---|
756 | * \return Result of test |
---|
757 | */ |
---|
758 | static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
759 | { |
---|
760 | // addrA / numUnitsPerRow == addrB / numUnitsPerRow |
---|
761 | return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
762 | } |
---|
763 | |
---|
764 | /** Check whether 2 addresses point to the same row or column |
---|
765 | * \param addrA First address in raster scan order |
---|
766 | * \param addrB Second address in raters scan order |
---|
767 | * \param numUnitsPerRow Number of units in a row |
---|
768 | * \return Result of test |
---|
769 | */ |
---|
770 | static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
771 | { |
---|
772 | return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow ); |
---|
773 | } |
---|
774 | |
---|
775 | /** Check whether one address points to the first column |
---|
776 | * \param addr Address in raster scan order |
---|
777 | * \param numUnitsPerRow Number of units in a row |
---|
778 | * \return Result of test |
---|
779 | */ |
---|
780 | static inline Bool isZeroCol( Int addr, Int numUnitsPerRow ) |
---|
781 | { |
---|
782 | // addr % numUnitsPerRow == 0 |
---|
783 | return ( addr & ( numUnitsPerRow - 1 ) ) == 0; |
---|
784 | } |
---|
785 | |
---|
786 | /** Check whether one address points to the first row |
---|
787 | * \param addr Address in raster scan order |
---|
788 | * \param numUnitsPerRow Number of units in a row |
---|
789 | * \return Result of test |
---|
790 | */ |
---|
791 | static inline Bool isZeroRow( Int addr, Int numUnitsPerRow ) |
---|
792 | { |
---|
793 | // addr / numUnitsPerRow == 0 |
---|
794 | return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
795 | } |
---|
796 | |
---|
797 | /** Check whether one address points to a column whose index is smaller than a given value |
---|
798 | * \param addr Address in raster scan order |
---|
799 | * \param val Given column index value |
---|
800 | * \param numUnitsPerRow Number of units in a row |
---|
801 | * \return Result of test |
---|
802 | */ |
---|
803 | static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow ) |
---|
804 | { |
---|
805 | // addr % numUnitsPerRow < val |
---|
806 | return ( addr & ( numUnitsPerRow - 1 ) ) < val; |
---|
807 | } |
---|
808 | |
---|
809 | /** Check whether one address points to a row whose index is smaller than a given value |
---|
810 | * \param addr Address in raster scan order |
---|
811 | * \param val Given row index value |
---|
812 | * \param numUnitsPerRow Number of units in a row |
---|
813 | * \return Result of test |
---|
814 | */ |
---|
815 | static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow ) |
---|
816 | { |
---|
817 | // addr / numUnitsPerRow < val |
---|
818 | return addr < val * numUnitsPerRow; |
---|
819 | } |
---|
820 | }; |
---|
821 | |
---|
822 | //! \} |
---|
823 | |
---|
824 | #endif |
---|