diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2008-07-05 16:47:32 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-07-05 16:47:32 +0000 |
commit | d7c49f75d6dace82b2038a2a5c647822059dd6ed (patch) | |
tree | a5550cee43baa7ad41555c1c2b77ba36f17e60fd /gst/deinterlace2/tvtime/tomsmocomp.c | |
parent | 8fccf53fc2d070a4938ceb05b164f4a273388b20 (diff) | |
download | gst-plugins-bad-d7c49f75d6dace82b2038a2a5c647822059dd6ed.tar.gz gst-plugins-bad-d7c49f75d6dace82b2038a2a5c647822059dd6ed.tar.bz2 gst-plugins-bad-d7c49f75d6dace82b2038a2a5c647822059dd6ed.zip |
gst/deinterlace2/: Use a GstObject subtype for the deinterlacing methods and export the different settings for each d...
Original commit message from CVS:
* gst/deinterlace2/Makefile.am:
* gst/deinterlace2/gstdeinterlace2.c:
(gst_deinterlace_method_class_init), (gst_deinterlace_method_init),
(gst_deinterlace_method_deinterlace_frame),
(gst_deinterlace_method_get_fields_required),
(gst_deinterlace2_methods_get_type), (_do_init),
(gst_deinterlace2_set_method), (gst_deinterlace2_class_init),
(gst_deinterlace2_child_proxy_get_child_by_index),
(gst_deinterlace2_child_proxy_get_children_count),
(gst_deinterlace2_child_proxy_interface_init),
(gst_deinterlace2_init), (gst_deinterlace2_finalize),
(gst_deinterlace2_chain), (gst_deinterlace2_src_query):
* gst/deinterlace2/gstdeinterlace2.h:
* gst/deinterlace2/tvtime/greedy.c:
(deinterlace_greedy_packed422_scanline_c),
(deinterlace_greedy_packed422_scanline_mmx),
(deinterlace_greedy_packed422_scanline_mmxext),
(deinterlace_frame_di_greedy),
(gst_deinterlace_method_greedy_l_set_property),
(gst_deinterlace_method_greedy_l_get_property),
(gst_deinterlace_method_greedy_l_class_init),
(gst_deinterlace_method_greedy_l_init):
* gst/deinterlace2/tvtime/greedyh.asm:
* gst/deinterlace2/tvtime/greedyh.c: (greedyDScaler_C),
(deinterlace_frame_di_greedyh),
(gst_deinterlace_method_greedy_h_set_property),
(gst_deinterlace_method_greedy_h_get_property),
(gst_deinterlace_method_greedy_h_class_init),
(gst_deinterlace_method_greedy_h_init):
* gst/deinterlace2/tvtime/greedyh.h:
* gst/deinterlace2/tvtime/plugins.h:
* gst/deinterlace2/tvtime/tomsmocomp.c:
(gst_deinterlace_method_tomsmocomp_set_property),
(gst_deinterlace_method_tomsmocomp_get_property),
(gst_deinterlace_method_tomsmocomp_class_init),
(gst_deinterlace_method_tomsmocomp_init):
* gst/deinterlace2/tvtime/tomsmocomp.h:
* gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll.inc:
* gst/deinterlace2/tvtime/vfir.c: (deinterlace_frame_vfir),
(gst_deinterlace_method_vfir_class_init),
(gst_deinterlace_method_vfir_init):
Use a GstObject subtype for the deinterlacing methods and export
the different settings for each deinterlacing method via GObject
properties.
Implement GstChildProxy interface to allow access to the used
deinterlacing method and to allow adjusting the different settings.
Move global variables of the tomsmocomp deinterlacing method into
function local variables to make it possible to use this deinterlacing
method from different instances.
Diffstat (limited to 'gst/deinterlace2/tvtime/tomsmocomp.c')
-rw-r--r-- | gst/deinterlace2/tvtime/tomsmocomp.c | 162 |
1 files changed, 97 insertions, 65 deletions
diff --git a/gst/deinterlace2/tvtime/tomsmocomp.c b/gst/deinterlace2/tvtime/tomsmocomp.c index 65234c2c..7a0ba6b3 100644 --- a/gst/deinterlace2/tvtime/tomsmocomp.c +++ b/gst/deinterlace2/tvtime/tomsmocomp.c @@ -1,5 +1,6 @@ /** * Copyright (C) 2004 Billy Biggs <vektor@dumbterm.net> + * Copyright (C) 2008 Sebastian Dröge <slomo@collabora.co.uk> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,22 +32,28 @@ #include "tomsmocomp/tomsmocompmacros.h" #include "x86-64_macros.inc" -#define SearchEffortDefault 5 -#define UseStrangeBobDefault 0 - -static long SearchEffort; -static int UseStrangeBob; -static int IsOdd; -static const unsigned char *pWeaveSrc; -static const unsigned char *pWeaveSrcP; -static unsigned char *pWeaveDest; -static const unsigned char *pCopySrc; -static const unsigned char *pCopySrcP; -static unsigned char *pCopyDest; -static int src_pitch; -static int dst_pitch; -static int rowsize; -static int FldHeight; +#define GST_TYPE_DEINTERLACE_METHOD_TOMSMOCOMP (gst_deinterlace_method_tomsmocomp_get_type ()) +#define GST_IS_DEINTERLACE_METHOD_TOMSMOCOMP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEINTERLACE_METHOD_TOMSMOCOMP)) +#define GST_IS_DEINTERLACE_METHOD_TOMSMOCOMP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEINTERLACE_METHOD_TOMSMOCOMP)) +#define GST_DEINTERLACE_METHOD_TOMSMOCOMP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEINTERLACE_METHOD_TOMSMOCOMP, GstDeinterlaceMethodTomsMoCompClass)) +#define GST_DEINTERLACE_METHOD_TOMSMOCOMP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEINTERLACE_METHOD_TOMSMOCOMP, GstDeinterlaceMethodTomsMoComp)) +#define GST_DEINTERLACE_METHOD_TOMSMOCOMP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEINTERLACE_METHOD_TOMSMOCOMP, GstDeinterlaceMethodTomsMoCompClass)) +#define GST_DEINTERLACE_METHOD_TOMSMOCOMP_CAST(obj) ((GstDeinterlaceMethodTomsMoComp*)(obj)) + +GType gst_deinterlace_method_tomsmocomp_get_type (void); + +typedef struct +{ + GstDeinterlaceMethod parent; + + guint search_effort; + gboolean strange_bob; +} GstDeinterlaceMethodTomsMoComp; + +typedef struct +{ + GstDeinterlaceMethodClass parent_class; +} GstDeinterlaceMethodTomsMoCompClass; static int Fieldcopy (void *dest, const void *src, size_t count, @@ -90,71 +97,96 @@ Fieldcopy (void *dest, const void *src, size_t count, #undef SSE_TYPE #undef FUNCT_NAME -static void -tomsmocomp_init (void) -{ - SearchEffort = SearchEffortDefault; - UseStrangeBob = UseStrangeBobDefault; -} +G_DEFINE_TYPE (GstDeinterlaceMethodTomsMoComp, + gst_deinterlace_method_tomsmocomp, GST_TYPE_DEINTERLACE_METHOD); -static void -tomsmocomp_filter_mmx (GstDeinterlace2 * object) +enum { - tomsmocompDScaler_MMX (object); -} + ARG_0, + ARG_SEARCH_EFFORT, + ARG_STRANGE_BOB +}; static void -tomsmocomp_filter_3dnow (GstDeinterlace2 * object) +gst_deinterlace_method_tomsmocomp_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) { - tomsmocompDScaler_3DNOW (object); + GstDeinterlaceMethodTomsMoComp *self = + GST_DEINTERLACE_METHOD_TOMSMOCOMP (object); + + switch (prop_id) { + case ARG_SEARCH_EFFORT: + self->search_effort = g_value_get_uint (value); + break; + case ARG_STRANGE_BOB: + self->strange_bob = g_value_get_boolean (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } } static void -tomsmocomp_filter_sse (GstDeinterlace2 * object) +gst_deinterlace_method_tomsmocomp_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) { - tomsmocompDScaler_SSE (object); + GstDeinterlaceMethodTomsMoComp *self = + GST_DEINTERLACE_METHOD_TOMSMOCOMP (object); + + switch (prop_id) { + case ARG_SEARCH_EFFORT: + g_value_set_uint (value, self->search_effort); + break; + case ARG_STRANGE_BOB: + g_value_set_boolean (value, self->strange_bob); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } } static void -deinterlace_frame_di_tomsmocomp (GstDeinterlace2 * object) + gst_deinterlace_method_tomsmocomp_class_init + (GstDeinterlaceMethodTomsMoCompClass * klass) { - if (object->cpu_feature_flags & OIL_IMPL_FLAG_SSE) { - tomsmocomp_filter_sse (object); - } else if (object->cpu_feature_flags & OIL_IMPL_FLAG_3DNOW) { - tomsmocomp_filter_3dnow (object); - } else if (object->cpu_feature_flags & OIL_IMPL_FLAG_MMX) { - tomsmocomp_filter_mmx (object); + GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass; + GObjectClass *gobject_class = (GObjectClass *) klass; + guint cpu_flags = oil_cpu_get_flags (); + + gobject_class->set_property = gst_deinterlace_method_tomsmocomp_set_property; + gobject_class->get_property = gst_deinterlace_method_tomsmocomp_get_property; + + g_object_class_install_property (gobject_class, ARG_SEARCH_EFFORT, + g_param_spec_uint ("search-effort", + "Search Effort", + "Search Effort", 0, 27, 5, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) + ); + + g_object_class_install_property (gobject_class, ARG_STRANGE_BOB, + g_param_spec_boolean ("strange-bob", + "Strange Bob", + "Use strange bob", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) + ); + + dim_class->fields_required = 4; + dim_class->name = "Motion Adaptive: Motion Search"; + dim_class->nick = "tomsmocomp"; + dim_class->latency = 1; + + if (cpu_flags & OIL_IMPL_FLAG_SSE) { + dim_class->deinterlace_frame = tomsmocompDScaler_SSE; + } else if (cpu_flags & OIL_IMPL_FLAG_3DNOW) { + dim_class->deinterlace_frame = tomsmocompDScaler_3DNOW; + } else if (cpu_flags & OIL_IMPL_FLAG_MMX) { + dim_class->deinterlace_frame = tomsmocompDScaler_MMX; } else { - g_assert_not_reached (); + dim_class->available = FALSE; } } -static deinterlace_method_t tomsmocompmethod = { - 0, //DEINTERLACE_PLUGIN_API_VERSION, - "Motion Adaptive: Motion Search", - "AdaptiveSearch", - 4, - OIL_IMPL_FLAG_MMX, - 0, - 0, - 0, - 0, - deinterlace_frame_di_tomsmocomp, - {"Uses heuristics to detect motion in the input", - "frames and reconstruct image detail where", - "possible. Use this for high quality output", - "even on monitors set to an arbitrary refresh", - "rate.", - "", - "Motion search mode finds and follows motion", - "vectors for accurate interpolation. This is", - "the TomsMoComp deinterlacer from DScaler.", - ""} -}; - -deinterlace_method_t * -dscaler_tomsmocomp_get_method (void) +static void +gst_deinterlace_method_tomsmocomp_init (GstDeinterlaceMethodTomsMoComp * self) { - tomsmocomp_init (); - return &tomsmocompmethod; + self->search_effort = 5; + self->strange_bob = FALSE; } |