renamed gpu to ocl
authorsalmanulhaq <no@email>
Thu, 7 Jul 2011 16:21:20 +0000 (16:21 +0000)
committersalmanulhaq <no@email>
Thu, 7 Jul 2011 16:21:20 +0000 (16:21 +0000)
modules/ocl/src/gpu/ocl_util.cpp [deleted file]
modules/ocl/src/gpu/oclmat.cpp [deleted file]
modules/ocl/src/gpu/precomp.cpp [deleted file]
modules/ocl/src/gpu/precomp.hpp [deleted file]

diff --git a/modules/ocl/src/gpu/ocl_util.cpp b/modules/ocl/src/gpu/ocl_util.cpp
deleted file mode 100644 (file)
index b592637..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*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
-#include "ocl.hpp"\r
-\r
-cl_platform_id cv::ocl::util::GetOCLPlatform()\r
-{\r
-    cl_platform_id pPlatforms[10] = { 0 };\r
-    char pPlatformName[128] = { 0 };\r
-\r
-    cl_uint uiPlatformsCount = 0;\r
-    cl_int err = clGetPlatformIDs(10, pPlatforms, &uiPlatformsCount);\r
-    for (cl_uint ui = 0; ui < uiPlatformsCount; ++ui)\r
-    {\r
-        err = clGetPlatformInfo(pPlatforms[ui], CL_PLATFORM_NAME, 128 * sizeof(char), pPlatformName, NULL);\r
-        if ( err != CL_SUCCESS )\r
-        {\r
-            return NULL;\r
-        }\r
-\r
-            return pPlatforms[ui];\r
-    }\r
-}\r
-\r
-int cv::ocl::util::createContext(cl_context* context, cl_command_queue* cmd_queue, bool hasGPU){\r
-\r
-    size_t cb;\r
-       cl_int err;\r
-       cl_platform_id platform_id = cv::ocl::util::GetOCLPlatform();\r
-\r
-       cl_context_properties context_properties[3] = {CL_CONTEXT_PLATFORM, (cl_context_properties)platform_id, NULL };\r
-\r
-       //If the GPU is present, create the context on GPU\r
-       if(hasGPU)\r
-               *context = clCreateContextFromType(context_properties, CL_DEVICE_TYPE_GPU, NULL, NULL, NULL);\r
-       else\r
-               *context = clCreateContextFromType(context_properties, CL_DEVICE_TYPE_CPU, NULL, NULL, NULL);\r
-\r
-    // get the list of devices associated with context\r
-    err = clGetContextInfo(*context, CL_CONTEXT_DEVICES, 0, NULL, &cb);\r
-\r
-       cl_device_id *devices = (cl_device_id*)malloc(cb);\r
-\r
-       clGetContextInfo(*context, CL_CONTEXT_DEVICES, cb, devices, NULL);\r
-\r
-    // create a command-queue\r
-    *cmd_queue = clCreateCommandQueue(*context, devices[0], 0, NULL);\r
-    free(devices);\r
-\r
-       return CL_SUCCESS;\r
-}\r
diff --git a/modules/ocl/src/gpu/oclmat.cpp b/modules/ocl/src/gpu/oclmat.cpp
deleted file mode 100644 (file)
index a27f92e..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-/*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
-#include "ocl.hpp"\r
-\r
-namespace cv{\r
-\r
-       namespace ocl{\r
-\r
-               cl_context ocl_context;\r
-               cl_command_queue ocl_cmd_queue;\r
-               bool initialized = false;\r
-\r
-               inline OclMat::OclMat() : rows(0), cols(0), step(0), data(0), refcount(0) {}\r
-\r
-               inline OclMat::OclMat(int _rows, int _cols, int _type): flags(0), rows(0), cols(0), step(0), data(0), refcount(0){\r
-               \r
-                       if(_rows > 0 && _cols > 0)\r
-                               create(_rows, _cols, _type);\r
-               }\r
-\r
-               inline OclMat::OclMat(Size size, int _type): flags(0), rows(0), cols(0), step(0), data(0), refcount(0){\r
-                       \r
-                       if(size.height > 0 && size.width > 0)\r
-                               create(size, _type);\r
-               }\r
-\r
-               inline OclMat::OclMat(const OclMat& m) \r
-               : flags(m.flags), rows(m.rows), cols(m.cols), step(m.step), data(m.data), refcount(m.refcount){\r
-                       \r
-                       if(refcount)\r
-                               CV_XADD(refcount, 1);\r
-               }\r
-\r
-               inline OclMat::OclMat(const Mat& m)\r
-               : flags(0), rows(0), cols(0), step(0), data(0), refcount(0) { upload(m); }\r
-\r
-               inline OclMat::~OclMat(){ release(); }\r
-\r
-               void OclMat::_upload(size_t size, void* src){\r
-\r
-                       this->data = clCreateBuffer(ocl_context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, size, src, NULL);\r
-               }\r
-\r
-               void OclMat::_download(size_t size, void* dst){\r
-               \r
-                       cl_int err = clEnqueueReadBuffer(ocl_cmd_queue, data, CL_TRUE, 0, size, dst, 0, NULL, NULL);\r
-               }\r
-\r
-\r
-               void OclMat::release(){\r
-               \r
-                       if( refcount && CV_XADD(refcount, -1) == 1 )\r
-                       {\r
-                               free(refcount);\r
-                               clReleaseMemObject(data);\r
-                       }\r
-                       clReleaseMemObject(data);\r
-                       data = 0;\r
-                       step = rows = cols = 0;\r
-                       refcount = 0;\r
-               }\r
-\r
-               void OclMat::upload(const Mat& m){\r
-               \r
-                       create(m.rows, m.cols, m.type());\r
-                       int ch = channels();\r
-                       int d = elemSize();\r
-                       size_t s = rows*cols*ch*d;\r
-                       if(initialized)\r
-                               this->_upload(s, m.data);\r
-                       else{\r
-                               init();\r
-                               this->_upload(s, m.data);\r
-#ifdef _DEBUG\r
-                               printf("Context and Command queues not initialized. First call cv::ocl::init()");\r
-#endif\r
-                       }\r
-               }\r
-\r
-               void OclMat::download(Mat& m){\r
-               \r
-                       size_t s = rows*cols*channels()*elemSize();\r
-                       m.create(rows, cols, type());\r
-                       if(initialized){\r
-                                       this->_download(s, m.data);\r
-                       }\r
-\r
-                       else{\r
-                               init();\r
-                               this->_download(s, m.data);\r
-#ifdef _DEBUG\r
-                               printf("Context and Command queues not initialized. First call cv::ocl::init()");\r
-#endif\r
-\r
-                               }\r
-\r
-               }\r
-\r
-               void init(){\r
-\r
-                       if(!initialized){\r
-                               cv::ocl::util::createContext(&ocl_context, &ocl_cmd_queue, false);\r
-                               initialized = true;\r
-                       }\r
-               }\r
-\r
-               void OclMat::create(int _rows, int _cols, int _type){\r
-    \r
-                       if(!initialized)\r
-                               init();\r
-\r
-                       _type &= TYPE_MASK;\r
-    \r
-                       if( rows == _rows && cols == _cols && type() == _type && data )\r
-                               return;\r
-                       if( data )\r
-                               release();\r
-   \r
-                       if( _rows > 0 && _cols > 0 ){\r
-                               flags = Mat::MAGIC_VAL + _type;\r
-                               rows = _rows;\r
-                               cols = _cols;\r
-\r
-       size_t esz = elemSize();\r
-          int ch = channels();\r
-\r
-          step = esz*cols*ch;\r
-\r
-          size_t size = esz*rows*cols*ch;\r
-          data = clCreateBuffer(ocl_context, CL_MEM_READ_WRITE, size, NULL, NULL);\r
-\r
-          if (esz * cols == step)\r
-            flags |= Mat::CONTINUOUS_FLAG;\r
-\r
-        /*\r
-        refcount = (int*)fastMalloc(sizeof(*refcount));\r
-        *refcount = 1;\r
-               */\r
-                       }\r
-               }\r
-\r
-               void OclMat::create(Size size, int _type){\r
-               \r
-                       return create(size.height, size.width, _type);\r
-               }\r
-\r
-               inline OclMat::operator Mat()\r
-               {\r
-                       Mat m;\r
-                       download(m);\r
-                   return m;\r
-               }\r
-\r
-               inline OclMat& OclMat::operator = (const OclMat& m)\r
-               {\r
-                       if( this != &m )\r
-                       {\r
-                               if( m.refcount )\r
-                               CV_XADD(m.refcount, 1);\r
-                               release();\r
-                               flags = m.flags;\r
-                               rows = m.rows; cols = m.cols;\r
-                               step = m.step; data = m.data;\r
-                               data = m.data;\r
-                               refcount = m.refcount;\r
-                       }\r
-                       return *this;\r
-               }\r
-\r
-               inline OclMat::OclMat(int _rows, int _cols, int _type, const Scalar& _s)\r
-               : flags(0), rows(0), cols(0), step(0), data(0), refcount(0)\r
-               {\r
-                       if(_rows > 0 && _cols > 0)\r
-                       {\r
-                               create(_rows, _cols, _type);\r
-                               *this = _s;\r
-                       }\r
-               }\r
-\r
-               inline OclMat& OclMat::operator = (const Mat& m) { upload(m); return *this; }\r
-\r
-               OclMat& OclMat::operator = (const Scalar& s)\r
-               {\r
-                       setTo(s);\r
-                       return *this;\r
-               }\r
-\r
-               OclMat& OclMat::setTo(const Scalar& s){\r
-\r
-                       //if (s[0] == 0.0 && s[1] == 0.0 && s[2] == 0.0 && s[3] == 0.0)\r
-                       //{\r
-                       \r
-                               size_t sz = rows*cols*channels()*elemSize();\r
-                               //void* ptr = (void*)malloc(sz);\r
-                               //memset(ptr, s[0], sz);\r
-                               //clEnqueueWriteBuffer(ocl_cmd_queue, data, CL_TRUE, 0, sz, ptr, NULL, NULL, NULL);\r
-                               //free(ptr); ptr = 0;\r
-                               return *this;\r
-                       //}\r
-               }\r
-\r
-               inline size_t OclMat::elemSize() const{ return CV_ELEM_SIZE(flags); }\r
-               inline size_t OclMat::elemSize1() const{ return CV_ELEM_SIZE1(flags); }\r
-               inline int OclMat::type() const { return CV_MAT_TYPE(flags); }\r
-               inline int OclMat::depth() const{ return CV_MAT_DEPTH(flags); }\r
-               inline int OclMat::channels() const{ return CV_MAT_CN(flags); }\r
-               inline size_t OclMat::step1() const{ return step/elemSize1(); }\r
-               inline Size OclMat::size() const{ return Size(cols, rows); }\r
-               inline bool OclMat::empty() const{ return data == 0; }\r
-       }\r
-}\r
-\r
-       
\ No newline at end of file
diff --git a/modules/ocl/src/gpu/precomp.cpp b/modules/ocl/src/gpu/precomp.cpp
deleted file mode 100644 (file)
index 2bf93e6..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*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
-//                        Intel License Agreement\r
-//                For Open Source Computer Vision Library\r
-//\r
-// Copyright (C) 2000, Intel Corporation, 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 materials provided with the distribution.\r
-//\r
-//   * The name of Intel Corporation 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
-#include "precomp.hpp"\r
-\r
-/* End of file. */
\ No newline at end of file
diff --git a/modules/ocl/src/gpu/precomp.hpp b/modules/ocl/src/gpu/precomp.hpp
deleted file mode 100644 (file)
index 6b1a562..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*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 materials 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 PRECOMP_H__\r
-#define PRECOMP_H__\r
-\r
-#define OCL_EXPORTS __declspec(dllexport)\r
-\r
-#include <exception>\r
-\r
-#include "opencv/highgui.h"\r
-#include "opencv/cv.h"\r
-#include <CL/cl.h> //General OpenCL include file. Current version is written for Intel architecture using Intel's OpenCL SDK\r
-#include "ocl.hpp"\r
-#include "oclmat.hpp"\r
-#include "ocldefs.h"\r
-#include "ocl_util.h"\r
-\r
-#ifdef _DEBUG\r
-       #include <stdio.h>\r
-#endif\r
-\r
-#endif
\ No newline at end of file