bayer: fix stride inconsistencies for odd widths

Consistently use GST_ROUND_UP_4(width) as stride for
bayer buffers. Bayer data will usually come in widths
that are multiples of 4 anyway, so hopefully this
should not have any adverse impact on anyone in
practice.

Before, bayer2rgb required input buffers to are sized
accordingly, but then didn't actually round up when
calculating row offsets. rgb2bayer didn't use a rounded
stride nor buffer size.

https://bugzilla.gnome.org/show_bug.cgi?id=752014
This commit is contained in:
Tim-Philipp Müller 2016-01-08 21:41:56 +00:00 committed by Sebastian Dröge
parent 9e6f39fdc7
commit d42177c89e
2 changed files with 3 additions and 3 deletions

View file

@ -470,7 +470,7 @@ gst_bayer2rgb_transform (GstBaseTransform * base, GstBuffer * inbuf,
output = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0); output = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0);
gst_bayer2rgb_process (filter, output, frame.info.stride[0], gst_bayer2rgb_process (filter, output, frame.info.stride[0],
map.data, filter->width); map.data, GST_ROUND_UP_4 (filter->width));
gst_video_frame_unmap (&frame); gst_video_frame_unmap (&frame);
gst_buffer_unmap (inbuf, &map); gst_buffer_unmap (inbuf, &map);

View file

@ -173,7 +173,7 @@ gst_rgb2bayer_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
name = gst_structure_get_name (structure); name = gst_structure_get_name (structure);
/* Our name must be either video/x-bayer video/x-raw */ /* Our name must be either video/x-bayer video/x-raw */
if (g_str_equal (name, "video/x-bayer")) { if (g_str_equal (name, "video/x-bayer")) {
*size = width * height; *size = GST_ROUND_UP_4 (width) * height;
return TRUE; return TRUE;
} else { } else {
/* For output, calculate according to format */ /* For output, calculate according to format */
@ -249,7 +249,7 @@ gst_rgb2bayer_transform (GstBaseTransform * trans, GstBuffer * inbuf,
src = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0); src = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0);
for (j = 0; j < height; j++) { for (j = 0; j < height; j++) {
guint8 *dest_line = dest + width * j; guint8 *dest_line = dest + GST_ROUND_UP_4 (width) * j;
guint8 *src_line = src + frame.info.stride[0] * j; guint8 *src_line = src + frame.info.stride[0] * j;
for (i = 0; i < width; i++) { for (i = 0; i < width; i++) {