mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 20:51:13 +00:00
video: Fix YUV9 and YVU9 again
This commit is contained in:
parent
f728ee3978
commit
5f61df82da
2 changed files with 9 additions and 16 deletions
|
@ -1937,12 +1937,12 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
||||||
if (component == 0)
|
if (component == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (component == 1) {
|
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 (GST_ROUND_UP_4 (width) / 4) *
|
||||||
(GST_ROUND_UP_4 (height) / 4);
|
(GST_ROUND_UP_4 (height) / 4);
|
||||||
}
|
}
|
||||||
if (component == 2)
|
if (component == 2)
|
||||||
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
|
return GST_ROUND_UP_4 (width) * height;
|
||||||
return 0;
|
return 0;
|
||||||
case GST_VIDEO_FORMAT_IYU1:
|
case GST_VIDEO_FORMAT_IYU1:
|
||||||
if (component == 0)
|
if (component == 0)
|
||||||
|
@ -2054,7 +2054,7 @@ gst_video_format_get_size (GstVideoFormat format, int width, int height)
|
||||||
return size;
|
return size;
|
||||||
case GST_VIDEO_FORMAT_YUV9:
|
case GST_VIDEO_FORMAT_YUV9:
|
||||||
case GST_VIDEO_FORMAT_YVU9:
|
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) *
|
size += GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4) *
|
||||||
(GST_ROUND_UP_4 (height) / 4) * 2;
|
(GST_ROUND_UP_4 (height) / 4) * 2;
|
||||||
return size;
|
return size;
|
||||||
|
|
|
@ -301,30 +301,25 @@ paint_setup_IMC4 (paintinfo * p, unsigned char *dest)
|
||||||
static void
|
static void
|
||||||
paint_setup_YVU9 (paintinfo * p, unsigned char *dest)
|
paint_setup_YVU9 (paintinfo * p, unsigned char *dest)
|
||||||
{
|
{
|
||||||
int h = GST_ROUND_UP_4 (p->height);
|
|
||||||
|
|
||||||
p->yp = dest;
|
p->yp = dest;
|
||||||
p->ystride = GST_ROUND_UP_4 (p->width);
|
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->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->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
|
static void
|
||||||
paint_setup_YUV9 (paintinfo * p, unsigned char *dest)
|
paint_setup_YUV9 (paintinfo * p, unsigned char *dest)
|
||||||
{
|
{
|
||||||
/* untested */
|
|
||||||
int h = GST_ROUND_UP_4 (p->height);
|
|
||||||
|
|
||||||
p->yp = dest;
|
p->yp = dest;
|
||||||
p->ystride = GST_ROUND_UP_4 (p->width);
|
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->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->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
|
#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 (off1, (unsigned long) paintinfo.up);
|
||||||
fail_unless_equals_int (off2, (unsigned long) paintinfo.vp);
|
fail_unless_equals_int (off2, (unsigned long) paintinfo.vp);
|
||||||
|
|
||||||
skip_check:
|
|
||||||
|
|
||||||
/* should be 0 if there's no alpha component */
|
/* should be 0 if there's no alpha component */
|
||||||
off3 = gst_video_format_get_component_offset (fmt, 3, w, h);
|
off3 = gst_video_format_get_component_offset (fmt, 3, w, h);
|
||||||
fail_unless_equals_int (off3, (unsigned long) paintinfo.ap);
|
fail_unless_equals_int (off3, (unsigned long) paintinfo.ap);
|
||||||
|
|
Loading…
Reference in a new issue