libs: utils: map GstVideoColorRange to VAAPI VPP
authorU. Artie Eoff <ullysses.a.eoff@intel.com>
Fri, 7 Feb 2020 19:20:11 +0000 (11:20 -0800)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Sat, 8 Feb 2020 10:07:58 +0000 (10:07 +0000)
gst-libs/gst/vaapi/gstvaapiutils.c
gst-libs/gst/vaapi/gstvaapiutils.h

index 925510d..33c1372 100644 (file)
@@ -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;
+  }
+}
index b2c0867..3159132 100644 (file)
@@ -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 */