Remove unnecessary linking hack, compilation works fine without.
[mplayer/glamo.git] / libvo / fastmemcpy.h
blobfa736b62f022f2d6c7c447ab47976a35e8d09a25
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with MPlayer; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef MPLAYER_FASTMEMCPY_H
20 #define MPLAYER_FASTMEMCPY_H
22 #include "config.h"
23 #include <inttypes.h>
24 #include <string.h>
26 #ifdef CONFIG_FASTMEMCPY
27 #if HAVE_MMX || HAVE_MMX2 || HAVE_AMD3DNOW \
28 /* || HAVE_SSE || HAVE_SSE2 */
29 #include <stddef.h>
31 void * fast_memcpy(void * to, const void * from, size_t len);
32 void * mem2agpcpy(void * to, const void * from, size_t len);
34 #else /* HAVE_MMX/MMX2/3DNOW/SSE/SSE2 */
35 #define mem2agpcpy(a,b,c) memcpy(a,b,c)
36 #define fast_memcpy(a,b,c) memcpy(a,b,c)
37 #endif
39 #else /* CONFIG_FASTMEMCPY */
40 #define mem2agpcpy(a,b,c) memcpy(a,b,c)
41 #define fast_memcpy(a,b,c) memcpy(a,b,c)
42 #endif
44 static inline void * mem2agpcpy_pic(void * dst, const void * src, int bytesPerLine, int height, int dstStride, int srcStride)
46 int i;
47 void *retval=dst;
49 if(dstStride == srcStride)
51 if (srcStride < 0) {
52 src = (uint8_t*)src + (height-1)*srcStride;
53 dst = (uint8_t*)dst + (height-1)*dstStride;
54 srcStride = -srcStride;
57 mem2agpcpy(dst, src, srcStride*height);
59 else
61 for(i=0; i<height; i++)
63 mem2agpcpy(dst, src, bytesPerLine);
64 src = (uint8_t*)src + srcStride;
65 dst = (uint8_t*)dst + dstStride;
69 return retval;
72 #define memcpy_pic(d, s, b, h, ds, ss) memcpy_pic2(d, s, b, h, ds, ss, 0)
73 #define my_memcpy_pic(d, s, b, h, ds, ss) memcpy_pic2(d, s, b, h, ds, ss, 1)
75 /**
76 * \param limit2width always skip data between end of line and start of next
77 * instead of copying the full block when strides are the same
79 static inline void * memcpy_pic2(void * dst, const void * src,
80 int bytesPerLine, int height,
81 int dstStride, int srcStride, int limit2width)
83 int i;
84 void *retval=dst;
86 if(!limit2width && dstStride == srcStride)
88 if (srcStride < 0) {
89 src = (uint8_t*)src + (height-1)*srcStride;
90 dst = (uint8_t*)dst + (height-1)*dstStride;
91 srcStride = -srcStride;
94 fast_memcpy(dst, src, srcStride*height);
96 else
98 for(i=0; i<height; i++)
100 fast_memcpy(dst, src, bytesPerLine);
101 src = (uint8_t*)src + srcStride;
102 dst = (uint8_t*)dst + dstStride;
106 return retval;
109 #endif /* MPLAYER_FASTMEMCPY_H */