mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -3142,12 +3142,16 @@ public:
|
||||
|
||||
/** @brief Stores algorithm parameters in a file storage
|
||||
*/
|
||||
virtual void write(FileStorage& fs) const { CV_UNUSED(fs); }
|
||||
CV_WRAP virtual void write(FileStorage& fs) const { CV_UNUSED(fs); }
|
||||
|
||||
/** @brief simplified API for language bindings
|
||||
/**
|
||||
* @overload
|
||||
*/
|
||||
CV_WRAP void write(const Ptr<FileStorage>& fs, const String& name = String()) const;
|
||||
CV_WRAP void write(FileStorage& fs, const String& name) const;
|
||||
#if CV_VERSION_MAJOR < 5
|
||||
/** @deprecated */
|
||||
void write(const Ptr<FileStorage>& fs, const String& name = String()) const;
|
||||
#endif
|
||||
|
||||
/** @brief Reads algorithm parameters from a file storage
|
||||
*/
|
||||
|
||||
@@ -232,6 +232,17 @@ String dumpVec2i(const cv::Vec2i value = cv::Vec2i(42, 24)) {
|
||||
return format("Vec2i(%d, %d)", value[0], value[1]);
|
||||
}
|
||||
|
||||
struct CV_EXPORTS_W_SIMPLE ClassWithKeywordProperties {
|
||||
CV_PROP_RW int lambda;
|
||||
CV_PROP int except;
|
||||
|
||||
CV_WRAP explicit ClassWithKeywordProperties(int lambda_arg = 24, int except_arg = 42)
|
||||
{
|
||||
lambda = lambda_arg;
|
||||
except = except_arg;
|
||||
}
|
||||
};
|
||||
|
||||
namespace nested {
|
||||
CV_WRAP static inline bool testEchoBooleanFunction(bool flag) {
|
||||
return flag;
|
||||
|
||||
@@ -55,19 +55,27 @@ Algorithm::~Algorithm()
|
||||
CV_TRACE_FUNCTION();
|
||||
}
|
||||
|
||||
void Algorithm::write(const Ptr<FileStorage>& fs, const String& name) const
|
||||
void Algorithm::write(FileStorage& fs, const String& name) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
if(name.empty())
|
||||
{
|
||||
write(*fs);
|
||||
write(fs);
|
||||
return;
|
||||
}
|
||||
*fs << name << "{";
|
||||
write(*fs);
|
||||
*fs << "}";
|
||||
fs << name << "{";
|
||||
write(fs);
|
||||
fs << "}";
|
||||
}
|
||||
|
||||
#if CV_VERSION_MAJOR < 5
|
||||
void Algorithm::write(const Ptr<FileStorage>& fs, const String& name) const
|
||||
{
|
||||
CV_Assert(fs);
|
||||
write(*fs, name);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Algorithm::save(const String& filename) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
@@ -40,11 +40,14 @@ DECLARE_CV_PAUSE
|
||||
#endif
|
||||
#ifndef CV_PAUSE
|
||||
# if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
|
||||
# include <x86intrin.h> /* for __rdtsc */
|
||||
# if !defined(__SSE2__)
|
||||
static inline void cv_non_sse_mm_pause() { __asm__ __volatile__ ("rep; nop"); }
|
||||
# define _mm_pause cv_non_sse_mm_pause
|
||||
# endif
|
||||
# define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { _mm_pause(); } } while (0)
|
||||
// 5 * v is meants for backward compatibility: with pre-Skylake CPUs, _mm_pause took 4 or 5 cycles.
|
||||
// With post-Skylake CPUs, _mm_pause takes 140 cycles.
|
||||
# define CV_PAUSE(v) do { const uint64_t __delay = 5 * v; uint64_t __init = __rdtsc(); do { _mm_pause(); } while ((__rdtsc() - __init) < __delay); } while (0)
|
||||
# elif defined __GNUC__ && defined __aarch64__
|
||||
# define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { asm volatile("yield" ::: "memory"); } } while (0)
|
||||
# elif defined __GNUC__ && defined __arm__
|
||||
|
||||
Reference in New Issue
Block a user