1 | |
---|
2 | |
---|
3 | /** \file TComDataCU.h |
---|
4 | \brief CU data structure (header) |
---|
5 | \todo not all entities are documented |
---|
6 | */ |
---|
7 | |
---|
8 | #ifndef _TCOMDATACU_ |
---|
9 | #define _TCOMDATACU_ |
---|
10 | |
---|
11 | #include <assert.h> |
---|
12 | |
---|
13 | // Include files |
---|
14 | #include "CommonDef.h" |
---|
15 | #include "TComMotionInfo.h" |
---|
16 | #include "TComSlice.h" |
---|
17 | #include "TComRdCost.h" |
---|
18 | #include "TComPattern.h" |
---|
19 | #include "TComYuv.h" |
---|
20 | |
---|
21 | #include <algorithm> |
---|
22 | #include <vector> |
---|
23 | |
---|
24 | // ==================================================================================================================== |
---|
25 | // Class definition |
---|
26 | // ==================================================================================================================== |
---|
27 | |
---|
28 | /// CU data structure class |
---|
29 | class TComDataCU |
---|
30 | { |
---|
31 | private: |
---|
32 | |
---|
33 | // ------------------------------------------------------------------------------------------------------------------- |
---|
34 | // class pointers |
---|
35 | // ------------------------------------------------------------------------------------------------------------------- |
---|
36 | |
---|
37 | TComPic* m_pcPic; ///< picture class pointer |
---|
38 | TComSlice* m_pcSlice; ///< slice header pointer |
---|
39 | TComPattern* m_pcPattern; ///< neighbour access class pointer |
---|
40 | |
---|
41 | // ------------------------------------------------------------------------------------------------------------------- |
---|
42 | // CU description |
---|
43 | // ------------------------------------------------------------------------------------------------------------------- |
---|
44 | |
---|
45 | UInt m_uiCUAddr; ///< CU address in a slice |
---|
46 | UInt m_uiAbsIdxInLCU; ///< absolute address in a CU. It's Z scan order |
---|
47 | UInt m_uiCUPelX; ///< CU position in a pixel (X) |
---|
48 | UInt m_uiCUPelY; ///< CU position in a pixel (Y) |
---|
49 | UInt m_uiNumPartition; ///< total number of minimum partitions in a CU |
---|
50 | UChar* m_puhWidth; ///< array of widths |
---|
51 | UChar* m_puhHeight; ///< array of heights |
---|
52 | UChar* m_puhDepth; ///< array of depths |
---|
53 | Int* m_piTextureModeDepth; ///< at which depth is prediction data inherited from texture picture ( -1 : none ) |
---|
54 | |
---|
55 | // ------------------------------------------------------------------------------------------------------------------- |
---|
56 | // CU data |
---|
57 | // ------------------------------------------------------------------------------------------------------------------- |
---|
58 | |
---|
59 | PartSize* m_pePartSize; ///< array of partition sizes |
---|
60 | PredMode* m_pePredMode; ///< array of prediction modes |
---|
61 | UChar* m_phQP; ///< array of QP values |
---|
62 | UChar* m_puhTrIdx; ///< array of transform indices |
---|
63 | UChar* m_puhCbf[3]; ///< array of coded block flags (CBF) |
---|
64 | TComCUMvField m_acCUMvField[2]; ///< array of motion vectors |
---|
65 | TCoeff* m_pcTrCoeffY; ///< transformed coefficient buffer (Y) |
---|
66 | TCoeff* m_pcTrCoeffCb; ///< transformed coefficient buffer (Cb) |
---|
67 | TCoeff* m_pcTrCoeffCr; ///< transformed coefficient buffer (Cr) |
---|
68 | #if SNY_DQP |
---|
69 | Bool m_bdQP; ///< signal if LCU dQP encoded |
---|
70 | #endif//SNY_DQP |
---|
71 | |
---|
72 | // ------------------------------------------------------------------------------------------------------------------- |
---|
73 | // neighbour access variables |
---|
74 | // ------------------------------------------------------------------------------------------------------------------- |
---|
75 | |
---|
76 | TComDataCU* m_pcCUAboveLeft; ///< pointer of above-left CU |
---|
77 | TComDataCU* m_pcCUAboveRight; ///< pointer of above-right CU |
---|
78 | TComDataCU* m_pcCUAbove; ///< pointer of above CU |
---|
79 | TComDataCU* m_pcCULeft; ///< pointer of left CU |
---|
80 | TComDataCU* m_apcCUColocated[2]; ///< pointer of temporally colocated CU's for both directions |
---|
81 | TComMvField m_cMvFieldA; ///< motion vector of position A |
---|
82 | TComMvField m_cMvFieldB; ///< motion vector of position B |
---|
83 | TComMvField m_cMvFieldC; ///< motion vector of position C |
---|
84 | TComMv m_cMvPred; ///< motion vector predictor |
---|
85 | |
---|
86 | // ------------------------------------------------------------------------------------------------------------------- |
---|
87 | // coding tool information |
---|
88 | // ------------------------------------------------------------------------------------------------------------------- |
---|
89 | |
---|
90 | Bool* m_pbMergeFlag; ///< array of merge flags |
---|
91 | UChar* m_puhMergeIndex; ///< array of merge candidate indices |
---|
92 | Bool* m_pbResPredAvailable; ///< array of residual prediction available flags |
---|
93 | Bool* m_pbResPredFlag; ///< array of residual prediction flags |
---|
94 | UChar* m_apuhNeighbourCandIdx[ MRG_MAX_NUM_CANDS ];///< array of motion vector predictor candidates indices |
---|
95 | UChar* m_puhLumaIntraDir; ///< array of intra directions (luma) |
---|
96 | UChar* m_puhChromaIntraDir; ///< array of intra directions (chroma) |
---|
97 | UChar* m_puhInterDir; ///< array of inter directions |
---|
98 | Int* m_apiMVPIdx[2]; ///< array of motion vector predictor candidates |
---|
99 | Int* m_apiMVPNum[2]; ///< array of number of possible motion vectors predictors |
---|
100 | UInt* m_puiAlfCtrlFlag; ///< array of ALF flags |
---|
101 | UInt* m_puiTmpAlfCtrlFlag; ///< temporal array of ALF flags |
---|
102 | #if HHI_DMM_INTRA |
---|
103 | UInt* m_puiWedgeFullTabIdx; |
---|
104 | Int* m_piWedgeFullDeltaDC1; |
---|
105 | Int* m_piWedgeFullDeltaDC2; |
---|
106 | |
---|
107 | UInt* m_puiWedgePredDirTabIdx; |
---|
108 | Int* m_piWedgePredDirDeltaDC1; |
---|
109 | Int* m_piWedgePredDirDeltaDC2; |
---|
110 | Int* m_piWedgePredDirDeltaEnd; |
---|
111 | |
---|
112 | UInt* m_puiWedgePredTexTabIdx; |
---|
113 | Int* m_piWedgePredTexDeltaDC1; |
---|
114 | Int* m_piWedgePredTexDeltaDC2; |
---|
115 | |
---|
116 | Int* m_piContourPredTexDeltaDC1; |
---|
117 | Int* m_piContourPredTexDeltaDC2; |
---|
118 | |
---|
119 | Bool* m_pbTextureModesAllowed; |
---|
120 | #endif |
---|
121 | |
---|
122 | // ------------------------------------------------------------------------------------------------------------------- |
---|
123 | // misc. variables |
---|
124 | // ------------------------------------------------------------------------------------------------------------------- |
---|
125 | |
---|
126 | Bool m_bDecSubCu; ///< indicates decoder-mode |
---|
127 | Double m_dTotalCost; ///< sum of partition RD costs |
---|
128 | Dist m_uiTotalDistortion; ///< sum of partition distortion |
---|
129 | UInt m_uiTotalBits; ///< sum of partition bits |
---|
130 | UInt m_uiSliceStartCU; ///< Start CU address of current slice |
---|
131 | UInt m_uiEntropySliceStartCU; ///< Start CU address of current slice |
---|
132 | |
---|
133 | protected: |
---|
134 | |
---|
135 | /// add possible motion vector predictor candidates |
---|
136 | Bool xAddMVPCand ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
137 | #if MTK_AMVP_SMVP_DERIVATION |
---|
138 | Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); |
---|
139 | #endif |
---|
140 | |
---|
141 | #if MTK_TMVP_H_MRG || MTK_TMVP_H_AMVP |
---|
142 | Void deriveRightBottomIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB ); |
---|
143 | Bool xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx ); |
---|
144 | #endif |
---|
145 | |
---|
146 | /// remove redundant candidates |
---|
147 | Void xUniqueMVPCand ( AMVPInfo* pInfo ); |
---|
148 | |
---|
149 | Void xCheckCornerCand( TComDataCU* pcCorner, UInt uiCornerIdx, UInt uiIter, Bool& rbValidCand ); |
---|
150 | /// compute required bits to encode MVD (used in AMVP) |
---|
151 | UInt xGetMvdBits ( TComMv cMvd ); |
---|
152 | UInt xGetComponentBits ( Int iVal ); |
---|
153 | |
---|
154 | /// compute scaling factor from POC difference |
---|
155 | Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); |
---|
156 | |
---|
157 | /// calculate all CBF's from coefficients |
---|
158 | Void xCalcCuCbf ( UChar* puhCbf, UInt uiTrDepth, UInt uiCbfDepth, UInt uiCuDepth ); |
---|
159 | |
---|
160 | #if FT_TCTR_AMVP || FT_TCTR_MRG |
---|
161 | Void xDeriveCenterIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxCenter ); |
---|
162 | Bool xGetCenterCol( UInt uiPartIdx, RefPicList eRefPicList, int iRefIdx, TComMv *pcMv ); |
---|
163 | #endif |
---|
164 | |
---|
165 | public: |
---|
166 | TComDataCU(); |
---|
167 | virtual ~TComDataCU(); |
---|
168 | |
---|
169 | // ------------------------------------------------------------------------------------------------------------------- |
---|
170 | // create / destroy / initialize / copy |
---|
171 | // ------------------------------------------------------------------------------------------------------------------- |
---|
172 | |
---|
173 | Void create ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu ); |
---|
174 | Void destroy (); |
---|
175 | |
---|
176 | Void initCU ( TComPic* pcPic, UInt uiCUAddr ); |
---|
177 | Void initEstData (); |
---|
178 | Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
179 | |
---|
180 | Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
181 | Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ); |
---|
182 | Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); |
---|
183 | |
---|
184 | Void copyToPic ( UChar uiDepth ); |
---|
185 | Void copyToPic ( UChar uiDepth, UInt uiPartIdx, UInt uiPartDepth ); |
---|
186 | |
---|
187 | // ------------------------------------------------------------------------------------------------------------------- |
---|
188 | // member functions for CU description |
---|
189 | // ------------------------------------------------------------------------------------------------------------------- |
---|
190 | |
---|
191 | TComPic* getPic () { return m_pcPic; } |
---|
192 | TComSlice* getSlice () { return m_pcSlice; } |
---|
193 | UInt& getAddr () { return m_uiCUAddr; } |
---|
194 | UInt& getZorderIdxInCU () { return m_uiAbsIdxInLCU; } |
---|
195 | UInt getCUPelX () { return m_uiCUPelX; } |
---|
196 | UInt getCUPelY () { return m_uiCUPelY; } |
---|
197 | TComPattern* getPattern () { return m_pcPattern; } |
---|
198 | |
---|
199 | UChar* getDepth () { return m_puhDepth; } |
---|
200 | UChar getDepth ( UInt uiIdx ) { return m_puhDepth[uiIdx]; } |
---|
201 | Void setDepth ( UInt uiIdx, UChar uh ) { m_puhDepth[uiIdx] = uh; } |
---|
202 | |
---|
203 | Int* getTextureModeDepth () { return m_piTextureModeDepth; } |
---|
204 | Int getTextureModeDepth ( UInt uiIdx ) { return m_piTextureModeDepth[uiIdx]; } |
---|
205 | Void setTextureModeDepth ( UInt uiIdx, Int iTextureModeDepth ){ m_piTextureModeDepth[uiIdx] = iTextureModeDepth; } |
---|
206 | Void setTextureModeDepthSubParts( Int iTextureModeDepth, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
207 | Void copyTextureMotionDataFrom( TComDataCU* pcCU, UInt uiDepth, UInt uiAbsPartIdxSrc, UInt uiAbsPartIdxDst = 0 ); |
---|
208 | |
---|
209 | Void setDepthSubParts ( UInt uiDepth, UInt uiAbsPartIdx ); |
---|
210 | Void getPosInPic ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY ); |
---|
211 | |
---|
212 | // ------------------------------------------------------------------------------------------------------------------- |
---|
213 | // member functions for CU data |
---|
214 | // ------------------------------------------------------------------------------------------------------------------- |
---|
215 | |
---|
216 | PartSize* getPartitionSize () { return m_pePartSize; } |
---|
217 | PartSize getPartitionSize ( UInt uiIdx ) { return m_pePartSize[uiIdx]; } |
---|
218 | Void setPartitionSize ( UInt uiIdx, PartSize uh){ m_pePartSize[uiIdx] = uh; } |
---|
219 | Void setPartSizeSubParts ( PartSize eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
220 | |
---|
221 | PredMode* getPredictionMode () { return m_pePredMode; } |
---|
222 | PredMode getPredictionMode ( UInt uiIdx ) { return m_pePredMode[uiIdx]; } |
---|
223 | Void setPredictionMode ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh; } |
---|
224 | Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
225 | |
---|
226 | UChar* getWidth () { return m_puhWidth; } |
---|
227 | UChar getWidth ( UInt uiIdx ) { return m_puhWidth[uiIdx]; } |
---|
228 | Void setWidth ( UInt uiIdx, UChar uh ) { m_puhWidth[uiIdx] = uh; } |
---|
229 | |
---|
230 | UChar* getHeight () { return m_puhHeight; } |
---|
231 | UChar getHeight ( UInt uiIdx ) { return m_puhHeight[uiIdx]; } |
---|
232 | Void setHeight ( UInt uiIdx, UChar uh ) { m_puhHeight[uiIdx] = uh; } |
---|
233 | |
---|
234 | Void setSizeSubParts ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
235 | |
---|
236 | UChar* getQP () { return m_phQP; } |
---|
237 | UChar getQP ( UInt uiIdx ) { return m_phQP[uiIdx]; } |
---|
238 | Void setQP ( UInt uiIdx, UChar uh ) { m_phQP[uiIdx] = uh; } |
---|
239 | Void setQPSubParts ( UInt uiQP, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
240 | #if SNY_DQP |
---|
241 | Bool getdQPFlag () { return m_bdQP; } |
---|
242 | Void setdQPFlag ( Bool b ) { m_bdQP = b; } |
---|
243 | #endif//SNY_DQP |
---|
244 | |
---|
245 | UChar* getTransformIdx () { return m_puhTrIdx; } |
---|
246 | UChar getTransformIdx ( UInt uiIdx ) { return m_puhTrIdx[uiIdx]; } |
---|
247 | Void setTrIdxSubParts ( UInt uiTrIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
248 | |
---|
249 | UInt getQuadtreeTULog2MinSizeInCU( UInt uiIdx ); |
---|
250 | |
---|
251 | #if HHI_RQT_FORCE_SPLIT_ACC2_PU || HHI_RQT_DISABLE_SUB |
---|
252 | UInt getQuadtreeTULog2RootSizeInCU( UInt uiIdx ); |
---|
253 | #endif |
---|
254 | |
---|
255 | TComCUMvField* getCUMvField ( RefPicList e ) { return &m_acCUMvField[e]; } |
---|
256 | |
---|
257 | TCoeff*& getCoeffY () { return m_pcTrCoeffY; } |
---|
258 | TCoeff*& getCoeffCb () { return m_pcTrCoeffCb; } |
---|
259 | TCoeff*& getCoeffCr () { return m_pcTrCoeffCr; } |
---|
260 | |
---|
261 | UChar getCbf ( UInt uiIdx, TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx]; } |
---|
262 | UChar* getCbf ( TextType eType ) { return m_puhCbf[g_aucConvertTxtTypeToIdx[eType]]; } |
---|
263 | UChar getCbf ( UInt uiIdx, TextType eType, UInt uiTrDepth ) { return ( ( getCbf( uiIdx, eType ) >> uiTrDepth ) & 0x1 ); } |
---|
264 | Void setCbf ( UInt uiIdx, TextType eType, UChar uh ) { m_puhCbf[g_aucConvertTxtTypeToIdx[eType]][uiIdx] = uh; } |
---|
265 | Void clearCbf ( UInt uiIdx, TextType eType, UInt uiNumParts ); |
---|
266 | UChar getQtRootCbf ( UInt uiIdx ) { return getCbf( uiIdx, TEXT_LUMA, 0 ) || getCbf( uiIdx, TEXT_CHROMA_U, 0 ) || getCbf( uiIdx, TEXT_CHROMA_V, 0 ); } |
---|
267 | |
---|
268 | Void setCbfSubParts ( UInt uiCbfY, UInt uiCbfU, UInt uiCbfV, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
269 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
270 | #if HHI_MRG_SKIP |
---|
271 | Void setCbfSubParts ( UInt uiCbf, TextType eTType, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
272 | #endif |
---|
273 | |
---|
274 | // ------------------------------------------------------------------------------------------------------------------- |
---|
275 | // member functions for coding tool information |
---|
276 | // ------------------------------------------------------------------------------------------------------------------- |
---|
277 | |
---|
278 | Bool* getMergeFlag () { return m_pbMergeFlag; } |
---|
279 | Bool getMergeFlag ( UInt uiIdx ) { return m_pbMergeFlag[uiIdx]; } |
---|
280 | Void setMergeFlag ( UInt uiIdx, Bool b ) { m_pbMergeFlag[uiIdx] = b; } |
---|
281 | Void setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
282 | |
---|
283 | UChar* getMergeIndex () { return m_puhMergeIndex; } |
---|
284 | UChar getMergeIndex ( UInt uiIdx ) { return m_puhMergeIndex[uiIdx]; } |
---|
285 | Void setMergeIndex ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex; } |
---|
286 | Void setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
287 | |
---|
288 | UChar* getNeighbourCandIdx ( UInt uiCandIdx ) { return m_apuhNeighbourCandIdx[uiCandIdx]; } |
---|
289 | UChar getNeighbourCandIdx ( UInt uiCandIdx, UInt uiIdx ){ return m_apuhNeighbourCandIdx[uiCandIdx][uiIdx]; } |
---|
290 | Void setNeighbourCandIdx ( UInt uiCandIdx, UInt uiIdx, UChar uhNeighCands ) { m_apuhNeighbourCandIdx[uiCandIdx][uiIdx] = uhNeighCands;} |
---|
291 | Void setNeighbourCandIdxSubParts ( UInt uiCandIdx, UChar uhNumCands, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
292 | |
---|
293 | Bool* getResPredAvail () { return m_pbResPredAvailable; } |
---|
294 | Bool getResPredAvail ( UInt uiIdx ) { return m_pbResPredAvailable[uiIdx]; } |
---|
295 | Void setResPredAvail ( UInt uiIdx, Bool b ) { m_pbResPredAvailable[uiIdx] = b; } |
---|
296 | Void setResPredAvailSubParts ( Bool b, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
297 | |
---|
298 | Bool* getResPredFlag () { return m_pbResPredFlag; } |
---|
299 | Bool getResPredFlag ( UInt uiIdx ) { return m_pbResPredFlag[uiIdx]; } |
---|
300 | Void setResPredFlag ( UInt uiIdx, Bool b ) { m_pbResPredFlag[uiIdx] = b; } |
---|
301 | Void setResPredFlagSubParts ( Bool b, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
302 | |
---|
303 | Void setResPredIndicator ( Bool bAv, Bool bRP ) { m_pbResPredAvailable[0] = bAv; m_pbResPredFlag[0] = bRP; } |
---|
304 | |
---|
305 | Void setSubPartBool ( Bool bParameter, Bool* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
306 | Void setSubPartUChar ( UInt bParameter, UChar* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx ); |
---|
307 | |
---|
308 | UChar* getLumaIntraDir () { return m_puhLumaIntraDir; } |
---|
309 | UChar getLumaIntraDir ( UInt uiIdx ) { return m_puhLumaIntraDir[uiIdx]; } |
---|
310 | Void setLumaIntraDir ( UInt uiIdx, UChar uh ) { m_puhLumaIntraDir[uiIdx] = uh; } |
---|
311 | Void setLumaIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
312 | |
---|
313 | UChar* getChromaIntraDir () { return m_puhChromaIntraDir; } |
---|
314 | UChar getChromaIntraDir ( UInt uiIdx ) { return m_puhChromaIntraDir[uiIdx]; } |
---|
315 | Void setChromaIntraDir ( UInt uiIdx, UChar uh ) { m_puhChromaIntraDir[uiIdx] = uh; } |
---|
316 | Void setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
317 | |
---|
318 | UChar* getInterDir () { return m_puhInterDir; } |
---|
319 | UChar getInterDir ( UInt uiIdx ) { return m_puhInterDir[uiIdx]; } |
---|
320 | Void setInterDir ( UInt uiIdx, UChar uh ) { m_puhInterDir[uiIdx] = uh; } |
---|
321 | Void setInterDirSubParts ( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
322 | |
---|
323 | UInt* getAlfCtrlFlag () { return m_puiAlfCtrlFlag; } |
---|
324 | UInt getAlfCtrlFlag ( UInt uiIdx ) { return m_puiAlfCtrlFlag[uiIdx]; } |
---|
325 | Void setAlfCtrlFlag ( UInt uiIdx, UInt uiFlag){ m_puiAlfCtrlFlag[uiIdx] = uiFlag; } |
---|
326 | Void setAlfCtrlFlagSubParts( UInt uiFlag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
327 | |
---|
328 | Void createTmpAlfCtrlFlag (); |
---|
329 | Void destroyTmpAlfCtrlFlag (); |
---|
330 | Void copyAlfCtrlFlagToTmp (); |
---|
331 | Void copyAlfCtrlFlagFromTmp(); |
---|
332 | |
---|
333 | #if HHI_DMM_INTRA |
---|
334 | UInt* getWedgeFullTabIdx () { return m_puiWedgeFullTabIdx; } |
---|
335 | UInt getWedgeFullTabIdx ( UInt uiIdx ) { return m_puiWedgeFullTabIdx[uiIdx]; } |
---|
336 | Void setWedgeFullTabIdx ( UInt uiIdx, UInt uh ) { m_puiWedgeFullTabIdx[uiIdx] = uh; } |
---|
337 | Void setWedgeFullTabIdxSubParts ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
338 | |
---|
339 | Int* getWedgeFullDeltaDC1 () { return m_piWedgeFullDeltaDC1; } |
---|
340 | Int getWedgeFullDeltaDC1 ( UInt uiIdx ) { return m_piWedgeFullDeltaDC1[uiIdx]; } |
---|
341 | Void setWedgeFullDeltaDC1 ( UInt uiIdx, Int i ) { m_piWedgeFullDeltaDC1[uiIdx] = i; } |
---|
342 | Void setWedgeFullDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
343 | |
---|
344 | Int* getWedgeFullDeltaDC2 () { return m_piWedgeFullDeltaDC2; } |
---|
345 | Int getWedgeFullDeltaDC2 ( UInt uiIdx ) { return m_piWedgeFullDeltaDC2[uiIdx]; } |
---|
346 | Void setWedgeFullDeltaDC2 ( UInt uiIdx, Int i ) { m_piWedgeFullDeltaDC2[uiIdx] = i; } |
---|
347 | Void setWedgeFullDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
348 | |
---|
349 | UInt* getWedgePredDirTabIdx () { return m_puiWedgePredDirTabIdx; } |
---|
350 | UInt getWedgePredDirTabIdx ( UInt uiIdx ) { return m_puiWedgePredDirTabIdx[uiIdx]; } |
---|
351 | Void setWedgePredDirTabIdx ( UInt uiIdx, UInt uh ) { m_puiWedgePredDirTabIdx[uiIdx] = uh; } |
---|
352 | Void setWedgePredDirTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
353 | |
---|
354 | Int* getWedgePredDirDeltaDC1 () { return m_piWedgePredDirDeltaDC1; } |
---|
355 | Int getWedgePredDirDeltaDC1 ( UInt uiIdx ) { return m_piWedgePredDirDeltaDC1[uiIdx]; } |
---|
356 | Void setWedgePredDirDeltaDC1 ( UInt uiIdx, Int i ) { m_piWedgePredDirDeltaDC1[uiIdx] = i; } |
---|
357 | Void setWedgePredDirDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
358 | |
---|
359 | Int* getWedgePredDirDeltaDC2 () { return m_piWedgePredDirDeltaDC2; } |
---|
360 | Int getWedgePredDirDeltaDC2 ( UInt uiIdx ) { return m_piWedgePredDirDeltaDC2[uiIdx]; } |
---|
361 | Void setWedgePredDirDeltaDC2 ( UInt uiIdx, Int i ) { m_piWedgePredDirDeltaDC2[uiIdx] = i; } |
---|
362 | Void setWedgePredDirDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
363 | |
---|
364 | Int* getWedgePredDirDeltaEnd () { return m_piWedgePredDirDeltaEnd; } |
---|
365 | Int getWedgePredDirDeltaEnd ( UInt uiIdx ) { return m_piWedgePredDirDeltaEnd[uiIdx]; } |
---|
366 | Void setWedgePredDirDeltaEnd ( UInt uiIdx, Int iD ) { m_piWedgePredDirDeltaEnd[uiIdx] = iD; } |
---|
367 | Void setWedgePredDirDeltaEndSubParts( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
368 | |
---|
369 | UInt* getWedgePredTexTabIdx () { return m_puiWedgePredTexTabIdx; } |
---|
370 | UInt getWedgePredTexTabIdx ( UInt uiIdx ) { return m_puiWedgePredTexTabIdx[uiIdx]; } |
---|
371 | Void setWedgePredTexTabIdx ( UInt uiIdx, UInt uh ) { m_puiWedgePredTexTabIdx[uiIdx] = uh; } |
---|
372 | Void setWedgePredTexTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
373 | |
---|
374 | Int* getWedgePredTexDeltaDC1 () { return m_piWedgePredTexDeltaDC1; } |
---|
375 | Int getWedgePredTexDeltaDC1 ( UInt uiIdx ) { return m_piWedgePredTexDeltaDC1[uiIdx]; } |
---|
376 | Void setWedgePredTexDeltaDC1 ( UInt uiIdx, Int i ) { m_piWedgePredTexDeltaDC1[uiIdx] = i; } |
---|
377 | Void setWedgePredTexDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
378 | |
---|
379 | Int* getWedgePredTexDeltaDC2 () { return m_piWedgePredTexDeltaDC2; } |
---|
380 | Int getWedgePredTexDeltaDC2 ( UInt uiIdx ) { return m_piWedgePredTexDeltaDC2[uiIdx]; } |
---|
381 | Void setWedgePredTexDeltaDC2 ( UInt uiIdx, Int i ) { m_piWedgePredTexDeltaDC2[uiIdx] = i; } |
---|
382 | Void setWedgePredTexDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
383 | |
---|
384 | Int* getContourPredTexDeltaDC1 () { return m_piContourPredTexDeltaDC1; } |
---|
385 | Int getContourPredTexDeltaDC1 ( UInt uiIdx ) { return m_piContourPredTexDeltaDC1[uiIdx]; } |
---|
386 | Void setContourPredTexDeltaDC1 ( UInt uiIdx, Int i ) { m_piContourPredTexDeltaDC1[uiIdx] = i; } |
---|
387 | Void setContourPredTexDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
388 | |
---|
389 | Int* getContourPredTexDeltaDC2 () { return m_piContourPredTexDeltaDC2; } |
---|
390 | Int getContourPredTexDeltaDC2 ( UInt uiIdx ) { return m_piContourPredTexDeltaDC2[uiIdx]; } |
---|
391 | Void setContourPredTexDeltaDC2 ( UInt uiIdx, Int i ) { m_piContourPredTexDeltaDC2[uiIdx] = i; } |
---|
392 | Void setContourPredTexDeltaDC2SubParts( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
393 | |
---|
394 | Bool* getTextureModeAllowance () { return m_pbTextureModesAllowed; } |
---|
395 | Bool getTextureModeAllowance ( UInt uiIdx ) { return m_pbTextureModesAllowed[uiIdx]; } |
---|
396 | Void setTextureModeAllowance ( UInt uiIdx, Bool b ) { m_pbTextureModesAllowed[uiIdx] = b; } |
---|
397 | Void setTextureModeAllowanceSubParts ( Bool bTMAllowed, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
398 | #endif |
---|
399 | |
---|
400 | Int getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv ); |
---|
401 | Bool getPdmMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge = false ); |
---|
402 | Bool getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv ); |
---|
403 | Bool getResidualSamples( UInt uiPartIdx, TComYuv* pcYuv = 0 ); |
---|
404 | |
---|
405 | // ------------------------------------------------------------------------------------------------------------------- |
---|
406 | // member functions for accessing partition information |
---|
407 | // ------------------------------------------------------------------------------------------------------------------- |
---|
408 | |
---|
409 | Void getPartIndexAndSize ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight ); |
---|
410 | UChar getNumPartInter (); |
---|
411 | Bool isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth); |
---|
412 | |
---|
413 | // ------------------------------------------------------------------------------------------------------------------- |
---|
414 | // member functions for motion vector |
---|
415 | // ------------------------------------------------------------------------------------------------------------------- |
---|
416 | |
---|
417 | Void getMvField ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList, TComMvField& rcMvField ); |
---|
418 | |
---|
419 | AMVP_MODE getAMVPMode ( UInt uiIdx ); |
---|
420 | Void fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo ); |
---|
421 | #if DCM_SIMPLIFIED_MVP==0 |
---|
422 | Bool clearMVPCand ( TComMv cMvd, AMVPInfo* pInfo ); |
---|
423 | #endif |
---|
424 | Int searchMVPIdx ( TComMv cMv, AMVPInfo* pInfo ); |
---|
425 | |
---|
426 | Void setMVPIdx ( RefPicList eRefPicList, UInt uiIdx, Int iMVPIdx) { m_apiMVPIdx[eRefPicList][uiIdx] = iMVPIdx; } |
---|
427 | Int getMVPIdx ( RefPicList eRefPicList, UInt uiIdx) { return m_apiMVPIdx[eRefPicList][uiIdx]; } |
---|
428 | Int* getMVPIdx ( RefPicList eRefPicList ) { return m_apiMVPIdx[eRefPicList]; } |
---|
429 | |
---|
430 | Void setMVPNum ( RefPicList eRefPicList, UInt uiIdx, Int iMVPNum ) { m_apiMVPNum[eRefPicList][uiIdx] = iMVPNum; } |
---|
431 | Int getMVPNum ( RefPicList eRefPicList, UInt uiIdx ) { return m_apiMVPNum[eRefPicList][uiIdx]; } |
---|
432 | Int* getMVPNum ( RefPicList eRefPicList ) { return m_apiMVPNum[eRefPicList]; } |
---|
433 | |
---|
434 | Void setMVPIdxSubParts ( Int iMVPIdx, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
435 | Void setMVPNumSubParts ( Int iMVPNum, RefPicList eRefPicList, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); |
---|
436 | |
---|
437 | Void clipMv ( TComMv& rcMv ); |
---|
438 | Void getMvPredLeft ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldA.getMv(); } |
---|
439 | Void getMvPredAbove ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldB.getMv(); } |
---|
440 | Void getMvPredAboveRight ( TComMv& rcMvPred ) { rcMvPred = m_cMvFieldC.getMv(); } |
---|
441 | |
---|
442 | #if AMVP_BUFFERCOMPRESS |
---|
443 | Void compressMV (); |
---|
444 | #endif |
---|
445 | |
---|
446 | // ------------------------------------------------------------------------------------------------------------------- |
---|
447 | // utility functions for neighbouring information |
---|
448 | // ------------------------------------------------------------------------------------------------------------------- |
---|
449 | |
---|
450 | TComDataCU* getCULeft () { return m_pcCULeft; } |
---|
451 | TComDataCU* getCUAbove () { return m_pcCUAbove; } |
---|
452 | TComDataCU* getCUAboveLeft () { return m_pcCUAboveLeft; } |
---|
453 | TComDataCU* getCUAboveRight () { return m_pcCUAboveRight; } |
---|
454 | TComDataCU* getCUColocated ( RefPicList eRefPicList ) { return m_apcCUColocated[eRefPicList]; } |
---|
455 | |
---|
456 | TComDataCU* getPULeft ( UInt& uiLPartUnitIdx , UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
457 | TComDataCU* getPUAbove ( UInt& uiAPartUnitIdx , UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
458 | TComDataCU* getPUAboveLeft ( UInt& uiALPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
459 | TComDataCU* getPUAboveRight ( UInt& uiARPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
460 | TComDataCU* getPUBelowLeft ( UInt& uiBLPartUnitIdx, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
461 | |
---|
462 | #if CONSTRAINED_INTRA_PRED |
---|
463 | TComDataCU* getPUAboveRightAdi ( UInt& uiARPartUnitIdx, UInt uiPuWidth, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
464 | TComDataCU* getPUBelowLeftAdi ( UInt& uiBLPartUnitIdx, UInt uiPuHeight, UInt uiCurrPartUnitIdx, UInt uiPartUnitOffset = 1, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
465 | #else |
---|
466 | TComDataCU* getPUAboveRightAdi ( UInt& uiARPartUnitIdx, UInt uiPuWidth, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
467 | TComDataCU* getPUBelowLeftAdi ( UInt& uiBLPartUnitIdx, UInt uiPuHeight, UInt uiCurrPartUnitIdx, Bool bEnforceSliceRestriction=true, Bool bEnforceEntropySliceRestriction=true ); |
---|
468 | #endif |
---|
469 | |
---|
470 | Void deriveLeftRightTopIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
471 | Void deriveLeftBottomIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
472 | |
---|
473 | Void deriveLeftRightTopIdxAdi ( UInt& ruiPartIdxLT, UInt& ruiPartIdxRT, UInt uiPartOffset, UInt uiPartDepth ); |
---|
474 | Void deriveLeftBottomIdxAdi ( UInt& ruiPartIdxLB, UInt uiPartOffset, UInt uiPartDepth ); |
---|
475 | |
---|
476 | Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); |
---|
477 | Bool avoidMergeCandidate ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); |
---|
478 | Bool hasEqualMotion ( UInt uiAbsPartIdx, UInt uiCandInterDir, Int* paiCandRefIdx, TComMv* pacCandMv ); |
---|
479 | Bool avoidMergeCandidate ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, UInt uiCandInterDir, Int* paiCandRefIdx, TComMv* pacCandMv ); |
---|
480 | Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, UInt* puiNeighbourCandIdx ); |
---|
481 | Void deriveLeftRightTopIdxGeneral ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT ); |
---|
482 | Void deriveLeftBottomIdxGeneral ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB ); |
---|
483 | |
---|
484 | |
---|
485 | // ------------------------------------------------------------------------------------------------------------------- |
---|
486 | // member functions for modes |
---|
487 | // ------------------------------------------------------------------------------------------------------------------- |
---|
488 | |
---|
489 | Bool isIntra ( UInt uiPartIdx ) { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } |
---|
490 | Bool isSkipped ( UInt uiPartIdx ); ///< SKIP (no residual) |
---|
491 | |
---|
492 | // ------------------------------------------------------------------------------------------------------------------- |
---|
493 | // member functions for symbol prediction (most probable / mode conversion) |
---|
494 | // ------------------------------------------------------------------------------------------------------------------- |
---|
495 | |
---|
496 | Int getMostProbableIntraDirLuma ( UInt uiAbsPartIdx ); |
---|
497 | |
---|
498 | UInt getIntraSizeIdx ( UInt uiAbsPartIdx ); |
---|
499 | Void convertTransIdx ( UInt uiAbsPartIdx, UInt uiTrIdx, UInt& ruiLumaTrMode, UInt& ruiChromaTrMode ); |
---|
500 | |
---|
501 | #if LCEC_INTRA_MODE |
---|
502 | Int getLeftIntraDirLuma ( UInt uiAbsPartIdx ); |
---|
503 | Int getAboveIntraDirLuma ( UInt uiAbsPartIdx ); |
---|
504 | #endif |
---|
505 | |
---|
506 | #if MTK_DCM_MPM |
---|
507 | Int getIntraDirLumaPredictor ( UInt uiAbsPartIdx, Int uiIntraDirPred[] ); |
---|
508 | #endif |
---|
509 | |
---|
510 | #if MS_LCEC_LOOKUP_TABLE_EXCEPTION |
---|
511 | Bool isSuroundingRefIdxException ( UInt uiAbsPartIdx ); |
---|
512 | #endif |
---|
513 | |
---|
514 | // ------------------------------------------------------------------------------------------------------------------- |
---|
515 | // member functions for SBAC context |
---|
516 | // ------------------------------------------------------------------------------------------------------------------- |
---|
517 | |
---|
518 | UInt getCtxSplitFlag ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
519 | #if MW_MVI_SIGNALLING_MODE == 0 |
---|
520 | UInt getCtxMvInheritanceFlag ( UInt uiAbsPartIdx, UInt uiDepth ); |
---|
521 | #endif |
---|
522 | UInt getCtxCbf ( UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth ); |
---|
523 | UInt getCtxQtCbf ( UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth ); |
---|
524 | UInt getCtxQtRootCbf ( UInt uiAbsPartIdx ); |
---|
525 | UInt getCtxRefIdx ( UInt uiAbsPartIdx, RefPicList eRefPicList ); |
---|
526 | UInt getCtxSkipFlag ( UInt uiAbsPartIdx ); |
---|
527 | UInt getCtxAlfCtrlFlag ( UInt uiAbsPartIdx ); |
---|
528 | UInt getCtxInterDir ( UInt uiAbsPartIdx ); |
---|
529 | UInt getCtxIntraDirChroma ( UInt uiAbsPartIdx ); |
---|
530 | UInt getCtxMergeFlag ( UInt uiAbsPartIdx ); |
---|
531 | |
---|
532 | Void setSliceStartCU ( UInt uiStartCU ) { m_uiSliceStartCU = uiStartCU; } |
---|
533 | UInt getSliceStartCU () { return m_uiSliceStartCU; } |
---|
534 | Void setEntropySliceStartCU ( UInt uiStartCU ) { m_uiEntropySliceStartCU = uiStartCU; } |
---|
535 | UInt getEntropySliceStartCU () { return m_uiEntropySliceStartCU; } |
---|
536 | |
---|
537 | // ------------------------------------------------------------------------------------------------------------------- |
---|
538 | // member functions for RD cost storage |
---|
539 | // ------------------------------------------------------------------------------------------------------------------- |
---|
540 | |
---|
541 | Double& getTotalCost() { return m_dTotalCost; } |
---|
542 | Dist& getTotalDistortion() { return m_uiTotalDistortion; } |
---|
543 | UInt& getTotalBits() { return m_uiTotalBits; } |
---|
544 | UInt& getTotalNumPart() { return m_uiNumPartition; } |
---|
545 | |
---|
546 | #if QC_MDCS |
---|
547 | UInt getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra); |
---|
548 | #endif //QC_MDCS |
---|
549 | |
---|
550 | }; |
---|
551 | |
---|
552 | #endif |
---|
553 | |
---|