summaryrefslogtreecommitdiff
path: root/lib/igt_color_encoding.h
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2018-02-27 22:52:28 +0200
committerVille Syrjälä <ville.syrjala@linux.intel.com>2018-05-23 19:24:07 +0300
commit71c7a5740913d2618f44bca252669efe8a84f4c9 (patch)
tree7cd946393000f5bd5f388e40ded35df19963b127 /lib/igt_color_encoding.h
parent9fddc9dd06d122bc8c7abe9a1195b96e2099c5cd (diff)
lib: Add igt_color_encoding
Add some helpers for generating rgb<->ycbcr conversion matrices. v2: Add enums for color_encoding/color_range Fix full range handling (lacked +-0.5<->+-1.0 scaling) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_color_encoding.h')
-rw-r--r--lib/igt_color_encoding.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/igt_color_encoding.h b/lib/igt_color_encoding.h
new file mode 100644
index 00000000..0d8c8193
--- /dev/null
+++ b/lib/igt_color_encoding.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright © 2018 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __IGT_COLOR_ENCODING_H__
+#define __IGT_COLOR_ENCODING_H__
+
+#include <stdbool.h>
+
+#include "igt_matrix.h"
+
+enum igt_color_encoding {
+ IGT_COLOR_YCBCR_BT601,
+ IGT_COLOR_YCBCR_BT709,
+ IGT_COLOR_YCBCR_BT2020,
+ IGT_NUM_COLOR_ENCODINGS,
+};
+
+enum igt_color_range {
+ IGT_COLOR_YCBCR_LIMITED_RANGE,
+ IGT_COLOR_YCBCR_FULL_RANGE,
+ IGT_NUM_COLOR_RANGES,
+};
+
+struct igt_mat4 igt_ycbcr_to_rgb_matrix(enum igt_color_encoding color_encoding,
+ enum igt_color_range color_range);
+struct igt_mat4 igt_rgb_to_ycbcr_matrix(enum igt_color_encoding color_encoding,
+ enum igt_color_range color_range);
+
+#endif /* __IGT_COLOR_ENCODING_H__ */