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-2014, 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 | #if H_3D_DBBP |
---|
63 | typedef struct _DBBPTmpData |
---|
64 | { |
---|
65 | TComMv acMvd[2][2]; // for two segments and two lists |
---|
66 | TComMvField acMvField[2][2]; // for two segments and two lists |
---|
67 | Int aiMvpNum[2][2]; // for two segments and two lists |
---|
68 | Int aiMvpIdx[2][2]; // for two segments and two lists |
---|
69 | UChar auhInterDir[2]; // for two segments |
---|
70 | Bool abMergeFlag[2]; // for two segments |
---|
71 | UChar auhMergeIndex[2]; // for two segments |
---|
72 | Char ahVSPFlag[2]; // for two segments |
---|
73 | DisInfo acDvInfo[2]; // for two segments |
---|
74 | |
---|
75 | PartSize eVirtualPartSize; |
---|
76 | UInt uiVirtualPartIndex; |
---|
77 | } DBBPTmpData; |
---|
78 | #endif |
---|
79 | |
---|
80 | // ==================================================================================================================== |
---|
81 | // Class definition |
---|
82 | // ==================================================================================================================== |
---|
83 | |
---|
84 | /// CU data structure class |
---|
85 | class TComDataCU |
---|
86 | { |
---|
87 | private: |
---|
88 | |
---|
89 | // ------------------------------------------------------------------------------------------------------------------- |
---|
90 | // class pointers |
---|
91 | // ------------------------------------------------------------------------------------------------------------------- |
---|
92 | |
---|
93 | TComPic* m_pcPic; ///< picture class pointer |
---|
94 | TComSlice* m_pcSlice; ///< slice header pointer |
---|
95 | TComPattern* m_pcPattern; ///< neighbour access class pointer |
---|
96 | |
---|
97 | // ------------------------------------------------------------------------------------------------------------------- |
---|
98 | // CU description |
---|
99 | // ------------------------------------------------------------------------------------------------------------------- |
---|
100 | |
---|
101 | UInt m_uiCUAddr; ///< CU address in a slice |
---|
102 | UInt m_uiAbsIdxInLCU; ///< absolute address in a CU. It's Z scan order |
---|
103 | UInt m_uiCUPelX; ///< CU position in a pixel (X) |
---|
104 | UInt m_uiCUPelY; ///< CU position in a pixel (Y) |
---|
105 | UInt m_uiNumPartition; ///< total number of minimum partitions in a CU |
---|
106 | UChar* m_puhWidth; ///< array of widths |
---|
107 | UChar* m_puhHeight; ///< array of heights |
---|
108 | UChar* m_puhDepth; ///< array of depths |
---|
109 | Int m_unitSize; ///< size of a "minimum partition" |
---|
110 | |
---|
111 | // ------------------------------------------------------------------------------------------------------------------- |
---|
112 | // CU data |
---|
113 | // ------------------------------------------------------------------------------------------------------------------- |
---|
114 | Bool* m_skipFlag; ///< array of skip flags |
---|
115 | Char* m_pePartSize; ///< array of partition sizes |
---|
116 | Char* m_pePredMode; ///< array of prediction modes |
---|
117 | Bool* m_CUTransquantBypass; ///< array of cu_transquant_bypass flags |
---|
118 | Char* m_phQP; ///< array of QP values |
---|
119 | UChar* m_puhTrIdx; ///< array of transform indices |
---|
120 | UChar* m_puhTransformSkip[3];///< array of transform skipping flags |
---|
121 | UChar* m_puhCbf[3]; ///< array of coded block flags (CBF) |
---|
122 | TComCUMvField m_acCUMvField[2]; ///< array of motion vectors |
---|
123 | TCoeff* m_pcTrCoeffY; ///< transformed coefficient buffer (Y) |
---|
124 | TCoeff* m_pcTrCoeffCb; ///< transformed coefficient buffer (Cb) |
---|
125 | TCoeff* m_pcTrCoeffCr; ///< transformed coefficient buffer (Cr) |
---|
126 | #if ADAPTIVE_QP_SELECTION |
---|
127 | Int* m_pcArlCoeffY; ///< ARL coefficient buffer (Y) |
---|
128 | Int* m_pcArlCoeffCb; ///< ARL coefficient buffer (Cb) |
---|
129 | Int* m_pcArlCoeffCr; ///< ARL coefficient buffer (Cr) |
---|
130 | Bool m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d |
---|
131 | |
---|
132 | static Int* m_pcGlbArlCoeffY; ///< ARL coefficient buffer (Y) |
---|
133 | static Int* m_pcGlbArlCoeffCb; ///< ARL coefficient buffer (Cb) |
---|
134 | static Int* m_pcGlbArlCoeffCr; ///< ARL coefficient buffer (Cr) |
---|
135 | #endif |
---|
136 | |
---|
137 | Pel* m_pcIPCMSampleY; ///< PCM sample buffer (Y) |
---|
138 | Pel* m_pcIPCMSampleCb; ///< PCM sample buffer (Cb) |
---|
139 | Pel* m_pcIPCMSampleCr; ///< PCM sample buffer (Cr) |
---|
140 | |
---|
141 | // ------------------------------------------------------------------------------------------------------------------- |
---|
142 | // neighbour access variables |
---|
143 | // ------------------------------------------------------------------------------------------------------------------- |
---|
144 | |
---|
145 | TComDataCU* m_pcCUAboveLeft; ///< pointer of above-left CU |
---|
146 | TComDataCU* m_pcCUAboveRight; ///< pointer of above-right CU |
---|
147 | TComDataCU* m_pcCUAbove; ///< pointer of above CU |
---|
148 | TComDataCU* m_pcCULeft; ///< pointer of left CU |
---|
149 | TComDataCU* m_apcCUColocated[2]; ///< pointer of temporally colocated CU's for both directions |
---|
150 | TComMvField m_cMvFieldA; ///< motion vector of position A |
---|
151 | TComMvField m_cMvFieldB; ///< motion vector of position B |
---|
152 | TComMvField m_cMvFieldC; ///< motion vector of position C |
---|
153 | TComMv m_cMvPred; ///< motion vector predictor |
---|
154 | |
---|
155 | // ------------------------------------------------------------------------------------------------------------------- |
---|
156 | // coding tool information |
---|
157 | // ------------------------------------------------------------------------------------------------------------------- |
---|
158 | |
---|
159 | Bool* m_pbMergeFlag; ///< array of merge flags |
---|
160 | UChar* m_puhMergeIndex; ///< array of merge candidate indices |
---|
161 | #if AMP_MRG |
---|
162 | Bool m_bIsMergeAMP; |
---|
163 | #endif |
---|
164 | UChar* m_puhLumaIntraDir; ///< array of intra directions (luma) |
---|
165 | UChar* m_puhChromaIntraDir; ///< array of intra directions (chroma) |
---|
166 | UChar* m_puhInterDir; ///< array of inter directions |
---|
167 | Char* m_apiMVPIdx[2]; ///< array of motion vector predictor candidates |
---|
168 | Char* m_apiMVPNum[2]; ///< array of number of possible motion vectors predictors |
---|
169 | Bool* m_pbIPCMFlag; ///< array of intra_pcm flags |
---|
170 | #if H_3D_NBDV |
---|
171 | DisInfo* m_pDvInfo; |
---|
172 | #endif |
---|
173 | #if H_3D_VSP |
---|
174 | Char* m_piVSPFlag; ///< array of VSP flags to indicate whehter a block uses VSP or not |
---|
175 | ///< 0: non-VSP; 1: VSP |
---|
176 | #endif |
---|
177 | #if H_3D_SPIVMP |
---|
178 | Bool* m_pbSPIVMPFlag; ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP |
---|
179 | ///< 0: non-SPIVMP; 1: SPIVMP |
---|
180 | #endif |
---|
181 | #if H_3D_ARP |
---|
182 | UChar* m_puhARPW; |
---|
183 | #endif |
---|
184 | #if H_3D_IC |
---|
185 | Bool* m_pbICFlag; ///< array of IC flags |
---|
186 | #endif |
---|
187 | #if H_3D_DIM |
---|
188 | Pel* m_dimDeltaDC[DIM_NUM_TYPE][2]; |
---|
189 | #if H_3D_DIM_DMM |
---|
190 | UInt* m_dmmWedgeTabIdx[DMM_NUM_TYPE]; |
---|
191 | #endif |
---|
192 | #if H_3D_DIM_SDC |
---|
193 | Bool* m_pbSDCFlag; |
---|
194 | Pel* m_apSegmentDCOffset[2]; |
---|
195 | #endif |
---|
196 | #endif |
---|
197 | #if H_3D_DBBP |
---|
198 | Bool* m_pbDBBPFlag; ///< array of DBBP flags |
---|
199 | DBBPTmpData m_sDBBPTmpData; |
---|
200 | #endif |
---|
201 | #if H_3D |
---|
202 | Bool m_bAvailableFlagA1; ///< A1 available flag |
---|
203 | Bool m_bAvailableFlagB1; ///< B1 available flag |
---|
204 | Bool m_bAvailableFlagB0; ///< B0 available flag |
---|
205 | Bool m_bAvailableFlagA0; ///< A0 available flag |
---|
206 | Bool m_bAvailableFlagB2; ///< B2 available flag |
---|
207 | #endif |
---|
208 | // ------------------------------------------------------------------------------------------------------------------- |
---|
209 | // misc. variables |
---|
210 | // ------------------------------------------------------------------------------------------------------------------- |
---|
211 | |
---|
212 | Bool m_bDecSubCu; ///< indicates decoder-mode |
---|
213 | Double m_dTotalCost; ///< sum of partition RD costs |
---|
214 | #if H_3D_VSO |
---|
215 | Dist m_uiTotalDistortion; ///< sum of partition distortion |
---|
216 | #else |
---|
217 | UInt m_uiTotalDistortion; ///< sum of partition distortion |
---|
218 | #endif |
---|
219 | UInt m_uiTotalBits; ///< sum of partition bits |
---|
220 | UInt m_uiTotalBins; ///< sum of partition bins |
---|
221 | UInt* m_sliceStartCU; ///< Start CU address of current slice |
---|
222 | UInt* m_sliceSegmentStartCU; ///< Start CU address of current slice |
---|
223 | Char m_codedQP; |
---|
224 | #if H_3D |
---|
225 | DisInfo m_cDefaultDisInfo; ///< Default disparity information for initializing |
---|
226 | #endif |
---|
227 | |
---|
228 | #if H_3D_DDD |
---|
229 | UChar* m_pucDisparityDerivedDepth; |
---|
230 | Bool* m_pbUseDDD; |
---|
231 | Int m_iUseDDDCandIdx; |
---|
232 | UChar m_ucDDTmpDepth; |
---|
233 | #endif |
---|
234 | |
---|
235 | protected: |
---|
236 | |
---|
237 | /// add possible motion vector predictor candidates |
---|
238 | Bool xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
239 | Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
240 | #if H_3D_VSP |
---|
241 | Bool xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, |
---|
242 | Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo* inheritedVSPDisInfo); |
---|
243 | #endif |
---|
244 | #if H_3D_IV_MERGE |
---|
245 | Bool xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, |
---|
246 | Int* ivCandRefIdx, Int posIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo* inheritedVSPDisInfo ); |
---|
247 | Bool xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int* ivCandDir, Int posIvDC, Int* vspFlag, Int& iFirDispCand ); |
---|
248 | #endif |
---|
249 | |
---|
250 | Void deriveRightBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxRB ); |
---|
251 | Bool xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx |
---|
252 | #if H_3D_TMVP |
---|
253 | , |
---|
254 | Bool bMRG = true |
---|
255 | #endif |
---|
256 | ); |
---|
257 | |
---|
258 | /// compute required bits to encode MVD (used in AMVP) |
---|
259 | UInt xGetMvdBits ( TComMv cMvd ); |
---|
260 | UInt xGetComponentBits ( Int iVal ); |
---|
261 | |
---|
262 | /// compute scaling factor from POC difference |
---|
263 | #if !H_3D_ARP |
---|
264 | Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
265 | #endif |
---|
266 | |
---|
267 | Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter ); |
---|
268 | |
---|
269 | #if H_3D_VSP |
---|
270 | Void xSetMvFieldForVSP ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize ); |
---|
271 | #endif |
---|
272 | |
---|
273 | public: |
---|
274 | TComDataCU(); |
---|
275 | virtual ~TComDataCU(); |
---|
276 | |
---|
277 | // ------------------------------------------------------------------------------------------------------------------- |
---|
278 | // create / destroy / initialize / copy |
---|
279 | // ------------------------------------------------------------------------------------------------------------------- |
---|
280 | #if H_3D_ARP |
---|
281 | Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
282 | #endif |
---|
283 | Void create ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize |
---|
284 | #if ADAPTIVE_QP_SELECTION |
---|
285 | , Bool bGlobalRMARLBuffer = false |
---|
286 | #endif |
---|
287 | ); |
---|
288 | Void destroy (); |
---|
289 | |
---|
290 | Void initCU ( TComPic* pcPic, UInt uiCUAddr ); |
---|
291 | Void initEstData ( UInt uiDepth, Int qp, Bool bTransquantBypass ); |
---|
292 | Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); |
---|
293 | Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
294 | #if H_3D_NBDV |
---|
295 | Void copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx); |
---|
296 | #endif |
---|
297 | Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
298 | Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList |
---|
299 | #if H_3D_NBDV |
---|
300 | , Bool bNBDV = false |
---|
301 | #endif |
---|
302 | ); |
---|
303 | Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
304 | |
---|
305 | Void copyToPic ( UChar uiDepth ); |
---|
306 | Void copyToPic ( UChar uiDepth, UInt uiPartIdx, UInt uiPartDepth ); |
---|
307 | |
---|
308 | // ------------------------------------------------------------------------------------------------------------------- |
---|
309 | // member functions for CU description |
---|
310 | // ------------------------------------------------------------------------------------------------------------------- |
---|
311 | |
---|
312 | TComPic* getPic () { return m_pcPic; } |
---|
313 | TComSlice* getSlice () { return m_pcSlice; } |
---|
314 | UInt& getAddr () { return m_uiCUAddr; } |
---|
315 | UInt& getZorderIdxInCU () { return m_uiAbsIdxInLCU; } |
---|
316 | UInt getSCUAddr (); |
---|
317 | UInt getCUPelX () { return m_uiCUPelX; } |
---|
318 | UInt getCUPelY () { return m_uiCUPelY; } |
---|
319 | TComPattern* getPattern () { return m_pcPattern; } |
---|
320 | |
---|
321 | UChar* getDepth () { return m_puhDepth; } |
---|
322 | UChar getDepth ( UInt uiIdx ) { return m_puhDepth[uiIdx]; } |
---|
323 | Void setDepth ( UInt uiIdx, UChar uh ) { m_puhDepth[uiIdx] = uh; } |
---|
324 | |
---|
325 | Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); |
---|
326 | #if H_3D |
---|
327 | Void getPosInPic ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ); |
---|
328 | #endif |
---|
329 | |
---|
330 | // ------------------------------------------------------------------------------------------------------------------- |
---|
331 | // member functions for CU data |
---|
332 | // ------------------------------------------------------------------------------------------------------------------- |
---|
333 | |
---|
334 | Char* getPartitionSize () { return m_pePartSize; } |
---|
335 | PartSize getPartitionSize ( UInt uiIdx ) { return static_cast<PartSize>( m_pePartSize[uiIdx] ); } |
---|
336 | Void setPartitionSize ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh; } |
---|
337 | Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
338 | Void setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
339 | |
---|
340 | #if H_3D_DBBP |
---|
341 | Pel* getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride); |
---|
342 | #endif |
---|
343 | |
---|
344 | Bool* getSkipFlag () { return m_skipFlag; } |
---|
345 | Bool getSkipFlag (UInt idx) { return m_skipFlag[idx]; } |
---|
346 | Void setSkipFlag ( UInt idx, Bool skip) { m_skipFlag[idx] = skip; } |
---|
347 | Void setSkipFlagSubParts ( Bool skip, UInt absPartIdx, UInt depth ); |
---|
348 | |
---|
349 | Char* getPredictionMode () { return m_pePredMode; } |
---|
350 | PredMode getPredictionMode ( UInt uiIdx ) { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } |
---|
351 | Bool* getCUTransquantBypass () { return m_CUTransquantBypass; } |
---|
352 | Bool getCUTransquantBypass( UInt uiIdx ) { return m_CUTransquantBypass[uiIdx]; } |
---|
353 | Void setPredictionMode ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh; } |
---|
354 | Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
355 | |
---|
356 | #if H_3D_DBBP |
---|
357 | Bool* getDBBPFlag () { return m_pbDBBPFlag; } |
---|
358 | Bool getDBBPFlag ( UInt uiIdx ) { return m_pbDBBPFlag[uiIdx]; } |
---|
359 | Void setDBBPFlag ( UInt uiIdx, Bool b ) { m_pbDBBPFlag[uiIdx] = b; } |
---|
360 | Void setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
361 | DBBPTmpData* getDBBPTmpData () { return &m_sDBBPTmpData; } |
---|
362 | #endif |
---|
363 | |
---|
364 | UChar* getWidth () { return m_puhWidth; } |
---|
365 | UChar getWidth ( UInt uiIdx ) { return m_puhWidth[uiIdx]; } |
---|
366 | Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh; } |
---|
367 | |
---|
368 | UChar* getHeight () { return m_puhHeight; } |
---|
369 | UChar getHeight ( UInt uiIdx ) { return m_puhHeight[uiIdx]; } |
---|
370 | Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh; } |
---|
371 | |
---|
372 | Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
373 | |
---|
374 | Char* getQP () { return m_phQP; } |
---|
375 | Char getQP ( UInt uiIdx ) { return m_phQP[uiIdx]; } |
---|
376 | Void setQP ( UInt uiIdx, Char value ){ m_phQP[uiIdx] = value; } |
---|
377 | Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
378 | Int getLastValidPartIdx ( Int iAbsPartIdx ); |
---|
379 | Char getLastCodedQP ( UInt uiAbsPartIdx ); |
---|
380 | Void setQPSubCUs ( Int qp, TComDataCU* pcCU, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf ); |
---|
381 | Void setCodedQP ( Char qp ) { m_codedQP = qp; } |
---|
382 | Char getCodedQP () { return m_codedQP; } |
---|
383 | |
---|
384 | Bool isLosslessCoded(UInt absPartIdx); |
---|
385 | |
---|
386 | UChar* getTransformIdx () { return m_puhTrIdx; } |
---|
387 | UChar getTransformIdx ( UInt uiIdx ) { return m_puhTrIdx[uiIdx]; } |
---|
388 | Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
389 | |
---|
390 | UChar* getTransformSkip ( TextType eType) { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]];} |
---|
391 | UChar getTransformSkip ( UInt uiIdx,TextType eType) { return m_puhTransformSkip[g_aucConvertTxtTypeToIdx[eType]][uiIdx];} |
---|
392 | Void setTransformSkipSubParts ( UInt useTransformSkip, TextType eType, UInt uiAbsPartIdx, UInt uiDepth); |
---|
393 | Void setTransformSkipSubParts ( UInt useTransformSkipY, UInt useTransformSkipU, UInt useTransformSkipV, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
394 | |
---|
395 | UInt getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ); |
---|
396 | |
---|
397 | TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } |
---|
398 | |
---|
399 | TCoeff*& getCoeffY () { return m_pcTrCoeffY; } |
---|
400 | TCoeff*& getCoeffCb () { return m_pcTrCoeffCb; } |
---|
401 | TCoeff*& getCoeffCr () { return m_pcTrCoeffCr; } |
---|
402 | #if ADAPTIVE_QP_SELECTION |
---|
403 | Int*& getArlCoeffY () { return m_pcArlCoeffY; } |
---|
404 | Int*& getArlCoeffCb () { return m_pcArlCoeffCb; } |
---|
405 | Int*& getArlCoeffCr () { return m_pcArlCoeffCr; } |
---|
406 | #endif |
---|
407 | |
---|
408 | Pel*& getPCMSampleY () { return m_pcIPCMSampleY; } |
---|
409 | Pel*& getPCMSampleCb () { return m_pcIPCMSampleCb; } |
---|
410 | Pel*& getPCMSampleCr () { return m_pcIPCMSampleCr; } |
---|
411 | |
---|
412 | UChar getCbf ( UInt uiIdx, TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx]; } |
---|
413 | UChar* getCbf ( TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]]; } |
---|
414 | UChar getCbf ( UInt uiIdx, TextType eType, UInt uiTrDepth ) { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); } |
---|
415 | Void setCbf ( UInt uiIdx, TextType eType, UChar uh ) { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh; } |
---|
416 | Void clearCbf ( UInt uiIdx, TextType eType, UInt uiNumParts ); |
---|
417 | UChar getQtRootCbf ( UInt uiIdx ) { return getCbf( uiIdx, TEXT_LUMA, 0 ) || getCbf( uiIdx, TEXT_CHROMA_U, 0 ) || getCbf( uiIdx, TEXT_CHROMA_V, 0 ); } |
---|
418 | |
---|
419 | Void setCbfSubParts ( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
420 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
421 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
422 | |
---|
423 | // ------------------------------------------------------------------------------------------------------------------- |
---|
424 | // member functions for coding tool information |
---|
425 | // ------------------------------------------------------------------------------------------------------------------- |
---|
426 | |
---|
427 | Bool* getMergeFlag () { return m_pbMergeFlag; } |
---|
428 | Bool getMergeFlag ( UInt uiIdx ) { return m_pbMergeFlag[uiIdx]; } |
---|
429 | Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b; } |
---|
430 | Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
431 | |
---|
432 | UChar* getMergeIndex () { return m_puhMergeIndex; } |
---|
433 | UChar getMergeIndex ( UInt uiIdx ) { return m_puhMergeIndex[uiIdx]; } |
---|
434 | Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } |
---|
435 | Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
436 | template <typename T> |
---|
437 | Void setSubPart ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
438 | #if H_3D_VSP |
---|
439 | template<typename T> |
---|
440 | Void setSubPartT ( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
441 | #endif |
---|
442 | #if AMP_MRG |
---|
443 | Void setMergeAMP( Bool b ) { m_bIsMergeAMP = b; } |
---|
444 | Bool getMergeAMP( ) { return m_bIsMergeAMP; } |
---|
445 | #endif |
---|
446 | |
---|
447 | UChar* getLumaIntraDir () { return m_puhLumaIntraDir; } |
---|
448 | UChar getLumaIntraDir ( UInt uiIdx ) { return m_puhLumaIntraDir[uiIdx]; } |
---|
449 | Void setLumaIntraDir ( UInt uiIdx, UChar uh ) { m_puhLumaIntraDir[uiIdx] = uh; } |
---|
450 | Void setLumaIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
451 | |
---|
452 | UChar* getChromaIntraDir () { return m_puhChromaIntraDir; } |
---|
453 | UChar getChromaIntraDir ( UInt uiIdx ) { return m_puhChromaIntraDir[uiIdx]; } |
---|
454 | Void setChromaIntraDir ( UInt uiIdx, UChar uh ) { m_puhChromaIntraDir[uiIdx] = uh; } |
---|
455 | Void setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
456 | |
---|
457 | UChar* getInterDir () { return m_puhInterDir; } |
---|
458 | UChar getInterDir ( UInt uiIdx ) { return m_puhInterDir[uiIdx]; } |
---|
459 | Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh; } |
---|
460 | Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
461 | Bool* getIPCMFlag () { return m_pbIPCMFlag; } |
---|
462 | Bool getIPCMFlag (UInt uiIdx ) { return m_pbIPCMFlag[uiIdx]; } |
---|
463 | Void setIPCMFlag (UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } |
---|
464 | Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth); |
---|
465 | #if H_3D_NBDV |
---|
466 | Void setDvInfoSubParts ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
467 | Void setDvInfoSubParts ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth); |
---|
468 | DisInfo* getDvInfo () { return m_pDvInfo; } |
---|
469 | DisInfo getDvInfo (UInt uiIdx) { return m_pDvInfo[uiIdx]; } |
---|
470 | #endif |
---|
471 | #if H_3D_NBDV |
---|
472 | Void xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb ); |
---|
473 | Bool xCheckSpatialNBDV (TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo, |
---|
474 | UInt uiMvpDvPos |
---|
475 | #if H_3D_NBDV_REF |
---|
476 | , Bool bDepthRefine = false |
---|
477 | #endif |
---|
478 | ); |
---|
479 | Bool xGetColDisMV ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx ); |
---|
480 | Bool getDisMvpCandNBDV ( DisInfo* pDInfo |
---|
481 | #if H_3D_NBDV_REF |
---|
482 | , Bool bDepthRefine = false |
---|
483 | #endif |
---|
484 | ); |
---|
485 | |
---|
486 | #if H_3D |
---|
487 | Void rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo* inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV); |
---|
488 | Bool getDispforDepth ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp); |
---|
489 | Bool getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm ); |
---|
490 | #endif |
---|
491 | |
---|
492 | #if H_3D_NBDV_REF |
---|
493 | Pel getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT ); |
---|
494 | Void estimateDVFromDM(Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred ); |
---|
495 | #endif //H_3D_NBDV_REF |
---|
496 | #endif |
---|
497 | #if H_3D_FAST_TEXTURE_ENCODING |
---|
498 | Void getIVNStatus ( UInt uiPartIdx, DisInfo* pDInfo, Bool& bIVFMerge, Int& iIVFMaxD); |
---|
499 | #endif |
---|
500 | #if H_3D_SPIVMP |
---|
501 | Void getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight); |
---|
502 | Void getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr ); |
---|
503 | Void setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight ); |
---|
504 | #endif |
---|
505 | #if H_3D_IV_MERGE |
---|
506 | Bool getInterViewMergeCands ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc, Bool bIsDepth |
---|
507 | |
---|
508 | #if H_3D_SPIVMP |
---|
509 | , TComMvField* pcMFieldSP, UChar* puhInterDirSP |
---|
510 | #endif |
---|
511 | ); |
---|
512 | #endif |
---|
513 | #if H_3D_ARP |
---|
514 | UChar* getARPW () { return m_puhARPW; } |
---|
515 | UChar getARPW ( UInt uiIdx ) { return m_puhARPW[uiIdx]; } |
---|
516 | Void setARPW ( UInt uiIdx, UChar w ) { m_puhARPW[uiIdx] = w; } |
---|
517 | Void setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
518 | Double getARPWFactor ( UInt uiIdx ); |
---|
519 | #endif |
---|
520 | #if H_3D_IC |
---|
521 | Bool* getICFlag () { return m_pbICFlag; } |
---|
522 | Bool getICFlag ( UInt uiIdx ) { return m_pbICFlag[uiIdx]; } |
---|
523 | Void setICFlag ( UInt uiIdx, Bool uh ) { m_pbICFlag[uiIdx] = uh; } |
---|
524 | Void setICFlagSubParts ( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
525 | Bool isICFlagRequired ( UInt uiAbsPartIdx ); |
---|
526 | Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false); |
---|
527 | #else |
---|
528 | // ------------------------------------------------------------------------------------------------------------------- |
---|
529 | // member functions for accessing partition information |
---|
530 | // ------------------------------------------------------------------------------------------------------------------- |
---|
531 | |
---|
532 | Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); |
---|
533 | #endif |
---|
534 | UChar getNumPartInter (); |
---|
535 | Bool isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth); |
---|
536 | |
---|
537 | #if H_3D_DIM |
---|
538 | Pel* getDimDeltaDC ( UInt dimType, UInt segId ) { return m_dimDeltaDC[dimType][segId]; } |
---|
539 | Pel getDimDeltaDC ( UInt dimType, UInt segId, UInt uiIdx ) { return m_dimDeltaDC[dimType][segId][uiIdx]; } |
---|
540 | Void setDimDeltaDC ( UInt dimType, UInt segId, UInt uiIdx, Pel val ) { m_dimDeltaDC[dimType][segId][uiIdx] = val; } |
---|
541 | #if H_3D_DIM_DMM |
---|
542 | UInt* getDmmWedgeTabIdx ( UInt dmmType ) { return m_dmmWedgeTabIdx[dmmType]; } |
---|
543 | UInt getDmmWedgeTabIdx ( UInt dmmType, UInt uiIdx ) { return m_dmmWedgeTabIdx[dmmType][uiIdx]; } |
---|
544 | Void setDmmWedgeTabIdx ( UInt dmmType, UInt uiIdx, UInt tabIdx ) { m_dmmWedgeTabIdx[dmmType][uiIdx] = tabIdx; } |
---|
545 | Void setDmmWedgeTabIdxSubParts ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
546 | |
---|
547 | #endif |
---|
548 | #if H_3D_DIM_SDC |
---|
549 | Bool* getSDCFlag () { return m_pbSDCFlag; } |
---|
550 | Bool getSDCFlag ( UInt uiIdx ) { return m_pbSDCFlag[uiIdx]; } |
---|
551 | Void setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
552 | |
---|
553 | Bool getSDCAvailable ( UInt uiAbsPartIdx ); |
---|
554 | |
---|
555 | Pel* getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; } |
---|
556 | Pel getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; } |
---|
557 | Void setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; } |
---|
558 | UInt getCtxSDCFlag ( UInt uiAbsPartIdx ); |
---|
559 | UInt getCtxAngleFlag ( UInt uiAbsPartIdx ); |
---|
560 | #endif |
---|
561 | #endif |
---|
562 | |
---|
563 | // ------------------------------------------------------------------------------------------------------------------- |
---|
564 | // member functions for motion vector |
---|
565 | // ------------------------------------------------------------------------------------------------------------------- |
---|
566 | |
---|
567 | Void getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); |
---|
568 | |
---|
569 | Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ); |
---|
570 | Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP); |
---|
571 | Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH); |
---|
572 | Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } |
---|
573 | Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) { return m_apiMVPIdx[eRefPicList][uiIdx]; } |
---|
574 | Char* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList]; } |
---|
575 | |
---|
576 | Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum; } |
---|
577 | Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) { return m_apiMVPNum[eRefPicList][uiIdx]; } |
---|
578 | Char* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList]; } |
---|
579 | |
---|
580 | Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
581 | Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
582 | |
---|
583 | Void clipMv ( TComMv& rcMv ); |
---|
584 | Void getMvPredLeft ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldA.getMv(); } |
---|
585 | Void getMvPredAbove ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldB.getMv(); } |
---|
586 | Void getMvPredAboveRight ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldC.getMv(); } |
---|
587 | #if H_3D |
---|
588 | Void compressMV ( Int scale ); |
---|
589 | #else |
---|
590 | Void compressMV (); |
---|
591 | #endif |
---|
592 | // ------------------------------------------------------------------------------------------------------------------- |
---|
593 | // utility functions for neighbouring information |
---|
594 | // ------------------------------------------------------------------------------------------------------------------- |
---|
595 | |
---|
596 | TComDataCU* getCULeft () { return m_pcCULeft; } |
---|
597 | TComDataCU* getCUAbove () { return m_pcCUAbove; } |
---|
598 | TComDataCU* getCUAboveLeft () { return m_pcCUAboveLeft; } |
---|
599 | TComDataCU* getCUAboveRight () { return m_pcCUAboveRight; } |
---|
600 | TComDataCU* getCUColocated ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; } |
---|
601 | |
---|
602 | |
---|
603 | TComDataCU* getPULeft ( UInt& uiLPartUnitIdx, |
---|
604 | UInt uiCurrPartUnitIdx, |
---|
605 | Bool bEnforceSliceRestriction=true, |
---|
606 | Bool bEnforceTileRestriction=true ); |
---|
607 | TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx, |
---|
608 | UInt uiCurrPartUnitIdx, |
---|
609 | Bool bEnforceSliceRestriction=true, |
---|
610 | Bool planarAtLCUBoundary = false, |
---|
611 | Bool bEnforceTileRestriction=true ); |
---|
612 | TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ); |
---|
613 | TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ); |
---|
614 | TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ); |
---|
615 | |
---|
616 | TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU ); |
---|
617 | TComDataCU* getQpMinCuAbove ( UInt& aPartUnitIdx , UInt currAbsIdxInLCU ); |
---|
618 | Char getRefQP ( UInt uiCurrAbsIdxInLCU ); |
---|
619 | |
---|
620 | TComDataCU* getPUAboveRightAdi ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ); |
---|
621 | TComDataCU* getPUBelowLeftAdi ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ); |
---|
622 | |
---|
623 | Void deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
624 | Void deriveLeftBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
625 | |
---|
626 | Void deriveLeftRightTopIdxAdi ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth ); |
---|
627 | Void deriveLeftBottomIdxAdi ( UInt& ruiPartIdxLB, UInt uiPartOffset, UInt uiPartDepth ); |
---|
628 | |
---|
629 | Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); |
---|
630 | |
---|
631 | #if H_3D |
---|
632 | Bool getAvailableFlagA1() { return m_bAvailableFlagA1;} |
---|
633 | Bool getAvailableFlagB1() { return m_bAvailableFlagB1;} |
---|
634 | Bool getAvailableFlagB0() { return m_bAvailableFlagB0;} |
---|
635 | Bool getAvailableFlagA0() { return m_bAvailableFlagA0;} |
---|
636 | Bool getAvailableFlagB2() { return m_bAvailableFlagB2;} |
---|
637 | Void initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0; } |
---|
638 | Void getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1); |
---|
639 | Void xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours |
---|
640 | #else |
---|
641 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours |
---|
642 | #endif |
---|
643 | #if H_3D_VSP |
---|
644 | , Int* vspFlag |
---|
645 | , InheritedVSPDisInfo* inheritedVSPDisInfo |
---|
646 | #endif |
---|
647 | #if H_3D_SPIVMP |
---|
648 | , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP |
---|
649 | #endif |
---|
650 | , Int& numValidMergeCand, Int mrgCandIdx = -1 |
---|
651 | ); |
---|
652 | |
---|
653 | #if H_3D_VSP |
---|
654 | inline Void xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount, InheritedVSPDisInfo* inheritedVSPDisInfo); |
---|
655 | |
---|
656 | #if H_3D_SPIVMP |
---|
657 | Bool* getSPIVMPFlag () { return m_pbSPIVMPFlag; } |
---|
658 | Bool getSPIVMPFlag ( UInt uiIdx ) { return m_pbSPIVMPFlag[uiIdx]; } |
---|
659 | Void setSPIVMPFlag ( UInt uiIdx, Bool n ) { m_pbSPIVMPFlag[uiIdx] = n; } |
---|
660 | Void setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
661 | #endif |
---|
662 | |
---|
663 | Char* getVSPFlag () { return m_piVSPFlag; } |
---|
664 | Char getVSPFlag ( UInt uiIdx ) { return m_piVSPFlag[uiIdx]; } |
---|
665 | Void setVSPFlag ( UInt uiIdx, Int n ) { m_piVSPFlag[uiIdx] = n; } |
---|
666 | Void setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
667 | Void setMvFieldPUForVSP ( TComDataCU* cu, UInt partAddr, Int width, Int height, RefPicList refPicList, Int refIdx, Int &vspSize ); |
---|
668 | #endif |
---|
669 | Void deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
670 | Void deriveLeftBottomIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
671 | |
---|
672 | |
---|
673 | // ------------------------------------------------------------------------------------------------------------------- |
---|
674 | // member functions for modes |
---|
675 | // ------------------------------------------------------------------------------------------------------------------- |
---|
676 | |
---|
677 | Bool isIntra ( UInt uiPartIdx ) { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } |
---|
678 | Bool isSkipped ( UInt uiPartIdx ); ///< SKIP (no residual) |
---|
679 | Bool isBipredRestriction( UInt puIdx ); |
---|
680 | |
---|
681 | #if H_3D_IC |
---|
682 | Bool isIC ( UInt uiPartIdx ); |
---|
683 | #endif |
---|
684 | |
---|
685 | // ------------------------------------------------------------------------------------------------------------------- |
---|
686 | // member functions for symbol prediction (most probable / mode conversion) |
---|
687 | // ------------------------------------------------------------------------------------------------------------------- |
---|
688 | |
---|
689 | UInt getIntraSizeIdx ( UInt uiAbsPartIdx ); |
---|
690 | |
---|
691 | Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList ); |
---|
692 | Int getIntraDirLumaPredictor ( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode = NULL ); |
---|
693 | |
---|
694 | // ------------------------------------------------------------------------------------------------------------------- |
---|
695 | // member functions for SBAC context |
---|
696 | // ------------------------------------------------------------------------------------------------------------------- |
---|
697 | |
---|
698 | UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
699 | UInt getCtxQtCbf ( TextType eType, UInt uiTrDepth ); |
---|
700 | |
---|
701 | UInt getCtxSkipFlag ( UInt uiAbsPartIdx ); |
---|
702 | UInt getCtxInterDir ( UInt uiAbsPartIdx ); |
---|
703 | |
---|
704 | #if H_3D_ARP |
---|
705 | UInt getCTXARPWFlag ( UInt uiAbsPartIdx ); |
---|
706 | #endif |
---|
707 | UInt getSliceStartCU ( UInt pos ) { return m_sliceStartCU[pos-m_uiAbsIdxInLCU]; } |
---|
708 | UInt getSliceSegmentStartCU ( UInt pos ) { return m_sliceSegmentStartCU[pos-m_uiAbsIdxInLCU]; } |
---|
709 | UInt& getTotalBins () { return m_uiTotalBins; } |
---|
710 | // ------------------------------------------------------------------------------------------------------------------- |
---|
711 | // member functions for RD cost storage |
---|
712 | // ------------------------------------------------------------------------------------------------------------------- |
---|
713 | |
---|
714 | Double& getTotalCost() { return m_dTotalCost; } |
---|
715 | #if H_3D_VSO |
---|
716 | Dist& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
717 | #else |
---|
718 | UInt& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
719 | #endif |
---|
720 | UInt& getTotalBits() { return m_uiTotalBits; } |
---|
721 | UInt& getTotalNumPart() { return m_uiNumPartition; } |
---|
722 | |
---|
723 | UInt getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra); |
---|
724 | |
---|
725 | #if H_3D_DDD |
---|
726 | UChar* getDDDepth () { return m_pucDisparityDerivedDepth; } |
---|
727 | UChar getDDDepth ( UInt uiIdx ) { return m_pucDisparityDerivedDepth[uiIdx]; } |
---|
728 | Void setDDDepth ( UInt uiIdx, UChar n ) { m_pucDisparityDerivedDepth[uiIdx] = n; } |
---|
729 | Void setDDDepthSubParts( UChar ucDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
730 | |
---|
731 | Bool* getUseDDD () { return m_pbUseDDD; } |
---|
732 | Bool getUseDDD ( UInt uiIdx ) { return m_pbUseDDD[uiIdx]; } |
---|
733 | Void setUseDDD ( UInt uiIdx, Bool n ) { m_pbUseDDD[uiIdx] = n; } |
---|
734 | Void setUseDDD( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
735 | |
---|
736 | Void setUseDDD ( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
737 | |
---|
738 | UChar getDDTmpDepth(){ return m_ucDDTmpDepth; } |
---|
739 | Int getUseDDDCandIdx(){ return m_iUseDDDCandIdx;} |
---|
740 | |
---|
741 | #endif |
---|
742 | }; |
---|
743 | |
---|
744 | namespace RasterAddress |
---|
745 | { |
---|
746 | /** Check whether 2 addresses point to the same 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 isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
753 | { |
---|
754 | // addrA % numUnitsPerRow == addrB % numUnitsPerRow |
---|
755 | return (( addrA ^ addrB ) & ( numUnitsPerRow - 1 ) ) == 0; |
---|
756 | } |
---|
757 | |
---|
758 | /** Check whether 2 addresses point to the same row |
---|
759 | * \param addrA First address in raster scan order |
---|
760 | * \param addrB Second address in raters scan order |
---|
761 | * \param numUnitsPerRow Number of units in a row |
---|
762 | * \return Result of test |
---|
763 | */ |
---|
764 | static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
765 | { |
---|
766 | // addrA / numUnitsPerRow == addrB / numUnitsPerRow |
---|
767 | return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
768 | } |
---|
769 | |
---|
770 | /** Check whether 2 addresses point to the same row or column |
---|
771 | * \param addrA First address in raster scan order |
---|
772 | * \param addrB Second address in raters scan order |
---|
773 | * \param numUnitsPerRow Number of units in a row |
---|
774 | * \return Result of test |
---|
775 | */ |
---|
776 | static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
777 | { |
---|
778 | return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow ); |
---|
779 | } |
---|
780 | |
---|
781 | /** Check whether one address points to the first column |
---|
782 | * \param addr Address in raster scan order |
---|
783 | * \param numUnitsPerRow Number of units in a row |
---|
784 | * \return Result of test |
---|
785 | */ |
---|
786 | static inline Bool isZeroCol( Int addr, Int numUnitsPerRow ) |
---|
787 | { |
---|
788 | // addr % numUnitsPerRow == 0 |
---|
789 | return ( addr & ( numUnitsPerRow - 1 ) ) == 0; |
---|
790 | } |
---|
791 | |
---|
792 | /** Check whether one address points to the first row |
---|
793 | * \param addr Address in raster scan order |
---|
794 | * \param numUnitsPerRow Number of units in a row |
---|
795 | * \return Result of test |
---|
796 | */ |
---|
797 | static inline Bool isZeroRow( Int addr, Int numUnitsPerRow ) |
---|
798 | { |
---|
799 | // addr / numUnitsPerRow == 0 |
---|
800 | return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
801 | } |
---|
802 | |
---|
803 | /** Check whether one address points to a column whose index is smaller than a given value |
---|
804 | * \param addr Address in raster scan order |
---|
805 | * \param val Given column index value |
---|
806 | * \param numUnitsPerRow Number of units in a row |
---|
807 | * \return Result of test |
---|
808 | */ |
---|
809 | static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow ) |
---|
810 | { |
---|
811 | // addr % numUnitsPerRow < val |
---|
812 | return ( addr & ( numUnitsPerRow - 1 ) ) < val; |
---|
813 | } |
---|
814 | |
---|
815 | /** Check whether one address points to a row whose index is smaller than a given value |
---|
816 | * \param addr Address in raster scan order |
---|
817 | * \param val Given row index value |
---|
818 | * \param numUnitsPerRow Number of units in a row |
---|
819 | * \return Result of test |
---|
820 | */ |
---|
821 | static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow ) |
---|
822 | { |
---|
823 | // addr / numUnitsPerRow < val |
---|
824 | return addr < val * numUnitsPerRow; |
---|
825 | } |
---|
826 | }; |
---|
827 | |
---|
828 | //! \} |
---|
829 | |
---|
830 | #endif |
---|