Commit 217a4736 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Delete galaktos plugin.

This hasn't work for quite some time and we have projectM module.
Moreover, noone complained.
parent cc1d1e62
......@@ -29,6 +29,7 @@ Visualisation:
Removed modules:
* csri
* galaktos
Changes between 0.9.9a and 1.0.0:
---------------------------------
......
......@@ -721,7 +721,7 @@ AC_CHECK_LIB(m,cos,[
VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain scene],[-lm])
])
AC_CHECK_LIB(m,pow,[
VLC_ADD_LIBS([avcodec avformat swscale postproc ffmpegaltivec stream_out_transrate i420_rgb faad twolame equalizer spatializer param_eq libvlccore freetype mod mpc dmo quicktime realaudio realvideo galaktos opengl],[-lm])
VLC_ADD_LIBS([avcodec avformat swscale postproc ffmpegaltivec stream_out_transrate i420_rgb faad twolame equalizer spatializer param_eq libvlccore freetype mod mpc dmo quicktime realaudio realvideo opengl],[-lm])
])
AC_CHECK_LIB(m,sqrt,[
VLC_ADD_LIBS([headphone_channel_mixer normvol speex mono colorthres extract],[-lm])
......@@ -4694,23 +4694,6 @@ then
VLC_ADD_PLUGIN([visual])
fi
dnl
dnl OpenGL visualisation plugin
dnl
AC_ARG_ENABLE(galaktos,
[ --enable-galaktos OpenGL visualisation plugin (default disabled)])
if test "${enable_galaktos}" = "yes"
then
AC_CHECK_HEADERS(GL/gl.h GL/glu.h, [
VLC_ADD_PLUGIN([galaktos])
if test "${SYS}" != "mingw32"; then
VLC_ADD_LIBS([galaktos],[${X_LIBS} -lGL -lGLU])
else
VLC_ADD_LIBS([galaktos],[-lopengl32])
fi
])
fi
dnl
dnl goom visualization plugin
dnl
......@@ -5455,7 +5438,6 @@ AC_CONFIG_FILES([
modules/video_output/x11/Makefile
modules/visualization/Makefile
modules/visualization/visual/Makefile
modules/visualization/galaktos/Makefile
])
dnl Generate makefiles
......
......@@ -116,7 +116,6 @@ $Id$
* folder: folder meta data and art finder
* freetype: Utility to put text on video using freetype2
* ftp : FTP input module
* galaktos: a visualization module that outputs OpenGL
* gapi: PocketPC Video output
* gaussianblur: gaussian blur video filter
* gestures: mouse gestures control plugin
......
SUBDIRS = visual galaktos
SUBDIRS = visual
SOURCES_goom = goom.c
SOURCES_projectm = projectm.cpp
SOURCES_galaktos = plugin.c plugin.h \
main.c main.h \
preset.c preset.h preset_types.h \
beat_detect.c beat_detect.h \
builtin_funcs.h common.h compare.h expr_types.h \
fatal.h idle_preset.h interface_types.h per_point_types.h \
param.c param.h param_types.h \
engine_vars.c engine_vars.h \
parser.c parser.h \
eval.c eval.h \
init_cond.c init_cond.h init_cond_types.h \
PCM.c PCM.h \
fftsg.c fftsg.h \
per_frame_eqn.c per_frame_eqn.h per_frame_eqn_types.h \
splaytree.c splaytree.h splaytree_types.h \
custom_shape.c custom_shape.h custom_shape_types.h \
func.c func.h func_types.h \
per_pixel_eqn.c per_pixel_eqn.h per_pixel_eqn_types.h \
tree_types.c tree_types.h \
custom_wave.c custom_wave.h custom_wave_types.h \
video_init.c video_init.h
/*****************************************************************************
* PCM.c:
*****************************************************************************
* Copyright (C) 2004 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@videolan.org>
* code from projectM http://xmms-projectm.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
//PCM.c - Sound data handler
//
//by Peter Sperl
//
//Takes sound data from wherever and hands it back out.
//Returns PCM Data or spectrum data, or the derivative of the PCM data
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include "fftsg.h"
double **PCMd; //data structure to store PCM data PCM[channels][maxsamples]
int maxsamples; //size of PCM buffer
int start; //where to add data next
int *ip; //working space for FFT routines
double *w; //lookup table for FFT routines
int new; //how many new samples
//initPCM(int samples)
//
//Initializes the PCM buffer to
// number of samples specified.
void initPCM(int samples)
{
int i;
//Allocate memory for PCM data buffer
PCMd = (double **)malloc(2 * sizeof(double *));
PCMd[0] = (double *)malloc(samples * sizeof(double));
PCMd[1] = (double *)malloc(samples * sizeof(double));
maxsamples=samples;
new=0;
//Initialize buffers to 0
for (i=0;i<samples;i++)
{
PCMd[0][i]=0;
PCMd[1][i]=0;
}
start=0;
//Allocate FFT workspace
w= (double *)malloc(maxsamples*sizeof(double));
ip= (int *)malloc(maxsamples*sizeof(int));
ip[0]=0;
}
//The only current addPCM function, can support more
//
//Takes in a 2x512 array of PCM samples
//and stores them
void addPCM(int16_t PCMdata[2][512])
{
int i,j;
int samples=512;
for(i=0;i<samples;i++)
{
j=i+start;
PCMd[0][j%maxsamples]=(PCMdata[0][i]/16384.0);
PCMd[1][j%maxsamples]=(PCMdata[1][i]/16384.0);
}
// printf("Added %d samples %d %d %f\n",samples,start,(start+samples)%maxsamples,PCM[0][start+10]);
start+=samples;
start=start%maxsamples;
new+=samples;
if (new>maxsamples) new=maxsamples;
}
//puts sound data requested at provided pointer
//
//samples is number of PCM samples to return
//freq = 0 gives PCM data
//freq = 1 gives FFT data
//smoothing is the smoothing coefficient
//returned values are normalized from -1 to 1
void getPCM(double *PCMdata, int samples, int channel, int freq, double smoothing, int derive)
{
int i,index;
index=start-1;
if (index<0) index=maxsamples+index;
PCMdata[0]=PCMd[channel][index];
for(i=1;i<samples;i++)
{
index=start-1-i;
if (index<0) index=maxsamples+index;
PCMdata[i]=(1-smoothing)*PCMd[channel][index]+smoothing*PCMdata[i-1];
}
//return derivative of PCM data
if(derive)
{
for(i=0;i<samples-1;i++)
{
PCMdata[i]=PCMdata[i]-PCMdata[i+1];
}
PCMdata[samples-1]=0;
}
//return frequency data instead of PCM (perform FFT)
if (freq) rdft(samples, 1, PCMdata, ip, w);
}
//getPCMnew
//
//Like getPCM except it returns all new samples in the buffer
//the actual return value is the number of samples, up to maxsamples.
//the passed pointer, PCMData, must bee able to hold up to maxsamples
int getPCMnew(double *PCMdata, int channel, int freq, double smoothing, int derive, int reset)
{
int i,index;
index=start-1;
if (index<0) index=maxsamples+index;
PCMdata[0]=PCMd[channel][index];
for(i=1;i<new;i++)
{
index=start-1-i;
if (index<0) index=maxsamples+index;
PCMdata[i]=(1-smoothing)*PCMd[channel][index]+smoothing*PCMdata[i-1];
}
//return derivative of PCM data
if(derive)
{
for(i=0;i<new-1;i++)
{
PCMdata[i]=PCMdata[i]-PCMdata[i+1];
}
PCMdata[new-1]=0;
}
//return frequency data instead of PCM (perform FFT)
// if (freq) rdft(samples, 1, PCMdata, ip, w);
i=new;
if (reset) new=0;
return i;
}
//Free stuff
void freePCM()
{
free(PCMd[0]);
free(PCMd[1]);
free(PCMd);
free(ip);
free(w);
}
void initPCM(int maxsamples);
void addPCM(int16_t [2][512]);
void getPCM(double *data, int samples, int channel, int freq, double smoothing, int derive);
void freePCM();
int getPCMnew(double *PCMdata, int channel, int freq, double smoothing, int derive,int reset);
/*****************************************************************************
* beat_detect.c: basic beat detection algorithm
*****************************************************************************
* Copyright (C) 2004 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@videolan.org>
* code from projectM http://xmms-projectm.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
//
//by Peter Sperl
//
//Takes sound data from wherever and returns beat detection values
//Uses statistical Energy-Based methods. Very simple
//
//Some stuff was taken from Frederic Patin's beat-detection article, you'll find it online
#include <stdlib.h>
#include <stdio.h>
#include "engine_vars.h"
double beat_buffer[32][80],beat_instant[32],beat_history[32];
double *beat_val,*beat_att,*beat_variance;
int beat_buffer_pos;
double vol_buffer[80],vol_instant,vol_history;
void initBeatDetect()
{
int x,y;
vol_instant=0;
vol_history=0;
for (y=0;y<80;y++)
{
vol_buffer[y]=0;
}
beat_buffer_pos=0;
beat_val=(double *)malloc(32*sizeof(double));
beat_att=(double *)malloc(32*sizeof(double));
beat_variance=(double *)malloc(32*sizeof(double));
for (x=0;x<32;x++)
{
beat_instant[x]=0;
beat_history[x]=0;
beat_val[x]=1.0;
beat_att[x]=1.0;
beat_variance[x]=0;
for (y=0;y<80;y++)
{
beat_buffer[x][y]=0;
}
}
}
void getBeatVals(double *vdataL,double *vdataR, double *vol)
{
int linear=0;
int x,y;
vol_instant=0;
for ( x=0;x<16;x++)
{
beat_instant[x]=0;
for ( y=linear*2;y<(linear+8+x)*2;y++)
{
beat_instant[x]+=((vdataL[y]*vdataL[y])+(vdataR[y]*vdataR[y]))*(1.0/(8+x));
vol_instant+=((vdataL[y]*vdataL[y])+(vdataR[y]*vdataR[y]))*(1.0/512.0);
}
linear=y/2;
beat_history[x]-=(beat_buffer[x][beat_buffer_pos])*.0125;
beat_buffer[x][beat_buffer_pos]=beat_instant[x];
beat_history[x]+=(beat_instant[x])*.0125;
beat_val[x]=(beat_instant[x])/(beat_history[x]);
beat_att[x]+=(beat_instant[x])/(beat_history[x]);
}
vol_history-=(vol_buffer[beat_buffer_pos])*.0125;
vol_buffer[beat_buffer_pos]=vol_instant;
vol_history+=(vol_instant)*.0125;
double temp2=0;
mid=0;
for(x=1;x<10;x++)
{
mid+=(beat_instant[x]);
temp2+=(beat_history[x]);
}
mid=mid/(1.5*temp2);
temp2=0;
treb=0;
for(x=10;x<16;x++)
{
treb+=(beat_instant[x]);
temp2+=(beat_history[x]);
}
treb=treb/(1.5*temp2);
*vol=vol_instant/(1.5*vol_history);
bass=(beat_instant[0])/(1.5*beat_history[0]);
treb_att=.6 * treb_att + .4 * treb;
mid_att=.6 * mid_att + .4 * mid;
bass_att=.6 * bass_att + .4 * bass;
//printf("%f %f %f %f\n",bass,mid,treb,*vol);
// *vol=(beat_instant[3])/(beat_history[3]);
beat_buffer_pos++;
if( beat_buffer_pos>79)beat_buffer_pos=0;
}
void freeBeatDetect()
{
free(beat_att);
free(beat_val);
free(beat_variance);
}
void initBeatDetect();
void getBeatVals(double *vdataL,double *vdataR,double *vol);
void freeBeatDetect();
/*****************************************************************************
* builtin_funcs.c:
*****************************************************************************
* Copyright (C) 2004 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@videolan.org>
* code from projectM http://xmms-projectm.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
/* Values to optimize the sigmoid function */
#define R 32767
#define RR 65534
static inline double int_wrapper(double * arg_list) {
return floor(arg_list[0]);
}
static inline double sqr_wrapper(double * arg_list) {
return pow(2, arg_list[0]);
}
static inline double sign_wrapper(double * arg_list) {
return -arg_list[0];
}
static inline double min_wrapper(double * arg_list) {
if (arg_list[0] > arg_list[1])
return arg_list[1];
return arg_list[0];
}
static inline double max_wrapper(double * arg_list) {
if (arg_list[0] > arg_list[1])
return arg_list[0];
return arg_list[1];
}
/* consult your AI book */
static inline double sigmoid_wrapper(double * arg_list) {
return (RR / (1 + exp( -(((double)(arg_list[0])) * arg_list[1]) / R) - R));
}
static inline double bor_wrapper(double * arg_list) {
return (double)((int)arg_list[0] || (int)arg_list[1]);
}
static inline double band_wrapper(double * arg_list) {
return (double)((int)arg_list[0] && (int)arg_list[1]);
}
static inline double bnot_wrapper(double * arg_list) {
return (double)(!(int)arg_list[0]);
}
static inline double if_wrapper(double * arg_list) {
if ((int)arg_list[0] == 0)
return arg_list[2];
return arg_list[1];
}
static inline double rand_wrapper(double * arg_list) {
double l;
// printf("RAND ARG:(%d)\n", (int)arg_list[0]);
l = (double)((rand()) % ((int)arg_list[0]));
//printf("VAL: %f\n", l);
return l;
}
static inline double equal_wrapper(double * arg_list) {
return (arg_list[0] == arg_list[1]);
}
static inline double above_wrapper(double * arg_list) {
return (arg_list[0] > arg_list[1]);
}
static inline double below_wrapper(double * arg_list) {
return (arg_list[0] < arg_list[1]);
}
static inline double sin_wrapper(double * arg_list) {
return (sin (arg_list[0]));
}
static inline double cos_wrapper(double * arg_list) {
return (cos (arg_list[0]));
}
static inline double tan_wrapper(double * arg_list) {
return (tan(arg_list[0]));
}
static inline double asin_wrapper(double * arg_list) {
return (asin (arg_list[0]));
}
static inline double acos_wrapper(double * arg_list) {
return (acos (arg_list[0]));
}
static inline double atan_wrapper(double * arg_list) {
return (atan (arg_list[0]));
}
static inline double atan2_wrapper(double * arg_list) {
return (atan2 (arg_list[0], arg_list[1]));
}
static inline double pow_wrapper(double * arg_list) {
return (pow (arg_list[0], arg_list[1]));
}
static inline double exp_wrapper(double * arg_list) {
return (exp(arg_list[0]));
}
static inline double abs_wrapper(double * arg_list) {
return (fabs(arg_list[0]));
}
static inline double log_wrapper(double *arg_list) {
return (log (arg_list[0]));
}
static inline double log10_wrapper(double * arg_list) {
return (log10 (arg_list[0]));
}
static inline double sqrt_wrapper(double * arg_list) {
return (sqrt (arg_list[0]));
}
static inline double nchoosek_wrapper(double * arg_list) {
unsigned long cnm = 1UL;
int i, f;
int n, m;
n = (int)arg_list[0];
m = (int)arg_list[1];
if (m*2 >n) m = n-m;
for (i=1 ; i <= m; n--, i++)
{
if ((f=n) % i == 0)
f /= i;
else cnm /= i;
cnm *= f;
}
return (double)cnm;
}
static inline double fact_wrapper(double * arg_list) {
int result = 1;
int n = (int)arg_list[0];
while (n > 1) {
result = result * n;
n--;
}
return (double)result;
}
#ifndef COMMON_H
#define COMMON_H
#define DEFAULT_FONT_PATH "/home/carm/fonts/courier1.glf"
#define MAX_TOKEN_SIZE 512
#define MAX_PATH_SIZE 4096
#define STRING_BUFFER_SIZE 1024*150
#define STRING_LINE_SIZE 1024
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#define PROJECTM_FILE_EXTENSION ".prjm"
#define MILKDROP_FILE_EXTENSION ".milk"
#define MAX_DOUBLE_SIZE 10000000.0
#define MIN_DOUBLE_SIZE -10000000.0
#define MAX_INT_SIZE 10000000
#define MIN_INT_SIZE -10000000
#define DEFAULT_DOUBLE_IV 0.0 /* default double initial value */
#define DEFAULT_DOUBLE_LB MIN_DOUBLE_SIZE /* default double lower bound */
#define DEFAULT_DOUBLE_UB MAX_DOUBLE_SIZE /* default double upper bound */
#endif
int compare_int(int * num1, int * num2);
int compare_string(char * string1, char * string2);
This diff is collapsed.
#ifndef CUSTOM_SHAPE_H
#define CUSTOM_SHAPE_H
#define CUSTOM_SHAPE_DEBUG 0
#include "expr_types.h"
#include "custom_shape_types.h"
#include "preset_types.h"
void free_custom_shape(custom_shape_t * custom_shape);
custom_shape_t * new_custom_shape(int id);
custom_shape_t * find_custom_shape(int id, preset_t * preset, int create_flag);
void load_unspecified_init_conds_shape(custom_shape_t * custom_shape);
void evalCustomShapeInitConditions();
custom_shape_t * nextCustomShape();
#endif
#ifndef CUSTOM_SHAPE_TYPES_H
#define CUSTOM_SHAPE_TYPES_H
#include "common.h"
#include "splaytree_types.h"
#include "expr_types.h"
typedef struct CUSTOM_SHAPE_T {
/* Numerical id */
int id;
int per_frame_count;
/* Parameter tree associated with this custom shape */
splaytree_t * param_tree;
/* Engine variables */
int sides;
int thickOutline;
int enabled;
int additive;
int textured;
double tex_zoom;
double tex_ang;
double x; /* x position for per point equations */
double y; /* y position for per point equations */
double rad;
double ang;
double r; /* red color value */
double g; /* green color value */
double b; /* blue color value */
double a; /* alpha color value */
double r2; /* red color value */
double g2; /* green color value */
double b2; /* blue color value */
double a2; /* alpha color value */
double border_r; /* red color value */
double border_g; /* green color value */
double border_b; /* blue color value */
double border_a; /* alpha color value */
/* stupid t variables */
double t1;
double t2;
double t3;
double t4;
double t5;
double t6;
double t7;
double t8;
/* Data structure to hold per frame / per frame init equations */
splaytree_t * init_cond_tree;
splaytree_t * per_frame_eqn_tree;
splaytree_t * per_frame_init_eqn_tree;
/* Denotes the index of the last character for each string buffer */
int per_frame_eqn_string_index;
int per_frame_init_eqn_string_index;
/* String buffers for per frame / per frame init equations */
char per_frame_eqn_string_buffer[STRING_BUFFER_SIZE];
char per_frame_init_eqn_string_buffer[STRING_BUFFER_SIZE];
/* Per point equation array */
} custom_shape_t;
#endif
This diff is collapsed.
#ifndef CUSTOM_WAVE_H
#define CUSTOM_WAVE_H
#define CUSTOM_WAVE_DEBUG 0
#include "expr_types.h"
#include "custom_wave_types.h"
#include "preset_types.h"
#include "splaytree.h"
#include "init_cond.h"
void free_custom_wave(custom_wave_t * custom_wave);
custom_wave_t * new_custom_wave(int id);
void free_per_point_eqn(per_point_eqn_t * per_point_eqn);
per_point_eqn_t * new_per_point_eqn(int index, param_t * param,gen_expr_t * gen_expr);
void reset_per_point_eqn_array(custom_wave_t * custom_wave);
custom_wave_t * find_custom_wave(int id, preset_t * preset, int create_flag);
int add_per_point_eqn(char * name, gen_expr_t * gen_expr, custom_wave_t * custom_wave);
void evalCustomWaveInitConditions();
void evalPerPointEqns();
custom_wave_t * nextCustomWave();
void load_unspecified_init_conds(custom_wave_t * custom_wave);
static inline void eval_custom_wave_init_conds(custom_wave_t * custom_wave) {
splay_traverse(eval_init_cond, custom_wave->init_cond_tree);
splay_traverse(eval_init_cond, custom_wave->per_frame_init_eqn_tree);
}
#endif
#ifndef CUSTOM_WAVE_TYPES_H
#define CUSTOM_WAVE_TYPES_H
#include "common.h"
#include "splaytree_types.h"
#include "expr_types.h"
#define X_POINT_OP 0
#define Y_POINT_OP 1
#define R_POINT_OP 2
#define G_POINT_OP 3
#define B_POINT_OP 4
#define A_POINT_OP 5
#define NUM_POINT_OPS 6
typedef struct PER_POINT_EQN_T {
int index;
param_t * param;
gen_expr_t * gen_expr;
} per_point_eqn_t;
typedef struct CUSTOM_WAVE_T {
/* Numerical id */
int id;
int per_frame_count;
/* Parameter tree associated with this custom wave */
splaytree_t * param_tree;
/* Engine variables */
double x; /* x position for per point equations */
double y; /* y position for per point equations */
double r; /* red color value */
double g; /* green color value */
double b; /* blue color value */
double a; /* alpha color value */
double * x_mesh;
double * y_mesh;
double * r_mesh;
double * b_mesh;
double * g_mesh;
double * a_mesh;
double * value1;
double * value2;
double * sample_mesh;
int enabled; /* if nonzero then wave is visible, hidden otherwise */
int samples; /* number of samples associated with this wave form. Usually powers of 2 */
double sample;
int bSpectrum; /* spectrum data or pcm data */
int bUseDots; /* draw wave as dots or lines */
int bDrawThick; /* draw thicker lines */
int bAdditive; /* add color values together */
double scaling; /* scale factor of waveform */
double smoothing; /* smooth factor of waveform */
int sep; /* no idea what this is yet... */
/* stupid t variables */
double t1;
double t2;
double t3;
double t4;
double t5;
double t6;
double t7;
double t8;
double v1,v2;
/* Data structure to hold per frame and per point equations */
splaytree_t * init_cond_tree;
splaytree_t * per_frame_eqn_tree;
splaytree_t * per_point_eqn_tree;
splaytree_t * per_frame_init_eqn_tree;
/* Denotes the index of the last character for each string buffer */
int per_point_eqn_string_index;
int per_frame_eqn_string_index;
int per_frame_init_eqn_string_index;
/* String buffers for per point and per frame equations */
char per_point_eqn_string_buffer[STRING_BUFFER_SIZE];
char per_frame_eqn_string_buffer[STRING_BUFFER_SIZE];
char per_frame_init_eqn_string_buffer[STRING_BUFFER_SIZE];
/* Per point equation array */
gen_expr_t * per_point_eqn_array[NUM_POINT_OPS];
} custom_wave_t;
#endif
/*****************************************************************************
* engine_vars.c:
*****************************************************************************
* Copyright (C) 2004 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@videolan.org>
* code from projectM http://xmms-projectm.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/* Include engine_vars.h to use these variables */
char preset_name[256];
/* PER FRAME CONSTANTS BEGIN */
double zoom=1.0;
double zoomexp= 1.0;
double rot= 0.0;
double warp= 0.0;
double sx= 1.0;
double sy= 1.0;
double dx= 0.0;
double dy= 0.0;
double cx= 0.5;
double cy= 0.5;
int gx = 32;
int gy = 24;
double decay=.98;
double wave_r= 1.0;
double wave_g= 0.2;
double wave_b= 0.0;
double wave_x= 0.5;
double wave_y= 0.5;
double wave_mystery= 0.0;
double ob_size= 0.0;
double ob_r= 0.0;
double ob_g= 0.0;
double ob_b= 0.0;
double ob_a= 0.0;
double ib_size = 0.0;
double ib_r = 0.0;
double ib_g = 0.0;
double ib_b = 0.0;
double ib_a = 0.0;
double mv_a = 0.0;
double mv_r = 0.0;
double mv_g = 0.0;
double mv_b = 0.0;
double mv_l = 1.0;
double mv_x = 16.0;
double mv_y = 12.0;
double mv_dy = 0.02;
double mv_dx = 0.02;
int meshx = 0;
int meshy = 0;
double Time = 0;
double treb = 0;
double mid = 0;
double bass = 0;
double treb_att = 0;
double mid_att = 0;
double bass_att = 0;
double progress = 0;
int frame = 0;
int fps = 30;
//double bass_thresh = 0;
/* PER_FRAME CONSTANTS END */
double fRating = 0;
double fGammaAdj = 1.0;
double fVideoEchoZoom = 1.0;
double fVideoEchoAlpha = 0;
double nVideoEchoOrientation = 0;
int nWaveMode = 7;
int bAdditiveWaves = 0;
int bWaveDots = 0;
int bWaveThick = 0;
int bModWaveAlphaByVolume = 0;
int bMaximizeWaveColor = 0;
int bTexWrap = 0;
int bDarkenCenter = 0;
int bRedBlueStereo = 0;
int bBrighten = 0;
int bDarken = 0;
int bSolarize = 0;
int bInvert = 0;
int bMotionVectorsOn = 1;
double fWaveAlpha =1.0;
double fWaveScale = 1.0;
double fWaveSmoothing = 0;
double fWaveParam = 0;
double fModWaveAlphaStart = 0;
double fModWaveAlphaEnd = 0;
double fWarpAnimSpeed = 0;
double fWarpScale = 0;
double fShader = 0;
/* PER_PIXEL CONSTANTS BEGIN */
double x_per_pixel = 0;
double y_per_pixel = 0;
double rad_per_pixel = 0;
double ang_per_pixel = 0;
/* PER_PIXEL CONSTANT END */
/* Q AND T VARIABLES START */
double q1 = 0;
double q2 = 0;
double q3 = 0;
double q4 = 0;
double q5 = 0;
double q6 = 0;
double q7 = 0;
double q8 = 0;
/* Q AND T VARIABLES END */
//per pixel meshes
double **zoom_mesh;
double **zoomexp_mesh;
double **rot_mesh;
double **sx_mesh;
double **sy_mesh;
double **dx_mesh;
double **dy_mesh;
double **cx_mesh;
double **cy_mesh;
double **x_mesh;
double **y_mesh;
double **rad_mesh;
double **theta_mesh;
//custom wave per point meshes
/* Temporay file until these variables are all externed */
#ifndef ENGINE_VARS_H
#define ENGINE_VARS_H
extern char preset_name[256];
/* PER FRAME CONSTANTS BEGIN */
extern double zoom;
extern double zoomexp;
extern double rot;
extern double warp;
extern double sx;
extern double sy;
extern double dx;
extern double dy;
extern double cx;
extern double cy;
extern int gy;
extern int gx;
extern double decay;
extern double wave_r;
extern double wave_g;
extern double wave_b;
extern double wave_x;
extern double wave_y;
extern double wave_mystery;
extern double ob_size;
extern double ob_r;
extern double ob_g;
extern double ob_b;
extern double ob_a;
extern double ib_size;
extern double ib_r;
extern double ib_g;
extern double ib_b;
extern double ib_a;
extern int meshx;
extern int meshy;
extern double mv_a ;
extern double mv_r ;
extern double mv_g ;
extern double mv_b ;
extern double mv_l;
extern double mv_x;
extern double mv_y;
extern double mv_dy;
extern double mv_dx;
extern double Time;
extern double treb ;
extern double mid ;
extern double bass ;
extern double treb_att ;
extern double mid_att ;
extern double bass_att ;
extern double progress ;
extern int frame ;
/* PER_FRAME CONSTANTS END */
/* PER_PIXEL CONSTANTS BEGIN */
extern double x_per_pixel;
extern double y_per_pixel;
extern double rad_per_pixel;
extern double ang_per_pixel;
/* PER_PIXEL CONSTANT END */
extern double fRating;
extern double fGammaAdj;
extern double fVideoEchoZoom;
extern double fVideoEchoAlpha;
extern int nVideoEchoOrientation;
extern int nWaveMode;
extern int bAdditiveWaves;
extern int bWaveDots;
extern int bWaveThick;
extern int bModWaveAlphaByVolume;
extern int bMaximizeWaveColor;
extern int bTexWrap;
extern int bDarkenCenter;
extern int bRedBlueStereo;
extern int bBrighten;
extern int bDarken;
extern int bSolarize;
extern int bInvert;
extern int bMotionVectorsOn;
extern int fps;
extern double fWaveAlpha ;
extern double fWaveScale;
extern double fWaveSmoothing;
extern double fWaveParam;
extern double fModWaveAlphaStart;
extern double fModWaveAlphaEnd;
extern double fWarpAnimSpeed;
extern double fWarpScale;
extern double fShader;
/* Q VARIABLES START */
extern double q1;
extern double q2;
extern double q3;
extern double q4;
extern double q5;
extern double q6;
extern double q7;
extern double q8;
/* Q VARIABLES END */
extern double **zoom_mesh;
extern double **zoomexp_mesh;
extern double **rot_mesh;
extern double **sx_mesh;
extern double **sy_mesh;
extern double **dx_mesh;
extern double **dy_mesh;
extern double **cx_mesh;
extern double **cy_mesh;
extern double **x_mesh;
extern double **y_mesh;
extern double **rad_mesh;
extern double **theta_mesh;
#endif
This diff is collapsed.
/* eval.h: evaluation functions of expressions */
#ifndef EVAL_H
#define EVAL_H
#include "func_types.h"
#include "param_types.h"
#define VAL_T 1
#define PREFUN_T 3
#define TREE_T 4
#define NONE_T 0
#define CONSTANT_TERM_T 0
#define PARAM_TERM_T 1
#define INFIX_ADD 0
#define INFIX_MINUS 1
#define INFIX_MOD 2
#define INFIX_DIV 3
#define INFIX_MULT 4
#define INFIX_OR 5
#define INFIX_AND 6
//#define EVAL_DEBUG
double eval_gen_expr(gen_expr_t * gen_expr);
inline gen_expr_t * opt_gen_expr(gen_expr_t * gen_expr, int ** param_list);
gen_expr_t * const_to_expr(double val);
gen_expr_t * param_to_expr(struct PARAM_T * param);
gen_expr_t * prefun_to_expr(double (*func_ptr)(), gen_expr_t ** expr_list, int num_args);
tree_expr_t * new_tree_expr(infix_op_t * infix_op, gen_expr_t * gen_expr, tree_expr_t * left, tree_expr_t * right);
gen_expr_t * new_gen_expr(int type, void * item);
val_expr_t * new_val_expr(int type, term_t term);
int free_gen_expr(gen_expr_t * gen_expr);
int free_prefun_expr(prefun_expr_t * prefun_expr);
int free_tree_expr(tree_expr_t * tree_expr);
int free_val_expr(val_expr_t * val_expr);
infix_op_t * new_infix_op(int type, int precedence);
int init_infix_ops();
int destroy_infix_ops();
void reset_engine_vars();
gen_expr_t * clone_gen_expr(gen_expr_t * gen_expr);
tree_expr_t * clone_tree_expr(tree_expr_t * tree_expr);
val_expr_t * clone_val_expr(val_expr_t * val_expr);
prefun_expr_t * clone_prefun_expr(prefun_expr_t * prefun_expr);
#endif
#ifndef EXPR_TYPES_H
#define EXPR_TYPES_H
#include "param_types.h"
#define CONST_STACK_ELEMENT 0
#define EXPR_STACK_ELEMENT 1
/* General Expression Type */
typedef struct GEN_EXPR_T {
int type;
void * item;
} gen_expr_t;
typedef union TERM_T {
double constant; /* static variable */
struct PARAM_T * param; /* pointer to a changing variable */
} term_t;
/* Value expression, contains a term union */
typedef struct VAL_EXPR_T {
int type;
term_t term;
} val_expr_t;
/* Infix Operator Function */
typedef struct INFIX_OP_T {
int type;
int precedence;
} infix_op_t;
/* A binary expression tree ordered by operator precedence */
typedef struct TREE_EXPR_T {
infix_op_t * infix_op; /* null if leaf */
gen_expr_t * gen_expr;
struct TREE_EXPR_T * left, * right;
} tree_expr_t;
/* A function expression in prefix form */
typedef struct PREFUN_EXPR_T {
double (*func_ptr)();
int num_args;
gen_expr_t ** expr_list;
} prefun_expr_t;
#endif
/* Fatal Error Definitions */
#define OUTOFMEM_ERROR -7; /* out of memory */
#define ERROR -1 /* non specific error */
#define SUCCESS 1
#define FAILURE -1
#define PARSE_ERROR -11
#define DIV_BY_ZERO -3
#define OK 2
This diff is collapsed.
/*****************************************************************************
* fftsg.c:
*****************************************************************************
* Copyright (C) 2004 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@videolan.org>
* code from projectM http://xmms-projectm.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
void cdft(int, int, double *, int *, double *);
void rdft(int, int, double *, int *, double *);
void ddct(int, int, double *, int *, double *);
void ddst(int, int, double *, int *, double *);
void dfct(int, double *, double *, int *, double *);
void dfst(int, double *, double *, int *, double *);
/* Function management */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "common.h"
#include "fatal.h"
#include "func_types.h"
#include "func.h"
#include "splaytree_types.h"
#include "splaytree.h"
#include "tree_types.h"
#include "builtin_funcs.h"
/* A splay tree of builtin functions */
splaytree_t * builtin_func_tree;
/* Private function prototypes */
int compare_func(char * name, char * name2);
int insert_func(func_t * name);
void * copy_func_key(char * string);
void * copy_func_key(char * string) {
char * clone_string;
if ((clone_string = malloc(MAX_TOKEN_SIZE)) == NULL)
return NULL;
strncpy(clone_string, string, MAX_TOKEN_SIZE-1);
return (void*)clone_string;
}
func_t * create_func (const char * name, double (*func_ptr)(), int num_args) {
func_t * func;
func = (func_t*)malloc(sizeof(func_t));
if (func == NULL)
return NULL;
/* Clear name space */
memset(func->name, 0, MAX_TOKEN_SIZE);
/* Copy given name into function structure */
strncpy(func->name, name, MAX_TOKEN_SIZE);
/* Assign value pointer */
func->func_ptr = func_ptr;
func->num_args = num_args;
/* Return instantiated function */
return func;
}
/* Initialize the builtin function database.
Should only be necessary once */
int init_builtin_func_db() {
int retval;
builtin_func_tree = create_splaytree(compare_string, copy_string, free_string);
if (builtin_func_tree == NULL)
return OUTOFMEM_ERROR;
retval = load_all_builtin_func();
return SUCCESS;
}
/* Destroy the builtin function database.
Generally, do this on projectm exit */
int destroy_builtin_func_db() {
splay_traverse(free_func, builtin_func_tree);
destroy_splaytree(builtin_func_tree);
return SUCCESS;
}
/* Insert a function into the database */
int insert_func(func_t * func) {
if (func == NULL)
return ERROR;
splay_insert(func, func->name, builtin_func_tree);
return SUCCESS;
}
/* Frees a function type, real complicated... */
void free_func(func_t * func) {
free(func);
}
/* Remove a function from the database */
int remove_func(func_t * func) {
if (func == NULL)
return ERROR;
splay_delete(func->name, builtin_func_tree);
return SUCCESS;
}
/* Find a function given its name */
func_t * find_func(char * name) {
func_t * func = NULL;
/* First look in the builtin database */
func = (func_t *)splay_find(name, builtin_func_tree);
return func;
}
/* Compare string name with function name */
int compare_func(char * name, char * name2) {
int cmpval;
/* Uses string comparison function */
cmpval = strncmp(name, name2, MAX_TOKEN_SIZE-1);
return cmpval;
}
/* Loads a builtin function */
int load_builtin_func(const char * name, double (*func_ptr)(), int num_args) {
func_t * func;
int retval;
/* Create new function */
func = create_func(name, func_ptr, num_args);
if (func == NULL)
return OUTOFMEM_ERROR;
retval = insert_func(func);
return retval;
}
/* Loads all builtin functions */
int load_all_builtin_func() {
if (load_builtin_func("int", int_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("abs", abs_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("sin", sin_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("cos", cos_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("tan", tan_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("asin", asin_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("acos", acos_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("atan", atan_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("sqr", sqr_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("sqrt", sqrt_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("pow", pow_wrapper, 2) < 0)
return ERROR;
if (load_builtin_func("exp", exp_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("log", log_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("log10", log10_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("sign", sign_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("min", min_wrapper, 2) < 0)
return ERROR;
if (load_builtin_func("max", max_wrapper, 2) < 0)
return ERROR;
if (load_builtin_func("sigmoid", sigmoid_wrapper, 2) < 0)
return ERROR;
if (load_builtin_func("atan2", atan2_wrapper, 2) < 0)
return ERROR;
if (load_builtin_func("rand", rand_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("band", band_wrapper, 2) < 0)
return ERROR;
if (load_builtin_func("bor", bor_wrapper, 2) < 0)
return ERROR;
if (load_builtin_func("bnot", bnot_wrapper, 1) < 0)
return ERROR;
if (load_builtin_func("if", if_wrapper, 3) < 0)
return ERROR;
if (load_builtin_func("equal", equal_wrapper, 2) < 0)
return ERROR;
if (load_builtin_func("above", above_wrapper, 2) < 0)
return ERROR;
if (load_builtin_func("below", below_wrapper, 2) < 0)
return ERROR;
if (load_builtin_func("nchoosek", nchoosek_wrapper, 2) < 0)
return ERROR;
if (load_builtin_func("fact", fact_wrapper, 1) < 0)
return ERROR;
return SUCCESS;
}
#ifndef FUNC_H
#define FUNC_H
/* Public Prototypes */
func_t * create_func (const char * name, double (*func_ptr)(), int num_args);
int remove_func(func_t * func);
func_t * find_func(char * name);
int init_builtin_func_db();
int destroy_builtin_func_db();
int load_all_builtin_func();
int load_builtin_func(const char * name, double (*func_ptr)(), int num_args);
void free_func(func_t * func);
#endif
#ifndef FUNC_TYPES_H
#define FUNC_TYPES_H
#include "common.h"
/* Function Type */
typedef struct FUNC_T {
char name[MAX_TOKEN_SIZE];
double (*func_ptr)();
int num_args;
} func_t;
#endif
#ifndef IDLE_PRESET_H
#include "preset_types.h"
#define IDLE_PRESET_H
#define IDLE_PRESET_STRING "[idlepreset]\n"
preset_t * idle_preset;
#endif
/*****************************************************************************
* init_cond.:
*****************************************************************************
* Copyright (C) 2004 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@videolan.org>
* code from projectM http://xmms-projectm.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
/* Library functions to manipulate initial condition values */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "fatal.h"
#include "param_types.h"
#include "expr_types.h"
#include "init_cond_types.h"
#include "init_cond.h"
#include "splaytree_types.h"
#include "splaytree.h"
char init_cond_string_buffer[STRING_BUFFER_SIZE];
int init_cond_string_buffer_index = 0;
void init_cond_to_string(init_cond_t * init_cond);
/* Frees initial condition structure */
void free_init_cond(init_cond_t * init_cond) {
free(init_cond);
}
/* Evaluate an initial conditon */
void eval_init_cond(init_cond_t * init_cond) {
if (init_cond == NULL)
return;
/* Parameter is of boolean type, either a 1 or 0 value integer */
/* Set matrix flag to zero. This ensures
its constant value will be used rather than a matrix value
*/
init_cond->param->matrix_flag = 0;
if (init_cond->param->type == P_TYPE_BOOL) {
if (INIT_COND_DEBUG) printf("init_cond: %s = %d (TYPE BOOL)\n", init_cond->param->name, init_cond->init_val.bool_val);
*((int*)init_cond->param->engine_val) = init_cond->init_val.bool_val;
return;
}
/* Parameter is an integer type, just like C */
if (init_cond->param->type == P_TYPE_INT) {
if (INIT_COND_DEBUG) printf("init_cond: %s = %d (TYPE INT)\n", init_cond->param->name, init_cond->init_val.int_val);
*((int*)init_cond->param->engine_val) = init_cond->init_val.int_val;
return;
}
/* Parameter is of a double type, just like C */
if (init_cond->param->type == P_TYPE_DOUBLE) {
if (INIT_COND_DEBUG) printf("init_cond: %s = %f (TYPE DOUBLE)\n", init_cond->param->name, init_cond->init_val.double_val);
*((double*)init_cond->param->engine_val) = init_cond->init_val.double_val;
return;
}
/* Unknown type of parameter */
return;
}
/* Creates a new initial condition */
init_cond_t * new_init_cond(param_t * param, value_t init_val) {
init_cond_t * init_cond;
init_cond = (init_cond_t*)malloc(sizeof(init_cond_t));
if (init_cond == NULL)
return NULL;
init_cond->param = param;
init_cond->init_val = init_val;
return init_cond;
}
/* WIP */
void init_cond_to_string(init_cond_t * init_cond) {
int string_length;
char string[MAX_TOKEN_SIZE];
if (init_cond == NULL)
return;
/* Create a string "param_name=val" */
switch (init_cond->param->type) {
lldiv_t div;
case P_TYPE_BOOL:
sprintf(string, "%s=%d\n", init_cond->param->name, init_cond->init_val.bool_val);
break;
case P_TYPE_INT:
sprintf(string, "%s=%d\n", init_cond->param->name, init_cond->init_val.int_val);
break;
case P_TYPE_DOUBLE:
div = lldiv( init_cond->init_val.double_val * 1000000,
1000000 );
sprintf(string, "%s=%"PRId64".%06u\n", init_cond->param->name, div.quot, (unsigned int) div.rem );
break;
default:
return;
}
/* Compute the length of the string */
string_length = strlen(string);
/* Buffer overflow check */
if ((init_cond_string_buffer_index + string_length + 1) > (STRING_BUFFER_SIZE - 1))
return;
/* Copy the string into the initial condition string buffer */
strncpy(init_cond_string_buffer + init_cond_string_buffer_index, string, string_length);
/* Increment the string buffer, offset by one for the null terminator, which will be
overwritten by the next call to this function */
init_cond_string_buffer_index+= string_length + 1;
}
char * create_init_cond_string_buffer(splaytree_t * init_cond_tree) {
if (init_cond_tree == NULL)
return NULL;
init_cond_string_buffer_index = 0;
splay_traverse(init_cond_to_string, init_cond_tree);
return init_cond_string_buffer;
}
#ifndef INIT_COND_H
#define INIT_COND_H
#define INIT_COND_DEBUG 0
#include "param_types.h"
#include "init_cond_types.h"
#include "splaytree_types.h"
void eval_init_cond(init_cond_t * init_cond);
init_cond_t * new_init_cond(param_t * param, value_t init_val);
void free_init_cond(init_cond_t * init_cond);
char * create_init_cond_string_buffer(splaytree_t * init_cond_tree);
#endif
#ifndef INIT_COND_TYPES_H
#define INIT_COND_TYPES_H
#include "param_types.h"
#include "expr_types.h"
typedef struct INIT_COND_T {
struct PARAM_T * param;
value_t init_val;
} init_cond_t;
#endif
#ifndef INTERFACE_TYPES_H
#define INTERFACE_TYPES_H
typedef enum {
MENU_INTERFACE,
SHELL_INTERFACE,
EDITOR_INTERFACE,
DEFAULT_INTERFACE,
BROWSER_INTERFACE
} interface_t;
#endif
This diff is collapsed.
/*****************************************************************************
* main.h:
*****************************************************************************
* Copyright (C) 2004 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _GALAKTOS_MAIN_H_
#define _GALAKTOS_MAIN_H_
int galaktos_init( galaktos_thread_t *p_thread );
void galaktos_done( galaktos_thread_t *p_thread );
int galaktos_update( galaktos_thread_t *p_thread );
#endif
This diff is collapsed.
#ifndef PARAM_H
#define PARAM_H
#include "preset_types.h"
#include "splaytree_types.h"
/* Debug level, zero for none */
#define PARAM_DEBUG 0
/* Used to store a number of decidable type */
/* Function prototypes */
param_t * create_param (const char * name, short int type, short int flags, void * eqn_val, void * matrix,
value_t default_init_val, value_t upper_bound, value_t lower_bound);
param_t * create_user_param(char * name);
int init_builtin_param_db();
int init_user_param_db();
int destroy_user_param_db();
int destroy_builtin_param_db();
void set_param(param_t * param, double val);
int remove_param(param_t * param);
param_t * find_param(char * name, struct PRESET_T * preset, int flags);
void free_param(param_t * param);
int load_all_builtin_param();
int insert_param(param_t * param, splaytree_t * database);
param_t * find_builtin_param(char * name);
param_t * new_param_double(const char * name, short int flags, void * engine_val, void * matrix,
double upper_bound, double lower_bound, double init_val);
param_t * new_param_int(const char * name, short int flags, void * engine_val,
int upper_bound, int lower_bound, int init_val);
param_t * new_param_bool(const char * name, short int flags, void * engine_val,
int upper_bound, int lower_bound, int init_val);
param_t * find_param_db(char * name, splaytree_t * database, int create_flag);
#endif
#ifndef PARAM_TYPES_H
#define PARAM_TYPES_H
#include "expr_types.h"
#define P_CREATE 1
#define P_NONE 0
#define P_TYPE_BOOL 0
#define P_TYPE_INT 1
#define P_TYPE_DOUBLE 2
#define P_FLAG_NONE 0
#define P_FLAG_READONLY 1
#define P_FLAG_USERDEF (1 << 1)
#define P_FLAG_QVAR (1 << 2)
#define P_FLAG_TVAR (1 << 3)
#define P_FLAG_ALWAYS_MATRIX (1 << 4)
#define P_FLAG_DONT_FREE_MATRIX (1 << 5)
#define P_FLAG_PER_PIXEL (1 << 6)
#define P_FLAG_PER_POINT (1 << 7)
typedef union VALUE_T {
int bool_val;
int int_val;
double double_val;
} value_t;
/* Parameter Type */
typedef struct PARAM_T {
char name[MAX_TOKEN_SIZE]; /* name of the parameter, not necessary but useful neverthless */
short int type; /* parameter number type (int, bool, or double) */
short int flags; /* read, write, user defined, etc */
short int matrix_flag; /* for optimization purposes */
void * engine_val; /* pointer to the engine variable */
void * matrix; /* per pixel / per point matrix for this variable */
value_t default_init_val; /* a default initial condition value */
value_t upper_bound; /* this parameter's upper bound */
value_t lower_bound; /* this parameter's lower bound */
} param_t;
#endif
This diff is collapsed.
#ifndef PARSER_H
#define PARSER_H
#define PARSE_DEBUG 0
#include "expr_types.h"
#include "per_frame_eqn_types.h"
#include "init_cond_types.h"
#include "preset_types.h"
#include <stdio.h>
per_frame_eqn_t * parse_per_frame_eqn(FILE * fs, int index, struct PRESET_T * preset);
int parse_per_pixel_eqn(FILE * fs, preset_t * preset);
init_cond_t * parse_init_cond(FILE * fs, char * name, struct PRESET_T * preset);
int parse_preset_name(FILE * fs, char * name);
int parse_top_comment(FILE * fs);
int parse_line(FILE * fs, struct PRESET_T * preset);
#endif
/*****************************************************************************
* per_frame_eqn.c:
*****************************************************************************
* Copyright (C) 2004 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@videolan.org>
* code from projectM http://xmms-projectm.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fatal.h"
#include "common.h"
#include "param.h"
#include "per_frame_eqn_types.h"
#include "per_frame_eqn.h"
#include "expr_types.h"
#include "eval.h"
/* Evaluate an equation */
void eval_per_frame_eqn(per_frame_eqn_t * per_frame_eqn) {
if (per_frame_eqn == NULL)
return;
if (PER_FRAME_EQN_DEBUG) {
printf("per_frame_%d=%s= ", per_frame_eqn->index, per_frame_eqn->param->name);
fflush(stdout);
}
//*((double*)per_frame_eqn->param->engine_val) = eval_gen_expr(per_frame_eqn->gen_expr);
set_param(per_frame_eqn->param, eval_gen_expr(per_frame_eqn->gen_expr));
if (PER_FRAME_EQN_DEBUG) printf(" = %.4f\n", *((double*)per_frame_eqn->param->engine_val));
}
/*
void eval_per_frame_init_eqn(per_frame_eqn_t * per_frame_eqn) {
double val;
init_cond_t * init_cond;
if (per_frame_eqn == NULL)
return;
if (PER_FRAME_EQN_DEBUG) {
printf("per_frame_init: %s = ", per_frame_eqn->param->name);
fflush(stdout);
}
val = *((double*)per_frame_eqn->param->engine_val) = eval_gen_expr(per_frame_eqn->gen_expr);
if (PER_FRAME_EQN_DEBUG) printf(" = %f\n", *((double*)per_frame_eqn->param->engine_val));
if (per_frame_eqn->param->flags & P_FLAG_QVAR) {
per_frame_eqn->param->init_val.double_val = val;
if ((init_cond = new_init_cond(per_frame_eqn->param)) == NULL)
return;
if ((list_append(init_cond_list, init_cond)) < 0) {
free_init_cond(init_cond);
return;
}
}
}
*/
/* Frees perframe equation structure */
void free_per_frame_eqn(per_frame_eqn_t * per_frame_eqn) {
if (per_frame_eqn == NULL)
return;
free_gen_expr(per_frame_eqn->gen_expr);
free(per_frame_eqn);
}
/* Create a new per frame equation */
per_frame_eqn_t * new_per_frame_eqn(int index, param_t * param, gen_expr_t * gen_expr) {
per_frame_eqn_t * per_frame_eqn;
per_frame_eqn = (per_frame_eqn_t*)malloc(sizeof(per_frame_eqn_t));
if (per_frame_eqn == NULL)
return NULL;
per_frame_eqn->param = param;
per_frame_eqn->gen_expr = gen_expr;
per_frame_eqn->index = index;
/* Set per frame eqn name */
// memset(per_frame_eqn->name, 0, MAX_TOKEN_SIZE);
//strncpy(per_frame_eqn->name, name, MAX_TOKEN_SIZE-1);
return per_frame_eqn;
}
#ifndef PER_FRAME_EQN_H
#define PER_FRAME_EQN_H
#define PER_FRAME_EQN_DEBUG 0
per_frame_eqn_t * new_per_frame_eqn(int index, param_t * param, struct GEN_EXPR_T * gen_expr);
void eval_per_frame_eqn(per_frame_eqn_t * per_frame_eqn);
void free_per_frame_eqn(per_frame_eqn_t * per_frame_eqn);
void eval_per_frame_init_eqn(per_frame_eqn_t * per_frame_eqn);
#endif
#ifndef PER_FRAME_EQN_TYPES_H
#define PER_FRAME_EQN_TYPES_H
#include "param_types.h"
#include "expr_types.h"
typedef struct PER_FRAME_EQN_T {
int index;
struct PARAM_T * param; /* parameter to be assigned a value */
struct GEN_EXPR_T * gen_expr; /* expression that paremeter is equal to */
} per_frame_eqn_t;
#endif
This diff is collapsed.
#ifndef PER_PIXEL_EQN_H
#define PER_PIXEL_EQN_H
#include "expr_types.h"
#include "preset_types.h"
#define PER_PIXEL_EQN_DEBUG 0
void evalPerPixelEqns();
int add_per_pixel_eqn(char * name, gen_expr_t * gen_expr, struct PRESET_T * preset);
void free_per_pixel_eqn(per_pixel_eqn_t * per_pixel_eqn);
per_pixel_eqn_t * new_per_pixel_eqn(int index, param_t * param, gen_expr_t * gen_expr);
inline int resetPerPixelEqnFlags();
#endif
#ifndef PER_PIXEL_EQN_TYPES_H
#define PER_PIXEL_EQN_TYPES_H
/* This is sort of ugly, but it is also the fastest way to access the per pixel equations */
#include "common.h"
#include "expr_types.h"
typedef struct PER_PIXEL_EQN_T {
int index; /* used for splay tree ordering. */
int flags; /* primarily to specify if this variable is user-defined */
param_t * param;
gen_expr_t * gen_expr;
} per_pixel_eqn_t;
#define ZOOM_OP 0
#define ZOOMEXP_OP 1
#define ROT_OP 2
#define CX_OP 3
#define CY_OP 4
#define SX_OP 5
#define SY_OP 6
#define DX_OP 7
#define DY_OP 8
#define WARP_OP 9
#define NUM_OPS 10 /* obviously, this number is dependent on the number of existing per pixel operations */
#endif
#ifndef PER_POINT_EQN_TYPES_H
#define PER_POINT_EQN_TYPES_H
#include "custom_wave_types.h"
typedef struct PER_POINT_EQN {
custom_wave_t * custom_wave;
} per_point_eqn_t;
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef PRESET_H
#define PRESET_H
#define PRESET_DEBUG 0 /* 0 for no debugging, 1 for normal, 2 for insane */
#define HARD_CUT 0
#define SOFT_CUT 1
#include "preset_types.h"
void evalInitConditions();
void evalPerFrameEquations();
void evalPerFrameInitEquations();
int switchPreset(switch_mode_t switch_mode, int cut_type);
void switchToIdlePreset();
int loadPresetDir(char * dir);
int closePresetDir();
int initPresetLoader();
int destroyPresetLoader();
int loadPresetByFile(char * filename);
void reloadPerFrame(char * s, preset_t * preset);
void reloadPerFrameInit(char *s, preset_t * preset);
void reloadPerPixel(char *s, preset_t * preset);
void savePreset(char * name);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef SPLAYTREE_TYPES_H
#define SPLAYTREE_TYPES_H
typedef struct SPLAYNODE_T {
int type;
struct SPLAYNODE_T * left, * right;
void * data;
void * key;
} splaynode_t;
typedef struct SPLAYTREE_T {
splaynode_t * root;
int (*compare)();
void * (*copy_key)();
void (*free_key)();
} splaytree_t;
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
void setup_opengl( int w, int h );
void CreateRenderTarget(int texsize,int *RenderTargetTextureID, int *RenderTarget);
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment