mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
videoscale: Make sure to allocate enough memory for the temporary buffer
and fix scaling of odd-height interlaced video.
This commit is contained in:
parent
c51d2febd3
commit
b69f5e2c66
1 changed files with 9 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue