Skip to content

Add RISC-V HAL implementation for cv::blur series#27097

Merged
asmorkalov merged 10 commits intoopencv:4.xfrom
amane-ame:blur_hal_rvv
Mar 20, 2025
Merged

Add RISC-V HAL implementation for cv::blur series#27097
asmorkalov merged 10 commits intoopencv:4.xfrom
amane-ame:blur_hal_rvv

Conversation

@amane-ame
Copy link
Copy Markdown
Contributor

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

This patch implements cv_hal_gaussianBlurBinomial, cv_hal_medianBlur, cv_hal_boxFilter and cv_hal_bilateralFilter using native intrinsics, optimizing the performance of cv::GaussianBlur/cv::medianBlur/cv::boxFilter/cv::bilateralFilter for 3x3/5x5 kernels.

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

$ ./opencv_test_imgproc --gtest_filter="*Filter*:*Blur*"
$ ./opencv_perf_imgproc --gtest_filter="*gauss*:*box*:*Bilateral*:*median*" --perf_min_samples=2000 --perf_force_samples=2000

View the full perf table here: hal_rvv_blur.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 8 commits March 15, 2025 14:59
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>
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>
@asmorkalov
Copy link
Copy Markdown
Contributor

My perf results for Muse Pi v 30 (gcc 14.2):
perf-blur.zip
Looks very fruitful!

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

amane-ame commented Mar 19, 2025

bilateralFilter got extra ~10% performance improvement on CV_8UC3 with exp32f.

@asmorkalov asmorkalov merged commit ec5f7bb into opencv:4.x Mar 20, 2025
16 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.

2 participants