mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
deinterlace: Port to 1.0
This requires the additional INTERLACED buffer flag recently added to -base
This commit is contained in:
parent
ec7f7264dc
commit
eac172c433
6 changed files with 478 additions and 432 deletions
File diff suppressed because it is too large
Load diff
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/video/gstvideofilter.h>
|
||||
|
||||
#include "gstdeinterlacemethod.h"
|
||||
|
||||
|
@ -129,11 +130,15 @@ struct _GstDeinterlace
|
|||
GstDeinterlaceMethods user_set_method_id;
|
||||
GstDeinterlaceMethod *method;
|
||||
|
||||
GstVideoInfo vinfo;
|
||||
|
||||
#if 0
|
||||
GstVideoFormat format;
|
||||
gint width, height; /* frame width & height */
|
||||
guint frame_size; /* frame size in bytes */
|
||||
gint fps_n, fps_d; /* frame rate */
|
||||
gboolean interlaced; /* is input interlaced? */
|
||||
#endif
|
||||
|
||||
gboolean passthrough;
|
||||
|
||||
|
|
|
@ -95,40 +95,36 @@ gst_deinterlace_method_supported_impl (GstDeinterlaceMethodClass * klass,
|
|||
}
|
||||
|
||||
void
|
||||
gst_deinterlace_method_setup (GstDeinterlaceMethod * self,
|
||||
GstVideoFormat format, gint width, gint height)
|
||||
gst_deinterlace_method_setup (GstDeinterlaceMethod * self, GstVideoInfo * vinfo)
|
||||
{
|
||||
GstDeinterlaceMethodClass *klass = GST_DEINTERLACE_METHOD_GET_CLASS (self);
|
||||
|
||||
klass->setup (self, format, width, height);
|
||||
klass->setup (self, vinfo);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_deinterlace_method_setup_impl (GstDeinterlaceMethod * self,
|
||||
GstVideoFormat format, gint width, gint height)
|
||||
GstVideoInfo * vinfo)
|
||||
{
|
||||
gint i;
|
||||
GstDeinterlaceMethodClass *klass = GST_DEINTERLACE_METHOD_GET_CLASS (self);
|
||||
|
||||
self->format = format;
|
||||
self->frame_width = width;
|
||||
self->frame_height = height;
|
||||
self->vinfo = vinfo;
|
||||
|
||||
self->deinterlace_frame = NULL;
|
||||
|
||||
if (format == GST_VIDEO_FORMAT_UNKNOWN)
|
||||
if (GST_VIDEO_INFO_FORMAT (self->vinfo) == GST_VIDEO_FORMAT_UNKNOWN)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
self->width[i] = gst_video_format_get_component_width (format, i, width);
|
||||
self->height[i] = gst_video_format_get_component_height (format, i, height);
|
||||
self->offset[i] =
|
||||
gst_video_format_get_component_offset (format, i, width, height);
|
||||
self->row_stride[i] = gst_video_format_get_row_stride (format, i, width);
|
||||
self->pixel_stride[i] = gst_video_format_get_pixel_stride (format, i);
|
||||
self->width[i] = GST_VIDEO_INFO_COMP_WIDTH (vinfo, i);
|
||||
self->height[i] = GST_VIDEO_INFO_COMP_HEIGHT (vinfo, i);
|
||||
self->offset[i] = GST_VIDEO_INFO_COMP_OFFSET (vinfo, i);
|
||||
self->row_stride[i] = GST_VIDEO_INFO_COMP_STRIDE (vinfo, i);
|
||||
self->pixel_stride[i] = GST_VIDEO_INFO_COMP_PSTRIDE (vinfo, i);
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
switch (GST_VIDEO_INFO_FORMAT (self->vinfo)) {
|
||||
case GST_VIDEO_FORMAT_YUY2:
|
||||
self->deinterlace_frame = klass->deinterlace_frame_yuy2;
|
||||
break;
|
||||
|
@ -200,16 +196,17 @@ gst_deinterlace_method_class_init (GstDeinterlaceMethodClass * klass)
|
|||
static void
|
||||
gst_deinterlace_method_init (GstDeinterlaceMethod * self)
|
||||
{
|
||||
self->format = GST_VIDEO_FORMAT_UNKNOWN;
|
||||
self->vinfo = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gst_deinterlace_method_deinterlace_frame (GstDeinterlaceMethod * self,
|
||||
const GstDeinterlaceField * history, guint history_count,
|
||||
GstBuffer * outbuf, int cur_field_idx)
|
||||
GstVideoFrame * outframe, int cur_field_idx)
|
||||
{
|
||||
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
|
||||
|
@ -318,7 +315,7 @@ gst_deinterlace_simple_method_copy_scanline_packed (GstDeinterlaceSimpleMethod *
|
|||
static void
|
||||
gst_deinterlace_simple_method_deinterlace_frame_packed (GstDeinterlaceMethod *
|
||||
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);
|
||||
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;
|
||||
guint cur_field_flags = history[cur_field_idx].flags;
|
||||
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];
|
||||
|
||||
g_assert (self->interpolate_scanline_packed != NULL);
|
||||
g_assert (self->copy_scanline_packed != NULL);
|
||||
|
||||
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 {
|
||||
fieldp = NULL;
|
||||
}
|
||||
|
||||
dest = GST_BUFFER_DATA (outbuf);
|
||||
field0 = GST_BUFFER_DATA (history[cur_field_idx].buf);
|
||||
dest = GST_VIDEO_FRAME_COMP_DATA (outframe, 0);
|
||||
|
||||
field0 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx].frame, 0);
|
||||
|
||||
g_assert (dm_class->fields_required <= 4);
|
||||
|
||||
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 {
|
||||
field1 = NULL;
|
||||
}
|
||||
|
||||
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 {
|
||||
field2 = NULL;
|
||||
}
|
||||
|
@ -509,14 +507,14 @@ static void
|
|||
static void
|
||||
gst_deinterlace_simple_method_deinterlace_frame_planar (GstDeinterlaceMethod *
|
||||
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);
|
||||
GstDeinterlaceMethodClass *dm_class = GST_DEINTERLACE_METHOD_GET_CLASS (self);
|
||||
guint8 *out;
|
||||
const guint8 *field0, *field1, *field2, *fieldp;
|
||||
guint cur_field_flags = history[cur_field_idx].flags;
|
||||
gint i, offset;
|
||||
gint i;
|
||||
GstDeinterlaceSimpleMethodFunction copy_scanline;
|
||||
GstDeinterlaceSimpleMethodFunction interpolate_scanline;
|
||||
|
||||
|
@ -528,29 +526,28 @@ gst_deinterlace_simple_method_deinterlace_frame_planar (GstDeinterlaceMethod *
|
|||
g_assert (self->copy_scanline_planar[2] != NULL);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
offset = self->parent.offset[i];
|
||||
copy_scanline = self->copy_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;
|
||||
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);
|
||||
|
||||
field1 = NULL;
|
||||
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;
|
||||
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,
|
||||
|
@ -562,40 +559,38 @@ gst_deinterlace_simple_method_deinterlace_frame_planar (GstDeinterlaceMethod *
|
|||
static void
|
||||
gst_deinterlace_simple_method_deinterlace_frame_nv12 (GstDeinterlaceMethod *
|
||||
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);
|
||||
GstDeinterlaceMethodClass *dm_class = GST_DEINTERLACE_METHOD_GET_CLASS (self);
|
||||
guint8 *out;
|
||||
const guint8 *field0, *field1, *field2, *fieldp;
|
||||
guint cur_field_flags = history[cur_field_idx].flags;
|
||||
gint i, offset;
|
||||
gint i;
|
||||
|
||||
g_assert (self->interpolate_scanline_packed != NULL);
|
||||
g_assert (self->copy_scanline_packed != NULL);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
offset = self->parent.offset[i];
|
||||
|
||||
out = GST_BUFFER_DATA (outbuf) + offset;
|
||||
out = GST_VIDEO_FRAME_PLANE_DATA (outframe, i);
|
||||
|
||||
fieldp = NULL;
|
||||
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);
|
||||
|
||||
field1 = NULL;
|
||||
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;
|
||||
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,
|
||||
|
@ -606,15 +601,14 @@ gst_deinterlace_simple_method_deinterlace_frame_nv12 (GstDeinterlaceMethod *
|
|||
|
||||
static void
|
||||
gst_deinterlace_simple_method_setup (GstDeinterlaceMethod * method,
|
||||
GstVideoFormat format, gint width, gint height)
|
||||
GstVideoInfo * vinfo)
|
||||
{
|
||||
GstDeinterlaceSimpleMethod *self = GST_DEINTERLACE_SIMPLE_METHOD (method);
|
||||
GstDeinterlaceSimpleMethodClass *klass =
|
||||
GST_DEINTERLACE_SIMPLE_METHOD_GET_CLASS (self);
|
||||
|
||||
GST_DEINTERLACE_METHOD_CLASS
|
||||
(gst_deinterlace_simple_method_parent_class)->setup (method, format,
|
||||
width, height);
|
||||
(gst_deinterlace_simple_method_parent_class)->setup (method, vinfo);
|
||||
|
||||
self->interpolate_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[2] = NULL;
|
||||
|
||||
if (format == GST_VIDEO_FORMAT_UNKNOWN)
|
||||
if (GST_VIDEO_INFO_FORMAT (vinfo) == GST_VIDEO_FORMAT_UNKNOWN)
|
||||
return;
|
||||
|
||||
switch (format) {
|
||||
switch (GST_VIDEO_INFO_FORMAT (vinfo)) {
|
||||
case GST_VIDEO_FORMAT_YUY2:
|
||||
self->interpolate_scanline_packed = klass->interpolate_scanline_yuy2;
|
||||
self->copy_scanline_packed = klass->copy_scanline_yuy2;
|
||||
|
|
|
@ -51,8 +51,7 @@ typedef struct _GstDeinterlaceMethodClass GstDeinterlaceMethodClass;
|
|||
|
||||
typedef struct
|
||||
{
|
||||
/* pointer to the start of data for this field */
|
||||
GstBuffer *buf;
|
||||
GstVideoFrame *frame;
|
||||
/* see PICTURE_ flags in *.c */
|
||||
guint flags;
|
||||
} GstDeinterlaceField;
|
||||
|
@ -63,13 +62,13 @@ typedef struct
|
|||
|
||||
typedef void (*GstDeinterlaceMethodDeinterlaceFunction) (
|
||||
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 {
|
||||
GstObject parent;
|
||||
|
||||
GstVideoFormat format;
|
||||
gint frame_width, frame_height;
|
||||
GstVideoInfo *vinfo;
|
||||
// FIXME - the stuff below can use vinfo and macros
|
||||
gint width[4];
|
||||
gint height[4];
|
||||
gint offset[4];
|
||||
|
@ -86,7 +85,7 @@ struct _GstDeinterlaceMethodClass {
|
|||
|
||||
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_yvyu;
|
||||
|
@ -113,8 +112,8 @@ struct _GstDeinterlaceMethodClass {
|
|||
GType gst_deinterlace_method_get_type (void);
|
||||
|
||||
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_deinterlace_frame (GstDeinterlaceMethod * self, const GstDeinterlaceField * history, guint history_count, GstBuffer * outbuf,
|
||||
void gst_deinterlace_method_setup (GstDeinterlaceMethod * self, GstVideoInfo * vinfo);
|
||||
void gst_deinterlace_method_deinterlace_frame (GstDeinterlaceMethod * self, const GstDeinterlaceField * history, guint history_count, GstVideoFrame * outframe,
|
||||
int cur_field_idx);
|
||||
gint gst_deinterlace_method_get_fields_required (GstDeinterlaceMethod * self);
|
||||
gint gst_deinterlace_method_get_latency (GstDeinterlaceMethod * self);
|
||||
|
|
|
@ -719,7 +719,7 @@ greedyh_scanline_C_planar_uv (GstDeinterlaceMethodGreedyH * self,
|
|||
static void
|
||||
deinterlace_frame_di_greedyh_packed (GstDeinterlaceMethod * method,
|
||||
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);
|
||||
GstDeinterlaceMethodGreedyHClass *klass =
|
||||
|
@ -727,13 +727,13 @@ deinterlace_frame_di_greedyh_packed (GstDeinterlaceMethod * method,
|
|||
gint InfoIsOdd = 0;
|
||||
gint Line;
|
||||
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;
|
||||
const guint8 *L1; // ptr to Line1, of 3
|
||||
const guint8 *L2; // ptr to Line2, the weave line
|
||||
const guint8 *L3; // ptr to Line3
|
||||
const guint8 *L2P; // ptr to prev Line2
|
||||
guint8 *Dest = GST_BUFFER_DATA (outbuf);
|
||||
guint8 *Dest = GST_VIDEO_FRAME_COMP_DATA (outframe, 0);
|
||||
ScanlineFunction scanline;
|
||||
|
||||
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 (),
|
||||
NULL);
|
||||
|
||||
gst_deinterlace_method_setup (backup_method, method->format,
|
||||
method->frame_width, method->frame_height);
|
||||
gst_deinterlace_method_setup (backup_method, method->vinfo);
|
||||
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);
|
||||
return;
|
||||
|
@ -753,7 +752,7 @@ deinterlace_frame_di_greedyh_packed (GstDeinterlaceMethod * method,
|
|||
|
||||
cur_field_idx += 2;
|
||||
|
||||
switch (method->format) {
|
||||
switch (GST_VIDEO_INFO_FORMAT (method->vinfo)) {
|
||||
case GST_VIDEO_FORMAT_YUY2:
|
||||
case GST_VIDEO_FORMAT_YVYU:
|
||||
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) {
|
||||
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)
|
||||
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)
|
||||
L2 += RowStride;
|
||||
|
||||
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)
|
||||
L2P += RowStride;
|
||||
|
||||
|
@ -793,16 +792,19 @@ deinterlace_frame_di_greedyh_packed (GstDeinterlaceMethod * method,
|
|||
Dest += RowStride;
|
||||
} else {
|
||||
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)
|
||||
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)
|
||||
L2 += RowStride;
|
||||
|
||||
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)
|
||||
L2P += RowStride;
|
||||
|
||||
|
@ -875,7 +877,7 @@ deinterlace_frame_di_greedyh_planar_plane (GstDeinterlaceMethodGreedyH * self,
|
|||
static void
|
||||
deinterlace_frame_di_greedyh_planar (GstDeinterlaceMethod * method,
|
||||
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);
|
||||
GstDeinterlaceMethodGreedyHClass *klass =
|
||||
|
@ -890,7 +892,6 @@ deinterlace_frame_di_greedyh_planar (GstDeinterlaceMethod * method,
|
|||
const guint8 *L2P; // ptr to prev Line2
|
||||
guint8 *Dest;
|
||||
gint i;
|
||||
gint Offset;
|
||||
ScanlineFunction scanline;
|
||||
|
||||
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 (),
|
||||
NULL);
|
||||
|
||||
gst_deinterlace_method_setup (backup_method, method->format,
|
||||
method->frame_width, method->frame_height);
|
||||
gst_deinterlace_method_setup (backup_method, method->vinfo);
|
||||
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);
|
||||
return;
|
||||
|
@ -911,8 +911,6 @@ deinterlace_frame_di_greedyh_planar (GstDeinterlaceMethod * method,
|
|||
cur_field_idx += 2;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
Offset = method->offset[i];
|
||||
|
||||
InfoIsOdd = (history[cur_field_idx - 1].flags == PICTURE_INTERLACED_BOTTOM);
|
||||
RowStride = method->row_stride[i];
|
||||
FieldHeight = method->height[i] / 2;
|
||||
|
@ -923,18 +921,18 @@ deinterlace_frame_di_greedyh_planar (GstDeinterlaceMethod * method,
|
|||
else
|
||||
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)
|
||||
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)
|
||||
L2 += RowStride;
|
||||
|
||||
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)
|
||||
L2P += RowStride;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
static void FUNCT_NAME(GstDeinterlaceMethod *d_method,
|
||||
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);
|
||||
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(),
|
||||
NULL);
|
||||
|
||||
gst_deinterlace_method_setup (backup_method, d_method->format,
|
||||
d_method->frame_width, d_method->frame_height);
|
||||
gst_deinterlace_method_setup (backup_method, d_method->vinfo);
|
||||
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);
|
||||
return;
|
||||
|
@ -99,18 +98,18 @@ static void FUNCT_NAME(GstDeinterlaceMethod *d_method,
|
|||
src_pitch = self->parent.row_stride[0]*2;
|
||||
dst_pitch = 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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
pWeaveSrcP += rowsize;
|
||||
|
||||
|
@ -119,7 +118,7 @@ static void FUNCT_NAME(GstDeinterlaceMethod *d_method,
|
|||
IsOdd = 1;
|
||||
|
||||
// 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;
|
||||
}
|
||||
/* do it vice verca */
|
||||
|
@ -127,8 +126,8 @@ static void FUNCT_NAME(GstDeinterlaceMethod *d_method,
|
|||
|
||||
IsOdd = 0;
|
||||
// if we have an even field we copy an odd field and weave an even field
|
||||
pCopyDest = GST_BUFFER_DATA(outbuf) + dst_pitch;
|
||||
pWeaveDest = GST_BUFFER_DATA(outbuf);
|
||||
pCopyDest = (guint8 *) GST_VIDEO_FRAME_PLANE_DATA (outframe, 0) + dst_pitch;
|
||||
pWeaveDest = GST_VIDEO_FRAME_PLANE_DATA (outframe, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue