From: <tp...@ke...> - 2008-03-02 18:23:41
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: tpm Date: Sun Mar 02 2008 18:20:58 UTC Log message: * gst-libs/gst/video/video.c: (gst_video_calculate_display_ratio), (gst_video_format_from_fourcc), (gst_video_format_to_fourcc), (gst_video_format_is_rgb), (gst_video_format_is_yuv), (gst_video_format_has_alpha), (gst_video_format_get_row_stride), (gst_video_format_get_pixel_stride), (gst_video_format_get_component_width), (gst_video_format_get_component_height), (gst_video_format_get_component_offset), (gst_video_format_get_size): * gst-libs/gst/video/video.h: (GST_VIDEO_FORMAT_Y41B), (GST_VIDEO_FORMAT_Y42B): API: add GST_VIDEO_FORMAT_Y41B and GST_VIDEO_FORMAT_Y42B. Modified files: . : ChangeLog gst-libs/gst/video: video.c video.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3787&r2=1.3788 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst-libs/gst/video/video.c.diff?r1=1.20&r2=1.21 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst-libs/gst/video/video.h.diff?r1=1.19&r2=1.20 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3787 retrieving revision 1.3788 diff -u -d -r1.3787 -r1.3788 --- ChangeLog 2 Mar 2008 18:07:09 -0000 1.3787 +++ ChangeLog 2 Mar 2008 18:20:39 -0000 1.3788 @@ -1,5 +1,19 @@ 2008-03-02 Tim-Philipp Müller <tim at centricular dot net> + * gst-libs/gst/video/video.c: (gst_video_calculate_display_ratio), + (gst_video_format_from_fourcc), (gst_video_format_to_fourcc), + (gst_video_format_is_rgb), (gst_video_format_is_yuv), + (gst_video_format_has_alpha), (gst_video_format_get_row_stride), + (gst_video_format_get_pixel_stride), + (gst_video_format_get_component_width), + (gst_video_format_get_component_height), + (gst_video_format_get_component_offset), (gst_video_format_get_size): + * gst-libs/gst/video/video.h: (GST_VIDEO_FORMAT_Y41B), + (GST_VIDEO_FORMAT_Y42B): + API: add GST_VIDEO_FORMAT_Y41B and GST_VIDEO_FORMAT_Y42B. + +2008-03-02 Tim-Philipp Müller <tim at centricular dot net> * gst-libs/gst/video/video.c: (gst_video_format_get_component_offset): YV12 is I420 with swapped components 1 and 2, so the offset of component 1 for I420 should be the offset for component 2 for YV12 Index: video.c RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/video/video.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- video.c 2 Mar 2008 18:07:10 -0000 1.20 +++ video.c 2 Mar 2008 18:20:44 -0000 1.21 @@ -203,7 +203,7 @@ * Determines the #GstVideoFormat of @caps and places it in the location * pointed to by @format. Extracts the size of the video and places it * in the location pointed to by @width and @height. If @caps does not - * reprsent one of the raw video formats listed in #GstVideoFormat, the + * represent one of the raw video formats listed in #GstVideoFormat, the * function will fail and return FALSE. * * Since: 0.10.16 @@ -481,6 +481,10 @@ return GST_VIDEO_FORMAT_UYVY; case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'): return GST_VIDEO_FORMAT_AYUV; + case GST_MAKE_FOURCC ('Y', '4', '1', 'B'): + return GST_VIDEO_FORMAT_Y41B; + case GST_MAKE_FOURCC ('Y', '4', '2', 'B'): + return GST_VIDEO_FORMAT_Y42B; default: return GST_VIDEO_FORMAT_UNKNOWN; } @@ -512,6 +516,10 @@ return GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'); case GST_VIDEO_FORMAT_AYUV: return GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'); + case GST_VIDEO_FORMAT_Y41B: + return GST_MAKE_FOURCC ('Y', '4', '1', 'B'); + case GST_VIDEO_FORMAT_Y42B: + return GST_MAKE_FOURCC ('Y', '4', '2', 'B'); return 0; @@ -607,6 +615,8 @@ case GST_VIDEO_FORMAT_YUY2: case GST_VIDEO_FORMAT_UYVY: return FALSE; case GST_VIDEO_FORMAT_RGBx: case GST_VIDEO_FORMAT_BGRx: @@ -641,6 +651,8 @@ return TRUE; @@ -674,6 +686,8 @@ case GST_VIDEO_FORMAT_YV12: case GST_VIDEO_FORMAT_RGBA: @@ -739,6 +753,18 @@ case GST_VIDEO_FORMAT_RGB: case GST_VIDEO_FORMAT_BGR: return GST_ROUND_UP_4 (width * 3); + if (component == 0) { + return GST_ROUND_UP_4 (width); + } else { + return GST_ROUND_UP_8 (width) / 4; + } + return GST_ROUND_UP_8 (width) / 2; @@ -764,6 +790,8 @@ switch (format) { case GST_VIDEO_FORMAT_I420: return 1; @@ -818,6 +846,18 @@ } else { return GST_ROUND_UP_2 (width) / 2; } + case GST_VIDEO_FORMAT_Y41B: /* CHECKME: component_width for Y41B */ + return width; + case GST_VIDEO_FORMAT_Y42B: /* CHECKME: component_width for Y42B */ @@ -861,6 +901,8 @@ return GST_ROUND_UP_2 (height) / 2; @@ -1011,6 +1053,22 @@ if (component == 2) return 0; + if (component == 0) + return 0; + if (component == 1) + return GST_ROUND_UP_4 (width) * height; + if (component == 2) + return (GST_ROUND_UP_4 (width) + (GST_ROUND_UP_8 (width) / 4)) * height; + return 0; + return (GST_ROUND_UP_4 (width) + (GST_ROUND_UP_8 (width) / 2)) * height; @@ -1057,6 +1115,12 @@ return GST_ROUND_UP_4 (width * 3) * height; + /* simplification of ROUNDUP4(w)*h + 2*((ROUNDUP8(w)/4)*h */ + return (GST_ROUND_UP_4 (width) + (GST_ROUND_UP_8 (width) / 2)) * height; + /* simplification of ROUNDUP4(w)*h + 2*(ROUNDUP8(w)/2)*h: */ + return (GST_ROUND_UP_4 (width) + GST_ROUND_UP_8 (width)) * height; Index: video.h RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/video/video.h,v retrieving revision 1.19 diff -u -d -r1.19 -r1.20 --- video.h 22 Dec 2007 05:19:00 -0000 1.19 +++ video.h 2 Mar 2008 18:20:44 -0000 1.20 @@ -25,6 +25,29 @@ G_BEGIN_DECLS +/** + * GstVideoFormat: + * @GST_VIDEO_FORMAT_UNKNOWN, + * @GST_VIDEO_FORMAT_I420: planar 4:2:0 YUV + * @GST_VIDEO_FORMAT_YV12: planar 4:2:0 YVU (like I420 but UV planes swapped) + * @GST_VIDEO_FORMAT_YUY2: packed 4:2:2 YUV (Y0-U0-Y1-V0 Y2-U2-Y3-V2 Y4 ...) + * @GST_VIDEO_FORMAT_UYVY: packed 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...) + * @GST_VIDEO_FORMAT_AYUV: packed 4:4:4 YUV with alpha channel (A0-Y0-U0-V0 ...) + * @GST_VIDEO_FORMAT_RGBx: + * @GST_VIDEO_FORMAT_BGRx: + * @GST_VIDEO_FORMAT_xRGB: + * @GST_VIDEO_FORMAT_xBGR: + * @GST_VIDEO_FORMAT_RGBA: + * @GST_VIDEO_FORMAT_BGRA: + * @GST_VIDEO_FORMAT_ARGB: + * @GST_VIDEO_FORMAT_ABGR: + * @GST_VIDEO_FORMAT_RGB: + * @GST_VIDEO_FORMAT_BGR: + * @GST_VIDEO_FORMAT_Y41B: planar 4:1:1 YUV (Since: 0.10.18) + * @GST_VIDEO_FORMAT_Y42B: planar 4:2:2 YUV (Since: 0.10.18) + * + * Enum value describing the most common video formats. + */ typedef enum { GST_VIDEO_FORMAT_UNKNOWN, GST_VIDEO_FORMAT_I420, @@ -41,7 +64,9 @@ GST_VIDEO_FORMAT_ARGB, GST_VIDEO_FORMAT_ABGR, GST_VIDEO_FORMAT_RGB, - GST_VIDEO_FORMAT_BGR + GST_VIDEO_FORMAT_BGR, + GST_VIDEO_FORMAT_Y41B, + GST_VIDEO_FORMAT_Y42B } GstVideoFormat; #define GST_VIDEO_BYTE1_MASK_32 "0xFF000000" |