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_PRIVATE_HPP
RyoheiHagimoto 0:0e0631af0305 45 #define OPENCV_CORE_PRIVATE_HPP
RyoheiHagimoto 0:0e0631af0305 46
RyoheiHagimoto 0:0e0631af0305 47 #ifndef __OPENCV_BUILD
RyoheiHagimoto 0:0e0631af0305 48 # error this is a private header which should not be used from outside of the OpenCV library
RyoheiHagimoto 0:0e0631af0305 49 #endif
RyoheiHagimoto 0:0e0631af0305 50
RyoheiHagimoto 0:0e0631af0305 51 #include "opencv2/core.hpp"
RyoheiHagimoto 0:0e0631af0305 52 #include "cvconfig.h"
RyoheiHagimoto 0:0e0631af0305 53
RyoheiHagimoto 0:0e0631af0305 54 #ifdef HAVE_EIGEN
RyoheiHagimoto 0:0e0631af0305 55 # if defined __GNUC__ && defined __APPLE__
RyoheiHagimoto 0:0e0631af0305 56 # pragma GCC diagnostic ignored "-Wshadow"
RyoheiHagimoto 0:0e0631af0305 57 # endif
RyoheiHagimoto 0:0e0631af0305 58 # include <Eigen/Core>
RyoheiHagimoto 0:0e0631af0305 59 # include "opencv2/core/eigen.hpp"
RyoheiHagimoto 0:0e0631af0305 60 #endif
RyoheiHagimoto 0:0e0631af0305 61
RyoheiHagimoto 0:0e0631af0305 62 #ifdef HAVE_TBB
RyoheiHagimoto 0:0e0631af0305 63 # include "tbb/tbb.h"
RyoheiHagimoto 0:0e0631af0305 64 # include "tbb/task.h"
RyoheiHagimoto 0:0e0631af0305 65 # undef min
RyoheiHagimoto 0:0e0631af0305 66 # undef max
RyoheiHagimoto 0:0e0631af0305 67 #endif
RyoheiHagimoto 0:0e0631af0305 68
RyoheiHagimoto 0:0e0631af0305 69 #if defined HAVE_FP16 && (defined __F16C__ || (defined _MSC_VER && _MSC_VER >= 1700))
RyoheiHagimoto 0:0e0631af0305 70 # include <immintrin.h>
RyoheiHagimoto 0:0e0631af0305 71 # define CV_FP16 1
RyoheiHagimoto 0:0e0631af0305 72 #elif defined HAVE_FP16 && defined __GNUC__
RyoheiHagimoto 0:0e0631af0305 73 # define CV_FP16 1
RyoheiHagimoto 0:0e0631af0305 74 #endif
RyoheiHagimoto 0:0e0631af0305 75
RyoheiHagimoto 0:0e0631af0305 76 #ifndef CV_FP16
RyoheiHagimoto 0:0e0631af0305 77 # define CV_FP16 0
RyoheiHagimoto 0:0e0631af0305 78 #endif
RyoheiHagimoto 0:0e0631af0305 79
RyoheiHagimoto 0:0e0631af0305 80 //! @cond IGNORED
RyoheiHagimoto 0:0e0631af0305 81
RyoheiHagimoto 0:0e0631af0305 82 namespace cv
RyoheiHagimoto 0:0e0631af0305 83 {
RyoheiHagimoto 0:0e0631af0305 84 #ifdef HAVE_TBB
RyoheiHagimoto 0:0e0631af0305 85
RyoheiHagimoto 0:0e0631af0305 86 typedef tbb::blocked_range<int> BlockedRange;
RyoheiHagimoto 0:0e0631af0305 87
RyoheiHagimoto 0:0e0631af0305 88 template<typename Body> static inline
RyoheiHagimoto 0:0e0631af0305 89 void parallel_for( const BlockedRange& range, const Body& body )
RyoheiHagimoto 0:0e0631af0305 90 {
RyoheiHagimoto 0:0e0631af0305 91 tbb::parallel_for(range, body);
RyoheiHagimoto 0:0e0631af0305 92 }
RyoheiHagimoto 0:0e0631af0305 93
RyoheiHagimoto 0:0e0631af0305 94 typedef tbb::split Split;
RyoheiHagimoto 0:0e0631af0305 95
RyoheiHagimoto 0:0e0631af0305 96 template<typename Body> static inline
RyoheiHagimoto 0:0e0631af0305 97 void parallel_reduce( const BlockedRange& range, Body& body )
RyoheiHagimoto 0:0e0631af0305 98 {
RyoheiHagimoto 0:0e0631af0305 99 tbb::parallel_reduce(range, body);
RyoheiHagimoto 0:0e0631af0305 100 }
RyoheiHagimoto 0:0e0631af0305 101
RyoheiHagimoto 0:0e0631af0305 102 typedef tbb::concurrent_vector<Rect> ConcurrentRectVector;
RyoheiHagimoto 0:0e0631af0305 103 #else
RyoheiHagimoto 0:0e0631af0305 104 class BlockedRange
RyoheiHagimoto 0:0e0631af0305 105 {
RyoheiHagimoto 0:0e0631af0305 106 public:
RyoheiHagimoto 0:0e0631af0305 107 BlockedRange() : _begin(0), _end(0), _grainsize(0) {}
RyoheiHagimoto 0:0e0631af0305 108 BlockedRange(int b, int e, int g=1) : _begin(b), _end(e), _grainsize(g) {}
RyoheiHagimoto 0:0e0631af0305 109 int begin() const { return _begin; }
RyoheiHagimoto 0:0e0631af0305 110 int end() const { return _end; }
RyoheiHagimoto 0:0e0631af0305 111 int grainsize() const { return _grainsize; }
RyoheiHagimoto 0:0e0631af0305 112
RyoheiHagimoto 0:0e0631af0305 113 protected:
RyoheiHagimoto 0:0e0631af0305 114 int _begin, _end, _grainsize;
RyoheiHagimoto 0:0e0631af0305 115 };
RyoheiHagimoto 0:0e0631af0305 116
RyoheiHagimoto 0:0e0631af0305 117 template<typename Body> static inline
RyoheiHagimoto 0:0e0631af0305 118 void parallel_for( const BlockedRange& range, const Body& body )
RyoheiHagimoto 0:0e0631af0305 119 {
RyoheiHagimoto 0:0e0631af0305 120 body(range);
RyoheiHagimoto 0:0e0631af0305 121 }
RyoheiHagimoto 0:0e0631af0305 122 typedef std::vector<Rect> ConcurrentRectVector;
RyoheiHagimoto 0:0e0631af0305 123
RyoheiHagimoto 0:0e0631af0305 124 class Split {};
RyoheiHagimoto 0:0e0631af0305 125
RyoheiHagimoto 0:0e0631af0305 126 template<typename Body> static inline
RyoheiHagimoto 0:0e0631af0305 127 void parallel_reduce( const BlockedRange& range, Body& body )
RyoheiHagimoto 0:0e0631af0305 128 {
RyoheiHagimoto 0:0e0631af0305 129 body(range);
RyoheiHagimoto 0:0e0631af0305 130 }
RyoheiHagimoto 0:0e0631af0305 131 #endif
RyoheiHagimoto 0:0e0631af0305 132
RyoheiHagimoto 0:0e0631af0305 133 // Returns a static string if there is a parallel framework,
RyoheiHagimoto 0:0e0631af0305 134 // NULL otherwise.
RyoheiHagimoto 0:0e0631af0305 135 CV_EXPORTS const char* currentParallelFramework();
RyoheiHagimoto 0:0e0631af0305 136 } //namespace cv
RyoheiHagimoto 0:0e0631af0305 137
RyoheiHagimoto 0:0e0631af0305 138 /****************************************************************************************\
RyoheiHagimoto 0:0e0631af0305 139 * Common declarations *
RyoheiHagimoto 0:0e0631af0305 140 \****************************************************************************************/
RyoheiHagimoto 0:0e0631af0305 141
RyoheiHagimoto 0:0e0631af0305 142 /* the alignment of all the allocated buffers */
RyoheiHagimoto 0:0e0631af0305 143 #define CV_MALLOC_ALIGN 16
RyoheiHagimoto 0:0e0631af0305 144
RyoheiHagimoto 0:0e0631af0305 145 /* IEEE754 constants and macros */
RyoheiHagimoto 0:0e0631af0305 146 #define CV_TOGGLE_FLT(x) ((x)^((int)(x) < 0 ? 0x7fffffff : 0))
RyoheiHagimoto 0:0e0631af0305 147 #define CV_TOGGLE_DBL(x) ((x)^((int64)(x) < 0 ? CV_BIG_INT(0x7fffffffffffffff) : 0))
RyoheiHagimoto 0:0e0631af0305 148
RyoheiHagimoto 0:0e0631af0305 149 static inline void* cvAlignPtr( const void* ptr, int align = 32 )
RyoheiHagimoto 0:0e0631af0305 150 {
RyoheiHagimoto 0:0e0631af0305 151 CV_DbgAssert ( (align & (align-1)) == 0 );
RyoheiHagimoto 0:0e0631af0305 152 return (void*)( ((size_t)ptr + align - 1) & ~(size_t)(align-1) );
RyoheiHagimoto 0:0e0631af0305 153 }
RyoheiHagimoto 0:0e0631af0305 154
RyoheiHagimoto 0:0e0631af0305 155 static inline int cvAlign( int size, int align )
RyoheiHagimoto 0:0e0631af0305 156 {
RyoheiHagimoto 0:0e0631af0305 157 CV_DbgAssert( (align & (align-1)) == 0 && size < INT_MAX );
RyoheiHagimoto 0:0e0631af0305 158 return (size + align - 1) & -align;
RyoheiHagimoto 0:0e0631af0305 159 }
RyoheiHagimoto 0:0e0631af0305 160
RyoheiHagimoto 0:0e0631af0305 161 #ifdef IPL_DEPTH_8U
RyoheiHagimoto 0:0e0631af0305 162 static inline cv::Size cvGetMatSize( const CvMat* mat )
RyoheiHagimoto 0:0e0631af0305 163 {
RyoheiHagimoto 0:0e0631af0305 164 return cv::Size(mat->cols, mat->rows);
RyoheiHagimoto 0:0e0631af0305 165 }
RyoheiHagimoto 0:0e0631af0305 166 #endif
RyoheiHagimoto 0:0e0631af0305 167
RyoheiHagimoto 0:0e0631af0305 168 namespace cv
RyoheiHagimoto 0:0e0631af0305 169 {
RyoheiHagimoto 0:0e0631af0305 170 CV_EXPORTS void scalarToRawData(const cv::Scalar& s, void* buf, int type, int unroll_to = 0);
RyoheiHagimoto 0:0e0631af0305 171 }
RyoheiHagimoto 0:0e0631af0305 172
RyoheiHagimoto 0:0e0631af0305 173 // property implementation macros
RyoheiHagimoto 0:0e0631af0305 174
RyoheiHagimoto 0:0e0631af0305 175 #define CV_IMPL_PROPERTY_RO(type, name, member) \
RyoheiHagimoto 0:0e0631af0305 176 inline type get##name() const { return member; }
RyoheiHagimoto 0:0e0631af0305 177
RyoheiHagimoto 0:0e0631af0305 178 #define CV_HELP_IMPL_PROPERTY(r_type, w_type, name, member) \
RyoheiHagimoto 0:0e0631af0305 179 CV_IMPL_PROPERTY_RO(r_type, name, member) \
RyoheiHagimoto 0:0e0631af0305 180 inline void set##name(w_type val) { member = val; }
RyoheiHagimoto 0:0e0631af0305 181
RyoheiHagimoto 0:0e0631af0305 182 #define CV_HELP_WRAP_PROPERTY(r_type, w_type, name, internal_name, internal_obj) \
RyoheiHagimoto 0:0e0631af0305 183 r_type get##name() const { return internal_obj.get##internal_name(); } \
RyoheiHagimoto 0:0e0631af0305 184 void set##name(w_type val) { internal_obj.set##internal_name(val); }
RyoheiHagimoto 0:0e0631af0305 185
RyoheiHagimoto 0:0e0631af0305 186 #define CV_IMPL_PROPERTY(type, name, member) CV_HELP_IMPL_PROPERTY(type, type, name, member)
RyoheiHagimoto 0:0e0631af0305 187 #define CV_IMPL_PROPERTY_S(type, name, member) CV_HELP_IMPL_PROPERTY(type, const type &, name, member)
RyoheiHagimoto 0:0e0631af0305 188
RyoheiHagimoto 0:0e0631af0305 189 #define CV_WRAP_PROPERTY(type, name, internal_name, internal_obj) CV_HELP_WRAP_PROPERTY(type, type, name, internal_name, internal_obj)
RyoheiHagimoto 0:0e0631af0305 190 #define CV_WRAP_PROPERTY_S(type, name, internal_name, internal_obj) CV_HELP_WRAP_PROPERTY(type, const type &, name, internal_name, internal_obj)
RyoheiHagimoto 0:0e0631af0305 191
RyoheiHagimoto 0:0e0631af0305 192 #define CV_WRAP_SAME_PROPERTY(type, name, internal_obj) CV_WRAP_PROPERTY(type, name, name, internal_obj)
RyoheiHagimoto 0:0e0631af0305 193 #define CV_WRAP_SAME_PROPERTY_S(type, name, internal_obj) CV_WRAP_PROPERTY_S(type, name, name, internal_obj)
RyoheiHagimoto 0:0e0631af0305 194
RyoheiHagimoto 0:0e0631af0305 195 /****************************************************************************************\
RyoheiHagimoto 0:0e0631af0305 196 * Structures and macros for integration with IPP *
RyoheiHagimoto 0:0e0631af0305 197 \****************************************************************************************/
RyoheiHagimoto 0:0e0631af0305 198
RyoheiHagimoto 0:0e0631af0305 199 #ifdef HAVE_IPP
RyoheiHagimoto 0:0e0631af0305 200 #include "ipp.h"
RyoheiHagimoto 0:0e0631af0305 201
RyoheiHagimoto 0:0e0631af0305 202 #ifndef IPP_VERSION_UPDATE // prior to 7.1
RyoheiHagimoto 0:0e0631af0305 203 #define IPP_VERSION_UPDATE 0
RyoheiHagimoto 0:0e0631af0305 204 #endif
RyoheiHagimoto 0:0e0631af0305 205
RyoheiHagimoto 0:0e0631af0305 206 #define IPP_VERSION_X100 (IPP_VERSION_MAJOR * 100 + IPP_VERSION_MINOR*10 + IPP_VERSION_UPDATE)
RyoheiHagimoto 0:0e0631af0305 207
RyoheiHagimoto 0:0e0631af0305 208 // General define for ipp function disabling
RyoheiHagimoto 0:0e0631af0305 209 #define IPP_DISABLE_BLOCK 0
RyoheiHagimoto 0:0e0631af0305 210
RyoheiHagimoto 0:0e0631af0305 211 #ifdef CV_MALLOC_ALIGN
RyoheiHagimoto 0:0e0631af0305 212 #undef CV_MALLOC_ALIGN
RyoheiHagimoto 0:0e0631af0305 213 #endif
RyoheiHagimoto 0:0e0631af0305 214 #define CV_MALLOC_ALIGN 32 // required for AVX optimization
RyoheiHagimoto 0:0e0631af0305 215
RyoheiHagimoto 0:0e0631af0305 216 #define setIppErrorStatus() cv::ipp::setIppStatus(-1, CV_Func, __FILE__, __LINE__)
RyoheiHagimoto 0:0e0631af0305 217
RyoheiHagimoto 0:0e0631af0305 218 static inline IppiSize ippiSize(int width, int height)
RyoheiHagimoto 0:0e0631af0305 219 {
RyoheiHagimoto 0:0e0631af0305 220 IppiSize size = { width, height };
RyoheiHagimoto 0:0e0631af0305 221 return size;
RyoheiHagimoto 0:0e0631af0305 222 }
RyoheiHagimoto 0:0e0631af0305 223
RyoheiHagimoto 0:0e0631af0305 224 static inline IppiSize ippiSize(const cv::Size & _size)
RyoheiHagimoto 0:0e0631af0305 225 {
RyoheiHagimoto 0:0e0631af0305 226 IppiSize size = { _size.width, _size.height };
RyoheiHagimoto 0:0e0631af0305 227 return size;
RyoheiHagimoto 0:0e0631af0305 228 }
RyoheiHagimoto 0:0e0631af0305 229
RyoheiHagimoto 0:0e0631af0305 230 static inline IppiPoint ippiPoint(const cv::Point & _point)
RyoheiHagimoto 0:0e0631af0305 231 {
RyoheiHagimoto 0:0e0631af0305 232 IppiPoint point = { _point.x, _point.y };
RyoheiHagimoto 0:0e0631af0305 233 return point;
RyoheiHagimoto 0:0e0631af0305 234 }
RyoheiHagimoto 0:0e0631af0305 235
RyoheiHagimoto 0:0e0631af0305 236 static inline IppiPoint ippiPoint(int x, int y)
RyoheiHagimoto 0:0e0631af0305 237 {
RyoheiHagimoto 0:0e0631af0305 238 IppiPoint point = { x, y };
RyoheiHagimoto 0:0e0631af0305 239 return point;
RyoheiHagimoto 0:0e0631af0305 240 }
RyoheiHagimoto 0:0e0631af0305 241
RyoheiHagimoto 0:0e0631af0305 242 static inline IppiBorderType ippiGetBorderType(int borderTypeNI)
RyoheiHagimoto 0:0e0631af0305 243 {
RyoheiHagimoto 0:0e0631af0305 244 return borderTypeNI == cv::BORDER_CONSTANT ? ippBorderConst :
RyoheiHagimoto 0:0e0631af0305 245 borderTypeNI == cv::BORDER_WRAP ? ippBorderWrap :
RyoheiHagimoto 0:0e0631af0305 246 borderTypeNI == cv::BORDER_REPLICATE ? ippBorderRepl :
RyoheiHagimoto 0:0e0631af0305 247 borderTypeNI == cv::BORDER_REFLECT_101 ? ippBorderMirror :
RyoheiHagimoto 0:0e0631af0305 248 borderTypeNI == cv::BORDER_REFLECT ? ippBorderMirrorR : (IppiBorderType)-1;
RyoheiHagimoto 0:0e0631af0305 249 }
RyoheiHagimoto 0:0e0631af0305 250
RyoheiHagimoto 0:0e0631af0305 251 static inline IppDataType ippiGetDataType(int depth)
RyoheiHagimoto 0:0e0631af0305 252 {
RyoheiHagimoto 0:0e0631af0305 253 return depth == CV_8U ? ipp8u :
RyoheiHagimoto 0:0e0631af0305 254 depth == CV_8S ? ipp8s :
RyoheiHagimoto 0:0e0631af0305 255 depth == CV_16U ? ipp16u :
RyoheiHagimoto 0:0e0631af0305 256 depth == CV_16S ? ipp16s :
RyoheiHagimoto 0:0e0631af0305 257 depth == CV_32S ? ipp32s :
RyoheiHagimoto 0:0e0631af0305 258 depth == CV_32F ? ipp32f :
RyoheiHagimoto 0:0e0631af0305 259 depth == CV_64F ? ipp64f : (IppDataType)-1;
RyoheiHagimoto 0:0e0631af0305 260 }
RyoheiHagimoto 0:0e0631af0305 261
RyoheiHagimoto 0:0e0631af0305 262 // IPP temporary buffer hepler
RyoheiHagimoto 0:0e0631af0305 263 template<typename T>
RyoheiHagimoto 0:0e0631af0305 264 class IppAutoBuffer
RyoheiHagimoto 0:0e0631af0305 265 {
RyoheiHagimoto 0:0e0631af0305 266 public:
RyoheiHagimoto 0:0e0631af0305 267 IppAutoBuffer() { m_pBuffer = NULL; }
RyoheiHagimoto 0:0e0631af0305 268 IppAutoBuffer(int size) { Alloc(size); }
RyoheiHagimoto 0:0e0631af0305 269 ~IppAutoBuffer() { Release(); }
RyoheiHagimoto 0:0e0631af0305 270 T* Alloc(int size) { m_pBuffer = (T*)ippMalloc(size); return m_pBuffer; }
RyoheiHagimoto 0:0e0631af0305 271 void Release() { if(m_pBuffer) ippFree(m_pBuffer); }
RyoheiHagimoto 0:0e0631af0305 272 inline operator T* () { return (T*)m_pBuffer;}
RyoheiHagimoto 0:0e0631af0305 273 inline operator const T* () const { return (const T*)m_pBuffer;}
RyoheiHagimoto 0:0e0631af0305 274 private:
RyoheiHagimoto 0:0e0631af0305 275 // Disable copy operations
RyoheiHagimoto 0:0e0631af0305 276 IppAutoBuffer(IppAutoBuffer &) {}
RyoheiHagimoto 0:0e0631af0305 277 IppAutoBuffer& operator =(const IppAutoBuffer &) {return *this;}
RyoheiHagimoto 0:0e0631af0305 278
RyoheiHagimoto 0:0e0631af0305 279 T* m_pBuffer;
RyoheiHagimoto 0:0e0631af0305 280 };
RyoheiHagimoto 0:0e0631af0305 281
RyoheiHagimoto 0:0e0631af0305 282 #else
RyoheiHagimoto 0:0e0631af0305 283 #define IPP_VERSION_X100 0
RyoheiHagimoto 0:0e0631af0305 284 #endif
RyoheiHagimoto 0:0e0631af0305 285
RyoheiHagimoto 0:0e0631af0305 286 #if defined HAVE_IPP
RyoheiHagimoto 0:0e0631af0305 287 #if IPP_VERSION_X100 >= 900
RyoheiHagimoto 0:0e0631af0305 288 #define IPP_INITIALIZER(FEAT) \
RyoheiHagimoto 0:0e0631af0305 289 { \
RyoheiHagimoto 0:0e0631af0305 290 if(FEAT) \
RyoheiHagimoto 0:0e0631af0305 291 ippSetCpuFeatures(FEAT); \
RyoheiHagimoto 0:0e0631af0305 292 else \
RyoheiHagimoto 0:0e0631af0305 293 ippInit(); \
RyoheiHagimoto 0:0e0631af0305 294 }
RyoheiHagimoto 0:0e0631af0305 295 #elif IPP_VERSION_X100 >= 800
RyoheiHagimoto 0:0e0631af0305 296 #define IPP_INITIALIZER(FEAT) \
RyoheiHagimoto 0:0e0631af0305 297 { \
RyoheiHagimoto 0:0e0631af0305 298 ippInit(); \
RyoheiHagimoto 0:0e0631af0305 299 }
RyoheiHagimoto 0:0e0631af0305 300 #else
RyoheiHagimoto 0:0e0631af0305 301 #define IPP_INITIALIZER(FEAT) \
RyoheiHagimoto 0:0e0631af0305 302 { \
RyoheiHagimoto 0:0e0631af0305 303 ippStaticInit(); \
RyoheiHagimoto 0:0e0631af0305 304 }
RyoheiHagimoto 0:0e0631af0305 305 #endif
RyoheiHagimoto 0:0e0631af0305 306
RyoheiHagimoto 0:0e0631af0305 307 #ifdef CVAPI_EXPORTS
RyoheiHagimoto 0:0e0631af0305 308 #define IPP_INITIALIZER_AUTO \
RyoheiHagimoto 0:0e0631af0305 309 struct __IppInitializer__ \
RyoheiHagimoto 0:0e0631af0305 310 { \
RyoheiHagimoto 0:0e0631af0305 311 __IppInitializer__() \
RyoheiHagimoto 0:0e0631af0305 312 {IPP_INITIALIZER(cv::ipp::getIppFeatures())} \
RyoheiHagimoto 0:0e0631af0305 313 }; \
RyoheiHagimoto 0:0e0631af0305 314 static struct __IppInitializer__ __ipp_initializer__;
RyoheiHagimoto 0:0e0631af0305 315 #else
RyoheiHagimoto 0:0e0631af0305 316 #define IPP_INITIALIZER_AUTO
RyoheiHagimoto 0:0e0631af0305 317 #endif
RyoheiHagimoto 0:0e0631af0305 318 #else
RyoheiHagimoto 0:0e0631af0305 319 #define IPP_INITIALIZER
RyoheiHagimoto 0:0e0631af0305 320 #define IPP_INITIALIZER_AUTO
RyoheiHagimoto 0:0e0631af0305 321 #endif
RyoheiHagimoto 0:0e0631af0305 322
RyoheiHagimoto 0:0e0631af0305 323 #define CV_IPP_CHECK_COND (cv::ipp::useIPP())
RyoheiHagimoto 0:0e0631af0305 324 #define CV_IPP_CHECK() if(CV_IPP_CHECK_COND)
RyoheiHagimoto 0:0e0631af0305 325
RyoheiHagimoto 0:0e0631af0305 326 #ifdef HAVE_IPP
RyoheiHagimoto 0:0e0631af0305 327
RyoheiHagimoto 0:0e0631af0305 328 #ifdef CV_IPP_RUN_VERBOSE
RyoheiHagimoto 0:0e0631af0305 329 #define CV_IPP_RUN_(condition, func, ...) \
RyoheiHagimoto 0:0e0631af0305 330 { \
RyoheiHagimoto 0:0e0631af0305 331 if (cv::ipp::useIPP() && (condition) && (func)) \
RyoheiHagimoto 0:0e0631af0305 332 { \
RyoheiHagimoto 0:0e0631af0305 333 printf("%s: IPP implementation is running\n", CV_Func); \
RyoheiHagimoto 0:0e0631af0305 334 fflush(stdout); \
RyoheiHagimoto 0:0e0631af0305 335 CV_IMPL_ADD(CV_IMPL_IPP); \
RyoheiHagimoto 0:0e0631af0305 336 return __VA_ARGS__; \
RyoheiHagimoto 0:0e0631af0305 337 } \
RyoheiHagimoto 0:0e0631af0305 338 else \
RyoheiHagimoto 0:0e0631af0305 339 { \
RyoheiHagimoto 0:0e0631af0305 340 printf("%s: Plain implementation is running\n", CV_Func); \
RyoheiHagimoto 0:0e0631af0305 341 fflush(stdout); \
RyoheiHagimoto 0:0e0631af0305 342 } \
RyoheiHagimoto 0:0e0631af0305 343 }
RyoheiHagimoto 0:0e0631af0305 344 #elif defined CV_IPP_RUN_ASSERT
RyoheiHagimoto 0:0e0631af0305 345 #define CV_IPP_RUN_(condition, func, ...) \
RyoheiHagimoto 0:0e0631af0305 346 { \
RyoheiHagimoto 0:0e0631af0305 347 if (cv::ipp::useIPP() && (condition)) \
RyoheiHagimoto 0:0e0631af0305 348 { \
RyoheiHagimoto 0:0e0631af0305 349 if(func) \
RyoheiHagimoto 0:0e0631af0305 350 { \
RyoheiHagimoto 0:0e0631af0305 351 CV_IMPL_ADD(CV_IMPL_IPP); \
RyoheiHagimoto 0:0e0631af0305 352 } \
RyoheiHagimoto 0:0e0631af0305 353 else \
RyoheiHagimoto 0:0e0631af0305 354 { \
RyoheiHagimoto 0:0e0631af0305 355 setIppErrorStatus(); \
RyoheiHagimoto 0:0e0631af0305 356 CV_Error(cv::Error::StsAssert, #func); \
RyoheiHagimoto 0:0e0631af0305 357 } \
RyoheiHagimoto 0:0e0631af0305 358 return __VA_ARGS__; \
RyoheiHagimoto 0:0e0631af0305 359 } \
RyoheiHagimoto 0:0e0631af0305 360 }
RyoheiHagimoto 0:0e0631af0305 361 #else
RyoheiHagimoto 0:0e0631af0305 362 #define CV_IPP_RUN_(condition, func, ...) \
RyoheiHagimoto 0:0e0631af0305 363 if (cv::ipp::useIPP() && (condition) && (func)) \
RyoheiHagimoto 0:0e0631af0305 364 { \
RyoheiHagimoto 0:0e0631af0305 365 CV_IMPL_ADD(CV_IMPL_IPP); \
RyoheiHagimoto 0:0e0631af0305 366 return __VA_ARGS__; \
RyoheiHagimoto 0:0e0631af0305 367 }
RyoheiHagimoto 0:0e0631af0305 368 #endif
RyoheiHagimoto 0:0e0631af0305 369 #define CV_IPP_RUN_FAST(func, ...) \
RyoheiHagimoto 0:0e0631af0305 370 if (cv::ipp::useIPP() && (func)) \
RyoheiHagimoto 0:0e0631af0305 371 { \
RyoheiHagimoto 0:0e0631af0305 372 CV_IMPL_ADD(CV_IMPL_IPP); \
RyoheiHagimoto 0:0e0631af0305 373 return __VA_ARGS__; \
RyoheiHagimoto 0:0e0631af0305 374 }
RyoheiHagimoto 0:0e0631af0305 375 #else
RyoheiHagimoto 0:0e0631af0305 376 #define CV_IPP_RUN_(condition, func, ...)
RyoheiHagimoto 0:0e0631af0305 377 #define CV_IPP_RUN_FAST(func, ...)
RyoheiHagimoto 0:0e0631af0305 378 #endif
RyoheiHagimoto 0:0e0631af0305 379
RyoheiHagimoto 0:0e0631af0305 380 #define CV_IPP_RUN(condition, func, ...) CV_IPP_RUN_((condition), (func), __VA_ARGS__)
RyoheiHagimoto 0:0e0631af0305 381
RyoheiHagimoto 0:0e0631af0305 382
RyoheiHagimoto 0:0e0631af0305 383 #ifndef IPPI_CALL
RyoheiHagimoto 0:0e0631af0305 384 # define IPPI_CALL(func) CV_Assert((func) >= 0)
RyoheiHagimoto 0:0e0631af0305 385 #endif
RyoheiHagimoto 0:0e0631af0305 386
RyoheiHagimoto 0:0e0631af0305 387 /* IPP-compatible return codes */
RyoheiHagimoto 0:0e0631af0305 388 typedef enum CvStatus
RyoheiHagimoto 0:0e0631af0305 389 {
RyoheiHagimoto 0:0e0631af0305 390 CV_BADMEMBLOCK_ERR = -113,
RyoheiHagimoto 0:0e0631af0305 391 CV_INPLACE_NOT_SUPPORTED_ERR= -112,
RyoheiHagimoto 0:0e0631af0305 392 CV_UNMATCHED_ROI_ERR = -111,
RyoheiHagimoto 0:0e0631af0305 393 CV_NOTFOUND_ERR = -110,
RyoheiHagimoto 0:0e0631af0305 394 CV_BADCONVERGENCE_ERR = -109,
RyoheiHagimoto 0:0e0631af0305 395
RyoheiHagimoto 0:0e0631af0305 396 CV_BADDEPTH_ERR = -107,
RyoheiHagimoto 0:0e0631af0305 397 CV_BADROI_ERR = -106,
RyoheiHagimoto 0:0e0631af0305 398 CV_BADHEADER_ERR = -105,
RyoheiHagimoto 0:0e0631af0305 399 CV_UNMATCHED_FORMATS_ERR = -104,
RyoheiHagimoto 0:0e0631af0305 400 CV_UNSUPPORTED_COI_ERR = -103,
RyoheiHagimoto 0:0e0631af0305 401 CV_UNSUPPORTED_CHANNELS_ERR = -102,
RyoheiHagimoto 0:0e0631af0305 402 CV_UNSUPPORTED_DEPTH_ERR = -101,
RyoheiHagimoto 0:0e0631af0305 403 CV_UNSUPPORTED_FORMAT_ERR = -100,
RyoheiHagimoto 0:0e0631af0305 404
RyoheiHagimoto 0:0e0631af0305 405 CV_BADARG_ERR = -49, //ipp comp
RyoheiHagimoto 0:0e0631af0305 406 CV_NOTDEFINED_ERR = -48, //ipp comp
RyoheiHagimoto 0:0e0631af0305 407
RyoheiHagimoto 0:0e0631af0305 408 CV_BADCHANNELS_ERR = -47, //ipp comp
RyoheiHagimoto 0:0e0631af0305 409 CV_BADRANGE_ERR = -44, //ipp comp
RyoheiHagimoto 0:0e0631af0305 410 CV_BADSTEP_ERR = -29, //ipp comp
RyoheiHagimoto 0:0e0631af0305 411
RyoheiHagimoto 0:0e0631af0305 412 CV_BADFLAG_ERR = -12,
RyoheiHagimoto 0:0e0631af0305 413 CV_DIV_BY_ZERO_ERR = -11, //ipp comp
RyoheiHagimoto 0:0e0631af0305 414 CV_BADCOEF_ERR = -10,
RyoheiHagimoto 0:0e0631af0305 415
RyoheiHagimoto 0:0e0631af0305 416 CV_BADFACTOR_ERR = -7,
RyoheiHagimoto 0:0e0631af0305 417 CV_BADPOINT_ERR = -6,
RyoheiHagimoto 0:0e0631af0305 418 CV_BADSCALE_ERR = -4,
RyoheiHagimoto 0:0e0631af0305 419 CV_OUTOFMEM_ERR = -3,
RyoheiHagimoto 0:0e0631af0305 420 CV_NULLPTR_ERR = -2,
RyoheiHagimoto 0:0e0631af0305 421 CV_BADSIZE_ERR = -1,
RyoheiHagimoto 0:0e0631af0305 422 CV_NO_ERR = 0,
RyoheiHagimoto 0:0e0631af0305 423 CV_OK = CV_NO_ERR
RyoheiHagimoto 0:0e0631af0305 424 }
RyoheiHagimoto 0:0e0631af0305 425 CvStatus;
RyoheiHagimoto 0:0e0631af0305 426
RyoheiHagimoto 0:0e0631af0305 427 #ifdef HAVE_TEGRA_OPTIMIZATION
RyoheiHagimoto 0:0e0631af0305 428 namespace tegra {
RyoheiHagimoto 0:0e0631af0305 429
RyoheiHagimoto 0:0e0631af0305 430 CV_EXPORTS bool useTegra();
RyoheiHagimoto 0:0e0631af0305 431 CV_EXPORTS void setUseTegra(bool flag);
RyoheiHagimoto 0:0e0631af0305 432
RyoheiHagimoto 0:0e0631af0305 433 }
RyoheiHagimoto 0:0e0631af0305 434 #endif
RyoheiHagimoto 0:0e0631af0305 435
RyoheiHagimoto 0:0e0631af0305 436 #ifdef ENABLE_INSTRUMENTATION
RyoheiHagimoto 0:0e0631af0305 437 namespace cv
RyoheiHagimoto 0:0e0631af0305 438 {
RyoheiHagimoto 0:0e0631af0305 439 namespace instr
RyoheiHagimoto 0:0e0631af0305 440 {
RyoheiHagimoto 0:0e0631af0305 441 struct InstrTLSStruct
RyoheiHagimoto 0:0e0631af0305 442 {
RyoheiHagimoto 0:0e0631af0305 443 InstrTLSStruct()
RyoheiHagimoto 0:0e0631af0305 444 {
RyoheiHagimoto 0:0e0631af0305 445 pCurrentNode = NULL;
RyoheiHagimoto 0:0e0631af0305 446 }
RyoheiHagimoto 0:0e0631af0305 447 InstrNode* pCurrentNode;
RyoheiHagimoto 0:0e0631af0305 448 };
RyoheiHagimoto 0:0e0631af0305 449
RyoheiHagimoto 0:0e0631af0305 450 class InstrStruct
RyoheiHagimoto 0:0e0631af0305 451 {
RyoheiHagimoto 0:0e0631af0305 452 public:
RyoheiHagimoto 0:0e0631af0305 453 InstrStruct()
RyoheiHagimoto 0:0e0631af0305 454 {
RyoheiHagimoto 0:0e0631af0305 455 useInstr = false;
RyoheiHagimoto 0:0e0631af0305 456 flags = FLAGS_MAPPING;
RyoheiHagimoto 0:0e0631af0305 457 maxDepth = 0;
RyoheiHagimoto 0:0e0631af0305 458
RyoheiHagimoto 0:0e0631af0305 459 rootNode.m_payload = NodeData("ROOT", NULL, 0, NULL, false, TYPE_GENERAL, IMPL_PLAIN);
RyoheiHagimoto 0:0e0631af0305 460 tlsStruct.get()->pCurrentNode = &rootNode;
RyoheiHagimoto 0:0e0631af0305 461 }
RyoheiHagimoto 0:0e0631af0305 462
RyoheiHagimoto 0:0e0631af0305 463 Mutex mutexCreate;
RyoheiHagimoto 0:0e0631af0305 464 Mutex mutexCount;
RyoheiHagimoto 0:0e0631af0305 465
RyoheiHagimoto 0:0e0631af0305 466 bool useInstr;
RyoheiHagimoto 0:0e0631af0305 467 int flags;
RyoheiHagimoto 0:0e0631af0305 468 int maxDepth;
RyoheiHagimoto 0:0e0631af0305 469 InstrNode rootNode;
RyoheiHagimoto 0:0e0631af0305 470 TLSData<InstrTLSStruct> tlsStruct;
RyoheiHagimoto 0:0e0631af0305 471 };
RyoheiHagimoto 0:0e0631af0305 472
RyoheiHagimoto 0:0e0631af0305 473 class CV_EXPORTS IntrumentationRegion
RyoheiHagimoto 0:0e0631af0305 474 {
RyoheiHagimoto 0:0e0631af0305 475 public:
RyoheiHagimoto 0:0e0631af0305 476 IntrumentationRegion(const char* funName, const char* fileName, int lineNum, void *retAddress, bool alwaysExpand, TYPE instrType = TYPE_GENERAL, IMPL implType = IMPL_PLAIN);
RyoheiHagimoto 0:0e0631af0305 477 ~IntrumentationRegion();
RyoheiHagimoto 0:0e0631af0305 478
RyoheiHagimoto 0:0e0631af0305 479 private:
RyoheiHagimoto 0:0e0631af0305 480 bool m_disabled; // region status
RyoheiHagimoto 0:0e0631af0305 481 uint64 m_regionTicks;
RyoheiHagimoto 0:0e0631af0305 482 };
RyoheiHagimoto 0:0e0631af0305 483
RyoheiHagimoto 0:0e0631af0305 484 CV_EXPORTS InstrStruct& getInstrumentStruct();
RyoheiHagimoto 0:0e0631af0305 485 InstrTLSStruct& getInstrumentTLSStruct();
RyoheiHagimoto 0:0e0631af0305 486 CV_EXPORTS InstrNode* getCurrentNode();
RyoheiHagimoto 0:0e0631af0305 487 }
RyoheiHagimoto 0:0e0631af0305 488 }
RyoheiHagimoto 0:0e0631af0305 489
RyoheiHagimoto 0:0e0631af0305 490 #ifdef _WIN32
RyoheiHagimoto 0:0e0631af0305 491 #define CV_INSTRUMENT_GET_RETURN_ADDRESS _ReturnAddress()
RyoheiHagimoto 0:0e0631af0305 492 #else
RyoheiHagimoto 0:0e0631af0305 493 #define CV_INSTRUMENT_GET_RETURN_ADDRESS __builtin_extract_return_addr(__builtin_return_address(0))
RyoheiHagimoto 0:0e0631af0305 494 #endif
RyoheiHagimoto 0:0e0631af0305 495
RyoheiHagimoto 0:0e0631af0305 496 // Instrument region
RyoheiHagimoto 0:0e0631af0305 497 #define CV_INSTRUMENT_REGION_META(NAME, ALWAYS_EXPAND, TYPE, IMPL) ::cv::instr::IntrumentationRegion __instr_region__(NAME, __FILE__, __LINE__, CV_INSTRUMENT_GET_RETURN_ADDRESS, ALWAYS_EXPAND, TYPE, IMPL);
RyoheiHagimoto 0:0e0631af0305 498 #define CV_INSTRUMENT_REGION_CUSTOM_META(NAME, ALWAYS_EXPAND, TYPE, IMPL)\
RyoheiHagimoto 0:0e0631af0305 499 void *__curr_address__ = [&]() {return CV_INSTRUMENT_GET_RETURN_ADDRESS;}();\
RyoheiHagimoto 0:0e0631af0305 500 ::cv::instr::IntrumentationRegion __instr_region__(NAME, __FILE__, __LINE__, __curr_address__, false, ::cv::instr::TYPE_GENERAL, ::cv::instr::IMPL_PLAIN);
RyoheiHagimoto 0:0e0631af0305 501 // Instrument functions with non-void return type
RyoheiHagimoto 0:0e0631af0305 502 #define CV_INSTRUMENT_FUN_RT_META(TYPE, IMPL, ERROR_COND, FUN, ...) ([&]()\
RyoheiHagimoto 0:0e0631af0305 503 {\
RyoheiHagimoto 0:0e0631af0305 504 if(::cv::instr::useInstrumentation()){\
RyoheiHagimoto 0:0e0631af0305 505 ::cv::instr::IntrumentationRegion __instr__(#FUN, __FILE__, __LINE__, NULL, false, TYPE, IMPL);\
RyoheiHagimoto 0:0e0631af0305 506 try{\
RyoheiHagimoto 0:0e0631af0305 507 auto status = ((FUN)(__VA_ARGS__));\
RyoheiHagimoto 0:0e0631af0305 508 if(ERROR_COND){\
RyoheiHagimoto 0:0e0631af0305 509 ::cv::instr::getCurrentNode()->m_payload.m_funError = true;\
RyoheiHagimoto 0:0e0631af0305 510 CV_INSTRUMENT_MARK_META(IMPL, #FUN " - BadExit");\
RyoheiHagimoto 0:0e0631af0305 511 }\
RyoheiHagimoto 0:0e0631af0305 512 return status;\
RyoheiHagimoto 0:0e0631af0305 513 }catch(...){\
RyoheiHagimoto 0:0e0631af0305 514 ::cv::instr::getCurrentNode()->m_payload.m_funError = true;\
RyoheiHagimoto 0:0e0631af0305 515 CV_INSTRUMENT_MARK_META(IMPL, #FUN " - BadExit");\
RyoheiHagimoto 0:0e0631af0305 516 throw;\
RyoheiHagimoto 0:0e0631af0305 517 }\
RyoheiHagimoto 0:0e0631af0305 518 }else{\
RyoheiHagimoto 0:0e0631af0305 519 return ((FUN)(__VA_ARGS__));\
RyoheiHagimoto 0:0e0631af0305 520 }\
RyoheiHagimoto 0:0e0631af0305 521 }())
RyoheiHagimoto 0:0e0631af0305 522 // Instrument functions with void return type
RyoheiHagimoto 0:0e0631af0305 523 #define CV_INSTRUMENT_FUN_RV_META(TYPE, IMPL, FUN, ...) ([&]()\
RyoheiHagimoto 0:0e0631af0305 524 {\
RyoheiHagimoto 0:0e0631af0305 525 if(::cv::instr::useInstrumentation()){\
RyoheiHagimoto 0:0e0631af0305 526 ::cv::instr::IntrumentationRegion __instr__(#FUN, __FILE__, __LINE__, NULL, false, TYPE, IMPL);\
RyoheiHagimoto 0:0e0631af0305 527 try{\
RyoheiHagimoto 0:0e0631af0305 528 (FUN)(__VA_ARGS__);\
RyoheiHagimoto 0:0e0631af0305 529 }catch(...){\
RyoheiHagimoto 0:0e0631af0305 530 ::cv::instr::getCurrentNode()->m_payload.m_funError = true;\
RyoheiHagimoto 0:0e0631af0305 531 CV_INSTRUMENT_MARK_META(IMPL, #FUN "- BadExit");\
RyoheiHagimoto 0:0e0631af0305 532 throw;\
RyoheiHagimoto 0:0e0631af0305 533 }\
RyoheiHagimoto 0:0e0631af0305 534 }else{\
RyoheiHagimoto 0:0e0631af0305 535 (FUN)(__VA_ARGS__);\
RyoheiHagimoto 0:0e0631af0305 536 }\
RyoheiHagimoto 0:0e0631af0305 537 }())
RyoheiHagimoto 0:0e0631af0305 538 // Instrumentation information marker
RyoheiHagimoto 0:0e0631af0305 539 #define CV_INSTRUMENT_MARK_META(IMPL, NAME, ...) {::cv::instr::IntrumentationRegion __instr_mark__(NAME, __FILE__, __LINE__, NULL, false, ::cv::instr::TYPE_MARKER, IMPL);}
RyoheiHagimoto 0:0e0631af0305 540
RyoheiHagimoto 0:0e0631af0305 541 ///// General instrumentation
RyoheiHagimoto 0:0e0631af0305 542 // General OpenCV region instrumentation macro
RyoheiHagimoto 0:0e0631af0305 543 #define CV_INSTRUMENT_REGION() CV_INSTRUMENT_REGION_META(__FUNCTION__, false, ::cv::instr::TYPE_GENERAL, ::cv::instr::IMPL_PLAIN)
RyoheiHagimoto 0:0e0631af0305 544 // Custom OpenCV region instrumentation macro
RyoheiHagimoto 0:0e0631af0305 545 #define CV_INSTRUMENT_REGION_NAME(NAME) CV_INSTRUMENT_REGION_CUSTOM_META(NAME, false, ::cv::instr::TYPE_GENERAL, ::cv::instr::IMPL_PLAIN)
RyoheiHagimoto 0:0e0631af0305 546 // Instrumentation for parallel_for_ or other regions which forks and gathers threads
RyoheiHagimoto 0:0e0631af0305 547 #define CV_INSTRUMENT_REGION_MT_FORK() CV_INSTRUMENT_REGION_META(__FUNCTION__, true, ::cv::instr::TYPE_GENERAL, ::cv::instr::IMPL_PLAIN);
RyoheiHagimoto 0:0e0631af0305 548
RyoheiHagimoto 0:0e0631af0305 549 ///// IPP instrumentation
RyoheiHagimoto 0:0e0631af0305 550 // Wrapper region instrumentation macro
RyoheiHagimoto 0:0e0631af0305 551 #define CV_INSTRUMENT_REGION_IPP() CV_INSTRUMENT_REGION_META(__FUNCTION__, false, ::cv::instr::TYPE_WRAPPER, ::cv::instr::IMPL_IPP)
RyoheiHagimoto 0:0e0631af0305 552 // Function instrumentation macro
RyoheiHagimoto 0:0e0631af0305 553 #define CV_INSTRUMENT_FUN_IPP(FUN, ...) CV_INSTRUMENT_FUN_RT_META(::cv::instr::TYPE_FUN, ::cv::instr::IMPL_IPP, status < 0, FUN, __VA_ARGS__)
RyoheiHagimoto 0:0e0631af0305 554 // Diagnostic markers
RyoheiHagimoto 0:0e0631af0305 555 #define CV_INSTRUMENT_MARK_IPP(NAME) CV_INSTRUMENT_MARK_META(::cv::instr::IMPL_IPP, NAME)
RyoheiHagimoto 0:0e0631af0305 556
RyoheiHagimoto 0:0e0631af0305 557 ///// OpenCL instrumentation
RyoheiHagimoto 0:0e0631af0305 558 // Wrapper region instrumentation macro
RyoheiHagimoto 0:0e0631af0305 559 #define CV_INSTRUMENT_REGION_OPENCL() CV_INSTRUMENT_REGION_META(__FUNCTION__, false, ::cv::instr::TYPE_WRAPPER, ::cv::instr::IMPL_OPENCL)
RyoheiHagimoto 0:0e0631af0305 560 // OpenCL kernel compilation wrapper
RyoheiHagimoto 0:0e0631af0305 561 #define CV_INSTRUMENT_REGION_OPENCL_COMPILE(NAME) CV_INSTRUMENT_REGION_META(NAME, false, ::cv::instr::TYPE_WRAPPER, ::cv::instr::IMPL_OPENCL)
RyoheiHagimoto 0:0e0631af0305 562 // OpenCL kernel run wrapper
RyoheiHagimoto 0:0e0631af0305 563 #define CV_INSTRUMENT_REGION_OPENCL_RUN(NAME) CV_INSTRUMENT_REGION_META(NAME, false, ::cv::instr::TYPE_FUN, ::cv::instr::IMPL_OPENCL)
RyoheiHagimoto 0:0e0631af0305 564 // Diagnostic markers
RyoheiHagimoto 0:0e0631af0305 565 #define CV_INSTRUMENT_MARK_OPENCL(NAME) CV_INSTRUMENT_MARK_META(::cv::instr::IMPL_OPENCL, NAME)
RyoheiHagimoto 0:0e0631af0305 566 #else
RyoheiHagimoto 0:0e0631af0305 567 #define CV_INSTRUMENT_REGION_META(...)
RyoheiHagimoto 0:0e0631af0305 568
RyoheiHagimoto 0:0e0631af0305 569 #define CV_INSTRUMENT_REGION()
RyoheiHagimoto 0:0e0631af0305 570 #define CV_INSTRUMENT_REGION_NAME(...)
RyoheiHagimoto 0:0e0631af0305 571 #define CV_INSTRUMENT_REGION_MT_FORK()
RyoheiHagimoto 0:0e0631af0305 572
RyoheiHagimoto 0:0e0631af0305 573 #define CV_INSTRUMENT_REGION_IPP()
RyoheiHagimoto 0:0e0631af0305 574 #define CV_INSTRUMENT_FUN_IPP(FUN, ...) ((FUN)(__VA_ARGS__))
RyoheiHagimoto 0:0e0631af0305 575 #define CV_INSTRUMENT_MARK_IPP(...)
RyoheiHagimoto 0:0e0631af0305 576
RyoheiHagimoto 0:0e0631af0305 577 #define CV_INSTRUMENT_REGION_OPENCL()
RyoheiHagimoto 0:0e0631af0305 578 #define CV_INSTRUMENT_REGION_OPENCL_COMPILE(...)
RyoheiHagimoto 0:0e0631af0305 579 #define CV_INSTRUMENT_REGION_OPENCL_RUN(...)
RyoheiHagimoto 0:0e0631af0305 580 #define CV_INSTRUMENT_MARK_OPENCL(...)
RyoheiHagimoto 0:0e0631af0305 581 #endif
RyoheiHagimoto 0:0e0631af0305 582
RyoheiHagimoto 0:0e0631af0305 583 //! @endcond
RyoheiHagimoto 0:0e0631af0305 584
RyoheiHagimoto 0:0e0631af0305 585 #endif // OPENCV_CORE_PRIVATE_HPP