Merge pull request #25443 from asmorkalov:as/kleidicv_hal

Integrate ARM KleidiCV as OpenCV HAL #25443

The library source code with license: https://gitlab.arm.com/kleidi/kleidicv/

### 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
pull/25598/head
Alexander Smorkalov 6 months ago committed by GitHub
parent 78ed6de518
commit d29ad2fb71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      3rdparty/kleidicv/CMakeLists.txt
  2. 14
      CMakeLists.txt
  3. 1
      doc/tutorials/introduction/config_reference/config_reference.markdown

@ -0,0 +1,23 @@
project(kleidicv_hal)
set(KLEIDICV_SOURCE_PATH "" CACHE PATH "Directory containing KleidiCV sources")
ocv_update(KLEIDICV_SRC_COMMIT "a9971ba8bf1d8b008a32c6ed8fea05cd8eb16748")
ocv_update(KLEIDICV_SRC_HASH "53d1d80620395a12c7fee91460499368")
if(KLEIDICV_SOURCE_PATH)
set(THE_ROOT "${KLEIDICV_SOURCE_PATH}")
else()
ocv_download(FILENAME "kleidicv-${KLEIDICV_SRC_COMMIT}.tar.gz"
HASH ${KLEIDICV_SRC_HASH}
URL
"${OPENCV_KLEIDICV_URL}"
"$ENV{OPENCV_KLEIDICV_URL}"
"https://gitlab.arm.com/kleidi/kleidicv/-/archive/${KLEIDICV_SRC_COMMIT}/"
DESTINATION_DIR "${OpenCV_BINARY_DIR}/3rdparty/kleidicv/"
ID KLEIDICV
STATUS res
UNPACK RELATIVE_URL)
set(THE_ROOT "${OpenCV_BINARY_DIR}/3rdparty/kleidicv/kleidicv-${KLEIDICV_SRC_COMMIT}")
endif()
include("${THE_ROOT}/adapters/opencv/CMakeLists.txt")

@ -13,7 +13,6 @@ FATAL: In-source builds are not allowed.
")
endif()
include(cmake/OpenCVMinDepVersions.cmake)
if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
@ -258,6 +257,8 @@ OCV_OPTION(WITH_CAP_IOS "Enable iOS video capture" ON
VERIFY HAVE_CAP_IOS)
OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" (NOT CV_DISABLE_OPTIMIZATION)
VISIBLE_IF (ARM OR AARCH64) AND NOT IOS AND NOT XROS)
OCV_OPTION(WITH_KLEIDICV "Use KleidiCV library for ARM platforms" OFF
VISIBLE_IF (AARCH64 AND (ANDROID OR UNIX AND NOT IOS AND NOT XROS)))
OCV_OPTION(WITH_CPUFEATURES "Use cpufeatures Android library" ON
VISIBLE_IF ANDROID
VERIFY HAVE_CPUFEATURES)
@ -966,6 +967,13 @@ if(HAVE_OPENVX)
endif()
endif()
if(WITH_KLEIDICV)
ocv_debug_message(STATUS "Enable KleidiCV acceleration")
if(NOT ";${OpenCV_HAL};" MATCHES ";kleidicv;")
set(OpenCV_HAL "kleidicv;${OpenCV_HAL}")
endif()
endif()
if(WITH_CAROTENE)
ocv_debug_message(STATUS "Enable carotene acceleration")
if(NOT ";${OpenCV_HAL};" MATCHES ";carotene;")
@ -990,6 +998,10 @@ foreach(hal ${OpenCV_HAL})
else()
message(STATUS "Carotene: NEON is not available, disabling carotene...")
endif()
elseif(hal STREQUAL "kleidicv")
add_subdirectory(3rdparty/kleidicv)
ocv_hal_register(KLEIDICV_HAL_LIBRARIES KLEIDICV_HAL_HEADERS KLEIDICV_HAL_INCLUDE_DIRS)
list(APPEND OpenCV_USED_HAL "KleidiCV (ver ${KLEIDICV_HAL_VERSION})")
elseif(hal STREQUAL "openvx")
add_subdirectory(3rdparty/openvx)
ocv_hal_register(OPENVX_HAL_LIBRARIES OPENVX_HAL_HEADERS OPENVX_HAL_INCLUDE_DIRS)

@ -623,6 +623,7 @@ Following build options are utilized in `opencv_contrib` modules, as stated [pre
`CMAKE_TOOLCHAIN_FILE`
`WITH_CAROTENE`
`WITH_KLEIDICV`
`WITH_CPUFEATURES`
`WITH_EIGEN`
`WITH_OPENVX`

Loading…
Cancel
Save