Files
opencv-mobile/patches/opencv-4.9.0-no-atomic.patch
2024-01-17 22:28:55 +08:00

37 lines
1.5 KiB
Diff

diff -Nuarp opencv-4.9.0.orig/modules/core/src/mathfuncs.cpp opencv-4.9.0/modules/core/src/mathfuncs.cpp
--- opencv-4.9.0.orig/modules/core/src/mathfuncs.cpp 2023-12-28 00:46:55.000000000 +0800
+++ opencv-4.9.0/modules/core/src/mathfuncs.cpp 2024-01-17 19:27:17.197215967 +0800
@@ -2140,8 +2140,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.9.0.orig/modules/core/src/parallel.cpp opencv-4.9.0/modules/core/src/parallel.cpp
--- opencv-4.9.0.orig/modules/core/src/parallel.cpp 2023-12-28 00:46:55.000000000 +0800
+++ opencv-4.9.0/modules/core/src/parallel.cpp 2024-01-17 19:27:17.197215967 +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);