From 2d204243af3f1b55f3734990c0dd560fbfe40873 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Thu, 22 Feb 2024 12:04:13 +0300 Subject: [PATCH] Merge pull request #25064 from vpisarev:em_5point_fix Fix very slow compilation of five-point algorithm on some platforms (e.g. Qualcomm) #25064 Thanks to our big friend and long-term contributor for the patch! ### 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 - [x] 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 --- modules/calib3d/src/five-point.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/calib3d/src/five-point.cpp b/modules/calib3d/src/five-point.cpp index b8d0b43edc..9fda9f73f1 100644 --- a/modules/calib3d/src/five-point.cpp +++ b/modules/calib3d/src/five-point.cpp @@ -36,6 +36,13 @@ namespace cv { +// for some compilers it takes very long time to compile +// automatically generated code in EMEstimatorCallback::runKernel(), +// so we temporarily disable optimizations here +#if defined __hexagon__ && defined __clang__ +#pragma clang optimize off +#endif + class EMEstimatorCallback CV_FINAL : public PointSetRegistrator::Callback { public: @@ -401,6 +408,11 @@ protected: } }; +// restore optimizations (if any) +#if defined __hexagon__ && defined __clang__ +#pragma clang optimize on +#endif + // Find essential matrix given undistorted points and two cameras. static Mat findEssentialMat_( InputArray _points1, InputArray _points2, InputArray cameraMatrix1, InputArray cameraMatrix2,