gst/deinterlace2/: Add the remaining tvtime deinterlacing methods and fix the deinterlace_frame() implementation of G...

Original commit message from CVS:
* gst/deinterlace2/Makefile.am:
* gst/deinterlace2/gstdeinterlace2.c:
(gst_deinterlace_simple_method_deinterlace_frame),
(gst_deinterlace2_methods_get_type), (gst_deinterlace2_set_method):
* gst/deinterlace2/gstdeinterlace2.h:
* gst/deinterlace2/tvtime/linear.c:
(deinterlace_scanline_linear_c), (deinterlace_scanline_linear_mmx),
(deinterlace_scanline_linear_mmxext),
(gst_deinterlace_method_linear_class_init),
(gst_deinterlace_method_linear_init):
* gst/deinterlace2/tvtime/linearblend.c:
(deinterlace_scanline_linear_blend_c),
(deinterlace_scanline_linear_blend2_c),
(deinterlace_scanline_linear_blend_mmx),
(deinterlace_scanline_linear_blend2_mmx),
(gst_deinterlace_method_linear_blend_class_init),
(gst_deinterlace_method_linear_blend_init):
* gst/deinterlace2/tvtime/plugins.h:
* gst/deinterlace2/tvtime/scalerbob.c:
(deinterlace_scanline_scaler_bob),
(gst_deinterlace_method_scaler_bob_class_init),
(gst_deinterlace_method_scaler_bob_init):
* gst/deinterlace2/tvtime/weave.c: (deinterlace_scanline_weave),
(copy_scanline), (gst_deinterlace_method_weave_class_init),
(gst_deinterlace_method_weave_init):
* gst/deinterlace2/tvtime/weavebff.c: (deinterlace_scanline_weave),
(copy_scanline), (gst_deinterlace_method_weave_bff_class_init),
(gst_deinterlace_method_weave_bff_init):
* gst/deinterlace2/tvtime/weavetff.c: (deinterlace_scanline_weave),
(copy_scanline), (gst_deinterlace_method_weave_tff_class_init),
(gst_deinterlace_method_weave_tff_init):
Add the remaining tvtime deinterlacing methods and fix the
deinterlace_frame() implementation of GstDeinterlaceSimpleMethod.
This commit is contained in:
Sebastian Dröge 2008-08-02 18:36:11 +00:00
parent cf6cde0d6d
commit cedd09c9ff
11 changed files with 872 additions and 18 deletions

View file

@ -1,3 +1,39 @@
2008-08-02 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/deinterlace2/Makefile.am:
* gst/deinterlace2/gstdeinterlace2.c:
(gst_deinterlace_simple_method_deinterlace_frame),
(gst_deinterlace2_methods_get_type), (gst_deinterlace2_set_method):
* gst/deinterlace2/gstdeinterlace2.h:
* gst/deinterlace2/tvtime/linear.c:
(deinterlace_scanline_linear_c), (deinterlace_scanline_linear_mmx),
(deinterlace_scanline_linear_mmxext),
(gst_deinterlace_method_linear_class_init),
(gst_deinterlace_method_linear_init):
* gst/deinterlace2/tvtime/linearblend.c:
(deinterlace_scanline_linear_blend_c),
(deinterlace_scanline_linear_blend2_c),
(deinterlace_scanline_linear_blend_mmx),
(deinterlace_scanline_linear_blend2_mmx),
(gst_deinterlace_method_linear_blend_class_init),
(gst_deinterlace_method_linear_blend_init):
* gst/deinterlace2/tvtime/plugins.h:
* gst/deinterlace2/tvtime/scalerbob.c:
(deinterlace_scanline_scaler_bob),
(gst_deinterlace_method_scaler_bob_class_init),
(gst_deinterlace_method_scaler_bob_init):
* gst/deinterlace2/tvtime/weave.c: (deinterlace_scanline_weave),
(copy_scanline), (gst_deinterlace_method_weave_class_init),
(gst_deinterlace_method_weave_init):
* gst/deinterlace2/tvtime/weavebff.c: (deinterlace_scanline_weave),
(copy_scanline), (gst_deinterlace_method_weave_bff_class_init),
(gst_deinterlace_method_weave_bff_init):
* gst/deinterlace2/tvtime/weavetff.c: (deinterlace_scanline_weave),
(copy_scanline), (gst_deinterlace_method_weave_tff_class_init),
(gst_deinterlace_method_weave_tff_init):
Add the remaining tvtime deinterlacing methods and fix the
deinterlace_frame() implementation of GstDeinterlaceSimpleMethod.
2008-08-02 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/deinterlace2/tvtime/vfir.c: (deinterlace_line_c),

View file

@ -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)

View file

@ -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;

View file

@ -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

View file

@ -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)
{
}

View file

@ -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)
{
}

View file

@ -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 */

View file

@ -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)
{
}

View file

@ -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)
{
}

View file

@ -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)
{
}

View file

@ -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)
{
}