va_intel.hpp 2.7 KB

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