diff options
author | He Junyan <junyan.he@intel.com> | 2020-07-11 23:17:02 +0800 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2020-11-30 16:45:54 +0000 |
commit | ff829c660be288ee09846ad28493db64aea58c09 (patch) | |
tree | ae013e7454d47703441be639cb0d4b8aa5273f88 /gst-libs | |
parent | 973b879f95588581d860ade43a348d7cd73a9346 (diff) |
libs: util: vpx: add get_chroma_format_idc for VP9
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/380>
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiutils_vpx.c | 31 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiutils_vpx.h | 3 |
2 files changed, 34 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiutils_vpx.c b/gst-libs/gst/vaapi/gstvaapiutils_vpx.c index 2882c2f0..d6bdd816 100644 --- a/gst-libs/gst/vaapi/gstvaapiutils_vpx.c +++ b/gst-libs/gst/vaapi/gstvaapiutils_vpx.c @@ -21,6 +21,7 @@ */ #include "gstvaapiutils_vpx.h" +#include "gstvaapisurface.h" struct map { @@ -86,3 +87,33 @@ gst_vaapi_utils_vp9_get_profile_string (GstVaapiProfile profile) return m ? m->name : NULL; } + +/** Returns VP9 chroma_format_idc value from GstVaapiChromaType */ +guint +gst_vaapi_utils_vp9_get_chroma_format_idc (guint chroma_type) +{ + guint chroma_format_idc; + + switch (chroma_type) { + case GST_VAAPI_CHROMA_TYPE_YUV400: + chroma_format_idc = 0; + break; + case GST_VAAPI_CHROMA_TYPE_YUV420: + case GST_VAAPI_CHROMA_TYPE_YUV420_10BPP: + chroma_format_idc = 1; + break; + case GST_VAAPI_CHROMA_TYPE_YUV422: + case GST_VAAPI_CHROMA_TYPE_YUV422_10BPP: + chroma_format_idc = 2; + break; + case GST_VAAPI_CHROMA_TYPE_YUV444: + case GST_VAAPI_CHROMA_TYPE_YUV444_10BPP: + chroma_format_idc = 3; + break; + default: + GST_DEBUG ("unsupported GstVaapiChromaType value"); + chroma_format_idc = 1; + break; + } + return chroma_format_idc; +} diff --git a/gst-libs/gst/vaapi/gstvaapiutils_vpx.h b/gst-libs/gst/vaapi/gstvaapiutils_vpx.h index a83510ce..acead5a5 100644 --- a/gst-libs/gst/vaapi/gstvaapiutils_vpx.h +++ b/gst-libs/gst/vaapi/gstvaapiutils_vpx.h @@ -35,6 +35,9 @@ gst_vaapi_utils_vp9_get_profile_from_string (const gchar * str); const gchar * gst_vaapi_utils_vp9_get_profile_string (GstVaapiProfile profile); +guint +gst_vaapi_utils_vp9_get_chroma_format_idc (guint chroma_type); + G_END_DECLS #endif /* GST_VAAPI_UTILS_VPX_H */ |