From 9542d55efb2680dec81d11e7200f4479cf346427 Mon Sep 17 00:00:00 2001 From: "U. Artie Eoff" Date: Fri, 7 Feb 2020 11:20:11 -0800 Subject: [PATCH] libs: utils: map GstVideoColorRange to VAAPI VPP --- gst-libs/gst/vaapi/gstvaapiutils.c | 21 +++++++++++++++++++++ gst-libs/gst/vaapi/gstvaapiutils.h | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/gst-libs/gst/vaapi/gstvaapiutils.c b/gst-libs/gst/vaapi/gstvaapiutils.c index 925510d..33c1372 100644 --- a/gst-libs/gst/vaapi/gstvaapiutils.c +++ b/gst-libs/gst/vaapi/gstvaapiutils.c @@ -987,3 +987,24 @@ from_GstVideoColorimetry (const GstVideoColorimetry * const colorimetry) return VAProcColorStandardExplicit; } + +/** + * from_GstVideoColorRange: + * @value: a #GstVideoColorRange + * + * VPP: maps the #GstVideoColorRange to the VA value. + * + * Returns: the VA color range. + **/ +guint +from_GstVideoColorRange (const GstVideoColorRange value) +{ + switch (value) { + case GST_VIDEO_COLOR_RANGE_0_255: + return VA_SOURCE_RANGE_FULL; + case GST_VIDEO_COLOR_RANGE_16_235: + return VA_SOURCE_RANGE_REDUCED; + default: + return VA_SOURCE_RANGE_UNKNOWN; + } +} diff --git a/gst-libs/gst/vaapi/gstvaapiutils.h b/gst-libs/gst/vaapi/gstvaapiutils.h index b2c0867..3159132 100644 --- a/gst-libs/gst/vaapi/gstvaapiutils.h +++ b/gst-libs/gst/vaapi/gstvaapiutils.h @@ -171,4 +171,8 @@ G_GNUC_INTERNAL guint from_GstVideoColorimetry (const GstVideoColorimetry *const colorimetry); +G_GNUC_INTERNAL +guint +from_GstVideoColorRange (const GstVideoColorRange value); + #endif /* GST_VAAPI_UTILS_H */ -- 2.7.4