diff --git a/modules/core/include/opencv2/core/base.hpp b/modules/core/include/opencv2/core/base.hpp index cc3237859e..20cf1cdd1c 100644 --- a/modules/core/include/opencv2/core/base.hpp +++ b/modules/core/include/opencv2/core/base.hpp @@ -405,7 +405,7 @@ inline unsigned cv_abs(unsigned x) { return x; } inline uint64 cv_abs(uint64 x) { return x; } inline uint64 cv_abs(int64 x) { return (uint64)std::abs(x); } inline float cv_abs(float16_t x) { return std::abs((float)x); } -inline float cv_abs(bfloat16_t x) { return std::abs((float)x); } +inline float cv_abs(bfloat x) { return std::abs((float)x); } inline int cv_absdiff(uchar x, uchar y) { return (int)std::abs((int)x - (int)y); } inline int cv_absdiff(schar x, schar y) { return (int)std::abs((int)x - (int)y); } inline int cv_absdiff(ushort x, ushort y) { return (int)std::abs((int)x - (int)y); } @@ -414,7 +414,7 @@ inline unsigned cv_absdiff(int x, int y) { return (unsigned)(std::max(x, y) - st inline unsigned cv_absdiff(unsigned x, unsigned y) { return std::max(x, y) - std::min(x, y); } inline uint64 cv_absdiff(uint64 x, uint64 y) { return std::max(x, y) - std::min(x, y); } inline float cv_absdiff(float16_t x, float16_t y) { return std::abs((float)x - (float)y); } -inline float cv_absdiff(bfloat16_t x, bfloat16_t y) { return std::abs((float)x - (float)y); } +inline float cv_absdiff(bfloat x, bfloat y) { return std::abs((float)x - (float)y); } template static inline _AccTp normL2Sqr(const _Tp* a, int n) diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h index 7917cf862d..ba31504d12 100644 --- a/modules/core/include/opencv2/core/cvdef.h +++ b/modules/core/include/opencv2/core/cvdef.h @@ -917,11 +917,12 @@ protected: #endif }; -class bfloat16_t +class bfloat { public: - bfloat16_t() : w(0) {} - explicit bfloat16_t(float x) + bfloat() : w(0) {} + + explicit bfloat(float x) { Cv32suf in; in.f = x; @@ -935,19 +936,6 @@ public: return out.f; } - static bfloat16_t fromBits(ushort b) - { - bfloat16_t result; - result.w = b; - return result; - } - static bfloat16_t zero() - { - bfloat16_t result; - result.w = (ushort)0; - return result; - } - ushort bits() const { return w; } protected: ushort w; }; diff --git a/modules/core/include/opencv2/core/detail/dispatch_helper.impl.hpp b/modules/core/include/opencv2/core/detail/dispatch_helper.impl.hpp index 2f25a76a03..6bf8f22538 100644 --- a/modules/core/include/opencv2/core/detail/dispatch_helper.impl.hpp +++ b/modules/core/include/opencv2/core/detail/dispatch_helper.impl.hpp @@ -49,7 +49,7 @@ static inline void depthDispatch(const int depth, Args&&... args) Functor{}(std::forward(args)...); break; case CV_16BF: - Functor{}(std::forward(args)...); + Functor{}(std::forward(args)...); break; default: CV_Error(cv::Error::BadDepth, "Unsupported matrix type."); diff --git a/modules/core/include/opencv2/core/hal/hal.hpp b/modules/core/include/opencv2/core/hal/hal.hpp index 4e56cf63e2..ce3f96d195 100644 --- a/modules/core/include/opencv2/core/hal/hal.hpp +++ b/modules/core/include/opencv2/core/hal/hal.hpp @@ -247,8 +247,8 @@ CV_EXPORTS void addWeighted32u( const unsigned* src1, size_t step1, const unsign CV_EXPORTS void cvt16f32f( const float16_t* src, float* dst, int len ); CV_EXPORTS void cvt32f16f( const float* src, float16_t* dst, int len ); -CV_EXPORTS void cvt16bf32f( const bfloat16_t* src, float* dst, int len ); -CV_EXPORTS void cvt32f16bf( const float* src, bfloat16_t* dst, int len ); +CV_EXPORTS void cvt16bf32f( const bfloat* src, float* dst, int len ); +CV_EXPORTS void cvt32f16bf( const float* src, bfloat* dst, int len ); CV_EXPORTS void addRNGBias32f( float* arr, const float* scaleBiasPairs, int len, int cn ); CV_EXPORTS void addRNGBias64f( double* arr, const double* scaleBiasPairs, int len, int cn ); diff --git a/modules/core/include/opencv2/core/hal/intrin.hpp b/modules/core/include/opencv2/core/hal/intrin.hpp index 3c76b6288c..72bdf707fe 100644 --- a/modules/core/include/opencv2/core/hal/intrin.hpp +++ b/modules/core/include/opencv2/core/hal/intrin.hpp @@ -719,13 +719,13 @@ namespace CV__SIMD_NAMESPACE { //! @} #ifndef OPENCV_HAL_HAVE_PACK_STORE_BFLOAT16 - inline v_float32 vx_load_expand(const bfloat16_t* ptr) + inline v_float32 vx_load_expand(const bfloat* ptr) { v_uint32 v = vx_load_expand((const ushort*)ptr); return v_reinterpret_as_f32(v_shl<16>(v)); } - inline void v_pack_store(const bfloat16_t* ptr, const v_float32& v) + inline void v_pack_store(const bfloat* ptr, const v_float32& v) { v_int32 iv = v_shr<16>(v_reinterpret_as_s32(v)); cv::v_pack_store((short*)ptr, iv); diff --git a/modules/core/include/opencv2/core/hal/intrin_avx.hpp b/modules/core/include/opencv2/core/hal/intrin_avx.hpp index 6a3ee5b2d7..00d84aabfc 100644 --- a/modules/core/include/opencv2/core/hal/intrin_avx.hpp +++ b/modules/core/include/opencv2/core/hal/intrin_avx.hpp @@ -3169,14 +3169,14 @@ inline void v_pack_store(float16_t* ptr, const v_float32x8& a) /*#define OPENCV_HAL_HAVE_PACK_STORE_BFLOAT16 1 -inline v_float32x8 v256_load_expand(const bfloat16_t* ptr) +inline v_float32x8 v256_load_expand(const bfloat* ptr) { __m128i bf = _mm_loadu_si128((const __m128i*)ptr); __m256i f = _mm256_unpacklo_epi16(_mm256_setzero_si256(), _mm256_castsi128_si256(bf)); return v_float32x8(_mm256_castsi256_ps(f)); } -inline void v_pack_store(bfloat16_t* ptr, const v_float32x8& a) +inline void v_pack_store(bfloat* ptr, const v_float32x8& a) { __m256i f = _mm256_castps_si256(a.val); f = _mm256_packs_epi32(_mm256_srai_epi32(f, 16), f); diff --git a/modules/core/include/opencv2/core/saturate.hpp b/modules/core/include/opencv2/core/saturate.hpp index 25363726df..89e193c977 100644 --- a/modules/core/include/opencv2/core/saturate.hpp +++ b/modules/core/include/opencv2/core/saturate.hpp @@ -163,7 +163,7 @@ template<> inline uint64 saturate_cast(double v) { return (int64)rou /** @overload */ template static inline _Tp saturate_cast(float16_t v) { return saturate_cast<_Tp>((float)v); } -template static inline _Tp saturate_cast(bfloat16_t v) { return saturate_cast<_Tp>((float)v); } +template static inline _Tp saturate_cast(bfloat v) { return saturate_cast<_Tp>((float)v); } template static inline _Tp saturate_cast(bool v) { return saturate_cast<_Tp>(v ? 1 : 0); } // in theory, we could use a LUT for 8u/8s->16f conversion, @@ -179,20 +179,20 @@ template<> inline float16_t saturate_cast(int64 v) { return float16 template<> inline float16_t saturate_cast(float v) { return float16_t(v); } template<> inline float16_t saturate_cast(double v) { return float16_t((float)v); } template<> inline float16_t saturate_cast(float16_t v) { return v; } -template<> inline float16_t saturate_cast(bfloat16_t v) { return float16_t((float)v); } +template<> inline float16_t saturate_cast(bfloat v) { return float16_t((float)v); } -template<> inline bfloat16_t saturate_cast(uchar v) { return bfloat16_t((float)v); } -template<> inline bfloat16_t saturate_cast(schar v) { return bfloat16_t((float)v); } -template<> inline bfloat16_t saturate_cast(ushort v) { return bfloat16_t((float)v); } -template<> inline bfloat16_t saturate_cast(short v) { return bfloat16_t((float)v); } -template<> inline bfloat16_t saturate_cast(unsigned v){ return bfloat16_t((float)v); } -template<> inline bfloat16_t saturate_cast(int v) { return bfloat16_t((float)v); } -template<> inline bfloat16_t saturate_cast(uint64 v) { return bfloat16_t((float)v); } -template<> inline bfloat16_t saturate_cast(int64 v) { return bfloat16_t((float)v); } -template<> inline bfloat16_t saturate_cast(float v) { return bfloat16_t(v); } -template<> inline bfloat16_t saturate_cast(double v) { return bfloat16_t((float)v); } -template<> inline bfloat16_t saturate_cast(float16_t v) { return bfloat16_t((float)v); } -template<> inline bfloat16_t saturate_cast(bfloat16_t v) { return v; } +template<> inline bfloat saturate_cast(uchar v) { return bfloat((float)v); } +template<> inline bfloat saturate_cast(schar v) { return bfloat((float)v); } +template<> inline bfloat saturate_cast(ushort v) { return bfloat((float)v); } +template<> inline bfloat saturate_cast(short v) { return bfloat((float)v); } +template<> inline bfloat saturate_cast(unsigned v){ return bfloat((float)v); } +template<> inline bfloat saturate_cast(int v) { return bfloat((float)v); } +template<> inline bfloat saturate_cast(uint64 v) { return bfloat((float)v); } +template<> inline bfloat saturate_cast(int64 v) { return bfloat((float)v); } +template<> inline bfloat saturate_cast(float v) { return bfloat(v); } +template<> inline bfloat saturate_cast(double v) { return bfloat((float)v); } +template<> inline bfloat saturate_cast(float16_t v) { return bfloat((float)v); } +template<> inline bfloat saturate_cast(bfloat v) { return v; } template<> inline bool saturate_cast(uchar v) { return v != 0; } template<> inline bool saturate_cast(schar v) { return v != 0; } @@ -205,7 +205,7 @@ template<> inline bool saturate_cast(double v){ return v != 0; } template<> inline bool saturate_cast(uint64_t v){ return v != 0; } template<> inline bool saturate_cast(int64_t v){ return v != 0; } template<> inline bool saturate_cast(float16_t v){ return (float)v != 0; } -template<> inline bool saturate_cast(bfloat16_t v){ return (float)v != 0; } +template<> inline bool saturate_cast(bfloat v){ return (float)v != 0; } //! @} diff --git a/modules/core/include/opencv2/core/traits.hpp b/modules/core/include/opencv2/core/traits.hpp index 18ceb9098d..45fab4bc44 100644 --- a/modules/core/include/opencv2/core/traits.hpp +++ b/modules/core/include/opencv2/core/traits.hpp @@ -321,10 +321,10 @@ public: }; }; -template<> class DataType +template<> class DataType { public: - typedef bfloat16_t value_type; + typedef bfloat value_type; typedef float work_type; typedef value_type channel_type; typedef value_type vec_type; @@ -431,7 +431,7 @@ template<> class TypeDepth template<> class TypeDepth { enum { depth = CV_16BF }; - typedef bfloat16_t value_type; + typedef bfloat value_type; }; template<> class TypeDepth diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp index d1bfa10aa8..77f899d00d 100644 --- a/modules/core/src/arithm.cpp +++ b/modules/core/src/arithm.cpp @@ -1592,9 +1592,9 @@ struct InRange_SIMD }; template <> -struct InRange_SIMD +struct InRange_SIMD { - int operator () (const bfloat16_t * src1, const bfloat16_t * src2, const bfloat16_t * src3, + int operator () (const bfloat * src1, const bfloat * src2, const bfloat * src3, uchar * dst, int len) const { int x = 0; @@ -1718,8 +1718,8 @@ static void inRange16f(const float16_t* src1, size_t step1, const float16_t* src inRange_(src1, step1, src2, step2, src3, step3, dst, step, size); } -static void inRange16bf(const bfloat16_t* src1, size_t step1, const bfloat16_t* src2, size_t step2, - const bfloat16_t* src3, size_t step3, uchar* dst, size_t step, Size size) +static void inRange16bf(const bfloat* src1, size_t step1, const bfloat* src2, size_t step2, + const bfloat* src3, size_t step3, uchar* dst, size_t step, Size size) { inRange_(src1, step1, src2, step2, src3, step3, dst, step, size); } diff --git a/modules/core/src/arithm.simd.hpp b/modules/core/src/arithm.simd.hpp index 8b1935a8ee..7e6f8f63f9 100644 --- a/modules/core/src/arithm.simd.hpp +++ b/modules/core/src/arithm.simd.hpp @@ -46,7 +46,7 @@ namespace cv { namespace hal { DECLARE_SIMPLE_BINARY_OP(opname##64u, uint64); \ DECLARE_SIMPLE_BINARY_OP(opname##64s, int64); \ DECLARE_SIMPLE_BINARY_OP(opname##16f, float16_t); \ - DECLARE_SIMPLE_BINARY_OP(opname##16bf, bfloat16_t); \ + DECLARE_SIMPLE_BINARY_OP(opname##16bf, bfloat); \ DECLARE_SIMPLE_BINARY_OP(opname##32f, float); \ DECLARE_SIMPLE_BINARY_OP(opname##64f, double) @@ -75,7 +75,7 @@ DECLARE_CMP_OP(cmp32s, int); DECLARE_CMP_OP(cmp64u, uint64); DECLARE_CMP_OP(cmp64s, int64); DECLARE_CMP_OP(cmp16f, float16_t); -DECLARE_CMP_OP(cmp16bf, bfloat16_t); +DECLARE_CMP_OP(cmp16bf, bfloat); DECLARE_CMP_OP(cmp32f, float); DECLARE_CMP_OP(cmp64f, double); @@ -95,7 +95,7 @@ DECLARE_CMP_OP(cmp64f, double); DECLARE_SCALED_BINARY_OP(opname##64u, uint64, scale_arg); \ DECLARE_SCALED_BINARY_OP(opname##64s, int64, scale_arg); \ DECLARE_SCALED_BINARY_OP(opname##16f, float16_t, scale_arg); \ - DECLARE_SCALED_BINARY_OP(opname##16bf, bfloat16_t, scale_arg); \ + DECLARE_SCALED_BINARY_OP(opname##16bf, bfloat, scale_arg); \ DECLARE_SCALED_BINARY_OP(opname##32f, float, scale_arg); \ DECLARE_SCALED_BINARY_OP(opname##64f, double, scale_arg) @@ -224,7 +224,7 @@ void opname(const T1* src1, size_t step1, \ DEFINE_SIMPLE_BINARY_OP_NOSIMD(opname##64u, uint64, uint64, scalar_op_u64) \ DEFINE_SIMPLE_BINARY_OP_NOSIMD(opname##64s, int64, int64, scalar_op) \ DEFINE_SIMPLE_BINARY_OP_16F(opname##16f, float16_t, scalar_op, vec_op) \ - DEFINE_SIMPLE_BINARY_OP_16F(opname##16bf, bfloat16_t, scalar_op, vec_op) \ + DEFINE_SIMPLE_BINARY_OP_16F(opname##16bf, bfloat, scalar_op, vec_op) \ DEFINE_SIMPLE_BINARY_OP(opname##32f, float, v_float32, scalar_op, vec_op) \ DEFINE_SIMPLE_BINARY_OP_64F(opname##64f, scalar_op, vec_op) @@ -246,7 +246,7 @@ DEFINE_SIMPLE_BINARY_OP_NOSIMD(absdiff32s, int, int, scalar_absdiff) DEFINE_SIMPLE_BINARY_OP_NOSIMD(absdiff64u, uint64, uint64, scalar_absdiffu) DEFINE_SIMPLE_BINARY_OP_NOSIMD(absdiff64s, int64, int64, scalar_absdiff) DEFINE_SIMPLE_BINARY_OP_16F(absdiff16f, float16_t, scalar_absdiff, v_absdiff) -DEFINE_SIMPLE_BINARY_OP_16F(absdiff16bf, bfloat16_t, scalar_absdiff, v_absdiff) +DEFINE_SIMPLE_BINARY_OP_16F(absdiff16bf, bfloat, scalar_absdiff, v_absdiff) DEFINE_SIMPLE_BINARY_OP(absdiff32f, float, v_float32, scalar_absdiff, v_absdiff) DEFINE_SIMPLE_BINARY_OP_64F(absdiff64f, scalar_absdiff, v_absdiff) @@ -458,7 +458,7 @@ static void opname(const T1* src1, size_t step1, \ DEFINE_CMP_OP_64(opname##64u, uint64, scalar_op) \ DEFINE_CMP_OP_64(opname##64s, int64, scalar_op) \ DEFINE_CMP_OP_16F(opname##16f, float16_t, scalar_op, vec_op) \ - DEFINE_CMP_OP_16F(opname##16bf, bfloat16_t, scalar_op, vec_op) \ + DEFINE_CMP_OP_16F(opname##16bf, bfloat, scalar_op, vec_op) \ DEFINE_CMP_OP_32(opname##32f, float, v_float32, scalar_op, vec_op) \ DEFINE_CMP_OP_64(opname##64f, double, scalar_op) @@ -505,7 +505,7 @@ DEFINE_CMP_OP(32s, int) DEFINE_CMP_OP(64u, uint64) DEFINE_CMP_OP(64s, int64) DEFINE_CMP_OP(16f, float16_t) -DEFINE_CMP_OP(16bf, bfloat16_t) +DEFINE_CMP_OP(16bf, bfloat) DEFINE_CMP_OP(32f, float) DEFINE_CMP_OP(64f, double) @@ -806,7 +806,7 @@ void opname(const T1* src1, size_t step1, const T1* src2, size_t step2, \ DEFINE_SCALED_OP_32(opname##32f, scale_arg, float, v_float32, fscalar_op, fvec_op, init##_f32, vx_load, v_store, when_binary) \ DEFINE_SCALED_OP_64F(opname##64f, scale_arg, fscalar_op, fvec_op, init##_f64, when_binary) \ DEFINE_SCALED_OP_16F(opname##16f, scale_arg, float16_t, fscalar_op, fvec_op, init##_f32, when_binary) \ - DEFINE_SCALED_OP_16F(opname##16bf, scale_arg, bfloat16_t, fscalar_op, fvec_op, init##_f32, when_binary) + DEFINE_SCALED_OP_16F(opname##16bf, scale_arg, bfloat, fscalar_op, fvec_op, init##_f32, when_binary) DEFINE_SCALED_OP_ALLTYPES(mul, double scale, scalar_mul, scalar_mul, vec_mul, vec_mul, init_muldiv, this_is_binary) @@ -839,7 +839,7 @@ void opname(const decl_type* src1, size_t step1, const decl_type* src2, size_t s DEFINE_BINARY_OP_DISPATCHER(opname##64u, uint64, uint64) \ DEFINE_BINARY_OP_DISPATCHER(opname##64s, int64, int64) \ DEFINE_BINARY_OP_DISPATCHER(opname##16f, cv_hal_f16, float16_t) \ - DEFINE_BINARY_OP_DISPATCHER(opname##16bf, cv_hal_bf16, bfloat16_t) \ + DEFINE_BINARY_OP_DISPATCHER(opname##16bf, cv_hal_bf16, bfloat) \ DEFINE_BINARY_OP_DISPATCHER(opname##32f, float, float) \ DEFINE_BINARY_OP_DISPATCHER(opname##64f, double, double) @@ -880,7 +880,7 @@ DEFINE_CMP_OP_DISPATCHER(cmp32s, int, int) DEFINE_CMP_OP_DISPATCHER(cmp64u, uint64, uint64) DEFINE_CMP_OP_DISPATCHER(cmp64s, int64, int64) DEFINE_CMP_OP_DISPATCHER(cmp16f, cv_hal_f16, float16_t) -DEFINE_CMP_OP_DISPATCHER(cmp16bf, cv_hal_bf16, bfloat16_t) +DEFINE_CMP_OP_DISPATCHER(cmp16bf, cv_hal_bf16, bfloat) DEFINE_CMP_OP_DISPATCHER(cmp32f, float, float) DEFINE_CMP_OP_DISPATCHER(cmp64f, double, double) @@ -907,7 +907,7 @@ void opname(const decl_type* src1, size_t step1, const decl_type* src2, size_t s DEFINE_BINARY_OP_W_PARAMS_DISPATCHER(opname##64u, uint64, uint64, read_params, paramname) \ DEFINE_BINARY_OP_W_PARAMS_DISPATCHER(opname##64s, int64, int64, read_params, paramname) \ DEFINE_BINARY_OP_W_PARAMS_DISPATCHER(opname##16f, cv_hal_f16, float16_t, read_params, paramname) \ - DEFINE_BINARY_OP_W_PARAMS_DISPATCHER(opname##16bf, cv_hal_bf16, bfloat16_t, read_params, paramname) \ + DEFINE_BINARY_OP_W_PARAMS_DISPATCHER(opname##16bf, cv_hal_bf16, bfloat, read_params, paramname) \ DEFINE_BINARY_OP_W_PARAMS_DISPATCHER(opname##32f, float, float, read_params, paramname) \ DEFINE_BINARY_OP_W_PARAMS_DISPATCHER(opname##64f, double, double, read_params, paramname) @@ -941,7 +941,7 @@ DEFINE_UNARY_OP_W_PARAMS_DISPATCHER(recip32s, int, int, double scale = *(double* DEFINE_UNARY_OP_W_PARAMS_DISPATCHER(recip64u, uint64, uint64, double scale = *(double*)params_, scale) DEFINE_UNARY_OP_W_PARAMS_DISPATCHER(recip64s, int64, int64, double scale = *(double*)params_, scale) DEFINE_UNARY_OP_W_PARAMS_DISPATCHER(recip16f, cv_hal_f16, float16_t, double scale = *(double*)params_, scale) -DEFINE_UNARY_OP_W_PARAMS_DISPATCHER(recip16bf, cv_hal_bf16, bfloat16_t, double scale = *(double*)params_, scale) +DEFINE_UNARY_OP_W_PARAMS_DISPATCHER(recip16bf, cv_hal_bf16, bfloat, double scale = *(double*)params_, scale) DEFINE_UNARY_OP_W_PARAMS_DISPATCHER(recip32f, float, float, double scale = *(double*)params_, scale) DEFINE_UNARY_OP_W_PARAMS_DISPATCHER(recip64f, double, double, double scale = *(double*)params_, scale) diff --git a/modules/core/src/convert.dispatch.cpp b/modules/core/src/convert.dispatch.cpp index 7418b696bc..43efab6659 100644 --- a/modules/core/src/convert.dispatch.cpp +++ b/modules/core/src/convert.dispatch.cpp @@ -23,7 +23,7 @@ void cvt32f16f(const float* src, float16_t* dst, int len) CV_CPU_DISPATCH(cvt32f16f, (src, dst, len), CV_CPU_DISPATCH_MODES_ALL); } -void cvt32f16bf(const float* src, bfloat16_t* dst, int len) +void cvt32f16bf(const float* src, bfloat* dst, int len) { CV_INSTRUMENT_REGION(); CV_CPU_DISPATCH(cvt32f16bf, (src, dst, len), diff --git a/modules/core/src/convert.hpp b/modules/core/src/convert.hpp index ca14cd86c0..2cefa8d566 100644 --- a/modules/core/src/convert.hpp +++ b/modules/core/src/convert.hpp @@ -46,7 +46,7 @@ static inline void vx_load_as(const float* ptr, v_float32& a) static inline void vx_load_as(const float16_t* ptr, v_float32& a) { a = vx_load_expand(ptr); } -static inline void vx_load_as(const bfloat16_t* ptr, v_float32& a) +static inline void vx_load_as(const bfloat* ptr, v_float32& a) { a = vx_load_expand(ptr); } static inline void v_store_as(ushort* ptr, const v_float32& a) @@ -70,7 +70,7 @@ static inline void v_store_as(float* ptr, const v_float32& a) static inline void v_store_as(float16_t* ptr, const v_float32& a) { v_pack_store(ptr, a); } -static inline void v_store_as(bfloat16_t* ptr, const v_float32& a) +static inline void v_store_as(bfloat* ptr, const v_float32& a) { v_pack_store(ptr, a); } static inline void v_store_as(int64_t* ptr, const v_float32& a) @@ -308,7 +308,7 @@ static inline void vx_load_pair_as(const float16_t* ptr, v_float32& a, v_float32 b = vx_load_expand(ptr + VTraits::vlanes()); } -static inline void vx_load_pair_as(const bfloat16_t* ptr, v_float32& a, v_float32& b) +static inline void vx_load_pair_as(const bfloat* ptr, v_float32& a, v_float32& b) { a = vx_load_expand(ptr); b = vx_load_expand(ptr + VTraits::vlanes()); @@ -508,7 +508,7 @@ static inline void vx_load_pair_as(const float16_t* ptr, v_float64& a, v_float64 b = v_cvt_f64_high(fab); } -static inline void vx_load_pair_as(const bfloat16_t* ptr, v_float64& a, v_float64& b) +static inline void vx_load_pair_as(const bfloat* ptr, v_float64& a, v_float64& b) { v_float32 fab = vx_load_expand(ptr); a = v_cvt_f64(fab); diff --git a/modules/core/src/convert.simd.hpp b/modules/core/src/convert.simd.hpp index 84161b2da7..a5e903b84a 100644 --- a/modules/core/src/convert.simd.hpp +++ b/modules/core/src/convert.simd.hpp @@ -16,8 +16,8 @@ CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN void cvt16f32f(const float16_t* src, float* dst, int len); void cvt32f16f(const float* src, float16_t* dst, int len); -void cvt16bf32f(const bfloat16_t* src, float* dst, int len); -void cvt32f16bf(const float* src, bfloat16_t* dst, int len); +void cvt16bf32f(const bfloat* src, float* dst, int len); +void cvt32f16bf(const float* src, bfloat* dst, int len); void addRNGBias32f(float* arr, const float* scaleBiasPairs, int len, int cn); void addRNGBias64f(double* arr, const double* scaleBiasPairs, int len, int cn); @@ -79,7 +79,7 @@ void cvt32f16f( const float* src, float16_t* dst, int len ) dst[j] = float16_t(src[j]); } -void cvt32f16bf( const float* src, bfloat16_t* dst, int len ) +void cvt32f16bf( const float* src, bfloat* dst, int len ) { CV_INSTRUMENT_REGION(); int j = 0; @@ -97,7 +97,7 @@ void cvt32f16bf( const float* src, bfloat16_t* dst, int len ) } #endif for( ; j < len; j++ ) - dst[j] = bfloat16_t(src[j]); + dst[j] = bfloat(src[j]); } void addRNGBias32f( float* arr, const float* scaleBiasPairs, int len, int cn ) @@ -323,7 +323,7 @@ DEF_CVT_FUNC(8u32f, cvt_, uchar, float, v_float32) DEF_CVT_FUNC(8u64f, cvt_, uchar, double, v_int32) DEF_CVT_SCALAR_FUNC(8u64s, uchar, int64_t) DEF_CVT_FUNC(8u16f, cvt1_, uchar, float16_t, v_float32) -DEF_CVT_FUNC(8u16bf, cvt1_, uchar, bfloat16_t, v_float32) +DEF_CVT_FUNC(8u16bf, cvt1_, uchar, bfloat, v_float32) DEF_CVT2BOOL_FUNC(8u8b, uchar, 0) ////////////////////// 8s -> ... //////////////////////// @@ -338,7 +338,7 @@ DEF_CVT_FUNC(8s64f, cvt_, schar, double, v_int32) DEF_CVT_FUNC(8s64u, cvt_, schar, uint64_t, v_uint32) DEF_CVT_FUNC(8s64s, cvt_, schar, int64_t, v_int32) DEF_CVT_FUNC(8s16f, cvt1_, schar, float16_t, v_float32) -DEF_CVT_FUNC(8s16bf, cvt1_, schar, bfloat16_t, v_float32) +DEF_CVT_FUNC(8s16bf, cvt1_, schar, bfloat, v_float32) ////////////////////// 8b -> ... //////////////////////// @@ -349,7 +349,7 @@ DEF_CVTBOOL2_FUNC(8b32f, float, 1) DEF_CVTBOOL2_FUNC(8b64f, double, 1) DEF_CVTBOOL2_FUNC(8b64s, int64_t, 1) DEF_CVTBOOL2_FUNC(8b16f, uint16_t, 0x3c00) // float16_t(1.0f) -DEF_CVTBOOL2_FUNC(8b16bf, uint16_t, 0x3f80) // bfloat16_t(1.0f) +DEF_CVTBOOL2_FUNC(8b16bf, uint16_t, 0x3f80) // bfloat(1.0f) ////////////////////// 16u -> ... //////////////////////// @@ -361,7 +361,7 @@ DEF_CVT_FUNC(16u32f, cvt_, ushort, float, v_float32) DEF_CVT_FUNC(16u64f, cvt_, ushort, double, v_int32) DEF_CVT_SCALAR_FUNC(16u64s, ushort, int64_t) DEF_CVT_FUNC(16u16f, cvt1_,ushort, float16_t, v_float32) -DEF_CVT_FUNC(16u16bf, cvt1_, ushort, bfloat16_t, v_float32) +DEF_CVT_FUNC(16u16bf, cvt1_, ushort, bfloat, v_float32) ////////////////////// 16s -> ... //////////////////////// @@ -375,7 +375,7 @@ DEF_CVT_FUNC(16s64f, cvt_, short, double, v_int32) DEF_CVT_FUNC(16s64u, cvt_, short, uint64_t, v_uint32) DEF_CVT_FUNC(16s64s, cvt_, short, int64_t, v_int32) DEF_CVT_FUNC(16s16f, cvt1_,short, float16_t, v_float32) -DEF_CVT_FUNC(16s16bf, cvt1_, short, bfloat16_t, v_float32) +DEF_CVT_FUNC(16s16bf, cvt1_, short, bfloat, v_float32) DEF_CVT2BOOL_FUNC(16s8b, short, 0) ////////////////////// 32u -> ... //////////////////////// @@ -389,7 +389,7 @@ DEF_CVT_FUNC(32u32f, cvt_, unsigned, float, v_float32) DEF_CVT_FUNC(32u64f, cvt_, unsigned, double, v_float32) DEF_CVT_SCALAR_FUNC(32u64s, unsigned, int64_t) DEF_CVT_FUNC(32u16f, cvt1_, unsigned, float16_t, v_float32) -DEF_CVT_FUNC(32u16bf, cvt1_, int, bfloat16_t, v_float32) +DEF_CVT_FUNC(32u16bf, cvt1_, int, bfloat, v_float32) ////////////////////// 32s -> ... //////////////////////// @@ -403,7 +403,7 @@ DEF_CVT_FUNC(32s64f, cvt_, int, double, v_int32) DEF_CVT_FUNC(32s64u, cvt_, int, uint64_t, v_uint32) DEF_CVT_FUNC(32s64s, cvt_, int, int64_t, v_int32) DEF_CVT_FUNC(32s16f, cvt1_,int, float16_t, v_float32) -DEF_CVT_FUNC(32s16bf, cvt1_, int, bfloat16_t, v_float32) +DEF_CVT_FUNC(32s16bf, cvt1_, int, bfloat, v_float32) DEF_CVT2BOOL_FUNC(32s8b, int, 0) ////////////////////// 32f -> ... //////////////////////// @@ -418,7 +418,7 @@ DEF_CVT_FUNC(32f64f, cvt_, float, double, v_float32) DEF_CVT_FUNC(32f64u, cvt_64f, float, uint64_t, v_float64) DEF_CVT_FUNC(32f64s, cvt_64f, float, int64_t, v_float64) DEF_CVT_FUNC(32f16f, cvt1_,float, float16_t, v_float32) -DEF_CVT_FUNC(32f16bf, cvt1_,float, bfloat16_t, v_float32) +DEF_CVT_FUNC(32f16bf, cvt1_,float, bfloat, v_float32) DEF_CVT2BOOL_FUNC(32f8b, int, 1) ////////////////////// 64f -> ... //////////////////////// @@ -433,7 +433,7 @@ DEF_CVT_FUNC(64f32f, cvt_, double, float, v_float32) DEF_CVT_FUNC(64f64u, cvt_64f, double, uint64_t, v_float64) DEF_CVT_FUNC(64f64s, cvt_64f, double, int64_t, v_float32) DEF_CVT_FUNC(64f16f, cvt1_,double, float16_t, v_float32) -DEF_CVT_FUNC(64f16bf, cvt1_,double, bfloat16_t, v_float32) +DEF_CVT_FUNC(64f16bf, cvt1_,double, bfloat, v_float32) DEF_CVT2BOOL_FUNC(64f8b, int64_t, 1) ////////////////////// 16f -> ... //////////////////////// @@ -448,22 +448,22 @@ DEF_CVT_FUNC(16f32f, cvt1_, float16_t, float, v_float32) DEF_CVT_FUNC(16f64f, cvt1_, float16_t, double, v_float32) DEF_CVT_FUNC(16f64u, cvt1_, float16_t, uint64_t, v_float32) DEF_CVT_FUNC(16f64s, cvt1_, float16_t, int64_t, v_float32) -DEF_CVT_FUNC(16f16bf, cvt1_, float16_t, bfloat16_t, v_float32) +DEF_CVT_FUNC(16f16bf, cvt1_, float16_t, bfloat, v_float32) DEF_CVT2BOOL_FUNC(16f8b, short, 1) ////////////////////// 16bf -> ... //////////////////////// -DEF_CVT_FUNC(16bf8u, cvt_, bfloat16_t, uchar, v_float32) -DEF_CVT_FUNC(16bf8s, cvt_, bfloat16_t, schar, v_float32) -DEF_CVT_FUNC(16bf16u, cvt1_, bfloat16_t, ushort, v_float32) -DEF_CVT_FUNC(16bf16s, cvt1_, bfloat16_t, short, v_float32) -DEF_CVT_FUNC(16bf32u, cvt1_, bfloat16_t, unsigned, v_float32) -DEF_CVT_FUNC(16bf32s, cvt1_, bfloat16_t, int, v_float32) -DEF_CVT_FUNC(16bf32f, cvt1_, bfloat16_t, float, v_float32) -DEF_CVT_FUNC(16bf64f, cvt1_, bfloat16_t, double, v_float32) -DEF_CVT_FUNC(16bf64u, cvt1_, bfloat16_t, uint64_t, v_float32) -DEF_CVT_FUNC(16bf64s, cvt1_, bfloat16_t, int64_t, v_float32) -DEF_CVT_FUNC(16bf16f, cvt1_, bfloat16_t, float16_t, v_float32) +DEF_CVT_FUNC(16bf8u, cvt_, bfloat, uchar, v_float32) +DEF_CVT_FUNC(16bf8s, cvt_, bfloat, schar, v_float32) +DEF_CVT_FUNC(16bf16u, cvt1_, bfloat, ushort, v_float32) +DEF_CVT_FUNC(16bf16s, cvt1_, bfloat, short, v_float32) +DEF_CVT_FUNC(16bf32u, cvt1_, bfloat, unsigned, v_float32) +DEF_CVT_FUNC(16bf32s, cvt1_, bfloat, int, v_float32) +DEF_CVT_FUNC(16bf32f, cvt1_, bfloat, float, v_float32) +DEF_CVT_FUNC(16bf64f, cvt1_, bfloat, double, v_float32) +DEF_CVT_FUNC(16bf64u, cvt1_, bfloat, uint64_t, v_float32) +DEF_CVT_FUNC(16bf64s, cvt1_, bfloat, int64_t, v_float32) +DEF_CVT_FUNC(16bf16f, cvt1_, bfloat, float16_t, v_float32) ////////////////////// 64s -> ... //////////////////////// @@ -477,7 +477,7 @@ DEF_CVT_FUNC(64s32f, cvt_64f, int64_t, float, v_float32) DEF_CVT_FUNC(64s64f, cvt_64f, int64_t, double, v_float64) DEF_CVT_FUNC(64s64u, cvt_, int64_t, uint64_t, v_uint64) DEF_CVT_FUNC(64s16f, cvt1_,int64_t, float16_t, v_float32) -DEF_CVT_FUNC(64s16bf, cvt1_, int64_t, bfloat16_t, v_float32) +DEF_CVT_FUNC(64s16bf, cvt1_, int64_t, bfloat, v_float32) DEF_CVT2BOOL_FUNC(64s8b, int64_t, 0) ////////////////////// 64u -> ... //////////////////////// @@ -491,7 +491,7 @@ DEF_CVT_FUNC(64u32s, cvt_, uint64_t, int, v_int32) DEF_CVT_FUNC(64u32f, cvt_64f, uint64_t, float, v_float64) DEF_CVT_FUNC(64u64f, cvt_64f, uint64_t, double, v_float64) DEF_CVT_FUNC(64u16f, cvt1_,uint64_t, float16_t, v_float32) -DEF_CVT_FUNC(64u16bf, cvt1_, uint64_t, bfloat16_t, v_float32) +DEF_CVT_FUNC(64u16bf, cvt1_, uint64_t, bfloat, v_float32) ///////////// "conversion" w/o conversion /////////////// diff --git a/modules/core/src/convert_scale.simd.hpp b/modules/core/src/convert_scale.simd.hpp index e29fe06a9b..89040c7e9a 100644 --- a/modules/core/src/convert_scale.simd.hpp +++ b/modules/core/src/convert_scale.simd.hpp @@ -236,7 +236,7 @@ DEF_CVT_SCALE_ABS_FUNC(64u8u, cvtabs_32f, uint64_t, uchar, float) DEF_CVT_SCALE_ABS_FUNC(64s8u, cvtabs_32f, int64_t, uchar, float) DEF_CVT_SCALE_ABS_FUNC(64f8u, cvtabs_32f, double, uchar, float) DEF_CVT_SCALE_ABS_FUNC(16f8u, cvtabs_32f, float16_t, uchar, float) -DEF_CVT_SCALE_ABS_FUNC(16bf8u, cvtabs_32f, bfloat16_t, uchar, float) +DEF_CVT_SCALE_ABS_FUNC(16bf8u, cvtabs_32f, bfloat, uchar, float) DEF_CVT_SCALE_FUNC(8u, cvt_32f, uchar, uchar, float) DEF_CVT_SCALE_FUNC(8s8u, cvt_32f, schar, uchar, float) @@ -249,7 +249,7 @@ DEF_CVT_SCALE_FUNC(64f8u, cvt_32f, double, uchar, float) DEF_CVT_SCALE_FUNC(64u8u, cvt_32f, uint64_t, uchar, float) DEF_CVT_SCALE_FUNC(64s8u, cvt_32f, int64_t, uchar, float) DEF_CVT_SCALE_FUNC(16f8u, cvt_32f, float16_t, uchar, float) -DEF_CVT_SCALE_FUNC(16bf8u, cvt_32f, bfloat16_t, uchar, float) +DEF_CVT_SCALE_FUNC(16bf8u, cvt_32f, bfloat, uchar, float) DEF_CVT_SCALE_FUNC(8u8s, cvt_32f, uchar, schar, float) DEF_CVT_SCALE_FUNC(8s, cvt_32f, schar, schar, float) @@ -262,7 +262,7 @@ DEF_CVT_SCALE_FUNC(64f8s, cvt_32f, double, schar, float) DEF_CVT_SCALE_FUNC(64u8s, cvt_32f, uint64_t, schar, float) DEF_CVT_SCALE_FUNC(64s8s, cvt_32f, int64_t, schar, float) DEF_CVT_SCALE_FUNC(16f8s, cvt_32f, float16_t, schar, float) -DEF_CVT_SCALE_FUNC(16bf8s, cvt_32f, bfloat16_t, schar, float) +DEF_CVT_SCALE_FUNC(16bf8s, cvt_32f, bfloat, schar, float) DEF_CVT_SCALE2BOOL_FUNC(8u8b, uchar, float) DEF_CVT_SCALE2BOOL_FUNC(8s8b, schar, float) @@ -275,7 +275,7 @@ DEF_CVT_SCALE2BOOL_FUNC(64f8b, double, float) DEF_CVT_SCALE2BOOL_FUNC(64u8b, uint64_t, float) DEF_CVT_SCALE2BOOL_FUNC(64s8b, int64_t, float) DEF_CVT_SCALE2BOOL_FUNC(16f8b, float16_t, float) -DEF_CVT_SCALE2BOOL_FUNC(16bf8b, bfloat16_t, float) +DEF_CVT_SCALE2BOOL_FUNC(16bf8b, bfloat, float) DEF_CVT_SCALE_FUNC(8u16u, cvt_32f, uchar, ushort, float) DEF_CVT_SCALE_FUNC(8s16u, cvt_32f, schar, ushort, float) @@ -288,7 +288,7 @@ DEF_CVT_SCALE_FUNC(64f16u, cvt_32f, double, ushort, float) DEF_CVT_SCALE_FUNC(64u16u, cvt_32f, uint64_t, ushort, float) DEF_CVT_SCALE_FUNC(64s16u, cvt_32f, int64_t, ushort, float) DEF_CVT_SCALE_FUNC(16f16u, cvt1_32f, float16_t, ushort, float) -DEF_CVT_SCALE_FUNC(16bf16u, cvt1_32f, bfloat16_t, ushort, float) +DEF_CVT_SCALE_FUNC(16bf16u, cvt1_32f, bfloat, ushort, float) DEF_CVT_SCALE_FUNC(8u16s, cvt_32f, uchar, short, float) DEF_CVT_SCALE_FUNC(8s16s, cvt_32f, schar, short, float) @@ -301,7 +301,7 @@ DEF_CVT_SCALE_FUNC(64f16s, cvt_32f, double, short, float) DEF_CVT_SCALE_FUNC(64u16s, cvt_32f, uint64_t, short, float) DEF_CVT_SCALE_FUNC(64s16s, cvt_32f, int64_t, short, float) DEF_CVT_SCALE_FUNC(16f16s, cvt1_32f, float16_t, short, float) -DEF_CVT_SCALE_FUNC(16bf16s, cvt1_32f, bfloat16_t, short, float) +DEF_CVT_SCALE_FUNC(16bf16s, cvt1_32f, bfloat, short, float) DEF_CVT_SCALE_FUNC(8u32u, cvt_32f, uchar, unsigned, float) DEF_CVT_SCALE_FUNC(8s32u, cvt_32f, schar, unsigned, float) @@ -314,7 +314,7 @@ DEF_CVT_SCALE_FUNC(64f32u, cvt_64f, double, unsigned, double) DEF_CVT_SCALE_FUNC(64u32u, cvt_32f, uint64_t, unsigned, float) DEF_CVT_SCALE_FUNC(64s32u, cvt_32f, int64_t, unsigned, float) DEF_CVT_SCALE_FUNC(16f32u, cvt1_32f, float16_t, unsigned, float) -DEF_CVT_SCALE_FUNC(16bf32u, cvt1_32f, bfloat16_t, unsigned, float) +DEF_CVT_SCALE_FUNC(16bf32u, cvt1_32f, bfloat, unsigned, float) DEF_CVT_SCALE_FUNC(8u32s, cvt_32f, uchar, int, float) DEF_CVT_SCALE_FUNC(8s32s, cvt_32f, schar, int, float) @@ -327,7 +327,7 @@ DEF_CVT_SCALE_FUNC(64f32s, cvt_64f, double, int, double) DEF_CVT_SCALE_FUNC(64u32s, cvt_32f, uint64_t, int, float) DEF_CVT_SCALE_FUNC(64s32s, cvt_32f, int64_t, int, float) DEF_CVT_SCALE_FUNC(16f32s, cvt1_32f, float16_t, int, float) -DEF_CVT_SCALE_FUNC(16bf32s, cvt1_32f, bfloat16_t, int, float) +DEF_CVT_SCALE_FUNC(16bf32s, cvt1_32f, bfloat, int, float) DEF_CVT_SCALE_FUNC(8u32f, cvt_32f, uchar, float, float) DEF_CVT_SCALE_FUNC(8s32f, cvt_32f, schar, float, float) @@ -340,7 +340,7 @@ DEF_CVT_SCALE_FUNC(64f32f, cvt_64f, double, float, double) DEF_CVT_SCALE_FUNC(64u32f, cvt_32f, uint64_t, float, float) DEF_CVT_SCALE_FUNC(64s32f, cvt_32f, int64_t, float, float) DEF_CVT_SCALE_FUNC(16f32f, cvt1_32f, float16_t, float, float) -DEF_CVT_SCALE_FUNC(16bf32f, cvt1_32f, bfloat16_t, float, float) +DEF_CVT_SCALE_FUNC(16bf32f, cvt1_32f, bfloat, float, float) DEF_CVT_SCALE_FUNC(8u64f, cvt_64f, uchar, double, double) DEF_CVT_SCALE_FUNC(8s64f, cvt_64f, schar, double, double) @@ -353,7 +353,7 @@ DEF_CVT_SCALE_FUNC(64f, cvt_64f, double, double, double) DEF_CVT_SCALE_FUNC(64u64f, cvt_64f, uint64_t, double, double) DEF_CVT_SCALE_FUNC(64s64f, cvt_64f, int64_t, double, double) DEF_CVT_SCALE_FUNC(16f64f, cvt_64f, float16_t, double, double) -DEF_CVT_SCALE_FUNC(16bf64f, cvt_64f, bfloat16_t, double, double) +DEF_CVT_SCALE_FUNC(16bf64f, cvt_64f, bfloat, double, double) DEF_CVT_SCALE_FUNC(8u64u, cvt_64f, uchar, uint64_t, double) DEF_CVT_SCALE_FUNC(8s64u, cvt_64f, schar, uint64_t, double) @@ -366,7 +366,7 @@ DEF_CVT_SCALE_FUNC(64f64u, cvt_64f, double, uint64_t, double) DEF_CVT_SCALE_FUNC(64u, cvt_64f, uint64_t, uint64_t, double) DEF_CVT_SCALE_FUNC(64s64u, cvt_64f, int64_t, uint64_t, double) DEF_CVT_SCALE_FUNC(16f64u, cvt_64f, float16_t, uint64_t, double) -DEF_CVT_SCALE_FUNC(16bf64u, cvt_64f, bfloat16_t, uint64_t, double) +DEF_CVT_SCALE_FUNC(16bf64u, cvt_64f, bfloat, uint64_t, double) DEF_CVT_SCALE_FUNC(8u64s, cvt_64f, uchar, int64_t, double) DEF_CVT_SCALE_FUNC(8s64s, cvt_64f, schar, int64_t, double) @@ -379,7 +379,7 @@ DEF_CVT_SCALE_FUNC(64f64s, cvt_64f, double, int64_t, double) DEF_CVT_SCALE_FUNC(64u64s, cvt_64f, uint64_t, int64_t, double) DEF_CVT_SCALE_FUNC(64s, cvt_64f, int64_t, int64_t, double) DEF_CVT_SCALE_FUNC(16f64s, cvt_64f, float16_t, int64_t, double) -DEF_CVT_SCALE_FUNC(16bf64s, cvt_64f, bfloat16_t, int64_t, double) +DEF_CVT_SCALE_FUNC(16bf64s, cvt_64f, bfloat, int64_t, double) DEF_CVT_SCALE_FUNC(8u16f, cvt1_32f, uchar, float16_t, float) DEF_CVT_SCALE_FUNC(8s16f, cvt1_32f, schar, float16_t, float) @@ -392,20 +392,20 @@ DEF_CVT_SCALE_FUNC(64f16f, cvt1_32f, double, float16_t, float) DEF_CVT_SCALE_FUNC(64u16f, cvt1_32f, uint64_t, float16_t, float) DEF_CVT_SCALE_FUNC(64s16f, cvt1_32f, int64_t, float16_t, float) DEF_CVT_SCALE_FUNC(16f, cvt1_32f, float16_t, float16_t, float) -DEF_CVT_SCALE_FUNC(16bf16f, cvt1_32f, bfloat16_t, float16_t, float) +DEF_CVT_SCALE_FUNC(16bf16f, cvt1_32f, bfloat, float16_t, float) -DEF_CVT_SCALE_FUNC(8u16bf, cvt1_32f, uchar, bfloat16_t, float) -DEF_CVT_SCALE_FUNC(8s16bf, cvt1_32f, schar, bfloat16_t, float) -DEF_CVT_SCALE_FUNC(16u16bf, cvt1_32f, ushort, bfloat16_t, float) -DEF_CVT_SCALE_FUNC(16s16bf, cvt1_32f, short, bfloat16_t, float) -DEF_CVT_SCALE_FUNC(32u16bf, cvt1_32f, unsigned, bfloat16_t, float) -DEF_CVT_SCALE_FUNC(32s16bf, cvt1_32f, int, bfloat16_t, float) -DEF_CVT_SCALE_FUNC(32f16bf, cvt1_32f, float, bfloat16_t, float) -DEF_CVT_SCALE_FUNC(64f16bf, cvt1_32f, double, bfloat16_t, float) -DEF_CVT_SCALE_FUNC(64u16bf, cvt1_32f, uint64_t, bfloat16_t, float) -DEF_CVT_SCALE_FUNC(64s16bf, cvt1_32f, int64_t, bfloat16_t, float) -DEF_CVT_SCALE_FUNC(16f16bf, cvt1_32f, float16_t, bfloat16_t, float) -DEF_CVT_SCALE_FUNC(16bf, cvt1_32f, bfloat16_t, bfloat16_t, float) +DEF_CVT_SCALE_FUNC(8u16bf, cvt1_32f, uchar, bfloat, float) +DEF_CVT_SCALE_FUNC(8s16bf, cvt1_32f, schar, bfloat, float) +DEF_CVT_SCALE_FUNC(16u16bf, cvt1_32f, ushort, bfloat, float) +DEF_CVT_SCALE_FUNC(16s16bf, cvt1_32f, short, bfloat, float) +DEF_CVT_SCALE_FUNC(32u16bf, cvt1_32f, unsigned, bfloat, float) +DEF_CVT_SCALE_FUNC(32s16bf, cvt1_32f, int, bfloat, float) +DEF_CVT_SCALE_FUNC(32f16bf, cvt1_32f, float, bfloat, float) +DEF_CVT_SCALE_FUNC(64f16bf, cvt1_32f, double, bfloat, float) +DEF_CVT_SCALE_FUNC(64u16bf, cvt1_32f, uint64_t, bfloat, float) +DEF_CVT_SCALE_FUNC(64s16bf, cvt1_32f, int64_t, bfloat, float) +DEF_CVT_SCALE_FUNC(16f16bf, cvt1_32f, float16_t, bfloat, float) +DEF_CVT_SCALE_FUNC(16bf, cvt1_32f, bfloat, bfloat, float) DEF_CVT_SCALEBOOL2_FUNC(8b8u, uchar, float) DEF_CVT_SCALEBOOL2_FUNC(8b8s, schar, float) @@ -419,7 +419,7 @@ DEF_CVT_SCALEBOOL2_FUNC(8b64u, uint64_t, double) DEF_CVT_SCALEBOOL2_FUNC(8b64s, int64_t, double) DEF_CVT_SCALEBOOL2_FUNC(8b64f, double, double) DEF_CVT_SCALEBOOL2_FUNC(8b16f, float16_t, float) -DEF_CVT_SCALEBOOL2_FUNC(8b16bf, bfloat16_t, float) +DEF_CVT_SCALEBOOL2_FUNC(8b16bf, bfloat, float) BinaryFunc getCvtScaleAbsFunc(int depth) { diff --git a/modules/core/src/copy.cpp b/modules/core/src/copy.cpp index aec36b9073..38db073e1b 100644 --- a/modules/core/src/copy.cpp +++ b/modules/core/src/copy.cpp @@ -90,7 +90,7 @@ void scalarToRawData(const Scalar& s, void* _buf, int type, int unroll_to) scalarToRawData_(s, (float16_t*)_buf, cn, unroll_to); break; case CV_16BF: - scalarToRawData_(s, (bfloat16_t*)_buf, cn, unroll_to); + scalarToRawData_(s, (bfloat*)_buf, cn, unroll_to); break; case CV_32U: scalarToRawData_(s, (unsigned*)_buf, cn, unroll_to); diff --git a/modules/core/src/mean.simd.hpp b/modules/core/src/mean.simd.hpp index 8bdaacc909..5562c95932 100644 --- a/modules/core/src/mean.simd.hpp +++ b/modules/core/src/mean.simd.hpp @@ -311,7 +311,7 @@ static int sqsum64f( const double* src, const uchar* mask, double* sum, double* static int sqsum16f( const float16_t* src, const uchar* mask, float* sum, double* sqsum, int len, int cn ) { CV_INSTRUMENT_REGION(); return sumsqr_(src, mask, sum, sqsum, len, cn); } -static int sqsum16bf( const bfloat16_t* src, const uchar* mask, float* sum, double* sqsum, int len, int cn ) +static int sqsum16bf( const bfloat* src, const uchar* mask, float* sum, double* sqsum, int len, int cn ) { CV_INSTRUMENT_REGION(); return sumsqr_(src, mask, sum, sqsum, len, cn); } static int sqsum64u( const uint64* src, const uchar* mask, double* sum, double* sqsum, int len, int cn ) diff --git a/modules/core/src/minmax.simd.hpp b/modules/core/src/minmax.simd.hpp index d1f2fa9e8e..44d806b403 100644 --- a/modules/core/src/minmax.simd.hpp +++ b/modules/core/src/minmax.simd.hpp @@ -354,13 +354,13 @@ DEFINE_MINMAXIDX_SMALLINT_FUNC(minMaxIdx16s, s16, u16, short, ushort, v_int16, v DEFINE_MINMAXIDX_FUNC(minMaxIdx32s, s32, u32, int, unsigned, v_int32, v_uint32, int, vx_load) DEFINE_MINMAXIDX_FUNC(minMaxIdx32f, f32, u32, float, unsigned, v_float32, v_uint32, float, vx_load) DEFINE_MINMAXIDX_FUNC(minMaxIdx16f, f32, u32, float16_t, unsigned, v_float32, v_uint32, float, vx_load_expand) -DEFINE_MINMAXIDX_FUNC(minMaxIdx16bf, f32, u32, bfloat16_t, unsigned, v_float32, v_uint32, float, vx_load_expand) +DEFINE_MINMAXIDX_FUNC(minMaxIdx16bf, f32, u32, bfloat, unsigned, v_float32, v_uint32, float, vx_load_expand) //DEFINE_MINMAXIDX_FUNC_NOSIMD(minMaxIdx32s, int, int) //DEFINE_MINMAXIDX_FUNC_NOSIMD(minMaxIdx32f, float, float) DEFINE_MINMAXIDX_FUNC_NOSIMD(minMaxIdx64f, double, double) //DEFINE_MINMAXIDX_FUNC_NOSIMD(minMaxIdx16f, float16_t, float) -//DEFINE_MINMAXIDX_FUNC_NOSIMD(minMaxIdx16bf, bfloat16_t, float) +//DEFINE_MINMAXIDX_FUNC_NOSIMD(minMaxIdx16bf, bfloat, float) DEFINE_MINMAXIDX_FUNC_NOSIMD(minMaxIdx64u, uint64, uint64) DEFINE_MINMAXIDX_FUNC_NOSIMD(minMaxIdx64s, int64, int64) DEFINE_MINMAXIDX_FUNC_NOSIMD(minMaxIdx32u, unsigned, int64) diff --git a/modules/core/src/norm.cpp b/modules/core/src/norm.cpp index 52ef62e4f7..09e1613585 100644 --- a/modules/core/src/norm.cpp +++ b/modules/core/src/norm.cpp @@ -364,7 +364,7 @@ CV_DEF_NORM_ALL(64f, double, double, double, double) CV_DEF_NORM_ALL(64u, uint64, uint64, double, double) CV_DEF_NORM_ALL(64s, int64, uint64, double, double) CV_DEF_NORM_ALL(16f, float16_t, float, float, float) -CV_DEF_NORM_ALL(16bf, bfloat16_t, float, float, float) +CV_DEF_NORM_ALL(16bf, bfloat, float, float, float) typedef int (*NormFunc)(const uchar*, const uchar*, void*, int, int); typedef int (*NormDiffFunc)(const uchar*, const uchar*, const uchar*, void*, int, int); diff --git a/modules/core/src/out.cpp b/modules/core/src/out.cpp index 2167f5af9f..93321392ca 100644 --- a/modules/core/src/out.cpp +++ b/modules/core/src/out.cpp @@ -82,7 +82,7 @@ namespace cv void valueToStr64u() { snprintf(buf, sizeof(buf), "%llu", (unsigned long long)mtx.ptr(row, col)[cn]); } void valueToStr64s() { snprintf(buf, sizeof(buf), "%lld", (long long)mtx.ptr(row, col)[cn]); } void valueToStr16f() { snprintf(buf, sizeof(buf), floatFormat, (float)mtx.ptr(row, col)[cn]); } - void valueToStr16bf() { snprintf(buf, sizeof(buf), floatFormat, (float)mtx.ptr(row, col)[cn]); } + void valueToStr16bf() { snprintf(buf, sizeof(buf), floatFormat, (float)mtx.ptr(row, col)[cn]); } void valueToStrOther() { buf[0] = 0; } public: diff --git a/modules/core/src/persistence.cpp b/modules/core/src/persistence.cpp index f39dfcae7d..334bb19084 100644 --- a/modules/core/src/persistence.cpp +++ b/modules/core/src/persistence.cpp @@ -295,7 +295,7 @@ int calcStructSize( const char* dt, int initial_size ) case 'f': { elem_max_size = std::max( elem_max_size, sizeof(float ) ); break; } case 'd': { elem_max_size = std::max( elem_max_size, sizeof(double) ); break; } case 'h': { elem_max_size = std::max( elem_max_size, sizeof(float16_t)); break; } - case 'H': { elem_max_size = std::max( elem_max_size, sizeof(bfloat16_t)); break; } + case 'H': { elem_max_size = std::max( elem_max_size, sizeof(bfloat)); break; } case 'I': { elem_max_size = std::max( elem_max_size, sizeof(int64_t)); break; } case 'U': { elem_max_size = std::max( elem_max_size, sizeof(uint64_t)); break; } default: @@ -1176,8 +1176,8 @@ void FileStorage::Impl::writeRawData(const std::string &dt, const void *_data, s data += sizeof(float16_t); break; case CV_16BF: - ptr = fs::floatToString(buf, sizeof(buf), (float) *(bfloat16_t *) data, true, explicitZero); - data += sizeof(bfloat16_t); + ptr = fs::floatToString(buf, sizeof(buf), (float) *(bfloat *) data, true, explicitZero); + data += sizeof(bfloat); break; default: CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported type"); @@ -2667,8 +2667,8 @@ FileNodeIterator& FileNodeIterator::readRaw( const String& fmt, void* _data0, si data += sizeof(float16_t); break; case CV_16BF: - *(bfloat16_t*)data = bfloat16_t((float)ival); - data += sizeof(bfloat16_t); + *(bfloat*)data = bfloat((float)ival); + data += sizeof(bfloat); break; default: CV_Error( Error::StsUnsupportedFormat, "Unsupported type" ); @@ -2725,8 +2725,8 @@ FileNodeIterator& FileNodeIterator::readRaw( const String& fmt, void* _data0, si data += sizeof(float16_t); break; case CV_16BF: - *(bfloat16_t*)data = bfloat16_t((float)fval); - data += sizeof(bfloat16_t); + *(bfloat*)data = bfloat((float)fval); + data += sizeof(bfloat); break; default: CV_Error( Error::StsUnsupportedFormat, "Unsupported type" ); diff --git a/modules/core/src/rand.cpp b/modules/core/src/rand.cpp index 7f1b5e4b81..010aad35ac 100644 --- a/modules/core/src/rand.cpp +++ b/modules/core/src/rand.cpp @@ -248,7 +248,7 @@ static void randf_16_or_32f( void* dst, int len_, int cn, uint64* state, const V if (depth == CV_16F) hal::cvt32f16f(fbuf, (float16_t*)dst, len); else if (depth == CV_16BF) - hal::cvt32f16bf(fbuf, (bfloat16_t*)dst, len); + hal::cvt32f16bf(fbuf, (bfloat*)dst, len); } static void @@ -480,7 +480,7 @@ randnScale_16_or_32f(float* fbuf, float* dst, int len, int cn, if (depth == CV_16F) hal::cvt32f16f(fbuf, (float16_t*)dst, len); else if (depth == CV_16BF) - hal::cvt32f16bf(fbuf, (bfloat16_t*)dst, len); + hal::cvt32f16bf(fbuf, (bfloat*)dst, len); } #define DEF_RANDNSCALE_FUNC(suffix, T, PT) \ diff --git a/modules/core/src/sum.simd.hpp b/modules/core/src/sum.simd.hpp index 5317606b80..0ebd616fd8 100644 --- a/modules/core/src/sum.simd.hpp +++ b/modules/core/src/sum.simd.hpp @@ -171,7 +171,7 @@ DEFINE_SUM_SIMD_8(schar, int, int, v_int32, vx_load_expand) DEFINE_SUM_SIMD_16(ushort, int, int, v_int32, load_u16_as_s32) DEFINE_SUM_SIMD_16(short, int, int, v_int32, vx_load_expand) DEFINE_SUM_SIMD_16(float16_t, float, int, v_float32, vx_load_expand) -DEFINE_SUM_SIMD_16(bfloat16_t, float, int, v_float32, vx_load_expand) +DEFINE_SUM_SIMD_16(bfloat, float, int, v_float32, vx_load_expand) #if (CV_SIMD_64F || CV_SIMD_SCALABLE_64F) @@ -377,8 +377,8 @@ static int sum64f( const double* src, const uchar* mask, double* dst, int len, i static int sum16f( const float16_t* src, const uchar* mask, float* dst, int len, int cn ) { CV_INSTRUMENT_REGION(); return sum_(src, mask, dst, len, cn); } -static int sum16bf( const bfloat16_t* src, const uchar* mask, float* dst, int len, int cn ) -{ CV_INSTRUMENT_REGION(); return sum_(src, mask, dst, len, cn); } +static int sum16bf( const bfloat* src, const uchar* mask, float* dst, int len, int cn ) +{ CV_INSTRUMENT_REGION(); return sum_(src, mask, dst, len, cn); } SumFunc getSumFunc(int depth) { diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index 5a3191f892..e5506f3bd9 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -632,8 +632,8 @@ static void inRange(const Mat& src, const Mat& lb, const Mat& rb, Mat& dst) (const cv::float16_t*)bptr, dptr, total, cn); break; case CV_16BF: - inRange_((const cv::bfloat16_t*)sptr, (const cv::bfloat16_t*)aptr, - (const cv::bfloat16_t*)bptr, dptr, total, cn); + inRange_((const cv::bfloat*)sptr, (const cv::bfloat*)aptr, + (const cv::bfloat*)bptr, dptr, total, cn); break; default: CV_Error(cv::Error::StsUnsupportedFormat, ""); @@ -698,7 +698,7 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds inRangeS_((const cv::float16_t*)sptr, lbuf.f, rbuf.f, dptr, total, cn); break; case CV_16BF: - inRangeS_((const cv::bfloat16_t*)sptr, lbuf.f, rbuf.f, dptr, total, cn); + inRangeS_((const cv::bfloat*)sptr, lbuf.f, rbuf.f, dptr, total, cn); break; default: CV_Error(cv::Error::StsUnsupportedFormat, ""); diff --git a/modules/ts/src/ts_func.cpp b/modules/ts/src/ts_func.cpp index bc88801cc9..cdf637bdb9 100644 --- a/modules/ts/src/ts_func.cpp +++ b/modules/ts/src/ts_func.cpp @@ -320,7 +320,7 @@ convertTo(const _Tp* src, void* dst, int dtype, convert_(src, (cv::float16_t*)dst, total, alpha, beta); break; case CV_16BF: - convert_(src, (cv::bfloat16_t*)dst, total, alpha, beta); + convert_(src, (cv::bfloat*)dst, total, alpha, beta); break; case CV_Bool: convert_to_bool(src, (bool*)dst, total, alpha, beta); @@ -403,7 +403,7 @@ void convert(const Mat& src, cv::OutputArray _dst, convertTo((const cv::float16_t*)sptr, dptr, dtype, total, alpha, beta); break; case CV_16BF: - convertTo((const cv::bfloat16_t*)sptr, dptr, dtype, total, alpha, beta); + convertTo((const cv::bfloat*)sptr, dptr, dtype, total, alpha, beta); break; default: CV_Error(cv::Error::StsNotImplemented, "unknown/unsupported depth"); @@ -1197,8 +1197,8 @@ void minMaxLoc(const Mat& src, double* _minval, double* _maxval, &minval, &maxval, &minidx, &maxidx, mptr); break; case CV_16BF: - minMaxLoc_( - (const cv::bfloat16_t*)sptr, total, startidx, + minMaxLoc_( + (const cv::bfloat*)sptr, total, startidx, &minval, &maxval, &minidx, &maxidx, mptr); break; case CV_64U: @@ -1450,7 +1450,7 @@ double norm(InputArray _src, int normType, InputArray _mask) result = norm_((const cv::float16_t*)sptr, total, cn, normType, result, mptr); break; case CV_16BF: - result = norm_((const cv::bfloat16_t*)sptr, total, cn, normType, result, mptr); + result = norm_((const cv::bfloat*)sptr, total, cn, normType, result, mptr); break; default: CV_Error(Error::StsUnsupportedFormat, ""); @@ -1556,7 +1556,7 @@ double norm(InputArray _src1, InputArray _src2, int normType, InputArray _mask) result = norm_((const cv::float16_t*)sptr1, (const cv::float16_t*)sptr2, total, cn, normType, result, mptr); break; case CV_16BF: - result = norm_((const cv::bfloat16_t*)sptr1, (const cv::bfloat16_t*)sptr2, total, cn, normType, result, mptr); + result = norm_((const cv::bfloat*)sptr1, (const cv::bfloat*)sptr2, total, cn, normType, result, mptr); break; default: CV_Error(Error::StsUnsupportedFormat, ""); @@ -1852,7 +1852,7 @@ void compare(const Mat& src1, const Mat& src2, Mat& dst, int cmpop) compare_((const cv::float16_t*)sptr1, (const cv::float16_t*)sptr2, dptr, total, cmpop); break; case CV_16BF: - compare_((const cv::bfloat16_t*)sptr1, (const cv::bfloat16_t*)sptr2, dptr, total, cmpop); + compare_((const cv::bfloat*)sptr1, (const cv::bfloat*)sptr2, dptr, total, cmpop); break; default: CV_Error(Error::StsUnsupportedFormat, ""); @@ -1914,7 +1914,7 @@ void compare(const Mat& src, double value, Mat& dst, int cmpop) compareS_((const cv::float16_t*)sptr, (float)value, dptr, total, cmpop); break; case CV_16BF: - compareS_((const cv::bfloat16_t*)sptr, (float)value, dptr, total, cmpop); + compareS_((const cv::bfloat*)sptr, (float)value, dptr, total, cmpop); break; default: CV_Error(Error::StsUnsupportedFormat, ""); @@ -2660,7 +2660,7 @@ static void minmax(const Mat& src1, const Mat& src2, Mat& dst, char op) minmax16f_((const cv::float16_t*)sptr1, (const cv::float16_t*)sptr2, (cv::float16_t*)dptr, total, op); break; case CV_16BF: - minmax16f_((const cv::bfloat16_t*)sptr1, (const cv::bfloat16_t*)sptr2, (cv::bfloat16_t*)dptr, total, op); + minmax16f_((const cv::bfloat*)sptr1, (const cv::bfloat*)sptr2, (cv::bfloat*)dptr, total, op); break; default: CV_Error(Error::StsUnsupportedFormat, ""); @@ -2756,7 +2756,7 @@ static void minmax(const Mat& src1, double val, Mat& dst, char op) minmax_16f((const cv::float16_t*)sptr1, saturate_cast(val), (cv::float16_t*)dptr, total, op); break; case CV_16BF: - minmax_16f((const cv::bfloat16_t*)sptr1, saturate_cast(val), (cv::bfloat16_t*)dptr, total, op); + minmax_16f((const cv::bfloat*)sptr1, saturate_cast(val), (cv::bfloat*)dptr, total, op); break; default: CV_Error(Error::StsUnsupportedFormat, ""); @@ -2857,7 +2857,7 @@ static void muldiv(const Mat& src1, const Mat& src2, Mat& dst, double scale, cha muldiv_16f((const cv::float16_t*)sptr1, (const cv::float16_t*)sptr2, (cv::float16_t*)dptr, total, scale, op); break; case CV_16BF: - muldiv_16f((const cv::bfloat16_t*)sptr1, (const cv::bfloat16_t*)sptr2, (cv::bfloat16_t*)dptr, total, scale, op); + muldiv_16f((const cv::bfloat*)sptr1, (const cv::bfloat*)sptr2, (cv::bfloat*)dptr, total, scale, op); break; default: CV_Error(Error::StsUnsupportedFormat, ""); @@ -2957,7 +2957,7 @@ Scalar mean(const Mat& src, const Mat& mask) mean_((const cv::float16_t*)sptr, mptr, total, cn, sum, nz); break; case CV_16BF: - mean_((const cv::bfloat16_t*)sptr, mptr, total, cn, sum, nz); + mean_((const cv::bfloat*)sptr, mptr, total, cn, sum, nz); break; default: CV_Error(Error::StsUnsupportedFormat, ""); @@ -3230,7 +3230,7 @@ static void writeElems(std::ostream& out, const void* data, int nelems, int dept { std::streamsize pp = out.precision(); out.precision(4); - writeElems(out, data, nelems, starpos); + writeElems(out, data, nelems, starpos); out.precision(pp); } else if(depth == CV_32F)