openCV library for Renesas RZ/A

Dependents:   RZ_A2M_Mbed_samples

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?

UserRevisionLine numberNew contents of line
RyoheiHagimoto 0:0e0631af0305 1 /*M///////////////////////////////////////////////////////////////////////////////////////
RyoheiHagimoto 0:0e0631af0305 2 //
RyoheiHagimoto 0:0e0631af0305 3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
RyoheiHagimoto 0:0e0631af0305 4 //
RyoheiHagimoto 0:0e0631af0305 5 // By downloading, copying, installing or using the software you agree to this license.
RyoheiHagimoto 0:0e0631af0305 6 // If you do not agree to this license, do not download, install,
RyoheiHagimoto 0:0e0631af0305 7 // copy or use the software.
RyoheiHagimoto 0:0e0631af0305 8 //
RyoheiHagimoto 0:0e0631af0305 9 //
RyoheiHagimoto 0:0e0631af0305 10 // License Agreement
RyoheiHagimoto 0:0e0631af0305 11 // For Open Source Computer Vision Library
RyoheiHagimoto 0:0e0631af0305 12 //
RyoheiHagimoto 0:0e0631af0305 13 // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
RyoheiHagimoto 0:0e0631af0305 14 // Third party copyrights are property of their respective owners.
RyoheiHagimoto 0:0e0631af0305 15 //
RyoheiHagimoto 0:0e0631af0305 16 // Redistribution and use in source and binary forms, with or without modification,
RyoheiHagimoto 0:0e0631af0305 17 // are permitted provided that the following conditions are met:
RyoheiHagimoto 0:0e0631af0305 18 //
RyoheiHagimoto 0:0e0631af0305 19 // * Redistribution's of source code must retain the above copyright notice,
RyoheiHagimoto 0:0e0631af0305 20 // this list of conditions and the following disclaimer.
RyoheiHagimoto 0:0e0631af0305 21 //
RyoheiHagimoto 0:0e0631af0305 22 // * Redistribution's in binary form must reproduce the above copyright notice,
RyoheiHagimoto 0:0e0631af0305 23 // this list of conditions and the following disclaimer in the documentation
RyoheiHagimoto 0:0e0631af0305 24 // and/or other materials provided with the distribution.
RyoheiHagimoto 0:0e0631af0305 25 //
RyoheiHagimoto 0:0e0631af0305 26 // * The name of the copyright holders may not be used to endorse or promote products
RyoheiHagimoto 0:0e0631af0305 27 // derived from this software without specific prior written permission.
RyoheiHagimoto 0:0e0631af0305 28 //
RyoheiHagimoto 0:0e0631af0305 29 // This software is provided by the copyright holders and contributors as is and
RyoheiHagimoto 0:0e0631af0305 30 // any express or implied warranties, including, but not limited to, the implied
RyoheiHagimoto 0:0e0631af0305 31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
RyoheiHagimoto 0:0e0631af0305 32 // In no event shall the copyright holders or contributors be liable for any direct,
RyoheiHagimoto 0:0e0631af0305 33 // indirect, incidental, special, exemplary, or consequential damages
RyoheiHagimoto 0:0e0631af0305 34 // (including, but not limited to, procurement of substitute goods or services;
RyoheiHagimoto 0:0e0631af0305 35 // loss of use, data, or profits; or business interruption) however caused
RyoheiHagimoto 0:0e0631af0305 36 // and on any theory of liability, whether in contract, strict liability,
RyoheiHagimoto 0:0e0631af0305 37 // or tort (including negligence or otherwise) arising in any way out of
RyoheiHagimoto 0:0e0631af0305 38 // the use of this software, even if advised of the possibility of such damage.
RyoheiHagimoto 0:0e0631af0305 39 //
RyoheiHagimoto 0:0e0631af0305 40 //M*/
RyoheiHagimoto 0:0e0631af0305 41
RyoheiHagimoto 0:0e0631af0305 42 #ifndef OPENCV_CORE_DIRECTX_HPP
RyoheiHagimoto 0:0e0631af0305 43 #define OPENCV_CORE_DIRECTX_HPP
RyoheiHagimoto 0:0e0631af0305 44
RyoheiHagimoto 0:0e0631af0305 45 #include "mat.hpp"
RyoheiHagimoto 0:0e0631af0305 46 #include "ocl.hpp"
RyoheiHagimoto 0:0e0631af0305 47
RyoheiHagimoto 0:0e0631af0305 48 #if !defined(__d3d11_h__)
RyoheiHagimoto 0:0e0631af0305 49 struct ID3D11Device;
RyoheiHagimoto 0:0e0631af0305 50 struct ID3D11Texture2D;
RyoheiHagimoto 0:0e0631af0305 51 #endif
RyoheiHagimoto 0:0e0631af0305 52
RyoheiHagimoto 0:0e0631af0305 53 #if !defined(__d3d10_h__)
RyoheiHagimoto 0:0e0631af0305 54 struct ID3D10Device;
RyoheiHagimoto 0:0e0631af0305 55 struct ID3D10Texture2D;
RyoheiHagimoto 0:0e0631af0305 56 #endif
RyoheiHagimoto 0:0e0631af0305 57
RyoheiHagimoto 0:0e0631af0305 58 #if !defined(_D3D9_H_)
RyoheiHagimoto 0:0e0631af0305 59 struct IDirect3DDevice9;
RyoheiHagimoto 0:0e0631af0305 60 struct IDirect3DDevice9Ex;
RyoheiHagimoto 0:0e0631af0305 61 struct IDirect3DSurface9;
RyoheiHagimoto 0:0e0631af0305 62 #endif
RyoheiHagimoto 0:0e0631af0305 63
RyoheiHagimoto 0:0e0631af0305 64
RyoheiHagimoto 0:0e0631af0305 65 namespace cv { namespace directx {
RyoheiHagimoto 0:0e0631af0305 66
RyoheiHagimoto 0:0e0631af0305 67 namespace ocl {
RyoheiHagimoto 0:0e0631af0305 68 using namespace cv::ocl;
RyoheiHagimoto 0:0e0631af0305 69
RyoheiHagimoto 0:0e0631af0305 70 //! @addtogroup core_directx
RyoheiHagimoto 0:0e0631af0305 71 // This section describes OpenCL and DirectX interoperability.
RyoheiHagimoto 0:0e0631af0305 72 //
RyoheiHagimoto 0:0e0631af0305 73 // To enable DirectX support, configure OpenCV using CMake with WITH_DIRECTX=ON . Note, DirectX is
RyoheiHagimoto 0:0e0631af0305 74 // supported only on Windows.
RyoheiHagimoto 0:0e0631af0305 75 //
RyoheiHagimoto 0:0e0631af0305 76 // To use OpenCL functionality you should first initialize OpenCL context from DirectX resource.
RyoheiHagimoto 0:0e0631af0305 77 //
RyoheiHagimoto 0:0e0631af0305 78 //! @{
RyoheiHagimoto 0:0e0631af0305 79
RyoheiHagimoto 0:0e0631af0305 80 // TODO static functions in the Context class
RyoheiHagimoto 0:0e0631af0305 81 //! @brief Creates OpenCL context from D3D11 device
RyoheiHagimoto 0:0e0631af0305 82 //
RyoheiHagimoto 0:0e0631af0305 83 //! @param pD3D11Device - pointer to D3D11 device
RyoheiHagimoto 0:0e0631af0305 84 //! @return Returns reference to OpenCL Context
RyoheiHagimoto 0:0e0631af0305 85 CV_EXPORTS Context& initializeContextFromD3D11Device(ID3D11Device* pD3D11Device);
RyoheiHagimoto 0:0e0631af0305 86
RyoheiHagimoto 0:0e0631af0305 87 //! @brief Creates OpenCL context from D3D10 device
RyoheiHagimoto 0:0e0631af0305 88 //
RyoheiHagimoto 0:0e0631af0305 89 //! @param pD3D10Device - pointer to D3D10 device
RyoheiHagimoto 0:0e0631af0305 90 //! @return Returns reference to OpenCL Context
RyoheiHagimoto 0:0e0631af0305 91 CV_EXPORTS Context& initializeContextFromD3D10Device(ID3D10Device* pD3D10Device);
RyoheiHagimoto 0:0e0631af0305 92
RyoheiHagimoto 0:0e0631af0305 93 //! @brief Creates OpenCL context from Direct3DDevice9Ex device
RyoheiHagimoto 0:0e0631af0305 94 //
RyoheiHagimoto 0:0e0631af0305 95 //! @param pDirect3DDevice9Ex - pointer to Direct3DDevice9Ex device
RyoheiHagimoto 0:0e0631af0305 96 //! @return Returns reference to OpenCL Context
RyoheiHagimoto 0:0e0631af0305 97 CV_EXPORTS Context& initializeContextFromDirect3DDevice9Ex(IDirect3DDevice9Ex* pDirect3DDevice9Ex);
RyoheiHagimoto 0:0e0631af0305 98
RyoheiHagimoto 0:0e0631af0305 99 //! @brief Creates OpenCL context from Direct3DDevice9 device
RyoheiHagimoto 0:0e0631af0305 100 //
RyoheiHagimoto 0:0e0631af0305 101 //! @param pDirect3DDevice9 - pointer to Direct3Device9 device
RyoheiHagimoto 0:0e0631af0305 102 //! @return Returns reference to OpenCL Context
RyoheiHagimoto 0:0e0631af0305 103 CV_EXPORTS Context& initializeContextFromDirect3DDevice9(IDirect3DDevice9* pDirect3DDevice9);
RyoheiHagimoto 0:0e0631af0305 104
RyoheiHagimoto 0:0e0631af0305 105 //! @}
RyoheiHagimoto 0:0e0631af0305 106
RyoheiHagimoto 0:0e0631af0305 107 } // namespace cv::directx::ocl
RyoheiHagimoto 0:0e0631af0305 108
RyoheiHagimoto 0:0e0631af0305 109 //! @addtogroup core_directx
RyoheiHagimoto 0:0e0631af0305 110 //! @{
RyoheiHagimoto 0:0e0631af0305 111
RyoheiHagimoto 0:0e0631af0305 112 //! @brief Converts InputArray to ID3D11Texture2D. If destination texture format is DXGI_FORMAT_NV12 then
RyoheiHagimoto 0:0e0631af0305 113 //! input UMat expected to be in BGR format and data will be downsampled and color-converted to NV12.
RyoheiHagimoto 0:0e0631af0305 114 //
RyoheiHagimoto 0:0e0631af0305 115 //! @note Note: Destination texture must be allocated by application. Function does memory copy from src to
RyoheiHagimoto 0:0e0631af0305 116 //! pD3D11Texture2D
RyoheiHagimoto 0:0e0631af0305 117 //
RyoheiHagimoto 0:0e0631af0305 118 //! @param src - source InputArray
RyoheiHagimoto 0:0e0631af0305 119 //! @param pD3D11Texture2D - destination D3D11 texture
RyoheiHagimoto 0:0e0631af0305 120 CV_EXPORTS void convertToD3D11Texture2D(InputArray src, ID3D11Texture2D* pD3D11Texture2D);
RyoheiHagimoto 0:0e0631af0305 121
RyoheiHagimoto 0:0e0631af0305 122 //! @brief Converts ID3D11Texture2D to OutputArray. If input texture format is DXGI_FORMAT_NV12 then
RyoheiHagimoto 0:0e0631af0305 123 //! data will be upsampled and color-converted to BGR format.
RyoheiHagimoto 0:0e0631af0305 124 //
RyoheiHagimoto 0:0e0631af0305 125 //! @note Note: Destination matrix will be re-allocated if it has not enough memory to match texture size.
RyoheiHagimoto 0:0e0631af0305 126 //! function does memory copy from pD3D11Texture2D to dst
RyoheiHagimoto 0:0e0631af0305 127 //
RyoheiHagimoto 0:0e0631af0305 128 //! @param pD3D11Texture2D - source D3D11 texture
RyoheiHagimoto 0:0e0631af0305 129 //! @param dst - destination OutputArray
RyoheiHagimoto 0:0e0631af0305 130 CV_EXPORTS void convertFromD3D11Texture2D(ID3D11Texture2D* pD3D11Texture2D, OutputArray dst);
RyoheiHagimoto 0:0e0631af0305 131
RyoheiHagimoto 0:0e0631af0305 132 //! @brief Converts InputArray to ID3D10Texture2D
RyoheiHagimoto 0:0e0631af0305 133 //
RyoheiHagimoto 0:0e0631af0305 134 //! @note Note: function does memory copy from src to
RyoheiHagimoto 0:0e0631af0305 135 //! pD3D10Texture2D
RyoheiHagimoto 0:0e0631af0305 136 //
RyoheiHagimoto 0:0e0631af0305 137 //! @param src - source InputArray
RyoheiHagimoto 0:0e0631af0305 138 //! @param pD3D10Texture2D - destination D3D10 texture
RyoheiHagimoto 0:0e0631af0305 139 CV_EXPORTS void convertToD3D10Texture2D(InputArray src, ID3D10Texture2D* pD3D10Texture2D);
RyoheiHagimoto 0:0e0631af0305 140
RyoheiHagimoto 0:0e0631af0305 141 //! @brief Converts ID3D10Texture2D to OutputArray
RyoheiHagimoto 0:0e0631af0305 142 //
RyoheiHagimoto 0:0e0631af0305 143 //! @note Note: function does memory copy from pD3D10Texture2D
RyoheiHagimoto 0:0e0631af0305 144 //! to dst
RyoheiHagimoto 0:0e0631af0305 145 //
RyoheiHagimoto 0:0e0631af0305 146 //! @param pD3D10Texture2D - source D3D10 texture
RyoheiHagimoto 0:0e0631af0305 147 //! @param dst - destination OutputArray
RyoheiHagimoto 0:0e0631af0305 148 CV_EXPORTS void convertFromD3D10Texture2D(ID3D10Texture2D* pD3D10Texture2D, OutputArray dst);
RyoheiHagimoto 0:0e0631af0305 149
RyoheiHagimoto 0:0e0631af0305 150 //! @brief Converts InputArray to IDirect3DSurface9
RyoheiHagimoto 0:0e0631af0305 151 //
RyoheiHagimoto 0:0e0631af0305 152 //! @note Note: function does memory copy from src to
RyoheiHagimoto 0:0e0631af0305 153 //! pDirect3DSurface9
RyoheiHagimoto 0:0e0631af0305 154 //
RyoheiHagimoto 0:0e0631af0305 155 //! @param src - source InputArray
RyoheiHagimoto 0:0e0631af0305 156 //! @param pDirect3DSurface9 - destination D3D10 texture
RyoheiHagimoto 0:0e0631af0305 157 //! @param surfaceSharedHandle - shared handle
RyoheiHagimoto 0:0e0631af0305 158 CV_EXPORTS void convertToDirect3DSurface9(InputArray src, IDirect3DSurface9* pDirect3DSurface9, void* surfaceSharedHandle = NULL);
RyoheiHagimoto 0:0e0631af0305 159
RyoheiHagimoto 0:0e0631af0305 160 //! @brief Converts IDirect3DSurface9 to OutputArray
RyoheiHagimoto 0:0e0631af0305 161 //
RyoheiHagimoto 0:0e0631af0305 162 //! @note Note: function does memory copy from pDirect3DSurface9
RyoheiHagimoto 0:0e0631af0305 163 //! to dst
RyoheiHagimoto 0:0e0631af0305 164 //
RyoheiHagimoto 0:0e0631af0305 165 //! @param pDirect3DSurface9 - source D3D10 texture
RyoheiHagimoto 0:0e0631af0305 166 //! @param dst - destination OutputArray
RyoheiHagimoto 0:0e0631af0305 167 //! @param surfaceSharedHandle - shared handle
RyoheiHagimoto 0:0e0631af0305 168 CV_EXPORTS void convertFromDirect3DSurface9(IDirect3DSurface9* pDirect3DSurface9, OutputArray dst, void* surfaceSharedHandle = NULL);
RyoheiHagimoto 0:0e0631af0305 169
RyoheiHagimoto 0:0e0631af0305 170 //! @brief Get OpenCV type from DirectX type
RyoheiHagimoto 0:0e0631af0305 171 //! @param iDXGI_FORMAT - enum DXGI_FORMAT for D3D10/D3D11
RyoheiHagimoto 0:0e0631af0305 172 //! @return OpenCV type or -1 if there is no equivalent
RyoheiHagimoto 0:0e0631af0305 173 CV_EXPORTS int getTypeFromDXGI_FORMAT(const int iDXGI_FORMAT); // enum DXGI_FORMAT for D3D10/D3D11
RyoheiHagimoto 0:0e0631af0305 174
RyoheiHagimoto 0:0e0631af0305 175 //! @brief Get OpenCV type from DirectX type
RyoheiHagimoto 0:0e0631af0305 176 //! @param iD3DFORMAT - enum D3DTYPE for D3D9
RyoheiHagimoto 0:0e0631af0305 177 //! @return OpenCV type or -1 if there is no equivalent
RyoheiHagimoto 0:0e0631af0305 178 CV_EXPORTS int getTypeFromD3DFORMAT(const int iD3DFORMAT); // enum D3DTYPE for D3D9
RyoheiHagimoto 0:0e0631af0305 179
RyoheiHagimoto 0:0e0631af0305 180 //! @}
RyoheiHagimoto 0:0e0631af0305 181
RyoheiHagimoto 0:0e0631af0305 182 } } // namespace cv::directx
RyoheiHagimoto 0:0e0631af0305 183
RyoheiHagimoto 0:0e0631af0305 184 #endif // OPENCV_CORE_DIRECTX_HPP