opencv/modules/core/test
HAN Liutong 1d9ca7160b
Merge pull request #25796 from hanliutong:hfloat
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
2024-07-07 11:38:02 +03:00
..
ocl Merge pull request #25075 from mshabunin:cleanup-imgproc-1 2024-03-05 12:18:31 +03:00
ref_reduce_arg.impl.hpp Merge pull request #20733 from rogday:argmaxnd 2021-11-28 16:17:46 +00:00
test_arithm.cpp Added lut support for all new types in 5.x 2024-07-02 14:44:55 +03:00
test_async.cpp Merge pull request #23736 from seanm:c++11-simplifications 2024-01-19 16:53:08 +03:00
test_concatenation.cpp Added more strict checks for empty inputs to compare, meanStdDev and RNG::fill 2018-07-26 18:06:38 +03:00
test_conjugate_gradient.cpp ts: refactor OpenCV tests 2018-02-03 19:39:47 +00:00
test_countnonzero.cpp Add missing std namespace qualifiers 2023-09-06 13:46:39 +03:00
test_cuda.cpp add cuda::Stream constructor with cuda flags 2021-01-28 16:14:01 +01:00
test_downhill_simplex.cpp Misc. modules/ typos 2018-02-12 07:09:43 -05:00
test_ds.cpp Merge pull request #25075 from mshabunin:cleanup-imgproc-1 2024-03-05 12:18:31 +03:00
test_dxt.cpp Merge pull request #25075 from mshabunin:cleanup-imgproc-1 2024-03-05 12:18:31 +03:00
test_eigen.cpp Fix modules/ typos 2019-08-16 17:34:29 +03:00
test_hal_core.cpp Add Loongson Advanced SIMD Extension support: -DCPU_BASELINE=LASX 2022-09-10 09:39:43 +03:00
test_hasnonzero.cpp Extended several core functions to support new types (#24962) 2024-02-11 10:42:41 +03:00
test_intrin128.simd.hpp Merge pull request #22179 from hanliutong:new-rvv 2022-07-19 20:02:00 +03:00
test_intrin256.simd.hpp core(test): intrinsic tests for all dispatched CPU optimizations 2018-08-01 13:50:42 +03:00
test_intrin512.simd.hpp Merge pull request #14210 from terfendail:wui_512 2019-06-03 18:05:35 +03:00
test_intrin_emulator.cpp Merge pull request #16236 from alalek:fix_core_simd_emulator 2020-01-10 21:31:02 +03:00
test_intrin_utils.hpp Merge pull request #25796 from hanliutong:hfloat 2024-07-07 11:38:02 +03:00
test_intrin.cpp core: fix F16C compilation check 2020-11-17 12:22:49 +00:00
test_io.cpp Merge branch 4.x 2024-04-16 17:28:18 +03:00
test_logtagconfigparser.cpp Merge pull request #13909 from kinchungwong:logging_20190220 2019-04-22 00:01:10 +03:00
test_logtagmanager.cpp build: reduce usage of constexpr 2019-04-22 15:41:27 +03:00
test_lpsolver.cpp Merge remote-tracking branch 'origin/3.4' into merge-3.4 2023-06-20 09:56:57 +03:00
test_main.cpp Merge pull request #11897 from Jakub-Golinowski:hpx_backend 2018-08-31 16:23:26 +03:00
test_mat.cpp Merge branch 4.x 2024-07-01 15:59:43 +03:00
test_math.cpp Merge branch '4.x' into '5.x' 2024-06-26 19:01:34 +03:00
test_misc.cpp Merge branch 4.x 2024-01-23 17:06:52 +03:00
test_opencl.cpp UMat usageFlags fixes opencv/opencv#19807 2021-06-03 16:33:03 +02:00
test_operations.cpp Merge branch '4.x' into '5.x' 2024-06-26 19:01:34 +03:00
test_precomp.hpp Merge branch 4.x 2024-01-23 17:06:52 +03:00
test_ptr.cpp 3.4: backported changes from 'master' branch 2019-08-14 16:36:08 +03:00
test_quaternion.cpp Merge pull request #19026 from chargerKong:dualquat 2021-02-17 17:05:08 +00:00
test_rand.cpp Merge pull request #25075 from mshabunin:cleanup-imgproc-1 2024-03-05 12:18:31 +03:00
test_rotatedrect.cpp ts: refactor OpenCV tests 2018-02-03 19:39:47 +00:00
test_umat.cpp Merge pull request #25075 from mshabunin:cleanup-imgproc-1 2024-03-05 12:18:31 +03:00
test_utils_tls.impl.hpp Merge pull request #23736 from seanm:c++11-simplifications 2024-01-19 16:53:08 +03:00
test_utils.cpp Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2022-08-14 15:50:42 +00:00