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-2012, 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 HHI_INTER_VIEW_RESIDUAL_PRED |
---|
52 | #include "TComYuv.h" |
---|
53 | #endif |
---|
54 | |
---|
55 | #include <algorithm> |
---|
56 | #include <vector> |
---|
57 | |
---|
58 | //! \ingroup TLibCommon |
---|
59 | //! \{ |
---|
60 | |
---|
61 | // ==================================================================================================================== |
---|
62 | // Non-deblocking in-loop filter processing block data structure |
---|
63 | // ==================================================================================================================== |
---|
64 | |
---|
65 | /// Non-deblocking filter processing block border tag |
---|
66 | enum NDBFBlockBorderTag |
---|
67 | { |
---|
68 | SGU_L = 0, |
---|
69 | SGU_R, |
---|
70 | SGU_T, |
---|
71 | SGU_B, |
---|
72 | SGU_TL, |
---|
73 | SGU_TR, |
---|
74 | SGU_BL, |
---|
75 | SGU_BR, |
---|
76 | NUM_SGU_BORDER |
---|
77 | }; |
---|
78 | |
---|
79 | /// Non-deblocking filter processing block information |
---|
80 | struct NDBFBlockInfo |
---|
81 | { |
---|
82 | Int tileID; //!< tile ID |
---|
83 | Int sliceID; //!< slice ID |
---|
84 | UInt startSU; //!< starting SU z-scan address in LCU |
---|
85 | UInt endSU; //!< ending SU z-scan address in LCU |
---|
86 | UInt widthSU; //!< number of SUs in width |
---|
87 | UInt heightSU; //!< number of SUs in height |
---|
88 | UInt posX; //!< top-left X coordinate in picture |
---|
89 | UInt posY; //!< top-left Y coordinate in picture |
---|
90 | UInt width; //!< number of pixels in width |
---|
91 | UInt height; //!< number of pixels in height |
---|
92 | Bool isBorderAvailable[NUM_SGU_BORDER]; //!< the border availabilities |
---|
93 | #if LCU_SYNTAX_ALF |
---|
94 | Bool allBordersAvailable; |
---|
95 | #endif |
---|
96 | |
---|
97 | NDBFBlockInfo():tileID(0), sliceID(0), startSU(0), endSU(0) {} //!< constructor |
---|
98 | const NDBFBlockInfo& operator= (const NDBFBlockInfo& src); //!< "=" operator |
---|
99 | }; |
---|
100 | |
---|
101 | |
---|
102 | // ==================================================================================================================== |
---|
103 | // Class definition |
---|
104 | // ==================================================================================================================== |
---|
105 | |
---|
106 | /// CU data structure class |
---|
107 | class TComDataCU |
---|
108 | { |
---|
109 | private: |
---|
110 | |
---|
111 | // ------------------------------------------------------------------------------------------------------------------- |
---|
112 | // class pointers |
---|
113 | // ------------------------------------------------------------------------------------------------------------------- |
---|
114 | |
---|
115 | TComPic* m_pcPic; ///< picture class pointer |
---|
116 | TComSlice* m_pcSlice; ///< slice header pointer |
---|
117 | TComPattern* m_pcPattern; ///< neighbour access class pointer |
---|
118 | |
---|
119 | // ------------------------------------------------------------------------------------------------------------------- |
---|
120 | // CU description |
---|
121 | // ------------------------------------------------------------------------------------------------------------------- |
---|
122 | |
---|
123 | UInt m_uiCUAddr; ///< CU address in a slice |
---|
124 | UInt m_uiAbsIdxInLCU; ///< absolute address in a CU. It's Z scan order |
---|
125 | UInt m_uiCUPelX; ///< CU position in a pixel (X) |
---|
126 | UInt m_uiCUPelY; ///< CU position in a pixel (Y) |
---|
127 | UInt m_uiNumPartition; ///< total number of minimum partitions in a CU |
---|
128 | UChar* m_puhWidth; ///< array of widths |
---|
129 | UChar* m_puhHeight; ///< array of heights |
---|
130 | UChar* m_puhDepth; ///< array of depths |
---|
131 | Int m_unitSize; ///< size of a "minimum partition" |
---|
132 | #if HHI_MPI |
---|
133 | Int* m_piTextureModeDepth; ///< at which depth are prediction data inherited from texture picture ( -1 : none ) |
---|
134 | #endif |
---|
135 | |
---|
136 | // ------------------------------------------------------------------------------------------------------------------- |
---|
137 | // CU data |
---|
138 | // ------------------------------------------------------------------------------------------------------------------- |
---|
139 | |
---|
140 | Char* m_pePartSize; ///< array of partition sizes |
---|
141 | #if HHI_INTERVIEW_SKIP |
---|
142 | Bool* m_pbRenderable; ///< array of merge flags |
---|
143 | #endif |
---|
144 | Char* m_pePredMode; ///< array of prediction modes |
---|
145 | #if H0736_AVC_STYLE_QP_RANGE |
---|
146 | Char* m_phQP; ///< array of QP values |
---|
147 | #else |
---|
148 | UChar* m_phQP; ///< array of QP values |
---|
149 | #endif |
---|
150 | UChar* m_puhTrIdx; ///< array of transform indices |
---|
151 | UChar* m_nsqtPartIdx; ///< array of absPartIdx mapping table, map zigzag to NSQT |
---|
152 | UChar* m_puhCbf[3]; ///< array of coded block flags (CBF) |
---|
153 | TComCUMvField m_acCUMvField[2]; ///< array of motion vectors |
---|
154 | TCoeff* m_pcTrCoeffY; ///< transformed coefficient buffer (Y) |
---|
155 | TCoeff* m_pcTrCoeffCb; ///< transformed coefficient buffer (Cb) |
---|
156 | TCoeff* m_pcTrCoeffCr; ///< transformed coefficient buffer (Cr) |
---|
157 | #if ADAPTIVE_QP_SELECTION |
---|
158 | Int* m_pcArlCoeffY; ///< ARL coefficient buffer (Y) |
---|
159 | Int* m_pcArlCoeffCb; ///< ARL coefficient buffer (Cb) |
---|
160 | Int* m_pcArlCoeffCr; ///< ARL coefficient buffer (Cr) |
---|
161 | |
---|
162 | static Int* m_pcGlbArlCoeffY; ///< ARL coefficient buffer (Y) |
---|
163 | static Int* m_pcGlbArlCoeffCb; ///< ARL coefficient buffer (Cb) |
---|
164 | static Int* m_pcGlbArlCoeffCr; ///< ARL coefficient buffer (Cr) |
---|
165 | #endif |
---|
166 | |
---|
167 | Pel* m_pcIPCMSampleY; ///< PCM sample buffer (Y) |
---|
168 | Pel* m_pcIPCMSampleCb; ///< PCM sample buffer (Cb) |
---|
169 | Pel* m_pcIPCMSampleCr; ///< PCM sample buffer (Cr) |
---|
170 | |
---|
171 | Int* m_piSliceSUMap; ///< pointer of slice ID map |
---|
172 | std::vector<NDBFBlockInfo> m_vNDFBlock; |
---|
173 | |
---|
174 | // ------------------------------------------------------------------------------------------------------------------- |
---|
175 | // neighbour access variables |
---|
176 | // ------------------------------------------------------------------------------------------------------------------- |
---|
177 | |
---|
178 | TComDataCU* m_pcCUAboveLeft; ///< pointer of above-left CU |
---|
179 | TComDataCU* m_pcCUAboveRight; ///< pointer of above-right CU |
---|
180 | TComDataCU* m_pcCUAbove; ///< pointer of above CU |
---|
181 | TComDataCU* m_pcCULeft; ///< pointer of left CU |
---|
182 | TComDataCU* m_apcCUColocated[2]; ///< pointer of temporally colocated CU's for both directions |
---|
183 | TComMvField m_cMvFieldA; ///< motion vector of position A |
---|
184 | TComMvField m_cMvFieldB; ///< motion vector of position B |
---|
185 | TComMvField m_cMvFieldC; ///< motion vector of position C |
---|
186 | TComMv m_cMvPred; ///< motion vector predictor |
---|
187 | |
---|
188 | // ------------------------------------------------------------------------------------------------------------------- |
---|
189 | // coding tool information |
---|
190 | // ------------------------------------------------------------------------------------------------------------------- |
---|
191 | |
---|
192 | Bool* m_pbMergeFlag; ///< array of merge flags |
---|
193 | UChar* m_puhMergeIndex; ///< array of merge candidate indices |
---|
194 | #if AMP_MRG |
---|
195 | Bool m_bIsMergeAMP; |
---|
196 | #endif |
---|
197 | UChar* m_puhLumaIntraDir; ///< array of intra directions (luma) |
---|
198 | UChar* m_puhChromaIntraDir; ///< array of intra directions (chroma) |
---|
199 | UChar* m_puhInterDir; ///< array of inter directions |
---|
200 | Char* m_apiMVPIdx[2]; ///< array of motion vector predictor candidates |
---|
201 | Char* m_apiMVPNum[2]; ///< array of number of possible motion vectors predictors |
---|
202 | Bool* m_puiAlfCtrlFlag; ///< array of ALF flags |
---|
203 | Bool* m_puiTmpAlfCtrlFlag; ///< temporal array of ALF flags |
---|
204 | |
---|
205 | Bool* m_pbIPCMFlag; ///< array of intra_pcm flags |
---|
206 | |
---|
207 | #if BURST_IPCM |
---|
208 | Int m_numSucIPCM; ///< the number of succesive IPCM blocks associated with the current log2CUSize |
---|
209 | Bool m_lastCUSucIPCMFlag; ///< True indicates that the last CU is IPCM and shares the same root as the current CU. |
---|
210 | #endif |
---|
211 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
212 | Bool* m_pbResPredAvailable; ///< array of residual prediction available flags |
---|
213 | Bool* m_pbResPredFlag; ///< array of residual prediction flags |
---|
214 | #endif |
---|
215 | |
---|
216 | // ------------------------------------------------------------------------------------------------------------------- |
---|
217 | // misc. variables |
---|
218 | // ------------------------------------------------------------------------------------------------------------------- |
---|
219 | |
---|
220 | Bool m_bDecSubCu; ///< indicates decoder-mode |
---|
221 | Double m_dTotalCost; ///< sum of partition RD costs |
---|
222 | UInt m_uiTotalDistortion; ///< sum of partition distortion |
---|
223 | UInt m_uiTotalBits; ///< sum of partition bits |
---|
224 | UInt m_uiTotalBins; ///< sum of partition bins |
---|
225 | UInt* m_uiSliceStartCU; ///< Start CU address of current slice |
---|
226 | UInt* m_uiEntropySliceStartCU; ///< Start CU address of current slice |
---|
227 | |
---|
228 | // ------------------------------------------------------------------------------------------------------------------- |
---|
229 | // depth model mode data |
---|
230 | // ------------------------------------------------------------------------------------------------------------------- |
---|
231 | #if HHI_DMM_WEDGE_INTRA |
---|
232 | UInt* m_puiWedgeFullTabIdx; |
---|
233 | Int* m_piWedgeFullDeltaDC1; |
---|
234 | Int* m_piWedgeFullDeltaDC2; |
---|
235 | |
---|
236 | UInt* m_puiWedgePredDirTabIdx; |
---|
237 | Int* m_piWedgePredDirDeltaDC1; |
---|
238 | Int* m_piWedgePredDirDeltaDC2; |
---|
239 | Int* m_piWedgePredDirDeltaEnd; |
---|
240 | #endif |
---|
241 | #if HHI_DMM_PRED_TEX |
---|
242 | UInt* m_puiWedgePredTexTabIdx; |
---|
243 | Int* m_piWedgePredTexDeltaDC1; |
---|
244 | Int* m_piWedgePredTexDeltaDC2; |
---|
245 | |
---|
246 | Int* m_piContourPredTexDeltaDC1; |
---|
247 | Int* m_piContourPredTexDeltaDC2; |
---|
248 | #endif |
---|
249 | |
---|
250 | protected: |
---|
251 | |
---|
252 | /// add possible motion vector predictor candidates |
---|
253 | Bool xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
254 | Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
255 | |
---|
256 | Void deriveRightBottomIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB ); |
---|
257 | Bool xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx ); |
---|
258 | #if QC_MULTI_DIS_CAN |
---|
259 | Bool xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx ); |
---|
260 | #endif |
---|
261 | |
---|
262 | #if !AMVP_PRUNING_SIMPLIFICATION |
---|
263 | /// remove redundant candidates |
---|
264 | Void xUniqueMVPCand ( AMVPInfo* pInfo ); |
---|
265 | #endif |
---|
266 | |
---|
267 | Void xCheckCornerCand( TComDataCU* pcCorner, UInt uiCornerIdx, UInt uiIter, Bool& rbValidCand ); |
---|
268 | /// compute required bits to encode MVD (used in AMVP) |
---|
269 | UInt xGetMvdBits ( TComMv cMvd ); |
---|
270 | UInt xGetComponentBits ( Int iVal ); |
---|
271 | |
---|
272 | /// compute scaling factor from POC difference |
---|
273 | Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
274 | |
---|
275 | Void xDeriveCenterIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxCenter ); |
---|
276 | Bool xGetCenterCol( UInt uiPartIdx, RefPicList eRefPicList, int iRefIdx, TComMv *pcMv ); |
---|
277 | |
---|
278 | Void xCheckDuplicateCand(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, bool* pbCandIsInter, UInt& ruiArrayAddr); |
---|
279 | |
---|
280 | #if !BURST_IPCM |
---|
281 | Int getLastValidPartIdx ( Int iAbsPartIdx ); |
---|
282 | #endif |
---|
283 | |
---|
284 | public: |
---|
285 | TComDataCU(); |
---|
286 | virtual ~TComDataCU(); |
---|
287 | |
---|
288 | // ------------------------------------------------------------------------------------------------------------------- |
---|
289 | // create / destroy / initialize / copy |
---|
290 | // ------------------------------------------------------------------------------------------------------------------- |
---|
291 | |
---|
292 | Void create ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize |
---|
293 | #if ADAPTIVE_QP_SELECTION |
---|
294 | , Bool bGlobalRMARLBuffer = false |
---|
295 | #endif |
---|
296 | ); |
---|
297 | Void destroy (); |
---|
298 | |
---|
299 | Void initCU ( TComPic* pcPic, UInt uiCUAddr ); |
---|
300 | #if H0736_AVC_STYLE_QP_RANGE |
---|
301 | Void initEstData ( UInt uiDepth, Int qp ); |
---|
302 | Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); |
---|
303 | #else |
---|
304 | Void initEstData ( UInt uiDepth, UInt uiQP ); |
---|
305 | Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, UInt uiQP ); |
---|
306 | #endif |
---|
307 | Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
308 | |
---|
309 | Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
310 | Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ); |
---|
311 | Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
312 | |
---|
313 | Void copyToPic ( UChar uiDepth ); |
---|
314 | Void copyToPic ( UChar uiDepth, UInt uiPartIdx, UInt uiPartDepth ); |
---|
315 | |
---|
316 | // ------------------------------------------------------------------------------------------------------------------- |
---|
317 | // member functions for CU description |
---|
318 | // ------------------------------------------------------------------------------------------------------------------- |
---|
319 | |
---|
320 | TComPic* getPic () { return m_pcPic; } |
---|
321 | TComSlice* getSlice () { return m_pcSlice; } |
---|
322 | UInt& getAddr () { return m_uiCUAddr; } |
---|
323 | UInt& getZorderIdxInCU () { return m_uiAbsIdxInLCU; } |
---|
324 | UInt getSCUAddr (); |
---|
325 | UInt getCUPelX () { return m_uiCUPelX; } |
---|
326 | UInt getCUPelY () { return m_uiCUPelY; } |
---|
327 | TComPattern* getPattern () { return m_pcPattern; } |
---|
328 | |
---|
329 | UChar* getDepth () { return m_puhDepth; } |
---|
330 | UChar getDepth ( UInt uiIdx ) { return m_puhDepth[uiIdx]; } |
---|
331 | Void setDepth ( UInt uiIdx, UChar uh ) { m_puhDepth[uiIdx] = uh; } |
---|
332 | |
---|
333 | Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); |
---|
334 | Void getPosInPic ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ); |
---|
335 | #if HHI_MPI |
---|
336 | Int* getTextureModeDepth () { return m_piTextureModeDepth; } |
---|
337 | Int getTextureModeDepth ( UInt uiIdx ) { return m_piTextureModeDepth[uiIdx]; } |
---|
338 | Void setTextureModeDepth ( UInt uiIdx, Int iTextureModeDepth ){ m_piTextureModeDepth[uiIdx] = iTextureModeDepth; } |
---|
339 | Void setTextureModeDepthSubParts( Int iTextureModeDepth, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
340 | Void copyTextureMotionDataFrom( TComDataCU* pcCU, UInt uiDepth, UInt uiAbsPartIdxSrc, UInt uiAbsPartIdxDst = 0 ); |
---|
341 | #endif |
---|
342 | |
---|
343 | // ------------------------------------------------------------------------------------------------------------------- |
---|
344 | // member functions for CU data |
---|
345 | // ------------------------------------------------------------------------------------------------------------------- |
---|
346 | |
---|
347 | Char* getPartitionSize () { return m_pePartSize; } |
---|
348 | PartSize getPartitionSize ( UInt uiIdx ) { return static_cast<PartSize>( m_pePartSize[uiIdx] ); } |
---|
349 | Void setPartitionSize ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh; } |
---|
350 | Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
351 | |
---|
352 | #if HHI_INTERVIEW_SKIP |
---|
353 | Bool* getRenderable () { return m_pbRenderable; } |
---|
354 | Bool getRenderable ( UInt uiIdx ) { return m_pbRenderable[uiIdx]; } |
---|
355 | Void setRenderable ( UInt uiIdx, Bool b ) { m_pbRenderable[uiIdx] = b; } |
---|
356 | Void setRenderableSubParts ( Bool bRenderable, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
357 | #endif |
---|
358 | |
---|
359 | Char* getPredictionMode () { return m_pePredMode; } |
---|
360 | PredMode getPredictionMode ( UInt uiIdx ) { return static_cast<PredMode>( m_pePredMode[uiIdx] ); } |
---|
361 | Void setPredictionMode ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh; } |
---|
362 | Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
363 | |
---|
364 | UChar* getWidth () { return m_puhWidth; } |
---|
365 | UChar getWidth ( UInt uiIdx ) { return m_puhWidth[uiIdx]; } |
---|
366 | Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh; } |
---|
367 | |
---|
368 | UChar* getHeight () { return m_puhHeight; } |
---|
369 | UChar getHeight ( UInt uiIdx ) { return m_puhHeight[uiIdx]; } |
---|
370 | Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh; } |
---|
371 | |
---|
372 | Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
373 | |
---|
374 | #if H0736_AVC_STYLE_QP_RANGE |
---|
375 | Char* getQP () { return m_phQP; } |
---|
376 | Char getQP ( UInt uiIdx ) { return m_phQP[uiIdx]; } |
---|
377 | Void setQP ( UInt uiIdx, Char value ){ m_phQP[uiIdx] = value; } |
---|
378 | Void setQPSubParts ( Int qp, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
379 | #if BURST_IPCM |
---|
380 | Int getLastValidPartIdx ( Int iAbsPartIdx ); |
---|
381 | #endif |
---|
382 | Char getLastCodedQP ( UInt uiAbsPartIdx ); |
---|
383 | #else |
---|
384 | UChar* getQP () { return m_phQP; } |
---|
385 | UChar getQP ( UInt uiIdx ) { return m_phQP[uiIdx]; } |
---|
386 | Void setQP ( UInt uiIdx, UChar uh ) { m_phQP[uiIdx] = uh; } |
---|
387 | Void setQPSubParts ( UInt uiQP, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
388 | #if BURST_IPCM |
---|
389 | Int getLastValidPartIdx ( Int iAbsPartIdx ); |
---|
390 | #endif |
---|
391 | UChar getLastCodedQP ( UInt uiAbsPartIdx ); |
---|
392 | #endif |
---|
393 | |
---|
394 | #if LOSSLESS_CODING |
---|
395 | Bool isLosslessCoded(UInt absPartIdx); |
---|
396 | #endif |
---|
397 | UChar* getNSQTPartIdx () { return m_nsqtPartIdx; } |
---|
398 | UChar getNSQTPartIdx ( UInt idx ) { return m_nsqtPartIdx[idx]; } |
---|
399 | Void setNSQTIdxSubParts ( UInt absPartIdx, UInt depth ); |
---|
400 | Void setNSQTIdxSubParts ( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt trMode ); |
---|
401 | |
---|
402 | UChar* getTransformIdx () { return m_puhTrIdx; } |
---|
403 | UChar getTransformIdx ( UInt uiIdx ) { return m_puhTrIdx[uiIdx]; } |
---|
404 | Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
405 | |
---|
406 | UInt getQuadtreeTULog2MinSizeInCU( UInt absPartIdx ); |
---|
407 | |
---|
408 | TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } |
---|
409 | |
---|
410 | TCoeff*& getCoeffY () { return m_pcTrCoeffY; } |
---|
411 | TCoeff*& getCoeffCb () { return m_pcTrCoeffCb; } |
---|
412 | TCoeff*& getCoeffCr () { return m_pcTrCoeffCr; } |
---|
413 | #if ADAPTIVE_QP_SELECTION |
---|
414 | Int*& getArlCoeffY () { return m_pcArlCoeffY; } |
---|
415 | Int*& getArlCoeffCb () { return m_pcArlCoeffCb; } |
---|
416 | Int*& getArlCoeffCr () { return m_pcArlCoeffCr; } |
---|
417 | #endif |
---|
418 | |
---|
419 | Pel*& getPCMSampleY () { return m_pcIPCMSampleY; } |
---|
420 | Pel*& getPCMSampleCb () { return m_pcIPCMSampleCb; } |
---|
421 | Pel*& getPCMSampleCr () { return m_pcIPCMSampleCr; } |
---|
422 | |
---|
423 | UChar getCbf ( UInt uiIdx, TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx]; } |
---|
424 | UChar* getCbf ( TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]]; } |
---|
425 | UChar getCbf ( UInt uiIdx, TextType eType, UInt uiTrDepth ) { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); } |
---|
426 | Void setCbf ( UInt uiIdx, TextType eType, UChar uh ) { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh; } |
---|
427 | Void clearCbf ( UInt uiIdx, TextType eType, UInt uiNumParts ); |
---|
428 | UChar getQtRootCbf ( UInt uiIdx ) { return getCbf( uiIdx, TEXT_LUMA, 0 ) || getCbf( uiIdx, TEXT_CHROMA_U, 0 ) || getCbf( uiIdx, TEXT_CHROMA_V, 0 ); } |
---|
429 | |
---|
430 | Void setCbfSubParts ( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
431 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
432 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
433 | |
---|
434 | // ------------------------------------------------------------------------------------------------------------------- |
---|
435 | // member functions for coding tool information |
---|
436 | // ------------------------------------------------------------------------------------------------------------------- |
---|
437 | |
---|
438 | Bool* getMergeFlag () { return m_pbMergeFlag; } |
---|
439 | Bool getMergeFlag ( UInt uiIdx ) { return m_pbMergeFlag[uiIdx]; } |
---|
440 | Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b; } |
---|
441 | Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
442 | |
---|
443 | UChar* getMergeIndex () { return m_puhMergeIndex; } |
---|
444 | UChar getMergeIndex ( UInt uiIdx ) { return m_puhMergeIndex[uiIdx]; } |
---|
445 | Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } |
---|
446 | Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
447 | template <typename T> |
---|
448 | Void setSubPart ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
449 | |
---|
450 | #if AMP_MRG |
---|
451 | Void setMergeAMP( Bool b ) { m_bIsMergeAMP = b; } |
---|
452 | Bool getMergeAMP( ) { return m_bIsMergeAMP; } |
---|
453 | #endif |
---|
454 | |
---|
455 | UChar* getLumaIntraDir () { return m_puhLumaIntraDir; } |
---|
456 | UChar getLumaIntraDir ( UInt uiIdx ) { return m_puhLumaIntraDir[uiIdx]; } |
---|
457 | Void setLumaIntraDir ( UInt uiIdx, UChar uh ) { m_puhLumaIntraDir[uiIdx] = uh; } |
---|
458 | Void setLumaIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
459 | |
---|
460 | UChar* getChromaIntraDir () { return m_puhChromaIntraDir; } |
---|
461 | UChar getChromaIntraDir ( UInt uiIdx ) { return m_puhChromaIntraDir[uiIdx]; } |
---|
462 | Void setChromaIntraDir ( UInt uiIdx, UChar uh ) { m_puhChromaIntraDir[uiIdx] = uh; } |
---|
463 | Void setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
464 | |
---|
465 | UChar* getInterDir () { return m_puhInterDir; } |
---|
466 | UChar getInterDir ( UInt uiIdx ) { return m_puhInterDir[uiIdx]; } |
---|
467 | Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh; } |
---|
468 | Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
469 | |
---|
470 | Bool* getAlfCtrlFlag () { return m_puiAlfCtrlFlag; } |
---|
471 | Bool getAlfCtrlFlag ( UInt uiIdx ) { return m_puiAlfCtrlFlag[uiIdx]; } |
---|
472 | Void setAlfCtrlFlag ( UInt uiIdx, Bool uiFlag){ m_puiAlfCtrlFlag[uiIdx] = uiFlag; } |
---|
473 | Void setAlfCtrlFlagSubParts( Bool uiFlag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
474 | |
---|
475 | Void createTmpAlfCtrlFlag (); |
---|
476 | Void destroyTmpAlfCtrlFlag (); |
---|
477 | Void copyAlfCtrlFlagToTmp (); |
---|
478 | Void copyAlfCtrlFlagFromTmp(); |
---|
479 | |
---|
480 | Bool* getIPCMFlag () { return m_pbIPCMFlag; } |
---|
481 | Bool getIPCMFlag (UInt uiIdx ) { return m_pbIPCMFlag[uiIdx]; } |
---|
482 | Void setIPCMFlag (UInt uiIdx, Bool b ) { m_pbIPCMFlag[uiIdx] = b; } |
---|
483 | Void setIPCMFlagSubParts (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth); |
---|
484 | |
---|
485 | #if BURST_IPCM |
---|
486 | Int getNumSucIPCM () { return m_numSucIPCM; } |
---|
487 | Void setNumSucIPCM ( Int num ) { m_numSucIPCM = num; } |
---|
488 | Bool getLastCUSucIPCMFlag () { return m_lastCUSucIPCMFlag; } |
---|
489 | Void setLastCUSucIPCMFlag ( Bool flg ) { m_lastCUSucIPCMFlag = flg; } |
---|
490 | #endif |
---|
491 | |
---|
492 | /// get slice ID for SU |
---|
493 | Int getSUSliceID (UInt uiIdx) {return m_piSliceSUMap[uiIdx]; } |
---|
494 | |
---|
495 | /// get the pointer of slice ID map |
---|
496 | Int* getSliceSUMap () {return m_piSliceSUMap; } |
---|
497 | |
---|
498 | /// set the pointer of slice ID map |
---|
499 | Void setSliceSUMap (Int *pi) {m_piSliceSUMap = pi; } |
---|
500 | |
---|
501 | std::vector<NDBFBlockInfo>* getNDBFilterBlocks() {return &m_vNDFBlock;} |
---|
502 | Void setNDBFilterBlockBorderAvailability(UInt numLCUInPicWidth, UInt numLCUInPicHeight, UInt numSUInLCUWidth, UInt numSUInLCUHeight, UInt picWidth, UInt picHeight |
---|
503 | ,Bool bIndependentSliceBoundaryEnabled |
---|
504 | ,Bool bTopTileBoundary, Bool bDownTileBoundary, Bool bLeftTileBoundary, Bool bRightTileBoundary |
---|
505 | ,Bool bIndependentTileBoundaryEnabled ); |
---|
506 | |
---|
507 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
508 | #if !QC_MULTI_DIS_CAN |
---|
509 | Int getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv ); |
---|
510 | Bool getPdmMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge = false ); |
---|
511 | #else |
---|
512 | Bool getPdmMvPredDisCan( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge = false ); |
---|
513 | Int getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo ); |
---|
514 | Void getDisMvpCand ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo ); |
---|
515 | #endif |
---|
516 | Bool getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv ); |
---|
517 | #endif |
---|
518 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
519 | Bool* getResPredAvail () { return m_pbResPredAvailable; } |
---|
520 | Bool getResPredAvail ( UInt uiIdx ) { return m_pbResPredAvailable[uiIdx]; } |
---|
521 | Void setResPredAvail ( UInt uiIdx, Bool b ) { m_pbResPredAvailable[uiIdx] = b; } |
---|
522 | Void setResPredAvailSubParts ( Bool b, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
523 | |
---|
524 | Bool* getResPredFlag () { return m_pbResPredFlag; } |
---|
525 | Bool getResPredFlag ( UInt uiIdx ) { return m_pbResPredFlag[uiIdx]; } |
---|
526 | Void setResPredFlag ( UInt uiIdx, Bool b ) { m_pbResPredFlag[uiIdx] = b; } |
---|
527 | Void setResPredFlagSubParts ( Bool b, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
528 | |
---|
529 | Void setResPredIndicator ( Bool bAv, Bool bRP ) { m_pbResPredAvailable[0] = bAv; m_pbResPredFlag[0] = bRP; } |
---|
530 | #endif |
---|
531 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
532 | Bool getResidualSamples( UInt uiPartIdx, |
---|
533 | #if QC_SIMPLIFIEDIVRP_M24938 |
---|
534 | Bool bRecon , |
---|
535 | #endif |
---|
536 | TComYuv* pcYuv = 0 ); |
---|
537 | #endif |
---|
538 | // ------------------------------------------------------------------------------------------------------------------- |
---|
539 | // member functions for accessing partition information |
---|
540 | // ------------------------------------------------------------------------------------------------------------------- |
---|
541 | #if LG_RESTRICTEDRESPRED_M24766 |
---|
542 | Void getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false); |
---|
543 | #else |
---|
544 | Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); |
---|
545 | #endif |
---|
546 | #if LG_RESTRICTEDRESPRED_M24766 |
---|
547 | Int getResiPredMode(UInt uiPartAddr); |
---|
548 | Void getPUResiPredShift (Int *iPUPredResiShift, UInt uiAbsPartIndex); |
---|
549 | #endif |
---|
550 | UChar getNumPartInter (); |
---|
551 | Bool isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth); |
---|
552 | |
---|
553 | // ------------------------------------------------------------------------------------------------------------------- |
---|
554 | // member functions for motion vector |
---|
555 | // ------------------------------------------------------------------------------------------------------------------- |
---|
556 | |
---|
557 | Void getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); |
---|
558 | |
---|
559 | AMVP_MODE getAMVPMode ( UInt uiIdx ); |
---|
560 | Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ); |
---|
561 | #if PARALLEL_MERGE |
---|
562 | Bool isDiffMER ( Int xN, Int yN, Int xP, Int yP); |
---|
563 | Void getPartPosition ( UInt partIdx, Int& xP, Int& yP, Int& nPSW, Int& nPSH); |
---|
564 | #endif |
---|
565 | Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } |
---|
566 | Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) { return m_apiMVPIdx[eRefPicList][uiIdx]; } |
---|
567 | Char* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList]; } |
---|
568 | |
---|
569 | Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum; } |
---|
570 | Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) { return m_apiMVPNum[eRefPicList][uiIdx]; } |
---|
571 | Char* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList]; } |
---|
572 | |
---|
573 | Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
574 | Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
575 | |
---|
576 | Void clipMv ( TComMv& rcMv ); |
---|
577 | Void getMvPredLeft ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldA.getMv(); } |
---|
578 | Void getMvPredAbove ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldB.getMv(); } |
---|
579 | Void getMvPredAboveRight ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldC.getMv(); } |
---|
580 | |
---|
581 | Void compressMV (); |
---|
582 | |
---|
583 | // ------------------------------------------------------------------------------------------------------------------- |
---|
584 | // utility functions for neighbouring information |
---|
585 | // ------------------------------------------------------------------------------------------------------------------- |
---|
586 | |
---|
587 | TComDataCU* getCULeft () { return m_pcCULeft; } |
---|
588 | TComDataCU* getCUAbove () { return m_pcCUAbove; } |
---|
589 | TComDataCU* getCUAboveLeft () { return m_pcCUAboveLeft; } |
---|
590 | TComDataCU* getCUAboveRight () { return m_pcCUAboveRight; } |
---|
591 | TComDataCU* getCUColocated ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; } |
---|
592 | |
---|
593 | |
---|
594 | TComDataCU* getPULeft ( UInt& uiLPartUnitIdx , UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true |
---|
595 | , Bool bEnforceTileRestriction=true |
---|
596 | ); |
---|
597 | |
---|
598 | TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx , UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true, Bool MotionDataCompresssion = false |
---|
599 | , Bool planarAtLCUBoundary = false |
---|
600 | , Bool bEnforceTileRestriction=true |
---|
601 | ); |
---|
602 | |
---|
603 | TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true, Bool MotionDataCompresssion = false ); |
---|
604 | TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true, Bool MotionDataCompresssion = false ); |
---|
605 | TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
606 | |
---|
607 | TComDataCU* getQpMinCuLeft ( UInt& uiLPartUnitIdx , UInt uiCurrAbsIdxInLCU, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
608 | #if H0204_QP_PREDICTION |
---|
609 | TComDataCU* getQpMinCuAbove ( UInt& aPartUnitIdx , UInt currAbsIdxInLCU, Bool enforceSliceRestriction=true, Bool enforceEntropySliceRestriction=true ); |
---|
610 | #endif |
---|
611 | #if H0736_AVC_STYLE_QP_RANGE |
---|
612 | Char getRefQP ( UInt uiCurrAbsIdxInLCU ); |
---|
613 | #else |
---|
614 | UChar getRefQP ( UInt uiCurrAbsIdxInLCU ); |
---|
615 | #endif |
---|
616 | |
---|
617 | TComDataCU* getPUAboveRightAdi ( UInt& uiARPartUnitIdx, UInt uiPuWidth, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
618 | TComDataCU* getPUBelowLeftAdi ( UInt& uiBLPartUnitIdx, UInt uiPuHeight, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
619 | |
---|
620 | Void deriveLeftRightTopIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
621 | Void deriveLeftBottomIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
622 | |
---|
623 | Void deriveLeftRightTopIdxAdi ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth ); |
---|
624 | Void deriveLeftBottomIdxAdi ( UInt& ruiPartIdxLB, UInt uiPartOffset, UInt uiPartDepth ); |
---|
625 | |
---|
626 | Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); |
---|
627 | #if SIMP_MRG_PRUN |
---|
628 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ); |
---|
629 | #else |
---|
630 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand ); |
---|
631 | #endif |
---|
632 | Void deriveLeftRightTopIdxGeneral ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
633 | Void deriveLeftBottomIdxGeneral ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
634 | |
---|
635 | |
---|
636 | // ------------------------------------------------------------------------------------------------------------------- |
---|
637 | // member functions for modes |
---|
638 | // ------------------------------------------------------------------------------------------------------------------- |
---|
639 | |
---|
640 | Bool isIntra ( UInt uiPartIdx ) { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } |
---|
641 | Bool isSkipped ( UInt uiPartIdx ); ///< SKIP (no residual) |
---|
642 | |
---|
643 | // ------------------------------------------------------------------------------------------------------------------- |
---|
644 | // member functions for symbol prediction (most probable / mode conversion) |
---|
645 | // ------------------------------------------------------------------------------------------------------------------- |
---|
646 | |
---|
647 | UInt getIntraSizeIdx ( UInt uiAbsPartIdx ); |
---|
648 | Void convertTransIdx ( UInt uiAbsPartIdx, UInt uiTrIdx, UInt& ruiLumaTrMode, UInt& ruiChromaTrMode ); |
---|
649 | |
---|
650 | Void getAllowedChromaDir ( UInt uiAbsPartIdx, UInt* uiModeList ); |
---|
651 | Int getIntraDirLumaPredictor ( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int* piMode = NULL ); |
---|
652 | |
---|
653 | // ------------------------------------------------------------------------------------------------------------------- |
---|
654 | // member functions for SBAC context |
---|
655 | // ------------------------------------------------------------------------------------------------------------------- |
---|
656 | |
---|
657 | UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
658 | UInt getCtxQtCbf ( UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth ); |
---|
659 | |
---|
660 | UInt getCtxSkipFlag ( UInt uiAbsPartIdx ); |
---|
661 | UInt getCtxInterDir ( UInt uiAbsPartIdx ); |
---|
662 | |
---|
663 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
664 | UInt getCtxResPredFlag ( UInt uiAbsPartIdx ); |
---|
665 | #endif |
---|
666 | |
---|
667 | UInt getSliceStartCU ( UInt pos ) { return m_uiSliceStartCU[pos-m_uiAbsIdxInLCU]; } |
---|
668 | UInt getEntropySliceStartCU ( UInt pos ) { return m_uiEntropySliceStartCU[pos-m_uiAbsIdxInLCU]; } |
---|
669 | UInt& getTotalBins () { return m_uiTotalBins; } |
---|
670 | // ------------------------------------------------------------------------------------------------------------------- |
---|
671 | // member functions for RD cost storage |
---|
672 | // ------------------------------------------------------------------------------------------------------------------- |
---|
673 | |
---|
674 | Double& getTotalCost() { return m_dTotalCost; } |
---|
675 | UInt& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
676 | UInt& getTotalBits() { return m_uiTotalBits; } |
---|
677 | UInt& getTotalNumPart() { return m_uiNumPartition; } |
---|
678 | |
---|
679 | UInt getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra); |
---|
680 | |
---|
681 | Bool useNonSquareTrans( UInt uiTrMode, Int absPartIdx ); |
---|
682 | Void getNSQTSize(Int trMode, Int absPartIdx, Int &trWidth, Int &trHeight); |
---|
683 | Bool useNonSquarePU ( UInt absPartIdx); |
---|
684 | UInt getInterTUSplitDirection ( Int width, Int height, Int trLastWidth, Int trLastHeight ); |
---|
685 | UInt getNSAbsPartIdx ( UInt log2TrafoSize, UInt absPartIdx, UInt absTUPartIdx, UInt innerQuadIdx, UInt trMode ); |
---|
686 | UInt getNSAddrChroma ( UInt uiLog2TrSizeC, UInt uiTrModeC, UInt uiQuadrant, UInt absTUPartIdx ); |
---|
687 | |
---|
688 | // ------------------------------------------------------------------------------------------------------------------- |
---|
689 | // member functions for depth model modes |
---|
690 | // ------------------------------------------------------------------------------------------------------------------- |
---|
691 | #if HHI_DMM_WEDGE_INTRA |
---|
692 | UInt* getWedgeFullTabIdx () { return m_puiWedgeFullTabIdx; } |
---|
693 | UInt getWedgeFullTabIdx ( UInt uiIdx ) { return m_puiWedgeFullTabIdx[uiIdx]; } |
---|
694 | Void setWedgeFullTabIdx ( UInt uiIdx, UInt uh ) { m_puiWedgeFullTabIdx[uiIdx] = uh; } |
---|
695 | Void setWedgeFullTabIdxSubParts ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
696 | Int* getWedgeFullDeltaDC1 () { return m_piWedgeFullDeltaDC1; } |
---|
697 | Int getWedgeFullDeltaDC1 ( UInt uiIdx ) { return m_piWedgeFullDeltaDC1[uiIdx]; } |
---|
698 | Void setWedgeFullDeltaDC1 ( UInt uiIdx, Int i ) { m_piWedgeFullDeltaDC1[uiIdx] = i; } |
---|
699 | Void setWedgeFullDeltaDC1SubParts ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
700 | Int* getWedgeFullDeltaDC2 () { return m_piWedgeFullDeltaDC2; } |
---|
701 | Int getWedgeFullDeltaDC2 ( UInt uiIdx ) { return m_piWedgeFullDeltaDC2[uiIdx]; } |
---|
702 | Void setWedgeFullDeltaDC2 ( UInt uiIdx, Int i ) { m_piWedgeFullDeltaDC2[uiIdx] = i; } |
---|
703 | Void setWedgeFullDeltaDC2SubParts ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
704 | |
---|
705 | UInt* getWedgePredDirTabIdx () { return m_puiWedgePredDirTabIdx; } |
---|
706 | UInt getWedgePredDirTabIdx ( UInt uiIdx ) { return m_puiWedgePredDirTabIdx[uiIdx]; } |
---|
707 | Void setWedgePredDirTabIdx ( UInt uiIdx, UInt uh ) { m_puiWedgePredDirTabIdx[uiIdx] = uh; } |
---|
708 | Void setWedgePredDirTabIdxSubParts ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
709 | Int* getWedgePredDirDeltaDC1 () { return m_piWedgePredDirDeltaDC1; } |
---|
710 | Int getWedgePredDirDeltaDC1 ( UInt uiIdx ) { return m_piWedgePredDirDeltaDC1[uiIdx]; } |
---|
711 | Void setWedgePredDirDeltaDC1 ( UInt uiIdx, Int i ) { m_piWedgePredDirDeltaDC1[uiIdx] = i; } |
---|
712 | Void setWedgePredDirDeltaDC1SubParts ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
713 | Int* getWedgePredDirDeltaDC2 () { return m_piWedgePredDirDeltaDC2; } |
---|
714 | Int getWedgePredDirDeltaDC2 ( UInt uiIdx ) { return m_piWedgePredDirDeltaDC2[uiIdx]; } |
---|
715 | Void setWedgePredDirDeltaDC2 ( UInt uiIdx, Int i ) { m_piWedgePredDirDeltaDC2[uiIdx] = i; } |
---|
716 | Void setWedgePredDirDeltaDC2SubParts ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
717 | Int* getWedgePredDirDeltaEnd () { return m_piWedgePredDirDeltaEnd; } |
---|
718 | Int getWedgePredDirDeltaEnd ( UInt uiIdx ) { return m_piWedgePredDirDeltaEnd[uiIdx]; } |
---|
719 | Void setWedgePredDirDeltaEnd ( UInt uiIdx, Int iD ) { m_piWedgePredDirDeltaEnd[uiIdx] = iD; } |
---|
720 | Void setWedgePredDirDeltaEndSubParts ( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
721 | #endif |
---|
722 | #if HHI_DMM_PRED_TEX |
---|
723 | UInt* getWedgePredTexTabIdx () { return m_puiWedgePredTexTabIdx; } |
---|
724 | UInt getWedgePredTexTabIdx ( UInt uiIdx ) { return m_puiWedgePredTexTabIdx[uiIdx]; } |
---|
725 | Void setWedgePredTexTabIdx ( UInt uiIdx, UInt uh ) { m_puiWedgePredTexTabIdx[uiIdx] = uh; } |
---|
726 | Void setWedgePredTexTabIdxSubParts ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
727 | Int* getWedgePredTexDeltaDC1 () { return m_piWedgePredTexDeltaDC1; } |
---|
728 | Int getWedgePredTexDeltaDC1 ( UInt uiIdx ) { return m_piWedgePredTexDeltaDC1[uiIdx]; } |
---|
729 | Void setWedgePredTexDeltaDC1 ( UInt uiIdx, Int i ) { m_piWedgePredTexDeltaDC1[uiIdx] = i; } |
---|
730 | Void setWedgePredTexDeltaDC1SubParts ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
731 | Int* getWedgePredTexDeltaDC2 () { return m_piWedgePredTexDeltaDC2; } |
---|
732 | Int getWedgePredTexDeltaDC2 ( UInt uiIdx ) { return m_piWedgePredTexDeltaDC2[uiIdx]; } |
---|
733 | Void setWedgePredTexDeltaDC2 ( UInt uiIdx, Int i ) { m_piWedgePredTexDeltaDC2[uiIdx] = i; } |
---|
734 | Void setWedgePredTexDeltaDC2SubParts ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
735 | |
---|
736 | Int* getContourPredTexDeltaDC1 () { return m_piContourPredTexDeltaDC1; } |
---|
737 | Int getContourPredTexDeltaDC1 ( UInt uiIdx ) { return m_piContourPredTexDeltaDC1[uiIdx]; } |
---|
738 | Void setContourPredTexDeltaDC1 ( UInt uiIdx, Int i ) { m_piContourPredTexDeltaDC1[uiIdx] = i; } |
---|
739 | Void setContourPredTexDeltaDC1SubParts ( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
740 | Int* getContourPredTexDeltaDC2 () { return m_piContourPredTexDeltaDC2; } |
---|
741 | Int getContourPredTexDeltaDC2 ( UInt uiIdx ) { return m_piContourPredTexDeltaDC2[uiIdx]; } |
---|
742 | Void setContourPredTexDeltaDC2 ( UInt uiIdx, Int i ) { m_piContourPredTexDeltaDC2[uiIdx] = i; } |
---|
743 | Void setContourPredTexDeltaDC2SubParts ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
744 | #endif |
---|
745 | }; |
---|
746 | |
---|
747 | namespace RasterAddress |
---|
748 | { |
---|
749 | /** Check whether 2 addresses point to the same column |
---|
750 | * \param addrA First address in raster scan order |
---|
751 | * \param addrB Second address in raters scan order |
---|
752 | * \param numUnitsPerRow Number of units in a row |
---|
753 | * \return Result of test |
---|
754 | */ |
---|
755 | static inline Bool isEqualCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
756 | { |
---|
757 | // addrA % numUnitsPerRow == addrB % numUnitsPerRow |
---|
758 | return (( addrA ^ addrB ) & ( numUnitsPerRow - 1 ) ) == 0; |
---|
759 | } |
---|
760 | |
---|
761 | /** Check whether 2 addresses point to the same row |
---|
762 | * \param addrA First address in raster scan order |
---|
763 | * \param addrB Second address in raters scan order |
---|
764 | * \param numUnitsPerRow Number of units in a row |
---|
765 | * \return Result of test |
---|
766 | */ |
---|
767 | static inline Bool isEqualRow( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
768 | { |
---|
769 | // addrA / numUnitsPerRow == addrB / numUnitsPerRow |
---|
770 | return (( addrA ^ addrB ) &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
771 | } |
---|
772 | |
---|
773 | /** Check whether 2 addresses point to the same row or column |
---|
774 | * \param addrA First address in raster scan order |
---|
775 | * \param addrB Second address in raters scan order |
---|
776 | * \param numUnitsPerRow Number of units in a row |
---|
777 | * \return Result of test |
---|
778 | */ |
---|
779 | static inline Bool isEqualRowOrCol( Int addrA, Int addrB, Int numUnitsPerRow ) |
---|
780 | { |
---|
781 | return isEqualCol( addrA, addrB, numUnitsPerRow ) | isEqualRow( addrA, addrB, numUnitsPerRow ); |
---|
782 | } |
---|
783 | |
---|
784 | /** Check whether one address points to the first column |
---|
785 | * \param addr Address in raster scan order |
---|
786 | * \param numUnitsPerRow Number of units in a row |
---|
787 | * \return Result of test |
---|
788 | */ |
---|
789 | static inline Bool isZeroCol( Int addr, Int numUnitsPerRow ) |
---|
790 | { |
---|
791 | // addr % numUnitsPerRow == 0 |
---|
792 | return ( addr & ( numUnitsPerRow - 1 ) ) == 0; |
---|
793 | } |
---|
794 | |
---|
795 | /** Check whether one address points to the first row |
---|
796 | * \param addr Address in raster scan order |
---|
797 | * \param numUnitsPerRow Number of units in a row |
---|
798 | * \return Result of test |
---|
799 | */ |
---|
800 | static inline Bool isZeroRow( Int addr, Int numUnitsPerRow ) |
---|
801 | { |
---|
802 | // addr / numUnitsPerRow == 0 |
---|
803 | return ( addr &~ ( numUnitsPerRow - 1 ) ) == 0; |
---|
804 | } |
---|
805 | |
---|
806 | /** Check whether one address points to a column whose index is smaller than a given value |
---|
807 | * \param addr Address in raster scan order |
---|
808 | * \param val Given column index value |
---|
809 | * \param numUnitsPerRow Number of units in a row |
---|
810 | * \return Result of test |
---|
811 | */ |
---|
812 | static inline Bool lessThanCol( Int addr, Int val, Int numUnitsPerRow ) |
---|
813 | { |
---|
814 | // addr % numUnitsPerRow < val |
---|
815 | return ( addr & ( numUnitsPerRow - 1 ) ) < val; |
---|
816 | } |
---|
817 | |
---|
818 | /** Check whether one address points to a row whose index is smaller than a given value |
---|
819 | * \param addr Address in raster scan order |
---|
820 | * \param val Given row index value |
---|
821 | * \param numUnitsPerRow Number of units in a row |
---|
822 | * \return Result of test |
---|
823 | */ |
---|
824 | static inline Bool lessThanRow( Int addr, Int val, Int numUnitsPerRow ) |
---|
825 | { |
---|
826 | // addr / numUnitsPerRow < val |
---|
827 | return addr < val * numUnitsPerRow; |
---|
828 | } |
---|
829 | }; |
---|
830 | |
---|
831 | //! \} |
---|
832 | |
---|
833 | #endif |
---|