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