From 1d9a4120fa7dbeab6316c255d283c16cd006a35e Mon Sep 17 00:00:00 2001 From: Rostislav Vasilikhin Date: Thu, 9 May 2024 07:37:55 +0200 Subject: [PATCH] Merge pull request #25565 from savuor:rv/hal_eq_hist Merge pull request #25565 from savuor/rv/hal_eq_hist HAL for equalizeHist() added #25565 fixes #25530 ### 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 - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake --- modules/imgproc/src/hal_replacement.hpp | 15 +++++++++++++++ modules/imgproc/src/histogram.cpp | 2 ++ 2 files changed, 17 insertions(+) diff --git a/modules/imgproc/src/hal_replacement.hpp b/modules/imgproc/src/hal_replacement.hpp index 28bfd31090..304877cb8b 100644 --- a/modules/imgproc/src/hal_replacement.hpp +++ b/modules/imgproc/src/hal_replacement.hpp @@ -903,6 +903,21 @@ inline int hal_ni_boxFilter(const uchar* src_data, size_t src_step, uchar* dst_d #define cv_hal_boxFilter hal_ni_boxFilter //! @endcond +/** + @brief Equalizes the histogram of a grayscale image + @param src_data Source image data + @param src_step Source image step + @param dst_data Destination image data + @param dst_step Destination image step + @param width Source image width + @param height Source image height +*/ +inline int hal_ni_equalize_hist(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } + +//! @cond IGNORED +#define cv_hal_equalize_hist hal_ni_equalize_hist +//! @endcond + /** @brief Blurs an image using a generic Gaussian filter. @param src_data Source image data diff --git a/modules/imgproc/src/histogram.cpp b/modules/imgproc/src/histogram.cpp index 99d5e7b1d8..02e97ba129 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -3452,6 +3452,8 @@ void cv::equalizeHist( InputArray _src, OutputArray _dst ) CV_OVX_RUN(!ovx::skipSmallImages(src.cols, src.rows), openvx_equalize_hist(src, dst)) + CALL_HAL(equalizeHist, cv_hal_equalize_hist, src.data, src.step, dst.data, dst.step, src.cols, src.rows); + Mutex histogramLockInstance; const int hist_sz = EqualizeHistCalcHist_Invoker::HIST_SZ;