EstervQrCode 2.0.0
Library for qr code manipulation
Loading...
Searching...
No Matches
ocl.hpp
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) 2013, OpenCV Foundation, all rights reserved.
14// Third party copyrights are property of their respective owners.
15//
16// Redistribution and use in source and binary forms, with or without modification,
17// are permitted provided that the following conditions are met:
18//
19// * Redistribution's of source code must retain the above copyright notice,
20// this list of conditions and the following disclaimer.
21//
22// * Redistribution's in binary form must reproduce the above copyright notice,
23// this list of conditions and the following disclaimer in the documentation
24// and/or other materials provided with the distribution.
25//
26// * The name of the copyright holders may not be used to endorse or promote products
27// derived from this software without specific prior written permission.
28//
29// This software is provided by the copyright holders and contributors "as is" and
30// any express or implied warranties, including, but not limited to, the implied
31// warranties of merchantability and fitness for a particular purpose are disclaimed.
32// In no event shall the OpenCV Foundation or contributors be liable for any direct,
33// indirect, incidental, special, exemplary, or consequential damages
34// (including, but not limited to, procurement of substitute goods or services;
35// loss of use, data, or profits; or business interruption) however caused
36// and on any theory of liability, whether in contract, strict liability,
37// or tort (including negligence or otherwise) arising in any way out of
38// the use of this software, even if advised of the possibility of such damage.
39//
40//M*/
41
42#ifndef OPENCV_OPENCL_HPP
43#define OPENCV_OPENCL_HPP
44
45#include "opencv2/core.hpp"
46#include <typeinfo>
47#include <typeindex>
48
49namespace cv { namespace ocl {
50
53
58CV_EXPORTS_W void setUseOpenCL(bool flag);
60
62
71
73{
74public:
76 explicit Device(void* d);
77 Device(const Device& d);
78 Device& operator = (const Device& d);
80 Device& operator = (Device&& d) CV_NOEXCEPT;
82
83 void set(void* d);
84
85 enum
86 {
87 TYPE_DEFAULT = (1 << 0),
88 TYPE_CPU = (1 << 1),
89 TYPE_GPU = (1 << 2),
90 TYPE_ACCELERATOR = (1 << 3),
91 TYPE_DGPU = TYPE_GPU + (1 << 16),
92 TYPE_IGPU = TYPE_GPU + (1 << 17),
93 TYPE_ALL = 0xFFFFFFFF
94 };
95
98 CV_WRAP bool isExtensionSupported(const String& extensionName) const;
106 void* ptr() const;
107
108 CV_WRAP int type() const;
109
110 CV_WRAP int addressBits() const;
111 CV_WRAP bool available() const;
114
115 enum
116 {
117 FP_DENORM=(1 << 0),
118 FP_INF_NAN=(1 << 1),
119 FP_ROUND_TO_NEAREST=(1 << 2),
120 FP_ROUND_TO_ZERO=(1 << 3),
121 FP_ROUND_TO_INF=(1 << 4),
122 FP_FMA=(1 << 5),
123 FP_SOFT_FLOAT=(1 << 6),
124 FP_CORRECTLY_ROUNDED_DIVIDE_SQRT=(1 << 7)
125 };
129
131 CV_WRAP bool hasFP64() const;
133 CV_WRAP bool hasFP16() const;
134
135 CV_WRAP bool endianLittle() const;
137
138 enum
139 {
140 EXEC_KERNEL=(1 << 0),
141 EXEC_NATIVE_KERNEL=(1 << 1)
142 };
144
146
147 enum
148 {
149 NO_CACHE=0,
150 READ_ONLY_CACHE=1,
151 READ_WRITE_CACHE=2
152 };
155 CV_WRAP size_t globalMemSize() const;
156
157 CV_WRAP size_t localMemSize() const;
158 enum
159 {
160 NO_LOCAL_MEM=0,
161 LOCAL_IS_LOCAL=1,
162 LOCAL_IS_GLOBAL=2
163 };
166
167 CV_WRAP bool imageSupport() const;
168
172
175
176 CV_WRAP size_t image2DMaxWidth() const;
177 CV_WRAP size_t image2DMaxHeight() const;
178
179 CV_WRAP size_t image3DMaxWidth() const;
180 CV_WRAP size_t image3DMaxHeight() const;
181 CV_WRAP size_t image3DMaxDepth() const;
182
185
186 enum
187 {
188 UNKNOWN_VENDOR=0,
189 VENDOR_AMD=1,
190 VENDOR_INTEL=2,
191 VENDOR_NVIDIA=3
192 };
193 CV_WRAP int vendorID() const;
194 // FIXIT
195 // dev.isAMD() doesn't work for OpenCL CPU devices from AMD OpenCL platform.
196 // This method should use platform name instead of vendor name.
197 // After fix restore code in arithm.cpp: ocl_compare()
198 CV_WRAP inline bool isAMD() const { return vendorID() == VENDOR_AMD; }
199 CV_WRAP inline bool isIntel() const { return vendorID() == VENDOR_INTEL; }
200 CV_WRAP inline bool isNVidia() const { return vendorID() == VENDOR_NVIDIA; }
201
206
207 CV_WRAP size_t maxMemAllocSize() const;
208 CV_WRAP size_t maxParameterSize() const;
209
212 CV_WRAP int maxSamplers() const;
213
214 CV_WRAP size_t maxWorkGroupSize() const;
216 void maxWorkItemSizes(size_t*) const;
217
219
227
235
236 CV_WRAP size_t printfBufferSize() const;
238
239 CV_WRAP static const Device& getDefault();
240
248 static Device fromHandle(void* d);
249
250 struct Impl;
251 inline Impl* getImpl() const { return (Impl*)p; }
252 inline bool empty() const { return !p; }
253protected:
254 Impl* p;
255};
256
257
259{
260public:
262 explicit Context(int dtype);
264 Context(const Context& c);
265 Context& operator= (const Context& c);
267 Context& operator = (Context&& c) CV_NOEXCEPT;
268
270 bool create();
272 bool create(int dtype);
273
274 size_t ndevices() const;
275 Device& device(size_t idx) const;
276 Program getProg(const ProgramSource& prog,
277 const String& buildopt, String& errmsg);
278 void unloadProg(Program& prog);
279
280
282#if 0 // OpenCV 5.0
283 static Context& getDefault();
284#else
285 static Context& getDefault(bool initialize = true);
286#endif
287
289 void* ptr() const;
290
296 void* getOpenCLContextProperty(int propertyId) const;
297
298 bool useSVM() const;
299 void setUseSVM(bool enabled);
300
304 static Context fromHandle(void* context);
305 static Context fromDevice(const ocl::Device& device);
306 static Context create(const std::string& configuration);
307
308 void release();
309
311 public:
312 virtual ~UserContext();
313 };
314 template <typename T>
315 inline void setUserContext(const std::shared_ptr<T>& userContext) {
316 setUserContext(typeid(T), userContext);
317 }
318 template <typename T>
320 return std::dynamic_pointer_cast<T>(getUserContext(typeid(T)));
321 }
324
325 struct Impl;
326 inline Impl* getImpl() const { return (Impl*)p; }
327 inline bool empty() const { return !p; }
328// TODO OpenCV 5.0
329//protected:
330 Impl* p;
331};
332
335{
336public:
340 Platform& operator = (const Platform& p);
342 Platform& operator = (Platform&& p) CV_NOEXCEPT;
343
344 void* ptr() const;
345
347 static Platform& getDefault();
348
349 struct Impl;
350 inline Impl* getImpl() const { return (Impl*)p; }
351 inline bool empty() const { return !p; }
352protected:
353 Impl* p;
354};
355
366CV_EXPORTS void attachContext(const String& platformName, void* platformID, void* context, void* deviceID);
367
380CV_EXPORTS void convertFromBuffer(void* cl_mem_buffer, size_t step, int rows, int cols, int type, UMat& dst);
381
389CV_EXPORTS void convertFromImage(void* cl_mem_image, UMat& dst);
390
391// TODO Move to internal header
393void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device);
394
396{
397public:
399 explicit Queue(const Context& c, const Device& d=Device());
401 Queue(const Queue& q);
402 Queue& operator = (const Queue& q);
404 Queue& operator = (Queue&& q) CV_NOEXCEPT;
405
406 bool create(const Context& c=Context(), const Device& d=Device());
407 void finish();
408 void* ptr() const;
409 static Queue& getDefault();
410
412 const Queue& getProfilingQueue() const;
413
414 struct Impl; friend struct Impl;
415 inline Impl* getImpl() const { return p; }
416 inline bool empty() const { return !p; }
417protected:
418 Impl* p;
419};
420
421
423{
424public:
425 enum { LOCAL=1, READ_ONLY=2, WRITE_ONLY=4, READ_WRITE=6, CONSTANT=8, PTR_ONLY = 16, NO_SIZE=256 };
426 KernelArg(int _flags, UMat* _m, int wscale=1, int iwscale=1, const void* _obj=0, size_t _sz=0);
428
429 static KernelArg Local(size_t localMemSize)
430 { return KernelArg(LOCAL, 0, 1, 1, 0, localMemSize); }
431 static KernelArg PtrWriteOnly(const UMat& m)
432 { return KernelArg(PTR_ONLY+WRITE_ONLY, (UMat*)&m); }
433 static KernelArg PtrReadOnly(const UMat& m)
434 { return KernelArg(PTR_ONLY+READ_ONLY, (UMat*)&m); }
435 static KernelArg PtrReadWrite(const UMat& m)
436 { return KernelArg(PTR_ONLY+READ_WRITE, (UMat*)&m); }
437 static KernelArg ReadWrite(const UMat& m, int wscale=1, int iwscale=1)
438 { return KernelArg(READ_WRITE, (UMat*)&m, wscale, iwscale); }
439 static KernelArg ReadWriteNoSize(const UMat& m, int wscale=1, int iwscale=1)
440 { return KernelArg(READ_WRITE+NO_SIZE, (UMat*)&m, wscale, iwscale); }
441 static KernelArg ReadOnly(const UMat& m, int wscale=1, int iwscale=1)
442 { return KernelArg(READ_ONLY, (UMat*)&m, wscale, iwscale); }
443 static KernelArg WriteOnly(const UMat& m, int wscale=1, int iwscale=1)
444 { return KernelArg(WRITE_ONLY, (UMat*)&m, wscale, iwscale); }
445 static KernelArg ReadOnlyNoSize(const UMat& m, int wscale=1, int iwscale=1)
446 { return KernelArg(READ_ONLY+NO_SIZE, (UMat*)&m, wscale, iwscale); }
447 static KernelArg WriteOnlyNoSize(const UMat& m, int wscale=1, int iwscale=1)
448 { return KernelArg(WRITE_ONLY+NO_SIZE, (UMat*)&m, wscale, iwscale); }
449 static KernelArg Constant(const Mat& m);
450 template<typename _Tp> static KernelArg Constant(const _Tp* arr, size_t n)
451 { return KernelArg(CONSTANT, 0, 1, 1, (void*)arr, n); }
452
453 int flags;
455 const void* obj;
456 size_t sz;
457 int wscale, iwscale;
458};
459
460
462{
463public:
465 Kernel(const char* kname, const Program& prog);
466 Kernel(const char* kname, const ProgramSource& prog,
467 const String& buildopts = String(), String* errmsg=0);
469 Kernel(const Kernel& k);
470 Kernel& operator = (const Kernel& k);
472 Kernel& operator = (Kernel&& k) CV_NOEXCEPT;
473
474 bool empty() const;
475 bool create(const char* kname, const Program& prog);
476 bool create(const char* kname, const ProgramSource& prog,
477 const String& buildopts, String* errmsg=0);
478
479 int set(int i, const void* value, size_t sz);
480 int set(int i, const Image2D& image2D);
481 int set(int i, const UMat& m);
482 int set(int i, const KernelArg& arg);
483 template<typename _Tp> int set(int i, const _Tp& value)
484 { return set(i, &value, sizeof(value)); }
485
486
487protected:
488 template<typename _Tp0> inline
489 int set_args_(int i, const _Tp0& a0) { return set(i, a0); }
490 template<typename _Tp0, typename... _Tps> inline
491 int set_args_(int i, const _Tp0& a0, const _Tps&... rest_args) { i = set(i, a0); return set_args_(i, rest_args...); }
492public:
504 template<typename... _Tps> inline
505 Kernel& args(const _Tps&... kernel_args) { set_args_(0, kernel_args...); return *this; }
506
520 bool run(int dims, size_t globalsize[],
521 size_t localsize[], bool sync, const Queue& q=Queue());
522
531 bool run_(int dims, size_t globalsize[], size_t localsize[], bool sync, const Queue& q=Queue());
532
533 bool runTask(bool sync, const Queue& q=Queue());
534
540 int64 runProfiling(int dims, size_t globalsize[], size_t localsize[], const Queue& q=Queue());
541
542 size_t workGroupSize() const;
544 bool compileWorkGroupSize(size_t wsz[]) const;
545 size_t localMemSize() const;
546
547 void* ptr() const;
548 struct Impl;
549
550protected:
551 Impl* p;
552};
553
555{
556public:
559 const String& buildflags, String& errmsg);
560 Program(const Program& prog);
561 Program& operator = (const Program& prog);
563 Program& operator = (Program&& prog) CV_NOEXCEPT;
565
566 bool create(const ProgramSource& src,
567 const String& buildflags, String& errmsg);
568
569 void* ptr() const;
570
580 void getBinary(std::vector<char>& binary) const;
581
582 struct Impl; friend struct Impl;
583 inline Impl* getImpl() const { return (Impl*)p; }
584 inline bool empty() const { return !p; }
585protected:
586 Impl* p;
587public:
588#ifndef OPENCV_REMOVE_DEPRECATED_API
589 // TODO Remove this
590 CV_DEPRECATED bool read(const String& buf, const String& buildflags); // removed, use ProgramSource instead
591 CV_DEPRECATED bool write(String& buf) const; // removed, use getBinary() method instead (RAW OpenCL binary)
592 CV_DEPRECATED const ProgramSource& source() const; // implementation removed
593 CV_DEPRECATED String getPrefix() const; // deprecated, implementation replaced
594 CV_DEPRECATED static String getPrefix(const String& buildflags); // deprecated, implementation replaced
595#endif
596};
597
598
600{
601public:
602 typedef uint64 hash_t; // deprecated
603
605 explicit ProgramSource(const String& module, const String& name, const String& codeStr, const String& codeHash);
606 explicit ProgramSource(const String& prog); // deprecated
607 explicit ProgramSource(const char* prog); // deprecated
610 ProgramSource& operator = (const ProgramSource& prog);
613
614 const String& source() const; // deprecated
615 hash_t hash() const; // deprecated
616
617
632 static ProgramSource fromBinary(const String& module, const String& name,
633 const unsigned char* binary, const size_t size,
634 const cv::String& buildOptions = cv::String());
635
657 static ProgramSource fromSPIR(const String& module, const String& name,
658 const unsigned char* binary, const size_t size,
659 const cv::String& buildOptions = cv::String());
660
661 //OpenCL 2.1+ only
662 //static Program fromSPIRV(const String& module, const String& name,
663 // const unsigned char* binary, const size_t size,
664 // const cv::String& buildOptions = cv::String());
665
666 struct Impl; friend struct Impl;
667 inline Impl* getImpl() const { return (Impl*)p; }
668 inline bool empty() const { return !p; }
669protected:
670 Impl* p;
671};
672
674{
675public:
680 explicit PlatformInfo(void* id);
682
684 PlatformInfo& operator =(const PlatformInfo& i);
687
688 String name() const;
689 String vendor() const;
690
692 String version() const;
693 int versionMajor() const;
694 int versionMinor() const;
695
696 int deviceNumber() const;
697 void getDevice(Device& device, int d) const;
698
699 struct Impl;
700 bool empty() const { return !p; }
701protected:
702 Impl* p;
703};
704
705CV_EXPORTS CV_DEPRECATED const char* convertTypeStr(int sdepth, int ddepth, int cn, char* buf);
706CV_EXPORTS const char* convertTypeStr(int sdepth, int ddepth, int cn, char* buf, size_t buf_size);
707CV_EXPORTS const char* typeToStr(int t);
708CV_EXPORTS const char* memopTypeToStr(int t);
709CV_EXPORTS const char* vecopTypeToStr(int t);
710CV_EXPORTS const char* getOpenCLErrorString(int errorCode);
711CV_EXPORTS String kernelToStr(InputArray _kernel, int ddepth = -1, const char * name = NULL);
713
714
716{
717 // all matrices have its own vector width
719 // all matrices have maximal vector width among all matrices
720 // (useful for cases when matrices have different data types)
722
723 // default strategy
726
728 InputArray src4 = noArray(), InputArray src5 = noArray(), InputArray src6 = noArray(),
729 InputArray src7 = noArray(), InputArray src8 = noArray(), InputArray src9 = noArray(),
731
732CV_EXPORTS int checkOptimalVectorWidth(const int *vectorWidths,
734 InputArray src4 = noArray(), InputArray src5 = noArray(), InputArray src6 = noArray(),
735 InputArray src7 = noArray(), InputArray src8 = noArray(), InputArray src9 = noArray(),
737
738// with OCL_VECTOR_MAX strategy
740 InputArray src4 = noArray(), InputArray src5 = noArray(), InputArray src6 = noArray(),
741 InputArray src7 = noArray(), InputArray src8 = noArray(), InputArray src9 = noArray());
742
744
746{
747public:
749
756 explicit Image2D(const UMat &src, bool norm = false, bool alias = false);
757 Image2D(const Image2D & i);
759
760 Image2D & operator = (const Image2D & i);
763
767 static bool canCreateAlias(const UMat &u);
768
771 static bool isFormatSupported(int depth, int cn, bool norm);
772
773 void* ptr() const;
774protected:
775 struct Impl;
776 Impl* p;
777};
778
780{
781public:
782 Timer(const Queue& q);
784 void start();
785 void stop();
786
788
789protected:
790 struct Impl;
791 Impl* const p;
792
793private:
794 Timer(const Timer&); // disabled
795 Timer& operator=(const Timer&); // disabled
796};
797
799
800
802{
803public:
806
809
812
820 Queue& getQueue() const;
821
822 bool useOpenCL() const;
823 void setUseOpenCL(bool flag);
824
832
835
842 void bind() const;
843
851
866 static OpenCLExecutionContext create(const std::string& platformName, void* platformID, void* context, void* deviceID);
867
874 static OpenCLExecutionContext create(const Context& context, const Device& device, const ocl::Queue& queue);
876 static OpenCLExecutionContext create(const Context& context, const Device& device);
877
878 struct Impl;
879 inline bool empty() const { return !p; }
880 void release();
881protected:
883};
884
886{
888public:
890 {
891 CV_Assert(!ctx.empty());
892 ctx_ = OpenCLExecutionContext::getCurrentRef();
893 ctx.bind();
894 }
895
897 {
898 if (!ctx_.empty())
899 {
900 ctx_.bind();
901 }
902 }
903};
904
905#ifdef __OPENCV_BUILD
906namespace internal {
907
908CV_EXPORTS bool isOpenCLForced();
909#define OCL_FORCE_CHECK(condition) (cv::ocl::internal::isOpenCLForced() || (condition))
910
911CV_EXPORTS bool isPerformanceCheckBypassed();
912#define OCL_PERFORMANCE_CHECK(condition) (cv::ocl::internal::isPerformanceCheckBypassed() || (condition))
913
914CV_EXPORTS bool isCLBuffer(UMat& u);
915
916} // namespace internal
917#endif
918
920
921}}
922
923#endif
Custom array allocator.
Definition mat.hpp:480
n-dimensional dense array class
Definition mat.hpp:812
Definition mat.hpp:2433
Definition ocl.hpp:310
Definition ocl.hpp:259
void setUseSVM(bool enabled)
Context() CV_NOEXCEPT
void * getOpenCLContextProperty(int propertyId) const
Get OpenCL context property specified on context creation.
bool useSVM() const
bool empty() const
Definition ocl.hpp:327
Impl * getImpl() const
Definition ocl.hpp:326
std::shared_ptr< UserContext > getUserContext(std::type_index typeId)
static Context create(const std::string &configuration)
static Context & getDefault(bool initialize=true)
std::shared_ptr< T > getUserContext()
Definition ocl.hpp:319
Impl * p
Definition ocl.hpp:330
static Context fromHandle(void *context)
void setUserContext(const std::shared_ptr< T > &userContext)
Definition ocl.hpp:315
void * ptr() const
static Context fromDevice(const ocl::Device &device)
void setUserContext(std::type_index typeId, const std::shared_ptr< UserContext > &userContext)
Definition ocl.hpp:73
CV_WRAP Device() CV_NOEXCEPT
CV_WRAP size_t image3DMaxWidth() const
CV_WRAP int nativeVectorWidthChar() const
bool empty() const
Definition ocl.hpp:252
CV_WRAP size_t image3DMaxHeight() const
CV_WRAP int nativeVectorWidthLong() const
CV_WRAP int addressBits() const
CV_WRAP String OpenCLVersion() const
CV_WRAP size_t maxMemAllocSize() const
CV_WRAP bool errorCorrectionSupport() const
CV_WRAP size_t globalMemSize() const
CV_WRAP size_t image3DMaxDepth() const
void * ptr() const
CV_WRAP int preferredVectorWidthInt() const
CV_WRAP bool isExtensionSupported(const String &extensionName) const
CV_WRAP String driverVersion() const
CV_WRAP int maxClockFrequency() const
CV_WRAP int doubleFPConfig() const
CV_WRAP String extensions() const
CV_WRAP size_t imageMaxArraySize() const
CV_WRAP size_t printfBufferSize() const
CV_WRAP int maxReadImageArgs() const
CV_WRAP int nativeVectorWidthDouble() const
void maxWorkItemSizes(size_t *) const
CV_WRAP bool available() const
CV_WRAP int vendorID() const
CV_WRAP int executionCapabilities() const
Impl * p
Definition ocl.hpp:254
CV_WRAP int singleFPConfig() const
CV_WRAP size_t maxWorkGroupSize() const
CV_WRAP int preferredVectorWidthDouble() const
static CV_WRAP const Device & getDefault()
CV_WRAP int nativeVectorWidthShort() const
CV_WRAP size_t image2DMaxHeight() const
CV_WRAP size_t image2DMaxWidth() const
CV_WRAP int nativeVectorWidthHalf() const
CV_WRAP int deviceVersionMinor() const
uint imagePitchAlignment() const
CV_WRAP bool compilerAvailable() const
CV_WRAP int maxConstantArgs() const
CV_WRAP int maxWorkItemDims() const
CV_WRAP int maxComputeUnits() const
CV_WRAP size_t maxConstantBufferSize() const
CV_WRAP int deviceVersionMajor() const
CV_WRAP String vendorName() const
CV_WRAP bool isNVidia() const
Definition ocl.hpp:200
CV_WRAP bool endianLittle() const
CV_WRAP size_t imageMaxBufferSize() const
CV_WRAP size_t globalMemCacheSize() const
CV_WRAP size_t maxParameterSize() const
CV_WRAP String version() const
CV_WRAP int nativeVectorWidthFloat() const
CV_WRAP bool hasFP16() const
true if 'cl_khr_fp16' extension is available
CV_WRAP int maxWriteImageArgs() const
CV_WRAP int halfFPConfig() const
CV_WRAP int type() const
uint imageBaseAddressAlignment() const
CV_WRAP int preferredVectorWidthLong() const
CV_WRAP bool hostUnifiedMemory() const
CV_WRAP String OpenCL_C_Version() const
CV_WRAP int localMemType() const
CV_WRAP int preferredVectorWidthFloat() const
CV_WRAP bool isIntel() const
Definition ocl.hpp:199
CV_WRAP size_t profilingTimerResolution() const
CV_WRAP bool hasFP64() const
true if 'cl_khr_fp64' extension is available
Impl * getImpl() const
Definition ocl.hpp:251
CV_WRAP int preferredVectorWidthShort() const
CV_WRAP bool intelSubgroupsSupport() const
deprecated, use isExtensionSupported() method (probably with "cl_khr_subgroups" value)
CV_WRAP size_t localMemSize() const
CV_WRAP int memBaseAddrAlign() const
static Device fromHandle(void *d)
CV_WRAP int preferredVectorWidthChar() const
CV_WRAP bool linkerAvailable() const
CV_WRAP int nativeVectorWidthInt() const
CV_WRAP bool isAMD() const
Definition ocl.hpp:198
CV_WRAP int maxSamplers() const
CV_WRAP int globalMemCacheLineSize() const
CV_WRAP bool imageFromBufferSupport() const
CV_WRAP String name() const
CV_WRAP int globalMemCacheType() const
CV_WRAP int preferredVectorWidthHalf() const
CV_WRAP bool imageSupport() const
Definition ocl.hpp:746
Image2D() CV_NOEXCEPT
Definition ocl.hpp:423
int iwscale
Definition ocl.hpp:457
static KernelArg ReadWriteNoSize(const UMat &m, int wscale=1, int iwscale=1)
Definition ocl.hpp:439
static KernelArg ReadOnlyNoSize(const UMat &m, int wscale=1, int iwscale=1)
Definition ocl.hpp:445
KernelArg(int _flags, UMat *_m, int wscale=1, int iwscale=1, const void *_obj=0, size_t _sz=0)
static KernelArg Constant(const _Tp *arr, size_t n)
Definition ocl.hpp:450
const void * obj
Definition ocl.hpp:455
static KernelArg PtrWriteOnly(const UMat &m)
Definition ocl.hpp:431
static KernelArg PtrReadWrite(const UMat &m)
Definition ocl.hpp:435
static KernelArg ReadOnly(const UMat &m, int wscale=1, int iwscale=1)
Definition ocl.hpp:441
int flags
Definition ocl.hpp:453
size_t sz
Definition ocl.hpp:456
static KernelArg PtrReadOnly(const UMat &m)
Definition ocl.hpp:433
static KernelArg ReadWrite(const UMat &m, int wscale=1, int iwscale=1)
Definition ocl.hpp:437
static KernelArg Constant(const Mat &m)
static KernelArg WriteOnlyNoSize(const UMat &m, int wscale=1, int iwscale=1)
Definition ocl.hpp:447
UMat * m
Definition ocl.hpp:454
KernelArg() CV_NOEXCEPT
static KernelArg WriteOnly(const UMat &m, int wscale=1, int iwscale=1)
Definition ocl.hpp:443
Definition ocl.hpp:462
Impl * p
Definition ocl.hpp:551
bool run(int dims, size_t globalsize[], size_t localsize[], bool sync, const Queue &q=Queue())
Run the OpenCL kernel (globalsize value may be adjusted)
int set_args_(int i, const _Tp0 &a0)
Definition ocl.hpp:489
bool compileWorkGroupSize(size_t wsz[]) const
Kernel() CV_NOEXCEPT
size_t preferedWorkGroupSizeMultiple() const
bool run_(int dims, size_t globalsize[], size_t localsize[], bool sync, const Queue &q=Queue())
Run the OpenCL kernel.
void * ptr() const
size_t localMemSize() const
int64 runProfiling(int dims, size_t globalsize[], size_t localsize[], const Queue &q=Queue())
Similar to synchronized run_() call with returning of kernel execution time.
size_t workGroupSize() const
int set_args_(int i, const _Tp0 &a0, const _Tps &... rest_args)
Definition ocl.hpp:491
Kernel & args(const _Tps &... kernel_args)
Setup OpenCL Kernel arguments. Avoid direct using of set(i, ...) methods.
Definition ocl.hpp:505
bool runTask(bool sync, const Queue &q=Queue())
~OpenCLExecutionContextScope()
Definition ocl.hpp:896
OpenCLExecutionContextScope(const OpenCLExecutionContext &ctx)
Definition ocl.hpp:889
Definition ocl.hpp:802
OpenCLExecutionContext cloneWithNewQueue() const
static OpenCLExecutionContext create(const std::string &platformName, void *platformID, void *context, void *deviceID)
Creates OpenCL execution context OpenCV will check if available OpenCL platform has platformName name...
bool empty() const
Definition ocl.hpp:879
static OpenCLExecutionContext create(const Context &context, const Device &device)
static OpenCLExecutionContext create(const Context &context, const Device &device, const ocl::Queue &queue)
Creates OpenCL execution context.
OpenCLExecutionContext & operator=(const OpenCLExecutionContext &)=default
std::shared_ptr< Impl > p
Definition ocl.hpp:882
OpenCLExecutionContext cloneWithNewQueue(const ocl::Queue &q) const
static OpenCLExecutionContext & getCurrentRef()
OpenCLExecutionContext & operator=(OpenCLExecutionContext &&)=default
static OpenCLExecutionContext & getCurrent()
OpenCLExecutionContext(const OpenCLExecutionContext &)=default
OpenCLExecutionContext(OpenCLExecutionContext &&)=default
Definition ocl.hpp:674
Impl * p
Definition ocl.hpp:702
PlatformInfo() CV_NOEXCEPT
Definition ocl.hpp:335
Impl * p
Definition ocl.hpp:353
Platform() CV_NOEXCEPT
bool empty() const
Definition ocl.hpp:351
Definition ocl.hpp:600
bool empty() const
Definition ocl.hpp:668
Impl * p
Definition ocl.hpp:670
uint64 hash_t
Definition ocl.hpp:602
ProgramSource() CV_NOEXCEPT
Definition ocl.hpp:555
CV_DEPRECATED bool read(const String &buf, const String &buildflags)
static CV_DEPRECATED String getPrefix(const String &buildflags)
CV_DEPRECATED String getPrefix() const
Program() CV_NOEXCEPT
CV_DEPRECATED const ProgramSource & source() const
bool empty() const
Definition ocl.hpp:584
Impl * p
Definition ocl.hpp:586
CV_DEPRECATED bool write(String &buf) const
Definition ocl.hpp:396
bool empty() const
Definition ocl.hpp:416
Queue() CV_NOEXCEPT
Impl * p
Definition ocl.hpp:418
Definition ocl.hpp:780
uint64 durationNS() const
duration in nanoseconds
Timer(const Queue &q)
Impl *const p
Definition ocl.hpp:791
InputArrayOfArrays InputArrayOfArrays InputOutputArray InputOutputArray InputOutputArray InputOutputArray Size InputOutputArray InputOutputArray T
Definition calib3d.hpp:1867
CV_EXPORTS InputOutputArray noArray()
CV__DEBUG_NS_END typedef const _InputArray & InputArray
Definition mat.hpp:442
int rows
Definition core_c.h:257
int CvScalar value
Definition core_c.h:720
const CvArr const CvArr const CvArr * src3
Definition core_c.h:994
int cols
Definition core_c.h:221
const int * idx
Definition core_c.h:668
const CvArr const CvArr * src2
Definition core_c.h:994
CvSize size
Definition core_c.h:112
const CvArr * src1
Definition core_c.h:993
int int type
Definition core_c.h:221
void int step
Definition core_c.h:905
CvArr * arr
Definition core_c.h:1247
int depth
Definition core_c.h:100
int dims
Definition core_c.h:464
uint32_t uint
Definition interface.h:42
int64_t int64
Definition interface.h:61
uint64_t uint64
Definition interface.h:62
CV_EXPORTS_W bool haveAmdBlas()
CV_EXPORTS_W bool haveOpenCL()
CV_EXPORTS_W bool haveAmdFft()
CV_EXPORTS MatAllocator * getOpenCLAllocator()
CV_EXPORTS int predictOptimalVectorWidth(InputArray src1, InputArray src2=noArray(), InputArray src3=noArray(), InputArray src4=noArray(), InputArray src5=noArray(), InputArray src6=noArray(), InputArray src7=noArray(), InputArray src8=noArray(), InputArray src9=noArray(), OclVectorStrategy strat=OCL_VECTOR_DEFAULT)
void initializeContextFromHandle(Context &ctx, void *platform, void *context, void *device)
CV_EXPORTS const char * memopTypeToStr(int t)
CV_EXPORTS_W void finish()
CV_EXPORTS int checkOptimalVectorWidth(const int *vectorWidths, InputArray src1, InputArray src2=noArray(), InputArray src3=noArray(), InputArray src4=noArray(), InputArray src5=noArray(), InputArray src6=noArray(), InputArray src7=noArray(), InputArray src8=noArray(), InputArray src9=noArray(), OclVectorStrategy strat=OCL_VECTOR_DEFAULT)
CV_EXPORTS void getPlatfomsInfo(std::vector< PlatformInfo > &platform_info)
CV_EXPORTS String kernelToStr(InputArray _kernel, int ddepth=-1, const char *name=NULL)
CV_EXPORTS CV_DEPRECATED const char * convertTypeStr(int sdepth, int ddepth, int cn, char *buf)
CV_EXPORTS const char * vecopTypeToStr(int t)
CV_EXPORTS_W void setUseOpenCL(bool flag)
CV_EXPORTS const char * getOpenCLErrorString(int errorCode)
CV_EXPORTS void convertFromImage(void *cl_mem_image, UMat &dst)
Convert OpenCL image2d_t to UMat.
CV_EXPORTS void attachContext(const String &platformName, void *platformID, void *context, void *deviceID)
Attaches OpenCL context to OpenCV.
OclVectorStrategy
Definition ocl.hpp:716
CV_EXPORTS int predictOptimalVectorWidthMax(InputArray src1, InputArray src2=noArray(), InputArray src3=noArray(), InputArray src4=noArray(), InputArray src5=noArray(), InputArray src6=noArray(), InputArray src7=noArray(), InputArray src8=noArray(), InputArray src9=noArray())
CV_EXPORTS void buildOptionsAddMatrixDescription(String &buildOptions, const String &name, InputArray _m)
CV_EXPORTS const char * typeToStr(int t)
CV_EXPORTS bool haveSVM()
CV_EXPORTS void convertFromBuffer(void *cl_mem_buffer, size_t step, int rows, int cols, int type, UMat &dst)
Convert OpenCL buffer to UMat.
CV_EXPORTS_W bool useOpenCL()
@ OCL_VECTOR_MAX
Definition ocl.hpp:721
@ OCL_VECTOR_DEFAULT
Definition ocl.hpp:724
@ OCL_VECTOR_OWN
Definition ocl.hpp:718
#define CV_EXPORTS_W_SIMPLE
Definition cvdef.h:473
#define CV_EXPORTS
Definition cvdef.h:435
#define CV_DEPRECATED
Definition cvdef.h:450
#define CV_EXPORTS_W
Definition cvdef.h:472
#define CV_NOEXCEPT
Definition cvdef.h:800
#define CV_WRAP
Definition cvdef.h:481
#define CV_Assert(expr)
Checks a condition at runtime and throws exception if it fails.
Definition base.hpp:342
OutputArray dst
Definition imgproc.hpp:3564
OutputArray OutputArray OutputArray int sdepth
Definition imgproc.hpp:2884
"black box" representation of the file storage associated with a file on disk.
Definition calib3d.hpp:441