From 5bdc68ff90fecb13b8576bb208f73cfc0f949575 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 12 Feb 2025 16:46:51 +0200 Subject: kms++util: Add SMPTE test pattern --- kms++util/inc/kms++util/color16.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'kms++util/inc') diff --git a/kms++util/inc/kms++util/color16.h b/kms++util/inc/kms++util/color16.h index 307b138..6d25c82 100644 --- a/kms++util/inc/kms++util/color16.h +++ b/kms++util/inc/kms++util/color16.h @@ -101,6 +101,25 @@ public: constexpr RGB16 to_rgb(RecStandard rec = RecStandard::BT709, ColorRange range = ColorRange::Limited) const noexcept; + + static constexpr YUV16 from_10(uint16_t r, uint16_t g, uint16_t b) + { + return YUV16 { + static_cast((r << 6) | (r >> 4)), + static_cast((g << 6) | (g >> 4)), + static_cast((b << 6) | (b >> 4)), + }; + } + + static constexpr YUV16 from_12(uint16_t r, uint16_t g, uint16_t b) + { + return YUV16 { + static_cast((r << 4) | (r >> 8)), + static_cast((g << 4) | (g >> 8)), + static_cast((b << 4) | (b >> 8)), + }; + } + static constexpr uint16_t max_value = 0xffff; }; -- cgit v1.2.3