summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gst-libs/gst/vaapi/gstvaapiutils_vpx.c31
-rw-r--r--gst-libs/gst/vaapi/gstvaapiutils_vpx.h3
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 */