2001-04-16 20:55:27 +00:00
|
|
|
#ifndef __MPLAYER_MEMCPY
|
2001-04-26 20:35:58 +00:00
|
|
|
#define __MPLAYER_MEMCPY 1
|
|
|
|
|
2004-10-28 01:15:53 +00:00
|
|
|
#include "config.h"
|
2001-05-14 18:18:14 +00:00
|
|
|
|
2001-06-15 12:42:00 +00:00
|
|
|
#ifdef USE_FASTMEMCPY
|
|
|
|
#if defined(HAVE_MMX) || defined(HAVE_MMX2) || defined(HAVE_3DNOW) \
|
|
|
|
/* || defined(HAVE_SSE) || defined(HAVE_SSE2) */
|
2001-05-05 13:30:00 +00:00
|
|
|
#include <stddef.h>
|
2001-04-26 20:35:58 +00:00
|
|
|
|
2001-05-05 13:30:00 +00:00
|
|
|
extern void * fast_memcpy(void * to, const void * from, size_t len);
|
2002-02-12 23:17:14 +00:00
|
|
|
extern void * mem2agpcpy(void * to, const void * from, size_t len);
|
2001-04-12 14:40:10 +00:00
|
|
|
#define memcpy(a,b,c) fast_memcpy(a,b,c)
|
2001-04-11 20:14:49 +00:00
|
|
|
|
2002-02-12 23:17:14 +00:00
|
|
|
#else /* HAVE_MMX/MMX2/3DNOW/SSE/SSE2 */
|
|
|
|
#define mem2agpcpy(a,b,c) memcpy(a,b,c)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else /* USE_FASTMEMCPY */
|
|
|
|
#define mem2agpcpy(a,b,c) memcpy(a,b,c)
|
|
|
|
#endif
|
2002-02-14 22:34:24 +00:00
|
|
|
|
|
|
|
static inline void * mem2agpcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
void *retval=dst;
|
|
|
|
|
2005-04-08 10:31:18 +00:00
|
|
|
if(dstStride == srcStride)
|
|
|
|
{
|
|
|
|
if (srcStride < 0) {
|
|
|
|
src += (height-1)*srcStride;
|
|
|
|
dst += (height-1)*dstStride;
|
|
|
|
srcStride = -srcStride;
|
|
|
|
}
|
|
|
|
|
|
|
|
mem2agpcpy(dst, src, srcStride*height);
|
|
|
|
}
|
2002-02-14 22:34:24 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
for(i=0; i<height; i++)
|
|
|
|
{
|
|
|
|
mem2agpcpy(dst, src, bytesPerLine);
|
|
|
|
src+= srcStride;
|
|
|
|
dst+= dstStride;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2002-04-06 21:46:07 +00:00
|
|
|
static inline void * memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
void *retval=dst;
|
|
|
|
|
2005-04-08 10:31:18 +00:00
|
|
|
if(dstStride == srcStride)
|
|
|
|
{
|
|
|
|
if (srcStride < 0) {
|
|
|
|
src += (height-1)*srcStride;
|
|
|
|
dst += (height-1)*dstStride;
|
|
|
|
srcStride = -srcStride;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(dst, src, srcStride*height);
|
|
|
|
}
|
2002-04-06 21:46:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
for(i=0; i<height; i++)
|
|
|
|
{
|
|
|
|
memcpy(dst, src, bytesPerLine);
|
|
|
|
src+= srcStride;
|
|
|
|
dst+= dstStride;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2001-05-14 18:18:14 +00:00
|
|
|
#endif
|