mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 07:13:02 +04:00
Merge pull request #23736 from seanm:c++11-simplifications
Removed all pre-C++11 code, workarounds, and branches #23736 This removes a bunch of pre-C++11 workrarounds that are no longer necessary as C++11 is now required. It is a nice clean up and simplification. * No longer unconditionally #include <array> in cvdef.h, include explicitly where needed * Removed deprecated CV_NODISCARD, already unused in the codebase * Removed some pre-C++11 workarounds, and simplified some backwards compat defines * Removed CV_CXX_STD_ARRAY * Removed CV_CXX_MOVE_SEMANTICS and CV_CXX_MOVE * Removed all tests of CV_CXX11, now assume it's always true. This allowed removing a lot of dead code. * Updated some documentation consequently. * Removed all tests of CV_CXX11, now assume it's always true * Fixed links. --------- Co-authored-by: Maksim Shabunin <maksim.shabunin@gmail.com> Co-authored-by: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
This commit is contained in:
@@ -305,9 +305,7 @@ DECLARE_CV_CPUID_X86
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined CV_CXX11
|
||||
#include <chrono>
|
||||
#endif
|
||||
#include <chrono>
|
||||
|
||||
namespace cv
|
||||
{
|
||||
@@ -909,50 +907,15 @@ bool useOptimized(void)
|
||||
|
||||
int64 getTickCount(void)
|
||||
{
|
||||
#if defined CV_CXX11
|
||||
std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
|
||||
return (int64)now.time_since_epoch().count();
|
||||
#elif defined _WIN32 || defined WINCE
|
||||
LARGE_INTEGER counter;
|
||||
QueryPerformanceCounter( &counter );
|
||||
return (int64)counter.QuadPart;
|
||||
#elif defined __MACH__ && defined __APPLE__
|
||||
return (int64)mach_absolute_time();
|
||||
#elif defined __unix__
|
||||
struct timespec tp;
|
||||
clock_gettime(CLOCK_MONOTONIC, &tp);
|
||||
return (int64)tp.tv_sec*1000000000 + tp.tv_nsec;
|
||||
#else
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
return (int64)tv.tv_sec*1000000 + tv.tv_usec;
|
||||
#endif
|
||||
}
|
||||
|
||||
double getTickFrequency(void)
|
||||
{
|
||||
#if defined CV_CXX11
|
||||
using clock_period_t = std::chrono::steady_clock::duration::period;
|
||||
double clock_freq = clock_period_t::den / clock_period_t::num;
|
||||
return clock_freq;
|
||||
#elif defined _WIN32 || defined WINCE
|
||||
LARGE_INTEGER freq;
|
||||
QueryPerformanceFrequency(&freq);
|
||||
return (double)freq.QuadPart;
|
||||
#elif defined __MACH__ && defined __APPLE__
|
||||
static double freq = 0;
|
||||
if( freq == 0 )
|
||||
{
|
||||
mach_timebase_info_data_t sTimebaseInfo;
|
||||
mach_timebase_info(&sTimebaseInfo);
|
||||
freq = sTimebaseInfo.denom*1e9/sTimebaseInfo.numer;
|
||||
}
|
||||
return freq;
|
||||
#elif defined __unix__
|
||||
return 1e9;
|
||||
#else
|
||||
return 1e6;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined __GNUC__ && (defined __i386__ || defined __x86_64__ || defined __ppc__)
|
||||
|
||||
Reference in New Issue
Block a user