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