From 30f368c57e963ac70170b6ab374ea69585bc3f20 Mon Sep 17 00:00:00 2001 From: sekrit-twc Date: Wed, 6 Nov 2024 20:46:42 -0800 Subject: [PATCH] colorspace: clip negative inputs to AVX-512 transfer functions --- src/zimg/colorspace/x86/operation_impl_avx512.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/zimg/colorspace/x86/operation_impl_avx512.cpp b/src/zimg/colorspace/x86/operation_impl_avx512.cpp index 0dac7d55..1c934eec 100644 --- a/src/zimg/colorspace/x86/operation_impl_avx512.cpp +++ b/src/zimg/colorspace/x86/operation_impl_avx512.cpp @@ -111,6 +111,8 @@ struct PowerFunction { if (Prescale) x = _mm512_mul_ps(x, scale); + x = _mm512_max_ps(x, _mm512_setzero_ps()); + orig = x; x = _mm512_range_ps(x, two_minus_eps, 0x08); // fabs(min(x, 2.0)) @@ -161,6 +163,8 @@ struct SRGBPowerFunction { if (Prescale) x = _mm512_mul_ps(x, scale); + x = _mm512_max_ps(x, _mm512_setzero_ps()); + orig = x; x = _mm512_range_ps(x, two_minus_eps, 0x08); // fabs(min(x, 2.0))