From 72ed148ff1b40511809811ee265a683a39eaebc6 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 17 Apr 2025 15:42:46 +0300 Subject: color16: Add rounding to YUV-to-RGB Signed-off-by: Tomi Valkeinen --- kms++util/inc/kms++util/color16.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'kms++util') diff --git a/kms++util/inc/kms++util/color16.h b/kms++util/inc/kms++util/color16.h index ac48785..340ce6a 100644 --- a/kms++util/inc/kms++util/color16.h +++ b/kms++util/inc/kms++util/color16.h @@ -176,9 +176,9 @@ constexpr RGB16 YUV16::to_rgb(RecStandard rec, ColorRange range) const noexcept const double b = y_norm + 2.0 * u_norm * (1.0 - coeff.kb); // Clamp and convert back to 16-bit values - return RGB16(static_cast(std::clamp(r, 0.0, 1.0) * max_value), - static_cast(std::clamp(g, 0.0, 1.0) * max_value), - static_cast(std::clamp(b, 0.0, 1.0) * max_value)); + return RGB16(static_cast(std::round(std::clamp(r, 0.0, 1.0) * max_value)), + static_cast(std::round(std::clamp(g, 0.0, 1.0) * max_value)), + static_cast(std::round(std::clamp(b, 0.0, 1.0) * max_value))); } } // namespace kms -- cgit v1.2.3