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-2011, 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 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 | |
---|
35 | |
---|
36 | /** \file TComPredFilter.h |
---|
37 | \brief interpolation filter class (header) |
---|
38 | */ |
---|
39 | |
---|
40 | #ifndef __TCOMPREDFILTER__ |
---|
41 | #define __TCOMPREDFILTER__ |
---|
42 | |
---|
43 | // Include files |
---|
44 | #include "TComPic.h" |
---|
45 | #include "TComMotionInfo.h" |
---|
46 | |
---|
47 | // ==================================================================================================================== |
---|
48 | // Constants |
---|
49 | // ==================================================================================================================== |
---|
50 | |
---|
51 | // Local type definitions |
---|
52 | #define HAL_IDX 1 |
---|
53 | #define QU0_IDX 0 |
---|
54 | #define QU1_IDX 2 |
---|
55 | |
---|
56 | // ==================================================================================================================== |
---|
57 | // Class definition |
---|
58 | // ==================================================================================================================== |
---|
59 | |
---|
60 | /// interpolation filter class |
---|
61 | class TComPredFilter |
---|
62 | { |
---|
63 | public: |
---|
64 | TComPredFilter(); |
---|
65 | |
---|
66 | // DIF filter interface (for half & quarter) |
---|
67 | __inline Void xCTI_FilterHalfHor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); |
---|
68 | __inline Void xCTI_FilterHalfHor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); |
---|
69 | |
---|
70 | __inline Void xCTI_FilterQuarter0Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); |
---|
71 | __inline Void xCTI_FilterQuarter0Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); |
---|
72 | |
---|
73 | __inline Void xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); |
---|
74 | __inline Void xCTI_FilterQuarter1Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); |
---|
75 | |
---|
76 | __inline Void xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst, Int iDstStridePel, Pel*& rpiDstPel ); |
---|
77 | __inline Void xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst ); |
---|
78 | __inline Void xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst ); |
---|
79 | |
---|
80 | __inline Void xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst ); |
---|
81 | __inline Void xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst ); |
---|
82 | |
---|
83 | __inline Void xCTI_FilterQuarter1Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst ); |
---|
84 | __inline Void xCTI_FilterQuarter1Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst ); |
---|
85 | |
---|
86 | __inline Void xCTI_Filter2DVerC (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Int*& rpiDst, Int iMv); |
---|
87 | __inline Void xCTI_Filter2DHorC (Int* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV); |
---|
88 | __inline Void xCTI_Filter1DHorC (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV); |
---|
89 | __inline Void xCTI_Filter1DVerC (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV); |
---|
90 | |
---|
91 | __inline Int xCTI_Filter_VPS04_C_HAL( Pel* pSrc, Int iStride ); |
---|
92 | __inline Int xCTI_Filter_VIS04_C_HAL( Int* pSrc, Int iStride ); |
---|
93 | __inline Int xCTI_Filter_VP04_C_OCT0( Pel* pSrc, Int iStride ); |
---|
94 | __inline Int xCTI_Filter_VI04_C_OCT0( Int* pSrc, Int iStride ); |
---|
95 | __inline Int xCTI_Filter_VP04_C_QUA0( Pel* pSrc, Int iStride ); |
---|
96 | __inline Int xCTI_Filter_VI04_C_QUA0( Int* pSrc, Int iStride ); |
---|
97 | __inline Int xCTI_Filter_VP04_C_OCT1( Pel* pSrc, Int iStride ); |
---|
98 | __inline Int xCTI_Filter_VI04_C_OCT1( Int* pSrc, Int iStride ); |
---|
99 | __inline Int xCTI_Filter_VP04_C_OCT2( Pel* pSrc, Int iStride ); |
---|
100 | __inline Int xCTI_Filter_VI04_C_OCT2( Int* pSrc, Int iStride ); |
---|
101 | __inline Int xCTI_Filter_VP04_C_QUA1( Pel* pSrc, Int iStride ); |
---|
102 | __inline Int xCTI_Filter_VI04_C_QUA1( Int* pSrc, Int iStride ); |
---|
103 | __inline Int xCTI_Filter_VP04_C_OCT3( Pel* pSrc, Int iStride ); |
---|
104 | __inline Int xCTI_Filter_VI04_C_OCT3( Int* pSrc, Int iStride ); |
---|
105 | |
---|
106 | #if HIGH_ACCURACY_BI |
---|
107 | __inline Void xCTI_FilterHalfHor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); // |
---|
108 | __inline Void xCTI_FilterHalfHor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst);// |
---|
109 | |
---|
110 | |
---|
111 | __inline Void xCTI_FilterQuarter0Hor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); // |
---|
112 | __inline Void xCTI_FilterQuarter0Hor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); // |
---|
113 | |
---|
114 | __inline Void xCTI_FilterQuarter1Hor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); // |
---|
115 | __inline Void xCTI_FilterQuarter1Hor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); // |
---|
116 | |
---|
117 | __inline Void xCTI_FilterHalfVer_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst ); // |
---|
118 | |
---|
119 | __inline Void xCTI_FilterQuarter0Ver_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst ); |
---|
120 | __inline Void xCTI_FilterQuarter1Ver_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst ); |
---|
121 | |
---|
122 | __inline Void xCTI_Filter1DHorC_ha (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV); |
---|
123 | __inline Void xCTI_Filter1DVerC_ha (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV); |
---|
124 | __inline Void xCTI_Filter2DHorC_ha (Int* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV); |
---|
125 | |
---|
126 | #endif |
---|
127 | }; |
---|
128 | |
---|
129 | #if HIGH_ACCURACY_BI |
---|
130 | __inline Void TComPredFilter::xCTI_FilterHalfHor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
131 | { |
---|
132 | Pel* piDst = rpiDst; |
---|
133 | Int iSum; |
---|
134 | Pel* piSrcTmp; |
---|
135 | |
---|
136 | Int iSrcStep2 = iSrcStep*2; |
---|
137 | Int iSrcStep3 = iSrcStep*3; |
---|
138 | Int iSrcStep4 = iSrcStep*4; |
---|
139 | Int iSrcStep5 = iSrcStep*5; |
---|
140 | Int iSrcStep6 = iSrcStep*6; |
---|
141 | Int iSrcStep7 = iSrcStep*7; |
---|
142 | |
---|
143 | Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; |
---|
144 | Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8; |
---|
145 | Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; |
---|
146 | for ( Int y = iHeight; y != 0; y-- ) |
---|
147 | { |
---|
148 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
---|
149 | for ( Int x = 0; x < iWidth; x++ ) |
---|
150 | { |
---|
151 | // { -1,4,-11,40,40,-11,4,-1 } |
---|
152 | iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStep7]; |
---|
153 | iTmp1 = piSrcTmp[iSrcStep]+piSrcTmp[iSrcStep6]; |
---|
154 | iTmp2 = piSrcTmp[iSrcStep2]+piSrcTmp[iSrcStep5]; |
---|
155 | iTmp3 = piSrcTmp[iSrcStep3]+piSrcTmp[iSrcStep4]; |
---|
156 | |
---|
157 | iTmpA = (iTmp3 << 2) - iTmp2; |
---|
158 | |
---|
159 | iSum = ( iTmp1 << 2 ) |
---|
160 | + ( iTmpA << 3 ) |
---|
161 | + ( iTmpA << 1 ) |
---|
162 | - iTmp0 - iTmp2; |
---|
163 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
164 | piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; |
---|
165 | #else |
---|
166 | piDst [x * iDstStep] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
167 | #endif |
---|
168 | |
---|
169 | piSrcTmp += iSrcStep; |
---|
170 | } |
---|
171 | piSrc += iSrcStride; |
---|
172 | piDst += iDstStride; |
---|
173 | } |
---|
174 | return; |
---|
175 | |
---|
176 | } |
---|
177 | |
---|
178 | __inline Void TComPredFilter::xCTI_FilterHalfHor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
179 | { |
---|
180 | Pel* piDst = rpiDst; |
---|
181 | Int iSum; |
---|
182 | Int* piSrcTmp; |
---|
183 | |
---|
184 | Int iSrcStep2 = iSrcStep*2; |
---|
185 | Int iSrcStep3 = iSrcStep*3; |
---|
186 | Int iSrcStep4 = iSrcStep*4; |
---|
187 | Int iSrcStep5 = iSrcStep*5; |
---|
188 | Int iSrcStep6 = iSrcStep*6; |
---|
189 | Int iSrcStep7 = iSrcStep*7; |
---|
190 | |
---|
191 | Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; |
---|
192 | Int shiftNum = 6 + g_uiBitIncrement + g_uiBitDepth - 8; |
---|
193 | Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; |
---|
194 | for ( Int y = iHeight; y != 0; y-- ) |
---|
195 | { |
---|
196 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
---|
197 | for ( Int x = 0; x < iWidth; x++ ) |
---|
198 | { |
---|
199 | // { -1,4,-11,40,40,-11,4,-1 } |
---|
200 | iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStep7]; |
---|
201 | iTmp1 = piSrcTmp[iSrcStep ]+piSrcTmp[iSrcStep6]; |
---|
202 | iTmp2 = piSrcTmp[iSrcStep2]+piSrcTmp[iSrcStep5]; |
---|
203 | iTmp3 = piSrcTmp[iSrcStep3]+piSrcTmp[iSrcStep4]; |
---|
204 | |
---|
205 | iTmpA = (iTmp3 << 2) - iTmp2; |
---|
206 | |
---|
207 | iSum = ( iTmp1 << 2 ) |
---|
208 | + ( iTmpA << 3 ) |
---|
209 | + ( iTmpA << 1 ) |
---|
210 | - iTmp0 - iTmp2; |
---|
211 | |
---|
212 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
213 | piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; |
---|
214 | #else |
---|
215 | piDst [x * iDstStep] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
216 | #endif |
---|
217 | |
---|
218 | piSrcTmp += iSrcStep; |
---|
219 | } |
---|
220 | piSrc += iSrcStride; |
---|
221 | piDst += iDstStride; |
---|
222 | } |
---|
223 | return; |
---|
224 | |
---|
225 | } |
---|
226 | |
---|
227 | |
---|
228 | __inline Void TComPredFilter::xCTI_FilterQuarter0Hor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
229 | { |
---|
230 | Pel* piDst = rpiDst; |
---|
231 | Int iSum; |
---|
232 | Pel* piSrcTmp; |
---|
233 | |
---|
234 | Int iSrcStep2 = iSrcStep*2; |
---|
235 | Int iSrcStep3 = iSrcStep*3; |
---|
236 | Int iSrcStep4 = iSrcStep*4; |
---|
237 | Int iSrcStep5 = iSrcStep*5; |
---|
238 | Int iSrcStep6 = iSrcStep*6; |
---|
239 | Int iSrcStep7 = iSrcStep*7; |
---|
240 | |
---|
241 | Int iTmp1, iTmp2; |
---|
242 | Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8; |
---|
243 | Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; |
---|
244 | for ( Int y = iHeight; y != 0; y-- ) |
---|
245 | { |
---|
246 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
---|
247 | for ( Int x = 0; x < iWidth; x++ ) |
---|
248 | { |
---|
249 | // {-1, 4, -10, 57, 19, -7, 3, -1 }, |
---|
250 | |
---|
251 | iTmp1 = piSrcTmp[iSrcStep3] + piSrcTmp[iSrcStep5]; |
---|
252 | iTmp2 = piSrcTmp[iSrcStep6] + piSrcTmp[iSrcStep4]; |
---|
253 | |
---|
254 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] |
---|
255 | - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 ) |
---|
256 | + ( piSrcTmp[iSrcStep] << 2 ) |
---|
257 | - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 ) |
---|
258 | + ( piSrcTmp[iSrcStep4] << 4 ) |
---|
259 | + ( piSrcTmp[iSrcStep3] << 6); |
---|
260 | |
---|
261 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
262 | piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; |
---|
263 | #else |
---|
264 | piDst [x * iDstStep] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
265 | #endif |
---|
266 | piSrcTmp += iSrcStep; |
---|
267 | } |
---|
268 | piSrc += iSrcStride; |
---|
269 | piDst += iDstStride; |
---|
270 | } |
---|
271 | return; |
---|
272 | } |
---|
273 | |
---|
274 | __inline Void TComPredFilter::xCTI_FilterQuarter0Hor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
275 | { |
---|
276 | Pel* piDst = rpiDst; |
---|
277 | Int iSum; |
---|
278 | Int* piSrcTmp; |
---|
279 | |
---|
280 | Int iSrcStep2 = iSrcStep*2; |
---|
281 | Int iSrcStep3 = iSrcStep*3; |
---|
282 | Int iSrcStep4 = iSrcStep*4; |
---|
283 | Int iSrcStep5 = iSrcStep*5; |
---|
284 | Int iSrcStep6 = iSrcStep*6; |
---|
285 | Int iSrcStep7 = iSrcStep*7; |
---|
286 | Int shiftNum = 6 + g_uiBitIncrement + g_uiBitDepth - 8; |
---|
287 | Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; |
---|
288 | Int iTmp1, iTmp2; |
---|
289 | |
---|
290 | for ( Int y = iHeight; y != 0; y-- ) |
---|
291 | { |
---|
292 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
---|
293 | for ( Int x = 0; x < iWidth; x++ ) |
---|
294 | { |
---|
295 | // {-1, 4, -10, 57, 19, -7, 3, -1 }, |
---|
296 | |
---|
297 | iTmp1 = piSrcTmp[iSrcStep3] + piSrcTmp[iSrcStep5]; |
---|
298 | iTmp2 = piSrcTmp[iSrcStep6] + piSrcTmp[iSrcStep4]; |
---|
299 | |
---|
300 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] |
---|
301 | - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 ) |
---|
302 | + ( piSrcTmp[iSrcStep] << 2 ) |
---|
303 | - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 ) |
---|
304 | + ( piSrcTmp[iSrcStep4] << 4 ) |
---|
305 | + ( piSrcTmp[iSrcStep3] << 6 ); |
---|
306 | |
---|
307 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
308 | piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; |
---|
309 | #else |
---|
310 | piDst [x * iDstStep] = Clip3(0, 16383, (iSum + shiftOffset) >> shiftNum ); |
---|
311 | #endif |
---|
312 | piSrcTmp += iSrcStep; |
---|
313 | } |
---|
314 | piSrc += iSrcStride; |
---|
315 | piDst += iDstStride; |
---|
316 | } |
---|
317 | return; |
---|
318 | |
---|
319 | } |
---|
320 | |
---|
321 | |
---|
322 | __inline Void TComPredFilter::xCTI_FilterQuarter1Hor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
323 | { |
---|
324 | Pel* piDst = rpiDst; |
---|
325 | Int iSum; |
---|
326 | Pel* piSrcTmp; |
---|
327 | |
---|
328 | Int iSrcStep2 = iSrcStep*2; |
---|
329 | Int iSrcStep3 = iSrcStep*3; |
---|
330 | Int iSrcStep4 = iSrcStep*4; |
---|
331 | Int iSrcStep5 = iSrcStep*5; |
---|
332 | Int iSrcStep6 = iSrcStep*6; |
---|
333 | Int iSrcStep7 = iSrcStep*7; |
---|
334 | Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8; |
---|
335 | Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; |
---|
336 | |
---|
337 | Int iTmp1, iTmp2; |
---|
338 | for ( Int y = iHeight; y != 0; y-- ) |
---|
339 | { |
---|
340 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
---|
341 | for ( Int x = 0; x < iWidth; x++ ) |
---|
342 | { |
---|
343 | // {-1, 3, -7, 19, 57, -10, 4, -1 }, |
---|
344 | |
---|
345 | iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2]; |
---|
346 | iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3]; |
---|
347 | |
---|
348 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] |
---|
349 | - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 ) |
---|
350 | + ( piSrcTmp[iSrcStep6] << 2 ) |
---|
351 | - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 ) |
---|
352 | + ( piSrcTmp[iSrcStep3] << 4 ) |
---|
353 | + ( piSrcTmp[iSrcStep4] << 6 ); |
---|
354 | |
---|
355 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
356 | piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; |
---|
357 | #else |
---|
358 | piDst [x * iDstStep] = Clip3(0, 16383, (iSum + shiftOffset) >> shiftNum ); |
---|
359 | #endif |
---|
360 | piSrcTmp += iSrcStep; |
---|
361 | } |
---|
362 | piSrc += iSrcStride; |
---|
363 | piDst += iDstStride; |
---|
364 | } |
---|
365 | return; |
---|
366 | |
---|
367 | |
---|
368 | } |
---|
369 | |
---|
370 | __inline Void TComPredFilter::xCTI_FilterQuarter1Hor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
371 | { |
---|
372 | Pel* piDst = rpiDst; |
---|
373 | Int iSum; |
---|
374 | Int* piSrcTmp; |
---|
375 | |
---|
376 | Int iSrcStep2 = iSrcStep*2; |
---|
377 | Int iSrcStep3 = iSrcStep*3; |
---|
378 | Int iSrcStep4 = iSrcStep*4; |
---|
379 | Int iSrcStep5 = iSrcStep*5; |
---|
380 | Int iSrcStep6 = iSrcStep*6; |
---|
381 | Int iSrcStep7 = iSrcStep*7; |
---|
382 | Int shiftNum = 6+g_uiBitIncrement + g_uiBitDepth - 8; |
---|
383 | Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; |
---|
384 | Int iTmp1, iTmp2; |
---|
385 | for ( Int y = iHeight; y != 0; y-- ) |
---|
386 | { |
---|
387 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
---|
388 | for ( Int x = 0; x < iWidth; x++ ) |
---|
389 | { |
---|
390 | // {-1, 3, -7, 19, 57, -10, 4, -1 }, |
---|
391 | |
---|
392 | iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2]; |
---|
393 | iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3]; |
---|
394 | |
---|
395 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] |
---|
396 | - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 ) |
---|
397 | + ( piSrcTmp[iSrcStep6] << 2 ) |
---|
398 | - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 ) |
---|
399 | + ( piSrcTmp[iSrcStep3] << 4 ) |
---|
400 | + ( piSrcTmp[iSrcStep4] << 6 ); |
---|
401 | |
---|
402 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
403 | piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; |
---|
404 | #else |
---|
405 | piDst [x * iDstStep] = Clip3(0, 16383, (iSum + shiftOffset) >> shiftNum ); |
---|
406 | #endif |
---|
407 | piSrcTmp += iSrcStep; |
---|
408 | } |
---|
409 | piSrc += iSrcStride; |
---|
410 | piDst += iDstStride; |
---|
411 | } |
---|
412 | return; |
---|
413 | |
---|
414 | } |
---|
415 | |
---|
416 | |
---|
417 | |
---|
418 | __inline Void TComPredFilter::xCTI_FilterQuarter0Ver_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
419 | { |
---|
420 | Pel* piDst = rpiDst; |
---|
421 | Int iSum; |
---|
422 | Pel* piSrcTmp; |
---|
423 | |
---|
424 | Int iSrcStride2 = iSrcStride*2; |
---|
425 | Int iSrcStride3 = iSrcStride*3; |
---|
426 | Int iSrcStride4 = iSrcStride*4; |
---|
427 | Int iSrcStride5 = iSrcStride*5; |
---|
428 | Int iSrcStride6 = iSrcStride*6; |
---|
429 | Int iSrcStride7 = iSrcStride*7; |
---|
430 | Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8; |
---|
431 | Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; |
---|
432 | Int iTmp1, iTmp2; |
---|
433 | for ( Int y = iHeight; y != 0; y-- ) |
---|
434 | { |
---|
435 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
---|
436 | for ( Int x = 0; x < iWidth; x++ ) |
---|
437 | { |
---|
438 | // {-1, 4, -10, 57, 19, -7, 3, -1 }, |
---|
439 | |
---|
440 | iTmp1 = piSrcTmp[iSrcStride3] + piSrcTmp[iSrcStride5]; |
---|
441 | iTmp2 = piSrcTmp[iSrcStride6] + piSrcTmp[iSrcStride4]; |
---|
442 | |
---|
443 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7] |
---|
444 | - ( ( piSrcTmp[iSrcStride2] - iTmp2 ) << 1 ) |
---|
445 | + ( piSrcTmp[iSrcStride] << 2 ) |
---|
446 | - ( ( piSrcTmp[iSrcStride2] + iTmp1 ) << 3 ) |
---|
447 | + ( piSrcTmp[iSrcStride4] << 4 ) |
---|
448 | + ( piSrcTmp[iSrcStride3] << 6); |
---|
449 | |
---|
450 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
451 | piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; |
---|
452 | #else |
---|
453 | piDst [x * iDstStep] = Clip3(0, 16383, (iSum + shiftOffset) >> shiftNum ); |
---|
454 | #endif |
---|
455 | piSrcTmp += iSrcStep; |
---|
456 | } |
---|
457 | piSrc += iSrcStride; |
---|
458 | piDst += iDstStride; |
---|
459 | } |
---|
460 | return; |
---|
461 | |
---|
462 | } |
---|
463 | |
---|
464 | |
---|
465 | __inline Void TComPredFilter::xCTI_FilterQuarter1Ver_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
466 | { |
---|
467 | Pel* piDst = rpiDst; |
---|
468 | Int iSum; |
---|
469 | Pel* piSrcTmp; |
---|
470 | |
---|
471 | Int iSrcStride2 = iSrcStride*2; |
---|
472 | Int iSrcStride3 = iSrcStride*3; |
---|
473 | Int iSrcStride4 = iSrcStride*4; |
---|
474 | Int iSrcStride5 = iSrcStride*5; |
---|
475 | Int iSrcStride6 = iSrcStride*6; |
---|
476 | Int iSrcStride7 = iSrcStride*7; |
---|
477 | Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8; |
---|
478 | Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; |
---|
479 | Int iTmp1, iTmp2; |
---|
480 | |
---|
481 | for ( Int y = iHeight; y != 0; y-- ) |
---|
482 | { |
---|
483 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
---|
484 | for ( Int x = 0; x < iWidth; x++ ) |
---|
485 | { |
---|
486 | /// {-1, 3, -7, 19, 57, -10, 4, -1 }, |
---|
487 | iTmp1 = piSrcTmp[iSrcStride4] + piSrcTmp[iSrcStride2]; |
---|
488 | iTmp2 = piSrcTmp[iSrcStride ] + piSrcTmp[iSrcStride3]; |
---|
489 | |
---|
490 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7] |
---|
491 | - ( ( piSrcTmp[iSrcStride5] - iTmp2 ) << 1 ) |
---|
492 | + ( piSrcTmp[iSrcStride6] << 2 ) |
---|
493 | - ( ( piSrcTmp[iSrcStride5] + iTmp1 ) << 3 ) |
---|
494 | + ( piSrcTmp[iSrcStride3] << 4 ) |
---|
495 | + ( piSrcTmp[iSrcStride4] << 6 ); |
---|
496 | |
---|
497 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
498 | piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; |
---|
499 | #else |
---|
500 | piDst [x * iDstStep] = Clip3(0, 16383, (iSum + shiftOffset) >> shiftNum ); |
---|
501 | #endif |
---|
502 | piSrcTmp += iSrcStep; |
---|
503 | } |
---|
504 | piSrc += iSrcStride; |
---|
505 | piDst += iDstStride; |
---|
506 | } |
---|
507 | return; |
---|
508 | |
---|
509 | } |
---|
510 | |
---|
511 | __inline Void TComPredFilter::xCTI_FilterHalfVer_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
512 | { |
---|
513 | Pel* piDst = rpiDst; |
---|
514 | Int iSum; |
---|
515 | Pel* piSrcTmp; |
---|
516 | |
---|
517 | Int iSrcStride2 = iSrcStride*2; |
---|
518 | Int iSrcStride3 = iSrcStride*3; |
---|
519 | Int iSrcStride4 = iSrcStride*4; |
---|
520 | Int iSrcStride5 = iSrcStride*5; |
---|
521 | Int iSrcStride6 = iSrcStride*6; |
---|
522 | Int iSrcStride7 = iSrcStride*7; |
---|
523 | Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8; |
---|
524 | Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; |
---|
525 | Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; |
---|
526 | for ( Int y = iHeight; y != 0; y-- ) |
---|
527 | { |
---|
528 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
---|
529 | for ( Int x = 0; x < iWidth; x++ ) |
---|
530 | { |
---|
531 | // { -1,4,-11,40,40,-11,4,-1 } |
---|
532 | iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7]; |
---|
533 | iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6]; |
---|
534 | iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5]; |
---|
535 | iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4]; |
---|
536 | |
---|
537 | iTmpA = (iTmp3 << 2) - iTmp2; |
---|
538 | |
---|
539 | iSum = ( iTmp1 << 2 ) |
---|
540 | + ( iTmpA << 3 ) |
---|
541 | + ( iTmpA << 1 ) |
---|
542 | - iTmp0 - iTmp2; |
---|
543 | |
---|
544 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
545 | piDst [x * iDstStep] = (iSum + shiftOffset) >> shiftNum; |
---|
546 | #else |
---|
547 | piDst [x * iDstStep] = Clip3(0, 16383, (iSum + shiftOffset) >> shiftNum ); |
---|
548 | #endif |
---|
549 | piSrcTmp += iSrcStep; |
---|
550 | } |
---|
551 | piSrc += iSrcStride; |
---|
552 | piDst += iDstStride; |
---|
553 | } |
---|
554 | return; |
---|
555 | |
---|
556 | } |
---|
557 | |
---|
558 | |
---|
559 | #endif |
---|
560 | |
---|
561 | // ------------------------------------------------------------------------------------------------ |
---|
562 | // DCTIF filters |
---|
563 | // ------------------------------------------------------------------------------------------------ |
---|
564 | |
---|
565 | __inline Void TComPredFilter::xCTI_FilterHalfHor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
566 | { |
---|
567 | Pel* piDst = rpiDst; |
---|
568 | Int iSum; |
---|
569 | Pel* piSrcTmp; |
---|
570 | Int iSrcStep2 = iSrcStep*2; |
---|
571 | Int iSrcStep3 = iSrcStep*3; |
---|
572 | Int iSrcStep4 = iSrcStep*4; |
---|
573 | Int iSrcStep5 = iSrcStep*5; |
---|
574 | Int iSrcStep6 = iSrcStep*6; |
---|
575 | Int iSrcStep7 = iSrcStep*7; |
---|
576 | |
---|
577 | Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; |
---|
578 | |
---|
579 | for ( Int y = iHeight; y != 0; y-- ) |
---|
580 | { |
---|
581 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
---|
582 | for ( Int x = 0; x < iWidth; x++ ) |
---|
583 | { |
---|
584 | // { -1,4,-11,40,40,-11,4,-1 } |
---|
585 | iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStep7]; |
---|
586 | iTmp1 = piSrcTmp[iSrcStep]+piSrcTmp[iSrcStep6]; |
---|
587 | iTmp2 = piSrcTmp[iSrcStep2]+piSrcTmp[iSrcStep5]; |
---|
588 | iTmp3 = piSrcTmp[iSrcStep3]+piSrcTmp[iSrcStep4]; |
---|
589 | |
---|
590 | iTmpA = (iTmp3 << 2) - iTmp2; |
---|
591 | |
---|
592 | iSum = ( iTmp1 << 2 ) |
---|
593 | + ( iTmpA << 3 ) |
---|
594 | + ( iTmpA << 1 ) |
---|
595 | - iTmp0 - iTmp2; |
---|
596 | |
---|
597 | piDst [x * iDstStep] = Clip( (iSum + 32) >> 6 ); |
---|
598 | piSrcTmp += iSrcStep; |
---|
599 | } |
---|
600 | piSrc += iSrcStride; |
---|
601 | piDst += iDstStride; |
---|
602 | } |
---|
603 | return; |
---|
604 | } |
---|
605 | |
---|
606 | __inline Void TComPredFilter::xCTI_FilterHalfHor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
607 | { |
---|
608 | Pel* piDst = rpiDst; |
---|
609 | Int iSum; |
---|
610 | Int* piSrcTmp; |
---|
611 | Int iSrcStep2 = iSrcStep*2; |
---|
612 | Int iSrcStep3 = iSrcStep*3; |
---|
613 | Int iSrcStep4 = iSrcStep*4; |
---|
614 | Int iSrcStep5 = iSrcStep*5; |
---|
615 | Int iSrcStep6 = iSrcStep*6; |
---|
616 | Int iSrcStep7 = iSrcStep*7; |
---|
617 | |
---|
618 | Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; |
---|
619 | |
---|
620 | for ( Int y = iHeight; y != 0; y-- ) |
---|
621 | { |
---|
622 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
---|
623 | for ( Int x = 0; x < iWidth; x++ ) |
---|
624 | { |
---|
625 | // { -1,4,-11,40,40,-11,4,-1 } |
---|
626 | iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStep7]; |
---|
627 | iTmp1 = piSrcTmp[iSrcStep ]+piSrcTmp[iSrcStep6]; |
---|
628 | iTmp2 = piSrcTmp[iSrcStep2]+piSrcTmp[iSrcStep5]; |
---|
629 | iTmp3 = piSrcTmp[iSrcStep3]+piSrcTmp[iSrcStep4]; |
---|
630 | |
---|
631 | iTmpA = (iTmp3 << 2) - iTmp2; |
---|
632 | |
---|
633 | iSum = ( iTmp1 << 2 ) |
---|
634 | + ( iTmpA << 3 ) |
---|
635 | + ( iTmpA << 1 ) |
---|
636 | - iTmp0 - iTmp2; |
---|
637 | |
---|
638 | piDst [x * iDstStep] = Clip( (iSum + 2048) >> 12 ); |
---|
639 | piSrcTmp += iSrcStep; |
---|
640 | } |
---|
641 | piSrc += iSrcStride; |
---|
642 | piDst += iDstStride; |
---|
643 | } |
---|
644 | return; |
---|
645 | } |
---|
646 | |
---|
647 | __inline Void TComPredFilter::xCTI_FilterQuarter0Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
648 | { |
---|
649 | Pel* piDst = rpiDst; |
---|
650 | Int iSum; |
---|
651 | Pel* piSrcTmp; |
---|
652 | Int iSrcStep2 = iSrcStep*2; |
---|
653 | Int iSrcStep3 = iSrcStep*3; |
---|
654 | Int iSrcStep4 = iSrcStep*4; |
---|
655 | Int iSrcStep5 = iSrcStep*5; |
---|
656 | Int iSrcStep6 = iSrcStep*6; |
---|
657 | Int iSrcStep7 = iSrcStep*7; |
---|
658 | |
---|
659 | Int iTmp1, iTmp2; |
---|
660 | |
---|
661 | for ( Int y = iHeight; y != 0; y-- ) |
---|
662 | { |
---|
663 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
---|
664 | for ( Int x = 0; x < iWidth; x++ ) |
---|
665 | { |
---|
666 | // {-1, 4, -10, 57, 19, -7, 3, -1 }, |
---|
667 | |
---|
668 | iTmp1 = piSrcTmp[iSrcStep3] + piSrcTmp[iSrcStep5]; |
---|
669 | iTmp2 = piSrcTmp[iSrcStep6] + piSrcTmp[iSrcStep4]; |
---|
670 | |
---|
671 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] |
---|
672 | - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 ) |
---|
673 | + ( piSrcTmp[iSrcStep] << 2 ) |
---|
674 | - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 ) |
---|
675 | + ( piSrcTmp[iSrcStep4] << 4 ); |
---|
676 | |
---|
677 | piDst [x * iDstStep] = Clip(( (iSum + 32) >> 6 )+ piSrcTmp[iSrcStep3]); |
---|
678 | piSrcTmp += iSrcStep; |
---|
679 | } |
---|
680 | piSrc += iSrcStride; |
---|
681 | piDst += iDstStride; |
---|
682 | } |
---|
683 | return; |
---|
684 | } |
---|
685 | |
---|
686 | __inline Void TComPredFilter::xCTI_FilterQuarter0Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
687 | { |
---|
688 | Pel* piDst = rpiDst; |
---|
689 | Int iSum; |
---|
690 | Int* piSrcTmp; |
---|
691 | Int iSrcStep2 = iSrcStep*2; |
---|
692 | Int iSrcStep3 = iSrcStep*3; |
---|
693 | Int iSrcStep4 = iSrcStep*4; |
---|
694 | Int iSrcStep5 = iSrcStep*5; |
---|
695 | Int iSrcStep6 = iSrcStep*6; |
---|
696 | Int iSrcStep7 = iSrcStep*7; |
---|
697 | |
---|
698 | Int iTmp1, iTmp2; |
---|
699 | |
---|
700 | for ( Int y = iHeight; y != 0; y-- ) |
---|
701 | { |
---|
702 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
---|
703 | for ( Int x = 0; x < iWidth; x++ ) |
---|
704 | { |
---|
705 | // {-1, 4, -10, 57, 19, -7, 3, -1 }, |
---|
706 | |
---|
707 | iTmp1 = piSrcTmp[iSrcStep3] + piSrcTmp[iSrcStep5]; |
---|
708 | iTmp2 = piSrcTmp[iSrcStep6] + piSrcTmp[iSrcStep4]; |
---|
709 | |
---|
710 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] |
---|
711 | - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 ) |
---|
712 | + ( piSrcTmp[iSrcStep] << 2 ) |
---|
713 | - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 ) |
---|
714 | + ( piSrcTmp[iSrcStep4] << 4 ) |
---|
715 | + ( piSrcTmp[iSrcStep3] << 6 ); |
---|
716 | |
---|
717 | piDst [x * iDstStep] = Clip( (iSum + 2048) >> 12 ); |
---|
718 | piSrcTmp += iSrcStep; |
---|
719 | } |
---|
720 | piSrc += iSrcStride; |
---|
721 | piDst += iDstStride; |
---|
722 | } |
---|
723 | return; |
---|
724 | } |
---|
725 | |
---|
726 | __inline Void TComPredFilter::xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
727 | { |
---|
728 | Pel* piDst = rpiDst; |
---|
729 | Int iSum; |
---|
730 | Pel* piSrcTmp; |
---|
731 | Int iSrcStep2 = iSrcStep*2; |
---|
732 | Int iSrcStep3 = iSrcStep*3; |
---|
733 | Int iSrcStep4 = iSrcStep*4; |
---|
734 | Int iSrcStep5 = iSrcStep*5; |
---|
735 | Int iSrcStep6 = iSrcStep*6; |
---|
736 | Int iSrcStep7 = iSrcStep*7; |
---|
737 | |
---|
738 | Int iTmp1, iTmp2; |
---|
739 | for ( Int y = iHeight; y != 0; y-- ) |
---|
740 | { |
---|
741 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
---|
742 | for ( Int x = 0; x < iWidth; x++ ) |
---|
743 | { |
---|
744 | // {-1, 3, -7, 19, 57, -10, 4, -1 }, |
---|
745 | |
---|
746 | iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2]; |
---|
747 | iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3]; |
---|
748 | |
---|
749 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] |
---|
750 | - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 ) |
---|
751 | + ( piSrcTmp[iSrcStep6] << 2 ) |
---|
752 | - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 ) |
---|
753 | + ( piSrcTmp[iSrcStep3] << 4 ); |
---|
754 | |
---|
755 | piDst [x * iDstStep] = Clip( ((iSum + 32) >> 6) + piSrcTmp[iSrcStep4] ); |
---|
756 | piSrcTmp += iSrcStep; |
---|
757 | } |
---|
758 | piSrc += iSrcStride; |
---|
759 | piDst += iDstStride; |
---|
760 | } |
---|
761 | return; |
---|
762 | } |
---|
763 | |
---|
764 | __inline Void TComPredFilter::xCTI_FilterQuarter1Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
765 | { |
---|
766 | Pel* piDst = rpiDst; |
---|
767 | Int iSum; |
---|
768 | Int* piSrcTmp; |
---|
769 | Int iSrcStep2 = iSrcStep*2; |
---|
770 | Int iSrcStep3 = iSrcStep*3; |
---|
771 | Int iSrcStep4 = iSrcStep*4; |
---|
772 | Int iSrcStep5 = iSrcStep*5; |
---|
773 | Int iSrcStep6 = iSrcStep*6; |
---|
774 | Int iSrcStep7 = iSrcStep*7; |
---|
775 | |
---|
776 | Int iTmp1, iTmp2; |
---|
777 | for ( Int y = iHeight; y != 0; y-- ) |
---|
778 | { |
---|
779 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
---|
780 | for ( Int x = 0; x < iWidth; x++ ) |
---|
781 | { |
---|
782 | // {-1, 3, -7, 19, 57, -10, 4, -1 }, |
---|
783 | |
---|
784 | iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2]; |
---|
785 | iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3]; |
---|
786 | |
---|
787 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] |
---|
788 | - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 ) |
---|
789 | + ( piSrcTmp[iSrcStep6] << 2 ) |
---|
790 | - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 ) |
---|
791 | + ( piSrcTmp[iSrcStep3] << 4 ) |
---|
792 | + ( piSrcTmp[iSrcStep4] << 6 ); |
---|
793 | |
---|
794 | piDst [x * iDstStep] = Clip( (iSum + 2048) >> 12 ); |
---|
795 | piSrcTmp += iSrcStep; |
---|
796 | } |
---|
797 | piSrc += iSrcStride; |
---|
798 | piDst += iDstStride; |
---|
799 | } |
---|
800 | return; |
---|
801 | } |
---|
802 | |
---|
803 | __inline Void TComPredFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst, Int iDstStridePel, Pel*& rpiDstPel ) |
---|
804 | { |
---|
805 | Int* piDst = rpiDst; |
---|
806 | Pel* piDstPel = rpiDstPel; |
---|
807 | Int iSum; |
---|
808 | Pel* piSrcTmp; |
---|
809 | Int iSrcStride2 = iSrcStride*2; |
---|
810 | Int iSrcStride3 = iSrcStride*3; |
---|
811 | Int iSrcStride4 = iSrcStride*4; |
---|
812 | Int iSrcStride5 = iSrcStride*5; |
---|
813 | Int iSrcStride6 = iSrcStride*6; |
---|
814 | Int iSrcStride7 = iSrcStride*7; |
---|
815 | |
---|
816 | Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; |
---|
817 | for ( Int y = iHeight; y != 0; y-- ) |
---|
818 | { |
---|
819 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
---|
820 | for ( Int x = 0; x < iWidth; x++ ) |
---|
821 | { |
---|
822 | // { -1,4,-11,40,40,-11,4,-1 } |
---|
823 | iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7]; |
---|
824 | iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6]; |
---|
825 | iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5]; |
---|
826 | iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4]; |
---|
827 | |
---|
828 | iTmpA = (iTmp3 << 2) - iTmp2; |
---|
829 | |
---|
830 | iSum = ( iTmp1 << 2 ) |
---|
831 | + ( iTmpA << 3 ) |
---|
832 | + ( iTmpA << 1 ) |
---|
833 | - iTmp0 - iTmp2; |
---|
834 | |
---|
835 | piDst[x * iDstStep] = iSum; |
---|
836 | piDstPel[x * iDstStep] = Clip( (iSum + 32) >> 6 ); |
---|
837 | piSrcTmp += iSrcStep; |
---|
838 | } |
---|
839 | piSrc += iSrcStride; |
---|
840 | piDst += iDstStride; |
---|
841 | piDstPel += iDstStridePel; |
---|
842 | } |
---|
843 | return; |
---|
844 | } |
---|
845 | |
---|
846 | __inline Void TComPredFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst) |
---|
847 | { |
---|
848 | Int* piDst = rpiDst; |
---|
849 | Int iSum; |
---|
850 | Pel* piSrcTmp; |
---|
851 | Int iSrcStride2 = iSrcStride*2; |
---|
852 | Int iSrcStride3 = iSrcStride*3; |
---|
853 | Int iSrcStride4 = iSrcStride*4; |
---|
854 | Int iSrcStride5 = iSrcStride*5; |
---|
855 | Int iSrcStride6 = iSrcStride*6; |
---|
856 | Int iSrcStride7 = iSrcStride*7; |
---|
857 | |
---|
858 | Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; |
---|
859 | for ( Int y = iHeight; y != 0; y-- ) |
---|
860 | { |
---|
861 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
---|
862 | for ( Int x = 0; x < iWidth; x++ ) |
---|
863 | { |
---|
864 | // { -1,4,-11,40,40,-11,4,-1 } |
---|
865 | iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7]; |
---|
866 | iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6]; |
---|
867 | iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5]; |
---|
868 | iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4]; |
---|
869 | |
---|
870 | iTmpA = (iTmp3 << 2) - iTmp2; |
---|
871 | |
---|
872 | iSum = ( iTmp1 << 2 ) |
---|
873 | + ( iTmpA << 3 ) |
---|
874 | + ( iTmpA << 1 ) |
---|
875 | - iTmp0 - iTmp2; |
---|
876 | |
---|
877 | piDst[x * iDstStep] = iSum; |
---|
878 | piSrcTmp += iSrcStep; |
---|
879 | } |
---|
880 | piSrc += iSrcStride; |
---|
881 | piDst += iDstStride; |
---|
882 | } |
---|
883 | return; |
---|
884 | } |
---|
885 | |
---|
886 | __inline Void TComPredFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
887 | { |
---|
888 | Pel* piDst = rpiDst; |
---|
889 | Int iSum; |
---|
890 | Pel* piSrcTmp; |
---|
891 | |
---|
892 | Int iSrcStride2 = iSrcStride*2; |
---|
893 | Int iSrcStride3 = iSrcStride*3; |
---|
894 | Int iSrcStride4 = iSrcStride*4; |
---|
895 | Int iSrcStride5 = iSrcStride*5; |
---|
896 | Int iSrcStride6 = iSrcStride*6; |
---|
897 | Int iSrcStride7 = iSrcStride*7; |
---|
898 | |
---|
899 | Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; |
---|
900 | for ( Int y = iHeight; y != 0; y-- ) |
---|
901 | { |
---|
902 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
---|
903 | for ( Int x = 0; x < iWidth; x++ ) |
---|
904 | { |
---|
905 | // { -1,4,-11,40,40,-11,4,-1 } |
---|
906 | iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7]; |
---|
907 | iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6]; |
---|
908 | iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5]; |
---|
909 | iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4]; |
---|
910 | |
---|
911 | iTmpA = (iTmp3 << 2) - iTmp2; |
---|
912 | |
---|
913 | iSum = ( iTmp1 << 2 ) |
---|
914 | + ( iTmpA << 3 ) |
---|
915 | + ( iTmpA << 1 ) |
---|
916 | - iTmp0 - iTmp2; |
---|
917 | |
---|
918 | piDst[x * iDstStep] = Clip( (iSum + 32) >> 6 ); |
---|
919 | piSrcTmp += iSrcStep; |
---|
920 | } |
---|
921 | piSrc += iSrcStride; |
---|
922 | piDst += iDstStride; |
---|
923 | } |
---|
924 | return; |
---|
925 | } |
---|
926 | |
---|
927 | __inline Void TComPredFilter::xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst) |
---|
928 | { |
---|
929 | Int* piDst = rpiDst; |
---|
930 | Int iSum; |
---|
931 | Pel* piSrcTmp; |
---|
932 | Int iSrcStride2 = iSrcStride*2; |
---|
933 | Int iSrcStride3 = iSrcStride*3; |
---|
934 | Int iSrcStride4 = iSrcStride*4; |
---|
935 | Int iSrcStride5 = iSrcStride*5; |
---|
936 | Int iSrcStride6 = iSrcStride*6; |
---|
937 | Int iSrcStride7 = iSrcStride*7; |
---|
938 | |
---|
939 | Int iTmp1, iTmp2; |
---|
940 | for ( Int y = iHeight; y != 0; y-- ) |
---|
941 | { |
---|
942 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
---|
943 | for ( Int x = 0; x < iWidth; x++ ) |
---|
944 | { |
---|
945 | // {-1, 4, -10, 57, 19, -7, 3, -1 }, |
---|
946 | |
---|
947 | iTmp1 = piSrcTmp[iSrcStride3] + piSrcTmp[iSrcStride5]; |
---|
948 | iTmp2 = piSrcTmp[iSrcStride6] + piSrcTmp[iSrcStride4]; |
---|
949 | |
---|
950 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7] |
---|
951 | - ( ( piSrcTmp[iSrcStride2] - iTmp2 ) << 1 ) |
---|
952 | + ( piSrcTmp[iSrcStride] << 2 ) |
---|
953 | - ( ( piSrcTmp[iSrcStride2] + iTmp1 ) << 3 ) |
---|
954 | + ( piSrcTmp[iSrcStride4] << 4 ) |
---|
955 | + ( piSrcTmp[iSrcStride3] << 6 ); |
---|
956 | |
---|
957 | piDst[x * iDstStep] = iSum; |
---|
958 | piSrcTmp += iSrcStep; |
---|
959 | } |
---|
960 | piSrc += iSrcStride; |
---|
961 | piDst += iDstStride; |
---|
962 | } |
---|
963 | return; |
---|
964 | } |
---|
965 | |
---|
966 | __inline Void TComPredFilter::xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
967 | { |
---|
968 | Pel* piDst = rpiDst; |
---|
969 | Int iSum; |
---|
970 | Pel* piSrcTmp; |
---|
971 | |
---|
972 | Int iSrcStride2 = iSrcStride*2; |
---|
973 | Int iSrcStride3 = iSrcStride*3; |
---|
974 | Int iSrcStride4 = iSrcStride*4; |
---|
975 | Int iSrcStride5 = iSrcStride*5; |
---|
976 | Int iSrcStride6 = iSrcStride*6; |
---|
977 | Int iSrcStride7 = iSrcStride*7; |
---|
978 | |
---|
979 | Int iTmp1, iTmp2; |
---|
980 | for ( Int y = iHeight; y != 0; y-- ) |
---|
981 | { |
---|
982 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
---|
983 | for ( Int x = 0; x < iWidth; x++ ) |
---|
984 | { |
---|
985 | // {-1, 4, -10, 57, 19, -7, 3, -1 }, |
---|
986 | |
---|
987 | iTmp1 = piSrcTmp[iSrcStride3] + piSrcTmp[iSrcStride5]; |
---|
988 | iTmp2 = piSrcTmp[iSrcStride6] + piSrcTmp[iSrcStride4]; |
---|
989 | |
---|
990 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7] |
---|
991 | - ( ( piSrcTmp[iSrcStride2] - iTmp2 ) << 1 ) |
---|
992 | + ( piSrcTmp[iSrcStride] << 2 ) |
---|
993 | - ( ( piSrcTmp[iSrcStride2] + iTmp1 ) << 3 ) |
---|
994 | + ( piSrcTmp[iSrcStride4] << 4 ); |
---|
995 | |
---|
996 | piDst[x * iDstStep] = Clip( ((iSum + 32) >> 6) + piSrcTmp[iSrcStride3] ); |
---|
997 | piSrcTmp += iSrcStep; |
---|
998 | } |
---|
999 | piSrc += iSrcStride; |
---|
1000 | piDst += iDstStride; |
---|
1001 | } |
---|
1002 | return; |
---|
1003 | } |
---|
1004 | |
---|
1005 | __inline Void TComPredFilter::xCTI_FilterQuarter1Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst) |
---|
1006 | { |
---|
1007 | Int* piDst = rpiDst; |
---|
1008 | Int iSum; |
---|
1009 | Pel* piSrcTmp; |
---|
1010 | Int iSrcStride2 = iSrcStride*2; |
---|
1011 | Int iSrcStride3 = iSrcStride*3; |
---|
1012 | Int iSrcStride4 = iSrcStride*4; |
---|
1013 | Int iSrcStride5 = iSrcStride*5; |
---|
1014 | Int iSrcStride6 = iSrcStride*6; |
---|
1015 | Int iSrcStride7 = iSrcStride*7; |
---|
1016 | |
---|
1017 | Int iTmp1, iTmp2; |
---|
1018 | |
---|
1019 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1020 | { |
---|
1021 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
---|
1022 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1023 | { |
---|
1024 | /// {-1, 3, -7, 19, 57, -10, 4, -1 }, |
---|
1025 | iTmp1 = piSrcTmp[iSrcStride4] + piSrcTmp[iSrcStride2]; |
---|
1026 | iTmp2 = piSrcTmp[iSrcStride ] + piSrcTmp[iSrcStride3]; |
---|
1027 | |
---|
1028 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7] |
---|
1029 | - ( ( piSrcTmp[iSrcStride5] - iTmp2 ) << 1 ) |
---|
1030 | + ( piSrcTmp[iSrcStride6] << 2 ) |
---|
1031 | - ( ( piSrcTmp[iSrcStride5] + iTmp1 ) << 3 ) |
---|
1032 | + ( piSrcTmp[iSrcStride3] << 4 ) |
---|
1033 | + ( piSrcTmp[iSrcStride4] << 6 ); |
---|
1034 | |
---|
1035 | piDst[x * iDstStep] = iSum; |
---|
1036 | piSrcTmp += iSrcStep; |
---|
1037 | } |
---|
1038 | piSrc += iSrcStride; |
---|
1039 | piDst += iDstStride; |
---|
1040 | } |
---|
1041 | return; |
---|
1042 | } |
---|
1043 | |
---|
1044 | __inline Void TComPredFilter::xCTI_FilterQuarter1Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
---|
1045 | { |
---|
1046 | Pel* piDst = rpiDst; |
---|
1047 | Int iSum; |
---|
1048 | Pel* piSrcTmp; |
---|
1049 | Int iSrcStride2 = iSrcStride*2; |
---|
1050 | Int iSrcStride3 = iSrcStride*3; |
---|
1051 | Int iSrcStride4 = iSrcStride*4; |
---|
1052 | Int iSrcStride5 = iSrcStride*5; |
---|
1053 | Int iSrcStride6 = iSrcStride*6; |
---|
1054 | Int iSrcStride7 = iSrcStride*7; |
---|
1055 | |
---|
1056 | Int iTmp1, iTmp2; |
---|
1057 | |
---|
1058 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1059 | { |
---|
1060 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
---|
1061 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1062 | { |
---|
1063 | /// {-1, 3, -7, 19, 57, -10, 4, -1 }, |
---|
1064 | iTmp1 = piSrcTmp[iSrcStride4] + piSrcTmp[iSrcStride2]; |
---|
1065 | iTmp2 = piSrcTmp[iSrcStride ] + piSrcTmp[iSrcStride3]; |
---|
1066 | |
---|
1067 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7] |
---|
1068 | - ( ( piSrcTmp[iSrcStride5] - iTmp2 ) << 1 ) |
---|
1069 | + ( piSrcTmp[iSrcStride6] << 2 ) |
---|
1070 | - ( ( piSrcTmp[iSrcStride5] + iTmp1 ) << 3 ) |
---|
1071 | + ( piSrcTmp[iSrcStride3] << 4 ); |
---|
1072 | |
---|
1073 | piDst[x * iDstStep] = Clip( ((iSum + 32) >> 6) + piSrcTmp[iSrcStride4] ); |
---|
1074 | piSrcTmp += iSrcStep; |
---|
1075 | } |
---|
1076 | piSrc += iSrcStride; |
---|
1077 | piDst += iDstStride; |
---|
1078 | } |
---|
1079 | return; |
---|
1080 | } |
---|
1081 | |
---|
1082 | // ------------------------------------------------------------------------------------------------ |
---|
1083 | // DCTIF filters for Chroma |
---|
1084 | // ------------------------------------------------------------------------------------------------ |
---|
1085 | __inline Void TComPredFilter::xCTI_Filter2DVerC (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Int*& rpiDst, Int iMV) |
---|
1086 | { |
---|
1087 | Int* piDst = rpiDst; |
---|
1088 | Int iSum; |
---|
1089 | Pel* piSrcTmp; |
---|
1090 | |
---|
1091 | switch (iMV) |
---|
1092 | { |
---|
1093 | case 1: |
---|
1094 | { |
---|
1095 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1096 | { |
---|
1097 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1098 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1099 | { |
---|
1100 | iSum = xCTI_Filter_VP04_C_OCT0( piSrcTmp, iSrcStride ); |
---|
1101 | piDst[x ] = iSum; |
---|
1102 | piSrcTmp++; |
---|
1103 | } |
---|
1104 | piSrc += iSrcStride; |
---|
1105 | piDst += iDstStride; |
---|
1106 | } |
---|
1107 | } |
---|
1108 | break; |
---|
1109 | case 2: |
---|
1110 | { |
---|
1111 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1112 | { |
---|
1113 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1114 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1115 | { |
---|
1116 | iSum = xCTI_Filter_VP04_C_QUA0( piSrcTmp, iSrcStride ); |
---|
1117 | piDst[x ] = iSum; |
---|
1118 | piSrcTmp++; |
---|
1119 | } |
---|
1120 | piSrc += iSrcStride; |
---|
1121 | piDst += iDstStride; |
---|
1122 | } |
---|
1123 | } |
---|
1124 | break; |
---|
1125 | case 6: |
---|
1126 | { |
---|
1127 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1128 | { |
---|
1129 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1130 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1131 | { |
---|
1132 | iSum = xCTI_Filter_VP04_C_QUA1( piSrcTmp, iSrcStride ); |
---|
1133 | piDst[x ] = iSum; |
---|
1134 | piSrcTmp++; |
---|
1135 | } |
---|
1136 | piSrc += iSrcStride; |
---|
1137 | piDst += iDstStride; |
---|
1138 | } |
---|
1139 | } |
---|
1140 | break; |
---|
1141 | case 3: |
---|
1142 | { |
---|
1143 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1144 | { |
---|
1145 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1146 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1147 | { |
---|
1148 | iSum = xCTI_Filter_VP04_C_OCT1( piSrcTmp, iSrcStride ); |
---|
1149 | piDst[x ] = iSum; |
---|
1150 | piSrcTmp++; |
---|
1151 | } |
---|
1152 | piSrc += iSrcStride; |
---|
1153 | piDst += iDstStride; |
---|
1154 | } |
---|
1155 | } |
---|
1156 | break; |
---|
1157 | case 5: |
---|
1158 | { |
---|
1159 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1160 | { |
---|
1161 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1162 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1163 | { |
---|
1164 | iSum = xCTI_Filter_VP04_C_OCT2( piSrcTmp, iSrcStride ); |
---|
1165 | piDst[x ] = iSum; |
---|
1166 | piSrcTmp++; |
---|
1167 | } |
---|
1168 | piSrc += iSrcStride; |
---|
1169 | piDst += iDstStride; |
---|
1170 | } |
---|
1171 | } |
---|
1172 | break; |
---|
1173 | case 7: |
---|
1174 | { |
---|
1175 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1176 | { |
---|
1177 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1178 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1179 | { |
---|
1180 | iSum = xCTI_Filter_VP04_C_OCT3( piSrcTmp, iSrcStride ); |
---|
1181 | piDst[x ] = iSum; |
---|
1182 | piSrcTmp++; |
---|
1183 | } |
---|
1184 | piSrc += iSrcStride; |
---|
1185 | piDst += iDstStride; |
---|
1186 | } |
---|
1187 | } |
---|
1188 | break; |
---|
1189 | case 4: |
---|
1190 | { |
---|
1191 | |
---|
1192 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1193 | { |
---|
1194 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1195 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1196 | { |
---|
1197 | iSum = xCTI_Filter_VPS04_C_HAL( piSrcTmp, iSrcStride ); |
---|
1198 | piDst[x ] = iSum; |
---|
1199 | piSrcTmp++; |
---|
1200 | } |
---|
1201 | piSrc += iSrcStride; |
---|
1202 | piDst += iDstStride; |
---|
1203 | } |
---|
1204 | } |
---|
1205 | break; |
---|
1206 | default: |
---|
1207 | assert( 0 ); |
---|
1208 | } |
---|
1209 | return; |
---|
1210 | } |
---|
1211 | |
---|
1212 | __inline Void TComPredFilter::xCTI_Filter2DHorC(Int* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV) |
---|
1213 | { |
---|
1214 | Pel* piDst = rpiDst; |
---|
1215 | Int iSum; |
---|
1216 | Int* piSrcTmp; |
---|
1217 | |
---|
1218 | switch (iMV) |
---|
1219 | { |
---|
1220 | case 1: |
---|
1221 | { |
---|
1222 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1223 | { |
---|
1224 | piSrcTmp = &piSrc[ -1 ]; |
---|
1225 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1226 | { |
---|
1227 | iSum = xCTI_Filter_VI04_C_OCT0( piSrcTmp, 1 ); |
---|
1228 | piDst [x ] = Clip ((iSum + 2048) >> 12 ); |
---|
1229 | piSrcTmp++; |
---|
1230 | } |
---|
1231 | piSrc += iSrcStride; |
---|
1232 | piDst += iDstStride; |
---|
1233 | } |
---|
1234 | } |
---|
1235 | break; |
---|
1236 | case 2: |
---|
1237 | { |
---|
1238 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1239 | { |
---|
1240 | piSrcTmp = &piSrc[ -1 ]; |
---|
1241 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1242 | { |
---|
1243 | iSum = xCTI_Filter_VI04_C_QUA0( piSrcTmp, 1 ); |
---|
1244 | piDst [x ] = Clip ((iSum + 2048) >> 12 ); |
---|
1245 | piSrcTmp++; |
---|
1246 | } |
---|
1247 | piSrc += iSrcStride; |
---|
1248 | piDst += iDstStride; |
---|
1249 | } |
---|
1250 | } |
---|
1251 | break; |
---|
1252 | case 6: |
---|
1253 | { |
---|
1254 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1255 | { |
---|
1256 | piSrcTmp = &piSrc[ -1 ]; |
---|
1257 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1258 | { |
---|
1259 | iSum = xCTI_Filter_VI04_C_QUA1( piSrcTmp, 1 ); |
---|
1260 | piDst [x ] = Clip ((iSum + 2048) >> 12 ); |
---|
1261 | piSrcTmp++; |
---|
1262 | } |
---|
1263 | piSrc += iSrcStride; |
---|
1264 | piDst += iDstStride; |
---|
1265 | } |
---|
1266 | } |
---|
1267 | break; |
---|
1268 | case 3: |
---|
1269 | { |
---|
1270 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1271 | { |
---|
1272 | piSrcTmp = &piSrc[ -1 ]; |
---|
1273 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1274 | { |
---|
1275 | iSum = xCTI_Filter_VI04_C_OCT1( piSrcTmp, 1 ); |
---|
1276 | piDst [x ] = Clip ((iSum + 2048) >> 12 ); |
---|
1277 | piSrcTmp++; |
---|
1278 | } |
---|
1279 | piSrc += iSrcStride; |
---|
1280 | piDst += iDstStride; |
---|
1281 | } |
---|
1282 | } |
---|
1283 | break; |
---|
1284 | case 5: |
---|
1285 | { |
---|
1286 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1287 | { |
---|
1288 | piSrcTmp = &piSrc[ -1 ]; |
---|
1289 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1290 | { |
---|
1291 | iSum = xCTI_Filter_VI04_C_OCT2( piSrcTmp, 1 ); |
---|
1292 | piDst [x ] = Clip ((iSum + 2048) >> 12 ); |
---|
1293 | piSrcTmp++; |
---|
1294 | } |
---|
1295 | piSrc += iSrcStride; |
---|
1296 | piDst += iDstStride; |
---|
1297 | } |
---|
1298 | } |
---|
1299 | break; |
---|
1300 | case 7: |
---|
1301 | { |
---|
1302 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1303 | { |
---|
1304 | piSrcTmp = &piSrc[ -1 ]; |
---|
1305 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1306 | { |
---|
1307 | iSum = xCTI_Filter_VI04_C_OCT3( piSrcTmp, 1 ); |
---|
1308 | piDst [x ] = Clip ((iSum + 2048) >> 12 ); |
---|
1309 | piSrcTmp++; |
---|
1310 | } |
---|
1311 | piSrc += iSrcStride; |
---|
1312 | piDst += iDstStride; |
---|
1313 | } |
---|
1314 | } |
---|
1315 | break; |
---|
1316 | case 4: |
---|
1317 | { |
---|
1318 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1319 | { |
---|
1320 | piSrcTmp = &piSrc[ -1 ]; |
---|
1321 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1322 | { |
---|
1323 | iSum = xCTI_Filter_VIS04_C_HAL( piSrcTmp, 1 ); |
---|
1324 | piDst [x ] = Clip ((iSum + 2048) >> 12 ); |
---|
1325 | piSrcTmp++; |
---|
1326 | } |
---|
1327 | piSrc += iSrcStride; |
---|
1328 | piDst += iDstStride; |
---|
1329 | } |
---|
1330 | } |
---|
1331 | break; |
---|
1332 | default: |
---|
1333 | assert( 0 ); |
---|
1334 | } |
---|
1335 | |
---|
1336 | return; |
---|
1337 | } |
---|
1338 | |
---|
1339 | __inline Void TComPredFilter::xCTI_Filter1DVerC (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV) |
---|
1340 | { |
---|
1341 | Pel* piDst = rpiDst; |
---|
1342 | Int iSum; |
---|
1343 | Pel* piSrcTmp; |
---|
1344 | |
---|
1345 | switch (iMV) |
---|
1346 | { |
---|
1347 | case 1: |
---|
1348 | { |
---|
1349 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1350 | { |
---|
1351 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1352 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1353 | { |
---|
1354 | iSum = xCTI_Filter_VP04_C_OCT0( piSrcTmp, iSrcStride ); |
---|
1355 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1356 | piSrcTmp++; |
---|
1357 | } |
---|
1358 | piSrc += iSrcStride; |
---|
1359 | piDst += iDstStride; |
---|
1360 | } |
---|
1361 | } |
---|
1362 | break; |
---|
1363 | case 2: |
---|
1364 | { |
---|
1365 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1366 | { |
---|
1367 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1368 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1369 | { |
---|
1370 | iSum = xCTI_Filter_VP04_C_QUA0( piSrcTmp, iSrcStride ); |
---|
1371 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1372 | piSrcTmp++; |
---|
1373 | } |
---|
1374 | piSrc += iSrcStride; |
---|
1375 | piDst += iDstStride; |
---|
1376 | } |
---|
1377 | } |
---|
1378 | break; |
---|
1379 | case 6: |
---|
1380 | { |
---|
1381 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1382 | { |
---|
1383 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1384 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1385 | { |
---|
1386 | iSum = xCTI_Filter_VP04_C_QUA1( piSrcTmp, iSrcStride ); |
---|
1387 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1388 | piSrcTmp++; |
---|
1389 | } |
---|
1390 | piSrc += iSrcStride; |
---|
1391 | piDst += iDstStride; |
---|
1392 | } |
---|
1393 | } |
---|
1394 | break; |
---|
1395 | case 3: |
---|
1396 | { |
---|
1397 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1398 | { |
---|
1399 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1400 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1401 | { |
---|
1402 | iSum = xCTI_Filter_VP04_C_OCT1( piSrcTmp, iSrcStride ); |
---|
1403 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1404 | piSrcTmp++; |
---|
1405 | } |
---|
1406 | piSrc += iSrcStride; |
---|
1407 | piDst += iDstStride; |
---|
1408 | } |
---|
1409 | } |
---|
1410 | break; |
---|
1411 | case 5: |
---|
1412 | { |
---|
1413 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1414 | { |
---|
1415 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1416 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1417 | { |
---|
1418 | iSum = xCTI_Filter_VP04_C_OCT2( piSrcTmp, iSrcStride ); |
---|
1419 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1420 | piSrcTmp++; |
---|
1421 | } |
---|
1422 | piSrc += iSrcStride; |
---|
1423 | piDst += iDstStride; |
---|
1424 | } |
---|
1425 | } |
---|
1426 | break; |
---|
1427 | case 7: |
---|
1428 | { |
---|
1429 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1430 | { |
---|
1431 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1432 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1433 | { |
---|
1434 | iSum = xCTI_Filter_VP04_C_OCT3( piSrcTmp, iSrcStride ); |
---|
1435 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1436 | piSrcTmp++; |
---|
1437 | } |
---|
1438 | piSrc += iSrcStride; |
---|
1439 | piDst += iDstStride; |
---|
1440 | } |
---|
1441 | } |
---|
1442 | break; |
---|
1443 | case 4: |
---|
1444 | { |
---|
1445 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1446 | { |
---|
1447 | piSrcTmp = &piSrc[-iSrcStride ]; |
---|
1448 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1449 | { |
---|
1450 | iSum = xCTI_Filter_VPS04_C_HAL( piSrcTmp, iSrcStride ); |
---|
1451 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1452 | piSrcTmp++; |
---|
1453 | } |
---|
1454 | piSrc += iSrcStride; |
---|
1455 | piDst += iDstStride; |
---|
1456 | } |
---|
1457 | } |
---|
1458 | break; |
---|
1459 | default: |
---|
1460 | assert( 0 ); |
---|
1461 | } |
---|
1462 | return; |
---|
1463 | } |
---|
1464 | |
---|
1465 | __inline Void TComPredFilter::xCTI_Filter1DHorC(Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV) |
---|
1466 | { |
---|
1467 | Pel* piDst = rpiDst; |
---|
1468 | Int iSum; |
---|
1469 | Pel* piSrcTmp; |
---|
1470 | |
---|
1471 | switch (iMV) |
---|
1472 | { |
---|
1473 | case 1: |
---|
1474 | { |
---|
1475 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1476 | { |
---|
1477 | piSrcTmp = &piSrc[ -1 ]; |
---|
1478 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1479 | { |
---|
1480 | iSum = xCTI_Filter_VP04_C_OCT0( piSrcTmp, 1 ); |
---|
1481 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1482 | piSrcTmp++; |
---|
1483 | } |
---|
1484 | piSrc += iSrcStride; |
---|
1485 | piDst += iDstStride; |
---|
1486 | } |
---|
1487 | } |
---|
1488 | break; |
---|
1489 | case 2: |
---|
1490 | { |
---|
1491 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1492 | { |
---|
1493 | piSrcTmp = &piSrc[ -1 ]; |
---|
1494 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1495 | { |
---|
1496 | iSum = xCTI_Filter_VP04_C_QUA0( piSrcTmp, 1 ); |
---|
1497 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1498 | piSrcTmp++; |
---|
1499 | } |
---|
1500 | piSrc += iSrcStride; |
---|
1501 | piDst += iDstStride; |
---|
1502 | } |
---|
1503 | } |
---|
1504 | break; |
---|
1505 | case 6: |
---|
1506 | { |
---|
1507 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1508 | { |
---|
1509 | piSrcTmp = &piSrc[ -1 ]; |
---|
1510 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1511 | { |
---|
1512 | iSum = xCTI_Filter_VP04_C_QUA1( piSrcTmp, 1 ); |
---|
1513 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1514 | piSrcTmp++; |
---|
1515 | } |
---|
1516 | piSrc += iSrcStride; |
---|
1517 | piDst += iDstStride; |
---|
1518 | } |
---|
1519 | } |
---|
1520 | break; |
---|
1521 | case 3: |
---|
1522 | { |
---|
1523 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1524 | { |
---|
1525 | piSrcTmp = &piSrc[ -1 ]; |
---|
1526 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1527 | { |
---|
1528 | iSum = xCTI_Filter_VP04_C_OCT1( piSrcTmp, 1 ); |
---|
1529 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1530 | piSrcTmp++; |
---|
1531 | } |
---|
1532 | piSrc += iSrcStride; |
---|
1533 | piDst += iDstStride; |
---|
1534 | } |
---|
1535 | } |
---|
1536 | break; |
---|
1537 | case 5: |
---|
1538 | { |
---|
1539 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1540 | { |
---|
1541 | piSrcTmp = &piSrc[ -1 ]; |
---|
1542 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1543 | { |
---|
1544 | iSum = xCTI_Filter_VP04_C_OCT2( piSrcTmp, 1 ); |
---|
1545 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1546 | piSrcTmp++; |
---|
1547 | } |
---|
1548 | piSrc += iSrcStride; |
---|
1549 | piDst += iDstStride; |
---|
1550 | } |
---|
1551 | } |
---|
1552 | break; |
---|
1553 | case 7: |
---|
1554 | { |
---|
1555 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1556 | { |
---|
1557 | piSrcTmp = &piSrc[ -1 ]; |
---|
1558 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1559 | { |
---|
1560 | iSum = xCTI_Filter_VP04_C_OCT3( piSrcTmp, 1 ); |
---|
1561 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1562 | piSrcTmp++; |
---|
1563 | } |
---|
1564 | piSrc += iSrcStride; |
---|
1565 | piDst += iDstStride; |
---|
1566 | } |
---|
1567 | } |
---|
1568 | break; |
---|
1569 | case 4: |
---|
1570 | { |
---|
1571 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1572 | { |
---|
1573 | piSrcTmp = &piSrc[ -1 ]; |
---|
1574 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1575 | { |
---|
1576 | iSum = xCTI_Filter_VPS04_C_HAL( piSrcTmp, 1 ); |
---|
1577 | piDst[x ] = Clip ((iSum + 32) >> 6 ); |
---|
1578 | piSrcTmp++; |
---|
1579 | } |
---|
1580 | piSrc += iSrcStride; |
---|
1581 | piDst += iDstStride; |
---|
1582 | } |
---|
1583 | } |
---|
1584 | break; |
---|
1585 | default: |
---|
1586 | assert( 0 ); |
---|
1587 | } |
---|
1588 | return; |
---|
1589 | } |
---|
1590 | |
---|
1591 | #if HIGH_ACCURACY_BI |
---|
1592 | __inline Void TComPredFilter::xCTI_Filter2DHorC_ha(Int* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV) |
---|
1593 | { |
---|
1594 | Pel* piDst = rpiDst; |
---|
1595 | Int iSum; |
---|
1596 | Int* piSrcTmp; |
---|
1597 | Int shiftNum = 6 + g_uiBitIncrement + g_uiBitDepth - 8; |
---|
1598 | Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; |
---|
1599 | |
---|
1600 | switch (iMV) |
---|
1601 | { |
---|
1602 | case 1: |
---|
1603 | { |
---|
1604 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1605 | { |
---|
1606 | piSrcTmp = &piSrc[ -1 ]; |
---|
1607 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1608 | { |
---|
1609 | iSum = xCTI_Filter_VI04_C_OCT0( piSrcTmp, 1 ); |
---|
1610 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1611 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1612 | #else |
---|
1613 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1614 | #endif |
---|
1615 | piSrcTmp++; |
---|
1616 | } |
---|
1617 | piSrc += iSrcStride; |
---|
1618 | piDst += iDstStride; |
---|
1619 | } |
---|
1620 | } |
---|
1621 | break; |
---|
1622 | case 2: |
---|
1623 | { |
---|
1624 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1625 | { |
---|
1626 | piSrcTmp = &piSrc[ -1 ]; |
---|
1627 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1628 | { |
---|
1629 | iSum = xCTI_Filter_VI04_C_QUA0( piSrcTmp, 1 ); |
---|
1630 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1631 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1632 | #else |
---|
1633 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1634 | #endif |
---|
1635 | piSrcTmp++; |
---|
1636 | } |
---|
1637 | piSrc += iSrcStride; |
---|
1638 | piDst += iDstStride; |
---|
1639 | } |
---|
1640 | } |
---|
1641 | break; |
---|
1642 | case 6: |
---|
1643 | { |
---|
1644 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1645 | { |
---|
1646 | piSrcTmp = &piSrc[ -1 ]; |
---|
1647 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1648 | { |
---|
1649 | iSum = xCTI_Filter_VI04_C_QUA1( piSrcTmp, 1 ); |
---|
1650 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1651 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1652 | #else |
---|
1653 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1654 | #endif |
---|
1655 | piSrcTmp++; |
---|
1656 | } |
---|
1657 | piSrc += iSrcStride; |
---|
1658 | piDst += iDstStride; |
---|
1659 | } |
---|
1660 | } |
---|
1661 | break; |
---|
1662 | case 3: |
---|
1663 | { |
---|
1664 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1665 | { |
---|
1666 | piSrcTmp = &piSrc[ -1 ]; |
---|
1667 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1668 | { |
---|
1669 | iSum = xCTI_Filter_VI04_C_OCT1( piSrcTmp, 1 ); |
---|
1670 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1671 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1672 | #else |
---|
1673 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1674 | #endif |
---|
1675 | piSrcTmp++; |
---|
1676 | } |
---|
1677 | piSrc += iSrcStride; |
---|
1678 | piDst += iDstStride; |
---|
1679 | } |
---|
1680 | } |
---|
1681 | break; |
---|
1682 | case 5: |
---|
1683 | { |
---|
1684 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1685 | { |
---|
1686 | piSrcTmp = &piSrc[ -1 ]; |
---|
1687 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1688 | { |
---|
1689 | iSum = xCTI_Filter_VI04_C_OCT2( piSrcTmp, 1 ); |
---|
1690 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1691 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1692 | #else |
---|
1693 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1694 | #endif |
---|
1695 | piSrcTmp++; |
---|
1696 | } |
---|
1697 | piSrc += iSrcStride; |
---|
1698 | piDst += iDstStride; |
---|
1699 | } |
---|
1700 | } |
---|
1701 | break; |
---|
1702 | case 7: |
---|
1703 | { |
---|
1704 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1705 | { |
---|
1706 | piSrcTmp = &piSrc[ -1 ]; |
---|
1707 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1708 | { |
---|
1709 | iSum = xCTI_Filter_VI04_C_OCT3( piSrcTmp, 1 ); |
---|
1710 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1711 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1712 | #else |
---|
1713 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1714 | #endif |
---|
1715 | piSrcTmp++; |
---|
1716 | } |
---|
1717 | piSrc += iSrcStride; |
---|
1718 | piDst += iDstStride; |
---|
1719 | } |
---|
1720 | } |
---|
1721 | break; |
---|
1722 | case 4: |
---|
1723 | { |
---|
1724 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1725 | { |
---|
1726 | piSrcTmp = &piSrc[ -1 ]; |
---|
1727 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1728 | { |
---|
1729 | iSum = xCTI_Filter_VIS04_C_HAL( piSrcTmp, 1 ); |
---|
1730 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1731 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1732 | #else |
---|
1733 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1734 | #endif |
---|
1735 | piSrcTmp++; |
---|
1736 | } |
---|
1737 | piSrc += iSrcStride; |
---|
1738 | piDst += iDstStride; |
---|
1739 | } |
---|
1740 | } |
---|
1741 | break; |
---|
1742 | default: |
---|
1743 | assert( 0 ); |
---|
1744 | } |
---|
1745 | |
---|
1746 | return; |
---|
1747 | } |
---|
1748 | |
---|
1749 | __inline Void TComPredFilter::xCTI_Filter1DVerC_ha (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV) |
---|
1750 | { |
---|
1751 | Pel* piDst = rpiDst; |
---|
1752 | Int iSum; |
---|
1753 | Pel* piSrcTmp; |
---|
1754 | Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8; |
---|
1755 | Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; |
---|
1756 | |
---|
1757 | switch (iMV) |
---|
1758 | { |
---|
1759 | case 1: |
---|
1760 | { |
---|
1761 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1762 | { |
---|
1763 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1764 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1765 | { |
---|
1766 | iSum = xCTI_Filter_VP04_C_OCT0( piSrcTmp, iSrcStride ); |
---|
1767 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1768 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1769 | #else |
---|
1770 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1771 | #endif |
---|
1772 | piSrcTmp++; |
---|
1773 | } |
---|
1774 | piSrc += iSrcStride; |
---|
1775 | piDst += iDstStride; |
---|
1776 | } |
---|
1777 | } |
---|
1778 | break; |
---|
1779 | case 2: |
---|
1780 | { |
---|
1781 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1782 | { |
---|
1783 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1784 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1785 | { |
---|
1786 | iSum = xCTI_Filter_VP04_C_QUA0( piSrcTmp, iSrcStride ); |
---|
1787 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1788 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1789 | #else |
---|
1790 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1791 | #endif |
---|
1792 | piSrcTmp++; |
---|
1793 | } |
---|
1794 | piSrc += iSrcStride; |
---|
1795 | piDst += iDstStride; |
---|
1796 | } |
---|
1797 | } |
---|
1798 | break; |
---|
1799 | case 6: |
---|
1800 | { |
---|
1801 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1802 | { |
---|
1803 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1804 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1805 | { |
---|
1806 | iSum = xCTI_Filter_VP04_C_QUA1( piSrcTmp, iSrcStride ); |
---|
1807 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1808 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1809 | #else |
---|
1810 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1811 | #endif |
---|
1812 | piSrcTmp++; |
---|
1813 | } |
---|
1814 | piSrc += iSrcStride; |
---|
1815 | piDst += iDstStride; |
---|
1816 | } |
---|
1817 | } |
---|
1818 | break; |
---|
1819 | case 3: |
---|
1820 | { |
---|
1821 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1822 | { |
---|
1823 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1824 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1825 | { |
---|
1826 | iSum = xCTI_Filter_VP04_C_OCT1( piSrcTmp, iSrcStride ); |
---|
1827 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1828 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1829 | #else |
---|
1830 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1831 | #endif |
---|
1832 | piSrcTmp++; |
---|
1833 | } |
---|
1834 | piSrc += iSrcStride; |
---|
1835 | piDst += iDstStride; |
---|
1836 | } |
---|
1837 | } |
---|
1838 | break; |
---|
1839 | case 5: |
---|
1840 | { |
---|
1841 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1842 | { |
---|
1843 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1844 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1845 | { |
---|
1846 | iSum = xCTI_Filter_VP04_C_OCT2( piSrcTmp, iSrcStride ); |
---|
1847 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1848 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1849 | #else |
---|
1850 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1851 | #endif |
---|
1852 | piSrcTmp++; |
---|
1853 | } |
---|
1854 | piSrc += iSrcStride; |
---|
1855 | piDst += iDstStride; |
---|
1856 | } |
---|
1857 | } |
---|
1858 | break; |
---|
1859 | case 7: |
---|
1860 | { |
---|
1861 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1862 | { |
---|
1863 | piSrcTmp = &piSrc[ -iSrcStride ]; |
---|
1864 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1865 | { |
---|
1866 | iSum = xCTI_Filter_VP04_C_OCT3( piSrcTmp, iSrcStride ); |
---|
1867 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1868 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1869 | #else |
---|
1870 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1871 | #endif |
---|
1872 | piSrcTmp++; |
---|
1873 | } |
---|
1874 | piSrc += iSrcStride; |
---|
1875 | piDst += iDstStride; |
---|
1876 | } |
---|
1877 | } |
---|
1878 | break; |
---|
1879 | case 4: |
---|
1880 | { |
---|
1881 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1882 | { |
---|
1883 | piSrcTmp = &piSrc[-iSrcStride ]; |
---|
1884 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1885 | { |
---|
1886 | iSum = xCTI_Filter_VPS04_C_HAL( piSrcTmp, iSrcStride ); |
---|
1887 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1888 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1889 | #else |
---|
1890 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1891 | #endif |
---|
1892 | piSrcTmp++; |
---|
1893 | } |
---|
1894 | piSrc += iSrcStride; |
---|
1895 | piDst += iDstStride; |
---|
1896 | } |
---|
1897 | } |
---|
1898 | break; |
---|
1899 | default: |
---|
1900 | assert( 0 ); |
---|
1901 | } |
---|
1902 | return; |
---|
1903 | } |
---|
1904 | |
---|
1905 | __inline Void TComPredFilter::xCTI_Filter1DHorC_ha(Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV) |
---|
1906 | { |
---|
1907 | Pel* piDst = rpiDst; |
---|
1908 | Int iSum; |
---|
1909 | Pel* piSrcTmp; |
---|
1910 | Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8; |
---|
1911 | Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ; |
---|
1912 | |
---|
1913 | switch (iMV) |
---|
1914 | { |
---|
1915 | case 1: |
---|
1916 | { |
---|
1917 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1918 | { |
---|
1919 | piSrcTmp = &piSrc[ -1 ]; |
---|
1920 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1921 | { |
---|
1922 | iSum = xCTI_Filter_VP04_C_OCT0( piSrcTmp, 1 ); |
---|
1923 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1924 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1925 | #else |
---|
1926 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1927 | #endif |
---|
1928 | piSrcTmp++; |
---|
1929 | } |
---|
1930 | piSrc += iSrcStride; |
---|
1931 | piDst += iDstStride; |
---|
1932 | } |
---|
1933 | } |
---|
1934 | break; |
---|
1935 | case 2: |
---|
1936 | { |
---|
1937 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1938 | { |
---|
1939 | piSrcTmp = &piSrc[ -1 ]; |
---|
1940 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1941 | { |
---|
1942 | iSum = xCTI_Filter_VP04_C_QUA0( piSrcTmp, 1 ); |
---|
1943 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1944 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1945 | #else |
---|
1946 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1947 | #endif |
---|
1948 | piSrcTmp++; |
---|
1949 | } |
---|
1950 | piSrc += iSrcStride; |
---|
1951 | piDst += iDstStride; |
---|
1952 | } |
---|
1953 | } |
---|
1954 | break; |
---|
1955 | case 6: |
---|
1956 | { |
---|
1957 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1958 | { |
---|
1959 | piSrcTmp = &piSrc[ -1 ]; |
---|
1960 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1961 | { |
---|
1962 | iSum = xCTI_Filter_VP04_C_QUA1( piSrcTmp, 1 ); |
---|
1963 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1964 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1965 | #else |
---|
1966 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1967 | #endif |
---|
1968 | piSrcTmp++; |
---|
1969 | } |
---|
1970 | piSrc += iSrcStride; |
---|
1971 | piDst += iDstStride; |
---|
1972 | } |
---|
1973 | } |
---|
1974 | break; |
---|
1975 | case 3: |
---|
1976 | { |
---|
1977 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1978 | { |
---|
1979 | piSrcTmp = &piSrc[ -1 ]; |
---|
1980 | for ( Int x = 0; x < iWidth; x++ ) |
---|
1981 | { |
---|
1982 | iSum = xCTI_Filter_VP04_C_OCT1( piSrcTmp, 1 ); |
---|
1983 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
1984 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
1985 | #else |
---|
1986 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
1987 | #endif |
---|
1988 | piSrcTmp++; |
---|
1989 | } |
---|
1990 | piSrc += iSrcStride; |
---|
1991 | piDst += iDstStride; |
---|
1992 | } |
---|
1993 | } |
---|
1994 | break; |
---|
1995 | case 5: |
---|
1996 | { |
---|
1997 | for ( Int y = iHeight; y != 0; y-- ) |
---|
1998 | { |
---|
1999 | piSrcTmp = &piSrc[ -1 ]; |
---|
2000 | for ( Int x = 0; x < iWidth; x++ ) |
---|
2001 | { |
---|
2002 | iSum = xCTI_Filter_VP04_C_OCT2( piSrcTmp, 1 ); |
---|
2003 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
2004 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
2005 | #else |
---|
2006 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
2007 | #endif |
---|
2008 | piSrcTmp++; |
---|
2009 | } |
---|
2010 | piSrc += iSrcStride; |
---|
2011 | piDst += iDstStride; |
---|
2012 | } |
---|
2013 | } |
---|
2014 | break; |
---|
2015 | case 7: |
---|
2016 | { |
---|
2017 | for ( Int y = iHeight; y != 0; y-- ) |
---|
2018 | { |
---|
2019 | piSrcTmp = &piSrc[ -1 ]; |
---|
2020 | for ( Int x = 0; x < iWidth; x++ ) |
---|
2021 | { |
---|
2022 | iSum = xCTI_Filter_VP04_C_OCT3( piSrcTmp, 1 ); |
---|
2023 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
2024 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
2025 | #else |
---|
2026 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
2027 | #endif |
---|
2028 | piSrcTmp++; |
---|
2029 | } |
---|
2030 | piSrc += iSrcStride; |
---|
2031 | piDst += iDstStride; |
---|
2032 | } |
---|
2033 | } |
---|
2034 | break; |
---|
2035 | case 4: |
---|
2036 | { |
---|
2037 | for ( Int y = iHeight; y != 0; y-- ) |
---|
2038 | { |
---|
2039 | piSrcTmp = &piSrc[ -1 ]; |
---|
2040 | for ( Int x = 0; x < iWidth; x++ ) |
---|
2041 | { |
---|
2042 | iSum = xCTI_Filter_VPS04_C_HAL( piSrcTmp, 1 ); |
---|
2043 | #if REMOVE_INTERMEDIATE_CLIPPING |
---|
2044 | piDst[x ] = (iSum + shiftOffset) >> shiftNum; |
---|
2045 | #else |
---|
2046 | piDst[x ] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum ); |
---|
2047 | #endif |
---|
2048 | piSrcTmp++; |
---|
2049 | } |
---|
2050 | piSrc += iSrcStride; |
---|
2051 | piDst += iDstStride; |
---|
2052 | } |
---|
2053 | } |
---|
2054 | break; |
---|
2055 | default: |
---|
2056 | assert( 0 ); |
---|
2057 | |
---|
2058 | } |
---|
2059 | return; |
---|
2060 | } |
---|
2061 | #endif |
---|
2062 | |
---|
2063 | |
---|
2064 | __inline Int TComPredFilter::xCTI_Filter_VP04_C_OCT0( Pel* pSrc, Int iStride ) |
---|
2065 | {// { -3, 60, 8, -1,} // 1/8 |
---|
2066 | Int iSum, iIdx = 0; |
---|
2067 | |
---|
2068 | Int p0 = pSrc[0]; iIdx+= iStride; |
---|
2069 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
---|
2070 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
---|
2071 | Int p3 = pSrc[iIdx]; |
---|
2072 | iSum = (p1<<6) -((p1+p0)<<2) +p0 +(p2<<3) -p3; |
---|
2073 | |
---|
2074 | return iSum; |
---|
2075 | } |
---|
2076 | __inline Int TComPredFilter::xCTI_Filter_VI04_C_OCT0( Int* pSrc, Int iStride ) |
---|
2077 | { // { -3, 60, 8, -1,} //1/8 |
---|
2078 | Int iSum, iIdx = 0; |
---|
2079 | |
---|
2080 | Int p0 = pSrc[0]; iIdx+= iStride; |
---|
2081 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
---|
2082 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
---|
2083 | Int p3 = pSrc[iIdx]; |
---|
2084 | iSum = (p1<<6) -((p1+p0)<<2) +p0 +(p2<<3) -p3; |
---|
2085 | |
---|
2086 | return iSum; |
---|
2087 | } |
---|
2088 | __inline Int TComPredFilter::xCTI_Filter_VP04_C_QUA0( Pel* pSrc, Int iStride ) |
---|
2089 | {// { -4, 54, 16, -2,} // 1/4 |
---|
2090 | Int iSum, iIdx = 0; |
---|
2091 | |
---|
2092 | Int p0 = pSrc[0]; iIdx+= iStride; |
---|
2093 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
---|
2094 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
---|
2095 | Int p3 = pSrc[iIdx]; |
---|
2096 | iSum = (p1 << 6) + (p2 << 4) - (p1 << 3) - ( p0 << 2) - ((p1 + p3) << 1); |
---|
2097 | |
---|
2098 | return iSum; |
---|
2099 | } |
---|
2100 | __inline Int TComPredFilter::xCTI_Filter_VI04_C_QUA0( Int* pSrc, Int iStride ) |
---|
2101 | { // { -4, 54, 16, -2,} //1/4 |
---|
2102 | Int iSum, iIdx = 0; |
---|
2103 | |
---|
2104 | Int p0 = pSrc[0]; iIdx+= iStride; |
---|
2105 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
---|
2106 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
---|
2107 | Int p3 = pSrc[iIdx]; |
---|
2108 | iSum = (p1 << 6) + (p2 << 4) - (p1 << 3) - ( p0 << 2) - ((p1 + p3) << 1); |
---|
2109 | |
---|
2110 | return iSum; |
---|
2111 | } |
---|
2112 | __inline Int TComPredFilter::xCTI_Filter_VP04_C_QUA1( Pel* pSrc, Int iStride ) |
---|
2113 | {// { -2, 16, 54, -4,}// 3/4 |
---|
2114 | Int iSum, iIdx = 0; |
---|
2115 | |
---|
2116 | Int p0 = pSrc[0]; iIdx+= iStride; |
---|
2117 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
---|
2118 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
---|
2119 | Int p3 = pSrc[iIdx]; |
---|
2120 | iSum = (p2 << 6) + (p1 << 4) - (p2 << 3) - ( p3 << 2) - ((p2 + p0) << 1); |
---|
2121 | |
---|
2122 | return iSum; |
---|
2123 | } |
---|
2124 | __inline Int TComPredFilter::xCTI_Filter_VI04_C_QUA1( Int* pSrc, Int iStride ) |
---|
2125 | {// { -2, 16, 54, -4,}// 3/4 |
---|
2126 | Int iSum, iIdx = 0; |
---|
2127 | |
---|
2128 | Int p0 = pSrc[0]; iIdx+= iStride; |
---|
2129 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
---|
2130 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
---|
2131 | Int p3 = pSrc[iIdx]; |
---|
2132 | iSum = (p2 << 6) + (p1 << 4) - (p2 << 3) - ( p3 << 2) - ((p2 + p0) << 1); |
---|
2133 | |
---|
2134 | return iSum; |
---|
2135 | } |
---|
2136 | __inline Int TComPredFilter::xCTI_Filter_VP04_C_OCT1( Pel* pSrc, Int iStride ) |
---|
2137 | {// { -5, 46, 27, -4,} // 3/8 |
---|
2138 | Int iSum, iIdx = 0; |
---|
2139 | |
---|
2140 | Int p0 = pSrc[0]; iIdx+= iStride; |
---|
2141 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
---|
2142 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
---|
2143 | Int p3 = pSrc[iIdx]; |
---|
2144 | Int t = p0 + p2; |
---|
2145 | iSum = ((p1 + p2) << 5) + (p1 << 4) - ( (t + p3) << 2) - ( p1 << 1) - t; |
---|
2146 | |
---|
2147 | return iSum; |
---|
2148 | } |
---|
2149 | __inline Int TComPredFilter::xCTI_Filter_VI04_C_OCT1( Int* pSrc, Int iStride ) |
---|
2150 | { // { -5, 46, 27, -4,} //3/8 |
---|
2151 | Int iSum, iIdx = 0; |
---|
2152 | |
---|
2153 | Int p0 = pSrc[0]; iIdx+= iStride; |
---|
2154 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
---|
2155 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
---|
2156 | Int p3 = pSrc[iIdx]; |
---|
2157 | Int t = p0 + p2; |
---|
2158 | iSum = ((p1 + p2) << 5) + (p1 << 4) - ( (t + p3) << 2) - ( p1 << 1) - t; |
---|
2159 | |
---|
2160 | return iSum; |
---|
2161 | } |
---|
2162 | __inline Int TComPredFilter::xCTI_Filter_VPS04_C_HAL( Pel* pSrc, Int iStride ) |
---|
2163 | { |
---|
2164 | // { -4, 36, 36, -4,}, // 1/2 |
---|
2165 | Int iSum; |
---|
2166 | Int iTemp0 = pSrc[iStride*1]+pSrc[iStride*2]; |
---|
2167 | Int iTemp1 = pSrc[ 0]+pSrc[iStride*3]; |
---|
2168 | |
---|
2169 | iSum = ((iTemp0<<3) + iTemp0 -iTemp1)<<2; |
---|
2170 | |
---|
2171 | return iSum; |
---|
2172 | } |
---|
2173 | __inline Int TComPredFilter::xCTI_Filter_VIS04_C_HAL( Int* pSrc, Int iStride ) |
---|
2174 | { |
---|
2175 | // { -4, 36, 36, -4,}, //1/2 |
---|
2176 | Int iSum; |
---|
2177 | Int iTemp0 = pSrc[iStride*1]+pSrc[iStride*2]; |
---|
2178 | Int iTemp1 = pSrc[ 0]+pSrc[iStride*3]; |
---|
2179 | |
---|
2180 | iSum = ((iTemp0<<3) + iTemp0 -iTemp1)<<2; |
---|
2181 | |
---|
2182 | return iSum; |
---|
2183 | } |
---|
2184 | __inline Int TComPredFilter::xCTI_Filter_VP04_C_OCT2( Pel* pSrc, Int iStride ) |
---|
2185 | {// { -4, 27, 46, -5,}, // 5/8 |
---|
2186 | Int iSum, iIdx = 0; |
---|
2187 | |
---|
2188 | Int p0 = pSrc[0]; iIdx+= iStride; |
---|
2189 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
---|
2190 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
---|
2191 | Int p3 = pSrc[iIdx]; |
---|
2192 | Int t = p1 + p3; |
---|
2193 | iSum = ((p1 + p2) << 5) + (p2 << 4) - ( (t + p0) << 2) - ( p2 << 1) - t; |
---|
2194 | |
---|
2195 | return iSum; |
---|
2196 | } |
---|
2197 | __inline Int TComPredFilter::xCTI_Filter_VI04_C_OCT2( Int* pSrc, Int iStride ) |
---|
2198 | { // { -4, 27, 46, -5,}, // 5/8 |
---|
2199 | Int iSum, iIdx = 0; |
---|
2200 | |
---|
2201 | Int p0 = pSrc[0]; iIdx+= iStride; |
---|
2202 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
---|
2203 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
---|
2204 | Int p3 = pSrc[iIdx]; |
---|
2205 | Int t = p1 + p3; |
---|
2206 | iSum = ((p1 + p2) << 5) + (p2 << 4) - ( (t + p0) << 2) - ( p2 << 1) - t; |
---|
2207 | |
---|
2208 | return iSum; |
---|
2209 | } |
---|
2210 | __inline Int TComPredFilter::xCTI_Filter_VP04_C_OCT3( Pel* pSrc, Int iStride ) |
---|
2211 | {// { -1, 8, 60, -3,} // 7/8 |
---|
2212 | Int iSum, iIdx = 0; |
---|
2213 | |
---|
2214 | Int p0 = pSrc[0]; iIdx+= iStride; |
---|
2215 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
---|
2216 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
---|
2217 | Int p3 = pSrc[iIdx]; |
---|
2218 | iSum = (p2<<6) -((p2+p3)<<2) +p3 +(p1<<3) -p0; |
---|
2219 | |
---|
2220 | return iSum; |
---|
2221 | } |
---|
2222 | __inline Int TComPredFilter::xCTI_Filter_VI04_C_OCT3( Int* pSrc, Int iStride ) |
---|
2223 | { // { -1, 8, 60, -3,} // 7/8 |
---|
2224 | Int iSum, iIdx = 0; |
---|
2225 | |
---|
2226 | Int p0 = pSrc[0]; iIdx+= iStride; |
---|
2227 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
---|
2228 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
---|
2229 | Int p3 = pSrc[iIdx]; |
---|
2230 | iSum = (p2<<6) -((p2+p3)<<2) +p3 +(p1<<3) -p0; |
---|
2231 | |
---|
2232 | return iSum; |
---|
2233 | } |
---|
2234 | |
---|
2235 | #endif // __TCOMPREDFILTER__ |
---|