From 71c7a5740913d2618f44bca252669efe8a84f4c9 Mon Sep 17 00:00:00 2001 From: Ville Syrjälä Date: Tue, 27 Feb 2018 22:52:28 +0200 Subject: lib: Add igt_color_encoding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ä Reviewed-by: Chris Wilson --- lib/igt_color_encoding.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lib/igt_color_encoding.h (limited to 'lib/igt_color_encoding.h') 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 + +#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__ */ -- cgit v1.2.3