Joe Verbout
/
main
opencv on mbed
opencv2/core/va_intel.hpp@0:ea44dc9ed014, 2016-03-31 (annotated)
- Committer:
- joeverbout
- Date:
- Thu Mar 31 21:16:38 2016 +0000
- Revision:
- 0:ea44dc9ed014
OpenCV on mbed attempt
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joeverbout | 0:ea44dc9ed014 | 1 | // This file is part of OpenCV project. |
joeverbout | 0:ea44dc9ed014 | 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory |
joeverbout | 0:ea44dc9ed014 | 3 | // of this distribution and at http://opencv.org/license.html. |
joeverbout | 0:ea44dc9ed014 | 4 | |
joeverbout | 0:ea44dc9ed014 | 5 | // Copyright (C) 2015, Itseez, Inc., all rights reserved. |
joeverbout | 0:ea44dc9ed014 | 6 | // Third party copyrights are property of their respective owners. |
joeverbout | 0:ea44dc9ed014 | 7 | |
joeverbout | 0:ea44dc9ed014 | 8 | #ifndef __OPENCV_CORE_VA_INTEL_HPP__ |
joeverbout | 0:ea44dc9ed014 | 9 | #define __OPENCV_CORE_VA_INTEL_HPP__ |
joeverbout | 0:ea44dc9ed014 | 10 | |
joeverbout | 0:ea44dc9ed014 | 11 | #ifndef __cplusplus |
joeverbout | 0:ea44dc9ed014 | 12 | # error va_intel.hpp header must be compiled as C++ |
joeverbout | 0:ea44dc9ed014 | 13 | #endif |
joeverbout | 0:ea44dc9ed014 | 14 | |
joeverbout | 0:ea44dc9ed014 | 15 | #include "opencv2/core.hpp" |
joeverbout | 0:ea44dc9ed014 | 16 | #include "ocl.hpp" |
joeverbout | 0:ea44dc9ed014 | 17 | |
joeverbout | 0:ea44dc9ed014 | 18 | #if defined(HAVE_VA) |
joeverbout | 0:ea44dc9ed014 | 19 | # include "va/va.h" |
joeverbout | 0:ea44dc9ed014 | 20 | #else // HAVE_VA |
joeverbout | 0:ea44dc9ed014 | 21 | # if !defined(_VA_H_) |
joeverbout | 0:ea44dc9ed014 | 22 | typedef void* VADisplay; |
joeverbout | 0:ea44dc9ed014 | 23 | typedef unsigned int VASurfaceID; |
joeverbout | 0:ea44dc9ed014 | 24 | # endif // !_VA_H_ |
joeverbout | 0:ea44dc9ed014 | 25 | #endif // HAVE_VA |
joeverbout | 0:ea44dc9ed014 | 26 | |
joeverbout | 0:ea44dc9ed014 | 27 | namespace cv { namespace va_intel { |
joeverbout | 0:ea44dc9ed014 | 28 | |
joeverbout | 0:ea44dc9ed014 | 29 | /** @addtogroup core_va_intel |
joeverbout | 0:ea44dc9ed014 | 30 | This section describes Intel VA-API/OpenCL (CL-VA) interoperability. |
joeverbout | 0:ea44dc9ed014 | 31 | |
joeverbout | 0:ea44dc9ed014 | 32 | To enable CL-VA interoperability support, configure OpenCV using CMake with WITH_VA_INTEL=ON . Currently VA-API is |
joeverbout | 0:ea44dc9ed014 | 33 | supported on Linux only. You should also install Intel Media Server Studio (MSS) to use this feature. You may |
joeverbout | 0:ea44dc9ed014 | 34 | have to specify the path(s) to MSS components for cmake in environment variables: VA_INTEL_MSDK_ROOT for Media SDK |
joeverbout | 0:ea44dc9ed014 | 35 | (default is "/opt/intel/mediasdk"), and VA_INTEL_IOCL_ROOT for Intel OpenCL (default is "/opt/intel/opencl"). |
joeverbout | 0:ea44dc9ed014 | 36 | |
joeverbout | 0:ea44dc9ed014 | 37 | To use CL-VA interoperability you should first create VADisplay (libva), and then call initializeContextFromVA() |
joeverbout | 0:ea44dc9ed014 | 38 | function to create OpenCL context and set up interoperability. |
joeverbout | 0:ea44dc9ed014 | 39 | */ |
joeverbout | 0:ea44dc9ed014 | 40 | //! @{ |
joeverbout | 0:ea44dc9ed014 | 41 | |
joeverbout | 0:ea44dc9ed014 | 42 | /////////////////// CL-VA Interoperability Functions /////////////////// |
joeverbout | 0:ea44dc9ed014 | 43 | |
joeverbout | 0:ea44dc9ed014 | 44 | namespace ocl { |
joeverbout | 0:ea44dc9ed014 | 45 | using namespace cv::ocl; |
joeverbout | 0:ea44dc9ed014 | 46 | |
joeverbout | 0:ea44dc9ed014 | 47 | // TODO static functions in the Context class |
joeverbout | 0:ea44dc9ed014 | 48 | /** @brief Creates OpenCL context from VA. |
joeverbout | 0:ea44dc9ed014 | 49 | @param display - VADisplay for which CL interop should be established. |
joeverbout | 0:ea44dc9ed014 | 50 | @param tryInterop - try to set up for interoperability, if true; set up for use slow copy if false. |
joeverbout | 0:ea44dc9ed014 | 51 | @return Returns reference to OpenCL Context |
joeverbout | 0:ea44dc9ed014 | 52 | */ |
joeverbout | 0:ea44dc9ed014 | 53 | CV_EXPORTS Context& initializeContextFromVA(VADisplay display, bool tryInterop = true); |
joeverbout | 0:ea44dc9ed014 | 54 | |
joeverbout | 0:ea44dc9ed014 | 55 | } // namespace cv::va_intel::ocl |
joeverbout | 0:ea44dc9ed014 | 56 | |
joeverbout | 0:ea44dc9ed014 | 57 | /** @brief Converts InputArray to VASurfaceID object. |
joeverbout | 0:ea44dc9ed014 | 58 | @param display - VADisplay object. |
joeverbout | 0:ea44dc9ed014 | 59 | @param src - source InputArray. |
joeverbout | 0:ea44dc9ed014 | 60 | @param surface - destination VASurfaceID object. |
joeverbout | 0:ea44dc9ed014 | 61 | @param size - size of image represented by VASurfaceID object. |
joeverbout | 0:ea44dc9ed014 | 62 | */ |
joeverbout | 0:ea44dc9ed014 | 63 | CV_EXPORTS void convertToVASurface(VADisplay display, InputArray src, VASurfaceID surface, Size size); |
joeverbout | 0:ea44dc9ed014 | 64 | |
joeverbout | 0:ea44dc9ed014 | 65 | /** @brief Converts VASurfaceID object to OutputArray. |
joeverbout | 0:ea44dc9ed014 | 66 | @param display - VADisplay object. |
joeverbout | 0:ea44dc9ed014 | 67 | @param surface - source VASurfaceID object. |
joeverbout | 0:ea44dc9ed014 | 68 | @param size - size of image represented by VASurfaceID object. |
joeverbout | 0:ea44dc9ed014 | 69 | @param dst - destination OutputArray. |
joeverbout | 0:ea44dc9ed014 | 70 | */ |
joeverbout | 0:ea44dc9ed014 | 71 | CV_EXPORTS void convertFromVASurface(VADisplay display, VASurfaceID surface, Size size, OutputArray dst); |
joeverbout | 0:ea44dc9ed014 | 72 | |
joeverbout | 0:ea44dc9ed014 | 73 | //! @} |
joeverbout | 0:ea44dc9ed014 | 74 | |
joeverbout | 0:ea44dc9ed014 | 75 | }} // namespace cv::va_intel |
joeverbout | 0:ea44dc9ed014 | 76 | |
joeverbout | 0:ea44dc9ed014 | 77 | #endif /* __OPENCV_CORE_VA_INTEL_HPP__ */ |
joeverbout | 0:ea44dc9ed014 | 78 |