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