CVS: main/libmpcodecs vf_tfields.c,1.2,1.3
Update of /cvsroot/mplayer/main/libmpcodecs In directory mail:/var/tmp.root/cvs-serv5280/libmpcodecs Modified Files: vf_tfields.c Log Message: new mode for tfields filter -- shifts fields by a quarter-pixel so the output picture doesn't bob up and down :) Index: vf_tfields.c =================================================================== RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_tfields.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- vf_tfields.c 15 Mar 2003 18:01:02 -0000 1.2 +++ vf_tfields.c 28 Apr 2003 02:53:50 -0000 1.3 @@ -56,6 +56,29 @@ } } +static void qpelup(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss) +{ + int i, j; + memcpy(d, s, w); + for (i=h-1; i; i--) { + d += ds; + s += ss; + for (j=0; j<w; j++) + d[j] = (s[j-ss] + 3*s[j])>>2; + } +} + +static void qpeldown(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss) +{ + int i, j; + for (i=h-1; i; i--) { + for (j=0; j<w; j++) + d[j] = (3*s[j] + s[j+ss])>>2; + d += ds; + s += ss; + } + memcpy(d, s, w); +} static int put_image(struct vf_instance_s* vf, mp_image_t *mpi) @@ -128,6 +151,33 @@ mpi->chroma_width, mpi->chroma_height, 1); } return vf_next_put_image(vf, dmpi) || ret; + case 2: + dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->width, mpi->height/2); + qpeldown(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, + dmpi->stride[0], mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + qpeldown(dmpi->planes[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1], mpi->stride[1]*2); + qpeldown(dmpi->planes[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2], mpi->stride[2]*2); + } + ret = vf_next_put_image(vf, dmpi); + + qpelup(dmpi->planes[0], mpi->planes[0] + mpi->stride[0], + mpi->w, mpi->h/2, dmpi->stride[0], mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + qpelup(dmpi->planes[1], mpi->planes[1] + mpi->stride[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1], mpi->stride[1]*2); + qpelup(dmpi->planes[2], mpi->planes[2] + mpi->stride[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2], mpi->stride[2]*2); + } + return vf_next_put_image(vf, dmpi) || ret; } return 0; } @@ -150,6 +200,7 @@ { switch (vf->priv->mode) { case 0: + case 2: return vf_next_config(vf,width,height/2,d_width,d_height,flags,outfmt); case 1: return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
Hi On Monday 28 April 2003 04:54, Richard Felker CVS wrote:
Update of /cvsroot/mplayer/main/libmpcodecs In directory mail:/var/tmp.root/cvs-serv5280/libmpcodecs
Modified Files: vf_tfields.c Log Message: new mode for tfields filter -- shifts fields by a quarter-pixel so the output picture doesn't bob up and down :) hmm linear interpolation sucks IMHO, why dont u use some filter like (-9a + 111b + 29c -3d + 64)>>7 or (-a + 14b + 3c + 8)>>4
[...] -- Michael screen[y][x] ^= cursor[cy][cx]; (violates patent #4,197,590) median(mv[y-1][x], mv[y][x-1], mv[y+1][x+1]); (violates patent #5,905,535) buf[i]= qp - buf[i-1]; (violates patent #?) for more examples, see http://mplayerhq.hu/~michael/patent.html stop it, see http://petition.eurolinux.org & http://petition.ffii.org/eubsa/en
On Tue, Apr 29, 2003 at 11:56:33AM +0200, Michael Niedermayer wrote:
Hi
On Monday 28 April 2003 04:54, Richard Felker CVS wrote:
Update of /cvsroot/mplayer/main/libmpcodecs In directory mail:/var/tmp.root/cvs-serv5280/libmpcodecs
Modified Files: vf_tfields.c Log Message: new mode for tfields filter -- shifts fields by a quarter-pixel so the output picture doesn't bob up and down :) hmm linear interpolation sucks IMHO, why dont u use some filter like (-9a + 111b + 29c -3d + 64)>>7 or (-a + 14b + 3c + 8)>>4
Because I'm lazy and don't know how to make this perform decent in mmx... Also, I'm a bit skeptical of wider filters with with sharp edges (common in anime)... What do you think about this? Rich
On Tue, Apr 29, 2003 at 11:56:33AM +0200, Michael Niedermayer wrote:
Hi
On Monday 28 April 2003 04:54, Richard Felker CVS wrote:
Update of /cvsroot/mplayer/main/libmpcodecs In directory mail:/var/tmp.root/cvs-serv5280/libmpcodecs
Modified Files: vf_tfields.c Log Message: new mode for tfields filter -- shifts fields by a quarter-pixel so the output picture doesn't bob up and down :)
hmm linear interpolation sucks IMHO, why dont u use some filter like (-9a + 111b + 29c -3d + 64)>>7 or (-a + 14b + 3c + 8)>>4
Because I'm lazy and don't know how to make this perform decent in mmx... i cant imagine any tricks beyond a simple unpack, multiply, add, ..., shift,
Hi On Wednesday 30 April 2003 19:55, D Richard Felker III wrote: pack mmx implementation either ATM, but i guess its still more then fast enough
Also, I'm a bit skeptical of wider filters with with sharp edges (common in anime)... What do you think about this?
yes, wide filters will create ugly wave effects around edges (just try -sws 8) but 3tap/4tap isnt wide, and short filters suck too for edges as they blur them [...] -- Michael screen[y][x] ^= cursor[cy][cx]; (violates patent #4,197,590) median(mv[y-1][x], mv[y][x-1], mv[y+1][x+1]); (violates patent #5,905,535) buf[i]= qp - buf[i-1]; (violates patent #?) for more examples, see http://mplayerhq.hu/~michael/patent.html stop it, see http://petition.eurolinux.org & http://petition.ffii.org/eubsa/en
On Wed, Apr 30, 2003 at 08:22:10PM +0200, Michael Niedermayer wrote:
Hi
On Tue, Apr 29, 2003 at 11:56:33AM +0200, Michael Niedermayer wrote:
Hi
On Monday 28 April 2003 04:54, Richard Felker CVS wrote:
Update of /cvsroot/mplayer/main/libmpcodecs In directory mail:/var/tmp.root/cvs-serv5280/libmpcodecs
Modified Files: vf_tfields.c Log Message: new mode for tfields filter -- shifts fields by a quarter-pixel so the output picture doesn't bob up and down :)
hmm linear interpolation sucks IMHO, why dont u use some filter like (-9a + 111b + 29c -3d + 64)>>7 or (-a + 14b + 3c + 8)>>4
Because I'm lazy and don't know how to make this perform decent in mmx... i cant imagine any tricks beyond a simple unpack, multiply, add, ..., shift,
On Wednesday 30 April 2003 19:55, D Richard Felker III wrote: pack mmx implementation either ATM, but i guess its still more then fast enough
Hmm, ok, I've never done mmx multiply. Do you unpack first, or does the multiply automatically give 16bit outputs for 8bit inputs?
Also, I'm a bit skeptical of wider filters with with sharp edges (common in anime)... What do you think about this? yes, wide filters will create ugly wave effects around edges (just try -sws 8) but 3tap/4tap isnt wide, and short filters suck too for edges as they blur them
OK, I'll see if I can improve it. :) I'm already rather happy with the results, so if it looks better with a nicer filter, that'll be great! Rich
Hi On Wednesday 30 April 2003 21:33, D Richard Felker III wrote:
On Wed, Apr 30, 2003 at 08:22:10PM +0200, Michael Niedermayer wrote:
Hi
On Wednesday 30 April 2003 19:55, D Richard Felker III wrote:
On Tue, Apr 29, 2003 at 11:56:33AM +0200, Michael Niedermayer wrote:
Hi
On Monday 28 April 2003 04:54, Richard Felker CVS wrote:
Update of /cvsroot/mplayer/main/libmpcodecs In directory mail:/var/tmp.root/cvs-serv5280/libmpcodecs
Modified Files: vf_tfields.c Log Message: new mode for tfields filter -- shifts fields by a quarter-pixel so the output picture doesn't bob up and down :)
hmm linear interpolation sucks IMHO, why dont u use some filter like (-9a + 111b + 29c -3d + 64)>>7 or (-a + 14b + 3c + 8)>>4
Because I'm lazy and don't know how to make this perform decent in mmx...
i cant imagine any tricks beyond a simple unpack, multiply, add, ..., shift, pack mmx implementation either ATM, but i guess its still more then fast enough
Hmm, ok, I've never done mmx multiply. Do you unpack first, or does the multiply automatically give 16bit outputs for 8bit inputs? u unpack first (then use pmullw), theres no 8bit multiply, and no 8bit shift either in mmx allthough theres a 16bit->32bit multiply-add but thats of no use here i guess
btw, see http://www.intel.com/design/pentium4/manuals/245471.htm [...] -- Michael screen[y][x] ^= cursor[cy][cx]; (violates patent #4,197,590) median(mv[y-1][x], mv[y][x-1], mv[y+1][x+1]); (violates patent #5,905,535) buf[i]= qp - buf[i-1]; (violates patent #?) for more examples, see http://mplayerhq.hu/~michael/patent.html stop it, see http://petition.eurolinux.org & http://petition.ffii.org/eubsa/en
participants (3)
-
D Richard Felker III -
Michael Niedermayer -
Richard Felker CVS