summaryrefslogtreecommitdiffstats
path: root/gst/deinterlace
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-12-18 23:43:47 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-12-18 23:43:47 +0000
commit143e26e9ea8de0aacbe49ea2a6e0b84bbadccb4f (patch)
tree11d2ff8a605a24847429523be01150f473d80307 /gst/deinterlace
parent27fe4e9b6835bd3760b94a750739f5028e7e7927 (diff)
downloadgst-plugins-bad-143e26e9ea8de0aacbe49ea2a6e0b84bbadccb4f.tar.gz
gst-plugins-bad-143e26e9ea8de0aacbe49ea2a6e0b84bbadccb4f.tar.bz2
gst-plugins-bad-143e26e9ea8de0aacbe49ea2a6e0b84bbadccb4f.zip
gst/deinterlace/gstdeinterlace.c: Rowstride fixes. Fixes #161039.
Original commit message from CVS: Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net> * gst/deinterlace/gstdeinterlace.c: (gst_deinterlace_link), (gst_deinterlace_chain): Rowstride fixes. Fixes #161039. * gst/videocrop/gstvideocrop.c: (gst_video_crop_init), (gst_video_crop_get_property), (gst_video_crop_add_to_struct_val), (gst_video_crop_getcaps), (gst_video_crop_link), (gst_video_crop_i420), (gst_video_crop_chain), (gst_video_crop_change_state): Rework of negotiation. Actually works now. Fixes #158650.
Diffstat (limited to 'gst/deinterlace')
-rw-r--r--gst/deinterlace/gstdeinterlace.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c
index 20da65cc..0b178492 100644
--- a/gst/deinterlace/gstdeinterlace.c
+++ b/gst/deinterlace/gstdeinterlace.c
@@ -27,6 +27,21 @@
#include <gst/video/video.h>
#include "gstdeinterlace.h"
+/* these macros are adapted from videotestsrc, paint_setup_I420() */
+#define ROUND_UP_2(x) (((x)+1)&~1)
+#define ROUND_UP_4(x) (((x)+3)&~3)
+#define ROUND_UP_8(x) (((x)+7)&~7)
+
+#define GST_VIDEO_I420_Y_ROWSTRIDE(width) (ROUND_UP_4(width))
+#define GST_VIDEO_I420_U_ROWSTRIDE(width) (ROUND_UP_8(width)/2)
+#define GST_VIDEO_I420_V_ROWSTRIDE(width) ((ROUND_UP_8(GST_VIDEO_I420_Y_ROWSTRIDE(width)))/2)
+
+#define GST_VIDEO_I420_Y_OFFSET(w,h) (0)
+#define GST_VIDEO_I420_U_OFFSET(w,h) (GST_VIDEO_I420_Y_OFFSET(w,h)+(GST_VIDEO_I420_Y_ROWSTRIDE(w)*ROUND_UP_2(h)))
+#define GST_VIDEO_I420_V_OFFSET(w,h) (GST_VIDEO_I420_U_OFFSET(w,h)+(GST_VIDEO_I420_U_ROWSTRIDE(w)*ROUND_UP_2(h)/2))
+
+#define GST_VIDEO_I420_SIZE(w,h) (GST_VIDEO_I420_V_OFFSET(w,h)+(GST_VIDEO_I420_V_ROWSTRIDE(w)*ROUND_UP_2(h)/2))
+
/* elementfactory information */
static GstElementDetails deinterlace_details =
GST_ELEMENT_DETAILS ("Deinterlace",
@@ -173,10 +188,10 @@ gst_deinterlace_link (GstPad * pad, const GstCaps * caps)
gst_structure_get_int (structure, "width", &filter->width);
gst_structure_get_int (structure, "height", &filter->height);
- if (filter->picsize != (filter->width * filter->height)) {
+ if (filter->picsize != GST_VIDEO_I420_SIZE (filter->width, filter->height)) {
if (filter->src)
g_free (filter->src);
- filter->picsize = filter->width * filter->height;
+ filter->picsize = GST_VIDEO_I420_SIZE (filter->width, filter->height);
filter->src = g_malloc (filter->picsize);
}
@@ -250,7 +265,7 @@ gst_deinterlace_chain (GstPad * pad, GstData * _data)
/* 2 pixels per 2 lines = 4 pixel and we don't want to change */
/* the color of */
- y_line = width;
+ y_line = GST_VIDEO_I420_Y_ROWSTRIDE (width);
y_src = src;
iThreshold = iThreshold * iThreshold * 4;