Skip to content

Commit

Permalink
Integrate ARM KleidiCV as OpenCV HAL.
Browse files Browse the repository at this point in the history
  • Loading branch information
asmorkalov committed Apr 18, 2024
1 parent a1e4444 commit a98fb17
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ FATAL: In-source builds are not allowed.
")
endif()

# Useful for HALs if built as a CMake submodule
set(OPENCV_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})

include(cmake/OpenCVMinDepVersions.cmake)

Expand Down Expand Up @@ -258,6 +260,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))
OCV_OPTION(WITH_CPUFEATURES "Use cpufeatures Android library" ON
VISIBLE_IF ANDROID
VERIFY HAVE_CPUFEATURES)
Expand Down Expand Up @@ -963,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;")
Expand All @@ -987,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit a98fb17

Please sign in to comment.