node-native-win-utils 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/README.md +144 -27
  2. package/binding.gyp +18 -5
  3. package/dist/index.d.ts +146 -4
  4. package/dist/index.js +107 -3
  5. package/include/opencv2/core/affine.hpp +678 -0
  6. package/include/opencv2/core/async.hpp +105 -0
  7. package/include/opencv2/core/base.hpp +664 -0
  8. package/include/opencv2/core/bindings_utils.hpp +325 -0
  9. package/include/opencv2/core/bufferpool.hpp +40 -0
  10. package/include/opencv2/core/check.hpp +170 -0
  11. package/include/opencv2/core/core.hpp +48 -0
  12. package/include/opencv2/core/core_c.h +3128 -0
  13. package/include/opencv2/core/cuda/block.hpp +211 -0
  14. package/include/opencv2/core/cuda/border_interpolate.hpp +722 -0
  15. package/include/opencv2/core/cuda/color.hpp +309 -0
  16. package/include/opencv2/core/cuda/common.hpp +131 -0
  17. package/include/opencv2/core/cuda/datamov_utils.hpp +113 -0
  18. package/include/opencv2/core/cuda/detail/color_detail.hpp +2018 -0
  19. package/include/opencv2/core/cuda/detail/reduce.hpp +365 -0
  20. package/include/opencv2/core/cuda/detail/reduce_key_val.hpp +502 -0
  21. package/include/opencv2/core/cuda/detail/transform_detail.hpp +392 -0
  22. package/include/opencv2/core/cuda/detail/type_traits_detail.hpp +191 -0
  23. package/include/opencv2/core/cuda/detail/vec_distance_detail.hpp +121 -0
  24. package/include/opencv2/core/cuda/dynamic_smem.hpp +88 -0
  25. package/include/opencv2/core/cuda/emulation.hpp +269 -0
  26. package/include/opencv2/core/cuda/filters.hpp +293 -0
  27. package/include/opencv2/core/cuda/funcattrib.hpp +79 -0
  28. package/include/opencv2/core/cuda/functional.hpp +805 -0
  29. package/include/opencv2/core/cuda/limits.hpp +128 -0
  30. package/include/opencv2/core/cuda/reduce.hpp +209 -0
  31. package/include/opencv2/core/cuda/saturate_cast.hpp +292 -0
  32. package/include/opencv2/core/cuda/scan.hpp +258 -0
  33. package/include/opencv2/core/cuda/simd_functions.hpp +869 -0
  34. package/include/opencv2/core/cuda/transform.hpp +75 -0
  35. package/include/opencv2/core/cuda/type_traits.hpp +90 -0
  36. package/include/opencv2/core/cuda/utility.hpp +230 -0
  37. package/include/opencv2/core/cuda/vec_distance.hpp +232 -0
  38. package/include/opencv2/core/cuda/vec_math.hpp +923 -0
  39. package/include/opencv2/core/cuda/vec_traits.hpp +288 -0
  40. package/include/opencv2/core/cuda/warp.hpp +139 -0
  41. package/include/opencv2/core/cuda/warp_reduce.hpp +76 -0
  42. package/include/opencv2/core/cuda/warp_shuffle.hpp +162 -0
  43. package/include/opencv2/core/cuda.hpp +1279 -0
  44. package/include/opencv2/core/cuda.inl.hpp +763 -0
  45. package/include/opencv2/core/cuda_stream_accessor.hpp +86 -0
  46. package/include/opencv2/core/cuda_types.hpp +144 -0
  47. package/include/opencv2/core/cv_cpu_dispatch.h +381 -0
  48. package/include/opencv2/core/cv_cpu_helper.h +550 -0
  49. package/include/opencv2/core/cvdef.h +973 -0
  50. package/include/opencv2/core/cvstd.hpp +190 -0
  51. package/include/opencv2/core/cvstd.inl.hpp +197 -0
  52. package/include/opencv2/core/cvstd_wrapper.hpp +154 -0
  53. package/include/opencv2/core/detail/async_promise.hpp +71 -0
  54. package/include/opencv2/core/detail/dispatch_helper.impl.hpp +49 -0
  55. package/include/opencv2/core/detail/exception_ptr.hpp +27 -0
  56. package/include/opencv2/core/directx.hpp +184 -0
  57. package/include/opencv2/core/dualquaternion.hpp +979 -0
  58. package/include/opencv2/core/dualquaternion.inl.hpp +487 -0
  59. package/include/opencv2/core/eigen.hpp +402 -0
  60. package/include/opencv2/core/fast_math.hpp +433 -0
  61. package/include/opencv2/core/hal/hal.hpp +256 -0
  62. package/include/opencv2/core/hal/interface.h +190 -0
  63. package/include/opencv2/core/hal/intrin.hpp +939 -0
  64. package/include/opencv2/core/hal/intrin_avx.hpp +3177 -0
  65. package/include/opencv2/core/hal/intrin_avx512.hpp +3090 -0
  66. package/include/opencv2/core/hal/intrin_cpp.hpp +3321 -0
  67. package/include/opencv2/core/hal/intrin_forward.hpp +191 -0
  68. package/include/opencv2/core/hal/intrin_lasx.hpp +3236 -0
  69. package/include/opencv2/core/hal/intrin_msa.hpp +1887 -0
  70. package/include/opencv2/core/hal/intrin_neon.hpp +2610 -0
  71. package/include/opencv2/core/hal/intrin_rvv.hpp +3320 -0
  72. package/include/opencv2/core/hal/intrin_rvv071.hpp +2545 -0
  73. package/include/opencv2/core/hal/intrin_rvv_scalable.hpp +2080 -0
  74. package/include/opencv2/core/hal/intrin_sse.hpp +3467 -0
  75. package/include/opencv2/core/hal/intrin_sse_em.hpp +180 -0
  76. package/include/opencv2/core/hal/intrin_vsx.hpp +1608 -0
  77. package/include/opencv2/core/hal/intrin_wasm.hpp +2782 -0
  78. package/include/opencv2/core/hal/msa_macros.h +1558 -0
  79. package/include/opencv2/core/hal/simd_utils.impl.hpp +186 -0
  80. package/include/opencv2/core/llapi/llapi.h +102 -0
  81. package/include/opencv2/core/mat.hpp +3775 -0
  82. package/include/opencv2/core/mat.inl.hpp +3422 -0
  83. package/include/opencv2/core/matx.hpp +1536 -0
  84. package/include/opencv2/core/neon_utils.hpp +128 -0
  85. package/include/opencv2/core/ocl.hpp +917 -0
  86. package/include/opencv2/core/ocl_genbase.hpp +69 -0
  87. package/include/opencv2/core/opencl/ocl_defs.hpp +82 -0
  88. package/include/opencv2/core/opencl/opencl_info.hpp +212 -0
  89. package/include/opencv2/core/opencl/opencl_svm.hpp +81 -0
  90. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clblas.hpp +602 -0
  91. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clfft.hpp +146 -0
  92. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp +371 -0
  93. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core_wrappers.hpp +272 -0
  94. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp +62 -0
  95. package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp +42 -0
  96. package/include/opencv2/core/opencl/runtime/opencl_clblas.hpp +53 -0
  97. package/include/opencv2/core/opencl/runtime/opencl_clfft.hpp +53 -0
  98. package/include/opencv2/core/opencl/runtime/opencl_core.hpp +84 -0
  99. package/include/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp +47 -0
  100. package/include/opencv2/core/opencl/runtime/opencl_gl.hpp +53 -0
  101. package/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp +47 -0
  102. package/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp +48 -0
  103. package/include/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp +42 -0
  104. package/include/opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp +166 -0
  105. package/include/opencv2/core/opengl.hpp +733 -0
  106. package/include/opencv2/core/openvx/ovx_defs.hpp +48 -0
  107. package/include/opencv2/core/operations.hpp +610 -0
  108. package/include/opencv2/core/optim.hpp +302 -0
  109. package/include/opencv2/core/ovx.hpp +28 -0
  110. package/include/opencv2/core/parallel/backend/parallel_for.openmp.hpp +72 -0
  111. package/include/opencv2/core/parallel/backend/parallel_for.tbb.hpp +153 -0
  112. package/include/opencv2/core/parallel/parallel_backend.hpp +90 -0
  113. package/include/opencv2/core/persistence.hpp +1350 -0
  114. package/include/opencv2/core/private/cv_cpu_include_simd_declarations.hpp +30 -0
  115. package/include/opencv2/core/private.cuda.hpp +169 -0
  116. package/include/opencv2/core/private.hpp +896 -0
  117. package/include/opencv2/core/quaternion.hpp +1696 -0
  118. package/include/opencv2/core/quaternion.inl.hpp +1063 -0
  119. package/include/opencv2/core/saturate.hpp +180 -0
  120. package/include/opencv2/core/simd_intrinsics.hpp +87 -0
  121. package/include/opencv2/core/softfloat.hpp +514 -0
  122. package/include/opencv2/core/sse_utils.hpp +652 -0
  123. package/include/opencv2/core/traits.hpp +417 -0
  124. package/include/opencv2/core/types.hpp +2457 -0
  125. package/include/opencv2/core/types_c.h +2126 -0
  126. package/include/opencv2/core/utility.hpp +1229 -0
  127. package/include/opencv2/core/utils/allocator_stats.hpp +29 -0
  128. package/include/opencv2/core/utils/allocator_stats.impl.hpp +158 -0
  129. package/include/opencv2/core/utils/buffer_area.private.hpp +136 -0
  130. package/include/opencv2/core/utils/configuration.private.hpp +22 -0
  131. package/include/opencv2/core/utils/filesystem.hpp +82 -0
  132. package/include/opencv2/core/utils/filesystem.private.hpp +66 -0
  133. package/include/opencv2/core/utils/fp_control.private.hpp +29 -0
  134. package/include/opencv2/core/utils/fp_control_utils.hpp +69 -0
  135. package/include/opencv2/core/utils/instrumentation.hpp +125 -0
  136. package/include/opencv2/core/utils/lock.private.hpp +119 -0
  137. package/include/opencv2/core/utils/logger.defines.hpp +42 -0
  138. package/include/opencv2/core/utils/logger.hpp +218 -0
  139. package/include/opencv2/core/utils/logtag.hpp +28 -0
  140. package/include/opencv2/core/utils/plugin_loader.private.hpp +165 -0
  141. package/include/opencv2/core/utils/tls.hpp +235 -0
  142. package/include/opencv2/core/utils/trace.hpp +252 -0
  143. package/include/opencv2/core/utils/trace.private.hpp +421 -0
  144. package/include/opencv2/core/va_intel.hpp +75 -0
  145. package/include/opencv2/core/version.hpp +26 -0
  146. package/include/opencv2/core/vsx_utils.hpp +1047 -0
  147. package/include/opencv2/core.hpp +3365 -0
  148. package/include/opencv2/imgcodecs/imgcodecs.hpp +48 -0
  149. package/include/opencv2/imgcodecs/imgcodecs_c.h +1 -0
  150. package/include/opencv2/imgcodecs/ios.h +59 -0
  151. package/include/opencv2/imgcodecs/legacy/constants_c.h +54 -0
  152. package/include/opencv2/imgcodecs/macosx.h +20 -0
  153. package/include/opencv2/imgcodecs.hpp +407 -0
  154. package/include/opencv2/imgproc/bindings.hpp +34 -0
  155. package/include/opencv2/imgproc/detail/gcgraph.hpp +395 -0
  156. package/include/opencv2/imgproc/hal/hal.hpp +246 -0
  157. package/include/opencv2/imgproc/hal/interface.h +46 -0
  158. package/include/opencv2/imgproc/imgproc.hpp +48 -0
  159. package/include/opencv2/imgproc/imgproc_c.h +1177 -0
  160. package/include/opencv2/imgproc/segmentation.hpp +141 -0
  161. package/include/opencv2/imgproc/types_c.h +659 -0
  162. package/include/opencv2/imgproc.hpp +5035 -0
  163. package/include/opencv2/opencv_modules.hpp +17 -0
  164. package/libs/libjpeg-turbo.lib +0 -0
  165. package/libs/libpng.lib +0 -0
  166. package/libs/opencv_core470.lib +0 -0
  167. package/libs/opencv_imgcodecs470.lib +0 -0
  168. package/libs/opencv_imgproc470.lib +0 -0
  169. package/libs/zlib.lib +0 -0
  170. package/package.json +14 -3
  171. package/prebuilds/win32-x64/node.napi.node +0 -0
  172. package/src/cpp/capturewindow.cpp +36 -46
  173. package/src/cpp/main.cpp +10 -2
  174. package/src/cpp/opencv.cpp +425 -0
@@ -0,0 +1,235 @@
1
+ // This file is part of OpenCV project.
2
+ // It is subject to the license terms in the LICENSE file found in the top-level directory
3
+ // of this distribution and at http://opencv.org/license.html.
4
+
5
+ #ifndef OPENCV_UTILS_TLS_HPP
6
+ #define OPENCV_UTILS_TLS_HPP
7
+
8
+ #ifndef OPENCV_CORE_UTILITY_H
9
+ #error "tls.hpp must be included after opencv2/core/utility.hpp or opencv2/core.hpp"
10
+ #endif
11
+
12
+ namespace cv {
13
+
14
+ //! @addtogroup core_utils
15
+ //! @{
16
+
17
+ namespace details { class TlsStorage; }
18
+
19
+ /** TLS container base implementation
20
+ *
21
+ * Don't use directly.
22
+ *
23
+ * @sa TLSData, TLSDataAccumulator templates
24
+ */
25
+ class CV_EXPORTS TLSDataContainer
26
+ {
27
+ protected:
28
+ TLSDataContainer();
29
+ virtual ~TLSDataContainer();
30
+
31
+ /// @deprecated use detachData() instead
32
+ void gatherData(std::vector<void*> &data) const;
33
+ /// get TLS data and detach all data from threads (similar to cleanup() call)
34
+ void detachData(std::vector<void*>& data);
35
+
36
+ void* getData() const;
37
+ void release();
38
+
39
+ protected:
40
+ virtual void* createDataInstance() const = 0;
41
+ virtual void deleteDataInstance(void* pData) const = 0;
42
+
43
+ private:
44
+ int key_;
45
+
46
+ friend class cv::details::TlsStorage; // core/src/system.cpp
47
+
48
+ public:
49
+ void cleanup(); //!< Release created TLS data container objects. It is similar to release() call, but it keeps TLS container valid.
50
+
51
+ private:
52
+ // Disable copy/assign (noncopyable pattern)
53
+ TLSDataContainer(TLSDataContainer &) = delete;
54
+ TLSDataContainer& operator =(const TLSDataContainer &) = delete;
55
+ };
56
+
57
+
58
+ /** @brief Simple TLS data class
59
+ *
60
+ * @sa TLSDataAccumulator
61
+ */
62
+ template <typename T>
63
+ class TLSData : protected TLSDataContainer
64
+ {
65
+ public:
66
+ inline TLSData() {}
67
+ inline ~TLSData() { release(); }
68
+
69
+ inline T* get() const { return (T*)getData(); } //!< Get data associated with key
70
+ inline T& getRef() const { T* ptr = (T*)getData(); CV_DbgAssert(ptr); return *ptr; } //!< Get data associated with key
71
+
72
+ /// Release associated thread data
73
+ inline void cleanup()
74
+ {
75
+ TLSDataContainer::cleanup();
76
+ }
77
+
78
+ protected:
79
+ /// Wrapper to allocate data by template
80
+ virtual void* createDataInstance() const CV_OVERRIDE { return new T; }
81
+ /// Wrapper to release data by template
82
+ virtual void deleteDataInstance(void* pData) const CV_OVERRIDE { delete (T*)pData; }
83
+ };
84
+
85
+
86
+ /// TLS data accumulator with gathering methods
87
+ template <typename T>
88
+ class TLSDataAccumulator : public TLSData<T>
89
+ {
90
+ mutable cv::Mutex mutex;
91
+ mutable std::vector<T*> dataFromTerminatedThreads;
92
+ std::vector<T*> detachedData;
93
+ bool cleanupMode;
94
+ public:
95
+ TLSDataAccumulator() : cleanupMode(false) {}
96
+ ~TLSDataAccumulator()
97
+ {
98
+ release();
99
+ }
100
+
101
+ /** @brief Get data from all threads
102
+ * @deprecated replaced by detachData()
103
+ *
104
+ * Lifetime of vector data is valid until next detachData()/cleanup()/release() calls
105
+ *
106
+ * @param[out] data result buffer (should be empty)
107
+ */
108
+ void gather(std::vector<T*> &data) const
109
+ {
110
+ CV_Assert(cleanupMode == false); // state is not valid
111
+ CV_Assert(data.empty());
112
+ {
113
+ std::vector<void*> &dataVoid = reinterpret_cast<std::vector<void*>&>(data);
114
+ TLSDataContainer::gatherData(dataVoid);
115
+ }
116
+ {
117
+ AutoLock lock(mutex);
118
+ data.reserve(data.size() + dataFromTerminatedThreads.size());
119
+ for (typename std::vector<T*>::const_iterator i = dataFromTerminatedThreads.begin(); i != dataFromTerminatedThreads.end(); ++i)
120
+ {
121
+ data.push_back((T*)*i);
122
+ }
123
+ }
124
+ }
125
+
126
+ /** @brief Get and detach data from all threads
127
+ *
128
+ * Call cleanupDetachedData() when returned vector is not needed anymore.
129
+ *
130
+ * @return Vector with associated data. Content is preserved (including lifetime of attached data pointers) until next detachData()/cleanupDetachedData()/cleanup()/release() calls
131
+ */
132
+ std::vector<T*>& detachData()
133
+ {
134
+ CV_Assert(cleanupMode == false); // state is not valid
135
+ std::vector<void*> dataVoid;
136
+ {
137
+ TLSDataContainer::detachData(dataVoid);
138
+ }
139
+ {
140
+ AutoLock lock(mutex);
141
+ detachedData.reserve(dataVoid.size() + dataFromTerminatedThreads.size());
142
+ for (typename std::vector<T*>::const_iterator i = dataFromTerminatedThreads.begin(); i != dataFromTerminatedThreads.end(); ++i)
143
+ {
144
+ detachedData.push_back((T*)*i);
145
+ }
146
+ dataFromTerminatedThreads.clear();
147
+ for (typename std::vector<void*>::const_iterator i = dataVoid.begin(); i != dataVoid.end(); ++i)
148
+ {
149
+ detachedData.push_back((T*)(void*)*i);
150
+ }
151
+ }
152
+ dataVoid.clear();
153
+ return detachedData;
154
+ }
155
+
156
+ /// Release associated thread data returned by detachData() call
157
+ void cleanupDetachedData()
158
+ {
159
+ AutoLock lock(mutex);
160
+ cleanupMode = true;
161
+ _cleanupDetachedData();
162
+ cleanupMode = false;
163
+ }
164
+
165
+ /// Release associated thread data
166
+ void cleanup()
167
+ {
168
+ cleanupMode = true;
169
+ TLSDataContainer::cleanup();
170
+
171
+ AutoLock lock(mutex);
172
+ _cleanupDetachedData();
173
+ _cleanupTerminatedData();
174
+ cleanupMode = false;
175
+ }
176
+
177
+ /// Release associated thread data and free TLS key
178
+ void release()
179
+ {
180
+ cleanupMode = true;
181
+ TLSDataContainer::release();
182
+ {
183
+ AutoLock lock(mutex);
184
+ _cleanupDetachedData();
185
+ _cleanupTerminatedData();
186
+ }
187
+ }
188
+
189
+ protected:
190
+ // synchronized
191
+ void _cleanupDetachedData()
192
+ {
193
+ for (typename std::vector<T*>::iterator i = detachedData.begin(); i != detachedData.end(); ++i)
194
+ {
195
+ deleteDataInstance((T*)*i);
196
+ }
197
+ detachedData.clear();
198
+ }
199
+
200
+ // synchronized
201
+ void _cleanupTerminatedData()
202
+ {
203
+ for (typename std::vector<T*>::iterator i = dataFromTerminatedThreads.begin(); i != dataFromTerminatedThreads.end(); ++i)
204
+ {
205
+ deleteDataInstance((T*)*i);
206
+ }
207
+ dataFromTerminatedThreads.clear();
208
+ }
209
+
210
+ protected:
211
+ virtual void* createDataInstance() const CV_OVERRIDE
212
+ {
213
+ // Note: we can collect all allocated data here, but this would require raced mutex locks
214
+ return new T;
215
+ }
216
+ virtual void deleteDataInstance(void* pData) const CV_OVERRIDE
217
+ {
218
+ if (cleanupMode)
219
+ {
220
+ delete (T*)pData;
221
+ }
222
+ else
223
+ {
224
+ AutoLock lock(mutex);
225
+ dataFromTerminatedThreads.push_back((T*)pData);
226
+ }
227
+ }
228
+ };
229
+
230
+
231
+ //! @}
232
+
233
+ } // namespace
234
+
235
+ #endif // OPENCV_UTILS_TLS_HPP
@@ -0,0 +1,252 @@
1
+ // This file is part of OpenCV project.
2
+ // It is subject to the license terms in the LICENSE file found in the top-level directory
3
+ // of this distribution and at http://opencv.org/license.html.
4
+
5
+ #ifndef OPENCV_TRACE_HPP
6
+ #define OPENCV_TRACE_HPP
7
+
8
+ #include <opencv2/core/cvdef.h>
9
+
10
+ namespace cv {
11
+ namespace utils {
12
+ namespace trace {
13
+
14
+ //! @addtogroup core_logging
15
+ //! @{
16
+
17
+ //! Macro to trace function
18
+ #define CV_TRACE_FUNCTION()
19
+
20
+ #define CV_TRACE_FUNCTION_SKIP_NESTED()
21
+
22
+ //! Trace code scope.
23
+ //! @note Dynamic names are not supported in this macro (on stack or heap). Use string literals here only, like "initialize".
24
+ #define CV_TRACE_REGION(name_as_static_string_literal)
25
+ //! mark completed of the current opened region and create new one
26
+ //! @note Dynamic names are not supported in this macro (on stack or heap). Use string literals here only, like "step1".
27
+ #define CV_TRACE_REGION_NEXT(name_as_static_string_literal)
28
+
29
+ //! Macro to trace argument value
30
+ #define CV_TRACE_ARG(arg_id)
31
+
32
+ //! Macro to trace argument value (expanded version)
33
+ #define CV_TRACE_ARG_VALUE(arg_id, arg_name, value)
34
+
35
+ //! @cond IGNORED
36
+ #define CV_TRACE_NS cv::utils::trace
37
+
38
+ #if !defined(OPENCV_DISABLE_TRACE) && defined(__EMSCRIPTEN__)
39
+ #define OPENCV_DISABLE_TRACE 1
40
+ #endif
41
+
42
+ namespace details {
43
+
44
+ #ifndef __OPENCV_TRACE
45
+ # if defined __OPENCV_BUILD && !defined __OPENCV_TESTS && !defined __OPENCV_APPS
46
+ # define __OPENCV_TRACE 1
47
+ # else
48
+ # define __OPENCV_TRACE 0
49
+ # endif
50
+ #endif
51
+
52
+ #ifndef CV_TRACE_FILENAME
53
+ # define CV_TRACE_FILENAME __FILE__
54
+ #endif
55
+
56
+ #ifndef CV__TRACE_FUNCTION
57
+ # if defined _MSC_VER
58
+ # define CV__TRACE_FUNCTION __FUNCSIG__
59
+ # elif defined __GNUC__
60
+ # define CV__TRACE_FUNCTION __PRETTY_FUNCTION__
61
+ # else
62
+ # define CV__TRACE_FUNCTION "<unknown>"
63
+ # endif
64
+ #endif
65
+
66
+ //! Thread-local instance (usually allocated on stack)
67
+ class CV_EXPORTS Region
68
+ {
69
+ public:
70
+ struct LocationExtraData;
71
+ struct LocationStaticStorage
72
+ {
73
+ LocationExtraData** ppExtra; //< implementation specific data
74
+ const char* name; //< region name (function name or other custom name)
75
+ const char* filename; //< source code filename
76
+ int line; //< source code line
77
+ int flags; //< flags (implementation code path: Plain, IPP, OpenCL)
78
+ };
79
+
80
+ Region(const LocationStaticStorage& location);
81
+ inline ~Region()
82
+ {
83
+ if (implFlags != 0)
84
+ destroy();
85
+ CV_DbgAssert(implFlags == 0);
86
+ CV_DbgAssert(pImpl == NULL);
87
+ }
88
+
89
+ class Impl;
90
+ Impl* pImpl; // NULL if current region is not active
91
+ int implFlags; // see RegionFlag, 0 if region is ignored
92
+
93
+ bool isActive() const { return pImpl != NULL; }
94
+
95
+ void destroy();
96
+ private:
97
+ Region(const Region&); // disabled
98
+ Region& operator= (const Region&); // disabled
99
+ };
100
+
101
+ //! Specify region flags
102
+ enum RegionLocationFlag {
103
+ REGION_FLAG_FUNCTION = (1 << 0), //< region is function (=1) / nested named region (=0)
104
+ REGION_FLAG_APP_CODE = (1 << 1), //< region is Application code (=1) / OpenCV library code (=0)
105
+ REGION_FLAG_SKIP_NESTED = (1 << 2), //< avoid processing of nested regions
106
+
107
+ REGION_FLAG_IMPL_IPP = (1 << 16), //< region is part of IPP code path
108
+ REGION_FLAG_IMPL_OPENCL = (2 << 16), //< region is part of OpenCL code path
109
+ REGION_FLAG_IMPL_OPENVX = (3 << 16), //< region is part of OpenVX code path
110
+
111
+ REGION_FLAG_IMPL_MASK = (15 << 16),
112
+
113
+ REGION_FLAG_REGION_FORCE = (1 << 30),
114
+ REGION_FLAG_REGION_NEXT = (1 << 31), //< close previous region (see #CV_TRACE_REGION_NEXT macro)
115
+
116
+ ENUM_REGION_FLAG_FORCE_INT = INT_MAX
117
+ };
118
+
119
+ struct CV_EXPORTS TraceArg {
120
+ public:
121
+ struct ExtraData;
122
+ ExtraData** ppExtra;
123
+ const char* name;
124
+ int flags;
125
+ };
126
+ /** @brief Add meta information to current region (function)
127
+ * See CV_TRACE_ARG macro
128
+ * @param arg argument information structure (global static cache)
129
+ * @param value argument value (can by dynamic string literal in case of string, static allocation is not required)
130
+ */
131
+ CV_EXPORTS void traceArg(const TraceArg& arg, const char* value);
132
+ //! @overload
133
+ CV_EXPORTS void traceArg(const TraceArg& arg, int value);
134
+ //! @overload
135
+ CV_EXPORTS void traceArg(const TraceArg& arg, int64 value);
136
+ //! @overload
137
+ CV_EXPORTS void traceArg(const TraceArg& arg, double value);
138
+
139
+ #define CV__TRACE_LOCATION_VARNAME(loc_id) CVAUX_CONCAT(CVAUX_CONCAT(__cv_trace_location_, loc_id), __LINE__)
140
+ #define CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id) CVAUX_CONCAT(CVAUX_CONCAT(__cv_trace_location_extra_, loc_id) , __LINE__)
141
+
142
+ #define CV__TRACE_DEFINE_LOCATION_(loc_id, name, flags) \
143
+ static CV_TRACE_NS::details::Region::LocationExtraData* CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id) = 0; \
144
+ static const CV_TRACE_NS::details::Region::LocationStaticStorage \
145
+ CV__TRACE_LOCATION_VARNAME(loc_id) = { &(CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id)), name, CV_TRACE_FILENAME, __LINE__, flags};
146
+
147
+ #define CV__TRACE_DEFINE_LOCATION_FN(name, flags) CV__TRACE_DEFINE_LOCATION_(fn, name, ((flags) | CV_TRACE_NS::details::REGION_FLAG_FUNCTION))
148
+
149
+
150
+ #define CV__TRACE_OPENCV_FUNCTION() \
151
+ CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, 0); \
152
+ const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
153
+
154
+ #define CV__TRACE_OPENCV_FUNCTION_NAME(name) \
155
+ CV__TRACE_DEFINE_LOCATION_FN(name, 0); \
156
+ const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
157
+
158
+ #define CV__TRACE_APP_FUNCTION() \
159
+ CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \
160
+ const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
161
+
162
+ #define CV__TRACE_APP_FUNCTION_NAME(name) \
163
+ CV__TRACE_DEFINE_LOCATION_FN(name, CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \
164
+ const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
165
+
166
+
167
+ #define CV__TRACE_OPENCV_FUNCTION_SKIP_NESTED() \
168
+ CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED); \
169
+ const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
170
+
171
+ #define CV__TRACE_OPENCV_FUNCTION_NAME_SKIP_NESTED(name) \
172
+ CV__TRACE_DEFINE_LOCATION_FN(name, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED); \
173
+ const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
174
+
175
+ #define CV__TRACE_APP_FUNCTION_SKIP_NESTED() \
176
+ CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED | CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \
177
+ const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
178
+
179
+
180
+ #define CV__TRACE_REGION_(name_as_static_string_literal, flags) \
181
+ CV__TRACE_DEFINE_LOCATION_(region, name_as_static_string_literal, flags); \
182
+ CV_TRACE_NS::details::Region CVAUX_CONCAT(__region_, __LINE__)(CV__TRACE_LOCATION_VARNAME(region));
183
+
184
+ #define CV__TRACE_REGION(name_as_static_string_literal) CV__TRACE_REGION_(name_as_static_string_literal, 0)
185
+ #define CV__TRACE_REGION_NEXT(name_as_static_string_literal) CV__TRACE_REGION_(name_as_static_string_literal, CV_TRACE_NS::details::REGION_FLAG_REGION_NEXT)
186
+
187
+ #define CV__TRACE_ARG_VARNAME(arg_id) CVAUX_CONCAT(__cv_trace_arg_ ## arg_id, __LINE__)
188
+ #define CV__TRACE_ARG_EXTRA_VARNAME(arg_id) CVAUX_CONCAT(__cv_trace_arg_extra_ ## arg_id, __LINE__)
189
+
190
+ #define CV__TRACE_DEFINE_ARG_(arg_id, name, flags) \
191
+ static CV_TRACE_NS::details::TraceArg::ExtraData* CV__TRACE_ARG_EXTRA_VARNAME(arg_id) = 0; \
192
+ static const CV_TRACE_NS::details::TraceArg \
193
+ CV__TRACE_ARG_VARNAME(arg_id) = { &(CV__TRACE_ARG_EXTRA_VARNAME(arg_id)), name, flags };
194
+
195
+ #define CV__TRACE_ARG_VALUE(arg_id, arg_name, value) \
196
+ CV__TRACE_DEFINE_ARG_(arg_id, arg_name, 0); \
197
+ CV_TRACE_NS::details::traceArg((CV__TRACE_ARG_VARNAME(arg_id)), value);
198
+
199
+ #define CV__TRACE_ARG(arg_id) CV_TRACE_ARG_VALUE(arg_id, #arg_id, (arg_id))
200
+
201
+ } // namespace
202
+
203
+ #ifndef OPENCV_DISABLE_TRACE
204
+ #undef CV_TRACE_FUNCTION
205
+ #undef CV_TRACE_FUNCTION_SKIP_NESTED
206
+ #if __OPENCV_TRACE
207
+ #define CV_TRACE_FUNCTION CV__TRACE_OPENCV_FUNCTION
208
+ #define CV_TRACE_FUNCTION_SKIP_NESTED CV__TRACE_OPENCV_FUNCTION_SKIP_NESTED
209
+ #else
210
+ #define CV_TRACE_FUNCTION CV__TRACE_APP_FUNCTION
211
+ #define CV_TRACE_FUNCTION_SKIP_NESTED CV__TRACE_APP_FUNCTION_SKIP_NESTED
212
+ #endif
213
+
214
+ #undef CV_TRACE_REGION
215
+ #define CV_TRACE_REGION CV__TRACE_REGION
216
+
217
+ #undef CV_TRACE_REGION_NEXT
218
+ #define CV_TRACE_REGION_NEXT CV__TRACE_REGION_NEXT
219
+
220
+ #undef CV_TRACE_ARG_VALUE
221
+ #define CV_TRACE_ARG_VALUE(arg_id, arg_name, value) \
222
+ if (__region_fn.isActive()) \
223
+ { \
224
+ CV__TRACE_ARG_VALUE(arg_id, arg_name, value); \
225
+ }
226
+
227
+ #undef CV_TRACE_ARG
228
+ #define CV_TRACE_ARG CV__TRACE_ARG
229
+
230
+ #endif // OPENCV_DISABLE_TRACE
231
+
232
+ #ifdef OPENCV_TRACE_VERBOSE
233
+ #define CV_TRACE_FUNCTION_VERBOSE CV_TRACE_FUNCTION
234
+ #define CV_TRACE_REGION_VERBOSE CV_TRACE_REGION
235
+ #define CV_TRACE_REGION_NEXT_VERBOSE CV_TRACE_REGION_NEXT
236
+ #define CV_TRACE_ARG_VALUE_VERBOSE CV_TRACE_ARG_VALUE
237
+ #define CV_TRACE_ARG_VERBOSE CV_TRACE_ARG
238
+ #else
239
+ #define CV_TRACE_FUNCTION_VERBOSE(...)
240
+ #define CV_TRACE_REGION_VERBOSE(...)
241
+ #define CV_TRACE_REGION_NEXT_VERBOSE(...)
242
+ #define CV_TRACE_ARG_VALUE_VERBOSE(...)
243
+ #define CV_TRACE_ARG_VERBOSE(...)
244
+ #endif
245
+
246
+ //! @endcond
247
+
248
+ //! @}
249
+
250
+ }}} // namespace
251
+
252
+ #endif // OPENCV_TRACE_HPP