From b4084491e5c4be6785f75b35c69abc804e356da5 Mon Sep 17 00:00:00 2001 From: Joe Howse Date: Thu, 10 Jun 2021 23:56:55 -0300 Subject: [PATCH] DirectX: Support more types, including float16 Support the following type conversions: * CV_16FC4 --> DXGI_FORMAT_R16G16B16A16_FLOAT * CV_16FC2 --> DXGI_FORMAT_R16G16_FLOAT * CV_16FC1 --> DXGI_FORMAT_R16_FLOAT * CV_32FC2 --> DXGI_FORMAT_R32G32_FLOAT * CV_32FC1 --> DXGI_FORMAT_D32_FLOAT * CV_32SC2 --> DXGI_FORMAT_R32G32_UINT * CV_32SC2 --> DXGI_FORMAT_R32G32_SINT * CV_8UC4 --> DXGI_FORMAT_R8G8_B8G8_UNORM * CV_8UC4 --> DXGI_FORMAT_G8R8_G8B8_UNORM --- modules/core/src/directx.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/core/src/directx.cpp b/modules/core/src/directx.cpp index d17adc6b48..2dbc3e2763 100644 --- a/modules/core/src/directx.cpp +++ b/modules/core/src/directx.cpp @@ -80,15 +80,15 @@ int getTypeFromDXGI_FORMAT(const int iDXGI_FORMAT) case DXGI_FORMAT_R32G32B32_UINT: case DXGI_FORMAT_R32G32B32_SINT: return CV_32SC3; //case DXGI_FORMAT_R16G16B16A16_TYPELESS: - //case DXGI_FORMAT_R16G16B16A16_FLOAT: + case DXGI_FORMAT_R16G16B16A16_FLOAT: return CV_16FC4; case DXGI_FORMAT_R16G16B16A16_UNORM: case DXGI_FORMAT_R16G16B16A16_UINT: return CV_16UC4; case DXGI_FORMAT_R16G16B16A16_SNORM: case DXGI_FORMAT_R16G16B16A16_SINT: return CV_16SC4; //case DXGI_FORMAT_R32G32_TYPELESS: - //case DXGI_FORMAT_R32G32_FLOAT: - //case DXGI_FORMAT_R32G32_UINT: - //case DXGI_FORMAT_R32G32_SINT: + case DXGI_FORMAT_R32G32_FLOAT: return CV_32FC2; + case DXGI_FORMAT_R32G32_UINT: + case DXGI_FORMAT_R32G32_SINT: return CV_32SC2; //case DXGI_FORMAT_R32G8X24_TYPELESS: //case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: //case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: @@ -104,13 +104,13 @@ int getTypeFromDXGI_FORMAT(const int iDXGI_FORMAT) case DXGI_FORMAT_R8G8B8A8_SNORM: case DXGI_FORMAT_R8G8B8A8_SINT: return CV_8SC4; //case DXGI_FORMAT_R16G16_TYPELESS: - //case DXGI_FORMAT_R16G16_FLOAT: + case DXGI_FORMAT_R16G16_FLOAT: return CV_16FC2; case DXGI_FORMAT_R16G16_UNORM: case DXGI_FORMAT_R16G16_UINT: return CV_16UC2; case DXGI_FORMAT_R16G16_SNORM: case DXGI_FORMAT_R16G16_SINT: return CV_16SC2; //case DXGI_FORMAT_R32_TYPELESS: - //case DXGI_FORMAT_D32_FLOAT: + case DXGI_FORMAT_D32_FLOAT: case DXGI_FORMAT_R32_FLOAT: return CV_32FC1; case DXGI_FORMAT_R32_UINT: case DXGI_FORMAT_R32_SINT: return CV_32SC1; @@ -124,7 +124,7 @@ int getTypeFromDXGI_FORMAT(const int iDXGI_FORMAT) case DXGI_FORMAT_R8G8_SNORM: case DXGI_FORMAT_R8G8_SINT: return CV_8SC2; //case DXGI_FORMAT_R16_TYPELESS: - //case DXGI_FORMAT_R16_FLOAT: + case DXGI_FORMAT_R16_FLOAT: return CV_16FC1; case DXGI_FORMAT_D16_UNORM: case DXGI_FORMAT_R16_UNORM: case DXGI_FORMAT_R16_UINT: return CV_16UC1; @@ -138,8 +138,8 @@ int getTypeFromDXGI_FORMAT(const int iDXGI_FORMAT) case DXGI_FORMAT_A8_UNORM: return CV_8UC1; //case DXGI_FORMAT_R1_UNORM: //case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: - //case DXGI_FORMAT_R8G8_B8G8_UNORM: - //case DXGI_FORMAT_G8R8_G8B8_UNORM: + case DXGI_FORMAT_R8G8_B8G8_UNORM: + case DXGI_FORMAT_G8R8_G8B8_UNORM: return CV_8UC4; //case DXGI_FORMAT_BC1_TYPELESS: //case DXGI_FORMAT_BC1_UNORM: //case DXGI_FORMAT_BC1_UNORM_SRGB: