Commit 07c1dcea authored by Jan Schmidt's avatar Jan Schmidt

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)
parent 4b549001
2006-02-05 Jan Schmidt <thaytan@mad.scientist.com>
* 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-04 Tim-Philipp Müller <tim at centricular dot net>
* gst/avi/gstavidemux.c: (gst_avi_demux_parse_stream),
......
This diff is collapsed.
......@@ -4,21 +4,7 @@
#include <glib.h>
#include "graphic.h"
typedef struct
{
int vitesse ;
unsigned char pertedec ;
unsigned char sqrtperte ;
int middleX,middleY ;
char reverse ;
char mode ;
/** @since June 2001 */
int hPlaneEffect ;
int vPlaneEffect ;
char noisify ;
} ZoomFilterData ;
#include "goom_core.h"
#define NORMAL_MODE 0
#define WAVE_MODE 1
......@@ -27,7 +13,34 @@ typedef struct
#define AMULETTE_MODE 4
#define WATER_MODE 5
void pointFilter(guint32 *pix1, Color c,
struct ZoomFilterData
{
int vitesse;
unsigned char pertedec;
unsigned char sqrtperte;
int middleX;
int middleY;
char reverse;
char mode;
/** @since June 2001 */
int hPlaneEffect;
int vPlaneEffect;
char noisify;
guint32 res_x;
guint32 res_y;
guint32 buffsize;
guint32 *buffer;
guint32 *pos10;
guint32 *c[4];
int *firedec;
int wave;
int wavesp;
};
void pointFilter(GoomData *goomdata, Color c,
float t1, float t2, float t3, float t4,
guint32 cycle);
......@@ -42,11 +55,10 @@ Uint middleX,
Uint middleY);
*/
void zoomFilterFastRGB (guint32 *pix1,
guint32 *pix2,
ZoomFilterData *zf,
guint32 resx, guint32 resy);
ZoomFilterData *zoomFilterNew ();
void zoomFilterDestroy (ZoomFilterData *zf);
void zoomFilterFastRGB (GoomData *goomdata, ZoomFilterData *zf,
int zfd_update);
/* filtre sin :
le contenu de pix1 est copie dans pix2, avec l'effet appliqu
......
This diff is collapsed.
......@@ -3,11 +3,41 @@
#include <glib.h>
void goom_init (guint32 resx, guint32 resy);
void goom_set_resolution (guint32 resx, guint32 resy);
typedef struct ZoomFilterData ZoomFilterData;
guint32 * goom_update (gint16 data [2][512]);
typedef struct
{
/**-----------------------------------------------------**
** SHARED DATA **
**-----------------------------------------------------**/
guint32 *pixel;
guint32 *back;
guint32 *p1, *p2;
guint32 cycle;
void goom_close ();
guint32 resolx, resoly, buffsize;
int lockvar; /* pour empecher de nouveaux changements */
int goomvar; /* boucle des gooms */
int totalgoom; /* nombre de gooms par seconds */
int agoom; /* un goom a eu lieu.. */
int loopvar; /* mouvement des points */
int speedvar; /* vitesse des particules */
int lineMode; /* l'effet lineaire a dessiner */
char goomlimit; /* sensibilité du goom */
ZoomFilterData *zfd;
/* Random table */
gint *rand_tab;
guint rand_pos;
} GoomData;
void goom_init (GoomData *goomdata, guint32 resx, guint32 resy);
void goom_set_resolution (GoomData *goomdata, guint32 resx, guint32 resy);
guint32 *goom_update (GoomData *goomdata, gint16 data [2][512]);
void goom_close (GoomData *goomdata);
#endif
......@@ -3,27 +3,22 @@
#define NB_RAND 0x10000
/* in graphic.c */
extern int * rand_tab ;
extern unsigned short rand_pos ;
#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_INIT(i) \
srand (i) ;\
if (!rand_tab)\
rand_tab = (int *) malloc (NB_RAND * sizeof(int)) ;\
rand_pos = 1 ;\
while (rand_pos != 0)\
rand_tab [rand_pos++] = rand () ;
#define RAND()\
(rand_tab[rand_pos = rand_pos + 1])
#define RAND_CLOSE()\
free (rand_tab);\
rand_tab = 0;
#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(i) (RAND()%i)
#define iRAND(gd,i) (RAND(gd) % i)
#endif
......@@ -12,10 +12,3 @@ const Color BLUE = { 0, 0, 0xff };
const Color YELLOW = { 0xff, 0xff, 0x33 };
const Color ORANGE = { 0xff, 0xcc, 0x00 };
const Color VIOLET = { 0x55, 0x00, 0xff };
unsigned int SIZE;
unsigned int HEIGHT;
unsigned int WIDTH;
int *rand_tab = 0;
unsigned short int rand_pos = 0;
......@@ -182,7 +182,7 @@ gst_goom_init (GstGoom * goom)
goom->samples_consumed = 0;
goom->disposed = FALSE;
goom_init (goom->width, goom->height);
goom_init (&(goom->goomdata), goom->width, goom->height);
}
static void
......@@ -191,7 +191,7 @@ gst_goom_dispose (GObject * object)
GstGoom *goom = GST_GOOM (object);
if (!goom->disposed) {
goom_close ();
goom_close (&(goom->goomdata));
goom->disposed = TRUE;
g_object_unref (goom->adapter);
......@@ -233,7 +233,7 @@ gst_goom_src_setcaps (GstPad * pad, GstCaps * caps)
&goom->fps_d))
return FALSE;
goom_set_resolution (goom->width, goom->height);
goom_set_resolution (&(goom->goomdata), goom->width, goom->height);
return TRUE;
}
......@@ -382,7 +382,7 @@ gst_goom_chain (GstPad * pad, GstBuffer * bufin)
GST_BUFFER_DURATION (bufout) = frame_duration;
GST_BUFFER_SIZE (bufout) = goom->width * goom->height * 4;
out_frame = (guchar *) goom_update (goom->datain);
out_frame = (guchar *) goom_update (&(goom->goomdata), goom->datain);
memcpy (GST_BUFFER_DATA (bufout), out_frame, GST_BUFFER_SIZE (bufout));
GST_DEBUG ("Pushing frame with time=%" G_GUINT64_FORMAT ", duration=%"
......
......@@ -24,6 +24,7 @@ G_BEGIN_DECLS
#include <gst/gst.h>
#include <gst/base/gstadapter.h>
#include "goom_core.h"
#define GOOM_SAMPLES 512
......@@ -60,6 +61,8 @@ struct _GstGoom
gint channels;
gboolean disposed;
GoomData goomdata;
};
struct _GstGoomClass
......
......@@ -14,8 +14,6 @@
#include "lines.h"
#include <math.h>
extern unsigned int resolx, resoly;
static inline unsigned char
lighten (unsigned char value, unsigned char power)
{
......@@ -27,11 +25,13 @@ lighten (unsigned char value, unsigned char power)
}
void
goom_lines (gint16 data[2][512], unsigned int ID, unsigned int *p,
guint32 power)
goom_lines (GoomData * goomdata, gint16 data[2][512], unsigned int ID,
unsigned int *p, guint32 power)
{
guint32 color1;
guint32 color2;
guint32 resolx = goomdata->resolx;
guint32 resoly = goomdata->resoly;
unsigned char *color = 1 + (unsigned char *) &color1;
switch (ID) {
......
......@@ -9,7 +9,8 @@
#include <glib.h>
#include "graphic.h"
#include "goom_core.h"
void goom_lines(GoomData *goomdata, 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);
void goom_lines_conf(gint16 config [25]);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment