Files
opencv-mobile/patches/opencv-4.10.0-no-atomic.patch
2024-06-05 21:06:55 +08:00

37 lines
1.5 KiB
Diff

diff -Nuarp opencv-4.10.0.orig/modules/core/src/mathfuncs.cpp opencv-4.10.0/modules/core/src/mathfuncs.cpp
--- opencv-4.10.0.orig/modules/core/src/mathfuncs.cpp 2024-06-02 04:41:06.000000000 +0800
+++ opencv-4.10.0/modules/core/src/mathfuncs.cpp 2024-06-04 20:57:06.217205470 +0800
@@ -2187,8 +2187,13 @@ const double* getExpTab64f()
const float* getExpTab32f()
{
static float CV_DECL_ALIGNED(64) expTab_f[EXPTAB_MASK+1];
+#ifndef OPENCV_DISABLE_THREAD_SUPPORT
static std::atomic<bool> expTab_f_initialized(false);
if (!expTab_f_initialized.load())
+#else
+ static bool expTab_f_initialized = false;
+ if (!expTab_f_initialized)
+#endif
{
for( int j = 0; j <= EXPTAB_MASK; j++ )
expTab_f[j] = (float)expTab[j];
diff -Nuarp opencv-4.10.0.orig/modules/core/src/parallel.cpp opencv-4.10.0/modules/core/src/parallel.cpp
--- opencv-4.10.0.orig/modules/core/src/parallel.cpp 2024-06-02 04:41:06.000000000 +0800
+++ opencv-4.10.0/modules/core/src/parallel.cpp 2024-06-04 20:57:58.179745974 +0800
@@ -513,6 +513,7 @@ void parallel_for_(const cv::Range& rang
if (range.empty())
return;
+#ifndef OPENCV_DISABLE_THREAD_SUPPORT
static std::atomic<bool> flagNestedParallelFor(false);
bool isNotNestedRegion = !flagNestedParallelFor.load();
if (isNotNestedRegion)
@@ -531,6 +532,7 @@ void parallel_for_(const cv::Range& rang
}
}
else // nested parallel_for_() calls are not parallelized
+#endif
{
CV_UNUSED(nstripes);
body(range);