Merge pull request #25059 from opencv-pushbot:gitee/alalek/core_fix_float16

core: fix float16_t optimization condition
pull/25093/head
Alexander Smorkalov 11 months ago committed by GitHub
commit a2e23fa988
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      modules/core/include/opencv2/core/cvdef.h

@ -844,7 +844,7 @@ protected:
float16_t() : w(0) {} float16_t() : w(0) {}
explicit float16_t(float x) explicit float16_t(float x)
{ {
#if CV_FP16 #if CV_FP16 && CV_AVX2
__m128 v = _mm_load_ss(&x); __m128 v = _mm_load_ss(&x);
w = (ushort)_mm_cvtsi128_si32(_mm_cvtps_ph(v, 0)); w = (ushort)_mm_cvtsi128_si32(_mm_cvtps_ph(v, 0));
#else #else
@ -875,7 +875,7 @@ protected:
operator float() const operator float() const
{ {
#if CV_FP16 #if CV_FP16 && CV_AVX2
float f; float f;
_mm_store_ss(&f, _mm_cvtph_ps(_mm_cvtsi32_si128(w))); _mm_store_ss(&f, _mm_cvtph_ps(_mm_cvtsi32_si128(w)));
return f; return f;

Loading…
Cancel
Save