1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-30 07:18:17 +00:00

Get rid of my_memcpy_pic code duplication in many filters.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23686 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2007-06-28 11:24:12 +00:00
parent 78fb17276c
commit ad164e04ee
10 changed files with 20 additions and 127 deletions

View File

@ -53,21 +53,6 @@ enum {
TC_IL2
};
static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
int i;
void *retval=dst;
for(i=0; i<height; i++)
{
fast_memcpy(dst, src, bytesPerLine);
src+= srcStride;
dst+= dstStride;
}
return retval;
}
static unsigned int hash_pic(unsigned char *img, int w, int h, int stride)
{
int step = w*h/1024;

View File

@ -170,6 +170,11 @@ static int deghost_plane(unsigned char *d, unsigned char *s,
return 0;
}
static int copyop(unsigned char *d, unsigned char *s, int bpl, int h, int dstride, int sstride, int dummy) {
memcpy_pic(d, s, bpl, h, dstride, sstride);
return 0;
}
static int imgop(int(*planeop)(unsigned char *, unsigned char *,
int, int, int, int, int),
mp_image_t *dst, mp_image_t *src, int arg)
@ -336,7 +341,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
switch((p->frameno++-p->phase+10)%5)
{
case 0:
imgop((void *)memcpy_pic, dmpi, mpi, 0);
imgop(copyop, dmpi, mpi, 0);
return 0;
case 4:
@ -348,14 +353,14 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
mpi->width, mpi->height);
vf_clone_mpi_attributes(tmpi, mpi);
imgop((void *)memcpy_pic, tmpi, mpi, 0);
imgop(copyop, tmpi, mpi, 0);
imgop(deghost_plane, tmpi, dmpi, p->deghost);
imgop((void *)memcpy_pic, dmpi, mpi, 0);
imgop(copyop, dmpi, mpi, 0);
return vf_next_put_image(vf, tmpi, MP_NOPTS_VALUE);
}
}
imgop((void *)memcpy_pic, dmpi, mpi, 0);
imgop(copyop, dmpi, mpi, 0);
return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
}

View File

@ -90,21 +90,6 @@ extern int opt_screen_size_y;
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
int i;
void *retval=dst;
for(i=0; i<height; i++)
{
fast_memcpy(dst, src, bytesPerLine);
src+= srcStride;
dst+= dstStride;
}
return retval;
}
#define PDIFFUB(X,Y,T) "movq " #X "," #T "\n\t" \
"psubusb " #Y "," #T "\n\t" \
"psubusb " #X "," #Y "\n\t" \

View File

@ -40,21 +40,6 @@ enum {
F_SHOW
};
static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
int i;
void *retval=dst;
for(i=0; i<height; i++)
{
fast_memcpy(dst, src, bytesPerLine);
src+= srcStride;
dst+= dstStride;
}
return retval;
}
#ifdef HAVE_MMX
static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char *new, int os, int ns)
{

View File

@ -24,21 +24,6 @@ struct vf_priv_s {
char *qbuf;
};
static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
int i;
void *retval=dst;
for(i=0; i<height; i++)
{
fast_memcpy(dst, src, bytesPerLine);
src+= srcStride;
dst+= dstStride;
}
return retval;
}
static inline void *il_memcpy_pic(void *dst, void *src0, void *src1, int w, int h, int ds, int ss)
{
int i;

View File

@ -17,21 +17,6 @@ struct vf_priv_s {
long long out;
};
static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
int i;
void *retval=dst;
for(i=0; i<height; i++)
{
fast_memcpy(dst, src, bytesPerLine);
src+= srcStride;
dst+= dstStride;
}
return retval;
}
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;

View File

@ -15,21 +15,6 @@ struct vf_priv_s {
int frame;
};
static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
int i;
void *retval=dst;
for(i=0; i<height; i++)
{
fast_memcpy(dst, src, bytesPerLine);
src+= srcStride;
dst+= dstStride;
}
return retval;
}
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;

View File

@ -20,21 +20,6 @@ struct vf_priv_s {
double buffered_pts;
};
static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
int i;
void *retval=dst;
for(i=0; i<height; i++)
{
fast_memcpy(dst, src, bytesPerLine);
src+= srcStride;
dst+= dstStride;
}
return retval;
}
static void deint(unsigned char *dest, int ds, unsigned char *src, int ss, int w, int h, int field)
{
int x, y;

View File

@ -35,22 +35,6 @@ struct vf_priv_s {
mp_image_t *dmpi;
};
// Copied verbatim from vf_telecine.c:
static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
int i;
void *retval=dst;
for(i=0; i<height; i++)
{
fast_memcpy(dst, src, bytesPerLine);
src+= srcStride;
dst+= dstStride;
}
return retval;
}
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
{
int ret = 0;

View File

@ -68,12 +68,21 @@ static inline void * mem2agpcpy_pic(void * dst, const void * src, int bytesPerLi
return retval;
}
static inline void * memcpy_pic(void * dst, const void * src, int bytesPerLine, int height, int dstStride, int srcStride)
#define memcpy_pic(d, s, b, h, ds, ss) memcpy_pic2(d, s, b, h, ds, ss, 0)
#define my_memcpy_pic(d, s, b, h, ds, ss) memcpy_pic2(d, s, b, h, ds, ss, 1)
/**
* \param limit2width always skip data between end of line and start of next
* instead of copying the full block when strides are the same
*/
static inline void * memcpy_pic2(void * dst, const void * src,
int bytesPerLine, int height,
int dstStride, int srcStride, int limit2width)
{
int i;
void *retval=dst;
if(dstStride == srcStride)
if(!limit2width && dstStride == srcStride)
{
if (srcStride < 0) {
src = (uint8_t*)src + (height-1)*srcStride;