summaryrefslogtreecommitdiffstats
path: root/gst/deinterlace2
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-04-15 15:46:44 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-04-15 15:46:44 +0200
commite539615c790ab9cdc2de647a3786e706a89c04d5 (patch)
treeacb7c9b9e45431e01d25af682f44aeb748575936 /gst/deinterlace2
parentb66a6f90beb4edb7cd96399880fae9892f827c11 (diff)
downloadgst-plugins-bad-e539615c790ab9cdc2de647a3786e706a89c04d5.tar.gz
gst-plugins-bad-e539615c790ab9cdc2de647a3786e706a89c04d5.tar.bz2
gst-plugins-bad-e539615c790ab9cdc2de647a3786e706a89c04d5.zip
deinterlace2: Move output buffer from the instance struct to a function parameter
Diffstat (limited to 'gst/deinterlace2')
-rw-r--r--gst/deinterlace2/gstdeinterlace2.c42
-rw-r--r--gst/deinterlace2/gstdeinterlace2.h8
-rw-r--r--gst/deinterlace2/tvtime/greedy.c4
-rw-r--r--gst/deinterlace2/tvtime/greedyh.c4
-rw-r--r--gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll.inc8
5 files changed, 29 insertions, 37 deletions
diff --git a/gst/deinterlace2/gstdeinterlace2.c b/gst/deinterlace2/gstdeinterlace2.c
index b475d5b6..98693d88 100644
--- a/gst/deinterlace2/gstdeinterlace2.c
+++ b/gst/deinterlace2/gstdeinterlace2.c
@@ -72,11 +72,11 @@ gst_deinterlace_method_init (GstDeinterlaceMethod * self)
static void
gst_deinterlace_method_deinterlace_frame (GstDeinterlaceMethod * self,
- GstDeinterlace2 * parent)
+ GstDeinterlace2 * parent, GstBuffer * outbuf)
{
GstDeinterlaceMethodClass *klass = GST_DEINTERLACE_METHOD_GET_CLASS (self);
- klass->deinterlace_frame (self, parent);
+ klass->deinterlace_frame (self, parent, outbuf);
}
static gint
@@ -117,13 +117,13 @@ gst_deinterlace_simple_method_copy_scanline (GstDeinterlaceMethod * self,
static void
gst_deinterlace_simple_method_deinterlace_frame (GstDeinterlaceMethod * self,
- GstDeinterlace2 * parent)
+ GstDeinterlace2 * parent, GstBuffer * outbuf)
{
GstDeinterlaceSimpleMethodClass *dsm_class =
GST_DEINTERLACE_SIMPLE_METHOD_GET_CLASS (self);
GstDeinterlaceMethodClass *dm_class = GST_DEINTERLACE_METHOD_GET_CLASS (self);
GstDeinterlaceScanlineData scanlines;
- guint8 *out = GST_BUFFER_DATA (parent->out_buf);
+ guint8 *out = GST_BUFFER_DATA (outbuf);
guint8 *field0 = NULL, *field1 = NULL, *field2 = NULL, *field3 = NULL;
gint cur_field_idx = parent->history_count - dm_class->fields_required;
guint cur_field_flags = parent->field_history[cur_field_idx].flags;
@@ -570,11 +570,6 @@ gst_deinterlace2_reset_history (GstDeinterlace2 * self)
static void
gst_deinterlace2_reset (GstDeinterlace2 * self)
{
- if (self->out_buf) {
- gst_buffer_unref (self->out_buf);
- self->out_buf = NULL;
- }
-
self->output_stride = 0;
self->line_length = 0;
self->frame_width = 0;
@@ -748,6 +743,7 @@ gst_deinterlace2_chain (GstPad * pad, GstBuffer * buf)
GstFlowReturn ret = GST_FLOW_OK;
gint fields_required = 0;
gint cur_field_idx = 0;
+ GstBuffer *outbuf;
self = GST_DEINTERLACE2 (GST_PAD_PARENT (pad));
@@ -781,12 +777,12 @@ gst_deinterlace2_chain (GstPad * pad, GstBuffer * buf)
/* create new buffer */
ret = gst_pad_alloc_buffer_and_set_caps (self->srcpad,
GST_BUFFER_OFFSET_NONE, self->frame_size,
- GST_PAD_CAPS (self->srcpad), &self->out_buf);
+ GST_PAD_CAPS (self->srcpad), &outbuf);
if (ret != GST_FLOW_OK)
return ret;
/* do magic calculus */
- gst_deinterlace_method_deinterlace_frame (self->method, self);
+ gst_deinterlace_method_deinterlace_frame (self->method, self, outbuf);
g_assert (self->history_count - 1 -
gst_deinterlace_method_get_latency (self->method) >= 0);
@@ -797,14 +793,14 @@ gst_deinterlace2_chain (GstPad * pad, GstBuffer * buf)
gst_buffer_unref (gst_deinterlace2_pop_history (self));
- GST_BUFFER_TIMESTAMP (self->out_buf) = timestamp;
+ GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
if (self->fields == GST_DEINTERLACE2_ALL)
- GST_BUFFER_DURATION (self->out_buf) = self->field_duration;
+ GST_BUFFER_DURATION (outbuf) = self->field_duration;
else
- GST_BUFFER_DURATION (self->out_buf) = 2 * self->field_duration;
+ GST_BUFFER_DURATION (outbuf) = 2 * self->field_duration;
- ret = gst_pad_push (self->srcpad, self->out_buf);
- self->out_buf = NULL;
+ ret = gst_pad_push (self->srcpad, outbuf);
+ outbuf = NULL;
if (ret != GST_FLOW_OK)
return ret;
}
@@ -828,12 +824,12 @@ gst_deinterlace2_chain (GstPad * pad, GstBuffer * buf)
/* create new buffer */
ret = gst_pad_alloc_buffer_and_set_caps (self->srcpad,
GST_BUFFER_OFFSET_NONE, self->frame_size,
- GST_PAD_CAPS (self->srcpad), &self->out_buf);
+ GST_PAD_CAPS (self->srcpad), &outbuf);
if (ret != GST_FLOW_OK)
return ret;
/* do magic calculus */
- gst_deinterlace_method_deinterlace_frame (self->method, self);
+ gst_deinterlace_method_deinterlace_frame (self->method, self, outbuf);
g_assert (self->history_count - 1 -
gst_deinterlace_method_get_latency (self->method) >= 0);
@@ -844,14 +840,14 @@ gst_deinterlace2_chain (GstPad * pad, GstBuffer * buf)
gst_buffer_unref (gst_deinterlace2_pop_history (self));
- GST_BUFFER_TIMESTAMP (self->out_buf) = timestamp;
+ GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
if (self->fields == GST_DEINTERLACE2_ALL)
- GST_BUFFER_DURATION (self->out_buf) = self->field_duration;
+ GST_BUFFER_DURATION (outbuf) = self->field_duration;
else
- GST_BUFFER_DURATION (self->out_buf) = 2 * self->field_duration;
+ GST_BUFFER_DURATION (outbuf) = 2 * self->field_duration;
- ret = gst_pad_push (self->srcpad, self->out_buf);
- self->out_buf = NULL;
+ ret = gst_pad_push (self->srcpad, outbuf);
+ outbuf = NULL;
if (ret != GST_FLOW_OK)
return ret;
diff --git a/gst/deinterlace2/gstdeinterlace2.h b/gst/deinterlace2/gstdeinterlace2.h
index 35cb55bf..ee40504b 100644
--- a/gst/deinterlace2/gstdeinterlace2.h
+++ b/gst/deinterlace2/gstdeinterlace2.h
@@ -74,7 +74,7 @@ struct _GstDeinterlaceMethodClass {
guint fields_required;
guint latency;
- void (*deinterlace_frame) (GstDeinterlaceMethod *self, GstDeinterlace2 * parent);
+ void (*deinterlace_frame) (GstDeinterlaceMethod *self, GstDeinterlace2 * parent, GstBuffer *outbuf);
const gchar *name;
const gchar *nick;
@@ -193,8 +193,6 @@ struct _GstDeinterlace2
GstPad *srcpad, *sinkpad;
- guint history_count;
-
GstDeinterlace2FieldLayout field_layout;
guint frame_size;
@@ -215,9 +213,7 @@ struct _GstDeinterlace2
the program just started or a picture was skipped.
*/
GstPicture field_history[MAX_FIELD_HISTORY];
-
- /* Current overlay buffer pointer. */
- GstBuffer *out_buf;
+ guint history_count;
/* Overlay pitch (number of bytes between scanlines). */
guint output_stride;
diff --git a/gst/deinterlace2/tvtime/greedy.c b/gst/deinterlace2/tvtime/greedy.c
index e3b24737..f364c094 100644
--- a/gst/deinterlace2/tvtime/greedy.c
+++ b/gst/deinterlace2/tvtime/greedy.c
@@ -335,7 +335,7 @@ deinterlace_greedy_packed422_scanline_mmxext (GstDeinterlaceMethodGreedyL *
static void
deinterlace_frame_di_greedy (GstDeinterlaceMethod * d_method,
- GstDeinterlace2 * object)
+ GstDeinterlace2 * object, GstBuffer * outbuf)
{
GstDeinterlaceMethodGreedyL *self =
GST_DEINTERLACE_METHOD_GREEDY_L (d_method);
@@ -349,7 +349,7 @@ deinterlace_frame_di_greedy (GstDeinterlaceMethod * d_method,
unsigned char *L3; // ptr to Line3
unsigned char *L2P; // ptr to prev Line2
- unsigned char *Dest = GST_BUFFER_DATA (object->out_buf);
+ unsigned char *Dest = GST_BUFFER_DATA (outbuf);
// copy first even line no matter what, and the first odd line if we're
// processing an EVEN field. (note diff from other deint rtns.)
diff --git a/gst/deinterlace2/tvtime/greedyh.c b/gst/deinterlace2/tvtime/greedyh.c
index 619a9455..0b4dc463 100644
--- a/gst/deinterlace2/tvtime/greedyh.c
+++ b/gst/deinterlace2/tvtime/greedyh.c
@@ -235,7 +235,7 @@ greedyDScaler_C (GstDeinterlaceMethodGreedyH * self, uint8_t * L1, uint8_t * L2,
static void
deinterlace_frame_di_greedyh (GstDeinterlaceMethod * d_method,
- GstDeinterlace2 * object)
+ GstDeinterlace2 * object, GstBuffer * outbuf)
{
GstDeinterlaceMethodGreedyH *self =
GST_DEINTERLACE_METHOD_GREEDY_H (d_method);
@@ -250,7 +250,7 @@ deinterlace_frame_di_greedyh (GstDeinterlaceMethod * d_method,
unsigned char *L3; // ptr to Line3
unsigned char *L2P; // ptr to prev Line2
- unsigned char *Dest = GST_BUFFER_DATA (object->out_buf);
+ unsigned char *Dest = GST_BUFFER_DATA (outbuf);
// copy first even line no matter what, and the first odd line if we're
// processing an EVEN field. (note diff from other deint rtns.)
diff --git a/gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll.inc b/gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll.inc
index d38cf019..f014aeb4 100644
--- a/gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll.inc
+++ b/gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll.inc
@@ -61,7 +61,7 @@
#define SEFUNC(x) Search_Effort_C_##x(src_pitch, dst_pitch, rowsize, pWeaveSrc, pWeaveSrcP, pWeaveDest, IsOdd, pCopySrc, pCopySrcP, FldHeight)
#endif
-void FUNCT_NAME(GstDeinterlaceMethod *d_method, GstDeinterlace2* object)
+void FUNCT_NAME(GstDeinterlaceMethod *d_method, GstDeinterlace2* object, GstBuffer *outbuf)
{
GstDeinterlaceMethodTomsMoComp *self = GST_DEINTERLACE_METHOD_TOMSMOCOMP (d_method);
long SearchEffort = self->search_effort;
@@ -94,7 +94,7 @@ void FUNCT_NAME(GstDeinterlaceMethod *d_method, GstDeinterlace2* object)
IsOdd = 1;
// if we have an odd field we copy an even field and weave an odd field
- pCopyDest = GST_BUFFER_DATA(object->out_buf);
+ pCopyDest = GST_BUFFER_DATA(outbuf);
pWeaveDest = pCopyDest + dst_pitch;
}
/* do it vice verca */
@@ -102,8 +102,8 @@ void FUNCT_NAME(GstDeinterlaceMethod *d_method, GstDeinterlace2* object)
IsOdd = 0;
// if we have an even field we copy an odd field and weave an even field
- pCopyDest = GST_BUFFER_DATA(object->out_buf) + dst_pitch;
- pWeaveDest = GST_BUFFER_DATA(object->out_buf);
+ pCopyDest = GST_BUFFER_DATA(outbuf) + dst_pitch;
+ pWeaveDest = GST_BUFFER_DATA(outbuf);
}