1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

hal/imgproc: add hal for calcHist and implement in hal:riscv-rvv (#27332)

hal/imgproc: add hal for calcHist and implement in hal/riscv-rvv #27332

### 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
- [ ] 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
This commit is contained in:
Yuantao Feng
2025-05-21 12:07:22 +08:00
committed by GitHub
parent 23f8e523a0
commit 9b08167769
4 changed files with 206 additions and 0 deletions
+20
View File
@@ -1395,6 +1395,26 @@ inline int hal_ni_polygonMoments(const uchar* src_data, size_t src_size, int src
#define cv_hal_polygonMoments hal_ni_polygonMoments
//! @endcond
/**
@brief Calculates a histogram of a set of arrays
@param src_data Source imgage data
@param src_step Source image step
@param src_type Source image type
@param src_width Source image width
@param src_height Source image height
@param hist_data Histogram data
@param hist_size Histogram size
@param ranges Array of dims arrays of the histogram bin boundaries
@param uniform Flag indicating whether the histogram is uniform or not
@param accumulate Accumulation flag
*/
inline int hal_ni_calcHist(const uchar* src_data, size_t src_step, int src_type, int src_width, int src_height, float* hist_data, int hist_size, const float** ranges, bool uniform, bool accumulate)
{ return CV_HAL_ERROR_NOT_IMPLEMENTED; }
//! @cond IGNORED
#define cv_hal_calcHist hal_ni_calcHist
//! @endcond
//! @}
#if defined(__clang__)
+5
View File
@@ -978,6 +978,11 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels,
&& _mask.empty() && images[0].dims <= 2 && ranges && ranges[0],
ipp_calchist(images[0], hist, histSize[0], ranges, uniform, accumulate));
if (nimages == 1 && dims == 1 && channels && channels[0] == 0 && _mask.empty() && images[0].dims <= 2 && ranges && ranges[0]) {
CALL_HAL(calcHist, cv_hal_calcHist, images[0].data, images[0].step, images[0].type(), images[0].cols, images[0].rows,
hist.ptr<float>(), histSize[0], ranges, uniform, accumulate);
}
Mat ihist = hist;
ihist.flags = (ihist.flags & ~CV_MAT_TYPE_MASK)|CV_32S;