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 |
||
---|---|---|
.. | ||
3rdparty/SoftFloat | ||
cmake/parallel | ||
doc | ||
include/opencv2 | ||
misc | ||
perf | ||
src | ||
test | ||
CMakeLists.txt |