summaryrefslogtreecommitdiff
path: root/src/post
diff options
context:
space:
mode:
Diffstat (limited to 'src/post')
-rw-r--r--src/post/goom/Makefile.am21
-rw-r--r--src/post/goom/drawmethods.h212
-rw-r--r--src/post/goom/filters.c461
-rw-r--r--src/post/goom/filters.h9
-rw-r--r--src/post/goom/goom_config.h2
-rw-r--r--src/post/goom/goom_core.c556
-rw-r--r--src/post/goom/goom_core.h13
-rw-r--r--src/post/goom/goom_tools.h20
-rw-r--r--src/post/goom/graphic.c15
-rw-r--r--src/post/goom/ifs.c81
-rw-r--r--src/post/goom/ifs.h10
-rw-r--r--src/post/goom/ifs_display.c168
-rw-r--r--src/post/goom/lines.c297
-rw-r--r--src/post/goom/lines.h18
-rw-r--r--src/post/goom/xine_goom.c42
-rw-r--r--src/post/goom/zoom_filter_mmx.c6
16 files changed, 1094 insertions, 837 deletions
diff --git a/src/post/goom/Makefile.am b/src/post/goom/Makefile.am
index 1d35308b5..366eaeade 100644
--- a/src/post/goom/Makefile.am
+++ b/src/post/goom/Makefile.am
@@ -1,6 +1,6 @@
include $(top_srcdir)/misc/Makefile.common
-EXTRA_DIST = zoom_filter_mmx.c ppc_zoom_ultimate.s
+EXTRA_DIST = zoom_filter_mmx.c zoom_filter_xmmx.c ppc_zoom_ultimate.s
## -fomit-frame-pointer segfaults here
CFLAGS = `echo @CFLAGS@ | sed -e 's/-fomit-frame-pointer//g'`
@@ -14,18 +14,21 @@ if PPC_ARCH
else
## only compile if MMX is supported.
if HAVE_FFMMX
- extra_files = zoom_filter_mmx.c
+ extra_files = zoom_filter_mmx.c zoom_filter_xmmx.c
endif
endif
xineplug_post_goom_la_SOURCES = xine_goom.c \
- goom_core.c goom_core.h \
- goom_tools.h goom_config.h \
- filters.c filters.h \
- lines.c lines.h \
- ifs_display.c ifs.c ifs.h \
- graphic.c graphic.h \
- drawmethods.h $(extra_files)
+ goom_core.c \
+ filters.c \
+ lines.c \
+ ifs_display.c ifs.c \
+ graphic.c \
+ gfontlib.c \
+ gfontrle.c \
+ surf3d.c surface.c \
+ tentacle3d.c \
+ $(extra_files)
xineplug_post_goom_la_LIBADD = $(XINE_LIB)
xineplug_post_goom_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@
diff --git a/src/post/goom/drawmethods.h b/src/post/goom/drawmethods.h
index 4ad83b047..408dbc2c5 100644
--- a/src/post/goom/drawmethods.h
+++ b/src/post/goom/drawmethods.h
@@ -1,17 +1,27 @@
#ifndef _DRAWMETHODS_H
#define _DRAWMETHODS_H
-#include "goom_config.h"
+#include "config.h"
#define DRAWMETHOD_NORMAL(adr,col) {*(adr) = (col);}
-/* #ifdef MMX */
-#if 0
+#ifdef HAVE_MMX
+#include "mmx.h"
+
#define DRAWMETHOD_PLUS(_out,_backbuf,_col) \
{\
+movd_m2r (_backbuf, mm0); \
+paddusb_m2r (_col, mm0); \
+movd_r2m (mm0, _out); \
+}
+
+/*
+paddusb (_out
__asm__ ("movd %%eax,%%mm0\n movd %%edx,%%mm1\n paddusb %%mm1,%%mm0\n movd %%mm0,%%eax"\
:"=eax"(_out):"eax"(_backbuf),"edx"(_col));\
}
+*/
+
#else
#define DRAWMETHOD_PLUS(_out,_backbuf,_col) \
{\
@@ -31,11 +41,203 @@ __asm__ ("movd %%eax,%%mm0\n movd %%edx,%%mm1\n paddusb %%mm1,%%mm0\n movd %%mm
#define DRAWMETHOD_OR(adr,col) {*(adr)|=(col);}
-/* #ifdef MMX */
-#if 0
+#ifdef HAVE_MMX
#define DRAWMETHOD_DONE() {__asm__ __volatile__ ("emms");}
#else
#define DRAWMETHOD_DONE() {}
#endif
+#ifndef DRAWMETHOD
+#define DRAWMETHOD DRAWMETHOD_PLUS(*p,*p,col)
+//#define DRAWMETHOD *p=col
+
+static void
+inline draw_line (int *data, int x1, int y1, int x2, int y2, int col, int screenx,
+ int screeny)
+{
+ int x, y, dx, dy, yy, xx;// am, tmp;
+ int *p;
+
+// DATA32 *p;
+// DATA8 aaa, nr, ng, nb, rr, gg, bb, aa, na;
+
+ if ((y1 < 0) || (y2 < 0) || (x1 < 0) || (x2 < 0) || (y1 >= screeny) || (y2 >= screeny) || (x1 >= screenx) || (x2 >= screenx)) return;
+
+ /* clip to top edge
+ if ((y1 < 0) && (y2 < 0))
+ return;
+
+ if (y1 < 0) {
+ x1 += (y1 * (x1 - x2)) / (y2 - y1);
+ y1 = 0;
+ }
+ if (y2 < 0) {
+ x2 += (y2 * (x1 - x2)) / (y2 - y1);
+ y2 = 0;
+ }
+
+ /* clip to bottom edge
+ if ((y1 >= screeny) && (y2 >= screeny))
+ return;
+ if (y1 >= screeny) {
+ x1 -= ((screeny - y1) * (x1 - x2)) / (y2 - y1);
+ y1 = screeny - 1;
+ }
+ if (y2 >= screeny) {
+ x2 -= ((screeny - y2) * (x1 - x2)) / (y2 - y1);
+ y2 = screeny - 1;
+ }
+ /* clip to left edge
+ if ((x1 < 0) && (x2 < 0))
+ return;
+ if (x1 < 0) {
+ y1 += (x1 * (y1 - y2)) / (x2 - x1);
+ x1 = 0;
+ }
+ if (x2 < 0) {
+ y2 += (x2 * (y1 - y2)) / (x2 - x1);
+ x2 = 0;
+ }
+ /* clip to right edge
+ if ((x1 >= screenx) && (x2 >= screenx))
+ return;
+ if (x1 >= screenx) {
+ y1 -= ((screenx - x1) * (y1 - y2)) / (x2 - x1);
+ x1 = screenx - 1;
+ }
+ if (x2 >= screenx) {
+ y2 -= ((screenx - x2) * (y1 - y2)) / (x2 - x1);
+ x2 = screenx - 1;
+ }
+ */
+ dx = x2 - x1;
+ dy = y2 - y1;
+ if (x1 > x2) {
+ int tmp;
+
+ tmp = x1;
+ x1 = x2;
+ x2 = tmp;
+ tmp = y1;
+ y1 = y2;
+ y2 = tmp;
+ dx = x2 - x1;
+ dy = y2 - y1;
+ }
+
+ /* vertical line */
+ if (dx == 0) {
+ if (y1 < y2) {
+ p = &(data[(screenx * y1) + x1]);
+ for (y = y1; y <= y2; y++) {
+ DRAWMETHOD;
+ p += screenx;
+ }
+ }
+ else {
+ p = &(data[(screenx * y2) + x1]);
+ for (y = y2; y <= y1; y++) {
+ DRAWMETHOD;
+ p += screenx;
+ }
+ }
+ return;
+ }
+ /* horizontal line */
+ if (dy == 0) {
+ if (x1 < x2) {
+ p = &(data[(screenx * y1) + x1]);
+ for (x = x1; x <= x2; x++) {
+ DRAWMETHOD;
+ p++;
+ }
+ return;
+ }
+ else {
+ p = &(data[(screenx * y1) + x2]);
+ for (x = x2; x <= x1; x++) {
+ DRAWMETHOD;
+ p++;
+ }
+ return;
+ }
+ }
+ /* 1 */
+ /* \ */
+ /* \ */
+ /* 2 */
+ if (y2 > y1) {
+ /* steep */
+ if (dy > dx) {
+ dx = ((dx << 16) / dy);
+ x = x1 << 16;
+ for (y = y1; y <= y2; y++) {
+ xx = x >> 16;
+ p = &(data[(screenx * y) + xx]);
+ DRAWMETHOD;
+ if (xx < (screenx - 1)) {
+ p++;
+// DRAWMETHOD;
+ }
+ x += dx;
+ }
+ return;
+ }
+ /* shallow */
+ else {
+ dy = ((dy << 16) / dx);
+ y = y1 << 16;
+ for (x = x1; x <= x2; x++) {
+ yy = y >> 16;
+ p = &(data[(screenx * yy) + x]);
+ DRAWMETHOD;
+ if (yy < (screeny - 1)) {
+ p += screeny;
+// DRAWMETHOD;
+ }
+ y += dy;
+ }
+ }
+ }
+ /* 2 */
+ /* / */
+ /* / */
+ /* 1 */
+ else {
+ /* steep */
+ if (-dy > dx) {
+ dx = ((dx << 16) / -dy);
+ x = (x1 + 1) << 16;
+ for (y = y1; y >= y2; y--) {
+ xx = x >> 16;
+ p = &(data[(screenx * y) + xx]);
+ DRAWMETHOD;
+ if (xx < (screenx - 1)) {
+ p--;
+// DRAWMETHOD;
+ }
+ x += dx;
+ }
+ return;
+ }
+ /* shallow */
+ else {
+ dy = ((dy << 16) / dx);
+ y = y1 << 16;
+ for (x = x1; x <= x2; x++) {
+ yy = y >> 16;
+ p = &(data[(screenx * yy) + x]);
+ DRAWMETHOD;
+ if (yy < (screeny - 1)) {
+ p += screeny;
+// DRAWMETHOD;
+ }
+ y += dy;
+ }
+ return;
+ }
+ }
+}
+#endif
+
#endif
diff --git a/src/post/goom/filters.c b/src/post/goom/filters.c
index 4628bc0aa..6c1774b51 100644
--- a/src/post/goom/filters.c
+++ b/src/post/goom/filters.c
@@ -10,7 +10,7 @@
* la vitesse est maintenant comprise dans [0..128] au lieu de [0..100]
*/
-/* #define _DEBUG_PIXEL; */
+//#define _DEBUG_PIXEL;
#include "filters.h"
#include "graphic.h"
@@ -19,7 +19,7 @@
#include <math.h>
#include <stdio.h>
-#ifdef MMX
+#ifdef HAVE_MMX
#define USE_ASM
#endif
#ifdef POWERPC
@@ -27,16 +27,49 @@
#endif
#define EFFECT_DISTORS 4
-
+#define EFFECT_DISTORS_SL 2
extern volatile guint32 resolx;
extern volatile guint32 c_resoly;
-extern volatile int use_asm;
+void c_zoom (unsigned int *expix1, unsigned int *expix2, unsigned int prevX, unsigned int prevY, signed int *brutS, signed int *brutD);
+
+#ifdef HAVE_MMX
+//#include "mmx.h"
+
+void zoom_filter_xmmx (int prevX, int prevY,
+ unsigned int *expix1, unsigned int *expix2,
+ int *brutS, int *brutD, int buffratio,
+ int precalCoef[16][16]);
+int zoom_filter_xmmx_supported ();
+
+void zoom_filter_mmx (int prevX, int prevY,
+ unsigned int *expix1, unsigned int *expix2,
+ int *brutS, int *brutD, int buffratio,
+ int precalCoef[16][16]);
+int zoom_filter_mmx_supported ();
+
+static int zf_use_xmmx = 0;
+static int zf_use_mmx = 0;
+
+static void select_zoom_filter () {
+ static int firsttime = 1;
+ if (firsttime){
+ if (zoom_filter_xmmx_supported()) {
+ zf_use_xmmx = 1;
+ printf ("Extented MMX detected. Using the fastest method !\n");
+ }
+ else if (zoom_filter_mmx_supported()) {
+ zf_use_mmx = 1;
+ printf ("MMX detected. Using fast method !\n");
+ }
+ else {
+ printf ("Too bad ! No MMX detected.\n");
+ }
+ firsttime = 0;
+ }
+}
-#ifdef MMX
-/*int mmx_zoom () ;*/
-#include "zoom_filter_mmx.h"
#endif /* MMX */
@@ -45,35 +78,31 @@ guint32 mmx_zoom_size;
#ifdef USE_ASM
#ifdef POWERPC
-/* extern unsigned int useAltivec; */
-extern void ppc_zoom (unsigned int *frompixmap, unsigned int *topixmap,
- unsigned int sizex, unsigned int sizey,
- unsigned int *brutS, unsigned int *brutD,
-
- unsigned int buffratio);
-/* extern void ppc_zoom_altivec (void); */
+#include "altivec.h"
+extern unsigned int useAltivec;
+extern const void ppc_zoom (unsigned int *frompixmap, unsigned int *topixmap, unsigned int sizex, unsigned int sizey, unsigned int *brutS, unsigned int *brutD, unsigned int buffratio, int precalCoef[16][16]);
-/*extern void ppc_zoom(void);*/
-unsigned int ppcsize4;
#endif /* PowerPC */
#endif /* ASM */
-/* A VIRER */
-unsigned int *coeffs = 0, *freecoeffs = 0; /* ne sont plus utilisé */
+unsigned int *coeffs = 0, *freecoeffs = 0;
-signed int *brutS = 0, *freebrutS = 0; /* source */
-signed int *brutD = 0, *freebrutD = 0; /* dest */
-signed int *brutT = 0, *freebrutT = 0; /* temp (en cours de génération) */
+signed int *brutS = 0, *freebrutS = 0; // source
+signed int *brutD = 0, *freebrutD = 0; // dest
+signed int *brutT = 0, *freebrutT = 0; // temp (en cours de génération)
+
+// TODO : virer
+guint32 *expix1 = 0; // pointeur exporte vers p1
+guint32 *expix2 = 0; // pointeur exporte vers p2
+// fin TODO
-guint32 *expix1 = 0; /* pointeur exporte vers p1 */
-guint32 *expix2 = 0; /* pointeur exporte vers p2 */
guint32 zoom_width;
-int prevX = 0, prevY = 0;
+unsigned int prevX = 0, prevY = 0;
-static int sintable[0xffff];
+static int sintable[0x10000];
static int vitesse = 127;
static char theMode = AMULETTE_MODE;
static int waveEffect = 0;
@@ -83,10 +112,10 @@ static int hPlaneEffect = 0;
static char noisify = 2;
static int middleX, middleY;
-/*static unsigned char sqrtperte = 16 ; */
+//static unsigned char sqrtperte = 16 ;
/** modif by jeko : fixedpoint : buffration = (16:16) (donc 0<=buffration<=2^16) */
-/*static int buffratio = 0; */
+//static int buffratio = 0;
int buffratio = 0;
#define BUFFPOINTNB 16
@@ -94,28 +123,22 @@ int buffratio = 0;
#define BUFFINCR 0xff
#define sqrtperte 16
-/* faire : a % sqrtperte <=> a & pertemask */
+// faire : a % sqrtperte <=> a & pertemask
#define PERTEMASK 0xf
-/* faire : a / sqrtperte <=> a >> PERTEDEC */
+// faire : a / sqrtperte <=> a >> PERTEDEC
#define PERTEDEC 4
static int *firedec = 0;
-/* retourne x>>s , en testant le signe de x */
-static int ShiftRight (int x, const unsigned char s)
-{
- if (x < 0)
- return -(-x >> s);
- else
- return x >> s;
-}
-
+// retourne x>>s , en testant le signe de x
+#define ShiftRight(_x,_s) (((_x)<0) ? -(-(_x)>>(_s)) : ((_x)>>(_s)))
/** modif d'optim by Jeko : precalcul des 4 coefs résultant des 2 pos */
int precalCoef[16][16];
-static void generatePrecalCoef (void)
+void
+generatePrecalCoef ()
{
static int firstime = 1;
@@ -124,10 +147,7 @@ static void generatePrecalCoef (void)
firstime = 0;
-/* precalCoef = (int**) malloc (17*sizeof (int*)); */
-
for (coefh = 0; coefh < 16; coefh++) {
-/* precalCoef [coefh] = (int *) malloc (17*sizeof (int)); */
for (coefv = 0; coefv < 16; coefv++) {
int i;
@@ -137,8 +157,8 @@ static void generatePrecalCoef (void)
diffcoeffh = sqrtperte - coefh;
diffcoeffv = sqrtperte - coefv;
- /* coeffs[myPos] = ((px >> PERTEDEC) + prevX * (py >> PERTEDEC)) << */
- /* 2; */
+ // coeffs[myPos] = ((px >> PERTEDEC) + prevX * (py >> PERTEDEC)) <<
+ // 2;
if (!(coefh || coefv))
i = 255;
else {
@@ -170,7 +190,8 @@ static void generatePrecalCoef (void)
px et py indique la nouvelle position (en sqrtperte ieme de pixel)
(valeur * 16)
*/
-static void calculatePXandPY (int x, int y, int *px, int *py)
+inline void
+calculatePXandPY (int x, int y, int *px, int *py)
{
if (theMode == WATER_MODE) {
static int wave = 0;
@@ -184,7 +205,7 @@ static void calculatePXandPY (int x, int y, int *px, int *py)
yy = c_resoly - 1;
*px = (x << 4) + firedec[yy] + (wave / 10);
- *py = (y << 4) + 132 - ((vitesse < 132) ? vitesse : 131);
+ *py = (y << 4) + 132 - ((vitesse < 131) ? vitesse : 130);
wavesp += RAND () % 3 - RAND () % 3;
if (wave < -10)
@@ -197,7 +218,7 @@ static void calculatePXandPY (int x, int y, int *px, int *py)
}
else {
int dist = 0, vx9, vy9;
- register int vx, vy;
+ int vx, vy;
int ppx, ppy;
int fvitesse = vitesse << 4;
@@ -210,17 +231,17 @@ static void calculatePXandPY (int x, int y, int *px, int *py)
if (hPlaneEffect)
vx += hPlaneEffect * (y - middleY);
- /* else vx = (x - middleX) << 9 ; */
+ // else vx = (x - middleX) << 9 ;
if (vPlaneEffect)
vy += vPlaneEffect * (x - middleX);
- /* else vy = (y - middleY) << 9 ; */
+ // else vy = (y - middleY) << 9 ;
if (waveEffect) {
fvitesse *=
1024 +
ShiftRight (sintable
- [(unsigned short) (0xffff * dist * EFFECT_DISTORS)], 6);
+ [(unsigned short) (dist * 0xffff + EFFECT_DISTORS)], 6);
fvitesse /= 1024;
}
@@ -238,17 +259,17 @@ static void calculatePXandPY (int x, int y, int *px, int *py)
fvitesse *=
1024 +
ShiftRight (sintable
- [(unsigned short) (0xffff * dist * EFFECT_DISTORS)], 6);
- fvitesse /= 1024;
+ [(unsigned short) (dist * 0xffff * EFFECT_DISTORS)], 6);
+ fvitesse>>=10;///=1024;
break;
case CRYSTAL_BALL_MODE:
- fvitesse += (dist * EFFECT_DISTORS >> 10);
+ fvitesse += (dist >> (10-EFFECT_DISTORS_SL));
break;
case AMULETTE_MODE:
- fvitesse -= (dist * EFFECT_DISTORS >> 4);
+ fvitesse -= (dist >> (4 - EFFECT_DISTORS_SL));
break;
case SCRUNCH_MODE:
- fvitesse -= (dist * EFFECT_DISTORS >> 9);
+ fvitesse -= (dist >> (10 - EFFECT_DISTORS_SL));
break;
case HYPERCOS1_MODE:
vx = vx + ShiftRight (sintable[(-vy + dist) & 0xffff], 1);
@@ -261,15 +282,22 @@ static void calculatePXandPY (int x, int y, int *px, int *py)
vy + ShiftRight (sintable[(ShiftRight (vx, 1) + dist) & 0xffff], 0);
fvitesse = 128 << 4;
break;
+ case YONLY_MODE:
+ fvitesse *= 1024 + ShiftRight (sintable[vy & 0xffff], 6);
+ fvitesse >>= 10;
+ break;
+ case SPEEDWAY_MODE:
+ fvitesse -= (ShiftRight(vy,10-EFFECT_DISTORS_SL));
+ break;
}
if (fvitesse < -3024)
fvitesse = -3024;
- if (vx < 0) /* pb avec decalage sur nb negatif */
+ if (vx < 0) // pb avec decalage sur nb negatif
ppx = -(-(vx * fvitesse) >> 16);
- /* 16 = 9 + 7 (7 = nb chiffre virgule de vitesse * (v = 128 => immobile) */
- /* * * * * * 9 = nb chiffre virgule de vx) */
+ /* 16 = 9 + 7 (7 = nb chiffre virgule de vitesse * (v = 128 => immobile)
+ * * * * * 9 = nb chiffre virgule de vx) */
else
ppx = ((vx * fvitesse) >> 16);
@@ -283,91 +311,69 @@ static void calculatePXandPY (int x, int y, int *px, int *py)
}
}
-/*#define _DEBUG */
+//#define _DEBUG
-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 */
+ // 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) ; */
+ // exit (1) ;
}
#endif
-/*#ifdef USE_DGA */
-/* buffer[ y*resolx + x ] = (c.b<<16)|(c.v<<8)|c.r ; */
-/*#else */
-/*#ifdef COLOR_BGRA */
buffer[y * resolx + x] =
(c.b << (BLEU * 8)) | (c.v << (VERT * 8)) | (c.r << (ROUGE * 8));
-/*#else */
-/* buffer[ y*resolx + x ] = (c.r<<16)|(c.v<<8)|c.b ; */
-/*#endif */
-/*#endif */
}
-static void setPixelRGB_ (Uint * buffer, Uint x, Color c)
+inline void
+setPixelRGB_ (Uint * buffer, Uint x, Color c)
{
#ifdef _DEBUG
if (x >= resolx * c_resoly) {
printf ("setPixel ERROR : hors du tableau... %i\n", x);
- /* exit (1) ; */
+ // exit (1) ;
}
#endif
-/*#ifdef USE_DGA */
-/* buffer[ x ] = (c.b<<16)|(c.v<<8)|c.r ; */
-/*#else */
-/*#ifdef COLOR_BGRA */
-/* buffer[ x ] = (c.b<<24)|(c.v<<16)|(c.r<<8) ; */
-/*#else */
buffer[x] = (c.r << (ROUGE * 8)) | (c.v << (VERT * 8)) | c.b << (BLEU * 8);
-/*#endif */
-/*#endif */
}
-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;
unsigned int i;
#ifdef _DEBUG
if (x + y * resolx >= resolx * c_resoly) {
printf ("getPixel ERROR : hors du tableau... %i, %i\n", x, y);
- /* exit (1) ; */
+ // 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); */
-
- /* #else */
/* ATTENTION AU PETIT INDIEN */
i = *(buffer + (x + y * resolx));
c->b = (i >> (BLEU * 8)) & 0xff;
c->v = (i >> (VERT * 8)) & 0xff;
c->r = (i >> (ROUGE * 8)) & 0xff;
- /* *c = (Color) buffer[x+y*WIDTH] ; */
-/*#endif */
}
-static void getPixelRGB_ (Uint * buffer, Uint x, Color * c)
+inline void
+getPixelRGB_ (Uint * buffer, Uint x, Color * c)
{
register unsigned char *tmp8;
#ifdef _DEBUG
if (x >= resolx * c_resoly) {
printf ("getPixel ERROR : hors du tableau... %i\n", x);
- /* exit (1) ; */
+ // exit (1) ;
}
#endif
@@ -382,21 +388,24 @@ static void getPixelRGB_ (Uint * buffer, Uint x, Color * c)
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] ; */
+ // *c = (Color) buffer[x+y*WIDTH] ;
#endif
}
-static void c_zoom (void)
+void c_zoom (unsigned int *expix1, unsigned int *expix2, unsigned int prevX, unsigned int prevY, signed int *brutS, signed int *brutD)
{
int myPos, myPos2;
Color couleur;
+// unsigned int coefv, coefh;
unsigned int ax = (prevX - 1) << PERTEDEC, ay = (prevY - 1) << PERTEDEC;
int bufsize = prevX * prevY * 2;
int bufwidth = prevX;
+ expix1[0]=expix1[prevX-1]=expix1[prevX*prevY-1]=expix1[prevX*prevY-prevX]=0;
+
for (myPos = 0; myPos < bufsize; myPos += 2) {
Color col1, col2, col3, col4;
int c1, c2, c3, c4, px, py;
@@ -414,15 +423,14 @@ static void c_zoom (void)
brutSmypos +
(((brutD[myPos2] - brutSmypos) * buffratio) >> BUFFPOINTNB);
+ pos = ((px >> PERTEDEC) + prevX * (py >> PERTEDEC));
+ // coef en modulo 15
+ coeffs = precalCoef[px & PERTEMASK][py & PERTEMASK];
+
if ((py >= ay) || (px >= ax)) {
pos = coeffs = 0;
}
- else {
- pos = ((px >> PERTEDEC) + prevX * (py >> PERTEDEC));
- /* coef en modulo 15 */
- coeffs = precalCoef[px & PERTEMASK][py & PERTEMASK];
- }
-
+
getPixelRGB_ (expix1, pos, &col1);
getPixelRGB_ (expix1, pos + 1, &col2);
getPixelRGB_ (expix1, pos + bufwidth, &col3);
@@ -453,6 +461,21 @@ static void c_zoom (void)
}
}
+#ifdef USE_ASM
+static int use_asm = 1;
+void
+setAsmUse (int useIt)
+{
+ use_asm = useIt;
+}
+
+int
+getAsmUse ()
+{
+ return use_asm;
+}
+#endif
+
/*===============================================================*/
void
zoomFilterFastRGB (Uint * pix1,
@@ -461,13 +484,21 @@ zoomFilterFastRGB (Uint * pix1,
Uint resx, Uint resy, int switchIncr, float switchMult)
{
register Uint x, y;
+// unsigned int *temp = brutD;
- static char reverse = 0; /* vitesse inversé..(zoom out) */
+ static char reverse = 0; // vitesse inversé..(zoom out)
static unsigned char pertedec = 8;
static char firstTime = 1;
+#define INTERLACE_INCR 16
+#define INTERLACE_ADD 9
+#define INTERLACE_AND 0xf
+ static int interlace_start = -2;
+
+/* TODO virer */
expix1 = pix1;
expix2 = pix2;
+/* */
/** changement de taille **/
if ((prevX != resx) || (prevY != resy)) {
@@ -492,6 +523,9 @@ zoomFilterFastRGB (Uint * pix1,
firedec = 0;
}
+ if (interlace_start != -2)
+ zf = NULL;
+
/** changement de config **/
if (zf) {
reverse = zf->reverse;
@@ -512,30 +546,25 @@ zoomFilterFastRGB (Uint * pix1,
/** generation d'un effet **/
if (firstTime || zf) {
- /* generation d'une table de sinus */
+ // generation d'une table de sinus
if (firstTime) {
unsigned short us;
int yofs;
firstTime = 0;
generatePrecalCoef ();
+ select_zoom_filter ();
freebrutS =
- (unsigned int *) malloc (resx * resy * 2 * sizeof (unsigned int) +
-
- 128);
+ (unsigned int *) calloc (resx * resy * 2 + 128, sizeof(unsigned int));
brutS = (guint32 *) ((1 + ((unsigned int) (freebrutS)) / 128) * 128);
freebrutD =
- (unsigned int *) malloc (resx * resy * 2 * sizeof (unsigned int) +
-
- 128);
+ (unsigned int *) calloc (resx * resy * 2 + 128, sizeof(unsigned int));
brutD = (guint32 *) ((1 + ((unsigned int) (freebrutD)) / 128) * 128);
freebrutT =
- (unsigned int *) malloc (resx * resy * 2 * sizeof (unsigned int) +
-
- 128);
+ (unsigned int *) calloc (resx * resy * 2 + 128, sizeof(unsigned int));
brutT = (guint32 *) ((1 + ((unsigned int) (freebrutT)) / 128) * 128);
/** modif here by jeko : plus de multiplications **/
@@ -577,7 +606,7 @@ zoomFilterFastRGB (Uint * pix1,
loopv--;
firedec[loopv] = decc;
decc += spdc / 10;
- spdc = spdc + RAND () % 3 - RAND () % 3;
+ spdc += RAND () % 3 - RAND () % 3;
if (decc > 4)
spdc -= 1;
@@ -607,16 +636,63 @@ zoomFilterFastRGB (Uint * pix1,
}
}
-/* buffratio = 0; */
+// buffratio = 0;
+ interlace_start = 0;
+ }
+ // generation du buffer de trans
+ if (interlace_start==-1) {
+ //int yprevx = 0;
+ //unsigned int ax = (prevX - 1) << PERTEDEC, ay = (prevY - 1) << PERTEDEC;
- /* generation du buffer de trans */
- {
/* sauvegarde de l'etat actuel dans la nouvelle source */
+
+#if 0
+ volatile mmx_t ratiox;
+
+ ratiox.d[0] = buffratio;
+ ratiox.d[1] = buffratio;
+ movq_m2r (ratiox, mm6);
+ pslld_i2r (16,mm6);
+
+ y = prevX * prevY;
+ for (x=0;x<y;++x) {
+ static volatile mmx_t *brutSm;
+ static volatile mmx_t *brutDm;
+ brutSm = (mmx_t*)brutS;
+ brutDm = (mmx_t*)brutD;
+ /*
+ * pre : mm6 = [buffratio<<16|buffratio<<16]
+ * post : mm0 = S + ((D-S)*buffratio)>>16 format [X|Y]
+ * modified = mm0,mm1,mm2
+ */
+
+ __asm__ __volatile__ (
+ "movq %0,%%mm0\n"
+ "movq %1,%%mm1\n"
+ : :"X"(brutSm[x]),"X"(brutDm[x])
+ ); /* mm0 = S */
+
+ psubd_r2r (mm0,mm1); /* mm1 = D - S */
+ movq_r2r (mm1, mm2); /* mm2 = D - S */
+
+ pslld_i2r (16,mm1);
+ mmx_r2r (pmulhuw, mm6, mm1); /* mm1 = ?? */
+ pmullw_r2r (mm6, mm2);
+
+ paddd_r2r (mm2, mm1); /* mm1 = (D - S) * buffratio >> 16 */
+ pslld_i2r (16,mm0);
+
+ paddd_r2r (mm1, mm0); /* mm0 = S + mm1 */
+ psrld_i2r (16, mm0);
+ movq_r2m (mm0,brutSm[x]);
+ }
+ emms();
+#else
y = prevX * prevY * 2;
for (x = 0; x < y; x += 2) {
int brutSmypos = brutS[x];
int x2 = x + 1;
-
+
brutS[x] =
brutSmypos + (((brutD[x] - brutSmypos) * buffratio) >> BUFFPOINTNB);
brutSmypos = brutS[x2];
@@ -624,40 +700,88 @@ zoomFilterFastRGB (Uint * pix1,
brutSmypos +
(((brutD[x2] - brutSmypos) * buffratio) >> BUFFPOINTNB);
}
-
- /* creation de la nouvelle destination */
- for (y = 0; y < prevY; y++) {
- for (x = 0; x < prevX; x++) {
- int px, py;
-
- /* unsigned char coefv,coefh; */
-
- calculatePXandPY (x, y, &px, &py);
-
-/* if (py>ay<<16)
- py = iRAND (32);
- if (px>ax<<16)
- px = iRAND (32);
-*/
-
+#endif
+ buffratio = 0;
+ }
+
+ if (interlace_start==-1) {
+ signed int * tmp;
+ //int i,prevXY = prevX*prevY*2;
+ //for (i=0;i<prevXY;i++)
+ tmp = brutD;
+ brutD=brutT;
+ brutT=tmp;
+ tmp = freebrutD;
+ freebrutD=freebrutT;
+ freebrutT=tmp;
+ interlace_start = -2;
+ /* TODO: virer si ca marche
+ int i,prevXY = prevX*prevY*2;
+ for (i=0;i<prevXY;i++)
+ brutD[i]=brutT[i];
+ interlace_start = -2;*/
+ }
+/*
+ if (interlace_start>=0) {
+ /* creation de la nouvelle destination *
+ for (y = interlace_start; y < prevY; y+=INTERLACE_INCR) {
+ Uint premul_y_prevX = y * prevX * 2;
+ for (x = 0; x < prevX; x++) {
+ int px, py;
+
+ // unsigned char coefv,coefh;
+
+ calculatePXandPY (x, y, &px, &py);
+
+ /* if (py>ay<<16)
+ py = iRAND (32);
+ if (px>ax<<16)
+ px = iRAND (32);
+ *
+
+ /*
if ((px == x << 4) && (py == y << 4)) {
- if (x > middleX)
- py += 2;
- else
- py -= 2;
- if (y > middleY)
- px += 2;
- else
- px -= 2;
+ if (x > middleX)
+ py += 2;
+ else
+ py -= 2;
+ if (y > middleY)
+ px += 2;
+ else
+ px -= 2;
}
-
- brutD[(y * prevX + x) << 1] = px;
- brutD[((y * prevX + x) << 1) + 1] = py;
- }
+ *
+
+ brutT[premul_y_prevX] = px;
+ brutT[premul_y_prevX + 1] = py;
+ premul_y_prevX += 2;
}
+ }
+ interlace_start += INTERLACE_ADD;
+ interlace_start &= INTERLACE_AND;
+ if (interlace_start == 0)
+ interlace_start = -1;
+ }
- buffratio = 0;
+*/
+
+ if (interlace_start>=0) {
+ int maxEnd = (interlace_start+INTERLACE_INCR);
+ /* creation de la nouvelle destination */
+ for (y = interlace_start; (y < prevY) && (y<maxEnd); y++) {
+ Uint premul_y_prevX = y * prevX * 2;
+ for (x = 0; x < prevX; x++) {
+ int px, py;
+
+ calculatePXandPY (x, y, &px, &py);
+
+ brutT[premul_y_prevX] = px;
+ brutT[premul_y_prevX + 1] = py;
+ premul_y_prevX += 2;
+ }
}
+ interlace_start += INTERLACE_INCR;
+ if (y >= prevY-1) interlace_start = -1;
}
if (switchIncr != 0) {
@@ -676,34 +800,39 @@ zoomFilterFastRGB (Uint * pix1,
mmx_zoom_size = prevX * prevY;
#ifdef USE_ASM
-#ifdef MMX
-/* mmx_zoom () ; */
- if (use_asm) {
- zoom_filter_mmx (prevX, prevY, expix1, expix2, brutS, brutD, buffratio, precalCoef);
- }
- else {
- c_zoom ();
- }
+#ifdef HAVE_MMX
+ if (zf_use_xmmx)
+ zoom_filter_xmmx (prevX, prevY,expix1, expix2,
+ brutS, brutD, buffratio, precalCoef);
+ else if (zf_use_mmx)
+ zoom_filter_mmx (prevX, prevY,expix1, expix2,
+ brutS, brutD, buffratio, precalCoef);
+ else c_zoom (expix1, expix2, prevX, prevY, brutS, brutD);
#endif
#ifdef POWERPC
- if (use_asm) {
- ppc_zoom (expix1, expix2, prevX, prevY, brutS, brutD, buffratio);
- }
- else {
- c_zoom ();
- }
+ if (useAltivec)
+{
+ ppc_zoom (expix1, expix2, prevX, prevY, brutS, brutD, buffratio,precalCoef);
+ //c_zoom (expix1, expix2, prevX, prevY, brutS, brutD);
+ //ppc_zoom_altivec (expix1, expix2, prevX, prevY, brutS, brutD, buffratio,precalCoef); // FIXME:rewrite alitvec
+}
+ else
+ ppc_zoom (expix1, expix2, prevX, prevY, brutS, brutD, buffratio,precalCoef);
#endif
#else
- c_zoom ();
+ c_zoom (expix1, expix2, prevX, prevY, brutS, brutD);
#endif
}
-void pointFilter (Uint * pix1, Color c,
+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)));
+ Uint x = (Uint) ((int) (resolx/2)
+ + (int) (t1 * cos ((float) cycle / t3)));
+ Uint y = (Uint) ((int) (c_resoly/2)
+ + (int) (t2 * sin ((float) cycle / t4)));
if ((x > 1) && (y > 1) && (x < resolx - 2) && (y < c_resoly - 2)) {
setPixelRGB (pix1, x + 1, y, c);
diff --git a/src/post/goom/filters.h b/src/post/goom/filters.h
index e306e6032..c4bfaf352 100644
--- a/src/post/goom/filters.h
+++ b/src/post/goom/filters.h
@@ -14,8 +14,8 @@ typedef struct
unsigned char sqrtperte;
int middleX, middleY; /* milieu de l'effet */
char reverse; /* inverse la vitesse */
- char mode; /* type d'effet ŕ appliquer (cf les #define)
- * * * * * */ /** @since June 2001 */
+ char mode; /* type d'effet ŕ appliquer (cf les #define)
+ * * * * * /** @since June 2001 */
int hPlaneEffect; /* deviation horitontale */
int vPlaneEffect; /* deviation verticale */
/** @since April 2002 */
@@ -36,6 +36,8 @@ ZoomFilterData;
#define WATER_MODE 5
#define HYPERCOS1_MODE 6
#define HYPERCOS2_MODE 7
+#define YONLY_MODE 8
+#define SPEEDWAY_MODE 9
void pointFilter (guint32 * pix1, Color c,
float t1, float t2, float t3, float t4, guint32 cycle);
@@ -74,5 +76,8 @@ void sinFilter(Uint *pix1,Uint *pix2,
#define SIN_MUL 1
#define SIN_ADD 2
+//#ifdef USE_ASM
+//void setAsmUse (int useIt);
+//#endif
#endif
diff --git a/src/post/goom/goom_config.h b/src/post/goom/goom_config.h
index 0947b400e..4f7f81e16 100644
--- a/src/post/goom/goom_config.h
+++ b/src/post/goom/goom_config.h
@@ -30,7 +30,7 @@
/* for pc users with mmx processors. */
#ifdef ARCH_X86
-#define MMX
+#define HAVE_MMX
#endif
#ifdef ARCH_PPC
diff --git a/src/post/goom/goom_core.c b/src/post/goom/goom_core.c
index fb9dbac9a..80d9a63c4 100644
--- a/src/post/goom/goom_core.c
+++ b/src/post/goom/goom_core.c
@@ -1,20 +1,24 @@
-#include <stdio.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include "goom_core.h"
#include "goom_tools.h"
#include "filters.h"
#include "lines.h"
#include "ifs.h"
+#include "tentacle3d.h"
+#include "gfontlib.h"
-/*#define VERBOSE */
+//#define VERBOSE
+
+#ifdef VERBOSE
+#include <stdio.h>
+#endif
#define STOP_SPEED 128
#define TIME_BTW_CHG 300
-int use_asm = 0;
-
/**-----------------------------------------------------**
** SHARED DATA **
**-----------------------------------------------------**/
@@ -23,26 +27,54 @@ static guint32 *back;
static guint32 *p1, *p2, *tmp;
static guint32 cycle;
+typedef struct {
+ int drawIFS;
+ int drawPoints;
+ int drawTentacle;
+
+ int drawScope;
+ int farScope;
+
+ int rangemin;
+ int rangemax;
+} GoomState;
+
+#define STATES_NB 8
+#define STATES_RANGEMAX 510
+GoomState states[STATES_NB] = {
+ {1,0,0,1,4, 000, 100},
+ {1,0,0,0,1, 101, 140},
+ {1,0,0,1,2, 141, 200},
+ {0,1,0,1,2, 201, 260},
+ {0,1,0,1,0, 261, 330},
+ {0,1,1,1,4, 331, 400},
+ {0,0,1,0,5, 401, 450},
+ {0,0,1,1,1, 451, 510}
+};
+
+GoomState *curGState = states+4;
+
+
guint32 resolx, resoly, buffsize, c_black_height = 0, /* hauteur des bande *
* * noires en bas et *
* * en * haut */
c_offset = 0, c_resoly = 0; /* avec prise en compte de ca */
-/* effet de ligne.. */
+// effet de ligne..
static GMLine *gmline1 = NULL;
static GMLine *gmline2 = NULL;
void choose_a_goom_line (float *param1, float *param2, int *couleur,
- int *mode);
+ int *mode, float *amplitude, int farparm);
-/* la police */
-int ***font_chars;
-int *font_width;
-int *font_height;
+// la police
+//int ***font_chars;
+//int *font_width;
+//int *font_height;
-void goom_draw_text (guint32 * buf,
- int x, int y,
- const char *str, float chspace, int center);
+//void goom_draw_text (guint32 * buf,
+// int x, int y,
+// const char *str, float chspace, int center);
void update_message (char *message);
@@ -67,7 +99,12 @@ goom_init (guint32 resx, guint32 resy, int cinemascope)
pixel = (guint32 *) malloc (buffsize * sizeof (guint32) + 128);
back = (guint32 *) malloc (buffsize * sizeof (guint32) + 128);
- RAND_INIT ((guint32) pixel);
+ //RAND_INIT ();
+ srand ((guint32) pixel);
+ if (!rand_tab) rand_tab = (int *) malloc (NB_RAND * sizeof(int)) ;
+ rand_pos = 1 ;
+ while (rand_pos != 0) rand_tab [rand_pos++] = rand () ;
+
cycle = 0;
p1 = (guint32 *) ((1 + ((unsigned int) (pixel)) / 128) * 128);
@@ -81,9 +118,12 @@ goom_init (guint32 resx, guint32 resy, int cinemascope)
GML_HLINE, 0, GML_BLACK,
GML_CIRCLE, 0.2f * (float) c_resoly, GML_RED);
- font_height = NULL;
- font_width = NULL;
- font_chars = NULL;
+// font_height = NULL;
+// font_width = NULL;
+// font_chars = NULL;
+ gfont_load ();
+
+ tentacle_new ();
}
@@ -118,45 +158,48 @@ goom_set_resolution (guint32 resx, guint32 resy, int cinemascope)
}
-guint32 *
-goom_update (gint16 data[2][512],
+
+guint32 * goom_update (gint16 data[2][512],
int forceMode,
float fps,
char *songTitle,
char *message)
{
- 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 abiggoom = 0; /* un big goom a eu lieu.. */
- static int loopvar = 0; /* mouvement des points */
- static int speedvar = 0; /* vitesse des particules */
-
- /* duree de la transition entre afficher les lignes ou pas */
-#define DRAWLINES 70
- static int lineMode = DRAWLINES; /* l'effet lineaire a dessiner */
- static int nombreCDDC = 0; /* nombre de Cycle Depuis Dernier Changement */
+ 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 abiggoom = 0; // un big goom a eu lieu..
+ static int loopvar = 0; // mouvement des points
+ static int speedvar = 0; // vitesse des particules
+
+ // duree de la transition entre afficher les lignes ou pas
+#define DRAWLINES 80
+ static int lineMode = DRAWLINES; // l'effet lineaire a dessiner
+ static int nombreCDDC = 0; // nombre de Cycle Depuis Dernier Changement
guint32 *return_val;
guint32 pointWidth;
guint32 pointHeight;
- int incvar; /* volume du son */
- static int accelvar=0; /* acceleration des particules */
+ int incvar; // volume du son
+ static int accelvar=0; // acceleration des particules
int i;
- float largfactor; /* elargissement de l'intervalle d'évolution */
+ float largfactor; // elargissement de l'intervalle d'évolution
+ static int stop_lines = 0;
- /* des points */
+ // des points
- static int ifs_incr = 1; /* dessiner l'ifs (0 = non: > = increment) */
- static int decay_ifs = 0; /* disparition de l'ifs */
- static int recay_ifs = 0; /* dédisparition de l'ifs */
+ static int ifs_incr = 1; // dessiner l'ifs (0 = non: > = increment)
+ static int decay_ifs = 0; // disparition de l'ifs
+ static int recay_ifs = 0; // dédisparition de l'ifs
-#define SWITCHMULT (19.0f/20.0f)
-#define SWITCHINCR 0xff
+#define SWITCHMULT (29.0f/30.0f)
+#define SWITCHINCR 0x7f
static float switchMult = 1.0f;
static int switchIncr = SWITCHINCR;
- static char goomlimit = 2; /* sensibilité du goom */
+// static int lastgoom = 0;
+
+ static char goomlimit = 2; // sensibilité du goom
static ZoomFilterData zfd = {
127, 8, 16,
1, 1, 0, NORMAL_MODE,
@@ -191,13 +234,19 @@ goom_update (gint16 data[2][512],
i = accelvar - i;
if (i<0) i=-i;
- speedvar += i/2;
- speedvar = speedvar * 15/16;
+ speedvar += (speedvar + i/2);
+ speedvar /= 2;
+ if ((speedvar) && (cycle%9==0)) {
+ speedvar -= 1;
+ }
+ if ((speedvar) && (cycle%5==0)) {
+ speedvar = (speedvar*7)/8;
+ }
if (speedvar < 0)
speedvar = 0;
- if (speedvar > 40)
- speedvar = 40;
+ if (speedvar > 50)
+ speedvar = 50;
/* ! calcul du deplacement des petits points ... */
@@ -206,9 +255,11 @@ goom_update (gint16 data[2][512],
if (largfactor > 1.5f)
largfactor = 1.5f;
+/*
if ((ifs_incr == 1) && (iRAND (300) == 0) && (decay_ifs < -300) && (agoom)) {
decay_ifs = 200;
}
+*/
decay_ifs--;
if (decay_ifs > 0)
@@ -216,26 +267,28 @@ goom_update (gint16 data[2][512],
if (decay_ifs == 0)
ifs_incr = 0;
+/*
if ((ifs_incr == 0) && (iRAND (300) == 0) && (agoom) && (decay_ifs < -100)) {
recay_ifs = 5;
ifs_incr = 11;
+ if (iRAND(2))
+ stop_lines = 0xf000 & 5;
}
+*/
if (recay_ifs) {
ifs_incr -= 2;
recay_ifs--;
- if (recay_ifs == 0)
+ if ((recay_ifs == 0)&&(ifs_incr<=0))
ifs_incr = 1;
}
if (ifs_incr > 0)
ifs_update (p1 + c_offset, p2 + c_offset, resolx, c_resoly, ifs_incr);
-
-/* (p1+c_offset)[resolx/2 + c_resoly/2 * resolx] = 0; */
-
- if (ifs_incr != 1) {
+
+ if (curGState->drawPoints) {
for (i = 1; i * 15 <= speedvar + 15; i++) {
- loopvar += speedvar*2 + 1;
+ loopvar += speedvar*2/3 + 1;
pointFilter (p1 + c_offset,
YELLOW,
@@ -260,7 +313,8 @@ goom_update (gint16 data[2][512],
66.0f, 74.0f, loopvar + i * 500);
}
}
- /* par défaut pas de changement de zoom */
+
+ // par défaut pas de changement de zoom
pzfd = NULL;
/*
@@ -273,21 +327,19 @@ goom_update (gint16 data[2][512],
#endif
- /* 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 */
- /* */
- /* */
- /* */
- /* ? */
+ // 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 */
+ // temps du goom
if (--agoom < 0)
agoom = 0;
- /* temps du goom */
+ // temps du goom
if (--abiggoom < 0)
abiggoom = 0;
@@ -305,26 +357,27 @@ goom_update (gint16 data[2][512],
(p1+c_offset)[i] = (~(p1+c_offset)[i]) | couleur;
}
- /* on verifie qu'il ne se pas un truc interressant avec le son. */
+ // on verifie qu'il ne se pas un truc interressant avec le son.
if ((accelvar > goomlimit) || (accelvar < -goomlimit) || (forceMode > 0)
|| (nombreCDDC > TIME_BTW_CHG)) {
-/* if (nombreCDDC > 300) { */
-/* } */
+// if (nombreCDDC > 300) {
+// }
- /* UN GOOM !!! YAHOO ! */
+ // UN GOOM !!! YAHOO !
totalgoom++;
- agoom = 20; /* mais pdt 20 cycles, il n'y en aura plus. */
- /* lineMode = (lineMode + 1)%40; */ /* Tous les 10 gooms on change de mode */
- /* lineaire */
-
- /* if (iRAND(12) == 0) */
- /* zfd.vitesse=STOP_SPEED-1; */
- /* if (iRAND(13) == 0) */
- /* zfd.vitesse=STOP_SPEED+1; */
-
- /* changement eventuel de mode */
- switch (iRAND (28)) {
+ agoom = 20; // mais pdt 20 cycles, il n'y en aura plus.
+ // lineMode = (lineMode + 1)%40; // Tous les 10 gooms on change de mode
+ // lineaire
+
+ // if (iRAND(12) == 0)
+ // zfd.vitesse=STOP_SPEED-1;
+ // if (iRAND(13) == 0)
+ // zfd.vitesse=STOP_SPEED+1;
+
+ // changement eventuel de mode
+ if (iRAND(16) == 0)
+ switch (iRAND (32)) {
case 0:
case 10:
zfd.hypercosEffect = iRAND (2);
@@ -346,8 +399,8 @@ goom_update (gint16 data[2][512],
case 2:
case 12:
zfd.mode = AMULETTE_MODE;
- zfd.waveEffect = (iRAND (3) == 0);
- zfd.hypercosEffect = (iRAND (3) == 0);
+ zfd.waveEffect = 0;
+ zfd.hypercosEffect = 0;
break;
case 3:
zfd.mode = WATER_MODE;
@@ -361,7 +414,8 @@ goom_update (gint16 data[2][512],
zfd.hypercosEffect = 0;
break;
case 5:
- case 15:
+ case 15:
+ case 22:
zfd.mode = HYPERCOS1_MODE;
zfd.waveEffect = 0;
zfd.hypercosEffect = (iRAND (3) == 0);
@@ -385,27 +439,66 @@ goom_update (gint16 data[2][512],
zfd.waveEffect = 1;
zfd.hypercosEffect = 1;
break;
+ case 29:
+ case 30:
+ zfd.mode = YONLY_MODE;
+ break;
+ case 31:
+ case 32:
+ zfd.mode = SPEEDWAY_MODE;
+ break;
default:
zfd.mode = NORMAL_MODE;
zfd.waveEffect = 0;
zfd.hypercosEffect = 0;
}
}
-
- /* tout ceci ne sera fait qu'en cas de non-blocage */
+
+ // 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.. */
+ // reperage de goom (acceleration forte de l'acceleration du volume)
+ // -> coup de boost de la vitesse si besoin..
if ((accelvar > goomlimit) || (accelvar < -goomlimit)) {
+ static int rndn = 0 ,i;
+ static int blocker = 0;
goomvar++;
- /* if (goomvar % 1 == 0) */
+
+ /* SELECTION OF THE GOOM STATE */
+ if ((!blocker)&&(iRAND(3))) {
+ rndn = iRAND(STATES_RANGEMAX);
+ blocker = 3;
+ }
+ else if (blocker) blocker--;
+
+ for (i=0;i<STATES_NB;i++)
+ if ((rndn >= states[i].rangemin)
+ && (rndn <= states[i].rangemax))
+ curGState = states+i;
+
+ if ((curGState->drawIFS) && (ifs_incr<=0)) {
+ recay_ifs = 5;
+ ifs_incr = 11;
+ }
+
+ if ((!curGState->drawIFS) && (ifs_incr>0) && (decay_ifs<=0))
+ decay_ifs = 100;
+
+ if (!curGState->drawScope)
+ stop_lines = 0xf000 & 5;
+
+ if (!curGState->drawScope) {
+ stop_lines = 0;
+ lineMode = DRAWLINES;
+ }
+
+ // if (goomvar % 1 == 0)
{
guint32 vtmp;
guint32 newvit;
lockvar = 50;
- newvit = STOP_SPEED - speedvar / 2;
- /* retablir le zoom avant.. */
+ newvit = STOP_SPEED + 1 - ((float)4.0f * log10(speedvar+1));
+ // retablir le zoom avant..
if ((zfd.reverse) && (!(cycle % 13)) && (rand () % 5 == 0)) {
zfd.reverse = 0;
zfd.vitesse = STOP_SPEED - 2;
@@ -421,7 +514,7 @@ goom_update (gint16 data[2][512],
if (iRAND (12) == 0)
zfd.vitesse = STOP_SPEED + 1;
- /* changement de milieu.. */
+ // changement de milieu..
switch (iRAND (25)) {
case 0:
case 3:
@@ -442,13 +535,16 @@ goom_update (gint16 data[2][512],
zfd.middleX = resolx / 2;
}
- if (zfd.mode == WATER_MODE) {
+ if ((zfd.mode == WATER_MODE)
+ || (zfd.mode == YONLY_MODE)
+ || (zfd.mode == AMULETTE_MODE)) {
zfd.middleX = resolx / 2;
zfd.middleY = c_resoly / 2;
}
switch (vtmp = (iRAND (15))) {
case 0:
+
zfd.vPlaneEffect = iRAND (3) - iRAND (3);
zfd.hPlaneEffect = iRAND (3) - iRAND (3);
break;
@@ -489,7 +585,7 @@ goom_update (gint16 data[2][512],
if (iRAND (5) != 0)
zfd.noisify = 0;
else {
- zfd.noisify = iRAND (3) + 2;
+ zfd.noisify = iRAND (2) + 1;
lockvar *= 2;
}
@@ -504,7 +600,7 @@ goom_update (gint16 data[2][512],
zfd.hPlaneEffect = iRAND (2) ? 0 : zfd.hPlaneEffect;
}
- if (newvit < zfd.vitesse) /* on accelere */
+ if (newvit < zfd.vitesse) // on accelere
{
pzfd = &zfd;
if (((newvit < STOP_SPEED - 7) &&
@@ -514,7 +610,7 @@ goom_update (gint16 data[2][512],
zfd.reverse = !zfd.reverse;
}
else {
- zfd.vitesse = (newvit + zfd.vitesse * 4) / 5;
+ zfd.vitesse = (newvit + zfd.vitesse * 7) / 8;
}
lockvar += 50;
}
@@ -525,7 +621,7 @@ goom_update (gint16 data[2][512],
switchMult = 1.0f;
}
}
- /* mode mega-lent */
+ // mode mega-lent
if (iRAND (700) == 0) {
/*
* printf ("coup du sort...\n") ;
@@ -541,37 +637,37 @@ goom_update (gint16 data[2][512],
}
}
- /* gros frein si la musique est calme */
+ /*
+ * 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... */
+ /*
+ * 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 */
+ /*
+ * 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;
}
+ /*
+ * Permet de forcer un effet.
+ */
if ((forceMode > 0) && (forceMode <= NB_FX)) {
pzfd = &zfd;
pzfd->mode = forceMode - 1;
@@ -581,6 +677,9 @@ goom_update (gint16 data[2][512],
pzfd = NULL;
}
+ /*
+ * Changement d'effet de zoom !
+ */
if (pzfd != NULL) {
static int exvit = 128;
int dif;
@@ -619,22 +718,41 @@ goom_update (gint16 data[2][512],
}
#endif
- /* Zoom here ! */
+ // Zoom here !
zoomFilterFastRGB (p1 + c_offset, p2 + c_offset, pzfd, resolx, c_resoly,
switchIncr, switchMult);
+ /*
+ * Affichage tentacule
+ */
+
+ // if (curGState->drawTentacle)
+ if (goomlimit!=0)
+ tentacle_update(p2 + c_offset, p1 + c_offset, resolx, c_resoly,
+ data, (float)accelvar/goomlimit, curGState->drawTentacle);
+ else
+ tentacle_update(p2 + c_offset, p1 + c_offset, resolx, c_resoly,
+ data,0.0f, curGState->drawTentacle);
+
+
+ /*
+ * Affichage de texte
+ */
{
static char title[1024];
static int displayTitle = 0;
char text[255];
+ /*
+ * Le fps
+ */
if (fps > 0) {
int i;
if (speedvar>0) {
for (i=0;i<speedvar;i++)
text[i]='*';
text[i]=0;
- goom_draw_text (p1 + c_offset,
+ goom_draw_text (p1 + c_offset,resolx,c_resoly,
10, 50, text,
1.0f, 0);
}
@@ -646,88 +764,135 @@ goom_update (gint16 data[2][512],
text[i]='*';
}
text[i]=0;
- goom_draw_text (p1 + c_offset,
+ goom_draw_text (p1 + c_offset,resolx,c_resoly,
10, 62, text,
1.0f, 0);
}
if (agoom==20)
- goom_draw_text (p1 + c_offset,10, 80, "GOOM",1.0f, 0);
+ goom_draw_text (p1 + c_offset,resolx,c_resoly,10, 80, "GOOM",1.0f, 0);
else if (agoom)
- goom_draw_text (p1 + c_offset,10, 80, "goom",1.0f, 0);
+ goom_draw_text (p1 + c_offset,resolx,c_resoly,10, 80, "goom",1.0f, 0);
if (abiggoom==200)
- goom_draw_text (p1 + c_offset,10, 100, "BGOOM",1.0f, 0);
+ goom_draw_text (p1 + c_offset,resolx,c_resoly,10, 100, "BGOOM",1.0f, 0);
else if (abiggoom)
- goom_draw_text (p1 + c_offset,10, 100, "bgoom",1.0f, 0);
+ goom_draw_text (p1 + c_offset,resolx,c_resoly,10, 100, "bgoom",1.0f, 0);
}
+ /*
+ * Le message
+ */
update_message (message);
if (fps > 0) {
- sprintf (text, "%3.0f fps", fps);
- goom_draw_text (p1 + c_offset,
- 24, 24, text, 1, 1);
+ sprintf (text, "%2.f fps", fps);
+ goom_draw_text (p1 + c_offset,resolx,c_resoly,
+ 10, 24, text, 1, 0);
}
+ /*
+ * Le titre
+ */
if (songTitle != NULL) {
- sprintf (title, songTitle); /* la flemme d'inclure string.h :) */
+ sprintf (title, songTitle); // la flemme d'inclure string.h :)
displayTitle = 200;
}
if (displayTitle) {
- goom_draw_text (p1 + c_offset,
+ goom_draw_text (p1 + c_offset,resolx,c_resoly,
resolx / 2, c_resoly / 2 + 7, title,
- ((float) (200 - displayTitle) / 10.0f), 1);
+ ((float) (190 - displayTitle) / 10.0f), 1);
displayTitle--;
if (displayTitle < 4)
- goom_draw_text (p2 + c_offset,
+ goom_draw_text (p2 + c_offset,resolx,c_resoly,
resolx / 2, c_resoly / 2 + 7, title,
- ((float) (200 - displayTitle) / 10.0f), 1);
+ ((float) (190 - displayTitle) / 10.0f), 1);
}
}
- /* si on est dans un goom : afficher les lignes... */
-
+ /*
+ * Gestion du Scope
+ */
+
+ /*
+ * arret demande
+ */
+ if ((stop_lines & 0xf000)||(!curGState->drawScope)) {
+ float param1, param2, amplitude;
+ int couleur;
+ int mode;
+
+ choose_a_goom_line (&param1, &param2, &couleur, &mode, &amplitude,1);
+ couleur = GML_BLACK;
+
+ goom_lines_switch_to (gmline1, mode, param1, amplitude, couleur);
+ goom_lines_switch_to (gmline2, mode, param2, amplitude, couleur);
+ stop_lines &= 0x0fff;
+ }
+
+ /*
+ * arret aleatore.. changement de mode de ligne..
+ */
if (lineMode != DRAWLINES) {
lineMode--;
if (lineMode == -1)
lineMode = 0;
}
- else if ((iRAND(60)==0)&&lineMode)
- lineMode--;
+ else
+ if ((cycle%80==0)&&(iRAND(5)==0)&&lineMode)
+ lineMode--;
- if ((agoom > 0) && (totalgoom > 2) && (cycle % 120 == 0)
- && (iRAND (3) == 0)) {
+ if ((cycle % 120 == 0)
+ && (iRAND (4) == 0)
+ && (curGState->drawScope)) {
if (lineMode == 0)
lineMode = DRAWLINES;
else if (lineMode == DRAWLINES) {
- float param1, param2;
- int couleur;
+ float param1, param2, amplitude;
+ int couleur1,couleur2;
int mode;
lineMode--;
- choose_a_goom_line (&param1, &param2, &couleur, &mode);
+ choose_a_goom_line (&param1, &param2, &couleur1,
+ &mode, &amplitude,stop_lines);
+
+ couleur2 = 5-couleur1;
+ if (stop_lines) {
+ stop_lines--;
+ if (iRAND(2))
+ couleur2=couleur1 = GML_BLACK;
+ }
- goom_lines_switch_to (gmline1, mode, param1, couleur);
- goom_lines_switch_to (gmline2, mode, param2, 5 - couleur);
+ goom_lines_switch_to (gmline1, mode, param1, amplitude, couleur1);
+ goom_lines_switch_to (gmline2, mode, param2, amplitude, couleur2);
}
}
+ /*
+ * si on est dans un goom : afficher les lignes...
+ */
if ((lineMode != 0) || (agoom > 15)) {
gmline2->power = gmline1->power;
goom_lines_draw (gmline1, data[0], p2 + c_offset);
goom_lines_draw (gmline2, data[1], p2 + c_offset);
- if (((cycle % 101) == 9) && (iRAND (3) == 1)
+ if (((cycle % 121) == 9) && (iRAND (3) == 1)
&& ((lineMode == 0) || (lineMode == DRAWLINES))) {
- float param1, param2;
- int couleur;
+ float param1, param2, amplitude;
+ int couleur1,couleur2;
int mode;
- choose_a_goom_line (&param1, &param2, &couleur, &mode);
-
- goom_lines_switch_to (gmline1, mode, param1, couleur);
- goom_lines_switch_to (gmline2, mode, param2, 5 - couleur);
+ choose_a_goom_line (&param1, &param2, &couleur1,
+ &mode, &amplitude, stop_lines);
+ couleur2 = 5-couleur1;
+
+ if (stop_lines) {
+ stop_lines--;
+ if (iRAND(2))
+ couleur2=couleur1 = GML_BLACK;
+ }
+ goom_lines_switch_to (gmline1, mode, param1, amplitude, couleur1);
+ goom_lines_switch_to (gmline2, mode, param2, amplitude, couleur2);
}
}
@@ -736,11 +901,11 @@ goom_update (gint16 data[2][512],
p1 = p2;
p2 = tmp;
- /* affichage et swappage des buffers.. */
+ // affichage et swappage des buffers..
cycle++;
- /* toute les 2 secondes : vérifier si le taux de goom est correct */
- /* et le modifier sinon.. */
+ // toute les 2 secondes : vérifier si le taux de goom est correct
+ // et le modifier sinon..
if (!(cycle % 64)) {
if (speedvar<1)
goomlimit /= 2;
@@ -761,7 +926,7 @@ goom_update (gint16 data[2][512],
}
void
-goom_close (void)
+goom_close ()
{
if (pixel != NULL)
free (pixel);
@@ -772,42 +937,53 @@ goom_close (void)
release_ifs ();
goom_lines_free (&gmline1);
goom_lines_free (&gmline2);
+ tentacle_free();
}
void
-choose_a_goom_line (float *param1, float *param2, int *couleur, int *mode)
+choose_a_goom_line (float *param1, float *param2, int *couleur, int *mode,
+ float *amplitude, int farparm)
{
*mode = iRAND (3);
+ *amplitude = 1.0f;
switch (*mode) {
case GML_CIRCLE:
+ if (farparm) {
+ *param1 = *param2 = 0.47f;
+ *amplitude = 0.8f;
+ break;
+ }
if (iRAND (3) == 0) {
*param1 = *param2 = 0;
+ *amplitude = 3.0f;
}
else if (iRAND (2)) {
*param1 = 0.40f * c_resoly;
- *param2 = 0.20f * c_resoly;
+ *param2 = 0.22f * c_resoly;
}
else {
- *param1 = *param2 = c_resoly * 0.25;
+ *param1 = *param2 = c_resoly * 0.35;
}
break;
case GML_HLINE:
- if (iRAND (4)) {
+ if (iRAND (4) || farparm) {
*param1 = c_resoly / 7;
*param2 = 6.0f * c_resoly / 7.0f;
}
else {
*param1 = *param2 = c_resoly / 2.0f;
+ *amplitude = 2.0f;
}
break;
case GML_VLINE:
- if (iRAND (3)) {
+ if (iRAND (3) || farparm) {
*param1 = resolx / 7.0f;
*param2 = 6.0f * resolx / 7.0f;
}
else {
*param1 = *param2 = resolx / 2.0f;
+ *amplitude = 1.5f;
}
break;
}
@@ -816,75 +992,15 @@ choose_a_goom_line (float *param1, float *param2, int *couleur, int *mode)
}
void
-goom_draw_text (guint32 * buf,
- int x, int y, const char *str, float charspace, int center)
-{
- float fx = (float) x;
- int fin = 0;
-
- if (font_chars == NULL)
- return ;
-
- if (center) {
- unsigned const char *tmp = str;
- float lg = -charspace;
-
- while (*tmp != '\0')
- lg += font_width[*(tmp++)] + charspace;
-
- fx -= lg / 2;
- }
-
- while (!fin) {
- unsigned char c = *str;
-
- x = (int) fx;
-
- if (c == '\0')
- fin = 1;
- else {
- int xx, yy;
- int xmin = x;
- int xmax = x + font_width[c];
- int ymin = y - font_height[c];
- int ymax = y;
-
- yy = ymin;
-
- if (xmin < 0)
- xmin = 0;
-
- if (xmin >= resolx - 1)
- return;
-
- if (xmax >= (int) resolx)
- xmax = resolx - 1;
-
- if (yy < 0)
- yy = 0;
-
- if (yy <= (int) resoly - 1) {
- if (ymax >= (int) resoly - 1)
- ymax = resoly - 1;
-
- for (; yy < ymax; yy++)
- for (xx = xmin; xx < xmax; xx++)
- if (font_chars[c][yy - ymin][xx - x] & 0xff000000)
- buf[yy * resolx + xx] = font_chars[c][yy - ymin][xx - x];
- }
- fx += font_width[c] + charspace;
- }
- str++;
- }
-}
-
-void
goom_set_font (int ***chars, int *width, int *height)
{
- font_chars = chars;
- font_width = width;
- font_height = height;
- /* tester les fonts.. */
+ if (chars == NULL)
+ return ;
+
+// font_chars = chars;
+// font_width = width;
+// font_height = height;
+ // tester les fonts..
}
@@ -898,6 +1014,7 @@ void update_message (char *message) {
static int affiche = 0;
static int longueur;
int fin = 0;
+
if (message) {
int i=1,j=0;
sprintf (msg2,message);
@@ -932,12 +1049,12 @@ void update_message (char *message) {
pos = affiche - (nbl-i)*25;
pos += 6.0*(cos((double)pos/20.0));
pos -= 80;
- ecart = (3.0+1.0*sin((double)pos/20.0));
+ ecart = (1.0+2.0*sin((double)pos/20.0));
if ((fin) && (2 * pos < (int)resoly))
pos = (int)resoly / 2;
pos += 7;
- goom_draw_text(p1 + c_offset,
+ goom_draw_text(p1 + c_offset,resolx,c_resoly,
resolx/2, pos,
message,
ecart,
@@ -950,12 +1067,3 @@ void update_message (char *message) {
}
}
-void goom_setAsmUse (int useIt)
-{
- use_asm = useIt;
-}
-
-int goom_getAsmUse (void)
-{
- return use_asm;
-}
diff --git a/src/post/goom/goom_core.h b/src/post/goom/goom_core.h
index 343285891..a4cac2c99 100644
--- a/src/post/goom/goom_core.h
+++ b/src/post/goom/goom_core.h
@@ -16,10 +16,10 @@
typedef Pixel * GoomBuffer;
*/
-#define NB_FX 8
+#define NB_FX 10
-void goom_init (guint32 resx, guint32 resy, int cinemascope);
-void goom_set_resolution (guint32 resx, guint32 resy, int cinemascope);
+void goom_init (guint32 resx, guint32 resy, int cinemascope);
+void goom_set_resolution (guint32 resx, guint32 resy, int cinemascope);
/*
* forceMode == 0 : do nothing
@@ -30,14 +30,11 @@ void goom_set_resolution (guint32 resx, guint32 resy, int cinemascope);
* - NULL if it is not the start of the song
* - only have a value at the start of the song
*/
-guint32 *goom_update (gint16 data[2][512], int forceMode, float fps,
+guint32 * goom_update ( gint16 data[2][512], int forceMode, float fps,
char *songTitle, char *message);
-void goom_close (void);
+void goom_close ();
void goom_set_font (int ***chars, int *width, int *height);
-void goom_setAsmUse (int useIt);
-
-int goom_getAsmUse (void);
#endif
diff --git a/src/post/goom/goom_tools.h b/src/post/goom/goom_tools.h
index 2bd74b95b..8e4fdd314 100644
--- a/src/post/goom/goom_tools.h
+++ b/src/post/goom/goom_tools.h
@@ -5,25 +5,29 @@
/* in graphic.c */
extern int *rand_tab;
-extern unsigned short rand_pos;
+static unsigned short rand_pos;
#define RAND_INIT(i) \
srand (i) ;\
- if (!rand_tab)\
- rand_tab = (int *) malloc (NB_RAND * sizeof(int)) ;\
+ if (!rand_tab) rand_tab = (int *) malloc (NB_RAND * sizeof(int)) ;\
rand_pos = 1 ;\
- while (rand_pos != 0)\
- rand_tab [rand_pos++] = rand () ;
+ while (rand_pos != 0) rand_tab [rand_pos++] = rand () ;
-#define RAND()\
- (rand_tab[rand_pos = (rand_pos + 1) % NB_RAND])
+
+static inline int RAND() {
+ ++rand_pos;
+ return rand_tab[rand_pos];
+}
#define RAND_CLOSE()\
free (rand_tab);\
rand_tab = 0;
-/* #define iRAND(i) ((guint32)((float)i * RAND()/RAND_MAX)) */
+//#define iRAND(i) ((guint32)((float)i * RAND()/RAND_MAX))
#define iRAND(i) (RAND()%i)
+//inline unsigned int RAND(void);
+//inline unsigned int iRAND(int i);
+
#endif
diff --git a/src/post/goom/graphic.c b/src/post/goom/graphic.c
index 10f3c7773..8ff08ff14 100644
--- a/src/post/goom/graphic.c
+++ b/src/post/goom/graphic.c
@@ -14,4 +14,17 @@ unsigned int HEIGHT;
unsigned int WIDTH;
int *rand_tab = 0;
-unsigned short int rand_pos = 0;
+//unsigned short int rand_pos = 0;
+/*
+inline unsigned int RAND(void)
+{
+ rand_pos++;
+ return rand_tab[rand_pos];
+}
+
+inline unsigned int iRAND(int i)
+{
+ rand_pos++;
+ return (rand_tab[rand_pos])%i;
+}
+*/
diff --git a/src/post/goom/ifs.c b/src/post/goom/ifs.c
index fa1c2c190..985e0d5b2 100644
--- a/src/post/goom/ifs.c
+++ b/src/post/goom/ifs.c
@@ -33,7 +33,7 @@ static const char sccsid[] = "@(#)ifs.c 5.00 2002/04/11 baffe";
* that onto the screen, to reduce flicker.
*/
-/*#ifdef STANDALONE */
+//#ifdef STANDALONE
#include <math.h>
#include <stdlib.h>
@@ -55,24 +55,24 @@ static const char sccsid[] = "@(#)ifs.c 5.00 2002/04/11 baffe";
#define SMOOTH_COLORS
-/*#include "xlockmore.h" */ /* in xscreensaver distribution */
-/*#else */ /* STANDALONE */
-/*#include "xlock.h" */ /* in xlockmore distribution */
-/*#endif */ /* STANDALONE */
+//#include "xlockmore.h" /* in xscreensaver distribution */
+//#else /* STANDALONE */
+//#include "xlock.h" /* in xlockmore distribution */
+//#endif /* STANDALONE */
-/*#ifdef MODE_ifs */
+//#ifdef MODE_ifs
-/*ModeSpecOpt ifs_opts = */
-/*{0, (XrmOptionDescRec *) NULL, 0, (argtype *) NULL, (OptionStruct *) NULL}; */
+//ModeSpecOpt ifs_opts =
+//{0, (XrmOptionDescRec *) NULL, 0, (argtype *) NULL, (OptionStruct *) NULL};
-/*#ifdef USE_MODULES */
-/*ModStruct ifs_description = */
-/*{"ifs", "init_ifs", "draw_ifs", "release_ifs", */
-/* "init_ifs", "init_ifs", (char *) NULL, &ifs_opts, */
-/* 1000, 1, 1, 1, 64, 1.0, "", */
-/* "Shows a modified iterated function system", 0, NULL}; */
+//#ifdef USE_MODULES
+//ModStruct ifs_description =
+//{"ifs", "init_ifs", "draw_ifs", "release_ifs",
+// "init_ifs", "init_ifs", (char *) NULL, &ifs_opts,
+// 1000, 1, 1, 1, 64, 1.0, "",
+// "Shows a modified iterated function system", 0, NULL};
-/*#endif */
+//#endif
#include "goom_tools.h"
@@ -137,8 +137,8 @@ struct Fractal_Struct
int Cur_Pt, Max_Pt;
IFSPoint *Buffer1, *Buffer2;
-/* Pixmap dbuf; */
-/* GC dbuf_gc; */
+// Pixmap dbuf;
+// GC dbuf_gc;
};
static FRACTAL *Root = (FRACTAL *) NULL, *Cur_F;
@@ -214,7 +214,7 @@ init_ifs (int width, int height)
int i;
FRACTAL *Fractal;
-/* printf ("initing ifs\n"); */
+// printf ("initing ifs\n");
if (Root == NULL) {
Root = (FRACTAL *) malloc (sizeof (FRACTAL));
@@ -225,9 +225,9 @@ init_ifs (int width, int height)
}
Fractal = Root;
-/* fprintf (stderr,"--ifs freeing ex-buffers\n"); */
+// fprintf (stderr,"--ifs freeing ex-buffers\n");
free_ifs_buffers (Fractal);
-/* fprintf (stderr,"--ifs ok\n"); */
+// fprintf (stderr,"--ifs ok\n");
i = (NRAND (4)) + 2; /* Number of centers */
switch (i) {
@@ -260,7 +260,7 @@ init_ifs (int width, int height)
Fractal->dr2_mean = .4;
break;
}
-/* fprintf( stderr, "N=%d\n", i ); */
+// fprintf( stderr, "N=%d\n", i );
Fractal->Nb_Simi = i;
Fractal->Max_Pt = Fractal->Nb_Simi - 1;
for (i = 0; i <= Fractal->Depth + 2; ++i)
@@ -277,7 +277,7 @@ init_ifs (int width, int height)
return;
}
-/* printf ("--ifs setting params\n"); */
+// printf ("--ifs setting params\n");
Fractal->Speed = 6;
Fractal->Width = width; /* modif by JeKo */
Fractal->Height = height; /* modif by JeKo */
@@ -295,9 +295,8 @@ init_ifs (int width, int height)
* XFreePixmap(display, Fractal->dbuf);
* Fractal->dbuf = XCreatePixmap(display, window,
* Fractal->Width, Fractal->Height, 1);
- */
- /* Allocation checked */
- /* if (Fractal->dbuf != None) {
+ * /* Allocation checked *
+ * if (Fractal->dbuf != None) {
* XGCValues gcv;
*
* gcv.foreground = 0;
@@ -321,10 +320,10 @@ init_ifs (int width, int height)
* }
* #endif
*/
- /* MI_CLEARWINDOW(mi); */
+ // MI_CLEARWINDOW(mi);
/* don't want any exposure events from XCopyPlane */
- /* XSetGraphicsExposures(display, gc, False); */
+ // XSetGraphicsExposures(display, gc, False);
}
@@ -342,21 +341,21 @@ Transform (SIMI * Simi, F_PT xo, F_PT yo, F_PT * x, F_PT * y)
F_PT xx, yy;
xo = xo - Simi->Cx;
- xo = (xo * Simi->R) / UNIT;
+ xo = (xo * Simi->R) >> FIX; // / UNIT;
yo = yo - Simi->Cy;
- yo = (yo * Simi->R) / UNIT;
+ yo = (yo * Simi->R) >> FIX; // / UNIT;
xx = xo - Simi->Cx;
- xx = (xx * Simi->R2) / UNIT;
+ xx = (xx * Simi->R2) >> FIX; // / UNIT;
yy = -yo - Simi->Cy;
- yy = (yy * Simi->R2) / UNIT;
+ yy = (yy * Simi->R2) >> FIX; // / UNIT;
*x =
- ((xo * Simi->Ct - yo * Simi->St + xx * Simi->Ct2 - yy * Simi->St2) /
- UNIT) + Simi->Cx;
+ ((xo * Simi->Ct - yo * Simi->St + xx * Simi->Ct2 - yy * Simi->St2)
+ >> FIX /* / UNIT */ ) + Simi->Cx;
*y =
- ((xo * Simi->St + yo * Simi->Ct + xx * Simi->St2 + yy * Simi->Ct2) /
- UNIT) + Simi->Cy;
+ ((xo * Simi->St + yo * Simi->Ct + xx * Simi->St2 + yy * Simi->Ct2)
+ >> FIX /* / UNIT */ ) + Simi->Cy;
}
/***************************************************************/
@@ -371,8 +370,8 @@ Trace (FRACTAL * F, F_PT xo, F_PT yo)
for (i = Cur_F->Nb_Simi; i; --i, Cur++) {
Transform (Cur, xo, yo, &x, &y);
- Buf->x = F->Lx + (x * F->Lx / (UNIT * 2));
- Buf->y = F->Ly - (y * F->Ly / (UNIT * 2));
+ Buf->x = F->Lx + ((x * F->Lx) >> (FIX+1) /* /(UNIT*2) */ );
+ Buf->y = F->Ly - ((y * F->Ly) >> (FIX+1) /* /(UNIT*2) */ );
Buf++;
Cur_Pt++;
@@ -468,7 +467,7 @@ draw_ifs ( /* ModeInfo * mi */ int *nbpt)
if (Root == NULL)
return NULL;
- F = Root; /* [ */ /*MI_SCREEN(mi)*/ /* 0]; */
+ F = Root; // [/*MI_SCREEN(mi)*/0];
if (F->Buffer1 == NULL)
return NULL;
@@ -496,7 +495,7 @@ draw_ifs ( /* ModeInfo * mi */ int *nbpt)
S->A2 = u0 * S1->A2 + u1 * S2->A2 + u2 * S3->A2 + u3 * S4->A2;
}
- /* MI_IS_DRAWN(mi) = True; */
+ // MI_IS_DRAWN(mi) = True;
Draw_Fractal ( /* mi */ );
@@ -538,7 +537,7 @@ draw_ifs ( /* ModeInfo * mi */ int *nbpt)
/***************************************************************/
void
-release_ifs (void)
+release_ifs ()
{
if (Root != NULL) {
(void) free ((void *) Root);
@@ -546,4 +545,4 @@ release_ifs (void)
}
}
-/*#endif */ /* MODE_ifs */
+//#endif /* MODE_ifs */
diff --git a/src/post/goom/ifs.h b/src/post/goom/ifs.h
index 9cb19514f..1fdaeabaa 100644
--- a/src/post/goom/ifs.h
+++ b/src/post/goom/ifs.h
@@ -13,16 +13,16 @@ typedef struct _ifsPoint
}
IFSPoint;
-/* init ifs for a (width)x(height) output. */
+// init ifs for a (width)x(height) output.
void init_ifs (int width, int height);
-/* draw an ifs on the buffer (which size is width * height) */
-/* increment means that we draw 1/increment of the ifs's points */
+// draw an ifs on the buffer (which size is width * height)
+// increment means that we draw 1/increment of the ifs's points
void ifs_update (guint32 * buffer, guint32 * back, int width, int height,
int increment);
-/* free all ifs's data. */
-void release_ifs (void);
+// free all ifs's data.
+void release_ifs ();
/* DONT USE !!! deprecated
diff --git a/src/post/goom/ifs_display.c b/src/post/goom/ifs_display.c
index c3d3783f3..ed570f59a 100644
--- a/src/post/goom/ifs_display.c
+++ b/src/post/goom/ifs_display.c
@@ -1,61 +1,11 @@
#include "ifs.h"
#include "goom_config.h"
-#include "xineutils.h"
-extern volatile int use_asm;
-
-#ifdef MMX
-static void
-ifs_fun_mmx(guint32 * data, guint32 * back, int width, int height,
- int increment, int nbpt, IFSPoint *points, int couleursl)
-{
- int i;
-
- movd_m2r(couleursl,mm1);
- for (i = 0; i < nbpt; i += increment) {
- int x = points[i].x;
- int y = points[i].y;
-
- if ((x < width) && (y < height) && (x > 0) && (y > 0)) {
- int pos = x + (y * width);
- movd_m2r(back[pos],mm0);
- paddusb_r2r(mm1,mm0);
- movd_r2m(mm0,data[pos]);
- }
- }
- emms();
-}
+#ifdef HAVE_MMX
+#include "mmx.h"
#endif
-static void
-ifs_fun_c(guint32 * data, guint32 * back, int width, int height,
- int increment, int nbpt, IFSPoint *points, int couleursl)
-{
- int i;
- for (i = 0; i < nbpt; i += increment) {
- int x = (int) points[i].x & 0x7fffffff;
- int y = (int) points[i].y & 0x7fffffff;
-
- if ((x < width) && (y < height)) {
- int pos = x + (int) (y * width);
- int tra = 0, i = 0;
- unsigned char *bra = (unsigned char *) &back[pos];
- unsigned char *dra = (unsigned char *) &data[pos];
- unsigned char *cra = (unsigned char *) &couleursl;
-
- for (; i < 4; i++) {
- tra = *cra;
- tra += *bra;
- if (tra > 255)
- tra = 255;
- *dra = tra;
- ++dra;
- ++cra;
- ++bra;
- }
- }
- }
-}
+#include "goom_tools.h"
void
ifs_update (guint32 * data, guint32 * back, int width, int height,
@@ -100,13 +50,45 @@ ifs_update (guint32 * data, guint32 * back, int width, int height,
points = draw_ifs (&nbpt);
nbpt--;
-#ifdef MMX
- if (use_asm)
- ifs_fun_mmx(data, back, width, height, increment, nbpt, points, couleursl);
- else
- ifs_fun_c(data, back, width, height, increment, nbpt, points, couleursl);
+#ifdef HAVE_MMX
+ movd_m2r (couleursl, mm1);
+ punpckldq_r2r (mm1, mm1);
+ for (i = 0; i < nbpt; i += increment) {
+ int x = points[i].x;
+ int y = points[i].y;
+
+ if ((x < width) && (y < height) && (x > 0) && (y > 0)) {
+ int pos = x + (y * width);
+ movd_m2r (back[pos], mm0);
+ paddusb_r2r (mm1, mm0);
+ movd_r2m (mm0, data[pos]);
+ }
+ }
+ emms();/*__asm__ __volatile__ ("emms");*/
#else
- ifs_fun_c(data, back, width, height, increment, nbpt, points, couleursl);
+ for (i = 0; i < nbpt; i += increment) {
+ int x = (int) points[i].x & 0x7fffffff;
+ int y = (int) points[i].y & 0x7fffffff;
+
+ if ((x < width) && (y < height)) {
+ int pos = x + (int) (y * width);
+ int tra = 0, i = 0;
+ unsigned char *bra = (unsigned char *) &back[pos];
+ unsigned char *dra = (unsigned char *) &data[pos];
+ unsigned char *cra = (unsigned char *) &couleursl;
+
+ for (; i < 4; i++) {
+ tra = *cra;
+ tra += *bra;
+ if (tra > 255)
+ tra = 255;
+ *dra = tra;
+ ++dra;
+ ++cra;
+ ++bra;
+ }
+ }
+ }
#endif /*MMX*/
justChanged--;
@@ -119,17 +101,17 @@ ifs_update (guint32 * data, guint32 * back, int width, int height,
col[BLEU] += v[BLEU];
if (col[BLEU] > 255) {
col[BLEU] = 255;
- v[BLEU] = -(rand () % 4) - 1;
+ v[BLEU] = -(RAND() % 4) - 1;
}
if (col[BLEU] < 32) {
col[BLEU] = 32;
- v[BLEU] = (rand () % 4) + 1;
+ v[BLEU] = (RAND() % 4) + 1;
}
col[VERT] += v[VERT];
if (col[VERT] > 200) {
col[VERT] = 200;
- v[VERT] = -(rand () % 3) - 2;
+ v[VERT] = -(RAND() % 3) - 2;
}
if (col[VERT] > col[BLEU]) {
col[VERT] = col[BLEU];
@@ -137,33 +119,33 @@ ifs_update (guint32 * data, guint32 * back, int width, int height,
}
if (col[VERT] < 32) {
col[VERT] = 32;
- v[VERT] = (rand () % 3) + 2;
+ v[VERT] = (RAND() % 3) + 2;
}
col[ROUGE] += v[ROUGE];
if (col[ROUGE] > 64) {
col[ROUGE] = 64;
- v[ROUGE] = -(rand () % 4) - 1;
+ v[ROUGE] = -(RAND () % 4) - 1;
}
if (col[ROUGE] < 0) {
col[ROUGE] = 0;
- v[ROUGE] = (rand () % 4) + 1;
+ v[ROUGE] = (RAND () % 4) + 1;
}
col[ALPHA] += v[ALPHA];
if (col[ALPHA] > 0) {
col[ALPHA] = 0;
- v[ALPHA] = -(rand () % 4) - 1;
+ v[ALPHA] = -(RAND () % 4) - 1;
}
if (col[ALPHA] < 0) {
col[ALPHA] = 0;
- v[ALPHA] = (rand () % 4) + 1;
+ v[ALPHA] = (RAND () % 4) + 1;
}
if (((col[VERT] > 32) && (col[ROUGE] < col[VERT] + 40)
&& (col[VERT] < col[ROUGE] + 20) && (col[BLEU] < 64)
- && (rand () % 20 == 0)) && (justChanged < 0)) {
- mode = rand () % 3 ? MOD_FEU : MOD_MERVER;
+ && (RAND () % 20 == 0)) && (justChanged < 0)) {
+ mode = RAND () % 3 ? MOD_FEU : MOD_MERVER;
justChanged = 250;
}
}
@@ -171,17 +153,17 @@ ifs_update (guint32 * data, guint32 * back, int width, int height,
col[BLEU] += v[BLEU];
if (col[BLEU] > 128) {
col[BLEU] = 128;
- v[BLEU] = -(rand () % 4) - 1;
+ v[BLEU] = -(RAND () % 4) - 1;
}
if (col[BLEU] < 16) {
col[BLEU] = 16;
- v[BLEU] = (rand () % 4) + 1;
+ v[BLEU] = (RAND () % 4) + 1;
}
col[VERT] += v[VERT];
if (col[VERT] > 200) {
col[VERT] = 200;
- v[VERT] = -(rand () % 3) - 2;
+ v[VERT] = -(RAND () % 3) - 2;
}
if (col[VERT] > col[ALPHA]) {
col[VERT] = col[ALPHA];
@@ -189,33 +171,33 @@ ifs_update (guint32 * data, guint32 * back, int width, int height,
}
if (col[VERT] < 32) {
col[VERT] = 32;
- v[VERT] = (rand () % 3) + 2;
+ v[VERT] = (RAND () % 3) + 2;
}
col[ROUGE] += v[ROUGE];
if (col[ROUGE] > 128) {
col[ROUGE] = 128;
- v[ROUGE] = -(rand () % 4) - 1;
+ v[ROUGE] = -(RAND () % 4) - 1;
}
if (col[ROUGE] < 0) {
col[ROUGE] = 0;
- v[ROUGE] = (rand () % 4) + 1;
+ v[ROUGE] = (RAND () % 4) + 1;
}
col[ALPHA] += v[ALPHA];
if (col[ALPHA] > 255) {
col[ALPHA] = 255;
- v[ALPHA] = -(rand () % 4) - 1;
+ v[ALPHA] = -(RAND () % 4) - 1;
}
if (col[ALPHA] < 0) {
col[ALPHA] = 0;
- v[ALPHA] = (rand () % 4) + 1;
+ v[ALPHA] = (RAND () % 4) + 1;
}
if (((col[VERT] > 32) && (col[ROUGE] < col[VERT] + 40)
&& (col[VERT] < col[ROUGE] + 20) && (col[BLEU] < 64)
- && (rand () % 20 == 0)) && (justChanged < 0)) {
- mode = rand () % 3 ? MOD_FEU : MOD_MER;
+ && (RAND () % 20 == 0)) && (justChanged < 0)) {
+ mode = RAND () % 3 ? MOD_FEU : MOD_MER;
justChanged = 250;
}
}
@@ -224,57 +206,57 @@ ifs_update (guint32 * data, guint32 * back, int width, int height,
col[BLEU] += v[BLEU];
if (col[BLEU] > 64) {
col[BLEU] = 64;
- v[BLEU] = -(rand () % 4) - 1;
+ v[BLEU] = -(RAND () % 4) - 1;
}
if (col[BLEU] < 0) {
col[BLEU] = 0;
- v[BLEU] = (rand () % 4) + 1;
+ v[BLEU] = (RAND () % 4) + 1;
}
col[VERT] += v[VERT];
if (col[VERT] > 200) {
col[VERT] = 200;
- v[VERT] = -(rand () % 3) - 2;
+ v[VERT] = -(RAND () % 3) - 2;
}
if (col[VERT] > col[ROUGE] + 20) {
col[VERT] = col[ROUGE] + 20;
- v[VERT] = -(rand () % 3) - 2;
- v[ROUGE] = (rand () % 4) + 1;
- v[BLEU] = (rand () % 4) + 1;
+ v[VERT] = -(RAND () % 3) - 2;
+ v[ROUGE] = (RAND () % 4) + 1;
+ v[BLEU] = (RAND () % 4) + 1;
}
if (col[VERT] < 0) {
col[VERT] = 0;
- v[VERT] = (rand () % 3) + 2;
+ v[VERT] = (RAND () % 3) + 2;
}
col[ROUGE] += v[ROUGE];
if (col[ROUGE] > 255) {
col[ROUGE] = 255;
- v[ROUGE] = -(rand () % 4) - 1;
+ v[ROUGE] = -(RAND () % 4) - 1;
}
if (col[ROUGE] > col[VERT] + 40) {
col[ROUGE] = col[VERT] + 40;
- v[ROUGE] = -(rand () % 4) - 1;
+ v[ROUGE] = -(RAND () % 4) - 1;
}
if (col[ROUGE] < 0) {
col[ROUGE] = 0;
- v[ROUGE] = (rand () % 4) + 1;
+ v[ROUGE] = (RAND () % 4) + 1;
}
col[ALPHA] += v[ALPHA];
if (col[ALPHA] > 0) {
col[ALPHA] = 0;
- v[ALPHA] = -(rand () % 4) - 1;
+ v[ALPHA] = -(RAND () % 4) - 1;
}
if (col[ALPHA] < 0) {
col[ALPHA] = 0;
- v[ALPHA] = (rand () % 4) + 1;
+ v[ALPHA] = (RAND () % 4) + 1;
}
if (((col[ROUGE] < 64) && (col[VERT] > 32) && (col[VERT] < col[BLEU])
&& (col[BLEU] > 32)
- && (rand () % 20 == 0)) && (justChanged < 0)) {
- mode = rand () % 2 ? MOD_MER : MOD_MERVER;
+ && (RAND () % 20 == 0)) && (justChanged < 0)) {
+ mode = RAND () % 2 ? MOD_MER : MOD_MERVER;
justChanged = 250;
}
}
diff --git a/src/post/goom/lines.c b/src/post/goom/lines.c
index e7a9b60e0..5d3d2dba6 100644
--- a/src/post/goom/lines.c
+++ b/src/post/goom/lines.c
@@ -1,10 +1,5 @@
/*
* lines.c
- * iTunesXPlugIn
- *
- * Created by guillaum on Tue Aug 14 2001.
- * Copyright (c) 2001 __CompanyName__. All rights reserved.
- *
*/
#include "lines.h"
@@ -16,192 +11,43 @@
extern unsigned int resolx, c_resoly;
-#define DRAWMETHOD DRAWMETHOD_PLUS(*p,*p,col)
-
-static void
-draw_line (int *data, int x1, int y1, int x2, int y2, int col, int screenx,
- int screeny)
+static inline unsigned char
+lighten (unsigned char value, float power)
{
- int x, y, dx, dy, yy, xx;
- int *p;
-
-/* DATA32 *p; */
-/* DATA8 aaa, nr, ng, nb, rr, gg, bb, aa, na; */
-
- /* clip to top edge */
- if ((y1 < 0) && (y2 < 0))
- return;
- if (y1 < 0) {
- x1 += (y1 * (x1 - x2)) / (y2 - y1);
- y1 = 0;
- }
- if (y2 < 0) {
- x2 += (y2 * (x1 - x2)) / (y2 - y1);
- y2 = 0;
- }
- /* clip to bottom edge */
- if ((y1 >= screeny) && (y2 >= screeny))
- return;
- if (y1 >= screeny) {
- x1 -= ((screeny - y1) * (x1 - x2)) / (y2 - y1);
- y1 = screeny - 1;
- }
- if (y2 >= screeny) {
- x2 -= ((screeny - y2) * (x1 - x2)) / (y2 - y1);
- y2 = screeny - 1;
- }
- /* clip to left edge */
- if ((x1 < 0) && (x2 < 0))
- return;
- if (x1 < 0) {
- y1 += (x1 * (y1 - y2)) / (x2 - x1);
- x1 = 0;
- }
- if (x2 < 0) {
- y2 += (x2 * (y1 - y2)) / (x2 - x1);
- x2 = 0;
- }
- /* clip to right edge */
- if ((x1 >= screenx) && (x2 >= screenx))
- return;
- if (x1 >= screenx) {
- y1 -= ((screenx - x1) * (y1 - y2)) / (x2 - x1);
- x1 = screenx - 1;
- }
- if (x2 >= screenx) {
- y2 -= ((screenx - x2) * (y1 - y2)) / (x2 - x1);
- x2 = screenx - 1;
- }
- dx = x2 - x1;
- dy = y2 - y1;
- if (x1 > x2) {
- int tmp;
-
- tmp = x1;
- x1 = x2;
- x2 = tmp;
- tmp = y1;
- y1 = y2;
- y2 = tmp;
- dx = x2 - x1;
- dy = y2 - y1;
- }
+ int val = value;
+ float t = (float) val * log10(power) / 2.0;
- /* vertical line */
- if (dx == 0) {
- if (y1 < y2) {
- p = &(data[(screenx * y1) + x1]);
- for (y = y1; y <= y2; y++) {
- DRAWMETHOD;
- p += screenx;
- }
- }
- else {
- p = &(data[(screenx * y2) + x1]);
- for (y = y2; y <= y1; y++) {
- DRAWMETHOD;
- p += screenx;
- }
- }
- return;
- }
- /* horizontal line */
- if (dy == 0) {
- if (x1 < x2) {
- p = &(data[(screenx * y1) + x1]);
- for (x = x1; x <= x2; x++) {
- DRAWMETHOD;
- p++;
- }
- return;
- }
- else {
- p = &(data[(screenx * y1) + x2]);
- for (x = x2; x <= x1; x++) {
- DRAWMETHOD;
- p++;
- }
- return;
- }
- }
- /* 1 */
- /* \ */
- /* \ */
- /* 2 */
- if (y2 > y1) {
- /* steep */
- if (dy > dx) {
- dx = ((dx << 16) / dy);
- x = x1 << 16;
- for (y = y1; y <= y2; y++) {
- xx = x >> 16;
- p = &(data[(screenx * y) + xx]);
- DRAWMETHOD;
- if (xx < (screenx - 1)) {
- p++;
-/* DRAWMETHOD; */
- }
- x += dx;
- }
- return;
- }
- /* shallow */
- else {
- dy = ((dy << 16) / dx);
- y = y1 << 16;
- for (x = x1; x <= x2; x++) {
- yy = y >> 16;
- p = &(data[(screenx * yy) + x]);
- DRAWMETHOD;
- if (yy < (screeny - 1)) {
- p += screeny;
-/* DRAWMETHOD; */
- }
- y += dy;
- }
- }
+ if (t > 0) {
+ val = (int) t; // (32.0f * log (t));
+ if (val > 255)
+ val = 255;
+ if (val < 0)
+ val = 0;
+ return val;
}
- /* 2 */
- /* / */
- /* / */
- /* 1 */
else {
- /* steep */
- if (-dy > dx) {
- dx = ((dx << 16) / -dy);
- x = (x1 + 1) << 16;
- for (y = y1; y >= y2; y--) {
- xx = x >> 16;
- p = &(data[(screenx * y) + xx]);
- DRAWMETHOD;
- if (xx < (screenx - 1)) {
- p--;
-/* DRAWMETHOD; */
- }
- x += dx;
- }
- return;
- }
- /* shallow */
- else {
- dy = ((dy << 16) / dx);
- y = y1 << 16;
- for (x = x1; x <= x2; x++) {
- yy = y >> 16;
- p = &(data[(screenx * yy) + x]);
- DRAWMETHOD;
- if (yy < (screeny - 1)) {
- p += screeny;
-/* DRAWMETHOD; */
- }
- y += dy;
- }
- return;
- }
+ return 0;
}
}
static void
+lightencolor (int *col, float power)
+{
+ unsigned char *color;
+
+ color = (unsigned char *) col;
+ *color = lighten (*color, power);
+ color++;
+ *color = lighten (*color, power);
+ color++;
+ *color = lighten (*color, power);
+ color++;
+ *color = lighten (*color, power);
+}
+
+
+
+void
genline (int id, float param, GMUnitPointer * l, int rx, int ry)
{
int i;
@@ -235,23 +81,23 @@ genline (int id, float param, GMUnitPointer * l, int rx, int ry)
}
}
-static guint32 getcouleur (int mode)
+guint32 getcouleur (int mode)
{
switch (mode) {
case GML_RED:
- return (230 << (ROUGE * 8)) | (120 << (VERT * 8));
+ return (230 << (ROUGE * 8)) | (120 << (VERT * 8)) | (10 << (BLEU * 8));
case GML_ORANGE_J:
- return (120 << (VERT * 8)) | (252 << (ROUGE * 8));
+ return (120 << (VERT * 8)) | (252 << (ROUGE * 8)) | (10 << (BLEU * 8));
case GML_ORANGE_V:
return (160 << (VERT * 8)) | (236 << (ROUGE * 8)) | (40 << (BLEU * 8));
case GML_BLEUBLANC:
return (40 << (BLEU * 8)) | (220 << (ROUGE * 8)) | (140 << (VERT * 8));
case GML_VERT:
- return (200 << (VERT * 8)) | (80 << (ROUGE * 8));
+ return (200 << (VERT * 8)) | (80 << (ROUGE * 8)) | (10 << (BLEU * 8));
case GML_BLEU:
return (250 << (BLEU * 8)) | (30 << (VERT * 8)) | (80 << (ROUGE * 8));
case GML_BLACK:
- return 0x10 << (BLEU * 8);
+ return 0x5 << (BLEU * 8);
}
return 0;
}
@@ -260,6 +106,8 @@ void
goom_lines_set_res (GMLine * gml, int rx, int ry)
{
if (gml != NULL) {
+ //int i;
+
gml->screenX = rx;
gml->screenY = ry;
@@ -268,7 +116,7 @@ goom_lines_set_res (GMLine * gml, int rx, int ry)
}
-static void
+void
goom_lines_move (GMLine * l)
{
int i;
@@ -294,58 +142,28 @@ goom_lines_move (GMLine * l)
}
l->power += l->powinc;
- if (l->power < -2.6f) {
- l->power = -2.6f;
- l->powinc = (float) (iRAND (20) + 10) / 600.0f;
+ if (l->power < 1.1f) {
+ l->power = 1.1f;
+ l->powinc = (float) (iRAND (20) + 10) / 300.0f;
}
- if (l->power > 0.6f) {
- l->power = 0.6f;
- l->powinc = -(float) (iRAND (20) + 10) / 600.0f;
+ if (l->power > 17.5f) {
+ l->power = 17.5f;
+ l->powinc = -(float) (iRAND (20) + 10) / 300.0f;
}
+
+ l->amplitude = (99.0f * l->amplitude + l->amplitudeF) / 100.0f;
}
void
-goom_lines_switch_to (GMLine * gml, int IDdest, float param, int col)
+goom_lines_switch_to (GMLine * gml, int IDdest,
+ float param, float amplitude, int col)
{
genline (IDdest, param, gml->points2, gml->screenX, gml->screenY);
gml->IDdest = IDdest;
gml->param = param;
+ gml->amplitudeF = amplitude;
gml->color2 = getcouleur (col);
-/* printf ("couleur %d : %x\n",col,gml->color2); */
-}
-
-static inline unsigned char
-lighten (unsigned char value, float power)
-{
- int val = value;
- float t = exp ((float) val / 32.0f) + power;
-
- if (t > 0) {
- val = (int) (32.0f * log (t));
- if (val > 255)
- val = 255;
- if (val < 0)
- val = 0;
- return val;
- }
- else {
- return 0;
- }
-}
-
-static void
-lightencolor (int *col, float power)
-{
- unsigned char *color;
-
- color = (unsigned char *) col;
- *color = lighten (*color, power);
- color++;
- *color = lighten (*color, power);
- color++;
- *color = lighten (*color, power);
- color++;
- *color = lighten (*color, power);
+// printf ("couleur %d : %x\n",col,gml->color2);
}
GMLine *
@@ -353,6 +171,10 @@ goom_lines_init (int rx, int ry,
int IDsrc, float paramS, int coulS,
int IDdest, float paramD, int coulD)
{
+ //int i;
+ //unsigned char *color;
+ //unsigned char power = 4;
+
GMLine *l = (GMLine *) malloc (sizeof (GMLine));
l->points = (GMUnitPointer *) malloc (512 * sizeof (GMUnitPointer));
@@ -361,6 +183,8 @@ goom_lines_init (int rx, int ry,
l->IDdest = IDdest;
l->param = paramD;
+
+ l->amplitude = l->amplitudeF = 1.0f;
genline (IDsrc, paramS, l->points, rx, ry);
genline (IDdest, paramD, l->points2, rx, ry);
@@ -374,7 +198,7 @@ goom_lines_init (int rx, int ry,
l->power = 0.0f;
l->powinc = 0.01f;
- goom_lines_switch_to (l, IDdest, paramD, coulD);
+ goom_lines_switch_to (l, IDdest, paramD, 1.0f, coulD);
return l;
}
@@ -400,8 +224,8 @@ goom_lines_draw (GMLine * line, gint16 data[512], unsigned int *p)
lightencolor (&color, line->power);
- x1 = (int) (pt->x + cosa * data[0]);
- y1 = (int) (pt->y + sina * data[0]);
+ x1 = (int) (pt->x + cosa * line->amplitude * data[0]);
+ y1 = (int) (pt->y + sina * line->amplitude * data[0]);
for (i = 1; i < 512; i++) {
int x2, y2;
@@ -410,11 +234,12 @@ goom_lines_draw (GMLine * line, gint16 data[512], unsigned int *p)
float cosa = cos (pt->angle) / 1000.0f;
float sina = sin (pt->angle) / 1000.0f;
- x2 = (int) (pt->x + cosa * data[i]);
- y2 = (int) (pt->y + sina * data[i]);
+ x2 = (int) (pt->x + cosa * line->amplitude * data[i]);
+ y2 = (int) (pt->y + sina * line->amplitude * data[i]);
draw_line (p, x1, y1, x2, y2, color, line->screenX, line->screenY);
DRAWMETHOD_DONE ();
+
x1 = x2;
y1 = y2;
}
diff --git a/src/post/goom/lines.h b/src/post/goom/lines.h
index bb1b2e416..3401cb38a 100644
--- a/src/post/goom/lines.h
+++ b/src/post/goom/lines.h
@@ -17,7 +17,7 @@ typedef struct _GMUNITPOINTER
}
GMUnitPointer;
-/* tableau de points */
+// tableau de points
typedef struct _GMLINE
{
@@ -25,6 +25,8 @@ typedef struct _GMLINE
GMUnitPointer *points2;
int IDdest;
float param;
+ float amplitudeF;
+ float amplitude;
int nbPoints;
guint32 color; /* pr l'instant je stocke la ouuleur * * a *
@@ -40,18 +42,18 @@ typedef struct _GMLINE
}
GMLine;
-/* les ID possibles */
+// les ID possibles
#define GML_CIRCLE 0
-/* (param = radius) */
+// (param = radius)
#define GML_HLINE 1
-/* (param = y) */
+// (param = y)
#define GML_VLINE 2
-/* (param = x) */
+// (param = x)
-/* les modes couleur possible (si tu mets un autre c'est noir) */
+// les modes couleur possible (si tu mets un autre c'est noir)
#define GML_BLEUBLANC 0
#define GML_RED 1
@@ -67,7 +69,7 @@ GMLine *goom_lines_init (int rx, int ry,
int IDdest, float paramD, int modeCoulDest);
void goom_lines_switch_to (GMLine * gml, int IDdest, float param,
-
+ float amplitude,
int modeCoul);
void goom_lines_set_res (GMLine * gml, int rx, int ry);
@@ -76,4 +78,4 @@ void goom_lines_free (GMLine ** gml);
void goom_lines_draw (GMLine * gml, gint16 data[512], unsigned int *p);
-/*void goom_lines_conf(gint16 config [25]); */
+//void goom_lines_conf(gint16 config [25]);
diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c
index 137aa3323..c5b48ed73 100644
--- a/src/post/goom/xine_goom.c
+++ b/src/post/goom/xine_goom.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_goom.c,v 1.34 2003/08/04 03:47:10 miguelfreitas Exp $
+ * $Id: xine_goom.c,v 1.35 2003/09/14 15:45:55 tmattern Exp $
*
* GOOM post plugin.
*
@@ -98,6 +98,11 @@ struct post_plugin_goom_s {
/* frame skipping */
int skip_frame;
+ int title_flag;
+ char *msg;
+ int msg_index;
+ int msg_flag;
+ char msg_buf[1024];
};
typedef struct post_goom_out_s post_goom_out_t;
@@ -174,16 +179,6 @@ static void height_changed_cb(void *data, xine_cfg_entry_t *cfg) {
}
}
-static void use_asm_changed_cb(void *data, xine_cfg_entry_t *cfg) {
- post_class_goom_t *class = (post_class_goom_t*) data;
-
- if(class->ip) {
- post_plugin_goom_t *this = class->ip;
- this->use_asm = cfg->num_value;
- goom_setAsmUse(this->use_asm);
- }
-}
-
static void csc_method_changed_cb(void *data, xine_cfg_entry_t *cfg) {
post_class_goom_t *class = (post_class_goom_t*) data;
@@ -223,20 +218,6 @@ static void *goom_init_plugin(xine_t *xine, void *data)
NULL, 20, height_changed_cb, this);
-#ifdef ARCH_X86
- if (xine_mm_accel() & MM_ACCEL_X86_MMX) {
- cfg->register_bool (cfg, "post.goom_use_asm", 1,
- _("Use Goom asm optimizations"),
- NULL, 10, use_asm_changed_cb, this);
- }
-#endif
-
-#ifdef ARCH_PPC
- cfg->register_bool (cfg, "post.goom_use_asm", 1,
- _("Use Goom asm optimizations"),
- NULL, 10, use_asm_changed_cb, this);
-#endif
-
cfg->register_enum (cfg, "post.goom_csc_method", 0,
(char **)goom_csc_methods,
_("Colorspace conversion method used by Goom"),
@@ -292,16 +273,18 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs,
&height_entry))
height_changed_cb(class, &height_entry);
- if(xine_config_lookup_entry(class->xine, "post.goom_use_asm",
- &use_asm_entry))
- use_asm_changed_cb(class, &use_asm_entry);
-
if(xine_config_lookup_entry(class->xine, "post.goom_csc_method",
&csc_method_entry))
csc_method_changed_cb(class, &csc_method_entry);
this->width_back = this->width;
this->height_back = this->height;
+
+ this->title_flag = 0;
+ this->msg_flag = 0;
+ this->msg_index = 0;
+ this->msg = NULL;
+
goom_init (this->width_back, this->height_back, 0);
this->ratio = (double)this->width_back/(double)this->height_back;
@@ -581,6 +564,7 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
if (!this->skip_frame) {
/* Try to be fast */
goom_frame = (uint8_t *)goom_update (this->data, 0, 0, NULL, NULL);
+
dest_ptr = frame -> base[0];
goom_frame_end = goom_frame + 4 * (this->width_back * this->height_back);
diff --git a/src/post/goom/zoom_filter_mmx.c b/src/post/goom/zoom_filter_mmx.c
index de8a37096..6e121f643 100644
--- a/src/post/goom/zoom_filter_mmx.c
+++ b/src/post/goom/zoom_filter_mmx.c
@@ -2,7 +2,7 @@
#include "xineutils.h"
#include "zoom_filter_mmx.h"
-#ifdef MMX
+#ifdef HAVE_MMX
#define BUFFPOINTNB 16
#define BUFFPOINTMASK 0xffff
#define BUFFINCR 0xff
@@ -13,6 +13,10 @@
/* faire : a / sqrtperte <=> a >> PERTEDEC */
#define PERTEDEC 4
+int zoom_filter_mmx_supported () {
+ return (xine_mm_accel() & MM_ACCEL_X86_MMX);
+}
+
void zoom_filter_mmx (int prevX, int prevY,
unsigned int *expix1, unsigned int *expix2,
int *brutS, int *brutD, int buffratio,