va: caps: Don't use image formats for decoded frames.

Initially we tried to use the internal color conversion used in i965
and Gallium drivers when decoding. But this approach has showed
limitations and problems.

This patch removes completely the possible color conversion at
decoding, since it show problems with deinterlacing, for example:

gst-launch-1.0 filesrc location=interlaced.mpg2 ! parsebin ! vampeg2dec ! vadeinterlace ! xvimagesink

Allowing only the surface formats when decoding is more stable.

For color conversion is better to do it explicitly with vapostproc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2531>
This commit is contained in:
Víctor Manuel Jáquez Leal 2021-09-18 11:03:16 +02:00 committed by GStreamer Marge Bot
parent 397b0cc492
commit 64c4eb2def

View file

@ -220,61 +220,9 @@ gst_va_create_raw_caps_from_config (GstVaDisplay * display, VAConfigID config)
gst_caps_set_features_simple (feature_caps, features);
caps = gst_caps_merge (caps, feature_caps);
}
/* raw caps */
/* XXX(victor): assumption -- drivers can only download to image
* formats with same chroma of surface's format.
*
* This assumption is only valid for i965 and Gallium (so far).
* iHD's color space conversor, in decoders, has some problems or
* outputs wrong MD5 in tests.
*/
{
GstCaps *raw_caps;
GArray *image_formats = NULL;
if (!gst_va_display_is_implementation (display,
GST_VA_IMPLEMENTATION_INTEL_IHD))
image_formats = gst_va_display_get_image_formats (display);
if (!image_formats) {
raw_caps = gst_caps_copy (base_caps);
} else {
GArray *raw_formats = g_array_new (FALSE, FALSE, sizeof (GstVideoFormat));
guint j, surface_chroma, image_chroma;
GstVideoFormat image_format;
raw_caps =
gst_caps_new_simple ("video/x-raw", "width", GST_TYPE_INT_RANGE,
min_width, max_width, "height", GST_TYPE_INT_RANGE, min_height,
max_height, NULL);
for (i = 0; i < formats->len; i++) {
format = g_array_index (formats, GstVideoFormat, i);
surface_chroma = gst_va_chroma_from_video_format (format);
if (surface_chroma == 0)
continue;
g_array_append_val (raw_formats, format);
for (j = 0; j < image_formats->len; j++) {
image_format = g_array_index (image_formats, GstVideoFormat, j);
image_chroma = gst_va_chroma_from_video_format (image_format);
if (image_format != format && surface_chroma == image_chroma)
g_array_append_val (raw_formats, image_format);
}
}
if (!gst_caps_set_format_array (raw_caps, raw_formats)) {
gst_caps_unref (raw_caps);
raw_caps = gst_caps_copy (base_caps);
}
g_array_unref (raw_formats);
g_array_unref (image_formats);
}
caps = gst_caps_merge (caps, raw_caps);
}
caps = gst_caps_merge (caps, gst_caps_copy (base_caps));
gst_caps_unref (base_caps);