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-2015, 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 <algorithm> |
---|
43 | #include <vector> |
---|
44 | |
---|
45 | // Include files |
---|
46 | #include "CommonDef.h" |
---|
47 | #include "TComMotionInfo.h" |
---|
48 | #include "TComSlice.h" |
---|
49 | #include "TComRdCost.h" |
---|
50 | #include "TComPattern.h" |
---|
51 | |
---|
52 | //! \ingroup TLibCommon |
---|
53 | //! \{ |
---|
54 | |
---|
55 | class TComTU; // forward declaration |
---|
56 | |
---|
57 | static const UInt NUM_MOST_PROBABLE_MODES=3; |
---|
58 | |
---|
59 | #if NH_3D_DBBP |
---|
60 | typedef struct _DBBPTmpData |
---|
61 | { |
---|
62 | TComMv acMvd[2][2]; // for two segments and two lists |
---|
63 | TComMvField acMvField[2][2]; // for two segments and two lists |
---|
64 | Int aiMvpNum[2][2]; // for two segments and two lists |
---|
65 | Int aiMvpIdx[2][2]; // for two segments and two lists |
---|
66 | UChar auhInterDir[2]; // for two segments |
---|
67 | Bool abMergeFlag[2]; // for two segments |
---|
68 | UChar auhMergeIndex[2]; // for two segments |
---|
69 | PartSize eVirtualPartSize; |
---|
70 | UInt uiVirtualPartIndex; |
---|
71 | } DbbpTmpData; |
---|
72 | #endif |
---|
73 | |
---|
74 | |
---|
75 | // ==================================================================================================================== |
---|
76 | // Class definition |
---|
77 | // ==================================================================================================================== |
---|
78 | |
---|
79 | /// CU data structure class |
---|
80 | class TComDataCU |
---|
81 | { |
---|
82 | private: |
---|
83 | |
---|
84 | // ------------------------------------------------------------------------------------------------------------------- |
---|
85 | // class pointers |
---|
86 | // ------------------------------------------------------------------------------------------------------------------- |
---|
87 | |
---|
88 | TComPic* m_pcPic; ///< picture class pointer |
---|
89 | TComSlice* m_pcSlice; ///< slice header pointer |
---|
90 | |
---|
91 | // ------------------------------------------------------------------------------------------------------------------- |
---|
92 | // CU description |
---|
93 | // ------------------------------------------------------------------------------------------------------------------- |
---|
94 | |
---|
95 | UInt m_ctuRsAddr; ///< CTU (also known as LCU) address in a slice (Raster-scan address, as opposed to tile-scan/encoding order). |
---|
96 | UInt m_absZIdxInCtu; ///< absolute address in a CTU. It's Z scan order |
---|
97 | UInt m_uiCUPelX; ///< CU position in a pixel (X) |
---|
98 | UInt m_uiCUPelY; ///< CU position in a pixel (Y) |
---|
99 | UInt m_uiNumPartition; ///< total number of minimum partitions in a CU |
---|
100 | UChar* m_puhWidth; ///< array of widths |
---|
101 | UChar* m_puhHeight; ///< array of heights |
---|
102 | UChar* m_puhDepth; ///< array of depths |
---|
103 | Int m_unitSize; ///< size of a "minimum partition" |
---|
104 | |
---|
105 | // ------------------------------------------------------------------------------------------------------------------- |
---|
106 | // CU data |
---|
107 | // ------------------------------------------------------------------------------------------------------------------- |
---|
108 | |
---|
109 | Bool* m_skipFlag; ///< array of skip flags |
---|
110 | #if NH_3D_DIS |
---|
111 | Bool* m_bDISFlag; |
---|
112 | UChar* m_ucDISType; |
---|
113 | #endif |
---|
114 | SChar* m_pePartSize; ///< array of partition sizes |
---|
115 | SChar* m_pePredMode; ///< array of prediction modes |
---|
116 | SChar* m_crossComponentPredictionAlpha[MAX_NUM_COMPONENT]; ///< array of cross-component prediction alpha values |
---|
117 | Bool* m_CUTransquantBypass; ///< array of cu_transquant_bypass flags |
---|
118 | SChar* m_phQP; ///< array of QP values |
---|
119 | UChar* m_ChromaQpAdj; ///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1 |
---|
120 | UInt m_codedChromaQpAdj; |
---|
121 | UChar* m_puhTrIdx; ///< array of transform indices |
---|
122 | UChar* m_puhTransformSkip[MAX_NUM_COMPONENT];///< array of transform skipping flags |
---|
123 | UChar* m_puhCbf[MAX_NUM_COMPONENT]; ///< array of coded block flags (CBF) |
---|
124 | TComCUMvField m_acCUMvField[NUM_REF_PIC_LIST_01]; ///< array of motion vectors. |
---|
125 | TCoeff* m_pcTrCoeff[MAX_NUM_COMPONENT]; ///< array of transform coefficient buffers (0->Y, 1->Cb, 2->Cr) |
---|
126 | #if ADAPTIVE_QP_SELECTION |
---|
127 | TCoeff* m_pcArlCoeff[MAX_NUM_COMPONENT]; ///< ARL coefficient buffer (0->Y, 1->Cb, 2->Cr) |
---|
128 | Bool m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d |
---|
129 | #endif |
---|
130 | |
---|
131 | Pel* m_pcIPCMSample[MAX_NUM_COMPONENT]; ///< PCM sample buffer (0->Y, 1->Cb, 2->Cr) |
---|
132 | |
---|
133 | // ------------------------------------------------------------------------------------------------------------------- |
---|
134 | // neighbour access variables |
---|
135 | // ------------------------------------------------------------------------------------------------------------------- |
---|
136 | |
---|
137 | TComDataCU* m_pCtuAboveLeft; ///< pointer of above-left CTU. |
---|
138 | TComDataCU* m_pCtuAboveRight; ///< pointer of above-right CTU. |
---|
139 | TComDataCU* m_pCtuAbove; ///< pointer of above CTU. |
---|
140 | TComDataCU* m_pCtuLeft; ///< pointer of left CTU |
---|
141 | TComDataCU* m_apcCUColocated[NUM_REF_PIC_LIST_01]; ///< pointer of temporally colocated CU's for both directions |
---|
142 | TComMvField m_cMvFieldA; ///< motion vector of position A |
---|
143 | TComMvField m_cMvFieldB; ///< motion vector of position B |
---|
144 | TComMvField m_cMvFieldC; ///< motion vector of position C |
---|
145 | TComMv m_cMvPred; ///< motion vector predictor |
---|
146 | |
---|
147 | // ------------------------------------------------------------------------------------------------------------------- |
---|
148 | // coding tool information |
---|
149 | // ------------------------------------------------------------------------------------------------------------------- |
---|
150 | |
---|
151 | Bool* m_pbMergeFlag; ///< array of merge flags |
---|
152 | UChar* m_puhMergeIndex; ///< array of merge candidate indices |
---|
153 | #if AMP_MRG |
---|
154 | Bool m_bIsMergeAMP; |
---|
155 | #endif |
---|
156 | UChar* m_puhIntraDir[MAX_NUM_CHANNEL_TYPE]; |
---|
157 | UChar* m_puhInterDir; ///< array of inter directions |
---|
158 | SChar* m_apiMVPIdx[NUM_REF_PIC_LIST_01]; ///< array of motion vector predictor candidates |
---|
159 | SChar* m_apiMVPNum[NUM_REF_PIC_LIST_01]; ///< array of number of possible motion vectors predictors |
---|
160 | Bool* m_pbIPCMFlag; ///< array of intra_pcm flags |
---|
161 | #if NH_3D_NBDV |
---|
162 | DisInfo* m_pDvInfo; |
---|
163 | #endif |
---|
164 | #if NH_3D_VSP |
---|
165 | SChar* m_piVSPFlag; ///< array of VSP flags to indicate whehter a block uses VSP or not ///< 0: non-VSP; 1: VSP |
---|
166 | #endif |
---|
167 | #if NH_3D_SPIVMP |
---|
168 | Bool* m_pbSPIVMPFlag; ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP ///< 0: non-SPIVMP; 1: SPIVMP |
---|
169 | #endif |
---|
170 | #if NH_3D_ARP |
---|
171 | UChar* m_puhARPW; |
---|
172 | #endif |
---|
173 | #if NH_3D_IC |
---|
174 | Bool* m_pbICFlag; ///< array of IC flags |
---|
175 | #endif |
---|
176 | #if NH_3D_DMM |
---|
177 | Pel* m_dmmDeltaDC[NUM_DMM][2]; |
---|
178 | UInt* m_dmm1WedgeTabIdx; |
---|
179 | #endif |
---|
180 | #if NH_3D_SDC_INTRA |
---|
181 | Bool* m_pbSDCFlag; |
---|
182 | Pel* m_apSegmentDCOffset[2]; |
---|
183 | #endif |
---|
184 | #if NH_3D_DBBP |
---|
185 | Bool* m_pbDBBPFlag; ///< array of DBBP flags |
---|
186 | DbbpTmpData m_sDBBPTmpData; |
---|
187 | #endif |
---|
188 | #if NH_3D_MLC |
---|
189 | Bool m_bAvailableFlagA1; ///< A1 available flag |
---|
190 | Bool m_bAvailableFlagB1; ///< B1 available flag |
---|
191 | Bool m_bAvailableFlagB0; ///< B0 available flag |
---|
192 | Bool m_bAvailableFlagA0; ///< A0 available flag |
---|
193 | Bool m_bAvailableFlagB2; ///< B2 available flag |
---|
194 | #endif |
---|
195 | |
---|
196 | |
---|
197 | // ------------------------------------------------------------------------------------------------------------------- |
---|
198 | // misc. variables |
---|
199 | // ------------------------------------------------------------------------------------------------------------------- |
---|
200 | |
---|
201 | Bool m_bDecSubCu; ///< indicates decoder-mode |
---|
202 | Double m_dTotalCost; ///< sum of partition RD costs |
---|
203 | #if NH_3D_VSO |
---|
204 | Dist m_uiTotalDistortion; ///< sum of partition distortion |
---|
205 | #else |
---|
206 | Distortion m_uiTotalDistortion; ///< sum of partition distortion |
---|
207 | #endif |
---|
208 | UInt m_uiTotalBits; ///< sum of partition bits |
---|
209 | UInt m_uiTotalBins; ///< sum of partition bins |
---|
210 | SChar m_codedQP; |
---|
211 | #if NH_3D_MLC |
---|
212 | DisInfo m_cDefaultDisInfo; ///< Default disparity information for initializing |
---|
213 | TComMotionCand m_mergCands[MRG_IVSHIFT+1]; ///< Motion candidates for merge mode |
---|
214 | Int m_numSpatialCands; |
---|
215 | #endif |
---|
216 | |
---|
217 | UChar* m_explicitRdpcmMode[MAX_NUM_COMPONENT]; ///< Stores the explicit RDPCM mode for all TUs belonging to this CU |
---|
218 | |
---|
219 | protected: |
---|
220 | |
---|
221 | /// adds a single possible motion vector predictor candidate |
---|
222 | Bool xAddMVPCandUnscaled ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const; |
---|
223 | Bool xAddMVPCandWithScaling ( AMVPInfo &info, const RefPicList eRefPicList, const Int iRefIdx, const UInt uiPartUnitIdx, const MVP_DIR eDir ) const; |
---|
224 | |
---|
225 | #if NH_3D_VSP |
---|
226 | Bool xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount); |
---|
227 | #endif |
---|
228 | #if NH_3D_IV_MERGE |
---|
229 | Bool xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int* ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx ); |
---|
230 | #endif |
---|
231 | |
---|
232 | Void deriveRightBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxRB ) const; |
---|
233 | |
---|
234 | #if NH_3D_TMVP |
---|
235 | Bool xGetColMVP ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, Int& refIdx, Bool bMRG = true ) const; |
---|
236 | #else |
---|
237 | Bool xGetColMVP ( const RefPicList eRefPicList, const Int ctuRsAddr, const Int partUnitIdx, TComMv& rcMv, const Int refIdx ) const; |
---|
238 | #endif |
---|
239 | |
---|
240 | /// compute scaling factor from POC difference |
---|
241 | #if !NH_3D_ARP |
---|
242 | static Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
243 | #endif |
---|
244 | Void xDeriveCenterIdx ( UInt uiPartIdx, UInt& ruiPartIdxCenter ) const; |
---|
245 | |
---|
246 | #if NH_3D_VSP |
---|
247 | Void xSetMvFieldForVSP ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize ); |
---|
248 | #endif |
---|
249 | |
---|
250 | public: |
---|
251 | |
---|
252 | #if NH_3D_ARP |
---|
253 | static Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
254 | #endif |
---|
255 | |
---|
256 | TComDataCU(); |
---|
257 | virtual ~TComDataCU(); |
---|
258 | |
---|
259 | // ------------------------------------------------------------------------------------------------------------------- |
---|
260 | // create / destroy / initialize / copy |
---|
261 | // ------------------------------------------------------------------------------------------------------------------- |
---|
262 | Void create ( ChromaFormat chromaFormatIDC, UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize |
---|
263 | #if ADAPTIVE_QP_SELECTION |
---|
264 | , TCoeff *pParentARLBuffer = 0 |
---|
265 | #endif |
---|
266 | ); |
---|
267 | Void destroy (); |
---|
268 | |
---|
269 | Void initCtu ( TComPic* pcPic, UInt ctuRsAddr ); |
---|
270 | Void initEstData ( const UInt uiDepth, const Int qp, const Bool bTransquantBypass ); |
---|
271 | Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); |
---|
272 | Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
273 | #if NH_3D_NBDV |
---|
274 | Void copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx); |
---|
275 | #endif |
---|
276 | |
---|
277 | Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx ); |
---|
278 | #if NH_3D_NBDV |
---|
279 | Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, Bool bNBDV = false ); |
---|
280 | #else |
---|
281 | Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ); |
---|
282 | #endif |
---|
283 | Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
284 | |
---|
285 | Void copyToPic ( UChar uiDepth ); |
---|
286 | |
---|
287 | // ------------------------------------------------------------------------------------------------------------------- |
---|
288 | // member functions for CU description |
---|
289 | // ------------------------------------------------------------------------------------------------------------------- |
---|
290 | |
---|
291 | TComPic* getPic () { return m_pcPic; } |
---|
292 | const TComPic* getPic () const { return m_pcPic; } |
---|
293 | TComSlice* getSlice () { return m_pcSlice; } |
---|
294 | const TComSlice* getSlice () const { return m_pcSlice; } |
---|
295 | UInt& getCtuRsAddr () { return m_ctuRsAddr; } |
---|
296 | UInt getCtuRsAddr () const { return m_ctuRsAddr; } |
---|
297 | UInt getZorderIdxInCtu () const { return m_absZIdxInCtu; } |
---|
298 | UInt getCUPelX () const { return m_uiCUPelX; } |
---|
299 | UInt getCUPelY () const { return m_uiCUPelY; } |
---|
300 | |
---|
301 | UChar* getDepth () { return m_puhDepth; } |
---|
302 | UChar getDepth ( UInt uiIdx ) const { return m_puhDepth[uiIdx]; } |
---|
303 | Void setDepth ( UInt uiIdx, UChar uh ) { m_puhDepth[uiIdx] = uh; } |
---|
304 | |
---|
305 | Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); |
---|
306 | #if NH_3D_VSO |
---|
307 | Void getPosInPic ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ) const; |
---|
308 | #endif |
---|
309 | |
---|
310 | #if NH_3D_ARP |
---|
311 | Void setSlice ( TComSlice* pcSlice) { m_pcSlice = pcSlice; } |
---|
312 | Void setPic ( TComDataCU* pcCU ) { m_pcPic = pcCU->getPic(); } |
---|
313 | #endif |
---|
314 | // ------------------------------------------------------------------------------------------------------------------- |
---|
315 | // member functions for CU data |
---|
316 | // ------------------------------------------------------------------------------------------------------------------- |
---|
317 | |
---|
318 | SChar* getPartitionSize ( ) { return m_pePartSize; } |
---|
319 | PartSize getPartitionSize ( UInt uiIdx ) const { return static_cast<PartSize>( m_pePartSize[uiIdx] ); } |
---|
320 | Void setPartitionSize ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh; } |
---|
321 | Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
322 | Void setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
323 | |
---|
324 | #if NH_3D_DBBP |
---|
325 | Pel* getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride); |
---|
326 | #endif |
---|
327 | |
---|
328 | Bool* getSkipFlag () { return m_skipFlag; } |
---|
329 | Bool getSkipFlag ( UInt idx ) const { return m_skipFlag[idx]; } |
---|
330 | Void setSkipFlag ( UInt idx, Bool skip) { m_skipFlag[idx] = skip; } |
---|
331 | Void setSkipFlagSubParts ( Bool skip, UInt absPartIdx, UInt depth ); |
---|
332 | #if NH_3D_DIS |
---|
333 | Bool* getDISFlag () { return m_bDISFlag; } |
---|
334 | Bool getDISFlag ( UInt idx) { return m_bDISFlag[idx]; } |
---|
335 | Void setDISFlag ( UInt idx, Bool bDIS) { m_bDISFlag[idx] = bDIS; } |
---|
336 | Void setDISFlagSubParts ( Bool bDIS, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
337 | |
---|
338 | UChar* getDISType () { return m_ucDISType; } |
---|
339 | UChar getDISType ( UInt idx) { return m_ucDISType[idx]; } |
---|
340 | Void getDISType ( UInt idx, UChar ucDISType) { m_ucDISType[idx] = ucDISType; } |
---|
341 | Void setDISTypeSubParts ( UChar ucDISType, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
342 | #endif |
---|
343 | SChar* getPredictionMode ( ) { return m_pePredMode; } |
---|
344 | PredMode getPredictionMode ( UInt uiIdx ) const { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } |
---|
345 | Void setPredictionMode ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh; } |
---|
346 | Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
347 | |
---|
348 | #if NH_3D_DBBP |
---|
349 | Bool* getDBBPFlag () const { return m_pbDBBPFlag; } |
---|
350 | Bool getDBBPFlag ( UInt uiIdx ) const { return m_pbDBBPFlag[uiIdx]; } |
---|
351 | Void setDBBPFlag ( UInt uiIdx, Bool b ) { m_pbDBBPFlag[uiIdx] = b; } |
---|
352 | Void setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
353 | DbbpTmpData* getDBBPTmpData () { return &m_sDBBPTmpData; } |
---|
354 | #endif |
---|
355 | |
---|
356 | SChar* getCrossComponentPredictionAlpha( ComponentID compID ) { return m_crossComponentPredictionAlpha[compID]; } |
---|
357 | SChar getCrossComponentPredictionAlpha( UInt uiIdx, ComponentID compID ) { return m_crossComponentPredictionAlpha[compID][uiIdx]; } |
---|
358 | |
---|
359 | Bool* getCUTransquantBypass () { return m_CUTransquantBypass; } |
---|
360 | Bool getCUTransquantBypass ( UInt uiIdx ) const { return m_CUTransquantBypass[uiIdx]; } |
---|
361 | |
---|
362 | UChar* getWidth () { return m_puhWidth; } |
---|
363 | UChar getWidth ( UInt uiIdx ) const { return m_puhWidth[uiIdx]; } |
---|
364 | Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh; } |
---|
365 | |
---|
366 | UChar* getHeight () { return m_puhHeight; } |
---|
367 | UChar getHeight ( UInt uiIdx ) const { return m_puhHeight[uiIdx]; } |
---|
368 | Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh; } |
---|
369 | |
---|
370 | Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
371 | |
---|
372 | SChar* getQP ( ) { return m_phQP; } |
---|
373 | SChar getQP ( UInt uiIdx ) const { return m_phQP[uiIdx]; } |
---|
374 | Void setQP ( UInt uiIdx, SChar value ) { m_phQP[uiIdx] = value; } |
---|
375 | Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
376 | Int getLastValidPartIdx ( Int iAbsPartIdx ) const; |
---|
377 | SChar getLastCodedQP ( UInt uiAbsPartIdx ) const; |
---|
378 | Void setQPSubCUs ( Int qp, UInt absPartIdx, UInt depth, Bool &foundNonZeroCbf ); |
---|
379 | Void setCodedQP ( SChar qp ) { m_codedQP = qp; } |
---|
380 | SChar getCodedQP ( ) const { return m_codedQP; } |
---|
381 | |
---|
382 | UChar* getChromaQpAdj () { return m_ChromaQpAdj; } ///< array of chroma QP adjustments (indexed). when value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1 |
---|
383 | UChar getChromaQpAdj (Int idx) const { return m_ChromaQpAdj[idx]; } ///< When value = 0, cu_chroma_qp_offset_flag=0; when value>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=value-1 |
---|
384 | Void setChromaQpAdj (Int idx, UChar val) { m_ChromaQpAdj[idx] = val; } ///< When val = 0, cu_chroma_qp_offset_flag=0; when val>0, indicates cu_chroma_qp_offset_flag=1 and cu_chroma_qp_offset_idx=val-1 |
---|
385 | Void setChromaQpAdjSubParts( UChar val, Int absPartIdx, Int depth ); |
---|
386 | Void setCodedChromaQpAdj ( SChar qp ) { m_codedChromaQpAdj = qp; } |
---|
387 | SChar getCodedChromaQpAdj ( ) const { return m_codedChromaQpAdj; } |
---|
388 | |
---|
389 | Bool isLosslessCoded ( UInt absPartIdx ) const; |
---|
390 | |
---|
391 | UChar* getTransformIdx () { return m_puhTrIdx; } |
---|
392 | UChar getTransformIdx ( UInt uiIdx ) const { return m_puhTrIdx[uiIdx]; } |
---|
393 | Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
394 | |
---|
395 | UChar* getTransformSkip ( ComponentID compID ) { return m_puhTransformSkip[compID];} |
---|
396 | UChar getTransformSkip ( UInt uiIdx, ComponentID compID ) const { return m_puhTransformSkip[compID][uiIdx]; } |
---|
397 | Void setTransformSkipSubParts ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth); |
---|
398 | Void setTransformSkipSubParts ( const UInt useTransformSkip[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth ); |
---|
399 | |
---|
400 | UChar* getExplicitRdpcmMode ( ComponentID component ) { return m_explicitRdpcmMode[component]; } |
---|
401 | UChar getExplicitRdpcmMode ( ComponentID component, UInt partIdx ) const { return m_explicitRdpcmMode[component][partIdx]; } |
---|
402 | Void setExplicitRdpcmModePartRange ( UInt rdpcmMode, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
403 | |
---|
404 | Bool isRDPCMEnabled ( UInt uiAbsPartIdx ) const { return getSlice()->getSPS()->getSpsRangeExtension().getRdpcmEnabledFlag(isIntra(uiAbsPartIdx) ? RDPCM_SIGNAL_IMPLICIT : RDPCM_SIGNAL_EXPLICIT); } |
---|
405 | |
---|
406 | Void setCrossComponentPredictionAlphaPartRange ( SChar alphaValue, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
407 | Void setTransformSkipPartRange ( UInt useTransformSkip, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
408 | |
---|
409 | UInt getQuadtreeTULog2MinSizeInCU ( UInt uiIdx ) const; |
---|
410 | |
---|
411 | TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } |
---|
412 | const TComCUMvField* getCUMvField ( RefPicList e ) const { return &m_acCUMvField[e]; } |
---|
413 | |
---|
414 | TCoeff* getCoeff (ComponentID component) { return m_pcTrCoeff[component]; } |
---|
415 | |
---|
416 | #if ADAPTIVE_QP_SELECTION |
---|
417 | TCoeff* getArlCoeff ( ComponentID component ) { return m_pcArlCoeff[component]; } |
---|
418 | #endif |
---|
419 | Pel* getPCMSample ( ComponentID component ) { return m_pcIPCMSample[component]; } |
---|
420 | |
---|
421 | UChar getCbf ( UInt uiIdx, ComponentID eType ) const { return m_puhCbf[eType][uiIdx]; } |
---|
422 | UChar* getCbf ( ComponentID eType ) { return m_puhCbf[eType]; } |
---|
423 | UChar getCbf ( UInt uiIdx, ComponentID eType, UInt uiTrDepth ) const { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); } |
---|
424 | Void setCbf ( UInt uiIdx, ComponentID eType, UChar uh ) { m_puhCbf[eType][uiIdx] = uh; } |
---|
425 | Void clearCbf ( UInt uiIdx, ComponentID eType, UInt uiNumParts ); |
---|
426 | UChar getQtRootCbf ( UInt uiIdx ) const; |
---|
427 | |
---|
428 | Void setCbfSubParts ( const UInt uiCbf[MAX_NUM_COMPONENT], UInt uiAbsPartIdx, UInt uiDepth ); |
---|
429 | Void setCbfSubParts ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
430 | Void setCbfSubParts ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
431 | |
---|
432 | Void setCbfPartRange ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
433 | Void bitwiseOrCbfPartRange ( UInt uiCbf, ComponentID compID, UInt uiAbsPartIdx, UInt uiCoveredPartIdxes ); |
---|
434 | |
---|
435 | // ------------------------------------------------------------------------------------------------------------------- |
---|
436 | // member functions for coding tool information |
---|
437 | // ------------------------------------------------------------------------------------------------------------------- |
---|
438 | |
---|
439 | Bool* getMergeFlag () { return m_pbMergeFlag; } |
---|
440 | Bool getMergeFlag ( UInt uiIdx ) const { return m_pbMergeFlag[uiIdx]; } |
---|
441 | Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b; } |
---|
442 | Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
443 | |
---|
444 | UChar* getMergeIndex () { return m_puhMergeIndex; } |
---|
445 | UChar getMergeIndex ( UInt uiIdx ) const { return m_puhMergeIndex[uiIdx]; } |
---|
446 | Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } |
---|
447 | Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
448 | template <typename T> |
---|
449 | Void setSubPart ( T bParameter, T* pbBaseCtu, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
450 | #if H_3D_VSP || NH_3D_DBBP |
---|
451 | template<typename T> |
---|
452 | Void setSubPartT ( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
453 | #endif |
---|
454 | |
---|
455 | #if AMP_MRG |
---|
456 | Void setMergeAMP( Bool b ) { m_bIsMergeAMP = b; } |
---|
457 | Bool getMergeAMP ( ) const { return m_bIsMergeAMP; } |
---|
458 | #endif |
---|
459 | |
---|
460 | UChar* getIntraDir ( const ChannelType channelType ) const { return m_puhIntraDir[channelType]; } |
---|
461 | UChar getIntraDir ( const ChannelType channelType, const UInt uiIdx ) const { return m_puhIntraDir[channelType][uiIdx]; } |
---|
462 | |
---|
463 | Void setIntraDirSubParts ( const ChannelType channelType, |
---|
464 | const UInt uiDir, |
---|
465 | const UInt uiAbsPartIdx, |
---|
466 | const UInt uiDepth ); |
---|
467 | |
---|
468 | UChar* getInterDir () { return m_puhInterDir; } |
---|
469 | UChar getInterDir ( UInt uiIdx ) const { return m_puhInterDir[uiIdx]; } |
---|
470 | Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh; } |
---|
471 | Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
472 | Bool* getIPCMFlag () { return m_pbIPCMFlag; } |
---|
473 | Bool getIPCMFlag ( UInt uiIdx ) const { return m_pbIPCMFlag[uiIdx]; } |
---|
474 | Void setIPCMFlag (UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } |
---|
475 | Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth); |
---|
476 | #if NH_3D_NBDV |
---|
477 | Void setDvInfoSubParts ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
478 | #if H_3D_VSP || NH_3D_DBBP |
---|
479 | Void setDvInfoSubParts ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth); |
---|
480 | #endif |
---|
481 | DisInfo* getDvInfo () { return m_pDvInfo; } |
---|
482 | DisInfo getDvInfo (UInt uiIdx) { return m_pDvInfo[uiIdx]; } |
---|
483 | #endif |
---|
484 | #if NH_3D_NBDV |
---|
485 | Void xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb ); |
---|
486 | Bool xCheckSpatialNBDV (const TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo, |
---|
487 | UInt uiMvpDvPos |
---|
488 | #if NH_3D_NBDV_REF |
---|
489 | , Bool bDepthRefine = false |
---|
490 | #endif |
---|
491 | ); |
---|
492 | Bool xGetColDisMV ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx ); |
---|
493 | Void getDisMvpCandNBDV ( DisInfo* pDInfo |
---|
494 | #if NH_3D_NBDV_REF |
---|
495 | , Bool bDepthRefine = false |
---|
496 | #endif |
---|
497 | ); |
---|
498 | |
---|
499 | #if NH_3D_IV_MERGE |
---|
500 | Void getDispforDepth ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp); |
---|
501 | #endif |
---|
502 | |
---|
503 | #if NH_3D_NBDV_REF |
---|
504 | Pel getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT ); |
---|
505 | Void estimateDVFromDM(Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred ); |
---|
506 | #endif //NH_3D_NBDV_REF |
---|
507 | #endif |
---|
508 | #if NH_3D_DIS |
---|
509 | Bool getNeighDepth (UInt uiPartIdx, UInt uiPartAddr, Pel* pNeighDepth, Int index); |
---|
510 | #endif |
---|
511 | #if NH_3D_FAST_TEXTURE_ENCODING |
---|
512 | Void getIVNStatus ( UInt uiPartIdx, DisInfo* pDInfo, Bool& bIVFMerge, Int& iIVFMaxD); |
---|
513 | #endif |
---|
514 | #if NH_3D_SPIVMP |
---|
515 | Void getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight); |
---|
516 | Void getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr ); |
---|
517 | Void setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight ); |
---|
518 | #endif |
---|
519 | #if NH_3D_IV_MERGE |
---|
520 | Bool getInterViewMergeCands ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc, Bool bIsDepth |
---|
521 | |
---|
522 | #if NH_3D_SPIVMP |
---|
523 | , TComMvField* pcMFieldSP, UChar* puhInterDirSP |
---|
524 | #endif |
---|
525 | , Bool bICFlag |
---|
526 | ); |
---|
527 | #endif |
---|
528 | #if NH_3D_ARP |
---|
529 | UChar* getARPW () const { return m_puhARPW; } |
---|
530 | UChar getARPW ( UInt uiIdx ) const { return m_puhARPW[uiIdx]; } |
---|
531 | Void setARPW ( UInt uiIdx, UChar w ) { m_puhARPW[uiIdx] = w; } |
---|
532 | Void setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
533 | #endif |
---|
534 | #if NH_3D_IC |
---|
535 | Bool* getICFlag () { return m_pbICFlag; } |
---|
536 | Bool getICFlag ( UInt uiIdx ) { return m_pbICFlag[uiIdx]; } |
---|
537 | Void setICFlag ( UInt uiIdx, Bool uh ) { m_pbICFlag[uiIdx] = uh; } |
---|
538 | Void setICFlagSubParts ( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
539 | Bool isICFlagRequired ( UInt uiAbsPartIdx ); |
---|
540 | Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false) const; |
---|
541 | #elif NH_3D_VSP |
---|
542 | Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false) const; |
---|
543 | #else |
---|
544 | // ------------------------------------------------------------------------------------------------------------------- |
---|
545 | // member functions for accessing partition information |
---|
546 | // ------------------------------------------------------------------------------------------------------------------- |
---|
547 | |
---|
548 | Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ) const; // This is for use by a leaf/sub CU object only, with no additional AbsPartIdx |
---|
549 | #endif |
---|
550 | UChar getNumPartitions ( const UInt uiAbsPartIdx = 0 ) const; |
---|
551 | Bool isFirstAbsZorderIdxInDepth ( UInt uiAbsPartIdx, UInt uiDepth ) const; |
---|
552 | |
---|
553 | #if NH_3D_DMM |
---|
554 | Pel* getDmmDeltaDC ( DmmID dmmType, UInt segId ) { return m_dmmDeltaDC[dmmType][segId]; } |
---|
555 | Pel getDmmDeltaDC ( DmmID dmmType, UInt segId, UInt uiIdx ) { return m_dmmDeltaDC[dmmType][segId][uiIdx]; } |
---|
556 | Void setDmmDeltaDC ( DmmID dmmType, UInt segId, UInt uiIdx, Pel val ) { m_dmmDeltaDC[dmmType][segId][uiIdx] = val; } |
---|
557 | |
---|
558 | UInt* getDmm1WedgeTabIdx () { return m_dmm1WedgeTabIdx; } |
---|
559 | UInt getDmm1WedgeTabIdx ( UInt uiIdx ) { return m_dmm1WedgeTabIdx[uiIdx]; } |
---|
560 | Void setDmm1WedgeTabIdx ( UInt uiIdx, UInt tabIdx ) { m_dmm1WedgeTabIdx[uiIdx] = tabIdx; } |
---|
561 | Void setDmm1WedgeTabIdxSubParts ( UInt tabIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
562 | #endif |
---|
563 | #if NH_3D_SDC_INTRA |
---|
564 | Bool* getSDCFlag () { return m_pbSDCFlag; } |
---|
565 | Bool getSDCFlag ( UInt uiIdx ) { return m_pbSDCFlag[uiIdx]; } |
---|
566 | Void setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
567 | |
---|
568 | Bool getSDCAvailable ( UInt uiAbsPartIdx ); |
---|
569 | |
---|
570 | Pel* getSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentDCOffset[uiSeg]; } |
---|
571 | Pel getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; } |
---|
572 | Void setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; } |
---|
573 | #endif |
---|
574 | |
---|
575 | // ------------------------------------------------------------------------------------------------------------------- |
---|
576 | // member functions for motion vector |
---|
577 | // ------------------------------------------------------------------------------------------------------------------- |
---|
578 | |
---|
579 | static Void getMvField ( const TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); |
---|
580 | |
---|
581 | Void fillMvpCand ( const UInt uiPartIdx, const UInt uiPartAddr, const RefPicList eRefPicList, const Int iRefIdx, AMVPInfo* pInfo ) const; |
---|
582 | Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP ) const; |
---|
583 | Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH ) const; |
---|
584 | |
---|
585 | Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } |
---|
586 | Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) const { return m_apiMVPIdx[eRefPicList][uiIdx]; } |
---|
587 | SChar* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList]; } |
---|
588 | |
---|
589 | Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum; } |
---|
590 | Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) const { return m_apiMVPNum[eRefPicList][uiIdx]; } |
---|
591 | SChar* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList]; } |
---|
592 | |
---|
593 | Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
594 | Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
595 | |
---|
596 | Void clipMv ( TComMv& rcMv ) const; |
---|
597 | |
---|
598 | #if NH_MV |
---|
599 | Void checkMvVertRest (TComMv& rcMv, RefPicList eRefPicList, int iRefIdx ); |
---|
600 | #endif |
---|
601 | Void getMvPredLeft ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldA.getMv(); } |
---|
602 | Void getMvPredAbove ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldB.getMv(); } |
---|
603 | Void getMvPredAboveRight ( TComMv& rcMvPred ) const { rcMvPred = m_cMvFieldC.getMv(); } |
---|
604 | #if NH_3D |
---|
605 | Void compressMV ( Int scale ); |
---|
606 | Void printMV ( ); |
---|
607 | #else |
---|
608 | Void compressMV (); |
---|
609 | #endif |
---|
610 | // ------------------------------------------------------------------------------------------------------------------- |
---|
611 | // utility functions for neighbouring information |
---|
612 | // ------------------------------------------------------------------------------------------------------------------- |
---|
613 | |
---|
614 | TComDataCU* getCtuLeft () { return m_pCtuLeft; } |
---|
615 | TComDataCU* getCtuAbove () { return m_pCtuAbove; } |
---|
616 | TComDataCU* getCtuAboveLeft () { return m_pCtuAboveLeft; } |
---|
617 | TComDataCU* getCtuAboveRight () { return m_pCtuAboveRight; } |
---|
618 | TComDataCU* getCUColocated ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; } |
---|
619 | Bool CUIsFromSameSlice ( const TComDataCU *pCU /* Can be NULL */) const { return ( pCU!=NULL && pCU->getSlice()->getSliceCurStartCtuTsAddr() == getSlice()->getSliceCurStartCtuTsAddr() ); } |
---|
620 | Bool CUIsFromSameTile ( const TComDataCU *pCU /* Can be NULL */) const; |
---|
621 | Bool CUIsFromSameSliceAndTile ( const TComDataCU *pCU /* Can be NULL */) const; |
---|
622 | Bool CUIsFromSameSliceTileAndWavefrontRow( const TComDataCU *pCU /* Can be NULL */) const; |
---|
623 | Bool isLastSubCUOfCtu ( const UInt absPartIdx ) const; |
---|
624 | |
---|
625 | |
---|
626 | const TComDataCU* getPULeft ( UInt& uiLPartUnitIdx, |
---|
627 | UInt uiCurrPartUnitIdx, |
---|
628 | Bool bEnforceSliceRestriction=true, |
---|
629 | Bool bEnforceTileRestriction=true ) const; |
---|
630 | |
---|
631 | const TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx, |
---|
632 | UInt uiCurrPartUnitIdx, |
---|
633 | Bool bEnforceSliceRestriction=true, |
---|
634 | Bool planarAtCTUBoundary = false, |
---|
635 | Bool bEnforceTileRestriction=true ) const; |
---|
636 | |
---|
637 | const TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true ) const; |
---|
638 | |
---|
639 | const TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const; |
---|
640 | const TComDataCU* getQpMinCuAbove ( UInt& uiAPartUnitIdx, UInt uiCurrAbsIdxInCtu ) const; |
---|
641 | |
---|
642 | /// returns CU and part index of the PU above the top row of the current uiCurrPartUnitIdx of the CU, at a horizontal offset (to the right) of uiPartUnitOffset (in parts) |
---|
643 | const TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const; |
---|
644 | /// returns CU and part index of the PU left of the lefthand column of the current uiCurrPartUnitIdx of the CU, at a vertical offset (below) of uiPartUnitOffset (in parts) |
---|
645 | const TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true ) const; |
---|
646 | |
---|
647 | SChar getRefQP ( UInt uiCurrAbsIdxInCtu ) const; |
---|
648 | |
---|
649 | Void deriveLeftRightTopIdx ( UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const; |
---|
650 | Void deriveLeftBottomIdx ( UInt uiPartIdx, UInt& ruiPartIdxLB ) const; |
---|
651 | |
---|
652 | #if NH_3D |
---|
653 | Bool hasEqualMotion ( Int dirA, const TComMvField* mvFieldA, Int dirB, const TComMvField* mvFieldB ); |
---|
654 | #endif |
---|
655 | Bool hasEqualMotion ( UInt uiAbsPartIdx, const TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ) const; |
---|
656 | |
---|
657 | #if NH_3D_MLC |
---|
658 | Bool getAvailableFlagA1() { return m_bAvailableFlagA1; } |
---|
659 | Bool getAvailableFlagB1() { return m_bAvailableFlagB1; } |
---|
660 | Bool getAvailableFlagB0() { return m_bAvailableFlagB0; } |
---|
661 | Bool getAvailableFlagA0() { return m_bAvailableFlagA0; } |
---|
662 | Bool getAvailableFlagB2() { return m_bAvailableFlagB2; } |
---|
663 | Void initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0; } |
---|
664 | Void buildMCL(TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours |
---|
665 | #if NH_3D_VSP |
---|
666 | , Int* vspFlag |
---|
667 | #endif |
---|
668 | #if NH_3D_SPIVMP |
---|
669 | , Bool* pbSPIVMPFlag |
---|
670 | #endif |
---|
671 | , Int& numValidMergeCand |
---|
672 | ); |
---|
673 | Void xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours |
---|
674 | #if NH_3D_SPIVMP |
---|
675 | , TComMvField* pcMvFieldSP, UChar* puhInterDirSP |
---|
676 | #endif |
---|
677 | , Int& numValidMergeCand, Int mrgCandIdx = -1 ); |
---|
678 | #endif |
---|
679 | #if NH_3D |
---|
680 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ); |
---|
681 | #else |
---|
682 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ) const; |
---|
683 | #endif |
---|
684 | |
---|
685 | #if NH_3D_VSP |
---|
686 | #if NH_3D_SPIVMP |
---|
687 | Bool* getSPIVMPFlag () const { return m_pbSPIVMPFlag; } |
---|
688 | Bool getSPIVMPFlag ( UInt uiIdx ) const { return m_pbSPIVMPFlag[uiIdx]; } |
---|
689 | Void setSPIVMPFlag ( UInt uiIdx, Bool n ) { m_pbSPIVMPFlag[uiIdx] = n; } |
---|
690 | Void setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
691 | #endif |
---|
692 | |
---|
693 | SChar* getVSPFlag () const { return m_piVSPFlag; } |
---|
694 | SChar getVSPFlag ( UInt uiIdx ) const { return m_piVSPFlag[uiIdx]; } |
---|
695 | Void setVSPFlag ( UInt uiIdx, Int n ) { m_piVSPFlag[uiIdx] = n; } |
---|
696 | Void setVSPFlagSubParts( SChar iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
697 | Void setMvFieldPUForVSP ( TComDataCU* cu, UInt partAddr, Int width, Int height, RefPicList refPicList, Int refIdx, Int &vspSize ); |
---|
698 | #endif |
---|
699 | Void deriveLeftRightTopIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ) const; |
---|
700 | Void deriveLeftBottomIdxGeneral ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ) const; |
---|
701 | // ------------------------------------------------------------------------------------------------------------------- |
---|
702 | // member functions for modes |
---|
703 | // ------------------------------------------------------------------------------------------------------------------- |
---|
704 | |
---|
705 | Bool isIntra ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } |
---|
706 | Bool isInter ( UInt uiPartIdx ) const { return m_pePredMode[ uiPartIdx ] == MODE_INTER; } |
---|
707 | Bool isSkipped ( UInt uiPartIdx ) const; ///< returns true, if the partiton is skipped |
---|
708 | Bool isBipredRestriction ( UInt puIdx ) const; |
---|
709 | |
---|
710 | // ------------------------------------------------------------------------------------------------------------------- |
---|
711 | // member functions for symbol prediction (most probable / mode conversion) |
---|
712 | // ------------------------------------------------------------------------------------------------------------------- |
---|
713 | |
---|
714 | UInt getIntraSizeIdx ( UInt uiAbsPartIdx ) const; |
---|
715 | |
---|
716 | Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList ) const; |
---|
717 | Void getIntraDirPredictor ( UInt uiAbsPartIdx, Int uiIntraDirPred[NUM_MOST_PROBABLE_MODES], const ComponentID compID, Int* piMode = NULL ) const; |
---|
718 | |
---|
719 | // ------------------------------------------------------------------------------------------------------------------- |
---|
720 | // member functions for SBAC context |
---|
721 | // ------------------------------------------------------------------------------------------------------------------- |
---|
722 | |
---|
723 | UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth ) const; |
---|
724 | UInt getCtxQtCbf ( TComTU &rTu, const ChannelType chType ) const; |
---|
725 | |
---|
726 | UInt getCtxSkipFlag ( UInt uiAbsPartIdx ) const; |
---|
727 | UInt getCtxInterDir ( UInt uiAbsPartIdx ) const; |
---|
728 | #if NH_3D_ARP |
---|
729 | UInt getCTXARPWFlag ( UInt uiAbsPartIdx ); |
---|
730 | #endif |
---|
731 | |
---|
732 | UInt& getTotalBins () { return m_uiTotalBins; } |
---|
733 | // ------------------------------------------------------------------------------------------------------------------- |
---|
734 | // member functions for RD cost storage |
---|
735 | // ------------------------------------------------------------------------------------------------------------------- |
---|
736 | |
---|
737 | Double& getTotalCost() { return m_dTotalCost; } |
---|
738 | #if NH_3D_VSO |
---|
739 | Dist& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
740 | #else |
---|
741 | Distortion& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
742 | #endif |
---|
743 | UInt& getTotalBits() { return m_uiTotalBits; } |
---|
744 | UInt& getTotalNumPart() { return m_uiNumPartition; } |
---|
745 | |
---|
746 | UInt getCoefScanIdx(const UInt uiAbsPartIdx, const UInt uiWidth, const UInt uiHeight, const ComponentID compID) const ; |
---|
747 | }; |
---|
748 | |
---|
749 | namespace RasterAddress |
---|
750 | { |
---|
751 | /** Check whether 2 addresses point to the same column |
---|
752 | * \param addrA First address in raster scan order |
---|
753 | * \param addrB Second address in raters scan order |
---|
754 | * \param numUnitsPerRow Number of units in a row |
---|
755 | * \return Result of test |
---|
756 | */ |
---|
757 | static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
758 | { |
---|
759 | // addrA % numUnitsPerRow == addrB % numUnitsPerRow |
---|
760 | return (( addrA ^ addrB ) & ( numUnitsPerRow - 1 ) ) == 0; |
---|
761 | } |
---|
762 | |
---|
763 | /** Check whether 2 addresses point to the same row |
---|
764 | * \param addrA First address in raster scan order |
---|
765 | * \param addrB Second address in raters scan order |
---|
766 | * \param numUnitsPerRow Number of units in a row |
---|
767 | * \return Result of test |
---|
768 | */ |
---|
769 | static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
770 | { |
---|
771 | // addrA / numUnitsPerRow == addrB / numUnitsPerRow |
---|
772 | return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
773 | } |
---|
774 | |
---|
775 | /** Check whether 2 addresses point to the same row or column |
---|
776 | * \param addrA First address in raster scan order |
---|
777 | * \param addrB Second address in raters scan order |
---|
778 | * \param numUnitsPerRow Number of units in a row |
---|
779 | * \return Result of test |
---|
780 | */ |
---|
781 | static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
782 | { |
---|
783 | return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow ); |
---|
784 | } |
---|
785 | |
---|
786 | /** Check whether one address points to the first column |
---|
787 | * \param addr Address in raster scan order |
---|
788 | * \param numUnitsPerRow Number of units in a row |
---|
789 | * \return Result of test |
---|
790 | */ |
---|
791 | static inline Bool isZeroCol( Int addr, Int numUnitsPerRow ) |
---|
792 | { |
---|
793 | // addr % numUnitsPerRow == 0 |
---|
794 | return ( addr & ( numUnitsPerRow - 1 ) ) == 0; |
---|
795 | } |
---|
796 | |
---|
797 | /** Check whether one address points to the first row |
---|
798 | * \param addr Address in raster scan order |
---|
799 | * \param numUnitsPerRow Number of units in a row |
---|
800 | * \return Result of test |
---|
801 | */ |
---|
802 | static inline Bool isZeroRow( Int addr, Int numUnitsPerRow ) |
---|
803 | { |
---|
804 | // addr / numUnitsPerRow == 0 |
---|
805 | return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
806 | } |
---|
807 | |
---|
808 | /** Check whether one address points to a column whose index is smaller than a given value |
---|
809 | * \param addr Address in raster scan order |
---|
810 | * \param val Given column index value |
---|
811 | * \param numUnitsPerRow Number of units in a row |
---|
812 | * \return Result of test |
---|
813 | */ |
---|
814 | static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow ) |
---|
815 | { |
---|
816 | // addr % numUnitsPerRow < val |
---|
817 | return ( addr & ( numUnitsPerRow - 1 ) ) < val; |
---|
818 | } |
---|
819 | |
---|
820 | /** Check whether one address points to a row whose index is smaller than a given value |
---|
821 | * \param addr Address in raster scan order |
---|
822 | * \param val Given row index value |
---|
823 | * \param numUnitsPerRow Number of units in a row |
---|
824 | * \return Result of test |
---|
825 | */ |
---|
826 | static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow ) |
---|
827 | { |
---|
828 | // addr / numUnitsPerRow < val |
---|
829 | return addr < val * numUnitsPerRow; |
---|
830 | } |
---|
831 | } |
---|
832 | |
---|
833 | //! \} |
---|
834 | |
---|
835 | #endif |
---|