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