util/format: Use SATURATE
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 19 May 2020 15:14:52 +0000 (11:14 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 26 May 2020 22:31:31 +0000 (22:31 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5100>

src/util/format/u_format_yuv.h

index 3c822bcb148856fdedbf7728b18517f4e2e236e5..37f76dc014cc01c955cf51a691bf6c55d54e5e45 100644 (file)
@@ -58,9 +58,9 @@ static inline void
 util_format_rgb_float_to_yuv(float r, float g, float b,
                              uint8_t *y, uint8_t *u, uint8_t *v)
 {
-   const float _r = CLAMP(r, 0.0f, 1.0f);
-   const float _g = CLAMP(g, 0.0f, 1.0f);
-   const float _b = CLAMP(b, 0.0f, 1.0f);
+   const float _r = SATURATE(r);
+   const float _g = SATURATE(g);
+   const float _b = SATURATE(b);
 
    const float scale = 255.0f;