aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuha Vehviläinen <jusu@users.sourceforge.net>2002-07-09 12:36:46 +0000
committerJuha Vehviläinen <jusu@users.sourceforge.net>2002-07-09 12:36:46 +0000
commitf8d8ce4d35bfbba5391af2a3fbce2ad88f94dd69 (patch)
tree8306320e4e2c602d8c64590bb5eeed180d249a2b
parent311e440f30c218015d17fb390f50829f430d5128 (diff)
PeRColate
svn path=/trunk/Framestein/; revision=31
-rw-r--r--Plugins/cga.c78
-rw-r--r--Plugins/cga.dllbin0 -> 36864 bytes
-rw-r--r--Plugins/constrain.c106
-rw-r--r--Plugins/constrain.dllbin0 -> 36864 bytes
-rw-r--r--Plugins/cutout.c131
-rw-r--r--Plugins/cutout.dllbin0 -> 36864 bytes
-rw-r--r--Plugins/eclipse.c177
-rw-r--r--Plugins/eclipse.dllbin0 -> 49152 bytes
-rw-r--r--Plugins/eclipse02.c178
-rw-r--r--Plugins/eclipse02.dllbin0 -> 45056 bytes
-rw-r--r--Plugins/eclipse03.c244
-rw-r--r--Plugins/eclipse03.dllbin0 -> 49152 bytes
-rw-r--r--Plugins/fromage.c191
-rw-r--r--Plugins/fromage.dllbin0 -> 36864 bytes
-rw-r--r--Plugins/keyscreen.c131
-rw-r--r--Plugins/keyscreen.dllbin0 -> 36864 bytes
-rw-r--r--Plugins/makefile54
-rw-r--r--Plugins/modgain.c89
-rw-r--r--Plugins/modgain.dllbin0 -> 36864 bytes
-rw-r--r--Plugins/rene.c245
-rw-r--r--Plugins/rene.dllbin0 -> 49152 bytes
-rw-r--r--Plugins/rgbavg.c654
-rw-r--r--Plugins/rgbavg.dllbin0 -> 49152 bytes
-rw-r--r--Plugins/rgbavg02.c799
-rw-r--r--Plugins/rgbavg02.dllbin0 -> 53248 bytes
-rw-r--r--Plugins/rgbseek.c97
-rw-r--r--Plugins/rgbseek.dllbin0 -> 36864 bytes
-rw-r--r--Plugins/traffic.c106
-rw-r--r--Plugins/traffic.dllbin0 -> 49152 bytes
29 files changed, 3279 insertions, 1 deletions
diff --git a/Plugins/cga.c b/Plugins/cga.c
new file mode 100644
index 0000000..bc329d7
--- /dev/null
+++ b/Plugins/cga.c
@@ -0,0 +1,78 @@
+// 242.cga -- does bit-level quantization on an input image.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+// usage: cga <red> <green> <blue>
+//
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "plugin.h"
+
+#pragma warning( disable : 4761 ) // the (lossy) conversion _IS_ our effect !
+
+void perform_effect(struct frame f, struct args arg)
+{
+ int x,y;
+ int red, green, blue; // parameters
+ byte r, g, b;
+ byte bits = f.pixelformat/8;
+ pixel16 *c16;
+ pixel24 *c24;
+ pixel32 *c32;
+ char *t;
+
+ // get r g b and alpha params
+ if(!arg.s) return;
+ red = atoi(arg.s);
+ if(!(t = strstr(arg.s, " "))) return;
+ green = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ blue = atoi(t+1);
+
+ printf("cga: r%d g%d b%d\n", red, green, blue);
+
+ for(y = 0; y < f.height; y++)
+ {
+ for(x = 0; x < f.width; x++)
+ {
+ switch(f.pixelformat)
+ {
+ case 16:
+ c16 = scanline16(f, y);
+ r = r16(c16[x]);
+ g = g16(c16[x]);
+ b = b16(c16[x]);
+ // shift it up, then shift it back down
+ c16[x] = rgbtocolor16((r>>red<<red), (g>>green<<green), (b>>blue<<blue));
+ break;
+ case 24:
+ c24 = scanline24(f, y);
+ r = r24(c24[x]);
+ g = g24(c24[x]);
+ b = b24(c24[x]);
+ // shift it up, then shift it back down
+ c24[x] = rgbtocolor24((r>>red<<red), (g>>green<<green), (b>>blue<<blue));
+ break;
+ case 32:
+ c32 = scanline32(f, y);
+ r = r32(c32[x]);
+ g = g32(c32[x]);
+ b = b32(c32[x]);
+ // shift it up, then shift it back down
+ c32[x] = rgbtocolor32((r>>red<<red), (g>>green<<green), (b>>blue<<blue));
+ break;
+ }
+ }
+ }
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ printf("Using cga as copy operation does nothing!\n");
+}
diff --git a/Plugins/cga.dll b/Plugins/cga.dll
new file mode 100644
index 0000000..aa25a11
--- /dev/null
+++ b/Plugins/cga.dll
Binary files differ
diff --git a/Plugins/constrain.c b/Plugins/constrain.c
new file mode 100644
index 0000000..86d0909
--- /dev/null
+++ b/Plugins/constrain.c
@@ -0,0 +1,106 @@
+// 242.constrain -- does color range constraining on an input image.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+// usage: constrain <min red> <min green> <min blue> <max red> <max green> <max blue>
+//
+
+#include <stdio.h>
+#include <string.h>
+#include "plugin.h"
+
+void perform_effect(struct frame f, struct args a)
+{
+ int x,y;
+ byte redmin, greenmin, bluemin, redmax, greenmax, bluemax;
+ byte redpix, greenpix, bluepix; // the color values
+ pixel16 *c16;
+ pixel24 *c24;
+ pixel32 *c32;
+ char *t;
+
+ // get params
+ if(!a.s) return;
+ redmin = atoi(a.s);
+ if(!(t = strstr(a.s, " "))) return;
+ greenmin = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ bluemin = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ redmax = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ greenmax = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ bluemax = atoi(t+1);
+
+ printf("constrain: rmin%d gmin%d bmin%d - rmax%d gmax%d - bmax%d\n",
+ redmin, greenmin, bluemin, redmax, greenmax, bluemax);
+
+
+ for(y = 0; y < f.height; y++)
+ {
+ for(x = 0; x < f.width; x++)
+ {
+ switch(f.pixelformat)
+ {
+ case 16:
+ *c16 = scanline16(f, y);
+ redpix = r16(c16[x]);
+ greenpix = g16(c16[x]);
+ bluepix = b16(c16[x]);
+
+ if(redpix < redmin) redpix = redmin;
+ if(redpix > redmax) redpix = redmax;
+ if(greenpix < greenmin) greenpix = greenmin;
+ if(greenpix > greenmax) greenpix = greenmax;
+ if(bluepix < bluemin) bluepix = bluemin;
+ if(bluepix > bluemax) bluepix = bluemax;
+
+ // set the output pixel
+ c16[x] = rgbtocolor16(redpix, greenpix, bluepix);
+ break;
+ case 24:
+ c24 = scanline24(f, y);
+ redpix = r24(c24[x]);
+ greenpix = g24(c24[x]);
+ bluepix = b24(c24[x]);
+
+ if(redpix < redmin) redpix = redmin;
+ if(redpix > redmax) redpix = redmax;
+ if(greenpix < greenmin) greenpix = greenmin;
+ if(greenpix > greenmax) greenpix = greenmax;
+ if(bluepix < bluemin) bluepix = bluemin;
+ if(bluepix > bluemax) bluepix = bluemax;
+
+ // set the output pixel
+ c24[x] = rgbtocolor24(redpix, greenpix, bluepix);
+ break;
+ case 32:
+ c32 = scanline32(f, y);
+ redpix = r32(c32[x]);
+ greenpix = g32(c32[x]);
+ bluepix = b32(c32[x]);
+
+ if(redpix < redmin) redpix = redmin;
+ if(redpix > redmax) redpix = redmax;
+ if(greenpix < greenmin) greenpix = greenmin;
+ if(greenpix > greenmax) greenpix = greenmax;
+ if(bluepix < bluemin) bluepix = bluemin;
+ if(bluepix > bluemax) bluepix = bluemax;
+
+ // set the output pixel
+ c32[x] = rgbtocolor32(redpix, greenpix, bluepix);
+ break;
+ }
+ }
+ }
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ printf("Using constrain as copy operation does nothing!\n");
+}
diff --git a/Plugins/constrain.dll b/Plugins/constrain.dll
new file mode 100644
index 0000000..9fc83eb
--- /dev/null
+++ b/Plugins/constrain.dll
Binary files differ
diff --git a/Plugins/cutout.c b/Plugins/cutout.c
new file mode 100644
index 0000000..9ad1984
--- /dev/null
+++ b/Plugins/cutout.c
@@ -0,0 +1,131 @@
+// 242.cutout -- does a rectangular mask really quickly.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+// usage: cutout <x> <y> <width> <height> <flip>
+//
+
+#include <stdio.h>
+#include <string.h>
+#include "plugin.h"
+
+void perform_effect(struct frame f, struct args a)
+{
+ printf("Using cutout as effect does nothing!\n");
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ short x, y, w, h, x_c, y_c, w_c, h_c, x_m, y_m, check, flip = 0;
+ byte pixelsize = f1.pixelformat/8;
+ pixel16 *pix1_16, *pix2_16;
+ pixel24 *pix1_24, *pix2_24;
+ pixel32 *pix1_32, *pix2_32;
+ char *t;
+
+ w = f1.width<f2.width ? f1.width : f2.width;
+ h = f1.height<f2.height ? f1.height : f2.height;
+
+ // get params
+ if(!a.s) return;
+ x_c = atoi(a.s);
+ if(!(t = strstr(a.s, " "))) return;
+ y_c = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ w_c = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ h_c = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ flip = atoi(t+1);
+
+ printf("cutout: x%d y%d w%d h%d - f%d\n", x_c, y_c, w_c, h_c, flip);
+
+ x_m = x_c + w_c; // figure out bounds of rectangle.
+ y_m = y_c + h_c;
+
+ switch(f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ pix1_16 = scanline16(f1, y);
+ pix2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ if((x >= x_c) && (x <= x_m) && (y >= y_c) && (y <= y_m))
+ {
+ check = 0;
+ }
+ else
+ {
+ check = 1;
+ } // occlude or don't occlude
+
+ // sort out which image input goes over and which goes under
+ if(flip)check = !check;
+
+ if(!check)
+ {
+ pix2_16[x] = pix1_16[x]; // set output1
+ }
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ pix1_24 = scanline24(f1, y);
+ pix2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ if((x >= x_c) && (x <= x_m) && (y >= y_c) && (y <= y_m))
+ {
+ check = 0;
+ }
+ else
+ {
+ check = 1;
+ } // occlude or don't occlude
+
+ // sort out which image input goes over and which goes under
+ if(flip)check = !check;
+
+ if(!check)
+ {
+ pix2_24[x] = pix1_24[x]; // set output1
+ }
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ pix1_32 = scanline32(f1, y);
+ pix2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ if((x >= x_c) && (x <= x_m) && (y >= y_c) && (y <= y_m))
+ {
+ check = 0;
+ }
+ else
+ {
+ check = 1;
+ } // occlude or don't occlude
+
+ // sort out which image input goes over and which goes under
+ if(flip)check = !check;
+
+ if(!check)
+ {
+ pix2_32[x] = pix1_32[x]; // set output1
+ }
+ }
+ }
+ break;
+ }
+}
diff --git a/Plugins/cutout.dll b/Plugins/cutout.dll
new file mode 100644
index 0000000..939cfe4
--- /dev/null
+++ b/Plugins/cutout.dll
Binary files differ
diff --git a/Plugins/eclipse.c b/Plugins/eclipse.c
new file mode 100644
index 0000000..6c2021c
--- /dev/null
+++ b/Plugins/eclipse.c
@@ -0,0 +1,177 @@
+// 242.eclipse -- does meta-imaging on an input image.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+// grid quantization algorithm massively improved by jeremy bernstein, bootsquadresearch.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+// usage: eclipse <red> <green> <blue> <rows> <columns>
+//
+
+#include <stdio.h>
+#include <string.h>
+#include "plugin.h"
+
+// the process image routines work like this:
+//
+// two pointers (src and src2) access the pixels in the input image
+// src controls the output of the smaller grids, src2 controls the tinting from
+// the upper-left corner of the point in the image that the grid is supposed to represent.
+//
+// the grid dimensions are computed by the size of the input image and are used to define
+// the size of each pixel in the grid (which is why some row and columns combinations
+// leave orphaned pixels on the edges).
+// the loop goes like this:
+//
+// do each row {
+// do each column {
+// get the 'tint pixel' for that frame;
+//
+// do the height within each meta-frame {
+// do the width within each meta-frame {
+// output the pixels for each frame, tinting it;
+// }
+// }
+// }
+// }
+//
+//
+
+void perform_effect(struct frame f, struct args a) // color tints color
+{
+ int i, i1, j, j1, r, c, src2[2];
+ int rows, columns, rowstep, colstep, rowoffset, coloffset, check;
+ byte red, green, blue, r2, g2, b2;
+ byte bits = f.pixelformat/8;
+ byte redpix, greenpix, bluepix; // the color values
+ pixel16 *pix_16, *pix2_16;
+ pixel24 *pix_24, *pix2_24;
+ pixel32 *pix_32, *pix2_32;
+ char *t;
+
+ // get r g b and fuzzy params
+ if(!a.s) return;
+ red = atoi(a.s);
+ if(!(t = strstr(a.s, " "))) return;
+ green = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ blue = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ rows = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ columns = atoi(t+1);
+
+ printf("eclipse: r%d g%d b%d - r%d c%d\n", red, green, blue, rows, columns);
+
+
+ rowstep = (f.height / rows) + .5;
+ colstep = (f.width / columns) + .5;
+ // printf("red is %ld green is %ld blue is %ld", red, green, blue);
+
+ if ( rows > (f.height * .1) )
+ rowoffset = rows - (f.height * .1);
+ else
+ rowoffset = 1;
+
+ if ( columns > (f.width * .1) )
+ coloffset = columns - (f.width * .1);
+ else
+ coloffset = 1;
+
+
+ for(r = 0; r <= ( rows + rowoffset ); r++ )
+ {
+ for(i = 0, i1 = ( r * rowstep ); i < f.height; i+=rows, i1++)
+ {
+ for( c = 0; c <= columns + coloffset; c++ )
+ {
+ switch(f.pixelformat)
+ {
+ case 16:
+ src2[0] = c * colstep;
+ src2[1] = r * rowstep;
+ pix2_16 = scanline16(f, src2[1]);
+ r2 = r16(pix2_16[src2[0]]);
+ g2 = g16(pix2_16[src2[0]]);
+ b2 = b16(pix2_16[src2[0]]);
+
+ for(j = 0, j1 = c * colstep; j < f.width; j += columns, j1++)
+ {
+ if ( j1 >= f.width )
+ goto dink;
+
+ if ( i1 >= f.height )
+ goto yoink;
+
+ pix_16 = scanline16(f, i1);
+ redpix = r16(pix_16[j1]) + r2 + red;
+ greenpix = g16(pix_16[j1]) + g2 + green;
+ bluepix = b16(pix_16[j1]) + b2 + blue;
+
+ pix_16[j1] = rgbtocolor16(redpix, greenpix, bluepix);
+ }
+ break;
+ case 24:
+ src2[0] = c * colstep;
+ src2[1] = r * rowstep;
+ pix2_24 = scanline24(f, src2[1]);
+ r2 = r24(pix2_24[src2[0]]);
+ g2 = g24(pix2_24[src2[0]]);
+ b2 = b24(pix2_24[src2[0]]);
+
+ for(j = 0, j1 = c * colstep; j < f.width; j += columns, j1++)
+ {
+ if ( j1 >= f.width )
+ goto dink;
+
+ if ( i1 >= f.height )
+ goto yoink;
+
+ pix_24 = scanline24(f, i1);
+ redpix = r24(pix_24[j1]) + r2 + red;
+ greenpix = g24(pix_24[j1]) + g2 + green;
+ bluepix = b24(pix_24[j1]) + b2 + blue;
+
+ pix_24[j1] = rgbtocolor24(redpix, greenpix, bluepix);
+ }
+ break;
+ case 32:
+ src2[0] = c * colstep;
+ src2[1] = r * rowstep;
+ pix2_32 = scanline32(f, src2[1]);
+ r2 = r32(pix2_32[src2[0]]);
+ g2 = g32(pix2_32[src2[0]]);
+ b2 = b32(pix2_32[src2[0]]);
+
+ for(j = 0, j1 = c * colstep; j < f.width; j += columns, j1++)
+ {
+ if ( j1 >= f.width )
+ goto dink;
+
+ if ( i1 >= f.height )
+ goto yoink;
+
+ pix_32 = scanline32(f, i1);
+ redpix = r32(pix_32[j1]) + r2 + red;
+ greenpix = g32(pix_32[j1]) + g2 + green;
+ bluepix = b32(pix_32[j1]) + b2 + blue;
+
+ pix_32[j1] = rgbtocolor32(redpix, greenpix, bluepix);
+ }
+ break;
+ }
+ }
+ dink:
+ ;
+ }
+ }
+ yoink:
+ ;
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ printf("Using eclipse as copy operation does nothing!\n");
+}
diff --git a/Plugins/eclipse.dll b/Plugins/eclipse.dll
new file mode 100644
index 0000000..e9a29df
--- /dev/null
+++ b/Plugins/eclipse.dll
Binary files differ
diff --git a/Plugins/eclipse02.c b/Plugins/eclipse02.c
new file mode 100644
index 0000000..d1d5301
--- /dev/null
+++ b/Plugins/eclipse02.c
@@ -0,0 +1,178 @@
+// 242.eclipse02 -- does meta-imaging on two input images.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+// grid quantization algorithm massively improved by jeremy bernstein, bootsquadresearch.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+// usage: eclipse02 <red> <green> <blue> <rows> <columns>
+//
+
+#include <stdio.h>
+#include <string.h>
+#include "plugin.h"
+
+// the process image routines work like this:
+//
+// two pointers (src and src2) access the pixels in the input image
+// src controls the output of the smaller grids, src2 controls the tinting from
+// the upper-left corner of the point in the image that the grid is supposed to represent.
+//
+// the grid dimensions are computed by the size of the input image and are used to define
+// the size of each pixel in the grid (which is why some row and columns combinations
+// leave orphaned pixels on the edges).
+// the loop goes like this:
+//
+// do each row {
+// do each column {
+// get the 'tint pixel' for that frame;
+//
+// do the height within each meta-frame {
+// do the width within each meta-frame {
+// output the pixels for each frame, tinting it;
+// }
+// }
+// }
+// }
+//
+//
+
+void perform_effect(struct frame f, struct args a) // color tints color
+{
+ printf("Using eclipse02 as effect does nothing!\n");
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ short i, i1, j, j1, r, c, src1[2], w, h;
+ short rows, columns, rowstep, colstep, rowoffset, coloffset;
+ byte red, green, blue, check, r1, g1, b1;
+ byte bits = f1.pixelformat/8;
+ byte redpix, greenpix, bluepix; // the color values
+ pixel16 *pix2_16, *pix1_16;
+ pixel24 *pix2_24, *pix1_24;
+ pixel32 *pix2_32, *pix1_32;
+ char *t;
+
+ w = f1.width<f2.width ? f1.width : f2.width;
+ h = f1.height<f2.height ? f1.height : f2.height;
+
+ // get r g b and fuzzy params
+ if(!a.s) return;
+ red = atoi(a.s);
+ if(!(t = strstr(a.s, " "))) return;
+ green = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ blue = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ rows = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ columns = atoi(t+1);
+
+
+ rowstep = (h / rows) + .5;
+ colstep = (w / columns) + .5;
+ // printf("red is %ld green is %ld blue is %ld", red, green, blue);
+
+ if ( rows > (h * .1) )
+ rowoffset = rows - (h * .1);
+ else
+ rowoffset = 1;
+
+ if ( columns > (w * .1) )
+ coloffset = columns - (w * .1);
+ else
+ coloffset = 1;
+
+
+ for(r = 0; r <= ( rows + rowoffset ); r++ )
+ {
+ for(i = 0, i1 = ( r * rowstep ); i < h; i += rows, i1++)
+ {
+ for( c = 0; c <= columns + coloffset; c++ )
+ {
+ switch(f1.pixelformat)
+ {
+ case 16:
+ src1[0] = c * colstep;
+ src1[1] = r * rowstep;
+ pix1_16 = scanline16(f1, src1[1]);
+ r1 = r16(pix1_16[src1[0]]);
+ g1 = g16(pix1_16[src1[0]]);
+ b1 = b16(pix1_16[src1[0]]);
+
+ for(j = 0, j1 = c * colstep; j < w; j += columns, j1++)
+ {
+ if ( j1 >= w )
+ goto dink;
+
+ if ( i1 >= h )
+ goto yoink;
+
+ pix2_16 = scanline16(f2, i1);
+ redpix = r16(pix2_16[j1]) + r1 + red;
+ greenpix = g16(pix2_16[j1]) + g1 + green;
+ bluepix = b16(pix2_16[j1]) + b1 + blue;
+
+ pix2_16[j1] = rgbtocolor16(redpix, greenpix, bluepix);
+ }
+ break;
+ case 24:
+ src1[0] = c * colstep;
+ src1[1] = r * rowstep;
+ pix1_24 = scanline24(f1, src1[1]);
+ r1 = r24(pix1_24[src1[0]]);
+ g1 = g24(pix1_24[src1[0]]);
+ b1 = b24(pix1_24[src1[0]]);
+
+ for(j = 0, j1 = c * colstep; j < w; j += columns, j1++)
+ {
+ if ( j1 >= w )
+ goto dink;
+
+ if ( i1 >= h )
+ goto yoink;
+
+ pix2_24 = scanline24(f2, i1);
+ redpix = r24(pix2_24[j1]) + r1 + red;
+ greenpix = g24(pix2_24[j1]) + g1 + green;
+ bluepix = b24(pix2_24[j1]) + b1 + blue;
+
+ pix2_24[j1] = rgbtocolor24(redpix, greenpix, bluepix);
+ }
+ break;
+ case 32:
+ src1[0] = c * colstep;
+ src1[1] = r * rowstep;
+ pix1_32 = scanline32(f1, src1[1]);
+ r1 = r32(pix1_32[src1[0]]);
+ g1 = g32(pix1_32[src1[0]]);
+ b1 = b32(pix1_32[src1[0]]);
+
+ for(j = 0, j1 = c * colstep; j < w; j += columns, j1++)
+ {
+ if ( j1 >= w )
+ goto dink;
+
+ if ( i1 >= h )
+ goto yoink;
+
+ pix2_32 = scanline32(f2, i1);
+ redpix = r32(pix2_32[j1]) + r1 + red;
+ greenpix = g32(pix2_32[j1]) + g1 + green;
+ bluepix = b32(pix2_32[j1]) + b1 + blue;
+
+ pix2_32[j1] = rgbtocolor32(redpix, greenpix, bluepix);
+ }
+ break;
+ }
+ }
+ dink:
+ ;
+ }
+ }
+ yoink:
+ ;
+}
diff --git a/Plugins/eclipse02.dll b/Plugins/eclipse02.dll
new file mode 100644
index 0000000..e13a72f
--- /dev/null
+++ b/Plugins/eclipse02.dll
Binary files differ
diff --git a/Plugins/eclipse03.c b/Plugins/eclipse03.c
new file mode 100644
index 0000000..8d6b31d
--- /dev/null
+++ b/Plugins/eclipse03.c
@@ -0,0 +1,244 @@
+// 242.eclipse0303 -- does meta-imaging on an input image using an inversion threshhold.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+// grid quantization algorithm massively improved by jeremy bernstein, bootsquadresearch.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+// usage: eclipse <red> <green> <blue> <rows> <columns> <tint> <invert> <thresh>
+//
+
+#include <stdio.h>
+#include <string.h>
+#include "plugin.h"
+
+// the process image routines work like this:
+//
+// two pointers (src and src2) access the pixels in the input image
+// src controls the output of the smaller grids, src2 controls the tinting from
+// the upper-left corner of the point in the image that the grid is supposed to represent.
+//
+// the grid dimensions are computed by the size of the input image and are used to define
+// the size of each pixel in the grid (which is why some row and columns combinations
+// leave orphaned pixels on the edges).
+// the loop goes like this:
+//
+// do each row {
+// do each column {
+// get the 'tint pixel' for that frame;
+//
+// do the height within each meta-frame {
+// do the width within each meta-frame {
+// output the pixels for each frame, tinting it;
+// }
+// }
+// }
+// }
+//
+//
+
+void perform_effect(struct frame f, struct args a) // color tints color
+{
+ short i, i1, j, j1, r, c, src2[2];
+ short rows, columns, rowstep, colstep, rowoffset, coloffset;
+ short cut, flip, tint, inv, thresh;
+ byte red, green, blue, check, r2, g2, b2;
+ byte bits = f.pixelformat/8;
+ byte redpix, greenpix, bluepix; // the color values
+ pixel16 *pix_16, *pix2_16;
+ pixel24 *pix_24, *pix2_24;
+ pixel32 *pix_32, *pix2_32;
+ char *t;
+
+ // get params
+ if(!a.s) return;
+ red = atoi(a.s);
+ if(!(t = strstr(a.s, " "))) return;
+ green = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ blue = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ rows = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ columns = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ tint = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ inv = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ thresh = atoi(t+1);
+
+ printf("eclipse03: r%d g%d b%d - r%d c%d - t%d i%d t%d\n",
+ red, green, blue, rows, columns, tint, inv, thresh);
+
+ rowstep = (f.height / rows) + .5;
+ colstep = (f.width / columns) + .5;
+
+ if ( rows > (f.height * .1) )
+ rowoffset = rows - (f.height * .1);
+ else
+ rowoffset = 1;
+
+ if ( columns > (f.width * .1) )
+ coloffset = columns - (f.width * .1);
+ else
+ coloffset = 1;
+
+ if (thresh < 0) flip = 1; else flip = 0;
+
+ for (r = 0; r <= ( rows + rowoffset ); r++ )
+ {
+ for(i = 0, i1 = ( r * rowstep ); i < f.height; i+=rows, i1++)
+ {
+ for ( c = 0; c <= columns + coloffset; c++ )
+ {
+ switch (f.pixelformat)
+ {
+ case 16:
+ src2[0] = c * colstep;
+ src2[1] = r * rowstep;
+ pix2_16 = scanline16(f, src2[1]);
+ r2 = r16(pix2_16[src2[0]]);
+ g2 = g16(pix2_16[src2[0]]);
+ b2 = b16(pix2_16[src2[0]]);
+ if (((r2 + g2 + b2) / 3.0) >= fabs(thresh)) cut = 1;
+ if (!tint) r2 = g2 = b2 = 0;
+
+ for(j = 0, j1 = c * colstep; j < f.width; j += columns, j1++)
+ {
+ if ( j1 >= f.width )
+ goto dink;
+
+ if ( i1 >= f.height )
+ goto yoink;
+
+ pix_16 = scanline16(f, i1);
+
+ if ((cut && !flip) || (!cut && flip)) {
+ redpix = r16(pix_16[j1]) + r2 + red;
+ greenpix = g16(pix_16[j1]) + g2 + green;
+ bluepix = b16(pix_16[j1]) + + b2 + blue;
+ }
+ else
+ {
+ if (!inv)
+ {
+ redpix = 255 - r16(pix_16[j1]) + r2 + red;
+ greenpix = 255 - g16(pix_16[j1]) + g2 + green;
+ bluepix = 255 - b16(pix_16[j1]) + b2 + blue;
+ }
+ else
+ {
+ redpix = 255 - r16(pix_16[j1]) + r2 - red;
+ greenpix = 255 - g16(pix_16[j1]) + g2 - green;
+ bluepix = 255 - b16(pix_16[j1]) + b2 - blue;
+ }
+ }
+
+ pix_16[j1] = rgbtocolor16(redpix, greenpix, bluepix);
+ }
+ break;
+ case 24:
+ src2[0] = c * colstep;
+ src2[1] = r * rowstep;
+ pix2_24 = scanline24(f, src2[1]);
+ r2 = r24(pix2_24[src2[0]]);
+ g2 = g24(pix2_24[src2[0]]);
+ b2 = b24(pix2_24[src2[0]]);
+ if (((r2 + g2 + b2) / 3.0) >= fabs(thresh)) cut = 1;
+ if (!tint) r2 = g2 = b2 = 0;
+
+ for(j = 0, j1 = c * colstep; j < f.width; j += columns, j1++)
+ {
+ if ( j1 >= f.width )
+ goto dink;
+
+ if ( i1 >= f.height )
+ goto yoink;
+
+ pix_24 = scanline24(f, i1);
+
+ if ((cut && !flip) || (!cut && flip)) {
+ redpix = r24(pix_24[j1]) + r2 + red;
+ greenpix = g24(pix_24[j1]) + g2 + green;
+ bluepix = b24(pix_24[j1]) + + b2 + blue;
+ }
+ else
+ {
+ if (!inv)
+ {
+ redpix = 255 - r24(pix_24[j1]) + r2 + red;
+ greenpix = 255 - g24(pix_24[j1]) + g2 + green;
+ bluepix = 255 - b24(pix_24[j1]) + b2 + blue;
+ }
+ else
+ {
+ redpix = 255 - r24(pix_24[j1]) + r2 - red;
+ greenpix = 255 - g24(pix_24[j1]) + g2 - green;
+ bluepix = 255 - b24(pix_24[j1]) + b2 - blue;
+ }
+ }
+
+ pix_24[j1] = rgbtocolor24(redpix, greenpix, bluepix);
+ }
+ break;
+ case 32:
+ src2[0] = c * colstep;
+ src2[1] = r * rowstep;
+ pix2_32 = scanline32(f, src2[1]);
+ r2 = r32(pix2_32[src2[0]]);
+ g2 = g32(pix2_32[src2[0]]);
+ b2 = b32(pix2_32[src2[0]]);
+ if (((r2 + g2 + b2) / 3.0) >= fabs(thresh)) cut = 1;
+ if (!tint) r2 = g2 = b2 = 0;
+
+ for(j = 0, j1 = c * colstep; j < f.width; j += columns, j1++)
+ {
+ if ( j1 >= f.width )
+ goto dink;
+
+ if ( i1 >= f.height )
+ goto yoink;
+
+ pix_32 = scanline32(f, i1);
+
+ if ((cut && !flip) || (!cut && flip)) {
+ redpix = r32(pix_32[j1]) + r2 + red;
+ greenpix = g32(pix_32[j1]) + g2 + green;
+ bluepix = b32(pix_32[j1]) + + b2 + blue;
+ }
+ else
+ {
+ if (!inv)
+ {
+ redpix = 255 - r32(pix_32[j1]) + r2 + red;
+ greenpix = 255 - g32(pix_32[j1]) + g2 + green;
+ bluepix = 255 - b32(pix_32[j1]) + b2 + blue;
+ }
+ else
+ {
+ redpix = 255 - r32(pix_32[j1]) + r2 - red;
+ greenpix = 255 - g32(pix_32[j1]) + g2 - green;
+ bluepix = 255 - b32(pix_32[j1]) + b2 - blue;
+ }
+ }
+
+ pix_32[j1] = rgbtocolor32(redpix, greenpix, bluepix);
+ }
+ break;
+ }
+ }
+ dink:
+ ;
+ }
+ }
+ yoink:
+ ;
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ printf("Using eclipse03 as copy operation does nothing!\n");
+}
diff --git a/Plugins/eclipse03.dll b/Plugins/eclipse03.dll
new file mode 100644
index 0000000..60560e2
--- /dev/null
+++ b/Plugins/eclipse03.dll
Binary files differ
diff --git a/Plugins/fromage.c b/Plugins/fromage.c
new file mode 100644
index 0000000..0c8b48a
--- /dev/null
+++ b/Plugins/fromage.c
@@ -0,0 +1,191 @@
+// 242.fromage -- does cheezy wipes between two input images.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+// usage: fromage <x> <y> <columns> <rows> <flip>
+//
+
+#include <stdio.h>
+#include <string.h>
+#include "plugin.h"
+
+void perform_effect(struct frame f, struct args a)
+{
+ printf("Using fromage as effect does nothing!\n");
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ short x, y, w, h, wf, hf, x_c, y_c, c, r, columns, rows, checky, checkx, flip = 0;
+ pixel16 *pix1_16, *pix2_16;
+ pixel24 *pix1_24, *pix2_24;
+ pixel32 *pix1_32, *pix2_32;
+ char *t;
+
+ // get params
+ if(!a.s) return;
+ x_c = atoi(a.s);
+ if(!(t = strstr(a.s, " "))) return;
+ y_c = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ columns = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ rows = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ flip = atoi(t+1);
+
+ printf("fromage: x%d y%d c%d r%d - f%d\n", x_c, y_c, columns, rows, flip);
+
+ // calculate size we need to process
+ wf = f1.width<f2.width ? f1.width : f2.width;
+ hf = f1.height<f2.height ? f1.height : f2.height;
+
+ w = wf / columns; // set column width
+ h = hf / rows; // set row height
+
+ switch(f1.pixelformat)
+ {
+ case 16:
+ for(r = 0; r < (rows + 1); r++)
+ {
+ for(y = r * h; y < h * (r + 1); y++)
+ {
+ pix1_16 = scanline16(f1, y);
+ pix2_16 = scanline16(f2, y);
+
+ if(y >= hf) continue;
+
+ if(y < (y_c + (r * h))) // occlude or don't occlude
+ {
+ checky = 1;
+ }
+ else
+ {
+ checky = 0;
+ }
+ if(flip) checky = !checky;
+
+ for(c = 0; c < (columns + 1); c++)
+ {
+ for(x = c * w; x < w * (c + 1); x++)
+ {
+ if (x >= wf) continue;
+
+ if(x < (x_c + (c * w))) // occlude or don't occlude
+ {
+ checkx = 1;
+ }
+ else
+ {
+ checkx = 0;
+ }
+ if(flip) checkx = !checkx;
+
+ if (checkx || checky)
+ {
+ pix2_16[x] = pix1_16[x]; // set output1
+ }
+ }
+ }
+
+ }
+ }
+ break;
+ case 24:
+ for(r = 0; r < (rows + 1); r++)
+ {
+ for(y = r * h; y < h * (r + 1); y++)
+ {
+ pix1_24 = scanline24(f1, y);
+ pix2_24 = scanline24(f2, y);
+
+ if(y >= hf) continue;
+
+ if(y < (y_c + (r*h))) // occlude or don't occlude
+ {
+ checky = 1;
+ }
+ else
+ {
+ checky = 0;
+ }
+ if(flip) checky = !checky;
+
+ for(c = 0; c < (columns + 1); c++)
+ {
+ for(x = c * w; x < w * (c + 1); x++)
+ {
+ if (x >= wf) continue;
+
+ if(x < (x_c + (c * w))) // occlude or don't occlude
+ {
+ checkx = 1;
+ }
+ else
+ {
+ checkx = 0;
+ }
+ if(flip) checkx = !checkx;
+
+ if (checkx || checky)
+ {
+ pix2_24[x] = pix1_24[x]; // set output2
+ }
+ }
+ }
+
+ }
+ }
+ break;
+ case 32:
+ for(r = 0; r < (rows + 1); r++)
+ {
+ for(y = r * h; y < h * (r + 1); y++)
+ {
+ pix1_32 = scanline32(f1, y);
+ pix2_32 = scanline32(f2, y);
+
+ if(y >= hf) continue;
+
+ if(y < (y_c + (r * h))) // occlude or don't occlude
+ {
+ checky = 1;
+ }
+ else
+ {
+ checky = 0;
+ }
+ if(flip) checky = !checky;
+
+ for(c = 0; c < (columns + 1); c++)
+ {
+ for(x = c * w; x < w * (c + 1); x++)
+ {
+ if (x >= wf) continue;
+
+ if(x < (x_c + (c * w))) // occlude or don't occlude
+ {
+ checkx = 1;
+ }
+ else
+ {
+ checkx = 0;
+ }
+ if(flip) checkx = !checkx;
+
+ if (checkx || checky)
+ {
+ pix2_32[x] = pix1_32[x]; // set output2
+ }
+ }
+ }
+
+ }
+ }
+ break;
+ }
+}
diff --git a/Plugins/fromage.dll b/Plugins/fromage.dll
new file mode 100644
index 0000000..913caee
--- /dev/null
+++ b/Plugins/fromage.dll
Binary files differ
diff --git a/Plugins/keyscreen.c b/Plugins/keyscreen.c
new file mode 100644
index 0000000..45aea88
--- /dev/null
+++ b/Plugins/keyscreen.c
@@ -0,0 +1,131 @@
+// 242.keyscreen -- does 3-source chroma keying.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+// usage: keyscreen <red> <green> <blue> <fuzzi red> <fuzzi green> <fuzzi blue>
+//
+// f2 is the key & target, f1 is the mask
+//
+
+#include <stdio.h>
+#include <string.h>
+#include "plugin.h"
+
+void perform_effect(struct frame f, struct args a)
+{
+ printf("Using keyscreen as effect does nothing!\n");
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ short x, y, w, h;
+ pixel16 *pix1_16, *pix2_16;
+ pixel24 *pix1_24, *pix2_24;
+ pixel32 *pix1_32, *pix2_32;
+ byte redpix, greenpix, bluepix;
+ byte red, green, blue, check, rf, gf, bf;
+ char *t;
+
+ w = f1.width<f2.width ? f1.width : f2.width;
+ h = f1.height<f2.height ? f1.height : f2.height;
+
+ // get params
+ if(!a.s) return;
+ red = atoi(a.s);
+ if(!(t = strstr(a.s, " "))) return;
+ green = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ blue = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ rf = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ gf = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ bf = atoi(t+1);
+
+ printf("keyscreen: r%d g%d b%d rf%d gf%d bf%d\n", red, green, blue, rf, gf, bf);
+
+ // key all channels simultaneously
+ switch(f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ pix1_16 = scanline16(f1, y);
+ pix2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ check = 0; // start with each pixel anew
+
+ redpix = r16(pix2_16[x]);
+ greenpix = g16(pix2_16[x]);
+ bluepix = b16(pix2_16[x]);
+ if ((redpix>=(red-rf))&&(redpix<=(red+rf))&&(greenpix>=(green-gf))&&(greenpix<=(green+gf))&&(bluepix>=(blue-bf))&&(bluepix<=(blue+bf)))
+ {
+ check = 1; // mask it
+ }
+
+
+ if(check) // output frame 1
+ {
+ pix2_16[x] = pix1_16[x];
+ }
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ pix1_24 = scanline24(f1, y);
+ pix2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ check = 0; // start with each pixel anew
+
+ redpix = r24(pix2_24[x]);
+ greenpix = g24(pix2_24[x]);
+ bluepix = b24(pix2_24[x]);
+ if ((redpix>=(red-rf))&&(redpix<=(red+rf))&&(greenpix>=(green-gf))&&(greenpix<=(green+gf))&&(bluepix>=(blue-bf))&&(bluepix<=(blue+bf)))
+ {
+ check = 1; // mask it
+ }
+
+
+ if(check) // output frame 1
+ {
+ pix1_24[x] = pix1_24[x];
+ }
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ pix1_32 = scanline32(f1, y);
+ pix2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ check = 0; // start with each pixel anew
+
+ redpix = r32(pix2_32[x]);
+ greenpix = g32(pix2_32[x]);
+ bluepix = b32(pix2_32[x]);
+ if ((redpix>=(red-rf))&&(redpix<=(red+rf))&&(greenpix>=(green-gf))&&(greenpix<=(green+gf))&&(bluepix>=(blue-bf))&&(bluepix<=(blue+bf)))
+ {
+ check = 1; // mask it
+ }
+
+
+ if(check) // output frame 1
+ {
+ pix2_32[x] = pix1_32[x];
+ }
+ }
+ }
+ break;
+ }
+}
diff --git a/Plugins/keyscreen.dll b/Plugins/keyscreen.dll
new file mode 100644
index 0000000..6631ea3
--- /dev/null
+++ b/Plugins/keyscreen.dll
Binary files differ
diff --git a/Plugins/makefile b/Plugins/makefile
index 198a611..4e92a8a 100644
--- a/Plugins/makefile
+++ b/Plugins/makefile
@@ -2,7 +2,9 @@ all: noize colortv subtract xbend bend gol shuffle green \
tile rgbcopy copyvert black rgb hist setbits xshred \
sonogram vf2fs fs2vf swap 2colors plot makesliders \
convolution compare darken deinterlace difference interlace lighten \
- multiply overlay screen shadowcaster softlight
+ multiply overlay screen shadowcaster softlight \
+ rgbseek modgain traffic constrain eclipse eclipse02 eclipse03 \
+ cga keyscreen rene cutout fromage rgbavg rgbavg02
dir *.dll
@@ -129,3 +131,53 @@ softlight:
#
# </PixelPack>
#
+
+#
+# PeRColate
+#
+
+rgbseek:
+ cl rgbseek.c $(FLAGS) /link $(EFFECT)
+
+modgain:
+ cl modgain.c $(FLAGS) /link $(EFFECT)
+
+traffic:
+ cl traffic.c $(FLAGS) /link $(EFFECT)
+
+constrain:
+ cl constrain.c $(FLAGS) /link $(EFFECT)
+
+eclipse:
+ cl eclipse.c $(FLAGS) /link $(EFFECT)
+
+eclipse02:
+ cl eclipse02.c $(FLAGS) /link $(COPY)
+
+eclipse03:
+ cl eclipse03.c $(FLAGS) /link $(EFFECT)
+
+cga:
+ cl cga.c $(FLAGS) /link $(EFFECT)
+
+keyscreen:
+ cl keyscreen.c $(FLAGS) /link $(COPY)
+
+rene:
+ cl rene.c $(FLAGS) /link $(COPY)
+
+cutout:
+ cl cutout.c $(FLAGS) /link $(COPY)
+
+fromage:
+ cl fromage.c $(FLAGS) /link $(COPY)
+
+rgbavg:
+ cl rgbavg.c $(FLAGS) /link $(EFFECT)
+
+rgbavg02:
+ cl rgbavg02.c $(FLAGS) /link $(COPY)
+
+#
+# </PeRColate>
+#
diff --git a/Plugins/modgain.c b/Plugins/modgain.c
new file mode 100644
index 0000000..1c4ce56
--- /dev/null
+++ b/Plugins/modgain.c
@@ -0,0 +1,89 @@
+// 242.modgain -- does modulo channel shifting on an input image.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+// usage: modgain <red> <green> <blue>
+//
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "plugin.h"
+
+void perform_effect(struct frame f, struct args arg)
+{
+ int x,y;
+ int red, green, blue, alpha; // parameters
+ byte r, g, b, a;
+ byte bits = f.pixelformat/8;
+ byte redpix, greenpix, bluepix; // the color values
+ pixel16 *c16;
+ pixel24 *c24;
+ pixel32 *c32;
+ char *t;
+
+ // get params
+ if(!arg.s) return;
+ red = atoi(arg.s);
+ if(!(t = strstr(arg.s, " "))) return;
+ green = atoi(t+1);
+ if(!(t = strstr(arg.s, " "))) return;
+ blue = atoi(t+1);
+
+ printf("modgain: r%d g%d b%d\n", red, green, blue);
+
+ for(y = 0; y < f.height; y++)
+ {
+ for(x = 0; x < f.width; x++)
+ {
+ switch(f.pixelformat)
+ {
+ case 16:
+ c16 = scanline16(f, y);
+ r = (r16(c16[x]) + red) % 255;
+ g = (g16(c16[x]) + green) % 255;
+ b = (b16(c16[x]) + blue) % 255;
+ // shift the pixels and wrap them
+ if(r<0) r += 255;
+ if(g<0) g += 255;
+ if(b<0) b += 255;
+
+ c16[x] = rgbtocolor16(r, g, b);
+ break;
+ case 24:
+ c24 = scanline24(f, y);
+ r = (r24(c24[x]) + red) % 255;
+ g = (g24(c24[x]) + green) % 255;
+ b = (b24(c24[x]) + blue) % 255;
+ // shift the pixels and wrap them
+ if(r<0) r += 255;
+ if(g<0) g += 255;
+ if(b<0) b += 255;
+
+ c24[x] = rgbtocolor24(r, g, b);
+ break;
+ case 32:
+ c32 = scanline32(f, y);
+ r = (r32(c32[x]) + red) % 255;
+ g = (g32(c32[x]) + green) % 255;
+ b = (b32(c32[x]) + blue) % 255;
+ // shift the pixels and wrap them
+ if(r<0) r += 255;
+ if(g<0) g += 255;
+ if(b<0) b += 255;
+
+ c32[x] = rgbtocolor32(r, g, b);
+ break;
+ }
+ }
+ }
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ printf("Using modgain as copy operation does nothing!\n");
+}
diff --git a/Plugins/modgain.dll b/Plugins/modgain.dll
new file mode 100644
index 0000000..14946a3
--- /dev/null
+++ b/Plugins/modgain.dll
Binary files differ
diff --git a/Plugins/rene.c b/Plugins/rene.c
new file mode 100644
index 0000000..d8e6082
--- /dev/null
+++ b/Plugins/rene.c
@@ -0,0 +1,245 @@
+// 242.rene -- does 3-source chroma keying with transparency.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+// for rene beekman.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+// usage: rene <red> <green> <blue> <fuzzi red> <fuzzi green> <fuzzi blue> <redfloor> <greenfloor> <bluefloor>
+//
+// f1 is the key & target, f2 is the mask
+//
+
+#include <stdio.h>
+#include <string.h>
+#include "plugin.h"
+
+void perform_effect(struct frame f, struct args a)
+{
+ printf("Using keyscreen as effect does nothing!\n");
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ short x, y, w, h;
+ pixel16 *pix1_16, *pix2_16;
+ pixel24 *pix1_24, *pix2_24;
+ pixel32 *pix1_32, *pix2_32;
+ byte redpix, greenpix, bluepix, rkeyed, gkeyed, bkeyed;
+ byte red, green, blue, check, rf, gf, bf, rfl, gfl, bfl;
+ float lum, keylum, lowfuzz, highfuzz, lowfloor, highfloor, coeff;
+ char *t;
+
+ w = f1.width<f2.width ? f1.width : f2.width;
+ h = f1.height<f2.height ? f1.height : f2.height;
+
+ // get params
+ if(!a.s) return;
+ red = atoi(a.s);
+ if(!(t = strstr(a.s, " "))) return;
+ green = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ blue = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ rf = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ gf = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ bf = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ rfl = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ gfl = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ bfl = atoi(t+1);
+
+ printf("rene: r%d g%d b%d rg%d gf%d bf%d rfl%d gfl%d bfl%d\n",
+ red, green, blue, rf, gf, bf, rfl, gfl, bfl);
+
+ // key all channels simultaneously
+ switch(f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ pix1_16 = scanline16(f1, y);
+ pix2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ check = 0; // start with each pixel anew
+
+ redpix = r16(pix2_16[x]);
+ greenpix = g16(pix2_16[x]);
+ bluepix = b16(pix2_16[x]);
+ if ((redpix>=(red-rf))&&(redpix<=(red+rf))&&(greenpix>=(green-gf))&&(greenpix<=(green+gf))&&(bluepix>=(blue-bf))&&(bluepix<=(blue+bf)))
+ {
+ check = 1; // mask it
+ }
+ if ((redpix<(red-rfl))||(redpix>(red+rfl))&&(greenpix<(green-gfl))||(greenpix>(green+gfl))&&(bluepix<(blue-bfl))||(bluepix>(blue+bfl)))
+ {
+ check = 2; // target it
+ }
+
+ if (!check)
+ {
+ lum = (redpix + greenpix + bluepix) / 3.0;
+ keylum = (red + blue + green) / 3.0;
+ lowfuzz = (rf + gf + bf) / 3.0;
+ if (lowfuzz < 0.0) lowfuzz = 0.0;
+ highfuzz = (rf + gf + bf) / 3.0;
+ if (highfuzz > 1.0) highfuzz = 1.0;
+ lowfloor = keylum - ((rfl + gfl + bfl) / 3.0);
+ if (lowfloor < 0.0) lowfloor = 0.;
+ highfloor = keylum + (rfl + gfl + bfl) / 3.0;
+ if (highfloor > 1.0) highfloor = 1.0;
+ if (lum < keylum)
+ {
+ coeff = ((lum - lowfloor) / (keylum - lowfuzz));
+ }
+ if (lum >= keylum)
+ {
+ coeff = ((255 - lum - highfloor) / (255 - keylum - highfuzz));
+ }
+
+ rkeyed = ((float)r16(pix2_16[x]) * coeff) + ((float)r16(pix1_16[x]) * (1.0 - coeff));
+ gkeyed = ((float)g16(pix2_16[x]) * coeff) + ((float)g16(pix1_16[x]) * (1.0 - coeff));
+ bkeyed = ((float)b16(pix2_16[x]) * coeff) + ((float)b16(pix1_16[x]) * (1.0 - coeff));
+
+ pix2_16[x] = rgbtocolor16(rkeyed, gkeyed, bkeyed);
+ }
+
+ if (check==1)
+ { // was pix3
+ // pix2_16[x] = rgbtocolor16(r16(pix2_16[x]), g16(pix2_16[x]), b16(pix2_16[x]));
+ }
+ if (check==2)
+ { // was pix2
+ pix2_16[x] = rgbtocolor16(r16(pix1_16[x]), g16(pix1_16[x]), b16(pix1_16[x]));
+ }
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ pix1_24 = scanline24(f1, y);
+ pix2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ check = 0; // start with each pixel anew
+
+ redpix = r24(pix2_24[x]);
+ greenpix = g24(pix2_24[x]);
+ bluepix = b24(pix2_24[x]);
+ if ((redpix>=(red-rf))&&(redpix<=(red+rf))&&(greenpix>=(green-gf))&&(greenpix<=(green+gf))&&(bluepix>=(blue-bf))&&(bluepix<=(blue+bf)))
+ {
+ check = 1; // mask it
+ }
+ if ((redpix<(red-rfl))||(redpix>(red+rfl))&&(greenpix<(green-gfl))||(greenpix>(green+gfl))&&(bluepix<(blue-bfl))||(bluepix>(blue+bfl)))
+ {
+ check = 2; // target it
+ }
+
+ if (!check)
+ {
+ lum = (redpix + greenpix + bluepix) / 3.0;
+ keylum = (red + blue + green) / 3.0;
+ lowfuzz = (rf + gf + bf) / 3.0;
+ if (lowfuzz < 0.0) lowfuzz = 0.0;
+ highfuzz = (rf + gf + bf) / 3.0;
+ if (highfuzz > 1.0) highfuzz = 1.0;
+ lowfloor = keylum - ((rfl + gfl + bfl) / 3.0);
+ if (lowfloor < 0.0) lowfloor = 0.;
+ highfloor = keylum + (rfl + gfl + bfl) / 3.0;
+ if (highfloor > 1.0) highfloor = 1.0;
+ if (lum < keylum)
+ {
+ coeff = ((lum - lowfloor) / (keylum - lowfuzz));
+ }
+ if (lum >= keylum)
+ {
+ coeff = ((255 - lum - highfloor) / (255 - keylum - highfuzz));
+ }
+
+ rkeyed = ((float)r24(pix2_24[x]) * coeff) + ((float)r24(pix1_24[x]) * (1.0 - coeff));
+ gkeyed = ((float)g24(pix2_24[x]) * coeff) + ((float)g24(pix1_24[x]) * (1.0 - coeff));
+ bkeyed = ((float)b24(pix2_24[x]) * coeff) + ((float)b24(pix1_24[x]) * (1.0 - coeff));
+
+ pix2_24[x] = rgbtocolor24(rkeyed, gkeyed, bkeyed);
+ }
+
+ if (check==1)
+ { // was pix3
+ // pix2_24[x] = rgbtocolor24(r24(pix2_24[x]), g24(pix2_24[x]), b24(pix2_24[x]));
+ }
+ if (check==2)
+ { // was pix2
+ pix2_24[x] = rgbtocolor24(r24(pix1_24[x]), g24(pix1_24[x]), b24(pix1_24[x]));
+ }
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ pix1_32 = scanline32(f1, y);
+ pix2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ check = 0; // start with each pixel anew
+
+ redpix = r32(pix2_32[x]);
+ greenpix = g32(pix2_32[x]);
+ bluepix = b32(pix2_32[x]);
+ if ((redpix>=(red-rf))&&(redpix<=(red+rf))&&(greenpix>=(green-gf))&&(greenpix<=(green+gf))&&(bluepix>=(blue-bf))&&(bluepix<=(blue+bf)))
+ {
+ check = 1; // mask it
+ }
+ if ((redpix<(red-rfl))||(redpix>(red+rfl))&&(greenpix<(green-gfl))||(greenpix>(green+gfl))&&(bluepix<(blue-bfl))||(bluepix>(blue+bfl)))
+ {
+ check = 2; // target it
+ }
+
+ if (!check)
+ {
+ lum = (redpix + greenpix + bluepix) / 3.0;
+ keylum = (red + blue + green) / 3.0;
+ lowfuzz = (rf + gf + bf) / 3.0;
+ if (lowfuzz < 0.0) lowfuzz = 0.0;
+ highfuzz = (rf + gf + bf) / 3.0;
+ if (highfuzz > 1.0) highfuzz = 1.0;
+ lowfloor = keylum - ((rfl + gfl + bfl) / 3.0);
+ if (lowfloor < 0.0) lowfloor = 0.;
+ highfloor = keylum + (rfl + gfl + bfl) / 3.0;
+ if (highfloor > 1.0) highfloor = 1.0;
+ if (lum < keylum)
+ {
+ coeff = ((lum - lowfloor) / (keylum - lowfuzz));
+ }
+ if (lum >= keylum)
+ {
+ coeff = ((255 - lum - highfloor) / (255 - keylum - highfuzz));
+ }
+
+ rkeyed = ((float)r32(pix2_32[x]) * coeff) + ((float)r32(pix1_32[x]) * (1.0 - coeff));
+ gkeyed = ((float)g32(pix2_32[x]) * coeff) + ((float)g32(pix1_32[x]) * (1.0 - coeff));
+ bkeyed = ((float)b32(pix2_32[x]) * coeff) + ((float)b32(pix1_32[x]) * (1.0 - coeff));
+
+ pix2_32[x] = rgbtocolor32(rkeyed, gkeyed, bkeyed);
+ }
+
+ if (check==1)
+ { // was pix3
+ // pix2_32[x] = rgbtocolor32(r32(pix2_32[x]), g32(pix2_32[x]), b32(pix2_32[x]));
+ }
+ if (check==2)
+ { // was pix2
+ pix2_32[x] = rgbtocolor32(r32(pix1_32[x]), g32(pix1_32[x]), b32(pix1_32[x]));
+ }
+ }
+ }
+ break;
+ }
+}
diff --git a/Plugins/rene.dll b/Plugins/rene.dll
new file mode 100644
index 0000000..d5fb95b
--- /dev/null
+++ b/Plugins/rene.dll
Binary files differ
diff --git a/Plugins/rgbavg.c b/Plugins/rgbavg.c
new file mode 100644
index 0000000..c903ab1
--- /dev/null
+++ b/Plugins/rgbavg.c
@@ -0,0 +1,654 @@
+// 242.rgbavg -- does funky pixel averaging on an input image.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+// usage: rgbavg <red> <green> <blue> <mode>
+//
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "plugin.h"
+
+#pragma warning( disable : 4761 ) // that's why it's funky !!
+
+void perform_effect(struct frame f, struct args a)
+{
+ short x,y;
+ long red, green, blue;
+ short alpha, mode = 0;
+ byte bits = f.pixelformat/8;
+ long redpix, greenpix, bluepix;
+ pixel16 *c16;
+ pixel24 *c24;
+ pixel32 *c32;
+ char *t;
+
+ // get params
+ if(!a.s) return;
+ red = atoi(a.s);
+ if(!(t = strstr(a.s, " "))) return;
+ green = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ blue = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ mode = atoi(t+1); // mode=0 = bypass
+
+ printf("rgbavg: %d %d %d - %d\n", red, green, blue, mode);
+
+ // perform routines do different pixel averagings in the main loop
+ switch (mode)
+ {
+ case 1: // output: color / (sum of other two colors)
+ switch (f.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < f.height; y++)
+ {
+ c16 = scanline16(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r16(c16[x]) + red;
+ greenpix = g16(c16[x]) + green;
+ bluepix = b16(c16[x]) + blue;
+ c16[x] = rgbtocolor16(klamp255(redpix/(greenpix+bluepix)),
+ klamp255(greenpix/(redpix+bluepix)),
+ klamp255(bluepix/(redpix+greenpix)));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < f.height; y++)
+ {
+ c24 = scanline24(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r24(c24[x]) + red;
+ greenpix = g24(c24[x]) + green;
+ bluepix = b24(c24[x]) + blue;
+ c24[x] = rgbtocolor24(klamp255(redpix/(greenpix+bluepix)),
+ klamp255(greenpix/(redpix+bluepix)),
+ klamp255(bluepix/(redpix+greenpix)));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < f.height; y++)
+ {
+ c32 = scanline32(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r32(c32[x]) + red;
+ greenpix = g32(c32[x]) + green;
+ bluepix = b32(c32[x]) + blue;
+ c32[x] = rgbtocolor32(klamp255(redpix/(greenpix+bluepix)),
+ klamp255(greenpix/(redpix+bluepix)),
+ klamp255(bluepix/(redpix+greenpix)));
+ }
+ }
+ break;
+ }
+ break;
+ case 2: // output: (sum of two colors) / third color
+ switch (f.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < f.height; y++)
+ {
+ c16 = scanline16(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r16(c16[x]) + red;
+ greenpix = g16(c16[x]) + green;
+ bluepix = b16(c16[x]) + blue;
+ c16[x] = rgbtocolor16(klamp255((greenpix+bluepix)/redpix),
+ klamp255((redpix+bluepix)/greenpix),
+ klamp255((redpix+greenpix)/bluepix));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < f.height; y++)
+ {
+ c24 = scanline24(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r24(c24[x]) + red;
+ greenpix = g24(c24[x]) + green;
+ bluepix = b24(c24[x]) + blue;
+ c24[x] = rgbtocolor24(klamp255((greenpix+bluepix)/redpix),
+ klamp255((redpix+bluepix)/greenpix),
+ klamp255((redpix+greenpix)/bluepix));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < f.height; y++)
+ {
+ c32 = scanline32(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r32(c32[x]) + red;
+ greenpix = g32(c32[x]) + green;
+ bluepix = b32(c32[x]) + blue;
+ c32[x] = rgbtocolor32(klamp255((greenpix+bluepix)/redpix),
+ klamp255((redpix+bluepix)/greenpix),
+ klamp255((redpix+greenpix)/bluepix));
+ }
+ }
+ break;
+ }
+ break;
+ case 3: // output: color / (sum of other two colors) + color(input)
+ switch (f.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < f.height; y++)
+ {
+ c16 = scanline16(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r16(c16[x]) + 1;
+ greenpix = g16(c16[x]) + 1;
+ bluepix = b16(c16[x]) + 1;
+ c16[x] = rgbtocolor16(klamp255(redpix/(greenpix+bluepix) + red),
+ klamp255(greenpix/(redpix+bluepix) + green),
+ klamp255(bluepix/(redpix+greenpix) + blue));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < f.height; y++)
+ {
+ c24 = scanline24(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r24(c24[x]) + 1;
+ greenpix = g24(c24[x]) + 1;
+ bluepix = b24(c24[x]) + 1;
+ c24[x] = rgbtocolor24(klamp255(redpix/(greenpix+bluepix) + red),
+ klamp255(greenpix/(redpix+bluepix) + green),
+ klamp255(bluepix/(redpix+greenpix) + blue));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < f.height; y++)
+ {
+ c32 = scanline32(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r32(c32[x]) + 1;
+ greenpix = g32(c32[x]) + 1;
+ bluepix = b32(c32[x]) + 1;
+ c32[x] = rgbtocolor32(klamp255(redpix/(greenpix+bluepix) + red),
+ klamp255(greenpix/(redpix+bluepix) + green),
+ klamp255(bluepix/(redpix+greenpix) + blue));
+ }
+ }
+ break;
+ }
+ break;
+ case 4:
+ switch (f.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < f.height; y++)
+ {
+ c16 = scanline16(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r16(c16[x]) + 1;
+ greenpix = g16(c16[x]) + 1;
+ bluepix = b16(c16[x]) + 1;
+ c16[x] = rgbtocolor16(klamp255(((greenpix*green)+(bluepix*blue))/redpix),
+ klamp255(((redpix*red)+(bluepix*blue))/greenpix),
+ klamp255(((redpix*red)+(greenpix*green))/bluepix));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < f.height; y++)
+ {
+ c24 = scanline24(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r24(c24[x]) + 1;
+ greenpix = g24(c24[x]) + 1;
+ bluepix = b24(c24[x]) + 1;
+ c24[x] = rgbtocolor24(klamp255(((greenpix*green)+(bluepix*blue))/redpix),
+ klamp255(((redpix*red)+(bluepix*blue))/greenpix),
+ klamp255(((redpix*red)+(greenpix*green))/bluepix));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < f.height; y++)
+ {
+ c32 = scanline32(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r32(c32[x]) + 1;
+ greenpix = g32(c32[x]) + 1;
+ bluepix = b32(c32[x]) + 1;
+ c32[x] = rgbtocolor32(klamp255(((greenpix*green)+(bluepix*blue))/redpix),
+ klamp255(((redpix*red)+(bluepix*blue))/greenpix),
+ klamp255(((redpix*red)+(greenpix*green))/bluepix));
+ }
+ }
+ break;
+ }
+ break;
+ case 5:
+ switch (f.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < f.height; y++)
+ {
+ c16 = scanline16(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r16(c16[x]) + 1;
+ greenpix = g16(c16[x]) + 1;
+ bluepix = b16(c16[x]) + 1;
+ c16[x] = rgbtocolor16(klamp255(((greenpix*green)+(bluepix*blue))/(redpix*red)),
+ klamp255(((redpix*red)+(bluepix*blue))/(greenpix*green)),
+ klamp255(((redpix*red)+(greenpix*green))/(bluepix*blue)));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < f.height; y++)
+ {
+ c24 = scanline24(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r24(c24[x]) + 1;
+ greenpix = g24(c24[x]) + 1;
+ bluepix = b24(c24[x]) + 1;
+ c24[x] = rgbtocolor24(klamp255(((greenpix*green)+(bluepix*blue))/(redpix*red)),
+ klamp255(((redpix*red)+(bluepix*blue))/(greenpix*green)),
+ klamp255(((redpix*red)+(greenpix*green))/(bluepix*blue)));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < f.height; y++)
+ {
+ c32 = scanline32(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r32(c32[x]) + 1;
+ greenpix = g32(c32[x]) + 1;
+ bluepix = b32(c32[x]) + 1;
+ c32[x] = rgbtocolor32(klamp255(((greenpix*green)+(bluepix*blue))/(redpix*red)),
+ klamp255(((redpix*red)+(bluepix*blue))/(greenpix*green)),
+ klamp255(((redpix*red)+(greenpix*green))/(bluepix*blue)));
+ }
+ }
+ break;
+ }
+ break;
+ case 6:
+ switch (f.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < f.height; y++)
+ {
+ c16 = scanline16(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r16(c16[x]) + 1;
+ greenpix = g16(c16[x]) + 1;
+ bluepix = b16(c16[x]) + 1;
+ c16[x] = rgbtocolor16(klamp255((redpix*red)/(greenpix*green)+(bluepix*blue)),
+ klamp255((greenpix*green)/(redpix*red)+(bluepix*blue)),
+ klamp255((bluepix*blue)/(redpix*red)+(greenpix*green)));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < f.height; y++)
+ {
+ c24 = scanline24(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r24(c24[x]) + 1;
+ greenpix = g24(c24[x]) + 1;
+ bluepix = b24(c24[x]) + 1;
+ c24[x] = rgbtocolor24(klamp255((redpix*red)/(greenpix*green)+(bluepix*blue)),
+ klamp255((greenpix*green)/(redpix*red)+(bluepix*blue)),
+ klamp255((bluepix*blue)/(redpix*red)+(greenpix*green)));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < f.height; y++)
+ {
+ c32 = scanline32(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r32(c32[x]) + 1;
+ greenpix = g32(c32[x]) + 1;
+ bluepix = b32(c32[x]) + 1;
+ c32[x] = rgbtocolor32(klamp255((redpix*red)/(greenpix*green)+(bluepix*blue)),
+ klamp255((greenpix*green)/(redpix*red)+(bluepix*blue)),
+ klamp255((bluepix*blue)/(redpix*red)+(greenpix*green)));
+ }
+ }
+ break;
+ }
+ break;
+ case 7:
+ switch (f.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < f.height; y++)
+ {
+ c16 = scanline16(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r16(c16[x]) + red;
+ greenpix = g16(c16[x]) + green;
+ bluepix = b16(c16[x]) + blue;
+ c16[x] = rgbtocolor16(klamp255((redpix/(greenpix+bluepix))*red),
+ klamp255((greenpix/(redpix+bluepix))*green),
+ klamp255((bluepix/(redpix+greenpix))*blue));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < f.height; y++)
+ {
+ c24 = scanline24(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r24(c24[x]) + red;
+ greenpix = g24(c24[x]) + green;
+ bluepix = b24(c24[x]) + blue;
+ c24[x] = rgbtocolor24(klamp255((redpix/(greenpix+bluepix))*red),
+ klamp255((greenpix/(redpix+bluepix))*green),
+ klamp255((bluepix/(redpix+greenpix))*blue));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < f.height; y++)
+ {
+ c32 = scanline32(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r32(c32[x]) + red;
+ greenpix = g32(c32[x]) + green;
+ bluepix = b32(c32[x]) + blue;
+ c32[x] = rgbtocolor32(klamp255((redpix/(greenpix+bluepix))*red),
+ klamp255((greenpix/(redpix+bluepix))*green),
+ klamp255((bluepix/(redpix+greenpix))*blue));
+ }
+ }
+ break;
+ }
+ break;
+ case 8:
+ switch (f.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < f.height; y++)
+ {
+ c16 = scanline16(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r16(c16[x]) + red;
+ greenpix = g16(c16[x]) + green;
+ bluepix = b16(c16[x]) + blue;
+ c16[x] = rgbtocolor16(klamp255(((greenpix+bluepix)/redpix)*red),
+ klamp255(((redpix+bluepix)/greenpix)*green),
+ klamp255(((redpix+greenpix)/bluepix)*blue));
+
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < f.height; y++)
+ {
+ c24 = scanline24(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r24(c24[x]) + red;
+ greenpix = g24(c24[x]) + green;
+ bluepix = b24(c24[x]) + blue;
+ c24[x] = rgbtocolor24(klamp255(((greenpix+bluepix)/redpix)*red),
+ klamp255(((redpix+bluepix)/greenpix)*green),
+ klamp255(((redpix+greenpix)/bluepix)*blue));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < f.height; y++)
+ {
+ c32 = scanline32(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r32(c32[x]) + red;
+ greenpix = g32(c32[x]) + green;
+ bluepix = b32(c32[x]) + blue;
+ c32[x] = rgbtocolor32(klamp255(((greenpix+bluepix)/redpix)*red),
+ klamp255(((redpix+bluepix)/greenpix)*green),
+ klamp255(((redpix+greenpix)/bluepix)*blue));
+ }
+ }
+ break;
+ }
+ break;
+ case 9:
+ switch (f.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < f.height; y++)
+ {
+ c16 = scanline16(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r16(c16[x]) + 1;
+ greenpix = g16(c16[x]) + 1;
+ bluepix = b16(c16[x]) + 1;
+ c16[x] = rgbtocolor16(klamp255((red + ((greenpix+bluepix)/redpix))*red),
+ klamp255((green + ((redpix+bluepix)/greenpix))*green),
+ klamp255((blue + ((redpix+greenpix)/bluepix))*blue));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < f.height; y++)
+ {
+ c24 = scanline24(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r24(c24[x]) + 1;
+ greenpix = g24(c24[x]) + 1;
+ bluepix = b24(c24[x]) + 1;
+ c24[x] = rgbtocolor24(klamp255((red + ((greenpix+bluepix)/redpix))*red),
+ klamp255((green + ((redpix+bluepix)/greenpix))*green),
+ klamp255((blue + ((redpix+greenpix)/bluepix))*blue));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < f.height; y++)
+ {
+ c32 = scanline32(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r32(c32[x]) + 1;
+ greenpix = g32(c32[x]) + 1;
+ bluepix = b32(c32[x]) + 1;
+ c32[x] = rgbtocolor32(klamp255((red + ((greenpix+bluepix)/redpix))*red),
+ klamp255((green + ((redpix+bluepix)/greenpix))*green),
+ klamp255((blue + ((redpix+greenpix)/bluepix))*blue));
+ }
+ }
+ break;
+ }
+ break;
+ case 10:
+ switch (f.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < f.height; y++)
+ {
+ c16 = scanline16(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r16(c16[x]) + 1;
+ greenpix = g16(c16[x]) + 1;
+ bluepix = b16(c16[x]) + 1;
+ c16[x] = rgbtocolor16(klamp255((((greenpix*green)+(bluepix*blue))/redpix)*red),
+ klamp255((((redpix*red)+(bluepix*blue))/greenpix)*green),
+ klamp255((((redpix*red)+(greenpix*green))/bluepix)*blue));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < f.height; y++)
+ {
+ c24 = scanline24(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r24(c24[x]) + 1;
+ greenpix = g24(c24[x]) + 1;
+ bluepix = b24(c24[x]) + 1;
+ c24[x] = rgbtocolor24(klamp255((((greenpix*green)+(bluepix*blue))/redpix)*red),
+ klamp255((((redpix*red)+(bluepix*blue))/greenpix)*green),
+ klamp255((((redpix*red)+(greenpix*green))/bluepix)*blue));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < f.height; y++)
+ {
+ c32 = scanline32(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r32(c32[x]) + 1;
+ greenpix = g32(c32[x]) + 1;
+ bluepix = b32(c32[x]) + 1;
+ c32[x] = rgbtocolor32(klamp255((((greenpix*green)+(bluepix*blue))/redpix)*red),
+ klamp255((((redpix*red)+(bluepix*blue))/greenpix)*green),
+ klamp255((((redpix*red)+(greenpix*green))/bluepix)*blue));
+ }
+ }
+ break;
+ }
+ break;
+ case 11:
+ switch (f.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < f.height; y++)
+ {
+ c16 = scanline16(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r16(c16[x]) + 1;
+ greenpix = g16(c16[x]) + 1;
+ bluepix = b16(c16[x]) + 1;
+ c16[x] = rgbtocolor16(klamp255((((greenpix*green)+(bluepix*blue))/(redpix*red))*red),
+ klamp255((((redpix*red)+(bluepix*blue))/(greenpix*green))*green),
+ klamp255((((redpix*red)+(greenpix*green))/(bluepix*blue))*blue));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < f.height; y++)
+ {
+ c24 = scanline24(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r24(c24[x]) + 1;
+ greenpix = g24(c24[x]) + 1;
+ bluepix = b24(c24[x]) + 1;
+ c24[x] = rgbtocolor24(klamp255((((greenpix*green)+(bluepix*blue))/(redpix*red))*red),
+ klamp255((((redpix*red)+(bluepix*blue))/(greenpix*green))*green),
+ klamp255((((redpix*red)+(greenpix*green))/(bluepix*blue))*blue));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < f.height; y++)
+ {
+ c32 = scanline32(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r32(c32[x]) + 1;
+ greenpix = g32(c32[x]) + 1;
+ bluepix = b32(c32[x]) + 1;
+ c32[x] = rgbtocolor32(klamp255((((greenpix*green)+(bluepix*blue))/(redpix*red))*red),
+ klamp255((((redpix*red)+(bluepix*blue))/(greenpix*green))*green),
+ klamp255((((redpix*red)+(greenpix*green))/(bluepix*blue))*blue));
+ }
+ }
+ break;
+ }
+ break;
+ case 12:
+ switch (f.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < f.height; y++)
+ {
+ c16 = scanline16(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r16(c16[x]) + 1;
+ greenpix = g16(c16[x]) + 1;
+ bluepix = b16(c16[x]) + 1;
+ c16[x] = rgbtocolor16(klamp255(((redpix*red)/(greenpix*green)+(bluepix*blue))*red),
+ klamp255(((greenpix*green)/(redpix*red)+(bluepix*blue))*green),
+ klamp255(((bluepix*blue)/(redpix*red)+(greenpix*green))*blue));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < f.height; y++)
+ {
+ c24 = scanline24(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r24(c24[x]) + 1;
+ greenpix = g24(c24[x]) + 1;
+ bluepix = b24(c24[x]) + 1;
+ c24[x] = rgbtocolor24(klamp255(((redpix*red)/(greenpix*green)+(bluepix*blue))*red),
+ klamp255(((greenpix*green)/(redpix*red)+(bluepix*blue))*green),
+ klamp255(((bluepix*blue)/(redpix*red)+(greenpix*green))*blue));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < f.height; y++)
+ {
+ c32 = scanline32(f, y);
+ for(x = 0; x < f.width; x++)
+ {
+ redpix = r32(c32[x]) + 1;
+ greenpix = g32(c32[x]) + 1;
+ bluepix = b32(c32[x]) + 1;
+ c32[x] = rgbtocolor32(klamp255(((redpix*red)/(greenpix*green)+(bluepix*blue))*red),
+ klamp255(((greenpix*green)/(redpix*red)+(bluepix*blue))*green),
+ klamp255(((bluepix*blue)/(redpix*red)+(greenpix*green))*blue));
+ }
+ }
+ break;
+ }
+ break;
+ }
+
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ printf("Using rgbavg as copy operation does nothing!\n");
+}
diff --git a/Plugins/rgbavg.dll b/Plugins/rgbavg.dll
new file mode 100644
index 0000000..8b5fe70
--- /dev/null
+++ b/Plugins/rgbavg.dll
Binary files differ
diff --git a/Plugins/rgbavg02.c b/Plugins/rgbavg02.c
new file mode 100644
index 0000000..5fc773e
--- /dev/null
+++ b/Plugins/rgbavg02.c
@@ -0,0 +1,799 @@
+// 242.rgbavg02 -- does 2-source funky pixel averaging.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+// usage: rgbavg <red> <green> <blue> <mode>
+//
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "plugin.h"
+
+#pragma warning( disable : 4761 ) // that's why it's funky !!
+
+void perform_effect(struct frame f1, struct frame f2, struct args a)
+{
+ printf("Using rgbavg as effect does nothing!\n");
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ short x,y, h, w;
+ long red, green, blue;
+ short alpha, mode;
+ long redpix, greenpix, bluepix, rp, gp, bp;
+ pixel16 *c1_16, *c2_16;
+ pixel24 *c1_24, *c2_24;
+ pixel32 *c1_32, *c2_32;
+ char *t;
+
+ // get params
+ if(!a.s) return;
+ red = atoi(a.s);
+ if(!(t = strstr(a.s, " "))) return;
+ green = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ blue = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ mode = atoi(t+1); // mode=0 = bypass
+
+ printf("rgbavg: %d %d %d - %d\n", red, green, blue, mode);
+
+ w = f1.width<f2.width ? f1.width : f2.width;
+ h = f1.height<f2.height ? f1.height : f2.height;
+
+ // perform routines do different pixel averagings in the main loop
+ switch (mode)
+ {
+ case 1: // output: color / (sum of other two colors)
+ switch (f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ c1_16 = scanline16(f1, y);
+ c2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r16(c1_16[x]) + red;
+ gp = g16(c1_16[x]) + green;
+ bp = b16(c1_16[x]) + blue;
+ redpix = r16(c2_16[x]) + red;
+ greenpix = g16(c2_16[x]) + green;
+ bluepix = b16(c2_16[x]) + blue;
+ c2_16[x] = rgbtocolor16(klamp255(redpix/(gp+bp)),
+ klamp255(greenpix/(rp+bp)),
+ klamp255(bluepix/(rp+gp)));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ c1_24 = scanline24(f1, y);
+ c2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r24(c1_24[x]) + red;
+ gp = g24(c1_24[x]) + green;
+ bp = b24(c1_24[x]) + blue;
+ redpix = r24(c2_24[x]) + red;
+ greenpix = g24(c2_24[x]) + green;
+ bluepix = b24(c2_24[x]) + blue;
+ c2_24[x] = rgbtocolor24(klamp255(redpix/(gp+bp)),
+ klamp255(greenpix/(rp+bp)),
+ klamp255(bluepix/(rp+gp)));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ c1_32 = scanline32(f1, y);
+ c2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r32(c1_32[x]) + red;
+ gp = g32(c1_32[x]) + green;
+ bp = b32(c1_32[x]) + blue;
+ redpix = r32(c2_32[x]) + red;
+ greenpix = g32(c2_32[x]) + green;
+ bluepix = b32(c2_32[x]) + blue;
+ c2_32[x] = rgbtocolor32(klamp255(redpix/(gp+bp)),
+ klamp255(greenpix/(rp+bp)),
+ klamp255(bluepix/(rp+gp)));
+ }
+ }
+ break;
+ }
+ break;
+ case 2: // output: (sum of two colors) / third color
+ switch (f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ c1_16 = scanline16(f1, y);
+ c2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r16(c1_16[x]) + red;
+ gp = g16(c1_16[x]) + green;
+ bp = b16(c1_16[x]) + blue;
+ redpix = r16(c2_16[x]) + red;
+ greenpix = g16(c2_16[x]) + green;
+ bluepix = b16(c2_16[x]) + blue;
+ c2_16[x] = rgbtocolor16(klamp255((gp+bp)/redpix),
+ klamp255((rp+bp)/greenpix),
+ klamp255((rp+gp)/bluepix));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ c1_24 = scanline24(f1, y);
+ c2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r24(c1_24[x]) + red;
+ gp = g24(c1_24[x]) + green;
+ bp = b24(c1_24[x]) + blue;
+ redpix = r24(c2_24[x]) + red;
+ greenpix = g24(c2_24[x]) + green;
+ bluepix = b24(c2_24[x]) + blue;
+ c2_24[x] = rgbtocolor24(klamp255((gp+bp)/redpix),
+ klamp255((rp+bp)/greenpix),
+ klamp255((rp+gp)/bluepix));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ c1_32 = scanline32(f1, y);
+ c2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r32(c1_32[x]) + red;
+ gp = g32(c1_32[x]) + green;
+ bp = b32(c1_32[x]) + blue;
+ redpix = r32(c2_32[x]) + red;
+ greenpix = g32(c2_32[x]) + green;
+ bluepix = b32(c2_32[x]) + blue;
+ c2_32[x] = rgbtocolor32(klamp255((gp+bp)/redpix),
+ klamp255((rp+bp)/greenpix),
+ klamp255((rp+gp)/bluepix));
+ }
+ }
+ break;
+ }
+ break;
+ case 3: // output: color / (sum of other two colors) + color(input)
+ switch (f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ c1_16 = scanline16(f1, y);
+ c2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r16(c1_16[x]) + 1;
+ gp = g16(c1_16[x]) + 1;
+ bp = b16(c1_16[x]) + 1;
+ redpix = r16(c2_16[x]) + 1;
+ greenpix = g16(c2_16[x]) + 1;
+ bluepix = b16(c2_16[x]) + 1;
+ c2_16[x] = rgbtocolor16(klamp255(red + ((gp+bp)/redpix)),
+ klamp255(green + ((rp+bp)/greenpix)),
+ klamp255(blue + ((rp+gp)/bluepix)));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ c1_24 = scanline24(f1, y);
+ c2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r24(c1_24[x]) + 1;
+ gp = g24(c1_24[x]) + 1;
+ bp = b24(c1_24[x]) + 1;
+ redpix = r24(c2_24[x]) + 1;
+ greenpix = g24(c2_24[x]) + 1;
+ bluepix = b24(c2_24[x]) + 1;
+ c2_24[x] = rgbtocolor24(klamp255(red + ((gp+bp)/redpix)),
+ klamp255(green + ((rp+bp)/greenpix)),
+ klamp255(blue + ((rp+gp)/bluepix)));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ c1_32 = scanline32(f1, y);
+ c2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r32(c1_32[x]) + 1;
+ gp = g32(c1_32[x]) + 1;
+ bp = b32(c1_32[x]) + 1;
+ redpix = r32(c2_32[x]) + 1;
+ greenpix = g32(c2_32[x]) + 1;
+ bluepix = b32(c2_32[x]) + 1;
+ c2_32[x] = rgbtocolor32(klamp255(red + ((gp+bp)/redpix)),
+ klamp255(green + ((rp+bp)/greenpix)),
+ klamp255(blue + ((rp+gp)/bluepix)));
+ }
+ }
+ break;
+ }
+ break;
+ case 4:
+ switch (f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ c1_16 = scanline16(f1, y);
+ c2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r16(c1_16[x]) + 1;
+ gp = g16(c1_16[x]) + 1;
+ bp = b16(c1_16[x]) + 1;
+ redpix = r16(c2_16[x]) + 1;
+ greenpix = g16(c2_16[x]) + 1;
+ bluepix = b16(c2_16[x]) + 1;
+ c2_16[x] = rgbtocolor16(klamp255(((gp*green)+(bp*blue))/redpix),
+ klamp255(((rp*red)+(bp*blue))/greenpix),
+ klamp255(((rp*red)+(gp*green))/bluepix));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ c1_24 = scanline24(f1, y);
+ c2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r24(c1_24[x]) + 1;
+ gp = g24(c1_24[x]) + 1;
+ bp = b24(c1_24[x]) + 1;
+ redpix = r24(c2_24[x]) + 1;
+ greenpix = g24(c2_24[x]) + 1;
+ bluepix = b24(c2_24[x]) + 1;
+ c2_24[x] = rgbtocolor24(klamp255(((gp*green)+(bp*blue))/redpix),
+ klamp255(((rp*red)+(bp*blue))/greenpix),
+ klamp255(((rp*red)+(gp*green))/bluepix));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ c1_32 = scanline32(f1, y);
+ c2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r32(c1_32[x]) + 1;
+ gp = g32(c1_32[x]) + 1;
+ bp = b32(c1_32[x]) + 1;
+ redpix = r32(c2_32[x]) + 1;
+ greenpix = g32(c2_32[x]) + 1;
+ bluepix = b32(c2_32[x]) + 1;
+ c2_32[x] = rgbtocolor32(klamp255(((gp*green)+(bp*blue))/redpix),
+ klamp255(((rp*red)+(bp*blue))/greenpix),
+ klamp255(((rp*red)+(gp*green))/bluepix));
+ }
+ }
+ break;
+ }
+ break;
+ case 5:
+ switch (f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ c1_16 = scanline16(f1, y);
+ c2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r16(c1_16[x]) + 1;
+ gp = g16(c1_16[x]) + 1;
+ bp = b16(c1_16[x]) + 1;
+ redpix = r16(c2_16[x]) + 1;
+ greenpix = g16(c2_16[x]) + 1;
+ bluepix = b16(c2_16[x]) + 1;
+ c2_16[x] = rgbtocolor16(klamp255(((gp*green)+(bp*blue))/(redpix*red)),
+ klamp255(((rp*red)+(bp*blue))/(greenpix*green)),
+ klamp255(((rp*red)+(gp*green))/(bluepix*blue)));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ c1_24 = scanline24(f1, y);
+ c2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r24(c1_24[x]) + 1;
+ gp = g24(c1_24[x]) + 1;
+ bp = b24(c1_24[x]) + 1;
+ redpix = r24(c2_24[x]) + 1;
+ greenpix = g24(c2_24[x]) + 1;
+ bluepix = b24(c2_24[x]) + 1;
+ c2_24[x] = rgbtocolor24(klamp255(((gp*green)+(bp*blue))/(redpix*red)),
+ klamp255(((rp*red)+(bp*blue))/(greenpix*green)),
+ klamp255(((rp*red)+(gp*green))/(bluepix*blue)));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ c1_32 = scanline32(f1, y);
+ c2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r32(c1_32[x]) + 1;
+ gp = g32(c1_32[x]) + 1;
+ bp = b32(c1_32[x]) + 1;
+ redpix = r32(c2_32[x]) + 1;
+ greenpix = g32(c2_32[x]) + 1;
+ bluepix = b32(c2_32[x]) + 1;
+ c2_32[x] = rgbtocolor32(klamp255(((gp*green)+(bp*blue))/(redpix*red)),
+ klamp255(((rp*red)+(bp*blue))/(greenpix*green)),
+ klamp255(((rp*red)+(gp*green))/(bluepix*blue)));
+ }
+ }
+ break;
+ }
+ break;
+ case 6:
+ switch (f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ c1_16 = scanline16(f1, y);
+ c2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r16(c1_16[x]) + 1;
+ gp = g16(c1_16[x]) + 1;
+ bp = b16(c1_16[x]) + 1;
+ redpix = r16(c2_16[x]) + 1;
+ greenpix = g16(c2_16[x]) + 1;
+ bluepix = b16(c2_16[x]) + 1;
+ c2_16[x] = rgbtocolor16(klamp255((redpix*red)/(gp*green)+(bp*blue)),
+ klamp255((greenpix*green)/(rp*red)+(bp*blue)),
+ klamp255((bluepix*blue)/(rp*red)+(gp*green)));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ c1_24 = scanline24(f1, y);
+ c2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r24(c1_24[x]) + 1;
+ gp = g24(c1_24[x]) + 1;
+ bp = b24(c1_24[x]) + 1;
+ redpix = r24(c2_24[x]) + 1;
+ greenpix = g24(c2_24[x]) + 1;
+ bluepix = b24(c2_24[x]) + 1;
+ c2_24[x] = rgbtocolor24(klamp255((redpix*red)/(gp*green)+(bp*blue)),
+ klamp255((greenpix*green)/(rp*red)+(bp*blue)),
+ klamp255((bluepix*blue)/(rp*red)+(gp*green)));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ c1_32 = scanline32(f1, y);
+ c2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r32(c1_32[x]) + 1;
+ gp = g32(c1_32[x]) + 1;
+ bp = b32(c1_32[x]) + 1;
+ redpix = r32(c2_32[x]) + 1;
+ greenpix = g32(c2_32[x]) + 1;
+ bluepix = b32(c2_32[x]) + 1;
+ c2_32[x] = rgbtocolor32(klamp255((redpix*red)/(gp*green)+(bp*blue)),
+ klamp255((greenpix*green)/(rp*red)+(bp*blue)),
+ klamp255((bluepix*blue)/(rp*red)+(gp*green)));
+ }
+ }
+ break;
+ }
+ break;
+ case 7:
+ switch (f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ c1_16 = scanline16(f1, y);
+ c2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r16(c1_16[x]) + red;
+ gp = g16(c1_16[x]) + green;
+ bp = b16(c1_16[x]) + blue;
+ redpix = r16(c2_16[x]) + red;
+ greenpix = g16(c2_16[x]) + green;
+ bluepix = b16(c2_16[x]) + blue;
+ c2_16[x] = rgbtocolor16(klamp255((redpix/(gp+bp))*red),
+ klamp255((greenpix/(rp+bp))*green),
+ klamp255((bluepix/(rp+gp))*blue));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ c1_24 = scanline24(f1, y);
+ c2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r24(c1_24[x]) + red;
+ gp = g24(c1_24[x]) + green;
+ bp = b24(c1_24[x]) + blue;
+ redpix = r24(c2_24[x]) + red;
+ greenpix = g24(c2_24[x]) + green;
+ bluepix = b24(c2_24[x]) + blue;
+ c2_24[x] = rgbtocolor24(klamp255((redpix/(gp+bp))*red),
+ klamp255((greenpix/(rp+bp))*green),
+ klamp255((bluepix/(rp+gp))*blue));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ c1_32 = scanline32(f1, y);
+ c2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r32(c1_32[x]) + red;
+ gp = g32(c1_32[x]) + green;
+ bp = b32(c1_32[x]) + blue;
+ redpix = r32(c2_32[x]) + red;
+ greenpix = g32(c2_32[x]) + green;
+ bluepix = b32(c2_32[x]) + blue;
+ c2_32[x] = rgbtocolor32(klamp255((redpix/(gp+bp))*red),
+ klamp255((greenpix/(rp+bp))*green),
+ klamp255((bluepix/(rp+gp))*blue));
+ }
+ }
+ break;
+ }
+ break;
+ case 8:
+ switch (f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ c1_16 = scanline16(f1, y);
+ c2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r16(c1_16[x]) + red;
+ gp = g16(c1_16[x]) + green;
+ bp = b16(c1_16[x]) + blue;
+ redpix = r16(c2_16[x]) + red;
+ greenpix = g16(c2_16[x]) + green;
+ bluepix = b16(c2_16[x]) + blue;
+ c2_16[x] = rgbtocolor16(klamp255(((gp+bp)/redpix)*red),
+ klamp255(((rp+bp)/greenpix)*green),
+ klamp255(((rp+gp)/bluepix)*blue));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ c1_24 = scanline24(f1, y);
+ c2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r24(c1_24[x]) + red;
+ gp = g24(c1_24[x]) + green;
+ bp = b24(c1_24[x]) + blue;
+ redpix = r24(c2_24[x]) + red;
+ greenpix = g24(c2_24[x]) + green;
+ bluepix = b24(c2_24[x]) + blue;
+ c2_24[x] = rgbtocolor24(klamp255(((gp+bp)/redpix)*red),
+ klamp255(((rp+bp)/greenpix)*green),
+ klamp255(((rp+gp)/bluepix)*blue));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ c1_32 = scanline32(f1, y);
+ c2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r32(c1_32[x]) + red;
+ gp = g32(c1_32[x]) + green;
+ bp = b32(c1_32[x]) + blue;
+ redpix = r32(c2_32[x]) + red;
+ greenpix = g32(c2_32[x]) + green;
+ bluepix = b32(c2_32[x]) + blue;
+ c2_32[x] = rgbtocolor32(klamp255(((gp+bp)/redpix)*red),
+ klamp255(((rp+bp)/greenpix)*green),
+ klamp255(((rp+gp)/bluepix)*blue));
+ }
+ }
+ break;
+ }
+ break;
+ case 9:
+ switch (f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ c1_16 = scanline16(f1, y);
+ c2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r16(c1_16[x]) + 1;
+ gp = g16(c1_16[x]) + 1;
+ bp = b16(c1_16[x]) + 1;
+ redpix = r16(c2_16[x]) + 1;
+ greenpix = g16(c2_16[x]) + 1;
+ bluepix = b16(c2_16[x]) + 1;
+ c2_16[x] = rgbtocolor16(klamp255((red + ((gp+bp)/redpix))*red),
+ klamp255((green + ((rp+bp)/greenpix))*green),
+ klamp255((blue + ((rp+gp)/bluepix))*blue));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ c1_24 = scanline24(f1, y);
+ c2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r24(c1_24[x]) + 1;
+ gp = g24(c1_24[x]) + 1;
+ bp = b24(c1_24[x]) + 1;
+ redpix = r24(c2_24[x]) + 1;
+ greenpix = g24(c2_24[x]) + 1;
+ bluepix = b24(c2_24[x]) + 1;
+ c2_24[x] = rgbtocolor24(klamp255((red + ((gp+bp)/redpix))*red),
+ klamp255((green + ((rp+bp)/greenpix))*green),
+ klamp255((blue + ((rp+gp)/bluepix))*blue));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ c1_32 = scanline32(f1, y);
+ c2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r32(c1_32[x]) + 1;
+ gp = g32(c1_32[x]) + 1;
+ bp = b32(c1_32[x]) + 1;
+ redpix = r32(c2_32[x]) + 1;
+ greenpix = g32(c2_32[x]) + 1;
+ bluepix = b32(c2_32[x]) + 1;
+ c2_32[x] = rgbtocolor32(klamp255((red + ((gp+bp)/redpix))*red),
+ klamp255((green + ((rp+bp)/greenpix))*green),
+ klamp255((blue + ((rp+gp)/bluepix))*blue));
+ }
+ }
+ break;
+ }
+ break;
+ case 10:
+ switch (f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ c1_16 = scanline16(f1, y);
+ c2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r16(c1_16[x]) + 1;
+ gp = g16(c1_16[x]) + 1;
+ bp = b16(c1_16[x]) + 1;
+ redpix = r16(c2_16[x]) + 1;
+ greenpix = g16(c2_16[x]) + 1;
+ bluepix = b16(c2_16[x]) + 1;
+ c2_16[x] = rgbtocolor16(klamp255((((gp*green)+(bp*blue))/redpix)*red),
+ klamp255((((rp*red)+(bp*blue))/greenpix)*green),
+ klamp255((((rp*red)+(gp*green))/bluepix)*blue));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ c1_24 = scanline24(f1, y);
+ c2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r24(c1_24[x]) + 1;
+ gp = g24(c1_24[x]) + 1;
+ bp = b24(c1_24[x]) + 1;
+ redpix = r24(c2_24[x]) + 1;
+ greenpix = g24(c2_24[x]) + 1;
+ bluepix = b24(c2_24[x]) + 1;
+ c2_24[x] = rgbtocolor24(klamp255((((gp*green)+(bp*blue))/redpix)*red),
+ klamp255((((rp*red)+(bp*blue))/greenpix)*green),
+ klamp255((((rp*red)+(gp*green))/bluepix)*blue));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ c1_32 = scanline32(f1, y);
+ c2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r32(c1_32[x]) + 1;
+ gp = g32(c1_32[x]) + 1;
+ bp = b32(c1_32[x]) + 1;
+ redpix = r32(c2_32[x]) + 1;
+ greenpix = g32(c2_32[x]) + 1;
+ bluepix = b32(c2_32[x]) + 1;
+ c2_32[x] = rgbtocolor32(klamp255((((gp*green)+(bp*blue))/redpix)*red),
+ klamp255((((rp*red)+(bp*blue))/greenpix)*green),
+ klamp255((((rp*red)+(gp*green))/bluepix)*blue));
+ }
+ }
+ break;
+ }
+ break;
+ case 11:
+ switch (f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ c1_16 = scanline16(f1, y);
+ c2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r16(c1_16[x]) + 1;
+ gp = g16(c1_16[x]) + 1;
+ bp = b16(c1_16[x]) + 1;
+ redpix = r16(c2_16[x]) + 1;
+ greenpix = g16(c2_16[x]) + 1;
+ bluepix = b16(c2_16[x]) + 1;
+ c2_16[x] = rgbtocolor16(klamp255((((gp*green)+(bp*blue))/(redpix*red))*red),
+ klamp255((((rp*red)+(bp*blue))/(greenpix*green))*green),
+ klamp255((((rp*red)+(gp*green))/(bluepix*blue))*blue));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ c1_24 = scanline24(f1, y);
+ c2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r24(c1_24[x]) + 1;
+ gp = g24(c1_24[x]) + 1;
+ bp = b24(c1_24[x]) + 1;
+ redpix = r24(c2_24[x]) + 1;
+ greenpix = g24(c2_24[x]) + 1;
+ bluepix = b24(c2_24[x]) + 1;
+ c2_24[x] = rgbtocolor24(klamp255((((gp*green)+(bp*blue))/(redpix*red))*red),
+ klamp255((((rp*red)+(bp*blue))/(greenpix*green))*green),
+ klamp255((((rp*red)+(gp*green))/(bluepix*blue))*blue));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ c1_32 = scanline32(f1, y);
+ c2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r32(c1_32[x]) + 1;
+ gp = g32(c1_32[x]) + 1;
+ bp = b32(c1_32[x]) + 1;
+ redpix = r32(c2_32[x]) + 1;
+ greenpix = g32(c2_32[x]) + 1;
+ bluepix = b32(c2_32[x]) + 1;
+ c2_32[x] = rgbtocolor32(klamp255((((gp*green)+(bp*blue))/(redpix*red))*red),
+ klamp255((((rp*red)+(bp*blue))/(greenpix*green))*green),
+ klamp255((((rp*red)+(gp*green))/(bluepix*blue))*blue));
+ }
+ }
+ break;
+ }
+ break;
+ case 12:
+ switch (f1.pixelformat)
+ {
+ case 16:
+ for(y = 0; y < h; y++)
+ {
+ c1_16 = scanline16(f1, y);
+ c2_16 = scanline16(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r16(c1_16[x]) + 1;
+ gp = g16(c1_16[x]) + 1;
+ bp = b16(c1_16[x]) + 1;
+ redpix = r16(c2_16[x]) + 1;
+ greenpix = g16(c2_16[x]) + 1;
+ bluepix = b16(c2_16[x]) + 1;
+ c2_16[x] = rgbtocolor16(klamp255(((redpix*red)/(gp*green)+(bp*blue))*red),
+ klamp255(((greenpix*green)/(rp*red)+(bp*blue))*green),
+ klamp255(((bluepix*blue)/(rp*red)+(gp*green))*blue));
+ }
+ }
+ break;
+ case 24:
+ for(y = 0; y < h; y++)
+ {
+ c1_24 = scanline24(f1, y);
+ c2_24 = scanline24(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r24(c1_24[x]) + 1;
+ gp = g24(c1_24[x]) + 1;
+ bp = b24(c1_24[x]) + 1;
+ redpix = r24(c2_24[x]) + 1;
+ greenpix = g24(c2_24[x]) + 1;
+ bluepix = b24(c2_24[x]) + 1;
+ c2_24[x] = rgbtocolor24(klamp255(((redpix*red)/(gp*green)+(bp*blue))*red),
+ klamp255(((greenpix*green)/(rp*red)+(bp*blue))*green),
+ klamp255(((bluepix*blue)/(rp*red)+(gp*green))*blue));
+ }
+ }
+ break;
+ case 32:
+ for(y = 0; y < h; y++)
+ {
+ c1_32 = scanline32(f1, y);
+ c2_32 = scanline32(f2, y);
+ for(x = 0; x < w; x++)
+ {
+ rp = r32(c1_32[x]) + 1;
+ gp = g32(c1_32[x]) + 1;
+ bp = b32(c1_32[x]) + 1;
+ redpix = r32(c2_32[x]) + 1;
+ greenpix = g32(c2_32[x]) + 1;
+ bluepix = b32(c2_32[x]) + 1;
+ c2_32[x] = rgbtocolor32(klamp255(((redpix*red)/(gp*green)+(bp*blue))*red),
+ klamp255(((greenpix*green)/(rp*red)+(bp*blue))*green),
+ klamp255(((bluepix*blue)/(rp*red)+(gp*green))*blue));
+ }
+ }
+ break;
+ }
+ break;
+ }
+
+} \ No newline at end of file
diff --git a/Plugins/rgbavg02.dll b/Plugins/rgbavg02.dll
new file mode 100644
index 0000000..274d69f
--- /dev/null
+++ b/Plugins/rgbavg02.dll
Binary files differ
diff --git a/Plugins/rgbseek.c b/Plugins/rgbseek.c
new file mode 100644
index 0000000..cf53aa5
--- /dev/null
+++ b/Plugins/rgbseek.c
@@ -0,0 +1,97 @@
+// 242.rgbseek -- does binary color recognition on an input image.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+// usage: rgbseek <red> <green> <blue> <fuzzi red> <fuzzi green> <fuzzi blue>
+//
+// return: 1 if color exists in frame, 0 if not
+//
+
+#include <stdio.h>
+#include <string.h>
+#include "plugin.h"
+
+void perform_effect(struct frame f, struct args a)
+{
+ int x,y;
+ byte red = 0, green = 0, blue = 0, check = 0, rf = 0, gf = 0, bf = 0;
+ byte bits = f.pixelformat/8;
+ byte redpix, greenpix, bluepix; // the color values
+ pixel16 c16;
+ pixel24 c24;
+ pixel32 c32;
+ char *ret_check; // returns the result
+ char *t;
+
+ // get r g b and fuzzi params
+ if(!a.s) return;
+ red = atoi(a.s);
+ if(!(t = strstr(a.s, " "))) return;
+ green = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ blue = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ rf = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ gf = atoi(t+1);
+ if(!(t = strstr(t+1, " "))) return;
+ bf = atoi(t+1);
+
+ printf("rgbseek: %d %d %d\n", red, green, blue);
+
+ // get returnvaluereceivenames
+ if(!(t = strstr(t+1, " "))) return;
+ ret_check = t+1;
+ t[0]=0;
+
+ for(y = 0; y < f.height; y++)
+ {
+ for(x = 0; x < f.width; x++)
+ {
+ switch (f.pixelformat)
+ {
+ case 16:
+ c16 = scanline16(f, y)[x];
+ redpix = r16(c16);
+ greenpix = g16(c16);
+ bluepix = b16(c16);
+ break;
+ case 24:
+ c24 = scanline24(f, y)[x];
+ redpix = r24(c24);
+ greenpix = g24(c24);
+ bluepix = b24(c24);
+ break;
+ case 32:
+ c32 = scanline32(f, y)[x];
+ redpix = r32(c32);
+ greenpix = g32(c32);
+ bluepix = b32(c32);
+ break;
+ }
+ if ((redpix>=(red-rf))&&(redpix<=(red+rf))&&(greenpix>=(green-gf))&&(greenpix<=(green+gf))&&(bluepix>=(blue-bf))&&(bluepix<=(blue+bf)))
+ {
+ check = 1; // found the color, let's get outta here
+ goto done;
+ }
+ }
+ }
+ check = 0; // didn't find the color
+
+done:
+ // return-values:
+ //
+ // framestein will send data given in the form "pd_receiver_name=value"
+ // back to pd.
+
+ sprintf(a.ret, "%s=%d", ret_check, check);
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ printf("Using rgbseek as copy operation does nothing!\n");
+}
diff --git a/Plugins/rgbseek.dll b/Plugins/rgbseek.dll
new file mode 100644
index 0000000..151b10c
--- /dev/null
+++ b/Plugins/rgbseek.dll
Binary files differ
diff --git a/Plugins/traffic.c b/Plugins/traffic.c
new file mode 100644
index 0000000..be2dbba
--- /dev/null
+++ b/Plugins/traffic.c
@@ -0,0 +1,106 @@
+// 242.traffic -- does tristimulus matrix operations on an input image.
+// by r. luke dubois (luke@music.columbia.edu),
+// computer music center, columbia university, 2001.
+//
+// Pd / Framestein port by Olaf Matthes <olaf.matthes@gmx.de>, June 2002
+//
+// objects and source are provided without warranty of any kind, express or implied.
+//
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <stdlib.h>
+#include "plugin.h"
+
+// tristimulus product used for matrix conversions
+
+static void tristimulus_product(float *matrix, byte *input, byte *output)
+{
+ int f, g;
+ for(f = 0; f < 3; f++)
+ {
+ output[f] = (byte)input[0]*matrix[f*3+0]+
+ input[1]*matrix[f*3+1]+
+ input[2]*matrix[f*3+2];
+ }
+}
+
+
+void perform_effect(struct frame f, struct args a)
+{
+ int i, x, y;
+ float matrix[9];
+ byte bits = f.pixelformat/8;
+ byte input[3], output[3]; // the color values
+ byte r, g, b;
+ pixel16 *c16;
+ pixel24 *c24;
+ pixel32 *c32;
+ char *t;
+
+ // get matrix params
+ if(!a.s) return;
+ matrix[0] = atof(a.s);
+ for(i = 1; i < 9; i++)
+ {
+ if(!(t = strstr(t+1, " "))) return;
+ matrix[i] = atof(t+1);
+ }
+
+ printf("traffic: matrix: %d %d %d\n"
+ " %d %d %d\n"
+ " %d %d %d\n", matrix[0], matrix[1], matrix[2],
+ matrix[3], matrix[4], matrix[5], matrix[6], matrix[7], matrix[8]);
+
+ for(y = 0; y < f.height; y++)
+ {
+ for(x = 0; x < f.width; x++)
+ {
+ switch (f.pixelformat)
+ {
+ case 16:
+ c16 = scanline16(f, y);
+ input[0] = r16(c16[x]);
+ input[1] = g16(c16[x]);
+ input[2] = b16(c16[x]);
+ tristimulus_product(matrix,input,output);
+ r = output[0];
+ g = output[1];
+ b = output[2];
+
+ c16[x] = rgbtocolor16(r, g, b);
+ break;
+ case 24:
+ c24 = scanline24(f, y);
+ input[0] = r24(c24[x]);
+ input[1] = g24(c24[x]);
+ input[2] = b24(c24[x]);
+ tristimulus_product(matrix,input,output);
+ r = output[0];
+ g = output[1];
+ b = output[2];
+
+ c24[x] = rgbtocolor24(r, g, b);
+ break;
+ case 32:
+ c32 = scanline32(f, y);
+ input[0] = r32(c32[x]);
+ input[1] = g32(c32[x]);
+ input[2] = b32(c32[x]);
+ tristimulus_product(matrix,input,output);
+ r = output[0];
+ g = output[1];
+ b = output[2];
+
+ c32[x] = rgbtocolor32(r, g, b);
+ break;
+ }
+ }
+ }
+}
+
+void perform_copy(struct frame f1, struct frame f2, struct args a)
+{
+ printf("Using traffic as copy operation does nothing!\n");
+}
diff --git a/Plugins/traffic.dll b/Plugins/traffic.dll
new file mode 100644
index 0000000..f6bacce
--- /dev/null
+++ b/Plugins/traffic.dll
Binary files differ