1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge pull request #25553 from asmorkalov:as/HAL_min_max_idx

Fix HAL interface for hal_ni_minMaxIdx #25553

Fixes https://github.com/opencv/opencv/issues/25540

The original implementation call HAL with the same parameters independently from amount of channels. The patch uses HAL correctly for the case cn > 1.

### 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
- [ ] 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:
Alexander Smorkalov
2024-05-07 20:46:17 +03:00
committed by GitHub
parent a9e489f149
commit faa259ab34
2 changed files with 14 additions and 7 deletions
+12 -2
View File
@@ -1510,9 +1510,19 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
Mat src = _src.getMat(), mask = _mask.getMat();
int _minIdx, _maxIdx;
int* min_offset = (cn == 1) ? minIdx : &_minIdx;
int* max_offset = (cn == 1) ? maxIdx : &_maxIdx;
if (src.dims <= 2)
CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols, src.rows, src.depth(), minVal, maxVal,
minIdx, maxIdx, mask.data);
{
CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols*cn, src.rows, src.depth(),
minVal, maxVal, min_offset, max_offset, mask.data);
}
else if (src.isContinuous())
{
CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, 0, (int)src.total()*cn, 1, src.depth(),
minVal, maxVal, min_offset, max_offset, mask.data);
}
CV_OVX_RUN(!ovx::skipSmallImages<VX_KERNEL_MINMAXLOC>(src.cols, src.rows),
openvx_minMaxIdx(src, minVal, maxVal, minIdx, maxIdx, mask))