10l for me
[mplayer/greg.git] / libvo / fastmemcpy.h
blob032345bca658084f5d4cc392077617b35fa73688
1 #ifndef __MPLAYER_MEMCPY
2 #define __MPLAYER_MEMCPY 1
4 #include "config.h"
6 #ifdef USE_FASTMEMCPY
7 #if defined(HAVE_MMX) || defined(HAVE_MMX2) || defined(HAVE_3DNOW) \
8 /* || defined(HAVE_SSE) || defined(HAVE_SSE2) */
9 #include <stddef.h>
11 extern void * fast_memcpy(void * to, const void * from, size_t len);
12 extern void * mem2agpcpy(void * to, const void * from, size_t len);
13 #define memcpy(a,b,c) fast_memcpy(a,b,c)
15 #else /* HAVE_MMX/MMX2/3DNOW/SSE/SSE2 */
16 #define mem2agpcpy(a,b,c) memcpy(a,b,c)
17 #endif
19 #else /* USE_FASTMEMCPY */
20 #define mem2agpcpy(a,b,c) memcpy(a,b,c)
21 #endif
23 static inline void * mem2agpcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
25 int i;
26 void *retval=dst;
28 if(dstStride == srcStride)
30 if (srcStride < 0) {
31 src += (height-1)*srcStride;
32 dst += (height-1)*dstStride;
33 srcStride = -srcStride;
36 mem2agpcpy(dst, src, srcStride*height);
38 else
40 for(i=0; i<height; i++)
42 mem2agpcpy(dst, src, bytesPerLine);
43 src+= srcStride;
44 dst+= dstStride;
48 return retval;
51 static inline void * memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
53 int i;
54 void *retval=dst;
56 if(dstStride == srcStride)
58 if (srcStride < 0) {
59 src += (height-1)*srcStride;
60 dst += (height-1)*dstStride;
61 srcStride = -srcStride;
64 memcpy(dst, src, srcStride*height);
66 else
68 for(i=0; i<height; i++)
70 memcpy(dst, src, bytesPerLine);
71 src+= srcStride;
72 dst+= dstStride;
76 return retval;
79 #endif