diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-06-28 11:24:12 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-06-28 11:24:12 +0000 |
commit | ad164e04ee0330426917f00275fccc2203aff653 (patch) | |
tree | 7eaba8b9a79e9ec5f54daf5a7ccdd41d2b26001e | |
parent | 78fb17276c503df51c7002bdff420bc075ebdc8e (diff) | |
download | mpv-ad164e04ee0330426917f00275fccc2203aff653.tar.bz2 mpv-ad164e04ee0330426917f00275fccc2203aff653.tar.xz |
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
-rw-r--r-- | libmpcodecs/vf_detc.c | 15 | ||||
-rw-r--r-- | libmpcodecs/vf_divtc.c | 13 | ||||
-rw-r--r-- | libmpcodecs/vf_filmdint.c | 15 | ||||
-rw-r--r-- | libmpcodecs/vf_ivtc.c | 15 | ||||
-rw-r--r-- | libmpcodecs/vf_pullup.c | 15 | ||||
-rw-r--r-- | libmpcodecs/vf_softpulldown.c | 15 | ||||
-rw-r--r-- | libmpcodecs/vf_telecine.c | 15 | ||||
-rw-r--r-- | libmpcodecs/vf_tfields.c | 15 | ||||
-rw-r--r-- | libmpcodecs/vf_tinterlace.c | 16 | ||||
-rw-r--r-- | libvo/fastmemcpy.h | 13 |
10 files changed, 20 insertions, 127 deletions
diff --git a/libmpcodecs/vf_detc.c b/libmpcodecs/vf_detc.c index 27be5d393c..87b9bff3a7 100644 --- a/libmpcodecs/vf_detc.c +++ b/libmpcodecs/vf_detc.c @@ -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; diff --git a/libmpcodecs/vf_divtc.c b/libmpcodecs/vf_divtc.c index 495169dd5a..de12d690a8 100644 --- a/libmpcodecs/vf_divtc.c +++ b/libmpcodecs/vf_divtc.c @@ -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); } diff --git a/libmpcodecs/vf_filmdint.c b/libmpcodecs/vf_filmdint.c index 0fb8ea69d1..6ec8be2c38 100644 --- a/libmpcodecs/vf_filmdint.c +++ b/libmpcodecs/vf_filmdint.c @@ -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" \ diff --git a/libmpcodecs/vf_ivtc.c b/libmpcodecs/vf_ivtc.c index 4f9ca36d7c..d9c7013567 100644 --- a/libmpcodecs/vf_ivtc.c +++ b/libmpcodecs/vf_ivtc.c @@ -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) { diff --git a/libmpcodecs/vf_pullup.c b/libmpcodecs/vf_pullup.c index 4746d3a957..2b1f3563cd 100644 --- a/libmpcodecs/vf_pullup.c +++ b/libmpcodecs/vf_pullup.c @@ -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; diff --git a/libmpcodecs/vf_softpulldown.c b/libmpcodecs/vf_softpulldown.c index 493d3502cb..1b710561f1 100644 --- a/libmpcodecs/vf_softpulldown.c +++ b/libmpcodecs/vf_softpulldown.c @@ -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; diff --git a/libmpcodecs/vf_telecine.c b/libmpcodecs/vf_telecine.c index e16c9fab20..102b79522b 100644 --- a/libmpcodecs/vf_telecine.c +++ b/libmpcodecs/vf_telecine.c @@ -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; diff --git a/libmpcodecs/vf_tfields.c b/libmpcodecs/vf_tfields.c index 5f6a761599..55a3ae9b5a 100644 --- a/libmpcodecs/vf_tfields.c +++ b/libmpcodecs/vf_tfields.c @@ -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; diff --git a/libmpcodecs/vf_tinterlace.c b/libmpcodecs/vf_tinterlace.c index 351cde3a47..f6b6f884e0 100644 --- a/libmpcodecs/vf_tinterlace.c +++ b/libmpcodecs/vf_tinterlace.c @@ -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; diff --git a/libvo/fastmemcpy.h b/libvo/fastmemcpy.h index 295efd8077..5c8b7add64 100644 --- a/libvo/fastmemcpy.h +++ b/libvo/fastmemcpy.h @@ -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; |