Files
opencv-mobile/opencv-4.8.1-no-atomic.patch
2023-10-11 11:11:09 +08:00

37 lines
1.5 KiB
Diff

diff -Nuarp opencv-4.8.0.orig/modules/core/src/mathfuncs.cpp opencv-4.8.0/modules/core/src/mathfuncs.cpp
--- opencv-4.8.0.orig/modules/core/src/mathfuncs.cpp 2023-06-28 19:53:33.000000000 +0800
+++ opencv-4.8.0/modules/core/src/mathfuncs.cpp 2023-09-24 13:59:28.427872811 +0800
@@ -2133,8 +2133,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.8.0.orig/modules/core/src/parallel.cpp opencv-4.8.0/modules/core/src/parallel.cpp
--- opencv-4.8.0.orig/modules/core/src/parallel.cpp 2023-06-28 19:53:33.000000000 +0800
+++ opencv-4.8.0/modules/core/src/parallel.cpp 2023-09-24 13:59:09.334964234 +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);