45#ifndef OPENCV_CORE_CVDEF_H
46#define OPENCV_CORE_CVDEF_H
48#include "opencv2/core/version.hpp"
53#ifdef OPENCV_INCLUDE_PORT_FILE
54#include OPENCV_INCLUDE_PORT_FILE
57#if !defined CV_DOXYGEN && !defined CV_IGNORE_DEBUG_BUILD_GUARD
58#if (defined(_MSC_VER) && (defined(DEBUG) || defined(_DEBUG))) || \
59 (defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_DEBUG_PEDANTIC))
62#define CV__DEBUG_NS_BEGIN namespace debug_build_guard {
63#define CV__DEBUG_NS_END }
64namespace cv {
namespace debug_build_guard { }
using namespace debug_build_guard; }
68#ifndef CV__DEBUG_NS_BEGIN
69#define CV__DEBUG_NS_BEGIN
70#define CV__DEBUG_NS_END
79#define __CV_EXPAND(x) x
83#define __CV_CAT__(x, y) x ## y
84#define __CV_CAT_(x, y) __CV_CAT__(x, y)
85#define __CV_CAT(x, y) __CV_CAT_(x, y)
88#define __CV_VA_NUM_ARGS_HELPER(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
89#define __CV_VA_NUM_ARGS(...) __CV_EXPAND(__CV_VA_NUM_ARGS_HELPER(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0))
93#elif defined __GNUC__ || (defined (__cpluscplus) && (__cpluscplus >= 201103))
94#define CV_Func __func__
95#elif defined __clang__ && (__clang_minor__ * 100 + __clang_major__ >= 305)
96#define CV_Func __func__
97#elif defined(__STDC_VERSION__) && (__STDC_VERSION >= 199901)
98#define CV_Func __func__
100#define CV_Func __FUNCTION__
101#elif defined(__INTEL_COMPILER) && (_INTEL_COMPILER >= 600)
102#define CV_Func __FUNCTION__
103#elif defined __IBMCPP__ && __IBMCPP__ >=500
104#define CV_Func __FUNCTION__
105#elif defined __BORLAND__ && (__BORLANDC__ >= 0x550)
106#define CV_Func __FUNC__
108#define CV_Func "<unknown>"
114#define CVAUX_CONCAT_EXP(a, b) a##b
115#define CVAUX_CONCAT(a, b) CVAUX_CONCAT_EXP(a,b)
117#if defined(__clang__)
118# ifndef __has_extension
119# define __has_extension __has_feature
121# if __has_extension(cxx_static_assert)
122# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition)
123# elif __has_extension(c_static_assert)
124# define CV_StaticAssert(condition, reason) _Static_assert((condition), reason " " #condition)
126#elif defined(__GNUC__)
127# if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
128# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition)
130#elif defined(_MSC_VER)
132# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition)
135#ifndef CV_StaticAssert
136# if !defined(__clang__) && defined(__GNUC__) && (__GNUC__*100 + __GNUC_MINOR__ > 302)
137# define CV_StaticAssert(condition, reason) ({ extern int __attribute__((error("CV_StaticAssert: " reason " " #condition))) CV_StaticAssert(); ((condition) ? 0 : CV_StaticAssert()); })
140 template <
bool x>
struct CV_StaticAssert_failed;
141 template <>
struct CV_StaticAssert_failed<true> {
enum { val = 1 }; };
142 template<
int x>
struct CV_StaticAssert_test {};
144# define CV_StaticAssert(condition, reason)\
145 typedef cv::CV_StaticAssert_test< sizeof(cv::CV_StaticAssert_failed< static_cast<bool>(condition) >) > CVAUX_CONCAT(CV_StaticAssert_failed_at_, __LINE__)
151 #define CV_DO_PRAGMA(x) __pragma(x)
152#elif defined(__GNUC__)
153 #define CV_DO_PRAGMA(x) _Pragma (#x)
155 #define CV_DO_PRAGMA(x)
159#define CV_SUPPRESS_DEPRECATED_START \
160 CV_DO_PRAGMA(warning(push)) \
161 CV_DO_PRAGMA(warning(disable: 4996))
162#define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA(warning(pop))
163#elif defined (__clang__) || ((__GNUC__) && (__GNUC__*100 + __GNUC_MINOR__ > 405))
164#define CV_SUPPRESS_DEPRECATED_START \
165 CV_DO_PRAGMA(GCC diagnostic push) \
166 CV_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
167#define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA(GCC diagnostic pop)
169#define CV_SUPPRESS_DEPRECATED_START
170#define CV_SUPPRESS_DEPRECATED_END
173#define CV_UNUSED(name) (void)name
184#if defined __cplusplus
190#include "opencv2/core/hal/interface.h"
200#elif defined __INTEL_COMPILER
201# define CV_ICC __INTEL_COMPILER
205# if defined __cplusplus
206# define CV_INLINE static inline
207# elif defined _MSC_VER
208# define CV_INLINE __inline
210# define CV_INLINE static
214#ifndef CV_ALWAYS_INLINE
215#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
216#define CV_ALWAYS_INLINE inline __attribute__((always_inline))
217#elif defined(_MSC_VER)
218#define CV_ALWAYS_INLINE __forceinline
220#define CV_ALWAYS_INLINE inline
224#if defined CV_DISABLE_OPTIMIZATION || (defined CV_ICC && !defined CV_ENABLE_UNROLLED)
225# define CV_ENABLE_UNROLLED 0
227# define CV_ENABLE_UNROLLED 1
231# define CV_DECL_ALIGNED(x) __attribute__ ((aligned (x)))
232#elif defined _MSC_VER
233# define CV_DECL_ALIGNED(x) __declspec(align(x))
235# define CV_DECL_ALIGNED(x)
244#define CV_CPU_SSSE3 5
245#define CV_CPU_SSE4_1 6
246#define CV_CPU_SSE4_2 7
247#define CV_CPU_POPCNT 8
250#define CV_CPU_AVX2 11
251#define CV_CPU_FMA3 12
253#define CV_CPU_AVX_512F 13
254#define CV_CPU_AVX_512BW 14
255#define CV_CPU_AVX_512CD 15
256#define CV_CPU_AVX_512DQ 16
257#define CV_CPU_AVX_512ER 17
258#define CV_CPU_AVX_512IFMA512 18
259#define CV_CPU_AVX_512IFMA 18
260#define CV_CPU_AVX_512PF 19
261#define CV_CPU_AVX_512VBMI 20
262#define CV_CPU_AVX_512VL 21
263#define CV_CPU_AVX_512VBMI2 22
264#define CV_CPU_AVX_512VNNI 23
265#define CV_CPU_AVX_512BITALG 24
266#define CV_CPU_AVX_512VPOPCNTDQ 25
267#define CV_CPU_AVX_5124VNNIW 26
268#define CV_CPU_AVX_5124FMAPS 27
270#define CV_CPU_NEON 100
272#define CV_CPU_MSA 150
274#define CV_CPU_RISCVV 170
276#define CV_CPU_VSX 200
277#define CV_CPU_VSX3 201
279#define CV_CPU_RVV 210
282#define CV_CPU_AVX512_SKX 256
283#define CV_CPU_AVX512_COMMON 257
284#define CV_CPU_AVX512_KNL 258
285#define CV_CPU_AVX512_KNM 259
286#define CV_CPU_AVX512_CNL 260
287#define CV_CPU_AVX512_CLX 261
288#define CV_CPU_AVX512_ICL 262
291#define CV_HARDWARE_MAX_FEATURE 512
314 CPU_AVX_512IFMA512 = 18,
315 CPU_AVX_512IFMA = 18,
317 CPU_AVX_512VBMI = 20,
319 CPU_AVX_512VBMI2 = 22,
320 CPU_AVX_512VNNI = 23,
321 CPU_AVX_512BITALG = 24,
322 CPU_AVX_512VPOPCNTDQ= 25,
323 CPU_AVX_5124VNNIW = 26,
324 CPU_AVX_5124FMAPS = 27,
345 CPU_MAX_FEATURE = 512
349#include "cv_cpu_dispatch.h"
351#if !defined(CV_STRONG_ALIGNMENT) && defined(__arm__) && !(defined(__aarch64__) || defined(_M_ARM64))
353#define CV_STRONG_ALIGNMENT 1
355#if !defined(CV_STRONG_ALIGNMENT)
356#define CV_STRONG_ALIGNMENT 0
360#define CV_PI 3.1415926535897932384626433832795
361#define CV_2PI 6.283185307179586476925286766559
362#define CV_LOG2 0.69314718055994530941723212145818
364#if defined __ARM_FP16_FORMAT_IEEE \
365 && !defined __CUDACC__
366# define CV_FP16_TYPE 1
368# define CV_FP16_TYPE 0
397#ifndef OPENCV_ABI_COMPATIBILITY
398#define OPENCV_ABI_COMPATIBILITY 400
402# define DISABLE_OPENCV_3_COMPATIBILITY
403# define OPENCV_DISABLE_DEPRECATED_COMPATIBILITY
407# if (defined _WIN32 || defined WINCE || defined __CYGWIN__) && defined(CVAPI_EXPORTS)
408# define CV_EXPORTS __declspec(dllexport)
409# elif defined __GNUC__ && __GNUC__ >= 4 && (defined(CVAPI_EXPORTS) || defined(__APPLE__))
410# define CV_EXPORTS __attribute__ ((visibility ("default")))
419# define CV_EXPORTS_TEMPLATE
421# define CV_EXPORTS_TEMPLATE CV_EXPORTS
425# if defined(__GNUC__)
426# define CV_DEPRECATED __attribute__ ((deprecated))
427# elif defined(_MSC_VER)
428# define CV_DEPRECATED __declspec(deprecated)
430# define CV_DEPRECATED
434#ifndef CV_DEPRECATED_EXTERNAL
435# if defined(__OPENCV_BUILD)
436# define CV_DEPRECATED_EXTERNAL
438# define CV_DEPRECATED_EXTERNAL CV_DEPRECATED
445# define CV_EXTERN_C extern "C"
452#define CV_EXPORTS_W CV_EXPORTS
453#define CV_EXPORTS_W_SIMPLE CV_EXPORTS
454#define CV_EXPORTS_AS(synonym) CV_EXPORTS
455#define CV_EXPORTS_W_MAP CV_EXPORTS
461#define CV_WRAP_AS(synonym)
462#define CV_WRAP_MAPPABLE(mappable)
463#define CV_WRAP_PHANTOM(phantom_header)
464#define CV_WRAP_DEFAULT(val)
470#define CV_MAT_CN_MASK ((CV_CN_MAX - 1) << CV_CN_SHIFT)
471#define CV_MAT_CN(flags) ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1)
472#define CV_MAT_TYPE_MASK (CV_DEPTH_MAX*CV_CN_MAX - 1)
473#define CV_MAT_TYPE(flags) ((flags) & CV_MAT_TYPE_MASK)
474#define CV_MAT_CONT_FLAG_SHIFT 14
475#define CV_MAT_CONT_FLAG (1 << CV_MAT_CONT_FLAG_SHIFT)
476#define CV_IS_MAT_CONT(flags) ((flags) & CV_MAT_CONT_FLAG)
477#define CV_IS_CONT_MAT CV_IS_MAT_CONT
478#define CV_SUBMAT_FLAG_SHIFT 15
479#define CV_SUBMAT_FLAG (1 << CV_SUBMAT_FLAG_SHIFT)
480#define CV_IS_SUBMAT(flags) ((flags) & CV_MAT_SUBMAT_FLAG)
484#define CV_ELEM_SIZE1(type) ((0x28442211 >> CV_MAT_DEPTH(type)*4) & 15)
486#define CV_ELEM_SIZE(type) (CV_MAT_CN(type)*CV_ELEM_SIZE1(type))
489# define MIN(a,b) ((a) > (b) ? (b) : (a))
493# define MAX(a,b) ((a) < (b) ? (b) : (a))
512#define __CV_ENUM_CLASS_EXPOSE_1(EnumType, MEMBER_CONST) \
513static const EnumType MEMBER_CONST = EnumType::MEMBER_CONST; \
515#define __CV_ENUM_CLASS_EXPOSE_2(EnumType, MEMBER_CONST, ...) \
516__CV_ENUM_CLASS_EXPOSE_1(EnumType, MEMBER_CONST); \
517__CV_EXPAND(__CV_ENUM_CLASS_EXPOSE_1(EnumType, __VA_ARGS__)); \
519#define __CV_ENUM_CLASS_EXPOSE_3(EnumType, MEMBER_CONST, ...) \
520__CV_ENUM_CLASS_EXPOSE_1(EnumType, MEMBER_CONST); \
521__CV_EXPAND(__CV_ENUM_CLASS_EXPOSE_2(EnumType, __VA_ARGS__)); \
523#define __CV_ENUM_CLASS_EXPOSE_4(EnumType, MEMBER_CONST, ...) \
524__CV_ENUM_CLASS_EXPOSE_1(EnumType, MEMBER_CONST); \
525__CV_EXPAND(__CV_ENUM_CLASS_EXPOSE_3(EnumType, __VA_ARGS__)); \
527#define __CV_ENUM_CLASS_EXPOSE_5(EnumType, MEMBER_CONST, ...) \
528__CV_ENUM_CLASS_EXPOSE_1(EnumType, MEMBER_CONST); \
529__CV_EXPAND(__CV_ENUM_CLASS_EXPOSE_4(EnumType, __VA_ARGS__)); \
531#define __CV_ENUM_CLASS_EXPOSE_6(EnumType, MEMBER_CONST, ...) \
532__CV_ENUM_CLASS_EXPOSE_1(EnumType, MEMBER_CONST); \
533__CV_EXPAND(__CV_ENUM_CLASS_EXPOSE_5(EnumType, __VA_ARGS__)); \
535#define __CV_ENUM_CLASS_EXPOSE_7(EnumType, MEMBER_CONST, ...) \
536__CV_ENUM_CLASS_EXPOSE_1(EnumType, MEMBER_CONST); \
537__CV_EXPAND(__CV_ENUM_CLASS_EXPOSE_6(EnumType, __VA_ARGS__)); \
539#define __CV_ENUM_CLASS_EXPOSE_8(EnumType, MEMBER_CONST, ...) \
540__CV_ENUM_CLASS_EXPOSE_1(EnumType, MEMBER_CONST); \
541__CV_EXPAND(__CV_ENUM_CLASS_EXPOSE_7(EnumType, __VA_ARGS__)); \
543#define __CV_ENUM_CLASS_EXPOSE_9(EnumType, MEMBER_CONST, ...) \
544__CV_ENUM_CLASS_EXPOSE_1(EnumType, MEMBER_CONST); \
545__CV_EXPAND(__CV_ENUM_CLASS_EXPOSE_8(EnumType, __VA_ARGS__)); \
547#define __CV_ENUM_FLAGS_LOGICAL_NOT(EnumType) \
548static inline bool operator!(const EnumType& val) \
550 typedef std::underlying_type<EnumType>::type UnderlyingType; \
551 return !static_cast<UnderlyingType>(val); \
554#define __CV_ENUM_FLAGS_LOGICAL_NOT_EQ(Arg1Type, Arg2Type) \
555static inline bool operator!=(const Arg1Type& a, const Arg2Type& b) \
557 return static_cast<int>(a) != static_cast<int>(b); \
560#define __CV_ENUM_FLAGS_LOGICAL_EQ(Arg1Type, Arg2Type) \
561static inline bool operator==(const Arg1Type& a, const Arg2Type& b) \
563 return static_cast<int>(a) == static_cast<int>(b); \
566#define __CV_ENUM_FLAGS_BITWISE_NOT(EnumType) \
567static inline EnumType operator~(const EnumType& val) \
569 typedef std::underlying_type<EnumType>::type UnderlyingType; \
570 return static_cast<EnumType>(~static_cast<UnderlyingType>(val)); \
573#define __CV_ENUM_FLAGS_BITWISE_OR(EnumType, Arg1Type, Arg2Type) \
574static inline EnumType operator|(const Arg1Type& a, const Arg2Type& b) \
576 typedef std::underlying_type<EnumType>::type UnderlyingType; \
577 return static_cast<EnumType>(static_cast<UnderlyingType>(a) | static_cast<UnderlyingType>(b)); \
580#define __CV_ENUM_FLAGS_BITWISE_AND(EnumType, Arg1Type, Arg2Type) \
581static inline EnumType operator&(const Arg1Type& a, const Arg2Type& b) \
583 typedef std::underlying_type<EnumType>::type UnderlyingType; \
584 return static_cast<EnumType>(static_cast<UnderlyingType>(a) & static_cast<UnderlyingType>(b)); \
587#define __CV_ENUM_FLAGS_BITWISE_XOR(EnumType, Arg1Type, Arg2Type) \
588static inline EnumType operator^(const Arg1Type& a, const Arg2Type& b) \
590 typedef std::underlying_type<EnumType>::type UnderlyingType; \
591 return static_cast<EnumType>(static_cast<UnderlyingType>(a) ^ static_cast<UnderlyingType>(b)); \
594#define __CV_ENUM_FLAGS_BITWISE_OR_EQ(EnumType, Arg1Type) \
595static inline EnumType& operator|=(EnumType& _this, const Arg1Type& val) \
597 _this = static_cast<EnumType>(static_cast<int>(_this) | static_cast<int>(val)); \
601#define __CV_ENUM_FLAGS_BITWISE_AND_EQ(EnumType, Arg1Type) \
602static inline EnumType& operator&=(EnumType& _this, const Arg1Type& val) \
604 _this = static_cast<EnumType>(static_cast<int>(_this) & static_cast<int>(val)); \
608#define __CV_ENUM_FLAGS_BITWISE_XOR_EQ(EnumType, Arg1Type) \
609static inline EnumType& operator^=(EnumType& _this, const Arg1Type& val) \
611 _this = static_cast<EnumType>(static_cast<int>(_this) ^ static_cast<int>(val)); \
615#define CV_ENUM_CLASS_EXPOSE(EnumType, ...) \
616__CV_EXPAND(__CV_CAT(__CV_ENUM_CLASS_EXPOSE_, __CV_VA_NUM_ARGS(__VA_ARGS__))(EnumType, __VA_ARGS__)); \
618#define CV_ENUM_FLAGS(EnumType) \
619__CV_ENUM_FLAGS_LOGICAL_NOT (EnumType) \
620__CV_ENUM_FLAGS_LOGICAL_EQ (EnumType, int) \
621__CV_ENUM_FLAGS_LOGICAL_NOT_EQ (EnumType, int) \
623__CV_ENUM_FLAGS_BITWISE_NOT (EnumType) \
624__CV_ENUM_FLAGS_BITWISE_OR (EnumType, EnumType, EnumType) \
625__CV_ENUM_FLAGS_BITWISE_AND (EnumType, EnumType, EnumType) \
626__CV_ENUM_FLAGS_BITWISE_XOR (EnumType, EnumType, EnumType) \
628__CV_ENUM_FLAGS_BITWISE_OR_EQ (EnumType, EnumType) \
629__CV_ENUM_FLAGS_BITWISE_AND_EQ (EnumType, EnumType) \
630__CV_ENUM_FLAGS_BITWISE_XOR_EQ (EnumType, EnumType) \
638#ifndef CV_STATIC_ANALYSIS
639# if defined(__KLOCWORK__) || defined(__clang_analyzer__) || defined(__COVERITY__)
640# define CV_STATIC_ANALYSIS 1
643# if defined(CV_STATIC_ANALYSIS) && !(__CV_CAT(1, CV_STATIC_ANALYSIS) == 1)
644# if 0 == CV_STATIC_ANALYSIS
645# undef CV_STATIC_ANALYSIS
653#ifndef CV_THREAD_SANITIZER
654# if defined(__has_feature)
655# if __has_feature(thread_sanitizer)
656# define CV_THREAD_SANITIZER
667#elif defined __GNUC__ || defined __clang__
668# if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ && !defined __EMSCRIPTEN__ && !defined(__CUDACC__) && !defined __INTEL_COMPILER
669# ifdef __ATOMIC_ACQ_REL
670# define CV_XADD(addr, delta) __c11_atomic_fetch_add((_Atomic(int)*)(addr), delta, __ATOMIC_ACQ_REL)
672# define CV_XADD(addr, delta) __atomic_fetch_add((_Atomic(int)*)(addr), delta, 4)
675# if defined __ATOMIC_ACQ_REL && !defined __clang__
677# define CV_XADD(addr, delta) (int)__atomic_fetch_add((unsigned*)(addr), (unsigned)(delta), __ATOMIC_ACQ_REL)
679# define CV_XADD(addr, delta) (int)__sync_fetch_and_add((unsigned*)(addr), (unsigned)(delta))
682#elif defined _MSC_VER && !defined RC_INVOKED
684# define CV_XADD(addr, delta) (int)_InterlockedExchangeAdd((long volatile*)addr, delta)
686 #ifdef OPENCV_FORCE_UNSAFE_XADD
687 CV_INLINE
int CV_XADD(
int* addr,
int delta) {
int tmp = *addr; *addr += delta;
return tmp; }
689 #error "OpenCV: can't define safe CV_XADD macro for current platform (unsupported). Define CV_XADD macro through custom port header (see OPENCV_INCLUDE_PORT_FILE)"
699# if defined(__GNUC__)
700# define CV_NORETURN __attribute__((__noreturn__))
701# elif defined(_MSC_VER) && (_MSC_VER >= 1300)
702# define CV_NORETURN __declspec(noreturn)
714# if defined(__GNUC__)
715# define CV_NODISCARD __attribute__((__warn_unused_result__))
716# elif defined(__clang__) && defined(__has_attribute)
717# if __has_attribute(__warn_unused_result__)
718# define CV_NODISCARD __attribute__((__warn_unused_result__))
731# if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
740# error "OpenCV 4.x+ requires enabled C++11 support"
743#define CV_CXX_MOVE_SEMANTICS 1
744#define CV_CXX_MOVE(x) std::move(x)
745#define CV_CXX_STD_ARRAY 1
748# define CV_OVERRIDE override
751# define CV_FINAL final
755# if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900)
756# define CV_NOEXCEPT noexcept
764# if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900)
765# define CV_CONSTEXPR constexpr
773#ifdef OPENCV_STDINT_HEADER
774#include OPENCV_STDINT_HEADER
775#elif defined(__cplusplus)
776#if defined(_MSC_VER) && _MSC_VER < 1600
778typedef signed char int8_t;
779typedef unsigned char uint8_t;
780typedef signed short int16_t;
781typedef unsigned short uint16_t;
782typedef signed int int32_t;
783typedef unsigned int uint32_t;
784typedef signed __int64 int64_t;
785typedef unsigned __int64 uint64_t;
787#elif defined(_MSC_VER) || __cplusplus >= 201103L
802typedef ::int8_t int8_t;
803typedef ::uint8_t uint8_t;
804typedef ::int16_t int16_t;
805typedef ::uint16_t uint16_t;
806typedef ::int32_t int32_t;
807typedef ::uint32_t uint32_t;
808typedef ::int64_t int64_t;
809typedef ::uint64_t uint64_t;
825 float16_t() : h(0) {}
826 explicit float16_t(
float x) { h = (__fp16)x; }
827 operator float()
const {
return (
float)h; }
828 static float16_t fromBits(ushort w)
836 static float16_t zero()
839 result.h = (__fp16)0;
852 float16_t() : w(0) {}
853 explicit float16_t(
float x)
856 __m128 v = _mm_load_ss(&x);
857 w = (ushort)_mm_cvtsi128_si32(_mm_cvtps_ph(v, 0));
861 unsigned sign = in.u & 0x80000000;
864 if( in.u >= 0x47800000 )
865 w = (ushort)(in.u > 0x7f800000 ? 0x7e00 : 0x7c00);
868 if (in.u < 0x38800000)
871 w = (ushort)(in.u - 0x3f000000);
875 unsigned t = in.u + 0xc8000fff;
876 w = (ushort)((t + ((in.u >> 13) & 1)) >> 13);
880 w = (ushort)(w | (sign >> 16));
884 operator float()
const
888 _mm_store_ss(&f, _mm_cvtph_ps(_mm_cvtsi32_si128(w)));
893 unsigned t = ((w & 0x7fff) << 13) + 0x38000000;
894 unsigned sign = (w & 0x8000) << 16;
895 unsigned e = w & 0x7c00;
897 out.u = t + (1 << 23);
898 out.u = (e >= 0x7c00 ? t + 0x38000000 :
899 e == 0 ? (
static_cast<void>(out.f -= 6.103515625e-05f), out.u) : t) | sign;
904 static float16_t fromBits(ushort b)
910 static float16_t zero()
913 result.w = (ushort)0;
916 ushort bits()
const {
return w; }
929#include "opencv2/core/fast_math.hpp"
CpuFeatures
Available CPU features.
Definition: cvdef.h:295
@ CPU_AVX512_KNM
Knights Mill with AVX-512F/CD/ER/PF/4FMAPS/4VNNIW/VPOPCNTDQ
Definition: cvdef.h:340
@ CPU_AVX512_CLX
Cascade Lake with AVX-512F/CD/BW/DQ/VL/VNNI
Definition: cvdef.h:342
@ CPU_AVX512_COMMON
Common instructions AVX-512F/CD for all CPUs that support AVX-512
Definition: cvdef.h:338
@ CPU_AVX512_SKX
Skylake-X with AVX-512F/CD/BW/DQ/VL
Definition: cvdef.h:337
@ CPU_AVX512_KNL
Knights Landing with AVX-512F/CD/ER/PF
Definition: cvdef.h:339
@ CPU_AVX512_CNL
Cannon Lake with AVX-512F/CD/BW/DQ/VL/IFMA/VBMI
Definition: cvdef.h:341
@ CPU_AVX512_ICL
Ice Lake with AVX-512F/CD/BW/DQ/VL/IFMA/VBMI/VNNI/VBMI2/BITALG/VPOPCNTDQ
Definition: cvdef.h:343
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75