Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: RZ_A2M_Mbed_samples
directx.hpp
00001 /*M/////////////////////////////////////////////////////////////////////////////////////// 00002 // 00003 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 00004 // 00005 // By downloading, copying, installing or using the software you agree to this license. 00006 // If you do not agree to this license, do not download, install, 00007 // copy or use the software. 00008 // 00009 // 00010 // License Agreement 00011 // For Open Source Computer Vision Library 00012 // 00013 // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 00014 // Third party copyrights are property of their respective owners. 00015 // 00016 // Redistribution and use in source and binary forms, with or without modification, 00017 // are permitted provided that the following conditions are met: 00018 // 00019 // * Redistribution's of source code must retain the above copyright notice, 00020 // this list of conditions and the following disclaimer. 00021 // 00022 // * Redistribution's in binary form must reproduce the above copyright notice, 00023 // this list of conditions and the following disclaimer in the documentation 00024 // and/or other materials provided with the distribution. 00025 // 00026 // * The name of the copyright holders may not be used to endorse or promote products 00027 // derived from this software without specific prior written permission. 00028 // 00029 // This software is provided by the copyright holders and contributors as is and 00030 // any express or implied warranties, including, but not limited to, the implied 00031 // warranties of merchantability and fitness for a particular purpose are disclaimed. 00032 // In no event shall the copyright holders or contributors be liable for any direct, 00033 // indirect, incidental, special, exemplary, or consequential damages 00034 // (including, but not limited to, procurement of substitute goods or services; 00035 // loss of use, data, or profits; or business interruption) however caused 00036 // and on any theory of liability, whether in contract, strict liability, 00037 // or tort (including negligence or otherwise) arising in any way out of 00038 // the use of this software, even if advised of the possibility of such damage. 00039 // 00040 //M*/ 00041 00042 #ifndef OPENCV_CORE_DIRECTX_HPP 00043 #define OPENCV_CORE_DIRECTX_HPP 00044 00045 #include "mat.hpp" 00046 #include "ocl.hpp" 00047 00048 #if !defined(__d3d11_h__) 00049 struct ID3D11Device; 00050 struct ID3D11Texture2D; 00051 #endif 00052 00053 #if !defined(__d3d10_h__) 00054 struct ID3D10Device; 00055 struct ID3D10Texture2D; 00056 #endif 00057 00058 #if !defined(_D3D9_H_) 00059 struct IDirect3DDevice9; 00060 struct IDirect3DDevice9Ex; 00061 struct IDirect3DSurface9; 00062 #endif 00063 00064 00065 namespace cv { namespace directx { 00066 00067 namespace ocl { 00068 using namespace cv::ocl; 00069 00070 //! @addtogroup core_directx 00071 // This section describes OpenCL and DirectX interoperability. 00072 // 00073 // To enable DirectX support, configure OpenCV using CMake with WITH_DIRECTX=ON . Note, DirectX is 00074 // supported only on Windows. 00075 // 00076 // To use OpenCL functionality you should first initialize OpenCL context from DirectX resource. 00077 // 00078 //! @{ 00079 00080 // TODO static functions in the Context class 00081 //! @brief Creates OpenCL context from D3D11 device 00082 // 00083 //! @param pD3D11Device - pointer to D3D11 device 00084 //! @return Returns reference to OpenCL Context 00085 CV_EXPORTS Context& initializeContextFromD3D11Device(ID3D11Device* pD3D11Device); 00086 00087 //! @brief Creates OpenCL context from D3D10 device 00088 // 00089 //! @param pD3D10Device - pointer to D3D10 device 00090 //! @return Returns reference to OpenCL Context 00091 CV_EXPORTS Context& initializeContextFromD3D10Device(ID3D10Device* pD3D10Device); 00092 00093 //! @brief Creates OpenCL context from Direct3DDevice9Ex device 00094 // 00095 //! @param pDirect3DDevice9Ex - pointer to Direct3DDevice9Ex device 00096 //! @return Returns reference to OpenCL Context 00097 CV_EXPORTS Context& initializeContextFromDirect3DDevice9Ex(IDirect3DDevice9Ex* pDirect3DDevice9Ex); 00098 00099 //! @brief Creates OpenCL context from Direct3DDevice9 device 00100 // 00101 //! @param pDirect3DDevice9 - pointer to Direct3Device9 device 00102 //! @return Returns reference to OpenCL Context 00103 CV_EXPORTS Context& initializeContextFromDirect3DDevice9(IDirect3DDevice9* pDirect3DDevice9); 00104 00105 //! @} 00106 00107 } // namespace cv::directx::ocl 00108 00109 //! @addtogroup core_directx 00110 //! @{ 00111 00112 //! @brief Converts InputArray to ID3D11Texture2D. If destination texture format is DXGI_FORMAT_NV12 then 00113 //! input UMat expected to be in BGR format and data will be downsampled and color-converted to NV12. 00114 // 00115 //! @note Note: Destination texture must be allocated by application. Function does memory copy from src to 00116 //! pD3D11Texture2D 00117 // 00118 //! @param src - source InputArray 00119 //! @param pD3D11Texture2D - destination D3D11 texture 00120 CV_EXPORTS void convertToD3D11Texture2D(InputArray src, ID3D11Texture2D* pD3D11Texture2D); 00121 00122 //! @brief Converts ID3D11Texture2D to OutputArray. If input texture format is DXGI_FORMAT_NV12 then 00123 //! data will be upsampled and color-converted to BGR format. 00124 // 00125 //! @note Note: Destination matrix will be re-allocated if it has not enough memory to match texture size. 00126 //! function does memory copy from pD3D11Texture2D to dst 00127 // 00128 //! @param pD3D11Texture2D - source D3D11 texture 00129 //! @param dst - destination OutputArray 00130 CV_EXPORTS void convertFromD3D11Texture2D(ID3D11Texture2D* pD3D11Texture2D, OutputArray dst); 00131 00132 //! @brief Converts InputArray to ID3D10Texture2D 00133 // 00134 //! @note Note: function does memory copy from src to 00135 //! pD3D10Texture2D 00136 // 00137 //! @param src - source InputArray 00138 //! @param pD3D10Texture2D - destination D3D10 texture 00139 CV_EXPORTS void convertToD3D10Texture2D(InputArray src, ID3D10Texture2D* pD3D10Texture2D); 00140 00141 //! @brief Converts ID3D10Texture2D to OutputArray 00142 // 00143 //! @note Note: function does memory copy from pD3D10Texture2D 00144 //! to dst 00145 // 00146 //! @param pD3D10Texture2D - source D3D10 texture 00147 //! @param dst - destination OutputArray 00148 CV_EXPORTS void convertFromD3D10Texture2D(ID3D10Texture2D* pD3D10Texture2D, OutputArray dst); 00149 00150 //! @brief Converts InputArray to IDirect3DSurface9 00151 // 00152 //! @note Note: function does memory copy from src to 00153 //! pDirect3DSurface9 00154 // 00155 //! @param src - source InputArray 00156 //! @param pDirect3DSurface9 - destination D3D10 texture 00157 //! @param surfaceSharedHandle - shared handle 00158 CV_EXPORTS void convertToDirect3DSurface9(InputArray src, IDirect3DSurface9* pDirect3DSurface9, void* surfaceSharedHandle = NULL); 00159 00160 //! @brief Converts IDirect3DSurface9 to OutputArray 00161 // 00162 //! @note Note: function does memory copy from pDirect3DSurface9 00163 //! to dst 00164 // 00165 //! @param pDirect3DSurface9 - source D3D10 texture 00166 //! @param dst - destination OutputArray 00167 //! @param surfaceSharedHandle - shared handle 00168 CV_EXPORTS void convertFromDirect3DSurface9(IDirect3DSurface9* pDirect3DSurface9, OutputArray dst, void* surfaceSharedHandle = NULL); 00169 00170 //! @brief Get OpenCV type from DirectX type 00171 //! @param iDXGI_FORMAT - enum DXGI_FORMAT for D3D10/D3D11 00172 //! @return OpenCV type or -1 if there is no equivalent 00173 CV_EXPORTS int getTypeFromDXGI_FORMAT(const int iDXGI_FORMAT); // enum DXGI_FORMAT for D3D10/D3D11 00174 00175 //! @brief Get OpenCV type from DirectX type 00176 //! @param iD3DFORMAT - enum D3DTYPE for D3D9 00177 //! @return OpenCV type or -1 if there is no equivalent 00178 CV_EXPORTS int getTypeFromD3DFORMAT(const int iD3DFORMAT); // enum D3DTYPE for D3D9 00179 00180 //! @} 00181 00182 } } // namespace cv::directx 00183 00184 #endif // OPENCV_CORE_DIRECTX_HPP
Generated on Tue Jul 12 2022 18:20:17 by
1.7.2