Commit: a92d96bfc2a857e0059550d675d65f236043f110
Parent: f4c893ef8c3769611ae063231aaad4a138c64be1
Author: Randy Palamar
Date: Tue, 30 Jul 2024 06:09:24 -0600
use min for clamping to 1 in hsv conversion
Diffstat:
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/util.c b/util.c
@@ -226,10 +226,7 @@ rgb_to_hsv(v4 rgb)
/* NOTE: keep only element [0] from H vector; Max contains V & A */
__m128 hva = _mm_blend_ps(Max, H, 0x01);
__m128 hsva = _mm_blend_ps(hva, S, 0x02);
-
- /* NOTE: Clamp values to 1 */
- __m128 one = _mm_set1_ps(1);
- hsva = _mm_blendv_ps(hsva, one, _mm_cmplt_ps(one, hsva));
+ hsva = _mm_min_ps(hsva, _mm_set1_ps(1));
v4 res;
_mm_storeu_ps(res.E, hsva);