1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00
Files
Pratham Kumar eadaab5fbb Merge pull request #28664 from pratham-mcw:armpl_dft_opt
Add ARMPL support for DFT Function #28664

- This PR introduces hal/armpl/ with implementation of 1D, 2D DFT and DCT routines using ARM Performance Libraries as a custom HAL replacement for OpenCV's DFT & DCT Function.
- ArmPL MSI package is automatically downloaded and extracted via CMake when building on Windows ARM64, with a WITH_ARMPL option that defaults to ON for that platform.
- Forward and inverse real DFT calls in dxt.cpp are routed through ArmPL when available, with scaling applied only when needed.
- Test error thresholds in test_dxt.cpp are relaxed (from 1e-5 to 2e-4 for float ) to account for numerical differences between ArmPL and OpenCV's reference DFT results.

**Performance Benchmarks :**
<img width="993" height="835" alt="image" src="https://github.com/user-attachments/assets/76def647-6d20-4bce-8bc9-7363e723669f" />

- [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
2026-05-14 10:56:21 +03:00

29 lines
1.2 KiB
CMake

if(HAVE_ARMPL)
set(ARMPL_HAL_VERSION 0.0.1 CACHE INTERNAL "")
set(ARMPL_HAL_LIBRARIES "armpl_hal" CACHE INTERNAL "")
set(ARMPL_HAL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include" CACHE INTERNAL "")
set(ARMPL_HAL_HEADERS
"${CMAKE_CURRENT_SOURCE_DIR}/include/armpl_hal_core.hpp"
CACHE INTERNAL "")
file(GLOB ARMPL_HAL_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
add_library(armpl_hal STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${ARMPL_HAL_FILES})
target_include_directories(armpl_hal PRIVATE
${CMAKE_SOURCE_DIR}/modules/core/include
${CMAKE_BINARY_DIR}
${ARMPL_HAL_INCLUDE_DIRS}
${ARMPL_INCLUDE_PATH})
target_link_libraries(armpl_hal PUBLIC ${ARMPL_LIBRARY})
if(WITH_OPENMP AND OpenMP_CXX_FOUND)
target_link_libraries(armpl_hal PUBLIC OpenMP::OpenMP_CXX)
endif()
set_target_properties(armpl_hal PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH})
if(NOT BUILD_SHARED_LIBS)
ocv_install_target(armpl_hal EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
endif()
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(armpl_hal PROPERTIES FOLDER "3rdparty")
endif()
else()
message(STATUS "ArmPL is not available, disabling related HAL")
endif(HAVE_ARMPL)