mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
deinterlace: add support for strides
Implement stride support correctly by taking it from the GstVideoFrame. Propose a bufferpool upstream when not operating in passthrough.
This commit is contained in:
parent
3503aef946
commit
abd7e33db6
14 changed files with 290 additions and 285 deletions
|
@ -2367,6 +2367,7 @@ gst_deinterlace_do_bufferpool (GstDeinterlace * self, GstCaps * outcaps)
|
|||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_set_params (config, outcaps, size, min, max);
|
||||
gst_buffer_pool_config_set_allocator (config, allocator, ¶ms);
|
||||
gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
|
||||
gst_buffer_pool_set_config (pool, config);
|
||||
|
||||
/* now store */
|
||||
|
@ -2590,6 +2591,33 @@ gst_deinterlace_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
return res;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_deinterlace_propose_allocation (GstDeinterlace * self, GstQuery * query)
|
||||
{
|
||||
GstBufferPool *pool;
|
||||
GstCaps *caps;
|
||||
GstVideoInfo info;
|
||||
guint size;
|
||||
|
||||
gst_query_parse_allocation (query, &caps, NULL);
|
||||
|
||||
if (caps == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!gst_video_info_from_caps (&info, caps))
|
||||
return FALSE;
|
||||
|
||||
size = GST_VIDEO_INFO_SIZE (&info);
|
||||
|
||||
pool = gst_video_buffer_pool_new ();
|
||||
|
||||
gst_query_add_allocation_pool (query, pool, size, 0, 0);
|
||||
gst_object_unref (pool);
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_deinterlace_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||
{
|
||||
|
@ -2614,7 +2642,7 @@ gst_deinterlace_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
|||
if (self->passthrough)
|
||||
res = gst_pad_peer_query (self->srcpad, query);
|
||||
else
|
||||
res = gst_pad_query_default (pad, parent, query);
|
||||
res = gst_deinterlace_propose_allocation (self, query);
|
||||
break;
|
||||
default:
|
||||
res = gst_pad_query_default (pad, parent, query);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/video/gstvideopool.h>
|
||||
#include <gst/video/gstvideofilter.h>
|
||||
#include <gst/video/gstvideometa.h>
|
||||
|
||||
#include "gstdeinterlacemethod.h"
|
||||
|
||||
|
|
|
@ -106,7 +106,6 @@ static void
|
|||
gst_deinterlace_method_setup_impl (GstDeinterlaceMethod * self,
|
||||
GstVideoInfo * vinfo)
|
||||
{
|
||||
gint i;
|
||||
GstDeinterlaceMethodClass *klass = GST_DEINTERLACE_METHOD_GET_CLASS (self);
|
||||
|
||||
self->vinfo = vinfo;
|
||||
|
@ -116,14 +115,6 @@ gst_deinterlace_method_setup_impl (GstDeinterlaceMethod * self,
|
|||
if (GST_VIDEO_INFO_FORMAT (self->vinfo) == GST_VIDEO_FORMAT_UNKNOWN)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 4; 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 (GST_VIDEO_INFO_FORMAT (self->vinfo)) {
|
||||
case GST_VIDEO_FORMAT_YUY2:
|
||||
self->deinterlace_frame = klass->deinterlace_frame_yuy2;
|
||||
|
@ -300,16 +291,17 @@ gst_deinterlace_simple_method_supported (GstDeinterlaceMethodClass * mklass,
|
|||
static void
|
||||
gst_deinterlace_simple_method_interpolate_scanline_packed
|
||||
(GstDeinterlaceSimpleMethod * self, guint8 * out,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint stride)
|
||||
{
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m1, stride);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_deinterlace_simple_method_copy_scanline_packed (GstDeinterlaceSimpleMethod *
|
||||
self, guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
self, guint8 * out, const GstDeinterlaceScanlineData * scanlines,
|
||||
guint stride)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m0, stride);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -320,43 +312,43 @@ gst_deinterlace_simple_method_deinterlace_frame_packed (GstDeinterlaceMethod *
|
|||
GstDeinterlaceSimpleMethod *self = GST_DEINTERLACE_SIMPLE_METHOD (method);
|
||||
GstDeinterlaceMethodClass *dm_class = GST_DEINTERLACE_METHOD_GET_CLASS (self);
|
||||
GstDeinterlaceScanlineData scanlines;
|
||||
guint8 *dest;
|
||||
const guint8 *field0, *field1, *field2, *fieldp;
|
||||
guint cur_field_flags = history[cur_field_idx].flags;
|
||||
guint cur_field_flags;
|
||||
gint i;
|
||||
gint frame_height = GST_VIDEO_INFO_HEIGHT (self->parent.vinfo);
|
||||
gint stride = self->parent.row_stride[0];
|
||||
gint frame_height, frame_width;
|
||||
GstVideoFrame *framep, *frame0, *frame1, *frame2;
|
||||
|
||||
g_assert (self->interpolate_scanline_packed != NULL);
|
||||
g_assert (self->copy_scanline_packed != NULL);
|
||||
|
||||
if (cur_field_idx > 0) {
|
||||
fieldp = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx - 1].frame, 0);
|
||||
} else {
|
||||
fieldp = NULL;
|
||||
}
|
||||
frame_height = GST_VIDEO_FRAME_HEIGHT (outframe);
|
||||
frame_width = GST_VIDEO_FRAME_PLANE_STRIDE (outframe, 0);
|
||||
|
||||
dest = GST_VIDEO_FRAME_COMP_DATA (outframe, 0);
|
||||
frame0 = history[cur_field_idx].frame;
|
||||
frame_width = MIN (frame_width, GST_VIDEO_FRAME_PLANE_STRIDE (frame0, 0));
|
||||
cur_field_flags = history[cur_field_idx].flags;
|
||||
|
||||
field0 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx].frame, 0);
|
||||
framep = (cur_field_idx > 0 ? history[cur_field_idx - 1].frame : NULL);
|
||||
if (framep)
|
||||
frame_width = MIN (frame_width, GST_VIDEO_FRAME_PLANE_STRIDE (framep, 0));
|
||||
|
||||
g_assert (dm_class->fields_required <= 4);
|
||||
|
||||
if (cur_field_idx + 1 < history_count) {
|
||||
field1 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx + 1].frame, 0);
|
||||
} else {
|
||||
field1 = NULL;
|
||||
}
|
||||
frame1 =
|
||||
(cur_field_idx + 1 <
|
||||
history_count ? history[cur_field_idx + 1].frame : NULL);
|
||||
if (frame1)
|
||||
frame_width = MIN (frame_width, GST_VIDEO_FRAME_PLANE_STRIDE (frame1, 0));
|
||||
|
||||
if (cur_field_idx + 2 < history_count) {
|
||||
field2 = GST_VIDEO_FRAME_COMP_DATA (history[cur_field_idx + 2].frame, 0);
|
||||
} else {
|
||||
field2 = NULL;
|
||||
}
|
||||
frame2 =
|
||||
(cur_field_idx + 2 <
|
||||
history_count ? history[cur_field_idx + 2].frame : NULL);
|
||||
if (frame2)
|
||||
frame_width = MIN (frame_width, GST_VIDEO_FRAME_PLANE_STRIDE (frame2, 0));
|
||||
|
||||
#define CLAMP_LOW(i) (((i)<0) ? (i+2) : (i))
|
||||
#define CLAMP_HI(i) (((i)>=(frame_height)) ? (i-2) : (i))
|
||||
#define LINE(x,i) ((x) + CLAMP_HI(CLAMP_LOW(i)) * (stride))
|
||||
#define LINE(x,i) (((guint8*)GST_VIDEO_FRAME_PLANE_DATA((x),0)) + CLAMP_HI(CLAMP_LOW(i)) * \
|
||||
GST_VIDEO_FRAME_PLANE_STRIDE((x),0))
|
||||
#define LINE2(x,i) ((x) ? LINE(x,i) : NULL)
|
||||
|
||||
for (i = 0; i < frame_height; i++) {
|
||||
|
@ -365,142 +357,159 @@ gst_deinterlace_simple_method_deinterlace_frame_packed (GstDeinterlaceMethod *
|
|||
|
||||
if (!((i & 1) ^ scanlines.bottom_field)) {
|
||||
/* copying */
|
||||
scanlines.tp = LINE2 (fieldp, i - 1);
|
||||
scanlines.bp = LINE2 (fieldp, i + 1);
|
||||
scanlines.tp = LINE2 (framep, i - 1);
|
||||
scanlines.bp = LINE2 (framep, i + 1);
|
||||
|
||||
scanlines.tt0 = LINE2 (field0, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.m0 = LINE2 (field0, i);
|
||||
scanlines.bb0 = LINE2 (field0, (i + 2 < frame_height ? i + 2 : i));
|
||||
scanlines.tt0 = LINE2 (frame0, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.m0 = LINE2 (frame0, i);
|
||||
scanlines.bb0 = LINE2 (frame0, (i + 2 < frame_height ? i + 2 : i));
|
||||
|
||||
scanlines.t1 = LINE2 (field1, i - 1);
|
||||
scanlines.b1 = LINE2 (field1, i + 1);
|
||||
scanlines.t1 = LINE2 (frame1, i - 1);
|
||||
scanlines.b1 = LINE2 (frame1, i + 1);
|
||||
|
||||
scanlines.tt2 = LINE2 (field2, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.m2 = LINE2 (field2, i);
|
||||
scanlines.bb2 = LINE2 (field2, (i + 2 < frame_height ? i + 2 : i));
|
||||
scanlines.tt2 = LINE2 (frame2, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.m2 = LINE2 (frame2, i);
|
||||
scanlines.bb2 = LINE2 (frame2, (i + 2 < frame_height ? i + 2 : i));
|
||||
|
||||
self->copy_scanline_packed (self, LINE (dest, i), &scanlines);
|
||||
self->copy_scanline_packed (self, LINE (outframe, i), &scanlines,
|
||||
frame_width);
|
||||
} else {
|
||||
/* interpolating */
|
||||
scanlines.ttp = LINE2 (fieldp, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.mp = LINE2 (fieldp, i);
|
||||
scanlines.bbp = LINE2 (fieldp, (i + 2 < frame_height ? i + 2 : i));
|
||||
scanlines.ttp = LINE2 (framep, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.mp = LINE2 (framep, i);
|
||||
scanlines.bbp = LINE2 (framep, (i + 2 < frame_height ? i + 2 : i));
|
||||
|
||||
scanlines.t0 = LINE2 (field0, i - 1);
|
||||
scanlines.b0 = LINE2 (field0, i + 1);
|
||||
scanlines.t0 = LINE2 (frame0, i - 1);
|
||||
scanlines.b0 = LINE2 (frame0, i + 1);
|
||||
|
||||
scanlines.tt1 = LINE2 (field1, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.m1 = LINE2 (field1, i);
|
||||
scanlines.bb1 = LINE2 (field1, (i + 2 < frame_height ? i + 2 : i));
|
||||
scanlines.tt1 = LINE2 (frame1, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.m1 = LINE2 (frame1, i);
|
||||
scanlines.bb1 = LINE2 (frame1, (i + 2 < frame_height ? i + 2 : i));
|
||||
|
||||
scanlines.t2 = LINE2 (field2, i - 1);
|
||||
scanlines.b2 = LINE2 (field2, i + 1);
|
||||
scanlines.t2 = LINE2 (frame2, i - 1);
|
||||
scanlines.b2 = LINE2 (frame2, i + 1);
|
||||
|
||||
self->interpolate_scanline_packed (self, LINE (dest, i), &scanlines);
|
||||
self->interpolate_scanline_packed (self, LINE (outframe, i), &scanlines,
|
||||
frame_width);
|
||||
}
|
||||
#undef LINE
|
||||
#undef LINE2
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_deinterlace_simple_method_interpolate_scanline_planar_y
|
||||
(GstDeinterlaceSimpleMethod * self, guint8 * out,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_deinterlace_simple_method_copy_scanline_planar_y (GstDeinterlaceSimpleMethod
|
||||
* self, guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
* self, guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint
|
||||
size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_deinterlace_simple_method_interpolate_scanline_planar_u
|
||||
(GstDeinterlaceSimpleMethod * self, guint8 * out,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[1]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_deinterlace_simple_method_copy_scanline_planar_u (GstDeinterlaceSimpleMethod
|
||||
* self, guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
* self, guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint
|
||||
size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[1]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_deinterlace_simple_method_interpolate_scanline_planar_v
|
||||
(GstDeinterlaceSimpleMethod * self, guint8 * out,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[2]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_deinterlace_simple_method_copy_scanline_planar_v (GstDeinterlaceSimpleMethod
|
||||
* self, guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
* self, guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint
|
||||
size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[2]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_deinterlace_simple_method_deinterlace_frame_planar_plane
|
||||
(GstDeinterlaceSimpleMethod * self, guint8 * dest, const guint8 * field0,
|
||||
const guint8 * field1, const guint8 * field2, const guint8 * fieldp,
|
||||
guint cur_field_flags,
|
||||
gint plane, GstDeinterlaceSimpleMethodFunction copy_scanline,
|
||||
(GstDeinterlaceSimpleMethod * self, GstVideoFrame * dest,
|
||||
const GstVideoFrame * frame0, const GstVideoFrame * frame1,
|
||||
const GstVideoFrame * frame2, const GstVideoFrame * framep,
|
||||
guint cur_field_flags, gint plane,
|
||||
GstDeinterlaceSimpleMethodFunction copy_scanline,
|
||||
GstDeinterlaceSimpleMethodFunction interpolate_scanline)
|
||||
{
|
||||
GstDeinterlaceScanlineData scanlines;
|
||||
gint i;
|
||||
gint frame_height = self->parent.height[plane];
|
||||
gint stride = self->parent.row_stride[plane];
|
||||
gint frame_height, frame_width;
|
||||
|
||||
frame_height = GST_VIDEO_FRAME_COMP_HEIGHT (dest, plane);
|
||||
frame_width = GST_VIDEO_FRAME_COMP_WIDTH (dest, plane) *
|
||||
GST_VIDEO_FRAME_COMP_PSTRIDE (dest, plane);
|
||||
|
||||
g_assert (interpolate_scanline != NULL);
|
||||
g_assert (copy_scanline != NULL);
|
||||
|
||||
#define LINE(x,i) (((guint8*)GST_VIDEO_FRAME_PLANE_DATA((x),plane)) + CLAMP_HI(CLAMP_LOW(i)) * \
|
||||
GST_VIDEO_FRAME_PLANE_STRIDE((x),plane))
|
||||
#define LINE2(x,i) ((x) ? LINE(x,i) : NULL)
|
||||
|
||||
for (i = 0; i < frame_height; i++) {
|
||||
memset (&scanlines, 0, sizeof (scanlines));
|
||||
scanlines.bottom_field = (cur_field_flags == PICTURE_INTERLACED_BOTTOM);
|
||||
|
||||
if (!((i & 1) ^ scanlines.bottom_field)) {
|
||||
/* copying */
|
||||
scanlines.tp = LINE2 (fieldp, i - 1);
|
||||
scanlines.bp = LINE2 (fieldp, i + 1);
|
||||
scanlines.tp = LINE2 (framep, i - 1);
|
||||
scanlines.bp = LINE2 (framep, i + 1);
|
||||
|
||||
scanlines.tt0 = LINE2 (field0, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.m0 = LINE2 (field0, i);
|
||||
scanlines.bb0 = LINE2 (field0, (i + 2 < frame_height ? i + 2 : i));
|
||||
scanlines.tt0 = LINE2 (frame0, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.m0 = LINE2 (frame0, i);
|
||||
scanlines.bb0 = LINE2 (frame0, (i + 2 < frame_height ? i + 2 : i));
|
||||
|
||||
scanlines.t1 = LINE2 (field1, i - 1);
|
||||
scanlines.b1 = LINE2 (field1, i + 1);
|
||||
scanlines.t1 = LINE2 (frame1, i - 1);
|
||||
scanlines.b1 = LINE2 (frame1, i + 1);
|
||||
|
||||
scanlines.tt2 = LINE2 (field2, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.m2 = LINE2 (field2, i);
|
||||
scanlines.bb2 = LINE2 (field2, (i + 2 < frame_height ? i + 2 : i));
|
||||
scanlines.tt2 = LINE2 (frame2, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.m2 = LINE2 (frame2, i);
|
||||
scanlines.bb2 = LINE2 (frame2, (i + 2 < frame_height ? i + 2 : i));
|
||||
|
||||
copy_scanline (self, LINE (dest, i), &scanlines);
|
||||
copy_scanline (self, LINE (dest, i), &scanlines, frame_width);
|
||||
} else {
|
||||
/* interpolating */
|
||||
scanlines.ttp = LINE2 (fieldp, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.mp = LINE2 (fieldp, i);
|
||||
scanlines.bbp = LINE2 (fieldp, (i + 2 < frame_height ? i + 2 : i));
|
||||
scanlines.ttp = LINE2 (framep, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.mp = LINE2 (framep, i);
|
||||
scanlines.bbp = LINE2 (framep, (i + 2 < frame_height ? i + 2 : i));
|
||||
|
||||
scanlines.t0 = LINE2 (field0, i - 1);
|
||||
scanlines.b0 = LINE2 (field0, i + 1);
|
||||
scanlines.t0 = LINE2 (frame0, i - 1);
|
||||
scanlines.b0 = LINE2 (frame0, i + 1);
|
||||
|
||||
scanlines.tt1 = LINE2 (field1, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.m1 = LINE2 (field1, i);
|
||||
scanlines.bb1 = LINE2 (field1, (i + 2 < frame_height ? i + 2 : i));
|
||||
scanlines.tt1 = LINE2 (frame1, (i - 2 >= 0) ? i - 2 : i);
|
||||
scanlines.m1 = LINE2 (frame1, i);
|
||||
scanlines.bb1 = LINE2 (frame1, (i + 2 < frame_height ? i + 2 : i));
|
||||
|
||||
scanlines.t2 = LINE2 (field2, i - 1);
|
||||
scanlines.b2 = LINE2 (field2, i + 1);
|
||||
scanlines.t2 = LINE2 (frame2, i - 1);
|
||||
scanlines.b2 = LINE2 (frame2, i + 1);
|
||||
|
||||
interpolate_scanline (self, LINE (dest, i), &scanlines);
|
||||
interpolate_scanline (self, LINE (dest, i), &scanlines, frame_width);
|
||||
}
|
||||
#undef LINE
|
||||
#undef LINE2
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -511,8 +520,7 @@ gst_deinterlace_simple_method_deinterlace_frame_planar (GstDeinterlaceMethod *
|
|||
{
|
||||
GstDeinterlaceSimpleMethod *self = GST_DEINTERLACE_SIMPLE_METHOD (method);
|
||||
GstDeinterlaceMethodClass *dm_class = GST_DEINTERLACE_METHOD_GET_CLASS (self);
|
||||
guint8 *out;
|
||||
const guint8 *field0, *field1, *field2, *fieldp;
|
||||
const GstVideoFrame *frame0, *frame1, *frame2, *framep;
|
||||
guint cur_field_flags = history[cur_field_idx].flags;
|
||||
gint i;
|
||||
GstDeinterlaceSimpleMethodFunction copy_scanline;
|
||||
|
@ -529,30 +537,22 @@ gst_deinterlace_simple_method_deinterlace_frame_planar (GstDeinterlaceMethod *
|
|||
copy_scanline = self->copy_scanline_planar[i];
|
||||
interpolate_scanline = self->interpolate_scanline_planar[i];
|
||||
|
||||
out = GST_VIDEO_FRAME_PLANE_DATA (outframe, i);
|
||||
framep = (cur_field_idx > 0 ? history[cur_field_idx - 1].frame : NULL);
|
||||
|
||||
fieldp = NULL;
|
||||
if (cur_field_idx > 0) {
|
||||
fieldp = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx - 1].frame, i);
|
||||
}
|
||||
|
||||
field0 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx].frame, i);
|
||||
frame0 = history[cur_field_idx].frame;
|
||||
|
||||
g_assert (dm_class->fields_required <= 4);
|
||||
|
||||
field1 = NULL;
|
||||
if (cur_field_idx + 1 < history_count) {
|
||||
field1 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx + 1].frame, i);
|
||||
}
|
||||
frame1 =
|
||||
(cur_field_idx + 1 <
|
||||
history_count ? history[cur_field_idx + 1].frame : NULL);
|
||||
frame2 =
|
||||
(cur_field_idx + 2 <
|
||||
history_count ? history[cur_field_idx + 2].frame : NULL);
|
||||
|
||||
field2 = NULL;
|
||||
if (cur_field_idx + 2 < history_count) {
|
||||
field2 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx + 2].frame, i);
|
||||
}
|
||||
|
||||
gst_deinterlace_simple_method_deinterlace_frame_planar_plane (self, out,
|
||||
field0, field1, field2, fieldp, cur_field_flags, i, copy_scanline,
|
||||
interpolate_scanline);
|
||||
gst_deinterlace_simple_method_deinterlace_frame_planar_plane (self,
|
||||
outframe, frame0, frame1, frame2, framep, cur_field_flags, i,
|
||||
copy_scanline, interpolate_scanline);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -563,8 +563,7 @@ gst_deinterlace_simple_method_deinterlace_frame_nv12 (GstDeinterlaceMethod *
|
|||
{
|
||||
GstDeinterlaceSimpleMethod *self = GST_DEINTERLACE_SIMPLE_METHOD (method);
|
||||
GstDeinterlaceMethodClass *dm_class = GST_DEINTERLACE_METHOD_GET_CLASS (self);
|
||||
guint8 *out;
|
||||
const guint8 *field0, *field1, *field2, *fieldp;
|
||||
const GstVideoFrame *frame0, *frame1, *frame2, *framep;
|
||||
guint cur_field_flags = history[cur_field_idx].flags;
|
||||
gint i;
|
||||
|
||||
|
@ -572,29 +571,21 @@ gst_deinterlace_simple_method_deinterlace_frame_nv12 (GstDeinterlaceMethod *
|
|||
g_assert (self->copy_scanline_packed != NULL);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
out = GST_VIDEO_FRAME_PLANE_DATA (outframe, i);
|
||||
framep = (cur_field_idx > 0 ? history[cur_field_idx - 1].frame : NULL);
|
||||
|
||||
fieldp = NULL;
|
||||
if (cur_field_idx > 0) {
|
||||
fieldp = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx - 1].frame, i);
|
||||
}
|
||||
|
||||
field0 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx].frame, i);
|
||||
frame0 = history[cur_field_idx].frame;
|
||||
|
||||
g_assert (dm_class->fields_required <= 4);
|
||||
|
||||
field1 = NULL;
|
||||
if (cur_field_idx + 1 < history_count) {
|
||||
field1 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx + 1].frame, i);
|
||||
}
|
||||
frame1 =
|
||||
(cur_field_idx + 1 <
|
||||
history_count ? history[cur_field_idx + 1].frame : NULL);
|
||||
frame2 =
|
||||
(cur_field_idx + 2 <
|
||||
history_count ? history[cur_field_idx + 2].frame : NULL);
|
||||
|
||||
field2 = NULL;
|
||||
if (cur_field_idx + 2 < history_count) {
|
||||
field2 = GST_VIDEO_FRAME_PLANE_DATA (history[cur_field_idx + 2].frame, i);
|
||||
}
|
||||
|
||||
gst_deinterlace_simple_method_deinterlace_frame_planar_plane (self, out,
|
||||
field0, field1, field2, fieldp, cur_field_flags, i,
|
||||
gst_deinterlace_simple_method_deinterlace_frame_planar_plane (self,
|
||||
outframe, frame0, frame1, frame2, framep, cur_field_flags, i,
|
||||
self->copy_scanline_packed, self->interpolate_scanline_packed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,12 +68,6 @@ struct _GstDeinterlaceMethod {
|
|||
GstObject parent;
|
||||
|
||||
GstVideoInfo *vinfo;
|
||||
// FIXME - the stuff below can use vinfo and macros
|
||||
gint width[4];
|
||||
gint height[4];
|
||||
gint offset[4];
|
||||
gint row_stride[4];
|
||||
gint pixel_stride[4];
|
||||
|
||||
GstDeinterlaceMethodDeinterlaceFunction deinterlace_frame;
|
||||
};
|
||||
|
@ -166,7 +160,7 @@ struct _GstDeinterlaceScanlineData {
|
|||
* All other values are NULL.
|
||||
*/
|
||||
|
||||
typedef void (*GstDeinterlaceSimpleMethodFunction) (GstDeinterlaceSimpleMethod *self, guint8 *out, const GstDeinterlaceScanlineData *scanlines);
|
||||
typedef void (*GstDeinterlaceSimpleMethodFunction) (GstDeinterlaceSimpleMethod *self, guint8 *out, const GstDeinterlaceScanlineData *scanlines, guint size);
|
||||
|
||||
struct _GstDeinterlaceSimpleMethod {
|
||||
GstDeinterlaceMethod parent;
|
||||
|
|
|
@ -70,71 +70,67 @@ typedef GstDeinterlaceSimpleMethodClass GstDeinterlaceMethodGreedyLClass;
|
|||
|
||||
static inline void
|
||||
deinterlace_greedy_interpolate_scanline_orc (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
guint max_comb = GST_DEINTERLACE_METHOD_GREEDY_L (self)->max_comb;
|
||||
|
||||
if (scanlines->m1 == NULL || scanlines->mp == NULL) {
|
||||
deinterlace_line_linear (out, scanlines->t0, scanlines->b0,
|
||||
self->parent.row_stride[0]);
|
||||
deinterlace_line_linear (out, scanlines->t0, scanlines->b0, size);
|
||||
} else {
|
||||
deinterlace_line_greedy (out, scanlines->m1, scanlines->t0, scanlines->b0,
|
||||
scanlines->mp ? scanlines->mp : scanlines->m1,
|
||||
max_comb, self->parent.row_stride[0]);
|
||||
scanlines->mp ? scanlines->mp : scanlines->m1, max_comb, size);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
deinterlace_greedy_interpolate_scanline_orc_planar_u (GstDeinterlaceSimpleMethod
|
||||
* self, guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
* self, guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint
|
||||
size)
|
||||
{
|
||||
guint max_comb = GST_DEINTERLACE_METHOD_GREEDY_L (self)->max_comb;
|
||||
|
||||
if (scanlines->m1 == NULL || scanlines->mp == NULL) {
|
||||
deinterlace_line_linear (out, scanlines->t0, scanlines->b0,
|
||||
self->parent.row_stride[1]);
|
||||
deinterlace_line_linear (out, scanlines->t0, scanlines->b0, size);
|
||||
} else {
|
||||
deinterlace_line_greedy (out, scanlines->m1, scanlines->t0, scanlines->b0,
|
||||
scanlines->mp ? scanlines->mp : scanlines->m1,
|
||||
max_comb, self->parent.row_stride[1]);
|
||||
scanlines->mp ? scanlines->mp : scanlines->m1, max_comb, size);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
deinterlace_greedy_interpolate_scanline_orc_planar_v (GstDeinterlaceSimpleMethod
|
||||
* self, guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
* self, guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint
|
||||
size)
|
||||
{
|
||||
guint max_comb = GST_DEINTERLACE_METHOD_GREEDY_L (self)->max_comb;
|
||||
|
||||
if (scanlines->m1 == NULL || scanlines->mp == NULL) {
|
||||
deinterlace_line_linear (out, scanlines->t0, scanlines->b0,
|
||||
self->parent.row_stride[2]);
|
||||
deinterlace_line_linear (out, scanlines->t0, scanlines->b0, size);
|
||||
} else {
|
||||
deinterlace_line_greedy (out, scanlines->m1, scanlines->t0, scanlines->b0,
|
||||
scanlines->mp ? scanlines->mp : scanlines->m1,
|
||||
max_comb, self->parent.row_stride[2]);
|
||||
scanlines->mp ? scanlines->mp : scanlines->m1, max_comb, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_greedy_copy_scanline (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_greedy_copy_scanline_planar_u (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[1]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_greedy_copy_scanline_planar_v (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[2]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GstDeinterlaceMethodGreedyL, gst_deinterlace_method_greedy_l,
|
||||
|
|
|
@ -726,9 +726,9 @@ deinterlace_frame_di_greedyh_packed (GstDeinterlaceMethod * method,
|
|||
GST_DEINTERLACE_METHOD_GREEDY_H_GET_CLASS (self);
|
||||
gint InfoIsOdd = 0;
|
||||
gint Line;
|
||||
gint RowStride = method->row_stride[0];
|
||||
gint RowStride = GST_VIDEO_FRAME_COMP_STRIDE (outframe, 0);
|
||||
gint FieldHeight = GST_VIDEO_INFO_HEIGHT (method->vinfo) / 2;
|
||||
gint Pitch = method->row_stride[0] * 2;
|
||||
gint Pitch = RowStride * 2;
|
||||
const guint8 *L1; // ptr to Line1, of 3
|
||||
const guint8 *L2; // ptr to Line2, the weave line
|
||||
const guint8 *L3; // ptr to Line3
|
||||
|
@ -912,9 +912,9 @@ deinterlace_frame_di_greedyh_planar (GstDeinterlaceMethod * method,
|
|||
|
||||
for (i = 0; i < 3; i++) {
|
||||
InfoIsOdd = (history[cur_field_idx - 1].flags == PICTURE_INTERLACED_BOTTOM);
|
||||
RowStride = method->row_stride[i];
|
||||
FieldHeight = method->height[i] / 2;
|
||||
Pitch = method->row_stride[i] * 2;
|
||||
RowStride = GST_VIDEO_FRAME_PLANE_STRIDE (outframe, i);
|
||||
FieldHeight = GST_VIDEO_FRAME_HEIGHT (outframe) / 2;
|
||||
Pitch = RowStride * 2;
|
||||
|
||||
if (i == 0)
|
||||
scanline = klass->scanline_planar_y;
|
||||
|
|
|
@ -56,34 +56,30 @@ deinterlace_scanline_linear_c (GstDeinterlaceSimpleMethod * self,
|
|||
|
||||
static void
|
||||
deinterlace_scanline_linear_packed_c (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
deinterlace_scanline_linear_c (self, out, scanlines->t0, scanlines->b0,
|
||||
self->parent.row_stride[0]);
|
||||
deinterlace_scanline_linear_c (self, out, scanlines->t0, scanlines->b0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_linear_planar_y_c (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
deinterlace_scanline_linear_c (self, out, scanlines->t0, scanlines->b0,
|
||||
self->parent.row_stride[0]);
|
||||
deinterlace_scanline_linear_c (self, out, scanlines->t0, scanlines->b0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_linear_planar_u_c (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
deinterlace_scanline_linear_c (self, out, scanlines->t0, scanlines->b0,
|
||||
self->parent.row_stride[1]);
|
||||
deinterlace_scanline_linear_c (self, out, scanlines->t0, scanlines->b0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_linear_planar_v_c (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
deinterlace_scanline_linear_c (self, out, scanlines->t0, scanlines->b0,
|
||||
self->parent.row_stride[2]);
|
||||
deinterlace_scanline_linear_c (self, out, scanlines->t0, scanlines->b0, size);
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GstDeinterlaceMethodLinear, gst_deinterlace_method_linear,
|
||||
|
|
|
@ -65,34 +65,34 @@ deinterlace_scanline_linear_blend_c (GstDeinterlaceSimpleMethod * self,
|
|||
|
||||
static void
|
||||
deinterlace_scanline_linear_blend_packed_c (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
deinterlace_scanline_linear_blend_c (self, out, scanlines->t0, scanlines->b0,
|
||||
scanlines->m1, self->parent.row_stride[0]);
|
||||
scanlines->m1, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_linear_blend_planar_y_c (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
deinterlace_scanline_linear_blend_c (self, out, scanlines->t0, scanlines->b0,
|
||||
scanlines->m1, self->parent.row_stride[0]);
|
||||
scanlines->m1, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_linear_blend_planar_u_c (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
deinterlace_scanline_linear_blend_c (self, out, scanlines->t0, scanlines->b0,
|
||||
scanlines->m1, self->parent.row_stride[1]);
|
||||
scanlines->m1, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_linear_blend_planar_v_c (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
deinterlace_scanline_linear_blend_c (self, out, scanlines->t0, scanlines->b0,
|
||||
scanlines->m1, self->parent.row_stride[2]);
|
||||
scanlines->m1, size);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -109,34 +109,37 @@ deinterlace_scanline_linear_blend2_c (GstDeinterlaceSimpleMethod * self,
|
|||
|
||||
static void
|
||||
deinterlace_scanline_linear_blend2_packed_c (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
deinterlace_scanline_linear_blend2_c (self, out, scanlines->m0, scanlines->t1,
|
||||
scanlines->b1, self->parent.row_stride[0]);
|
||||
scanlines->b1, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_linear_blend2_planar_y_c (GstDeinterlaceSimpleMethod *
|
||||
self, guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
self, guint8 * out, const GstDeinterlaceScanlineData * scanlines,
|
||||
guint size)
|
||||
{
|
||||
deinterlace_scanline_linear_blend2_c (self, out, scanlines->m0, scanlines->t1,
|
||||
scanlines->b1, self->parent.row_stride[0]);
|
||||
scanlines->b1, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_linear_blend2_planar_u_c (GstDeinterlaceSimpleMethod *
|
||||
self, guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
self, guint8 * out, const GstDeinterlaceScanlineData * scanlines,
|
||||
guint size)
|
||||
{
|
||||
deinterlace_scanline_linear_blend2_c (self, out, scanlines->m0, scanlines->t1,
|
||||
scanlines->b1, self->parent.row_stride[1]);
|
||||
scanlines->b1, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_linear_blend2_planar_v_c (GstDeinterlaceSimpleMethod *
|
||||
self, guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
self, guint8 * out, const GstDeinterlaceScanlineData * scanlines,
|
||||
guint size)
|
||||
{
|
||||
deinterlace_scanline_linear_blend2_c (self, out, scanlines->m0, scanlines->t1,
|
||||
scanlines->b1, self->parent.row_stride[2]);
|
||||
scanlines->b1, size);
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GstDeinterlaceMethodLinearBlend,
|
||||
|
|
|
@ -40,30 +40,30 @@ typedef GstDeinterlaceSimpleMethodClass GstDeinterlaceMethodScalerBobClass;
|
|||
|
||||
static void
|
||||
deinterlace_scanline_scaler_bob_packed (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->t0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->t0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_scaler_bob_planar_y (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->t0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->t0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_scaler_bob_planar_u (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->t0, self->parent.row_stride[1]);
|
||||
memcpy (out, scanlines->t0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_scaler_bob_planar_v (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->t0, self->parent.row_stride[2]);
|
||||
memcpy (out, scanlines->t0, size);
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GstDeinterlaceMethodScalerBob, gst_deinterlace_method_scaler_bob,
|
||||
|
|
|
@ -95,23 +95,24 @@ static void FUNCT_NAME(GstDeinterlaceMethod *d_method,
|
|||
}
|
||||
|
||||
/* double stride do address just every odd/even scanline */
|
||||
src_pitch = self->parent.row_stride[0]*2;
|
||||
dst_pitch = self->parent.row_stride[0];
|
||||
rowsize = self->parent.row_stride[0];
|
||||
src_pitch = GST_VIDEO_FRAME_PLANE_STRIDE (outframe, 0) * 2;
|
||||
dst_pitch = GST_VIDEO_FRAME_PLANE_STRIDE (outframe, 0);
|
||||
rowsize = GST_VIDEO_FRAME_PLANE_STRIDE (outframe, 0);
|
||||
|
||||
FldHeight = GST_VIDEO_INFO_HEIGHT (self->parent.vinfo) / 2;
|
||||
|
||||
pCopySrc = GST_VIDEO_FRAME_PLANE_DATA (history[history_count-1].frame, 0);
|
||||
if (history[history_count - 1].flags & PICTURE_INTERLACED_BOTTOM)
|
||||
pCopySrc += rowsize;
|
||||
pCopySrc += GST_VIDEO_FRAME_PLANE_STRIDE (history[history_count-1].frame, 0);
|
||||
pCopySrcP = GST_VIDEO_FRAME_PLANE_DATA (history[history_count-3].frame, 0);
|
||||
if (history[history_count - 3].flags & PICTURE_INTERLACED_BOTTOM)
|
||||
pCopySrcP += rowsize;
|
||||
pCopySrcP += GST_VIDEO_FRAME_PLANE_STRIDE (history[history_count-3].frame, 0);
|
||||
pWeaveSrc = GST_VIDEO_FRAME_PLANE_DATA (history[history_count-2].frame, 0);
|
||||
if (history[history_count - 2].flags & PICTURE_INTERLACED_BOTTOM)
|
||||
pWeaveSrc += rowsize;
|
||||
pWeaveSrc += GST_VIDEO_FRAME_PLANE_STRIDE (history[history_count-2].frame, 0);
|
||||
pWeaveSrcP = GST_VIDEO_FRAME_PLANE_DATA (history[history_count-4].frame, 0);
|
||||
if (history[history_count - 4].flags & PICTURE_INTERLACED_BOTTOM)
|
||||
pWeaveSrcP += rowsize;
|
||||
pWeaveSrcP += GST_VIDEO_FRAME_PLANE_STRIDE (history[history_count-4].frame, 0);
|
||||
|
||||
/* use bottom field and interlace top field */
|
||||
if (history[history_count-2].flags == PICTURE_INTERLACED_BOTTOM) {
|
||||
|
|
|
@ -77,56 +77,52 @@ deinterlace_c (guint8 * dst, const guint8 * lum_m4, const guint8 * lum_m3,
|
|||
|
||||
static void
|
||||
deinterlace_line_packed_c (GstDeinterlaceSimpleMethod * self, guint8 * dst,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
const guint8 *lum_m4 = scanlines->tt1;
|
||||
const guint8 *lum_m3 = scanlines->t0;
|
||||
const guint8 *lum_m2 = scanlines->m1;
|
||||
const guint8 *lum_m1 = scanlines->b0;
|
||||
const guint8 *lum = scanlines->bb1;
|
||||
gint size = self->parent.row_stride[0];
|
||||
|
||||
deinterlace_c (dst, lum_m4, lum_m3, lum_m2, lum_m1, lum, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_line_planar_y_c (GstDeinterlaceSimpleMethod * self, guint8 * dst,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
const guint8 *lum_m4 = scanlines->tt1;
|
||||
const guint8 *lum_m3 = scanlines->t0;
|
||||
const guint8 *lum_m2 = scanlines->m1;
|
||||
const guint8 *lum_m1 = scanlines->b0;
|
||||
const guint8 *lum = scanlines->bb1;
|
||||
gint size = self->parent.row_stride[0];
|
||||
|
||||
deinterlace_c (dst, lum_m4, lum_m3, lum_m2, lum_m1, lum, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_line_planar_u_c (GstDeinterlaceSimpleMethod * self, guint8 * dst,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
const guint8 *lum_m4 = scanlines->tt1;
|
||||
const guint8 *lum_m3 = scanlines->t0;
|
||||
const guint8 *lum_m2 = scanlines->m1;
|
||||
const guint8 *lum_m1 = scanlines->b0;
|
||||
const guint8 *lum = scanlines->bb1;
|
||||
gint size = self->parent.row_stride[1];
|
||||
|
||||
deinterlace_c (dst, lum_m4, lum_m3, lum_m2, lum_m1, lum, size);
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_line_planar_v_c (GstDeinterlaceSimpleMethod * self, guint8 * dst,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
const guint8 *lum_m4 = scanlines->tt1;
|
||||
const guint8 *lum_m3 = scanlines->t0;
|
||||
const guint8 *lum_m2 = scanlines->m1;
|
||||
const guint8 *lum_m1 = scanlines->b0;
|
||||
const guint8 *lum = scanlines->bb1;
|
||||
gint size = self->parent.row_stride[2];
|
||||
|
||||
deinterlace_c (dst, lum_m4, lum_m3, lum_m2, lum_m1, lum, size);
|
||||
}
|
||||
|
|
|
@ -46,74 +46,74 @@ typedef GstDeinterlaceSimpleMethodClass GstDeinterlaceMethodWeaveClass;
|
|||
|
||||
static void
|
||||
deinterlace_scanline_weave_packed (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
if (scanlines->m1 == NULL) {
|
||||
memcpy (out, scanlines->t0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->t0, size);
|
||||
} else {
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_weave_planar_y (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
if (scanlines->m1 == NULL) {
|
||||
memcpy (out, scanlines->t0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->t0, size);
|
||||
} else {
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_weave_planar_u (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
if (scanlines->m1 == NULL) {
|
||||
memcpy (out, scanlines->t0, self->parent.row_stride[1]);
|
||||
memcpy (out, scanlines->t0, size);
|
||||
} else {
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[1]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_weave_planar_v (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
if (scanlines->m1 == NULL) {
|
||||
memcpy (out, scanlines->t0, self->parent.row_stride[2]);
|
||||
memcpy (out, scanlines->t0, size);
|
||||
} else {
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[2]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
copy_scanline_packed (GstDeinterlaceSimpleMethod * self, guint8 * out,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_scanline_planar_y (GstDeinterlaceSimpleMethod * self, guint8 * out,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_scanline_planar_u (GstDeinterlaceSimpleMethod * self, guint8 * out,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[1]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_scanline_planar_v (GstDeinterlaceSimpleMethod * self, guint8 * out,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[2]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GstDeinterlaceMethodWeave, gst_deinterlace_method_weave,
|
||||
|
|
|
@ -46,74 +46,74 @@ typedef GstDeinterlaceSimpleMethodClass GstDeinterlaceMethodWeaveBFFClass;
|
|||
|
||||
static void
|
||||
deinterlace_scanline_weave_packed (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
if (scanlines->m1 == NULL) {
|
||||
memcpy (out, scanlines->b0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->b0, size);
|
||||
} else {
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_weave_planar_y (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
if (scanlines->m1 == NULL) {
|
||||
memcpy (out, scanlines->b0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->b0, size);
|
||||
} else {
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_weave_planar_u (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
if (scanlines->m1 == NULL) {
|
||||
memcpy (out, scanlines->b0, self->parent.row_stride[1]);
|
||||
memcpy (out, scanlines->b0, size);
|
||||
} else {
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[1]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_weave_planar_v (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
if (scanlines->m1 == NULL) {
|
||||
memcpy (out, scanlines->b0, self->parent.row_stride[2]);
|
||||
memcpy (out, scanlines->b0, size);
|
||||
} else {
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[2]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
copy_scanline_packed (GstDeinterlaceSimpleMethod * self, guint8 * out,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_scanline_planar_y (GstDeinterlaceSimpleMethod * self, guint8 * out,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_scanline_planar_u (GstDeinterlaceSimpleMethod * self, guint8 * out,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[1]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_scanline_planar_v (GstDeinterlaceSimpleMethod * self, guint8 * out,
|
||||
const GstDeinterlaceScanlineData * scanlines)
|
||||
const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[2]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GstDeinterlaceMethodWeaveBFF, gst_deinterlace_method_weave_bff,
|
||||
|
|
|
@ -47,74 +47,74 @@ typedef GstDeinterlaceSimpleMethodClass GstDeinterlaceMethodWeaveTFFClass;
|
|||
|
||||
static void
|
||||
deinterlace_scanline_weave_packed (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
if (scanlines->m1 == NULL) {
|
||||
memcpy (out, scanlines->t0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->t0, size);
|
||||
} else {
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_weave_planar_y (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
if (scanlines->m1 == NULL) {
|
||||
memcpy (out, scanlines->t0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->t0, size);
|
||||
} else {
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_weave_planar_u (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
if (scanlines->m1 == NULL) {
|
||||
memcpy (out, scanlines->t0, self->parent.row_stride[1]);
|
||||
memcpy (out, scanlines->t0, size);
|
||||
} else {
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[1]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterlace_scanline_weave_planar_v (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
if (scanlines->m1 == NULL) {
|
||||
memcpy (out, scanlines->t0, self->parent.row_stride[2]);
|
||||
memcpy (out, scanlines->t0, size);
|
||||
} else {
|
||||
memcpy (out, scanlines->m1, self->parent.row_stride[2]);
|
||||
memcpy (out, scanlines->m1, size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
copy_scanline_packed (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_scanline_planar_y (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[0]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_scanline_planar_u (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[1]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_scanline_planar_v (GstDeinterlaceSimpleMethod * self,
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines)
|
||||
guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
|
||||
{
|
||||
memcpy (out, scanlines->m0, self->parent.row_stride[2]);
|
||||
memcpy (out, scanlines->m0, size);
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GstDeinterlaceMethodWeaveTFF, gst_deinterlace_method_weave_tff,
|
||||
|
|
Loading…
Reference in a new issue