opencv/modules
天音あめ bb525fe91d
Merge pull request #26865 from amane-ame:dxt_hal_rvv
Add RISC-V HAL implementation for cv::dft and cv::dct #26865

This patch implements `static cv::DFT` function in RVV_HAL using native intrinsic, optimizing the performance for `cv::dft` and `cv::dct` with data types `32FC1/64FC1/32FC2/64FC2`.

The reason I chose to create a new `cv_hal_dftOcv` interface is that if I were to use the existing interfaces (`cv_hal_dftInit1D` and `cv_hal_dft1D`), it would require handling and parsing the dft flags within HAL, as well as performing preprocessing operations such as handling unit roots. Since these operations are not performance hotspots and do not require optimization, reusing the existing interfaces would result in copying approximately 300 lines of code from `core/src/dxt.cpp` into HAL, which I believe is unnecessary.

Moreover, if I insert the new interface into `static cv::DFT`, both `static cv::RealDFT` and `static cv::DCT` can be optimized as well. The processing performed before and after calling `static cv::DFT` in these functions is also not a performance hotspot.

Tested on MUSE-PI (Spacemit X60) for both gcc 14.2 and clang 20.0.

```
$ opencv_test_core --gtest_filter="*DFT*"
$ opencv_perf_core --gtest_filter="*dft*:*dct*" --perf_min_samples=30 --perf_force_samples=30
```

The head of the perf table is shown below since the table is too long.

View the full perf table here: [hal_rvv_dxt.pdf](https://github.com/user-attachments/files/18622645/hal_rvv_dxt.pdf)

<img width="1017" alt="Untitled" src="https://github.com/user-attachments/assets/609856e7-9c7d-4a95-9923-45c1b77eb3a2" />

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] 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
2025-03-07 11:08:41 +03:00
..
calib3d Merge pull request #26988 from DanBmh:opt_undistort 2025-03-03 17:16:09 +03:00
core Merge pull request #26865 from amane-ame:dxt_hal_rvv 2025-03-07 11:08:41 +03:00
dnn Fixed Android build with Vulkan support. 2025-01-13 21:13:22 +03:00
features2d Move OpenVX implementation for FAST to HAL. 2025-02-14 17:47:48 +03:00
flann flann: remove unused hdf5 header 2024-11-14 19:44:10 +03:00
gapi Workaround for successfull append of OpenVINO Execution Provider: Moved creation of 'Ort::Env' before it 2025-02-26 16:55:48 +00:00
highgui Backported some C API cleanup from 5.x to 4.x to reduce conflicts in 4.x->5.x merge. 2025-02-26 17:11:31 +03:00
imgcodecs Merge pull request #26849 from sturkmen72:apng-writeanimation 2025-03-05 10:42:43 +03:00
imgproc Merge pull request #26958 from amane-ame:pyramids_hal_rvv 2025-03-04 15:41:15 +03:00
java Merge pull request #26875 from asmorkalov:as/in_memory_models 2025-02-14 15:35:38 +03:00
js Merge pull request #26147 from vrabaud:opencv_js 2024-12-19 17:35:16 +03:00
ml replace tostring() with tobytes 2025-02-18 12:25:01 +05:30
objc Merge pull request #26713 from homuler:fix/build-ios-framework 2025-01-10 14:48:56 +03:00
objdetect Merge pull request #26753 from shyama7004:RotatedMarkers 2025-01-13 10:51:03 +03:00
photo Merge pull request #26831 from shyama7004:fix-denoising.cpp 2025-01-29 15:45:40 +03:00
python replace deprecated np.fromstring() by np.frombuffer() 2025-02-21 10:37:11 +05:30
stitching Merge pull request #26754 from s-trinh:add_bibtex_direct_pdf_links 2025-01-27 10:28:38 +03:00
ts fix: qnx7.0 build 2025-02-27 14:24:18 +08:00
video Merge pull request #26875 from asmorkalov:as/in_memory_models 2025-02-14 15:35:38 +03:00
videoio Merge pull request #26992 from Anshuprem:4.x 2025-03-01 14:54:26 +03:00
world cmake: use /INCREMENTAL:NO with MSVS 2015 2023-12-07 19:46:27 +00:00