summaryrefslogtreecommitdiffstats
path: root/gst/effectv/gstshagadelic.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/effectv/gstshagadelic.c
parent1e83b097f7b732ae49e294a5a398bdc3e88854a8 (diff)
gst-indent
Original commit message from CVS: gst-indent
Diffstat (limited to 'gst/effectv/gstshagadelic.c')
-rw-r--r--gst/effectv/gstshagadelic.c114
1 files changed, 65 insertions, 49 deletions
diff --git a/gst/effectv/gstshagadelic.c b/gst/effectv/gstshagadelic.c
index 790649d5..345f2762 100644
--- a/gst/effectv/gstshagadelic.c
+++ b/gst/effectv/gstshagadelic.c
@@ -20,7 +20,7 @@
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
- */
+ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -76,28 +76,30 @@ enum
ARG_0,
};
-static void gst_shagadelictv_base_init (gpointer g_class);
-static void gst_shagadelictv_class_init (gpointer g_class, gpointer class_data);
-static void gst_shagadelictv_init (GTypeInstance *instance, gpointer g_class);
+static void gst_shagadelictv_base_init (gpointer g_class);
+static void gst_shagadelictv_class_init (gpointer g_class, gpointer class_data);
+static void gst_shagadelictv_init (GTypeInstance * instance, gpointer g_class);
-static void gst_shagadelic_initialize (GstShagadelicTV *filter);
+static void gst_shagadelic_initialize (GstShagadelicTV * filter);
-static void gst_shagadelictv_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_shagadelictv_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_shagadelictv_setup (GstVideofilter *videofilter);
-static void gst_shagadelictv_rgb32 (GstVideofilter *videofilter, void *d, void *s);
+static void gst_shagadelictv_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_shagadelictv_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+static void gst_shagadelictv_setup (GstVideofilter * videofilter);
+static void gst_shagadelictv_rgb32 (GstVideofilter * videofilter, void *d,
+ void *s);
/*static guint gst_shagadelictv_signals[LAST_SIGNAL] = { 0 }; */
-GType gst_shagadelictv_get_type (void)
+GType
+gst_shagadelictv_get_type (void)
{
static GType shagadelictv_type = 0;
if (!shagadelictv_type) {
static const GTypeInfo shagadelictv_info = {
- sizeof (GstShagadelicTVClass),
+ sizeof (GstShagadelicTVClass),
gst_shagadelictv_base_init,
NULL,
(GClassInitFunc) gst_shagadelictv_class_init,
@@ -108,34 +110,36 @@ GType gst_shagadelictv_get_type (void)
(GInstanceInitFunc) gst_shagadelictv_init,
};
- shagadelictv_type = g_type_register_static (GST_TYPE_VIDEOFILTER, "GstShagadelicTV", &shagadelictv_info, 0);
+ shagadelictv_type =
+ g_type_register_static (GST_TYPE_VIDEOFILTER, "GstShagadelicTV",
+ &shagadelictv_info, 0);
}
return shagadelictv_type;
}
static GstVideofilterFormat gst_shagadelictv_formats[] = {
- { "RGB ", 32, gst_shagadelictv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000, 0xff000000 }
+ {"RGB ", 32, gst_shagadelictv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000,
+ 0xff000000}
};
-
+
static void
gst_shagadelictv_base_init (gpointer g_class)
{
/* elementfactory information */
- static GstElementDetails gst_shagadelictv_details = GST_ELEMENT_DETAILS (
- "ShagadelicTV",
- "Filter/Effect/Video",
- "Oh behave, ShagedelicTV makes images shagadelic!",
- "Wim Taymans <wim.taymans@chello.be>"
- );
+ static GstElementDetails gst_shagadelictv_details =
+ GST_ELEMENT_DETAILS ("ShagadelicTV",
+ "Filter/Effect/Video",
+ "Oh behave, ShagedelicTV makes images shagadelic!",
+ "Wim Taymans <wim.taymans@chello.be>");
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
int i;
-
+
gst_element_class_set_details (element_class, &gst_shagadelictv_details);
- for(i=0;i<G_N_ELEMENTS(gst_shagadelictv_formats);i++){
- gst_videofilter_class_add_format(videofilter_class,
+ for (i = 0; i < G_N_ELEMENTS (gst_shagadelictv_formats); i++) {
+ gst_videofilter_class_add_format (videofilter_class,
gst_shagadelictv_formats + i);
}
@@ -158,7 +162,7 @@ gst_shagadelictv_class_init (gpointer g_class, gpointer class_data)
}
static void
-gst_shagadelictv_init (GTypeInstance *instance, gpointer g_class)
+gst_shagadelictv_init (GTypeInstance * instance, gpointer g_class)
{
GstShagadelicTV *filter = GST_SHAGADELICTV (instance);
@@ -166,12 +170,12 @@ gst_shagadelictv_init (GTypeInstance *instance, gpointer g_class)
filter->spiral = NULL;
}
-static void
-gst_shagadelictv_setup(GstVideofilter *videofilter)
+static void
+gst_shagadelictv_setup (GstVideofilter * videofilter)
{
GstShagadelicTV *filter;
- int width = gst_videofilter_get_input_width(videofilter);
- int height = gst_videofilter_get_input_height(videofilter);
+ int width = gst_videofilter_get_input_width (videofilter);
+ int height = gst_videofilter_get_input_height (videofilter);
int area;
g_return_if_fail (GST_IS_SHAGADELICTV (videofilter));
@@ -193,16 +197,17 @@ gst_shagadelictv_setup(GstVideofilter *videofilter)
static unsigned int
fastrand (void)
-{
+{
static unsigned int fastrand_val;
return (fastrand_val = fastrand_val * 1103515245 + 12345);
}
static void
-gst_shagadelic_initialize (GstShagadelicTV *filter)
+gst_shagadelic_initialize (GstShagadelicTV * filter)
{
int i, x, y;
+
#ifdef PS2
float xx, yy;
#else
@@ -210,32 +215,35 @@ gst_shagadelic_initialize (GstShagadelicTV *filter)
#endif
i = 0;
- for(y = 0; y < filter->height * 2; y++) {
+ for (y = 0; y < filter->height * 2; y++) {
yy = y - filter->height;
yy *= yy;
for (x = 0; x < filter->width * 2; x++) {
xx = x - filter->width;
#ifdef PS2
- filter->ripple[i++] = ((unsigned int)(sqrtf(xx*xx+yy)*8))&255;
+ filter->ripple[i++] = ((unsigned int) (sqrtf (xx * xx + yy) * 8)) & 255;
#else
- filter->ripple[i++] = ((unsigned int)(sqrt(xx*xx+yy)*8))&255;
+ filter->ripple[i++] = ((unsigned int) (sqrt (xx * xx + yy) * 8)) & 255;
#endif
}
}
i = 0;
for (y = 0; y < filter->height; y++) {
- yy = y - filter->height/2;
-
+ yy = y - filter->height / 2;
+
for (x = 0; x < filter->width; x++) {
- xx = x - filter->width/2;
+ xx = x - filter->width / 2;
#ifdef PS2
filter->spiral[i++] = ((unsigned int)
- ((atan2f(xx, yy)/((float)M_PI)*256*9) + (sqrtf(xx*xx+yy*yy)*5)))&255;
+ ((atan2f (xx,
+ yy) / ((float) M_PI) * 256 * 9) + (sqrtf (xx * xx +
+ yy * yy) * 5))) & 255;
#else
filter->spiral[i++] = ((unsigned int)
- ((atan2(xx, yy)/M_PI*256*9) + (sqrt(xx*xx+yy*yy)*5)))&255;
+ ((atan2 (xx, yy) / M_PI * 256 * 9) + (sqrt (xx * xx +
+ yy * yy) * 5))) & 255;
#endif
/* Here is another Swinger!
* ((atan2(xx, yy)/M_PI*256) + (sqrt(xx*xx+yy*yy)*10))&255;
@@ -254,7 +262,7 @@ gst_shagadelic_initialize (GstShagadelicTV *filter)
}
static void
-gst_shagadelictv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
+gst_shagadelictv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
{
GstShagadelicTV *filter;
guint32 *src, *dest;
@@ -280,18 +288,24 @@ gst_shagadelictv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
* v = *src++;
* *dest++ = v & ((r<<16)|(g<<8)|b);
*/
- r = (gchar) (filter->ripple[(filter->ry + y) * width * 2 + filter->rx + x] + filter->phase * 2) >> 7;
+ r = (gchar) (filter->ripple[(filter->ry + y) * width * 2 + filter->rx +
+ x] + filter->phase * 2) >> 7;
g = (gchar) (filter->spiral[y * width + x] + filter->phase * 3) >> 7;
- b = (gchar) (filter->ripple[(filter->by + y) * width * 2 + filter->bx + x] - filter->phase) >> 7;
+ b = (gchar) (filter->ripple[(filter->by + y) * width * 2 + filter->bx +
+ x] - filter->phase) >> 7;
*dest++ = v & ((r << 16) | (g << 8) | b);
}
}
filter->phase -= 8;
- if ((filter->rx + filter->rvx) < 0 || (filter->rx + filter->rvx) >= width) filter->rvx =- filter->rvx;
- if ((filter->ry + filter->rvy) < 0 || (filter->ry + filter->rvy) >= height) filter->rvy =- filter->rvy;
- if ((filter->bx + filter->bvx) < 0 || (filter->bx + filter->bvx) >= width) filter->bvx =- filter->bvx;
- if ((filter->by + filter->bvy) < 0 || (filter->by + filter->bvy) >= height) filter->bvy =- filter->bvy;
+ if ((filter->rx + filter->rvx) < 0 || (filter->rx + filter->rvx) >= width)
+ filter->rvx = -filter->rvx;
+ if ((filter->ry + filter->rvy) < 0 || (filter->ry + filter->rvy) >= height)
+ filter->rvy = -filter->rvy;
+ if ((filter->bx + filter->bvx) < 0 || (filter->bx + filter->bvx) >= width)
+ filter->bvx = -filter->bvx;
+ if ((filter->by + filter->bvy) < 0 || (filter->by + filter->bvy) >= height)
+ filter->bvy = -filter->bvy;
filter->rx += filter->rvx;
filter->ry += filter->rvy;
filter->bx += filter->bvx;
@@ -299,7 +313,8 @@ gst_shagadelictv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
}
static void
-gst_shagadelictv_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+gst_shagadelictv_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstShagadelicTV *filter;
@@ -315,7 +330,8 @@ gst_shagadelictv_set_property (GObject * object, guint prop_id, const GValue * v
}
static void
-gst_shagadelictv_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+gst_shagadelictv_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstShagadelicTV *filter;