/*
* GStreamer
* Copyright (C) 2005 Martin Eikermann <meiker@upb.de>
- * Copyright (C) 2008 Sebastian Dröge <slomo@collabora.co.uk>
+ * Copyright (C) 2008-2009 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
GstDeinterlace2 * parent, guint8 * out,
GstDeinterlaceScanlineData * scanlines, gint width)
{
- oil_memcpy (out, scanlines->m1, parent->line_length);
+ oil_memcpy (out, scanlines->m1, parent->row_stride);
}
static void
GstDeinterlace2 * parent, guint8 * out,
GstDeinterlaceScanlineData * scanlines, gint width)
{
- oil_memcpy (out, scanlines->m0, parent->line_length);
+ oil_memcpy (out, scanlines->m0, parent->row_stride);
}
static void
if (cur_field_flags == PICTURE_INTERLACED_BOTTOM) {
/* double the first scanline of the bottom field */
- oil_memcpy (out, field0, parent->line_length);
- out += parent->output_stride;
+ oil_memcpy (out, field0, parent->row_stride);
+ out += parent->row_stride;
}
- oil_memcpy (out, field0, parent->line_length);
- out += parent->output_stride;
+ oil_memcpy (out, field0, parent->row_stride);
+ out += parent->row_stride;
for (line = 2; line <= parent->field_height; line++) {
dsm_class->interpolate_scanline (self, parent, out, &scanlines,
parent->frame_width);
- out += parent->output_stride;
+ out += parent->row_stride;
memset (&scanlines, 0, sizeof (scanlines));
scanlines.bottom_field = (cur_field_flags == PICTURE_INTERLACED_BOTTOM);
dsm_class->copy_scanline (self, parent, out, &scanlines,
parent->frame_width);
- out += parent->output_stride;
+ out += parent->row_stride;
}
if (cur_field_flags == PICTURE_INTERLACED_TOP) {
/* double the last scanline of the top field */
- oil_memcpy (out, field0, parent->line_length);
+ oil_memcpy (out, field0, parent->row_stride);
}
}
static void
gst_deinterlace2_reset (GstDeinterlace2 * self)
{
- self->output_stride = 0;
- self->line_length = 0;
+ self->row_stride = 0;
self->frame_width = 0;
self->frame_height = 0;
self->frame_rate_n = 0;
GST_DEBUG ("Top field first");
field1 = gst_buffer_ref (buffer);
field1_flags = PICTURE_INTERLACED_TOP;
- field2 = gst_buffer_create_sub (buffer, self->line_length,
- GST_BUFFER_SIZE (buffer) - self->line_length);
+ field2 = gst_buffer_create_sub (buffer, self->row_stride,
+ GST_BUFFER_SIZE (buffer) - self->row_stride);
field2_flags = PICTURE_INTERLACED_BOTTOM;
} else {
GST_DEBUG ("Bottom field first");
- field1 = gst_buffer_create_sub (buffer, self->line_length,
- GST_BUFFER_SIZE (buffer) - self->line_length);
+ field1 = gst_buffer_create_sub (buffer, self->row_stride,
+ GST_BUFFER_SIZE (buffer) - self->row_stride);
field1_flags = PICTURE_INTERLACED_BOTTOM;
field2 = gst_buffer_ref (buffer);
field2_flags = PICTURE_INTERLACED_TOP;
goto caps_not_accepted;
gst_caps_unref (othercaps);
- /* TODO: introduce self->field_stride */
self->field_height = self->frame_height / 2;
fmt = gst_video_format_from_fourcc (fourcc);
change when the buffer-fields concept has landed */
self->field_stride =
gst_video_format_get_row_stride (fmt, 0, self->frame_width) * 2;
- self->output_stride =
- gst_video_format_get_row_stride (fmt, 0, self->frame_width);
/* in bytes */
- self->line_length =
+ self->row_stride =
gst_video_format_get_row_stride (fmt, 0, self->frame_width);
self->frame_size =
gst_video_format_get_size (fmt, self->frame_width, self->frame_height);
/*
* GStreamer
* Copyright (C) 2005 Martin Eikermann <meiker@upb.de>
- * Copyright (C) 2008 Sebastian Dröge <slomo@collabora.co.uk>
+ * Copyright (C) 2008-2009 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
GST_DEINTERLACE2_LAYOUT_BFF
} GstDeinterlace2FieldLayout;
+typedef enum {
+ GST_DEINTERLACE2_MODE_AUTO,
+ GST_DEINTERLACE2_MODE_INTERLACED
+} GstDeinterlace2Mode;
+
struct _GstDeinterlace2
{
GstElement parent;
GstPad *srcpad, *sinkpad;
+ GstDeinterlace2Mode mode;
+
GstDeinterlace2FieldLayout field_layout;
guint frame_size;
GstPicture field_history[MAX_FIELD_HISTORY];
guint history_count;
- /* Overlay pitch (number of bytes between scanlines). */
- guint output_stride;
-
/* Number of bytes of actual data in each scanline. May be less than
OverlayPitch since the overlay's scanlines might have alignment
requirements. Generally equal to FrameWidth * 2.
*/
- guint line_length;
+ guint row_stride;
/* Number of pixels in each scanline. */
gint frame_width;
GST_BUFFER_DATA (object->field_history[object->history_count - 3].buf);
// copy first even line
- oil_memcpy (Dest, L1, object->line_length);
- Dest += object->output_stride;
+ oil_memcpy (Dest, L1, object->row_stride);
+ Dest += object->row_stride;
} else {
InfoIsOdd = 0;
L1 = GST_BUFFER_DATA (object->field_history[object->history_count - 2].buf);
// copy first even line
oil_memcpy (Dest, GST_BUFFER_DATA (object->field_history[0].buf),
- object->line_length);
- Dest += object->output_stride;
+ object->row_stride);
+ Dest += object->row_stride;
// then first odd line
- oil_memcpy (Dest, L1, object->line_length);
- Dest += object->output_stride;
+ oil_memcpy (Dest, L1, object->row_stride);
+ Dest += object->row_stride;
}
for (Line = 0; Line < (object->field_height - 1); ++Line) {
- klass->scanline (self, L2, L1, L3, L2P, Dest, object->line_length);
- Dest += object->output_stride;
- oil_memcpy (Dest, L3, object->line_length);
- Dest += object->output_stride;
+ klass->scanline (self, L2, L1, L3, L2P, Dest, object->row_stride);
+ Dest += object->row_stride;
+ oil_memcpy (Dest, L3, object->row_stride);
+ Dest += object->row_stride;
L1 += Pitch;
L2 += Pitch;
}
if (InfoIsOdd) {
- oil_memcpy (Dest, L2, object->line_length);
+ oil_memcpy (Dest, L2, object->row_stride);
}
}
GST_BUFFER_DATA (object->field_history[object->history_count - 3].buf);
// copy first even line
- oil_memcpy (Dest, L1, object->line_length);
- Dest += object->output_stride;
+ oil_memcpy (Dest, L1, object->row_stride);
+ Dest += object->row_stride;
} else {
InfoIsOdd = 0;
L1 = GST_BUFFER_DATA (object->field_history[object->history_count - 2].buf);
// copy first even line
oil_memcpy (Dest, GST_BUFFER_DATA (object->field_history[0].buf),
- object->line_length);
- Dest += object->output_stride;
+ object->row_stride);
+ Dest += object->row_stride;
// then first odd line
- oil_memcpy (Dest, L1, object->line_length);
- Dest += object->output_stride;
+ oil_memcpy (Dest, L1, object->row_stride);
+ Dest += object->row_stride;
}
for (Line = 0; Line < (object->field_height - 1); ++Line) {
- klass->scanline (self, L1, L2, L3, L2P, Dest, object->line_length);
- Dest += object->output_stride;
- oil_memcpy (Dest, L3, object->line_length);
- Dest += object->output_stride;
+ klass->scanline (self, L1, L2, L3, L2P, Dest, object->row_stride);
+ Dest += object->row_stride;
+ oil_memcpy (Dest, L3, object->row_stride);
+ Dest += object->row_stride;
L1 += Pitch;
L2 += Pitch;
}
if (InfoIsOdd) {
- oil_memcpy (Dest, L2, object->line_length);
+ oil_memcpy (Dest, L2, object->row_stride);
}
}
GstDeinterlace2 * parent, guint8 * out,
GstDeinterlaceScanlineData * scanlines, gint width)
{
- oil_memcpy (out, scanlines->t0, parent->line_length);
+ oil_memcpy (out, scanlines->t0, parent->row_stride);
}
G_DEFINE_TYPE (GstDeinterlaceMethodScalerBob, gst_deinterlace_method_scaler_bob,
/* double stride do address just every odd/even scanline */
src_pitch = object->field_stride;
- dst_pitch = object->output_stride;
- rowsize = object->line_length;
+ dst_pitch = object->row_stride;
+ rowsize = object->row_stride;
FldHeight = object->field_height;
pCopySrc = GST_BUFFER_DATA(object->field_history[object->history_count-1].buf);
GstDeinterlace2 * parent, guint8 * out,
GstDeinterlaceScanlineData * scanlines, gint width)
{
- oil_memcpy (out, scanlines->m1, parent->line_length);
+ oil_memcpy (out, scanlines->m1, parent->row_stride);
}
static void
copy_scanline (GstDeinterlaceMethod * self, GstDeinterlace2 * parent,
guint8 * out, GstDeinterlaceScanlineData * scanlines, gint width)
{
- oil_memcpy (out, scanlines->m0, parent->line_length);
+ oil_memcpy (out, scanlines->m0, parent->row_stride);
}
G_DEFINE_TYPE (GstDeinterlaceMethodWeave, gst_deinterlace_method_weave,
GstDeinterlace2 * parent, guint8 * out,
GstDeinterlaceScanlineData * scanlines, gint width)
{
- oil_memcpy (out, scanlines->m1, parent->line_length);
+ oil_memcpy (out, scanlines->m1, parent->row_stride);
}
static void
{
/* FIXME: original code used m2 and m0 but this looks really bad */
if (scanlines->bottom_field) {
- oil_memcpy (out, scanlines->bb2, parent->line_length);
+ oil_memcpy (out, scanlines->bb2, parent->row_stride);
} else {
- oil_memcpy (out, scanlines->bb0, parent->line_length);
+ oil_memcpy (out, scanlines->bb0, parent->row_stride);
}
}
GstDeinterlace2 * parent, guint8 * out,
GstDeinterlaceScanlineData * scanlines, gint width)
{
- oil_memcpy (out, scanlines->m1, parent->line_length);
+ oil_memcpy (out, scanlines->m1, parent->row_stride);
}
static void
{
/* FIXME: original code used m2 and m0 but this looks really bad */
if (scanlines->bottom_field) {
- oil_memcpy (out, scanlines->bb0, parent->line_length);
+ oil_memcpy (out, scanlines->bb0, parent->row_stride);
} else {
- oil_memcpy (out, scanlines->bb2, parent->line_length);
+ oil_memcpy (out, scanlines->bb2, parent->row_stride);
}
}