Unified · Split
| @@ -241,15 +241,15 @@ void put_vp8_epel ## WIDTH ## _v ## TAPS ## _altivec(uint8_t *dst, ptrdiff_t dst · 240 unmodified lines | ||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | #define EPEL_HV(WIDTH, HTAPS, VTAPS) \ |
| 244 | −static void put_vp8_epel ## WIDTH ## _h ## HTAPS ## v ## VTAPS ## _altivec(uint8_t *dst, ptrdiff_t stride, uint8_t *src, ptrdiff_t s, int h, int mx, int my) \ | |
| 244 | +static void put_vp8_epel ## WIDTH ## _h ## HTAPS ## v ## VTAPS ## _altivec(uint8_t *dst, ptrdiff_t dstride, uint8_t *src, ptrdiff_t sstride, int h, int mx, int my) \ | |
| 245 | 245 | { \ |
| 246 | 246 | DECLARE_ALIGNED(16, uint8_t, tmp)[(2*WIDTH+5)*16]; \ |
| 247 | 247 | if (VTAPS == 6) { \ |
| 248 | − put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16, src-2*stride, stride, h+5, mx, my); \ | |
| 249 | − put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, stride, tmp+2*16, 16, h, mx, my); \ | |
| 248 | + put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16, src-2*sstride, sstride, h+5, mx, my); \ | |
| 249 | + put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, dstride, tmp+2*16, 16, h, mx, my); \ | |
| 250 | 250 | } else { \ |
| 251 | − put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16, src-stride, stride, h+4, mx, my); \ | |
| 252 | − put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, stride, tmp+16, 16, h, mx, my); \ | |
| 251 | + put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16, src-sstride, sstride, h+4, mx, my); \ | |
| 252 | + put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, dstride, tmp+16, 16, h, mx, my); \ | |
| 253 | 253 | } \ |
| 254 | 254 | } |
| 255 | 255 | |
| @@ -269,9 +269,44 @@ EPEL_HV(4, 4,6) · 13 unmodified lines | ||
| 269 | 269 | EPEL_HV(4, 6,4) |
| 270 | 270 | EPEL_HV(4, 4,4) |
| 271 | 271 | |
| 272 | −static void put_vp8_pixels16_altivec(uint8_t *dst, ptrdiff_t stride, uint8_t *src, ptrdiff_t s, int h, int mx, int my) | |
| 272 | +static void put_vp8_pixels16_altivec(uint8_t *dst, ptrdiff_t dstride, uint8_t *src, ptrdiff_t sstride, int h, int mx, int my) | |
| 273 | 273 | { |
| 274 | − ff_put_pixels16_altivec(dst, src, stride, h); | |
| 274 | + register vector unsigned char pixelsv1, pixelsv2; | |
| 275 | + register vector unsigned char pixelsv1B, pixelsv2B; | |
| 276 | + register vector unsigned char pixelsv1C, pixelsv2C; | |
| 277 | + register vector unsigned char pixelsv1D, pixelsv2D; | |
| 278 | + | |
| 279 | + register vector unsigned char perm = vec_lvsl(0, src); | |
| 280 | + int i; | |
| 281 | + register ptrdiff_t dstride2 = dstride << 1, sstride2 = sstride << 1; | |
| 282 | + register ptrdiff_t dstride3 = dstride2 + dstride, sstride3 = sstride + sstride2; | |
| 283 | + register ptrdiff_t dstride4 = dstride << 2, sstride4 = sstride << 2; | |
| 284 | + | |
| 285 | +// hand-unrolling the loop by 4 gains about 15% | |
| 286 | +// mininum execution time goes from 74 to 60 cycles | |
| 287 | +// it's faster than -funroll-loops, but using | |
| 288 | +// -funroll-loops w/ this is bad - 74 cycles again. | |
| 289 | +// all this is on a 7450, tuning for the 7450 | |
| 290 | + for (i = 0; i < h; i += 4) { | |
| 291 | + pixelsv1 = vec_ld( 0, src); | |
| 292 | + pixelsv2 = vec_ld(15, src); | |
| 293 | + pixelsv1B = vec_ld(sstride, src); | |
| 294 | + pixelsv2B = vec_ld(15 + sstride, src); | |
| 295 | + pixelsv1C = vec_ld(sstride2, src); | |
| 296 | + pixelsv2C = vec_ld(15 + sstride2, src); | |
| 297 | + pixelsv1D = vec_ld(sstride3, src); | |
| 298 | + pixelsv2D = vec_ld(15 + sstride3, src); | |
| 299 | + vec_st(vec_perm(pixelsv1, pixelsv2, perm), | |
| 300 | + 0, (unsigned char*)dst); | |
| 301 | + vec_st(vec_perm(pixelsv1B, pixelsv2B, perm), | |
| 302 | + dstride, (unsigned char*)dst); | |
| 303 | + vec_st(vec_perm(pixelsv1C, pixelsv2C, perm), | |
| 304 | + dstride2, (unsigned char*)dst); | |
| 305 | + vec_st(vec_perm(pixelsv1D, pixelsv2D, perm), | |
| 306 | + dstride3, (unsigned char*)dst); | |
| 307 | + src += sstride4; | |
| 308 | + dst += dstride4; | |
| 309 | + } | |
| 275 | 310 | } |
| 276 | 311 | |
| 277 | 312 | #endif /* HAVE_ALTIVEC */ |