summaryrefslogtreecommitdiffstats
path: root/gst/goom
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
parent1e83b097f7b732ae49e294a5a398bdc3e88854a8 (diff)
gst-indent
Original commit message from CVS: gst-indent
Diffstat (limited to 'gst/goom')
-rw-r--r--gst/goom/filters.c764
-rw-r--r--gst/goom/filters.h31
-rw-r--r--gst/goom/goom_core.c715
-rw-r--r--gst/goom/goom_core.h2
-rw-r--r--gst/goom/goom_tools.h6
-rw-r--r--gst/goom/graphic.c26
-rw-r--r--gst/goom/graphic.h8
-rw-r--r--gst/goom/gstgoom.c168
-rw-r--r--gst/goom/lines.c143
-rw-r--r--gst/goom/lines.h6
10 files changed, 933 insertions, 936 deletions
diff --git a/gst/goom/filters.c b/gst/goom/filters.c
index 5d74b622..14bd7ec6 100644
--- a/gst/goom/filters.c
+++ b/gst/goom/filters.c
@@ -43,44 +43,45 @@ extern volatile guint32 resoly;
#ifdef USE_ASM
#ifdef MMX
-int mmx_zoom () ;
+int mmx_zoom ();
guint32 mmx_zoom_size;
#endif /* MMX */
#ifdef POWERPC
extern unsigned int useAltivec;
-extern void ppc_zoom(void);
-extern void ppc_zoom_altivec(void);
+extern void ppc_zoom (void);
+extern void ppc_zoom_altivec (void);
unsigned int ppcsize4;
#endif /* PowerPC */
unsigned int *coeffs = 0, *freecoeffs = 0;
-guint32 *expix1 = 0; /* pointeur exporte vers p1 */
-guint32 *expix2 = 0; /* pointeur exporte vers p2 */
+guint32 *expix1 = 0; /* pointeur exporte vers p1 */
+guint32 *expix2 = 0; /* pointeur exporte vers p2 */
guint32 zoom_width;
#endif /* ASM */
-static int sintable [0xffff] ;
+static int sintable[0xffff];
static int vitesse = 127;
-static char theMode = AMULETTE_MODE ;
+static char theMode = AMULETTE_MODE;
static int vPlaneEffect = 0;
static int hPlaneEffect = 0;
static char noisify = 2;
-static int middleX , middleY ;
-static unsigned char sqrtperte = 16 ;
+static int middleX, middleY;
+static unsigned char sqrtperte = 16;
-static int * firedec = 0 ;
+static int *firedec = 0;
/* retourne x>>s , en testant le signe de x */
-inline int ShiftRight (int x, const unsigned char s)
+inline int
+ShiftRight (int x, const unsigned char s)
{
- if (x<0)
- return -(-x >> s) ;
+ if (x < 0)
+ return -(-x >> s);
else
- return x >> s ;
+ return x >> s;
}
/*
@@ -88,454 +89,463 @@ inline int ShiftRight (int x, const unsigned char s)
px et py indique la nouvelle position (en sqrtperte ieme de pixel)
(valeur * 16)
*/
-void calculatePXandPY (int x, int y, int *px, int *py)
+void
+calculatePXandPY (int x, int y, int *px, int *py)
{
- if (theMode == WATER_MODE)
- {
- static int wave = 0 ;
- static int wavesp = 0 ;
- int yy ;
-
- yy = y + RAND () % 4 + wave / 10 ;
- yy -= RAND () % 4;
- if (yy < 0) yy = 0 ;
- if (yy >= resoly) yy = resoly - 1 ;
-
- *px = (x<<4) + firedec [yy] + (wave / 10) ;
- *py = (y<<4) + 132 - ((vitesse < 132) ? vitesse : 131) ;
-
- wavesp += RAND () % 3;
- wavesp -= RAND () % 3;
- if (wave < -10) wavesp += 2 ;
- if (wave > 10) wavesp -= 2 ;
- wave += (wavesp / 10) + RAND () % 3;
- wave -= RAND () % 3;
- if (wavesp > 100) wavesp = (wavesp * 9) / 10 ;
+ if (theMode == WATER_MODE) {
+ static int wave = 0;
+ static int wavesp = 0;
+ int yy;
+
+ yy = y + RAND () % 4 + wave / 10;
+ yy -= RAND () % 4;
+ if (yy < 0)
+ yy = 0;
+ if (yy >= resoly)
+ yy = resoly - 1;
+
+ *px = (x << 4) + firedec[yy] + (wave / 10);
+ *py = (y << 4) + 132 - ((vitesse < 132) ? vitesse : 131);
+
+ wavesp += RAND () % 3;
+ wavesp -= RAND () % 3;
+ if (wave < -10)
+ wavesp += 2;
+ if (wave > 10)
+ wavesp -= 2;
+ wave += (wavesp / 10) + RAND () % 3;
+ wave -= RAND () % 3;
+ if (wavesp > 100)
+ wavesp = (wavesp * 9) / 10;
+ } else {
+ int dist;
+ register int vx, vy;
+ int fvitesse = vitesse << 4;
+
+ if (noisify) {
+ x += RAND () % noisify;
+ x -= RAND () % noisify;
+ y += RAND () % noisify;
+ y -= RAND () % noisify;
}
+
+ if (hPlaneEffect)
+ vx = ((x - middleX) << 9) + hPlaneEffect * (y - middleY);
+ else
+ vx = (x - middleX) << 9;
+
+ if (vPlaneEffect)
+ vy = ((y - middleY) << 9) + vPlaneEffect * (x - middleX);
else
- {
- int dist ;
- register int vx,vy ;
- int fvitesse = vitesse << 4 ;
-
- if (noisify)
- {
- x += RAND() % noisify;
- x -= RAND() % noisify;
- y += RAND() % noisify;
- y -= RAND() % noisify;
- }
-
- if (hPlaneEffect) vx = ((x - middleX) << 9) + hPlaneEffect * (y - middleY);
- else vx = (x - middleX) << 9 ;
-
- if (vPlaneEffect) vy = ((y - middleY) << 9) + vPlaneEffect * (x - middleX);
- else vy = (y - middleY) << 9 ;
-
- switch (theMode)
- {
- case WAVE_MODE:
- dist = ShiftRight(vx,9) * ShiftRight(vx,9) + ShiftRight(vy,9) * ShiftRight(vy,9);
- fvitesse *= 1024 + ShiftRight (
- sintable [(unsigned short)(0xffff*dist*EFFECT_DISTORS)],6);
- fvitesse /= 1024 ;
- break ;
- case CRYSTAL_BALL_MODE:
- dist = ShiftRight(vx,9) * ShiftRight(vx,9) + ShiftRight(vy,9) * ShiftRight(vy,9);
- fvitesse += (dist * EFFECT_DISTORS >> 10);
- break;
- case AMULETTE_MODE:
- dist = ShiftRight(vx,9) * ShiftRight(vx,9) + ShiftRight(vy,9) * ShiftRight(vy,9);
- fvitesse -= (dist * EFFECT_DISTORS >> 4);
- break;
- case SCRUNCH_MODE:
- dist = ShiftRight(vx,9) * ShiftRight(vx,9) + ShiftRight(vy,9) * ShiftRight(vy,9);
- fvitesse -= (dist * EFFECT_DISTORS >> 9);
- break;
- }
- if (vx<0) *px = (middleX << 4) - (-(vx * fvitesse) >> 16) ;
- else *px = (middleX << 4) + ((vx * fvitesse) >> 16) ;
- if (vy<0) *py = (middleY << 4) - (-(vy * fvitesse) >> 16) ;
- else *py = (middleY << 4) + ((vy * fvitesse) >> 16) ;
+ vy = (y - middleY) << 9;
+
+ switch (theMode) {
+ case WAVE_MODE:
+ dist =
+ ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
+ 9) * ShiftRight (vy, 9);
+ fvitesse *=
+ 1024 +
+ ShiftRight (sintable[(unsigned short) (0xffff * dist *
+ EFFECT_DISTORS)], 6);
+ fvitesse /= 1024;
+ break;
+ case CRYSTAL_BALL_MODE:
+ dist =
+ ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
+ 9) * ShiftRight (vy, 9);
+ fvitesse += (dist * EFFECT_DISTORS >> 10);
+ break;
+ case AMULETTE_MODE:
+ dist =
+ ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
+ 9) * ShiftRight (vy, 9);
+ fvitesse -= (dist * EFFECT_DISTORS >> 4);
+ break;
+ case SCRUNCH_MODE:
+ dist =
+ ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
+ 9) * ShiftRight (vy, 9);
+ fvitesse -= (dist * EFFECT_DISTORS >> 9);
+ break;
}
+ if (vx < 0)
+ *px = (middleX << 4) - (-(vx * fvitesse) >> 16);
+ else
+ *px = (middleX << 4) + ((vx * fvitesse) >> 16);
+ if (vy < 0)
+ *py = (middleY << 4) - (-(vy * fvitesse) >> 16);
+ else
+ *py = (middleY << 4) + ((vy * fvitesse) >> 16);
+ }
}
/*#define _DEBUG */
-inline void setPixelRGB(Uint *buffer, Uint x, Uint y, Color c)
+inline void
+setPixelRGB (Uint * buffer, Uint x, Uint y, Color c)
{
/* buffer[ y*WIDTH + x ] = (c.r<<16)|(c.v<<8)|c.b */
#ifdef _DEBUG_PIXEL
- if ( x+y*resolx >= resolx * resoly)
- {
- fprintf (stderr,"setPixel ERROR : hors du tableau... %i, %i\n", x,y) ;
- /*exit (1) ; */
- }
+ if (x + y * resolx >= resolx * resoly) {
+ fprintf (stderr, "setPixel ERROR : hors du tableau... %i, %i\n", x, y);
+ /*exit (1) ; */
+ }
#endif
-
+
#ifdef USE_DGA
- buffer[ y*resolx + x ] = (c.b<<16)|(c.v<<8)|c.r ;
+ buffer[y * resolx + x] = (c.b << 16) | (c.v << 8) | c.r;
#else
- buffer[ y*resolx + x ] = (c.r<<16)|(c.v<<8)|c.b ;
+ buffer[y * resolx + x] = (c.r << 16) | (c.v << 8) | c.b;
#endif
}
-inline void setPixelRGB_ (Uint *buffer, Uint x, Color c)
+inline void
+setPixelRGB_ (Uint * buffer, Uint x, Color c)
{
#ifdef _DEBUG
- if ( x >= resolx*resoly )
- {
- printf ("setPixel ERROR : hors du tableau... %i, %i\n", x,y) ;
- exit (1) ;
- }
+ if (x >= resolx * resoly) {
+ printf ("setPixel ERROR : hors du tableau... %i, %i\n", x, y);
+ exit (1);
+ }
#endif
-
+
#ifdef USE_DGA
- buffer[ x ] = (c.b<<16)|(c.v<<8)|c.r ;
+ buffer[x] = (c.b << 16) | (c.v << 8) | c.r;
#else
- buffer[ x ] = (c.r<<16)|(c.v<<8)|c.b ;
+ buffer[x] = (c.r << 16) | (c.v << 8) | c.b;
#endif
}
-inline void getPixelRGB (Uint *buffer, Uint x, Uint y, Color *c)
+inline void
+getPixelRGB (Uint * buffer, Uint x, Uint y, Color * c)
{
- register unsigned char *tmp8;
+ register unsigned char *tmp8;
- #ifdef _DEBUG
- if (x + y * resolx >= resolx*resoly)
- {
- printf ("getPixel ERROR : hors du tableau... %i, %i\n", x,y) ;
- exit (1) ;
- }
- #endif
+#ifdef _DEBUG
+ if (x + y * resolx >= resolx * resoly) {
+ printf ("getPixel ERROR : hors du tableau... %i, %i\n", x, y);
+ exit (1);
+ }
+#endif
#ifdef __BIG_ENDIAN__
- c->b = *(unsigned char *)(tmp8 = (unsigned char*)(buffer + (x + y*resolx)));
- c->r = *(unsigned char *)(++tmp8);
- c->v = *(unsigned char *)(++tmp8);
- c->b = *(unsigned char *)(++tmp8);
-
+ c->b = *(unsigned char *) (tmp8 =
+ (unsigned char *) (buffer + (x + y * resolx)));
+ c->r = *(unsigned char *) (++tmp8);
+ c->v = *(unsigned char *) (++tmp8);
+ c->b = *(unsigned char *) (++tmp8);
+
#else
- /* ATTENTION AU PETIT INDIEN */
- c->b = *(unsigned char *)(tmp8 = (unsigned char*)(buffer + (x + y*resolx)));
- c->v = *(unsigned char *)(++tmp8);
- c->r = *(unsigned char *)(++tmp8);
+ /* ATTENTION AU PETIT INDIEN */
+ c->b = *(unsigned char *) (tmp8 =
+ (unsigned char *) (buffer + (x + y * resolx)));
+ c->v = *(unsigned char *) (++tmp8);
+ c->r = *(unsigned char *) (++tmp8);
/* *c = (Color) buffer[x+y*WIDTH] ; */
#endif
}
-inline void getPixelRGB_ (Uint *buffer, Uint x, Color *c)
+inline void
+getPixelRGB_ (Uint * buffer, Uint x, Color * c)
{
- register unsigned char *tmp8;
+ register unsigned char *tmp8;
- #ifdef _DEBUG
- if ( x >= resolx*resoly )
- {
- printf ("getPixel ERROR : hors du tableau... %i\n", x) ;
- exit (1) ;
- }
- #endif
+#ifdef _DEBUG
+ if (x >= resolx * resoly) {
+ printf ("getPixel ERROR : hors du tableau... %i\n", x);
+ exit (1);
+ }
+#endif
#ifdef __BIG_ENDIAN__
- c->b = *(unsigned char *)(tmp8 = (unsigned char*)(buffer + x));
- c->r = *(unsigned char *)(++tmp8);
- c->v = *(unsigned char *)(++tmp8);
- c->b = *(unsigned char *)(++tmp8);
-
+ c->b = *(unsigned char *) (tmp8 = (unsigned char *) (buffer + x));
+ c->r = *(unsigned char *) (++tmp8);
+ c->v = *(unsigned char *) (++tmp8);
+ c->b = *(unsigned char *) (++tmp8);
+
#else
- /* ATTENTION AU PETIT INDIEN */
- c->b = *(unsigned char *)(tmp8 = (unsigned char*)(buffer + x));
- c->v = *(unsigned char *)(++tmp8);
- c->r = *(unsigned char *)(++tmp8);
+ /* ATTENTION AU PETIT INDIEN */
+ c->b = *(unsigned char *) (tmp8 = (unsigned char *) (buffer + x));
+ c->v = *(unsigned char *) (++tmp8);
+ c->r = *(unsigned char *) (++tmp8);
/* *c = (Color) buffer[x+y*WIDTH] ; */
#endif
}
/*===============================================================*/
-void zoomFilterFastRGB (Uint *pix1,
- Uint *pix2,
- ZoomFilterData *zf,
- Uint resx, Uint resy)
+void
+zoomFilterFastRGB (Uint * pix1,
+ Uint * pix2, ZoomFilterData * zf, Uint resx, Uint resy)
{
static guint32 prevX = 0, prevY = 0;
- static char reverse = 0 ; /*vitesse inversé..(zoom out) */
- /* static int perte = 100; // 100 = normal */
- static unsigned char pertedec = 8 ;
+ static char reverse = 0; /*vitesse inversé..(zoom out) */
+
+ /* static int perte = 100; // 100 = normal */
+ static unsigned char pertedec = 8;
static char firstTime = 1;
-
+
Uint x, y;
/* static unsigned int prevX = 0, prevY = 0; */
-
+
#ifdef USE_ASM
- expix1 = pix1 ;
- expix2 = pix2 ;
+ expix1 = pix1;
+ expix2 = pix2;
#else
Color couleur;
- Color col1,col2,col3,col4;
- Uint position ;
+ Color col1, col2, col3, col4;
+ Uint position;
static unsigned int *pos10 = 0;
- static unsigned int *c1 = 0,
- *c2 = 0,
- *c3 = 0,
- *c4 = 0;
+ static unsigned int *c1 = 0, *c2 = 0, *c3 = 0, *c4 = 0;
#endif
-
- if ((prevX != resx) || (prevY != resy))
- {
- prevX = resx;
- prevY = resy;
+
+ if ((prevX != resx) || (prevY != resy)) {
+ prevX = resx;
+ prevY = resy;
#ifndef USE_ASM
- if (c1) free (c1) ;
- if (c2) free (c2) ;
- if (c3) free (c3) ;
- if (c4) free (c4) ;
- if (pos10) free (pos10) ;
- c1=c2=c3=c4=pos10=0;
+ if (c1)
+ free (c1);
+ if (c2)
+ free (c2);
+ if (c3)
+ free (c3);
+ if (c4)
+ free (c4);
+ if (pos10)
+ free (pos10);
+ c1 = c2 = c3 = c4 = pos10 = 0;
#else
- if (coeffs) free (freecoeffs) ;
- coeffs = 0;
+ if (coeffs)
+ free (freecoeffs);
+ coeffs = 0;
#endif
- middleX = resx / 2 ;
- middleY = resy - 1;
- firstTime = 1 ;
- if (firedec) free (firedec);
- firedec=0;
- }
-
- if (zf)
- {
- reverse = zf->reverse ;
- vitesse = zf->vitesse ;
- if (reverse)
- vitesse = 256 - vitesse ;
+ middleX = resx / 2;
+ middleY = resy - 1;
+ firstTime = 1;
+ if (firedec)
+ free (firedec);
+ firedec = 0;
+ }
+
+ if (zf) {
+ reverse = zf->reverse;
+ vitesse = zf->vitesse;
+ if (reverse)
+ vitesse = 256 - vitesse;
#ifndef USE_ASM
- sqrtperte = zf->sqrtperte ;
+ sqrtperte = zf->sqrtperte;
#endif
- pertedec = zf->pertedec ;
- middleX = zf->middleX ;
- middleY = zf->middleY ;
- theMode = zf->mode ;
- hPlaneEffect = zf->hPlaneEffect;
- vPlaneEffect = zf->vPlaneEffect;
- noisify = zf->noisify;
- }
-
- if (firstTime || zf)
- {
-
- /* generation d'une table de sinus */
- if (firstTime)
- {
- unsigned short us ;
-
- firstTime = 0;
+ pertedec = zf->pertedec;
+ middleX = zf->middleX;
+ middleY = zf->middleY;
+ theMode = zf->mode;
+ hPlaneEffect = zf->hPlaneEffect;
+ vPlaneEffect = zf->vPlaneEffect;
+ noisify = zf->noisify;
+ }
+
+ if (firstTime || zf) {
+
+ /* generation d'une table de sinus */
+ if (firstTime) {
+ unsigned short us;
+
+ firstTime = 0;
#ifdef USE_ASM
- freecoeffs = (unsigned int *)
- malloc (resx*resy*2*sizeof(unsigned int)+128);
- coeffs = (guint32 *)((1+((unsigned int)(freecoeffs))/128)*128);
+ freecoeffs = (unsigned int *)
+ malloc (resx * resy * 2 * sizeof (unsigned int) + 128);
+ coeffs = (guint32 *) ((1 + ((unsigned int) (freecoeffs)) / 128) * 128);
#else
- pos10 = (unsigned int *) malloc (resx*resy*sizeof(unsigned int)) ;
- c1 = (unsigned int *) malloc (resx*resy*sizeof(unsigned int)) ;
- c2 = (unsigned int *) malloc (resx*resy*sizeof(unsigned int)) ;
- c3 = (unsigned int *) malloc (resx*resy*sizeof(unsigned int)) ;
- c4 = (unsigned int *) malloc (resx*resy*sizeof(unsigned int)) ;
+ pos10 = (unsigned int *) malloc (resx * resy * sizeof (unsigned int));
+ c1 = (unsigned int *) malloc (resx * resy * sizeof (unsigned int));
+ c2 = (unsigned int *) malloc (resx * resy * sizeof (unsigned int));
+ c3 = (unsigned int *) malloc (resx * resy * sizeof (unsigned int));
+ c4 = (unsigned int *) malloc (resx * resy * sizeof (unsigned int));
#endif
- for (us=0; us<0xffff; us++)
- {
- sintable [us] = (int)(1024.0f * sin (us*2*3.31415f/0xffff)) ;
- }
-
- {
- int loopv ;
- firedec = (int *) malloc (prevY * sizeof(int)) ;
- for (loopv = prevY ; loopv != 0 ;)
- {
- static int decc = 0 ;
- static int spdc = 0 ;
- static int accel = 0 ;
- loopv -- ;
- firedec [loopv] = decc ;
- decc += spdc / 10 ;
- spdc+= RAND () % 3;
- spdc-= RAND () % 3;
-
- if (decc > 4)
- spdc -= 1 ;
- if (decc < -4)
- spdc += 1 ;
-
- if (spdc > 30)
- spdc = spdc - RAND () % 3 + accel / 10 ;
- if (spdc < -30)
- spdc = spdc + RAND () % 3 + accel / 10 ;
-
- if (decc > 8 && spdc > 1 )
- spdc -= RAND () % 3 - 2 ;
-
- if (decc < -8 && spdc < -1 )
- spdc += RAND () % 3 + 2 ;
-
- if (decc > 8 || decc < -8)
- decc = decc * 8 / 9 ;
-
- accel += RAND () % 2;
- accel -= RAND () % 2;
- if (accel > 20)
- accel -= 2 ;
- if (accel < -20)
- accel += 2 ;
- }
- }
- }
-
-
- /* generation du buffer */
- for (y = 0 ; y < prevY ; y++)
- for (x = 0; x < prevX ; x++)
- {
- int px,py;
- unsigned char coefv,coefh;
-
- /* calculer px et py en fonction de */
- /* x,y,middleX,middleY et theMode */
- calculatePXandPY (x,y,&px, &py) ;
- if ((px == x << 4) && (py == y << 4))
- py += 8 ;
-
- if ( (py<0) || (px<0) ||
- (py>=(prevY-1)*sqrtperte) ||
- (px>=(prevX-1)*sqrtperte))
- {
+ for (us = 0; us < 0xffff; us++) {
+ sintable[us] = (int) (1024.0f * sin (us * 2 * 3.31415f / 0xffff));
+ }
+
+ {
+ int loopv;
+ firedec = (int *) malloc (prevY * sizeof (int));
+ for (loopv = prevY; loopv != 0;) {
+ static int decc = 0;
+ static int spdc = 0;
+ static int accel = 0;
+
+ loopv--;
+ firedec[loopv] = decc;
+ decc += spdc / 10;
+ spdc += RAND () % 3;
+ spdc -= RAND () % 3;
+
+ if (decc > 4)
+ spdc -= 1;
+ if (decc < -4)
+ spdc += 1;
+
+ if (spdc > 30)
+ spdc = spdc - RAND () % 3 + accel / 10;
+ if (spdc < -30)
+ spdc = spdc + RAND () % 3 + accel / 10;
+
+ if (decc > 8 && spdc > 1)
+ spdc -= RAND () % 3 - 2;
+
+ if (decc < -8 && spdc < -1)
+ spdc += RAND () % 3 + 2;
+
+ if (decc > 8 || decc < -8)
+ decc = decc * 8 / 9;
+
+ accel += RAND () % 2;
+ accel -= RAND () % 2;
+ if (accel > 20)
+ accel -= 2;
+ if (accel < -20)
+ accel += 2;
+ }
+ }
+ }
+
+
+ /* generation du buffer */
+ for (y = 0; y < prevY; y++)
+ for (x = 0; x < prevX; x++) {
+ int px, py;
+ unsigned char coefv, coefh;
+
+ /* calculer px et py en fonction de */
+ /* x,y,middleX,middleY et theMode */
+ calculatePXandPY (x, y, &px, &py);
+ if ((px == x << 4) && (py == y << 4))
+ py += 8;
+
+ if ((py < 0) || (px < 0) ||
+ (py >= (prevY - 1) * sqrtperte) ||
+ (px >= (prevX - 1) * sqrtperte)) {
#ifdef USE_ASM
- coeffs[(y*prevX+x)*2]=0 ;
- coeffs[(y*prevX+x)*2+1]=0;
+ coeffs[(y * prevX + x) * 2] = 0;
+ coeffs[(y * prevX + x) * 2 + 1] = 0;
#else
- pos10[y*prevX+x]=0 ;
- c1[y*prevX+x] = 0 ;
- c2[y*prevX+x] = 0 ;
- c3[y*prevX+x] = 0 ;
- c4[y*prevX+x] = 0 ;
+ pos10[y * prevX + x] = 0;
+ c1[y * prevX + x] = 0;
+ c2[y * prevX + x] = 0;
+ c3[y * prevX + x] = 0;
+ c4[y * prevX + x] = 0;
#endif
- }
- else
- {
- int npx10 ;
- int npy10 ;
- int pos;
-
- npx10 = (px/sqrtperte) ;
- npy10 = (py/sqrtperte) ;
-
+ } else {
+ int npx10;
+ int npy10;
+ int pos;
+
+ npx10 = (px / sqrtperte);
+ npy10 = (py / sqrtperte);
+
/* if (npx10 >= prevX) fprintf(stderr,"error npx:%d",npx10);
if (npy10 >= prevY) fprintf(stderr,"error npy:%d",npy10);
-*/
- coefh = px % sqrtperte ;
- coefv = py % sqrtperte ;
+*/
+ coefh = px % sqrtperte;
+ coefv = py % sqrtperte;
#ifdef USE_ASM
- pos = (y*prevX+x)*2;
- coeffs[pos] = (npx10 + prevX * npy10) * 4;
-
- if (!(coefh || coefv))
- coeffs[pos+1] = (sqrtperte*sqrtperte-1) ;
- else
- coeffs[pos+1] = (
- (sqrtperte-coefh) *
- (sqrtperte-coefv) );
-
- coeffs[pos+1] |= (coefh * (sqrtperte-coefv)) << 8 ;
- coeffs[pos+1] |= ((sqrtperte-coefh) * coefv) << 16 ;
- coeffs[pos+1] |= (coefh * coefv)<<24 ;
+ pos = (y * prevX + x) * 2;
+ coeffs[pos] = (npx10 + prevX * npy10) * 4;
+
+ if (!(coefh || coefv))
+ coeffs[pos + 1] = (sqrtperte * sqrtperte - 1);
+ else
+ coeffs[pos + 1] = ((sqrtperte - coefh) * (sqrtperte - coefv));
+
+ coeffs[pos + 1] |= (coefh * (sqrtperte - coefv)) << 8;
+ coeffs[pos + 1] |= ((sqrtperte - coefh) * coefv) << 16;
+ coeffs[pos + 1] |= (coefh * coefv) << 24;
#else
- pos = y*prevX+x;
- pos10[pos]= npx10 + prevX * npy10 ;
-
- if (!(coefh || coefv))
- c1[pos] = sqrtperte*sqrtperte-1 ;
- else
- c1[pos] = (sqrtperte-coefh) * (sqrtperte-coefv);
-
- c2[pos] = coefh * (sqrtperte-coefv) ;
- c3[pos] = (sqrtperte-coefh) * coefv ;
- c4[pos] = coefh * coefv ;
+ pos = y * prevX + x;
+ pos10[pos] = npx10 + prevX * npy10;
+
+ if (!(coefh || coefv))
+ c1[pos] = sqrtperte * sqrtperte - 1;
+ else
+ c1[pos] = (sqrtperte - coefh) * (sqrtperte - coefv);
+
+ c2[pos] = coefh * (sqrtperte - coefv);
+ c3[pos] = (sqrtperte - coefh) * coefv;
+ c4[pos] = coefh * coefv;
#endif
- }
- }
- }
-
+ }
+ }
+ }
#ifdef USE_ASM
- #ifdef MMX
- zoom_width = prevX ;
- mmx_zoom_size = prevX * prevY ;
- mmx_zoom () ;
- #endif
-
- #ifdef POWERPC
- zoom_width = prevX;
- if (useAltivec)
- {
- ppcsize4 = ((unsigned int)(prevX*prevY))/4;
- ppc_zoom_altivec();
- }
- else
- {
- ppcsize4 = ((unsigned int)(prevX*prevY));
- ppc_zoom();
- }
- #endif
+#ifdef MMX
+ zoom_width = prevX;
+ mmx_zoom_size = prevX * prevY;
+ mmx_zoom ();
+#endif
+
+#ifdef POWERPC
+ zoom_width = prevX;
+ if (useAltivec) {
+ ppcsize4 = ((unsigned int) (prevX * prevY)) / 4;
+ ppc_zoom_altivec ();
+ } else {
+ ppcsize4 = ((unsigned int) (prevX * prevY));
+ ppc_zoom ();
+ }
+#endif
#else
- for (position=0; position<prevX*prevY; position++)
- {
- getPixelRGB_(pix1,pos10[position],&col1);
- getPixelRGB_(pix1,pos10[position]+1,&col2);
- getPixelRGB_(pix1,pos10[position]+prevX,&col3);
- getPixelRGB_(pix1,pos10[position]+prevX+1,&col4);
-
- couleur.r = col1.r * c1[position]
- + col2.r * c2[position]
- + col3.r * c3[position]
- + col4.r * c4[position];
- couleur.r >>= pertedec ;
-
- couleur.v = col1.v * c1[position]
- + col2.v * c2[position]
- + col3.v * c3[position]
- + col4.v * c4[position];
- couleur.v >>= pertedec ;
-
- couleur.b = col1.b * c1[position]
- + col2.b * c2[position]
- + col3.b * c3[position]
- + col4.b * c4[position];
- couleur.b >>= pertedec ;
-
- setPixelRGB_(pix2,position,couleur);
- }
+ for (position = 0; position < prevX * prevY; position++) {
+ getPixelRGB_ (pix1, pos10[position], &col1);
+ getPixelRGB_ (pix1, pos10[position] + 1, &col2);
+ getPixelRGB_ (pix1, pos10[position] + prevX, &col3);
+ getPixelRGB_ (pix1, pos10[position] + prevX + 1, &col4);
+
+ couleur.r = col1.r * c1[position]
+ + col2.r * c2[position]
+ + col3.r * c3[position]
+ + col4.r * c4[position];
+ couleur.r >>= pertedec;
+
+ couleur.v = col1.v * c1[position]
+ + col2.v * c2[position]
+ + col3.v * c3[position]
+ + col4.v * c4[position];
+ couleur.v >>= pertedec;
+
+ couleur.b = col1.b * c1[position]
+ + col2.b * c2[position]
+ + col3.b * c3[position]
+ + col4.b * c4[position];
+ couleur.b >>= pertedec;
+
+ setPixelRGB_ (pix2, position, couleur);
+ }
#endif
}
-void pointFilter(Uint *pix1, Color c,
- float t1, float t2, float t3, float t4,
- Uint cycle)
+void
+pointFilter (Uint * pix1, Color c,
+ float t1, float t2, float t3, float t4, Uint cycle)
{
- Uint x = (Uint)((int)middleX + (int)(t1*cos((float)cycle/t3)));
- Uint y = (Uint)((int)middleY + (int)(t2*sin((float)cycle/t4)));
- if ((x>1) && (y>1) && (x<resolx-2) && (y<resoly-2))
- {
- setPixelRGB(pix1, x+1, y, c);
- setPixelRGB(pix1, x, y+1, c);
- setPixelRGB(pix1, x+1, y+1, WHITE);
- setPixelRGB(pix1, x+2, y+1, c);
- setPixelRGB(pix1, x+1, y+2, c);
- }
+ Uint x = (Uint) ((int) middleX + (int) (t1 * cos ((float) cycle / t3)));
+ Uint y = (Uint) ((int) middleY + (int) (t2 * sin ((float) cycle / t4)));
+
+ if ((x > 1) && (y > 1) && (x < resolx - 2) && (y < resoly - 2)) {
+ setPixelRGB (pix1, x + 1, y, c);
+ setPixelRGB (pix1, x, y + 1, c);
+ setPixelRGB (pix1, x + 1, y + 1, WHITE);
+ setPixelRGB (pix1, x + 2, y + 1, c);
+ setPixelRGB (pix1, x + 1, y + 2, c);
+ }
}
diff --git a/gst/goom/filters.h b/gst/goom/filters.h
index 33784c29..c4f0926d 100644
--- a/gst/goom/filters.h
+++ b/gst/goom/filters.h
@@ -7,17 +7,17 @@
typedef struct
{
- int vitesse ;
- unsigned char pertedec ;
- unsigned char sqrtperte ;
- int middleX,middleY ;
- char reverse ;
- char mode ;
+ 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 ;
+ int hPlaneEffect;
+ int vPlaneEffect;
+ char noisify;
+} ZoomFilterData;
#define NORMAL_MODE 0
@@ -27,9 +27,8 @@ typedef struct
#define AMULETTE_MODE 4
#define WATER_MODE 5
-void pointFilter(guint32 *pix1, Color c,
- float t1, float t2, float t3, float t4,
- guint32 cycle);
+void pointFilter (guint32 * pix1, Color c,
+ float t1, float t2, float t3, float t4, guint32 cycle);
/* filtre de zoom :
le contenu de pix1 est copie dans pix2, avec l'effet appliqué
@@ -42,10 +41,8 @@ Uint middleX,
Uint middleY);
*/
-void zoomFilterFastRGB (guint32 *pix1,
- guint32 *pix2,
- ZoomFilterData *zf,
- guint32 resx, guint32 resy);
+void zoomFilterFastRGB (guint32 * pix1,
+ guint32 * pix2, ZoomFilterData * zf, guint32 resx, guint32 resy);
/* filtre sin :
diff --git a/gst/goom/goom_core.c b/gst/goom/goom_core.c
index cf841127..5c4a75a3 100644
--- a/gst/goom/goom_core.c
+++ b/gst/goom/goom_core.c
@@ -17,410 +17,393 @@
/**-----------------------------------------------------**
** SHARED DATA **
**-----------------------------------------------------**/
-static guint32 *pixel ;
-static guint32 *back ;
-static guint32 *p1,*p2,*tmp;
+static guint32 *pixel;
+static guint32 *back;
+static guint32 *p1, *p2, *tmp;
static guint32 cycle;
guint32 resolx, resoly, buffsize;
-void goom_init (guint32 resx, guint32 resy)
+void
+goom_init (guint32 resx, guint32 resy)
{
#ifdef VERBOSE
- printf ("GOOM: init (%d, %d);\n", resx,resy);
+ printf ("GOOM: init (%d, %d);\n", resx, resy);
#endif
- resolx = resx;
- resoly = resy;
- buffsize = resx * resy;
+ resolx = resx;
+ resoly = resy;
+ buffsize = resx * resy;
- pixel = (guint32 *) malloc (buffsize * sizeof(guint32) + 128);
- back = (guint32 *) malloc (buffsize * sizeof(guint32) + 128);
- RAND_INIT (GPOINTER_TO_INT(pixel));
- cycle = 0 ;
+ pixel = (guint32 *) malloc (buffsize * sizeof (guint32) + 128);
+ back = (guint32 *) malloc (buffsize * sizeof (guint32) + 128);
+ RAND_INIT (GPOINTER_TO_INT (pixel));
+ cycle = 0;
- p1 = (void *)(((unsigned long)pixel + 0x7f)&(~0x7f));
- p2 = (void *)(((unsigned long)back + 0x7f)&(~0x7f));
+ p1 = (void *) (((unsigned long) pixel + 0x7f) & (~0x7f));
+ p2 = (void *) (((unsigned long) back + 0x7f) & (~0x7f));
}
-void goom_set_resolution (guint32 resx, guint32 resy)
+void
+goom_set_resolution (guint32 resx, guint32 resy)
{
- free (pixel);
- free (back);
+ free (pixel);
+ free (back);
- resolx = resx;
- resoly = resy;
- buffsize = resx * resy;
+ resolx = resx;
+ resoly = resy;
+ buffsize = resx * resy;
- pixel = (guint32 *) malloc (buffsize * sizeof(guint32) + 128);
- memset(pixel,0,buffsize * sizeof(guint32) + 128);
- back = (guint32 *) malloc (buffsize * sizeof(guint32) + 128);
- memset(back,0,buffsize * sizeof(guint32) + 128);
+ pixel = (guint32 *) malloc (buffsize * sizeof (guint32) + 128);
+ memset (pixel, 0, buffsize * sizeof (guint32) + 128);
+ back = (guint32 *) malloc (buffsize * sizeof (guint32) + 128);
+ memset (back, 0, buffsize * sizeof (guint32) + 128);
- p1 = (void *)(((unsigned long)pixel + 0x7f)&(~0x7f));
- p2 = (void *)(((unsigned long)back + 0x7f)&(~0x7f));
+ p1 = (void *) (((unsigned long) pixel + 0x7f) & (~0x7f));
+ p2 = (void *) (((unsigned long) back + 0x7f) & (~0x7f));
}
-guint32 * goom_update (gint16 data [2][512])
+guint32 *
+goom_update (gint16 data[2][512])
{
- static int lockvar = 0 ; /* pour empecher de nouveaux changements */
- static int goomvar = 0 ; /* boucle des gooms */
- static int totalgoom = 0 ; /* nombre de gooms par seconds */
- static int agoom = 0 ; /* un goom a eu lieu.. */
- static int loopvar = 0 ; /* mouvement des points */
- static int speedvar = 0 ; /* vitesse des particules */
- static int lineMode = 0 ; /* l'effet lineaire a dessiner */
- guint32 * return_val;
- guint32 pointWidth;
- guint32 pointHeight;
- int incvar ; /* volume du son */
- int accelvar ; /* acceleration des particules */
- int i ;
- float largfactor ; /* elargissement de l'intervalle d'évolution des points */
- static char goomlimit = 2 ; /* sensibilité du goom */
- static ZoomFilterData zfd =
- {
- 128, 8, 16,
- 1, 1, 0, WAVE_MODE,
- 0, 0, 0};
-
- ZoomFilterData *pzfd;
-
- /* test if the config has changed, update it if so */
- pointWidth = (resolx * 2) / 5;
- pointHeight = (resoly * 2) / 5;
-
- /* ! etude du signal ... */
- incvar = 0 ;
- for (i=0;i<512;i++)
- {
- if (incvar < data[0][i]) incvar = data[0][i] ;
- }
+ static int lockvar = 0; /* pour empecher de nouveaux changements */
+ static int goomvar = 0; /* boucle des gooms */
+ static int totalgoom = 0; /* nombre de gooms par seconds */
+ static int agoom = 0; /* un goom a eu lieu.. */
+ static int loopvar = 0; /* mouvement des points */
+ static int speedvar = 0; /* vitesse des particules */
+ static int lineMode = 0; /* l'effet lineaire a dessiner */
+ guint32 *return_val;
+ guint32 pointWidth;
+ guint32 pointHeight;
+ int incvar; /* volume du son */
+ int accelvar; /* acceleration des particules */
+ int i;
+ float largfactor; /* elargissement de l'intervalle d'évolution des points */
+ static char goomlimit = 2; /* sensibilité du goom */
+ static ZoomFilterData zfd = {
+ 128, 8, 16,
+ 1, 1, 0, WAVE_MODE,
+ 0, 0, 0
+ };
+
+ ZoomFilterData *pzfd;
+
+ /* test if the config has changed, update it if so */
+ pointWidth = (resolx * 2) / 5;
+ pointHeight = (resoly * 2) / 5;
+
+ /* ! etude du signal ... */
+ incvar = 0;
+ for (i = 0; i < 512; i++) {
+ if (incvar < data[0][i])
+ incvar = data[0][i];
+ }
- accelvar = incvar / 5000 ;
- if (speedvar>5)
- {
- accelvar-- ;
- if (speedvar>20) accelvar -- ;
- if (speedvar>40) speedvar = 40 ;
- }
- accelvar -- ;
- speedvar += accelvar ;
-
- if (speedvar<0) speedvar=0;
- if (speedvar>40) speedvar = 40 ;
+ accelvar = incvar / 5000;
+ if (speedvar > 5) {
+ accelvar--;
+ if (speedvar > 20)
+ accelvar--;
+ if (speedvar > 40)
+ speedvar = 40;
+ }
+ accelvar--;
+ speedvar += accelvar;
+
+ if (speedvar < 0)
+ speedvar = 0;
+ if (speedvar > 40)
+ speedvar = 40;
/* ! calcul du deplacement des petits points ... */
- largfactor = ((float)speedvar / 40.0f + (float)incvar / 50000.0f) / 1.5f ;
- if (largfactor>1.5f) largfactor = 1.5f ;
-
- for (i = 1 ; i*15 <= speedvar + 15; i ++) {
- loopvar += speedvar + 1 ;
-
- pointFilter(p1,
- YELLOW,
- ((pointWidth - 6.0f) * largfactor + 5.0f),
- ((pointHeight - 6.0f) * largfactor + 5.0f),
- i * 152.0f, 128.0f,
- loopvar + i*2032);
- pointFilter(p1, ORANGE,
- ((pointWidth / 2) * largfactor) / i + 10.0f * i,
- ((pointHeight / 2) * largfactor) / i + 10.0f * i,
- 96.0f, i * 80.0f, loopvar / i);
- pointFilter(p1, VIOLET,
- ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
- ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
- i + 122.0f, 134.0f, loopvar / i);
- pointFilter(p1, BLACK,
- ((pointHeight / 3) * largfactor + 20.0f),
- ((pointHeight / 3) * largfactor + 20.0f),
- 58.0f, i * 66.0f, loopvar / i);
- pointFilter(p1, WHITE,
- (pointHeight * largfactor + 10.0f * i) / i,
- (pointHeight * largfactor + 10.0f * i) / i,
- 66.0f, 74.0f, loopvar + i * 500);
+ largfactor = ((float) speedvar / 40.0f + (float) incvar / 50000.0f) / 1.5f;
+ if (largfactor > 1.5f)
+ largfactor = 1.5f;
+
+ for (i = 1; i * 15 <= speedvar + 15; i++) {
+ loopvar += speedvar + 1;
+
+ pointFilter (p1,
+ YELLOW,
+ ((pointWidth - 6.0f) * largfactor + 5.0f),
+ ((pointHeight - 6.0f) * largfactor + 5.0f),
+ i * 152.0f, 128.0f, loopvar + i * 2032);
+ pointFilter (p1, ORANGE,
+ ((pointWidth / 2) * largfactor) / i + 10.0f * i,
+ ((pointHeight / 2) * largfactor) / i + 10.0f * i,
+ 96.0f, i * 80.0f, loopvar / i);
+ pointFilter (p1, VIOLET,
+ ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
+ ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
+ i + 122.0f, 134.0f, loopvar / i);
+ pointFilter (p1, BLACK,
+ ((pointHeight / 3) * largfactor + 20.0f),
+ ((pointHeight / 3) * largfactor + 20.0f),
+ 58.0f, i * 66.0f, loopvar / i);
+ pointFilter (p1, WHITE,
+ (pointHeight * largfactor + 10.0f * i) / i,
+ (pointHeight * largfactor + 10.0f * i) / i,
+ 66.0f, 74.0f, loopvar + i * 500);
}
- /* par défaut pas de changement de zoom */
- pzfd = NULL ;
-
- /* diminuer de 1 le temps de lockage */
- /* note pour ceux qui n'ont pas suivis : le lockvar permet d'empecher un */
- /* changement d'etat du plugins juste apres un autre changement d'etat. oki ? */
- if (--lockvar < 0) lockvar = 0 ;
-
- /* temps du goom */
- if (--agoom < 0) agoom = 0 ;
-
- /* on verifie qu'il ne se pas un truc interressant avec le son. */
- if ((accelvar>goomlimit) || (accelvar<-goomlimit))
- {
- /* UN GOOM !!! YAHOO ! */
- totalgoom ++ ;
- agoom = 20 ; /* mais pdt 20 cycles, il n'y en aura plus. */
- lineMode = (lineMode + 1)%20; /* Tous les 10 gooms on change de mode lineaire */
-
- /* changement eventuel de mode */
- switch (iRAND(10))
- {
- case 0:
- case 1:
- case 2:
- zfd.mode=WAVE_MODE;
- zfd.vitesse=STOP_SPEED-1;
- zfd.reverse=0;
- break;
- case 3:
- case 4:
- zfd.mode=CRYSTAL_BALL_MODE;
- break;
- case 5:
- zfd.mode=AMULETTE_MODE;
- break;
- case 6:
- zfd.mode = WATER_MODE ;
- break;
- case 7:
- zfd.mode=SCRUNCH_MODE;
- break;
- default:
- zfd.mode=NORMAL_MODE;
- }
+ /* par défaut pas de changement de zoom */
+ pzfd = NULL;
+
+ /* diminuer de 1 le temps de lockage */
+ /* note pour ceux qui n'ont pas suivis : le lockvar permet d'empecher un */
+ /* changement d'etat du plugins juste apres un autre changement d'etat. oki ? */
+ if (--lockvar < 0)
+ lockvar = 0;
+
+ /* temps du goom */
+ if (--agoom < 0)
+ agoom = 0;
+
+ /* on verifie qu'il ne se pas un truc interressant avec le son. */
+ if ((accelvar > goomlimit) || (accelvar < -goomlimit)) {
+ /* UN GOOM !!! YAHOO ! */
+ totalgoom++;
+ agoom = 20; /* mais pdt 20 cycles, il n'y en aura plus. */
+ lineMode = (lineMode + 1) % 20; /* Tous les 10 gooms on change de mode lineaire */
+
+ /* changement eventuel de mode */
+ switch (iRAND (10)) {
+ case 0:
+ case 1:
+ case 2:
+ zfd.mode = WAVE_MODE;
+ zfd.vitesse = STOP_SPEED - 1;
+ zfd.reverse = 0;
+ break;
+ case 3:
+ case 4:
+ zfd.mode = CRYSTAL_BALL_MODE;
+ break;
+ case 5:
+ zfd.mode = AMULETTE_MODE;
+ break;
+ case 6:
+ zfd.mode = WATER_MODE;
+ break;
+ case 7:
+ zfd.mode = SCRUNCH_MODE;
+ break;
+ default:
+ zfd.mode = NORMAL_MODE;
}
+ }
- /* tout ceci ne sera fait qu'en cas de non-blocage */
- if (lockvar == 0)
- {
- /* reperage de goom (acceleration forte de l'acceleration du volume) */
- /* -> coup de boost de la vitesse si besoin.. */
- if ( (accelvar>goomlimit) || (accelvar<-goomlimit) )
- {
- goomvar ++ ;
- /*if (goomvar % 1 == 0) */
- {
- guint32 vtmp ;
- guint32 newvit ;
- newvit = STOP_SPEED - speedvar / 2 ;
- /* retablir le zoom avant.. */
- if ((zfd.reverse) &&
- (!(cycle%12)) &&
- (rand ()%3==0))
- {
- zfd.reverse = 0 ;
- zfd.vitesse = STOP_SPEED - 2 ;
- lockvar = 50 ;
- }
- if (iRAND (10) == 0)
- {
- zfd.reverse = 1;
- lockvar = 100;
- }
-
- /* changement de milieu.. */
- switch (iRAND(20))
- {
- case 0:
- zfd.middleY = resoly - 1 ;
- zfd.middleX = resolx / 2 ;
- break ;
- case 1:
- zfd.middleX = resolx - 1 ;
- break ;
- case 2:
- zfd.middleX = 1 ;
- break ;
- default:
- zfd.middleY = resoly / 2 ;
- zfd.middleX = resolx / 2 ;
- }
-
- if (zfd.mode == WATER_MODE)
- {
- zfd.middleX = resolx / 2;
- zfd.middleY = resoly / 2;
- }
-
- switch (vtmp = (iRAND (27)))
- {
- case 0:
- zfd.vPlaneEffect = iRAND(3);
- zfd.vPlaneEffect -= iRAND(3);
- zfd.hPlaneEffect = iRAND(3);
- zfd.hPlaneEffect -= iRAND(3);
- break;
- case 3:
- zfd.vPlaneEffect = 0 ;
- zfd.hPlaneEffect = iRAND(8);
- zfd.hPlaneEffect -= iRAND(8);
- break;
- case 4:
- case 5:
- case 6:
- case 7:
- zfd.vPlaneEffect = iRAND(5);
- zfd.vPlaneEffect -= iRAND(5);
- zfd.hPlaneEffect = - zfd.vPlaneEffect;
- break;
- case 8:
- zfd.hPlaneEffect = 5 + iRAND (8);
- zfd.vPlaneEffect = - zfd.hPlaneEffect ;
- break;
- case 9:
- zfd.vPlaneEffect = 5 + iRAND (8);
- zfd.hPlaneEffect = - zfd.hPlaneEffect ;
- break;
- case 13:
- zfd.hPlaneEffect = 0;
- zfd.vPlaneEffect = iRAND(10);
- zfd.vPlaneEffect -= iRAND(10);
- break;
- default:
- if (vtmp < 10)
- {
- zfd.vPlaneEffect = 0;
- zfd.hPlaneEffect = 0;
- }
- }
-
- if (iRAND (3) != 0) zfd.noisify = 0 ;
- else
- {
- zfd.noisify = iRAND (3) + 2 ;
- lockvar *= 3;
- }
-
- if (zfd.mode == AMULETTE_MODE)
- {
- zfd.vPlaneEffect = 0;
- zfd.hPlaneEffect = 0;
- zfd.noisify = 0;
- }
-
- if ((zfd.middleX == 1) || (zfd.middleX == resolx - 1))
- {
- zfd.vPlaneEffect = 0 ;
- zfd.hPlaneEffect = iRAND (2) ? 0 : zfd.hPlaneEffect;
- }
-
- if (newvit < zfd.vitesse) /* on accelere */
- {
- pzfd = &zfd;
- if ( ( (newvit < STOP_SPEED - 7) &&
- (zfd.vitesse < STOP_SPEED - 6) &&
- (cycle % 3 == 0)) ||
- (iRAND (40) == 0))
- {
- zfd.vitesse = STOP_SPEED - 1 ;
- zfd.reverse = ! zfd.reverse ;
- }
- else
- {
- zfd.vitesse = (newvit + zfd.vitesse * 4) / 5 ;
- }
- lockvar += 50 ;
- }
- }
- }
- /* mode mega-lent */
- if (iRAND(1000) == 0)
- {
- /*
- printf ("coup du sort...\n") ;
- */
- pzfd = &zfd ;
- zfd.vitesse = STOP_SPEED - 1 ;
- zfd.pertedec = 8 ;
- zfd.sqrtperte = 16 ;
- goomvar = 1 ;
- lockvar += 70 ;
- }
+ /* tout ceci ne sera fait qu'en cas de non-blocage */
+ if (lockvar == 0) {
+ /* reperage de goom (acceleration forte de l'acceleration du volume) */
+ /* -> coup de boost de la vitesse si besoin.. */
+ if ((accelvar > goomlimit) || (accelvar < -goomlimit)) {
+ goomvar++;
+ /*if (goomvar % 1 == 0) */
+ {
+ guint32 vtmp;
+ guint32 newvit;
+
+ newvit = STOP_SPEED - speedvar / 2;
+ /* retablir le zoom avant.. */
+ if ((zfd.reverse) && (!(cycle % 12)) && (rand () % 3 == 0)) {
+ zfd.reverse = 0;
+ zfd.vitesse = STOP_SPEED - 2;
+ lockvar = 50;
}
-
- /* gros frein si la musique est calme */
- if ((speedvar < 1) && (zfd.vitesse < STOP_SPEED - 4) && (cycle % 16 == 0))
- {
- /*
- printf ("++slow part... %i\n", zfd.vitesse) ;
- */
- pzfd = &zfd ;
- zfd.vitesse += 3 ;
- zfd.pertedec = 8 ;
- zfd.sqrtperte = 16 ;
- goomvar = 0 ;
- /*
- printf ("--slow part... %i\n", zfd.vitesse) ;
- */
+ if (iRAND (10) == 0) {
+ zfd.reverse = 1;
+ lockvar = 100;
}
-
- /* baisser regulierement la vitesse... */
- if ( (cycle % 73 == 0) && (zfd.vitesse < STOP_SPEED - 5))
- {
- /*
- printf ("slow down...\n") ;
- */
- pzfd = &zfd ;
- zfd.vitesse ++ ;
+
+ /* changement de milieu.. */
+ switch (iRAND (20)) {
+ case 0:
+ zfd.middleY = resoly - 1;
+ zfd.middleX = resolx / 2;
+ break;
+ case 1:
+ zfd.middleX = resolx - 1;
+ break;
+ case 2:
+ zfd.middleX = 1;
+ break;
+ default:
+ zfd.middleY = resoly / 2;
+ zfd.middleX = resolx / 2;
}
-
- /* arreter de decrémenter au bout d'un certain temps */
- if ((cycle % 101 == 0) && (zfd.pertedec == 7))
- {
- pzfd = &zfd ;
- zfd.pertedec=8 ;
- zfd.sqrtperte=16 ;
+
+ if (zfd.mode == WATER_MODE) {
+ zfd.middleX = resolx / 2;
+ zfd.middleY = resoly / 2;
}
-
-#ifdef VERBOSE
- if (pzfd)
- {
- printf ("GOOM: pzfd->mode = %d\n", pzfd->mode);
+
+ switch (vtmp = (iRAND (27))) {
+ case 0:
+ zfd.vPlaneEffect = iRAND (3);
+ zfd.vPlaneEffect -= iRAND (3);
+ zfd.hPlaneEffect = iRAND (3);
+ zfd.hPlaneEffect -= iRAND (3);
+ break;
+ case 3:
+ zfd.vPlaneEffect = 0;
+ zfd.hPlaneEffect = iRAND (8);
+ zfd.hPlaneEffect -= iRAND (8);
+ break;
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ zfd.vPlaneEffect = iRAND (5);
+ zfd.vPlaneEffect -= iRAND (5);
+ zfd.hPlaneEffect = -zfd.vPlaneEffect;
+ break;
+ case 8:
+ zfd.hPlaneEffect = 5 + iRAND (8);
+ zfd.vPlaneEffect = -zfd.hPlaneEffect;
+ break;
+ case 9:
+ zfd.vPlaneEffect = 5 + iRAND (8);
+ zfd.hPlaneEffect = -zfd.hPlaneEffect;
+ break;
+ case 13:
+ zfd.hPlaneEffect = 0;
+ zfd.vPlaneEffect = iRAND (10);
+ zfd.vPlaneEffect -= iRAND (10);
+ break;
+ default:
+ if (vtmp < 10) {
+ zfd.vPlaneEffect = 0;
+ zfd.hPlaneEffect = 0;
+ }
+ }
+
+ if (iRAND (3) != 0)
+ zfd.noisify = 0;
+ else {
+ zfd.noisify = iRAND (3) + 2;
+ lockvar *= 3;
+ }
+
+ if (zfd.mode == AMULETTE_MODE) {
+ zfd.vPlaneEffect = 0;
+ zfd.hPlaneEffect = 0;
+ zfd.noisify = 0;
+ }
+
+ if ((zfd.middleX == 1) || (zfd.middleX == resolx - 1)) {
+ zfd.vPlaneEffect = 0;
+ zfd.hPlaneEffect = iRAND (2) ? 0 : zfd.hPlaneEffect;
+ }
+
+ if (newvit < zfd.vitesse) { /* on accelere */
+ pzfd = &zfd;
+ if (((newvit < STOP_SPEED - 7) &&
+ (zfd.vitesse < STOP_SPEED - 6) &&
+ (cycle % 3 == 0)) || (iRAND (40) == 0)) {
+ zfd.vitesse = STOP_SPEED - 1;
+ zfd.reverse = !zfd.reverse;
+ } else {
+ zfd.vitesse = (newvit + zfd.vitesse * 4) / 5;
+ }
+ lockvar += 50;
}
+ }
+ }
+ /* mode mega-lent */
+ if (iRAND (1000) == 0) {
+ /*
+ printf ("coup du sort...\n") ;
+ */
+ pzfd = &zfd;
+ zfd.vitesse = STOP_SPEED - 1;
+ zfd.pertedec = 8;
+ zfd.sqrtperte = 16;
+ goomvar = 1;
+ lockvar += 70;
+ }
+ }
+
+ /* gros frein si la musique est calme */
+ if ((speedvar < 1) && (zfd.vitesse < STOP_SPEED - 4) && (cycle % 16 == 0)) {
+ /*
+ printf ("++slow part... %i\n", zfd.vitesse) ;
+ */
+ pzfd = &zfd;
+ zfd.vitesse += 3;
+ zfd.pertedec = 8;
+ zfd.sqrtperte = 16;
+ goomvar = 0;
+ /*
+ printf ("--slow part... %i\n", zfd.vitesse) ;
+ */
+ }
+
+ /* baisser regulierement la vitesse... */
+ if ((cycle % 73 == 0) && (zfd.vitesse < STOP_SPEED - 5)) {
+ /*
+ printf ("slow down...\n") ;
+ */
+ pzfd = &zfd;
+ zfd.vitesse++;
+ }
+
+ /* arreter de decrémenter au bout d'un certain temps */
+ if ((cycle % 101 == 0) && (zfd.pertedec == 7)) {
+ pzfd = &zfd;
+ zfd.pertedec = 8;
+ zfd.sqrtperte = 16;
+ }
+#ifdef VERBOSE
+ if (pzfd) {
+ printf ("GOOM: pzfd->mode = %d\n", pzfd->mode);
+ }
#endif
- /* Zoom here ! */
- zoomFilterFastRGB (p1, p2, pzfd, resolx, resoly) ;
-
- /* si on est dans un goom : afficher les lignes... */
- if (agoom > 15) goom_lines
- (data,
- ((zfd.middleX==resolx/2) && (zfd.middleY==resoly/2) && (zfd.mode!=WATER_MODE))
- ? (lineMode/10) : 0,
- p2,agoom-15);
-
- return_val = p2 ;
- tmp=p1;
- p1=p2;
- p2=tmp;
-
- /* affichage et swappage des buffers.. */
- cycle++;
-
- /* tous les 100 cycles : vérifier si le taux de goom est correct */
- /* et le modifier sinon.. */
- if (!(cycle%100))
- {
- if (totalgoom>15)
- {
- /* printf ("less gooms\n") ; */
- goomlimit ++ ;
- }
- else
- {
- if ((totalgoom==0) && (goomlimit>1))
- goomlimit -- ;
- }
- totalgoom = 0 ;
+ /* Zoom here ! */
+ zoomFilterFastRGB (p1, p2, pzfd, resolx, resoly);
+
+ /* si on est dans un goom : afficher les lignes... */
+ if (agoom > 15)
+ goom_lines
+ (data, ((zfd.middleX == resolx / 2) && (zfd.middleY == resoly / 2)
+ && (zfd.mode != WATER_MODE))
+ ? (lineMode / 10) : 0, p2, agoom - 15);
+
+ return_val = p2;
+ tmp = p1;
+ p1 = p2;
+ p2 = tmp;
+
+ /* affichage et swappage des buffers.. */
+ cycle++;
+
+ /* tous les 100 cycles : vérifier si le taux de goom est correct */
+ /* et le modifier sinon.. */
+ if (!(cycle % 100)) {
+ if (totalgoom > 15) {
+ /* printf ("less gooms\n") ; */
+ goomlimit++;
+ } else {
+ if ((totalgoom == 0) && (goomlimit > 1))
+ goomlimit--;
}
- return return_val;
+ totalgoom = 0;
+ }
+ return return_val;
}
-void goom_close ()
+void
+goom_close ()
{
- if (pixel!=NULL) free (pixel) ;
- if (back!=NULL) free (back) ;
- pixel = back = NULL;
- RAND_CLOSE();
+ if (pixel != NULL)
+ free (pixel);
+ if (back != NULL)
+ free (back);
+ pixel = back = NULL;
+ RAND_CLOSE ();
}
diff --git a/gst/goom/goom_core.h b/gst/goom/goom_core.h
index 15f942d2..3751b522 100644
--- a/gst/goom/goom_core.h
+++ b/gst/goom/goom_core.h
@@ -6,7 +6,7 @@
void goom_init (guint32 resx, guint32 resy);
void goom_set_resolution (guint32 resx, guint32 resy);
-guint32 * goom_update (gint16 data [2][512]);
+guint32 *goom_update (gint16 data[2][512]);
void goom_close ();
diff --git a/gst/goom/goom_tools.h b/gst/goom/goom_tools.h
index e3613825..5159cf91 100644
--- a/gst/goom/goom_tools.h
+++ b/gst/goom/goom_tools.h
@@ -4,8 +4,8 @@
#define NB_RAND 0x10000
/* in graphic.c */
-extern int * rand_tab ;
-extern unsigned short rand_pos ;
+extern int *rand_tab;
+extern unsigned short rand_pos;
#define RAND_INIT(i) \
srand (i) ;\
@@ -25,5 +25,5 @@ extern unsigned short rand_pos ;
/*#define iRAND(i) ((guint32)((float)i * RAND()/RAND_MAX)) */
#define iRAND(i) (RAND()%i)
-
+
#endif
diff --git a/gst/goom/graphic.c b/gst/goom/graphic.c
index cd24d49f..33fff165 100644
--- a/gst/goom/graphic.c
+++ b/gst/goom/graphic.c
@@ -4,18 +4,18 @@
#include "graphic.h"
-const Color BLACK = {0,0,0} ;
-const Color WHITE = {0xff,0xff,0xff} ;
-const Color RED = {0xff,0,0} ;
-const Color GREEN = {0,0xff,0} ;
-const Color BLUE = {0,0,0xff} ;
-const Color YELLOW = {0xff, 0xff, 0x33} ;
-const Color ORANGE = {0xff, 0xcc, 0x00} ;
-const Color VIOLET = {0x55, 0x00, 0xff} ;
+const Color BLACK = { 0, 0, 0 };
+const Color WHITE = { 0xff, 0xff, 0xff };
+const Color RED = { 0xff, 0, 0 };
+const Color GREEN = { 0, 0xff, 0 };
+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 ;
+unsigned int SIZE;
+unsigned int HEIGHT;
+unsigned int WIDTH;
-int * rand_tab = 0 ;
-unsigned short int rand_pos = 0 ;
+int *rand_tab = 0;
+unsigned short int rand_pos = 0;
diff --git a/gst/goom/graphic.h b/gst/goom/graphic.h
index 415dde73..1af1030a 100644
--- a/gst/goom/graphic.h
+++ b/gst/goom/graphic.h
@@ -5,7 +5,7 @@ typedef unsigned int Uint;
typedef struct
{
- unsigned short r,v,b;
+ unsigned short r, v, b;
}
Color;
@@ -18,7 +18,7 @@ extern const Color YELLOW;
extern const Color ORANGE;
extern const Color VIOLET;
-inline void setPixelRGB (Uint *buffer, Uint x, Uint y, Color c) ;
-inline void getPixelRGB (Uint *buffer, Uint x, Uint y, Color *c) ;
+inline void setPixelRGB (Uint * buffer, Uint x, Uint y, Color c);
+inline void getPixelRGB (Uint * buffer, Uint x, Uint y, Color * c);
-#endif /*GRAPHIC_H*/
+#endif /*GRAPHIC_H */
diff --git a/gst/goom/gstgoom.c b/gst/goom/gstgoom.c
index 35d5e098..b5ad63a5 100644
--- a/gst/goom/gstgoom.c
+++ b/gst/goom/gstgoom.c
@@ -34,11 +34,12 @@
typedef struct _GstGOOM GstGOOM;
typedef struct _GstGOOMClass GstGOOMClass;
-struct _GstGOOM {
+struct _GstGOOM
+{
GstElement element;
/* pads */
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
/* the timestamp of the next frame */
guint64 next_time;
@@ -52,11 +53,12 @@ struct _GstGOOM {
gboolean srcnegotiated;
};
-struct _GstGOOMClass {
+struct _GstGOOMClass
+{
GstElementClass parent_class;
};
-GType gst_goom_get_type(void);
+GType gst_goom_get_type (void);
/* elementfactory information */
@@ -68,53 +70,50 @@ static GstElementDetails gst_goom_details = {
};
/* signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
/* FILL ME */
};
-static GstStaticPadTemplate src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ( GST_VIDEO_CAPS_xRGB_HOST_ENDIAN )
-);
-
-static GstStaticPadTemplate sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink", /* the name of the pads */
- GST_PAD_SINK, /* type of the pad */
- GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
- GST_STATIC_CAPS ( "audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) TRUE, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 8000, 96000 ], "
- "channels = (int) [ 1, 2 ]"
- )
-);
-
-
-static void gst_goom_class_init (GstGOOMClass *klass);
-static void gst_goom_base_init (GstGOOMClass *klass);
-static void gst_goom_init (GstGOOM *goom);
-static void gst_goom_dispose (GObject *object);
+static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN)
+ );
-static GstElementStateReturn
- gst_goom_change_state (GstElement *element);
+static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", /* the name of the pads */
+ GST_PAD_SINK, /* type of the pad */
+ GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]")
+ );
+
+
+static void gst_goom_class_init (GstGOOMClass * klass);
+static void gst_goom_base_init (GstGOOMClass * klass);
+static void gst_goom_init (GstGOOM * goom);
+static void gst_goom_dispose (GObject * object);
-static void gst_goom_chain (GstPad *pad, GstData *_data);
+static GstElementStateReturn gst_goom_change_state (GstElement * element);
-static GstPadLinkReturn gst_goom_sinkconnect (GstPad *pad, const GstCaps *caps);
-static GstPadLinkReturn gst_goom_srcconnect (GstPad *pad, const GstCaps *caps);
-static GstCaps * gst_goom_src_fixate (GstPad *pad, const GstCaps *caps);
+static void gst_goom_chain (GstPad * pad, GstData * _data);
+
+static GstPadLinkReturn gst_goom_sinkconnect (GstPad * pad,
+ const GstCaps * caps);
+static GstPadLinkReturn gst_goom_srcconnect (GstPad * pad,
+ const GstCaps * caps);
+static GstCaps *gst_goom_src_fixate (GstPad * pad, const GstCaps * caps);
static GstElementClass *parent_class = NULL;
@@ -125,9 +124,9 @@ gst_goom_get_type (void)
if (!type) {
static const GTypeInfo info = {
- sizeof (GstGOOMClass),
- (GBaseInitFunc) gst_goom_base_init,
- NULL,
+ sizeof (GstGOOMClass),
+ (GBaseInitFunc) gst_goom_base_init,
+ NULL,
(GClassInitFunc) gst_goom_class_init,
NULL,
NULL,
@@ -141,41 +140,43 @@ gst_goom_get_type (void)
}
static void
-gst_goom_base_init (GstGOOMClass *klass)
+gst_goom_base_init (GstGOOMClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_set_details (element_class, &gst_goom_details);
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_template));
+ gst_static_pad_template_get (&sink_template));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_template));
+ gst_static_pad_template_get (&src_template));
}
static void
-gst_goom_class_init(GstGOOMClass *klass)
+gst_goom_class_init (GstGOOMClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*) klass;
- gstelement_class = (GstElementClass*) klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- gobject_class->dispose = gst_goom_dispose;
+ gobject_class->dispose = gst_goom_dispose;
gstelement_class->change_state = gst_goom_change_state;
}
static void
-gst_goom_init (GstGOOM *goom)
+gst_goom_init (GstGOOM * goom)
{
/* create the sink and src pads */
- goom->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&sink_template ), "sink");
- goom->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&src_template ), "src");
+ goom->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&sink_template),
+ "sink");
+ goom->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&src_template),
+ "src");
gst_element_add_pad (GST_ELEMENT (goom), goom->sinkpad);
gst_element_add_pad (GST_ELEMENT (goom), goom->srcpad);
@@ -189,22 +190,22 @@ gst_goom_init (GstGOOM *goom)
goom->width = 320;
goom->height = 200;
- goom->fps = 25.; /* desired frame rate */
+ goom->fps = 25.; /* desired frame rate */
goom->channels = 0;
/* set to something */
goom_init (50, 50);
}
static void
-gst_goom_dispose (GObject *object)
+gst_goom_dispose (GObject * object)
{
goom_close ();
-
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static GstPadLinkReturn
-gst_goom_sinkconnect (GstPad *pad, const GstCaps *caps)
+gst_goom_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstGOOM *goom;
GstStructure *structure;
@@ -219,7 +220,7 @@ gst_goom_sinkconnect (GstPad *pad, const GstCaps *caps)
}
static GstPadLinkReturn
-gst_goom_srcconnect (GstPad *pad, const GstCaps *caps)
+gst_goom_srcconnect (GstPad * pad, const GstCaps * caps)
{
GstGOOM *goom;
GstStructure *structure;
@@ -239,12 +240,13 @@ gst_goom_srcconnect (GstPad *pad, const GstCaps *caps)
}
static GstCaps *
-gst_goom_src_fixate (GstPad *pad, const GstCaps *caps)
+gst_goom_src_fixate (GstPad * pad, const GstCaps * caps)
{
GstCaps *newcaps;
GstStructure *structure;
- if (!gst_caps_is_simple (caps)) return NULL;
+ if (!gst_caps_is_simple (caps))
+ return NULL;
newcaps = gst_caps_copy (caps);
structure = gst_caps_get_structure (newcaps, 0);
@@ -256,7 +258,7 @@ gst_goom_src_fixate (GstPad *pad, const GstCaps *caps)
return newcaps;
}
if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
- 30.0)) {
+ 30.0)) {
return newcaps;
}
@@ -266,7 +268,7 @@ gst_goom_src_fixate (GstPad *pad, const GstCaps *caps)
}
static void
-gst_goom_chain (GstPad *pad, GstData *_data)
+gst_goom_chain (GstPad * pad, GstData * _data)
{
GstBuffer *bufin = GST_BUFFER (_data);
GstGOOM *goom;
@@ -289,7 +291,7 @@ gst_goom_chain (GstPad *pad, GstData *_data)
gst_event_discont_get_value (event, GST_FORMAT_TIME, &value);
- goom->next_time = value;
+ goom->next_time = value;
}
default:
gst_pad_event_default (pad, event);
@@ -300,7 +302,7 @@ gst_goom_chain (GstPad *pad, GstData *_data)
if (goom->channels == 0) {
GST_ELEMENT_ERROR (goom, CORE, NEGOTIATION, (NULL),
- ("format wasn't negotiated before chain function"));
+ ("format wasn't negotiated before chain function"));
goto done;
}
@@ -318,13 +320,12 @@ gst_goom_chain (GstPad *pad, GstData *_data)
data = (gint16 *) GST_BUFFER_DATA (bufin);
if (goom->channels == 2) {
- for (i=0; i < 512; i++) {
+ for (i = 0; i < 512; i++) {
goom->datain[0][i] = *data++;
goom->datain[1][i] = *data++;
}
- }
- else {
- for (i=0; i < 512; i++) {
+ } else {
+ for (i = 0; i < 512; i++) {
goom->datain[0][i] = *data;
goom->datain[1][i] = *data++;
}
@@ -347,15 +348,15 @@ done:
}
static GstElementStateReturn
-gst_goom_change_state (GstElement *element)
-{
+gst_goom_change_state (GstElement * element)
+{
GstGOOM *goom = GST_GOOM (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
break;
case GST_STATE_READY_TO_NULL:
- break;
+ break;
case GST_STATE_READY_TO_PAUSED:
goom->next_time = 0;
goom->srcnegotiated = FALSE;
@@ -374,20 +375,13 @@ gst_goom_change_state (GstElement *element)
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- return gst_element_register (plugin, "goom",
- GST_RANK_NONE, GST_TYPE_GOOM);
+ return gst_element_register (plugin, "goom", GST_RANK_NONE, GST_TYPE_GOOM);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "goom",
- "GOOM visualization filter",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "goom",
+ "GOOM visualization filter",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
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;
}
+ }
}
-
diff --git a/gst/goom/lines.h b/gst/goom/lines.h
index 3582d380..988605ee 100644
--- a/gst/goom/lines.h
+++ b/gst/goom/lines.h
@@ -10,6 +10,6 @@
#include "graphic.h"
-void goom_lines(gint16 data [2][512], unsigned int ID,unsigned int* p, guint32 power);
-void goom_lines_conf(gint16 config [25]);
-
+void goom_lines (gint16 data[2][512], unsigned int ID, unsigned int *p,
+ guint32 power);
+void goom_lines_conf (gint16 config[25]);