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.
- package/README.md +144 -27
- package/binding.gyp +18 -5
- package/dist/index.d.ts +146 -4
- package/dist/index.js +107 -3
- package/include/opencv2/core/affine.hpp +678 -0
- package/include/opencv2/core/async.hpp +105 -0
- package/include/opencv2/core/base.hpp +664 -0
- package/include/opencv2/core/bindings_utils.hpp +325 -0
- package/include/opencv2/core/bufferpool.hpp +40 -0
- package/include/opencv2/core/check.hpp +170 -0
- package/include/opencv2/core/core.hpp +48 -0
- package/include/opencv2/core/core_c.h +3128 -0
- package/include/opencv2/core/cuda/block.hpp +211 -0
- package/include/opencv2/core/cuda/border_interpolate.hpp +722 -0
- package/include/opencv2/core/cuda/color.hpp +309 -0
- package/include/opencv2/core/cuda/common.hpp +131 -0
- package/include/opencv2/core/cuda/datamov_utils.hpp +113 -0
- package/include/opencv2/core/cuda/detail/color_detail.hpp +2018 -0
- package/include/opencv2/core/cuda/detail/reduce.hpp +365 -0
- package/include/opencv2/core/cuda/detail/reduce_key_val.hpp +502 -0
- package/include/opencv2/core/cuda/detail/transform_detail.hpp +392 -0
- package/include/opencv2/core/cuda/detail/type_traits_detail.hpp +191 -0
- package/include/opencv2/core/cuda/detail/vec_distance_detail.hpp +121 -0
- package/include/opencv2/core/cuda/dynamic_smem.hpp +88 -0
- package/include/opencv2/core/cuda/emulation.hpp +269 -0
- package/include/opencv2/core/cuda/filters.hpp +293 -0
- package/include/opencv2/core/cuda/funcattrib.hpp +79 -0
- package/include/opencv2/core/cuda/functional.hpp +805 -0
- package/include/opencv2/core/cuda/limits.hpp +128 -0
- package/include/opencv2/core/cuda/reduce.hpp +209 -0
- package/include/opencv2/core/cuda/saturate_cast.hpp +292 -0
- package/include/opencv2/core/cuda/scan.hpp +258 -0
- package/include/opencv2/core/cuda/simd_functions.hpp +869 -0
- package/include/opencv2/core/cuda/transform.hpp +75 -0
- package/include/opencv2/core/cuda/type_traits.hpp +90 -0
- package/include/opencv2/core/cuda/utility.hpp +230 -0
- package/include/opencv2/core/cuda/vec_distance.hpp +232 -0
- package/include/opencv2/core/cuda/vec_math.hpp +923 -0
- package/include/opencv2/core/cuda/vec_traits.hpp +288 -0
- package/include/opencv2/core/cuda/warp.hpp +139 -0
- package/include/opencv2/core/cuda/warp_reduce.hpp +76 -0
- package/include/opencv2/core/cuda/warp_shuffle.hpp +162 -0
- package/include/opencv2/core/cuda.hpp +1279 -0
- package/include/opencv2/core/cuda.inl.hpp +763 -0
- package/include/opencv2/core/cuda_stream_accessor.hpp +86 -0
- package/include/opencv2/core/cuda_types.hpp +144 -0
- package/include/opencv2/core/cv_cpu_dispatch.h +381 -0
- package/include/opencv2/core/cv_cpu_helper.h +550 -0
- package/include/opencv2/core/cvdef.h +973 -0
- package/include/opencv2/core/cvstd.hpp +190 -0
- package/include/opencv2/core/cvstd.inl.hpp +197 -0
- package/include/opencv2/core/cvstd_wrapper.hpp +154 -0
- package/include/opencv2/core/detail/async_promise.hpp +71 -0
- package/include/opencv2/core/detail/dispatch_helper.impl.hpp +49 -0
- package/include/opencv2/core/detail/exception_ptr.hpp +27 -0
- package/include/opencv2/core/directx.hpp +184 -0
- package/include/opencv2/core/dualquaternion.hpp +979 -0
- package/include/opencv2/core/dualquaternion.inl.hpp +487 -0
- package/include/opencv2/core/eigen.hpp +402 -0
- package/include/opencv2/core/fast_math.hpp +433 -0
- package/include/opencv2/core/hal/hal.hpp +256 -0
- package/include/opencv2/core/hal/interface.h +190 -0
- package/include/opencv2/core/hal/intrin.hpp +939 -0
- package/include/opencv2/core/hal/intrin_avx.hpp +3177 -0
- package/include/opencv2/core/hal/intrin_avx512.hpp +3090 -0
- package/include/opencv2/core/hal/intrin_cpp.hpp +3321 -0
- package/include/opencv2/core/hal/intrin_forward.hpp +191 -0
- package/include/opencv2/core/hal/intrin_lasx.hpp +3236 -0
- package/include/opencv2/core/hal/intrin_msa.hpp +1887 -0
- package/include/opencv2/core/hal/intrin_neon.hpp +2610 -0
- package/include/opencv2/core/hal/intrin_rvv.hpp +3320 -0
- package/include/opencv2/core/hal/intrin_rvv071.hpp +2545 -0
- package/include/opencv2/core/hal/intrin_rvv_scalable.hpp +2080 -0
- package/include/opencv2/core/hal/intrin_sse.hpp +3467 -0
- package/include/opencv2/core/hal/intrin_sse_em.hpp +180 -0
- package/include/opencv2/core/hal/intrin_vsx.hpp +1608 -0
- package/include/opencv2/core/hal/intrin_wasm.hpp +2782 -0
- package/include/opencv2/core/hal/msa_macros.h +1558 -0
- package/include/opencv2/core/hal/simd_utils.impl.hpp +186 -0
- package/include/opencv2/core/llapi/llapi.h +102 -0
- package/include/opencv2/core/mat.hpp +3775 -0
- package/include/opencv2/core/mat.inl.hpp +3422 -0
- package/include/opencv2/core/matx.hpp +1536 -0
- package/include/opencv2/core/neon_utils.hpp +128 -0
- package/include/opencv2/core/ocl.hpp +917 -0
- package/include/opencv2/core/ocl_genbase.hpp +69 -0
- package/include/opencv2/core/opencl/ocl_defs.hpp +82 -0
- package/include/opencv2/core/opencl/opencl_info.hpp +212 -0
- package/include/opencv2/core/opencl/opencl_svm.hpp +81 -0
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clblas.hpp +602 -0
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clfft.hpp +146 -0
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp +371 -0
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core_wrappers.hpp +272 -0
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp +62 -0
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp +42 -0
- package/include/opencv2/core/opencl/runtime/opencl_clblas.hpp +53 -0
- package/include/opencv2/core/opencl/runtime/opencl_clfft.hpp +53 -0
- package/include/opencv2/core/opencl/runtime/opencl_core.hpp +84 -0
- package/include/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp +47 -0
- package/include/opencv2/core/opencl/runtime/opencl_gl.hpp +53 -0
- package/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp +47 -0
- package/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp +48 -0
- package/include/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp +42 -0
- package/include/opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp +166 -0
- package/include/opencv2/core/opengl.hpp +733 -0
- package/include/opencv2/core/openvx/ovx_defs.hpp +48 -0
- package/include/opencv2/core/operations.hpp +610 -0
- package/include/opencv2/core/optim.hpp +302 -0
- package/include/opencv2/core/ovx.hpp +28 -0
- package/include/opencv2/core/parallel/backend/parallel_for.openmp.hpp +72 -0
- package/include/opencv2/core/parallel/backend/parallel_for.tbb.hpp +153 -0
- package/include/opencv2/core/parallel/parallel_backend.hpp +90 -0
- package/include/opencv2/core/persistence.hpp +1350 -0
- package/include/opencv2/core/private/cv_cpu_include_simd_declarations.hpp +30 -0
- package/include/opencv2/core/private.cuda.hpp +169 -0
- package/include/opencv2/core/private.hpp +896 -0
- package/include/opencv2/core/quaternion.hpp +1696 -0
- package/include/opencv2/core/quaternion.inl.hpp +1063 -0
- package/include/opencv2/core/saturate.hpp +180 -0
- package/include/opencv2/core/simd_intrinsics.hpp +87 -0
- package/include/opencv2/core/softfloat.hpp +514 -0
- package/include/opencv2/core/sse_utils.hpp +652 -0
- package/include/opencv2/core/traits.hpp +417 -0
- package/include/opencv2/core/types.hpp +2457 -0
- package/include/opencv2/core/types_c.h +2126 -0
- package/include/opencv2/core/utility.hpp +1229 -0
- package/include/opencv2/core/utils/allocator_stats.hpp +29 -0
- package/include/opencv2/core/utils/allocator_stats.impl.hpp +158 -0
- package/include/opencv2/core/utils/buffer_area.private.hpp +136 -0
- package/include/opencv2/core/utils/configuration.private.hpp +22 -0
- package/include/opencv2/core/utils/filesystem.hpp +82 -0
- package/include/opencv2/core/utils/filesystem.private.hpp +66 -0
- package/include/opencv2/core/utils/fp_control.private.hpp +29 -0
- package/include/opencv2/core/utils/fp_control_utils.hpp +69 -0
- package/include/opencv2/core/utils/instrumentation.hpp +125 -0
- package/include/opencv2/core/utils/lock.private.hpp +119 -0
- package/include/opencv2/core/utils/logger.defines.hpp +42 -0
- package/include/opencv2/core/utils/logger.hpp +218 -0
- package/include/opencv2/core/utils/logtag.hpp +28 -0
- package/include/opencv2/core/utils/plugin_loader.private.hpp +165 -0
- package/include/opencv2/core/utils/tls.hpp +235 -0
- package/include/opencv2/core/utils/trace.hpp +252 -0
- package/include/opencv2/core/utils/trace.private.hpp +421 -0
- package/include/opencv2/core/va_intel.hpp +75 -0
- package/include/opencv2/core/version.hpp +26 -0
- package/include/opencv2/core/vsx_utils.hpp +1047 -0
- package/include/opencv2/core.hpp +3365 -0
- package/include/opencv2/imgcodecs/imgcodecs.hpp +48 -0
- package/include/opencv2/imgcodecs/imgcodecs_c.h +1 -0
- package/include/opencv2/imgcodecs/ios.h +59 -0
- package/include/opencv2/imgcodecs/legacy/constants_c.h +54 -0
- package/include/opencv2/imgcodecs/macosx.h +20 -0
- package/include/opencv2/imgcodecs.hpp +407 -0
- package/include/opencv2/imgproc/bindings.hpp +34 -0
- package/include/opencv2/imgproc/detail/gcgraph.hpp +395 -0
- package/include/opencv2/imgproc/hal/hal.hpp +246 -0
- package/include/opencv2/imgproc/hal/interface.h +46 -0
- package/include/opencv2/imgproc/imgproc.hpp +48 -0
- package/include/opencv2/imgproc/imgproc_c.h +1177 -0
- package/include/opencv2/imgproc/segmentation.hpp +141 -0
- package/include/opencv2/imgproc/types_c.h +659 -0
- package/include/opencv2/imgproc.hpp +5035 -0
- package/include/opencv2/opencv_modules.hpp +17 -0
- package/libs/libjpeg-turbo.lib +0 -0
- package/libs/libpng.lib +0 -0
- package/libs/opencv_core470.lib +0 -0
- package/libs/opencv_imgcodecs470.lib +0 -0
- package/libs/opencv_imgproc470.lib +0 -0
- package/libs/zlib.lib +0 -0
- package/package.json +14 -3
- package/prebuilds/win32-x64/node.napi.node +0 -0
- package/src/cpp/capturewindow.cpp +36 -46
- package/src/cpp/main.cpp +10 -2
- package/src/cpp/opencv.cpp +425 -0
|
@@ -0,0 +1,258 @@
|
|
|
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_SCAN_HPP
|
|
44
|
+
#define OPENCV_CUDA_SCAN_HPP
|
|
45
|
+
|
|
46
|
+
#include "opencv2/core/cuda/common.hpp"
|
|
47
|
+
#include "opencv2/core/cuda/utility.hpp"
|
|
48
|
+
#include "opencv2/core/cuda/warp.hpp"
|
|
49
|
+
#include "opencv2/core/cuda/warp_shuffle.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
|
+
enum ScanKind { EXCLUSIVE = 0, INCLUSIVE = 1 };
|
|
60
|
+
|
|
61
|
+
template <ScanKind Kind, typename T, typename F> struct WarpScan
|
|
62
|
+
{
|
|
63
|
+
__device__ __forceinline__ WarpScan() {}
|
|
64
|
+
__device__ __forceinline__ WarpScan(const WarpScan& other) { CV_UNUSED(other); }
|
|
65
|
+
|
|
66
|
+
__device__ __forceinline__ T operator()( volatile T *ptr , const unsigned int idx)
|
|
67
|
+
{
|
|
68
|
+
const unsigned int lane = idx & 31;
|
|
69
|
+
F op;
|
|
70
|
+
|
|
71
|
+
if ( lane >= 1) ptr [idx ] = op(ptr [idx - 1], ptr [idx]);
|
|
72
|
+
if ( lane >= 2) ptr [idx ] = op(ptr [idx - 2], ptr [idx]);
|
|
73
|
+
if ( lane >= 4) ptr [idx ] = op(ptr [idx - 4], ptr [idx]);
|
|
74
|
+
if ( lane >= 8) ptr [idx ] = op(ptr [idx - 8], ptr [idx]);
|
|
75
|
+
if ( lane >= 16) ptr [idx ] = op(ptr [idx - 16], ptr [idx]);
|
|
76
|
+
|
|
77
|
+
if( Kind == INCLUSIVE )
|
|
78
|
+
return ptr [idx];
|
|
79
|
+
else
|
|
80
|
+
return (lane > 0) ? ptr [idx - 1] : 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
__device__ __forceinline__ unsigned int index(const unsigned int tid)
|
|
84
|
+
{
|
|
85
|
+
return tid;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
__device__ __forceinline__ void init(volatile T *ptr){}
|
|
89
|
+
|
|
90
|
+
static const int warp_offset = 0;
|
|
91
|
+
|
|
92
|
+
typedef WarpScan<INCLUSIVE, T, F> merge;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
template <ScanKind Kind , typename T, typename F> struct WarpScanNoComp
|
|
96
|
+
{
|
|
97
|
+
__device__ __forceinline__ WarpScanNoComp() {}
|
|
98
|
+
__device__ __forceinline__ WarpScanNoComp(const WarpScanNoComp& other) { CV_UNUSED(other); }
|
|
99
|
+
|
|
100
|
+
__device__ __forceinline__ T operator()( volatile T *ptr , const unsigned int idx)
|
|
101
|
+
{
|
|
102
|
+
const unsigned int lane = threadIdx.x & 31;
|
|
103
|
+
F op;
|
|
104
|
+
|
|
105
|
+
ptr [idx ] = op(ptr [idx - 1], ptr [idx]);
|
|
106
|
+
ptr [idx ] = op(ptr [idx - 2], ptr [idx]);
|
|
107
|
+
ptr [idx ] = op(ptr [idx - 4], ptr [idx]);
|
|
108
|
+
ptr [idx ] = op(ptr [idx - 8], ptr [idx]);
|
|
109
|
+
ptr [idx ] = op(ptr [idx - 16], ptr [idx]);
|
|
110
|
+
|
|
111
|
+
if( Kind == INCLUSIVE )
|
|
112
|
+
return ptr [idx];
|
|
113
|
+
else
|
|
114
|
+
return (lane > 0) ? ptr [idx - 1] : 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
__device__ __forceinline__ unsigned int index(const unsigned int tid)
|
|
118
|
+
{
|
|
119
|
+
return (tid >> warp_log) * warp_smem_stride + 16 + (tid & warp_mask);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
__device__ __forceinline__ void init(volatile T *ptr)
|
|
123
|
+
{
|
|
124
|
+
ptr[threadIdx.x] = 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
static const int warp_smem_stride = 32 + 16 + 1;
|
|
128
|
+
static const int warp_offset = 16;
|
|
129
|
+
static const int warp_log = 5;
|
|
130
|
+
static const int warp_mask = 31;
|
|
131
|
+
|
|
132
|
+
typedef WarpScanNoComp<INCLUSIVE, T, F> merge;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
template <ScanKind Kind , typename T, typename Sc, typename F> struct BlockScan
|
|
136
|
+
{
|
|
137
|
+
__device__ __forceinline__ BlockScan() {}
|
|
138
|
+
__device__ __forceinline__ BlockScan(const BlockScan& other) { CV_UNUSED(other); }
|
|
139
|
+
|
|
140
|
+
__device__ __forceinline__ T operator()(volatile T *ptr)
|
|
141
|
+
{
|
|
142
|
+
const unsigned int tid = threadIdx.x;
|
|
143
|
+
const unsigned int lane = tid & warp_mask;
|
|
144
|
+
const unsigned int warp = tid >> warp_log;
|
|
145
|
+
|
|
146
|
+
Sc scan;
|
|
147
|
+
typename Sc::merge merge_scan;
|
|
148
|
+
const unsigned int idx = scan.index(tid);
|
|
149
|
+
|
|
150
|
+
T val = scan(ptr, idx);
|
|
151
|
+
__syncthreads ();
|
|
152
|
+
|
|
153
|
+
if( warp == 0)
|
|
154
|
+
scan.init(ptr);
|
|
155
|
+
__syncthreads ();
|
|
156
|
+
|
|
157
|
+
if( lane == 31 )
|
|
158
|
+
ptr [scan.warp_offset + warp ] = (Kind == INCLUSIVE) ? val : ptr [idx];
|
|
159
|
+
__syncthreads ();
|
|
160
|
+
|
|
161
|
+
if( warp == 0 )
|
|
162
|
+
merge_scan(ptr, idx);
|
|
163
|
+
__syncthreads();
|
|
164
|
+
|
|
165
|
+
if ( warp > 0)
|
|
166
|
+
val = ptr [scan.warp_offset + warp - 1] + val;
|
|
167
|
+
__syncthreads ();
|
|
168
|
+
|
|
169
|
+
ptr[idx] = val;
|
|
170
|
+
__syncthreads ();
|
|
171
|
+
|
|
172
|
+
return val ;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
static const int warp_log = 5;
|
|
176
|
+
static const int warp_mask = 31;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
template <typename T>
|
|
180
|
+
__device__ T warpScanInclusive(T idata, volatile T* s_Data, unsigned int tid)
|
|
181
|
+
{
|
|
182
|
+
#if __CUDA_ARCH__ >= 300
|
|
183
|
+
const unsigned int laneId = cv::cuda::device::Warp::laneId();
|
|
184
|
+
|
|
185
|
+
// scan on shuffl functions
|
|
186
|
+
#pragma unroll
|
|
187
|
+
for (int i = 1; i <= (OPENCV_CUDA_WARP_SIZE / 2); i *= 2)
|
|
188
|
+
{
|
|
189
|
+
const T n = cv::cuda::device::shfl_up(idata, i);
|
|
190
|
+
if (laneId >= i)
|
|
191
|
+
idata += n;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return idata;
|
|
195
|
+
#else
|
|
196
|
+
unsigned int pos = 2 * tid - (tid & (OPENCV_CUDA_WARP_SIZE - 1));
|
|
197
|
+
s_Data[pos] = 0;
|
|
198
|
+
pos += OPENCV_CUDA_WARP_SIZE;
|
|
199
|
+
s_Data[pos] = idata;
|
|
200
|
+
|
|
201
|
+
s_Data[pos] += s_Data[pos - 1];
|
|
202
|
+
s_Data[pos] += s_Data[pos - 2];
|
|
203
|
+
s_Data[pos] += s_Data[pos - 4];
|
|
204
|
+
s_Data[pos] += s_Data[pos - 8];
|
|
205
|
+
s_Data[pos] += s_Data[pos - 16];
|
|
206
|
+
|
|
207
|
+
return s_Data[pos];
|
|
208
|
+
#endif
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
template <typename T>
|
|
212
|
+
__device__ __forceinline__ T warpScanExclusive(T idata, volatile T* s_Data, unsigned int tid)
|
|
213
|
+
{
|
|
214
|
+
return warpScanInclusive(idata, s_Data, tid) - idata;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
template <int tiNumScanThreads, typename T>
|
|
218
|
+
__device__ T blockScanInclusive(T idata, volatile T* s_Data, unsigned int tid)
|
|
219
|
+
{
|
|
220
|
+
if (tiNumScanThreads > OPENCV_CUDA_WARP_SIZE)
|
|
221
|
+
{
|
|
222
|
+
//Bottom-level inclusive warp scan
|
|
223
|
+
T warpResult = warpScanInclusive(idata, s_Data, tid);
|
|
224
|
+
|
|
225
|
+
//Save top elements of each warp for exclusive warp scan
|
|
226
|
+
//sync to wait for warp scans to complete (because s_Data is being overwritten)
|
|
227
|
+
__syncthreads();
|
|
228
|
+
if ((tid & (OPENCV_CUDA_WARP_SIZE - 1)) == (OPENCV_CUDA_WARP_SIZE - 1))
|
|
229
|
+
{
|
|
230
|
+
s_Data[tid >> OPENCV_CUDA_LOG_WARP_SIZE] = warpResult;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
//wait for warp scans to complete
|
|
234
|
+
__syncthreads();
|
|
235
|
+
|
|
236
|
+
if (tid < (tiNumScanThreads / OPENCV_CUDA_WARP_SIZE) )
|
|
237
|
+
{
|
|
238
|
+
//grab top warp elements
|
|
239
|
+
T val = s_Data[tid];
|
|
240
|
+
//calculate exclusive scan and write back to shared memory
|
|
241
|
+
s_Data[tid] = warpScanExclusive(val, s_Data, tid);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
//return updated warp scans with exclusive scan results
|
|
245
|
+
__syncthreads();
|
|
246
|
+
|
|
247
|
+
return warpResult + s_Data[tid >> OPENCV_CUDA_LOG_WARP_SIZE];
|
|
248
|
+
}
|
|
249
|
+
else
|
|
250
|
+
{
|
|
251
|
+
return warpScanInclusive(idata, s_Data, tid);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}}}
|
|
255
|
+
|
|
256
|
+
//! @endcond
|
|
257
|
+
|
|
258
|
+
#endif // OPENCV_CUDA_SCAN_HPP
|