openCV library for Renesas RZ/A

Dependents:   RZ_A2M_Mbed_samples

Committer:
RyoheiHagimoto
Date:
Fri Jan 29 04:53:38 2021 +0000
Revision:
0:0e0631af0305
copied from https://github.com/d-kato/opencv-lib.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RyoheiHagimoto 0:0e0631af0305 1 /*M///////////////////////////////////////////////////////////////////////////////////////
RyoheiHagimoto 0:0e0631af0305 2 //
RyoheiHagimoto 0:0e0631af0305 3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
RyoheiHagimoto 0:0e0631af0305 4 //
RyoheiHagimoto 0:0e0631af0305 5 // By downloading, copying, installing or using the software you agree to this license.
RyoheiHagimoto 0:0e0631af0305 6 // If you do not agree to this license, do not download, install,
RyoheiHagimoto 0:0e0631af0305 7 // copy or use the software.
RyoheiHagimoto 0:0e0631af0305 8 //
RyoheiHagimoto 0:0e0631af0305 9 //
RyoheiHagimoto 0:0e0631af0305 10 // License Agreement
RyoheiHagimoto 0:0e0631af0305 11 // For Open Source Computer Vision Library
RyoheiHagimoto 0:0e0631af0305 12 //
RyoheiHagimoto 0:0e0631af0305 13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
RyoheiHagimoto 0:0e0631af0305 14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
RyoheiHagimoto 0:0e0631af0305 15 // Copyright (C) 2013, OpenCV Foundation, all rights reserved.
RyoheiHagimoto 0:0e0631af0305 16 // Third party copyrights are property of their respective owners.
RyoheiHagimoto 0:0e0631af0305 17 //
RyoheiHagimoto 0:0e0631af0305 18 // Redistribution and use in source and binary forms, with or without modification,
RyoheiHagimoto 0:0e0631af0305 19 // are permitted provided that the following conditions are met:
RyoheiHagimoto 0:0e0631af0305 20 //
RyoheiHagimoto 0:0e0631af0305 21 // * Redistribution's of source code must retain the above copyright notice,
RyoheiHagimoto 0:0e0631af0305 22 // this list of conditions and the following disclaimer.
RyoheiHagimoto 0:0e0631af0305 23 //
RyoheiHagimoto 0:0e0631af0305 24 // * Redistribution's in binary form must reproduce the above copyright notice,
RyoheiHagimoto 0:0e0631af0305 25 // this list of conditions and the following disclaimer in the documentation
RyoheiHagimoto 0:0e0631af0305 26 // and/or other materials provided with the distribution.
RyoheiHagimoto 0:0e0631af0305 27 //
RyoheiHagimoto 0:0e0631af0305 28 // * The name of the copyright holders may not be used to endorse or promote products
RyoheiHagimoto 0:0e0631af0305 29 // derived from this software without specific prior written permission.
RyoheiHagimoto 0:0e0631af0305 30 //
RyoheiHagimoto 0:0e0631af0305 31 // This software is provided by the copyright holders and contributors "as is" and
RyoheiHagimoto 0:0e0631af0305 32 // any express or implied warranties, including, but not limited to, the implied
RyoheiHagimoto 0:0e0631af0305 33 // warranties of merchantability and fitness for a particular purpose are disclaimed.
RyoheiHagimoto 0:0e0631af0305 34 // In no event shall the Intel Corporation or contributors be liable for any direct,
RyoheiHagimoto 0:0e0631af0305 35 // indirect, incidental, special, exemplary, or consequential damages
RyoheiHagimoto 0:0e0631af0305 36 // (including, but not limited to, procurement of substitute goods or services;
RyoheiHagimoto 0:0e0631af0305 37 // loss of use, data, or profits; or business interruption) however caused
RyoheiHagimoto 0:0e0631af0305 38 // and on any theory of liability, whether in contract, strict liability,
RyoheiHagimoto 0:0e0631af0305 39 // or tort (including negligence or otherwise) arising in any way out of
RyoheiHagimoto 0:0e0631af0305 40 // the use of this software, even if advised of the possibility of such damage.
RyoheiHagimoto 0:0e0631af0305 41 //
RyoheiHagimoto 0:0e0631af0305 42 //M*/
RyoheiHagimoto 0:0e0631af0305 43
RyoheiHagimoto 0:0e0631af0305 44 #ifndef OPENCV_CORE_CUDA_HPP
RyoheiHagimoto 0:0e0631af0305 45 #define OPENCV_CORE_CUDA_HPP
RyoheiHagimoto 0:0e0631af0305 46
RyoheiHagimoto 0:0e0631af0305 47 #ifndef __cplusplus
RyoheiHagimoto 0:0e0631af0305 48 # error cuda.hpp header must be compiled as C++
RyoheiHagimoto 0:0e0631af0305 49 #endif
RyoheiHagimoto 0:0e0631af0305 50
RyoheiHagimoto 0:0e0631af0305 51 #include "opencv2/core.hpp"
RyoheiHagimoto 0:0e0631af0305 52 #include "opencv2/core/cuda_types.hpp"
RyoheiHagimoto 0:0e0631af0305 53
RyoheiHagimoto 0:0e0631af0305 54 /**
RyoheiHagimoto 0:0e0631af0305 55 @defgroup cuda CUDA-accelerated Computer Vision
RyoheiHagimoto 0:0e0631af0305 56 @{
RyoheiHagimoto 0:0e0631af0305 57 @defgroup cudacore Core part
RyoheiHagimoto 0:0e0631af0305 58 @{
RyoheiHagimoto 0:0e0631af0305 59 @defgroup cudacore_init Initalization and Information
RyoheiHagimoto 0:0e0631af0305 60 @defgroup cudacore_struct Data Structures
RyoheiHagimoto 0:0e0631af0305 61 @}
RyoheiHagimoto 0:0e0631af0305 62 @}
RyoheiHagimoto 0:0e0631af0305 63 */
RyoheiHagimoto 0:0e0631af0305 64
RyoheiHagimoto 0:0e0631af0305 65 namespace cv { namespace cuda {
RyoheiHagimoto 0:0e0631af0305 66
RyoheiHagimoto 0:0e0631af0305 67 //! @addtogroup cudacore_struct
RyoheiHagimoto 0:0e0631af0305 68 //! @{
RyoheiHagimoto 0:0e0631af0305 69
RyoheiHagimoto 0:0e0631af0305 70 //===================================================================================
RyoheiHagimoto 0:0e0631af0305 71 // GpuMat
RyoheiHagimoto 0:0e0631af0305 72 //===================================================================================
RyoheiHagimoto 0:0e0631af0305 73
RyoheiHagimoto 0:0e0631af0305 74 /** @brief Base storage class for GPU memory with reference counting.
RyoheiHagimoto 0:0e0631af0305 75
RyoheiHagimoto 0:0e0631af0305 76 Its interface matches the Mat interface with the following limitations:
RyoheiHagimoto 0:0e0631af0305 77
RyoheiHagimoto 0:0e0631af0305 78 - no arbitrary dimensions support (only 2D)
RyoheiHagimoto 0:0e0631af0305 79 - no functions that return references to their data (because references on GPU are not valid for
RyoheiHagimoto 0:0e0631af0305 80 CPU)
RyoheiHagimoto 0:0e0631af0305 81 - no expression templates technique support
RyoheiHagimoto 0:0e0631af0305 82
RyoheiHagimoto 0:0e0631af0305 83 Beware that the latter limitation may lead to overloaded matrix operators that cause memory
RyoheiHagimoto 0:0e0631af0305 84 allocations. The GpuMat class is convertible to cuda::PtrStepSz and cuda::PtrStep so it can be
RyoheiHagimoto 0:0e0631af0305 85 passed directly to the kernel.
RyoheiHagimoto 0:0e0631af0305 86
RyoheiHagimoto 0:0e0631af0305 87 @note In contrast with Mat, in most cases GpuMat::isContinuous() == false . This means that rows are
RyoheiHagimoto 0:0e0631af0305 88 aligned to a size depending on the hardware. Single-row GpuMat is always a continuous matrix.
RyoheiHagimoto 0:0e0631af0305 89
RyoheiHagimoto 0:0e0631af0305 90 @note You are not recommended to leave static or global GpuMat variables allocated, that is, to rely
RyoheiHagimoto 0:0e0631af0305 91 on its destructor. The destruction order of such variables and CUDA context is undefined. GPU memory
RyoheiHagimoto 0:0e0631af0305 92 release function returns error if the CUDA context has been destroyed before.
RyoheiHagimoto 0:0e0631af0305 93
RyoheiHagimoto 0:0e0631af0305 94 @sa Mat
RyoheiHagimoto 0:0e0631af0305 95 */
RyoheiHagimoto 0:0e0631af0305 96 class CV_EXPORTS GpuMat
RyoheiHagimoto 0:0e0631af0305 97 {
RyoheiHagimoto 0:0e0631af0305 98 public:
RyoheiHagimoto 0:0e0631af0305 99 class CV_EXPORTS Allocator
RyoheiHagimoto 0:0e0631af0305 100 {
RyoheiHagimoto 0:0e0631af0305 101 public:
RyoheiHagimoto 0:0e0631af0305 102 virtual ~Allocator() {}
RyoheiHagimoto 0:0e0631af0305 103
RyoheiHagimoto 0:0e0631af0305 104 // allocator must fill data, step and refcount fields
RyoheiHagimoto 0:0e0631af0305 105 virtual bool allocate(GpuMat* mat, int rows, int cols, size_t elemSize) = 0;
RyoheiHagimoto 0:0e0631af0305 106 virtual void free(GpuMat* mat) = 0;
RyoheiHagimoto 0:0e0631af0305 107 };
RyoheiHagimoto 0:0e0631af0305 108
RyoheiHagimoto 0:0e0631af0305 109 //! default allocator
RyoheiHagimoto 0:0e0631af0305 110 static Allocator* defaultAllocator();
RyoheiHagimoto 0:0e0631af0305 111 static void setDefaultAllocator(Allocator* allocator);
RyoheiHagimoto 0:0e0631af0305 112
RyoheiHagimoto 0:0e0631af0305 113 //! default constructor
RyoheiHagimoto 0:0e0631af0305 114 explicit GpuMat(Allocator* allocator = defaultAllocator());
RyoheiHagimoto 0:0e0631af0305 115
RyoheiHagimoto 0:0e0631af0305 116 //! constructs GpuMat of the specified size and type
RyoheiHagimoto 0:0e0631af0305 117 GpuMat(int rows, int cols, int type, Allocator* allocator = defaultAllocator());
RyoheiHagimoto 0:0e0631af0305 118 GpuMat(Size size, int type, Allocator* allocator = defaultAllocator());
RyoheiHagimoto 0:0e0631af0305 119
RyoheiHagimoto 0:0e0631af0305 120 //! constucts GpuMat and fills it with the specified value _s
RyoheiHagimoto 0:0e0631af0305 121 GpuMat(int rows, int cols, int type, Scalar s, Allocator* allocator = defaultAllocator());
RyoheiHagimoto 0:0e0631af0305 122 GpuMat(Size size, int type, Scalar s, Allocator* allocator = defaultAllocator());
RyoheiHagimoto 0:0e0631af0305 123
RyoheiHagimoto 0:0e0631af0305 124 //! copy constructor
RyoheiHagimoto 0:0e0631af0305 125 GpuMat(const GpuMat& m);
RyoheiHagimoto 0:0e0631af0305 126
RyoheiHagimoto 0:0e0631af0305 127 //! constructor for GpuMat headers pointing to user-allocated data
RyoheiHagimoto 0:0e0631af0305 128 GpuMat(int rows, int cols, int type, void* data, size_t step = Mat::AUTO_STEP);
RyoheiHagimoto 0:0e0631af0305 129 GpuMat(Size size, int type, void* data, size_t step = Mat::AUTO_STEP);
RyoheiHagimoto 0:0e0631af0305 130
RyoheiHagimoto 0:0e0631af0305 131 //! creates a GpuMat header for a part of the bigger matrix
RyoheiHagimoto 0:0e0631af0305 132 GpuMat(const GpuMat& m, Range rowRange, Range colRange);
RyoheiHagimoto 0:0e0631af0305 133 GpuMat(const GpuMat& m, Rect roi);
RyoheiHagimoto 0:0e0631af0305 134
RyoheiHagimoto 0:0e0631af0305 135 //! builds GpuMat from host memory (Blocking call)
RyoheiHagimoto 0:0e0631af0305 136 explicit GpuMat(InputArray arr, Allocator* allocator = defaultAllocator());
RyoheiHagimoto 0:0e0631af0305 137
RyoheiHagimoto 0:0e0631af0305 138 //! destructor - calls release()
RyoheiHagimoto 0:0e0631af0305 139 ~GpuMat();
RyoheiHagimoto 0:0e0631af0305 140
RyoheiHagimoto 0:0e0631af0305 141 //! assignment operators
RyoheiHagimoto 0:0e0631af0305 142 GpuMat& operator =(const GpuMat& m);
RyoheiHagimoto 0:0e0631af0305 143
RyoheiHagimoto 0:0e0631af0305 144 //! allocates new GpuMat data unless the GpuMat already has specified size and type
RyoheiHagimoto 0:0e0631af0305 145 void create(int rows, int cols, int type);
RyoheiHagimoto 0:0e0631af0305 146 void create(Size size, int type);
RyoheiHagimoto 0:0e0631af0305 147
RyoheiHagimoto 0:0e0631af0305 148 //! decreases reference counter, deallocate the data when reference counter reaches 0
RyoheiHagimoto 0:0e0631af0305 149 void release();
RyoheiHagimoto 0:0e0631af0305 150
RyoheiHagimoto 0:0e0631af0305 151 //! swaps with other smart pointer
RyoheiHagimoto 0:0e0631af0305 152 void swap(GpuMat& mat);
RyoheiHagimoto 0:0e0631af0305 153
RyoheiHagimoto 0:0e0631af0305 154 //! pefroms upload data to GpuMat (Blocking call)
RyoheiHagimoto 0:0e0631af0305 155 void upload(InputArray arr);
RyoheiHagimoto 0:0e0631af0305 156
RyoheiHagimoto 0:0e0631af0305 157 //! pefroms upload data to GpuMat (Non-Blocking call)
RyoheiHagimoto 0:0e0631af0305 158 void upload(InputArray arr, Stream& stream);
RyoheiHagimoto 0:0e0631af0305 159
RyoheiHagimoto 0:0e0631af0305 160 //! pefroms download data from device to host memory (Blocking call)
RyoheiHagimoto 0:0e0631af0305 161 void download(OutputArray dst) const;
RyoheiHagimoto 0:0e0631af0305 162
RyoheiHagimoto 0:0e0631af0305 163 //! pefroms download data from device to host memory (Non-Blocking call)
RyoheiHagimoto 0:0e0631af0305 164 void download(OutputArray dst, Stream& stream) const;
RyoheiHagimoto 0:0e0631af0305 165
RyoheiHagimoto 0:0e0631af0305 166 //! returns deep copy of the GpuMat, i.e. the data is copied
RyoheiHagimoto 0:0e0631af0305 167 GpuMat clone() const;
RyoheiHagimoto 0:0e0631af0305 168
RyoheiHagimoto 0:0e0631af0305 169 //! copies the GpuMat content to device memory (Blocking call)
RyoheiHagimoto 0:0e0631af0305 170 void copyTo(OutputArray dst) const;
RyoheiHagimoto 0:0e0631af0305 171
RyoheiHagimoto 0:0e0631af0305 172 //! copies the GpuMat content to device memory (Non-Blocking call)
RyoheiHagimoto 0:0e0631af0305 173 void copyTo(OutputArray dst, Stream& stream) const;
RyoheiHagimoto 0:0e0631af0305 174
RyoheiHagimoto 0:0e0631af0305 175 //! copies those GpuMat elements to "m" that are marked with non-zero mask elements (Blocking call)
RyoheiHagimoto 0:0e0631af0305 176 void copyTo(OutputArray dst, InputArray mask) const;
RyoheiHagimoto 0:0e0631af0305 177
RyoheiHagimoto 0:0e0631af0305 178 //! copies those GpuMat elements to "m" that are marked with non-zero mask elements (Non-Blocking call)
RyoheiHagimoto 0:0e0631af0305 179 void copyTo(OutputArray dst, InputArray mask, Stream& stream) const;
RyoheiHagimoto 0:0e0631af0305 180
RyoheiHagimoto 0:0e0631af0305 181 //! sets some of the GpuMat elements to s (Blocking call)
RyoheiHagimoto 0:0e0631af0305 182 GpuMat& setTo(Scalar s);
RyoheiHagimoto 0:0e0631af0305 183
RyoheiHagimoto 0:0e0631af0305 184 //! sets some of the GpuMat elements to s (Non-Blocking call)
RyoheiHagimoto 0:0e0631af0305 185 GpuMat& setTo(Scalar s, Stream& stream);
RyoheiHagimoto 0:0e0631af0305 186
RyoheiHagimoto 0:0e0631af0305 187 //! sets some of the GpuMat elements to s, according to the mask (Blocking call)
RyoheiHagimoto 0:0e0631af0305 188 GpuMat& setTo(Scalar s, InputArray mask);
RyoheiHagimoto 0:0e0631af0305 189
RyoheiHagimoto 0:0e0631af0305 190 //! sets some of the GpuMat elements to s, according to the mask (Non-Blocking call)
RyoheiHagimoto 0:0e0631af0305 191 GpuMat& setTo(Scalar s, InputArray mask, Stream& stream);
RyoheiHagimoto 0:0e0631af0305 192
RyoheiHagimoto 0:0e0631af0305 193 //! converts GpuMat to another datatype (Blocking call)
RyoheiHagimoto 0:0e0631af0305 194 void convertTo(OutputArray dst, int rtype) const;
RyoheiHagimoto 0:0e0631af0305 195
RyoheiHagimoto 0:0e0631af0305 196 //! converts GpuMat to another datatype (Non-Blocking call)
RyoheiHagimoto 0:0e0631af0305 197 void convertTo(OutputArray dst, int rtype, Stream& stream) const;
RyoheiHagimoto 0:0e0631af0305 198
RyoheiHagimoto 0:0e0631af0305 199 //! converts GpuMat to another datatype with scaling (Blocking call)
RyoheiHagimoto 0:0e0631af0305 200 void convertTo(OutputArray dst, int rtype, double alpha, double beta = 0.0) const;
RyoheiHagimoto 0:0e0631af0305 201
RyoheiHagimoto 0:0e0631af0305 202 //! converts GpuMat to another datatype with scaling (Non-Blocking call)
RyoheiHagimoto 0:0e0631af0305 203 void convertTo(OutputArray dst, int rtype, double alpha, Stream& stream) const;
RyoheiHagimoto 0:0e0631af0305 204
RyoheiHagimoto 0:0e0631af0305 205 //! converts GpuMat to another datatype with scaling (Non-Blocking call)
RyoheiHagimoto 0:0e0631af0305 206 void convertTo(OutputArray dst, int rtype, double alpha, double beta, Stream& stream) const;
RyoheiHagimoto 0:0e0631af0305 207
RyoheiHagimoto 0:0e0631af0305 208 void assignTo(GpuMat& m, int type=-1) const;
RyoheiHagimoto 0:0e0631af0305 209
RyoheiHagimoto 0:0e0631af0305 210 //! returns pointer to y-th row
RyoheiHagimoto 0:0e0631af0305 211 uchar* ptr(int y = 0);
RyoheiHagimoto 0:0e0631af0305 212 const uchar* ptr(int y = 0) const;
RyoheiHagimoto 0:0e0631af0305 213
RyoheiHagimoto 0:0e0631af0305 214 //! template version of the above method
RyoheiHagimoto 0:0e0631af0305 215 template<typename _Tp> _Tp* ptr(int y = 0);
RyoheiHagimoto 0:0e0631af0305 216 template<typename _Tp> const _Tp* ptr(int y = 0) const;
RyoheiHagimoto 0:0e0631af0305 217
RyoheiHagimoto 0:0e0631af0305 218 template <typename _Tp> operator PtrStepSz<_Tp>() const;
RyoheiHagimoto 0:0e0631af0305 219 template <typename _Tp> operator PtrStep<_Tp>() const;
RyoheiHagimoto 0:0e0631af0305 220
RyoheiHagimoto 0:0e0631af0305 221 //! returns a new GpuMat header for the specified row
RyoheiHagimoto 0:0e0631af0305 222 GpuMat row(int y) const;
RyoheiHagimoto 0:0e0631af0305 223
RyoheiHagimoto 0:0e0631af0305 224 //! returns a new GpuMat header for the specified column
RyoheiHagimoto 0:0e0631af0305 225 GpuMat col(int x) const;
RyoheiHagimoto 0:0e0631af0305 226
RyoheiHagimoto 0:0e0631af0305 227 //! ... for the specified row span
RyoheiHagimoto 0:0e0631af0305 228 GpuMat rowRange(int startrow, int endrow) const;
RyoheiHagimoto 0:0e0631af0305 229 GpuMat rowRange(Range r) const;
RyoheiHagimoto 0:0e0631af0305 230
RyoheiHagimoto 0:0e0631af0305 231 //! ... for the specified column span
RyoheiHagimoto 0:0e0631af0305 232 GpuMat colRange(int startcol, int endcol) const;
RyoheiHagimoto 0:0e0631af0305 233 GpuMat colRange(Range r) const;
RyoheiHagimoto 0:0e0631af0305 234
RyoheiHagimoto 0:0e0631af0305 235 //! extracts a rectangular sub-GpuMat (this is a generalized form of row, rowRange etc.)
RyoheiHagimoto 0:0e0631af0305 236 GpuMat operator ()(Range rowRange, Range colRange) const;
RyoheiHagimoto 0:0e0631af0305 237 GpuMat operator ()(Rect roi) const;
RyoheiHagimoto 0:0e0631af0305 238
RyoheiHagimoto 0:0e0631af0305 239 //! creates alternative GpuMat header for the same data, with different
RyoheiHagimoto 0:0e0631af0305 240 //! number of channels and/or different number of rows
RyoheiHagimoto 0:0e0631af0305 241 GpuMat reshape(int cn, int rows = 0) const;
RyoheiHagimoto 0:0e0631af0305 242
RyoheiHagimoto 0:0e0631af0305 243 //! locates GpuMat header within a parent GpuMat
RyoheiHagimoto 0:0e0631af0305 244 void locateROI(Size& wholeSize, Point& ofs) const;
RyoheiHagimoto 0:0e0631af0305 245
RyoheiHagimoto 0:0e0631af0305 246 //! moves/resizes the current GpuMat ROI inside the parent GpuMat
RyoheiHagimoto 0:0e0631af0305 247 GpuMat& adjustROI(int dtop, int dbottom, int dleft, int dright);
RyoheiHagimoto 0:0e0631af0305 248
RyoheiHagimoto 0:0e0631af0305 249 //! returns true iff the GpuMat data is continuous
RyoheiHagimoto 0:0e0631af0305 250 //! (i.e. when there are no gaps between successive rows)
RyoheiHagimoto 0:0e0631af0305 251 bool isContinuous() const;
RyoheiHagimoto 0:0e0631af0305 252
RyoheiHagimoto 0:0e0631af0305 253 //! returns element size in bytes
RyoheiHagimoto 0:0e0631af0305 254 size_t elemSize() const;
RyoheiHagimoto 0:0e0631af0305 255
RyoheiHagimoto 0:0e0631af0305 256 //! returns the size of element channel in bytes
RyoheiHagimoto 0:0e0631af0305 257 size_t elemSize1() const;
RyoheiHagimoto 0:0e0631af0305 258
RyoheiHagimoto 0:0e0631af0305 259 //! returns element type
RyoheiHagimoto 0:0e0631af0305 260 int type() const;
RyoheiHagimoto 0:0e0631af0305 261
RyoheiHagimoto 0:0e0631af0305 262 //! returns element type
RyoheiHagimoto 0:0e0631af0305 263 int depth() const;
RyoheiHagimoto 0:0e0631af0305 264
RyoheiHagimoto 0:0e0631af0305 265 //! returns number of channels
RyoheiHagimoto 0:0e0631af0305 266 int channels() const;
RyoheiHagimoto 0:0e0631af0305 267
RyoheiHagimoto 0:0e0631af0305 268 //! returns step/elemSize1()
RyoheiHagimoto 0:0e0631af0305 269 size_t step1() const;
RyoheiHagimoto 0:0e0631af0305 270
RyoheiHagimoto 0:0e0631af0305 271 //! returns GpuMat size : width == number of columns, height == number of rows
RyoheiHagimoto 0:0e0631af0305 272 Size size() const;
RyoheiHagimoto 0:0e0631af0305 273
RyoheiHagimoto 0:0e0631af0305 274 //! returns true if GpuMat data is NULL
RyoheiHagimoto 0:0e0631af0305 275 bool empty() const;
RyoheiHagimoto 0:0e0631af0305 276
RyoheiHagimoto 0:0e0631af0305 277 /*! includes several bit-fields:
RyoheiHagimoto 0:0e0631af0305 278 - the magic signature
RyoheiHagimoto 0:0e0631af0305 279 - continuity flag
RyoheiHagimoto 0:0e0631af0305 280 - depth
RyoheiHagimoto 0:0e0631af0305 281 - number of channels
RyoheiHagimoto 0:0e0631af0305 282 */
RyoheiHagimoto 0:0e0631af0305 283 int flags;
RyoheiHagimoto 0:0e0631af0305 284
RyoheiHagimoto 0:0e0631af0305 285 //! the number of rows and columns
RyoheiHagimoto 0:0e0631af0305 286 int rows, cols;
RyoheiHagimoto 0:0e0631af0305 287
RyoheiHagimoto 0:0e0631af0305 288 //! a distance between successive rows in bytes; includes the gap if any
RyoheiHagimoto 0:0e0631af0305 289 size_t step;
RyoheiHagimoto 0:0e0631af0305 290
RyoheiHagimoto 0:0e0631af0305 291 //! pointer to the data
RyoheiHagimoto 0:0e0631af0305 292 uchar* data;
RyoheiHagimoto 0:0e0631af0305 293
RyoheiHagimoto 0:0e0631af0305 294 //! pointer to the reference counter;
RyoheiHagimoto 0:0e0631af0305 295 //! when GpuMat points to user-allocated data, the pointer is NULL
RyoheiHagimoto 0:0e0631af0305 296 int* refcount;
RyoheiHagimoto 0:0e0631af0305 297
RyoheiHagimoto 0:0e0631af0305 298 //! helper fields used in locateROI and adjustROI
RyoheiHagimoto 0:0e0631af0305 299 uchar* datastart;
RyoheiHagimoto 0:0e0631af0305 300 const uchar* dataend;
RyoheiHagimoto 0:0e0631af0305 301
RyoheiHagimoto 0:0e0631af0305 302 //! allocator
RyoheiHagimoto 0:0e0631af0305 303 Allocator* allocator;
RyoheiHagimoto 0:0e0631af0305 304 };
RyoheiHagimoto 0:0e0631af0305 305
RyoheiHagimoto 0:0e0631af0305 306 /** @brief Creates a continuous matrix.
RyoheiHagimoto 0:0e0631af0305 307
RyoheiHagimoto 0:0e0631af0305 308 @param rows Row count.
RyoheiHagimoto 0:0e0631af0305 309 @param cols Column count.
RyoheiHagimoto 0:0e0631af0305 310 @param type Type of the matrix.
RyoheiHagimoto 0:0e0631af0305 311 @param arr Destination matrix. This parameter changes only if it has a proper type and area (
RyoheiHagimoto 0:0e0631af0305 312 \f$\texttt{rows} \times \texttt{cols}\f$ ).
RyoheiHagimoto 0:0e0631af0305 313
RyoheiHagimoto 0:0e0631af0305 314 Matrix is called continuous if its elements are stored continuously, that is, without gaps at the
RyoheiHagimoto 0:0e0631af0305 315 end of each row.
RyoheiHagimoto 0:0e0631af0305 316 */
RyoheiHagimoto 0:0e0631af0305 317 CV_EXPORTS void createContinuous(int rows, int cols, int type, OutputArray arr);
RyoheiHagimoto 0:0e0631af0305 318
RyoheiHagimoto 0:0e0631af0305 319 /** @brief Ensures that the size of a matrix is big enough and the matrix has a proper type.
RyoheiHagimoto 0:0e0631af0305 320
RyoheiHagimoto 0:0e0631af0305 321 @param rows Minimum desired number of rows.
RyoheiHagimoto 0:0e0631af0305 322 @param cols Minimum desired number of columns.
RyoheiHagimoto 0:0e0631af0305 323 @param type Desired matrix type.
RyoheiHagimoto 0:0e0631af0305 324 @param arr Destination matrix.
RyoheiHagimoto 0:0e0631af0305 325
RyoheiHagimoto 0:0e0631af0305 326 The function does not reallocate memory if the matrix has proper attributes already.
RyoheiHagimoto 0:0e0631af0305 327 */
RyoheiHagimoto 0:0e0631af0305 328 CV_EXPORTS void ensureSizeIsEnough(int rows, int cols, int type, OutputArray arr);
RyoheiHagimoto 0:0e0631af0305 329
RyoheiHagimoto 0:0e0631af0305 330 //! BufferPool management (must be called before Stream creation)
RyoheiHagimoto 0:0e0631af0305 331 CV_EXPORTS void setBufferPoolUsage(bool on);
RyoheiHagimoto 0:0e0631af0305 332 CV_EXPORTS void setBufferPoolConfig(int deviceId, size_t stackSize, int stackCount);
RyoheiHagimoto 0:0e0631af0305 333
RyoheiHagimoto 0:0e0631af0305 334 //===================================================================================
RyoheiHagimoto 0:0e0631af0305 335 // HostMem
RyoheiHagimoto 0:0e0631af0305 336 //===================================================================================
RyoheiHagimoto 0:0e0631af0305 337
RyoheiHagimoto 0:0e0631af0305 338 /** @brief Class with reference counting wrapping special memory type allocation functions from CUDA.
RyoheiHagimoto 0:0e0631af0305 339
RyoheiHagimoto 0:0e0631af0305 340 Its interface is also Mat-like but with additional memory type parameters.
RyoheiHagimoto 0:0e0631af0305 341
RyoheiHagimoto 0:0e0631af0305 342 - **PAGE_LOCKED** sets a page locked memory type used commonly for fast and asynchronous
RyoheiHagimoto 0:0e0631af0305 343 uploading/downloading data from/to GPU.
RyoheiHagimoto 0:0e0631af0305 344 - **SHARED** specifies a zero copy memory allocation that enables mapping the host memory to GPU
RyoheiHagimoto 0:0e0631af0305 345 address space, if supported.
RyoheiHagimoto 0:0e0631af0305 346 - **WRITE_COMBINED** sets the write combined buffer that is not cached by CPU. Such buffers are
RyoheiHagimoto 0:0e0631af0305 347 used to supply GPU with data when GPU only reads it. The advantage is a better CPU cache
RyoheiHagimoto 0:0e0631af0305 348 utilization.
RyoheiHagimoto 0:0e0631af0305 349
RyoheiHagimoto 0:0e0631af0305 350 @note Allocation size of such memory types is usually limited. For more details, see *CUDA 2.2
RyoheiHagimoto 0:0e0631af0305 351 Pinned Memory APIs* document or *CUDA C Programming Guide*.
RyoheiHagimoto 0:0e0631af0305 352 */
RyoheiHagimoto 0:0e0631af0305 353 class CV_EXPORTS HostMem
RyoheiHagimoto 0:0e0631af0305 354 {
RyoheiHagimoto 0:0e0631af0305 355 public:
RyoheiHagimoto 0:0e0631af0305 356 enum AllocType { PAGE_LOCKED = 1, SHARED = 2, WRITE_COMBINED = 4 };
RyoheiHagimoto 0:0e0631af0305 357
RyoheiHagimoto 0:0e0631af0305 358 static MatAllocator* getAllocator(AllocType alloc_type = PAGE_LOCKED);
RyoheiHagimoto 0:0e0631af0305 359
RyoheiHagimoto 0:0e0631af0305 360 explicit HostMem(AllocType alloc_type = PAGE_LOCKED);
RyoheiHagimoto 0:0e0631af0305 361
RyoheiHagimoto 0:0e0631af0305 362 HostMem(const HostMem& m);
RyoheiHagimoto 0:0e0631af0305 363
RyoheiHagimoto 0:0e0631af0305 364 HostMem(int rows, int cols, int type, AllocType alloc_type = PAGE_LOCKED);
RyoheiHagimoto 0:0e0631af0305 365 HostMem(Size size, int type, AllocType alloc_type = PAGE_LOCKED);
RyoheiHagimoto 0:0e0631af0305 366
RyoheiHagimoto 0:0e0631af0305 367 //! creates from host memory with coping data
RyoheiHagimoto 0:0e0631af0305 368 explicit HostMem(InputArray arr, AllocType alloc_type = PAGE_LOCKED);
RyoheiHagimoto 0:0e0631af0305 369
RyoheiHagimoto 0:0e0631af0305 370 ~HostMem();
RyoheiHagimoto 0:0e0631af0305 371
RyoheiHagimoto 0:0e0631af0305 372 HostMem& operator =(const HostMem& m);
RyoheiHagimoto 0:0e0631af0305 373
RyoheiHagimoto 0:0e0631af0305 374 //! swaps with other smart pointer
RyoheiHagimoto 0:0e0631af0305 375 void swap(HostMem& b);
RyoheiHagimoto 0:0e0631af0305 376
RyoheiHagimoto 0:0e0631af0305 377 //! returns deep copy of the matrix, i.e. the data is copied
RyoheiHagimoto 0:0e0631af0305 378 HostMem clone() const;
RyoheiHagimoto 0:0e0631af0305 379
RyoheiHagimoto 0:0e0631af0305 380 //! allocates new matrix data unless the matrix already has specified size and type.
RyoheiHagimoto 0:0e0631af0305 381 void create(int rows, int cols, int type);
RyoheiHagimoto 0:0e0631af0305 382 void create(Size size, int type);
RyoheiHagimoto 0:0e0631af0305 383
RyoheiHagimoto 0:0e0631af0305 384 //! creates alternative HostMem header for the same data, with different
RyoheiHagimoto 0:0e0631af0305 385 //! number of channels and/or different number of rows
RyoheiHagimoto 0:0e0631af0305 386 HostMem reshape(int cn, int rows = 0) const;
RyoheiHagimoto 0:0e0631af0305 387
RyoheiHagimoto 0:0e0631af0305 388 //! decrements reference counter and released memory if needed.
RyoheiHagimoto 0:0e0631af0305 389 void release();
RyoheiHagimoto 0:0e0631af0305 390
RyoheiHagimoto 0:0e0631af0305 391 //! returns matrix header with disabled reference counting for HostMem data.
RyoheiHagimoto 0:0e0631af0305 392 Mat createMatHeader() const;
RyoheiHagimoto 0:0e0631af0305 393
RyoheiHagimoto 0:0e0631af0305 394 /** @brief Maps CPU memory to GPU address space and creates the cuda::GpuMat header without reference counting
RyoheiHagimoto 0:0e0631af0305 395 for it.
RyoheiHagimoto 0:0e0631af0305 396
RyoheiHagimoto 0:0e0631af0305 397 This can be done only if memory was allocated with the SHARED flag and if it is supported by the
RyoheiHagimoto 0:0e0631af0305 398 hardware. Laptops often share video and CPU memory, so address spaces can be mapped, which
RyoheiHagimoto 0:0e0631af0305 399 eliminates an extra copy.
RyoheiHagimoto 0:0e0631af0305 400 */
RyoheiHagimoto 0:0e0631af0305 401 GpuMat createGpuMatHeader() const;
RyoheiHagimoto 0:0e0631af0305 402
RyoheiHagimoto 0:0e0631af0305 403 // Please see cv::Mat for descriptions
RyoheiHagimoto 0:0e0631af0305 404 bool isContinuous() const;
RyoheiHagimoto 0:0e0631af0305 405 size_t elemSize() const;
RyoheiHagimoto 0:0e0631af0305 406 size_t elemSize1() const;
RyoheiHagimoto 0:0e0631af0305 407 int type() const;
RyoheiHagimoto 0:0e0631af0305 408 int depth() const;
RyoheiHagimoto 0:0e0631af0305 409 int channels() const;
RyoheiHagimoto 0:0e0631af0305 410 size_t step1() const;
RyoheiHagimoto 0:0e0631af0305 411 Size size() const;
RyoheiHagimoto 0:0e0631af0305 412 bool empty() const;
RyoheiHagimoto 0:0e0631af0305 413
RyoheiHagimoto 0:0e0631af0305 414 // Please see cv::Mat for descriptions
RyoheiHagimoto 0:0e0631af0305 415 int flags;
RyoheiHagimoto 0:0e0631af0305 416 int rows, cols;
RyoheiHagimoto 0:0e0631af0305 417 size_t step;
RyoheiHagimoto 0:0e0631af0305 418
RyoheiHagimoto 0:0e0631af0305 419 uchar* data;
RyoheiHagimoto 0:0e0631af0305 420 int* refcount;
RyoheiHagimoto 0:0e0631af0305 421
RyoheiHagimoto 0:0e0631af0305 422 uchar* datastart;
RyoheiHagimoto 0:0e0631af0305 423 const uchar* dataend;
RyoheiHagimoto 0:0e0631af0305 424
RyoheiHagimoto 0:0e0631af0305 425 AllocType alloc_type;
RyoheiHagimoto 0:0e0631af0305 426 };
RyoheiHagimoto 0:0e0631af0305 427
RyoheiHagimoto 0:0e0631af0305 428 /** @brief Page-locks the memory of matrix and maps it for the device(s).
RyoheiHagimoto 0:0e0631af0305 429
RyoheiHagimoto 0:0e0631af0305 430 @param m Input matrix.
RyoheiHagimoto 0:0e0631af0305 431 */
RyoheiHagimoto 0:0e0631af0305 432 CV_EXPORTS void registerPageLocked(Mat& m);
RyoheiHagimoto 0:0e0631af0305 433
RyoheiHagimoto 0:0e0631af0305 434 /** @brief Unmaps the memory of matrix and makes it pageable again.
RyoheiHagimoto 0:0e0631af0305 435
RyoheiHagimoto 0:0e0631af0305 436 @param m Input matrix.
RyoheiHagimoto 0:0e0631af0305 437 */
RyoheiHagimoto 0:0e0631af0305 438 CV_EXPORTS void unregisterPageLocked(Mat& m);
RyoheiHagimoto 0:0e0631af0305 439
RyoheiHagimoto 0:0e0631af0305 440 //===================================================================================
RyoheiHagimoto 0:0e0631af0305 441 // Stream
RyoheiHagimoto 0:0e0631af0305 442 //===================================================================================
RyoheiHagimoto 0:0e0631af0305 443
RyoheiHagimoto 0:0e0631af0305 444 /** @brief This class encapsulates a queue of asynchronous calls.
RyoheiHagimoto 0:0e0631af0305 445
RyoheiHagimoto 0:0e0631af0305 446 @note Currently, you may face problems if an operation is enqueued twice with different data. Some
RyoheiHagimoto 0:0e0631af0305 447 functions use the constant GPU memory, and next call may update the memory before the previous one
RyoheiHagimoto 0:0e0631af0305 448 has been finished. But calling different operations asynchronously is safe because each operation
RyoheiHagimoto 0:0e0631af0305 449 has its own constant buffer. Memory copy/upload/download/set operations to the buffers you hold are
RyoheiHagimoto 0:0e0631af0305 450 also safe.
RyoheiHagimoto 0:0e0631af0305 451
RyoheiHagimoto 0:0e0631af0305 452 @note The Stream class is not thread-safe. Please use different Stream objects for different CPU threads.
RyoheiHagimoto 0:0e0631af0305 453
RyoheiHagimoto 0:0e0631af0305 454 @code
RyoheiHagimoto 0:0e0631af0305 455 void thread1()
RyoheiHagimoto 0:0e0631af0305 456 {
RyoheiHagimoto 0:0e0631af0305 457 cv::cuda::Stream stream1;
RyoheiHagimoto 0:0e0631af0305 458 cv::cuda::func1(..., stream1);
RyoheiHagimoto 0:0e0631af0305 459 }
RyoheiHagimoto 0:0e0631af0305 460
RyoheiHagimoto 0:0e0631af0305 461 void thread2()
RyoheiHagimoto 0:0e0631af0305 462 {
RyoheiHagimoto 0:0e0631af0305 463 cv::cuda::Stream stream2;
RyoheiHagimoto 0:0e0631af0305 464 cv::cuda::func2(..., stream2);
RyoheiHagimoto 0:0e0631af0305 465 }
RyoheiHagimoto 0:0e0631af0305 466 @endcode
RyoheiHagimoto 0:0e0631af0305 467
RyoheiHagimoto 0:0e0631af0305 468 @note By default all CUDA routines are launched in Stream::Null() object, if the stream is not specified by user.
RyoheiHagimoto 0:0e0631af0305 469 In multi-threading environment the stream objects must be passed explicitly (see previous note).
RyoheiHagimoto 0:0e0631af0305 470 */
RyoheiHagimoto 0:0e0631af0305 471 class CV_EXPORTS Stream
RyoheiHagimoto 0:0e0631af0305 472 {
RyoheiHagimoto 0:0e0631af0305 473 typedef void (Stream::*bool_type)() const;
RyoheiHagimoto 0:0e0631af0305 474 void this_type_does_not_support_comparisons() const {}
RyoheiHagimoto 0:0e0631af0305 475
RyoheiHagimoto 0:0e0631af0305 476 public:
RyoheiHagimoto 0:0e0631af0305 477 typedef void (*StreamCallback)(int status, void* userData);
RyoheiHagimoto 0:0e0631af0305 478
RyoheiHagimoto 0:0e0631af0305 479 //! creates a new asynchronous stream
RyoheiHagimoto 0:0e0631af0305 480 Stream();
RyoheiHagimoto 0:0e0631af0305 481
RyoheiHagimoto 0:0e0631af0305 482 /** @brief Returns true if the current stream queue is finished. Otherwise, it returns false.
RyoheiHagimoto 0:0e0631af0305 483 */
RyoheiHagimoto 0:0e0631af0305 484 bool queryIfComplete() const;
RyoheiHagimoto 0:0e0631af0305 485
RyoheiHagimoto 0:0e0631af0305 486 /** @brief Blocks the current CPU thread until all operations in the stream are complete.
RyoheiHagimoto 0:0e0631af0305 487 */
RyoheiHagimoto 0:0e0631af0305 488 void waitForCompletion();
RyoheiHagimoto 0:0e0631af0305 489
RyoheiHagimoto 0:0e0631af0305 490 /** @brief Makes a compute stream wait on an event.
RyoheiHagimoto 0:0e0631af0305 491 */
RyoheiHagimoto 0:0e0631af0305 492 void waitEvent(const Event& event);
RyoheiHagimoto 0:0e0631af0305 493
RyoheiHagimoto 0:0e0631af0305 494 /** @brief Adds a callback to be called on the host after all currently enqueued items in the stream have
RyoheiHagimoto 0:0e0631af0305 495 completed.
RyoheiHagimoto 0:0e0631af0305 496
RyoheiHagimoto 0:0e0631af0305 497 @note Callbacks must not make any CUDA API calls. Callbacks must not perform any synchronization
RyoheiHagimoto 0:0e0631af0305 498 that may depend on outstanding device work or other callbacks that are not mandated to run earlier.
RyoheiHagimoto 0:0e0631af0305 499 Callbacks without a mandated order (in independent streams) execute in undefined order and may be
RyoheiHagimoto 0:0e0631af0305 500 serialized.
RyoheiHagimoto 0:0e0631af0305 501 */
RyoheiHagimoto 0:0e0631af0305 502 void enqueueHostCallback(StreamCallback callback, void* userData);
RyoheiHagimoto 0:0e0631af0305 503
RyoheiHagimoto 0:0e0631af0305 504 //! return Stream object for default CUDA stream
RyoheiHagimoto 0:0e0631af0305 505 static Stream& Null();
RyoheiHagimoto 0:0e0631af0305 506
RyoheiHagimoto 0:0e0631af0305 507 //! returns true if stream object is not default (!= 0)
RyoheiHagimoto 0:0e0631af0305 508 operator bool_type() const;
RyoheiHagimoto 0:0e0631af0305 509
RyoheiHagimoto 0:0e0631af0305 510 class Impl;
RyoheiHagimoto 0:0e0631af0305 511
RyoheiHagimoto 0:0e0631af0305 512 private:
RyoheiHagimoto 0:0e0631af0305 513 Ptr<Impl> impl_;
RyoheiHagimoto 0:0e0631af0305 514 Stream(const Ptr<Impl>& impl);
RyoheiHagimoto 0:0e0631af0305 515
RyoheiHagimoto 0:0e0631af0305 516 friend struct StreamAccessor;
RyoheiHagimoto 0:0e0631af0305 517 friend class BufferPool;
RyoheiHagimoto 0:0e0631af0305 518 friend class DefaultDeviceInitializer;
RyoheiHagimoto 0:0e0631af0305 519 };
RyoheiHagimoto 0:0e0631af0305 520
RyoheiHagimoto 0:0e0631af0305 521 class CV_EXPORTS Event
RyoheiHagimoto 0:0e0631af0305 522 {
RyoheiHagimoto 0:0e0631af0305 523 public:
RyoheiHagimoto 0:0e0631af0305 524 enum CreateFlags
RyoheiHagimoto 0:0e0631af0305 525 {
RyoheiHagimoto 0:0e0631af0305 526 DEFAULT = 0x00, /**< Default event flag */
RyoheiHagimoto 0:0e0631af0305 527 BLOCKING_SYNC = 0x01, /**< Event uses blocking synchronization */
RyoheiHagimoto 0:0e0631af0305 528 DISABLE_TIMING = 0x02, /**< Event will not record timing data */
RyoheiHagimoto 0:0e0631af0305 529 INTERPROCESS = 0x04 /**< Event is suitable for interprocess use. DisableTiming must be set */
RyoheiHagimoto 0:0e0631af0305 530 };
RyoheiHagimoto 0:0e0631af0305 531
RyoheiHagimoto 0:0e0631af0305 532 explicit Event(CreateFlags flags = DEFAULT);
RyoheiHagimoto 0:0e0631af0305 533
RyoheiHagimoto 0:0e0631af0305 534 //! records an event
RyoheiHagimoto 0:0e0631af0305 535 void record(Stream& stream = Stream::Null());
RyoheiHagimoto 0:0e0631af0305 536
RyoheiHagimoto 0:0e0631af0305 537 //! queries an event's status
RyoheiHagimoto 0:0e0631af0305 538 bool queryIfComplete() const;
RyoheiHagimoto 0:0e0631af0305 539
RyoheiHagimoto 0:0e0631af0305 540 //! waits for an event to complete
RyoheiHagimoto 0:0e0631af0305 541 void waitForCompletion();
RyoheiHagimoto 0:0e0631af0305 542
RyoheiHagimoto 0:0e0631af0305 543 //! computes the elapsed time between events
RyoheiHagimoto 0:0e0631af0305 544 static float elapsedTime(const Event& start, const Event& end);
RyoheiHagimoto 0:0e0631af0305 545
RyoheiHagimoto 0:0e0631af0305 546 class Impl;
RyoheiHagimoto 0:0e0631af0305 547
RyoheiHagimoto 0:0e0631af0305 548 private:
RyoheiHagimoto 0:0e0631af0305 549 Ptr<Impl> impl_;
RyoheiHagimoto 0:0e0631af0305 550 Event(const Ptr<Impl>& impl);
RyoheiHagimoto 0:0e0631af0305 551
RyoheiHagimoto 0:0e0631af0305 552 friend struct EventAccessor;
RyoheiHagimoto 0:0e0631af0305 553 };
RyoheiHagimoto 0:0e0631af0305 554
RyoheiHagimoto 0:0e0631af0305 555 //! @} cudacore_struct
RyoheiHagimoto 0:0e0631af0305 556
RyoheiHagimoto 0:0e0631af0305 557 //===================================================================================
RyoheiHagimoto 0:0e0631af0305 558 // Initialization & Info
RyoheiHagimoto 0:0e0631af0305 559 //===================================================================================
RyoheiHagimoto 0:0e0631af0305 560
RyoheiHagimoto 0:0e0631af0305 561 //! @addtogroup cudacore_init
RyoheiHagimoto 0:0e0631af0305 562 //! @{
RyoheiHagimoto 0:0e0631af0305 563
RyoheiHagimoto 0:0e0631af0305 564 /** @brief Returns the number of installed CUDA-enabled devices.
RyoheiHagimoto 0:0e0631af0305 565
RyoheiHagimoto 0:0e0631af0305 566 Use this function before any other CUDA functions calls. If OpenCV is compiled without CUDA support,
RyoheiHagimoto 0:0e0631af0305 567 this function returns 0.
RyoheiHagimoto 0:0e0631af0305 568 */
RyoheiHagimoto 0:0e0631af0305 569 CV_EXPORTS int getCudaEnabledDeviceCount();
RyoheiHagimoto 0:0e0631af0305 570
RyoheiHagimoto 0:0e0631af0305 571 /** @brief Sets a device and initializes it for the current thread.
RyoheiHagimoto 0:0e0631af0305 572
RyoheiHagimoto 0:0e0631af0305 573 @param device System index of a CUDA device starting with 0.
RyoheiHagimoto 0:0e0631af0305 574
RyoheiHagimoto 0:0e0631af0305 575 If the call of this function is omitted, a default device is initialized at the fist CUDA usage.
RyoheiHagimoto 0:0e0631af0305 576 */
RyoheiHagimoto 0:0e0631af0305 577 CV_EXPORTS void setDevice(int device);
RyoheiHagimoto 0:0e0631af0305 578
RyoheiHagimoto 0:0e0631af0305 579 /** @brief Returns the current device index set by cuda::setDevice or initialized by default.
RyoheiHagimoto 0:0e0631af0305 580 */
RyoheiHagimoto 0:0e0631af0305 581 CV_EXPORTS int getDevice();
RyoheiHagimoto 0:0e0631af0305 582
RyoheiHagimoto 0:0e0631af0305 583 /** @brief Explicitly destroys and cleans up all resources associated with the current device in the current
RyoheiHagimoto 0:0e0631af0305 584 process.
RyoheiHagimoto 0:0e0631af0305 585
RyoheiHagimoto 0:0e0631af0305 586 Any subsequent API call to this device will reinitialize the device.
RyoheiHagimoto 0:0e0631af0305 587 */
RyoheiHagimoto 0:0e0631af0305 588 CV_EXPORTS void resetDevice();
RyoheiHagimoto 0:0e0631af0305 589
RyoheiHagimoto 0:0e0631af0305 590 /** @brief Enumeration providing CUDA computing features.
RyoheiHagimoto 0:0e0631af0305 591 */
RyoheiHagimoto 0:0e0631af0305 592 enum FeatureSet
RyoheiHagimoto 0:0e0631af0305 593 {
RyoheiHagimoto 0:0e0631af0305 594 FEATURE_SET_COMPUTE_10 = 10,
RyoheiHagimoto 0:0e0631af0305 595 FEATURE_SET_COMPUTE_11 = 11,
RyoheiHagimoto 0:0e0631af0305 596 FEATURE_SET_COMPUTE_12 = 12,
RyoheiHagimoto 0:0e0631af0305 597 FEATURE_SET_COMPUTE_13 = 13,
RyoheiHagimoto 0:0e0631af0305 598 FEATURE_SET_COMPUTE_20 = 20,
RyoheiHagimoto 0:0e0631af0305 599 FEATURE_SET_COMPUTE_21 = 21,
RyoheiHagimoto 0:0e0631af0305 600 FEATURE_SET_COMPUTE_30 = 30,
RyoheiHagimoto 0:0e0631af0305 601 FEATURE_SET_COMPUTE_32 = 32,
RyoheiHagimoto 0:0e0631af0305 602 FEATURE_SET_COMPUTE_35 = 35,
RyoheiHagimoto 0:0e0631af0305 603 FEATURE_SET_COMPUTE_50 = 50,
RyoheiHagimoto 0:0e0631af0305 604
RyoheiHagimoto 0:0e0631af0305 605 GLOBAL_ATOMICS = FEATURE_SET_COMPUTE_11,
RyoheiHagimoto 0:0e0631af0305 606 SHARED_ATOMICS = FEATURE_SET_COMPUTE_12,
RyoheiHagimoto 0:0e0631af0305 607 NATIVE_DOUBLE = FEATURE_SET_COMPUTE_13,
RyoheiHagimoto 0:0e0631af0305 608 WARP_SHUFFLE_FUNCTIONS = FEATURE_SET_COMPUTE_30,
RyoheiHagimoto 0:0e0631af0305 609 DYNAMIC_PARALLELISM = FEATURE_SET_COMPUTE_35
RyoheiHagimoto 0:0e0631af0305 610 };
RyoheiHagimoto 0:0e0631af0305 611
RyoheiHagimoto 0:0e0631af0305 612 //! checks whether current device supports the given feature
RyoheiHagimoto 0:0e0631af0305 613 CV_EXPORTS bool deviceSupports(FeatureSet feature_set);
RyoheiHagimoto 0:0e0631af0305 614
RyoheiHagimoto 0:0e0631af0305 615 /** @brief Class providing a set of static methods to check what NVIDIA\* card architecture the CUDA module was
RyoheiHagimoto 0:0e0631af0305 616 built for.
RyoheiHagimoto 0:0e0631af0305 617
RyoheiHagimoto 0:0e0631af0305 618 According to the CUDA C Programming Guide Version 3.2: "PTX code produced for some specific compute
RyoheiHagimoto 0:0e0631af0305 619 capability can always be compiled to binary code of greater or equal compute capability".
RyoheiHagimoto 0:0e0631af0305 620 */
RyoheiHagimoto 0:0e0631af0305 621 class CV_EXPORTS TargetArchs
RyoheiHagimoto 0:0e0631af0305 622 {
RyoheiHagimoto 0:0e0631af0305 623 public:
RyoheiHagimoto 0:0e0631af0305 624 /** @brief The following method checks whether the module was built with the support of the given feature:
RyoheiHagimoto 0:0e0631af0305 625
RyoheiHagimoto 0:0e0631af0305 626 @param feature_set Features to be checked. See :ocvcuda::FeatureSet.
RyoheiHagimoto 0:0e0631af0305 627 */
RyoheiHagimoto 0:0e0631af0305 628 static bool builtWith(FeatureSet feature_set);
RyoheiHagimoto 0:0e0631af0305 629
RyoheiHagimoto 0:0e0631af0305 630 /** @brief There is a set of methods to check whether the module contains intermediate (PTX) or binary CUDA
RyoheiHagimoto 0:0e0631af0305 631 code for the given architecture(s):
RyoheiHagimoto 0:0e0631af0305 632
RyoheiHagimoto 0:0e0631af0305 633 @param major Major compute capability version.
RyoheiHagimoto 0:0e0631af0305 634 @param minor Minor compute capability version.
RyoheiHagimoto 0:0e0631af0305 635 */
RyoheiHagimoto 0:0e0631af0305 636 static bool has(int major, int minor);
RyoheiHagimoto 0:0e0631af0305 637 static bool hasPtx(int major, int minor);
RyoheiHagimoto 0:0e0631af0305 638 static bool hasBin(int major, int minor);
RyoheiHagimoto 0:0e0631af0305 639
RyoheiHagimoto 0:0e0631af0305 640 static bool hasEqualOrLessPtx(int major, int minor);
RyoheiHagimoto 0:0e0631af0305 641 static bool hasEqualOrGreater(int major, int minor);
RyoheiHagimoto 0:0e0631af0305 642 static bool hasEqualOrGreaterPtx(int major, int minor);
RyoheiHagimoto 0:0e0631af0305 643 static bool hasEqualOrGreaterBin(int major, int minor);
RyoheiHagimoto 0:0e0631af0305 644 };
RyoheiHagimoto 0:0e0631af0305 645
RyoheiHagimoto 0:0e0631af0305 646 /** @brief Class providing functionality for querying the specified GPU properties.
RyoheiHagimoto 0:0e0631af0305 647 */
RyoheiHagimoto 0:0e0631af0305 648 class CV_EXPORTS DeviceInfo
RyoheiHagimoto 0:0e0631af0305 649 {
RyoheiHagimoto 0:0e0631af0305 650 public:
RyoheiHagimoto 0:0e0631af0305 651 //! creates DeviceInfo object for the current GPU
RyoheiHagimoto 0:0e0631af0305 652 DeviceInfo();
RyoheiHagimoto 0:0e0631af0305 653
RyoheiHagimoto 0:0e0631af0305 654 /** @brief The constructors.
RyoheiHagimoto 0:0e0631af0305 655
RyoheiHagimoto 0:0e0631af0305 656 @param device_id System index of the CUDA device starting with 0.
RyoheiHagimoto 0:0e0631af0305 657
RyoheiHagimoto 0:0e0631af0305 658 Constructs the DeviceInfo object for the specified device. If device_id parameter is missed, it
RyoheiHagimoto 0:0e0631af0305 659 constructs an object for the current device.
RyoheiHagimoto 0:0e0631af0305 660 */
RyoheiHagimoto 0:0e0631af0305 661 DeviceInfo(int device_id);
RyoheiHagimoto 0:0e0631af0305 662
RyoheiHagimoto 0:0e0631af0305 663 /** @brief Returns system index of the CUDA device starting with 0.
RyoheiHagimoto 0:0e0631af0305 664 */
RyoheiHagimoto 0:0e0631af0305 665 int deviceID() const;
RyoheiHagimoto 0:0e0631af0305 666
RyoheiHagimoto 0:0e0631af0305 667 //! ASCII string identifying device
RyoheiHagimoto 0:0e0631af0305 668 const char* name() const;
RyoheiHagimoto 0:0e0631af0305 669
RyoheiHagimoto 0:0e0631af0305 670 //! global memory available on device in bytes
RyoheiHagimoto 0:0e0631af0305 671 size_t totalGlobalMem() const;
RyoheiHagimoto 0:0e0631af0305 672
RyoheiHagimoto 0:0e0631af0305 673 //! shared memory available per block in bytes
RyoheiHagimoto 0:0e0631af0305 674 size_t sharedMemPerBlock() const;
RyoheiHagimoto 0:0e0631af0305 675
RyoheiHagimoto 0:0e0631af0305 676 //! 32-bit registers available per block
RyoheiHagimoto 0:0e0631af0305 677 int regsPerBlock() const;
RyoheiHagimoto 0:0e0631af0305 678
RyoheiHagimoto 0:0e0631af0305 679 //! warp size in threads
RyoheiHagimoto 0:0e0631af0305 680 int warpSize() const;
RyoheiHagimoto 0:0e0631af0305 681
RyoheiHagimoto 0:0e0631af0305 682 //! maximum pitch in bytes allowed by memory copies
RyoheiHagimoto 0:0e0631af0305 683 size_t memPitch() const;
RyoheiHagimoto 0:0e0631af0305 684
RyoheiHagimoto 0:0e0631af0305 685 //! maximum number of threads per block
RyoheiHagimoto 0:0e0631af0305 686 int maxThreadsPerBlock() const;
RyoheiHagimoto 0:0e0631af0305 687
RyoheiHagimoto 0:0e0631af0305 688 //! maximum size of each dimension of a block
RyoheiHagimoto 0:0e0631af0305 689 Vec3i maxThreadsDim() const;
RyoheiHagimoto 0:0e0631af0305 690
RyoheiHagimoto 0:0e0631af0305 691 //! maximum size of each dimension of a grid
RyoheiHagimoto 0:0e0631af0305 692 Vec3i maxGridSize() const;
RyoheiHagimoto 0:0e0631af0305 693
RyoheiHagimoto 0:0e0631af0305 694 //! clock frequency in kilohertz
RyoheiHagimoto 0:0e0631af0305 695 int clockRate() const;
RyoheiHagimoto 0:0e0631af0305 696
RyoheiHagimoto 0:0e0631af0305 697 //! constant memory available on device in bytes
RyoheiHagimoto 0:0e0631af0305 698 size_t totalConstMem() const;
RyoheiHagimoto 0:0e0631af0305 699
RyoheiHagimoto 0:0e0631af0305 700 //! major compute capability
RyoheiHagimoto 0:0e0631af0305 701 int majorVersion() const;
RyoheiHagimoto 0:0e0631af0305 702
RyoheiHagimoto 0:0e0631af0305 703 //! minor compute capability
RyoheiHagimoto 0:0e0631af0305 704 int minorVersion() const;
RyoheiHagimoto 0:0e0631af0305 705
RyoheiHagimoto 0:0e0631af0305 706 //! alignment requirement for textures
RyoheiHagimoto 0:0e0631af0305 707 size_t textureAlignment() const;
RyoheiHagimoto 0:0e0631af0305 708
RyoheiHagimoto 0:0e0631af0305 709 //! pitch alignment requirement for texture references bound to pitched memory
RyoheiHagimoto 0:0e0631af0305 710 size_t texturePitchAlignment() const;
RyoheiHagimoto 0:0e0631af0305 711
RyoheiHagimoto 0:0e0631af0305 712 //! number of multiprocessors on device
RyoheiHagimoto 0:0e0631af0305 713 int multiProcessorCount() const;
RyoheiHagimoto 0:0e0631af0305 714
RyoheiHagimoto 0:0e0631af0305 715 //! specified whether there is a run time limit on kernels
RyoheiHagimoto 0:0e0631af0305 716 bool kernelExecTimeoutEnabled() const;
RyoheiHagimoto 0:0e0631af0305 717
RyoheiHagimoto 0:0e0631af0305 718 //! device is integrated as opposed to discrete
RyoheiHagimoto 0:0e0631af0305 719 bool integrated() const;
RyoheiHagimoto 0:0e0631af0305 720
RyoheiHagimoto 0:0e0631af0305 721 //! device can map host memory with cudaHostAlloc/cudaHostGetDevicePointer
RyoheiHagimoto 0:0e0631af0305 722 bool canMapHostMemory() const;
RyoheiHagimoto 0:0e0631af0305 723
RyoheiHagimoto 0:0e0631af0305 724 enum ComputeMode
RyoheiHagimoto 0:0e0631af0305 725 {
RyoheiHagimoto 0:0e0631af0305 726 ComputeModeDefault, /**< default compute mode (Multiple threads can use cudaSetDevice with this device) */
RyoheiHagimoto 0:0e0631af0305 727 ComputeModeExclusive, /**< compute-exclusive-thread mode (Only one thread in one process will be able to use cudaSetDevice with this device) */
RyoheiHagimoto 0:0e0631af0305 728 ComputeModeProhibited, /**< compute-prohibited mode (No threads can use cudaSetDevice with this device) */
RyoheiHagimoto 0:0e0631af0305 729 ComputeModeExclusiveProcess /**< compute-exclusive-process mode (Many threads in one process will be able to use cudaSetDevice with this device) */
RyoheiHagimoto 0:0e0631af0305 730 };
RyoheiHagimoto 0:0e0631af0305 731
RyoheiHagimoto 0:0e0631af0305 732 //! compute mode
RyoheiHagimoto 0:0e0631af0305 733 ComputeMode computeMode() const;
RyoheiHagimoto 0:0e0631af0305 734
RyoheiHagimoto 0:0e0631af0305 735 //! maximum 1D texture size
RyoheiHagimoto 0:0e0631af0305 736 int maxTexture1D() const;
RyoheiHagimoto 0:0e0631af0305 737
RyoheiHagimoto 0:0e0631af0305 738 //! maximum 1D mipmapped texture size
RyoheiHagimoto 0:0e0631af0305 739 int maxTexture1DMipmap() const;
RyoheiHagimoto 0:0e0631af0305 740
RyoheiHagimoto 0:0e0631af0305 741 //! maximum size for 1D textures bound to linear memory
RyoheiHagimoto 0:0e0631af0305 742 int maxTexture1DLinear() const;
RyoheiHagimoto 0:0e0631af0305 743
RyoheiHagimoto 0:0e0631af0305 744 //! maximum 2D texture dimensions
RyoheiHagimoto 0:0e0631af0305 745 Vec2i maxTexture2D() const;
RyoheiHagimoto 0:0e0631af0305 746
RyoheiHagimoto 0:0e0631af0305 747 //! maximum 2D mipmapped texture dimensions
RyoheiHagimoto 0:0e0631af0305 748 Vec2i maxTexture2DMipmap() const;
RyoheiHagimoto 0:0e0631af0305 749
RyoheiHagimoto 0:0e0631af0305 750 //! maximum dimensions (width, height, pitch) for 2D textures bound to pitched memory
RyoheiHagimoto 0:0e0631af0305 751 Vec3i maxTexture2DLinear() const;
RyoheiHagimoto 0:0e0631af0305 752
RyoheiHagimoto 0:0e0631af0305 753 //! maximum 2D texture dimensions if texture gather operations have to be performed
RyoheiHagimoto 0:0e0631af0305 754 Vec2i maxTexture2DGather() const;
RyoheiHagimoto 0:0e0631af0305 755
RyoheiHagimoto 0:0e0631af0305 756 //! maximum 3D texture dimensions
RyoheiHagimoto 0:0e0631af0305 757 Vec3i maxTexture3D() const;
RyoheiHagimoto 0:0e0631af0305 758
RyoheiHagimoto 0:0e0631af0305 759 //! maximum Cubemap texture dimensions
RyoheiHagimoto 0:0e0631af0305 760 int maxTextureCubemap() const;
RyoheiHagimoto 0:0e0631af0305 761
RyoheiHagimoto 0:0e0631af0305 762 //! maximum 1D layered texture dimensions
RyoheiHagimoto 0:0e0631af0305 763 Vec2i maxTexture1DLayered() const;
RyoheiHagimoto 0:0e0631af0305 764
RyoheiHagimoto 0:0e0631af0305 765 //! maximum 2D layered texture dimensions
RyoheiHagimoto 0:0e0631af0305 766 Vec3i maxTexture2DLayered() const;
RyoheiHagimoto 0:0e0631af0305 767
RyoheiHagimoto 0:0e0631af0305 768 //! maximum Cubemap layered texture dimensions
RyoheiHagimoto 0:0e0631af0305 769 Vec2i maxTextureCubemapLayered() const;
RyoheiHagimoto 0:0e0631af0305 770
RyoheiHagimoto 0:0e0631af0305 771 //! maximum 1D surface size
RyoheiHagimoto 0:0e0631af0305 772 int maxSurface1D() const;
RyoheiHagimoto 0:0e0631af0305 773
RyoheiHagimoto 0:0e0631af0305 774 //! maximum 2D surface dimensions
RyoheiHagimoto 0:0e0631af0305 775 Vec2i maxSurface2D() const;
RyoheiHagimoto 0:0e0631af0305 776
RyoheiHagimoto 0:0e0631af0305 777 //! maximum 3D surface dimensions
RyoheiHagimoto 0:0e0631af0305 778 Vec3i maxSurface3D() const;
RyoheiHagimoto 0:0e0631af0305 779
RyoheiHagimoto 0:0e0631af0305 780 //! maximum 1D layered surface dimensions
RyoheiHagimoto 0:0e0631af0305 781 Vec2i maxSurface1DLayered() const;
RyoheiHagimoto 0:0e0631af0305 782
RyoheiHagimoto 0:0e0631af0305 783 //! maximum 2D layered surface dimensions
RyoheiHagimoto 0:0e0631af0305 784 Vec3i maxSurface2DLayered() const;
RyoheiHagimoto 0:0e0631af0305 785
RyoheiHagimoto 0:0e0631af0305 786 //! maximum Cubemap surface dimensions
RyoheiHagimoto 0:0e0631af0305 787 int maxSurfaceCubemap() const;
RyoheiHagimoto 0:0e0631af0305 788
RyoheiHagimoto 0:0e0631af0305 789 //! maximum Cubemap layered surface dimensions
RyoheiHagimoto 0:0e0631af0305 790 Vec2i maxSurfaceCubemapLayered() const;
RyoheiHagimoto 0:0e0631af0305 791
RyoheiHagimoto 0:0e0631af0305 792 //! alignment requirements for surfaces
RyoheiHagimoto 0:0e0631af0305 793 size_t surfaceAlignment() const;
RyoheiHagimoto 0:0e0631af0305 794
RyoheiHagimoto 0:0e0631af0305 795 //! device can possibly execute multiple kernels concurrently
RyoheiHagimoto 0:0e0631af0305 796 bool concurrentKernels() const;
RyoheiHagimoto 0:0e0631af0305 797
RyoheiHagimoto 0:0e0631af0305 798 //! device has ECC support enabled
RyoheiHagimoto 0:0e0631af0305 799 bool ECCEnabled() const;
RyoheiHagimoto 0:0e0631af0305 800
RyoheiHagimoto 0:0e0631af0305 801 //! PCI bus ID of the device
RyoheiHagimoto 0:0e0631af0305 802 int pciBusID() const;
RyoheiHagimoto 0:0e0631af0305 803
RyoheiHagimoto 0:0e0631af0305 804 //! PCI device ID of the device
RyoheiHagimoto 0:0e0631af0305 805 int pciDeviceID() const;
RyoheiHagimoto 0:0e0631af0305 806
RyoheiHagimoto 0:0e0631af0305 807 //! PCI domain ID of the device
RyoheiHagimoto 0:0e0631af0305 808 int pciDomainID() const;
RyoheiHagimoto 0:0e0631af0305 809
RyoheiHagimoto 0:0e0631af0305 810 //! true if device is a Tesla device using TCC driver, false otherwise
RyoheiHagimoto 0:0e0631af0305 811 bool tccDriver() const;
RyoheiHagimoto 0:0e0631af0305 812
RyoheiHagimoto 0:0e0631af0305 813 //! number of asynchronous engines
RyoheiHagimoto 0:0e0631af0305 814 int asyncEngineCount() const;
RyoheiHagimoto 0:0e0631af0305 815
RyoheiHagimoto 0:0e0631af0305 816 //! device shares a unified address space with the host
RyoheiHagimoto 0:0e0631af0305 817 bool unifiedAddressing() const;
RyoheiHagimoto 0:0e0631af0305 818
RyoheiHagimoto 0:0e0631af0305 819 //! peak memory clock frequency in kilohertz
RyoheiHagimoto 0:0e0631af0305 820 int memoryClockRate() const;
RyoheiHagimoto 0:0e0631af0305 821
RyoheiHagimoto 0:0e0631af0305 822 //! global memory bus width in bits
RyoheiHagimoto 0:0e0631af0305 823 int memoryBusWidth() const;
RyoheiHagimoto 0:0e0631af0305 824
RyoheiHagimoto 0:0e0631af0305 825 //! size of L2 cache in bytes
RyoheiHagimoto 0:0e0631af0305 826 int l2CacheSize() const;
RyoheiHagimoto 0:0e0631af0305 827
RyoheiHagimoto 0:0e0631af0305 828 //! maximum resident threads per multiprocessor
RyoheiHagimoto 0:0e0631af0305 829 int maxThreadsPerMultiProcessor() const;
RyoheiHagimoto 0:0e0631af0305 830
RyoheiHagimoto 0:0e0631af0305 831 //! gets free and total device memory
RyoheiHagimoto 0:0e0631af0305 832 void queryMemory(size_t& totalMemory, size_t& freeMemory) const;
RyoheiHagimoto 0:0e0631af0305 833 size_t freeMemory() const;
RyoheiHagimoto 0:0e0631af0305 834 size_t totalMemory() const;
RyoheiHagimoto 0:0e0631af0305 835
RyoheiHagimoto 0:0e0631af0305 836 /** @brief Provides information on CUDA feature support.
RyoheiHagimoto 0:0e0631af0305 837
RyoheiHagimoto 0:0e0631af0305 838 @param feature_set Features to be checked. See cuda::FeatureSet.
RyoheiHagimoto 0:0e0631af0305 839
RyoheiHagimoto 0:0e0631af0305 840 This function returns true if the device has the specified CUDA feature. Otherwise, it returns false
RyoheiHagimoto 0:0e0631af0305 841 */
RyoheiHagimoto 0:0e0631af0305 842 bool supports(FeatureSet feature_set) const;
RyoheiHagimoto 0:0e0631af0305 843
RyoheiHagimoto 0:0e0631af0305 844 /** @brief Checks the CUDA module and device compatibility.
RyoheiHagimoto 0:0e0631af0305 845
RyoheiHagimoto 0:0e0631af0305 846 This function returns true if the CUDA module can be run on the specified device. Otherwise, it
RyoheiHagimoto 0:0e0631af0305 847 returns false .
RyoheiHagimoto 0:0e0631af0305 848 */
RyoheiHagimoto 0:0e0631af0305 849 bool isCompatible() const;
RyoheiHagimoto 0:0e0631af0305 850
RyoheiHagimoto 0:0e0631af0305 851 private:
RyoheiHagimoto 0:0e0631af0305 852 int device_id_;
RyoheiHagimoto 0:0e0631af0305 853 };
RyoheiHagimoto 0:0e0631af0305 854
RyoheiHagimoto 0:0e0631af0305 855 CV_EXPORTS void printCudaDeviceInfo(int device);
RyoheiHagimoto 0:0e0631af0305 856 CV_EXPORTS void printShortCudaDeviceInfo(int device);
RyoheiHagimoto 0:0e0631af0305 857
RyoheiHagimoto 0:0e0631af0305 858 /** @brief Converts an array to half precision floating number.
RyoheiHagimoto 0:0e0631af0305 859
RyoheiHagimoto 0:0e0631af0305 860 @param _src input array.
RyoheiHagimoto 0:0e0631af0305 861 @param _dst output array.
RyoheiHagimoto 0:0e0631af0305 862 @param stream Stream for the asynchronous version.
RyoheiHagimoto 0:0e0631af0305 863 @sa convertFp16
RyoheiHagimoto 0:0e0631af0305 864 */
RyoheiHagimoto 0:0e0631af0305 865 CV_EXPORTS void convertFp16(InputArray _src, OutputArray _dst, Stream& stream = Stream::Null());
RyoheiHagimoto 0:0e0631af0305 866
RyoheiHagimoto 0:0e0631af0305 867 //! @} cudacore_init
RyoheiHagimoto 0:0e0631af0305 868
RyoheiHagimoto 0:0e0631af0305 869 }} // namespace cv { namespace cuda {
RyoheiHagimoto 0:0e0631af0305 870
RyoheiHagimoto 0:0e0631af0305 871
RyoheiHagimoto 0:0e0631af0305 872 #include "opencv2/core/cuda.inl.hpp"
RyoheiHagimoto 0:0e0631af0305 873
RyoheiHagimoto 0:0e0631af0305 874 #endif /* OPENCV_CORE_CUDA_HPP */