From 579dfb6e025c62acb16b7b3e1fe953030df68d40 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov <2536374+asmorkalov@users.noreply.github.com> Date: Thu, 11 Dec 2025 18:06:39 +0300 Subject: [PATCH] Merge pull request #27640 from asmorkalov:as/kleidicv_mac Enable KleidiCV on Linux and Mac Mx by default #27640 OpenCV Extra: https://github.com/opencv/opencv_extra/pull/1296 ### 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 - [ ] The PR is proposed to the proper branch - [ ] 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 --- CMakeLists.txt | 2 +- modules/dnn/test/test_torch_importer.cpp | 2 +- modules/video/perf/perf_ecc.cpp | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 167ce19578..caf42ebc0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,7 +227,7 @@ 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" (ANDROID AND AARCH64 AND NOT CV_DISABLE_OPTIMIZATION) +OCV_OPTION(WITH_KLEIDICV "Use KleidiCV library for ARM platforms" (NOT CV_DISABLE_OPTIMIZATION) VISIBLE_IF (AARCH64 AND (ANDROID OR UNIX))) OCV_OPTION(WITH_NDSRVP "Use Andes RVP extension" (NOT CV_DISABLE_OPTIMIZATION) VISIBLE_IF RISCV) diff --git a/modules/dnn/test/test_torch_importer.cpp b/modules/dnn/test/test_torch_importer.cpp index f1d7521e7b..d27cda17b8 100644 --- a/modules/dnn/test/test_torch_importer.cpp +++ b/modules/dnn/test/test_torch_importer.cpp @@ -426,7 +426,7 @@ static void normAssertSegmentation(const Mat& ref, const Mat& test) Mat refMask = getSegmMask(ref); Mat testMask = getSegmMask(test); - EXPECT_EQ(countNonZero(refMask != testMask), 0); + EXPECT_LE(countNonZero(refMask != testMask), 2); } TEST_P(Test_Torch_nets, ENet_accuracy) diff --git a/modules/video/perf/perf_ecc.cpp b/modules/video/perf/perf_ecc.cpp index 217b98fa0e..f81f64d8a6 100644 --- a/modules/video/perf/perf_ecc.cpp +++ b/modules/video/perf/perf_ecc.cpp @@ -55,7 +55,16 @@ PERF_TEST_P(ECCPerfTest, findTransformECC, TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 5, -1)); } - SANITY_CHECK(warpMat, 3e-3); + if (transform_type == MOTION_HOMOGRAPHY) + { + // NOTE: for Mac M1 + KleidiCV + // ECCPerfTest_findTransformECC.findTransformECC/6, where GetParam() = (MOTION_HOMOGRAPHY, IMREAD_GRAYSCALE) + SANITY_CHECK(warpMat, 8.3e-3); + } + else + { + SANITY_CHECK(warpMat, 3e-3); + } } } // namespace opencv_test