mirror of
https://gitcode.com/gh_mirrors/es/esp32-opencv.git
synced 2025-08-14 01:57:43 +08:00
added some comments on the modifications done into the code
This commit is contained in:
@ -199,7 +199,7 @@ endif()
|
|||||||
# OpenCV cmake options
|
# OpenCV cmake options
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
# ESP32 target option
|
# ESP32 target option. Enable it with -DESP32=ON will disable/modify parts of the code for compilation to work
|
||||||
OCV_OPTION(ESP32 "Compilation for esp32 target" OFF)
|
OCV_OPTION(ESP32 "Compilation for esp32 target" OFF)
|
||||||
|
|
||||||
OCV_OPTION(OPENCV_ENABLE_NONFREE "Enable non-free algorithms" OFF)
|
OCV_OPTION(OPENCV_ENABLE_NONFREE "Enable non-free algorithms" OFF)
|
||||||
@ -491,6 +491,7 @@ OCV_OPTION(OPENCV_ENABLE_MEMALIGN "Enable posix_memalign or memalign usage"
|
|||||||
OCV_OPTION(ENABLE_PYLINT "Add target with Pylint checks" (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
|
OCV_OPTION(ENABLE_PYLINT "Add target with Pylint checks" (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
|
||||||
OCV_OPTION(ENABLE_FLAKE8 "Add target with Python flake8 checker" (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
|
OCV_OPTION(ENABLE_FLAKE8 "Add target with Python flake8 checker" (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
|
||||||
|
|
||||||
|
# Add preprocessor definition seen by the code sources
|
||||||
if(ESP32)
|
if(ESP32)
|
||||||
message(STATUS "Enabled ESP32 target specific build")
|
message(STATUS "Enabled ESP32 target specific build")
|
||||||
add_definitions(-DESP32)
|
add_definitions(-DESP32)
|
||||||
@ -659,6 +660,7 @@ include(cmake/OpenCVModule.cmake)
|
|||||||
# Detect endianness of build platform
|
# Detect endianness of build platform
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# if not working while compiling for esp32, change the next line in 'if(IOS OR ESP32)'
|
||||||
if(IOS)
|
if(IOS)
|
||||||
# test_big_endian needs try_compile, which doesn't work for iOS
|
# test_big_endian needs try_compile, which doesn't work for iOS
|
||||||
# http://public.kitware.com/Bug/view.php?id=12288
|
# http://public.kitware.com/Bug/view.php?id=12288
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
static int test()
|
static int test()
|
||||||
{
|
{
|
||||||
std::atomic<long> x;
|
// std::atomic<long long> x;
|
||||||
|
std::atomic<long> x; // esp32 doesn't support hardware 64bit atomic. FIXME: add software support
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
cmake/platforms/OpenCV-Generic.cmake
Normal file
1
cmake/platforms/OpenCV-Generic.cmake
Normal file
@ -0,0 +1 @@
|
|||||||
|
# nop
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "ade/memory/alloc.hpp"
|
#include "ade/memory/alloc.hpp"
|
||||||
|
|
||||||
|
// esp32 uses memalign from malloc.h
|
||||||
#if defined(_WIN32) || defined(__ANDROID__) || defined(ANDROID) || defined(ESP32)
|
#if defined(_WIN32) || defined(__ANDROID__) || defined(ANDROID) || defined(ESP32)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#else
|
#else
|
||||||
|
@ -21,7 +21,8 @@ class AllocatorStatistics : public AllocatorStatisticsInterface
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
#ifdef CV_CXX11
|
#ifdef CV_CXX11
|
||||||
std::atomic<long> curr, total, total_allocs, peak; // ESP32 modification (from <long long> to <long>)
|
// std::atomic<long long> curr, total, total_allocs, peak;
|
||||||
|
std::atomic<long> curr, total, total_allocs, peak; // esp32 doesn't support hardware 64bit atomic. FIXME: add software support
|
||||||
#else
|
#else
|
||||||
volatile long long curr, total, total_allocs, peak; // overflow is possible, CV_XADD operates with 'int' only
|
volatile long long curr, total, total_allocs, peak; // overflow is possible, CV_XADD operates with 'int' only
|
||||||
#endif
|
#endif
|
||||||
|
@ -942,6 +942,7 @@ int cv::getNumberOfCPUs(void)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// esp32 doesn't support sysconf call. FIXME: add support
|
||||||
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(ESP32)
|
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(ESP32)
|
||||||
|
|
||||||
static unsigned cpu_count_sysconf = (unsigned)sysconf( _SC_NPROCESSORS_ONLN );
|
static unsigned cpu_count_sysconf = (unsigned)sysconf( _SC_NPROCESSORS_ONLN );
|
||||||
|
@ -1000,6 +1000,7 @@ String tempfile( const char* suffix )
|
|||||||
fname = fname + "__opencv_temp.XXXXXX";
|
fname = fname + "__opencv_temp.XXXXXX";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: esp32 compilation only find mktemp and not mkstemp
|
||||||
//const int fd = mkstemp((char*)fname.c_str());
|
//const int fd = mkstemp((char*)fname.c_str());
|
||||||
//if (fd == -1) return String();
|
//if (fd == -1) return String();
|
||||||
|
|
||||||
|
@ -136,6 +136,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Optimization doesn't works with xtensa cross-compiler
|
||||||
#pragma GCC push_options
|
#pragma GCC push_options
|
||||||
#pragma GCC optimize ("-O0")
|
#pragma GCC optimize ("-O0")
|
||||||
virtual void operator()(const Range& range) const CV_OVERRIDE
|
virtual void operator()(const Range& range) const CV_OVERRIDE
|
||||||
|
@ -1777,6 +1777,7 @@ calcSparseBackProj_8u( std::vector<uchar*>& _ptrs, const std::vector<int>& _delt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Optimization doesn't works with xtensa cross-compiler
|
||||||
#pragma GCC push_options
|
#pragma GCC push_options
|
||||||
#pragma GCC optimize ("-O0")
|
#pragma GCC optimize ("-O0")
|
||||||
void cv::calcBackProject( const Mat* images, int nimages, const int* channels,
|
void cv::calcBackProject( const Mat* images, int nimages, const int* channels,
|
||||||
|
Reference in New Issue
Block a user