summaryrefslogtreecommitdiff
path: root/src/post/goom
diff options
context:
space:
mode:
Diffstat (limited to 'src/post/goom')
-rw-r--r--src/post/goom/Makefile.am46
-rw-r--r--src/post/goom/goom_core.c8
-rw-r--r--src/post/goom/goom_filters.h2
-rw-r--r--src/post/goom/ifs.c2
-rw-r--r--src/post/goom/mmx.c2
-rw-r--r--[-rwxr-xr-x]src/post/goom/mmx.h4
-rw-r--r--src/post/goom/sound_tester.c2
-rw-r--r--src/post/goom/xine_goom.c150
-rw-r--r--src/post/goom/xmmx.c2
9 files changed, 114 insertions, 104 deletions
diff --git a/src/post/goom/Makefile.am b/src/post/goom/Makefile.am
index 4aeda8f04..22b4af79f 100644
--- a/src/post/goom/Makefile.am
+++ b/src/post/goom/Makefile.am
@@ -1,35 +1,15 @@
include $(top_srcdir)/misc/Makefile.common
-libdir = $(XINE_PLUGINDIR)/post
-
-EXTRA_DIST = mmx.c xmmx.c ppc_drawings.s ppc_zoom_ultimate.s diff_against_release.patch \
- gfontrle.c mathtools.c
-
-## -fomit-frame-pointer segfaults here
-## Use -O2 if -Os is stripped or x86 does not build
-#CFLAGS = `echo @CFLAGS@ | sed -e 's/-fomit-frame-pointer//g;s/-Os/-O2/g'`
-CFLAGS = `echo @CFLAGS@ | sed -e 's/-Os/-O2/g'`
-
-lib_LTLIBRARIES = xineplug_post_goom.la
+AM_CFLAGS = $(VISIBILITY_FLAG)
## doesn't work
-#if PPC_ARCH
+#if ARCH_PPC
#extra_files = ppc_drawings.s ppc_zoom_ultimate.s
#AM_CPPFLAGS = -DCPU_POWERPC
#endif
-if HAVE_MMX
-extra_files = mmx.c xmmx.c
-endif
-
-xineplug_post_goom_la_SOURCES = $(extra_files) xine_goom.c \
- config_param.c convolve_fx.c cpu_info.c drawmethods.c filters.c flying_stars_fx.c \
- gfontlib.c goom_core.c goom_tools.c goomsl.c goomsl_hash.c goomsl_heap.c \
- goomsl_lex.c goomsl_yacc.c graphic.c ifs.c lines.c \
- plugin_info.c sound_tester.c surf3d.c tentacle3d.c v3d.c
-xineplug_post_goom_la_LIBADD = $(XINE_LIB) $(GOOM_LIBS) $(PTHREAD_LIBS) -lm
-xineplug_post_goom_la_CFLAGS = $(VISIBILITY_FLAG)
-xineplug_post_goom_la_LDFLAGS = -avoid-version -module
+EXTRA_DIST = mmx.c xmmx.c ppc_drawings.s ppc_zoom_ultimate.s diff_against_release.patch \
+ gfontrle.c mathtools.c
noinst_HEADERS = cpu_info.h default_scripts.h drawmethods.h gfontlib.h goom.h \
goom_config.h goom_config_param.h goom_filters.h goom_fx.h goom_graphic.h \
@@ -37,3 +17,21 @@ noinst_HEADERS = cpu_info.h default_scripts.h drawmethods.h gfontlib.h goom.h \
goomsl_heap.h goomsl_private.h goomsl_yacc.h ifs.h lines.h mathtools.h mmx.h \
ppc_drawings.h ppc_zoom_ultimate.h sound_tester.h surf3d.h tentacle3d.h v3d.h \
motif_goom1.h motif_goom2.h
+
+noinst_LTLIBRARIES = libpost_goom_asm.la
+libpost_goom_asm_la_SOURCES = xmmx.c
+if DEBUG_BUILD
+libpost_goom_asm_la_CFLAGS = $(O1_CFLAGS) $(AM_CFLAGS)
+else
+libpost_goom_asm_la_CFLAGS = $(DEFAULT_OCFLAGS) $(AM_CFLAGS)
+endif
+
+xinepost_LTLIBRARIES = xineplug_post_goom.la
+xineplug_post_goom_la_SOURCES = mmx.c xine_goom.c \
+ config_param.c convolve_fx.c cpu_info.c drawmethods.c filters.c flying_stars_fx.c \
+ gfontlib.c goom_core.c goom_tools.c goomsl.c goomsl_hash.c goomsl_heap.c \
+ goomsl_lex.c goomsl_yacc.c graphic.c ifs.c lines.c \
+ plugin_info.c sound_tester.c surf3d.c tentacle3d.c v3d.c
+xineplug_post_goom_la_LIBADD = $(XINE_LIB) $(GOOM_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) -lm $(noinst_LTLIBRARIES)
+xineplug_post_goom_la_CFLAGS = $(DEFAULT_OCFLAGS) $(AM_CFLAGS)
+xineplug_post_goom_la_LDFLAGS = $(AM_LDFLAGS) $(xineplug_ldflags)
diff --git a/src/post/goom/goom_core.c b/src/post/goom/goom_core.c
index e6fec60ea..274059da4 100644
--- a/src/post/goom/goom_core.c
+++ b/src/post/goom/goom_core.c
@@ -26,7 +26,7 @@
#include "goom_fx.h"
#include "goomsl.h"
-#include "xine_internal.h"
+#include <xine/xine_internal.h>
/* #define VERBOSE */
@@ -151,7 +151,7 @@ guint32 *goom_update (PluginInfo *goomInfo, gint16 data[2][512],
guint32 pointWidth;
guint32 pointHeight;
int i;
- float largfactor; /* elargissement de l'intervalle d'évolution des points */
+ float largfactor; /* elargissement de l'intervalle d'évolution des points */
Pixel *tmp;
ZoomFilterData *pzfd;
@@ -215,7 +215,7 @@ guint32 *goom_update (PluginInfo *goomInfo, gint16 data[2][512],
}
}
- /* par défaut pas de changement de zoom */
+ /* par défaut pas de changement de zoom */
pzfd = NULL;
/*
@@ -532,7 +532,7 @@ guint32 *goom_update (PluginInfo *goomInfo, gint16 data[2][512],
}
/*
- * arreter de decrémenter au bout d'un certain temps
+ * arreter de decrémenter au bout d'un certain temps
*/
if ((goomInfo->cycle % 101 == 0) && (goomInfo->update.zoomFilterData.pertedec == 7)) {
pzfd = &goomInfo->update.zoomFilterData;
diff --git a/src/post/goom/goom_filters.h b/src/post/goom/goom_filters.h
index f015499a8..06c6d092a 100644
--- a/src/post/goom/goom_filters.h
+++ b/src/post/goom/goom_filters.h
@@ -16,7 +16,7 @@ struct _ZOOM_FILTER_DATA
unsigned char sqrtperte;
int middleX, middleY; /* milieu de l'effet */
char reverse; /* inverse la vitesse */
- char mode; /* type d'effet à appliquer (cf les #define) */
+ char mode; /* type d'effet à appliquer (cf les #define) */
/** @since June 2001 */
int hPlaneEffect; /* deviation horitontale */
int vPlaneEffect; /* deviation verticale */
diff --git a/src/post/goom/ifs.c b/src/post/goom/ifs.c
index af84b777b..4c7ec75d1 100644
--- a/src/post/goom/ifs.c
+++ b/src/post/goom/ifs.c
@@ -64,7 +64,7 @@ IFSPoint;
#define ifs_opts xlockmore_opts
#define DEFAULTS "*delay: 20000 \n" \
-"*ncolors: 100 \n"
+"*ncolours: 100 \n"
#define SMOOTH_COLORS
diff --git a/src/post/goom/mmx.c b/src/post/goom/mmx.c
index e2f25b47d..3c9d0ee4a 100644
--- a/src/post/goom/mmx.c
+++ b/src/post/goom/mmx.c
@@ -109,7 +109,7 @@ void zoom_filter_mmx (int prevX, int prevY,
"pmullw %%mm4, %%mm1 \n\t"
"pmullw %%mm5, %%mm2 \n\t"
- /* ajout des valeurs obtenues à la valeur finale */
+ /* ajout des valeurs obtenues à la valeur finale */
"paddw %%mm1, %%mm0 \n\t"
"paddw %%mm2, %%mm0 \n\t"
diff --git a/src/post/goom/mmx.h b/src/post/goom/mmx.h
index b650d8b12..6861b7cfe 100755..100644
--- a/src/post/goom/mmx.h
+++ b/src/post/goom/mmx.h
@@ -31,6 +31,8 @@
# include "config.h"
#endif
+#include <xine/attributes.h>
+
#include "goom_graphic.h"
/* Warning: at this writing, the version of GAS packaged
@@ -58,7 +60,7 @@ typedef union {
char b[8]; /* 8 Byte (8-bit) values */
unsigned char ub[8]; /* 8 Unsigned Byte */
float s[2]; /* Single-precision (32-bit) value */
-} __attribute__ ((aligned (8))) mmx_t; /* On an 8-byte (64-bit) boundary */
+} ATTR_ALIGN(8) mmx_t; /* On an 8-byte (64-bit) boundary */
diff --git a/src/post/goom/sound_tester.c b/src/post/goom/sound_tester.c
index ac50a11b2..b6c4af442 100644
--- a/src/post/goom/sound_tester.c
+++ b/src/post/goom/sound_tester.c
@@ -90,7 +90,7 @@ void evaluate_sound(gint16 data[2][512], SoundInfo *info) {
if (info->goom_limit>1)
info->goom_limit=1;
- /* toute les 2 secondes : vérifier si le taux de goom est correct
+ /* toute les 2 secondes : vérifier si le taux de goom est correct
* et le modifier sinon.. */
if (info->cycle % 64 == 0) {
if (info->speedvar<0.01f)
diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c
index 5871618e0..6971a5a1c 100644
--- a/src/post/goom/xine_goom.c
+++ b/src/post/goom/xine_goom.c
@@ -15,9 +15,7 @@
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: xine_goom.c,v 1.65 2007/02/20 00:58:51 dgp85 Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* GOOM post plugin.
*
@@ -37,9 +35,9 @@
*/
#include "config.h"
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "post.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/post.h>
#include "goom.h"
@@ -82,13 +80,12 @@ struct post_plugin_goom_s {
/* goom context */
PluginInfo *goom;
- int data_idx;
+ int data_idx;
gint16 data [2][NUMSAMPLES];
audio_buffer_t buf; /* dummy buffer just to hold a copy of audio data */
int channels;
int sample_rate;
- int sample_counter;
int samples_per_frame;
int width, height;
int width_back, height_back;
@@ -96,6 +93,11 @@ struct post_plugin_goom_s {
int fps;
int csc_method;
+
+ int do_samples_skip; /* true = skipping samples, false reading samples*/
+ int left_to_read; /* data to read before switching modes*/
+
+
yuv_planes_t yuv;
/* frame skipping */
@@ -114,7 +116,7 @@ static const post_info_t goom_special_info = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 9, "goom", XINE_VERSION_CODE, &goom_special_info, &goom_init_plugin },
+ { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 10, "goom", XINE_VERSION_CODE, &goom_special_info, &goom_init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
@@ -123,8 +125,6 @@ const plugin_info_t xine_plugin_info[] EXPORTED = {
static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs,
xine_audio_port_t **audio_target,
xine_video_port_t **video_target);
-static char *goom_get_identifier(post_class_t *class_gen);
-static char *goom_get_description(post_class_t *class_gen);
static void goom_class_dispose(post_class_t *class_gen);
/* plugin instance functions */
@@ -192,8 +192,8 @@ static void *goom_init_plugin(xine_t *xine, void *data)
return NULL;
this->class.open_plugin = goom_open_plugin;
- this->class.get_identifier = goom_get_identifier;
- this->class.get_description = goom_get_description;
+ this->class.identifier = "goom";
+ this->class.description = N_("What a GOOM");
this->class.dispose = goom_class_dispose;
this->ip = NULL;
this->xine = xine;
@@ -219,8 +219,8 @@ static void *goom_init_plugin(xine_t *xine, void *data)
cfg->register_enum (cfg, "effects.goom.csc_method", 0,
goom_csc_methods,
- _("colorspace conversion method"),
- _("You can choose the colorspace conversion method used by goom.\n"
+ _("colour space conversion method"),
+ _("You can choose the colour space conversion method used by goom.\n"
"The available selections should be self-explaining."),
20, csc_method_changed_cb, this);
@@ -282,7 +282,6 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs,
this->ratio = (double)this->width_back/(double)this->height_back;
- this->sample_counter = 0;
this->buf.mem = NULL;
this->buf.mem_size = 0;
@@ -306,16 +305,6 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs,
return &this->post;
}
-static char *goom_get_identifier(post_class_t *class_gen)
-{
- return "goom";
-}
-
-static char *goom_get_description(post_class_t *class_gen)
-{
- return "What a GOOM";
-}
-
static void goom_class_dispose(post_class_t *class_gen)
{
post_class_goom_t *this = (post_class_goom_t*) class_gen;
@@ -362,7 +351,7 @@ static int goom_rewire_video(xine_post_out_t *output_gen, void *data)
return 0;
/* register our stream at the new output port */
old_port->close(old_port, XINE_ANON_STREAM);
- new_port->open(new_port, XINE_ANON_STREAM);
+ (new_port->open) (new_port, XINE_ANON_STREAM);
/* reconnect ourselves */
this->vo_port = new_port;
return 1;
@@ -386,14 +375,16 @@ static int goom_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream,
this->sample_rate = rate;
this->samples_per_frame = rate / this->fps;
this->data_idx = 0;
- this->sample_counter = 0;
init_yuv_planes(&this->yuv, this->width, this->height);
this->skip_frame = 0;
+
+ this->do_samples_skip = 0;
+ this->left_to_read = NUMSAMPLES;
- this->vo_port->open(this->vo_port, XINE_ANON_STREAM);
+ (this->vo_port->open) (this->vo_port, XINE_ANON_STREAM);
this->metronom->set_master(this->metronom, stream->metronom);
- return port->original_port->open(port->original_port, stream, bits, rate, mode );
+ return (port->original_port->open) (port->original_port, stream, bits, rate, mode );
}
static void goom_port_close(xine_audio_port_t *port_gen, xine_stream_t *stream ) {
@@ -422,11 +413,12 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
uint8_t *goom_frame, *goom_frame_end;
int16_t *data;
int8_t *data8;
- int samples_used = 0;
int64_t pts = buf->vpts;
int i, j;
uint8_t *dest_ptr;
int width, height;
+
+ int current_sample = 0;
/* make a copy of buf data for private use */
if( this->buf.mem_size < buf->mem_size ) {
@@ -444,59 +436,73 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
* to the fifo of free audio buffers. just use our private copy instead.
*/
buf = &this->buf;
-
- this->sample_counter += buf->num_frames;
j = (this->channels >= 2) ? 1 : 0;
- do {
-
+
+ while (current_sample < buf->num_frames) {
+
+ if (this->do_samples_skip) {
+ if (current_sample + this->left_to_read > buf->num_frames) {
+ this->left_to_read -= (buf->num_frames-current_sample);
+ break;
+ } else {
+ current_sample+=this->left_to_read;
+ this->left_to_read = NUMSAMPLES;
+ this->do_samples_skip = 0;
+
+ }
+ } else {
+
if( port->bits == 8 ) {
data8 = (int8_t *)buf->mem;
- data8 += samples_used * this->channels;
+ data8 += current_sample * this->channels;
/* scale 8 bit data to 16 bits and convert to signed as well */
- for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES;
- i++, this->data_idx++, data8 += this->channels ) {
+ for ( i=current_sample ; this->data_idx < NUMSAMPLES && i < buf->num_frames;
+ i++, this->data_idx++,data8 += this->channels) {
+
this->data[0][this->data_idx] = ((int16_t)data8[0] << 8) - 0x8000;
this->data[1][this->data_idx] = ((int16_t)data8[j] << 8) - 0x8000;
}
} else {
data = buf->mem;
- data += samples_used * this->channels;
-
- for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES;
- i++, this->data_idx++, data += this->channels ) {
+ data += current_sample * this->channels;
+
+ for ( i=current_sample ; this->data_idx < NUMSAMPLES && i < buf->num_frames;
+ i++, this->data_idx++,data += this->channels) {
+
this->data[0][this->data_idx] = data[0];
this->data[1][this->data_idx] = data[j];
}
}
-
- if( this->sample_counter >= this->samples_per_frame ) {
-
- samples_used += this->samples_per_frame;
+
+ if (this->data_idx < NUMSAMPLES) {
+ this->left_to_read = NUMSAMPLES - this->data_idx;
+ break;
+ } else {
+ _x_assert(this->data_idx == NUMSAMPLES);
+ this->data_idx = 0;
+
+ if (this->samples_per_frame > NUMSAMPLES) {
+ current_sample += NUMSAMPLES;
+ this->do_samples_skip = 1;
+ this->left_to_read = this->samples_per_frame - NUMSAMPLES;
+ } else {
+ current_sample += this->samples_per_frame;
+ this->left_to_read = NUMSAMPLES;
+ }
frame = this->vo_port->get_frame (this->vo_port, this->width_back, this->height_back,
- this->ratio, XINE_IMGFMT_YUY2,
- VO_BOTH_FIELDS);
+ this->ratio, XINE_IMGFMT_YUY2,
+ VO_BOTH_FIELDS);
frame->extra_info->invalid = 1;
- /* frame is marked as bad if we don't have enough samples for
- * updating the viz plugin (calculations may be skipped).
- * we must keep the framerate though. */
- if( this->data_idx == NUMSAMPLES ) {
- frame->bad_frame = 0;
- this->data_idx = 0;
- } else {
- frame->bad_frame = 1;
- }
frame->duration = 90000 * this->samples_per_frame / this->sample_rate;
frame->pts = pts;
this->metronom->got_video_frame(this->metronom, frame);
- this->sample_counter -= this->samples_per_frame;
-
- if (!this->skip_frame && !frame->bad_frame) {
+ if (!this->skip_frame) {
/* Try to be fast */
goom_frame = (uint8_t *)goom_update (this->goom, this->data, 0, 0, NULL, NULL);
@@ -561,21 +567,25 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
} else {
frame->bad_frame = 1;
frame->draw(frame, XINE_ANON_STREAM);
- this->skip_frame--;
+
+ _x_assert(this->skip_frame>0);
+ this->skip_frame--;
}
+
frame->free(frame);
width = this->width;
height = this->height;
if ((width != this->width_back) || (height != this->height_back)) {
- goom_close(this->goom);
- this->goom = goom_init (this->width, this->height);
- this->width_back = width;
- this->height_back = height;
- this->ratio = (double)width/(double)height;
- free_yuv_planes(&this->yuv);
- init_yuv_planes(&this->yuv, this->width, this->height);
- }
+ goom_close(this->goom);
+ this->goom = goom_init (this->width, this->height);
+ this->width_back = width;
+ this->height_back = height;
+ this->ratio = (double)width/(double)height;
+ free_yuv_planes(&this->yuv);
+ init_yuv_planes(&this->yuv, this->width, this->height);
+ }
}
- } while( this->sample_counter >= this->samples_per_frame );
+ }
+ }
}
diff --git a/src/post/goom/xmmx.c b/src/post/goom/xmmx.c
index 0048a20e8..6b76a86a3 100644
--- a/src/post/goom/xmmx.c
+++ b/src/post/goom/xmmx.c
@@ -234,7 +234,7 @@ void zoom_filter_xmmx (int prevX, int prevY,
pmullw_r2r (mm4, mm1);
pmullw_r2r (mm5, mm2);
- /* ajout des valeurs obtenues à la valeur finale */
+ /* ajout des valeurs obtenues à la valeur finale */
paddw_r2r (mm1, mm0);
paddw_r2r (mm2, mm0);