Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:01

0001 //---------------------------------------------------------------------------//
0002 // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
0003 //
0004 // Distributed under the Boost Software License, Version 1.0
0005 // See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt
0007 //
0008 // See http://boostorg.github.com/compute for more information.
0009 //---------------------------------------------------------------------------//
0010 
0011 #ifndef BOOST_COMPUTE_INTEROP_OPENCV_OCL_HPP
0012 #define BOOST_COMPUTE_INTEROP_OPENCV_OCL_HPP
0013 
0014 #include <opencv2/ocl/ocl.hpp>
0015 
0016 #include <boost/compute/buffer.hpp>
0017 #include <boost/compute/context.hpp>
0018 #include <boost/compute/command_queue.hpp>
0019 
0020 namespace boost {
0021 namespace compute {
0022 
0023 context opencv_ocl_get_context()
0024 {
0025     void *ocl_context = cv::ocl::getoclContext();
0026     if(!ocl_context){
0027         return context();
0028     }
0029 
0030     return context(*(static_cast<cl_context *>(ocl_context)));
0031 }
0032 
0033 command_queue opencv_ocl_get_command_queue()
0034 {
0035     void *ocl_queue = cv::ocl::getoclCommandQueue();
0036     if(!ocl_queue){
0037         return command_queue();
0038     }
0039 
0040     return command_queue(*(static_cast<cl_command_queue *>(ocl_queue)));
0041 }
0042 
0043 buffer opencv_ocl_get_buffer(const cv::ocl::oclMat &mat)
0044 {
0045     return buffer(reinterpret_cast<cl_mem>(mat.data));
0046 }
0047 
0048 } // end compute namespace
0049 } // end boost namespace
0050 
0051 #endif // BOOST_COMPUTE_INTEROP_OPENCV_OCL_HPP