summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@hotmail.com>2019-09-11 11:56:35 +0800
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2019-09-18 09:05:02 +0000
commitf5e1946036e0e3f43b8981bf11cbc82ee5f5c0e2 (patch)
treeb555f7bdc331c0dea2dab6aff6882d73b7426937 /gst-libs
parent499e248d4cac5ac8f230b9cadbf6dd313d23987e (diff)
libs: video-format: Make all YUV format available
The YUV formats have no ambiguity for drivers, so we can add them all. Some old driver(i965) does not implement full get/put image functions but can use derive image funtions for the YUV format. It does not report that kind of formats correctly in image query, but will derive that YUV format image from surface. The dynamic mapping of YUV format will block that manner. Adding more YUV format mapping has no side effect. So considering the legacy driver conformance, we add all YUV formats mapping statically and dynamic mapping RBG formats Fix: #189 Fix: #190
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/vaapi/video-format.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/gst-libs/gst/vaapi/video-format.c b/gst-libs/gst/vaapi/video-format.c
index a22b3095..1463c0e7 100644
--- a/gst-libs/gst/vaapi/video-format.c
+++ b/gst-libs/gst/vaapi/video-format.c
@@ -491,41 +491,48 @@ video_format_create_map_once (gpointer data)
guint n = ((struct ImageFormatsData *) data)->n;
GArray *array = NULL;
- if (formats == NULL || n == 0)
- return NULL;
-
array = g_array_new (FALSE, TRUE, sizeof (GstVideoFormatMap));
if (array == NULL)
return NULL;
- for (i = 0; i < n; i++) {
- src_entry = get_map_in_default_by_va_format (&formats[i]);
- if (src_entry) {
- entry = get_map_by_gst_format (array, src_entry->format);
- if (entry && !va_format_is_same (&entry->va_format, &formats[i])) {
- GST_INFO ("va_format1 with fourcc %" GST_FOURCC_FORMAT
- " byte order: %d, BPP: %d, depth %d, red mask 0x%4x,"
- " green mask 0x%4x, blue mask 0x%4x, alpha mask 0x%4x"
- " conflict with va_foramt2 fourcc %" GST_FOURCC_FORMAT
- " byte order: %d, BPP: %d, depth %d, red mask 0x%4x,"
- " green mask 0x%4x, blue mask 0x%4x, alpha mask 0x%4x."
- " Both map to the same GST format: %s, which is not"
- " allowed, va_format1 will be skipped",
- GST_FOURCC_ARGS (entry->va_format.fourcc),
- entry->va_format.byte_order, entry->va_format.bits_per_pixel,
- entry->va_format.depth, entry->va_format.red_mask,
- entry->va_format.green_mask, entry->va_format.blue_mask,
- entry->va_format.alpha_mask,
- GST_FOURCC_ARGS (formats[i].fourcc),
- formats[i].byte_order, formats[i].bits_per_pixel, formats[i].depth,
- formats[i].red_mask, formats[i].green_mask, formats[i].blue_mask,
- formats[i].alpha_mask, gst_video_format_to_string (entry->format));
+ /* All the YUV format has no ambiguity */
+ for (i = 0; i < G_N_ELEMENTS (gst_vaapi_video_default_formats); i++) {
+ if (va_format_is_yuv (&gst_vaapi_video_default_formats[i].va_format))
+ g_array_append_val (array, gst_vaapi_video_default_formats[i]);
+ }
+
+ if (formats) {
+ for (i = 0; i < n; i++) {
+ if (!va_format_is_rgb (&formats[i]))
continue;
+
+ src_entry = get_map_in_default_by_va_format (&formats[i]);
+ if (src_entry) {
+ entry = get_map_by_gst_format (array, src_entry->format);
+ if (entry && !va_format_is_same (&entry->va_format, &formats[i])) {
+ GST_INFO ("va_format1 with fourcc %" GST_FOURCC_FORMAT
+ " byte order: %d, BPP: %d, depth %d, red mask 0x%4x,"
+ " green mask 0x%4x, blue mask 0x%4x, alpha mask 0x%4x"
+ " conflict with va_foramt2 fourcc %" GST_FOURCC_FORMAT
+ " byte order: %d, BPP: %d, depth %d, red mask 0x%4x,"
+ " green mask 0x%4x, blue mask 0x%4x, alpha mask 0x%4x."
+ " Both map to the same GST format: %s, which is not"
+ " allowed, va_format1 will be skipped",
+ GST_FOURCC_ARGS (entry->va_format.fourcc),
+ entry->va_format.byte_order, entry->va_format.bits_per_pixel,
+ entry->va_format.depth, entry->va_format.red_mask,
+ entry->va_format.green_mask, entry->va_format.blue_mask,
+ entry->va_format.alpha_mask,
+ GST_FOURCC_ARGS (formats[i].fourcc),
+ formats[i].byte_order, formats[i].bits_per_pixel,
+ formats[i].depth, formats[i].red_mask, formats[i].green_mask,
+ formats[i].blue_mask, formats[i].alpha_mask,
+ gst_video_format_to_string (entry->format));
+ continue;
+ }
+ g_array_append_val (array, (*src_entry));
}
- g_array_append_val (array, (*src_entry));
- }
- if (va_format_is_rgb (&formats[i])) {
GST_LOG ("%s to map RGB va_format with fourcc: %"
GST_FOURCC_FORMAT
", byte order: %d BPP: %d, depth %d, red mask %4x,"
@@ -535,13 +542,6 @@ video_format_create_map_once (gpointer data)
formats[i].bits_per_pixel, formats[i].depth, formats[i].red_mask,
formats[i].green_mask, formats[i].blue_mask, formats[i].alpha_mask,
src_entry ? gst_video_format_to_string (src_entry->format) : "any");
- } else {
- GST_LOG ("%s to map YUV va format with fourcc: %"
- GST_FOURCC_FORMAT ", byte order: %d BPP: %d to %s gstreamer"
- " video format", src_entry ? "succeed" : "failed",
- GST_FOURCC_ARGS (formats[i].fourcc), formats[i].byte_order,
- formats[i].bits_per_pixel,
- src_entry ? gst_video_format_to_string (src_entry->format) : "any");
}
}