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: colorspace_altivec.c,v 1.3 2004-12-09 23:02:54 edgomez Exp $ |
* $Id: colorspace_altivec.c,v 1.4 2005-03-18 18:01:34 edgomez Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
28 |
#endif |
#endif |
29 |
|
|
30 |
#include "../../portab.h" |
#include "../../portab.h" |
31 |
|
#include "../colorspace.h" |
32 |
|
|
33 |
#undef DEBUG |
#undef DEBUG |
34 |
#include <stdio.h> |
#include <stdio.h> |
494 |
WRITE_YUYV_ALTIVEC(1, 0, C1,C2,C3,C4) |
WRITE_YUYV_ALTIVEC(1, 0, C1,C2,C3,C4) |
495 |
|
|
496 |
|
|
497 |
MAKE_COLORSPACE_ALTIVEC_TO_YUV(yv12_to_yuyv_altivec_c, 2, 16, 2, YV12_TO_YUYV_ALTIVEC, 0, 1, 2, 3) |
MAKE_COLORSPACE_ALTIVEC_TO_YUV(yv12_to_yuyv_altivec_unaligned_c, 2, 16, 2, YV12_TO_YUYV_ALTIVEC, 0, 1, 2, 3) |
498 |
MAKE_COLORSPACE_ALTIVEC_TO_YUV(yv12_to_uyvy_altivec_c, 2, 16, 2, YV12_TO_YUYV_ALTIVEC, 1, 0, 3, 2) |
MAKE_COLORSPACE_ALTIVEC_TO_YUV(yv12_to_uyvy_altivec_unaligned_c, 2, 16, 2, YV12_TO_YUYV_ALTIVEC, 1, 0, 3, 2) |
499 |
|
|
500 |
|
|
501 |
|
/* This intermediate functions are used because gcc v3.3 seems to produces an invalid register usage with the fallback directly integrated in the altivec routine (!!!) */ |
502 |
|
|
503 |
|
#define CHECK_COLORSPACE_ALTIVEC_TO_YUV(NAME,FAST,FALLBACK) \ |
504 |
|
void \ |
505 |
|
NAME(uint8_t *x_ptr, int x_stride, \ |
506 |
|
uint8_t *y_ptr, uint8_t *u_ptr, uint8_t *v_ptr, \ |
507 |
|
int y_stride, int uv_stride, \ |
508 |
|
int width, int height, int vflip) \ |
509 |
|
{\ |
510 |
|
if( ((uint32_t)x_ptr & 15) | (x_stride & 15) )\ |
511 |
|
FALLBACK(x_ptr, x_stride, y_ptr, u_ptr, v_ptr, y_stride, uv_stride, width, height, vflip);\ |
512 |
|
else\ |
513 |
|
FAST(x_ptr, x_stride, y_ptr, u_ptr, v_ptr, y_stride, uv_stride, width, height, vflip);\ |
514 |
|
} |
515 |
|
|
516 |
|
CHECK_COLORSPACE_ALTIVEC_TO_YUV(yv12_to_yuyv_altivec_c, yv12_to_yuyv_altivec_unaligned_c, yv12_to_yuyv_c) |
517 |
|
CHECK_COLORSPACE_ALTIVEC_TO_YUV(yv12_to_uyvy_altivec_c, yv12_to_uyvy_altivec_unaligned_c, yv12_to_uyvy_c) |