mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-05 02:02:26 +00:00
videoconvert: also allocate temp lines in fastpath
Some of the fastpath functions need tmplines, so make sure we allocate some in the fastpath too. This avoids SEGFAULTs with odd heights. See https://bugzilla.gnome.org/show_bug.cgi?id=663248
This commit is contained in:
parent
0b693deb3d
commit
22da49a55c
1 changed files with 13 additions and 7 deletions
|
@ -378,12 +378,22 @@ videoconvert_dither_halftone (VideoConvert * convert, guint16 * pixels, int j)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
alloc_tmplines (VideoConvert * convert, guint lines, gint width)
|
||||||
|
{
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
convert->n_tmplines = lines;
|
||||||
|
convert->tmplines = g_malloc (lines * sizeof (gpointer));
|
||||||
|
for (i = 0; i < lines; i++)
|
||||||
|
convert->tmplines[i] = g_malloc (sizeof (guint16) * (width + 8) * 4);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
videoconvert_convert_compute_resample (VideoConvert * convert)
|
videoconvert_convert_compute_resample (VideoConvert * convert)
|
||||||
{
|
{
|
||||||
GstVideoInfo *in_info, *out_info;
|
GstVideoInfo *in_info, *out_info;
|
||||||
const GstVideoFormatInfo *sfinfo, *dfinfo;
|
const GstVideoFormatInfo *sfinfo, *dfinfo;
|
||||||
gint lines, i;
|
|
||||||
gint width;
|
gint width;
|
||||||
|
|
||||||
in_info = &convert->in_info;
|
in_info = &convert->in_info;
|
||||||
|
@ -431,12 +441,7 @@ videoconvert_convert_compute_resample (VideoConvert * convert)
|
||||||
convert->downsample, out_info->chroma_site, convert->down_offset,
|
convert->downsample, out_info->chroma_site, convert->down_offset,
|
||||||
convert->down_n_lines);
|
convert->down_n_lines);
|
||||||
|
|
||||||
lines = convert->down_n_lines + convert->up_n_lines;
|
alloc_tmplines (convert, convert->down_n_lines + convert->up_n_lines, width);
|
||||||
|
|
||||||
convert->n_tmplines = lines;
|
|
||||||
convert->tmplines = g_malloc (lines * sizeof (gpointer));
|
|
||||||
for (i = 0; i < lines; i++)
|
|
||||||
convert->tmplines[i] = g_malloc (sizeof (guint16) * (width + 8) * 4);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1447,6 +1452,7 @@ videoconvert_convert_lookup_fastpath (VideoConvert * convert)
|
||||||
(transforms[i].keeps_interlaced || !interlaced)) {
|
(transforms[i].keeps_interlaced || !interlaced)) {
|
||||||
GST_DEBUG ("using fastpath");
|
GST_DEBUG ("using fastpath");
|
||||||
convert->convert = transforms[i].convert;
|
convert->convert = transforms[i].convert;
|
||||||
|
alloc_tmplines (convert, 1, GST_VIDEO_INFO_WIDTH (&convert->in_info));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue