mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge branch 4.x
This commit is contained in:
@@ -7,10 +7,8 @@
|
||||
|
||||
#include <opencv2/core/mat.hpp>
|
||||
|
||||
#ifdef CV_CXX11
|
||||
//#include <future>
|
||||
#include <chrono>
|
||||
#endif
|
||||
|
||||
namespace cv {
|
||||
|
||||
@@ -69,7 +67,6 @@ public:
|
||||
|
||||
CV_WRAP bool valid() const CV_NOEXCEPT;
|
||||
|
||||
#ifdef CV_CXX11
|
||||
inline AsyncArray(AsyncArray&& o) { p = o.p; o.p = NULL; }
|
||||
inline AsyncArray& operator=(AsyncArray&& o) CV_NOEXCEPT { std::swap(p, o.p); return *this; }
|
||||
|
||||
@@ -89,7 +86,6 @@ public:
|
||||
std::future<Mat> getFutureMat() const;
|
||||
std::future<UMat> getFutureUMat() const;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// PImpl
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(__riscv) && defined(__riscv_vector) && defined(__riscv_vector_071)
|
||||
# include<riscv-vector.h>
|
||||
# include<riscv_vector.h>
|
||||
# define CV_RVV071 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -476,6 +476,8 @@ Cv64suf;
|
||||
#define CV_WRAP_MAPPABLE(mappable)
|
||||
#define CV_WRAP_PHANTOM(phantom_header)
|
||||
#define CV_WRAP_DEFAULT(val)
|
||||
/* Indicates that the function parameter has filesystem path semantic */
|
||||
#define CV_WRAP_FILE_PATH
|
||||
|
||||
/****************************************************************************************\
|
||||
* Matrix type (Mat) *
|
||||
@@ -755,89 +757,44 @@ __CV_ENUM_FLAGS_BITWISE_XOR_EQ (EnumType, EnumType)
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************************\
|
||||
* CV_NODISCARD attribute (deprecated, GCC only) *
|
||||
* DONT USE: use instead the standard CV_NODISCARD_STD macro above *
|
||||
* this legacy method silently fails to issue warning until some version *
|
||||
* after gcc 6.3.0. Yet with gcc 7+ you can use the above standard method *
|
||||
* which makes this method useless. Don't use it. *
|
||||
* @deprecated use instead CV_NODISCARD_STD *
|
||||
\****************************************************************************************/
|
||||
#ifndef CV_NODISCARD
|
||||
# if defined(__GNUC__)
|
||||
# define CV_NODISCARD __attribute__((__warn_unused_result__))
|
||||
# elif defined(__clang__) && defined(__has_attribute)
|
||||
# if __has_attribute(__warn_unused_result__)
|
||||
# define CV_NODISCARD __attribute__((__warn_unused_result__))
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#ifndef CV_NODISCARD
|
||||
# define CV_NODISCARD /* nothing by default */
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************************\
|
||||
* C++ 11 *
|
||||
\****************************************************************************************/
|
||||
#ifndef CV_CXX11
|
||||
# if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
# define CV_CXX11 1
|
||||
#ifdef __cplusplus
|
||||
// MSVC was stuck at __cplusplus == 199711L for a long time, even where it supports C++11,
|
||||
// so check _MSC_VER instead. See:
|
||||
// <https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus>
|
||||
# if defined(_MSC_VER)
|
||||
# if _MSC_VER < 1800
|
||||
# error "OpenCV 4.x+ requires enabled C++11 support"
|
||||
# endif
|
||||
# elif __cplusplus < 201103L
|
||||
# error "OpenCV 4.x+ requires enabled C++11 support"
|
||||
# endif
|
||||
#else
|
||||
# if CV_CXX11 == 0
|
||||
# undef CV_CXX11
|
||||
# endif
|
||||
#endif
|
||||
#ifndef CV_CXX11
|
||||
# error "OpenCV 4.x+ requires enabled C++11 support"
|
||||
#endif
|
||||
|
||||
#define CV_CXX_MOVE_SEMANTICS 1
|
||||
#define CV_CXX_MOVE(x) std::move(x)
|
||||
#define CV_CXX_STD_ARRAY 1
|
||||
#include <array>
|
||||
#ifndef CV_CXX11
|
||||
# define CV_CXX11 1
|
||||
#endif
|
||||
|
||||
#ifndef CV_OVERRIDE
|
||||
# define CV_OVERRIDE override
|
||||
#endif
|
||||
|
||||
#ifndef CV_FINAL
|
||||
# define CV_FINAL final
|
||||
#endif
|
||||
|
||||
#ifndef CV_NOEXCEPT
|
||||
# if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900/*MSVS 2015*/)
|
||||
# define CV_NOEXCEPT noexcept
|
||||
# endif
|
||||
#endif
|
||||
#ifndef CV_NOEXCEPT
|
||||
# define CV_NOEXCEPT
|
||||
# define CV_NOEXCEPT noexcept
|
||||
#endif
|
||||
|
||||
#ifndef CV_CONSTEXPR
|
||||
# if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900/*MSVS 2015*/)
|
||||
# define CV_CONSTEXPR constexpr
|
||||
# endif
|
||||
#endif
|
||||
#ifndef CV_CONSTEXPR
|
||||
# define CV_CONSTEXPR
|
||||
# define CV_CONSTEXPR constexpr
|
||||
#endif
|
||||
|
||||
// Integer types portability
|
||||
#ifdef OPENCV_STDINT_HEADER
|
||||
#include OPENCV_STDINT_HEADER
|
||||
#elif defined(__cplusplus)
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1600 /* MSVS 2010 */
|
||||
namespace cv {
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
}
|
||||
#elif defined(_MSC_VER) || __cplusplus >= 201103L
|
||||
#ifdef __cplusplus
|
||||
#include <cstdint>
|
||||
namespace cv {
|
||||
using std::int8_t;
|
||||
@@ -849,19 +806,6 @@ using std::uint32_t;
|
||||
using std::int64_t;
|
||||
using std::uint64_t;
|
||||
}
|
||||
#else
|
||||
#include <stdint.h>
|
||||
namespace cv {
|
||||
typedef ::int8_t int8_t;
|
||||
typedef ::uint8_t uint8_t;
|
||||
typedef ::int16_t int16_t;
|
||||
typedef ::uint16_t uint16_t;
|
||||
typedef ::int32_t int32_t;
|
||||
typedef ::uint32_t uint32_t;
|
||||
typedef ::int64_t int64_t;
|
||||
typedef ::uint64_t uint64_t;
|
||||
}
|
||||
#endif
|
||||
#else // pure C
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
@@ -52,10 +52,8 @@ public:
|
||||
*/
|
||||
void setException(const cv::Exception& exception);
|
||||
|
||||
#ifdef CV_CXX11
|
||||
explicit AsyncPromise(AsyncPromise&& o) { p = o.p; o.p = NULL; }
|
||||
AsyncPromise& operator=(AsyncPromise&& o) CV_NOEXCEPT { std::swap(p, o.p); return *this; }
|
||||
#endif
|
||||
|
||||
|
||||
// PImpl
|
||||
|
||||
@@ -8,14 +8,8 @@
|
||||
#ifndef CV__EXCEPTION_PTR
|
||||
# if defined(__ANDROID__) && defined(ATOMIC_INT_LOCK_FREE) && ATOMIC_INT_LOCK_FREE < 2
|
||||
# define CV__EXCEPTION_PTR 0 // Not supported, details: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58938
|
||||
# elif defined(CV_CXX11)
|
||||
# else
|
||||
# define CV__EXCEPTION_PTR 1
|
||||
# elif defined(_MSC_VER)
|
||||
# define CV__EXCEPTION_PTR (_MSC_VER >= 1600)
|
||||
# elif defined(__clang__)
|
||||
# define CV__EXCEPTION_PTR 0 // C++11 only (see above)
|
||||
# elif defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define CV__EXCEPTION_PTR (__GXX_EXPERIMENTAL_CXX0X__ > 0)
|
||||
# endif
|
||||
#endif
|
||||
#ifndef CV__EXCEPTION_PTR
|
||||
|
||||
@@ -61,8 +61,7 @@
|
||||
#endif
|
||||
|
||||
#if !defined(OPENCV_DISABLE_EIGEN_TENSOR_SUPPORT)
|
||||
#if EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 3 \
|
||||
&& defined(CV_CXX11) && defined(CV_CXX_STD_ARRAY)
|
||||
#if EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 3
|
||||
#include <unsupported/Eigen/CXX11/Tensor>
|
||||
#define OPENCV_EIGEN_TENSOR_SUPPORT 1
|
||||
#endif // EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 3
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,6 +53,7 @@
|
||||
|
||||
#include "opencv2/core/bufferpool.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <type_traits>
|
||||
|
||||
namespace cv
|
||||
|
||||
@@ -386,10 +386,8 @@ public:
|
||||
static Vec randn(_Tp a, _Tp b);
|
||||
static Vec randu(_Tp a, _Tp b);
|
||||
static Vec zeros();
|
||||
#ifdef CV_CXX11
|
||||
static Vec diag(_Tp alpha) = delete;
|
||||
static Vec eye() = delete;
|
||||
#endif
|
||||
|
||||
//! per-element multiplication
|
||||
Vec mul(const Vec<_Tp, cn>& v) const;
|
||||
@@ -412,9 +410,7 @@ public:
|
||||
const _Tp& operator ()(int i) const;
|
||||
_Tp& operator ()(int i);
|
||||
|
||||
#ifdef CV_CXX11
|
||||
Vec<_Tp, cn>& operator=(const Vec<_Tp, cn>& rhs) = default;
|
||||
#endif
|
||||
|
||||
Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_AddOp);
|
||||
Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_SubOp);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#define OPENCV_CORE_QUATERNION_INL_HPP
|
||||
|
||||
#ifndef OPENCV_CORE_QUATERNION_HPP
|
||||
#erorr This is not a standalone header. Include quaternion.hpp instead.
|
||||
#error This is not a standalone header. Include quaternion.hpp instead.
|
||||
#endif
|
||||
|
||||
//@cond IGNORE
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
//#define OPENCV_DISABLE_ALLOCATOR_STATS
|
||||
|
||||
#ifdef CV_CXX11
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#ifndef OPENCV_ALLOCATOR_STATS_COUNTER_TYPE
|
||||
@@ -26,14 +24,6 @@
|
||||
#define OPENCV_ALLOCATOR_STATS_COUNTER_TYPE long long
|
||||
#endif
|
||||
|
||||
#else // CV_CXX11
|
||||
|
||||
#ifndef OPENCV_ALLOCATOR_STATS_COUNTER_TYPE
|
||||
#define OPENCV_ALLOCATOR_STATS_COUNTER_TYPE int // CV_XADD supports int only
|
||||
#endif
|
||||
|
||||
#endif // CV_CXX11
|
||||
|
||||
namespace cv { namespace utils {
|
||||
|
||||
#ifdef CV__ALLOCATOR_STATS_LOG
|
||||
@@ -59,7 +49,7 @@ public:
|
||||
void onAllocate(size_t /*sz*/) {}
|
||||
void onFree(size_t /*sz*/) {}
|
||||
|
||||
#elif defined(CV_CXX11)
|
||||
#else
|
||||
|
||||
protected:
|
||||
typedef OPENCV_ALLOCATOR_STATS_COUNTER_TYPE counter_t;
|
||||
@@ -104,49 +94,7 @@ public:
|
||||
#endif
|
||||
curr -= (counter_t)sz;
|
||||
}
|
||||
|
||||
#else // non C++11
|
||||
|
||||
protected:
|
||||
typedef OPENCV_ALLOCATOR_STATS_COUNTER_TYPE counter_t;
|
||||
volatile counter_t curr, total, total_allocs, peak; // overflow is possible, CV_XADD operates with 'int' only
|
||||
public:
|
||||
AllocatorStatistics()
|
||||
: curr(0), total(0), total_allocs(0), peak(0)
|
||||
{}
|
||||
~AllocatorStatistics() CV_OVERRIDE {}
|
||||
|
||||
uint64_t getCurrentUsage() const CV_OVERRIDE { return (uint64_t)curr; }
|
||||
uint64_t getTotalUsage() const CV_OVERRIDE { return (uint64_t)total; }
|
||||
uint64_t getNumberOfAllocations() const CV_OVERRIDE { return (uint64_t)total_allocs; }
|
||||
uint64_t getPeakUsage() const CV_OVERRIDE { return (uint64_t)peak; }
|
||||
|
||||
void resetPeakUsage() CV_OVERRIDE { peak = curr; }
|
||||
|
||||
// Controller interface
|
||||
void onAllocate(size_t sz)
|
||||
{
|
||||
#ifdef CV__ALLOCATOR_STATS_LOG
|
||||
CV__ALLOCATOR_STATS_LOG(cv::format("allocate: %lld (curr=%lld)", (long long int)sz, (long long int)curr));
|
||||
#endif
|
||||
|
||||
counter_t new_curr = (counter_t)CV_XADD(&curr, (counter_t)sz) + (counter_t)sz;
|
||||
|
||||
peak = std::max((counter_t)peak, new_curr); // non-thread safe
|
||||
|
||||
//CV_XADD(&total, (uint64_t)sz); // overflow with int, non-reliable...
|
||||
total += sz;
|
||||
|
||||
CV_XADD(&total_allocs, (counter_t)1);
|
||||
}
|
||||
void onFree(size_t sz)
|
||||
{
|
||||
#ifdef CV__ALLOCATOR_STATS_LOG
|
||||
CV__ALLOCATOR_STATS_LOG(cv::format("free: %lld (curr=%lld)", (long long int)sz, (long long int)curr));
|
||||
#endif
|
||||
CV_XADD(&curr, (counter_t)-sz);
|
||||
}
|
||||
#endif
|
||||
#endif // OPENCV_DISABLE_ALLOCATOR_STATS
|
||||
};
|
||||
|
||||
#ifdef CV__ALLOCATOR_STATS_LOG
|
||||
|
||||
Reference in New Issue
Block a user