1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
4 
5 // Copyright (C) 2016, Intel Corporation, all rights reserved.
6 // Third party copyrights are property of their respective owners.
7 
8 // OpenVX related definitions and declarations
9 
10 #pragma once
11 #ifndef OPENCV_OVX_DEFS_HPP
12 #define OPENCV_OVX_DEFS_HPP
13 
14 #include "cvconfig.h"
15 
16 // utility macro for running OpenVX-based implementations
17 #ifdef HAVE_OPENVX
18 
19 #define IVX_HIDE_INFO_WARNINGS
20 #define IVX_USE_OPENCV
21 #include "ivx.hpp"
22 
23 namespace cv{
24 namespace ovx{
25 // Get common thread local OpenVX context
26 CV_EXPORTS_W ivx::Context& getOpenVXContext();
27 
skipSmallImages(int w,int h)28 template <int kernel_id> inline bool skipSmallImages(int w, int h)     { return w*h < 3840 * 2160; }
29 }}
30 
31 #define CV_OVX_RUN(condition, func, ...)          \
32     if (cv::useOpenVX() && (condition) && func)   \
33     {                                             \
34         return __VA_ARGS__;                       \
35     }
36 
37 #else
38     #define CV_OVX_RUN(condition, func, ...)
39 #endif // HAVE_OPENVX
40 
41 // Throw an error in debug mode or try another implementation in release
42 #ifdef _DEBUG
43 #define VX_DbgThrow(s) CV_Error(cv::Error::StsInternal, (s))
44 #else
45 #define VX_DbgThrow(s) return false
46 #endif
47 
48 #endif // OPENCV_OVX_DEFS_HPP
49