Commit a7bc7485 authored by Bastien Nocera's avatar Bastien Nocera

configure.ac: Add checks for Flex/Yacc/Bison and other furry animals, for the...

configure.ac: Add checks for Flex/Yacc/Bison and other furry animals, for the new goom 2k4 based plugin

Original commit message from CVS:
2008-02-23  Bastien Nocera  <hadess@hadess.net>

* configure.ac: Add checks for Flex/Yacc/Bison and other
furry animals, for the new goom 2k4 based plugin

* gst/goom/*: Update to use goom 2k4, uses liboil to detect
CPU optimisations (not working yet), move the old plugin to...

* gst/goom2k1/*: ... here, in case somebody is sick enough

Fixes #515073
parent 7f0745bb
2008-02-23 Bastien Nocera <hadess@hadess.net>
* configure.ac: Add checks for Flex/Yacc/Bison and other
furry animals, for the new goom 2k4 based plugin
* gst/goom/*: Update to use goom 2k4, uses liboil to detect
CPU optimisations (not working yet), move the old plugin to...
* gst/goom2k1/*: ... here, in case somebody is sick enough
Fixes #515073
2008-02-22 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_setup_streams):
......
common @ bd6ec570
Subproject commit 135628f16d422584d3454fb9c9805e7be25760a1
Subproject commit bd6ec57040fe3fa93e21ca440dfe494e3ee18555
......@@ -94,6 +94,7 @@ GST_PLUGINS_ALL="\
icydemux \
flx \
goom \
goom2k1 \
law \
level \
matroska \
......@@ -329,6 +330,11 @@ AG_GST_SET_LEVEL_DEFAULT($GST_CVS)
dnl used in examples
AG_GST_DEFAULT_ELEMENTS
dnl Check for Yacc and Lex for the goom plugin
AG_GST_BISON_CHECK
AG_GST_FLEX_CHECK
AM_PROG_AS
dnl *** sys plug-ins ***
echo
......@@ -1019,6 +1025,7 @@ gst/equalizer/Makefile
gst/id3demux/Makefile
gst/icydemux/Makefile
gst/goom/Makefile
gst/goom2k1/Makefile
gst/law/Makefile
gst/level/Makefile
gst/matroska/Makefile
......
plugin_LTLIBRARIES = libgstgoom.la
GOOM_FILTER_FILES = filters.c
GOOM_FILTER_CFLAGS = -UMMX -UUSE_ASM
PPC_FILES=ppc_zoom_ultimate.s ppc_drawings.s ppc_drawings.h ppc_zoom_ultimate.h
MMX_FILES=mmx.c xmmx.c mmx.h xmmx.h
noinst_HEADERS = gstgoom.h filters.h goom_core.h goom_tools.h graphic.h lines.h
if HAVE_CPU_PPC
ARCH_FILES = $(PPC_FILES)
endif
if HAVE_CPU_PPC64
ARCH_FILES = $(PPC_FILES)
endif
if HAVE_CPU_I386
ARCH_FILES = $(MMX_FILES)
endif
libgstgoom_la_SOURCES = gstgoom.c goom_core.c $(GOOM_FILTER_FILES) graphic.c lines.c
libgstgoom_la_SOURCES = \
gstgoom.c gstgoom.h \
drawmethods.c drawmethods.h \
sound_tester.c sound_tester.h \
mathtools.c mathtools.h \
goomsl_heap.c goomsl_heap.h \
goomsl_hash.c goomsl_hash.h \
goomsl.c goomsl_private.h \
lines.c lines.h ifs.c ifs.h surf3d.c surf3d.h \
tentacle3d.c tentacle3d.h v3d.c v3d.h \
gfontrle.c gfontrle.h gfontlib.c gfontlib.h \
convolve_fx.c flying_stars_fx.c \
goom_fx.h goom_visual_fx.h \
motif_goom1.h motif_goom2.h \
plugin_info.c goom_plugin_info.h \
default_scripts.h goom_tools.c \
config_param.c filters.c goom_core.c graphic.c \
goom.h goom_typedefs.h goom_graphic.h \
goom_config_param.h goom_visual_fx.h goom_filters.h \
goom_tools.h goom_tools.h goom_config.h \
$(ARCH_FILES)
libgstgoom_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GOOM_FILTER_CFLAGS)
libgstgoom_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(LIBM)
ERROR_CFLAGS=
libgstgoom_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GOOM_FILTER_CFLAGS) $(LIBOIL_CFLAGS)
libgstgoom_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(LIBM) $(LIBOIL_LIBS) libgstgoomconfigparse.la
libgstgoom_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
EXTRA_DIST = filters.c
EXTRA_DIST = filters.c $(PPC_FILES) $(MMX_FILES)
goomsl_yacc.c goomsl_yacc.h: goomsl_yacc.y
$(BISON_PATH) -d $(srcdir)/goomsl_yacc.y -o goomsl_yacc.c && \
mv goomsl_yacc.c goomsl_yacc_tmp.c && \
echo '#ifdef HAVE_CONFIG_H' > goomsl_yacc_tmp2.c && \
echo '#include <config.h>' >> goomsl_yacc_tmp2.c && \
echo '#endif' >> goomsl_yacc_tmp2.c && \
cat goomsl_yacc_tmp.c >> goomsl_yacc_tmp2.c && \
rm goomsl_yacc_tmp.c && \
mv goomsl_yacc_tmp2.c goomsl_yacc.c
goomsl_lex.c: goomsl_lex.l goomsl_yacc.h
$(FLEX_PATH) -ogoomsl_lex.c $(srcdir)/goomsl_lex.l && \
mv goomsl_lex.c goomsl_lex_tmp.c && \
echo '#ifdef HAVE_CONFIG_H' > goomsl_lex_tmp2.c && \
echo '#include <config.h>' >> goomsl_lex_tmp2.c && \
echo '#endif' >> goomsl_lex_tmp2.c && \
cat goomsl_lex_tmp.c >> goomsl_lex_tmp2.c && \
rm goomsl_lex_tmp.c && \
mv goomsl_lex_tmp2.c goomsl_lex.c
# libgstgoomconfigparse.la is library linked into the goom plugin
noinst_LTLIBRARIES = libgstgoomconfigparse.la
# uncomment these lines to dist the generated sources
#BUILT_SOURCES = goomsl_yacc.h goomsl_yacc.c goomsl_lex.c
#libgstgoomconfigparse_la_SOURCES = goomsl_lex.c goomsl_yacc.c goomsl_yacc.h
# uncomment these lines to _NOT_ dist the generated sources
nodist_libgstgoomconfigparse_la_SOURCES = goomsl_lex.c goomsl_yacc.c
CLEANFILES=goomsl_yacc.c goomsl_lex.c goomsl_yacc.h
EXTRA_DIST += goomsl_yacc.y goomsl_lex.l
.NOTPARALLEL:
......@@ -3,3 +3,6 @@ the Goom homepage found at:
http://ios.free.fr/?page=projet&quoi=1
Like the original library so is the Goom plugin available under the LGPL license
This is based on goom2k4 with changes to plugin_info.c and mmx.h to use liboil for CPU
detection and GStreamer-specific ifdef's for architecture detection.
/*---------------------------------------------------------------------------*/
/*
** config_param.c
** Goom Project
**
** Created by Jean-Christophe Hoelt on Sat Jul 19 2003
** Copyright (c) 2003 iOS. All rights reserved.
*/
/*---------------------------------------------------------------------------*/
#include "goom_config_param.h"
#include <string.h>
/* TODO: Ajouter goom_ devant ces fonctions */
static void
empty_fct (PluginParam * dummy)
{
}
PluginParam
goom_secure_param ()
{
PluginParam p;
p.changed = empty_fct;
p.change_listener = empty_fct;
p.user_data = 0;
p.name = p.desc = 0;
p.rw = 1;
return p;
}
PluginParam
goom_secure_f_param (char *name)
{
PluginParam p = secure_param ();
p.name = name;
p.type = PARAM_FLOATVAL;
FVAL (p) = 0.5f;
FMIN (p) = 0.0f;
FMAX (p) = 1.0f;
FSTEP (p) = 0.01f;
return p;
}
PluginParam
goom_secure_f_feedback (char *name)
{
PluginParam p = secure_f_param (name);
p.rw = 0;
return p;
}
PluginParam
goom_secure_s_param (char *name)
{
PluginParam p = secure_param ();
p.name = name;
p.type = PARAM_STRVAL;
SVAL (p) = 0;
return p;
}
PluginParam
goom_secure_b_param (char *name, int value)
{
PluginParam p = secure_param ();
p.name = name;
p.type = PARAM_BOOLVAL;
BVAL (p) = value;
return p;
}
PluginParam
goom_secure_i_param (char *name)
{
PluginParam p = secure_param ();
p.name = name;
p.type = PARAM_INTVAL;
IVAL (p) = 50;
IMIN (p) = 0;
IMAX (p) = 100;
ISTEP (p) = 1;
return p;
}
PluginParam
goom_secure_i_feedback (char *name)
{
PluginParam p = secure_i_param (name);
p.rw = 0;
return p;
}
PluginParameters
goom_plugin_parameters (const char *name, int nb)
{
PluginParameters p;
p.name = (char *) name;
p.desc = "";
p.nbParams = nb;
p.params = (PluginParam **) malloc (nb * sizeof (PluginParam *));
return p;
}
/*---------------------------------------------------------------------------*/
void
goom_set_str_param_value (PluginParam * p, const char *str)
{
int len = strlen (str);
if (SVAL (*p))
SVAL (*p) = (char *) realloc (SVAL (*p), len + 1);
else
SVAL (*p) = (char *) malloc (len + 1);
memcpy (SVAL (*p), str, len + 1);
}
void
goom_set_list_param_value (PluginParam * p, const char *str)
{
int len = strlen (str);
#ifdef VERBOSE
printf ("%s: %d\n", str, len);
#endif
if (LVAL (*p))
LVAL (*p) = (char *) realloc (LVAL (*p), len + 1);
else
LVAL (*p) = (char *) malloc (len + 1);
memcpy (LVAL (*p), str, len + 1);
}
#include "goom_fx.h"
#include "goom_plugin_info.h"
#include "goomsl.h"
#include "goom_config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#define CONV_MOTIF_W 32
//#define CONV_MOTIF_WMASK 0x1f
#define CONV_MOTIF_W 128
#define CONV_MOTIF_WMASK 0x7f
typedef char Motif[CONV_MOTIF_W][CONV_MOTIF_W];
#include "motif_goom1.h"
#include "motif_goom2.h"
#define NB_THETA 512
#define MAX 2.0f
typedef struct _CONV_DATA
{
PluginParam light;
PluginParam factor_adj_p;
PluginParam factor_p;
PluginParameters params;
GoomSL *script;
/* rotozoom */
int theta;
float ftheta;
int h_sin[NB_THETA];
int h_cos[NB_THETA];
int h_height;
float visibility;
Motif conv_motif;
int inverse_motif;
} ConvData;
/* init rotozoom tables */
static void
compute_tables (VisualFX * _this, PluginInfo * info)
{
ConvData *data = (ConvData *) _this->fx_data;
double screen_coef;
int i;
double h;
double radian;
if (data->h_height == info->screen.height)
return;
screen_coef = 2.0 * 300.0 / (double) info->screen.height;
data->h_height = info->screen.height;
for (i = 0; i < NB_THETA; i++) {
radian = 2 * i * M_PI / NB_THETA;
h = (0.2 + cos (radian) / 15.0 * sin (radian * 2.0 + 12.123)) * screen_coef;
data->h_cos[i] = 0x10000 * (-h * cos (radian) * cos (radian));
data->h_sin[i] = 0x10000 * (h * sin (radian + 1.57) * sin (radian));
}
}
static void
set_motif (ConvData * data, Motif motif)
{
int i, j;
for (i = 0; i < CONV_MOTIF_W; ++i)
for (j = 0; j < CONV_MOTIF_W; ++j)
data->conv_motif[i][j] =
motif[CONV_MOTIF_W - i - 1][CONV_MOTIF_W - j - 1];
}
static void
convolve_init (VisualFX * _this, PluginInfo * info)
{
ConvData *data;
data = (ConvData *) malloc (sizeof (ConvData));
_this->fx_data = (void *) data;
data->light = secure_f_param ("Screen Brightness");
data->light.param.fval.max = 300.0f;
data->light.param.fval.step = 1.0f;
data->light.param.fval.value = 100.0f;
data->factor_adj_p = secure_f_param ("Flash Intensity");
data->factor_adj_p.param.fval.max = 200.0f;
data->factor_adj_p.param.fval.step = 1.0f;
data->factor_adj_p.param.fval.value = 70.0f;
data->factor_p = secure_f_feedback ("Factor");
data->params = plugin_parameters ("Bright Flash", 5);
data->params.params[0] = &data->light;
data->params.params[1] = &data->factor_adj_p;
data->params.params[2] = 0;
data->params.params[3] = &data->factor_p;
data->params.params[4] = 0;
/* init rotozoom tables */
compute_tables (_this, info);
data->theta = 0;
data->ftheta = 0.0;
data->visibility = 1.0;
set_motif (data, CONV_MOTIF2);
data->inverse_motif = 0;
_this->params = &data->params;
}
static void
convolve_free (VisualFX * _this)
{
free (_this->fx_data);
}
static void
create_output_with_brightness (VisualFX * _this, Pixel * src, Pixel * dest,
PluginInfo * info, int iff)
{
ConvData *data = (ConvData *) _this->fx_data;
int x, y;
int i = 0; //info->screen.height * info->screen.width - 1;
const int c = data->h_cos[data->theta];
const int s = data->h_sin[data->theta];
const int xi = -(info->screen.width / 2) * c;
const int yi = (info->screen.width / 2) * s;
const int xj = -(info->screen.height / 2) * s;
const int yj = -(info->screen.height / 2) * c;
int xprime = xj;
int yprime = yj;
int ifftab[16];
if (data->inverse_motif) {
int i;
for (i = 0; i < 16; ++i)
ifftab[i] = (double) iff *(1.0 + data->visibility * (15.0 - i) / 15.0);
} else {
int i;
for (i = 0; i < 16; ++i)
ifftab[i] = (double) iff / (1.0 + data->visibility * (15.0 - i) / 15.0);
}
for (y = info->screen.height; y--;) {
int xtex, ytex;
xtex = xprime + xi + CONV_MOTIF_W * 0x10000 / 2;
xprime += s;
ytex = yprime + yi + CONV_MOTIF_W * 0x10000 / 2;
yprime += c;
#ifdef HAVE_MMX
__asm__ __volatile__ ("\n\t pxor %%mm7, %%mm7" /* mm7 = 0 */
"\n\t movd %[xtex], %%mm2" "\n\t movd %[ytex], %%mm3" "\n\t punpckldq %%mm3, %%mm2" /* mm2 = [ ytex | xtex ] */
"\n\t movd %[c], %%mm4" "\n\t movd %[s], %%mm6" "\n\t pxor %%mm5, %%mm5" "\n\t psubd %%mm6, %%mm5" "\n\t punpckldq %%mm5, %%mm4" /* mm4 = [ -s | c ] */
"\n\t movd %[motif], %%mm6" /* mm6 = motif */
::[xtex] "g" (xtex),[ytex] "g" (ytex)
,[c] "g" (c),[s] "g" (s)
,[motif] "g" (&data->conv_motif[0][0]));
for (x = info->screen.width; x--;) {
__asm__ __volatile__ ("\n\t movd %[src], %%mm0" /* mm0 = src */
"\n\t paddd %%mm4, %%mm2" /* [ ytex | xtex ] += [ -s | s ] */
"\n\t movd %%esi, %%mm5" /* save esi into mm5 */
"\n\t movq %%mm2, %%mm3" "\n\t psrld $16, %%mm3" /* mm3 = [ (ytex>>16) | (xtex>>16) ] */
"\n\t movd %%mm3, %%eax" /* eax = xtex' */
"\n\t psrlq $25, %%mm3" "\n\t movd %%mm3, %%ecx" /* ecx = ytex' << 7 */
"\n\t andl $127, %%eax" "\n\t andl $16256, %%ecx" "\n\t addl %%ecx, %%eax" "\n\t movd %%mm6, %%esi" /* esi = motif */
"\n\t xorl %%ecx, %%ecx" "\n\t movb (%%eax,%%esi), %%cl" "\n\t movl %[ifftab], %%eax" "\n\t movd %%mm5, %%esi" /* restore esi from mm5 */
"\n\t movd (%%eax,%%ecx,4), %%mm1" /* mm1 = [0|0|0|iff2] */
"\n\t punpcklwd %%mm1, %%mm1"
"\n\t punpcklbw %%mm7, %%mm0"
"\n\t punpckldq %%mm1, %%mm1"
"\n\t psrlw $1, %%mm0"
"\n\t psrlw $2, %%mm1"
"\n\t pmullw %%mm1, %%mm0"
"\n\t psrlw $5, %%mm0"
"\n\t packuswb %%mm7, %%mm0"
"\n\t movd %%mm0, %[dest]":[dest] "=g" (dest[i].val)
:[src] "g" (src[i].val)
,[ifftab] "g" (&ifftab[0])
:"eax", "ecx");
i++;
}
#else
for (x = info->screen.width; x--;) {
int iff2;
unsigned int f0, f1, f2, f3;
xtex += c;
ytex -= s;
iff2 =
ifftab[data->
conv_motif[(ytex >> 16) & CONV_MOTIF_WMASK][(xtex >> 16) &
CONV_MOTIF_WMASK]];
#define sat(a) ((a)>0xFF?0xFF:(a))
f0 = src[i].val;
f1 = ((f0 >> R_OFFSET) & 0xFF) * iff2 >> 8;
f2 = ((f0 >> G_OFFSET) & 0xFF) * iff2 >> 8;
f3 = ((f0 >> B_OFFSET) & 0xFF) * iff2 >> 8;
dest[i].val =
(sat (f1) << R_OFFSET) | (sat (f2) << G_OFFSET) | (sat (f3) <<
B_OFFSET);
/*
f0 = (src[i].cop[0] * iff2) >> 8;
f1 = (src[i].cop[1] * iff2) >> 8;
f2 = (src[i].cop[2] * iff2) >> 8;
f3 = (src[i].cop[3] * iff2) >> 8;
dest[i].cop[0] = (f0 & 0xffffff00) ? 0xff : (unsigned char)f0;
dest[i].cop[1] = (f1 & 0xffffff00) ? 0xff : (unsigned char)f1;
dest[i].cop[2] = (f2 & 0xffffff00) ? 0xff : (unsigned char)f2;
dest[i].cop[3] = (f3 & 0xffffff00) ? 0xff : (unsigned char)f3;
*/
i++;
}
#endif
}
#ifdef HAVE_MMX
__asm__ __volatile__ ("\n\t emms");
#endif
compute_tables (_this, info);
}
/*#include <stdint.h>
static uint64_t GetTick()
{
uint64_t x;
asm volatile ("RDTSC" : "=A" (x));
return x;
}*/
static void
convolve_apply (VisualFX * _this, Pixel * src, Pixel * dest, PluginInfo * info)
{
ConvData *data = (ConvData *) _this->fx_data;
float ff;
int iff;
ff = (FVAL (data->factor_p) * FVAL (data->factor_adj_p) +
FVAL (data->light)) / 100.0f;
iff = (unsigned int) (ff * 256);
{
double fcycle = (double) info->cycle;
double rotate_param, rotate_coef;
float INCREASE_RATE = 1.5;
float DECAY_RATE = 0.955;
if (FVAL (info->sound.last_goom_p) > 0.8)
FVAL (data->factor_p) += FVAL (info->sound.goom_power_p) * INCREASE_RATE;
FVAL (data->factor_p) *= DECAY_RATE;
rotate_param = FVAL (info->sound.last_goom_p);
if (rotate_param < 0.0)
rotate_param = 0.0;
rotate_param += FVAL (info->sound.goom_power_p);
rotate_coef = 4.0 + FVAL (info->sound.goom_power_p) * 6.0;
data->ftheta = (data->ftheta + rotate_coef * sin (rotate_param * 6.3));
data->theta = ((unsigned int) data->ftheta) % NB_THETA;
data->visibility =
(cos (fcycle * 0.001 + 1.5) * sin (fcycle * 0.008) +
cos (fcycle * 0.011 + 5.0) - 0.8 + info->sound.speedvar) * 1.5;
if (data->visibility < 0.0)
data->visibility = 0.0;
data->factor_p.change_listener (&data->factor_p);
}
if (data->visibility < 0.01) {
switch (goom_irand (info->gRandom, 300)) {
case 1:
set_motif (data, CONV_MOTIF1);
data->inverse_motif = 1;
break;
case 2:
set_motif (data, CONV_MOTIF2);
data->inverse_motif = 0;
break;
}
}
if ((ff > 0.98f) && (ff < 1.02f))
memcpy (dest, src, info->screen.size * sizeof (Pixel));
else
create_output_with_brightness (_this, src, dest, info, iff);
/*
// Benching suite...
{
uint64_t before, after;
double timed;
static double stimed = 10000.0;
before = GetTick();
data->visibility = 1.0;
create_output_with_brightness(_this,src,dest,info,iff);
after = GetTick();
timed = (double)((after-before) / info->screen.size);
if (timed < stimed) {
stimed = timed;
printf ("CLK = %3.0f CPP\n", stimed);
}
}
*/
}
VisualFX
convolve_create (void)
{
VisualFX vfx = {
init:convolve_init,
free:convolve_free,
apply:convolve_apply,
fx_data:0
};
return vfx;
}
#ifndef _DEFAULT_SCRIPTS_H
#define _DEFAULT_SCRIPTS_H
#define GOOM_MAIN_SCRIPT ""
#endif
#include "drawmethods.h"
#define DRAWMETHOD_PLUS(_out,_backbuf,_col) \
{\
int tra=0,i=0;\
unsigned char *bra = (unsigned char*)&(_backbuf);\
unsigned char *dra = (unsigned char*)&(_out);\
unsigned char *cra = (unsigned char*)&(_col);\
for (;i<4;i++) {\
tra = *cra;\
tra += *bra;\
if (tra>255) tra=255;\
*dra = tra;\
++dra;++cra;++bra;\
}\
}
#define DRAWMETHOD DRAWMETHOD_PLUS(*p,*p,col)
void
draw_line (Pixel * data, int x1, int y1, int x2, int y2, int col, int screenx,
int screeny)
{
int x, y, dx, dy, yy, xx;
Pixel *p;
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;