deinterlace: Port to 1.0

This requires the additional INTERLACED buffer flag recently added to
-base
This commit is contained in:
Robert Swain 2012-07-19 14:55:45 +02:00
parent ec7f7264dc
commit eac172c433
6 changed files with 478 additions and 432 deletions

File diff suppressed because it is too large Load diff

View file

@ -24,6 +24,7 @@
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include <gst/video/gstvideofilter.h>
#include "gstdeinterlacemethod.h" #include "gstdeinterlacemethod.h"
@ -129,11 +130,15 @@ struct _GstDeinterlace
GstDeinterlaceMethods user_set_method_id; GstDeinterlaceMethods user_set_method_id;
GstDeinterlaceMethod *method; GstDeinterlaceMethod *method;
GstVideoInfo vinfo;
#if 0
GstVideoFormat format; GstVideoFormat format;
gint width, height; /* frame width & height */ gint width, height; /* frame width & height */
guint frame_size; /* frame size in bytes */ guint frame_size; /* frame size in bytes */
gint fps_n, fps_d; /* frame rate */ gint fps_n, fps_d; /* frame rate */
gboolean interlaced; /* is input interlaced? */ gboolean interlaced; /* is input interlaced? */
#endif
gboolean passthrough; gboolean passthrough;

View file

@ -95,40 +95,36 @@ gst_deinterlace_method_supported_impl (GstDeinterlaceMethodClass * klass,
} }
void void
gst_deinterlace_method_setup (GstDeinterlaceMethod * self, gst_deinterlace_method_setup (GstDeinterlaceMethod * self, GstVideoInfo * vinfo)
GstVideoFormat format, gint width, gint height)
{ {
GstDeinterlaceMethodClass *klass = GST_DEINTERLACE_METHOD_GET_CLASS (self); GstDeinterlaceMethodClass *klass = GST_DEINTERLACE_METHOD_GET_CLASS (self);
klass->setup (self, format, width, height); klass->setup (self, vinfo);
} }
static void static void
gst_deinterlace_method_setup_impl (GstDeinterlaceMethod * self, gst_deinterlace_method_setup_impl (GstDeinterlaceMethod * self,
GstVideoFormat format, gint width, gint height) GstVideoInfo * vinfo)
{ {
gint i; gint i;
GstDeinterlaceMethodClass *klass = GST_DEINTERLACE_METHOD_GET_CLASS (self); GstDeinterlaceMethodClass *klass = GST_DEINTERLACE_METHOD_GET_CLASS (self);
self->format = format; self->vinfo = vinfo;
self->frame_width = width;
self->frame_height = height;
self->deinterlace_frame = NULL; self->deinterlace_frame = NULL;
if (format == GST_VIDEO_FORMAT_UNKNOWN) if (GST_VIDEO_INFO_FORMAT (self->vinfo) == GST_VIDEO_FORMAT_UNKNOWN)
return; return;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
self->width[i] = gst_video_format_get_component_width (format, i, width); self->width[i] = GST_VIDEO_INFO_COMP_WIDTH (vinfo, i);
self->height[i] = gst_video_format_get_component_height (format, i, height); self->height[i] = GST_VIDEO_INFO_COMP_HEIGHT (vinfo, i);
self->offset[i] = self->offset[i] = GST_VIDEO_INFO_COMP_OFFSET (vinfo, i);
gst_video_format_get_component_offset (format, i, width, height); self->row_stride[i] = GST_VIDEO_INFO_COMP_STRIDE (vinfo, i);
self->row_stride[i] = gst_video_format_get_row_stride (format, i, width); self->pixel_stride[i] = GST_VIDEO_INFO_COMP_PSTRIDE (vinfo, i);
self->pixel_stride[i] = gst_video_format_get_pixel_stride (format, i);
} }
switch (format) { switch (GST_VIDEO_INFO_FORMAT (self->vinfo)) {
case GST_VIDEO_FORMAT_YUY2: case GST_VIDEO_FORMAT_YUY2:
self->deinterlace_frame = klass->deinterlace_frame_yuy2; self->deinterlace_frame = klass->deinterlace_frame_yuy2;
break; break;
@ -200,16 +196,17 @@ gst_deinterlace_method_class_init (GstDeinterlaceMethodClass * klass)
static void static void
gst_deinterlace_method_init (GstDeinterlaceMethod * self) gst_deinterlace_method_init (GstDeinterlaceMethod * self)
{ {
self->format = GST_VIDEO_FORMAT_UNKNOWN; self->vinfo = NULL;
} }
void void
gst_deinterlace_method_deinterlace_frame (GstDeinterlaceMethod * self, gst_deinterlace_method_deinterlace_frame (GstDeinterlaceMethod * self,
const GstDeinterlaceField * history, guint history_count, const GstDeinterlaceField * history, guint history_count,
GstBuffer * outbuf, int cur_field_idx) GstVideoFrame * outframe, int cur_field_idx)
{ {
g_assert (self->deinterlace_frame != NULL); g_assert (self->deinterlace_frame != NULL);
self->deinterlace_frame (self, history, history_count, outbuf, cur_field_idx); self->deinterlace_frame (self, history, history_count, outframe,
cur_field_idx);
} }
gint gint
@ -318,7 +315,7 @@ gst_deinterlace_simple_method_copy_scanline_packed (GstDeinterlaceSimpleMethod *
static void static void
gst_deinterlace_simple_method_deinterlace_frame_packed (GstDeinterlaceMethod * gst_deinterlace_simple_method_deinterlace_frame_packed (GstDeinterlaceMethod *
method, const GstDeinterlaceField * history, guint history_count, method, const GstDeinterlaceField * history, guint history_count,
GstBuffer * outbuf, gint cur_field_idx) GstVideoFrame * outframe, gint cur_field_idx)
{ {
GstDeinterlaceSimpleMethod *self = GST_DEINTERLACE_SIMPLE_METHOD (method); GstDeinterlaceSimpleMethod *self = GST_DEINTERLACE_SIMPLE_METHOD (method);
GstDeinterlaceMethodClass *dm_class = GST_DEINTERLACE_METHOD_GET_CLASS (self); GstDeinterlaceMethodClass *dm_class = GST_DEINTERLACE_METHOD_GET_CLASS (self);
@ -327,31 +324,32 @@ gst_deinterlace_simple_method_deinterlace_frame_packed (GstDeinterlaceMethod *
const guint8 *field0, *field1, *field2, *fieldp; const guint8 *field0, *field1, *field2, *fieldp;
guint cur_field_flags = history[cur_field_idx].flags; guint cur_field_flags = history[cur_field_idx].flags;
gint i; gint i;
gint frame_height = self->parent.frame_height; gint frame_height = GST_VIDEO_INFO_HEIGHT (self->parent.vinfo);
gint stride = self->parent.row_stride[0]; gint stride = self->parent.row_stride[0];
g_assert (self->interpolate_scanline_packed != NULL); g_assert (self->interpolate_scanline_packed != NULL);
g_assert (self->copy_scanline_packed != NULL); g_assert (self->copy_scanline_packed != NULL);
if (cur_field_idx > 0) { if (cur_field_idx > 0) {
fieldp = GST_BUFFER_DATA (history[cur_field_idx - 1].buf); fieldp = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx - 1].frame, 0);
} else { } else {
fieldp = NULL; fieldp = NULL;
} }
dest = GST_BUFFER_DATA (outbuf); dest = GST_VIDEO_FRAME_COMP_DATA (outframe, 0);
field0 = GST_BUFFER_DATA (history[cur_field_idx].buf);
field0 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx].frame, 0);
g_assert (dm_class->fields_required <= 4); g_assert (dm_class->fields_required <= 4);
if (cur_field_idx + 1 < history_count) { if (cur_field_idx + 1 < history_count) {
field1 = GST_BUFFER_DATA (history[cur_field_idx + 1].buf); field1 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx + 1].frame, 0);
} else { } else {
field1 = NULL; field1 = NULL;
} }
if (cur_field_idx + 2 < history_count) { if (cur_field_idx + 2 < history_count) {
field2 = GST_BUFFER_DATA (history[cur_field_idx + 2].buf); field2 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx + 2].frame, 0);
} else { } else {
field2 = NULL; field2 = NULL;
} }
@ -509,14 +507,14 @@ static void
static void static void
gst_deinterlace_simple_method_deinterlace_frame_planar (GstDeinterlaceMethod * gst_deinterlace_simple_method_deinterlace_frame_planar (GstDeinterlaceMethod *
method, const GstDeinterlaceField * history, guint history_count, method, const GstDeinterlaceField * history, guint history_count,
GstBuffer * outbuf, gint cur_field_idx) GstVideoFrame * outframe, gint cur_field_idx)
{ {
GstDeinterlaceSimpleMethod *self = GST_DEINTERLACE_SIMPLE_METHOD (method); GstDeinterlaceSimpleMethod *self = GST_DEINTERLACE_SIMPLE_METHOD (method);
GstDeinterlaceMethodClass *dm_class = GST_DEINTERLACE_METHOD_GET_CLASS (self); GstDeinterlaceMethodClass *dm_class = GST_DEINTERLACE_METHOD_GET_CLASS (self);
guint8 *out; guint8 *out;
const guint8 *field0, *field1, *field2, *fieldp; const guint8 *field0, *field1, *field2, *fieldp;
guint cur_field_flags = history[cur_field_idx].flags; guint cur_field_flags = history[cur_field_idx].flags;
gint i, offset; gint i;
GstDeinterlaceSimpleMethodFunction copy_scanline; GstDeinterlaceSimpleMethodFunction copy_scanline;
GstDeinterlaceSimpleMethodFunction interpolate_scanline; GstDeinterlaceSimpleMethodFunction interpolate_scanline;
@ -528,29 +526,28 @@ gst_deinterlace_simple_method_deinterlace_frame_planar (GstDeinterlaceMethod *
g_assert (self->copy_scanline_planar[2] != NULL); g_assert (self->copy_scanline_planar[2] != NULL);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
offset = self->parent.offset[i];
copy_scanline = self->copy_scanline_planar[i]; copy_scanline = self->copy_scanline_planar[i];
interpolate_scanline = self->interpolate_scanline_planar[i]; interpolate_scanline = self->interpolate_scanline_planar[i];
out = GST_BUFFER_DATA (outbuf) + offset; out = GST_VIDEO_FRAME_PLANE_DATA (outframe, i);
fieldp = NULL; fieldp = NULL;
if (cur_field_idx > 0) { if (cur_field_idx > 0) {
fieldp = GST_BUFFER_DATA (history[cur_field_idx - 1].buf) + offset; fieldp = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx - 1].frame, i);
} }
field0 = GST_BUFFER_DATA (history[cur_field_idx].buf) + offset; field0 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx].frame, i);
g_assert (dm_class->fields_required <= 4); g_assert (dm_class->fields_required <= 4);
field1 = NULL; field1 = NULL;
if (cur_field_idx + 1 < history_count) { if (cur_field_idx + 1 < history_count) {
field1 = GST_BUFFER_DATA (history[cur_field_idx + 1].buf) + offset; field1 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx + 1].frame, i);
} }
field2 = NULL; field2 = NULL;
if (cur_field_idx + 2 < history_count) { if (cur_field_idx + 2 < history_count) {
field2 = GST_BUFFER_DATA (history[cur_field_idx + 2].buf) + offset; field2 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx + 2].frame, i);
} }
gst_deinterlace_simple_method_deinterlace_frame_planar_plane (self, out, gst_deinterlace_simple_method_deinterlace_frame_planar_plane (self, out,
@ -562,40 +559,38 @@ gst_deinterlace_simple_method_deinterlace_frame_planar (GstDeinterlaceMethod *
static void static void
gst_deinterlace_simple_method_deinterlace_frame_nv12 (GstDeinterlaceMethod * gst_deinterlace_simple_method_deinterlace_frame_nv12 (GstDeinterlaceMethod *
method, const GstDeinterlaceField * history, guint history_count, method, const GstDeinterlaceField * history, guint history_count,
GstBuffer * outbuf, gint cur_field_idx) GstVideoFrame * outframe, gint cur_field_idx)
{ {
GstDeinterlaceSimpleMethod *self = GST_DEINTERLACE_SIMPLE_METHOD (method); GstDeinterlaceSimpleMethod *self = GST_DEINTERLACE_SIMPLE_METHOD (method);
GstDeinterlaceMethodClass *dm_class = GST_DEINTERLACE_METHOD_GET_CLASS (self); GstDeinterlaceMethodClass *dm_class = GST_DEINTERLACE_METHOD_GET_CLASS (self);
guint8 *out; guint8 *out;
const guint8 *field0, *field1, *field2, *fieldp; const guint8 *field0, *field1, *field2, *fieldp;
guint cur_field_flags = history[cur_field_idx].flags; guint cur_field_flags = history[cur_field_idx].flags;
gint i, offset; gint i;
g_assert (self->interpolate_scanline_packed != NULL); g_assert (self->interpolate_scanline_packed != NULL);
g_assert (self->copy_scanline_packed != NULL); g_assert (self->copy_scanline_packed != NULL);
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
offset = self->parent.offset[i]; out = GST_VIDEO_FRAME_PLANE_DATA (outframe, i);
out = GST_BUFFER_DATA (outbuf) + offset;
fieldp = NULL; fieldp = NULL;
if (cur_field_idx > 0) { if (cur_field_idx > 0) {
fieldp = GST_BUFFER_DATA (history[cur_field_idx - 1].buf) + offset; fieldp = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx - 1].frame, i);
} }
field0 = GST_BUFFER_DATA (history[cur_field_idx].buf) + offset; field0 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx].frame, i);
g_assert (dm_class->fields_required <= 4); g_assert (dm_class->fields_required <= 4);
field1 = NULL; field1 = NULL;
if (cur_field_idx + 1 < history_count) { if (cur_field_idx + 1 < history_count) {
field1 = GST_BUFFER_DATA (history[cur_field_idx + 1].buf) + offset; field1 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx + 1].frame, i);
} }
field2 = NULL; field2 = NULL;
if (cur_field_idx + 2 < history_count) { if (cur_field_idx + 2 < history_count) {
field2 = GST_BUFFER_DATA (history[cur_field_idx + 2].buf) + offset; field2 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx + 2].frame, i);
} }
gst_deinterlace_simple_method_deinterlace_frame_planar_plane (self, out, gst_deinterlace_simple_method_deinterlace_frame_planar_plane (self, out,
@ -606,15 +601,14 @@ gst_deinterlace_simple_method_deinterlace_frame_nv12 (GstDeinterlaceMethod *
static void static void
gst_deinterlace_simple_method_setup (GstDeinterlaceMethod * method, gst_deinterlace_simple_method_setup (GstDeinterlaceMethod * method,
GstVideoFormat format, gint width, gint height) GstVideoInfo * vinfo)
{ {
GstDeinterlaceSimpleMethod *self = GST_DEINTERLACE_SIMPLE_METHOD (method); GstDeinterlaceSimpleMethod *self = GST_DEINTERLACE_SIMPLE_METHOD (method);
GstDeinterlaceSimpleMethodClass *klass = GstDeinterlaceSimpleMethodClass *klass =
GST_DEINTERLACE_SIMPLE_METHOD_GET_CLASS (self); GST_DEINTERLACE_SIMPLE_METHOD_GET_CLASS (self);
GST_DEINTERLACE_METHOD_CLASS GST_DEINTERLACE_METHOD_CLASS
(gst_deinterlace_simple_method_parent_class)->setup (method, format, (gst_deinterlace_simple_method_parent_class)->setup (method, vinfo);
width, height);
self->interpolate_scanline_packed = NULL; self->interpolate_scanline_packed = NULL;
self->copy_scanline_packed = NULL; self->copy_scanline_packed = NULL;
@ -626,10 +620,10 @@ gst_deinterlace_simple_method_setup (GstDeinterlaceMethod * method,
self->copy_scanline_planar[1] = NULL; self->copy_scanline_planar[1] = NULL;
self->copy_scanline_planar[2] = NULL; self->copy_scanline_planar[2] = NULL;
if (format == GST_VIDEO_FORMAT_UNKNOWN) if (GST_VIDEO_INFO_FORMAT (vinfo) == GST_VIDEO_FORMAT_UNKNOWN)
return; return;
switch (format) { switch (GST_VIDEO_INFO_FORMAT (vinfo)) {
case GST_VIDEO_FORMAT_YUY2: case GST_VIDEO_FORMAT_YUY2:
self->interpolate_scanline_packed = klass->interpolate_scanline_yuy2; self->interpolate_scanline_packed = klass->interpolate_scanline_yuy2;
self->copy_scanline_packed = klass->copy_scanline_yuy2; self->copy_scanline_packed = klass->copy_scanline_yuy2;

View file

@ -51,8 +51,7 @@ typedef struct _GstDeinterlaceMethodClass GstDeinterlaceMethodClass;
typedef struct typedef struct
{ {
/* pointer to the start of data for this field */ GstVideoFrame *frame;
GstBuffer *buf;
/* see PICTURE_ flags in *.c */ /* see PICTURE_ flags in *.c */
guint flags; guint flags;
} GstDeinterlaceField; } GstDeinterlaceField;
@ -63,13 +62,13 @@ typedef struct
typedef void (*GstDeinterlaceMethodDeinterlaceFunction) ( typedef void (*GstDeinterlaceMethodDeinterlaceFunction) (
GstDeinterlaceMethod *self, const GstDeinterlaceField *history, GstDeinterlaceMethod *self, const GstDeinterlaceField *history,
guint history_count, GstBuffer *outbuf, int cur_field_idx); guint history_count, GstVideoFrame *outframe, int cur_field_idx);
struct _GstDeinterlaceMethod { struct _GstDeinterlaceMethod {
GstObject parent; GstObject parent;
GstVideoFormat format; GstVideoInfo *vinfo;
gint frame_width, frame_height; // FIXME - the stuff below can use vinfo and macros
gint width[4]; gint width[4];
gint height[4]; gint height[4];
gint offset[4]; gint offset[4];
@ -86,7 +85,7 @@ struct _GstDeinterlaceMethodClass {
gboolean (*supported) (GstDeinterlaceMethodClass *klass, GstVideoFormat format, gint width, gint height); gboolean (*supported) (GstDeinterlaceMethodClass *klass, GstVideoFormat format, gint width, gint height);
void (*setup) (GstDeinterlaceMethod *self, GstVideoFormat format, gint width, gint height); void (*setup) (GstDeinterlaceMethod *self, GstVideoInfo * vinfo);
GstDeinterlaceMethodDeinterlaceFunction deinterlace_frame_yuy2; GstDeinterlaceMethodDeinterlaceFunction deinterlace_frame_yuy2;
GstDeinterlaceMethodDeinterlaceFunction deinterlace_frame_yvyu; GstDeinterlaceMethodDeinterlaceFunction deinterlace_frame_yvyu;
@ -113,8 +112,8 @@ struct _GstDeinterlaceMethodClass {
GType gst_deinterlace_method_get_type (void); GType gst_deinterlace_method_get_type (void);
gboolean gst_deinterlace_method_supported (GType type, GstVideoFormat format, gint width, gint height); gboolean gst_deinterlace_method_supported (GType type, GstVideoFormat format, gint width, gint height);
void gst_deinterlace_method_setup (GstDeinterlaceMethod * self, GstVideoFormat format, gint width, gint height); void gst_deinterlace_method_setup (GstDeinterlaceMethod * self, GstVideoInfo * vinfo);
void gst_deinterlace_method_deinterlace_frame (GstDeinterlaceMethod * self, const GstDeinterlaceField * history, guint history_count, GstBuffer * outbuf, void gst_deinterlace_method_deinterlace_frame (GstDeinterlaceMethod * self, const GstDeinterlaceField * history, guint history_count, GstVideoFrame * outframe,
int cur_field_idx); int cur_field_idx);
gint gst_deinterlace_method_get_fields_required (GstDeinterlaceMethod * self); gint gst_deinterlace_method_get_fields_required (GstDeinterlaceMethod * self);
gint gst_deinterlace_method_get_latency (GstDeinterlaceMethod * self); gint gst_deinterlace_method_get_latency (GstDeinterlaceMethod * self);

View file

@ -719,7 +719,7 @@ greedyh_scanline_C_planar_uv (GstDeinterlaceMethodGreedyH * self,
static void static void
deinterlace_frame_di_greedyh_packed (GstDeinterlaceMethod * method, deinterlace_frame_di_greedyh_packed (GstDeinterlaceMethod * method,
const GstDeinterlaceField * history, guint history_count, const GstDeinterlaceField * history, guint history_count,
GstBuffer * outbuf, int cur_field_idx) GstVideoFrame * outframe, int cur_field_idx)
{ {
GstDeinterlaceMethodGreedyH *self = GST_DEINTERLACE_METHOD_GREEDY_H (method); GstDeinterlaceMethodGreedyH *self = GST_DEINTERLACE_METHOD_GREEDY_H (method);
GstDeinterlaceMethodGreedyHClass *klass = GstDeinterlaceMethodGreedyHClass *klass =
@ -727,13 +727,13 @@ deinterlace_frame_di_greedyh_packed (GstDeinterlaceMethod * method,
gint InfoIsOdd = 0; gint InfoIsOdd = 0;
gint Line; gint Line;
gint RowStride = method->row_stride[0]; gint RowStride = method->row_stride[0];
gint FieldHeight = method->frame_height / 2; gint FieldHeight = GST_VIDEO_INFO_HEIGHT (method->vinfo) / 2;
gint Pitch = method->row_stride[0] * 2; gint Pitch = method->row_stride[0] * 2;
const guint8 *L1; // ptr to Line1, of 3 const guint8 *L1; // ptr to Line1, of 3
const guint8 *L2; // ptr to Line2, the weave line const guint8 *L2; // ptr to Line2, the weave line
const guint8 *L3; // ptr to Line3 const guint8 *L3; // ptr to Line3
const guint8 *L2P; // ptr to prev Line2 const guint8 *L2P; // ptr to prev Line2
guint8 *Dest = GST_BUFFER_DATA (outbuf); guint8 *Dest = GST_VIDEO_FRAME_COMP_DATA (outframe, 0);
ScanlineFunction scanline; ScanlineFunction scanline;
if (cur_field_idx + 2 > history_count || cur_field_idx < 1) { if (cur_field_idx + 2 > history_count || cur_field_idx < 1) {
@ -742,10 +742,9 @@ deinterlace_frame_di_greedyh_packed (GstDeinterlaceMethod * method,
backup_method = g_object_new (gst_deinterlace_method_linear_get_type (), backup_method = g_object_new (gst_deinterlace_method_linear_get_type (),
NULL); NULL);
gst_deinterlace_method_setup (backup_method, method->format, gst_deinterlace_method_setup (backup_method, method->vinfo);
method->frame_width, method->frame_height);
gst_deinterlace_method_deinterlace_frame (backup_method, gst_deinterlace_method_deinterlace_frame (backup_method,
history, history_count, outbuf, cur_field_idx); history, history_count, outframe, cur_field_idx);
g_object_unref (backup_method); g_object_unref (backup_method);
return; return;
@ -753,7 +752,7 @@ deinterlace_frame_di_greedyh_packed (GstDeinterlaceMethod * method,
cur_field_idx += 2; cur_field_idx += 2;
switch (method->format) { switch (GST_VIDEO_INFO_FORMAT (method->vinfo)) {
case GST_VIDEO_FORMAT_YUY2: case GST_VIDEO_FORMAT_YUY2:
case GST_VIDEO_FORMAT_YVYU: case GST_VIDEO_FORMAT_YVYU:
scanline = klass->scanline_yuy2; scanline = klass->scanline_yuy2;
@ -775,16 +774,16 @@ deinterlace_frame_di_greedyh_packed (GstDeinterlaceMethod * method,
if (history[cur_field_idx - 1].flags == PICTURE_INTERLACED_BOTTOM) { if (history[cur_field_idx - 1].flags == PICTURE_INTERLACED_BOTTOM) {
InfoIsOdd = 1; InfoIsOdd = 1;
L1 = GST_BUFFER_DATA (history[cur_field_idx - 2].buf); L1 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx - 2].frame, 0);
if (history[cur_field_idx - 2].flags & PICTURE_INTERLACED_BOTTOM) if (history[cur_field_idx - 2].flags & PICTURE_INTERLACED_BOTTOM)
L1 += RowStride; L1 += RowStride;
L2 = GST_BUFFER_DATA (history[cur_field_idx - 1].buf); L2 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx - 1].frame, 0);
if (history[cur_field_idx - 1].flags & PICTURE_INTERLACED_BOTTOM) if (history[cur_field_idx - 1].flags & PICTURE_INTERLACED_BOTTOM)
L2 += RowStride; L2 += RowStride;
L3 = L1 + Pitch; L3 = L1 + Pitch;
L2P = GST_BUFFER_DATA (history[cur_field_idx - 3].buf); L2P = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx - 3].frame, 0);
if (history[cur_field_idx - 3].flags & PICTURE_INTERLACED_BOTTOM) if (history[cur_field_idx - 3].flags & PICTURE_INTERLACED_BOTTOM)
L2P += RowStride; L2P += RowStride;
@ -793,16 +792,19 @@ deinterlace_frame_di_greedyh_packed (GstDeinterlaceMethod * method,
Dest += RowStride; Dest += RowStride;
} else { } else {
InfoIsOdd = 0; InfoIsOdd = 0;
L1 = GST_BUFFER_DATA (history[cur_field_idx - 2].buf); L1 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx - 2].frame, 0);
if (history[cur_field_idx - 2].flags & PICTURE_INTERLACED_BOTTOM) if (history[cur_field_idx - 2].flags & PICTURE_INTERLACED_BOTTOM)
L1 += RowStride; L1 += RowStride;
L2 = GST_BUFFER_DATA (history[cur_field_idx - 1].buf) + Pitch; L2 = (guint8 *) GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx -
1].frame, 0) + Pitch;
if (history[cur_field_idx - 1].flags & PICTURE_INTERLACED_BOTTOM) if (history[cur_field_idx - 1].flags & PICTURE_INTERLACED_BOTTOM)
L2 += RowStride; L2 += RowStride;
L3 = L1 + Pitch; L3 = L1 + Pitch;
L2P = GST_BUFFER_DATA (history[cur_field_idx - 3].buf) + Pitch; L2P =
(guint8 *) GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx - 3].frame,
0) + Pitch;
if (history[cur_field_idx - 3].flags & PICTURE_INTERLACED_BOTTOM) if (history[cur_field_idx - 3].flags & PICTURE_INTERLACED_BOTTOM)
L2P += RowStride; L2P += RowStride;
@ -875,7 +877,7 @@ deinterlace_frame_di_greedyh_planar_plane (GstDeinterlaceMethodGreedyH * self,
static void static void
deinterlace_frame_di_greedyh_planar (GstDeinterlaceMethod * method, deinterlace_frame_di_greedyh_planar (GstDeinterlaceMethod * method,
const GstDeinterlaceField * history, guint history_count, const GstDeinterlaceField * history, guint history_count,
GstBuffer * outbuf, int cur_field_idx) GstVideoFrame * outframe, int cur_field_idx)
{ {
GstDeinterlaceMethodGreedyH *self = GST_DEINTERLACE_METHOD_GREEDY_H (method); GstDeinterlaceMethodGreedyH *self = GST_DEINTERLACE_METHOD_GREEDY_H (method);
GstDeinterlaceMethodGreedyHClass *klass = GstDeinterlaceMethodGreedyHClass *klass =
@ -890,7 +892,6 @@ deinterlace_frame_di_greedyh_planar (GstDeinterlaceMethod * method,
const guint8 *L2P; // ptr to prev Line2 const guint8 *L2P; // ptr to prev Line2
guint8 *Dest; guint8 *Dest;
gint i; gint i;
gint Offset;
ScanlineFunction scanline; ScanlineFunction scanline;
if (cur_field_idx + 2 > history_count || cur_field_idx < 1) { if (cur_field_idx + 2 > history_count || cur_field_idx < 1) {
@ -899,10 +900,9 @@ deinterlace_frame_di_greedyh_planar (GstDeinterlaceMethod * method,
backup_method = g_object_new (gst_deinterlace_method_linear_get_type (), backup_method = g_object_new (gst_deinterlace_method_linear_get_type (),
NULL); NULL);
gst_deinterlace_method_setup (backup_method, method->format, gst_deinterlace_method_setup (backup_method, method->vinfo);
method->frame_width, method->frame_height);
gst_deinterlace_method_deinterlace_frame (backup_method, gst_deinterlace_method_deinterlace_frame (backup_method,
history, history_count, outbuf, cur_field_idx); history, history_count, outframe, cur_field_idx);
g_object_unref (backup_method); g_object_unref (backup_method);
return; return;
@ -911,8 +911,6 @@ deinterlace_frame_di_greedyh_planar (GstDeinterlaceMethod * method,
cur_field_idx += 2; cur_field_idx += 2;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
Offset = method->offset[i];
InfoIsOdd = (history[cur_field_idx - 1].flags == PICTURE_INTERLACED_BOTTOM); InfoIsOdd = (history[cur_field_idx - 1].flags == PICTURE_INTERLACED_BOTTOM);
RowStride = method->row_stride[i]; RowStride = method->row_stride[i];
FieldHeight = method->height[i] / 2; FieldHeight = method->height[i] / 2;
@ -923,18 +921,18 @@ deinterlace_frame_di_greedyh_planar (GstDeinterlaceMethod * method,
else else
scanline = klass->scanline_planar_uv; scanline = klass->scanline_planar_uv;
Dest = GST_BUFFER_DATA (outbuf) + Offset; Dest = GST_VIDEO_FRAME_PLANE_DATA (outframe, i);
L1 = GST_BUFFER_DATA (history[cur_field_idx - 2].buf) + Offset; L1 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx - 2].frame, i);
if (history[cur_field_idx - 2].flags & PICTURE_INTERLACED_BOTTOM) if (history[cur_field_idx - 2].flags & PICTURE_INTERLACED_BOTTOM)
L1 += RowStride; L1 += RowStride;
L2 = GST_BUFFER_DATA (history[cur_field_idx - 1].buf) + Offset; L2 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx - 1].frame, i);
if (history[cur_field_idx - 1].flags & PICTURE_INTERLACED_BOTTOM) if (history[cur_field_idx - 1].flags & PICTURE_INTERLACED_BOTTOM)
L2 += RowStride; L2 += RowStride;
L3 = L1 + Pitch; L3 = L1 + Pitch;
L2P = GST_BUFFER_DATA (history[cur_field_idx - 3].buf) + Offset; L2P = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx - 3].frame, i);
if (history[cur_field_idx - 3].flags & PICTURE_INTERLACED_BOTTOM) if (history[cur_field_idx - 3].flags & PICTURE_INTERLACED_BOTTOM)
L2P += RowStride; L2P += RowStride;

View file

@ -63,7 +63,7 @@
static void FUNCT_NAME(GstDeinterlaceMethod *d_method, static void FUNCT_NAME(GstDeinterlaceMethod *d_method,
const GstDeinterlaceField* history, guint history_count, const GstDeinterlaceField* history, guint history_count,
GstBuffer *outbuf, int cur_field_idx) GstVideoFrame *outframe, int cur_field_idx)
{ {
GstDeinterlaceMethodTomsMoComp *self = GST_DEINTERLACE_METHOD_TOMSMOCOMP (d_method); GstDeinterlaceMethodTomsMoComp *self = GST_DEINTERLACE_METHOD_TOMSMOCOMP (d_method);
glong SearchEffort = self->search_effort; glong SearchEffort = self->search_effort;
@ -86,10 +86,9 @@ static void FUNCT_NAME(GstDeinterlaceMethod *d_method,
backup_method = g_object_new (gst_deinterlace_method_linear_get_type(), backup_method = g_object_new (gst_deinterlace_method_linear_get_type(),
NULL); NULL);
gst_deinterlace_method_setup (backup_method, d_method->format, gst_deinterlace_method_setup (backup_method, d_method->vinfo);
d_method->frame_width, d_method->frame_height);
gst_deinterlace_method_deinterlace_frame (backup_method, gst_deinterlace_method_deinterlace_frame (backup_method,
history, history_count, outbuf, cur_field_idx); history, history_count, outframe, cur_field_idx);
g_object_unref (backup_method); g_object_unref (backup_method);
return; return;
@ -99,18 +98,18 @@ static void FUNCT_NAME(GstDeinterlaceMethod *d_method,
src_pitch = self->parent.row_stride[0]*2; src_pitch = self->parent.row_stride[0]*2;
dst_pitch = self->parent.row_stride[0]; dst_pitch = self->parent.row_stride[0];
rowsize = self->parent.row_stride[0]; rowsize = self->parent.row_stride[0];
FldHeight = self->parent.frame_height / 2; FldHeight = GST_VIDEO_INFO_HEIGHT (self->parent.vinfo) / 2;
pCopySrc = GST_BUFFER_DATA(history[history_count-1].buf); pCopySrc = GST_VIDEO_FRAME_PLANE_DATA (history[history_count-1].frame, 0);
if (history[history_count - 1].flags & PICTURE_INTERLACED_BOTTOM) if (history[history_count - 1].flags & PICTURE_INTERLACED_BOTTOM)
pCopySrc += rowsize; pCopySrc += rowsize;
pCopySrcP = GST_BUFFER_DATA(history[history_count-3].buf); pCopySrcP = GST_VIDEO_FRAME_PLANE_DATA (history[history_count-3].frame, 0);
if (history[history_count - 3].flags & PICTURE_INTERLACED_BOTTOM) if (history[history_count - 3].flags & PICTURE_INTERLACED_BOTTOM)
pCopySrcP += rowsize; pCopySrcP += rowsize;
pWeaveSrc = GST_BUFFER_DATA(history[history_count-2].buf); pWeaveSrc = GST_VIDEO_FRAME_PLANE_DATA (history[history_count-2].frame, 0);
if (history[history_count - 2].flags & PICTURE_INTERLACED_BOTTOM) if (history[history_count - 2].flags & PICTURE_INTERLACED_BOTTOM)
pWeaveSrc += rowsize; pWeaveSrc += rowsize;
pWeaveSrcP = GST_BUFFER_DATA(history[history_count-4].buf); pWeaveSrcP = GST_VIDEO_FRAME_PLANE_DATA (history[history_count-4].frame, 0);
if (history[history_count - 4].flags & PICTURE_INTERLACED_BOTTOM) if (history[history_count - 4].flags & PICTURE_INTERLACED_BOTTOM)
pWeaveSrcP += rowsize; pWeaveSrcP += rowsize;
@ -119,7 +118,7 @@ static void FUNCT_NAME(GstDeinterlaceMethod *d_method,
IsOdd = 1; IsOdd = 1;
// if we have an odd field we copy an even field and weave an odd field // if we have an odd field we copy an even field and weave an odd field
pCopyDest = GST_BUFFER_DATA(outbuf); pCopyDest = GST_VIDEO_FRAME_PLANE_DATA (outframe, 0);
pWeaveDest = pCopyDest + dst_pitch; pWeaveDest = pCopyDest + dst_pitch;
} }
/* do it vice verca */ /* do it vice verca */
@ -127,8 +126,8 @@ static void FUNCT_NAME(GstDeinterlaceMethod *d_method,
IsOdd = 0; IsOdd = 0;
// if we have an even field we copy an odd field and weave an even field // if we have an even field we copy an odd field and weave an even field
pCopyDest = GST_BUFFER_DATA(outbuf) + dst_pitch; pCopyDest = (guint8 *) GST_VIDEO_FRAME_PLANE_DATA (outframe, 0) + dst_pitch;
pWeaveDest = GST_BUFFER_DATA(outbuf); pWeaveDest = GST_VIDEO_FRAME_PLANE_DATA (outframe, 0);
} }