mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
decoder: h264: properly support grayscale formats.
Request the correct chroma format for decoding grayscale streams. i.e. make lookups of the VA chroma format more generic, thus possibly supporting more formats in the future. This means that, if a VA driver doesn't support grayscale formats, it is now going to fail. We cannot safely assume that maybe grayscale was implemented on top of some YUV 4:2:0 with the chroma components all set to 0x80.
This commit is contained in:
parent
c4cd8e2b36
commit
85a60441fa
4 changed files with 33 additions and 2 deletions
|
@ -195,8 +195,11 @@ context_create (GstVaapiContext * context)
|
|||
attrib->type = VAConfigAttribRTFormat;
|
||||
if (!context_get_attribute (context, attrib->type, &value))
|
||||
goto cleanup;
|
||||
if (!(value & va_chroma_format))
|
||||
if (!(value & va_chroma_format)) {
|
||||
GST_ERROR ("unsupported chroma format (%s)",
|
||||
string_of_va_chroma_format (va_chroma_format));
|
||||
goto cleanup;
|
||||
}
|
||||
attrib->value = va_chroma_format;
|
||||
attrib++;
|
||||
|
||||
|
|
|
@ -957,7 +957,7 @@ ensure_context(GstVaapiDecoderH264 *decoder, GstH264SPS *sps)
|
|||
/* XXX: fix surface size when cropping is implemented */
|
||||
info.profile = priv->profile;
|
||||
info.entrypoint = priv->entrypoint;
|
||||
info.chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
|
||||
info.chroma_type = priv->chroma_type;
|
||||
info.width = sps->width;
|
||||
info.height = sps->height;
|
||||
info.ref_frames = get_max_dec_frame_buffering(sps);
|
||||
|
|
|
@ -208,6 +208,29 @@ string_of_VADisplayAttributeType (VADisplayAttribType attribute_type)
|
|||
return "<unknown>";
|
||||
}
|
||||
|
||||
/* Return a string representation of a VA chroma format */
|
||||
const gchar *
|
||||
string_of_va_chroma_format (guint chroma_format)
|
||||
{
|
||||
switch (chroma_format) {
|
||||
#define MAP(value) \
|
||||
STRCASEP(VA_RT_FORMAT_, value)
|
||||
MAP (YUV420);
|
||||
MAP (YUV422);
|
||||
MAP (YUV444);
|
||||
#if VA_CHECK_VERSION(0,34,0)
|
||||
MAP (YUV400);
|
||||
MAP (RGB16);
|
||||
MAP (RGB32);
|
||||
MAP (RGBP);
|
||||
#endif
|
||||
#undef MAP
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "<unknown>";
|
||||
}
|
||||
|
||||
const gchar *
|
||||
string_of_VARateControl (guint rate_control)
|
||||
{
|
||||
|
|
|
@ -71,6 +71,11 @@ G_GNUC_INTERNAL
|
|||
const gchar *
|
||||
string_of_VADisplayAttributeType (VADisplayAttribType attribute_type);
|
||||
|
||||
/* Return a string representation of a VA chroma format */
|
||||
G_GNUC_INTERNAL
|
||||
const gchar *
|
||||
string_of_va_chroma_format (guint chroma_format);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
const gchar *
|
||||
string_of_VARateControl (guint rate_control);
|
||||
|
|
Loading…
Reference in a new issue