From c535c30bfa912f36a0d13e9c65595f516c024f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Podgain=C3=B5i?= Date: Wed, 28 Aug 2024 08:59:14 +0200 Subject: [PATCH] Improve Separable Filter 2D anchor check in the HAL --- adapters/opencv/kleidicv_hal.cpp | 6 +++++- doc/opencv.md | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/adapters/opencv/kleidicv_hal.cpp b/adapters/opencv/kleidicv_hal.cpp index 4a6f0c68b..14afc0e3b 100644 --- a/adapters/opencv/kleidicv_hal.cpp +++ b/adapters/opencv/kleidicv_hal.cpp @@ -347,7 +347,11 @@ int separable_filter_2d_init(cvhalFilter2D **context, int src_type, return CV_HAL_ERROR_NOT_IMPLEMENTED; } - if (anchor_x != -1 || anchor_y != -1) { + if (anchor_x > -1 && anchor_x != (kernelx_length >> 1)) { + return CV_HAL_ERROR_NOT_IMPLEMENTED; + } + + if (anchor_y > -1 && anchor_y != (kernely_length >> 1)) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } diff --git a/doc/opencv.md b/doc/opencv.md index 57a7a5ef2..431a8e21a 100644 --- a/doc/opencv.md +++ b/doc/opencv.md @@ -104,7 +104,7 @@ In-place filtering 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)` are not supported. +* `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: -- GitLab