video: Add ARGB64 and AYUV64

16-bit per channel formats.
This commit is contained in:
David Schleef 2011-02-19 12:03:17 -08:00
parent 7a24e3ea4e
commit 0ed72c2959
2 changed files with 74 additions and 2 deletions

View file

@ -395,6 +395,15 @@ gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format,
}
} else if (depth == 8 && bpp == 8) {
*format = GST_VIDEO_FORMAT_RGB8_PALETTED;
} else if (depth == 64 && bpp == 64) {
*format = gst_video_format_from_rgba32_masks (red_mask, green_mask,
blue_mask, alpha_mask);
if (*format == GST_VIDEO_FORMAT_ARGB) {
*format = GST_VIDEO_FORMAT_ARGB64;
} else {
*format = GST_VIDEO_FORMAT_UNKNOWN;
ok = FALSE;
}
} else {
ok = FALSE;
}
@ -615,10 +624,15 @@ gst_video_format_new_caps (GstVideoFormat format, int width,
depth = 8;
have_alpha = FALSE;
break;
case GST_VIDEO_FORMAT_ARGB64:
bpp = 64;
depth = 64;
have_alpha = TRUE;
break;
default:
return NULL;
}
if (bpp == 32 || bpp == 24) {
if (bpp == 32 || bpp == 24 || bpp == 64) {
if (bpp == 32) {
mask = 0xff000000;
} else {
@ -797,6 +811,8 @@ gst_video_format_from_fourcc (guint32 fourcc)
return GST_VIDEO_FORMAT_YVU9;
case GST_MAKE_FOURCC ('I', 'Y', 'U', '1'):
return GST_VIDEO_FORMAT_IYU1;
case GST_MAKE_FOURCC ('A', 'Y', '6', '4'):
return GST_VIDEO_FORMAT_AYUV64;
default:
return GST_VIDEO_FORMAT_UNKNOWN;
}
@ -862,6 +878,8 @@ gst_video_format_to_fourcc (GstVideoFormat format)
return GST_MAKE_FOURCC ('Y', 'V', 'U', '9');
case GST_VIDEO_FORMAT_IYU1:
return GST_MAKE_FOURCC ('I', 'Y', 'U', '1');
case GST_VIDEO_FORMAT_AYUV64:
return GST_MAKE_FOURCC ('A', 'Y', '6', '4');
default:
return 0;
}
@ -1000,6 +1018,7 @@ gst_video_format_is_rgb (GstVideoFormat format)
case GST_VIDEO_FORMAT_YUV9:
case GST_VIDEO_FORMAT_YVU9:
case GST_VIDEO_FORMAT_IYU1:
case GST_VIDEO_FORMAT_AYUV64:
return FALSE;
case GST_VIDEO_FORMAT_RGBx:
case GST_VIDEO_FORMAT_BGRx:
@ -1016,6 +1035,7 @@ gst_video_format_is_rgb (GstVideoFormat format)
case GST_VIDEO_FORMAT_RGB15:
case GST_VIDEO_FORMAT_BGR15:
case GST_VIDEO_FORMAT_RGB8_PALETTED:
case GST_VIDEO_FORMAT_ARGB64:
return TRUE;
default:
return FALSE;
@ -1057,6 +1077,7 @@ gst_video_format_is_yuv (GstVideoFormat format)
case GST_VIDEO_FORMAT_YUV9:
case GST_VIDEO_FORMAT_YVU9:
case GST_VIDEO_FORMAT_IYU1:
case GST_VIDEO_FORMAT_AYUV64:
return TRUE;
case GST_VIDEO_FORMAT_RGBx:
case GST_VIDEO_FORMAT_BGRx:
@ -1073,6 +1094,7 @@ gst_video_format_is_yuv (GstVideoFormat format)
case GST_VIDEO_FORMAT_RGB15:
case GST_VIDEO_FORMAT_BGR15:
case GST_VIDEO_FORMAT_RGB8_PALETTED:
case GST_VIDEO_FORMAT_ARGB64:
return FALSE;
default:
return FALSE;
@ -1146,6 +1168,8 @@ gst_video_format_has_alpha (GstVideoFormat format)
case GST_VIDEO_FORMAT_ABGR:
case GST_VIDEO_FORMAT_A420:
case GST_VIDEO_FORMAT_RGB8_PALETTED:
case GST_VIDEO_FORMAT_ARGB64:
case GST_VIDEO_FORMAT_AYUV64:
return TRUE;
case GST_VIDEO_FORMAT_RGBx:
case GST_VIDEO_FORMAT_BGRx:
@ -1225,6 +1249,8 @@ gst_video_format_get_component_depth (GstVideoFormat format, int component)
return 10;
case GST_VIDEO_FORMAT_Y16:
case GST_VIDEO_FORMAT_v216:
case GST_VIDEO_FORMAT_ARGB64:
case GST_VIDEO_FORMAT_AYUV64:
return 16;
}
@ -1335,6 +1361,9 @@ gst_video_format_get_row_stride (GstVideoFormat format, int component,
case GST_VIDEO_FORMAT_IYU1:
return GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) +
GST_ROUND_UP_4 (width) / 2);
case GST_VIDEO_FORMAT_ARGB64:
case GST_VIDEO_FORMAT_AYUV64:
return width * 8;
default:
return 0;
}
@ -1429,6 +1458,9 @@ gst_video_format_get_pixel_stride (GstVideoFormat format, int component)
return 0;
case GST_VIDEO_FORMAT_RGB8_PALETTED:
return 1;
case GST_VIDEO_FORMAT_ARGB64:
case GST_VIDEO_FORMAT_AYUV64:
return 8;
default:
return 0;
}
@ -1505,6 +1537,8 @@ gst_video_format_get_component_width (GstVideoFormat format,
case GST_VIDEO_FORMAT_Y800:
case GST_VIDEO_FORMAT_Y16:
case GST_VIDEO_FORMAT_RGB8_PALETTED:
case GST_VIDEO_FORMAT_ARGB64:
case GST_VIDEO_FORMAT_AYUV64:
return width;
case GST_VIDEO_FORMAT_A420:
if (component == 0 || component == 3) {
@ -1581,6 +1615,8 @@ gst_video_format_get_component_height (GstVideoFormat format,
case GST_VIDEO_FORMAT_UYVP:
case GST_VIDEO_FORMAT_RGB8_PALETTED:
case GST_VIDEO_FORMAT_IYU1:
case GST_VIDEO_FORMAT_ARGB64:
case GST_VIDEO_FORMAT_AYUV64:
return height;
case GST_VIDEO_FORMAT_A420:
if (component == 0 || component == 3) {
@ -1843,6 +1879,17 @@ gst_video_format_get_component_offset (GstVideoFormat format,
return 0;
if (component == 2)
return 4;
case GST_VIDEO_FORMAT_ARGB64:
case GST_VIDEO_FORMAT_AYUV64:
if (component == 0)
return 2;
if (component == 1)
return 4;
if (component == 2)
return 6;
if (component == 3)
return 0;
return 0;
default:
return 0;
}
@ -1938,6 +1985,9 @@ gst_video_format_get_size (GstVideoFormat format, int width, int height)
size += GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4) *
(GST_ROUND_UP_4 (height) / 4) * 2;
return size;
case GST_VIDEO_FORMAT_ARGB64:
case GST_VIDEO_FORMAT_AYUV64:
return width * 8 * height;
default:
return 0;
}

View file

@ -69,6 +69,8 @@ G_BEGIN_DECLS
* @GST_VIDEO_FORMAT_YUV9: planar 4:1:0 YUV (Since: 0.10.32)
* @GST_VIDEO_FORMAT_YVU9: planar 4:1:0 YUV (like YUV9 but UV planes swapped) (Since: 0.10.32)
* @GST_VIDEO_FORMAT_IYU1: packed 4:1:1 YUV (Cb-Y0-Y1-Cr-Y2-Y3 ...) (Since: 0.10.32)
* @GST_VIDEO_FORMAT_ARGB64: rgb with alpha channel first, 16 bits per channel (Since: 0.10.33)
* @GST_VIDEO_FORMAT_AY64: packed 4:4:4 YUV with alpha channel, 16 bits per channel (A0-Y0-U0-V0 ...) (Since: 0.10.33)
*
* Enum value describing the most common video formats.
*/
@ -112,7 +114,9 @@ typedef enum {
GST_VIDEO_FORMAT_RGB8_PALETTED,
GST_VIDEO_FORMAT_YUV9,
GST_VIDEO_FORMAT_YVU9,
GST_VIDEO_FORMAT_IYU1
GST_VIDEO_FORMAT_IYU1,
GST_VIDEO_FORMAT_ARGB64,
GST_VIDEO_FORMAT_AYUV64
} GstVideoFormat;
#define GST_VIDEO_BYTE1_MASK_32 "0xFF000000"
@ -232,6 +236,19 @@ typedef enum {
"height = " GST_VIDEO_SIZE_RANGE ", " \
"framerate = " GST_VIDEO_FPS_RANGE
#define __GST_VIDEO_CAPS_MAKE_64A(R, G, B, A) \
"video/x-raw-rgb, " \
"bpp = (int) 64, " \
"depth = (int) 64, " \
"endianness = (int) BIG_ENDIAN, " \
"red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", " \
"green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", " \
"blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", " \
"alpha_mask = (int) " GST_VIDEO_BYTE ## A ## _MASK_32 ", " \
"width = " GST_VIDEO_SIZE_RANGE ", " \
"height = " GST_VIDEO_SIZE_RANGE ", " \
"framerate = " GST_VIDEO_FPS_RANGE
/* 24 bit */
@ -296,6 +313,11 @@ typedef enum {
#define GST_VIDEO_CAPS_BGR_15 \
__GST_VIDEO_CAPS_MAKE_15 (3, 2, 1)
/* 64 bit alpha */
#define GST_VIDEO_CAPS_ARGB_64 \
__GST_VIDEO_CAPS_MAKE_64A (2, 3, 4, 1)
/**
* GST_VIDEO_CAPS_RGB8_PALETTED:
*