2002-02-01 19:28:30 +00:00
|
|
|
/*
|
|
|
|
* lines.c
|
|
|
|
* iTunesXPlugIn
|
|
|
|
*
|
|
|
|
* Created by guillaum on Tue Aug 14 2001.
|
|
|
|
* Copyright (c) 2001 __CompanyName__. All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2003-11-07 12:47:01 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2002-02-01 19:28:30 +00:00
|
|
|
#include "lines.h"
|
|
|
|
#include <math.h>
|
|
|
|
|
2005-10-19 10:57:46 +00:00
|
|
|
static inline unsigned char
|
2004-03-14 22:34:33 +00:00
|
|
|
lighten (unsigned char value, unsigned char power)
|
2002-02-01 19:28:30 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
unsigned char i;
|
|
|
|
|
|
|
|
for (i = 0; i < power; i++)
|
|
|
|
value += (255 - value) / 5;
|
|
|
|
return value;
|
2002-02-01 19:28:30 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
void
|
gst/goom/: Make goom reentrant by moving all important static variables into instance structures.
Original commit message from CVS:
* gst/goom/filters.c: (zoomFilterNew), (calculatePXandPY),
(setPixelRGB), (setPixelRGB_), (getPixelRGB), (getPixelRGB_),
(zoomFilterSetResolution), (zoomFilterDestroy),
(zoomFilterFastRGB), (pointFilter):
* gst/goom/filters.h:
* gst/goom/goom_core.c: (goom_init), (goom_set_resolution),
(goom_update), (goom_close):
* gst/goom/goom_core.h:
* gst/goom/goom_tools.h:
* gst/goom/graphic.c:
* gst/goom/gstgoom.c: (gst_goom_class_init), (gst_goom_init),
(gst_goom_dispose), (gst_goom_src_setcaps), (gst_goom_chain):
* gst/goom/gstgoom.h:
* gst/goom/lines.c: (goom_lines):
* gst/goom/lines.h:
Make goom reentrant by moving all important static variables
into instance structures.
(Fixes #329181)
2006-02-05 20:43:49 +00:00
|
|
|
goom_lines (GoomData * goomdata, gint16 data[2][512], unsigned int ID,
|
|
|
|
unsigned int *p, guint32 power)
|
2002-02-01 19:28:30 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
guint32 color1;
|
|
|
|
guint32 color2;
|
gst/goom/: Make goom reentrant by moving all important static variables into instance structures.
Original commit message from CVS:
* gst/goom/filters.c: (zoomFilterNew), (calculatePXandPY),
(setPixelRGB), (setPixelRGB_), (getPixelRGB), (getPixelRGB_),
(zoomFilterSetResolution), (zoomFilterDestroy),
(zoomFilterFastRGB), (pointFilter):
* gst/goom/filters.h:
* gst/goom/goom_core.c: (goom_init), (goom_set_resolution),
(goom_update), (goom_close):
* gst/goom/goom_core.h:
* gst/goom/goom_tools.h:
* gst/goom/graphic.c:
* gst/goom/gstgoom.c: (gst_goom_class_init), (gst_goom_init),
(gst_goom_dispose), (gst_goom_src_setcaps), (gst_goom_chain):
* gst/goom/gstgoom.h:
* gst/goom/lines.c: (goom_lines):
* gst/goom/lines.h:
Make goom reentrant by moving all important static variables
into instance structures.
(Fixes #329181)
2006-02-05 20:43:49 +00:00
|
|
|
guint32 resolx = goomdata->resolx;
|
|
|
|
guint32 resoly = goomdata->resoly;
|
2004-03-14 22:34:33 +00:00
|
|
|
unsigned char *color = 1 + (unsigned char *) &color1;
|
|
|
|
|
|
|
|
switch (ID) {
|
2004-03-15 19:32:27 +00:00
|
|
|
case 0: /* Horizontal stereo lines */
|
2004-03-14 22:34:33 +00:00
|
|
|
{
|
|
|
|
color1 = 0x0000AA00;
|
|
|
|
color2 = 0x00AA0000;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
case 1: /* Stereo circles */
|
2004-03-14 22:34:33 +00:00
|
|
|
{
|
|
|
|
color1 = 0x00AA33DD;
|
|
|
|
color2 = 0x00AA33DD;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*color = lighten (*color, power);
|
|
|
|
color++;
|
|
|
|
*color = lighten (*color, power);
|
|
|
|
color++;
|
|
|
|
*color = lighten (*color, power);
|
|
|
|
color = 1 + (unsigned char *) &color2;
|
|
|
|
*color = lighten (*color, power);
|
|
|
|
color++;
|
|
|
|
*color = lighten (*color, power);
|
|
|
|
color++;
|
|
|
|
*color = lighten (*color, power);
|
2002-02-01 19:28:30 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
switch (ID) {
|
2004-03-15 19:32:27 +00:00
|
|
|
case 0: /* Horizontal stereo lines */
|
2002-02-01 19:28:30 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 512; i++) {
|
2004-03-15 19:32:27 +00:00
|
|
|
guint32 plot;
|
2002-02-01 19:28:30 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
plot = i * resolx / 512 + (resoly / 4 + data[0][i] / 1600) * resolx;
|
|
|
|
p[plot] = color1;
|
|
|
|
p[plot + 1] = color1;
|
|
|
|
plot = i * resolx / 512 + (resoly * 3 / 4 - data[1][i] / 1600) * resolx;
|
|
|
|
p[plot] = color2;
|
|
|
|
p[plot + 1] = color2;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-02-01 19:28:30 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
case 1: /* Stereo circles */
|
2002-02-01 19:28:30 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
float z;
|
|
|
|
unsigned int monX = resolx / 2;
|
|
|
|
float monY = resoly / 4;
|
|
|
|
float monY2 = resoly / 2;
|
2002-02-01 19:28:30 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
for (z = 0; z < 6.2832f; z += 1.0f / monY) {
|
2004-03-15 19:32:27 +00:00
|
|
|
/* float offset1 = 128+data[1][(unsigned int)(z*81.33f)])/200000; */
|
|
|
|
p[monX + (unsigned int) ((monY + ((float) resoly) * (128 +
|
|
|
|
data[1][(unsigned int) (z * 81.33f)]) / 200000) *
|
|
|
|
cos (z) + resolx * (unsigned int) (monY2 + (monY +
|
|
|
|
((float) resoly) * (128 +
|
|
|
|
data[1][(unsigned int) (z * 81.33f)]) / 400000) *
|
|
|
|
sin (z)))] = color1;
|
|
|
|
p[monX + (unsigned int) ((monY - ((float) resoly) * (128 +
|
|
|
|
data[0][(unsigned int) (z * 81.33f)]) / 200000) *
|
|
|
|
cos (z) + resolx * (unsigned int) (monY2 + (monY -
|
|
|
|
((float) resoly) * (128 +
|
|
|
|
data[0][(unsigned int) (z * 81.33f)]) / 400000) *
|
|
|
|
sin (z)))] = color2;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-02-01 19:28:30 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
2002-02-01 19:28:30 +00:00
|
|
|
}
|