--- /dev/null
+/*M///////////////////////////////////////////////////////////////////////////////////////\r
+//\r
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\r
+//\r
+// By downloading, copying, installing or using the software you agree to this license.\r
+// If you do not agree to this license, do not download, install,\r
+// copy or use the software.\r
+//\r
+//\r
+// License Agreement\r
+// For Open Source Computer Vision Library\r
+//\r
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.\r
+// Copyright (C) 2009, Willow Garage Inc., all rights reserved.\r
+// Third party copyrights are property of their respective owners.\r
+//\r
+// Redistribution and use in source and binary forms, with or without modification,\r
+// are permitted provided that the following conditions are met:\r
+//\r
+// * Redistribution's of source code must retain the above copyright notice,\r
+// this list of conditions and the following disclaimer.\r
+//\r
+// * The name of the copyright holders may not be used to endorse or promote products\r
+// derived from this software without specific prior written permission.\r
+//\r
+// This software is provided by the copyright holders and contributors "as is" and\r
+// any express or implied warranties, including, but not limited to, the implied\r
+// warranties of merchantability and fitness for a particular purpose are disclaimed.\r
+// In no event shall the Intel Corporation or contributors be liable for any direct,\r
+// indirect, incidental, special, exemplary, or consequential damages\r
+// (including, but not limited to, procurement of substitute goods or services;\r
+// loss of use, data, or profits; or business interruption) however caused\r
+// and on any theory of liability, whether in contract, strict liability,\r
+// or tort (including negligence or otherwise) arising in any way out of\r
+// the use of this software, even if advised of the possibility of such damage.\r
+//\r
+//M*/\r
+\r
+#ifndef OCL_HPP\r
+#define OCL_HPP\r
+\r
+#include "precomp.hpp"\r
+\r
+\r
+//Root level namespace\r
+namespace cv{\r
+\r
+ //This namespace will contain all the source code for the OpenCL module\r
+ namespace ocl{\r
+\r
+ extern cl_context ocl_context;\r
+ extern cl_command_queue ocl_cmd_queue;\r
+ \r
+ class OCL_EXPORTS OclMat{\r
+ \r
+ public:\r
+ //! default constructor\r
+ OclMat();\r
+ \r
+ //! constructs OclMat of the specified size and type (supported types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16UC3, CV_64FC3 etc)\r
+ OclMat(int rows, int cols, int type);\r
+ OclMat(Size size, int type);\r
+ //! constucts OclMat and fills it with the specified value _s.\r
+ OclMat(int rows, int cols, int type, const Scalar& s);\r
+ OclMat(Size size, int type, const Scalar& s);\r
+ //! copy constructor\r
+ OclMat(const OclMat& m);\r
+\r
+ //! builds OclMat from Mat. Perfom blocking upload to device.\r
+ explicit OclMat (const Mat& m);\r
+\r
+ //! destructor - calls release()\r
+ ~OclMat();\r
+\r
+ //Releases the OpenCL context, command queue and the data buffer\r
+ void release();\r
+\r
+ //! assignment operators\r
+ OclMat& operator = (const OclMat& m);\r
+ //! assignment operator. Perfom blocking upload to device.\r
+ OclMat& operator = (const Mat& m);\r
+\r
+ //! sets every OclMatelement to s\r
+ OclMat& operator = (const Scalar& s);\r
+\r
+ //! sets some of the OclMat elements to s, according to the mask\r
+ OclMat& setTo(const Scalar& s);\r
+\r
+ //! pefroms blocking upload data to GpuMat.\r
+ void upload(const cv::Mat& m);\r
+\r
+ //! downloads data from device to host memory. Blocking calls.\r
+ operator Mat();\r
+ void download(cv::Mat& m);\r
+\r
+ //! returns the size of element in bytes.\r
+ size_t elemSize() const;\r
+ //! returns the size of element channel in bytes.\r
+ size_t elemSize1() const;\r
+ //! returns element type, similar to CV_MAT_TYPE(cvMat->type)\r
+ int type() const;\r
+ //! returns element type, similar to CV_MAT_DEPTH(cvMat->type)\r
+ int depth() const;\r
+ //! returns element type, similar to CV_MAT_CN(cvMat->type)\r
+ int channels() const;\r
+ //! returns step/elemSize1()\r
+ size_t step1() const;\r
+ //! returns GpuMatrix size:\r
+ // width == number of columns, height == number of rows\r
+ Size size() const;\r
+ //! returns true if OclMat data is NULL\r
+ bool empty() const;\r
+\r
+ int flags;\r
+\r
+ //! the number of rows and columns\r
+ int rows, cols;\r
+ //! a distance between successive rows in bytes; includes the gap if any\r
+ size_t step;\r
+ //! pointer to the data of type cl_mem\r
+ cl_mem data;\r
+\r
+ int* refcount;\r
+\r
+ //! allocates new OclMat data unless the OclMat already has specified size and type.\r
+ // previous data is unreferenced if needed.\r
+ void create(int rows, int cols, int type);\r
+ void create(Size size, int type);\r
+\r
+ void _upload(size_t size, void* src);\r
+ void _download(size_t size, void* dst);\r
+\r
+ };\r
+\r
+ //Creates the OpenCL context and command queue\r
+ OCL_EXPORTS void init();\r
+\r
+ }\r
+}\r
+\r
+#endif
\ No newline at end of file
--- /dev/null
+/*M///////////////////////////////////////////////////////////////////////////////////////\r
+//\r
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\r
+//\r
+// By downloading, copying, installing or using the software you agree to this license.\r
+// If you do not agree to this license, do not download, install,\r
+// copy or use the software.\r
+//\r
+//\r
+// License Agreement\r
+// For Open Source Computer Vision Library\r
+//\r
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.\r
+// Copyright (C) 2009, Willow Garage Inc., all rights reserved.\r
+// Third party copyrights are property of their respective owners.\r
+//\r
+// Redistribution and use in source and binary forms, with or without modification,\r
+// are permitted provided that the following conditions are met:\r
+//\r
+// * Redistribution's of source code must retain the above copyright notice,\r
+// this list of conditions and the following disclaimer.\r
+//\r
+// * Redistribution's in binary form must reproduce the above copyright notice,\r
+// this list of conditions and the following disclaimer in the documentation\r
+// and/or other GpuMaterials provided with the distribution.\r
+//\r
+// * The name of the copyright holders may not be used to endorse or promote products\r
+// derived from this software without specific prior written permission.\r
+//\r
+// This software is provided by the copyright holders and contributors "as is" and\r
+// any express or implied warranties, including, but not limited to, the implied\r
+// warranties of merchantability and fitness for a particular purpose are disclaimed.\r
+// In no event shall the Intel Corporation or contributors be liable for any direct,\r
+// indirect, incidental, special, exemplary, or consequential damages\r
+// (including, but not limited to, procurement of substitute goods or services;\r
+// loss of use, data, or profits; or business interruption) however caused\r
+// and on any theory of liability, whether in contract, strict liability,\r
+// or tort (including negligence or otherwise) arising in any way out of\r
+// the use of this software, even if advised of the possibility of such damage.\r
+//\r
+//M*/\r
+\r
+#ifndef OCL_UTIL_H\r
+#define OCL_UTIL_H\r
+\r
+#include "ocl.hpp"\r
+\r
+namespace cv{\r
+ namespace ocl{\r
+ namespace util{\r
+\r
+ //Step 1: Get the target platform\r
+ cl_platform_id GetOCLPlatform();\r
+ \r
+ //Step 2: Create a context\r
+ int createContext(cl_context* context, cl_command_queue* cmd_queue, bool hasGPU);\r
+ }\r
+ }\r
+}\r
+\r
+#endif
\ No newline at end of file
--- /dev/null
+/*M///////////////////////////////////////////////////////////////////////////////////////\r
+//\r
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\r
+//\r
+// By downloading, copying, installing or using the software you agree to this license.\r
+// If you do not agree to this license, do not download, install,\r
+// copy or use the software.\r
+//\r
+//\r
+// License Agreement\r
+// For Open Source Computer Vision Library\r
+//\r
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.\r
+// Copyright (C) 2009, Willow Garage Inc., all rights reserved.\r
+// Third party copyrights are property of their respective owners.\r
+//\r
+// Redistribution and use in source and binary forms, with or without modification,\r
+// are permitted provided that the following conditions are met:\r
+//\r
+// * Redistribution's of source code must retain the above copyright notice,\r
+// this list of conditions and the following disclaimer.\r
+//\r
+// * Redistribution's in binary form must reproduce the above copyright notice,\r
+// this list of conditions and the following disclaimer in the documentation\r
+// and/or other GpuMaterials provided with the distribution.\r
+//\r
+// * The name of the copyright holders may not be used to endorse or promote products\r
+// derived from this software without specific prior written permission.\r
+//\r
+// This software is provided by the copyright holders and contributors "as is" and\r
+// any express or implied warranties, including, but not limited to, the implied\r
+// warranties of merchantability and fitness for a particular purpose are disclaimed.\r
+// In no event shall the Intel Corporation or contributors be liable for any direct,\r
+// indirect, incidental, special, exemplary, or consequential damages\r
+// (including, but not limited to, procurement of substitute goods or services;\r
+// loss of use, data, or profits; or business interruption) however caused\r
+// and on any theory of liability, whether in contract, strict liability,\r
+// or tort (including negligence or otherwise) arising in any way out of\r
+// the use of this software, even if advised of the possibility of such damage.\r
+//\r
+//M*/\r
+\r
+/*\r
+This header file will contain all the type, struct and enum definitions exclusively used by the OpenCL module\r
+*/\r
+\r
+#ifndef OCLDEFS_H\r
+#define OCLDEFS_H\r
+\r
+enum OclStatus{\r
+\r
+ OCL_SUCCESS=0,\r
+ OCL_ERROR=-100,\r
+ OCL_SIZE_ERROR = -101\r
+\r
+};\r
+\r
+\r
+#endif
\ No newline at end of file