1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00

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
This commit is contained in:
Pratham Kumar
2026-05-14 13:26:21 +05:30
committed by GitHub
parent 357ad24262
commit eadaab5fbb
9 changed files with 3176 additions and 1 deletions
+27
View File
@@ -284,6 +284,9 @@ OCV_OPTION(WITH_WAYLAND "Include Wayland support" OFF
OCV_OPTION(WITH_IPP "Include Intel IPP support" (NOT MINGW AND NOT CV_DISABLE_OPTIMIZATION) OCV_OPTION(WITH_IPP "Include Intel IPP support" (NOT MINGW AND NOT CV_DISABLE_OPTIMIZATION)
VISIBLE_IF (X86_64 OR X86) AND NOT WINRT AND NOT IOS AND NOT XROS VISIBLE_IF (X86_64 OR X86) AND NOT WINRT AND NOT IOS AND NOT XROS
VERIFY HAVE_IPP) VERIFY HAVE_IPP)
OCV_OPTION(WITH_ARMPL "Include ARM Performance Libraries support (auto-download)" OFF
VISIBLE_IF (AARCH64 OR ARM64) AND NOT WINRT AND NOT IOS AND NOT XROS
VERIFY HAVE_ARMPL)
OCV_OPTION(WITH_HALIDE "Include Halide support" OFF OCV_OPTION(WITH_HALIDE "Include Halide support" OFF
VISIBLE_IF TRUE VISIBLE_IF TRUE
VERIFY HAVE_HALIDE) VERIFY HAVE_HALIDE)
@@ -975,6 +978,13 @@ if(HAVE_FASTCV)
endif() endif()
endif() endif()
if(HAVE_ARMPL)
ocv_debug_message(STATUS "Enable ARMPL acceleration")
if(NOT ";${OpenCV_HAL};" MATCHES ";armpl;")
set(OpenCV_HAL "armpl_hal;${OpenCV_HAL}")
endif()
endif()
if(HAVE_KLEIDICV) if(HAVE_KLEIDICV)
ocv_debug_message(STATUS "Enable KleidiCV acceleration") ocv_debug_message(STATUS "Enable KleidiCV acceleration")
if(NOT ";${OpenCV_HAL};" MATCHES ";kleidicv;") if(NOT ";${OpenCV_HAL};" MATCHES ";kleidicv;")
@@ -1020,6 +1030,14 @@ foreach(hal ${OpenCV_HAL})
else() else()
message(STATUS "FastCV: fastcv is not available, disabling fastcv...") message(STATUS "FastCV: fastcv is not available, disabling fastcv...")
endif() endif()
elseif(hal STREQUAL "armpl_hal")
if((ARM OR AARCH64 OR ARM64) AND NOT WINRT AND NOT IOS AND NOT XROS)
add_subdirectory(hal/armpl)
ocv_hal_register(ARMPL_HAL_LIBRARIES ARMPL_HAL_HEADERS ARMPL_HAL_INCLUDE_DIRS)
list(APPEND OpenCV_USED_HAL "ARMPL (ver ${ARMPL_HAL_VERSION})")
else()
message(STATUS "ARMPL: ARM Performance Libraries not available on this platform, disabling armpl...")
endif()
elseif(hal STREQUAL "kleidicv") elseif(hal STREQUAL "kleidicv")
add_subdirectory(hal/kleidicv) add_subdirectory(hal/kleidicv)
ocv_hal_register(KLEIDICV_HAL_LIBRARIES KLEIDICV_HAL_HEADERS KLEIDICV_HAL_INCLUDE_DIRS) ocv_hal_register(KLEIDICV_HAL_LIBRARIES KLEIDICV_HAL_HEADERS KLEIDICV_HAL_INCLUDE_DIRS)
@@ -1797,6 +1815,12 @@ if(WITH_IPP AND HAVE_IPP)
endif() endif()
endif() endif()
if(WITH_ARMPL AND HAVE_ARMPL)
status(" ARM Perf Lib:" "${ARMPL_VERSION_STR}")
status(" at:" "${ARMPL_ROOT_DIR}")
status(" variant:" "${ARMPL_LIB_NAME}")
endif()
if(WITH_VA OR HAVE_VA) if(WITH_VA OR HAVE_VA)
status(" VA:" HAVE_VA THEN "YES" ELSE NO) status(" VA:" HAVE_VA THEN "YES" ELSE NO)
endif() endif()
@@ -1885,6 +1909,9 @@ endif()
if(WITH_FASTCV OR HAVE_FASTCV) if(WITH_FASTCV OR HAVE_FASTCV)
status(" FastCV:" HAVE_FASTCV THEN "YES (${FASTCV_LIBRARY})" ELSE "NO") status(" FastCV:" HAVE_FASTCV THEN "YES (${FASTCV_LIBRARY})" ELSE "NO")
endif() endif()
if(WITH_ARMPL OR HAVE_ARMPL)
status(" ARM Perf Lib:" HAVE_ARMPL THEN "YES (${ARMPL_LIBRARY})" ELSE "NO")
endif()
status(" Custom HAL:" OpenCV_USED_HAL THEN "YES (${OpenCV_USED_HAL})" ELSE "NO") status(" Custom HAL:" OpenCV_USED_HAL THEN "YES (${OpenCV_USED_HAL})" ELSE "NO")
+172
View File
@@ -0,0 +1,172 @@
if(NOT AARCH64 AND NOT ARM64 AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64|ARM64")
return()
endif()
if(NOT WITH_ARMPL)
return()
endif()
set(ARMPL_ROOT_DIR "" CACHE PATH "Path to ARM Performance Libraries root directory")
if(NOT ARMPL_ROOT_DIR)
if(DEFINED ENV{ARMPL_DIR})
set(ARMPL_ROOT_DIR "$ENV{ARMPL_DIR}")
endif()
endif()
find_path(ARMPL_INCLUDE_DIR
NAMES armpl.h
HINTS
"${ARMPL_ROOT_DIR}/include"
"${ARMPL_ROOT_DIR}/include_lp64"
PATHS
/opt/arm/armpl/include
/usr/include/armpl
ENV ARMPL_DIR
PATH_SUFFIXES include
NO_DEFAULT_PATH
)
if(WITH_OPENMP AND OpenMP_CXX_FOUND)
set(ARMPL_USE_OPENMP TRUE)
set(ARMPL_LIB_CANDIDATES
armpl_lp64_mp
armpl_ilp64_mp
)
else()
set(ARMPL_USE_OPENMP FALSE)
set(ARMPL_LIB_CANDIDATES
armpl_lp64
armpl_ilp64
)
endif()
set(ARMPL_LIB_FOUND FALSE)
set(ARMPL_LIB_NAME "")
set(ARMPL_LIB_FILE "")
foreach(lib_candidate ${ARMPL_LIB_CANDIDATES})
if(WIN32)
set(ARMPL_LIB_FILE_DLL "${ARMPL_ROOT_DIR}/lib/${lib_candidate}.dll.lib")
set(ARMPL_LIB_FILE_LIB "${ARMPL_ROOT_DIR}/lib/${lib_candidate}.lib")
if(EXISTS "${ARMPL_LIB_FILE_DLL}")
set(ARMPL_LIB_FILE "${ARMPL_LIB_FILE_DLL}")
set(ARMPL_LIB_NAME "${lib_candidate}")
set(ARMPL_LIB_FOUND TRUE)
break()
elseif(EXISTS "${ARMPL_LIB_FILE_LIB}")
set(ARMPL_LIB_FILE "${ARMPL_LIB_FILE_LIB}")
set(ARMPL_LIB_NAME "${lib_candidate}")
set(ARMPL_LIB_FOUND TRUE)
break()
endif()
else()
set(ARMPL_LIB_FILE "${ARMPL_ROOT_DIR}/lib/lib${lib_candidate}.a")
if(EXISTS "${ARMPL_LIB_FILE}")
set(ARMPL_LIB_NAME "${lib_candidate}")
set(ARMPL_LIB_FOUND TRUE)
break()
endif()
endif()
endforeach()
if(NOT ARMPL_LIB_FOUND)
find_library(ARMPL_LIBRARY_FALLBACK
NAMES ${ARMPL_LIB_CANDIDATES}
HINTS "${ARMPL_ROOT_DIR}/lib"
PATHS
/opt/arm/armpl/lib
/usr/lib/armpl
ENV ARMPL_DIR
PATH_SUFFIXES lib
NO_DEFAULT_PATH
)
if(ARMPL_LIBRARY_FALLBACK)
set(ARMPL_LIB_FILE "${ARMPL_LIBRARY_FALLBACK}")
get_filename_component(ARMPL_LIB_NAME "${ARMPL_LIBRARY_FALLBACK}" NAME_WE)
string(REGEX REPLACE "^lib" "" ARMPL_LIB_NAME "${ARMPL_LIB_NAME}")
set(ARMPL_LIB_FOUND TRUE)
endif()
endif()
if(NOT ARMPL_INCLUDE_DIR OR NOT ARMPL_LIB_FOUND)
message(WARNING
"ARM Performance Libraries: NOT FOUND. "
"Please install ArmPL manually and set -DARMPL_ROOT_DIR=<path>. "
"Download from: https://developer.arm.com/Tools%20and%20Software/Arm%20Performance%20Libraries"
)
return()
endif()
set(ARMPL_VERSION_STR "unknown")
if(EXISTS "${ARMPL_INCLUDE_DIR}/armpl.h")
file(STRINGS "${ARMPL_INCLUDE_DIR}/armpl.h" ARMPL_VERSION_MAJOR_LINE
REGEX "#define ARMPL_VERSION_MAJOR")
file(STRINGS "${ARMPL_INCLUDE_DIR}/armpl.h" ARMPL_VERSION_MINOR_LINE
REGEX "#define ARMPL_VERSION_MINOR")
if(ARMPL_VERSION_MAJOR_LINE AND ARMPL_VERSION_MINOR_LINE)
string(REGEX REPLACE ".*ARMPL_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1"
ARMPL_VERSION_MAJOR "${ARMPL_VERSION_MAJOR_LINE}")
string(REGEX REPLACE ".*ARMPL_VERSION_MINOR[ \t]+([0-9]+).*" "\\1"
ARMPL_VERSION_MINOR "${ARMPL_VERSION_MINOR_LINE}")
set(ARMPL_VERSION_STR "${ARMPL_VERSION_MAJOR}.${ARMPL_VERSION_MINOR}")
else()
file(STRINGS "${ARMPL_INCLUDE_DIR}/armpl.h" ARMPL_BUILD_LINE
REGEX "#define ARMPL_BUILD")
if(ARMPL_BUILD_LINE)
string(REGEX REPLACE ".*ARMPL_BUILD[ \t]+([0-9]+).*" "\\1"
ARMPL_VERSION_STR "${ARMPL_BUILD_LINE}")
else()
string(REGEX MATCH "armpl_([0-9]+\\.[0-9]+)" ARMPL_VERSION_MATCH "${ARMPL_ROOT_DIR}")
if(CMAKE_MATCH_1)
set(ARMPL_VERSION_STR "${CMAKE_MATCH_1}")
endif()
endif()
endif()
endif()
if(ARMPL_USE_OPENMP)
message(STATUS "ArmPL: OpenMP enabled, using parallel version (${ARMPL_LIB_NAME})")
else()
message(WARNING
"ArmPL: OpenMP is not enabled. "
"Using serial version of ArmPL (${ARMPL_LIB_NAME}). "
"For better performance enable OpenMP with -DWITH_OPENMP=ON"
)
endif()
if(NOT TARGET armpl)
if(WIN32)
add_library(armpl SHARED IMPORTED)
find_file(ARMPL_DLL
NAMES "${ARMPL_LIB_NAME}.dll"
HINTS "${ARMPL_ROOT_DIR}/bin"
NO_DEFAULT_PATH
)
set_target_properties(armpl PROPERTIES
IMPORTED_IMPLIB "${ARMPL_LIB_FILE}"
IMPORTED_LOCATION "${ARMPL_DLL}"
INTERFACE_INCLUDE_DIRECTORIES "${ARMPL_INCLUDE_DIR}"
)
else()
add_library(armpl UNKNOWN IMPORTED)
set_target_properties(armpl PROPERTIES
IMPORTED_LOCATION "${ARMPL_LIB_FILE}"
INTERFACE_INCLUDE_DIRECTORIES "${ARMPL_INCLUDE_DIR}"
)
endif()
if(ARMPL_USE_OPENMP)
set_target_properties(armpl PROPERTIES
INTERFACE_LINK_LIBRARIES OpenMP::OpenMP_CXX
)
endif()
endif()
set(ARMPL_LIBRARIES armpl CACHE INTERNAL "ArmPL libraries")
set(ARMPL_INCLUDE_DIRS "${ARMPL_INCLUDE_DIR}" CACHE INTERNAL "ArmPL include dirs")
set(ARMPL_INCLUDE_PATH "${ARMPL_INCLUDE_DIR}" CACHE INTERNAL "ArmPL include path")
set(ARMPL_LIBRARY "${ARMPL_LIB_FILE}" CACHE INTERNAL "ArmPL library path")
set(ARMPL_LIB_NAME "${ARMPL_LIB_NAME}" CACHE INTERNAL "ArmPL library variant")
set(ARMPL_VERSION_STR "${ARMPL_VERSION_STR}" CACHE INTERNAL "ArmPL version")
set(ARMPL_ROOT_DIR "${ARMPL_ROOT_DIR}" CACHE PATH "ArmPL root directory")
set(HAVE_ARMPL TRUE CACHE BOOL "ArmPL found and enabled" FORCE)
+15
View File
@@ -38,6 +38,21 @@ if(WITH_IPP)
endif() endif()
endif() endif()
if(WITH_ARMPL)
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindARMPL.cmake")
if(HAVE_ARMPL)
message(STATUS "Using ARM Performance Libraries")
ocv_include_directories(${ARMPL_INCLUDE_DIRS})
list(APPEND OPENCV_LINKER_LIBS ${ARMPL_LIBRARIES})
add_compile_definitions(HAVE_ARMPL)
if(WITH_OPENMP AND OpenMP_CXX_FOUND)
list(APPEND OPENCV_LINKER_LIBS OpenMP::OpenMP_CXX)
endif()
else()
message(STATUS "ARM Performance Libraries: Not found or not available")
endif()
endif()
# --- CUDA --- # --- CUDA ---
if(WITH_CUDA) if(WITH_CUDA)
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE) if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
@@ -19,6 +19,7 @@ Introduction to OpenCV {#tutorial_table_of_content_introduction}
- @subpage tutorial_windows_visual_studio_opencv - @subpage tutorial_windows_visual_studio_opencv
- @subpage tutorial_windows_visual_studio_image_watch - @subpage tutorial_windows_visual_studio_image_watch
- @subpage tutorial_windows_msys2_vscode - @subpage tutorial_windows_msys2_vscode
- @subpage tutorial_windows_armpl
##### Java & Android ##### Java & Android
- @subpage tutorial_java_dev_intro - @subpage tutorial_java_dev_intro
@@ -0,0 +1,169 @@
Building OpenCV with ARM Performance Libraries (ARMPL) on Windows {#tutorial_windows_armpl}
==================================================================
@prev_tutorial{tutorial_windows_install}
@next_tutorial{tutorial_linux_install}
| | |
| -: | :- |
@tableofcontents
Introduction {#tutorial_windows_armpl_intro}
============
This tutorial explains how to build OpenCV on Windows (AArch64) with
[ARM Performance Libraries (ARMPL)](https://developer.arm.com/Tools%20and%20Software/Arm%20Performance%20Libraries)
as a math backend. ARMPL provides optimized BLAS and LAPACK routines for Arm-based hardware
and can significantly accelerate OpenCV operations such as DFT and DCT.
Step 1: Download and Install ARM Performance Libraries {#tutorial_windows_armpl_download}
=====================================================
1. Open a browser and go to the
[ARM Performance Libraries Downloads page](https://developer.arm.com/Tools%20and%20Software/Arm%20Performance%20Libraries#Downloads).
2. Under **Windows / AArch64**, download the installer for your preferred toolchain:
| File | Architecture | Size |
|------|--------------|------|
| `arm-performance-libraries_26.01_Windows.msi` | AArch64 | ~240 MiB |
3. Run the downloaded `.msi` installer and follow the on-screen instructions.
The default installation directory is:
```
C:\Program Files\Arm Performance Libraries\armpl_26.01
```
Step 2: Configure System Environment Variables {#tutorial_windows_armpl_env}
=============================================
OpenCV's CMake scripts (and the ARMPL runtime itself) need to find the library files at both
build time and run time. Add the following entries to the **System** `PATH` variable:
1. Open **System Properties**, click **Advanced**, then **Environment Variables**.
2. Under **System variables**, select `Path` and click **Edit**.
3. Add the two paths below (adjust the version number if yours differs):
```
C:\Program Files\Arm Performance Libraries\armpl_26.01\lib
C:\Program Files\Arm Performance Libraries\armpl_26.01\bin
```
4. Click **OK** on every dialog to save.
Step 3: Clone OpenCV {#tutorial_windows_armpl_clone}
====================
```bat
git clone https://github.com/opencv/opencv.git
cd opencv
```
If you also need the extra modules:
```bat
git clone https://github.com/opencv/opencv_contrib.git
```
Step 4: Configure with CMake {#tutorial_windows_armpl_cmake}
============================
Create a build directory and run CMake with ARMPL support enabled.
**Without OpenMP (single-threaded ARMPL):**
```bat
mkdir build && cd build
cmake -G "Visual Studio 17 2022" -A ARM64 ^
-DWITH_ARMPL=ON ^
-DARMPL_ROOT_DIR="C:\Program Files\Arm Performance Libraries\armpl_26.01" ^
-DWITH_OPENMP=OFF ^
..
```
**With OpenMP (multi-threaded ARMPL):**
ARMPL ships both serial and OpenMP-enabled library variants. To use the multi-threaded variant,
enable OpenMP in CMake:
```bat
mkdir build && cd build
cmake -G "Visual Studio 17 2022" -A ARM64 ^
-DWITH_ARMPL=ON ^
-DARMPL_ROOT_DIR="C:\Program Files\Arm Performance Libraries\armpl_26.01" ^
-DWITH_OPENMP=ON ^
..
```
@note Enabling `WITH_OPENMP=ON` causes CMake to link against the `armpl_lp64_mp` (multi-threaded)
variant of ARMPL. Disabling it links against the serial `armpl_lp64` variant. Only one variant
should be enabled at a time to avoid symbol conflicts.
Step 5: Build and Install {#tutorial_windows_armpl_build}
=========================
Open the generated `.sln` file in Visual Studio and build the **Release** configuration, or
build from the command line:
```bat
cmake --build . --config Release --parallel
cmake --install . --config Release
```
Step 6: Verify the Build {#tutorial_windows_armpl_verify}
=========================
After a successful build, confirm that OpenCV detects ARMPL by running:
```bat
opencv_version --verbose 2>&1 | findstr /i armpl
```
You should see a line similar to:
```
ARMPL: YES (armpl_26.01)
```
Alternatively, check the CMake configuration log for the line:
```
-- ARMPL support: YES
```
Troubleshooting {#tutorial_windows_armpl_troubleshoot}
===============
**CMake cannot find ARMPL:**
Make sure `ARMPL_ROOT_DIR` points to the folder that contains both `include\` and `lib\`
sub-directories:
```
C:\Program Files\Arm Performance Libraries\armpl_26.01
bin\
include\
lib\
```
**Runtime error: DLL not found:**
Ensure that both the `lib\` and `bin\` directories are on the system `PATH` and that
you opened a new Command Prompt after adding them (changes are not picked up by already-open
sessions).
**Linker errors with OpenMP:**
If you see duplicate symbol errors when `WITH_OPENMP=ON`, make sure you are not also linking
against the serial ARMPL library. Pass `-DWITH_OPENMP=ON` consistently and clean the build
directory before re-running CMake.
See also {#tutorial_windows_armpl_seealso}
=========
- @ref tutorial_windows_install - Generic Windows build guide
- [ARM Performance Libraries documentation](https://developer.arm.com/documentation/101004/)
- @ref tutorial_general_install - General installation guide
+28
View File
@@ -0,0 +1,28 @@
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)
+91
View File
@@ -0,0 +1,91 @@
#ifndef OPENCV_ARMPL_HAL_CORE_HPP
#define OPENCV_ARMPL_HAL_CORE_HPP
#ifdef HAVE_ARMPL
#include <stddef.h>
#include <fftw3.h>
#include <opencv2/core/base.hpp>
#include <opencv2/core/utility.hpp>
#ifndef cvhalDFT
struct cvhalDFT;
#endif
int armpl_hal_dftInit2D(cvhalDFT **context, int width, int height,
int depth, int src_channels, int dst_channels,
int flags, int nonzero_rows);
int armpl_hal_dft2D(cvhalDFT *context, const unsigned char *src_data,
size_t src_step, unsigned char *dst_data, size_t dst_step);
int armpl_hal_dftFree2D(cvhalDFT *context);
#undef cv_hal_dftInit2D
#define cv_hal_dftInit2D armpl_hal_dftInit2D
#undef cv_hal_dft2D
#define cv_hal_dft2D armpl_hal_dft2D
#undef cv_hal_dftFree2D
#define cv_hal_dftFree2D armpl_hal_dftFree2D
struct ArmplDFTSpec_C_32fc {
fftwf_plan plan;
int n;
bool isInverse;
};
struct ArmplDFTSpec_C_64fc {
fftw_plan plan;
int n;
bool isInverse;
};
struct ArmplDFTSpec_R_32f {
fftwf_plan plan;
int n;
bool isInverse;
double scale;
};
struct ArmplDFTSpec_R_64f {
fftw_plan plan;
int n;
bool isInverse;
double scale;
};
int armpl_hal_dftInit1D(cvhalDFT **context, int len, int count,
int depth, int flags, bool *needBuffer);
int armpl_hal_dft1D(cvhalDFT *context,
const unsigned char *src, unsigned char *dst);
int armpl_hal_dftFree1D(cvhalDFT *context);
#undef cv_hal_dftInit1D
#define cv_hal_dftInit1D armpl_hal_dftInit1D
#undef cv_hal_dft1D
#define cv_hal_dft1D armpl_hal_dft1D
#undef cv_hal_dftFree1D
#define cv_hal_dftFree1D armpl_hal_dftFree1D
int armpl_hal_dctInit2D(cvhalDFT **context, int width, int height,
int depth, int flags);
int armpl_hal_dct2D(cvhalDFT *context, const unsigned char *src_data,
size_t src_step, unsigned char *dst_data, size_t dst_step);
int armpl_hal_dctFree2D(cvhalDFT *context);
#undef cv_hal_dctInit2D
#define cv_hal_dctInit2D armpl_hal_dctInit2D
#undef cv_hal_dct2D
#define cv_hal_dct2D armpl_hal_dct2D
#undef cv_hal_dctFree2D
#define cv_hal_dctFree2D armpl_hal_dctFree2D
#endif // HAVE_ARMPL
#endif // OPENCV_ARMPL_HAL_CORE_HPP
File diff suppressed because it is too large Load Diff
+31 -1
View File
@@ -678,13 +678,26 @@ public:
protected: protected:
void run_func(); void run_func();
void prepare_to_validation( int test_case_idx ); void prepare_to_validation( int test_case_idx );
double get_success_error_level( int test_case_idx, int i, int j );
}; };
CxCore_DFTTest::CxCore_DFTTest() : CxCore_DXTBaseTest( true, true, false ) CxCore_DFTTest::CxCore_DFTTest() : CxCore_DXTBaseTest( true, true, false )
{ {
} }
double CxCore_DFTTest::get_success_error_level( int test_case_idx, int i, int j )
{
CV_Assert(i == OUTPUT);
CV_Assert(j == 0);
int depth = CV_MAT_DEPTH(cvGetElemType(test_array[i][j]));
// NOTE: non-default threshold intorduced for ARMPL integration
if (depth == CV_32F)
return 1.5e-4;
return CxCore_DXTBaseTest::get_success_error_level(test_case_idx, i, j);
}
void CxCore_DFTTest::run_func() void CxCore_DFTTest::run_func()
{ {
@@ -743,6 +756,9 @@ public:
protected: protected:
void run_func(); void run_func();
void prepare_to_validation( int test_case_idx ); void prepare_to_validation( int test_case_idx );
#if defined(HAVE_ARMPL)
double get_success_error_level( int test_case_idx, int i, int j ) CV_OVERRIDE;
#endif
}; };
@@ -750,6 +766,20 @@ CxCore_DCTTest::CxCore_DCTTest() : CxCore_DXTBaseTest( false, false, false )
{ {
} }
#if defined(HAVE_ARMPL)
double CxCore_DCTTest::get_success_error_level(int, int i, int j)
{
CV_Assert(i == OUTPUT);
CV_Assert(j == 0);
int depth = CV_MAT_DEPTH(cvGetElemType(test_array[i][j]));
if (depth == CV_32F)
return 1.67e-5;
return 1e-12;
}
#endif
void CxCore_DCTTest::run_func() void CxCore_DCTTest::run_func()
{ {