Renesas / opencv-lib

Dependents:   RZ_A2M_Mbed_samples

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers private.hpp Source File

private.hpp

00001 /*M///////////////////////////////////////////////////////////////////////////////////////
00002 //
00003 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
00004 //
00005 //  By downloading, copying, installing or using the software you agree to this license.
00006 //  If you do not agree to this license, do not download, install,
00007 //  copy or use the software.
00008 //
00009 //
00010 //                          License Agreement
00011 //                For Open Source Computer Vision Library
00012 //
00013 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
00014 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
00015 // Copyright (C) 2013, OpenCV Foundation, all rights reserved.
00016 // Third party copyrights are property of their respective owners.
00017 //
00018 // Redistribution and use in source and binary forms, with or without modification,
00019 // are permitted provided that the following conditions are met:
00020 //
00021 //   * Redistribution's of source code must retain the above copyright notice,
00022 //     this list of conditions and the following disclaimer.
00023 //
00024 //   * Redistribution's in binary form must reproduce the above copyright notice,
00025 //     this list of conditions and the following disclaimer in the documentation
00026 //     and/or other materials provided with the distribution.
00027 //
00028 //   * The name of the copyright holders may not be used to endorse or promote products
00029 //     derived from this software without specific prior written permission.
00030 //
00031 // This software is provided by the copyright holders and contributors "as is" and
00032 // any express or implied warranties, including, but not limited to, the implied
00033 // warranties of merchantability and fitness for a particular purpose are disclaimed.
00034 // In no event shall the Intel Corporation or contributors be liable for any direct,
00035 // indirect, incidental, special, exemplary, or consequential damages
00036 // (including, but not limited to, procurement of substitute goods or services;
00037 // loss of use, data, or profits; or business interruption) however caused
00038 // and on any theory of liability, whether in contract, strict liability,
00039 // or tort (including negligence or otherwise) arising in any way out of
00040 // the use of this software, even if advised of the possibility of such damage.
00041 //
00042 //M*/
00043 
00044 #ifndef OPENCV_CORE_PRIVATE_HPP
00045 #define OPENCV_CORE_PRIVATE_HPP
00046 
00047 #ifndef __OPENCV_BUILD
00048 #  error this is a private header which should not be used from outside of the OpenCV library
00049 #endif
00050 
00051 #include "opencv2/core.hpp"
00052 #include "cvconfig.h"
00053 
00054 #ifdef HAVE_EIGEN
00055 #  if defined __GNUC__ && defined __APPLE__
00056 #    pragma GCC diagnostic ignored "-Wshadow"
00057 #  endif
00058 #  include <Eigen/Core>
00059 #  include "opencv2/core/eigen.hpp"
00060 #endif
00061 
00062 #ifdef HAVE_TBB
00063 #  include "tbb/tbb.h"
00064 #  include "tbb/task.h"
00065 #  undef min
00066 #  undef max
00067 #endif
00068 
00069 #if defined HAVE_FP16 && (defined __F16C__ || (defined _MSC_VER && _MSC_VER >= 1700))
00070 #  include <immintrin.h>
00071 #  define CV_FP16 1
00072 #elif defined HAVE_FP16 && defined __GNUC__
00073 #  define CV_FP16 1
00074 #endif
00075 
00076 #ifndef CV_FP16
00077 #  define CV_FP16 0
00078 #endif
00079 
00080 //! @cond IGNORED
00081 
00082 namespace cv
00083 {
00084 #ifdef HAVE_TBB
00085 
00086     typedef tbb::blocked_range<int> BlockedRange;
00087 
00088     template<typename Body> static inline
00089     void parallel_for( const BlockedRange& range, const Body& body )
00090     {
00091         tbb::parallel_for(range, body);
00092     }
00093 
00094     typedef tbb::split Split;
00095 
00096     template<typename Body> static inline
00097     void parallel_reduce( const BlockedRange& range, Body& body )
00098     {
00099         tbb::parallel_reduce(range, body);
00100     }
00101 
00102     typedef tbb::concurrent_vector<Rect> ConcurrentRectVector;
00103 #else
00104     class BlockedRange
00105     {
00106     public:
00107         BlockedRange() : _begin(0), _end(0), _grainsize(0) {}
00108         BlockedRange(int b, int e, int g=1) : _begin(b), _end(e), _grainsize(g) {}
00109         int begin() const { return _begin; }
00110         int end() const { return _end; }
00111         int grainsize() const { return _grainsize; }
00112 
00113     protected:
00114         int _begin, _end, _grainsize;
00115     };
00116 
00117     template<typename Body> static inline
00118     void parallel_for( const BlockedRange& range, const Body& body )
00119     {
00120         body(range);
00121     }
00122     typedef std::vector<Rect> ConcurrentRectVector;
00123 
00124     class Split {};
00125 
00126     template<typename Body> static inline
00127     void parallel_reduce( const BlockedRange& range, Body& body )
00128     {
00129         body(range);
00130     }
00131 #endif
00132 
00133     // Returns a static string if there is a parallel framework,
00134     // NULL otherwise.
00135     CV_EXPORTS const char* currentParallelFramework();
00136 } //namespace cv
00137 
00138 /****************************************************************************************\
00139 *                                  Common declarations                                   *
00140 \****************************************************************************************/
00141 
00142 /* the alignment of all the allocated buffers */
00143 #define  CV_MALLOC_ALIGN    16
00144 
00145 /* IEEE754 constants and macros */
00146 #define  CV_TOGGLE_FLT(x) ((x)^((int)(x) < 0 ? 0x7fffffff : 0))
00147 #define  CV_TOGGLE_DBL(x) ((x)^((int64)(x) < 0 ? CV_BIG_INT(0x7fffffffffffffff) : 0))
00148 
00149 static inline void* cvAlignPtr( const void* ptr, int align = 32 )
00150 {
00151     CV_DbgAssert ( (align & (align-1)) == 0 );
00152     return (void*)( ((size_t)ptr + align - 1) & ~(size_t)(align-1) );
00153 }
00154 
00155 static inline int cvAlign( int size, int align )
00156 {
00157     CV_DbgAssert( (align & (align-1)) == 0 && size < INT_MAX );
00158     return (size + align - 1) & -align;
00159 }
00160 
00161 #ifdef IPL_DEPTH_8U
00162 static inline cv::Size cvGetMatSize( const CvMat* mat )
00163 {
00164     return cv::Size(mat->cols, mat->rows);
00165 }
00166 #endif
00167 
00168 namespace cv
00169 {
00170 CV_EXPORTS void scalarToRawData(const cv::Scalar & s, void* buf, int type, int unroll_to = 0);
00171 }
00172 
00173 // property implementation macros
00174 
00175 #define CV_IMPL_PROPERTY_RO(type, name, member) \
00176     inline type get##name() const { return member; }
00177 
00178 #define CV_HELP_IMPL_PROPERTY(r_type, w_type, name, member) \
00179     CV_IMPL_PROPERTY_RO(r_type, name, member) \
00180     inline void set##name(w_type val) { member = val; }
00181 
00182 #define CV_HELP_WRAP_PROPERTY(r_type, w_type, name, internal_name, internal_obj) \
00183     r_type get##name() const { return internal_obj.get##internal_name(); } \
00184     void set##name(w_type val) { internal_obj.set##internal_name(val); }
00185 
00186 #define CV_IMPL_PROPERTY(type, name, member) CV_HELP_IMPL_PROPERTY(type, type, name, member)
00187 #define CV_IMPL_PROPERTY_S(type, name, member) CV_HELP_IMPL_PROPERTY(type, const type &, name, member)
00188 
00189 #define CV_WRAP_PROPERTY(type, name, internal_name, internal_obj)  CV_HELP_WRAP_PROPERTY(type, type, name, internal_name, internal_obj)
00190 #define CV_WRAP_PROPERTY_S(type, name, internal_name, internal_obj) CV_HELP_WRAP_PROPERTY(type, const type &, name, internal_name, internal_obj)
00191 
00192 #define CV_WRAP_SAME_PROPERTY(type, name, internal_obj) CV_WRAP_PROPERTY(type, name, name, internal_obj)
00193 #define CV_WRAP_SAME_PROPERTY_S(type, name, internal_obj) CV_WRAP_PROPERTY_S(type, name, name, internal_obj)
00194 
00195 /****************************************************************************************\
00196 *                     Structures and macros for integration with IPP                     *
00197 \****************************************************************************************/
00198 
00199 #ifdef HAVE_IPP
00200 #include "ipp.h"
00201 
00202 #ifndef IPP_VERSION_UPDATE // prior to 7.1
00203 #define IPP_VERSION_UPDATE 0
00204 #endif
00205 
00206 #define IPP_VERSION_X100 (IPP_VERSION_MAJOR * 100 + IPP_VERSION_MINOR*10 + IPP_VERSION_UPDATE)
00207 
00208 // General define for ipp function disabling
00209 #define IPP_DISABLE_BLOCK 0
00210 
00211 #ifdef CV_MALLOC_ALIGN
00212 #undef CV_MALLOC_ALIGN
00213 #endif
00214 #define CV_MALLOC_ALIGN 32 // required for AVX optimization
00215 
00216 #define setIppErrorStatus() cv::ipp::setIppStatus(-1, CV_Func, __FILE__, __LINE__)
00217 
00218 static inline IppiSize ippiSize(int width, int height)
00219 {
00220     IppiSize size = { width, height };
00221     return size;
00222 }
00223 
00224 static inline IppiSize ippiSize(const cv::Size & _size)
00225 {
00226     IppiSize size = { _size.width, _size.height };
00227     return size;
00228 }
00229 
00230 static inline IppiPoint ippiPoint(const cv::Point & _point)
00231 {
00232     IppiPoint point = { _point.x, _point.y };
00233     return point;
00234 }
00235 
00236 static inline IppiPoint ippiPoint(int x, int y)
00237 {
00238     IppiPoint point = { x, y };
00239     return point;
00240 }
00241 
00242 static inline IppiBorderType ippiGetBorderType(int borderTypeNI)
00243 {
00244     return borderTypeNI == cv::BORDER_CONSTANT ? ippBorderConst :
00245         borderTypeNI == cv::BORDER_WRAP ? ippBorderWrap :
00246         borderTypeNI == cv::BORDER_REPLICATE ? ippBorderRepl :
00247         borderTypeNI == cv::BORDER_REFLECT_101 ? ippBorderMirror :
00248         borderTypeNI == cv::BORDER_REFLECT ? ippBorderMirrorR : (IppiBorderType)-1;
00249 }
00250 
00251 static inline IppDataType ippiGetDataType(int depth)
00252 {
00253     return depth == CV_8U ? ipp8u :
00254         depth == CV_8S ? ipp8s :
00255         depth == CV_16U ? ipp16u :
00256         depth == CV_16S ? ipp16s :
00257         depth == CV_32S ? ipp32s :
00258         depth == CV_32F ? ipp32f :
00259         depth == CV_64F ? ipp64f : (IppDataType)-1;
00260 }
00261 
00262 // IPP temporary buffer hepler
00263 template<typename T>
00264 class IppAutoBuffer
00265 {
00266 public:
00267     IppAutoBuffer() { m_pBuffer = NULL; }
00268     IppAutoBuffer(int size) { Alloc(size); }
00269     ~IppAutoBuffer() { Release(); }
00270     T* Alloc(int size) { m_pBuffer = (T*)ippMalloc(size); return m_pBuffer; }
00271     void Release() { if(m_pBuffer) ippFree(m_pBuffer); }
00272     inline operator T* () { return (T*)m_pBuffer;}
00273     inline operator const T* () const { return (const T*)m_pBuffer;}
00274 private:
00275     // Disable copy operations
00276     IppAutoBuffer(IppAutoBuffer &) {}
00277     IppAutoBuffer& operator =(const IppAutoBuffer &) {return *this;}
00278 
00279     T* m_pBuffer;
00280 };
00281 
00282 #else
00283 #define IPP_VERSION_X100 0
00284 #endif
00285 
00286 #if defined HAVE_IPP
00287 #if IPP_VERSION_X100 >= 900
00288 #define IPP_INITIALIZER(FEAT)                           \
00289 {                                                       \
00290     if(FEAT)                                            \
00291         ippSetCpuFeatures(FEAT);                        \
00292     else                                                \
00293         ippInit();                                      \
00294 }
00295 #elif IPP_VERSION_X100 >= 800
00296 #define IPP_INITIALIZER(FEAT)                           \
00297 {                                                       \
00298     ippInit();                                          \
00299 }
00300 #else
00301 #define IPP_INITIALIZER(FEAT)                           \
00302 {                                                       \
00303     ippStaticInit();                                    \
00304 }
00305 #endif
00306 
00307 #ifdef CVAPI_EXPORTS
00308 #define IPP_INITIALIZER_AUTO                            \
00309 struct __IppInitializer__                               \
00310 {                                                       \
00311     __IppInitializer__()                                \
00312     {IPP_INITIALIZER(cv::ipp::getIppFeatures())}        \
00313 };                                                      \
00314 static struct __IppInitializer__ __ipp_initializer__;
00315 #else
00316 #define IPP_INITIALIZER_AUTO
00317 #endif
00318 #else
00319 #define IPP_INITIALIZER
00320 #define IPP_INITIALIZER_AUTO
00321 #endif
00322 
00323 #define CV_IPP_CHECK_COND (cv::ipp::useIPP())
00324 #define CV_IPP_CHECK() if(CV_IPP_CHECK_COND)
00325 
00326 #ifdef HAVE_IPP
00327 
00328 #ifdef CV_IPP_RUN_VERBOSE
00329 #define CV_IPP_RUN_(condition, func, ...)                                   \
00330     {                                                                       \
00331         if (cv::ipp::useIPP() && (condition) && (func))                     \
00332         {                                                                   \
00333             printf("%s: IPP implementation is running\n", CV_Func);         \
00334             fflush(stdout);                                                 \
00335             CV_IMPL_ADD(CV_IMPL_IPP);                                       \
00336             return __VA_ARGS__;                                             \
00337         }                                                                   \
00338         else                                                                \
00339         {                                                                   \
00340             printf("%s: Plain implementation is running\n", CV_Func);       \
00341             fflush(stdout);                                                 \
00342         }                                                                   \
00343     }
00344 #elif defined CV_IPP_RUN_ASSERT
00345 #define CV_IPP_RUN_(condition, func, ...)                                   \
00346     {                                                                       \
00347         if (cv::ipp::useIPP() && (condition))                               \
00348         {                                                                   \
00349             if(func)                                                        \
00350             {                                                               \
00351                 CV_IMPL_ADD(CV_IMPL_IPP);                                   \
00352             }                                                               \
00353             else                                                            \
00354             {                                                               \
00355                 setIppErrorStatus();                                        \
00356                 CV_Error(cv::Error::StsAssert, #func);                      \
00357             }                                                               \
00358             return __VA_ARGS__;                                             \
00359         }                                                                   \
00360     }
00361 #else
00362 #define CV_IPP_RUN_(condition, func, ...)                                   \
00363     if (cv::ipp::useIPP() && (condition) && (func))                         \
00364     {                                                                       \
00365         CV_IMPL_ADD(CV_IMPL_IPP);                                           \
00366         return __VA_ARGS__;                                                 \
00367     }
00368 #endif
00369 #define CV_IPP_RUN_FAST(func, ...)                                          \
00370     if (cv::ipp::useIPP() && (func))                                        \
00371     {                                                                       \
00372         CV_IMPL_ADD(CV_IMPL_IPP);                                           \
00373         return __VA_ARGS__;                                                 \
00374     }
00375 #else
00376 #define CV_IPP_RUN_(condition, func, ...)
00377 #define CV_IPP_RUN_FAST(func, ...)
00378 #endif
00379 
00380 #define CV_IPP_RUN(condition, func, ...) CV_IPP_RUN_((condition), (func), __VA_ARGS__)
00381 
00382 
00383 #ifndef IPPI_CALL
00384 #  define IPPI_CALL(func) CV_Assert((func) >= 0)
00385 #endif
00386 
00387 /* IPP-compatible return codes */
00388 typedef enum CvStatus
00389 {
00390     CV_BADMEMBLOCK_ERR          = -113,
00391     CV_INPLACE_NOT_SUPPORTED_ERR= -112,
00392     CV_UNMATCHED_ROI_ERR        = -111,
00393     CV_NOTFOUND_ERR             = -110,
00394     CV_BADCONVERGENCE_ERR       = -109,
00395 
00396     CV_BADDEPTH_ERR             = -107,
00397     CV_BADROI_ERR               = -106,
00398     CV_BADHEADER_ERR            = -105,
00399     CV_UNMATCHED_FORMATS_ERR    = -104,
00400     CV_UNSUPPORTED_COI_ERR      = -103,
00401     CV_UNSUPPORTED_CHANNELS_ERR = -102,
00402     CV_UNSUPPORTED_DEPTH_ERR    = -101,
00403     CV_UNSUPPORTED_FORMAT_ERR   = -100,
00404 
00405     CV_BADARG_ERR               = -49,  //ipp comp
00406     CV_NOTDEFINED_ERR           = -48,  //ipp comp
00407 
00408     CV_BADCHANNELS_ERR          = -47,  //ipp comp
00409     CV_BADRANGE_ERR             = -44,  //ipp comp
00410     CV_BADSTEP_ERR              = -29,  //ipp comp
00411 
00412     CV_BADFLAG_ERR              =  -12,
00413     CV_DIV_BY_ZERO_ERR          =  -11, //ipp comp
00414     CV_BADCOEF_ERR              =  -10,
00415 
00416     CV_BADFACTOR_ERR            =  -7,
00417     CV_BADPOINT_ERR             =  -6,
00418     CV_BADSCALE_ERR             =  -4,
00419     CV_OUTOFMEM_ERR             =  -3,
00420     CV_NULLPTR_ERR              =  -2,
00421     CV_BADSIZE_ERR              =  -1,
00422     CV_NO_ERR                   =   0,
00423     CV_OK                       =   CV_NO_ERR
00424 }
00425 CvStatus;
00426 
00427 #ifdef HAVE_TEGRA_OPTIMIZATION
00428 namespace tegra {
00429 
00430 CV_EXPORTS bool useTegra();
00431 CV_EXPORTS void setUseTegra(bool flag);
00432 
00433 }
00434 #endif
00435 
00436 #ifdef ENABLE_INSTRUMENTATION
00437 namespace cv
00438 {
00439 namespace instr
00440 {
00441 struct InstrTLSStruct
00442 {
00443     InstrTLSStruct()
00444     {
00445         pCurrentNode = NULL;
00446     }
00447     InstrNode* pCurrentNode;
00448 };
00449 
00450 class InstrStruct
00451 {
00452 public:
00453     InstrStruct()
00454     {
00455         useInstr    = false;
00456         flags       = FLAGS_MAPPING;
00457         maxDepth    = 0;
00458 
00459         rootNode.m_payload = NodeData("ROOT", NULL, 0, NULL, false, TYPE_GENERAL, IMPL_PLAIN);
00460         tlsStruct.get()->pCurrentNode = &rootNode;
00461     }
00462 
00463     Mutex mutexCreate;
00464     Mutex mutexCount;
00465 
00466     bool       useInstr;
00467     int        flags;
00468     int        maxDepth;
00469     InstrNode  rootNode;
00470     TLSData<InstrTLSStruct> tlsStruct;
00471 };
00472 
00473 class CV_EXPORTS IntrumentationRegion
00474 {
00475 public:
00476     IntrumentationRegion(const char* funName, const char* fileName, int lineNum, void *retAddress, bool alwaysExpand, TYPE instrType = TYPE_GENERAL, IMPL implType = IMPL_PLAIN);
00477     ~IntrumentationRegion();
00478 
00479 private:
00480     bool    m_disabled; // region status
00481     uint64  m_regionTicks;
00482 };
00483 
00484 CV_EXPORTS InstrStruct& getInstrumentStruct();
00485 InstrTLSStruct&         getInstrumentTLSStruct();
00486 CV_EXPORTS InstrNode*   getCurrentNode();
00487 }
00488 }
00489 
00490 #ifdef _WIN32
00491 #define CV_INSTRUMENT_GET_RETURN_ADDRESS _ReturnAddress()
00492 #else
00493 #define CV_INSTRUMENT_GET_RETURN_ADDRESS __builtin_extract_return_addr(__builtin_return_address(0))
00494 #endif
00495 
00496 // Instrument region
00497 #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);
00498 #define CV_INSTRUMENT_REGION_CUSTOM_META(NAME, ALWAYS_EXPAND, TYPE, IMPL)\
00499     void *__curr_address__ = [&]() {return CV_INSTRUMENT_GET_RETURN_ADDRESS;}();\
00500     ::cv::instr::IntrumentationRegion __instr_region__(NAME, __FILE__, __LINE__, __curr_address__, false, ::cv::instr::TYPE_GENERAL, ::cv::instr::IMPL_PLAIN);
00501 // Instrument functions with non-void return type
00502 #define CV_INSTRUMENT_FUN_RT_META(TYPE, IMPL, ERROR_COND, FUN, ...) ([&]()\
00503 {\
00504     if(::cv::instr::useInstrumentation()){\
00505         ::cv::instr::IntrumentationRegion __instr__(#FUN, __FILE__, __LINE__, NULL, false, TYPE, IMPL);\
00506         try{\
00507             auto status = ((FUN)(__VA_ARGS__));\
00508             if(ERROR_COND){\
00509                 ::cv::instr::getCurrentNode()->m_payload.m_funError = true;\
00510                 CV_INSTRUMENT_MARK_META(IMPL, #FUN " - BadExit");\
00511             }\
00512             return status;\
00513         }catch(...){\
00514             ::cv::instr::getCurrentNode()->m_payload.m_funError = true;\
00515             CV_INSTRUMENT_MARK_META(IMPL, #FUN " - BadExit");\
00516             throw;\
00517         }\
00518     }else{\
00519         return ((FUN)(__VA_ARGS__));\
00520     }\
00521 }())
00522 // Instrument functions with void return type
00523 #define CV_INSTRUMENT_FUN_RV_META(TYPE, IMPL, FUN, ...) ([&]()\
00524 {\
00525     if(::cv::instr::useInstrumentation()){\
00526         ::cv::instr::IntrumentationRegion __instr__(#FUN, __FILE__, __LINE__, NULL, false, TYPE, IMPL);\
00527         try{\
00528             (FUN)(__VA_ARGS__);\
00529         }catch(...){\
00530             ::cv::instr::getCurrentNode()->m_payload.m_funError = true;\
00531             CV_INSTRUMENT_MARK_META(IMPL, #FUN "- BadExit");\
00532             throw;\
00533         }\
00534     }else{\
00535         (FUN)(__VA_ARGS__);\
00536     }\
00537 }())
00538 // Instrumentation information marker
00539 #define CV_INSTRUMENT_MARK_META(IMPL, NAME, ...) {::cv::instr::IntrumentationRegion __instr_mark__(NAME, __FILE__, __LINE__, NULL, false, ::cv::instr::TYPE_MARKER, IMPL);}
00540 
00541 ///// General instrumentation
00542 // General OpenCV region instrumentation macro
00543 #define CV_INSTRUMENT_REGION()              CV_INSTRUMENT_REGION_META(__FUNCTION__, false, ::cv::instr::TYPE_GENERAL, ::cv::instr::IMPL_PLAIN)
00544 // Custom OpenCV region instrumentation macro
00545 #define CV_INSTRUMENT_REGION_NAME(NAME)     CV_INSTRUMENT_REGION_CUSTOM_META(NAME,  false, ::cv::instr::TYPE_GENERAL, ::cv::instr::IMPL_PLAIN)
00546 // Instrumentation for parallel_for_ or other regions which forks and gathers threads
00547 #define CV_INSTRUMENT_REGION_MT_FORK()      CV_INSTRUMENT_REGION_META(__FUNCTION__, true,  ::cv::instr::TYPE_GENERAL, ::cv::instr::IMPL_PLAIN);
00548 
00549 ///// IPP instrumentation
00550 // Wrapper region instrumentation macro
00551 #define CV_INSTRUMENT_REGION_IPP()          CV_INSTRUMENT_REGION_META(__FUNCTION__, false, ::cv::instr::TYPE_WRAPPER, ::cv::instr::IMPL_IPP)
00552 // Function instrumentation macro
00553 #define CV_INSTRUMENT_FUN_IPP(FUN, ...)     CV_INSTRUMENT_FUN_RT_META(::cv::instr::TYPE_FUN, ::cv::instr::IMPL_IPP, status < 0, FUN, __VA_ARGS__)
00554 // Diagnostic markers
00555 #define CV_INSTRUMENT_MARK_IPP(NAME)        CV_INSTRUMENT_MARK_META(::cv::instr::IMPL_IPP, NAME)
00556 
00557 ///// OpenCL instrumentation
00558 // Wrapper region instrumentation macro
00559 #define CV_INSTRUMENT_REGION_OPENCL()              CV_INSTRUMENT_REGION_META(__FUNCTION__, false, ::cv::instr::TYPE_WRAPPER, ::cv::instr::IMPL_OPENCL)
00560 // OpenCL kernel compilation wrapper
00561 #define CV_INSTRUMENT_REGION_OPENCL_COMPILE(NAME)  CV_INSTRUMENT_REGION_META(NAME, false, ::cv::instr::TYPE_WRAPPER, ::cv::instr::IMPL_OPENCL)
00562 // OpenCL kernel run wrapper
00563 #define CV_INSTRUMENT_REGION_OPENCL_RUN(NAME)      CV_INSTRUMENT_REGION_META(NAME, false, ::cv::instr::TYPE_FUN, ::cv::instr::IMPL_OPENCL)
00564 // Diagnostic markers
00565 #define CV_INSTRUMENT_MARK_OPENCL(NAME)            CV_INSTRUMENT_MARK_META(::cv::instr::IMPL_OPENCL, NAME)
00566 #else
00567 #define CV_INSTRUMENT_REGION_META(...)
00568 
00569 #define CV_INSTRUMENT_REGION()
00570 #define CV_INSTRUMENT_REGION_NAME(...)
00571 #define CV_INSTRUMENT_REGION_MT_FORK()
00572 
00573 #define CV_INSTRUMENT_REGION_IPP()
00574 #define CV_INSTRUMENT_FUN_IPP(FUN, ...) ((FUN)(__VA_ARGS__))
00575 #define CV_INSTRUMENT_MARK_IPP(...)
00576 
00577 #define CV_INSTRUMENT_REGION_OPENCL()
00578 #define CV_INSTRUMENT_REGION_OPENCL_COMPILE(...)
00579 #define CV_INSTRUMENT_REGION_OPENCL_RUN(...)
00580 #define CV_INSTRUMENT_MARK_OPENCL(...)
00581 #endif
00582 
00583 //! @endcond
00584 
00585 #endif // OPENCV_CORE_PRIVATE_HPP