mirror of
https://github.com/opencv/opencv.git
synced 2024-12-12 15:19:11 +08:00
1d9ca7160b
Use hfloat instead of __fp16. #25796 Related: #25743 Currently, the type for the half-precision floating point data in the OpenCV source code is `__fp16`, which is a unique(?) type supported by the ARM compiler. Other compilers have very limited support for `__fp16`, so in order to introduce more backends that support FP16 (such as RISC-V), we may need a the more general FP16 type. In this patch, we use `hfloat` instead of `__fp16` in non-ARM code blocks, mainly affected parts are: - `core/hal/intrin.hpp`: Type Traits, REG Traits and `vx_` interface. - `core/hal/intrin_neon.hpp`: Universal Intrinsic API for FP16 type. - `core/test/test_intrin_utils.hpp`: Usage of Univseral Intrinsic - `core/include/opencv2/core/cvdef.h`: Definition of class `hfloat` If I understand correctly, class `hfloat` acts as a wrapper around FP16 types in different platform (`__fp16` for ARM and `_Float16` for RISC-V). Any OpenCV generic interface/source code should use `hfloat`, while platform-specific FP16 types only used in macro-guarded code blocks. /cc @fengyuentau @mshabunin ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [ ] I agree to contribute to the project under Apache 2 License. - [ ] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake |
||
---|---|---|
.. | ||
ocl | ||
ref_reduce_arg.impl.hpp | ||
test_arithm.cpp | ||
test_async.cpp | ||
test_concatenation.cpp | ||
test_conjugate_gradient.cpp | ||
test_countnonzero.cpp | ||
test_cuda.cpp | ||
test_downhill_simplex.cpp | ||
test_ds.cpp | ||
test_dxt.cpp | ||
test_eigen.cpp | ||
test_hal_core.cpp | ||
test_hasnonzero.cpp | ||
test_intrin128.simd.hpp | ||
test_intrin256.simd.hpp | ||
test_intrin512.simd.hpp | ||
test_intrin_emulator.cpp | ||
test_intrin_utils.hpp | ||
test_intrin.cpp | ||
test_io.cpp | ||
test_logtagconfigparser.cpp | ||
test_logtagmanager.cpp | ||
test_lpsolver.cpp | ||
test_main.cpp | ||
test_mat.cpp | ||
test_math.cpp | ||
test_misc.cpp | ||
test_opencl.cpp | ||
test_operations.cpp | ||
test_precomp.hpp | ||
test_ptr.cpp | ||
test_quaternion.cpp | ||
test_rand.cpp | ||
test_rotatedrect.cpp | ||
test_umat.cpp | ||
test_utils_tls.impl.hpp | ||
test_utils.cpp |