mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
ffmpegcolorspace: Fix IYU1 support
Fix conversions to IYU1, they allocated infinite amounts of memory before because no conversion to IYU1 was actually implemented and it was running into an infinite loop trying to find suitable intermediate formats. Also fix the stride and sizes used for IYU1.
This commit is contained in:
parent
0d39e2896e
commit
1469453cb9
2 changed files with 41 additions and 4 deletions
|
@ -958,14 +958,14 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture,
|
|||
picture->linesize[0] = stride;
|
||||
return size;
|
||||
case PIX_FMT_UYVY411:
|
||||
/* FIXME, probably not the right stride */
|
||||
stride = GST_ROUND_UP_4 (width);
|
||||
stride =
|
||||
GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) + GST_ROUND_UP_4 (width) / 2);
|
||||
size = stride * height;
|
||||
picture->data[0] = ptr;
|
||||
picture->data[1] = NULL;
|
||||
picture->data[2] = NULL;
|
||||
picture->linesize[0] = width + width / 2;
|
||||
return size + size / 2;
|
||||
picture->linesize[0] = stride;
|
||||
return size;
|
||||
case PIX_FMT_Y800:
|
||||
case PIX_FMT_GRAY8:
|
||||
stride = GST_ROUND_UP_4 (width);
|
||||
|
|
|
@ -1324,6 +1324,42 @@ uyvy411_to_yuv411p (AVPicture * dst, const AVPicture * src,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
yuv411p_to_uyvy411 (AVPicture * dst, const AVPicture * src,
|
||||
int width, int height)
|
||||
{
|
||||
uint8_t *p, *p1;
|
||||
const uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
|
||||
int w;
|
||||
|
||||
p1 = dst->data[0];
|
||||
lum1 = src->data[0];
|
||||
cb1 = src->data[1];
|
||||
cr1 = src->data[2];
|
||||
for (; height > 0; height--) {
|
||||
p = p1;
|
||||
lum = lum1;
|
||||
cb = cb1;
|
||||
cr = cr1;
|
||||
for (w = width; w >= 4; w -= 4) {
|
||||
p[0] = cb[0];
|
||||
p[1] = lum[0];
|
||||
p[2] = lum[1];
|
||||
p[3] = cr[0];
|
||||
p[4] = lum[2];
|
||||
p[5] = lum[3];
|
||||
p += 6;
|
||||
lum += 4;
|
||||
cb++;
|
||||
cr++;
|
||||
}
|
||||
p1 += dst->linesize[0];
|
||||
lum1 += src->linesize[0];
|
||||
cb1 += src->linesize[1];
|
||||
cr1 += src->linesize[2];
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
yuv420p_to_yuv422 (AVPicture * dst, const AVPicture * src,
|
||||
int width, int height)
|
||||
|
@ -3437,6 +3473,7 @@ static ConvertEntry convert_table[] = {
|
|||
{PIX_FMT_PAL8, PIX_FMT_ABGR32, pal8_to_abgr32},
|
||||
|
||||
{PIX_FMT_UYVY411, PIX_FMT_YUV411P, uyvy411_to_yuv411p},
|
||||
{PIX_FMT_YUV411P, PIX_FMT_UYVY411, yuv411p_to_uyvy411},
|
||||
|
||||
{PIX_FMT_V308, PIX_FMT_RGB24, v308_to_rgb24},
|
||||
|
||||
|
|
Loading…
Reference in a new issue