diff options
Diffstat (limited to 'src/post')
60 files changed, 932 insertions, 797 deletions
diff --git a/src/post/Makefile.am b/src/post/Makefile.am index 8408c3f3a..f6706f221 100644 --- a/src/post/Makefile.am +++ b/src/post/Makefile.am @@ -1,4 +1,4 @@ +include $(top_srcdir)/misc/Makefile.quiet include $(top_srcdir)/misc/Makefile.common -SUBDIRS = \ - planar goom visualizations mosaico deinterlace audio +SUBDIRS = planar goom visualizations mosaico deinterlace audio diff --git a/src/post/audio/Makefile.am b/src/post/audio/Makefile.am index 78b94cd43..a359310e6 100644 --- a/src/post/audio/Makefile.am +++ b/src/post/audio/Makefile.am @@ -1,13 +1,15 @@ +include $(top_srcdir)/misc/Makefile.quiet include $(top_builddir)/misc/Makefile.plugins include $(top_srcdir)/misc/Makefile.common +AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) +AM_LDFLAGS = $(xineplug_ldflags) + noinst_HEADERS = dsp.h filter.h window.h audio_filters.h xinepost_LTLIBRARIES = xineplug_post_audio_filters.la xineplug_post_audio_filters_la_SOURCES = \ upmix.c upmix_mono.c filter.c window.c stretch.c volnorm.c audio_filters.c -xineplug_post_audio_filters_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -lm -xineplug_post_audio_filters_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_post_audio_filters_la_LDFLAGS = $(xineplug_ldflags) - +xineplug_post_audio_filters_la_CFLAGS = $(AM_CFLAGS) -fno-strict-aliasing +xineplug_post_audio_filters_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) -lm diff --git a/src/post/audio/audio_filters.c b/src/post/audio/audio_filters.c index eb90d38cb..78f495ca6 100644 --- a/src/post/audio/audio_filters.c +++ b/src/post/audio/audio_filters.c @@ -24,9 +24,9 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #include "audio_filters.h" @@ -39,9 +39,9 @@ static const post_info_t volnorm_special_info = { XINE_POST_TYPE_AUDIO_FILTER const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "upmix", XINE_VERSION_CODE, &upmix_special_info, &upmix_init_plugin }, - { PLUGIN_POST, 9, "upmix_mono", XINE_VERSION_CODE, &upmix_mono_special_info, &upmix_mono_init_plugin }, - { PLUGIN_POST, 9, "stretch", XINE_VERSION_CODE, &stretch_special_info, &stretch_init_plugin }, - { PLUGIN_POST, 9, "volnorm", XINE_VERSION_CODE, &volnorm_special_info, &volnorm_init_plugin }, - { PLUGIN_NONE, 0, "", 0, NULL, NULL } + { PLUGIN_POST, 10, "upmix", XINE_VERSION_CODE, &upmix_special_info, &upmix_init_plugin }, + { PLUGIN_POST, 10, "upmix_mono", XINE_VERSION_CODE, &upmix_mono_special_info, &upmix_mono_init_plugin }, + { PLUGIN_POST, 10, "stretch", XINE_VERSION_CODE, &stretch_special_info, &stretch_init_plugin }, + { PLUGIN_POST, 10, "volnorm", XINE_VERSION_CODE, &volnorm_special_info, &volnorm_init_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/audio/audio_filters.h b/src/post/audio/audio_filters.h index c2bf88cf8..144e85836 100644 --- a/src/post/audio/audio_filters.h +++ b/src/post/audio/audio_filters.h @@ -20,7 +20,7 @@ * catalog for audio filter plugins */ -#include "xine_internal.h" +#include <xine/xine_internal.h> void *upmix_init_plugin(xine_t *xine, void *data); diff --git a/src/post/audio/stretch.c b/src/post/audio/stretch.c index e315b11a8..1f130eff8 100644 --- a/src/post/audio/stretch.c +++ b/src/post/audio/stretch.c @@ -26,11 +26,11 @@ #include <stdio.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 "dsp.h" -#include "resample.h" +#include <xine/resample.h> #include "audio_filters.h" @@ -663,33 +663,18 @@ static post_plugin_t *stretch_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *stretch_get_identifier(post_class_t *class_gen) -{ - return "stretch"; -} - -static char *stretch_get_description(post_class_t *class_gen) -{ - return "Time stretch by a given factor, optionally preserving pitch"; -} - -static void stretch_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - /* plugin class initialization function */ void *stretch_init_plugin(xine_t *xine, void *data) { - post_class_stretch_t *class = (post_class_stretch_t *)malloc(sizeof(post_class_stretch_t)); + post_class_stretch_t *class = (post_class_stretch_t *)xine_xmalloc(sizeof(post_class_stretch_t)); if (!class) return NULL; class->post_class.open_plugin = stretch_open_plugin; - class->post_class.get_identifier = stretch_get_identifier; - class->post_class.get_description = stretch_get_description; - class->post_class.dispose = stretch_class_dispose; + class->post_class.identifier = "stretch"; + class->post_class.description = N_("Time stretch by a given factor, optionally preserving pitch"); + class->post_class.dispose = default_post_class_dispose; class->xine = xine; diff --git a/src/post/audio/upmix.c b/src/post/audio/upmix.c index f4ea9544a..97edd47dd 100644 --- a/src/post/audio/upmix.c +++ b/src/post/audio/upmix.c @@ -30,9 +30,9 @@ #include <stdio.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 "dsp.h" #include "audio_filters.h" @@ -420,33 +420,18 @@ static post_plugin_t *upmix_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *upmix_get_identifier(post_class_t *class_gen) -{ - return "upmix"; -} - -static char *upmix_get_description(post_class_t *class_gen) -{ - return "upmix"; -} - -static void upmix_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - /* plugin class initialization function */ void *upmix_init_plugin(xine_t *xine, void *data) { - post_class_upmix_t *class = (post_class_upmix_t *)malloc(sizeof(post_class_upmix_t)); + post_class_upmix_t *class = (post_class_upmix_t *)xine_xmalloc(sizeof(post_class_upmix_t)); if (!class) return NULL; class->post_class.open_plugin = upmix_open_plugin; - class->post_class.get_identifier = upmix_get_identifier; - class->post_class.get_description = upmix_get_description; - class->post_class.dispose = upmix_class_dispose; + class->post_class.identifier = "upmix"; + class->post_class.description = N_("upmix"); + class->post_class.dispose = default_post_class_dispose; class->xine = xine; diff --git a/src/post/audio/upmix_mono.c b/src/post/audio/upmix_mono.c index 1e5e05549..7fb6c7bd9 100644 --- a/src/post/audio/upmix_mono.c +++ b/src/post/audio/upmix_mono.c @@ -35,8 +35,8 @@ #define LOG */ -#include "xineutils.h" -#include "post.h" +#include <xine/xineutils.h> +#include <xine/post.h> #include "audio_filters.h" @@ -333,33 +333,18 @@ static post_plugin_t *upmix_mono_open_plugin(post_class_t *class_gen, int inputs return &this->post; } -static char *upmix_mono_get_identifier(post_class_t *class_gen) -{ - return "upmix_mono"; -} - -static char *upmix_mono_get_description(post_class_t *class_gen) -{ - return "converts Mono into Stereo"; -} - -static void upmix_mono_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - /* plugin class initialization function */ void *upmix_mono_init_plugin(xine_t *xine, void *data) { - post_class_upmix_mono_t *class = (post_class_upmix_mono_t *)malloc(sizeof(post_class_upmix_mono_t)); + post_class_upmix_mono_t *class = (post_class_upmix_mono_t *)xine_xmalloc(sizeof(post_class_upmix_mono_t)); if (!class) return NULL; class->post_class.open_plugin = upmix_mono_open_plugin; - class->post_class.get_identifier = upmix_mono_get_identifier; - class->post_class.get_description = upmix_mono_get_description; - class->post_class.dispose = upmix_mono_class_dispose; + class->post_class.identifier = "upmix_mono"; + class->post_class.description = N_("converts Mono into Stereo"); + class->post_class.dispose = default_post_class_dispose; class->xine = xine; diff --git a/src/post/audio/volnorm.c b/src/post/audio/volnorm.c index 945fd2505..dda38fa5f 100644 --- a/src/post/audio/volnorm.c +++ b/src/post/audio/volnorm.c @@ -29,9 +29,9 @@ #include <stdio.h> #include <math.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 "dsp.h" #include "audio_filters.h" @@ -449,33 +449,18 @@ static post_plugin_t *volnorm_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *volnorm_get_identifier(post_class_t *class_gen) -{ - return "volnorm"; -} - -static char *volnorm_get_description(post_class_t *class_gen) -{ - return "Normalize volume"; -} - -static void volnorm_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - /* plugin class initialization function */ void *volnorm_init_plugin(xine_t *xine, void *data) { - post_class_volnorm_t *class = (post_class_volnorm_t *)malloc(sizeof(post_class_volnorm_t)); + post_class_volnorm_t *class = (post_class_volnorm_t *)xine_xmalloc(sizeof(post_class_volnorm_t)); if (!class) return NULL; class->post_class.open_plugin = volnorm_open_plugin; - class->post_class.get_identifier = volnorm_get_identifier; - class->post_class.get_description = volnorm_get_description; - class->post_class.dispose = volnorm_class_dispose; + class->post_class.identifier = "volnorm"; + class->post_class.description = N_("Normalize volume"); + class->post_class.dispose = default_post_class_dispose; class->xine = xine; diff --git a/src/post/deinterlace/Makefile.am b/src/post/deinterlace/Makefile.am index 079ed5baf..cde794988 100644 --- a/src/post/deinterlace/Makefile.am +++ b/src/post/deinterlace/Makefile.am @@ -1,19 +1,18 @@ +include $(top_srcdir)/misc/Makefile.quiet include $(top_builddir)/misc/Makefile.plugins include $(top_srcdir)/misc/Makefile.common -SUBDIRS = plugins +AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) +AM_LDFLAGS = $(xineplug_ldflags) $(IMPURE_TEXT_LDFLAGS) -EXTRA_DIST = +SUBDIRS = plugins xinepost_LTLIBRARIES = xineplug_post_tvtime.la xineplug_post_tvtime_la_SOURCES = xine_plugin.c \ deinterlace.c pulldown.c speedy.c tvtime.c +xineplug_post_tvtime_la_CFLAGS = $(AM_CFLAGS) -fno-strict-aliasing xineplug_post_tvtime_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(PTHREAD_LIBS) \ $(top_builddir)/src/post/deinterlace/plugins/libdeinterlaceplugins.la -xineplug_post_tvtime_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_post_tvtime_la_LDFLAGS = $(xineplug_ldflags) \ - @IMPURE_TEXT_LDFLAGS@ - noinst_HEADERS = deinterlace.h pulldown.h speedtools.h speedy.h tvtime.h diff --git a/src/post/deinterlace/deinterlace.c b/src/post/deinterlace/deinterlace.c index 8e4a3bb00..5c0356c55 100644 --- a/src/post/deinterlace/deinterlace.c +++ b/src/post/deinterlace/deinterlace.c @@ -31,7 +31,7 @@ */ #include "deinterlace.h" -#include "xine_internal.h" +#include <xine/xine_internal.h> typedef struct methodlist_item_s methodlist_item_t; diff --git a/src/post/deinterlace/plugins/Makefile.am b/src/post/deinterlace/plugins/Makefile.am index 5e50c25f4..b2068a019 100644 --- a/src/post/deinterlace/plugins/Makefile.am +++ b/src/post/deinterlace/plugins/Makefile.am @@ -1,3 +1,4 @@ +include $(top_srcdir)/misc/Makefile.quiet include $(top_srcdir)/misc/Makefile.common # plugins/Makefile.am distributes the plugins that come with tvtime. @@ -17,7 +18,12 @@ include $(top_srcdir)/misc/Makefile.common # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -EXTRA_DIST = greedy2frame_template.c greedyh.asm \ +# libpostproc is here so we can use their nice mangle.h +AM_CFLAGS = $(VISIBILITY_FLAG) +AM_CPPFLAGS = -I$(top_srcdir)/src/post/deinterlace \ + -I$(top_srcdir)/src/xine-utils + +EXTRA_DIST = greedy2frame_template.c greedy2frame_template_sse2.c greedyh.asm \ tomsmocomp/SearchLoop0A.inc tomsmocomp/SearchLoopBottom.inc \ tomsmocomp/SearchLoopEdgeA.inc tomsmocomp/SearchLoopEdgeA8.inc \ tomsmocomp/SearchLoopOddA.inc tomsmocomp/SearchLoopOddA2.inc \ @@ -28,27 +34,26 @@ EXTRA_DIST = greedy2frame_template.c greedyh.asm \ tomsmocomp/TomsMoCompAll2.inc tomsmocomp/WierdBob.inc \ tomsmocomp/tomsmocompmacros.h x86-64_macros.inc -# libpostproc is here so we can use their nice mangle.h -AM_CFLAGS = -I$(top_srcdir)/src/post/deinterlace \ - -I$(top_srcdir)/src/xine-utils - -# Avoid "can't find register" failures with -O0, -O2, -O3 (gcc 4.0) -libdeinterlaceplugins_la-kdetv_greedyh.o libdeinterlaceplugins_la-kdetv_greedyh.lo: CFLAGS=$(shell echo @CFLAGS@ | sed -e 's/$$/ -O1/') - -noinst_LTLIBRARIES = libdeinterlaceplugins.la - -libdeinterlaceplugins_la_SOURCES = \ - double.c \ - greedy.c \ - linear.c \ - linearblend.c \ - vfir.c \ - weave.c \ - greedy2frame.c \ - scalerbob.c \ - kdetv_greedyh.c \ - kdetv_tomsmocomp.c -libdeinterlaceplugins_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) -libdeinterlaceplugins_la_LDFLAGS = $(xineplug_ldflags) - noinst_HEADERS = plugins.h greedyhmacros.h + +if DEBUG_BUILD +debug_sources = greedy2frame.c +nodebug_sources = +else +debug_sources = +nodebug_sources = greedy2frame.c +endif + +# per-object CFLAGS -- drop optimization on kdetv_greedyh.c so that gcc +# doesn't run out of general registers trying to compile it. + +noinst_LTLIBRARIES = libdeinterlacepluginsO1.la libdeinterlaceplugins.la +libdeinterlacepluginsO1_la_SOURCES = kdetv_greedyh.c $(debug_sources) +libdeinterlacepluginsO1_la_CFLAGS = $(O1_CFLAGS) $(AM_CFLAGS) + +libdeinterlaceplugins_la_SOURCES = double.c greedy.c linear.c linearblend.c \ + vfir.c weave.c scalerbob.c kdetv_tomsmocomp.c \ + $(nodebug_sources) +libdeinterlaceplugins_la_LIBADD = $(XINE_LIB) libdeinterlacepluginsO1.la +libdeinterlaceplugins_la_CFLAGS = $(DEFAULT_OCFLAGS) $(AM_CFLAGS) $(AVUTIL_CFLAGS) +libdeinterlaceplugins_la_LDFLAGS = $(AM_LDFLAGS) $(xineplug_ldflags) diff --git a/src/post/deinterlace/plugins/greedy.c b/src/post/deinterlace/plugins/greedy.c index 925779224..ee401dba6 100644 --- a/src/post/deinterlace/plugins/greedy.c +++ b/src/post/deinterlace/plugins/greedy.c @@ -32,8 +32,9 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> +#include "xine_mmx.h" #include "deinterlace.h" #include "speedtools.h" #include "speedy.h" diff --git a/src/post/deinterlace/plugins/greedy2frame.c b/src/post/deinterlace/plugins/greedy2frame.c index 57e3228ac..964c490a9 100644 --- a/src/post/deinterlace/plugins/greedy2frame.c +++ b/src/post/deinterlace/plugins/greedy2frame.c @@ -31,8 +31,9 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> +#include "xine_mmx.h" #include "deinterlace.h" #include "speedtools.h" #include "speedy.h" @@ -44,12 +45,45 @@ // uncomment next line to see this //#define CHECK_BOBWEAVE -static int GreedyTwoFrameThreshold = 4; -static int GreedyTwoFrameThreshold2 = 8; +#define GREEDYTWOFRAMETHRESHOLD 4 +#define GREEDYTWOFRAMETHRESHOLD2 8 -#define IS_SSE 1 +#define IS_MMXEXT 1 #include "greedy2frame_template.c" -#undef IS_SSE +#undef IS_MMXEXT + +#include "greedy2frame_template_sse2.c" + +static void DeinterlaceGreedy2Frame(uint8_t *output, int outstride, + deinterlace_frame_data_t *data, + int bottom_field, int second_field, int width, int height ) + +{ + if (xine_mm_accel() & MM_ACCEL_X86_SSE2) { + if (((uintptr_t)output & 15) || (outstride & 15) || + width & 7 || + ((uintptr_t)data->f0 & 15) || ((uintptr_t)data->f1 & 15)) { + /* + * instead of using an unaligned sse2 version just fall back to mmx + * which has no alignment restriction (though might be slow unaliged, + * but shouldn't hit this hopefully anyway). Plus in my experiments this + * was at least as fast as a naive unaligned sse2 version anyway (due to + * the inability to use streaming stores). + */ + DeinterlaceGreedy2Frame_MMXEXT(output, outstride, data, + bottom_field, second_field, width, height ); + } else { + DeinterlaceGreedy2Frame_SSE2(output, outstride, data, + bottom_field, second_field, width, height ); + } + } + else { + DeinterlaceGreedy2Frame_MMXEXT(output, outstride, data, + bottom_field, second_field, width, height ); + /* could fall back to 3dnow/mmx here too */ + } +} + static deinterlace_method_t greedy2framemethod = { @@ -61,7 +95,7 @@ static deinterlace_method_t greedy2framemethod = 0, 0, 0, - DeinterlaceGreedy2Frame_SSE, + DeinterlaceGreedy2Frame, 1, NULL }; diff --git a/src/post/deinterlace/plugins/greedy2frame_template.c b/src/post/deinterlace/plugins/greedy2frame_template.c index 7fe52519f..e88124886 100644 --- a/src/post/deinterlace/plugins/greedy2frame_template.c +++ b/src/post/deinterlace/plugins/greedy2frame_template.c @@ -85,25 +85,18 @@ */ -/* debugging feature */ -/* output the value of mm4 at this point which is pink where we will weave */ -/* and green were we are going to bob */ -/* uncomment next line to see this */ -/* #define CHECK_BOBWEAVE */ - +#if defined(ARCH_X86) || defined(ARCH_X86_64) #if !defined(MASKS_DEFINED) #define MASKS_DEFINED - static const int64_t __attribute__((__used__)) YMask = 0x00ff00ff00ff00ffll; - static const int64_t __attribute__((__used__)) Mask = 0x7f7f7f7f7f7f7f7fll; - static const int64_t __attribute__((__used__)) DwordOne = 0x0000000100000001ll; - static const int64_t __attribute__((__used__)) DwordTwo = 0x0000000200000002ll; - static int64_t qwGreedyTwoFrameThreshold; +static const mmx_t Mask = { uq: 0x7f7f7f7f7f7f7f7fll }; +#define TP GREEDYTWOFRAMETHRESHOLD, GREEDYTWOFRAMETHRESHOLD2 +static const mmx_t GreedyTwoFrameThreshold = { ub: {TP, TP, TP, TP} }; +#undef TP +#endif #endif -#include <mangle.h> - -#if defined(IS_SSE) -static void DeinterlaceGreedy2Frame_SSE(uint8_t *output, int outstride, +#if defined(IS_MMXEXT) +static void DeinterlaceGreedy2Frame_MMXEXT(uint8_t *output, int outstride, deinterlace_frame_data_t *data, int bottom_field, int second_field, int width, int height ) #elif defined(IS_3DNOW) @@ -132,13 +125,6 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, uint32_t LineLength = stride; uint32_t PitchRest = Pitch - (LineLength >> 3)*8; - qwGreedyTwoFrameThreshold = GreedyTwoFrameThreshold; - qwGreedyTwoFrameThreshold += (GreedyTwoFrameThreshold2 << 8); - qwGreedyTwoFrameThreshold += (qwGreedyTwoFrameThreshold << 48) + - (qwGreedyTwoFrameThreshold << 32) + - (qwGreedyTwoFrameThreshold << 16); - - if( second_field ) { M1 = data->f0; T1 = data->f0; @@ -185,14 +171,15 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, asm volatile( /* Figure out what to do with the scanline above the one we just copied. * See above for a description of the algorithm. - */ - ".align 8 \n\t" - "movq %4, %%mm6 \n\t" - + * weave if (weave(M) AND (weave(T) OR weave(B))) + */ "movq %0, %%mm1 \n\t" // T1 "movq %1, %%mm0 \n\t" // M1 "movq %2, %%mm3 \n\t" // B1 "movq %3, %%mm2 \n\t" // M0 + + "movq %4, %%mm6 \n\t" // Mask + : /* no output */ : "m" (*T1), "m" (*M1), "m" (*B1), "m" (*M0), "m" (Mask) ); @@ -205,7 +192,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, */ "movq %%mm3, %%mm7 \n\t" /* mm7 = B1 */ -#if defined(IS_SSE) +#if defined(IS_MMXEXT) "pavgb %%mm1, %%mm7 \n\t" #elif defined(IS_3DNOW) "pavgusb %%mm1, %%mm7 \n\t" @@ -224,93 +211,84 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, * which should make weave look better when there is small amounts of * movement */ -#if defined(IS_SSE) - "movq %%mm0, %%mm4 \n\t" - "movq %%mm2, %%mm5 \n\t" - "psubusb %%mm2, %%mm4 \n\t" - "psubusb %%mm0, %%mm5 \n\t" - "por %%mm5, %%mm4 \n\t" - "psrlw $1, %%mm4 \n\t" - "pavgb %%mm2, %%mm0 \n\t" - "pand %%mm6, %%mm4 \n\t" +#if defined(IS_MMXEXT) + "movq %%mm0, %%mm4 \n\t" + "movq %%mm2, %%mm5 \n\t" + "psubusb %%mm2, %%mm4 \n\t" + "psubusb %%mm0, %%mm5 \n\t" + "por %%mm5, %%mm4 \n\t" + "pavgb %%mm2, %%mm0 \n\t" #elif defined(IS_3DNOW) - "movq %%mm0, %%mm4 \n\t" - "movq %%mm2, %%mm5 \n\t" - "psubusb %%mm2, %%mm4 \n\t" - "psubusb %%mm0, %%mm5 \n\t" - "por %%mm5, %%mm4 \n\t" - "psrlw $1, %%mm4 \n\t" - "pavgusb %%mm2, %%mm0 \n\t" - "pand %%mm6, %%mm4 \n\t" + "movq %%mm0, %%mm4 \n\t" + "movq %%mm2, %%mm5 \n\t" + "psubusb %%mm2, %%mm4 \n\t" + "psubusb %%mm0, %%mm5 \n\t" + "por %%mm5, %%mm4 \n\t" + "pavgusb %%mm2, %%mm0 \n\t" #else - "movq %%mm0, %%mm4 \n\t" - "psubusb %%mm2, %%mm4 \n\t" - "psubusb %%mm0, %%mm2 \n\t" - "por %%mm2, %%mm4 \n\t" - "psrlw $1, %%mm4 \n\t" - "pand %%mm6, %%mm4 \n\t" + "movq %%mm0, %%mm4 \n\t" + "psubusb %%mm2, %%mm4 \n\t" + "psubusb %%mm0, %%mm2 \n\t" + "por %%mm2, %%mm4 \n\t" #endif - /* if |M1-M0| > Threshold we want dword worth of twos */ - "pcmpgtb %3, %%mm4 \n\t" - "pand %4, %%mm4 \n\t" /* get rid of sign bit */ - "pcmpgtd %5, %%mm4 \n\t" /* do we want to bob */ - "pandn %6, %%mm4 \n\t" - "movq %1, %%mm2 \n\t" /* mm2 = T0 */ - /* calculate |T1-T0| put result in mm5 */ - "movq %%mm2, %%mm5 \n\t" - "psubusb %%mm1, %%mm5 \n\t" - "psubusb %%mm2, %%mm1 \n\t" - "por %%mm1, %%mm5 \n\t" - "psrlw $1, %%mm5 \n\t" - "pand %%mm6, %%mm5 \n\t" - - /* if |T1-T0| > Threshold we want dword worth of ones */ - "pcmpgtb %3, %%mm5 \n\t" - "pand %%mm6, %%mm5 \n\t" /* get rid of sign bit */ + /* if |M1-M0| > Threshold we want 0 else dword minus one */ + "psrlw $1, %%mm4 \n\t" + "pand %%mm6, %%mm4 \n\t" + "pxor %%mm5, %%mm5 \n\t" // zero + "pcmpgtb %3, %%mm4 \n\t" + "pcmpeqd %%mm5, %%mm4 \n\t" /* do we want to bob */ - "pcmpgtd %5, %%mm5 \n\t" - "pandn %5, %%mm5 \n\t" - "paddd %%mm5, %%mm4 \n\t" + /* calculate |T1-T0| put result in mm5 */ + "movq %%mm2, %%mm5 \n\t" + "psubusb %%mm1, %%mm5 \n\t" + "psubusb %%mm2, %%mm1 \n\t" + "por %%mm1, %%mm5 \n\t" - "movq %2, %%mm2 \n\t" /* B0 */ + "movq %2, %%mm2 \n\t" /* mm2 = B0 */ - /* calculate |B1-B0| put result in mm5 */ - "movq %%mm2, %%mm5 \n\t" - "psubusb %%mm3, %%mm5 \n\t" - "psubusb %%mm2, %%mm3 \n\t" - "por %%mm3, %%mm5 \n\t" + /* if |T1-T0| > Threshold we want 0 else dword minus one */ "psrlw $1, %%mm5 \n\t" - "pand %%mm6, %%mm5 \n\t" + "pand %%mm6, %%mm5 \n\t" + "pxor %%mm1, %%mm1 \n\t" // zero + "pcmpgtb %3, %%mm5 \n\t" + "pcmpeqd %%mm1, %%mm5 \n\t" + + /* calculate |B1-B0| put result in mm1 */ + "movq %%mm2, %%mm1 \n\t" + "psubusb %%mm3, %%mm1 \n\t" + "psubusb %%mm2, %%mm3 \n\t" + "por %%mm3, %%mm1 \n\t" - /* if |B1-B0| > Threshold we want dword worth of ones */ - "pcmpgtb %3, %%mm5 \n\t" - "pand %%mm6, %%mm5 \n\t" /* get rid of any sign bit */ - "pcmpgtd %5, %%mm5 \n\t" - "pandn %5, %%mm5 \n\t" - "paddd %%mm5, %%mm4 \n\t" + /* if |B1-B0| > Threshold we want 0 else dword minus one */ + "psrlw $1, %%mm1 \n\t" + "pand %%mm6, %%mm1 \n\t" + "pxor %%mm3, %%mm3 \n\t" // zero + "pcmpgtb %3, %%mm1 \n\t" + "pcmpeqd %%mm3, %%mm1 \n\t" - "pcmpgtd %6, %%mm4 \n\t" + "por %%mm1, %%mm5 \n\t" + "pand %%mm5, %%mm4 \n\t" /* debugging feature * output the value of mm4 at this point which is pink where we will weave - * and green were we are going to bob */ + * and green where we are going to bob + */ #ifdef CHECK_BOBWEAVE -#ifdef IS_SSE +#ifdef IS_MMXEXT "movntq %%mm4, %0 \n\t" #else "movq %%mm4, %0 \n\t" #endif #else - "movq %%mm4, %%mm5 \n\t" - /* mm4 now is 1 where we want to weave and 0 where we want to bob */ - "pand %%mm0, %%mm4 \n\t" - "pandn %%mm7, %%mm5 \n\t" - "por %%mm5, %%mm4 \n\t" -#ifdef IS_SSE + /* mm4 now is 1 where we want to weave and 0 where we want to bob */ + "pand %%mm4, %%mm0 \n\t" + "pandn %%mm7, %%mm4 \n\t" + "por %%mm0, %%mm4 \n\t" +#ifdef IS_MMXEXT "movntq %%mm4, %0 \n\t" #else "movq %%mm4, %0 \n\t" @@ -318,7 +296,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, #endif : "=m" (*Dest2) - : "m" (*T0), "m" (*B0), "m" (qwGreedyTwoFrameThreshold), "m" (Mask), "m" (DwordOne), "m" (DwordTwo) ); + : "m" (*T0), "m" (*B0), "m" (GreedyTwoFrameThreshold) ); /* Advance to the next set of pixels. */ T1 += 8; @@ -341,7 +319,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, B0 += PitchRest; } -#ifdef IS_SSE +#ifdef IS_MMXEXT asm("sfence\n\t"); #endif diff --git a/src/post/deinterlace/plugins/greedy2frame_template_sse2.c b/src/post/deinterlace/plugins/greedy2frame_template_sse2.c new file mode 100644 index 000000000..379a78440 --- /dev/null +++ b/src/post/deinterlace/plugins/greedy2frame_template_sse2.c @@ -0,0 +1,293 @@ +/***************************************************************************** +** Copyright (c) 2000 John Adcock, Tom Barry, Steve Grimm All rights reserved. +** port copyright (c) 2003 Miguel Freitas +****************************************************************************** +** +** This file is subject to the terms of the GNU General Public License as +** published by the Free Software Foundation. A copy of this license is +** included with this software distribution in the file COPYING. If you +** do not have a copy, you may obtain a copy by writing to the Free +** Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +** +** This software 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 +****************************************************************************** +** CVS Log +** +** Revision 1.10 2006/12/21 09:54:45 dgp85 +** Apply the textrel patch from Gentoo, thanks to PaX team for providing it. The patch was applied and tested for a while in Gentoo and Pardus, and solves also Debian's problems with non-PIC code. If problems will arise, they'll be debugged. +** +** Revision 1.9 2006/02/04 14:06:29 miguelfreitas +** Enable AMD64 mmx/sse support in some plugins (tvtime, libmpeg2, goom...) +** patch by dani3l +** +** Revision 1.8 2005/06/05 16:00:06 miguelfreitas +** quite some hacks for gcc 2.95 compatibility +** +** Revision 1.7 2004/04/09 02:57:06 miguelfreitas +** tvtime deinterlacing algorithms assumed top_field_first=1 +** top_field_first=0 (aka bottom_field_first) should now work as expected +** +** Revision 1.6 2004/02/12 20:53:31 mroi +** my gcc (partly 3.4 already) optimizes these away, because they are only used +** inside inline assembler (which the compiler does not recognize); so actually +** the code is wrong (the asm parts should list these as inputs), but telling +** the compiler to keep them is the easier fix +** +** Revision 1.5 2004/01/05 12:15:55 siggi +** wonder why Mike isn't complaining about C++ style comments, any more... +** +** Revision 1.4 2004/01/05 01:47:26 tmmm +** DOS/Win CRs are forbidden, verboten, interdit +** +** Revision 1.3 2004/01/02 20:53:43 miguelfreitas +** better MANGLE from ffmpeg +** +** Revision 1.2 2004/01/02 20:47:03 miguelfreitas +** my small contribution to the cygwin port ;-) +** +** Revision 1.1 2003/06/22 17:30:03 miguelfreitas +** use our own port of greedy2frame (tvtime port is currently broken) +** +** Revision 1.8 2001/11/23 17:18:54 adcockj +** Fixed silly and/or confusion +** +** Revision 1.7 2001/11/22 22:27:00 adcockj +** Bug Fixes +** +** Revision 1.6 2001/11/21 15:21:40 adcockj +** Renamed DEINTERLACE_INFO to TDeinterlaceInfo in line with standards +** Changed TDeinterlaceInfo structure to have history of pictures. +** +** Revision 1.5 2001/07/31 06:48:33 adcockj +** Fixed index bug spotted by Peter Gubanov +** +** Revision 1.4 2001/07/13 16:13:33 adcockj +** Added CVS tags and removed tabs +** +*****************************************************************************/ + +/* + * This is the implementation of the Greedy 2-frame deinterlace algorithm + * described in DI_Greedy2Frame.c. It's in a separate file so we can compile + * variants for different CPU types; most of the code is the same in the + * different variants. + */ + + +/**************************************************************************** +** Field 1 | Field 2 | Field 3 | Field 4 | +** T0 | | T1 | | +** | M0 | | M1 | +** B0 | | B1 | | +*/ + +#if defined(ARCH_X86) || defined(ARCH_X86_64) +static const sse_t Mask128 = { uq: { 0x7f7f7f7f7f7f7f7fll, 0x7f7f7f7f7f7f7f7fll} }; +#define TP GREEDYTWOFRAMETHRESHOLD, GREEDYTWOFRAMETHRESHOLD2 +static const sse_t GreedyTwoFrameThreshold128 = { ub: {TP, TP, TP, TP, TP, TP, TP, TP} }; +#undef TP +#endif + +static void DeinterlaceGreedy2Frame_SSE2(uint8_t *output, int outstride, + deinterlace_frame_data_t *data, + int bottom_field, int second_field, + int width, int height ) +{ +#if defined(ARCH_X86) || defined(ARCH_X86_64) + int Line; + int stride = width * 2; + register uint8_t* M1; + register uint8_t* M0; + register uint8_t* T1; + register uint8_t* T0; + uint8_t* Dest = output; + register uint8_t* Dest2; + register uint8_t* Destc; + register int count; + uint32_t Pitch = stride * 2; + uint32_t LineLength = stride; + uint32_t PitchRest = Pitch - (LineLength >> 4)*16; + + if( second_field ) { + M1 = data->f0; + T1 = data->f0; + M0 = data->f1; + T0 = data->f1; + } else { + M1 = data->f0; + T1 = data->f1; + M0 = data->f1; + T0 = data->f2; + } + + if( bottom_field ) { + M1 += stride; + T1 += 0; + M0 += stride; + T0 += 0; + } else { + M1 += Pitch; + T1 += stride; + M0 += Pitch; + T0 += stride; + + xine_fast_memcpy(Dest, M1, LineLength); + Dest += outstride; + } + + for (Line = 0; Line < (height / 2) - 1; ++Line) + { + /* Always use the most recent data verbatim. By definition it's correct + * (it'd be shown on an interlaced display) and our job is to fill in + * the spaces between the new lines. + */ + /* xine_fast_memcpy would be pretty pointless here as we load the same + * data anyway it's just one additional mov per loop... + * XXX I believe some cpus with sse2 (early A64?) only have one write + * buffer. Using movntdq with 2 different streams may have quite + * bad performance consequences on such cpus. + */ + + Destc = Dest; + Dest += outstride; + Dest2 = Dest; + + /* just rely on gcc not using xmm regs... */ + do { + asm volatile( + "movdqa %0, %%xmm6 \n\t" // xmm6 = Mask + "pxor %%xmm7, %%xmm7 \n\t" // xmm7 = zero + : /* no output */ + : "m" (Mask128) ); + } while (0); + + count = LineLength >> 4; + do { + asm volatile( + /* Figure out what to do with the scanline above the one we copy. + * See above for a description of the algorithm. + * weave if (weave(M) AND (weave(T) OR weave(B))) + */ + "movdqa (%2), %%xmm1 \n\t" /* xmm1 = T1 */ + "movdqa (%3), %%xmm0 \n\t" /* xmm0 = T0 */ + "movdqa (%q4,%2), %%xmm3 \n\t" /* xmm3 = B1 */ + "movdqa (%q4,%3), %%xmm2 \n\t" /* xmm2 = B0 */ + + /* calculate |T1-T0| keep T1 put result in xmm5 */ + "movdqa %%xmm1, %%xmm5 \n\t" + "psubusb %%xmm0, %%xmm5 \n\t" + "psubusb %%xmm1, %%xmm0 \n\t" + "por %%xmm0, %%xmm5 \n\t" + + /* T1 is data for line to copy */ + "movntdq %%xmm1, %1 \n\t" + + /* if |T1-T0| > Threshold we want 0 else dword minus one */ + "psrlw $1, %%xmm5 \n\t" + "pand %%xmm6, %%xmm5 \n\t" + "pcmpgtb %0, %%xmm5 \n\t" + "pcmpeqd %%xmm7, %%xmm5 \n\t" + + "prefetcht0 64(%q4,%2) \n\t" + "prefetcht0 64(%q4,%3) \n\t" + : + : "m" (GreedyTwoFrameThreshold128), + "m" (*Destc), "r" (T1), "r" (T0), "r" (Pitch) ); + + asm volatile ( + /* calculate |B1-B0| keep B1 put result in xmm4 */ + "movdqa %%xmm3, %%xmm4 \n\t" + "psubusb %%xmm2, %%xmm4 \n\t" + "psubusb %%xmm3, %%xmm2 \n\t" + "por %%xmm2, %%xmm4 \n\t" + + "movdqa (%0), %%xmm0 \n\t" /* xmm0 = M1 */ + "movdqa (%1), %%xmm2 \n\t" /* xmm2 = M0 */ + + /* if |B1-B0| > Threshold we want 0 else dword minus one */ + "psrlw $1, %%xmm4 \n\t" + "pand %%xmm6, %%xmm4 \n\t" + "pcmpgtb %2, %%xmm4 \n\t" + "pcmpeqd %%xmm7, %%xmm4 \n\t" + + "por %%xmm4, %%xmm5 \n\t" + + /* Average T1 and B1 so we can do interpolated bobbing if we bob + * onto T1 */ + "pavgb %%xmm3, %%xmm1 \n\t" /* xmm1 = avg(T1,B1) */ + + "prefetcht0 64(%0) \n\t" + "prefetcht0 64(%1) \n\t" + + /* make mm0 the average of M1 and M0 which should make weave + * look better when there is small amounts of movement */ + "movdqa %%xmm2, %%xmm3 \n\t" + "pavgb %%xmm0, %%xmm3 \n\t" /* xmm3 = avg(M1,M0) */ + + /* calculate |M1-M0| put result in xmm4 */ + "movdqa %%xmm0, %%xmm4 \n\t" + "psubusb %%xmm2, %%xmm4 \n\t" + "psubusb %%xmm0, %%xmm2 \n\t" + "por %%xmm2, %%xmm4 \n\t" + + /* if |M1-M0| > Threshold we want 0 else dword minus one */ + "psrlw $1, %%xmm4 \n\t" + "pand %%xmm6, %%xmm4 \n\t" + "pcmpgtb %2, %%xmm4 \n\t" + "pcmpeqd %%xmm7, %%xmm4 \n\t" /* do we want to bob */ + + "pand %%xmm5, %%xmm4 \n\t" + +/* debugging feature + * output the value of xmm4 at this point which is pink where we will weave + * and green where we are going to bob + */ +#ifdef CHECK_BOBWEAVE + "movntdq %%xmm4, %3 \n\t" +#else + /* xmm4 now is 1 where we want to weave and 0 where we want to bob */ + "pand %%xmm4, %%xmm3 \n\t" + "pandn %%xmm1, %%xmm4 \n\t" + "por %%xmm3, %%xmm4 \n\t" + "movntdq %%xmm4, %3 \n\t" +#endif + : + : "r" (M1), "r" (M0), "m" (GreedyTwoFrameThreshold128), + "m" (*Dest2)); + + /* Advance to the next set of pixels. */ + T1 += 16; + M1 += 16; + M0 += 16; + T0 += 16; + Dest2 += 16; + Destc += 16; + + } while( --count ); + + Dest += outstride; + + M1 += PitchRest; + T1 += PitchRest; + M0 += PitchRest; + T0 += PitchRest; + } + + asm("sfence\n\t"); + + if( bottom_field ) + { + xine_fast_memcpy(Dest, T1, stride); + Dest += outstride; + xine_fast_memcpy(Dest, M1, stride); + } + else + { + xine_fast_memcpy(Dest, T1, stride); + } +#endif +} + diff --git a/src/post/deinterlace/plugins/greedyh.asm b/src/post/deinterlace/plugins/greedyh.asm index 11b28ca76..c96bfbf2c 100644 --- a/src/post/deinterlace/plugins/greedyh.asm +++ b/src/post/deinterlace/plugins/greedyh.asm @@ -17,7 +17,6 @@ ///////////////////////////////////////////////////////////////////////////// #include "x86-64_macros.inc" -#include <mangle.h> #if !defined(MASKS_DEFINED) #define MASKS_DEFINED diff --git a/src/post/deinterlace/plugins/kdetv_greedyh.c b/src/post/deinterlace/plugins/kdetv_greedyh.c index 5ec48e4a2..2207772ca 100644 --- a/src/post/deinterlace/plugins/kdetv_greedyh.c +++ b/src/post/deinterlace/plugins/kdetv_greedyh.c @@ -31,8 +31,8 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> #include "deinterlace.h" #include "speedtools.h" #include "speedy.h" diff --git a/src/post/deinterlace/plugins/kdetv_tomsmocomp.c b/src/post/deinterlace/plugins/kdetv_tomsmocomp.c index ae0fa0363..0f87b913f 100644 --- a/src/post/deinterlace/plugins/kdetv_tomsmocomp.c +++ b/src/post/deinterlace/plugins/kdetv_tomsmocomp.c @@ -31,8 +31,8 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> #include "deinterlace.h" #include "speedtools.h" #include "speedy.h" diff --git a/src/post/deinterlace/plugins/linearblend.c b/src/post/deinterlace/plugins/linearblend.c index c594f41dd..fe230685b 100644 --- a/src/post/deinterlace/plugins/linearblend.c +++ b/src/post/deinterlace/plugins/linearblend.c @@ -31,8 +31,9 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> +#include "xine_mmx.h" #include "speedtools.h" #include "speedy.h" #include "deinterlace.h" diff --git a/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc b/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc index a3b139691..d3ee46a20 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc @@ -21,8 +21,6 @@ // See www.eff.org for details ///////////////////////////////////////////////////////////////////////////// -#include <mangle.h> - #if !defined(MASKS_DEFINED) #define MASKS_DEFINED static const int64_t __attribute__((__used__)) Max_Mov = 0x0404040404040404ull; diff --git a/src/post/deinterlace/plugins/vfir.c b/src/post/deinterlace/plugins/vfir.c index e66d7c789..89ea1d0e5 100644 --- a/src/post/deinterlace/plugins/vfir.c +++ b/src/post/deinterlace/plugins/vfir.c @@ -34,8 +34,9 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> +#include "xine_mmx.h" #include "speedy.h" #include "deinterlace.h" #include "plugins.h" diff --git a/src/post/deinterlace/speedy.c b/src/post/deinterlace/speedy.c index 32c8b03e3..4c9d5c0d1 100644 --- a/src/post/deinterlace/speedy.c +++ b/src/post/deinterlace/speedy.c @@ -62,8 +62,9 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> +#include "xine_mmx.h" #include "speedtools.h" #include "speedy.h" @@ -343,6 +344,89 @@ static unsigned int diff_factor_packed422_scanline_mmx( uint8_t *cur, uint8_t *o } #endif +#if defined(ARCH_X86) || defined(ARCH_X86_64) + +static const sse_t dqwYMask = { uq: { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL }}; +static const sse_t dqwCMask = { uq: { 0xff00ff00ff00ff00ULL, 0xff00ff00ff00ff00ULL }}; + +static unsigned int diff_factor_packed422_scanline_sse2_aligned( uint8_t *cur, uint8_t *old, int width ) +{ + register unsigned int temp; + + width /= 8; + + movdqa_m2r( dqwYMask, xmm1 ); + movd_m2r( BitShift, xmm7 ); + pxor_r2r( xmm0, xmm0 ); + + while( width-- ) { + movdqa_m2r( *cur, xmm4 ); + movdqa_m2r( *old, xmm5 ); + + pand_r2r( xmm1, xmm4 ); + pand_r2r( xmm1, xmm5 ); + + psubw_r2r( xmm5, xmm4 ); /* mm4 = Y1 - Y2 */ + pmaddwd_r2r( xmm4, xmm4 ); /* mm4 = (Y1 - Y2)^2 */ + psrld_r2r( xmm7, xmm4 ); /* divide mm4 by 2^BitShift */ + paddd_r2r( xmm4, xmm0 ); /* keep total in mm0 */ + + cur += 16; + old += 16; + } + + pshufd_r2r(xmm0, xmm1, 0x0e); + paddd_r2r(xmm1, xmm0); + pshufd_r2r(xmm0, xmm1, 0x01); + paddd_r2r(xmm1, xmm0); + + movd_r2a(xmm0, temp); + return temp; +} +#endif + +#if defined(ARCH_X86) || defined(ARCH_X86_64) +static unsigned int diff_factor_packed422_scanline_sse2( uint8_t *cur, uint8_t *old, int width ) +{ + if (0 == (((unsigned int)cur|(unsigned int)old) & 15)) { + return diff_factor_packed422_scanline_sse2_aligned(cur, old, width); + } + + register unsigned int temp; + + width /= 8; + + movdqa_m2r( dqwYMask, xmm1 ); + movd_m2r( BitShift, xmm7 ); + pxor_r2r( xmm0, xmm0 ); + + while( width-- ) { + movdqu_m2r( *cur, xmm4 ); + movdqu_m2r( *old, xmm5 ); + + pand_r2r( xmm1, xmm4 ); + pand_r2r( xmm1, xmm5 ); + + psubw_r2r( xmm5, xmm4 ); /* mm4 = Y1 - Y2 */ + pmaddwd_r2r( xmm4, xmm4 ); /* mm4 = (Y1 - Y2)^2 */ + psrld_r2r( xmm7, xmm4 ); /* divide mm4 by 2^BitShift */ + paddd_r2r( xmm4, xmm0 ); /* keep total in mm0 */ + + cur += 16; + old += 16; + } + + pshufd_r2r(xmm0, xmm1, 0x0e); + paddd_r2r(xmm1, xmm0); + pshufd_r2r(xmm0, xmm1, 0x01); + paddd_r2r(xmm1, xmm0); + + movd_r2a(xmm0, temp); + + return temp; +} +#endif + #define ABS(a) (((a) < 0)?-(a):(a)) #if defined(ARCH_X86) || defined(ARCH_X86_64) @@ -716,6 +800,130 @@ static void vfilter_chroma_332_packed422_scanline_mmx( uint8_t *output, int widt } #endif +#if defined(ARCH_X86) || defined(ARCH_X86_64) +static void vfilter_chroma_332_packed422_scanline_sse2_aligned( uint8_t *output, int width, + uint8_t *m, uint8_t *t, uint8_t *b ) +{ + int i; + + // Get width in bytes. + width *= 2; + i = width / 16; + width -= i * 16; + + movdqa_m2r( dqwYMask, xmm7 ); + movdqa_m2r( dqwCMask, xmm6 ); + + while( i-- ) { + movdqa_m2r ( *t, xmm0 ); + movdqa_m2r ( *b, xmm1 ); + movdqa_m2r ( *m, xmm2 ); + + movdqa_r2r ( xmm2, xmm3 ); + pand_r2r ( xmm7, xmm3 ); + + pand_r2r ( xmm6, xmm0 ); + pand_r2r ( xmm6, xmm1 ); + pand_r2r ( xmm6, xmm2 ); + + psrlq_i2r ( 8, xmm0 ); + psrlq_i2r ( 7, xmm1 ); + psrlq_i2r ( 8, xmm2 ); + + movdqa_r2r ( xmm0, xmm4 ); + movdqa_r2r ( xmm2, xmm5 ); + psllw_i2r ( 1, xmm4 ); + psllw_i2r ( 1, xmm5 ); + paddw_r2r ( xmm4, xmm0 ); + paddw_r2r ( xmm5, xmm2 ); + + paddw_r2r ( xmm0, xmm2 ); + paddw_r2r ( xmm1, xmm2 ); + + psllw_i2r ( 5, xmm2 ); + pand_r2r ( xmm6, xmm2 ); + + por_r2r ( xmm3, xmm2 ); + + movdqa_r2m( xmm2, *output ); + output += 16; + t += 16; + b += 16; + m += 16; + } + output++; t++; b++; m++; + while( width-- ) { + *output = (3 * *t + 3 * *m + 2 * *b) >> 3; + output +=2; t+=2; b+=2; m+=2; + } +} +#endif + +#if defined(ARCH_X86) || defined(ARCH_X86_64) +static void vfilter_chroma_332_packed422_scanline_sse2( uint8_t *output, int width, + uint8_t *m, uint8_t *t, uint8_t *b ) +{ + int i; + + if (0 == (((unsigned int)output|(unsigned int)m|(unsigned int)t|(unsigned int)b) & 15)) { + vfilter_chroma_332_packed422_scanline_sse2_aligned(output, width, m, t, b); + return; + } + + // Get width in bytes. + width *= 2; + i = width / 16; + width -= i * 16; + + movdqa_m2r( dqwYMask, xmm7 ); + movdqa_m2r( dqwCMask, xmm6 ); + + while( i-- ) { + movdqu_m2r ( *t, xmm0 ); + movdqu_m2r ( *b, xmm1 ); + movdqu_m2r ( *m, xmm2 ); + + movdqa_r2r ( xmm2, xmm3 ); + pand_r2r ( xmm7, xmm3 ); + + pand_r2r ( xmm6, xmm0 ); + pand_r2r ( xmm6, xmm1 ); + pand_r2r ( xmm6, xmm2 ); + + psrlq_i2r ( 8, xmm0 ); + psrlq_i2r ( 7, xmm1 ); + psrlq_i2r ( 8, xmm2 ); + + movdqa_r2r ( xmm0, xmm4 ); + movdqa_r2r ( xmm2, xmm5 ); + psllw_i2r ( 1, xmm4 ); + psllw_i2r ( 1, xmm5 ); + paddw_r2r ( xmm4, xmm0 ); + paddw_r2r ( xmm5, xmm2 ); + + paddw_r2r ( xmm0, xmm2 ); + paddw_r2r ( xmm1, xmm2 ); + + psllw_i2r ( 5, xmm2 ); + pand_r2r ( xmm6, xmm2 ); + + por_r2r ( xmm3, xmm2 ); + + movdqu_r2m( xmm2, *output ); + output += 16; + t += 16; + b += 16; + m += 16; + } + output++; t++; b++; m++; + while( width-- ) { + *output = (3 * *t + 3 * *m + 2 * *b) >> 3; + output +=2; t+=2; b+=2; m+=2; + } +} +#endif + + static void vfilter_chroma_332_packed422_scanline_c( uint8_t *output, int width, uint8_t *m, uint8_t *t, uint8_t *b ) { @@ -2458,6 +2666,14 @@ void setup_speedy_calls( uint32_t accel, int verbose ) printf( "speedycode: No MMX or MMXEXT support detected, using C fallbacks.\n" ); } } + + if( speedy_accel & MM_ACCEL_X86_SSE2 ) { + if( verbose ) { + printf( "speedycode: Using SSE2 optimized functions.\n" ); + } + diff_factor_packed422_scanline = diff_factor_packed422_scanline_sse2; + vfilter_chroma_332_packed422_scanline = vfilter_chroma_332_packed422_scanline_sse2; + } #endif } diff --git a/src/post/deinterlace/xine_plugin.c b/src/post/deinterlace/xine_plugin.c index c9d451b4f..3cce42400 100644 --- a/src/post/deinterlace/xine_plugin.c +++ b/src/post/deinterlace/xine_plugin.c @@ -31,10 +31,10 @@ #define LOG */ -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" -#include "xine_buffer.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> +#include <xine/xine_buffer.h> #include <pthread.h> #include "tvtime.h" @@ -51,7 +51,7 @@ static const post_info_t deinterlace_special_info = { XINE_POST_TYPE_VIDEO_FILTE const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 9, "tvtime", XINE_VERSION_CODE, &deinterlace_special_info, &deinterlace_init_plugin }, + { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 10, "tvtime", XINE_VERSION_CODE, &deinterlace_special_info, &deinterlace_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -60,8 +60,8 @@ typedef struct post_plugin_deinterlace_s post_plugin_deinterlace_t; #define MAX_NUM_METHODS 30 static const char *enum_methods[MAX_NUM_METHODS]; -static char *enum_pulldown[] = { "none", "vektor", NULL }; -static char *enum_framerate[] = { "full", "half_top", "half_bottom", NULL }; +static const char *const enum_pulldown[] = { "none", "vektor", NULL }; +static const char *const enum_framerate[] = { "full", "half_top", "half_bottom", NULL }; static void *help_string; @@ -280,8 +280,6 @@ static xine_post_api_t post_api = { static post_plugin_t *deinterlace_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static char *deinterlace_get_identifier(post_class_t *class_gen); -static char *deinterlace_get_description(post_class_t *class_gen); static void deinterlace_class_dispose(post_class_t *class_gen); /* plugin instance functions */ @@ -311,8 +309,8 @@ static void *deinterlace_init_plugin(xine_t *xine, void *data) return NULL; class->class.open_plugin = deinterlace_open_plugin; - class->class.get_identifier = deinterlace_get_identifier; - class->class.get_description = deinterlace_get_description; + class->class.identifier = "tvtime"; + class->class.description = N_("advanced deinterlacer plugin with pulldown detection"); class->class.dispose = deinterlace_class_dispose; @@ -425,16 +423,6 @@ static post_plugin_t *deinterlace_open_plugin(post_class_t *class_gen, int input return &this->post; } -static char *deinterlace_get_identifier(post_class_t *class_gen) -{ - return "tvtime"; -} - -static char *deinterlace_get_description(post_class_t *class_gen) -{ - return "advanced deinterlacer plugin with pulldown detection"; -} - static void deinterlace_class_dispose(post_class_t *class_gen) { xine_buffer_free(help_string); diff --git a/src/post/goom/Makefile.am b/src/post/goom/Makefile.am index 386c0b351..8453213e3 100644 --- a/src/post/goom/Makefile.am +++ b/src/post/goom/Makefile.am @@ -1,37 +1,17 @@ +include $(top_srcdir)/misc/Makefile.quiet include $(top_builddir)/misc/Makefile.plugins include $(top_srcdir)/misc/Makefile.common -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'` - -# Avoid errors with -O0 -xineplug_post_goom_la-xmmx.o xineplug_post_goom_la-xmmx.lo: CFLAGS=`echo @CFLAGS@ | sed -e 's/-O0\?\s/-Os /g'` - -xinepost_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) $(LTLIBINTL) -lm -xineplug_post_goom_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_post_goom_la_LDFLAGS = $(xineplug_ldflags) +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 \ @@ -39,3 +19,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/gfontlib.c b/src/post/goom/gfontlib.c index f538aad34..f538aad34 100644..100755 --- a/src/post/goom/gfontlib.c +++ b/src/post/goom/gfontlib.c diff --git a/src/post/goom/gfontlib.h b/src/post/goom/gfontlib.h index 0520b7da9..0520b7da9 100644..100755 --- a/src/post/goom/gfontlib.h +++ b/src/post/goom/gfontlib.h diff --git a/src/post/goom/gfontrle.c b/src/post/goom/gfontrle.c index a22545a1e..a22545a1e 100644..100755 --- a/src/post/goom/gfontrle.c +++ b/src/post/goom/gfontrle.c diff --git a/src/post/goom/goom_core.c b/src/post/goom/goom_core.c index 62d9a27b6..7d40c0f86 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 */ diff --git a/src/post/goom/mathtools.h b/src/post/goom/mathtools.h index 165fc66b0..165fc66b0 100644..100755 --- a/src/post/goom/mathtools.h +++ b/src/post/goom/mathtools.h diff --git a/src/post/goom/mmx.h b/src/post/goom/mmx.h index b650d8b12..6861b7cfe 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/surf3d.c b/src/post/goom/surf3d.c index ba8c69094..ba8c69094 100644..100755 --- a/src/post/goom/surf3d.c +++ b/src/post/goom/surf3d.c diff --git a/src/post/goom/surf3d.h b/src/post/goom/surf3d.h index 482b6a090..482b6a090 100644..100755 --- a/src/post/goom/surf3d.h +++ b/src/post/goom/surf3d.h diff --git a/src/post/goom/tentacle3d.c b/src/post/goom/tentacle3d.c index e1e2157e7..e1e2157e7 100644..100755 --- a/src/post/goom/tentacle3d.c +++ b/src/post/goom/tentacle3d.c diff --git a/src/post/goom/tentacle3d.h b/src/post/goom/tentacle3d.h index ad0858fad..ad0858fad 100644..100755 --- a/src/post/goom/tentacle3d.h +++ b/src/post/goom/tentacle3d.h diff --git a/src/post/goom/v3d.h b/src/post/goom/v3d.h index 7690847f2..7690847f2 100644..100755 --- a/src/post/goom/v3d.h +++ b/src/post/goom/v3d.h diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c index 72692ffe1..7cf1a9325 100644 --- a/src/post/goom/xine_goom.c +++ b/src/post/goom/xine_goom.c @@ -35,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" @@ -116,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 } }; @@ -125,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 */ @@ -194,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; @@ -307,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; diff --git a/src/post/mosaico/Makefile.am b/src/post/mosaico/Makefile.am index 83f2b8f2a..cbe5faa9c 100644 --- a/src/post/mosaico/Makefile.am +++ b/src/post/mosaico/Makefile.am @@ -1,14 +1,14 @@ +include $(top_srcdir)/misc/Makefile.quiet include $(top_builddir)/misc/Makefile.plugins include $(top_srcdir)/misc/Makefile.common +AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) +AM_LDFLAGS = $(xineplug_ldflags) + xinepost_LTLIBRARIES = xineplug_post_mosaico.la xineplug_post_switch.la xineplug_post_mosaico_la_SOURCES = mosaico.c xineplug_post_mosaico_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_post_mosaico_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_post_mosaico_la_LDFLAGS = $(xineplug_ldflags) xineplug_post_switch_la_SOURCES = switch.c xineplug_post_switch_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_post_switch_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_post_switch_la_LDFLAGS = $(xineplug_ldflags) diff --git a/src/post/mosaico/mosaico.c b/src/post/mosaico/mosaico.c index 9a9a9911c..79272e8db 100644 --- a/src/post/mosaico/mosaico.c +++ b/src/post/mosaico/mosaico.c @@ -32,8 +32,8 @@ #define LOG */ -#include "xine_internal.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/post.h> /* FIXME: This plugin needs to handle overlays as well. */ @@ -45,7 +45,7 @@ static const post_info_t mosaico_special_info = { XINE_POST_TYPE_VIDEO_COMPOSE } const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "mosaico", XINE_VERSION_CODE, &mosaico_special_info, &mosaico_init_plugin }, + { PLUGIN_POST, 10, "mosaico", XINE_VERSION_CODE, &mosaico_special_info, &mosaico_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -100,9 +100,6 @@ struct post_mosaico_s { static post_plugin_t *mosaico_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static char *mosaico_get_identifier(post_class_t *class_gen); -static char *mosaico_get_description(post_class_t *class_gen); -static void mosaico_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void mosaico_dispose(post_plugin_t *this_gen); @@ -132,9 +129,9 @@ static void *mosaico_init_plugin(xine_t *xine, void *data) return NULL; this->class.open_plugin = mosaico_open_plugin; - this->class.get_identifier = mosaico_get_identifier; - this->class.get_description = mosaico_get_description; - this->class.dispose = mosaico_class_dispose; + this->class.identifier = "mosaico"; + this->class.description = N_("Mosaico is a picture in picture (pip) post plugin"); + this->class.dispose = default_post_class_dispose; this->xine = xine; return &this->class; @@ -205,22 +202,6 @@ static post_plugin_t *mosaico_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *mosaico_get_identifier(post_class_t *class_gen) -{ - return "mosaico"; -} - -static char *mosaico_get_description(post_class_t *class_gen) -{ - return "Mosaico is a picture in picture (pip) post plugin"; -} - -static void mosaico_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void mosaico_dispose(post_plugin_t *this_gen) { post_mosaico_t *this = (post_mosaico_t *)this_gen; diff --git a/src/post/mosaico/switch.c b/src/post/mosaico/switch.c index 7cba7c998..1bc9058ae 100644 --- a/src/post/mosaico/switch.c +++ b/src/post/mosaico/switch.c @@ -28,8 +28,8 @@ #define LOG */ -#include "xine_internal.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/post.h> /* FIXME: This plugin needs to handle overlays as well. */ @@ -41,7 +41,7 @@ static const post_info_t switch_special_info = { XINE_POST_TYPE_VIDEO_COMPOSE }; const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "switch", XINE_VERSION_CODE, &switch_special_info, &switch_init_plugin }, + { PLUGIN_POST, 10, "switch", XINE_VERSION_CODE, &switch_special_info, &switch_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -82,9 +82,6 @@ struct post_switch_s { static post_plugin_t *switch_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static char *switch_get_identifier(post_class_t *class_gen); -static char *switch_get_description(post_class_t *class_gen); -static void switch_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void switch_dispose(post_plugin_t *this_gen); @@ -107,9 +104,9 @@ static void *switch_init_plugin(xine_t *xine, void *data) return NULL; this->class.open_plugin = switch_open_plugin; - this->class.get_identifier = switch_get_identifier; - this->class.get_description = switch_get_description; - this->class.dispose = switch_class_dispose; + this->class.identifier = "switch"; + this->class.description = N_("Switch is a post plugin able to switch at any time between different streams"); + this->class.dispose = default_post_class_dispose; this->xine = xine; return &this->class; @@ -168,22 +165,6 @@ static post_plugin_t *switch_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *switch_get_identifier(post_class_t *class_gen) -{ - return "switch"; -} - -static char *switch_get_description(post_class_t *class_gen) -{ - return "Switch is a post plugin able to switch at any time between different streams"; -} - -static void switch_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void switch_dispose(post_plugin_t *this_gen) { post_switch_t *this = (post_switch_t *)this_gen; diff --git a/src/post/planar/Makefile.am b/src/post/planar/Makefile.am index 319152cba..d5d122ce3 100644 --- a/src/post/planar/Makefile.am +++ b/src/post/planar/Makefile.am @@ -1,35 +1,20 @@ +include $(top_srcdir)/misc/Makefile.quiet include $(top_builddir)/misc/Makefile.plugins include $(top_srcdir)/misc/Makefile.common -POSTPROC_INT_LIB = $(top_builddir)/src/libffmpeg/libavcodec/libpostproc/libpostprocess.la +AM_CFLAGS = $(VISIBILITY_FLAG) +AM_CPPFLAGS = +AM_LDFLAGS = -if HAVE_FFMPEG -postproc_lib = $(FFMPEG_POSTPROC_LIBS) -ff_cflags = $(FFMPEG_CFLAGS) $(FFMPEG_POSTPROC_CFLAGS) -else -ff_cflags = -I$(top_srcdir)/src/libffmpeg/libavcodec -postproc_lib = $(POSTPROC_INT_LIB) -postproc_dep = $(postproc_lib) -endif - -# -fomit-frame-pointer is always needed. it might cause debug to not -# work, but at least it compiles. -AM_CFLAGS = $(ff_cflags) -fomit-frame-pointer - -# Avoid errors with -O0 -xineplug_post_planar_la-eq.o xineplug_post_planar_la-eq.lo: CFLAGS=`echo @CFLAGS@ | sed -e 's/-O0\?\s/-Os /g'` -xineplug_post_planar_la-eq2.o xineplug_post_planar_la-eq2.lo: CFLAGS=`echo @CFLAGS@ | sed -e 's/-O0\?\s/-Os /g'` -xineplug_post_planar_la-noise.o xineplug_post_planar_la-noise.lo: CFLAGS=`echo @CFLAGS@ | sed -e 's/-O0\?\s/-Os /g'` +noinst_LTLIBRARIES = libpost_planar_asm.la +libpost_planar_asm_la_SOURCES = eq.c eq2.c noise.c +libpost_planar_asm_la_CFLAGS = $(O1_CFLAGS) -fomit-frame-pointer $(AM_CFLAGS) $(AVUTIL_CFLAGS) +libpost_planar_asm_la_LIBADD = $(AVUTIL_LIBS) xinepost_LTLIBRARIES = xineplug_post_planar.la - xineplug_post_planar_la_SOURCES = planar.c invert.c expand.c fill.c boxblur.c \ - denoise3d.c eq.c eq2.c unsharp.c pp.c noise.c -xineplug_post_planar_la_DEPENDENCIES = $(postproc_dep) -xineplug_post_planar_la_LIBADD = $(XINE_LIB) $(postproc_lib) -lm $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_post_planar_la_LDFLAGS = $(xineplug_ldflags) \ - @IMPURE_TEXT_LDFLAGS@ -xineplug_post_planar_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) - -$(POSTPROC_INT_LIB): - cd $(top_builddir)/src/libffmpeg/libavcodec/libpostproc && $(MAKE) libpostprocess.la + denoise3d.c unsharp.c pp.c +xineplug_post_planar_la_LIBADD = $(XINE_LIB) $(FFMPEG_POSTPROC_LIBS) -lm $(PTHREAD_LIBS) $(LTLIBINTL) $(noinst_LTLIBRARIES) +xineplug_post_planar_la_DEPS = $(FFMPEG_POSTPROC_DEPS) +xineplug_post_planar_la_CFLAGS = $(DEFAULT_OCFLAGS) $(AM_CFLAGS) $(FFMPEG_CFLAGS) $(FFMPEG_POSTPROC_CFLAGS) +xineplug_post_planar_la_LDFLAGS = $(AM_LDFLAGS) $(xineplug_ldflags) $(IMPURE_TEXT_LDFLAGS) diff --git a/src/post/planar/boxblur.c b/src/post/planar/boxblur.c index ceeba3b40..ea3085ffd 100644 --- a/src/post/planar/boxblur.c +++ b/src/post/planar/boxblur.c @@ -25,9 +25,9 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #include <pthread.h> /* plugin class initialization function */ @@ -124,9 +124,6 @@ static xine_post_api_t post_api = { static post_plugin_t *boxblur_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static char *boxblur_get_identifier(post_class_t *class_gen); -static char *boxblur_get_description(post_class_t *class_gen); -static void boxblur_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void boxblur_dispose(post_plugin_t *this_gen); @@ -140,15 +137,15 @@ static int boxblur_draw(vo_frame_t *frame, xine_stream_t *stream); void *boxblur_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; class->open_plugin = boxblur_open_plugin; - class->get_identifier = boxblur_get_identifier; - class->get_description = boxblur_get_description; - class->dispose = boxblur_class_dispose; + class->identifier = "boxblur"; + class->description = N_("box blur filter from mplayer"); + class->dispose = default_post_class_dispose; return class; } @@ -198,22 +195,6 @@ static post_plugin_t *boxblur_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *boxblur_get_identifier(post_class_t *class_gen) -{ - return "boxblur"; -} - -static char *boxblur_get_description(post_class_t *class_gen) -{ - return "box blur filter from mplayer"; -} - -static void boxblur_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void boxblur_dispose(post_plugin_t *this_gen) { post_plugin_boxblur_t *this = (post_plugin_boxblur_t *)this_gen; diff --git a/src/post/planar/denoise3d.c b/src/post/planar/denoise3d.c index 2073151b4..793a377c7 100644 --- a/src/post/planar/denoise3d.c +++ b/src/post/planar/denoise3d.c @@ -25,9 +25,9 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #include <math.h> #include <pthread.h> @@ -161,9 +161,6 @@ static xine_post_api_t post_api = { static post_plugin_t *denoise3d_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static char *denoise3d_get_identifier(post_class_t *class_gen); -static char *denoise3d_get_description(post_class_t *class_gen); -static void denoise3d_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void denoise3d_dispose(post_plugin_t *this_gen); @@ -180,15 +177,15 @@ static int denoise3d_draw(vo_frame_t *frame, xine_stream_t *stream); void *denoise3d_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; class->open_plugin = denoise3d_open_plugin; - class->get_identifier = denoise3d_get_identifier; - class->get_description = denoise3d_get_description; - class->dispose = denoise3d_class_dispose; + class->identifier = "denoise3d"; + class->description = N_("3D Denoiser (variable lowpass filter)"); + class->dispose = default_post_class_dispose; return class; } @@ -241,22 +238,6 @@ static post_plugin_t *denoise3d_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *denoise3d_get_identifier(post_class_t *class_gen) -{ - return "denoise3d"; -} - -static char *denoise3d_get_description(post_class_t *class_gen) -{ - return "3D Denoiser (variable lowpass filter)"; -} - -static void denoise3d_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void denoise3d_dispose(post_plugin_t *this_gen) { post_plugin_denoise3d_t *this = (post_plugin_denoise3d_t *)this_gen; diff --git a/src/post/planar/eq.c b/src/post/planar/eq.c index 73607b8a1..dcf9b47fb 100644 --- a/src/post/planar/eq.c +++ b/src/post/planar/eq.c @@ -25,9 +25,9 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #include <pthread.h> @@ -212,9 +212,6 @@ static xine_post_api_t post_api = { static post_plugin_t *eq_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static char *eq_get_identifier(post_class_t *class_gen); -static char *eq_get_description(post_class_t *class_gen); -static void eq_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void eq_dispose(post_plugin_t *this_gen); @@ -232,15 +229,15 @@ static int eq_draw(vo_frame_t *frame, xine_stream_t *stream); void *eq_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; class->open_plugin = eq_open_plugin; - class->get_identifier = eq_get_identifier; - class->get_description = eq_get_description; - class->dispose = eq_class_dispose; + class->identifier = "eq"; + class->description = N_("soft video equalizer"); + class->dispose = default_post_class_dispose; return class; } @@ -296,22 +293,6 @@ static post_plugin_t *eq_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *eq_get_identifier(post_class_t *class_gen) -{ - return "eq"; -} - -static char *eq_get_description(post_class_t *class_gen) -{ - return "soft video equalizer"; -} - -static void eq_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void eq_dispose(post_plugin_t *this_gen) { post_plugin_eq_t *this = (post_plugin_eq_t *)this_gen; diff --git a/src/post/planar/eq2.c b/src/post/planar/eq2.c index 542ea7bad..a3e1acac1 100644 --- a/src/post/planar/eq2.c +++ b/src/post/planar/eq2.c @@ -29,9 +29,9 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #include <math.h> #include <pthread.h> @@ -393,9 +393,6 @@ static xine_post_api_t post_api = { static post_plugin_t *eq2_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static char *eq2_get_identifier(post_class_t *class_gen); -static char *eq2_get_description(post_class_t *class_gen); -static void eq2_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void eq2_dispose(post_plugin_t *this_gen); @@ -413,15 +410,15 @@ static int eq2_draw(vo_frame_t *frame, xine_stream_t *stream); void *eq2_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; class->open_plugin = eq2_open_plugin; - class->get_identifier = eq2_get_identifier; - class->get_description = eq2_get_description; - class->dispose = eq2_class_dispose; + class->identifier = "eq2"; + class->description = N_("Software video equalizer"); + class->dispose = default_post_class_dispose; return class; } @@ -480,22 +477,6 @@ static post_plugin_t *eq2_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *eq2_get_identifier(post_class_t *class_gen) -{ - return "eq2"; -} - -static char *eq2_get_description(post_class_t *class_gen) -{ - return "Software video equalizer"; -} - -static void eq2_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void eq2_dispose(post_plugin_t *this_gen) { post_plugin_eq2_t *this = (post_plugin_eq2_t *)this_gen; diff --git a/src/post/planar/expand.c b/src/post/planar/expand.c index cc189118f..513def84f 100644 --- a/src/post/planar/expand.c +++ b/src/post/planar/expand.c @@ -27,8 +27,8 @@ * */ -#include "xine_internal.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/post.h> /* The expand trick explained: * @@ -100,9 +100,6 @@ typedef struct post_expand_s { static post_plugin_t *expand_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static char *expand_get_identifier(post_class_t *class_gen); -static char *expand_get_description(post_class_t *class_gen); -static void expand_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void expand_dispose(post_plugin_t *this_gen); @@ -130,15 +127,15 @@ static int32_t expand_overlay_add_event(video_overlay_manager_t *this_gen void *expand_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; class->open_plugin = expand_open_plugin; - class->get_identifier = expand_get_identifier; - class->get_description = expand_get_description; - class->dispose = expand_class_dispose; + class->identifier = "expand"; + class->description = N_("add black borders to top and bottom of video to expand it to 4:3 aspect ratio"); + class->dispose = default_post_class_dispose; return class; } @@ -191,22 +188,6 @@ static post_plugin_t *expand_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *expand_get_identifier(post_class_t *class_gen) -{ - return "expand"; -} - -static char *expand_get_description(post_class_t *class_gen) -{ - return "add black borders to top and bottom of video to expand it to 4:3 aspect ratio"; -} - -static void expand_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void expand_dispose(post_plugin_t *this_gen) { post_expand_t *this = (post_expand_t *)this_gen; diff --git a/src/post/planar/fill.c b/src/post/planar/fill.c index dd8b83c82..c79033a72 100644 --- a/src/post/planar/fill.c +++ b/src/post/planar/fill.c @@ -22,8 +22,8 @@ * based on invert.c */ -#include "xine_internal.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/post.h> /* plugin class initialization function */ void *fill_init_plugin(xine_t *xine, void *); @@ -32,9 +32,6 @@ void *fill_init_plugin(xine_t *xine, void *); static post_plugin_t *fill_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static char *fill_get_identifier(post_class_t *class_gen); -static char *fill_get_description(post_class_t *class_gen); -static void fill_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void fill_dispose(post_plugin_t *this_gen); @@ -48,15 +45,15 @@ static int fill_draw(vo_frame_t *frame, xine_stream_t *stream); void *fill_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; class->open_plugin = fill_open_plugin; - class->get_identifier = fill_get_identifier; - class->get_description = fill_get_description; - class->dispose = fill_class_dispose; + class->identifier = "fill"; + class->description = N_("crops left and right of video to fill 4:3 aspect ratio"); + class->dispose = default_post_class_dispose; return class; } @@ -92,21 +89,6 @@ static post_plugin_t *fill_open_plugin(post_class_t *class_gen, int inputs, return this; } -static char *fill_get_identifier(post_class_t *class_gen) -{ - return "fill"; -} - -static char *fill_get_description(post_class_t *class_gen) -{ - return "crops left and right of video to fill 4:3 aspect ratio"; -} - -static void fill_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - static void fill_dispose(post_plugin_t *this) { if (_x_post_dispose(this)) diff --git a/src/post/planar/invert.c b/src/post/planar/invert.c index 820221cf5..462b8fa7b 100644 --- a/src/post/planar/invert.c +++ b/src/post/planar/invert.c @@ -22,8 +22,8 @@ * simple video inverter plugin */ -#include "xine_internal.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/post.h> /* plugin class initialization function */ @@ -33,9 +33,6 @@ void *invert_init_plugin(xine_t *xine, void *); static post_plugin_t *invert_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static char *invert_get_identifier(post_class_t *class_gen); -static char *invert_get_description(post_class_t *class_gen); -static void invert_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void invert_dispose(post_plugin_t *this_gen); @@ -49,15 +46,15 @@ static int invert_draw(vo_frame_t *frame, xine_stream_t *stream); void *invert_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; class->open_plugin = invert_open_plugin; - class->get_identifier = invert_get_identifier; - class->get_description = invert_get_description; - class->dispose = invert_class_dispose; + class->identifier = "invert"; + class->description = N_("inverts the colours of every video frame"); + class->dispose = default_post_class_dispose; return class; } @@ -91,22 +88,6 @@ static post_plugin_t *invert_open_plugin(post_class_t *class_gen, int inputs, return this; } -static char *invert_get_identifier(post_class_t *class_gen) -{ - return "invert"; -} - -static char *invert_get_description(post_class_t *class_gen) -{ - return "inverts the colours of every video frame"; -} - -static void invert_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void invert_dispose(post_plugin_t *this) { if (_x_post_dispose(this)) diff --git a/src/post/planar/noise.c b/src/post/planar/noise.c index 41a3a9aeb..471670fb9 100644 --- a/src/post/planar/noise.c +++ b/src/post/planar/noise.c @@ -25,12 +25,17 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #include <math.h> #include <pthread.h> +#ifdef HAVE_FFMPEG_AVUTIL_H +# include <mem.h> +#else +# include <libavutil/mem.h> +#endif #ifdef ARCH_X86_64 # define REG_a "rax" @@ -61,7 +66,6 @@ typedef struct noise_param_t { shiftptr; int8_t *noise, *prev_shift[MAX_RES][3]; - void *base; } noise_param_t; static int nonTempRandShift[MAX_RES]= {-1}; @@ -78,9 +82,8 @@ static int8_t *initNoise(noise_param_t *fp){ int pattern= fp->pattern; int8_t *noise; int i, j; - void *base; - noise = xine_xmalloc_aligned(16, MAX_NOISE*sizeof(int8_t), &base); + noise = av_mallocz(MAX_NOISE*sizeof(int8_t)); srand(123457); for(i=0,j=0; i<MAX_NOISE; i++,j++) @@ -136,7 +139,6 @@ static int8_t *initNoise(noise_param_t *fp){ } fp->noise= noise; - fp->base = base; fp->shiftptr= 0; return noise; } @@ -324,8 +326,8 @@ typedef struct noise_parameters_s { type, quality, pattern; } noise_parameters_t; -static char *enum_types[] = {"uniform", "gaussian", NULL}; -static char *enum_quality[] = {"fixed", "temporal", "averaged temporal", NULL}; +static const char *const enum_types[] = {"uniform", "gaussian", NULL}; +static const char *const enum_quality[] = {"fixed", "temporal", "averaged temporal", NULL}; /* * description of params struct @@ -435,9 +437,6 @@ static xine_post_api_t post_api = { static post_plugin_t *noise_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static char *noise_get_identifier(post_class_t *class_gen); -static char *noise_get_description(post_class_t *class_gen); -static void noise_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void noise_dispose(post_plugin_t *this_gen); @@ -451,15 +450,15 @@ static int noise_draw(vo_frame_t *frame, xine_stream_t *stream); void *noise_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; class->open_plugin = noise_open_plugin; - class->get_identifier = noise_get_identifier; - class->get_description = noise_get_description; - class->dispose = noise_class_dispose; + class->identifier = "noise"; + class->description = N_("Adds noise"); + class->dispose = default_post_class_dispose; #ifdef ARCH_X86 if (xine_mm_accel() & MM_ACCEL_X86_MMX) { @@ -521,28 +520,14 @@ static post_plugin_t *noise_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *noise_get_identifier(post_class_t *class_gen) -{ - return "noise"; -} - -static char *noise_get_description(post_class_t *class_gen) -{ - return "Adds noise"; -} - -static void noise_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void noise_dispose(post_plugin_t *this_gen) { post_plugin_noise_t *this = (post_plugin_noise_t *)this_gen; if (_x_post_dispose(this_gen)) { pthread_mutex_destroy(&this->lock); + av_free(this->params[0].noise); + av_free(this->params[1].noise); free(this); } } diff --git a/src/post/planar/planar.c b/src/post/planar/planar.c index 112ebdf0d..e2bd65846 100644 --- a/src/post/planar/planar.c +++ b/src/post/planar/planar.c @@ -24,9 +24,9 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> extern void *invert_init_plugin(xine_t *xine, void *); static const post_info_t invert_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; @@ -60,15 +60,15 @@ static const post_info_t noise_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "expand", XINE_VERSION_CODE, &expand_special_info, &expand_init_plugin }, - { PLUGIN_POST, 9, "fill", XINE_VERSION_CODE, &fill_special_info, &fill_init_plugin }, - { PLUGIN_POST, 9, "invert", XINE_VERSION_CODE, &invert_special_info, &invert_init_plugin }, - { PLUGIN_POST, 9, "eq", XINE_VERSION_CODE, &eq_special_info, &eq_init_plugin }, - { PLUGIN_POST, 9, "denoise3d", XINE_VERSION_CODE, &denoise3d_special_info, &denoise3d_init_plugin }, - { PLUGIN_POST, 9, "boxblur", XINE_VERSION_CODE, &boxblur_special_info, &boxblur_init_plugin }, - { PLUGIN_POST, 9, "eq2", XINE_VERSION_CODE, &eq2_special_info, &eq2_init_plugin }, - { PLUGIN_POST, 9, "unsharp", XINE_VERSION_CODE, &unsharp_special_info, &unsharp_init_plugin }, - { PLUGIN_POST, 9, "pp", XINE_VERSION_CODE, &pp_special_info, &pp_init_plugin }, - { PLUGIN_POST, 9, "noise", XINE_VERSION_CODE, &noise_special_info, &noise_init_plugin }, + { PLUGIN_POST, 10, "expand", XINE_VERSION_CODE, &expand_special_info, &expand_init_plugin }, + { PLUGIN_POST, 10, "fill", XINE_VERSION_CODE, &fill_special_info, &fill_init_plugin }, + { PLUGIN_POST, 10, "invert", XINE_VERSION_CODE, &invert_special_info, &invert_init_plugin }, + { PLUGIN_POST, 10, "eq", XINE_VERSION_CODE, &eq_special_info, &eq_init_plugin }, + { PLUGIN_POST, 10, "denoise3d", XINE_VERSION_CODE, &denoise3d_special_info, &denoise3d_init_plugin }, + { PLUGIN_POST, 10, "boxblur", XINE_VERSION_CODE, &boxblur_special_info, &boxblur_init_plugin }, + { PLUGIN_POST, 10, "eq2", XINE_VERSION_CODE, &eq2_special_info, &eq2_init_plugin }, + { PLUGIN_POST, 10, "unsharp", XINE_VERSION_CODE, &unsharp_special_info, &unsharp_init_plugin }, + { PLUGIN_POST, 10, "pp", XINE_VERSION_CODE, &pp_special_info, &pp_init_plugin }, + { PLUGIN_POST, 10, "noise", XINE_VERSION_CODE, &noise_special_info, &noise_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/planar/pp.c b/src/post/planar/pp.c index 3753c2ce2..ab1fc3a9f 100644 --- a/src/post/planar/pp.c +++ b/src/post/planar/pp.c @@ -24,16 +24,17 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" -#include <pthread.h> +#include <config.h> +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #ifdef HAVE_FFMPEG_AVUTIL_H # include <postprocess.h> #else # include <libpostproc/postprocess.h> #endif +#include <pthread.h> #if LIBPOSTPROC_VERSION_MAJOR < 52 # define pp_context pp_context_t @@ -119,20 +120,19 @@ static xine_post_api_descr_t * get_param_descr (void) { } static char * get_help (void) { - char *help1 = - _("FFmpeg libpostprocess plugin.\n" - "\n" - "Parameters\n" - "\n"); - - char *help2 = - _("\n" - "* libpostprocess (C) Michael Niedermayer\n" - ); static char *help = NULL; - if( !help ) - help = _x_asprintf("%s%s%s", help1, help2, pp_help); + if( !help ) { + help = _x_asprintf("%s%s%s", + _("FFmpeg libpostprocess plugin.\n" + "\n" + "Parameters\n" + "\n"), + pp_help, + _("\n" + "* libpostprocess (C) Michael Niedermayer\n") + ); + } return help; } @@ -149,9 +149,6 @@ static xine_post_api_t post_api = { static post_plugin_t *pp_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static char *pp_get_identifier(post_class_t *class_gen); -static char *pp_get_description(post_class_t *class_gen); -static void pp_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void pp_dispose(post_plugin_t *this_gen); @@ -165,15 +162,15 @@ static int pp_draw(vo_frame_t *frame, xine_stream_t *stream); void *pp_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; class->open_plugin = pp_open_plugin; - class->get_identifier = pp_get_identifier; - class->get_description = pp_get_description; - class->dispose = pp_class_dispose; + class->identifier = "pp"; + class->description = N_("plugin for ffmpeg libpostprocess"); + class->dispose = default_post_class_dispose; return class; } @@ -235,22 +232,6 @@ static post_plugin_t *pp_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *pp_get_identifier(post_class_t *class_gen) -{ - return "pp"; -} - -static char *pp_get_description(post_class_t *class_gen) -{ - return "plugin for ffmpeg libpostprocess"; -} - -static void pp_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void pp_dispose(post_plugin_t *this_gen) { post_plugin_pp_t *this = (post_plugin_pp_t *)this_gen; diff --git a/src/post/planar/unsharp.c b/src/post/planar/unsharp.c index dbf723577..ffa6a39df 100644 --- a/src/post/planar/unsharp.c +++ b/src/post/planar/unsharp.c @@ -25,9 +25,9 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #include <pthread.h> /*===========================================================================*/ @@ -250,9 +250,6 @@ static xine_post_api_t post_api = { static post_plugin_t *unsharp_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static char *unsharp_get_identifier(post_class_t *class_gen); -static char *unsharp_get_description(post_class_t *class_gen); -static void unsharp_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void unsharp_dispose(post_plugin_t *this_gen); @@ -266,15 +263,15 @@ static int unsharp_draw(vo_frame_t *frame, xine_stream_t *stream); void *unsharp_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; class->open_plugin = unsharp_open_plugin; - class->get_identifier = unsharp_get_identifier; - class->get_description = unsharp_get_description; - class->dispose = unsharp_class_dispose; + class->identifier = "unsharp"; + class->description = N_("unsharp mask & gaussian blur"); + class->dispose = default_post_class_dispose; return class; } @@ -329,21 +326,6 @@ static post_plugin_t *unsharp_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *unsharp_get_identifier(post_class_t *class_gen) -{ - return "unsharp"; -} - -static char *unsharp_get_description(post_class_t *class_gen) -{ - return "unsharp mask & gaussian blur"; -} - -static void unsharp_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - static void unsharp_free_SC(post_plugin_unsharp_t *this) { int i; diff --git a/src/post/visualizations/Makefile.am b/src/post/visualizations/Makefile.am index f3a759fae..0bf5c21d0 100644 --- a/src/post/visualizations/Makefile.am +++ b/src/post/visualizations/Makefile.am @@ -1,14 +1,16 @@ +include $(top_srcdir)/misc/Makefile.quiet include $(top_builddir)/misc/Makefile.plugins include $(top_srcdir)/misc/Makefile.common +AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) +AM_LDFLAGS = $(xineplug_ldflags) + EXTRA_DIST = fooviz.c +noinst_HEADERS = fft.h visualizations.h + xinepost_LTLIBRARIES = xineplug_post_visualizations.la xineplug_post_visualizations_la_SOURCES = \ visualizations.c fft.c fftscope.c oscope.c fftgraph.c xineplug_post_visualizations_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) -lm -xineplug_post_visualizations_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_post_visualizations_la_LDFLAGS = $(xineplug_ldflags) - -noinst_HEADERS = fft.h visualizations.h diff --git a/src/post/visualizations/fft.c b/src/post/visualizations/fft.c index ac109e379..0b61625c3 100644 --- a/src/post/visualizations/fft.c +++ b/src/post/visualizations/fft.c @@ -187,18 +187,6 @@ double fft_amp (int n, complex_t wave[], int bits) } /* - * Calculate phase of component n in the decimated wave[] array. - */ -double fft_phase (int n, complex_t wave[], int bits) -{ - n = PERMUTE (n, bits); - if (REAL(n) != 0.0) - return (atan (IMAG(n) / REAL(n))); - else - return (0.0); -} - -/* * Scale sampled values. * Do this *before* the fft. */ diff --git a/src/post/visualizations/fft.h b/src/post/visualizations/fft.h index 651c7f15d..358cec33c 100644 --- a/src/post/visualizations/fft.h +++ b/src/post/visualizations/fft.h @@ -44,7 +44,6 @@ void fft_compute (fft_t *fft, complex_t wave[]); void fft_window (fft_t *fft, complex_t wave[]); double fft_amp (int n, complex_t wave[], int bits); -double fft_phase (int n, complex_t wave[], int bits); void fft_scale (complex_t wave[], int bits); #endif /* FFT_H */ diff --git a/src/post/visualizations/fftgraph.c b/src/post/visualizations/fftgraph.c index c3f8ff9f9..2d13c4084 100644 --- a/src/post/visualizations/fftgraph.c +++ b/src/post/visualizations/fftgraph.c @@ -30,9 +30,9 @@ #include <assert.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 "bswap.h" #include "visualizations.h" #include "fft.h" @@ -456,33 +456,18 @@ static post_plugin_t *fftgraph_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *fftgraph_get_identifier(post_class_t *class_gen) -{ - return "fftgraph"; -} - -static char *fftgraph_get_description(post_class_t *class_gen) -{ - return "fftgraph Visualization Post Plugin"; -} - -static void fftgraph_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - /* plugin class initialization function */ void *fftgraph_init_plugin(xine_t *xine, void *data) { - post_class_fftgraph_t *class = (post_class_fftgraph_t *)malloc(sizeof(post_class_fftgraph_t)); + post_class_fftgraph_t *class = (post_class_fftgraph_t *)xine_xmalloc(sizeof(post_class_fftgraph_t)); if (!class) return NULL; class->post_class.open_plugin = fftgraph_open_plugin; - class->post_class.get_identifier = fftgraph_get_identifier; - class->post_class.get_description = fftgraph_get_description; - class->post_class.dispose = fftgraph_class_dispose; + class->post_class.identifier = "fftgraph"; + class->post_class.description = N_("fftgraph Visualization Post Plugin"); + class->post_class.dispose = default_post_class_dispose; class->xine = xine; diff --git a/src/post/visualizations/fftscope.c b/src/post/visualizations/fftscope.c index 286c4ac38..3ec72fba8 100644 --- a/src/post/visualizations/fftscope.c +++ b/src/post/visualizations/fftscope.c @@ -30,9 +30,9 @@ #include <stdio.h> #include <math.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 "bswap.h" #include "visualizations.h" #include "fft.h" @@ -477,33 +477,18 @@ static post_plugin_t *fftscope_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *fftscope_get_identifier(post_class_t *class_gen) -{ - return "FFT Scope"; -} - -static char *fftscope_get_description(post_class_t *class_gen) -{ - return "FFT Scope"; -} - -static void fftscope_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - /* plugin class initialization function */ void *fftscope_init_plugin(xine_t *xine, void *data) { - post_class_fftscope_t *class = (post_class_fftscope_t *)malloc(sizeof(post_class_fftscope_t)); + post_class_fftscope_t *class = (post_class_fftscope_t *)xine_xmalloc(sizeof(post_class_fftscope_t)); if (!class) return NULL; class->post_class.open_plugin = fftscope_open_plugin; - class->post_class.get_identifier = fftscope_get_identifier; - class->post_class.get_description = fftscope_get_description; - class->post_class.dispose = fftscope_class_dispose; + class->post_class.identifier = "FFT Scope"; + class->post_class.description = N_("FFT Scope"); + class->post_class.dispose = default_post_class_dispose; class->xine = xine; diff --git a/src/post/visualizations/fooviz.c b/src/post/visualizations/fooviz.c index ac85da304..9c8a9c1fa 100644 --- a/src/post/visualizations/fooviz.c +++ b/src/post/visualizations/fooviz.c @@ -30,9 +30,9 @@ #include <stdio.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #define FPS 20 @@ -288,33 +288,18 @@ static post_plugin_t *fooviz_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *fooviz_get_identifier(post_class_t *class_gen) -{ - return "fooviz"; -} - -static char *fooviz_get_description(post_class_t *class_gen) -{ - return "fooviz"; -} - -static void fooviz_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - /* plugin class initialization function */ static void *fooviz_init_plugin(xine_t *xine, void *data) { - post_class_fooviz_t *class = (post_class_fooviz_t *)malloc(sizeof(post_class_fooviz_t)); + post_class_fooviz_t *class = (post_class_fooviz_t *)xine_xmalloc(sizeof(post_class_fooviz_t)); if (!class) return NULL; class->post_class.open_plugin = fooviz_open_plugin; - class->post_class.get_identifier = fooviz_get_identifier; - class->post_class.get_description = fooviz_get_description; - class->post_class.dispose = fooviz_class_dispose; + class->post_class.identifier = "fooviz"; + class->post_class.description = N_("fooviz"); + class->post_class.dispose = default_post_class_dispose; class->xine = xine; @@ -326,6 +311,6 @@ static const post_info_t fooviz_special_info = { XINE_POST_TYPE_AUDIO_VISUALIZAT const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "fooviz", XINE_VERSION_CODE, &fooviz_special_info, &fooviz_init_plugin }, + { PLUGIN_POST, 10, "fooviz", XINE_VERSION_CODE, &fooviz_special_info, &fooviz_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/visualizations/oscope.c b/src/post/visualizations/oscope.c index 28d1b4cbc..ffd6f0842 100644 --- a/src/post/visualizations/oscope.c +++ b/src/post/visualizations/oscope.c @@ -27,9 +27,9 @@ #include <stdio.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 "visualizations.h" #define FPS 20 @@ -359,33 +359,18 @@ static post_plugin_t *oscope_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *oscope_get_identifier(post_class_t *class_gen) -{ - return "Oscilloscope"; -} - -static char *oscope_get_description(post_class_t *class_gen) -{ - return "Oscilloscope"; -} - -static void oscope_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - /* plugin class initialization function */ void *oscope_init_plugin(xine_t *xine, void *data) { - post_class_oscope_t *class = (post_class_oscope_t *)malloc(sizeof(post_class_oscope_t)); + post_class_oscope_t *class = (post_class_oscope_t *)xine_xmalloc(sizeof(post_class_oscope_t)); if (!class) return NULL; class->post_class.open_plugin = oscope_open_plugin; - class->post_class.get_identifier = oscope_get_identifier; - class->post_class.get_description = oscope_get_description; - class->post_class.dispose = oscope_class_dispose; + class->post_class.identifier = "Oscilloscope"; + class->post_class.description = N_("Oscilloscope"); + class->post_class.dispose = default_post_class_dispose; class->xine = xine; diff --git a/src/post/visualizations/visualizations.c b/src/post/visualizations/visualizations.c index a26f0bd5b..17c8491d5 100644 --- a/src/post/visualizations/visualizations.c +++ b/src/post/visualizations/visualizations.c @@ -24,8 +24,8 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/post.h> #include "visualizations.h" @@ -46,8 +46,8 @@ static const post_info_t fftgraph_special_info = { XINE_POST_TYPE_AUDIO_VISUALIZ const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "oscope", XINE_VERSION_CODE, &oscope_special_info, &oscope_init_plugin }, - { PLUGIN_POST, 9, "fftscope", XINE_VERSION_CODE, &fftscope_special_info, &fftscope_init_plugin }, - { PLUGIN_POST, 9, "fftgraph", XINE_VERSION_CODE, &fftgraph_special_info, &fftgraph_init_plugin }, + { PLUGIN_POST, 10, "oscope", XINE_VERSION_CODE, &oscope_special_info, &oscope_init_plugin }, + { PLUGIN_POST, 10, "fftscope", XINE_VERSION_CODE, &fftscope_special_info, &fftscope_init_plugin }, + { PLUGIN_POST, 10, "fftgraph", XINE_VERSION_CODE, &fftgraph_special_info, &fftgraph_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/visualizations/visualizations.h b/src/post/visualizations/visualizations.h index 39d02e1cb..c72a1ad77 100644 --- a/src/post/visualizations/visualizations.h +++ b/src/post/visualizations/visualizations.h @@ -20,7 +20,7 @@ * This file contains plugin entries for several visualization post plugins. */ -#include "xine_internal.h" +#include <xine/xine_internal.h> void *oscope_init_plugin(xine_t *xine, void *data); void *fftscope_init_plugin(xine_t *xine, void *data); |