summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
Diffstat (limited to 'gst')
-rw-r--r--gst/deinterlace2/Makefile.am8
-rw-r--r--gst/deinterlace2/gstdeinterlace2.c43
-rw-r--r--gst/deinterlace2/gstdeinterlace2.h8
-rw-r--r--gst/deinterlace2/tvtime/linear.c214
-rw-r--r--gst/deinterlace2/tvtime/linearblend.c231
-rw-r--r--gst/deinterlace2/tvtime/plugins.h18
-rw-r--r--gst/deinterlace2/tvtime/scalerbob.c74
-rw-r--r--gst/deinterlace2/tvtime/weave.c82
-rw-r--r--gst/deinterlace2/tvtime/weavebff.c88
-rw-r--r--gst/deinterlace2/tvtime/weavetff.c88
10 files changed, 836 insertions, 18 deletions
diff --git a/gst/deinterlace2/Makefile.am b/gst/deinterlace2/Makefile.am
index 0359ff81..b9447039 100644
--- a/gst/deinterlace2/Makefile.am
+++ b/gst/deinterlace2/Makefile.am
@@ -5,7 +5,13 @@ libgstdeinterlace2_la_SOURCES = \
tvtime/greedy.c \
tvtime/greedyh.c \
tvtime/vfir.c \
- tvtime/tomsmocomp.c
+ tvtime/tomsmocomp.c \
+ tvtime/weavetff.c \
+ tvtime/weavebff.c \
+ tvtime/weave.c \
+ tvtime/linear.c \
+ tvtime/linearblend.c \
+ tvtime/scalerbob.c
libgstdeinterlace2_la_CFLAGS = $(GST_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(LIBOIL_CFLAGS)
diff --git a/gst/deinterlace2/gstdeinterlace2.c b/gst/deinterlace2/gstdeinterlace2.c
index cf72a8d7..28abdaba 100644
--- a/gst/deinterlace2/gstdeinterlace2.c
+++ b/gst/deinterlace2/gstdeinterlace2.c
@@ -128,14 +128,11 @@ gst_deinterlace_simple_method_deinterlace_frame (GstDeinterlaceMethod * self,
g_assert (dm_class->fields_required <= 4);
if (dm_class->fields_required >= 2)
- field1 = field0 =
- GST_BUFFER_DATA (parent->field_history[cur_field_idx + 1].buf);
+ field1 = GST_BUFFER_DATA (parent->field_history[cur_field_idx + 1].buf);
if (dm_class->fields_required >= 3)
- field1 = field0 =
- GST_BUFFER_DATA (parent->field_history[cur_field_idx + 2].buf);
+ field2 = GST_BUFFER_DATA (parent->field_history[cur_field_idx + 2].buf);
if (dm_class->fields_required >= 4)
- field1 = field0 =
- GST_BUFFER_DATA (parent->field_history[cur_field_idx + 3].buf);
+ field3 = GST_BUFFER_DATA (parent->field_history[cur_field_idx + 3].buf);
if (cur_field_flags == PICTURE_INTERLACED_BOTTOM) {
@@ -259,10 +256,18 @@ gst_deinterlace2_methods_get_type (void)
static GType deinterlace2_methods_type = 0;
static const GEnumValue methods_types[] = {
- {GST_DEINTERLACE2_TOMSMOCOMP, "Toms Motion Compensation", "tomsmocomp"},
- {GST_DEINTERLACE2_GREEDY_H, "Greedy High Motion", "greedyh"},
- {GST_DEINTERLACE2_GREEDY_L, "Greedy Low Motion", "greedyl"},
- {GST_DEINTERLACE2_VFIR, "Vertical Blur", "vfir"},
+ {GST_DEINTERLACE2_TOMSMOCOMP, "Motion Adaptive: Motion Search",
+ "tomsmocomp"},
+ {GST_DEINTERLACE2_GREEDY_H, "Motion Adaptive: Advanced Detection",
+ "greedyh"},
+ {GST_DEINTERLACE2_GREEDY_L, "Motion Adaptive: Simple Detection", "greedyl"},
+ {GST_DEINTERLACE2_VFIR, "Blur Vertical", "vfir"},
+ {GST_DEINTERLACE2_LINEAR, "Television: Full resolution", "linear"},
+ {GST_DEINTERLACE2_LINEAR_BLEND, "Blur: Temporal", "linearblend"},
+ {GST_DEINTERLACE2_SCALER_BOB, "Double lines", "scalerbob"},
+ {GST_DEINTERLACE2_WEAVE, "Weave", "weave"},
+ {GST_DEINTERLACE2_WEAVE_TFF, "Progressive: Top Field First", "weavetff"},
+ {GST_DEINTERLACE2_WEAVE_BFF, "Progressive: Bottom Field First", "weavebff"},
{0, NULL, NULL},
};
@@ -389,6 +394,24 @@ gst_deinterlace2_set_method (GstDeinterlace2 * self,
case GST_DEINTERLACE2_VFIR:
self->method = g_object_new (GST_TYPE_DEINTERLACE_VFIR, NULL);
break;
+ case GST_DEINTERLACE2_LINEAR:
+ self->method = g_object_new (GST_TYPE_DEINTERLACE_LINEAR, NULL);
+ break;
+ case GST_DEINTERLACE2_LINEAR_BLEND:
+ self->method = g_object_new (GST_TYPE_DEINTERLACE_LINEAR_BLEND, NULL);
+ break;
+ case GST_DEINTERLACE2_SCALER_BOB:
+ self->method = g_object_new (GST_TYPE_DEINTERLACE_SCALER_BOB, NULL);
+ break;
+ case GST_DEINTERLACE2_WEAVE:
+ self->method = g_object_new (GST_TYPE_DEINTERLACE_WEAVE, NULL);
+ break;
+ case GST_DEINTERLACE2_WEAVE_TFF:
+ self->method = g_object_new (GST_TYPE_DEINTERLACE_WEAVE_TFF, NULL);
+ break;
+ case GST_DEINTERLACE2_WEAVE_BFF:
+ self->method = g_object_new (GST_TYPE_DEINTERLACE_WEAVE_BFF, NULL);
+ break;
default:
GST_WARNING ("Invalid Deinterlacer Method");
return;
diff --git a/gst/deinterlace2/gstdeinterlace2.h b/gst/deinterlace2/gstdeinterlace2.h
index 1f56dd3e..01f1831b 100644
--- a/gst/deinterlace2/gstdeinterlace2.h
+++ b/gst/deinterlace2/gstdeinterlace2.h
@@ -166,7 +166,13 @@ typedef enum
GST_DEINTERLACE2_TOMSMOCOMP,
GST_DEINTERLACE2_GREEDY_H,
GST_DEINTERLACE2_GREEDY_L,
- GST_DEINTERLACE2_VFIR
+ GST_DEINTERLACE2_VFIR,
+ GST_DEINTERLACE2_LINEAR,
+ GST_DEINTERLACE2_LINEAR_BLEND,
+ GST_DEINTERLACE2_SCALER_BOB,
+ GST_DEINTERLACE2_WEAVE,
+ GST_DEINTERLACE2_WEAVE_TFF,
+ GST_DEINTERLACE2_WEAVE_BFF
} GstDeinterlace2Methods;
typedef enum
diff --git a/gst/deinterlace2/tvtime/linear.c b/gst/deinterlace2/tvtime/linear.c
new file mode 100644
index 00000000..42403e49
--- /dev/null
+++ b/gst/deinterlace2/tvtime/linear.c
@@ -0,0 +1,214 @@
+/**
+ * Copyright (C) 2002 Billy Biggs <vektor@dumbterm.net>.
+ * 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 Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "_stdint.h"
+#include "gstdeinterlace2.h"
+#include <string.h>
+
+#define GST_TYPE_DEINTERLACE_METHOD_LINEAR (gst_deinterlace_method_linear_get_type ())
+#define GST_IS_DEINTERLACE_METHOD_LINEAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEINTERLACE_METHOD_LINEAR))
+#define GST_IS_DEINTERLACE_METHOD_LINEAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEINTERLACE_METHOD_LINEAR))
+#define GST_DEINTERLACE_METHOD_LINEAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEINTERLACE_METHOD_LINEAR, GstDeinterlaceMethodLinearClass))
+#define GST_DEINTERLACE_METHOD_LINEAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEINTERLACE_METHOD_LINEAR, GstDeinterlaceMethodLinear))
+#define GST_DEINTERLACE_METHOD_LINEAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEINTERLACE_METHOD_LINEAR, GstDeinterlaceMethodLinearClass))
+#define GST_DEINTERLACE_METHOD_LINEAR_CAST(obj) ((GstDeinterlaceMethodLinear*)(obj))
+
+GType gst_deinterlace_method_linear_get_type (void);
+
+typedef GstDeinterlaceSimpleMethod GstDeinterlaceMethodLinear;
+
+typedef GstDeinterlaceSimpleMethodClass GstDeinterlaceMethodLinearClass;
+
+static void
+deinterlace_scanline_linear_c (GstDeinterlaceMethod * self,
+ GstDeinterlace2 * parent, guint8 * out,
+ GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ gint i;
+
+ width *= 2;
+ for (i = 0; i < width; i++)
+ out[i] = (scanlines->t0[i] + scanlines->b0[i]) / 2;
+}
+
+#ifdef BUILD_X86_ASM
+#include "mmx.h"
+static void
+deinterlace_scanline_linear_mmx (GstDeinterlaceMethod * self,
+ GstDeinterlace2 * parent, guint8 * out,
+ GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ const mmx_t shiftmask = { 0xfefffefffefffeffULL }; /* To avoid shifting chroma to luma. */
+ int i;
+ guint8 *bot = scanlines->b0, *top = scanlines->t0;
+
+ for (i = width / 16; i; --i) {
+ movq_m2r (*bot, mm0);
+ movq_m2r (*top, mm1);
+ movq_m2r (*(bot + 8), mm2);
+ movq_m2r (*(top + 8), mm3);
+ movq_m2r (*(bot + 16), mm4);
+ movq_m2r (*(top + 16), mm5);
+ movq_m2r (*(bot + 24), mm6);
+ movq_m2r (*(top + 24), mm7);
+ pand_m2r (shiftmask, mm0);
+ pand_m2r (shiftmask, mm1);
+ pand_m2r (shiftmask, mm2);
+ pand_m2r (shiftmask, mm3);
+ pand_m2r (shiftmask, mm4);
+ pand_m2r (shiftmask, mm5);
+ pand_m2r (shiftmask, mm6);
+ pand_m2r (shiftmask, mm7);
+ psrlw_i2r (1, mm0);
+ psrlw_i2r (1, mm1);
+ psrlw_i2r (1, mm2);
+ psrlw_i2r (1, mm3);
+ psrlw_i2r (1, mm4);
+ psrlw_i2r (1, mm5);
+ psrlw_i2r (1, mm6);
+ psrlw_i2r (1, mm7);
+ paddb_r2r (mm1, mm0);
+ paddb_r2r (mm3, mm2);
+ paddb_r2r (mm5, mm4);
+ paddb_r2r (mm7, mm6);
+ movq_r2m (mm0, *out);
+ movq_r2m (mm2, *(out + 8));
+ movq_r2m (mm4, *(out + 16));
+ movq_r2m (mm6, *(out + 24));
+ out += 32;
+ top += 32;
+ bot += 32;
+ }
+ width = (width & 0xf);
+
+ for (i = width / 4; i; --i) {
+ movq_m2r (*bot, mm0);
+ movq_m2r (*top, mm1);
+ pand_m2r (shiftmask, mm0);
+ pand_m2r (shiftmask, mm1);
+ psrlw_i2r (1, mm0);
+ psrlw_i2r (1, mm1);
+ paddb_r2r (mm1, mm0);
+ movq_r2m (mm0, *out);
+ out += 8;
+ top += 8;
+ bot += 8;
+ }
+ width = width & 0x7;
+
+ /* Handle last few pixels. */
+ for (i = width * 2; i; --i) {
+ *out++ = ((*top++) + (*bot++)) >> 1;
+ }
+
+ emms ();
+}
+
+#include "sse.h"
+static void
+deinterlace_scanline_linear_mmxext (GstDeinterlaceMethod * self,
+ GstDeinterlace2 * parent, guint8 * out,
+ GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ gint i;
+ guint8 *bot = scanlines->b0, *top = scanlines->t0;
+
+ for (i = width / 16; i; --i) {
+ movq_m2r (*bot, mm0);
+ movq_m2r (*top, mm1);
+ movq_m2r (*(bot + 8), mm2);
+ movq_m2r (*(top + 8), mm3);
+ movq_m2r (*(bot + 16), mm4);
+ movq_m2r (*(top + 16), mm5);
+ movq_m2r (*(bot + 24), mm6);
+ movq_m2r (*(top + 24), mm7);
+ pavgb_r2r (mm1, mm0);
+ pavgb_r2r (mm3, mm2);
+ pavgb_r2r (mm5, mm4);
+ pavgb_r2r (mm7, mm6);
+ movntq_r2m (mm0, *out);
+ movntq_r2m (mm2, *(out + 8));
+ movntq_r2m (mm4, *(out + 16));
+ movntq_r2m (mm6, *(out + 24));
+ out += 32;
+ top += 32;
+ bot += 32;
+ }
+ width = (width & 0xf);
+
+ for (i = width / 4; i; --i) {
+ movq_m2r (*bot, mm0);
+ movq_m2r (*top, mm1);
+ pavgb_r2r (mm1, mm0);
+ movntq_r2m (mm0, *out);
+ out += 8;
+ top += 8;
+ bot += 8;
+ }
+ width = width & 0x7;
+
+ /* Handle last few pixels. */
+ for (i = width * 2; i; --i) {
+ *out++ = ((*top++) + (*bot++)) >> 1;
+ }
+
+ emms ();
+}
+
+#endif
+
+G_DEFINE_TYPE (GstDeinterlaceMethodLinear, gst_deinterlace_method_linear,
+ GST_TYPE_DEINTERLACE_SIMPLE_METHOD);
+
+static void
+gst_deinterlace_method_linear_class_init (GstDeinterlaceMethodLinearClass *
+ klass)
+{
+ GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass;
+ GstDeinterlaceSimpleMethodClass *dism_class =
+ (GstDeinterlaceSimpleMethodClass *) klass;
+#ifdef BUILD_X86_ASM
+ guint cpu_flags = oil_cpu_get_flags ();
+#endif
+
+ dim_class->fields_required = 1;
+ dim_class->name = "Television: Full resolution";
+ dim_class->nick = "linear";
+ dim_class->latency = 0;
+
+ dism_class->interpolate_scanline = deinterlace_scanline_linear_c;
+
+#ifdef BUILD_X86_ASM
+ if (cpu_flags & OIL_IMPL_FLAG_MMXEXT) {
+ dism_class->interpolate_scanline = deinterlace_scanline_linear_mmxext;
+ } else if (cpu_flags & OIL_IMPL_FLAG_MMXEXT) {
+ dism_class->interpolate_scanline = deinterlace_scanline_linear_mmx;
+ }
+#endif
+}
+
+static void
+gst_deinterlace_method_linear_init (GstDeinterlaceMethodLinear * self)
+{
+}
diff --git a/gst/deinterlace2/tvtime/linearblend.c b/gst/deinterlace2/tvtime/linearblend.c
new file mode 100644
index 00000000..c25c4d0e
--- /dev/null
+++ b/gst/deinterlace2/tvtime/linearblend.c
@@ -0,0 +1,231 @@
+/**
+ * Linear blend deinterlacing plugin. The idea for this algorithm came
+ * from the linear blend deinterlacer which originated in the mplayer
+ * sources.
+ *
+ * Copyright (C) 2002 Billy Biggs <vektor@dumbterm.net>.
+ * 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 Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "_stdint.h"
+#include "gstdeinterlace2.h"
+#include <string.h>
+
+#define GST_TYPE_DEINTERLACE_METHOD_LINEAR_BLEND (gst_deinterlace_method_linear_blend_get_type ())
+#define GST_IS_DEINTERLACE_METHOD_LINEAR_BLEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEINTERLACE_METHOD_LINEAR_BLEND))
+#define GST_IS_DEINTERLACE_METHOD_LINEAR_BLEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEINTERLACE_METHOD_LINEAR_BLEND))
+#define GST_DEINTERLACE_METHOD_LINEAR_BLEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEINTERLACE_METHOD_LINEAR_BLEND, GstDeinterlaceMethodLinearBlendClass))
+#define GST_DEINTERLACE_METHOD_LINEAR_BLEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEINTERLACE_METHOD_LINEAR_BLEND, GstDeinterlaceMethodLinearBlend))
+#define GST_DEINTERLACE_METHOD_LINEAR_BLEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEINTERLACE_METHOD_LINEAR_BLEND, GstDeinterlaceMethodLinearBlendClass))
+#define GST_DEINTERLACE_METHOD_LINEAR_BLEND_CAST(obj) ((GstDeinterlaceMethodLinearBlend*)(obj))
+
+GType gst_deinterlace_method_linear_blend_get_type (void);
+
+typedef GstDeinterlaceSimpleMethod GstDeinterlaceMethodLinearBlend;
+
+typedef GstDeinterlaceSimpleMethodClass GstDeinterlaceMethodLinearBlendClass;
+
+
+static inline void
+deinterlace_scanline_linear_blend_c (GstDeinterlaceMethod * self,
+ GstDeinterlace2 * parent, guint8 * out,
+ GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ guint8 *t0 = scanlines->t0;
+ guint8 *b0 = scanlines->b0;
+ guint8 *m1 = scanlines->m1;
+
+ width *= 2;
+
+ while (width--) {
+ *out++ = (*t0++ + *b0++ + (*m1++ << 1)) >> 2;
+ }
+}
+
+static inline void
+deinterlace_scanline_linear_blend2_c (GstDeinterlaceMethod * self,
+ GstDeinterlace2 * parent, guint8 * out,
+ GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ guint8 *m0 = scanlines->m0;
+ guint8 *t1 = scanlines->t1;
+ guint8 *b1 = scanlines->b1;
+
+ width *= 2;
+ while (width--) {
+ *out++ = (*t1++ + *b1++ + (*m0++ << 1)) >> 2;
+ }
+}
+
+#ifdef BUILD_X86_ASM
+#include "mmx.h"
+static inline void
+deinterlace_scanline_linear_blend_mmx (GstDeinterlaceMethod * self,
+ GstDeinterlace2 * parent, guint8 * out,
+ GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ guint8 *t0 = scanlines->t0;
+ guint8 *b0 = scanlines->b0;
+ guint8 *m1 = scanlines->m1;
+ gint i;
+
+ // Get width in bytes.
+ width *= 2;
+ i = width / 8;
+ width -= i * 8;
+
+ pxor_r2r (mm7, mm7);
+ while (i--) {
+ movd_m2r (*t0, mm0);
+ movd_m2r (*b0, mm1);
+ movd_m2r (*m1, mm2);
+
+ movd_m2r (*(t0 + 4), mm3);
+ movd_m2r (*(b0 + 4), mm4);
+ movd_m2r (*(m1 + 4), mm5);
+
+ punpcklbw_r2r (mm7, mm0);
+ punpcklbw_r2r (mm7, mm1);
+ punpcklbw_r2r (mm7, mm2);
+
+ punpcklbw_r2r (mm7, mm3);
+ punpcklbw_r2r (mm7, mm4);
+ punpcklbw_r2r (mm7, mm5);
+
+ psllw_i2r (1, mm2);
+ psllw_i2r (1, mm5);
+ paddw_r2r (mm0, mm2);
+ paddw_r2r (mm3, mm5);
+ paddw_r2r (mm1, mm2);
+ paddw_r2r (mm4, mm5);
+ psrlw_i2r (2, mm2);
+ psrlw_i2r (2, mm5);
+ packuswb_r2r (mm2, mm2);
+ packuswb_r2r (mm5, mm5);
+
+ movd_r2m (mm2, *out);
+ movd_r2m (mm5, *(out + 4));
+ out += 8;
+ t0 += 8;
+ b0 += 8;
+ m1 += 8;
+ }
+ while (width--) {
+ *out++ = (*t0++ + *b0++ + (*m1++ << 1)) >> 2;
+ }
+ emms ();
+}
+
+static inline void
+deinterlace_scanline_linear_blend2_mmx (GstDeinterlaceMethod * self,
+ GstDeinterlace2 * parent, guint8 * out,
+ GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ guint8 *m0 = scanlines->m0;
+ guint8 *t1 = scanlines->t1;
+ guint8 *b1 = scanlines->b1;
+ gint i;
+
+ // Get width in bytes.
+ width *= 2;
+ i = width / 8;
+ width -= i * 8;
+
+ pxor_r2r (mm7, mm7);
+ while (i--) {
+ movd_m2r (*t1, mm0);
+ movd_m2r (*b1, mm1);
+ movd_m2r (*m0, mm2);
+
+ movd_m2r (*(t1 + 4), mm3);
+ movd_m2r (*(b1 + 4), mm4);
+ movd_m2r (*(m0 + 4), mm5);
+
+ punpcklbw_r2r (mm7, mm0);
+ punpcklbw_r2r (mm7, mm1);
+ punpcklbw_r2r (mm7, mm2);
+
+ punpcklbw_r2r (mm7, mm3);
+ punpcklbw_r2r (mm7, mm4);
+ punpcklbw_r2r (mm7, mm5);
+
+ psllw_i2r (1, mm2);
+ psllw_i2r (1, mm5);
+ paddw_r2r (mm0, mm2);
+ paddw_r2r (mm3, mm5);
+ paddw_r2r (mm1, mm2);
+ paddw_r2r (mm4, mm5);
+ psrlw_i2r (2, mm2);
+ psrlw_i2r (2, mm5);
+ packuswb_r2r (mm2, mm2);
+ packuswb_r2r (mm5, mm5);
+
+ movd_r2m (mm2, *out);
+ movd_r2m (mm5, *(out + 4));
+ out += 8;
+ t1 += 8;
+ b1 += 8;
+ m0 += 8;
+ }
+ while (width--) {
+ *out++ = (*t1++ + *b1++ + (*m0++ << 1)) >> 2;
+ }
+ emms ();
+}
+
+#endif
+
+G_DEFINE_TYPE (GstDeinterlaceMethodLinearBlend,
+ gst_deinterlace_method_linear_blend, GST_TYPE_DEINTERLACE_SIMPLE_METHOD);
+
+static void
+ gst_deinterlace_method_linear_blend_class_init
+ (GstDeinterlaceMethodLinearBlendClass * klass)
+{
+ GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass;
+ GstDeinterlaceSimpleMethodClass *dism_class =
+ (GstDeinterlaceSimpleMethodClass *) klass;
+#ifdef BUILD_X86_ASM
+ guint cpu_flags = oil_cpu_get_flags ();
+#endif
+
+ dim_class->fields_required = 2;
+ dim_class->name = "Blur: Temporal";
+ dim_class->nick = "linearblend";
+ dim_class->latency = 0;
+
+ dism_class->interpolate_scanline = deinterlace_scanline_linear_blend_c;
+ dism_class->copy_scanline = deinterlace_scanline_linear_blend2_c;
+
+#ifdef BUILD_X86_ASM
+ if (cpu_flags & OIL_IMPL_FLAG_MMX) {
+ dism_class->interpolate_scanline = deinterlace_scanline_linear_blend_mmx;
+ dism_class->copy_scanline = deinterlace_scanline_linear_blend2_mmx;
+ }
+#endif
+}
+
+static void
+gst_deinterlace_method_linear_blend_init (GstDeinterlaceMethodLinearBlend *
+ self)
+{
+}
diff --git a/gst/deinterlace2/tvtime/plugins.h b/gst/deinterlace2/tvtime/plugins.h
index 19d9aed9..8fb01af5 100644
--- a/gst/deinterlace2/tvtime/plugins.h
+++ b/gst/deinterlace2/tvtime/plugins.h
@@ -32,17 +32,23 @@
#define GST_TYPE_DEINTERLACE_GREEDY_H (gst_deinterlace_method_greedy_h_get_type ())
#define GST_TYPE_DEINTERLACE_GREEDY_L (gst_deinterlace_method_greedy_l_get_type ())
#define GST_TYPE_DEINTERLACE_VFIR (gst_deinterlace_method_vfir_get_type ())
+#define GST_TYPE_DEINTERLACE_LINEAR (gst_deinterlace_method_linear_get_type ())
+#define GST_TYPE_DEINTERLACE_LINEAR_BLEND (gst_deinterlace_method_linear_blend_get_type ())
+#define GST_TYPE_DEINTERLACE_SCALER_BOB (gst_deinterlace_method_scaler_bob_get_type ())
+#define GST_TYPE_DEINTERLACE_WEAVE (gst_deinterlace_method_weave_get_type ())
+#define GST_TYPE_DEINTERLACE_WEAVE_TFF (gst_deinterlace_method_weave_tff_get_type ())
+#define GST_TYPE_DEINTERLACE_WEAVE_BFF (gst_deinterlace_method_weave_bff_get_type ())
GType gst_deinterlace_method_tomsmocomp_get_type (void);
GType gst_deinterlace_method_greedy_h_get_type (void);
GType gst_deinterlace_method_greedy_l_get_type (void);
GType gst_deinterlace_method_vfir_get_type (void);
-//void linear_plugin_init( void );
-//void scalerbob_plugin_init( void );
-//void linearblend_plugin_init( void );
-//void weave_plugin_init( void );
-//void weavetff_plugin_init( void );
-//void weavebff_plugin_init( void );
+GType gst_deinterlace_method_linear_get_type (void);
+GType gst_deinterlace_method_linear_blend_get_type (void);
+GType gst_deinterlace_method_scaler_bob_get_type (void);
+GType gst_deinterlace_method_weave_get_type (void);
+GType gst_deinterlace_method_weave_tff_get_type (void);
+GType gst_deinterlace_method_weave_bff_get_type (void);
#endif /* TVTIME_PLUGINS_H_INCLUDED */
diff --git a/gst/deinterlace2/tvtime/scalerbob.c b/gst/deinterlace2/tvtime/scalerbob.c
new file mode 100644
index 00000000..5443b5fe
--- /dev/null
+++ b/gst/deinterlace2/tvtime/scalerbob.c
@@ -0,0 +1,74 @@
+/**
+ * Double lines
+ * Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "_stdint.h"
+#include "gstdeinterlace2.h"
+#include <string.h>
+
+#define GST_TYPE_DEINTERLACE_METHOD_SCALER_BOB (gst_deinterlace_method_scaler_bob_get_type ())
+#define GST_IS_DEINTERLACE_METHOD_SCALER_BOB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEINTERLACE_METHOD_SCALER_BOB))
+#define GST_IS_DEINTERLACE_METHOD_SCALER_BOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEINTERLACE_METHOD_SCALER_BOB))
+#define GST_DEINTERLACE_METHOD_SCALER_BOB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEINTERLACE_METHOD_SCALER_BOB, GstDeinterlaceMethodScalerBobClass))
+#define GST_DEINTERLACE_METHOD_SCALER_BOB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEINTERLACE_METHOD_SCALER_BOB, GstDeinterlaceMethodScalerBob))
+#define GST_DEINTERLACE_METHOD_SCALER_BOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEINTERLACE_METHOD_SCALER_BOB, GstDeinterlaceMethodScalerBobClass))
+#define GST_DEINTERLACE_METHOD_SCALER_BOB_CAST(obj) ((GstDeinterlaceMethodScalerBob*)(obj))
+
+GType gst_deinterlace_method_scaler_bob_get_type (void);
+
+typedef GstDeinterlaceSimpleMethod GstDeinterlaceMethodScalerBob;
+
+typedef GstDeinterlaceSimpleMethodClass GstDeinterlaceMethodScalerBobClass;
+
+
+static void
+deinterlace_scanline_scaler_bob (GstDeinterlaceMethod * self,
+ GstDeinterlace2 * parent, guint8 * out,
+ GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ memcpy (out, scanlines->t0, parent->line_length);
+}
+
+G_DEFINE_TYPE (GstDeinterlaceMethodScalerBob, gst_deinterlace_method_scaler_bob,
+ GST_TYPE_DEINTERLACE_SIMPLE_METHOD);
+
+static void
+gst_deinterlace_method_scaler_bob_class_init (GstDeinterlaceMethodScalerBobClass
+ * klass)
+{
+ GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass;
+ GstDeinterlaceSimpleMethodClass *dism_class =
+ (GstDeinterlaceSimpleMethodClass *) klass;
+
+ dim_class->fields_required = 1;
+ dim_class->name = "Double lines";
+ dim_class->nick = "scalerbob";
+ dim_class->latency = 0;
+
+ dism_class->interpolate_scanline = deinterlace_scanline_scaler_bob;
+}
+
+static void
+gst_deinterlace_method_scaler_bob_init (GstDeinterlaceMethodScalerBob * self)
+{
+}
diff --git a/gst/deinterlace2/tvtime/weave.c b/gst/deinterlace2/tvtime/weave.c
new file mode 100644
index 00000000..b74dcae8
--- /dev/null
+++ b/gst/deinterlace2/tvtime/weave.c
@@ -0,0 +1,82 @@
+/**
+ * Weave frames
+ * Copyright (C) 2002 Billy Biggs <vektor@dumbterm.net>.
+ * Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "_stdint.h"
+#include "gstdeinterlace2.h"
+#include <string.h>
+
+#define GST_TYPE_DEINTERLACE_METHOD_WEAVE (gst_deinterlace_method_weave_get_type ())
+#define GST_IS_DEINTERLACE_METHOD_WEAVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEINTERLACE_METHOD_WEAVE))
+#define GST_IS_DEINTERLACE_METHOD_WEAVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEINTERLACE_METHOD_WEAVE))
+#define GST_DEINTERLACE_METHOD_WEAVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEINTERLACE_METHOD_WEAVE, GstDeinterlaceMethodWeaveClass))
+#define GST_DEINTERLACE_METHOD_WEAVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEINTERLACE_METHOD_WEAVE, GstDeinterlaceMethodWeave))
+#define GST_DEINTERLACE_METHOD_WEAVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEINTERLACE_METHOD_WEAVE, GstDeinterlaceMethodWeaveClass))
+#define GST_DEINTERLACE_METHOD_WEAVE_CAST(obj) ((GstDeinterlaceMethodWeave*)(obj))
+
+GType gst_deinterlace_method_weave_get_type (void);
+
+typedef GstDeinterlaceSimpleMethod GstDeinterlaceMethodWeave;
+
+typedef GstDeinterlaceSimpleMethodClass GstDeinterlaceMethodWeaveClass;
+
+
+static void
+deinterlace_scanline_weave (GstDeinterlaceMethod * self,
+ GstDeinterlace2 * parent, guint8 * out,
+ GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ memcpy (out, scanlines->m1, parent->line_length);
+}
+
+static void
+copy_scanline (GstDeinterlaceMethod * self, GstDeinterlace2 * parent,
+ guint8 * out, GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ memcpy (out, scanlines->m0, parent->line_length);
+}
+
+G_DEFINE_TYPE (GstDeinterlaceMethodWeave, gst_deinterlace_method_weave,
+ GST_TYPE_DEINTERLACE_SIMPLE_METHOD);
+
+static void
+gst_deinterlace_method_weave_class_init (GstDeinterlaceMethodWeaveClass * klass)
+{
+ GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass;
+ GstDeinterlaceSimpleMethodClass *dism_class =
+ (GstDeinterlaceSimpleMethodClass *) klass;
+
+ dim_class->fields_required = 2;
+ dim_class->name = "Weave";
+ dim_class->nick = "weave";
+ dim_class->latency = 0;
+
+ dism_class->interpolate_scanline = deinterlace_scanline_weave;
+ dism_class->copy_scanline = copy_scanline;
+}
+
+static void
+gst_deinterlace_method_weave_init (GstDeinterlaceMethodWeave * self)
+{
+}
diff --git a/gst/deinterlace2/tvtime/weavebff.c b/gst/deinterlace2/tvtime/weavebff.c
new file mode 100644
index 00000000..e96bcd3c
--- /dev/null
+++ b/gst/deinterlace2/tvtime/weavebff.c
@@ -0,0 +1,88 @@
+/**
+ * Weave frames, bottom-field-first.
+ * Copyright (C) 2003 Billy Biggs <vektor@dumbterm.net>.
+ * Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "_stdint.h"
+#include "gstdeinterlace2.h"
+#include <string.h>
+
+#define GST_TYPE_DEINTERLACE_METHOD_WEAVE_BFF (gst_deinterlace_method_weave_bff_get_type ())
+#define GST_IS_DEINTERLACE_METHOD_WEAVE_BFF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEINTERLACE_METHOD_WEAVE_BFF))
+#define GST_IS_DEINTERLACE_METHOD_WEAVE_BFF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEINTERLACE_METHOD_WEAVE_BFF))
+#define GST_DEINTERLACE_METHOD_WEAVE_BFF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEINTERLACE_METHOD_WEAVE_BFF, GstDeinterlaceMethodWeaveBFFClass))
+#define GST_DEINTERLACE_METHOD_WEAVE_BFF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEINTERLACE_METHOD_WEAVE_BFF, GstDeinterlaceMethodWeaveBFF))
+#define GST_DEINTERLACE_METHOD_WEAVE_BFF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEINTERLACE_METHOD_WEAVE_BFF, GstDeinterlaceMethodWeaveBFFClass))
+#define GST_DEINTERLACE_METHOD_WEAVE_BFF_CAST(obj) ((GstDeinterlaceMethodWeaveBFF*)(obj))
+
+GType gst_deinterlace_method_weave_bff_get_type (void);
+
+typedef GstDeinterlaceSimpleMethod GstDeinterlaceMethodWeaveBFF;
+
+typedef GstDeinterlaceSimpleMethodClass GstDeinterlaceMethodWeaveBFFClass;
+
+
+static void
+deinterlace_scanline_weave (GstDeinterlaceMethod * self,
+ GstDeinterlace2 * parent, guint8 * out,
+ GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ memcpy (out, scanlines->m1, parent->line_length);
+}
+
+static void
+copy_scanline (GstDeinterlaceMethod * self, GstDeinterlace2 * parent,
+ guint8 * out, GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ /* FIXME: original code used m2 and m0 but this looks really bad */
+ if (scanlines->bottom_field) {
+ memcpy (out, scanlines->bb2, parent->line_length);
+ } else {
+ memcpy (out, scanlines->bb0, parent->line_length);
+ }
+}
+
+G_DEFINE_TYPE (GstDeinterlaceMethodWeaveBFF, gst_deinterlace_method_weave_bff,
+ GST_TYPE_DEINTERLACE_SIMPLE_METHOD);
+
+static void
+gst_deinterlace_method_weave_bff_class_init (GstDeinterlaceMethodWeaveBFFClass *
+ klass)
+{
+ GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass;
+ GstDeinterlaceSimpleMethodClass *dism_class =
+ (GstDeinterlaceSimpleMethodClass *) klass;
+
+ dim_class->fields_required = 3;
+ dim_class->name = "Progressive: Bottom Field First";
+ dim_class->nick = "weavebff";
+ dim_class->latency = 0;
+
+ dism_class->interpolate_scanline = deinterlace_scanline_weave;
+ dism_class->copy_scanline = copy_scanline;
+}
+
+static void
+gst_deinterlace_method_weave_bff_init (GstDeinterlaceMethodWeaveBFF * self)
+{
+}
diff --git a/gst/deinterlace2/tvtime/weavetff.c b/gst/deinterlace2/tvtime/weavetff.c
new file mode 100644
index 00000000..dec2bc57
--- /dev/null
+++ b/gst/deinterlace2/tvtime/weavetff.c
@@ -0,0 +1,88 @@
+/**
+ * Weave frames, top-field-first.
+ * Copyright (C) 2003 Billy Biggs <vektor@dumbterm.net>.
+ * Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "_stdint.h"
+#include "gstdeinterlace2.h"
+#include <string.h>
+
+#define GST_TYPE_DEINTERLACE_METHOD_WEAVE_TFF (gst_deinterlace_method_weave_tff_get_type ())
+#define GST_IS_DEINTERLACE_METHOD_WEAVE_TFF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEINTERLACE_METHOD_WEAVE_TFF))
+#define GST_IS_DEINTERLACE_METHOD_WEAVE_TFF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEINTERLACE_METHOD_WEAVE_TFF))
+#define GST_DEINTERLACE_METHOD_WEAVE_TFF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEINTERLACE_METHOD_WEAVE_TFF, GstDeinterlaceMethodWeaveTFFClass))
+#define GST_DEINTERLACE_METHOD_WEAVE_TFF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEINTERLACE_METHOD_WEAVE_TFF, GstDeinterlaceMethodWeaveTFF))
+#define GST_DEINTERLACE_METHOD_WEAVE_TFF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEINTERLACE_METHOD_WEAVE_TFF, GstDeinterlaceMethodWeaveTFFClass))
+#define GST_DEINTERLACE_METHOD_WEAVE_TFF_CAST(obj) ((GstDeinterlaceMethodWeaveTFF*)(obj))
+
+GType gst_deinterlace_method_weave_tff_get_type (void);
+
+typedef GstDeinterlaceSimpleMethod GstDeinterlaceMethodWeaveTFF;
+
+typedef GstDeinterlaceSimpleMethodClass GstDeinterlaceMethodWeaveTFFClass;
+
+
+static void
+deinterlace_scanline_weave (GstDeinterlaceMethod * self,
+ GstDeinterlace2 * parent, guint8 * out,
+ GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ memcpy (out, scanlines->m1, parent->line_length);
+}
+
+static void
+copy_scanline (GstDeinterlaceMethod * self, GstDeinterlace2 * parent,
+ guint8 * out, GstDeinterlaceScanlineData * scanlines, gint width)
+{
+ /* FIXME: original code used m2 and m0 but this looks really bad */
+ if (scanlines->bottom_field) {
+ memcpy (out, scanlines->bb0, parent->line_length);
+ } else {
+ memcpy (out, scanlines->bb2, parent->line_length);
+ }
+}
+
+G_DEFINE_TYPE (GstDeinterlaceMethodWeaveTFF, gst_deinterlace_method_weave_tff,
+ GST_TYPE_DEINTERLACE_SIMPLE_METHOD);
+
+static void
+gst_deinterlace_method_weave_tff_class_init (GstDeinterlaceMethodWeaveTFFClass *
+ klass)
+{
+ GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass;
+ GstDeinterlaceSimpleMethodClass *dism_class =
+ (GstDeinterlaceSimpleMethodClass *) klass;
+
+ dim_class->fields_required = 3;
+ dim_class->name = "Progressive: Top Field First";
+ dim_class->nick = "weavetff";
+ dim_class->latency = 0;
+
+ dism_class->interpolate_scanline = deinterlace_scanline_weave;
+ dism_class->copy_scanline = copy_scanline;
+}
+
+static void
+gst_deinterlace_method_weave_tff_init (GstDeinterlaceMethodWeaveTFF * self)
+{
+}