1 |
|
/***************************************************************************** |
2 |
|
* |
3 |
|
* XVID MPEG-4 VIDEO CODEC |
4 |
|
* - Interpolation related header - |
5 |
|
* |
6 |
|
* Copyright(C) 2001-2003 Peter Ross <pross@xvid.org> |
7 |
|
* |
8 |
|
* This program is free software ; you can redistribute it and/or modify |
9 |
|
* it under the terms of the GNU General Public License as published by |
10 |
|
* the Free Software Foundation ; either version 2 of the License, or |
11 |
|
* (at your option) any later version. |
12 |
|
* |
13 |
|
* This program is distributed in the hope that it will be useful, |
14 |
|
* but WITHOUT ANY WARRANTY ; without even the implied warranty of |
15 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
* GNU General Public License for more details. |
17 |
|
* |
18 |
|
* You should have received a copy of the GNU General Public License |
19 |
|
* along with this program ; if not, write to the Free Software |
20 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
|
* |
22 |
|
* $Id$ |
23 |
|
* |
24 |
|
****************************************************************************/ |
25 |
|
|
26 |
|
#ifndef _INTERPOLATE8X8_H_ |
27 |
|
#define _INTERPOLATE8X8_H_ |
28 |
|
|
29 |
#include "../utils/mem_transfer.h" |
#include "../utils/mem_transfer.h" |
30 |
|
|
31 |
typedef void (INTERPOLATE8X8) (uint8_t * const dst, |
typedef void (INTERPOLATE8X8) (uint8_t * const dst, |
34 |
const uint32_t rounding); |
const uint32_t rounding); |
35 |
typedef INTERPOLATE8X8 *INTERPOLATE8X8_PTR; |
typedef INTERPOLATE8X8 *INTERPOLATE8X8_PTR; |
36 |
|
|
37 |
|
typedef void (INTERPOLATE8X4) (uint8_t * const dst, |
38 |
|
const uint8_t * const src, |
39 |
|
const uint32_t stride, |
40 |
|
const uint32_t rounding); |
41 |
|
typedef INTERPOLATE8X4 *INTERPOLATE8X4_PTR; |
42 |
|
|
43 |
|
typedef void (INTERPOLATE8X8_AVG2) (uint8_t *dst, |
44 |
|
const uint8_t *src1, |
45 |
|
const uint8_t *src2, |
46 |
|
const uint32_t stride, |
47 |
|
const uint32_t rounding, |
48 |
|
const uint32_t height); |
49 |
|
typedef INTERPOLATE8X8_AVG2 *INTERPOLATE8X8_AVG2_PTR; |
50 |
|
|
51 |
|
typedef void (INTERPOLATE8X8_AVG4) (uint8_t *dst, |
52 |
|
const uint8_t *src1, |
53 |
|
const uint8_t *src2, |
54 |
|
const uint8_t *src3, |
55 |
|
const uint8_t *src4, |
56 |
|
const uint32_t stride, |
57 |
|
const uint32_t rounding); |
58 |
|
typedef INTERPOLATE8X8_AVG4 *INTERPOLATE8X8_AVG4_PTR; |
59 |
|
|
60 |
|
typedef void (INTERPOLATE_LOWPASS) (uint8_t *dst, |
61 |
|
uint8_t *src, |
62 |
|
int32_t stride, |
63 |
|
int32_t rounding); |
64 |
|
|
65 |
|
typedef INTERPOLATE_LOWPASS *INTERPOLATE_LOWPASS_PTR; |
66 |
|
|
67 |
|
typedef void (INTERPOLATE_LOWPASS_HV) (uint8_t *dst1, |
68 |
|
uint8_t *dst2, |
69 |
|
uint8_t *src, |
70 |
|
int32_t stride, |
71 |
|
int32_t rounding); |
72 |
|
|
73 |
|
typedef INTERPOLATE_LOWPASS_HV *INTERPOLATE_LOWPASS_HV_PTR; |
74 |
|
|
75 |
|
typedef void (INTERPOLATE8X8_6TAP_LOWPASS) (uint8_t *dst, |
76 |
|
uint8_t *src, |
77 |
|
int32_t stride, |
78 |
|
int32_t rounding); |
79 |
|
|
80 |
|
typedef INTERPOLATE8X8_6TAP_LOWPASS *INTERPOLATE8X8_6TAP_LOWPASS_PTR; |
81 |
|
|
82 |
|
/* These function do: dst = interpolate(src) */ |
83 |
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_h; |
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_h; |
84 |
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_v; |
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_v; |
85 |
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_hv; |
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_hv; |
86 |
|
|
87 |
|
extern INTERPOLATE8X4_PTR interpolate8x4_halfpel_h; |
88 |
|
extern INTERPOLATE8X4_PTR interpolate8x4_halfpel_v; |
89 |
|
extern INTERPOLATE8X4_PTR interpolate8x4_halfpel_hv; |
90 |
|
|
91 |
|
/* These functions do: dst = (dst+interpolate(src) + 1)/2 |
92 |
|
* Suitable for direct/interpolated bvop prediction block |
93 |
|
* building w/o the need for intermediate interpolated result |
94 |
|
* storing/reading |
95 |
|
* NB: the rounding applies to the interpolation, but not |
96 |
|
* the averaging step which will always use rounding=0 */ |
97 |
|
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_add; |
98 |
|
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_h_add; |
99 |
|
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_v_add; |
100 |
|
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_hv_add; |
101 |
|
|
102 |
|
extern INTERPOLATE8X8_AVG2_PTR interpolate8x8_avg2; |
103 |
|
extern INTERPOLATE8X8_AVG4_PTR interpolate8x8_avg4; |
104 |
|
|
105 |
|
extern INTERPOLATE_LOWPASS_PTR interpolate8x8_lowpass_h; |
106 |
|
extern INTERPOLATE_LOWPASS_PTR interpolate8x8_lowpass_v; |
107 |
|
|
108 |
|
extern INTERPOLATE_LOWPASS_PTR interpolate16x16_lowpass_h; |
109 |
|
extern INTERPOLATE_LOWPASS_PTR interpolate16x16_lowpass_v; |
110 |
|
|
111 |
|
extern INTERPOLATE_LOWPASS_HV_PTR interpolate8x8_lowpass_hv; |
112 |
|
extern INTERPOLATE_LOWPASS_HV_PTR interpolate16x16_lowpass_hv; |
113 |
|
|
114 |
|
extern INTERPOLATE8X8_6TAP_LOWPASS_PTR interpolate8x8_6tap_lowpass_h; |
115 |
|
extern INTERPOLATE8X8_6TAP_LOWPASS_PTR interpolate8x8_6tap_lowpass_v; |
116 |
|
|
117 |
INTERPOLATE8X8 interpolate8x8_halfpel_h_c; |
INTERPOLATE8X8 interpolate8x8_halfpel_h_c; |
118 |
INTERPOLATE8X8 interpolate8x8_halfpel_v_c; |
INTERPOLATE8X8 interpolate8x8_halfpel_v_c; |
119 |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_c; |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_c; |
120 |
|
|
121 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_h_c; |
122 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_v_c; |
123 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_hv_c; |
124 |
|
|
125 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_add_c; |
126 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_h_add_c; |
127 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_v_add_c; |
128 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_hv_add_c; |
129 |
|
|
130 |
|
#ifdef ARCH_IS_IA32 |
131 |
INTERPOLATE8X8 interpolate8x8_halfpel_h_mmx; |
INTERPOLATE8X8 interpolate8x8_halfpel_h_mmx; |
132 |
INTERPOLATE8X8 interpolate8x8_halfpel_v_mmx; |
INTERPOLATE8X8 interpolate8x8_halfpel_v_mmx; |
133 |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_mmx; |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_mmx; |
134 |
|
|
135 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_h_mmx; |
136 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_v_mmx; |
137 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_hv_mmx; |
138 |
|
|
139 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_add_mmx; |
140 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_h_add_mmx; |
141 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_v_add_mmx; |
142 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_hv_add_mmx; |
143 |
|
|
144 |
INTERPOLATE8X8 interpolate8x8_halfpel_h_xmm; |
INTERPOLATE8X8 interpolate8x8_halfpel_h_xmm; |
145 |
INTERPOLATE8X8 interpolate8x8_halfpel_v_xmm; |
INTERPOLATE8X8 interpolate8x8_halfpel_v_xmm; |
146 |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_xmm; |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_xmm; |
147 |
|
|
148 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_h_xmm; |
149 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_v_xmm; |
150 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_hv_xmm; |
151 |
|
|
152 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_add_xmm; |
153 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_h_add_xmm; |
154 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_v_add_xmm; |
155 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_hv_add_xmm; |
156 |
|
|
157 |
INTERPOLATE8X8 interpolate8x8_halfpel_h_3dn; |
INTERPOLATE8X8 interpolate8x8_halfpel_h_3dn; |
158 |
INTERPOLATE8X8 interpolate8x8_halfpel_v_3dn; |
INTERPOLATE8X8 interpolate8x8_halfpel_v_3dn; |
159 |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_3dn; |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_3dn; |
160 |
|
|
161 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_h_3dn; |
162 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_v_3dn; |
163 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_hv_3dn; |
164 |
|
|
165 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_h_3dne; |
166 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_v_3dne; |
167 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_hv_3dne; |
168 |
|
|
169 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_h_3dne; |
170 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_v_3dne; |
171 |
|
INTERPOLATE8X4 interpolate8x4_halfpel_hv_3dne; |
172 |
|
#endif |
173 |
|
|
174 |
|
#ifdef ARCH_IS_IA64 |
175 |
INTERPOLATE8X8 interpolate8x8_halfpel_h_ia64; |
INTERPOLATE8X8 interpolate8x8_halfpel_h_ia64; |
176 |
INTERPOLATE8X8 interpolate8x8_halfpel_v_ia64; |
INTERPOLATE8X8 interpolate8x8_halfpel_v_ia64; |
177 |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_ia64; |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_ia64; |
178 |
|
#endif |
179 |
|
|
180 |
void interpolate8x8_lowpass_h(uint8_t *dst, uint8_t *src, int32_t dst_stride, int32_t src_stride, int32_t rounding); |
#ifdef ARCH_IS_PPC |
181 |
void interpolate8x8_lowpass_v(uint8_t *dst, uint8_t *src, int32_t dst_stride, int32_t src_stride, int32_t rounding); |
INTERPOLATE8X8 interpolate8x8_halfpel_h_altivec_c; |
182 |
void interpolate8x8_lowpass_hv(uint8_t *dst1, uint8_t *dst2, uint8_t *src, int32_t dst1_stride, int32_t dst2_stride, int32_t src_stride, int32_t rounding); |
INTERPOLATE8X8 interpolate8x8_halfpel_v_altivec_c; |
183 |
void interpolate8x8_bilinear2(uint8_t *dst, uint8_t *src1, uint8_t *src2, int32_t dst_stride, int32_t src_stride, int32_t rounding); |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_altivec_c; |
184 |
void interpolate8x8_bilinear4(uint8_t *dst, uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4, int32_t stride, int32_t rounding); |
|
185 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_add_altivec_c; |
186 |
void interpolate8x8_c(uint8_t * const dst, |
INTERPOLATE8X8 interpolate8x8_halfpel_h_add_altivec_c; |
187 |
const uint8_t * const src, |
INTERPOLATE8X8 interpolate8x8_halfpel_v_add_altivec_c; |
188 |
const uint32_t x, |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_add_altivec_c; |
189 |
const uint32_t y, |
#endif |
190 |
const uint32_t stride); |
|
191 |
|
#ifdef ARCH_IS_X86_64 |
192 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_h_x86_64; |
193 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_v_x86_64; |
194 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_hv_x86_64; |
195 |
|
|
196 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_add_x86_64; |
197 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_h_add_x86_64; |
198 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_v_add_x86_64; |
199 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_hv_add_x86_64; |
200 |
|
#endif |
201 |
|
|
202 |
|
INTERPOLATE8X8_AVG2 interpolate8x8_avg2_c; |
203 |
|
INTERPOLATE8X8_AVG4 interpolate8x8_avg4_c; |
204 |
|
|
205 |
|
#ifdef ARCH_IS_IA32 |
206 |
|
INTERPOLATE8X8_AVG2 interpolate8x8_avg2_mmx; |
207 |
|
INTERPOLATE8X8_AVG4 interpolate8x8_avg4_mmx; |
208 |
|
#endif |
209 |
|
|
210 |
|
#ifdef ARCH_IS_PPC |
211 |
|
INTERPOLATE8X8_AVG2 interpolate8x8_avg2_altivec_c; |
212 |
|
INTERPOLATE8X8_AVG4 interpolate8x8_avg4_altivec_c; |
213 |
|
#endif |
214 |
|
|
215 |
|
#ifdef ARCH_IS_X86_64 |
216 |
|
INTERPOLATE8X8_AVG2 interpolate8x8_avg2_x86_64; |
217 |
|
INTERPOLATE8X8_AVG4 interpolate8x8_avg4_x86_64; |
218 |
|
#endif |
219 |
|
|
220 |
|
INTERPOLATE_LOWPASS interpolate8x8_lowpass_h_c; |
221 |
|
INTERPOLATE_LOWPASS interpolate8x8_lowpass_v_c; |
222 |
|
|
223 |
|
INTERPOLATE_LOWPASS interpolate16x16_lowpass_h_c; |
224 |
|
INTERPOLATE_LOWPASS interpolate16x16_lowpass_v_c; |
225 |
|
|
226 |
|
INTERPOLATE_LOWPASS_HV interpolate8x8_lowpass_hv_c; |
227 |
|
INTERPOLATE_LOWPASS_HV interpolate16x16_lowpass_hv_c; |
228 |
|
|
229 |
|
INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_h_c; |
230 |
|
INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_v_c; |
231 |
|
|
232 |
|
#ifdef ARCH_IS_IA32 |
233 |
|
INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_h_mmx; |
234 |
|
INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_v_mmx; |
235 |
|
#endif |
236 |
|
|
237 |
|
#ifdef ARCH_IS_PPC |
238 |
|
INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_h_altivec_c; |
239 |
|
#endif |
240 |
|
|
241 |
|
#ifdef ARCH_IS_X86_64 |
242 |
|
INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_h_x86_64; |
243 |
|
INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_v_x86_64; |
244 |
|
#endif |
245 |
|
|
246 |
static __inline void |
static __inline void |
247 |
interpolate8x8_switch(uint8_t * const cur, |
interpolate8x4_switch(uint8_t * const cur, |
248 |
const uint8_t * const refn, |
const uint8_t * const refn, |
249 |
const uint32_t x, |
const uint32_t x, |
250 |
const uint32_t y, |
const uint32_t y, |
253 |
const uint32_t stride, |
const uint32_t stride, |
254 |
const uint32_t rounding) |
const uint32_t rounding) |
255 |
{ |
{ |
|
int32_t ddx, ddy; |
|
256 |
|
|
257 |
switch (((dx & 1) << 1) + (dy & 1)) // ((dx%2)?2:0)+((dy%2)?1:0) |
const uint8_t * const src = refn + (int)((y + (dy>>1)) * stride + x + (dx>>1)); |
258 |
{ |
uint8_t * const dst = cur + (int)(y * stride + x); |
259 |
|
|
260 |
|
switch (((dx & 1) << 1) + (dy & 1)) |
261 |
|
{ /* ((dx%2)?2:0)+((dy%2)?1:0) */ |
262 |
case 0: |
case 0: |
263 |
ddx = dx / 2; |
transfer8x4_copy(dst, src, stride); |
|
ddy = dy / 2; |
|
|
transfer8x8_copy(cur + y * stride + x, |
|
|
refn + (int)((y + ddy) * stride + x + ddx), stride); |
|
264 |
break; |
break; |
|
|
|
265 |
case 1: |
case 1: |
266 |
ddx = dx / 2; |
interpolate8x4_halfpel_v(dst, src, stride, rounding); |
|
ddy = (dy - 1) / 2; |
|
|
interpolate8x8_halfpel_v(cur + y * stride + x, |
|
|
refn + (int)((y + ddy) * stride + x + ddx), stride, |
|
|
rounding); |
|
267 |
break; |
break; |
|
|
|
268 |
case 2: |
case 2: |
269 |
ddx = (dx - 1) / 2; |
interpolate8x4_halfpel_h(dst, src, stride, rounding); |
|
ddy = dy / 2; |
|
|
interpolate8x8_halfpel_h(cur + y * stride + x, |
|
|
refn + (int)((y + ddy) * stride + x + ddx), stride, |
|
|
rounding); |
|
270 |
break; |
break; |
|
|
|
271 |
default: |
default: |
272 |
ddx = (dx - 1) / 2; |
interpolate8x4_halfpel_hv(dst, src, stride, rounding); |
|
ddy = (dy - 1) / 2; |
|
|
interpolate8x8_halfpel_hv(cur + y * stride + x, |
|
|
refn + (int)((y + ddy) * stride + x + ddx), stride, |
|
|
rounding); |
|
273 |
break; |
break; |
274 |
} |
} |
275 |
} |
} |
276 |
|
|
277 |
|
static __inline void |
278 |
static __inline void interpolate8x8_quarterpel(uint8_t * const cur, |
interpolate8x8_switch(uint8_t * const cur, |
279 |
uint8_t * const refn, |
const uint8_t * const refn, |
280 |
const uint32_t x, const uint32_t y, |
const uint32_t x, |
281 |
const int32_t dx, const int dy, |
const uint32_t y, |
282 |
|
const int32_t dx, |
283 |
|
const int dy, |
284 |
const uint32_t stride, |
const uint32_t stride, |
285 |
const uint32_t rounding) |
const uint32_t rounding) |
286 |
{ |
{ |
|
const int32_t xRef = x*4 + dx; |
|
|
const int32_t yRef = y*4 + dy; |
|
|
|
|
|
uint8_t *src, *dst; |
|
|
int32_t x_int, y_int, x_frac, y_frac; |
|
287 |
|
|
288 |
uint8_t halfpel_h[72]; |
const uint8_t * const src = refn + (int)((y + (dy>>1)) * stride + x + (dx>>1)); |
289 |
uint8_t halfpel_v[64]; |
uint8_t * const dst = cur + (int)(y * stride + x); |
|
uint8_t halfpel_hv[64]; |
|
|
|
|
|
x_int = xRef/4; |
|
|
if (xRef < 0 && xRef % 4) |
|
|
x_int--; |
|
|
|
|
|
x_frac = xRef - (4*x_int); |
|
|
|
|
|
y_int = yRef/4; |
|
|
if (yRef < 0 && yRef % 4) |
|
|
y_int--; |
|
|
|
|
|
y_frac = yRef - (4*y_int); |
|
|
|
|
|
src = refn + y_int * stride + x_int; |
|
|
dst = cur + y * stride + x; |
|
|
|
|
|
switch((y_frac << 2) | (x_frac)) { |
|
290 |
|
|
291 |
|
switch (((dx & 1) << 1) + (dy & 1)) { /* ((dx%2)?2:0)+((dy%2)?1:0) */ |
292 |
case 0: |
case 0: |
293 |
transfer8x8_copy(dst, src, stride); |
transfer8x8_copy(dst, src, stride); |
294 |
break; |
break; |
|
|
|
295 |
case 1: |
case 1: |
296 |
interpolate8x8_lowpass_h(halfpel_h, src, 8, stride, rounding); |
interpolate8x8_halfpel_v(dst, src, stride, rounding); |
|
interpolate8x8_bilinear2(dst, src, halfpel_h, stride, stride, rounding); |
|
297 |
break; |
break; |
|
|
|
298 |
case 2: |
case 2: |
299 |
interpolate8x8_lowpass_h(dst, src, stride, stride, rounding); |
interpolate8x8_halfpel_h(dst, src, stride, rounding); |
300 |
break; |
break; |
301 |
|
default: |
302 |
case 3: |
interpolate8x8_halfpel_hv(dst, src, stride, rounding); |
|
interpolate8x8_lowpass_h(halfpel_h, src, 8, stride, rounding); |
|
|
interpolate8x8_bilinear2(dst, src+1, halfpel_h, stride, stride, rounding); |
|
303 |
break; |
break; |
304 |
|
} |
305 |
|
} |
306 |
|
|
307 |
case 4: |
static __inline void |
308 |
interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding); |
interpolate8x8_add_switch(uint8_t * const cur, |
309 |
interpolate8x8_bilinear2(dst, src, halfpel_v, stride, stride, rounding); |
const uint8_t * const refn, |
310 |
break; |
const uint32_t x, |
311 |
|
const uint32_t y, |
312 |
|
const int32_t dx, |
313 |
|
const int dy, |
314 |
|
const uint32_t stride, |
315 |
|
const uint32_t rounding) |
316 |
|
{ |
317 |
|
|
318 |
case 5: |
const uint8_t * const src = refn + (int)((y + (dy>>1)) * stride + x + (dx>>1)); |
319 |
interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding); |
uint8_t * const dst = cur + (int)(y * stride + x); |
|
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
|
|
interpolate8x8_bilinear4(dst, src, halfpel_h, halfpel_v, halfpel_hv, stride, rounding); |
|
|
break; |
|
320 |
|
|
321 |
case 6: |
switch (((dx & 1) << 1) + (dy & 1)) { /* ((dx%2)?2:0)+((dy%2)?1:0) */ |
322 |
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
case 0: |
323 |
interpolate8x8_bilinear2(dst, halfpel_h, halfpel_hv, stride, 8, 1-rounding); |
interpolate8x8_halfpel_add(dst, src, stride, rounding); |
324 |
break; |
break; |
325 |
|
case 1: |
326 |
case 7: |
interpolate8x8_halfpel_v_add(dst, src, stride, rounding); |
|
interpolate8x8_lowpass_v(halfpel_v, src+1, 8, stride, 16-rounding); |
|
|
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
|
|
interpolate8x8_bilinear4(dst, src+1, halfpel_h, halfpel_v, halfpel_hv, stride, rounding); |
|
327 |
break; |
break; |
328 |
|
case 2: |
329 |
case 8: |
interpolate8x8_halfpel_h_add(dst, src, stride, rounding); |
|
interpolate8x8_lowpass_v(dst, src, stride, stride, rounding); |
|
330 |
break; |
break; |
331 |
|
default: |
332 |
case 9: |
interpolate8x8_halfpel_hv_add(dst, src, stride, rounding); |
|
interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, 16-rounding); |
|
|
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
|
|
interpolate8x8_bilinear2(dst, halfpel_v, halfpel_hv, stride, 8, rounding); |
|
333 |
break; |
break; |
334 |
|
} |
335 |
|
} |
336 |
|
|
337 |
case 10: |
static __inline void |
338 |
interpolate8x8_lowpass_hv(dst, halfpel_h, src, stride, 8, stride, rounding); |
interpolate16x16_switch(uint8_t * const cur, |
339 |
break; |
const uint8_t * const refn, |
340 |
|
const uint32_t x, |
341 |
|
const uint32_t y, |
342 |
|
const int32_t dx, |
343 |
|
const int dy, |
344 |
|
const uint32_t stride, |
345 |
|
const uint32_t rounding) |
346 |
|
{ |
347 |
|
interpolate8x8_switch(cur, refn, x, y, dx, dy, stride, rounding); |
348 |
|
interpolate8x8_switch(cur, refn, x+8, y, dx, dy, stride, rounding); |
349 |
|
interpolate8x8_switch(cur, refn, x, y+8, dx, dy, stride, rounding); |
350 |
|
interpolate8x8_switch(cur, refn, x+8, y+8, dx, dy, stride, rounding); |
351 |
|
} |
352 |
|
|
353 |
case 11: |
static __inline void |
354 |
interpolate8x8_lowpass_v(halfpel_v, src+1, 8, stride, 16-rounding); |
interpolate16x16_add_switch(uint8_t * const cur, |
355 |
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
const uint8_t * const refn, |
356 |
interpolate8x8_bilinear2(dst, halfpel_v, halfpel_hv, stride, 8, rounding); |
const uint32_t x, |
357 |
break; |
const uint32_t y, |
358 |
|
const int32_t dx, |
359 |
|
const int dy, |
360 |
|
const uint32_t stride, |
361 |
|
const uint32_t rounding) |
362 |
|
{ |
363 |
|
interpolate8x8_add_switch(cur, refn, x, y, dx, dy, stride, rounding); |
364 |
|
interpolate8x8_add_switch(cur, refn, x+8, y, dx, dy, stride, rounding); |
365 |
|
interpolate8x8_add_switch(cur, refn, x, y+8, dx, dy, stride, rounding); |
366 |
|
interpolate8x8_add_switch(cur, refn, x+8, y+8, dx, dy, stride, rounding); |
367 |
|
} |
368 |
|
|
369 |
case 12: |
static __inline void |
370 |
interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding); |
interpolate32x32_switch(uint8_t * const cur, |
371 |
interpolate8x8_bilinear2(dst, src+stride, halfpel_v, stride, stride, rounding); |
const uint8_t * const refn, |
372 |
break; |
const uint32_t x, |
373 |
|
const uint32_t y, |
374 |
|
const int32_t dx, |
375 |
|
const int dy, |
376 |
|
const uint32_t stride, |
377 |
|
const uint32_t rounding) |
378 |
|
{ |
379 |
|
interpolate16x16_switch(cur, refn, x, y, dx, dy, stride, rounding); |
380 |
|
interpolate16x16_switch(cur, refn, x+16, y, dx, dy, stride, rounding); |
381 |
|
interpolate16x16_switch(cur, refn, x, y+16, dx, dy, stride, rounding); |
382 |
|
interpolate16x16_switch(cur, refn, x+16, y+16, dx, dy, stride, rounding); |
383 |
|
} |
384 |
|
|
385 |
case 13: |
static __inline void |
386 |
interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding); |
interpolate32x32_add_switch(uint8_t * const cur, |
387 |
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
const uint8_t * const refn, |
388 |
interpolate8x8_bilinear4(dst, src+stride, halfpel_h+8, halfpel_v, halfpel_hv, stride, rounding); |
const uint32_t x, |
389 |
break; |
const uint32_t y, |
390 |
|
const int32_t dx, |
391 |
|
const int dy, |
392 |
|
const uint32_t stride, |
393 |
|
const uint32_t rounding) |
394 |
|
{ |
395 |
|
interpolate16x16_add_switch(cur, refn, x, y, dx, dy, stride, rounding); |
396 |
|
interpolate16x16_add_switch(cur, refn, x+16, y, dx, dy, stride, rounding); |
397 |
|
interpolate16x16_add_switch(cur, refn, x, y+16, dx, dy, stride, rounding); |
398 |
|
interpolate16x16_add_switch(cur, refn, x+16, y+16, dx, dy, stride, rounding); |
399 |
|
} |
400 |
|
|
401 |
case 14: |
static __inline uint8_t * |
402 |
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
interpolate8x8_switch2(uint8_t * const buffer, |
403 |
interpolate8x8_bilinear2(dst, halfpel_h+8, halfpel_hv, stride, 8, rounding); |
const uint8_t * const refn, |
404 |
break; |
const int x, |
405 |
|
const int y, |
406 |
|
const int dx, |
407 |
|
const int dy, |
408 |
|
const uint32_t stride, |
409 |
|
const uint32_t rounding) |
410 |
|
{ |
411 |
|
|
412 |
case 15: |
const uint8_t * const src = refn + (int)((y + (dy>>1)) * stride + x + (dx>>1)); |
413 |
interpolate8x8_lowpass_v(halfpel_v, src+1, 8, stride, rounding); |
|
414 |
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
switch (((dx & 1) << 1) + (dy & 1)) { /* ((dx%2)?2:0)+((dy%2)?1:0) */ |
415 |
interpolate8x8_bilinear4(dst, src+stride+1, halfpel_h+8, halfpel_v, halfpel_hv, stride, rounding); |
case 0: |
416 |
|
return (uint8_t *)src; |
417 |
|
case 1: |
418 |
|
interpolate8x8_halfpel_v(buffer, src, stride, rounding); |
419 |
|
break; |
420 |
|
case 2: |
421 |
|
interpolate8x8_halfpel_h(buffer, src, stride, rounding); |
422 |
|
break; |
423 |
|
default: |
424 |
|
interpolate8x8_halfpel_hv(buffer, src, stride, rounding); |
425 |
break; |
break; |
426 |
} |
} |
427 |
|
return buffer; |
428 |
} |
} |
429 |
|
|
430 |
|
#endif |