3 #include "goom_plugin_info.h"
5 #include "default_scripts.h"
6 #include "drawmethods.h"
11 #if defined (HAVE_CPU_PPC64) || defined (HAVE_CPU_PPC)
12 #include <sys/types.h>
13 #include <sys/sysctl.h>
14 #include "ppc_zoom_ultimate.h"
15 #include "ppc_drawings.h"
16 #endif /* HAVE_CPU_PPC64 || HAVE_CPU_PPC */
21 #endif /* HAVE_CPU_I386 */
23 #include <liboil/liboil.h>
24 #include <liboil/liboilfunction.h>
28 setOptimizedMethods (PluginInfo * p)
31 unsigned int cpuFlavour = oil_cpu_get_flags ();
33 /* set default methods */
34 p->methods.draw_line = draw_line;
35 p->methods.zoom_filter = zoom_filter_c;
36 /* p->methods.create_output_with_brightness = create_output_with_brightness;*/
39 printf ("have an x86\n");
40 if (cpuFlavour & OIL_IMPL_FLAG_MMXEXT) {
42 printf ("Extented MMX detected. Using the fastest methods !\n");
44 p->methods.draw_line = draw_line_mmx;
45 p->methods.zoom_filter = zoom_filter_xmmx;
46 } else if (cpuFlavour & OIL_IMPL_FLAG_MMX) {
48 printf ("MMX detected. Using fast methods !\n");
50 p->methods.draw_line = draw_line_mmx;
51 p->methods.zoom_filter = zoom_filter_mmx;
55 printf ("Too bad ! No SIMD optimization available for your CPU.\n");
57 #endif /* HAVE_CPU_I386 */
60 if ((cpuFlavour & CPU_OPTION_64_BITS) != 0) {
61 /* p->methods.create_output_with_brightness = ppc_brightness_G5; */
62 p->methods.zoom_filter = ppc_zoom_generic;
64 #endif /* HAVE_CPU_PPC64 */
67 if ((cpuFlavour & OIL_IMPL_FLAG_ALTIVEC) != 0) {
68 /* p->methods.create_output_with_brightness = ppc_brightness_G4; */
69 p->methods.zoom_filter = ppc_zoom_G4;
71 /* p->methods.create_output_with_brightness = ppc_brightness_generic;*/
72 p->methods.zoom_filter = ppc_zoom_generic;
74 #endif /* HAVE_CPU_PPC */
79 plugin_info_init (PluginInfo * pp, int nbVisuals)
85 p.sound.speedvar = p.sound.accelvar = p.sound.totalgoom = 0;
87 p.sound.goom_limit = 1;
88 p.sound.allTimesMax = 1;
90 p.sound.volume_p = secure_f_feedback ("Sound Volume");
91 p.sound.accel_p = secure_f_feedback ("Sound Acceleration");
92 p.sound.speed_p = secure_f_feedback ("Sound Speed");
93 p.sound.goom_limit_p = secure_f_feedback ("Goom Limit");
94 p.sound.last_goom_p = secure_f_feedback ("Goom Detection");
95 p.sound.last_biggoom_p = secure_f_feedback ("Big Goom Detection");
96 p.sound.goom_power_p = secure_f_feedback ("Goom Power");
98 p.sound.biggoom_speed_limit_p = secure_i_param ("Big Goom Speed Limit");
99 IVAL (p.sound.biggoom_speed_limit_p) = 10;
100 IMIN (p.sound.biggoom_speed_limit_p) = 0;
101 IMAX (p.sound.biggoom_speed_limit_p) = 100;
102 ISTEP (p.sound.biggoom_speed_limit_p) = 1;
104 p.sound.biggoom_factor_p = secure_i_param ("Big Goom Factor");
105 IVAL (p.sound.biggoom_factor_p) = 10;
106 IMIN (p.sound.biggoom_factor_p) = 0;
107 IMAX (p.sound.biggoom_factor_p) = 100;
108 ISTEP (p.sound.biggoom_factor_p) = 1;
110 p.sound.params = plugin_parameters ("Sound", 11);
113 p.nbVisuals = nbVisuals;
114 p.visuals = (VisualFX **) malloc (sizeof (VisualFX *) * nbVisuals);
117 pp->sound.params.params[0] = &pp->sound.biggoom_speed_limit_p;
118 pp->sound.params.params[1] = &pp->sound.biggoom_factor_p;
119 pp->sound.params.params[2] = 0;
120 pp->sound.params.params[3] = &pp->sound.volume_p;
121 pp->sound.params.params[4] = &pp->sound.accel_p;
122 pp->sound.params.params[5] = &pp->sound.speed_p;
123 pp->sound.params.params[6] = 0;
124 pp->sound.params.params[7] = &pp->sound.goom_limit_p;
125 pp->sound.params.params[8] = &pp->sound.goom_power_p;
126 pp->sound.params.params[9] = &pp->sound.last_goom_p;
127 pp->sound.params.params[10] = &pp->sound.last_biggoom_p;
129 pp->statesNumber = 8;
130 pp->statesRangeMax = 510;
132 GoomState states[8] = {
133 {1, 0, 0, 1, 4, 0, 100}
135 {1, 0, 0, 0, 1, 101, 140}
137 {1, 0, 0, 1, 2, 141, 200}
139 {0, 1, 0, 1, 2, 201, 260}
141 {0, 1, 0, 1, 0, 261, 330}
143 {0, 1, 1, 1, 4, 331, 400}
145 {0, 0, 1, 0, 5, 401, 450}
147 {0, 0, 1, 1, 1, 451, 510}
149 for (i = 0; i < 8; ++i)
150 pp->states[i] = states[i];
152 pp->curGState = &(pp->states[6]);
154 /* datas for the update loop */
155 pp->update.lockvar = 0;
156 pp->update.goomvar = 0;
157 pp->update.loopvar = 0;
158 pp->update.stop_lines = 0;
159 pp->update.ifs_incr = 1; /* dessiner l'ifs (0 = non: > = increment) */
160 pp->update.decay_ifs = 0; /* disparition de l'ifs */
161 pp->update.recay_ifs = 0; /* dedisparition de l'ifs */
162 pp->update.cyclesSinceLastChange = 0;
163 pp->update.drawLinesDuration = 80;
164 pp->update.lineMode = pp->update.drawLinesDuration;
166 pp->update.switchMultAmount = (29.0f / 30.0f);
167 pp->update.switchIncrAmount = 0x7f;
168 pp->update.switchMult = 1.0f;
169 pp->update.switchIncr = pp->update.switchIncrAmount;
171 pp->update.stateSelectionRnd = 0;
172 pp->update.stateSelectionBlocker = 0;
173 pp->update.previousZoomSpeed = 128;
174 pp->update.timeOfTitleDisplay = 0;
176 pp->update_message.affiche = 0;
179 ZoomFilterData zfd = {
181 1, 1, 0, NORMAL_MODE,
184 pp->update.zoomFilterData = zfd;
187 setOptimizedMethods (pp);
189 pp->scanner = gsl_new ();
190 pp->main_scanner = gsl_new ();
191 pp->main_script_str = GOOM_MAIN_SCRIPT;
193 for (i = 0; i < 0xffff; i++) {
195 (int) (1024 * sin ((double) i * 360 / (sizeof (pp->sintable) /
196 sizeof (pp->sintable[0]) - 1) * 3.141592 / 180) + .5);
197 /* sintable [us] = (int)(1024.0f * sin (us*2*3.31415f/0xffff)) ; */
202 plugin_info_add_visual (PluginInfo * p, int i, VisualFX * visual)
204 p->visuals[i] = visual;
205 if (i == p->nbVisuals - 1) {
209 if (p->visuals[i]->params)
213 (PluginParameters *) malloc (sizeof (PluginParameters) * p->nbParams);
216 p->params[0] = p->sound.params;
218 if (p->visuals[i]->params)
219 p->params[p->nbParams++] = *(p->visuals[i]->params);