summaryrefslogtreecommitdiff
path: root/gst/videoscale
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-07-28 15:54:14 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-08-06 06:43:32 +0200
commitb69f5e2c66bcd821654d340b326a7fb7be981aa7 (patch)
treeac90e44c017b6bc31a5581a04a2276c2f40b48cc /gst/videoscale
parentc51d2febd3cb99be1365234cf3947e4d91b1cb61 (diff)
videoscale: Make sure to allocate enough memory for the temporary buffer
and fix scaling of odd-height interlaced video.
Diffstat (limited to 'gst/videoscale')
-rw-r--r--gst/videoscale/gstvideoscale.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c
index 690e517fa..9f232f489 100644
--- a/gst/videoscale/gstvideoscale.c
+++ b/gst/videoscale/gstvideoscale.c
@@ -546,7 +546,8 @@ gst_video_scale_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
if (videoscale->tmp_buf)
g_free (videoscale->tmp_buf);
- videoscale->tmp_buf = g_malloc (videoscale->dest.stride * 4);
+ videoscale->tmp_buf =
+ g_malloc (videoscale->dest.stride * 4 * (videoscale->interlaced ? 2 : 1));
/* FIXME: par */
GST_DEBUG_OBJECT (videoscale, "from=%dx%d, size %d -> to=%dx%d, size %d",
@@ -789,6 +790,13 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
dest.height += 1;
}
} else if (step == 1 && interlaced) {
+ if (videoscale->from_height % 2 == 1) {
+ src.height -= 1;
+ }
+
+ if (videoscale->to_height % 2 == 1) {
+ dest.height -= 1;
+ }
src.pixels += (src.stride / 2);
dest.pixels += (dest.stride / 2);
}