diff options
Diffstat (limited to 'gst/goom2k1/goom_tools.h')
-rw-r--r-- | gst/goom2k1/goom_tools.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gst/goom2k1/goom_tools.h b/gst/goom2k1/goom_tools.h new file mode 100644 index 00000000..6178dbaf --- /dev/null +++ b/gst/goom2k1/goom_tools.h @@ -0,0 +1,24 @@ +#ifndef _GOOMTOOLS_H +#define _GOOMTOOLS_H + +#define NB_RAND 0x10000 + +#define RAND_INIT(gd,i) \ + srand (i); \ + if (gd->rand_tab == NULL) \ + gd->rand_tab = g_malloc (NB_RAND * sizeof(gint)) ;\ + gd->rand_pos = 0; \ + while (gd->rand_pos < NB_RAND) \ + gd->rand_tab [gd->rand_pos++] = rand (); + +#define RAND(gd) \ + (gd->rand_tab[gd->rand_pos = ((gd->rand_pos + 1) % NB_RAND)]) + +#define RAND_CLOSE(gd) \ + g_free (gd->rand_tab); \ + gd->rand_tab = NULL; + +/*#define iRAND(i) ((guint32)((float)i * RAND()/RAND_MAX)) */ +#define iRAND(gd,i) (RAND(gd) % i) + +#endif |