From 311e440f30c218015d17fb390f50829f430d5128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20Vehvil=C3=A4inen?= Date: Tue, 9 Jul 2002 12:19:44 +0000 Subject: PixelPack002 by Olaf Matthes svn path=/trunk/Framestein/; revision=30 --- Plugins/deinterlace.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Plugins/deinterlace.c (limited to 'Plugins/deinterlace.c') diff --git a/Plugins/deinterlace.c b/Plugins/deinterlace.c new file mode 100644 index 0000000..ca12568 --- /dev/null +++ b/Plugins/deinterlace.c @@ -0,0 +1,82 @@ +// +// deinterlace - deinterlacing through pixel / line repitition +// +// written by Olaf Matthes +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// usage: deinterlace [ with line = 0 or 1 ] +// + +#include +#include +#include "plugin.h" + +void perform_effect(struct frame f, struct args a) +{ + short x, y, line = 0; + byte pixelsize = f.pixelformat/8; + pixel16 *p16, *c16; + pixel24 *p24, *c24; + pixel32 *p32, *c32; + char *t; + + // get params + if(a.s) + { + line = atoi(a.s); + } // else keep 0 + + printf("deinterlace: %d\n", line); + + y = f.height - line; + x = f.width; + + switch(f.pixelformat) + { + case 16: + while(y > 0) + { + p16 = scanline16(f, y); + c16 = scanline16(f, y-1); + memcpy(p16, c16, x*pixelsize); + y -= 2; + } + break; + case 24: + while(y > 0) + { + p24 = scanline24(f, y); + c24 = scanline24(f, y-1); + memcpy(p24, c24, x*pixelsize); + y -= 2; + } + break; + case 32: + while(y > 0) + { + p32 = scanline32(f, y); + c32 = scanline32(f, y-1); + memcpy(p32, c32, x*pixelsize); + y -= 2; + } + break; + } +} + +void perform_copy(struct frame f1, struct frame f2, struct args a) +{ + printf("Using deinterlace as copy operation does nothing!\n"); +} -- cgit v1.2.1