mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
gloverlay: Fix upside down and miss-aligned JPEG
LibJPEG uses macroblock of 8x8 sample. In this element we use RGB and Y444, two 24bit formats that are stored in 32bit pixels. This mean we have 32x32 bytes macroblocks. For this reason, we need to allocate our buffer slightly larger. We also need to pass the line pointer in the right order, otherwise the image endup upside-down. https://bugzilla.gnome.org/show_bug.cgi?id=745109
This commit is contained in:
parent
d387cf67df
commit
eff94f929d
1 changed files with 7 additions and 4 deletions
|
@ -610,6 +610,7 @@ gst_gl_overlay_load_jpeg (GstGLFilter * filter)
|
|||
{
|
||||
GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
|
||||
GstVideoInfo v_info;
|
||||
GstVideoAlignment v_align;
|
||||
GstMapInfo map_info;
|
||||
FILE *fp = NULL;
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
|
@ -637,9 +638,13 @@ gst_gl_overlay_load_jpeg (GstGLFilter * filter)
|
|||
gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGB,
|
||||
overlay->image_width, overlay->image_height);
|
||||
|
||||
gst_video_alignment_reset (&v_align);
|
||||
v_align.stride_align[0] = 32 - 1;
|
||||
gst_video_info_align (&v_info, &v_align);
|
||||
|
||||
overlay->image_memory =
|
||||
(GstGLMemory *) gst_gl_memory_alloc (filter->context, NULL, &v_info, 0,
|
||||
NULL);
|
||||
&v_align);
|
||||
|
||||
if (!gst_memory_map ((GstMemory *) overlay->image_memory, &map_info,
|
||||
GST_MAP_WRITE)) {
|
||||
|
@ -647,9 +652,7 @@ gst_gl_overlay_load_jpeg (GstGLFilter * filter)
|
|||
}
|
||||
|
||||
for (i = 0; i < overlay->image_height; ++i) {
|
||||
j = (map_info.data +
|
||||
(((int) overlay->image_height - (i +
|
||||
1)) * (int) overlay->image_width * cinfo.num_components));
|
||||
j = map_info.data + v_info.stride[0] * i;
|
||||
jpeg_read_scanlines (&cinfo, &j, 1);
|
||||
}
|
||||
jpeg_finish_decompress (&cinfo);
|
||||
|
|
Loading…
Reference in a new issue