76d4f84365f74b68ac9955f6357bddbb878dbbce
[profile/ivi/opencv.git] / modules / core / include / opencv2 / core / opencl / ocl_defs.hpp
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) 2014, Advanced Micro Devices, Inc., all rights reserved.
6 // Third party copyrights are property of their respective owners.
7
8 #define CV_OPENCL_RUN_ASSERT
9
10 #ifdef HAVE_OPENCL
11
12 #ifdef CV_OPENCL_RUN_VERBOSE
13 #define CV_OCL_RUN_(condition, func, ...)                                   \
14     {                                                                       \
15         if (cv::ocl::useOpenCL() && (condition) && func)                    \
16         {                                                                   \
17             printf("%s: OpenCL implementation is running\n", CV_Func);      \
18             fflush(stdout);                                                 \
19             return __VA_ARGS__;                                             \
20         }                                                                   \
21         else                                                                \
22         {                                                                   \
23             printf("%s: Plain implementation is running\n", CV_Func);       \
24             fflush(stdout);                                                 \
25         }                                                                   \
26     }
27 #elif defined CV_OPENCL_RUN_ASSERT
28 #define CV_OCL_RUN_(condition, func, ...)                                   \
29     {                                                                       \
30         if (cv::ocl::useOpenCL() && (condition))                            \
31         {                                                                   \
32             CV_Assert(func);                                                \
33             return __VA_ARGS__;                                             \
34         }                                                                   \
35     }
36 #else
37 #define CV_OCL_RUN_(condition, func, ...)                                   \
38     if (cv::ocl::useOpenCL() && (condition) && func)                        \
39         return __VA_ARGS__;
40 #endif
41
42 #else
43 #define CV_OCL_RUN_(condition, func, ...)
44 #endif
45
46 #define CV_OCL_RUN(condition, func) CV_OCL_RUN_(condition, func)