Skip to content

Add RISC-V HAL implementation for cv::warp series#27119

Merged
asmorkalov merged 8 commits intoopencv:4.xfrom
amane-ame:warp_hal_rvv
Mar 25, 2025
Merged

Add RISC-V HAL implementation for cv::warp series#27119
asmorkalov merged 8 commits intoopencv:4.xfrom
amane-ame:warp_hal_rvv

Conversation

@amane-ame
Copy link
Copy Markdown
Contributor

@amane-ame amane-ame commented Mar 21, 2025

This patch implements cv_hal_remap, cv_hal_warpAffine and cv_hal_warpPerspective using native intrinsics, optimizing the performance of cv::remap/cv::warpAffine/cv::warpPerspective for CV_HAL_INTER_NEAREST/CV_HAL_INTER_LINEAR/CV_HAL_INTER_CUBIC/CV_HAL_INTER_LANCZOS4 modes.

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

$ ./opencv_test_imgproc --gtest_filter="*Remap*:*Warp*"
$ ./opencv_perf_imgproc --gtest_filter="*Remap*:*remap*:*Warp*" --perf_min_samples=200 --perf_force_samples=200

View the full perf table here: hal_rvv_warp.pdf

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

amane-ame and others added 4 commits March 21, 2025 22:28
Co-authored-by: Liutong HAN <liutong2020@iscas.ac.cn>
Co-authored-by: Liutong HAN <liutong2020@iscas.ac.cn>
Co-authored-by: Liutong HAN <liutong2020@iscas.ac.cn>
Co-authored-by: Liutong HAN <liutong2020@iscas.ac.cn>
amane-ame and others added 2 commits March 22, 2025 15:48
Co-authored-by: Liutong HAN <liutong2020@iscas.ac.cn>
Co-authored-by: Liutong HAN <liutong2020@iscas.ac.cn>
@asmorkalov
Copy link
Copy Markdown
Contributor

Performance for Muse Pi v 30 (gcc 14.2):
perf-warp.zip

@asmorkalov
Copy link
Copy Markdown
Contributor

Updated results with the last commit:
perf-warp.zip

Co-authored-by: Liutong HAN <liutong2020@iscas.ac.cn>
@asmorkalov asmorkalov self-assigned this Mar 24, 2025
@asmorkalov
Copy link
Copy Markdown
Contributor

@fengyuentau @vpisarev Do you have any notes about the patch?

@amane-ame
Copy link
Copy Markdown
Contributor Author

Discovered maybe I can accelerate it further. I will come back later.

Co-authored-by: Liutong HAN <liutong2020@iscas.ac.cn>
@amane-ame
Copy link
Copy Markdown
Contributor Author

Done, got extra ~10% improvement on remap16s(LANCZOS4). Also reverted the error change on SANITY_CHECK.

@asmorkalov
Copy link
Copy Markdown
Contributor

My perf results for Muse Pi v 30 (gcc 14.2):
perf-warp.zip

@asmorkalov asmorkalov added this to the 4.12.0 milestone Mar 25, 2025
@asmorkalov asmorkalov merged commit fa58c12 into opencv:4.x Mar 25, 2025
25 of 28 checks passed
@asmorkalov asmorkalov mentioned this pull request Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants