]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/compute/include/boost/compute/interop/opencv/ocl.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / compute / include / boost / compute / interop / opencv / ocl.hpp
CommitLineData
7c673cae
FG
1//---------------------------------------------------------------------------//
2// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
3//
4// Distributed under the Boost Software License, Version 1.0
5// See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt
7//
8// See http://boostorg.github.com/compute for more information.
9//---------------------------------------------------------------------------//
10
11#ifndef BOOST_COMPUTE_INTEROP_OPENCV_OCL_HPP
12#define BOOST_COMPUTE_INTEROP_OPENCV_OCL_HPP
13
14#include <opencv2/ocl/ocl.hpp>
15
16#include <boost/compute/buffer.hpp>
17#include <boost/compute/context.hpp>
18#include <boost/compute/command_queue.hpp>
19
20namespace boost {
21namespace compute {
22
23context opencv_ocl_get_context()
24{
25 void *ocl_context = cv::ocl::getoclContext();
26 if(!ocl_context){
27 return context();
28 }
29
30 return context(*(static_cast<cl_context *>(ocl_context)));
31}
32
33command_queue opencv_ocl_get_command_queue()
34{
35 void *ocl_queue = cv::ocl::getoclCommandQueue();
36 if(!ocl_queue){
37 return command_queue();
38 }
39
40 return command_queue(*(static_cast<cl_command_queue *>(ocl_queue)));
41}
42
43buffer opencv_ocl_get_buffer(const cv::ocl::oclMat &mat)
44{
45 return buffer(reinterpret_cast<cl_mem>(mat.data));
46}
47
48} // end compute namespace
49} // end boost namespace
50
51#endif // BOOST_COMPUTE_INTEROP_OPENCV_OCL_HPP