1 |
/***************************************************************************** |
/***************************************************************************** |
2 |
* |
* |
3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* - 8x8 block-based halfpel interpolation - headers |
* - Interpolation related header - |
5 |
* |
* |
6 |
* Copyright(C) 2002 Peter Ross <pross@xvid.org> |
* Copyright(C) 2001-2003 Peter Ross <pross@xvid.org> |
|
* |
|
|
* This program is an implementation of a part of one or more MPEG-4 |
|
|
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
|
|
* to use this software module in hardware or software products are |
|
|
* advised that its use may infringe existing patents or copyrights, and |
|
|
* any such use would be at such party's own risk. The original |
|
|
* developer of this software module and his/her company, and subsequent |
|
|
* editors and their companies, will have no liability for use of this |
|
|
* software or modifications or derivatives thereof. |
|
7 |
* |
* |
8 |
* This program is free software; you can redistribute it and/or modify |
* 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 |
* it under the terms of the GNU General Public License as published by |
19 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* 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 (INTERPOLATE8X8_AVG2) (uint8_t *dst, |
38 |
|
const uint8_t *src1, |
39 |
|
const uint8_t *src2, |
40 |
|
const uint32_t stride, |
41 |
|
const uint32_t rounding, |
42 |
|
const uint32_t height); |
43 |
|
typedef INTERPOLATE8X8_AVG2 *INTERPOLATE8X8_AVG2_PTR; |
44 |
|
|
45 |
|
typedef void (INTERPOLATE8X8_AVG4) (uint8_t *dst, |
46 |
|
const uint8_t *src1, |
47 |
|
const uint8_t *src2, |
48 |
|
const uint8_t *src3, |
49 |
|
const uint8_t *src4, |
50 |
|
const uint32_t stride, |
51 |
|
const uint32_t rounding); |
52 |
|
typedef INTERPOLATE8X8_AVG4 *INTERPOLATE8X8_AVG4_PTR; |
53 |
|
|
54 |
|
typedef void (INTERPOLATE_LOWPASS) (uint8_t *dst, |
55 |
|
uint8_t *src, |
56 |
|
int32_t stride, |
57 |
|
int32_t rounding); |
58 |
|
|
59 |
|
typedef INTERPOLATE_LOWPASS *INTERPOLATE_LOWPASS_PTR; |
60 |
|
|
61 |
|
typedef void (INTERPOLATE_LOWPASS_HV) (uint8_t *dst1, |
62 |
|
uint8_t *dst2, |
63 |
|
uint8_t *src, |
64 |
|
int32_t stride, |
65 |
|
int32_t rounding); |
66 |
|
|
67 |
|
typedef INTERPOLATE_LOWPASS_HV *INTERPOLATE_LOWPASS_HV_PTR; |
68 |
|
|
69 |
|
typedef void (INTERPOLATE8X8_6TAP_LOWPASS) (uint8_t *dst, |
70 |
|
uint8_t *src, |
71 |
|
int32_t stride, |
72 |
|
int32_t rounding); |
73 |
|
|
74 |
|
typedef INTERPOLATE8X8_6TAP_LOWPASS *INTERPOLATE8X8_6TAP_LOWPASS_PTR; |
75 |
|
|
76 |
|
/* These function do: dst = interpolate(src) */ |
77 |
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_h; |
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_h; |
78 |
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_v; |
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_v; |
79 |
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_hv; |
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_hv; |
80 |
|
|
81 |
|
/* These functions do: dst = (dst+interpolate(src) + 1)/2 |
82 |
|
* Suitable for direct/interpolated bvop prediction block |
83 |
|
* building w/o the need for intermediate interpolated result |
84 |
|
* storing/reading |
85 |
|
* NB: the rounding applies to the interpolation, but not |
86 |
|
* the averaging step which will always use rounding=0 */ |
87 |
|
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_add; |
88 |
|
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_h_add; |
89 |
|
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_v_add; |
90 |
|
extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_hv_add; |
91 |
|
|
92 |
|
extern INTERPOLATE8X8_AVG2_PTR interpolate8x8_avg2; |
93 |
|
extern INTERPOLATE8X8_AVG4_PTR interpolate8x8_avg4; |
94 |
|
|
95 |
|
extern INTERPOLATE_LOWPASS_PTR interpolate8x8_lowpass_h; |
96 |
|
extern INTERPOLATE_LOWPASS_PTR interpolate8x8_lowpass_v; |
97 |
|
|
98 |
|
extern INTERPOLATE_LOWPASS_PTR interpolate16x16_lowpass_h; |
99 |
|
extern INTERPOLATE_LOWPASS_PTR interpolate16x16_lowpass_v; |
100 |
|
|
101 |
|
extern INTERPOLATE_LOWPASS_HV_PTR interpolate8x8_lowpass_hv; |
102 |
|
extern INTERPOLATE_LOWPASS_HV_PTR interpolate16x16_lowpass_hv; |
103 |
|
|
104 |
|
extern INTERPOLATE8X8_6TAP_LOWPASS_PTR interpolate8x8_6tap_lowpass_h; |
105 |
|
extern INTERPOLATE8X8_6TAP_LOWPASS_PTR interpolate8x8_6tap_lowpass_v; |
106 |
|
|
107 |
INTERPOLATE8X8 interpolate8x8_halfpel_h_c; |
INTERPOLATE8X8 interpolate8x8_halfpel_h_c; |
108 |
INTERPOLATE8X8 interpolate8x8_halfpel_v_c; |
INTERPOLATE8X8 interpolate8x8_halfpel_v_c; |
109 |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_c; |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_c; |
110 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_add_c; |
111 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_h_add_c; |
112 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_v_add_c; |
113 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_hv_add_c; |
114 |
|
|
115 |
|
#ifdef ARCH_IS_IA32 |
116 |
INTERPOLATE8X8 interpolate8x8_halfpel_h_mmx; |
INTERPOLATE8X8 interpolate8x8_halfpel_h_mmx; |
117 |
INTERPOLATE8X8 interpolate8x8_halfpel_v_mmx; |
INTERPOLATE8X8 interpolate8x8_halfpel_v_mmx; |
118 |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_mmx; |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_mmx; |
119 |
|
|
120 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_add_mmx; |
121 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_h_add_mmx; |
122 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_v_add_mmx; |
123 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_hv_add_mmx; |
124 |
|
|
125 |
INTERPOLATE8X8 interpolate8x8_halfpel_h_xmm; |
INTERPOLATE8X8 interpolate8x8_halfpel_h_xmm; |
126 |
INTERPOLATE8X8 interpolate8x8_halfpel_v_xmm; |
INTERPOLATE8X8 interpolate8x8_halfpel_v_xmm; |
127 |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_xmm; |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_xmm; |
128 |
|
|
129 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_add_xmm; |
130 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_h_add_xmm; |
131 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_v_add_xmm; |
132 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_hv_add_xmm; |
133 |
|
|
134 |
INTERPOLATE8X8 interpolate8x8_halfpel_h_3dn; |
INTERPOLATE8X8 interpolate8x8_halfpel_h_3dn; |
135 |
INTERPOLATE8X8 interpolate8x8_halfpel_v_3dn; |
INTERPOLATE8X8 interpolate8x8_halfpel_v_3dn; |
136 |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_3dn; |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_3dn; |
137 |
|
|
138 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_h_3dne; |
139 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_v_3dne; |
140 |
|
INTERPOLATE8X8 interpolate8x8_halfpel_hv_3dne; |
141 |
|
#endif |
142 |
|
|
143 |
|
#ifdef ARCH_IS_IA64 |
144 |
INTERPOLATE8X8 interpolate8x8_halfpel_h_ia64; |
INTERPOLATE8X8 interpolate8x8_halfpel_h_ia64; |
145 |
INTERPOLATE8X8 interpolate8x8_halfpel_v_ia64; |
INTERPOLATE8X8 interpolate8x8_halfpel_v_ia64; |
146 |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_ia64; |
INTERPOLATE8X8 interpolate8x8_halfpel_hv_ia64; |
147 |
|
#endif |
148 |
|
|
149 |
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 |
150 |
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; |
151 |
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; |
152 |
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; |
153 |
void interpolate8x8_bilinear4(uint8_t *dst, uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4, int32_t stride, int32_t rounding); |
#endif |
154 |
|
|
155 |
void interpolate8x8_c(uint8_t * const dst, |
INTERPOLATE8X8_AVG2 interpolate8x8_avg2_c; |
156 |
const uint8_t * const src, |
INTERPOLATE8X8_AVG4 interpolate8x8_avg4_c; |
157 |
const uint32_t x, |
|
158 |
const uint32_t y, |
#ifdef ARCH_IS_IA32 |
159 |
const uint32_t stride); |
INTERPOLATE8X8_AVG2 interpolate8x8_avg2_mmx; |
160 |
|
INTERPOLATE8X8_AVG4 interpolate8x8_avg4_mmx; |
161 |
|
#endif |
162 |
|
|
163 |
|
#ifdef ARCH_IS_PPC |
164 |
|
INTERPOLATE8X8_AVG2 interpolate8x8_avg2_altivec_c; |
165 |
|
INTERPOLATE8X8_AVG4 interpolate8x8_avg4_altivec_c; |
166 |
|
#endif |
167 |
|
|
168 |
|
INTERPOLATE_LOWPASS interpolate8x8_lowpass_h_c; |
169 |
|
INTERPOLATE_LOWPASS interpolate8x8_lowpass_v_c; |
170 |
|
|
171 |
|
INTERPOLATE_LOWPASS interpolate16x16_lowpass_h_c; |
172 |
|
INTERPOLATE_LOWPASS interpolate16x16_lowpass_v_c; |
173 |
|
|
174 |
|
INTERPOLATE_LOWPASS_HV interpolate8x8_lowpass_hv_c; |
175 |
|
INTERPOLATE_LOWPASS_HV interpolate16x16_lowpass_hv_c; |
176 |
|
|
177 |
|
INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_h_c; |
178 |
|
INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_v_c; |
179 |
|
|
180 |
|
#ifdef ARCH_IS_IA32 |
181 |
|
INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_h_mmx; |
182 |
|
INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_v_mmx; |
183 |
|
#endif |
184 |
|
|
185 |
|
#ifdef ARCH_IS_PPC |
186 |
|
INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_h_altivec_c; |
187 |
|
#endif |
188 |
|
|
189 |
static __inline void |
static __inline void |
190 |
interpolate8x8_switch(uint8_t * const cur, |
interpolate8x8_switch(uint8_t * const cur, |
196 |
const uint32_t stride, |
const uint32_t stride, |
197 |
const uint32_t rounding) |
const uint32_t rounding) |
198 |
{ |
{ |
|
int32_t ddx, ddy; |
|
199 |
|
|
200 |
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)); |
201 |
{ |
uint8_t * const dst = cur + (int)(y * stride + x); |
202 |
|
|
203 |
|
switch (((dx & 1) << 1) + (dy & 1)) { /* ((dx%2)?2:0)+((dy%2)?1:0) */ |
204 |
case 0: |
case 0: |
205 |
ddx = dx / 2; |
transfer8x8_copy(dst, src, stride); |
|
ddy = dy / 2; |
|
|
transfer8x8_copy(cur + y * stride + x, |
|
|
refn + (int)((y + ddy) * stride + x + ddx), stride); |
|
206 |
break; |
break; |
|
|
|
207 |
case 1: |
case 1: |
208 |
ddx = dx / 2; |
interpolate8x8_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); |
|
209 |
break; |
break; |
|
|
|
210 |
case 2: |
case 2: |
211 |
ddx = (dx - 1) / 2; |
interpolate8x8_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); |
|
212 |
break; |
break; |
|
|
|
213 |
default: |
default: |
214 |
ddx = (dx - 1) / 2; |
interpolate8x8_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); |
|
215 |
break; |
break; |
216 |
} |
} |
217 |
} |
} |
218 |
|
|
219 |
|
static __inline void |
220 |
static __inline void interpolate8x8_quarterpel(uint8_t * const cur, |
interpolate8x8_add_switch(uint8_t * const cur, |
221 |
uint8_t * const refn, |
const uint8_t * const refn, |
222 |
const uint32_t x, const uint32_t y, |
const uint32_t x, |
223 |
const int32_t dx, const int dy, |
const uint32_t y, |
224 |
|
const int32_t dx, |
225 |
|
const int dy, |
226 |
const uint32_t stride, |
const uint32_t stride, |
227 |
const uint32_t rounding) |
const uint32_t rounding) |
228 |
{ |
{ |
|
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; |
|
|
|
|
|
uint8_t halfpel_h[72]; |
|
|
uint8_t halfpel_v[64]; |
|
|
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; |
|
229 |
|
|
230 |
switch((y_frac << 2) | (x_frac)) { |
const uint8_t * const src = refn + (int)((y + (dy>>1)) * stride + x + (dx>>1)); |
231 |
|
uint8_t * const dst = cur + (int)(y * stride + x); |
232 |
|
|
233 |
|
switch (((dx & 1) << 1) + (dy & 1)) { /* ((dx%2)?2:0)+((dy%2)?1:0) */ |
234 |
case 0: |
case 0: |
235 |
transfer8x8_copy(dst, src, stride); |
interpolate8x8_halfpel_add(dst, src, stride, rounding); |
236 |
break; |
break; |
|
|
|
237 |
case 1: |
case 1: |
238 |
interpolate8x8_lowpass_h(halfpel_h, src, 8, stride, rounding); |
interpolate8x8_halfpel_v_add(dst, src, stride, rounding); |
|
interpolate8x8_bilinear2(dst, src, halfpel_h, stride, stride, rounding); |
|
239 |
break; |
break; |
|
|
|
240 |
case 2: |
case 2: |
241 |
interpolate8x8_lowpass_h(dst, src, stride, stride, rounding); |
interpolate8x8_halfpel_h_add(dst, src, stride, rounding); |
|
break; |
|
|
|
|
|
case 3: |
|
|
interpolate8x8_lowpass_h(halfpel_h, src, 8, stride, rounding); |
|
|
interpolate8x8_bilinear2(dst, src+1, halfpel_h, stride, stride, rounding); |
|
|
break; |
|
|
|
|
|
case 4: |
|
|
interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding); |
|
|
interpolate8x8_bilinear2(dst, src, halfpel_v, stride, stride, rounding); |
|
242 |
break; |
break; |
243 |
|
default: |
244 |
case 5: |
interpolate8x8_halfpel_hv_add(dst, src, stride, rounding); |
|
interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding); |
|
|
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; |
|
|
|
|
|
case 6: |
|
|
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
|
|
interpolate8x8_bilinear2(dst, halfpel_h, halfpel_hv, stride, 8, 1-rounding); |
|
245 |
break; |
break; |
246 |
|
} |
247 |
|
} |
248 |
|
|
249 |
case 7: |
static __inline void |
250 |
interpolate8x8_lowpass_v(halfpel_v, src+1, 8, stride, 16-rounding); |
interpolate16x16_switch(uint8_t * const cur, |
251 |
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
const uint8_t * const refn, |
252 |
interpolate8x8_bilinear4(dst, src+1, halfpel_h, halfpel_v, halfpel_hv, stride, rounding); |
const uint32_t x, |
253 |
break; |
const uint32_t y, |
254 |
|
const int32_t dx, |
255 |
|
const int dy, |
256 |
|
const uint32_t stride, |
257 |
|
const uint32_t rounding) |
258 |
|
{ |
259 |
|
interpolate8x8_switch(cur, refn, x, y, dx, dy, stride, rounding); |
260 |
|
interpolate8x8_switch(cur, refn, x+8, y, dx, dy, stride, rounding); |
261 |
|
interpolate8x8_switch(cur, refn, x, y+8, dx, dy, stride, rounding); |
262 |
|
interpolate8x8_switch(cur, refn, x+8, y+8, dx, dy, stride, rounding); |
263 |
|
} |
264 |
|
|
265 |
case 8: |
static __inline void |
266 |
interpolate8x8_lowpass_v(dst, src, stride, stride, rounding); |
interpolate16x16_add_switch(uint8_t * const cur, |
267 |
break; |
const uint8_t * const refn, |
268 |
|
const uint32_t x, |
269 |
|
const uint32_t y, |
270 |
|
const int32_t dx, |
271 |
|
const int dy, |
272 |
|
const uint32_t stride, |
273 |
|
const uint32_t rounding) |
274 |
|
{ |
275 |
|
interpolate8x8_add_switch(cur, refn, x, y, dx, dy, stride, rounding); |
276 |
|
interpolate8x8_add_switch(cur, refn, x+8, y, dx, dy, stride, rounding); |
277 |
|
interpolate8x8_add_switch(cur, refn, x, y+8, dx, dy, stride, rounding); |
278 |
|
interpolate8x8_add_switch(cur, refn, x+8, y+8, dx, dy, stride, rounding); |
279 |
|
} |
280 |
|
|
281 |
case 9: |
static __inline void |
282 |
interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, 16-rounding); |
interpolate32x32_switch(uint8_t * const cur, |
283 |
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
const uint8_t * const refn, |
284 |
interpolate8x8_bilinear2(dst, halfpel_v, halfpel_hv, stride, 8, rounding); |
const uint32_t x, |
285 |
break; |
const uint32_t y, |
286 |
|
const int32_t dx, |
287 |
|
const int dy, |
288 |
|
const uint32_t stride, |
289 |
|
const uint32_t rounding) |
290 |
|
{ |
291 |
|
interpolate16x16_switch(cur, refn, x, y, dx, dy, stride, rounding); |
292 |
|
interpolate16x16_switch(cur, refn, x+16, y, dx, dy, stride, rounding); |
293 |
|
interpolate16x16_switch(cur, refn, x, y+16, dx, dy, stride, rounding); |
294 |
|
interpolate16x16_switch(cur, refn, x+16, y+16, dx, dy, stride, rounding); |
295 |
|
} |
296 |
|
|
297 |
case 10: |
static __inline void |
298 |
interpolate8x8_lowpass_hv(dst, halfpel_h, src, stride, 8, stride, rounding); |
interpolate32x32_add_switch(uint8_t * const cur, |
299 |
break; |
const uint8_t * const refn, |
300 |
|
const uint32_t x, |
301 |
|
const uint32_t y, |
302 |
|
const int32_t dx, |
303 |
|
const int dy, |
304 |
|
const uint32_t stride, |
305 |
|
const uint32_t rounding) |
306 |
|
{ |
307 |
|
interpolate16x16_add_switch(cur, refn, x, y, dx, dy, stride, rounding); |
308 |
|
interpolate16x16_add_switch(cur, refn, x+16, y, dx, dy, stride, rounding); |
309 |
|
interpolate16x16_add_switch(cur, refn, x, y+16, dx, dy, stride, rounding); |
310 |
|
interpolate16x16_add_switch(cur, refn, x+16, y+16, dx, dy, stride, rounding); |
311 |
|
} |
312 |
|
|
313 |
case 11: |
static __inline uint8_t * |
314 |
interpolate8x8_lowpass_v(halfpel_v, src+1, 8, stride, 16-rounding); |
interpolate8x8_switch2(uint8_t * const buffer, |
315 |
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
const uint8_t * const refn, |
316 |
interpolate8x8_bilinear2(dst, halfpel_v, halfpel_hv, stride, 8, rounding); |
const int x, |
317 |
break; |
const int y, |
318 |
|
const int dx, |
319 |
|
const int dy, |
320 |
|
const uint32_t stride, |
321 |
|
const uint32_t rounding) |
322 |
|
{ |
323 |
|
|
324 |
case 12: |
const uint8_t * const src = refn + (int)((y + (dy>>1)) * stride + x + (dx>>1)); |
|
interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding); |
|
|
interpolate8x8_bilinear2(dst, src+stride, halfpel_v, stride, stride, rounding); |
|
|
break; |
|
325 |
|
|
326 |
case 13: |
switch (((dx & 1) << 1) + (dy & 1)) { /* ((dx%2)?2:0)+((dy%2)?1:0) */ |
327 |
interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding); |
case 0: |
328 |
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
return (uint8_t *)src; |
329 |
interpolate8x8_bilinear4(dst, src+stride, halfpel_h+8, halfpel_v, halfpel_hv, stride, rounding); |
case 1: |
330 |
|
interpolate8x8_halfpel_v(buffer, src, stride, rounding); |
331 |
break; |
break; |
332 |
|
case 2: |
333 |
case 14: |
interpolate8x8_halfpel_h(buffer, src, stride, rounding); |
|
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
|
|
interpolate8x8_bilinear2(dst, halfpel_h+8, halfpel_hv, stride, 8, rounding); |
|
334 |
break; |
break; |
335 |
|
default: |
336 |
case 15: |
interpolate8x8_halfpel_hv(buffer, src, stride, rounding); |
|
interpolate8x8_lowpass_v(halfpel_v, src+1, 8, stride, rounding); |
|
|
interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding); |
|
|
interpolate8x8_bilinear4(dst, src+stride+1, halfpel_h+8, halfpel_v, halfpel_hv, stride, rounding); |
|
337 |
break; |
break; |
338 |
} |
} |
339 |
|
return buffer; |
340 |
} |
} |
341 |
|
|
342 |
|
#endif |