1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +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
+31 -1
View File
@@ -678,13 +678,26 @@ public:
protected:
void run_func();
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 )
{
}
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()
{
@@ -743,6 +756,9 @@ public:
protected:
void run_func();
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()
{