From: David Schleef Date: Mon, 4 Apr 2011 23:00:30 +0000 (-0700) Subject: video: Fix YUV9 and YVU9 again X-Git-Tag: 1.19.3~511^2~6555^2~1011 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f61df82da8837522a4b75b5cc2e98802c67829e;p=platform%2Fupstream%2Fgstreamer.git video: Fix YUV9 and YVU9 again --- diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c index efb2e9f..a423a7e 100644 --- a/gst-libs/gst/video/video.c +++ b/gst-libs/gst/video/video.c @@ -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; diff --git a/tests/check/libs/video.c b/tests/check/libs/video.c index dc5ef88..05b840c 100644 --- a/tests/check/libs/video.c +++ b/tests/check/libs/video.c @@ -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);