mirror of
https://github.com/opencv/opencv.git
synced 2026-09-25 04:09:57 +03:00
Remove references to C++ < 17 and older compiler versions.
According to https://github.com/opencv/opencv/wiki/OpenCV-4-to-5-migration#1-build-requirements are not supported: - GCC < 7 - clang < 9 - MSVC < 2017 (19.14)
This commit is contained in:
@@ -51,11 +51,7 @@ elseif(CV_CLANG)
|
||||
set(OPENCV_LINKER_DEFENSES_FLAGS_COMMON "${OPENCV_LINKER_DEFENSES_FLAGS_COMMON} -z noexecstack -z relro -z now" )
|
||||
endif()
|
||||
elseif(CV_GCC)
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9")
|
||||
ocv_add_defense_compiler_flag("-fstack-protector")
|
||||
else()
|
||||
ocv_add_defense_compiler_flag("-fstack-protector-strong")
|
||||
endif()
|
||||
|
||||
# These flags is added by general options: -Wformat -Wformat-security
|
||||
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wformat" OR NOT CMAKE_CXX_FLAGS MATCHES "format-security")
|
||||
|
||||
@@ -296,7 +296,6 @@ if(X86 OR X86_64)
|
||||
ocv_update(CPU_SSSE3_FLAGS_ON "-mssse3")
|
||||
ocv_update(CPU_SSE2_FLAGS_ON "-msse2")
|
||||
ocv_update(CPU_SSE_FLAGS_ON "-msse")
|
||||
if(NOT (CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0")) # GCC >= 5.0
|
||||
ocv_update(CPU_AVX_512F_FLAGS_ON "-mavx512f")
|
||||
ocv_update(CPU_AVX_512CD_FLAGS_ON "-mavx512cd")
|
||||
ocv_update(CPU_AVX512_KNL_EXTRA_FLAGS_ON "-mavx512er -mavx512pf")
|
||||
@@ -310,9 +309,6 @@ if(X86 OR X86_64)
|
||||
ocv_update(CPU_AVX_512VBMI2_FLAGS_ON "-mavx512vbmi2")
|
||||
ocv_update(CPU_AVX_512BITALG_FLAGS_ON "-mavx512bitalg")
|
||||
ocv_update(CPU_AVX_512VPOPCNTDQ_FLAGS_ON "-mavx512vpopcntdq")
|
||||
else()
|
||||
ocv_update(CPU_AVX_512F_SUPPORTED OFF)
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
ocv_update(CPU_AVX2_FLAGS_ON "/arch:AVX2")
|
||||
ocv_update(CPU_AVX_FLAGS_ON "/arch:AVX")
|
||||
|
||||
@@ -149,21 +149,17 @@ if(CV_GCC OR CV_CLANG OR CV_ICX)
|
||||
add_extra_compiler_option(-Wundef)
|
||||
add_extra_compiler_option(-Winit-self)
|
||||
add_extra_compiler_option(-Wpointer-arith)
|
||||
if(NOT (CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0"))
|
||||
add_extra_compiler_option(-Wshadow) # old GCC emits warnings for variables + methods combination
|
||||
endif()
|
||||
add_extra_compiler_option(-Wshadow)
|
||||
add_extra_compiler_option(-Wsign-promo)
|
||||
add_extra_compiler_option(-Wuninitialized)
|
||||
if(CV_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0) AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0 OR ARM))
|
||||
if(CV_GCC AND ARM)
|
||||
add_extra_compiler_option(-Wno-psabi)
|
||||
endif()
|
||||
if(HAVE_CXX11)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT ENABLE_PRECOMPILED_HEADERS)
|
||||
add_extra_compiler_option(-Wsuggest-override)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
add_extra_compiler_option(-Winconsistent-missing-override)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_NOISY_WARNINGS)
|
||||
add_extra_compiler_option(-Wcast-align)
|
||||
@@ -174,16 +170,13 @@ if(CV_GCC OR CV_CLANG OR CV_ICX)
|
||||
add_extra_compiler_option(-Wno-comment)
|
||||
if(NOT OPENCV_SKIP_IMPLICIT_FALLTHROUGH
|
||||
AND NOT " ${CMAKE_CXX_FLAGS} ${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_CXX_FLAGS}" MATCHES "implicit-fallthrough"
|
||||
AND (CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)
|
||||
AND (CV_GCC OR CV_CLANG)
|
||||
)
|
||||
add_extra_compiler_option(-Wimplicit-fallthrough=3)
|
||||
endif()
|
||||
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
|
||||
add_extra_compiler_option(-Wno-strict-overflow) # Issue appears when compiling surf.cpp from opencv_contrib/modules/xfeatures2d
|
||||
endif()
|
||||
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
add_extra_compiler_option(-Wno-missing-field-initializers) # GCC 4.x emits warnings about {}, fixed in GCC 5+
|
||||
endif()
|
||||
if(CV_CLANG AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
add_extra_compiler_option(-Wno-deprecated-enum-enum-conversion)
|
||||
add_extra_compiler_option(-Wno-deprecated-anon-enum-enum-conversion)
|
||||
@@ -266,9 +259,6 @@ if(CV_GCC OR CV_CLANG OR CV_ICX)
|
||||
endif()
|
||||
|
||||
if(ENABLE_INSTRUMENTATION)
|
||||
if(NOT HAVE_CXX11)
|
||||
message(WARNING "ENABLE_INSTRUMENTATION requires C++11 support")
|
||||
endif()
|
||||
set(WITH_VTK OFF) # There are issues with VTK 6.0
|
||||
endif()
|
||||
|
||||
@@ -314,9 +304,7 @@ if(MSVC)
|
||||
|
||||
# Remove unreferenced functions: function level linking
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /Gy")
|
||||
if(NOT MSVC_VERSION LESS 1400)
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /bigobj")
|
||||
endif()
|
||||
|
||||
if(OPENCV_WARNINGS_ARE_ERRORS)
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /WX")
|
||||
@@ -327,7 +315,7 @@ if(MSVC)
|
||||
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE} /LTCG")
|
||||
endif()
|
||||
|
||||
if(NOT MSVC_VERSION LESS 1800 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /FS")
|
||||
set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} /FS")
|
||||
endif()
|
||||
|
||||
@@ -405,7 +405,7 @@ macro(ocv_nvcc_flags)
|
||||
endif()
|
||||
|
||||
# disabled because of multiple warnings during building nvcc auto generated files
|
||||
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.6.0")
|
||||
if(CV_GCC)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-but-set-variable)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -203,24 +203,11 @@ if(NOT OPENCV_SKIP_CMAKE_CXX_STANDARD)
|
||||
ocv_update(CMAKE_CXX_STANDARD 17)
|
||||
ocv_update(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
ocv_update(CMAKE_CXX_EXTENSIONS OFF) # use -std=c++17 instead of -std=gnu++17
|
||||
if("cxx_std_11" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
|
||||
set(HAVE_CXX11 ON)
|
||||
endif()
|
||||
if("cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
|
||||
set(HAVE_CXX17 ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_CXX11)
|
||||
message(WARNING "OpenCV 5.x requires C++11 support, but it was not detected. Your compilation may fail.")
|
||||
endif()
|
||||
if(NOT HAVE_CXX17)
|
||||
message(WARNING "OpenCV 5.x requires C++17 support, but it was not detected. Your compilation may fail.")
|
||||
endif()
|
||||
|
||||
# Debian 10 - GCC 8.3.0
|
||||
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
|
||||
message(WARNING "OpenCV requires GCC >= 8.x (detected ${CMAKE_CXX_COMPILER_VERSION}). Your compilation may fail.")
|
||||
# Debian 9 - GCC 7.3.0
|
||||
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7)
|
||||
message(WARNING "OpenCV requires GCC >= 7.x (detected ${CMAKE_CXX_COMPILER_VERSION}). Your compilation may fail.")
|
||||
endif()
|
||||
|
||||
# Debian 10 - Clang 7.0
|
||||
@@ -236,12 +223,12 @@ endif()
|
||||
# TODO: check other known compilers versions
|
||||
|
||||
set(__OPENCV_ENABLE_ATOMIC_LONG_LONG OFF)
|
||||
if(HAVE_CXX11 AND (X86 OR X86_64))
|
||||
if(X86 OR X86_64)
|
||||
set(__OPENCV_ENABLE_ATOMIC_LONG_LONG ON)
|
||||
endif()
|
||||
option(OPENCV_ENABLE_ATOMIC_LONG_LONG "Enable C++ compiler support for atomic<long long>" ${__OPENCV_ENABLE_ATOMIC_LONG_LONG})
|
||||
|
||||
if((HAVE_CXX11 AND OPENCV_ENABLE_ATOMIC_LONG_LONG
|
||||
if((OPENCV_ENABLE_ATOMIC_LONG_LONG
|
||||
AND NOT MSVC
|
||||
AND NOT (X86 OR X86_64)
|
||||
AND NOT OPENCV_SKIP_LIBATOMIC_COMPILER_CHECK)
|
||||
@@ -260,6 +247,6 @@ if((HAVE_CXX11 AND OPENCV_ENABLE_ATOMIC_LONG_LONG
|
||||
else()
|
||||
set(HAVE_ATOMIC_LONG_LONG ON)
|
||||
endif()
|
||||
else(HAVE_CXX11 AND OPENCV_ENABLE_ATOMIC_LONG_LONG)
|
||||
else()
|
||||
set(HAVE_ATOMIC_LONG_LONG ${OPENCV_ENABLE_ATOMIC_LONG_LONG})
|
||||
endif()
|
||||
|
||||
@@ -149,7 +149,7 @@ IF(OPENEXR_FOUND)
|
||||
if(NOT OPENEXR_VERSION)
|
||||
SET(OPENEXR_VERSION "Unknown")
|
||||
else()
|
||||
if(HAVE_CXX17 AND OPENEXR_VERSION VERSION_LESS "2.3.0")
|
||||
if(OPENEXR_VERSION VERSION_LESS "2.3.0")
|
||||
message(STATUS " OpenEXR(ver ${OPENEXR_VERSION}) doesn't support C++17 and higher. Updating OpenEXR 2.3.0+ is required.")
|
||||
SET(OPENEXR_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
@@ -78,15 +78,6 @@ endif()
|
||||
# Details: https://protobuf.dev/news/2022-08-03/
|
||||
# And if std::text_view is in abseil-cpp requests C++17 and later.
|
||||
|
||||
if(HAVE_PROTOBUF)
|
||||
if(NOT (Protobuf_VERSION VERSION_LESS 22))
|
||||
if((CMAKE_CXX_STANDARD EQUAL 98) OR (CMAKE_CXX_STANDARD LESS 17))
|
||||
message(STATUS "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} is too old to support protobuf(${Protobuf_VERSION}) and/or abseil-cpp. Use C++17 or later. Turning HAVE_PROTOBUF off")
|
||||
set(HAVE_PROTOBUF FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(HAVE_PROTOBUF AND PROTOBUF_UPDATE_FILES AND NOT COMMAND PROTOBUF_GENERATE_CPP)
|
||||
message(FATAL_ERROR "Can't configure protobuf dependency (BUILD_PROTOBUF=${BUILD_PROTOBUF} PROTOBUF_UPDATE_FILES=${PROTOBUF_UPDATE_FILES})")
|
||||
endif()
|
||||
|
||||
@@ -2,7 +2,7 @@ if(NOT DEFINED MIN_VER_CMAKE)
|
||||
set(MIN_VER_CMAKE 3.13) # Debian 10
|
||||
# set(MIN_VER_CMAKE 3.10) # Visual Studio 2017 15.7
|
||||
endif()
|
||||
set(MIN_VER_CUDA 6.5)
|
||||
set(MIN_VER_CUDA 9.0) # CUDA 9.0 is the minimum version supporting stable C++11 compilation for device code
|
||||
set(MIN_VER_CUDNN 7.5)
|
||||
set(MIN_VER_CUDNNJIT 9.0)
|
||||
set(MIN_VER_PYTHON3 3.2)
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
|
||||
IF(CV_GCC)
|
||||
|
||||
IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2.0")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF()
|
||||
|
||||
SET(_PCH_include_prefix "-I")
|
||||
SET(_PCH_isystem_prefix "-isystem")
|
||||
@@ -65,7 +63,7 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
|
||||
ocv_is_opencv_directory(__result ${item})
|
||||
if(__result)
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
|
||||
elseif(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
|
||||
elseif(CV_GCC AND
|
||||
item MATCHES "/usr/include$")
|
||||
# workaround for GCC 6.x bug
|
||||
else()
|
||||
@@ -78,7 +76,7 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
|
||||
ocv_is_opencv_directory(__result ${item})
|
||||
if(__result)
|
||||
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
|
||||
elseif(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
|
||||
elseif(CV_GCC AND
|
||||
item MATCHES "/usr/include$")
|
||||
# workaround for GCC 6.x bug
|
||||
else()
|
||||
|
||||
@@ -70,7 +70,6 @@ function(ocv_create_plugin module default_name dependency_target dependency_targ
|
||||
|
||||
target_link_libraries(${OPENCV_PLUGIN_NAME} PRIVATE ${dependency_target})
|
||||
set_target_properties(${OPENCV_PLUGIN_NAME} PROPERTIES
|
||||
CXX_STANDARD 11
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
)
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ function(ocv_include_directories)
|
||||
ocv_is_opencv_directory(__is_opencv_dir "${dir}")
|
||||
if(__is_opencv_dir)
|
||||
list(APPEND __add_before "${dir}")
|
||||
elseif(((CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0") OR CV_CLANG) AND
|
||||
elseif((CV_GCC OR CV_CLANG) AND
|
||||
dir MATCHES "/usr/include$")
|
||||
# workaround for GCC 6.x bug
|
||||
else()
|
||||
@@ -359,7 +359,7 @@ function(ocv_target_include_directories target)
|
||||
if("${dir}" STREQUAL "SYSTEM")
|
||||
set(__var_name __system_params)
|
||||
else()
|
||||
if(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
|
||||
if(CV_GCC AND
|
||||
dir MATCHES "/usr/include$")
|
||||
# workaround for GCC 6.x bug
|
||||
else()
|
||||
|
||||
@@ -139,7 +139,7 @@ option(OPENCV_ENABLE_ALLOCATOR_STATS "Enable Allocator metrics" ON)
|
||||
|
||||
if(NOT OPENCV_ENABLE_ALLOCATOR_STATS)
|
||||
add_definitions(-DOPENCV_DISABLE_ALLOCATOR_STATS=1)
|
||||
elseif(HAVE_CXX11 OR DEFINED OPENCV_ALLOCATOR_STATS_COUNTER_TYPE)
|
||||
else()
|
||||
if(NOT DEFINED OPENCV_ALLOCATOR_STATS_COUNTER_TYPE)
|
||||
if(HAVE_ATOMIC_LONG_LONG AND OPENCV_ENABLE_ATOMIC_LONG_LONG)
|
||||
if(MINGW)
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#if defined(__OPENCV_BUILD) && defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
|
||||
#endif
|
||||
#if defined(__OPENCV_BUILD) && defined(__GNUC__) && __GNUC__ >= 5
|
||||
#if defined(__OPENCV_BUILD) && defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -90,11 +90,9 @@ namespace cv { namespace debug_build_guard { } using namespace debug_build_guard
|
||||
|
||||
#ifdef CV_Func
|
||||
// keep current value (through OpenCV port file)
|
||||
#elif defined __GNUC__ || (defined (__cpluscplus) && (__cpluscplus >= 201103))
|
||||
#elif defined __GNUC__ || defined __clang__ || defined __cplusplus
|
||||
#define CV_Func __func__
|
||||
#elif defined __clang__ && (__clang_minor__ * 100 + __clang_major__ >= 305)
|
||||
#define CV_Func __func__
|
||||
#elif defined(__STDC_VERSION__) && (__STDC_VERSION >= 199901)
|
||||
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
#define CV_Func __func__
|
||||
#elif defined _MSC_VER
|
||||
#define CV_Func __FUNCTION__
|
||||
@@ -114,36 +112,12 @@ namespace cv { namespace debug_build_guard { } using namespace debug_build_guard
|
||||
#define CVAUX_CONCAT_EXP(a, b) a##b
|
||||
#define CVAUX_CONCAT(a, b) CVAUX_CONCAT_EXP(a,b)
|
||||
|
||||
#if defined(__clang__)
|
||||
# ifndef __has_extension
|
||||
# define __has_extension __has_feature /* compatibility, for older versions of clang */
|
||||
# endif
|
||||
# if __has_extension(cxx_static_assert)
|
||||
#if defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
|
||||
# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition)
|
||||
# elif __has_extension(c_static_assert)
|
||||
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
|
||||
# define CV_StaticAssert(condition, reason) _Static_assert((condition), reason " " #condition)
|
||||
# endif
|
||||
#elif defined(__GNUC__)
|
||||
# if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
|
||||
# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition)
|
||||
# endif
|
||||
#elif defined(_MSC_VER)
|
||||
# if _MSC_VER >= 1600 /* MSVC 10 */
|
||||
# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition)
|
||||
# endif
|
||||
#endif
|
||||
#ifndef CV_StaticAssert
|
||||
# if !defined(__clang__) && defined(__GNUC__) && (__GNUC__*100 + __GNUC_MINOR__ > 302)
|
||||
# define CV_StaticAssert(condition, reason) ({ extern int __attribute__((error("CV_StaticAssert: " reason " " #condition))) CV_StaticAssert(); ((condition) ? 0 : CV_StaticAssert()); })
|
||||
# else
|
||||
namespace cv {
|
||||
template <bool x> struct CV_StaticAssert_failed;
|
||||
template <> struct CV_StaticAssert_failed<true> { enum { val = 1 }; };
|
||||
template<int x> struct CV_StaticAssert_test {};
|
||||
}
|
||||
# define CV_StaticAssert(condition, reason)\
|
||||
typedef cv::CV_StaticAssert_test< sizeof(cv::CV_StaticAssert_failed< static_cast<bool>(condition) >) > CVAUX_CONCAT(CV_StaticAssert_failed_at_, __LINE__)
|
||||
# endif
|
||||
#else
|
||||
# define CV_StaticAssert(condition, reason)
|
||||
#endif
|
||||
|
||||
// Suppress warning "-Wdeprecated-declarations" / C4996
|
||||
@@ -220,7 +194,7 @@ namespace cv {
|
||||
#endif
|
||||
|
||||
#ifndef CV_ALWAYS_INLINE
|
||||
#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
|
||||
#if defined(__GNUC__)
|
||||
#define CV_ALWAYS_INLINE inline __attribute__((always_inline))
|
||||
#elif defined(_MSC_VER)
|
||||
#define CV_ALWAYS_INLINE __forceinline
|
||||
@@ -437,7 +411,7 @@ Cv64suf;
|
||||
#ifndef CV_EXPORTS
|
||||
# if (defined _WIN32 || defined WINCE || defined __CYGWIN__) && defined(CVAPI_EXPORTS)
|
||||
# define CV_EXPORTS __declspec(dllexport)
|
||||
# elif defined __GNUC__ && __GNUC__ >= 4 && (defined(CVAPI_EXPORTS) || defined(__APPLE__))
|
||||
# elif defined __GNUC__ && (defined(CVAPI_EXPORTS) || defined(__APPLE__))
|
||||
# define CV_EXPORTS __attribute__ ((visibility ("default")))
|
||||
# endif
|
||||
#endif
|
||||
@@ -729,21 +703,10 @@ __CV_ENUM_FLAGS_BITWISE_XOR_EQ (EnumType, EnumType)
|
||||
|
||||
#ifdef CV_XADD
|
||||
// allow to use user-defined macro
|
||||
#elif defined __GNUC__ || defined __clang__
|
||||
# if defined __clang__ && __clang_major__ >= 3 && !defined __EMSCRIPTEN__ && !defined __INTEL_COMPILER
|
||||
# ifdef __ATOMIC_ACQ_REL
|
||||
#elif defined __clang__ && !defined __EMSCRIPTEN__ && !defined __INTEL_COMPILER
|
||||
# define CV_XADD(addr, delta) __c11_atomic_fetch_add((_Atomic(int)*)(addr), delta, __ATOMIC_ACQ_REL)
|
||||
# else
|
||||
# define CV_XADD(addr, delta) __atomic_fetch_add((_Atomic(int)*)(addr), delta, 4)
|
||||
# endif
|
||||
# else
|
||||
# if defined __ATOMIC_ACQ_REL && !defined __clang__
|
||||
// version for gcc >= 4.7
|
||||
#elif defined __GNUC__ || defined __clang__
|
||||
# define CV_XADD(addr, delta) (int)__atomic_fetch_add((unsigned*)(addr), (unsigned)(delta), __ATOMIC_ACQ_REL)
|
||||
# else
|
||||
# define CV_XADD(addr, delta) (int)__sync_fetch_and_add((unsigned*)(addr), (unsigned)(delta))
|
||||
# endif
|
||||
# endif
|
||||
#elif defined _MSC_VER && !defined RC_INVOKED
|
||||
# include <intrin.h>
|
||||
# define CV_XADD(addr, delta) (int)_InterlockedExchangeAdd((long volatile*)addr, delta)
|
||||
@@ -785,20 +748,9 @@ __CV_ENUM_FLAGS_BITWISE_XOR_EQ (EnumType, EnumType)
|
||||
# else
|
||||
# define CV_NODISCARD_STD [[nodiscard]]
|
||||
# endif
|
||||
# elif __cplusplus >= 201703L
|
||||
# else
|
||||
// available when compiler is C++17 compliant
|
||||
# define CV_NODISCARD_STD [[nodiscard]]
|
||||
# elif defined(__INTEL_COMPILER)
|
||||
// see above, available when C++17 is enabled
|
||||
# elif defined(_MSC_VER) && _MSC_VER >= 1911 && _MSVC_LANG >= 201703L
|
||||
// available with VS2017 v15.3+ with /std:c++17 or higher; works on functions and classes
|
||||
# define CV_NODISCARD_STD [[nodiscard]]
|
||||
# elif defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 700) && (__cplusplus >= 201103L)
|
||||
// available with GCC 7.0+; works on functions, works or silently fails on classes
|
||||
# define CV_NODISCARD_STD [[nodiscard]]
|
||||
# elif defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 408) && (__cplusplus >= 201103L)
|
||||
// available with GCC 4.8+ but it usually does nothing and can fail noisily -- therefore not used
|
||||
// define CV_NODISCARD_STD [[gnu::warn_unused_result]]
|
||||
# endif
|
||||
#endif
|
||||
#ifndef CV_NODISCARD_STD
|
||||
@@ -810,21 +762,11 @@ __CV_ENUM_FLAGS_BITWISE_XOR_EQ (EnumType, EnumType)
|
||||
* C++ 11 *
|
||||
\****************************************************************************************/
|
||||
#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"
|
||||
# if __cplusplus < 201103L && !(defined(_MSC_VER) && _MSVC_LANG >= 201103L)
|
||||
# error "OpenCV 5.x+ requires enabled C++11 support"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CV_CXX11
|
||||
# define CV_CXX11 1
|
||||
#endif
|
||||
|
||||
#ifndef CV_OVERRIDE
|
||||
# define CV_OVERRIDE override
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#if defined _MSC_VER
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX // fix https://github.com/opencv/opencv/issues/17548
|
||||
#endif
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
namespace {
|
||||
inline unsigned int trailingZeros32(unsigned int value) {
|
||||
#if defined(_MSC_VER)
|
||||
#if (_MSC_VER < 1700) || defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC)
|
||||
#if defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC)
|
||||
unsigned long index = 0;
|
||||
_BitScanForward(&index, value);
|
||||
return (unsigned int)index;
|
||||
|
||||
@@ -1464,12 +1464,7 @@ inline v_float32x16 v_abs(const v_float32x16& x)
|
||||
inline v_float64x8 v_abs(const v_float64x8& x)
|
||||
{
|
||||
#ifdef _mm512_abs_pd
|
||||
#if defined __GNUC__ && (__GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ <= 3) || (__GNUC__ == 8 && __GNUC_MINOR__ <= 2))
|
||||
// Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87476
|
||||
return v_float64x8(_mm512_abs_pd(_mm512_castpd_ps(x.val)));
|
||||
#else
|
||||
return v_float64x8(_mm512_abs_pd(x.val));
|
||||
#endif
|
||||
#else
|
||||
return v_float64x8(_mm512_castsi512_pd(_mm512_and_si512(_mm512_castpd_si512(x.val),
|
||||
_v512_set_epu64(0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFF,
|
||||
|
||||
@@ -167,23 +167,13 @@ public:
|
||||
//! default constructor
|
||||
Point_();
|
||||
Point_(_Tp _x, _Tp _y);
|
||||
#if (defined(__GNUC__) && __GNUC__ < 5) && !defined(__clang__) // GCC 4.x bug. Details: https://github.com/opencv/opencv/pull/20837
|
||||
Point_(const Point_& pt);
|
||||
Point_(Point_&& pt) CV_NOEXCEPT = default;
|
||||
#elif OPENCV_ABI_COMPATIBILITY < 500
|
||||
Point_(const Point_& pt) = default;
|
||||
Point_(Point_&& pt) CV_NOEXCEPT = default;
|
||||
#endif
|
||||
Point_(const Size_<_Tp>& sz);
|
||||
Point_(const Vec<_Tp, 2>& v);
|
||||
|
||||
#if (defined(__GNUC__) && __GNUC__ < 5) && !defined(__clang__) // GCC 4.x bug. Details: https://github.com/opencv/opencv/pull/20837
|
||||
Point_& operator = (const Point_& pt);
|
||||
Point_& operator = (Point_&& pt) CV_NOEXCEPT = default;
|
||||
#elif OPENCV_ABI_COMPATIBILITY < 500
|
||||
Point_& operator = (const Point_& pt) = default;
|
||||
Point_& operator = (Point_&& pt) CV_NOEXCEPT = default;
|
||||
#endif
|
||||
//! conversion to another data type
|
||||
template<typename _Tp2> operator Point_<_Tp2>() const;
|
||||
|
||||
@@ -1204,12 +1194,6 @@ template<typename _Tp> inline
|
||||
Point_<_Tp>::Point_(_Tp _x, _Tp _y)
|
||||
: x(_x), y(_y) {}
|
||||
|
||||
#if (defined(__GNUC__) && __GNUC__ < 5) && !defined(__clang__) // GCC 4.x bug. Details: https://github.com/opencv/opencv/pull/20837
|
||||
template<typename _Tp> inline
|
||||
Point_<_Tp>::Point_(const Point_& pt)
|
||||
: x(pt.x), y(pt.y) {}
|
||||
#endif
|
||||
|
||||
template<typename _Tp> inline
|
||||
Point_<_Tp>::Point_(const Size_<_Tp>& sz)
|
||||
: x(sz.width), y(sz.height) {}
|
||||
@@ -1218,15 +1202,6 @@ template<typename _Tp> inline
|
||||
Point_<_Tp>::Point_(const Vec<_Tp,2>& v)
|
||||
: x(v[0]), y(v[1]) {}
|
||||
|
||||
#if (defined(__GNUC__) && __GNUC__ < 5) && !defined(__clang__) // GCC 4.x bug. Details: https://github.com/opencv/opencv/pull/20837
|
||||
template<typename _Tp> inline
|
||||
Point_<_Tp>& Point_<_Tp>::operator = (const Point_& pt)
|
||||
{
|
||||
x = pt.x; y = pt.y;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename _Tp> template<typename _Tp2> inline
|
||||
Point_<_Tp>::operator Point_<_Tp2>() const
|
||||
{
|
||||
|
||||
@@ -344,33 +344,8 @@ VSX_IMPL_1RG(vec_udword2, vec_float4, xvcvspuxds, vec_ctulo)
|
||||
VSX_FINLINE(rt) fnm(const rg& a) { return __builtin_convertvector(a, rt); }
|
||||
|
||||
#ifndef vec_permi
|
||||
#if __clang_major__ < 5
|
||||
// implement vec_permi in a dirty way
|
||||
# define VSX_IMPL_CLANG_4_PERMI(Tvec) \
|
||||
VSX_FINLINE(Tvec) vec_permi(const Tvec& a, const Tvec& b, unsigned const char c) \
|
||||
{ \
|
||||
switch (c) \
|
||||
{ \
|
||||
case 0: \
|
||||
return vec_mergeh(a, b); \
|
||||
case 1: \
|
||||
return vec_mergel(vec_mergeh(a, a), b); \
|
||||
case 2: \
|
||||
return vec_mergeh(vec_mergel(a, a), b); \
|
||||
default: \
|
||||
return vec_mergel(a, b); \
|
||||
} \
|
||||
}
|
||||
VSX_IMPL_CLANG_4_PERMI(vec_udword2)
|
||||
VSX_IMPL_CLANG_4_PERMI(vec_dword2)
|
||||
VSX_IMPL_CLANG_4_PERMI(vec_double2)
|
||||
|
||||
// vec_xxsldwi is missing in clang 4
|
||||
# define vec_xxsldwi(a, b, c) vec_sld(a, b, (c) * 4)
|
||||
#else
|
||||
// vec_xxpermdi is missing little-endian supports in clang 4 just like gcc4
|
||||
# define vec_permi(a, b, c) vec_xxpermdi(b, a, (3 ^ (((c) & 1) << 1 | (c) >> 1)))
|
||||
#endif // __clang_major__ < 5
|
||||
#endif
|
||||
|
||||
// shift left double by word immediate
|
||||
@@ -429,25 +404,19 @@ VSX_IMPL_CONVERT(vec_double2, vec_dword2, vec_ctd)
|
||||
VSX_IMPL_CONVERT(vec_double2, vec_udword2, vec_ctd)
|
||||
|
||||
// converts word and doubleword to single-precision
|
||||
#if __clang_major__ > 4
|
||||
# undef vec_ctf
|
||||
#endif
|
||||
#undef vec_ctf
|
||||
VSX_IMPL_CONVERT(vec_float4, vec_int4, vec_ctf)
|
||||
VSX_IMPL_CONVERT(vec_float4, vec_uint4, vec_ctf)
|
||||
VSX_REDIRECT_1RG(vec_float4, vec_dword2, vec_ctfo, __builtin_vsx_xvcvsxdsp)
|
||||
VSX_REDIRECT_1RG(vec_float4, vec_udword2, vec_ctfo, __builtin_vsx_xvcvuxdsp)
|
||||
|
||||
// converts single and double precision to signed word
|
||||
#if __clang_major__ > 4
|
||||
# undef vec_cts
|
||||
#endif
|
||||
#undef vec_cts
|
||||
VSX_REDIRECT_1RG(vec_int4, vec_double2, vec_ctso, __builtin_vsx_xvcvdpsxws)
|
||||
VSX_IMPL_CONVERT(vec_int4, vec_float4, vec_cts)
|
||||
|
||||
// converts single and double precision to unsigned word
|
||||
#if __clang_major__ > 4
|
||||
# undef vec_ctu
|
||||
#endif
|
||||
#undef vec_ctu
|
||||
VSX_REDIRECT_1RG(vec_uint4, vec_double2, vec_ctuo, __builtin_vsx_xvcvdpuxws)
|
||||
VSX_IMPL_CONVERT(vec_uint4, vec_float4, vec_ctu)
|
||||
|
||||
@@ -510,7 +479,6 @@ VSX_IMPL_CONV_EVEN_2_4(vec_uint4, vec_double2, vec_ctu, vec_ctuo)
|
||||
* changing behavior of conversion intrinsics for gcc has effect on Eigen
|
||||
* so we redefine old behavior again only on gcc, clang
|
||||
*/
|
||||
#if !defined(__clang__) || __clang_major__ > 4
|
||||
// ignoring second arg since Eigen only truncates toward zero
|
||||
# define VSX_IMPL_CONV_2VARIANT(rt, rg, fnm, fn2) \
|
||||
VSX_FINLINE(rt) fnm(const rg& a, int only_truncate) \
|
||||
@@ -526,7 +494,6 @@ VSX_IMPL_CONV_EVEN_2_4(vec_uint4, vec_double2, vec_ctu, vec_ctuo)
|
||||
// define vec_cts for converting double precision to signed doubleword
|
||||
// which isn't compatible with xlc but its okay since Eigen only uses it for gcc
|
||||
VSX_IMPL_CONV_2VARIANT(vec_dword2, vec_double2, vec_cts, vec_ctsl)
|
||||
#endif // Eigen
|
||||
|
||||
#endif // Common GCC, CLANG compatibility
|
||||
|
||||
|
||||
@@ -48,12 +48,6 @@
|
||||
namespace cv
|
||||
{
|
||||
|
||||
// On Win64 optimized versions of DFT and DCT fail the tests (fixed in VS2010)
|
||||
#if defined _MSC_VER && !defined CV_ICC && defined _M_X64 && _MSC_VER < 1600
|
||||
# pragma optimize("", off)
|
||||
# pragma warning(disable: 4748)
|
||||
#endif
|
||||
|
||||
#if IPP_VERSION_X100 >= 710
|
||||
#define USE_IPP_DFT 1
|
||||
#else
|
||||
|
||||
@@ -58,10 +58,6 @@
|
||||
# include "opencv2/core/eigen.hpp"
|
||||
#endif
|
||||
|
||||
#if defined _M_IX86 && defined _MSC_VER && _MSC_VER < 1700
|
||||
#pragma float_control(precise, on)
|
||||
#endif
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
#define HAVE_GCD
|
||||
#endif
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1600
|
||||
#if defined _MSC_VER
|
||||
#define HAVE_CONCURRENCY
|
||||
#endif
|
||||
|
||||
@@ -128,8 +128,6 @@
|
||||
#elif defined HAVE_GCD
|
||||
#include <dispatch/dispatch.h>
|
||||
#include <pthread.h>
|
||||
#elif defined WINRT && _MSC_VER < 1900
|
||||
#include <ppltasks.h>
|
||||
#elif defined HAVE_CONCURRENCY
|
||||
#include <ppl.h>
|
||||
#elif defined HAVE_PTHREADS_PF
|
||||
|
||||
@@ -519,7 +519,7 @@ CoreTLSData& getCoreTlsData();
|
||||
#if defined(BUILD_SHARED_LIBS)
|
||||
#if defined _WIN32 || defined WINCE
|
||||
#define CL_RUNTIME_EXPORT __declspec(dllexport)
|
||||
#elif defined __GNUC__ && __GNUC__ >= 4
|
||||
#elif defined __GNUC__
|
||||
#define CL_RUNTIME_EXPORT __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
#define CL_RUNTIME_EXPORT
|
||||
|
||||
@@ -869,7 +869,6 @@ TEST(Core_Allocation, alignedAllocation)
|
||||
}
|
||||
|
||||
|
||||
#if !(defined(__GNUC__) && __GNUC__ < 5) // GCC 4.8 emits: 'is_trivially_copyable' is not a member of 'std'
|
||||
TEST(Core_Types, trivially_copyable)
|
||||
{
|
||||
EXPECT_TRUE(std::is_trivially_copyable<cv::Complexd>::value);
|
||||
@@ -889,7 +888,6 @@ TEST(Core_Types, trivially_copyable_extra)
|
||||
EXPECT_TRUE(std::is_trivially_copyable<cv::TermCriteria>::value);
|
||||
EXPECT_TRUE(std::is_trivially_copyable<cv::Moments>::value);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T> class Rect_Test : public testing::Test {};
|
||||
|
||||
|
||||
@@ -100,11 +100,6 @@ CV_OperationsTest::~CV_OperationsTest() {}
|
||||
#define CHECK_DIFF(a, b) checkDiff(a, b, "(" #a ") != (" #b ") at l." STR(__LINE__))
|
||||
#define CHECK_DIFF_FLT(a, b) checkDiffF(a, b, "(" #a ") !=(eps) (" #b ") at l." STR(__LINE__))
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER < 1400
|
||||
#define MSVC_OLD 1
|
||||
#else
|
||||
#define MSVC_OLD 0
|
||||
#endif
|
||||
|
||||
template<typename _Tp> void CV_OperationsTest::TestType(Size sz, _Tp value)
|
||||
{
|
||||
@@ -295,9 +290,7 @@ bool CV_OperationsTest::TestMat()
|
||||
CHECK_DIFF(4.0 * (maskMat1 | maskMat1), maskMat4);
|
||||
CHECK_DIFF((maskMat4 | maskMat4)/4.0, maskMat1);
|
||||
|
||||
#if !MSVC_OLD
|
||||
CHECK_DIFF(2.0 * (maskMat1 * 2.0) , maskMat4);
|
||||
#endif
|
||||
CHECK_DIFF((maskMat4 / 2.0) / 2.0 , maskMat1);
|
||||
CHECK_DIFF(-(maskMat4 - maskMat5) , maskMat1);
|
||||
CHECK_DIFF(-((maskMat4 - maskMat5) * 1.0), maskMat1);
|
||||
@@ -363,7 +356,6 @@ bool CV_OperationsTest::TestMat()
|
||||
|
||||
m = maskMat1.clone(); m+=(maskMat1 * 3.0 + 1.0); CHECK_DIFF(m, maskMat5);
|
||||
m = maskMat5.clone(); m-=(maskMat1 * 3.0 + 1.0); CHECK_DIFF(m, maskMat1);
|
||||
#if !MSVC_OLD
|
||||
m = mi.clone(); m+=(3.0 * mi * mt + d1); CHECK_DIFF_FLT(m, mi + d1 * 4);
|
||||
m = mi.clone(); m-=(3.0 * mi * mt + d1); CHECK_DIFF_FLT(m, mi - d1 * 4);
|
||||
m = mi.clone(); m*=(mt * 1.0); CHECK_DIFF_FLT(m, d1);
|
||||
@@ -420,7 +412,6 @@ bool CV_OperationsTest::TestMat()
|
||||
CHECK_DIFF_FLT(mt.inv() * mt, d1);
|
||||
|
||||
CHECK_DIFF_FLT(mt.inv() * (2*mt - mt), d1);
|
||||
#endif
|
||||
}
|
||||
catch (const test_excep& e)
|
||||
{
|
||||
|
||||
@@ -93,10 +93,6 @@ endif()
|
||||
if(HAVE_CUDA)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
|
||||
endif()
|
||||
if(NOT HAVE_CXX11)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-undef) # LANG_CXX11 from protobuf files
|
||||
endif()
|
||||
|
||||
if(APPLE_FRAMEWORK)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshorten-64-to-32)
|
||||
endif()
|
||||
|
||||
@@ -55,15 +55,7 @@ enum class NearestMode {
|
||||
ROUND_PREFER_FLOOR
|
||||
};
|
||||
|
||||
#if __cplusplus < 201703L
|
||||
template<typename T>
|
||||
static T clamp(T d, T min, T max)
|
||||
{
|
||||
return std::min(std::max(d, min), max);
|
||||
}
|
||||
#else
|
||||
#define clamp std::clamp
|
||||
#endif
|
||||
using std::clamp;
|
||||
|
||||
static inline NearestMode parseNearestMode(const String& s)
|
||||
{
|
||||
|
||||
@@ -15,15 +15,7 @@ namespace cv
|
||||
namespace dnn
|
||||
{
|
||||
|
||||
#if __cplusplus < 201703L
|
||||
template<typename T>
|
||||
static T clamp(T d, T min, T max)
|
||||
{
|
||||
return std::min(std::max(d, min), max);
|
||||
}
|
||||
#else
|
||||
#define clamp std::clamp
|
||||
#endif
|
||||
using std::clamp;
|
||||
|
||||
static MatShape inferTransformLayoutShape(const MatShape& inpshape_,
|
||||
DataLayout outlayout,
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
#define __OPENCV_DNN_ONNX_SIMPLIFIER_HPP__
|
||||
#ifdef HAVE_PROTOBUF
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#include "opencv-onnx.pb.h"
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,17 +31,12 @@
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER < 1910/*MSVS 2017*/
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4503) // decorated name length exceeded, name was truncated
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#include "opencv-onnx.pb.h"
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
@@ -28,17 +28,12 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER < 1910/*MSVS 2017*/
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4503) // decorated name length exceeded, name was truncated
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#include "opencv-onnx.pb.h"
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#define INF_ENGINE_VER_MAJOR_LE(ver) (((INF_ENGINE_RELEASE) / 10000) <= ((ver) / 10000))
|
||||
#define INF_ENGINE_VER_MAJOR_EQ(ver) (((INF_ENGINE_RELEASE) / 10000) == ((ver) / 10000))
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#if defined(__GNUC__)
|
||||
//#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <openvino/pass/serialize.hpp>
|
||||
#include <openvino/pass/convert_fp32_to_fp16.hpp>
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#if defined(__GNUC__)
|
||||
//#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ Declaration of various functions which are related to Tensorflow models reading.
|
||||
#define __OPENCV_DNN_TF_IO_HPP__
|
||||
#ifdef HAVE_PROTOBUF
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
@@ -22,7 +22,7 @@ Declaration of various functions which are related to Tensorflow models reading.
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/text_format.h>
|
||||
#include <google/protobuf/io/zero_copy_stream_impl.h>
|
||||
#if defined(__GNUC__) && __GNUC__ >= 5
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
@@ -14,10 +14,8 @@ namespace cv
|
||||
|
||||
struct Random
|
||||
{
|
||||
static const uint64 default_seed = 0xffffffff;
|
||||
#if __cplusplus < 201103L
|
||||
typedef uint64 seed_type;
|
||||
#endif
|
||||
static const uint64 default_seed = 0xffffffff;
|
||||
|
||||
RNG rng;
|
||||
|
||||
|
||||
@@ -406,7 +406,7 @@ int GenericIndex<Distance>::radiusSearch(const std::vector<ElementType>& query,
|
||||
|
||||
FLANN_DISTANCE_CHECK
|
||||
|
||||
return nnIndex->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
|
||||
return nnIndex->radiusSearch(m_query,m_indices,m_dists,static_cast<float>(radius),searchParams);
|
||||
}
|
||||
|
||||
template <typename Distance>
|
||||
@@ -426,7 +426,7 @@ int GenericIndex<Distance>::radiusSearch(const Mat& query, Mat& indices, Mat& di
|
||||
|
||||
FLANN_DISTANCE_CHECK
|
||||
|
||||
return nnIndex->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
|
||||
return nnIndex->radiusSearch(m_query,m_indices,m_dists,static_cast<float>(radius),searchParams);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -502,8 +502,8 @@ public:
|
||||
::cvflann::Matrix<int> m_indices(&indices[0], 1, indices.size());
|
||||
::cvflann::Matrix<DistanceType> m_dists(&dists[0], 1, dists.size());
|
||||
|
||||
if (nnIndex_L1) return nnIndex_L1->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
|
||||
if (nnIndex_L2) return nnIndex_L2->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
|
||||
if (nnIndex_L1) return nnIndex_L1->radiusSearch(m_query,m_indices,m_dists,static_cast<float>(radius),searchParams);
|
||||
if (nnIndex_L2) return nnIndex_L2->radiusSearch(m_query,m_indices,m_dists,static_cast<float>(radius),searchParams);
|
||||
}
|
||||
|
||||
CV_DEPRECATED int radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& searchParams)
|
||||
@@ -520,8 +520,8 @@ public:
|
||||
CV_Assert(dists.isContinuous());
|
||||
::cvflann::Matrix<DistanceType> m_dists((DistanceType*)dists.ptr<DistanceType>(0), dists.rows, dists.cols);
|
||||
|
||||
if (nnIndex_L1) return nnIndex_L1->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
|
||||
if (nnIndex_L2) return nnIndex_L2->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
|
||||
if (nnIndex_L1) return nnIndex_L1->radiusSearch(m_query,m_indices,m_dists,static_cast<float>(radius),searchParams);
|
||||
if (nnIndex_L2) return nnIndex_L2->radiusSearch(m_query,m_indices,m_dists,static_cast<float>(radius),searchParams);
|
||||
}
|
||||
|
||||
CV_DEPRECATED void save(String filename)
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <cstring>
|
||||
#include <random>
|
||||
|
||||
#include "nn_index.h"
|
||||
#include "dynamic_bitset.h"
|
||||
@@ -143,7 +144,8 @@ public:
|
||||
#ifndef OPENCV_FLANN_USE_STD_RAND
|
||||
cv::randShuffle(vind_);
|
||||
#else
|
||||
std::random_shuffle(vind_.begin(), vind_.end());
|
||||
std::mt19937 std_rng(12345);
|
||||
std::shuffle(vind_.begin(), vind_.end(), std_rng);
|
||||
#endif
|
||||
|
||||
tree_roots_[i] = divideTree(vind_.data(), int(size_) );
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
//! @cond IGNORED
|
||||
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
@@ -362,7 +363,8 @@ inline LshTable<unsigned char>::LshTable(unsigned int feature_size, unsigned int
|
||||
#ifndef OPENCV_FLANN_USE_STD_RAND
|
||||
cv::randShuffle(indices);
|
||||
#else
|
||||
std::random_shuffle(indices.begin(), indices.end());
|
||||
std::mt19937 std_rng(12345);
|
||||
std::shuffle(indices.begin(), indices.end(), std_rng);
|
||||
#endif
|
||||
|
||||
// Generate a random set of order of subsignature_size_ bits
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
#include <random>
|
||||
|
||||
namespace cvflann
|
||||
{
|
||||
@@ -127,7 +128,8 @@ public:
|
||||
#ifndef OPENCV_FLANN_USE_STD_RAND
|
||||
cv::randShuffle(vals_);
|
||||
#else
|
||||
std::random_shuffle(vals_.begin(), vals_.end());
|
||||
std::mt19937 std_rng(12345);
|
||||
std::shuffle(vals_.begin(), vals_.end(), std_rng);
|
||||
#endif
|
||||
|
||||
counter_ = 0;
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
|
||||
#include <cmath>
|
||||
#include <complex>
|
||||
#if defined (_MSC_VER) && (_MSC_VER <= 1700)
|
||||
static inline double cbrt(double x) { return (double)cv::cubeRoot((float)x); };
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
void polishQuarticRoots(const double *coeffs, double *roots, int nb_roots) {
|
||||
const int iterations = 2;
|
||||
|
||||
@@ -317,10 +317,6 @@ struct MomentsInTile_SIMD<ushort, int, int64>
|
||||
#endif // CV_SIMD || CV_SIMD_SCALABLE
|
||||
|
||||
template<typename T, typename WT, typename MT>
|
||||
#if defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 9
|
||||
// Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60196
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
static void momentsInTile( const Mat& img, double* moments )
|
||||
{
|
||||
Size size = img.size();
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#include <opencv2/core/utils/configuration.private.hpp>
|
||||
#include <opencv2/core/utils/logger.hpp>
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#if defined _MSC_VER
|
||||
# pragma warning( disable: 4100 4244 4267 )
|
||||
#endif
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
#include "grfmt_png.hpp"
|
||||
#include <opencv2/core/utils/logger.hpp>
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#if defined _MSC_VER
|
||||
// interaction between '_setjmp' and C++ object destruction is non-portable
|
||||
#pragma warning( disable: 4611 )
|
||||
#pragma warning( disable: 4244 )
|
||||
|
||||
@@ -44,14 +44,6 @@
|
||||
|
||||
using namespace cv;
|
||||
|
||||
// std::isnan is a part of C++11 and it is not supported in MSVS2010/2012
|
||||
#if defined _MSC_VER && _MSC_VER < 1800 /* MSVC 2013 */
|
||||
#include <float.h>
|
||||
namespace std {
|
||||
template <typename T> bool isnan(T value) { return _isnan(value) != 0; }
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T> struct pixelInfo_
|
||||
{
|
||||
static const int channels = 1;
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__OPENCV_BUILD) && defined(__GNUC__) && __GNUC__ >= 5
|
||||
#if defined(__OPENCV_BUILD) && defined(__GNUC__)
|
||||
//#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
@@ -126,7 +126,7 @@
|
||||
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
|
||||
#endif
|
||||
#include "opencv2/ts/ts_gtest.h"
|
||||
#if defined(__OPENCV_BUILD) && defined(__GNUC__) && __GNUC__ >= 5
|
||||
#if defined(__OPENCV_BUILD) && defined(__GNUC__)
|
||||
//#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if defined(__OPENCV_BUILD) && defined(__clang__) && ((__clang_major__*100 + __clang_minor__) >= 1301)
|
||||
|
||||
@@ -60,9 +60,6 @@ using namespace cv;
|
||||
|
||||
#define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c )
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4244 4510 4610 )
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
@@ -162,12 +159,6 @@ inline static AVRational av_make_q(int num, int den)
|
||||
}
|
||||
#endif
|
||||
|
||||
// GCC 4.x compilation bug. Details: https://github.com/opencv/opencv/issues/20292
|
||||
#if (defined(__GNUC__) && __GNUC__ < 5) && !defined(__clang__)
|
||||
#undef USE_AV_HW_CODECS
|
||||
#define USE_AV_HW_CODECS 0
|
||||
#endif
|
||||
|
||||
//#define USE_AV_HW_CODECS 0
|
||||
#ifndef USE_AV_HW_CODECS
|
||||
#if LIBAVUTIL_VERSION_MAJOR >= 56 // FFMPEG 4.0+
|
||||
@@ -178,9 +169,7 @@ inline static AVRational av_make_q(int num, int den)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( default: 4244 4510 4610 )
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define CV_WARN(message)
|
||||
@@ -190,13 +179,6 @@ inline static AVRational av_make_q(int num, int den)
|
||||
|
||||
#if defined _WIN32
|
||||
#include <windows.h>
|
||||
#if defined _MSC_VER && _MSC_VER < 1900
|
||||
struct timespec
|
||||
{
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
#endif
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -14,7 +14,7 @@ extern "C"
|
||||
# define OPENCV_FFMPEG_API
|
||||
#elif defined _WIN32
|
||||
# define OPENCV_FFMPEG_API __declspec(dllexport)
|
||||
#elif defined __GNUC__ && __GNUC__ >= 4
|
||||
#elif defined __GNUC__
|
||||
# define OPENCV_FFMPEG_API __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
# define OPENCV_FFMPEG_API
|
||||
|
||||
Reference in New Issue
Block a user