Global threshold writing into caller-supplied buffer.
195{
196 const size_t n = gray.size();
197 const float*
src = gray.data();
199
200#ifdef MAYAFLUX_ARCH_X64
201 const __m256 thresh = _mm256_set1_ps(
value);
202 const __m256 one = _mm256_set1_ps(1.0F);
203 size_t i = 0;
204 for (; i + 8 <= n; i += 8) {
205 __m256 v = _mm256_loadu_ps(
src + i);
206 __m256 mask = _mm256_cmp_ps(v, thresh, _CMP_GE_OS);
207 _mm256_storeu_ps(
out + i, _mm256_and_ps(mask, one));
208 }
209 for (; i < n; ++i)
211
212#elif defined(MAYAFLUX_ARCH_ARM64)
213 const float32x4_t thresh = vdupq_n_f32(
value);
214 const float32x4_t one = vdupq_n_f32(1.0F);
215 size_t i = 0;
216 for (; i + 4 <= n; i += 4) {
217 float32x4_t v = vld1q_f32(
src + i);
218 uint32x4_t mask = vcgeq_f32(v, thresh);
220 vreinterpretq_f32_u32(vandq_u32(mask, vreinterpretq_u32_f32(one))));
221 }
222 for (; i < n; ++i)
224
225#else
226 std::transform(std::execution::par_unseq, gray.begin(), gray.end(),
dst.begin(),
227 [
value](
float v) { return v >= value ? 1.0F : 0.0F; });
228#endif
229}
std::vector< float > * out