1 | |
---|
2 | |
---|
3 | /** \file TComAdaptiveLoopFilter.h |
---|
4 | \brief adaptive loop filter class (header) |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef __TCOMADAPTIVELOOPFILTER__ |
---|
8 | #define __TCOMADAPTIVELOOPFILTER__ |
---|
9 | |
---|
10 | #include "TComPic.h" |
---|
11 | |
---|
12 | // ==================================================================================================================== |
---|
13 | // Constants |
---|
14 | // ==================================================================================================================== |
---|
15 | |
---|
16 | #define ALF_MAX_NUM_TAP 9 ///< maximum number of filter taps (9x9) |
---|
17 | #define ALF_MIN_NUM_TAP 5 ///< minimum number of filter taps (5x5) |
---|
18 | #define ALF_MAX_NUM_TAP_C 5 ///< number of filter taps for chroma (5x5) |
---|
19 | #define ALF_MAX_NUM_COEF 42 ///< maximum number of filter coefficients |
---|
20 | #define ALF_MIN_NUM_COEF 14 ///< minimum number of filter coefficients |
---|
21 | #define ALF_MAX_NUM_COEF_C 14 ///< number of filter taps for chroma |
---|
22 | #define ALF_NUM_BIT_SHIFT 8 ///< bit shift parameter for quantization of ALF param. |
---|
23 | #define ALF_ROUND_OFFSET ( 1 << ( ALF_NUM_BIT_SHIFT - 1 ) ) ///< rounding offset for ALF quantization |
---|
24 | |
---|
25 | #include "../TLibCommon/CommonDef.h" |
---|
26 | |
---|
27 | #define NUM_BITS 9 |
---|
28 | #define NO_TEST_FILT 3 // Filter supports (5/7/9) |
---|
29 | #define NO_VAR_BINS 16 |
---|
30 | #define NO_FILTERS 16 |
---|
31 | |
---|
32 | #if MQT_BA_RA |
---|
33 | #define VAR_SIZE 1 // JCTVC-E323+E046 |
---|
34 | #else |
---|
35 | #define VAR_SIZE 3 |
---|
36 | #endif |
---|
37 | |
---|
38 | #define FILTER_LENGTH 9 |
---|
39 | |
---|
40 | #define MAX_SQR_FILT_LENGTH ((FILTER_LENGTH*FILTER_LENGTH) / 2 + 2) |
---|
41 | #if TI_ALF_MAX_VSIZE_7 |
---|
42 | #define SQR_FILT_LENGTH_9SYM ((9*9) / 4 + 2 - 1) |
---|
43 | #else |
---|
44 | #define SQR_FILT_LENGTH_9SYM ((9*9) / 4 + 2) |
---|
45 | #endif |
---|
46 | #define SQR_FILT_LENGTH_7SYM ((7*7) / 4 + 2) |
---|
47 | #define SQR_FILT_LENGTH_5SYM ((5*5) / 4 + 2) |
---|
48 | #define MAX_SCAN_VAL 11 |
---|
49 | #define MAX_EXP_GOLOMB 16 |
---|
50 | |
---|
51 | #define min(a, b) (((a) < (b)) ? (a) : (b)) |
---|
52 | #define max(a, b) (((a) > (b)) ? (a) : (b)) |
---|
53 | #define imgpel unsigned short |
---|
54 | |
---|
55 | #if TI_ALF_MAX_VSIZE_7 |
---|
56 | extern Int depthInt9x9Sym[21]; |
---|
57 | #else |
---|
58 | extern Int depthInt9x9Sym[22]; |
---|
59 | #endif |
---|
60 | extern Int depthInt7x7Sym[14]; |
---|
61 | extern Int depthInt5x5Sym[8]; |
---|
62 | extern Int *pDepthIntTab[NO_TEST_FILT]; |
---|
63 | void destroyMatrix_int(int **m2D); |
---|
64 | void initMatrix_int(int ***m2D, int d1, int d2); |
---|
65 | |
---|
66 | #if MTK_NONCROSS_INLOOP_FILTER |
---|
67 | #define EXTEND_NUM_PEL (UInt)(ALF_MAX_NUM_TAP/2) |
---|
68 | #define EXTEND_NUM_PEL_C (UInt)(ALF_MAX_NUM_TAP_C/2) |
---|
69 | enum PaddingRegionPosition |
---|
70 | { |
---|
71 | PRP_L = 0, |
---|
72 | PRP_R, |
---|
73 | PRP_T, |
---|
74 | PRP_B, |
---|
75 | NUM_PADDING_TILE, |
---|
76 | PRP_LT = NUM_PADDING_TILE, |
---|
77 | PRP_RT, |
---|
78 | PRP_LB, |
---|
79 | PRP_RB, |
---|
80 | NUM_PADDING_REGION |
---|
81 | }; |
---|
82 | enum AlfChromaID |
---|
83 | { |
---|
84 | ALF_Cb = 0, |
---|
85 | ALF_Cr = 1 |
---|
86 | }; |
---|
87 | #endif |
---|
88 | |
---|
89 | #if MQT_BA_RA |
---|
90 | enum ALFClassficationMethod |
---|
91 | { |
---|
92 | ALF_BA =0, |
---|
93 | ALF_RA, |
---|
94 | NUM_ALF_CLASS_METHOD |
---|
95 | }; |
---|
96 | #endif |
---|
97 | // ==================================================================================================================== |
---|
98 | // Class definition |
---|
99 | // ==================================================================================================================== |
---|
100 | |
---|
101 | #if MTK_SAO |
---|
102 | |
---|
103 | #define CRANGE_EXT 512 |
---|
104 | #define CRANGE 4096 |
---|
105 | #define CRANGE_ALL (CRANGE + (CRANGE_EXT*2)) |
---|
106 | #define AO_MAX_DEPTH 4 |
---|
107 | #define MAX_NUM_QAO_PART 341 |
---|
108 | #define MTK_QAO_BO_BITS 5 |
---|
109 | #define LUMA_GROUP_NUM (1<<MTK_QAO_BO_BITS) |
---|
110 | #define MAX_NUM_QAO_CLASS 32 |
---|
111 | #define SAO_RDCO 0 |
---|
112 | |
---|
113 | class TComSampleAdaptiveOffset |
---|
114 | { |
---|
115 | protected: |
---|
116 | TComPic* m_pcPic; |
---|
117 | |
---|
118 | |
---|
119 | static UInt m_uiMaxDepth; |
---|
120 | static const Int m_aiNumPartsInRow[5]; |
---|
121 | static const Int m_aiNumPartsLevel[5]; |
---|
122 | static const Int m_aiNumCulPartsLevel[5]; |
---|
123 | static const UInt m_auiEoTable[9]; |
---|
124 | static const UInt m_auiEoTable2D[9]; |
---|
125 | static const UInt m_iWeightAO[MAX_NUM_SAO_TYPE]; |
---|
126 | Int m_iOffsetBo[4096]; |
---|
127 | Int m_iOffsetEo[LUMA_GROUP_NUM]; |
---|
128 | |
---|
129 | Int m_iPicWidth; |
---|
130 | Int m_iPicHeight; |
---|
131 | UInt m_uiMaxSplitLevel; |
---|
132 | UInt m_uiMaxCUWidth; |
---|
133 | UInt m_uiMaxCUHeight; |
---|
134 | Int m_iNumCuInWidth; |
---|
135 | Int m_iNumCuInHeight; |
---|
136 | Int m_iNumTotalParts; |
---|
137 | static Int m_iNumClass[MAX_NUM_SAO_TYPE]; |
---|
138 | |
---|
139 | Bool m_bSaoFlag; |
---|
140 | SAOQTPart *m_psQAOPart; |
---|
141 | |
---|
142 | SliceType m_eSliceType; |
---|
143 | Int m_iPicNalReferenceIdc; |
---|
144 | |
---|
145 | UInt m_uiAoBitDepth; |
---|
146 | UInt m_uiQP; |
---|
147 | |
---|
148 | Bool m_bBcEnable; |
---|
149 | Int m_iMinY; |
---|
150 | Int m_iMaxY; |
---|
151 | Int m_iMinCb; |
---|
152 | Int m_iMaxCb; |
---|
153 | Int m_iMinCr; |
---|
154 | Int m_iMaxCr; |
---|
155 | Pel *m_pClipTable; |
---|
156 | Pel m_pClipTableBase[CRANGE_ALL]; |
---|
157 | Pel *m_ppLumaTableBo0; |
---|
158 | Pel *m_ppLumaTableBo1; |
---|
159 | |
---|
160 | Int *m_iUpBuff1; |
---|
161 | Int *m_iUpBuff2; |
---|
162 | Int *m_iUpBufft; |
---|
163 | Int *ipSwap; |
---|
164 | |
---|
165 | public: |
---|
166 | Void create( UInt uiSourceWidth, UInt uiSourceHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth ); |
---|
167 | Void destroy (); |
---|
168 | Void xCreateQAOParts(); |
---|
169 | Void xDestroyQAOParts(); |
---|
170 | Void xInitALfOnePart(Int part_level, Int part_row, Int part_col, Int parent_part_idx, Int StartCUX, Int EndCUX, Int StartCUY, Int EndCUY); |
---|
171 | Void xMakeSubPartList(Int part_level, Int part_row, Int part_col, Int* pList, Int& rListLength, Int NumPartInRow); |
---|
172 | Void xSetQTPartCUInfo(); |
---|
173 | |
---|
174 | Bool getQAOFlag () {return m_bSaoFlag;} |
---|
175 | Int getMaxSplitLevel() {return (Int)m_uiMaxSplitLevel;} |
---|
176 | SAOQTPart * getQTPart() {return m_psQAOPart;} |
---|
177 | |
---|
178 | Void SAOProcess(TComPic* pcPic, SAOParam* pcQaoParam); |
---|
179 | Void resetQTPart(); |
---|
180 | Void xAoOnePart(UInt uiPartIdx, TComPicYuv* pcPicYuvRec, TComPicYuv* pcPicYuvExt); |
---|
181 | Void xProcessQuadTreeAo(UInt uiPartIdx, TComPicYuv* pcPicYuvRec, TComPicYuv* pcPicYuvExt); |
---|
182 | Void copyQaoData(SAOParam* pcQaoParam); |
---|
183 | |
---|
184 | Void InitSao(SAOParam* pSaoParam); |
---|
185 | Void AoProcessCu(Int iAddr, Int iPartIdx); |
---|
186 | }; |
---|
187 | #endif |
---|
188 | |
---|
189 | |
---|
190 | #if MTK_NONCROSS_INLOOP_FILTER |
---|
191 | |
---|
192 | class CAlfCU |
---|
193 | { |
---|
194 | public: |
---|
195 | CAlfCU() {} |
---|
196 | ~CAlfCU() {} |
---|
197 | public: |
---|
198 | // Void init(TComDataCU* pcCU, UInt uiCUAddr, UInt uiStartCU, UInt uiEndCU, UInt uiNumCUWidth, UInt uiNumCUHeight); |
---|
199 | Void init(TComPic* pcPic, UInt uiCUAddr, UInt uiStartCU, UInt uiEndCU, UInt uiNumCUWidth, UInt uiNumCUHeight); |
---|
200 | TComDataCU* getCU() {return m_pcCU;} |
---|
201 | UInt getWidth() {return m_uiWidth;} |
---|
202 | UInt getHeight() {return m_uiHeight;} |
---|
203 | Int* getCUBorderFlag() {return m_aiCUBorderFlag;} |
---|
204 | Void extendCUBorder(Pel* pCUPel, UInt uiCUWidth, UInt uiCUHeight, Int iStride, UInt uiExtSize); |
---|
205 | private: |
---|
206 | Void assignBorderStatus(UInt uiStartCU, UInt uiEndCU, UInt uiNumCUWidth, UInt uiNumCUHeight); |
---|
207 | |
---|
208 | private: |
---|
209 | TComDataCU* m_pcCU; |
---|
210 | |
---|
211 | UInt m_uiCUAddr; |
---|
212 | Int m_aiCUBorderFlag[NUM_PADDING_REGION]; |
---|
213 | UInt m_uiWidth; |
---|
214 | UInt m_uiHeight; |
---|
215 | }; |
---|
216 | |
---|
217 | class CAlfSlice |
---|
218 | { |
---|
219 | public: |
---|
220 | CAlfSlice() |
---|
221 | { |
---|
222 | m_pcAlfCU= NULL; |
---|
223 | } |
---|
224 | ~CAlfSlice() |
---|
225 | { |
---|
226 | destroy(); |
---|
227 | } |
---|
228 | public: //operator to access CAlfCU |
---|
229 | CAlfCU& operator[] (Int idx) |
---|
230 | { |
---|
231 | assert(idx < m_uiNumLCUs); |
---|
232 | return m_pcAlfCU[idx]; |
---|
233 | } |
---|
234 | |
---|
235 | public: |
---|
236 | Void init(UInt uiNumLCUsInPicWidth, UInt uiNumLCUsInPicHeight); |
---|
237 | Void create(TComPic* pcPic, Int iSliceID, UInt uiStartLCU, UInt uiEndLCU); |
---|
238 | Void destroy(); |
---|
239 | |
---|
240 | UInt getNumLCUs () {return m_uiNumLCUs;} |
---|
241 | |
---|
242 | Void extendSliceBorderLuma(Pel* pPelSrc, Int iStride, UInt uiExtSize); |
---|
243 | Void extendSliceBorderChroma(Pel* pPelSrc, Int iStride, UInt uiExtSize); |
---|
244 | Void copySliceLuma(Pel* pPicDst, Pel* pPicSrc, Int iStride); |
---|
245 | Void copySliceChroma(Pel* pPicDst, Pel* pPicSrc, Int iStride ); |
---|
246 | |
---|
247 | private: |
---|
248 | |
---|
249 | Int m_iSliceID; |
---|
250 | UInt m_uiStartLCU; |
---|
251 | UInt m_uiEndLCU; |
---|
252 | UInt m_uiNumLCUs; |
---|
253 | |
---|
254 | CAlfCU* m_pcAlfCU; |
---|
255 | |
---|
256 | //----------------------------------------// |
---|
257 | UInt m_uiNumLCUsInPicWidth; |
---|
258 | UInt m_uiNumLCUsInPicHeight; |
---|
259 | }; |
---|
260 | |
---|
261 | #endif |
---|
262 | |
---|
263 | |
---|
264 | /// adaptive loop filter class |
---|
265 | class TComAdaptiveLoopFilter |
---|
266 | { |
---|
267 | protected: |
---|
268 | // quantized filter coefficients |
---|
269 | static const Int m_aiSymmetricMag9x9[41]; ///< quantization scaling factor for 9x9 filter |
---|
270 | static const Int m_aiSymmetricMag7x7[25]; ///< quantization scaling factor for 7x7 filter |
---|
271 | static const Int m_aiSymmetricMag5x5[13]; ///< quantization scaling factor for 5x5 filter |
---|
272 | #if TI_ALF_MAX_VSIZE_7 |
---|
273 | static const Int m_aiSymmetricMag9x7[32]; ///< quantization scaling factor for 9x7 filter |
---|
274 | #endif |
---|
275 | |
---|
276 | // temporary picture buffer |
---|
277 | TComPicYuv* m_pcTempPicYuv; ///< temporary picture buffer for ALF processing |
---|
278 | |
---|
279 | // ------------------------------------------------------------------------------------------------------------------ |
---|
280 | // For luma component |
---|
281 | // ------------------------------------------------------------------------------------------------------------------ |
---|
282 | #if TI_ALF_MAX_VSIZE_7 |
---|
283 | static Int m_pattern9x9Sym[39]; |
---|
284 | static Int m_weights9x9Sym[21]; |
---|
285 | #else |
---|
286 | static Int m_pattern9x9Sym[41]; |
---|
287 | static Int m_weights9x9Sym[22]; |
---|
288 | #endif |
---|
289 | static Int m_pattern9x9Sym_Quart[42]; |
---|
290 | static Int m_pattern7x7Sym[25]; |
---|
291 | static Int m_weights7x7Sym[14]; |
---|
292 | static Int m_pattern7x7Sym_Quart[42]; |
---|
293 | static Int m_pattern5x5Sym[13]; |
---|
294 | static Int m_weights5x5Sym[8]; |
---|
295 | static Int m_pattern5x5Sym_Quart[45]; |
---|
296 | #if TI_ALF_MAX_VSIZE_7 |
---|
297 | static Int m_pattern9x9Sym_9[39]; |
---|
298 | #else |
---|
299 | static Int m_pattern9x9Sym_9[41]; |
---|
300 | #endif |
---|
301 | static Int m_pattern9x9Sym_7[25]; |
---|
302 | static Int m_pattern9x9Sym_5[13]; |
---|
303 | |
---|
304 | static Int *m_patternTab_filt[NO_TEST_FILT]; |
---|
305 | static Int m_flTab[NO_TEST_FILT]; |
---|
306 | static Int *m_patternTab[NO_TEST_FILT]; |
---|
307 | static Int *m_patternMapTab[NO_TEST_FILT]; |
---|
308 | static Int *m_weightsTab[NO_TEST_FILT]; |
---|
309 | static Int m_sqrFiltLengthTab[NO_TEST_FILT]; |
---|
310 | |
---|
311 | Int m_img_height,m_img_width; |
---|
312 | |
---|
313 | imgpel **m_imgY_pad; |
---|
314 | imgpel **m_imgY_var; |
---|
315 | Int **m_imgY_temp; |
---|
316 | |
---|
317 | #if MQT_BA_RA |
---|
318 | Int** m_imgY_ver; |
---|
319 | Int** m_imgY_hor; |
---|
320 | UInt m_uiVarGenMethod; |
---|
321 | imgpel** m_varImgMethods[NUM_ALF_CLASS_METHOD]; |
---|
322 | #endif |
---|
323 | |
---|
324 | Int **m_filterCoeffSym; |
---|
325 | Int **m_filterCoeffPrevSelected; |
---|
326 | Int **m_filterCoeffTmp; |
---|
327 | Int **m_filterCoeffSymTmp; |
---|
328 | |
---|
329 | |
---|
330 | #if MTK_NONCROSS_INLOOP_FILTER |
---|
331 | Bool m_bUseNonCrossALF; |
---|
332 | UInt m_uiNumLCUsInWidth; |
---|
333 | UInt m_uiNumLCUsInHeight; |
---|
334 | UInt m_uiNumSlicesInPic; |
---|
335 | CAlfSlice* m_pSlice; |
---|
336 | Bool m_bIsFirstDecodedSlice; |
---|
337 | |
---|
338 | #if SB_MEM_FIX |
---|
339 | Bool m_bIsCreated; |
---|
340 | #endif |
---|
341 | Void xFilterOneSlice (CAlfSlice* pSlice, imgpel* pDec, imgpel* pRest, Int iStride, ALFParam* pcAlfParam); |
---|
342 | Void calcVarforOneSlice (CAlfSlice* pSlice, imgpel **imgY_var, imgpel *imgY_pad, Int pad_size, Int fl, Int img_stride); |
---|
343 | Void xFrameChromaforOneSlice (CAlfSlice* pSlice, Int ComponentID, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, Int *qh, Int iTap); |
---|
344 | //for decoder CU on/off control |
---|
345 | Void setAlfCtrlFlagsforSlices (ALFParam *pcAlfParam, UInt &idx); |
---|
346 | Void setAlfCtrlFlagsforOneSlice (CAlfSlice* pSlice, ALFParam *pcAlfParam, UInt &idx); |
---|
347 | #endif |
---|
348 | |
---|
349 | #if MQT_BA_RA |
---|
350 | Void createRegionIndexMap(imgpel **imgY_var, Int img_width, Int img_height); |
---|
351 | #endif |
---|
352 | |
---|
353 | /// ALF for luma component |
---|
354 | Void xALFLuma_qc( TComPic* pcPic, ALFParam* pcAlfParam, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest ); |
---|
355 | |
---|
356 | Void reconstructFilterCoeffs(ALFParam* pcAlfParam,int **pfilterCoeffSym, int bit_depth); |
---|
357 | Void getCurrentFilter(int **filterCoeffSym,ALFParam* pcAlfParam); |
---|
358 | // memory allocation |
---|
359 | Void destroyMatrix_imgpel(imgpel **m2D); |
---|
360 | Void destroyMatrix_int(int **m2D); |
---|
361 | Void initMatrix_int(int ***m2D, int d1, int d2); |
---|
362 | Void initMatrix_imgpel(imgpel ***m2D, int d1, int d2); |
---|
363 | Void destroyMatrix4D_double(double ****m4D, int d1, int d2); |
---|
364 | Void destroyMatrix3D_double(double ***m3D, int d1); |
---|
365 | Void destroyMatrix_double(double **m2D); |
---|
366 | Void initMatrix4D_double(double *****m4D, int d1, int d2, int d3, int d4); |
---|
367 | Void initMatrix3D_double(double ****m3D, int d1, int d2, int d3); |
---|
368 | Void initMatrix_double(double ***m2D, int d1, int d2); |
---|
369 | Void free_mem2Dpel(imgpel **array2D); |
---|
370 | Void get_mem2Dpel(imgpel ***array2D, int rows, int columns); |
---|
371 | Void no_mem_exit(const char *where); |
---|
372 | Void xError(const char *text, int code); |
---|
373 | #if MTK_NONCROSS_INLOOP_FILTER |
---|
374 | Void calcVar(int ypos, int xpos, imgpel **imgY_var, imgpel *imgY_pad, int pad_size, int fl, int img_height, int img_width, int img_stride); |
---|
375 | #else |
---|
376 | Void calcVar(imgpel **imgY_var, imgpel *imgY_pad, int pad_size, int fl, int img_height, int img_width, int img_stride); |
---|
377 | #endif |
---|
378 | Void DecFilter_qc(imgpel* imgY_rec,ALFParam* pcAlfParam, int Stride); |
---|
379 | Void xSubCUAdaptive_qc(TComDataCU* pcCU, ALFParam* pcAlfParam, imgpel *imgY_rec_post, imgpel *imgY_rec, UInt uiAbsPartIdx, UInt uiDepth, Int Stride); |
---|
380 | Void xCUAdaptive_qc(TComPic* pcPic, ALFParam* pcAlfParam, imgpel *imgY_rec_post, imgpel *imgY_rec, Int Stride); |
---|
381 | Void subfilterFrame(imgpel *imgY_rec_post, imgpel *imgY_rec, int filtNo, int start_height, int end_height, int start_width, int end_width, int Stride); |
---|
382 | Void filterFrame(imgpel *imgY_rec_post, imgpel *imgY_rec, int filtNo, int Stride); |
---|
383 | #if TSB_ALF_HEADER |
---|
384 | UInt m_uiNumCUsInFrame; |
---|
385 | Void setAlfCtrlFlags (ALFParam *pAlfParam, TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt &idx); |
---|
386 | #endif |
---|
387 | |
---|
388 | // ------------------------------------------------------------------------------------------------------------------ |
---|
389 | // For chroma component |
---|
390 | // ------------------------------------------------------------------------------------------------------------------ |
---|
391 | |
---|
392 | /// ALF for chroma component |
---|
393 | Void xALFChroma ( ALFParam* pcAlfParam, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest ); |
---|
394 | |
---|
395 | /// sub function: non-adaptive ALF process for chroma |
---|
396 | #if MTK_NONCROSS_INLOOP_FILTER |
---|
397 | Void xFrameChroma ( Int ypos, Int xpos, Int iHeight, Int iWidth, TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, Int *qh, Int iTap, Int iColor ); |
---|
398 | #else |
---|
399 | Void xFrameChroma ( TComPicYuv* pcPicDec, TComPicYuv* pcPicRest, Int *qh, Int iTap, Int iColor ); |
---|
400 | #endif |
---|
401 | |
---|
402 | public: |
---|
403 | TComAdaptiveLoopFilter(); |
---|
404 | virtual ~TComAdaptiveLoopFilter() {} |
---|
405 | |
---|
406 | // initialize & destory temporary buffer |
---|
407 | Void create ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth ); |
---|
408 | Void destroy (); |
---|
409 | |
---|
410 | #if SB_MEM_FIX |
---|
411 | Bool isCreated() { return m_bIsCreated;} |
---|
412 | #endif |
---|
413 | // alloc & free & set functions |
---|
414 | Void allocALFParam ( ALFParam* pAlfParam ); |
---|
415 | Void freeALFParam ( ALFParam* pAlfParam ); |
---|
416 | Void copyALFParam ( ALFParam* pDesAlfParam, ALFParam* pSrcAlfParam ); |
---|
417 | #if TSB_ALF_HEADER |
---|
418 | Void setNumCUsInFrame (TComPic *pcPic); |
---|
419 | #endif |
---|
420 | |
---|
421 | // predict filter coefficients |
---|
422 | Void predictALFCoeff ( ALFParam* pAlfParam ); ///< prediction of luma ALF coefficients |
---|
423 | Void predictALFCoeffChroma ( ALFParam* pAlfParam ); ///< prediction of chroma ALF coefficients |
---|
424 | |
---|
425 | // interface function |
---|
426 | Void ALFProcess ( TComPic* pcPic, ALFParam* pcAlfParam ); ///< interface function for ALF process |
---|
427 | |
---|
428 | #if TI_ALF_MAX_VSIZE_7 |
---|
429 | static Int ALFTapHToTapV(Int tapH); |
---|
430 | static Int ALFTapHToNumCoeff(Int tapH); |
---|
431 | static Int ALFFlHToFlV(Int flH); |
---|
432 | #endif |
---|
433 | |
---|
434 | |
---|
435 | #if MTK_NONCROSS_INLOOP_FILTER |
---|
436 | public: |
---|
437 | Void setNumSlicesInPic(UInt uiNum) {m_uiNumSlicesInPic = uiNum;} |
---|
438 | UInt getNumSlicesInPic() {return m_uiNumSlicesInPic;} |
---|
439 | Void setUseNonCrossAlf(Bool bVal) {m_bUseNonCrossALF = bVal;} |
---|
440 | Bool getUseNonCrossAlf() {return m_bUseNonCrossALF;} |
---|
441 | Void createSlice (); |
---|
442 | Void destroySlice (); |
---|
443 | |
---|
444 | public: //operator to access Alf slice |
---|
445 | CAlfSlice& operator[] (UInt i) |
---|
446 | { |
---|
447 | assert(i < m_uiNumSlicesInPic); |
---|
448 | return m_pSlice[i]; |
---|
449 | } |
---|
450 | #endif |
---|
451 | |
---|
452 | |
---|
453 | }; |
---|
454 | #endif |
---|