mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
video-scaler: fix temp line allocation
We need to allocate the templine with the amount of pixels we are going to handle, which we only know for the vertical resampler when we are asked to resample.
This commit is contained in:
parent
67a4702b19
commit
3286320297
1 changed files with 17 additions and 4 deletions
|
@ -62,6 +62,7 @@ struct _GstVideoScaler
|
||||||
/* for ORC */
|
/* for ORC */
|
||||||
gint inc;
|
gint inc;
|
||||||
|
|
||||||
|
gint tmpwidth;
|
||||||
guint32 *tmpline1;
|
guint32 *tmpline1;
|
||||||
guint32 *tmpline2;
|
guint32 *tmpline2;
|
||||||
};
|
};
|
||||||
|
@ -106,6 +107,16 @@ resampler_zip (GstVideoResampler * resampler, const GstVideoResampler * r1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
realloc_tmplines (GstVideoScaler * scale, gint width)
|
||||||
|
{
|
||||||
|
scale->tmpline1 =
|
||||||
|
g_realloc (scale->tmpline1,
|
||||||
|
sizeof (gint32) * width * 4 * scale->resampler.max_taps);
|
||||||
|
scale->tmpline2 = g_realloc (scale->tmpline2, sizeof (gint32) * width * 4);
|
||||||
|
scale->tmpwidth = width;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_video_scaler_new:
|
* gst_video_scaler_new:
|
||||||
* @method: a #GstVideoResamplerMethod
|
* @method: a #GstVideoResamplerMethod
|
||||||
|
@ -164,10 +175,6 @@ gst_video_scaler_new (GstVideoResamplerMethod method, GstVideoScalerFlags flags,
|
||||||
else
|
else
|
||||||
scale->inc = ((in_size - 1) << 16) / (out_size - 1) - 1;
|
scale->inc = ((in_size - 1) << 16) / (out_size - 1) - 1;
|
||||||
|
|
||||||
scale->tmpline1 =
|
|
||||||
g_malloc (sizeof (gint32) * out_size * 4 * scale->resampler.max_taps);
|
|
||||||
scale->tmpline2 = g_malloc (sizeof (gint32) * out_size * 4);
|
|
||||||
|
|
||||||
return scale;
|
return scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -727,6 +734,9 @@ gst_video_scaler_horizontal (GstVideoScaler * scale, GstVideoFormat format,
|
||||||
pstride = finfo->pixel_stride[0];
|
pstride = finfo->pixel_stride[0];
|
||||||
g_return_if_fail (pstride == 4 || pstride == 8);
|
g_return_if_fail (pstride == 4 || pstride == 8);
|
||||||
|
|
||||||
|
if (scale->tmpwidth < width)
|
||||||
|
realloc_tmplines (scale, width);
|
||||||
|
|
||||||
switch (pstride) {
|
switch (pstride) {
|
||||||
case 4:
|
case 4:
|
||||||
switch (scale->resampler.max_taps) {
|
switch (scale->resampler.max_taps) {
|
||||||
|
@ -797,6 +807,9 @@ gst_video_scaler_vertical (GstVideoScaler * scale, GstVideoFormat format,
|
||||||
pstride = finfo->pixel_stride[0];
|
pstride = finfo->pixel_stride[0];
|
||||||
g_return_if_fail (pstride == 4 || pstride == 8);
|
g_return_if_fail (pstride == 4 || pstride == 8);
|
||||||
|
|
||||||
|
if (scale->tmpwidth < width)
|
||||||
|
realloc_tmplines (scale, width);
|
||||||
|
|
||||||
switch (pstride) {
|
switch (pstride) {
|
||||||
case 4:
|
case 4:
|
||||||
switch (scale->resampler.max_taps) {
|
switch (scale->resampler.max_taps) {
|
||||||
|
|
Loading…
Reference in a new issue