Renesas GR-PEACH OpenCV Development / gr-peach-opencv-project-sd-card_update

Fork of gr-peach-opencv-project-sd-card by the do

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ocl_defs.hpp Source File

ocl_defs.hpp

00001 // This file is part of OpenCV project.
00002 // It is subject to the license terms in the LICENSE file found in the top-level directory
00003 // of this distribution and at http://opencv.org/license.html.
00004 
00005 // Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
00006 // Third party copyrights are property of their respective owners.
00007 
00008 #include "opencv2/core/utility.hpp"
00009 //#define CV_OPENCL_RUN_ASSERT
00010 
00011 #ifdef HAVE_OPENCL
00012 
00013 #ifdef CV_OPENCL_RUN_VERBOSE
00014 #define CV_OCL_RUN_(condition, func, ...)                                   \
00015     {                                                                       \
00016         if (cv::ocl::useOpenCL() && (condition) && func)                    \
00017         {                                                                   \
00018             printf("%s: OpenCL implementation is running\n", CV_Func);      \
00019             fflush(stdout);                                                 \
00020             CV_IMPL_ADD(CV_IMPL_OCL);                                       \
00021             return __VA_ARGS__;                                             \
00022         }                                                                   \
00023         else                                                                \
00024         {                                                                   \
00025             printf("%s: Plain implementation is running\n", CV_Func);       \
00026             fflush(stdout);                                                 \
00027         }                                                                   \
00028     }
00029 #elif defined CV_OPENCL_RUN_ASSERT
00030 #define CV_OCL_RUN_(condition, func, ...)                                   \
00031     {                                                                       \
00032         if (cv::ocl::useOpenCL() && (condition))                            \
00033         {                                                                   \
00034             if(func)                                                        \
00035             {                                                               \
00036                 CV_IMPL_ADD(CV_IMPL_OCL);                                   \
00037             }                                                               \
00038             else                                                            \
00039             {                                                               \
00040                 CV_Error(cv::Error::StsAssert, #func);                      \
00041             }                                                               \
00042             return __VA_ARGS__;                                             \
00043         }                                                                   \
00044     }
00045 #else
00046 #define CV_OCL_RUN_(condition, func, ...)                                   \
00047     if (cv::ocl::useOpenCL() && (condition) && func)                        \
00048     {                                                                       \
00049         CV_IMPL_ADD(CV_IMPL_OCL);                                           \
00050         return __VA_ARGS__;                                                 \
00051     }
00052 #endif
00053 
00054 #else
00055 #define CV_OCL_RUN_(condition, func, ...)
00056 #endif
00057 
00058 #define CV_OCL_RUN(condition, func) CV_OCL_RUN_(condition, func)
00059