Skip to content

Commit

Permalink
colorspace: clip negative inputs to AVX-512 transfer functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sekrit-twc committed Nov 7, 2024
1 parent 017c814 commit 30f368c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/zimg/colorspace/x86/operation_impl_avx512.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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))

Expand Down

0 comments on commit 30f368c

Please sign in to comment.