mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -364,7 +364,7 @@ IplImage;
|
||||
|
||||
CV_INLINE IplImage cvIplImage()
|
||||
{
|
||||
#if !defined(CV__ENABLE_C_API_CTORS)
|
||||
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
|
||||
IplImage self = CV_STRUCT_INITIALIZER; self.nSize = sizeof(IplImage); return self;
|
||||
#else
|
||||
return _IplImage();
|
||||
|
||||
@@ -2772,6 +2772,7 @@ struct Kernel::Impl
|
||||
for( int i = 0; i < MAX_ARRS; i++ )
|
||||
u[i] = 0;
|
||||
haveTempDstUMats = false;
|
||||
haveTempSrcUMats = false;
|
||||
}
|
||||
|
||||
void cleanupUMats()
|
||||
@@ -2788,6 +2789,7 @@ struct Kernel::Impl
|
||||
}
|
||||
nu = 0;
|
||||
haveTempDstUMats = false;
|
||||
haveTempSrcUMats = false;
|
||||
}
|
||||
|
||||
void addUMat(const UMat& m, bool dst)
|
||||
@@ -2798,6 +2800,8 @@ struct Kernel::Impl
|
||||
nu++;
|
||||
if(dst && m.u->tempUMat())
|
||||
haveTempDstUMats = true;
|
||||
if(m.u->originalUMatData == NULL && m.u->tempUMat())
|
||||
haveTempSrcUMats = true; // UMat is created on RAW memory (without proper lifetime management, even from Mat)
|
||||
}
|
||||
|
||||
void addImage(const Image2D& image)
|
||||
@@ -2835,6 +2839,7 @@ struct Kernel::Impl
|
||||
int nu;
|
||||
std::list<Image2D> images;
|
||||
bool haveTempDstUMats;
|
||||
bool haveTempSrcUMats;
|
||||
};
|
||||
|
||||
}} // namespace cv::ocl
|
||||
@@ -3108,6 +3113,8 @@ bool Kernel::Impl::run(int dims, size_t globalsize[], size_t localsize[],
|
||||
cl_command_queue qq = getQueue(q);
|
||||
if (haveTempDstUMats)
|
||||
sync = true;
|
||||
if (haveTempSrcUMats)
|
||||
sync = true;
|
||||
if (timeNS)
|
||||
sync = true;
|
||||
cl_event asyncEvent = 0;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#undef min
|
||||
#undef max
|
||||
#undef abs
|
||||
#elif defined(__linux__)
|
||||
#include <dlfcn.h> // requires -ldl
|
||||
#elif defined(__APPLE__)
|
||||
#include <TargetConditionals.h>
|
||||
#if TARGET_OS_MAC
|
||||
@@ -123,27 +125,10 @@ static cv::String getModuleLocation(const void* addr)
|
||||
}
|
||||
}
|
||||
#elif defined(__linux__)
|
||||
std::ifstream fs("/proc/self/maps");
|
||||
std::string line;
|
||||
while (std::getline(fs, line, '\n'))
|
||||
Dl_info info;
|
||||
if (0 != dladdr(addr, &info))
|
||||
{
|
||||
long long int addr_begin = 0, addr_end = 0;
|
||||
if (2 == sscanf(line.c_str(), "%llx-%llx", &addr_begin, &addr_end))
|
||||
{
|
||||
if ((intptr_t)addr >= (intptr_t)addr_begin && (intptr_t)addr < (intptr_t)addr_end)
|
||||
{
|
||||
size_t pos = line.rfind(" "); // 2 spaces
|
||||
if (pos == cv::String::npos)
|
||||
pos = line.rfind(' '); // 1 spaces
|
||||
else
|
||||
pos++;
|
||||
if (pos == cv::String::npos)
|
||||
{
|
||||
CV_LOG_DEBUG(NULL, "Can't parse module path: '" << line << '\'');
|
||||
}
|
||||
return line.substr(pos + 1);
|
||||
}
|
||||
}
|
||||
return cv::String(info.dli_fname);
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
# if TARGET_OS_MAC
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <errno.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
@@ -178,7 +178,7 @@ cv::String getcwd()
|
||||
sz = GetCurrentDirectoryA((DWORD)buf.size(), buf.data());
|
||||
return cv::String(buf.data(), (size_t)sz);
|
||||
#endif
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__
|
||||
for(;;)
|
||||
{
|
||||
char* p = ::getcwd(buf.data(), buf.size());
|
||||
@@ -212,7 +212,7 @@ bool createDirectory(const cv::String& path)
|
||||
#else
|
||||
int result = _mkdir(path.c_str());
|
||||
#endif
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__
|
||||
int result = mkdir(path.c_str(), 0777);
|
||||
#else
|
||||
int result = -1;
|
||||
@@ -327,7 +327,7 @@ private:
|
||||
Impl& operator=(const Impl&); // disabled
|
||||
};
|
||||
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__
|
||||
|
||||
struct FileLock::Impl
|
||||
{
|
||||
@@ -441,7 +441,7 @@ cv::String getCacheDirectory(const char* sub_directory_name, const char* configu
|
||||
default_cache_path = "/tmp/";
|
||||
CV_LOG_WARNING(NULL, "Using world accessible cache directory. This may be not secure: " << default_cache_path);
|
||||
}
|
||||
#elif defined __linux__ || defined __HAIKU__
|
||||
#elif defined __linux__ || defined __HAIKU__ || defined __FreeBSD__
|
||||
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
if (default_cache_path.empty())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user