Commit 5f61df82 authored by David Schleef's avatar David Schleef

video: Fix YUV9 and YVU9 again

parent f728ee39
......@@ -1937,12 +1937,12 @@ gst_video_format_get_component_offset (GstVideoFormat format,
if (component == 0)
return 0;
if (component == 1) {
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) +
return GST_ROUND_UP_4 (width) * height +
GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4) *
(GST_ROUND_UP_4 (height) / 4);
}
if (component == 2)
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
return GST_ROUND_UP_4 (width) * height;
return 0;
case GST_VIDEO_FORMAT_IYU1:
if (component == 0)
......@@ -2054,7 +2054,7 @@ gst_video_format_get_size (GstVideoFormat format, int width, int height)
return size;
case GST_VIDEO_FORMAT_YUV9:
case GST_VIDEO_FORMAT_YVU9:
size = GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
size = GST_ROUND_UP_4 (width) * height;
size += GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4) *
(GST_ROUND_UP_4 (height) / 4) * 2;
return size;
......
......@@ -301,30 +301,25 @@ paint_setup_IMC4 (paintinfo * p, unsigned char *dest)
static void
paint_setup_YVU9 (paintinfo * p, unsigned char *dest)
{
int h = GST_ROUND_UP_4 (p->height);
p->yp = dest;
p->ystride = GST_ROUND_UP_4 (p->width);
p->vp = p->yp + p->ystride * GST_ROUND_UP_4 (p->height);
p->vp = p->yp + p->ystride * p->height;
p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
p->up = p->vp + p->vstride * GST_ROUND_UP_4 (h / 4);
p->up = p->vp + p->vstride * (GST_ROUND_UP_4 (p->height) / 4);
p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
p->endptr = p->up + p->ustride * GST_ROUND_UP_4 (h / 4);
p->endptr = p->up + p->ustride * (GST_ROUND_UP_4 (p->height) / 4);
}
static void
paint_setup_YUV9 (paintinfo * p, unsigned char *dest)
{
/* untested */
int h = GST_ROUND_UP_4 (p->height);
p->yp = dest;
p->ystride = GST_ROUND_UP_4 (p->width);
p->up = p->yp + p->ystride * h;
p->up = p->yp + p->ystride * p->height;
p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
p->vp = p->up + p->ustride * GST_ROUND_UP_4 (h / 4);
p->vp = p->up + p->ustride * (GST_ROUND_UP_4 (p->height) / 4);
p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
p->endptr = p->vp + p->vstride * GST_ROUND_UP_4 (h / 4);
p->endptr = p->vp + p->vstride * (GST_ROUND_UP_4 (p->height) / 4);
}
#define gst_video_format_is_packed video_format_is_packed
......@@ -429,8 +424,6 @@ GST_START_TEST (test_video_formats)
fail_unless_equals_int (off1, (unsigned long) paintinfo.up);
fail_unless_equals_int (off2, (unsigned long) paintinfo.vp);
skip_check:
/* should be 0 if there's no alpha component */
off3 = gst_video_format_get_component_offset (fmt, 3, w, h);
fail_unless_equals_int (off3, (unsigned long) paintinfo.ap);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment