diff options
| author | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2025-04-17 15:42:46 +0300 |
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2025-04-17 15:42:46 +0300 |
| commit | 72ed148ff1b40511809811ee265a683a39eaebc6 (patch) | |
| tree | 9fed075b538212584b03afaa3c504c15e3438eba | |
| parent | 8e0670031ba0cf1563f811963390f529e039447e (diff) | |
color16: Add rounding to YUV-to-RGB
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
| -rw-r--r-- | kms++util/inc/kms++util/color16.h | 6 |
1 files changed, 3 insertions, 3 deletions
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<uint16_t>(std::clamp(r, 0.0, 1.0) * max_value), - static_cast<uint16_t>(std::clamp(g, 0.0, 1.0) * max_value), - static_cast<uint16_t>(std::clamp(b, 0.0, 1.0) * max_value)); + return RGB16(static_cast<uint16_t>(std::round(std::clamp(r, 0.0, 1.0) * max_value)), + static_cast<uint16_t>(std::round(std::clamp(g, 0.0, 1.0) * max_value)), + static_cast<uint16_t>(std::round(std::clamp(b, 0.0, 1.0) * max_value))); } } // namespace kms |
