summaryrefslogtreecommitdiffstats
path: root/gst/deinterlace2/tvtime/vfir.c
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-07-05 16:47:32 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-07-05 16:47:32 +0000
commitd7c49f75d6dace82b2038a2a5c647822059dd6ed (patch)
treea5550cee43baa7ad41555c1c2b77ba36f17e60fd /gst/deinterlace2/tvtime/vfir.c
parent8fccf53fc2d070a4938ceb05b164f4a273388b20 (diff)
downloadgst-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/vfir.c')
-rw-r--r--gst/deinterlace2/tvtime/vfir.c95
1 files changed, 54 insertions, 41 deletions
diff --git a/gst/deinterlace2/tvtime/vfir.c b/gst/deinterlace2/tvtime/vfir.c
index 3a56f850..fcfbaa6b 100644
--- a/gst/deinterlace2/tvtime/vfir.c
+++ b/gst/deinterlace2/tvtime/vfir.c
@@ -3,6 +3,7 @@
* GStreamer
* Copyright (C) 2004 Billy Biggs <vektor@dumbterm.net>
* Copyright (c) 2001, 2002, 2003 Fabrice Bellard.
+ * Copyright (C) 2008 Sebastian Dröge <slomo@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -36,6 +37,26 @@
#include "gstdeinterlace2.h"
#include <string.h>
+#define GST_TYPE_DEINTERLACE_METHOD_VFIR (gst_deinterlace_method_vfir_get_type ())
+#define GST_IS_DEINTERLACE_METHOD_VFIR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEINTERLACE_METHOD_VFIR))
+#define GST_IS_DEINTERLACE_METHOD_VFIR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEINTERLACE_METHOD_VFIR))
+#define GST_DEINTERLACE_METHOD_VFIR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEINTERLACE_METHOD_VFIR, GstDeinterlaceMethodVFIRClass))
+#define GST_DEINTERLACE_METHOD_VFIR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEINTERLACE_METHOD_VFIR, GstDeinterlaceMethodVFIR))
+#define GST_DEINTERLACE_METHOD_VFIR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEINTERLACE_METHOD_VFIR, GstDeinterlaceMethodVFIRClass))
+#define GST_DEINTERLACE_METHOD_VFIR_CAST(obj) ((GstDeinterlaceMethodVFIR*)(obj))
+
+GType gst_deinterlace_method_vfir_get_type (void);
+
+typedef GstDeinterlaceMethod GstDeinterlaceMethodVFIR;
+
+typedef struct
+{
+ GstDeinterlaceMethodClass parent_class;
+ void (*scanline) (uint8_t * dst, uint8_t * lum_m4,
+ uint8_t * lum_m3, uint8_t * lum_m2,
+ uint8_t * lum_m1, uint8_t * lum, int size);
+} GstDeinterlaceMethodVFIRClass;
+
/*
* The MPEG2 spec uses a slightly harsher filter, they specify
* [-1 8 2 8 -1]. ffmpeg uses a similar filter but with more of
@@ -122,25 +143,15 @@ deinterlace_line_mmx (uint8_t * dst, uint8_t * lum_m4,
#endif
static void
-deinterlace_frame_vfir (GstDeinterlace2 * object)
+deinterlace_frame_vfir (GstDeinterlaceMethod * d_method,
+ GstDeinterlace2 * object)
{
- void (*func) (uint8_t * dst, uint8_t * lum_m4,
- uint8_t * lum_m3, uint8_t * lum_m2,
- uint8_t * lum_m1, uint8_t * lum, int size);
+ GstDeinterlaceMethodVFIRClass *klass =
+ GST_DEINTERLACE_METHOD_VFIR_GET_CLASS (d_method);
gint line = 0;
uint8_t *cur_field, *last_field;
uint8_t *t0, *b0, *tt1, *m1, *bb1, *out_data;
-#ifdef HAVE_CPU_I386
- if (object->cpu_feature_flags & OIL_IMPL_FLAG_MMX) {
- func = deinterlace_line_mmx;
- } else {
- func = deinterlace_line_c;
- }
-#else
- func = deinterlace_line_c;
-#endif
-
cur_field =
GST_BUFFER_DATA (object->field_history[object->history_count - 2].buf);
last_field =
@@ -173,7 +184,7 @@ deinterlace_frame_vfir (GstDeinterlace2 * object)
bb1 = tt1;
}
- func (out_data, tt1, t0, m1, b0, bb1, object->line_length);
+ klass->scanline (out_data, tt1, t0, m1, b0, bb1, object->line_length);
out_data += object->output_stride;
cur_field += object->field_stride;
last_field += object->field_stride;
@@ -189,31 +200,33 @@ deinterlace_frame_vfir (GstDeinterlace2 * object)
}
}
-static deinterlace_method_t vfirmethod = {
- 0, //DEINTERLACE_PLUGIN_API_VERSION,
- "Blur: Vertical",
- "BlurVertical",
- 2,
- 0,
- 0,
- 0,
- 0,
- 1,
- deinterlace_frame_vfir,
- {"Avoids flicker by blurring consecutive frames",
- "of input. Use this if you want to run your",
- "monitor at an arbitrary refresh rate and not",
- "use much CPU, and are willing to sacrifice",
- "detail.",
- "",
- "Vertical mode blurs favouring the most recent",
- "field for less visible trails. From the",
- "deinterlacer filter in ffmpeg.",
- ""}
-};
-
-deinterlace_method_t *
-dscaler_vfir_get_method (void)
+G_DEFINE_TYPE (GstDeinterlaceMethodVFIR, gst_deinterlace_method_vfir,
+ GST_TYPE_DEINTERLACE_METHOD);
+
+static void
+gst_deinterlace_method_vfir_class_init (GstDeinterlaceMethodVFIRClass * klass)
+{
+ GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass;
+ guint cpu_flags = oil_cpu_get_flags ();
+
+ dim_class->fields_required = 2;
+ dim_class->deinterlace_frame = deinterlace_frame_vfir;
+ dim_class->name = "Blur Vertical";
+ dim_class->nick = "vfir";
+ dim_class->latency = 0;
+
+#ifdef HAVE_CPU_I386
+ if (cpu_flags & OIL_IMPL_FLAG_MMX) {
+ klass->scanline = deinterlace_line_mmx;
+ } else {
+ klass->scanline = deinterlace_line_c;
+ }
+#else
+ klass->scanline = deinterlace_line_c;
+#endif
+}
+
+static void
+gst_deinterlace_method_vfir_init (GstDeinterlaceMethodVFIR * self)
{
- return &vfirmethod;
}