From 276200850c54a438fce7e7ee19f699d3b5495716 Mon Sep 17 00:00:00 2001 From: Denes Tarjan Date: Wed, 25 Sep 2024 18:46:07 +0000 Subject: [PATCH] Disable sepFilter2D in OpenCV --- adapters/opencv/kleidicv_hal.cpp | 2 +- adapters/opencv/kleidicv_hal.h | 5 +++++ conformity/opencv/tests.cpp | 4 ++++ doc/opencv.md | 16 ---------------- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/adapters/opencv/kleidicv_hal.cpp b/adapters/opencv/kleidicv_hal.cpp index a4ec0112f..fafa50fc3 100644 --- a/adapters/opencv/kleidicv_hal.cpp +++ b/adapters/opencv/kleidicv_hal.cpp @@ -647,7 +647,7 @@ int morphology_init(cvhalFilter2D **cvcontext, int operation, int src_type, #if !KLEIDICV_ENABLE_ALL_OPENCV_HAL // KleidiCV is not that fast on smaller kernels - if (kernel_width_sz < 5 || kernel_height < 5) { + if (kernel_width_sz < 5 || kernel_height_sz < 5) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } #endif diff --git a/adapters/opencv/kleidicv_hal.h b/adapters/opencv/kleidicv_hal.h index ec8f232fa..ec420ebdc 100644 --- a/adapters/opencv/kleidicv_hal.h +++ b/adapters/opencv/kleidicv_hal.h @@ -236,6 +236,9 @@ static inline int kleidicv_threshold_with_fallback( #undef cv_hal_threshold #define cv_hal_threshold kleidicv_threshold_with_fallback +// TODO: implement 3x3 kernels and 8UC1 -> 16SC1 data type +#if KLEIDICV_ENABLE_ALL_OPENCV_HAL + // separable_filter_2d_init // no fallback, because it cannot be made sure that // separable_filter_2d_operation also uses the fallback @@ -254,6 +257,8 @@ static inline int kleidicv_threshold_with_fallback( #undef cv_hal_sepFilterFree #define cv_hal_sepFilterFree kleidicv::hal::separable_filter_2d_free +#endif // KLEIDICV_ENABLE_ALL_OPENCV_HAL + // gaussian_blur_binomial static inline int kleidicv_gaussian_blur_binomial_with_fallback( const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, diff --git a/conformity/opencv/tests.cpp b/conformity/opencv/tests.cpp index 926de6874..bce00a813 100644 --- a/conformity/opencv/tests.cpp +++ b/conformity/opencv/tests.cpp @@ -23,9 +23,12 @@ static std::vector merge_tests( } std::vector all_tests = merge_tests({ + // clang-format off binary_op_tests_get, cvtcolor_tests_get, +#if KLEIDICV_ENABLE_ALL_OPENCV_HAL separable_filter_2d_tests_get, +#endif gaussian_blur_tests_get, rgb2yuv_tests_get, yuv2rgb_tests_get, @@ -36,6 +39,7 @@ std::vector all_tests = merge_tests({ scale_tests_get, min_max_tests_get, in_range_tests_get, + // clang-format on }); #if MANAGER diff --git a/doc/opencv.md b/doc/opencv.md index cd3c5c37c..ec4befa0c 100644 --- a/doc/opencv.md +++ b/doc/opencv.md @@ -97,22 +97,6 @@ Notes on parameters: * `src.depth()` - only supports `CV_8U` depth. * `type` - currently only binary threshold operation is supported ([`cv::THRESH_BINARY`](https://docs.opencv.org/4.10.0/d7/d1b/group__imgproc__misc.html#ggaa9e58d2860d4afa658ef70a9b1115576a147222a96556ebc1d948b372bcd7ac59)). -### [`cv::sepFilter2D()`](https://docs.opencv.org/4.10.0/d4/d86/group__imgproc__filter.html#ga910e29ff7d7b105057d1625a4bf6318d) -Applies a separable linear filter to an image.\ -Currently only the 5x5 kernel size is supported with `CV_8U`, `CV_16U` or `CV_16S` depths for the source, destination and kernels.\ -In-place filtering is not supported. - -Notes on parameters: -* `src`, `dst`, `kernelX`, `kernelY` - the number of channels must match between source and destination. The types must match between source, destination and kernels. However, the kernels must have 1 channel. -* `anchor` - values other than `(-1, -1)` or the midpoints of the X and Y kernels respectively are not supported. -* `delta` - values other than `0.0` are not supported. -* `borderType` - pixel extrapolation method. -Supported [OpenCV border types](https://docs.opencv.org/4.10.0/d2/de8/group__core__array.html#ga209f2f4869e304c82d07739337eae7c5) are: - + `cv::BORDER_REPLICATE` - + `cv::BORDER_REFLECT` - + `cv::BORDER_WRAP` - + `cv::BORDER_REFLECT_101` - ### [`cv::GaussianBlur()`](https://docs.opencv.org/4.10.0/d4/d86/group__imgproc__filter.html#gaabe8c836e97159a9193fb0b11ac52cf1) Blurs an image using a Gaussian filter.\ The filter's standard deviation must be the same in horizontal and vertical directions (`sigmaX == sigmaY`).\ -- GitLab