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,805 @@
1
+ /*M///////////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4
+ //
5
+ // By downloading, copying, installing or using the software you agree to this license.
6
+ // If you do not agree to this license, do not download, install,
7
+ // copy or use the software.
8
+ //
9
+ //
10
+ // License Agreement
11
+ // For Open Source Computer Vision Library
12
+ //
13
+ // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14
+ // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15
+ // Third party copyrights are property of their respective owners.
16
+ //
17
+ // Redistribution and use in source and binary forms, with or without modification,
18
+ // are permitted provided that the following conditions are met:
19
+ //
20
+ // * Redistribution's of source code must retain the above copyright notice,
21
+ // this list of conditions and the following disclaimer.
22
+ //
23
+ // * Redistribution's in binary form must reproduce the above copyright notice,
24
+ // this list of conditions and the following disclaimer in the documentation
25
+ // and/or other materials provided with the distribution.
26
+ //
27
+ // * The name of the copyright holders may not be used to endorse or promote products
28
+ // derived from this software without specific prior written permission.
29
+ //
30
+ // This software is provided by the copyright holders and contributors "as is" and
31
+ // any express or implied warranties, including, but not limited to, the implied
32
+ // warranties of merchantability and fitness for a particular purpose are disclaimed.
33
+ // In no event shall the Intel Corporation or contributors be liable for any direct,
34
+ // indirect, incidental, special, exemplary, or consequential damages
35
+ // (including, but not limited to, procurement of substitute goods or services;
36
+ // loss of use, data, or profits; or business interruption) however caused
37
+ // and on any theory of liability, whether in contract, strict liability,
38
+ // or tort (including negligence or otherwise) arising in any way out of
39
+ // the use of this software, even if advised of the possibility of such damage.
40
+ //
41
+ //M*/
42
+
43
+ #ifndef OPENCV_CUDA_FUNCTIONAL_HPP
44
+ #define OPENCV_CUDA_FUNCTIONAL_HPP
45
+
46
+ #include <functional>
47
+ #include "saturate_cast.hpp"
48
+ #include "vec_traits.hpp"
49
+ #include "type_traits.hpp"
50
+
51
+ /** @file
52
+ * @deprecated Use @ref cudev instead.
53
+ */
54
+
55
+ //! @cond IGNORED
56
+
57
+ namespace cv { namespace cuda { namespace device
58
+ {
59
+ // Function Objects
60
+ template<typename Argument, typename Result> struct unary_function
61
+ {
62
+ typedef Argument argument_type;
63
+ typedef Result result_type;
64
+ };
65
+ template<typename Argument1, typename Argument2, typename Result> struct binary_function
66
+ {
67
+ typedef Argument1 first_argument_type;
68
+ typedef Argument2 second_argument_type;
69
+ typedef Result result_type;
70
+ };
71
+
72
+ // Arithmetic Operations
73
+ template <typename T> struct plus : binary_function<T, T, T>
74
+ {
75
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,
76
+ typename TypeTraits<T>::ParameterType b) const
77
+ {
78
+ return a + b;
79
+ }
80
+ __host__ __device__ __forceinline__ plus() {}
81
+ __host__ __device__ __forceinline__ plus(const plus&) {}
82
+ };
83
+
84
+ template <typename T> struct minus : binary_function<T, T, T>
85
+ {
86
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,
87
+ typename TypeTraits<T>::ParameterType b) const
88
+ {
89
+ return a - b;
90
+ }
91
+ __host__ __device__ __forceinline__ minus() {}
92
+ __host__ __device__ __forceinline__ minus(const minus&) {}
93
+ };
94
+
95
+ template <typename T> struct multiplies : binary_function<T, T, T>
96
+ {
97
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,
98
+ typename TypeTraits<T>::ParameterType b) const
99
+ {
100
+ return a * b;
101
+ }
102
+ __host__ __device__ __forceinline__ multiplies() {}
103
+ __host__ __device__ __forceinline__ multiplies(const multiplies&) {}
104
+ };
105
+
106
+ template <typename T> struct divides : binary_function<T, T, T>
107
+ {
108
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,
109
+ typename TypeTraits<T>::ParameterType b) const
110
+ {
111
+ return a / b;
112
+ }
113
+ __host__ __device__ __forceinline__ divides() {}
114
+ __host__ __device__ __forceinline__ divides(const divides&) {}
115
+ };
116
+
117
+ template <typename T> struct modulus : binary_function<T, T, T>
118
+ {
119
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,
120
+ typename TypeTraits<T>::ParameterType b) const
121
+ {
122
+ return a % b;
123
+ }
124
+ __host__ __device__ __forceinline__ modulus() {}
125
+ __host__ __device__ __forceinline__ modulus(const modulus&) {}
126
+ };
127
+
128
+ template <typename T> struct negate : unary_function<T, T>
129
+ {
130
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a) const
131
+ {
132
+ return -a;
133
+ }
134
+ __host__ __device__ __forceinline__ negate() {}
135
+ __host__ __device__ __forceinline__ negate(const negate&) {}
136
+ };
137
+
138
+ // Comparison Operations
139
+ template <typename T> struct equal_to : binary_function<T, T, bool>
140
+ {
141
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,
142
+ typename TypeTraits<T>::ParameterType b) const
143
+ {
144
+ return a == b;
145
+ }
146
+ __host__ __device__ __forceinline__ equal_to() {}
147
+ __host__ __device__ __forceinline__ equal_to(const equal_to&) {}
148
+ };
149
+
150
+ template <typename T> struct not_equal_to : binary_function<T, T, bool>
151
+ {
152
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,
153
+ typename TypeTraits<T>::ParameterType b) const
154
+ {
155
+ return a != b;
156
+ }
157
+ __host__ __device__ __forceinline__ not_equal_to() {}
158
+ __host__ __device__ __forceinline__ not_equal_to(const not_equal_to&) {}
159
+ };
160
+
161
+ template <typename T> struct greater : binary_function<T, T, bool>
162
+ {
163
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,
164
+ typename TypeTraits<T>::ParameterType b) const
165
+ {
166
+ return a > b;
167
+ }
168
+ __host__ __device__ __forceinline__ greater() {}
169
+ __host__ __device__ __forceinline__ greater(const greater&) {}
170
+ };
171
+
172
+ template <typename T> struct less : binary_function<T, T, bool>
173
+ {
174
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,
175
+ typename TypeTraits<T>::ParameterType b) const
176
+ {
177
+ return a < b;
178
+ }
179
+ __host__ __device__ __forceinline__ less() {}
180
+ __host__ __device__ __forceinline__ less(const less&) {}
181
+ };
182
+
183
+ template <typename T> struct greater_equal : binary_function<T, T, bool>
184
+ {
185
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,
186
+ typename TypeTraits<T>::ParameterType b) const
187
+ {
188
+ return a >= b;
189
+ }
190
+ __host__ __device__ __forceinline__ greater_equal() {}
191
+ __host__ __device__ __forceinline__ greater_equal(const greater_equal&) {}
192
+ };
193
+
194
+ template <typename T> struct less_equal : binary_function<T, T, bool>
195
+ {
196
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,
197
+ typename TypeTraits<T>::ParameterType b) const
198
+ {
199
+ return a <= b;
200
+ }
201
+ __host__ __device__ __forceinline__ less_equal() {}
202
+ __host__ __device__ __forceinline__ less_equal(const less_equal&) {}
203
+ };
204
+
205
+ // Logical Operations
206
+ template <typename T> struct logical_and : binary_function<T, T, bool>
207
+ {
208
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,
209
+ typename TypeTraits<T>::ParameterType b) const
210
+ {
211
+ return a && b;
212
+ }
213
+ __host__ __device__ __forceinline__ logical_and() {}
214
+ __host__ __device__ __forceinline__ logical_and(const logical_and&) {}
215
+ };
216
+
217
+ template <typename T> struct logical_or : binary_function<T, T, bool>
218
+ {
219
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a,
220
+ typename TypeTraits<T>::ParameterType b) const
221
+ {
222
+ return a || b;
223
+ }
224
+ __host__ __device__ __forceinline__ logical_or() {}
225
+ __host__ __device__ __forceinline__ logical_or(const logical_or&) {}
226
+ };
227
+
228
+ template <typename T> struct logical_not : unary_function<T, bool>
229
+ {
230
+ __device__ __forceinline__ bool operator ()(typename TypeTraits<T>::ParameterType a) const
231
+ {
232
+ return !a;
233
+ }
234
+ __host__ __device__ __forceinline__ logical_not() {}
235
+ __host__ __device__ __forceinline__ logical_not(const logical_not&) {}
236
+ };
237
+
238
+ // Bitwise Operations
239
+ template <typename T> struct bit_and : binary_function<T, T, T>
240
+ {
241
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,
242
+ typename TypeTraits<T>::ParameterType b) const
243
+ {
244
+ return a & b;
245
+ }
246
+ __host__ __device__ __forceinline__ bit_and() {}
247
+ __host__ __device__ __forceinline__ bit_and(const bit_and&) {}
248
+ };
249
+
250
+ template <typename T> struct bit_or : binary_function<T, T, T>
251
+ {
252
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,
253
+ typename TypeTraits<T>::ParameterType b) const
254
+ {
255
+ return a | b;
256
+ }
257
+ __host__ __device__ __forceinline__ bit_or() {}
258
+ __host__ __device__ __forceinline__ bit_or(const bit_or&) {}
259
+ };
260
+
261
+ template <typename T> struct bit_xor : binary_function<T, T, T>
262
+ {
263
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType a,
264
+ typename TypeTraits<T>::ParameterType b) const
265
+ {
266
+ return a ^ b;
267
+ }
268
+ __host__ __device__ __forceinline__ bit_xor() {}
269
+ __host__ __device__ __forceinline__ bit_xor(const bit_xor&) {}
270
+ };
271
+
272
+ template <typename T> struct bit_not : unary_function<T, T>
273
+ {
274
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType v) const
275
+ {
276
+ return ~v;
277
+ }
278
+ __host__ __device__ __forceinline__ bit_not() {}
279
+ __host__ __device__ __forceinline__ bit_not(const bit_not&) {}
280
+ };
281
+
282
+ // Generalized Identity Operations
283
+ template <typename T> struct identity : unary_function<T, T>
284
+ {
285
+ __device__ __forceinline__ typename TypeTraits<T>::ParameterType operator()(typename TypeTraits<T>::ParameterType x) const
286
+ {
287
+ return x;
288
+ }
289
+ __host__ __device__ __forceinline__ identity() {}
290
+ __host__ __device__ __forceinline__ identity(const identity&) {}
291
+ };
292
+
293
+ template <typename T1, typename T2> struct project1st : binary_function<T1, T2, T1>
294
+ {
295
+ __device__ __forceinline__ typename TypeTraits<T1>::ParameterType operator()(typename TypeTraits<T1>::ParameterType lhs, typename TypeTraits<T2>::ParameterType rhs) const
296
+ {
297
+ return lhs;
298
+ }
299
+ __host__ __device__ __forceinline__ project1st() {}
300
+ __host__ __device__ __forceinline__ project1st(const project1st&) {}
301
+ };
302
+
303
+ template <typename T1, typename T2> struct project2nd : binary_function<T1, T2, T2>
304
+ {
305
+ __device__ __forceinline__ typename TypeTraits<T2>::ParameterType operator()(typename TypeTraits<T1>::ParameterType lhs, typename TypeTraits<T2>::ParameterType rhs) const
306
+ {
307
+ return rhs;
308
+ }
309
+ __host__ __device__ __forceinline__ project2nd() {}
310
+ __host__ __device__ __forceinline__ project2nd(const project2nd&) {}
311
+ };
312
+
313
+ // Min/Max Operations
314
+
315
+ #define OPENCV_CUDA_IMPLEMENT_MINMAX(name, type, op) \
316
+ template <> struct name<type> : binary_function<type, type, type> \
317
+ { \
318
+ __device__ __forceinline__ type operator()(type lhs, type rhs) const {return op(lhs, rhs);} \
319
+ __host__ __device__ __forceinline__ name() {}\
320
+ __host__ __device__ __forceinline__ name(const name&) {}\
321
+ };
322
+
323
+ template <typename T> struct maximum : binary_function<T, T, T>
324
+ {
325
+ __device__ __forceinline__ T operator()(typename TypeTraits<T>::ParameterType lhs, typename TypeTraits<T>::ParameterType rhs) const
326
+ {
327
+ return max(lhs, rhs);
328
+ }
329
+ __host__ __device__ __forceinline__ maximum() {}
330
+ __host__ __device__ __forceinline__ maximum(const maximum&) {}
331
+ };
332
+
333
+ OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, uchar, ::max)
334
+ OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, schar, ::max)
335
+ OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, char, ::max)
336
+ OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, ushort, ::max)
337
+ OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, short, ::max)
338
+ OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, int, ::max)
339
+ OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, uint, ::max)
340
+ OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, float, ::fmax)
341
+ OPENCV_CUDA_IMPLEMENT_MINMAX(maximum, double, ::fmax)
342
+
343
+ template <typename T> struct minimum : binary_function<T, T, T>
344
+ {
345
+ __device__ __forceinline__ T operator()(typename TypeTraits<T>::ParameterType lhs, typename TypeTraits<T>::ParameterType rhs) const
346
+ {
347
+ return min(lhs, rhs);
348
+ }
349
+ __host__ __device__ __forceinline__ minimum() {}
350
+ __host__ __device__ __forceinline__ minimum(const minimum&) {}
351
+ };
352
+
353
+ OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, uchar, ::min)
354
+ OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, schar, ::min)
355
+ OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, char, ::min)
356
+ OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, ushort, ::min)
357
+ OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, short, ::min)
358
+ OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, int, ::min)
359
+ OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, uint, ::min)
360
+ OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, float, ::fmin)
361
+ OPENCV_CUDA_IMPLEMENT_MINMAX(minimum, double, ::fmin)
362
+
363
+ #undef OPENCV_CUDA_IMPLEMENT_MINMAX
364
+
365
+ // Math functions
366
+
367
+ template <typename T> struct abs_func : unary_function<T, T>
368
+ {
369
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType x) const
370
+ {
371
+ return abs(x);
372
+ }
373
+
374
+ __host__ __device__ __forceinline__ abs_func() {}
375
+ __host__ __device__ __forceinline__ abs_func(const abs_func&) {}
376
+ };
377
+ template <> struct abs_func<unsigned char> : unary_function<unsigned char, unsigned char>
378
+ {
379
+ __device__ __forceinline__ unsigned char operator ()(unsigned char x) const
380
+ {
381
+ return x;
382
+ }
383
+
384
+ __host__ __device__ __forceinline__ abs_func() {}
385
+ __host__ __device__ __forceinline__ abs_func(const abs_func&) {}
386
+ };
387
+ template <> struct abs_func<signed char> : unary_function<signed char, signed char>
388
+ {
389
+ __device__ __forceinline__ signed char operator ()(signed char x) const
390
+ {
391
+ return ::abs((int)x);
392
+ }
393
+
394
+ __host__ __device__ __forceinline__ abs_func() {}
395
+ __host__ __device__ __forceinline__ abs_func(const abs_func&) {}
396
+ };
397
+ template <> struct abs_func<char> : unary_function<char, char>
398
+ {
399
+ __device__ __forceinline__ char operator ()(char x) const
400
+ {
401
+ return ::abs((int)x);
402
+ }
403
+
404
+ __host__ __device__ __forceinline__ abs_func() {}
405
+ __host__ __device__ __forceinline__ abs_func(const abs_func&) {}
406
+ };
407
+ template <> struct abs_func<unsigned short> : unary_function<unsigned short, unsigned short>
408
+ {
409
+ __device__ __forceinline__ unsigned short operator ()(unsigned short x) const
410
+ {
411
+ return x;
412
+ }
413
+
414
+ __host__ __device__ __forceinline__ abs_func() {}
415
+ __host__ __device__ __forceinline__ abs_func(const abs_func&) {}
416
+ };
417
+ template <> struct abs_func<short> : unary_function<short, short>
418
+ {
419
+ __device__ __forceinline__ short operator ()(short x) const
420
+ {
421
+ return ::abs((int)x);
422
+ }
423
+
424
+ __host__ __device__ __forceinline__ abs_func() {}
425
+ __host__ __device__ __forceinline__ abs_func(const abs_func&) {}
426
+ };
427
+ template <> struct abs_func<unsigned int> : unary_function<unsigned int, unsigned int>
428
+ {
429
+ __device__ __forceinline__ unsigned int operator ()(unsigned int x) const
430
+ {
431
+ return x;
432
+ }
433
+
434
+ __host__ __device__ __forceinline__ abs_func() {}
435
+ __host__ __device__ __forceinline__ abs_func(const abs_func&) {}
436
+ };
437
+ template <> struct abs_func<int> : unary_function<int, int>
438
+ {
439
+ __device__ __forceinline__ int operator ()(int x) const
440
+ {
441
+ return ::abs(x);
442
+ }
443
+
444
+ __host__ __device__ __forceinline__ abs_func() {}
445
+ __host__ __device__ __forceinline__ abs_func(const abs_func&) {}
446
+ };
447
+ template <> struct abs_func<float> : unary_function<float, float>
448
+ {
449
+ __device__ __forceinline__ float operator ()(float x) const
450
+ {
451
+ return ::fabsf(x);
452
+ }
453
+
454
+ __host__ __device__ __forceinline__ abs_func() {}
455
+ __host__ __device__ __forceinline__ abs_func(const abs_func&) {}
456
+ };
457
+ template <> struct abs_func<double> : unary_function<double, double>
458
+ {
459
+ __device__ __forceinline__ double operator ()(double x) const
460
+ {
461
+ return ::fabs(x);
462
+ }
463
+
464
+ __host__ __device__ __forceinline__ abs_func() {}
465
+ __host__ __device__ __forceinline__ abs_func(const abs_func&) {}
466
+ };
467
+
468
+ #define OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(name, func) \
469
+ template <typename T> struct name ## _func : unary_function<T, float> \
470
+ { \
471
+ __device__ __forceinline__ float operator ()(typename TypeTraits<T>::ParameterType v) const \
472
+ { \
473
+ return func ## f(v); \
474
+ } \
475
+ __host__ __device__ __forceinline__ name ## _func() {} \
476
+ __host__ __device__ __forceinline__ name ## _func(const name ## _func&) {} \
477
+ }; \
478
+ template <> struct name ## _func<double> : unary_function<double, double> \
479
+ { \
480
+ __device__ __forceinline__ double operator ()(double v) const \
481
+ { \
482
+ return func(v); \
483
+ } \
484
+ __host__ __device__ __forceinline__ name ## _func() {} \
485
+ __host__ __device__ __forceinline__ name ## _func(const name ## _func&) {} \
486
+ };
487
+
488
+ #define OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR(name, func) \
489
+ template <typename T> struct name ## _func : binary_function<T, T, float> \
490
+ { \
491
+ __device__ __forceinline__ float operator ()(typename TypeTraits<T>::ParameterType v1, typename TypeTraits<T>::ParameterType v2) const \
492
+ { \
493
+ return func ## f(v1, v2); \
494
+ } \
495
+ __host__ __device__ __forceinline__ name ## _func() {} \
496
+ __host__ __device__ __forceinline__ name ## _func(const name ## _func&) {} \
497
+ }; \
498
+ template <> struct name ## _func<double> : binary_function<double, double, double> \
499
+ { \
500
+ __device__ __forceinline__ double operator ()(double v1, double v2) const \
501
+ { \
502
+ return func(v1, v2); \
503
+ } \
504
+ __host__ __device__ __forceinline__ name ## _func() {} \
505
+ __host__ __device__ __forceinline__ name ## _func(const name ## _func&) {} \
506
+ };
507
+
508
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(sqrt, ::sqrt)
509
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(exp, ::exp)
510
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(exp2, ::exp2)
511
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(exp10, ::exp10)
512
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(log, ::log)
513
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(log2, ::log2)
514
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(log10, ::log10)
515
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(sin, ::sin)
516
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(cos, ::cos)
517
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(tan, ::tan)
518
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(asin, ::asin)
519
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(acos, ::acos)
520
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(atan, ::atan)
521
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(sinh, ::sinh)
522
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(cosh, ::cosh)
523
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(tanh, ::tanh)
524
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(asinh, ::asinh)
525
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(acosh, ::acosh)
526
+ OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR(atanh, ::atanh)
527
+
528
+ OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR(hypot, ::hypot)
529
+ OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR(atan2, ::atan2)
530
+ OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR(pow, ::pow)
531
+
532
+ #undef OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR
533
+ #undef OPENCV_CUDA_IMPLEMENT_UN_FUNCTOR_NO_DOUBLE
534
+ #undef OPENCV_CUDA_IMPLEMENT_BIN_FUNCTOR
535
+
536
+ template<typename T> struct hypot_sqr_func : binary_function<T, T, float>
537
+ {
538
+ __device__ __forceinline__ T operator ()(typename TypeTraits<T>::ParameterType src1, typename TypeTraits<T>::ParameterType src2) const
539
+ {
540
+ return src1 * src1 + src2 * src2;
541
+ }
542
+ __host__ __device__ __forceinline__ hypot_sqr_func() {}
543
+ __host__ __device__ __forceinline__ hypot_sqr_func(const hypot_sqr_func&) {}
544
+ };
545
+
546
+ // Saturate Cast Functor
547
+ template <typename T, typename D> struct saturate_cast_func : unary_function<T, D>
548
+ {
549
+ __device__ __forceinline__ D operator ()(typename TypeTraits<T>::ParameterType v) const
550
+ {
551
+ return saturate_cast<D>(v);
552
+ }
553
+ __host__ __device__ __forceinline__ saturate_cast_func() {}
554
+ __host__ __device__ __forceinline__ saturate_cast_func(const saturate_cast_func&) {}
555
+ };
556
+
557
+ // Threshold Functors
558
+ template <typename T> struct thresh_binary_func : unary_function<T, T>
559
+ {
560
+ __host__ __device__ __forceinline__ thresh_binary_func(T thresh_, T maxVal_) : thresh(thresh_), maxVal(maxVal_) {}
561
+
562
+ __device__ __forceinline__ T operator()(typename TypeTraits<T>::ParameterType src) const
563
+ {
564
+ return (src > thresh) * maxVal;
565
+ }
566
+
567
+ __host__ __device__ __forceinline__ thresh_binary_func() {}
568
+ __host__ __device__ __forceinline__ thresh_binary_func(const thresh_binary_func& other)
569
+ : thresh(other.thresh), maxVal(other.maxVal) {}
570
+
571
+ T thresh;
572
+ T maxVal;
573
+ };
574
+
575
+ template <typename T> struct thresh_binary_inv_func : unary_function<T, T>
576
+ {
577
+ __host__ __device__ __forceinline__ thresh_binary_inv_func(T thresh_, T maxVal_) : thresh(thresh_), maxVal(maxVal_) {}
578
+
579
+ __device__ __forceinline__ T operator()(typename TypeTraits<T>::ParameterType src) const
580
+ {
581
+ return (src <= thresh) * maxVal;
582
+ }
583
+
584
+ __host__ __device__ __forceinline__ thresh_binary_inv_func() {}
585
+ __host__ __device__ __forceinline__ thresh_binary_inv_func(const thresh_binary_inv_func& other)
586
+ : thresh(other.thresh), maxVal(other.maxVal) {}
587
+
588
+ T thresh;
589
+ T maxVal;
590
+ };
591
+
592
+ template <typename T> struct thresh_trunc_func : unary_function<T, T>
593
+ {
594
+ explicit __host__ __device__ __forceinline__ thresh_trunc_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {CV_UNUSED(maxVal_);}
595
+
596
+ __device__ __forceinline__ T operator()(typename TypeTraits<T>::ParameterType src) const
597
+ {
598
+ return minimum<T>()(src, thresh);
599
+ }
600
+
601
+ __host__ __device__ __forceinline__ thresh_trunc_func() {}
602
+ __host__ __device__ __forceinline__ thresh_trunc_func(const thresh_trunc_func& other)
603
+ : thresh(other.thresh) {}
604
+
605
+ T thresh;
606
+ };
607
+
608
+ template <typename T> struct thresh_to_zero_func : unary_function<T, T>
609
+ {
610
+ explicit __host__ __device__ __forceinline__ thresh_to_zero_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {CV_UNUSED(maxVal_);}
611
+
612
+ __device__ __forceinline__ T operator()(typename TypeTraits<T>::ParameterType src) const
613
+ {
614
+ return (src > thresh) * src;
615
+ }
616
+
617
+ __host__ __device__ __forceinline__ thresh_to_zero_func() {}
618
+ __host__ __device__ __forceinline__ thresh_to_zero_func(const thresh_to_zero_func& other)
619
+ : thresh(other.thresh) {}
620
+
621
+ T thresh;
622
+ };
623
+
624
+ template <typename T> struct thresh_to_zero_inv_func : unary_function<T, T>
625
+ {
626
+ explicit __host__ __device__ __forceinline__ thresh_to_zero_inv_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {CV_UNUSED(maxVal_);}
627
+
628
+ __device__ __forceinline__ T operator()(typename TypeTraits<T>::ParameterType src) const
629
+ {
630
+ return (src <= thresh) * src;
631
+ }
632
+
633
+ __host__ __device__ __forceinline__ thresh_to_zero_inv_func() {}
634
+ __host__ __device__ __forceinline__ thresh_to_zero_inv_func(const thresh_to_zero_inv_func& other)
635
+ : thresh(other.thresh) {}
636
+
637
+ T thresh;
638
+ };
639
+
640
+ // Function Object Adaptors
641
+ template <typename Predicate> struct unary_negate : unary_function<typename Predicate::argument_type, bool>
642
+ {
643
+ explicit __host__ __device__ __forceinline__ unary_negate(const Predicate& p) : pred(p) {}
644
+
645
+ __device__ __forceinline__ bool operator()(typename TypeTraits<typename Predicate::argument_type>::ParameterType x) const
646
+ {
647
+ return !pred(x);
648
+ }
649
+
650
+ __host__ __device__ __forceinline__ unary_negate() {}
651
+ __host__ __device__ __forceinline__ unary_negate(const unary_negate& other) : pred(other.pred) {}
652
+
653
+ Predicate pred;
654
+ };
655
+
656
+ template <typename Predicate> __host__ __device__ __forceinline__ unary_negate<Predicate> not1(const Predicate& pred)
657
+ {
658
+ return unary_negate<Predicate>(pred);
659
+ }
660
+
661
+ template <typename Predicate> struct binary_negate : binary_function<typename Predicate::first_argument_type, typename Predicate::second_argument_type, bool>
662
+ {
663
+ explicit __host__ __device__ __forceinline__ binary_negate(const Predicate& p) : pred(p) {}
664
+
665
+ __device__ __forceinline__ bool operator()(typename TypeTraits<typename Predicate::first_argument_type>::ParameterType x,
666
+ typename TypeTraits<typename Predicate::second_argument_type>::ParameterType y) const
667
+ {
668
+ return !pred(x,y);
669
+ }
670
+
671
+ __host__ __device__ __forceinline__ binary_negate() {}
672
+ __host__ __device__ __forceinline__ binary_negate(const binary_negate& other) : pred(other.pred) {}
673
+
674
+ Predicate pred;
675
+ };
676
+
677
+ template <typename BinaryPredicate> __host__ __device__ __forceinline__ binary_negate<BinaryPredicate> not2(const BinaryPredicate& pred)
678
+ {
679
+ return binary_negate<BinaryPredicate>(pred);
680
+ }
681
+
682
+ template <typename Op> struct binder1st : unary_function<typename Op::second_argument_type, typename Op::result_type>
683
+ {
684
+ __host__ __device__ __forceinline__ binder1st(const Op& op_, const typename Op::first_argument_type& arg1_) : op(op_), arg1(arg1_) {}
685
+
686
+ __device__ __forceinline__ typename Op::result_type operator ()(typename TypeTraits<typename Op::second_argument_type>::ParameterType a) const
687
+ {
688
+ return op(arg1, a);
689
+ }
690
+
691
+ __host__ __device__ __forceinline__ binder1st() {}
692
+ __host__ __device__ __forceinline__ binder1st(const binder1st& other) : op(other.op), arg1(other.arg1) {}
693
+
694
+ Op op;
695
+ typename Op::first_argument_type arg1;
696
+ };
697
+
698
+ template <typename Op, typename T> __host__ __device__ __forceinline__ binder1st<Op> bind1st(const Op& op, const T& x)
699
+ {
700
+ return binder1st<Op>(op, typename Op::first_argument_type(x));
701
+ }
702
+
703
+ template <typename Op> struct binder2nd : unary_function<typename Op::first_argument_type, typename Op::result_type>
704
+ {
705
+ __host__ __device__ __forceinline__ binder2nd(const Op& op_, const typename Op::second_argument_type& arg2_) : op(op_), arg2(arg2_) {}
706
+
707
+ __forceinline__ __device__ typename Op::result_type operator ()(typename TypeTraits<typename Op::first_argument_type>::ParameterType a) const
708
+ {
709
+ return op(a, arg2);
710
+ }
711
+
712
+ __host__ __device__ __forceinline__ binder2nd() {}
713
+ __host__ __device__ __forceinline__ binder2nd(const binder2nd& other) : op(other.op), arg2(other.arg2) {}
714
+
715
+ Op op;
716
+ typename Op::second_argument_type arg2;
717
+ };
718
+
719
+ template <typename Op, typename T> __host__ __device__ __forceinline__ binder2nd<Op> bind2nd(const Op& op, const T& x)
720
+ {
721
+ return binder2nd<Op>(op, typename Op::second_argument_type(x));
722
+ }
723
+
724
+ // Functor Traits
725
+ template <typename F> struct IsUnaryFunction
726
+ {
727
+ typedef char Yes;
728
+ struct No {Yes a[2];};
729
+
730
+ template <typename T, typename D> static Yes check(unary_function<T, D>);
731
+ static No check(...);
732
+
733
+ static F makeF();
734
+
735
+ enum { value = (sizeof(check(makeF())) == sizeof(Yes)) };
736
+ };
737
+
738
+ template <typename F> struct IsBinaryFunction
739
+ {
740
+ typedef char Yes;
741
+ struct No {Yes a[2];};
742
+
743
+ template <typename T1, typename T2, typename D> static Yes check(binary_function<T1, T2, D>);
744
+ static No check(...);
745
+
746
+ static F makeF();
747
+
748
+ enum { value = (sizeof(check(makeF())) == sizeof(Yes)) };
749
+ };
750
+
751
+ namespace functional_detail
752
+ {
753
+ template <size_t src_elem_size, size_t dst_elem_size> struct UnOpShift { enum { shift = 1 }; };
754
+ template <size_t src_elem_size> struct UnOpShift<src_elem_size, 1> { enum { shift = 4 }; };
755
+ template <size_t src_elem_size> struct UnOpShift<src_elem_size, 2> { enum { shift = 2 }; };
756
+
757
+ template <typename T, typename D> struct DefaultUnaryShift
758
+ {
759
+ enum { shift = UnOpShift<sizeof(T), sizeof(D)>::shift };
760
+ };
761
+
762
+ template <size_t src_elem_size1, size_t src_elem_size2, size_t dst_elem_size> struct BinOpShift { enum { shift = 1 }; };
763
+ template <size_t src_elem_size1, size_t src_elem_size2> struct BinOpShift<src_elem_size1, src_elem_size2, 1> { enum { shift = 4 }; };
764
+ template <size_t src_elem_size1, size_t src_elem_size2> struct BinOpShift<src_elem_size1, src_elem_size2, 2> { enum { shift = 2 }; };
765
+
766
+ template <typename T1, typename T2, typename D> struct DefaultBinaryShift
767
+ {
768
+ enum { shift = BinOpShift<sizeof(T1), sizeof(T2), sizeof(D)>::shift };
769
+ };
770
+
771
+ template <typename Func, bool unary = IsUnaryFunction<Func>::value> struct ShiftDispatcher;
772
+ template <typename Func> struct ShiftDispatcher<Func, true>
773
+ {
774
+ enum { shift = DefaultUnaryShift<typename Func::argument_type, typename Func::result_type>::shift };
775
+ };
776
+ template <typename Func> struct ShiftDispatcher<Func, false>
777
+ {
778
+ enum { shift = DefaultBinaryShift<typename Func::first_argument_type, typename Func::second_argument_type, typename Func::result_type>::shift };
779
+ };
780
+ }
781
+
782
+ template <typename Func> struct DefaultTransformShift
783
+ {
784
+ enum { shift = functional_detail::ShiftDispatcher<Func>::shift };
785
+ };
786
+
787
+ template <typename Func> struct DefaultTransformFunctorTraits
788
+ {
789
+ enum { simple_block_dim_x = 16 };
790
+ enum { simple_block_dim_y = 16 };
791
+
792
+ enum { smart_block_dim_x = 16 };
793
+ enum { smart_block_dim_y = 16 };
794
+ enum { smart_shift = DefaultTransformShift<Func>::shift };
795
+ };
796
+
797
+ template <typename Func> struct TransformFunctorTraits : DefaultTransformFunctorTraits<Func> {};
798
+
799
+ #define OPENCV_CUDA_TRANSFORM_FUNCTOR_TRAITS(type) \
800
+ template <> struct TransformFunctorTraits< type > : DefaultTransformFunctorTraits< type >
801
+ }}} // namespace cv { namespace cuda { namespace cudev
802
+
803
+ //! @endcond
804
+
805
+ #endif // OPENCV_CUDA_FUNCTIONAL_HPP