summaryrefslogtreecommitdiffstats
path: root/gst/goom/lines.c
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
commit5d25c00e4b613b9cdf2c04fa3a68dffa03834a68 (patch)
tree74a5b1eaf3a324b520e64e87404fd0b3018a7829 /gst/goom/lines.c
parent1e83b097f7b732ae49e294a5a398bdc3e88854a8 (diff)
gst-indent
Original commit message from CVS: gst-indent
Diffstat (limited to 'gst/goom/lines.c')
-rw-r--r--gst/goom/lines.c143
1 files changed, 78 insertions, 65 deletions
diff --git a/gst/goom/lines.c b/gst/goom/lines.c
index 131fd002..611f9a52 100644
--- a/gst/goom/lines.c
+++ b/gst/goom/lines.c
@@ -14,81 +14,94 @@
#include "lines.h"
#include <math.h>
-extern unsigned int resolx,resoly;
+extern unsigned int resolx, resoly;
-inline unsigned char lighten(unsigned char value,unsigned char power)
+inline unsigned char
+lighten (unsigned char value, unsigned char power)
{
- unsigned char i;
- for (i=0;i < power; i++) value += (255-value)/5;
- return value;
+ unsigned char i;
+
+ for (i = 0; i < power; i++)
+ value += (255 - value) / 5;
+ return value;
}
-void goom_lines(gint16 data [2][512], unsigned int ID,unsigned int* p, guint32 power)
+void
+goom_lines (gint16 data[2][512], unsigned int ID, unsigned int *p,
+ guint32 power)
{
- guint32 color1;
- guint32 color2;
- unsigned char * color = 1 + (unsigned char *) &color1;
+ guint32 color1;
+ guint32 color2;
+ unsigned char *color = 1 + (unsigned char *) &color1;
+
+ switch (ID) {
+ case 0: /* Horizontal stereo lines */
+ {
+ color1 = 0x0000AA00;
+ color2 = 0x00AA0000;
+ break;
+ }
+
+ case 1: /* Stereo circles */
+ {
+ 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);
- switch (ID)
+ switch (ID) {
+ case 0: /* Horizontal stereo lines */
{
- case 0: /* Horizontal stereo lines */
- {
- color1 = 0x0000AA00;
- color2 = 0x00AA0000;
- break;
- }
+ unsigned int i;
+
+ for (i = 0; i < 512; i++) {
+ guint32 plot;
- case 1: /* Stereo circles */
- {
- color1 = 0x00AA33DD;
- color2 = 0x00AA33DD;
- break;
- }
+ 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;
+ }
+ 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);
-
- switch (ID)
+
+ case 1: /* Stereo circles */
{
- case 0: /* Horizontal stereo lines */
- {
- unsigned int i;
- for (i=0;i<512;i++)
- {
- guint32 plot ;
- 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;
- }
- break;
- }
+ float z;
+ unsigned int monX = resolx / 2;
+ float monY = resoly / 4;
+ float monY2 = resoly / 2;
- case 1: /* Stereo circles */
- {
- float z;
- unsigned int monX = resolx/2;
- float monY = resoly/4;
- float monY2 = resoly/2;
- for (z=0;z<6.2832f; z+=1.0f/monY)
- {
- /* 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;
- }
- break;
- }
+ for (z = 0; z < 6.2832f; z += 1.0f / monY) {
+ /* 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;
+ }
+ break;
}
+ }
}
-