Commit 971ae009 authored by Tatsuro Shibamura's avatar Tatsuro Shibamura Committed by Alexander Alekhin

Merge pull request #16027 from shibayan:arm64-windows10

* Support ARM64 Windows 10 platform

* Fixed detection issue for ARM64 Windows 10

* Try enabling ARM NEON intrin

* build: disable NEON with MSVC compiler

* samples(directx): gdi32 dependency
parent 21ee54c3
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
// GCC and Visual Studio SSE2 compiler flags // GCC and Visual Studio SSE2 compiler flags
#if defined __SSE2__ || (_MSC_VER >= 1300 && !_M_CEE_PURE) #if defined __SSE2__ || (defined(_M_X64) || _M_IX86_FP == 2)
#define IMF_HAVE_SSE2 1 #define IMF_HAVE_SSE2 1
#endif #endif
......
#include <stdio.h> #include <stdio.h>
#if defined _WIN32 && defined(_M_ARM) #if defined _WIN32 && (defined(_M_ARM) || defined(_M_ARM64))
# include <Intrin.h> # include <Intrin.h>
# include <arm_neon.h> # include <arm_neon.h>
# define CV_NEON 1 # define CV_NEON 1
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
# define CV_NEON 1 # define CV_NEON 1
#endif #endif
// MSVC 2019 bug. Details: https://github.com/opencv/opencv/pull/16027
void test_aliased_type(const uint8x16_t& a) { }
void test_aliased_type(const int8x16_t& a) { }
#if defined CV_NEON #if defined CV_NEON
int test() int test()
{ {
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
# define CV_AVX 1 # define CV_AVX 1
#endif #endif
#ifdef CV_CPU_COMPILE_FP16 #ifdef CV_CPU_COMPILE_FP16
# if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) # if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64)
# include <arm_neon.h> # include <arm_neon.h>
# else # else
# include <immintrin.h> # include <immintrin.h>
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
# define CV_FMA3 1 # define CV_FMA3 1
#endif #endif
#if defined _WIN32 && defined(_M_ARM) #if defined _WIN32 && (defined(_M_ARM) || defined(_M_ARM64)) && (defined(CV_CPU_COMPILE_NEON) || !defined(_MSC_VER))
# include <Intrin.h> # include <Intrin.h>
# include <arm_neon.h> # include <arm_neon.h>
# define CV_NEON 1 # define CV_NEON 1
...@@ -201,7 +201,7 @@ struct VZeroUpperGuard { ...@@ -201,7 +201,7 @@ struct VZeroUpperGuard {
# define CV_MMX 1 # define CV_MMX 1
# define CV_SSE 1 # define CV_SSE 1
# define CV_SSE2 1 # define CV_SSE2 1
#elif defined _WIN32 && defined(_M_ARM) #elif defined _WIN32 && (defined(_M_ARM) || defined(_M_ARM64)) && (defined(CV_CPU_COMPILE_NEON) || !defined(_MSC_VER))
# include <Intrin.h> # include <Intrin.h>
# include <arm_neon.h> # include <arm_neon.h>
# define CV_NEON 1 # define CV_NEON 1
......
...@@ -289,7 +289,7 @@ CV_INLINE int cvIsInf( double value ) ...@@ -289,7 +289,7 @@ CV_INLINE int cvIsInf( double value )
{ {
#if defined CV_INLINE_ISINF_DBL #if defined CV_INLINE_ISINF_DBL
CV_INLINE_ISINF_DBL(value); CV_INLINE_ISINF_DBL(value);
#elif defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(__PPC64__) #elif defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(_M_ARM64) || defined(__PPC64__)
Cv64suf ieee754; Cv64suf ieee754;
ieee754.f = value; ieee754.f = value;
return (ieee754.u & 0x7fffffff00000000) == return (ieee754.u & 0x7fffffff00000000) ==
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
namespace { namespace {
inline unsigned int trailingZeros32(unsigned int value) { inline unsigned int trailingZeros32(unsigned int value) {
#if defined(_MSC_VER) #if defined(_MSC_VER)
#if (_MSC_VER < 1700) || defined(_M_ARM) #if (_MSC_VER < 1700) || defined(_M_ARM) || defined(_M_ARM64)
unsigned long index = 0; unsigned long index = 0;
_BitScanForward(&index, value); _BitScanForward(&index, value);
return (unsigned int)index; return (unsigned int)index;
......
...@@ -56,7 +56,7 @@ namespace cv ...@@ -56,7 +56,7 @@ namespace cv
CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN
#define CV_SIMD128 1 #define CV_SIMD128 1
#if defined(__aarch64__) #if defined(__aarch64__) || defined(_M_ARM64)
#define CV_SIMD128_64F 1 #define CV_SIMD128_64F 1
#else #else
#define CV_SIMD128_64F 0 #define CV_SIMD128_64F 0
...@@ -1531,7 +1531,7 @@ inline v_int32x4 v_load_expand_q(const schar* ptr) ...@@ -1531,7 +1531,7 @@ inline v_int32x4 v_load_expand_q(const schar* ptr)
return v_int32x4(vmovl_s16(v1)); return v_int32x4(vmovl_s16(v1));
} }
#if defined(__aarch64__) #if defined(__aarch64__) || defined(_M_ARM64)
#define OPENCV_HAL_IMPL_NEON_UNPACKS(_Tpvec, suffix) \ #define OPENCV_HAL_IMPL_NEON_UNPACKS(_Tpvec, suffix) \
inline void v_zip(const v_##_Tpvec& a0, const v_##_Tpvec& a1, v_##_Tpvec& b0, v_##_Tpvec& b1) \ inline void v_zip(const v_##_Tpvec& a0, const v_##_Tpvec& a1, v_##_Tpvec& b0, v_##_Tpvec& b1) \
{ \ { \
......
...@@ -1537,7 +1537,7 @@ transform_8u( const uchar* src, uchar* dst, const float* m, int len, int scn, in ...@@ -1537,7 +1537,7 @@ transform_8u( const uchar* src, uchar* dst, const float* m, int len, int scn, in
static void static void
transform_16u( const ushort* src, ushort* dst, const float* m, int len, int scn, int dcn ) transform_16u( const ushort* src, ushort* dst, const float* m, int len, int scn, int dcn )
{ {
#if CV_SIMD && !defined(__aarch64__) #if CV_SIMD && !defined(__aarch64__) && !defined(_M_ARM64)
if( scn == 3 && dcn == 3 ) if( scn == 3 && dcn == 3 )
{ {
int x = 0; int x = 0;
...@@ -1606,7 +1606,7 @@ transform_16u( const ushort* src, ushort* dst, const float* m, int len, int scn, ...@@ -1606,7 +1606,7 @@ transform_16u( const ushort* src, ushort* dst, const float* m, int len, int scn,
static void static void
transform_32f( const float* src, float* dst, const float* m, int len, int scn, int dcn ) transform_32f( const float* src, float* dst, const float* m, int len, int scn, int dcn )
{ {
#if CV_SIMD && !defined(__aarch64__) #if CV_SIMD && !defined(__aarch64__) && !defined(_M_ARM64)
int x = 0; int x = 0;
if( scn == 3 && dcn == 3 ) if( scn == 3 && dcn == 3 )
{ {
......
...@@ -783,7 +783,7 @@ int cv::getNumberOfCPUs(void) ...@@ -783,7 +783,7 @@ int cv::getNumberOfCPUs(void)
{ {
#if defined _WIN32 #if defined _WIN32
SYSTEM_INFO sysinfo; SYSTEM_INFO sysinfo;
#if (defined(_M_ARM) || defined(_M_X64) || defined(WINRT)) && _WIN32_WINNT >= 0x501 #if (defined(_M_ARM) || defined(_M_ARM64) || defined(_M_X64) || defined(WINRT)) && _WIN32_WINNT >= 0x501
GetNativeSystemInfo( &sysinfo ); GetNativeSystemInfo( &sysinfo );
#else #else
GetSystemInfo( &sysinfo ); GetSystemInfo( &sysinfo );
......
...@@ -45,7 +45,7 @@ typedef unsigned __int64 uint64_t; ...@@ -45,7 +45,7 @@ typedef unsigned __int64 uint64_t;
#include "defines.h" #include "defines.h"
#if defined _WIN32 && defined(_M_ARM) #if defined _WIN32 && (defined(_M_ARM) || defined(_M_ARM64))
# include <Intrin.h> # include <Intrin.h>
#endif #endif
......
...@@ -118,6 +118,9 @@ elseif(WINRT) ...@@ -118,6 +118,9 @@ elseif(WINRT)
endif() endif()
elseif(HAVE_WIN32UI) elseif(HAVE_WIN32UI)
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_w32.cpp) list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_w32.cpp)
if(OpenCV_ARCH STREQUAL "ARM64")
list(APPEND HIGHGUI_LIBRARIES "comdlg32" "advapi32")
endif()
elseif(HAVE_GTK OR HAVE_GTK3) elseif(HAVE_GTK OR HAVE_GTK3)
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_gtk.cpp) list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_gtk.cpp)
elseif(HAVE_CARBON) elseif(HAVE_CARBON)
......
...@@ -75,7 +75,7 @@ using namespace cv; ...@@ -75,7 +75,7 @@ using namespace cv;
static const char* trackbar_text = static const char* trackbar_text =
" "; " ";
#if defined _M_X64 || defined __x86_64 #if defined _M_X64 || defined __x86_64 || defined _M_ARM64
#define icvGetWindowLongPtr GetWindowLongPtr #define icvGetWindowLongPtr GetWindowLongPtr
#define icvSetWindowLongPtr( hwnd, id, ptr ) SetWindowLongPtr( hwnd, id, (LONG_PTR)(ptr) ) #define icvSetWindowLongPtr( hwnd, id, ptr ) SetWindowLongPtr( hwnd, id, (LONG_PTR)(ptr) )
......
...@@ -94,7 +94,7 @@ bool checkBigDataTests(); ...@@ -94,7 +94,7 @@ bool checkBigDataTests();
} \ } \
// Special type of tests which require / use or validate processing of huge amount of data (>= 2Gb) // Special type of tests which require / use or validate processing of huge amount of data (>= 2Gb)
#if defined(_M_X64) || defined(__x86_64__) || defined(__aarch64__) #if defined(_M_X64) || defined(_M_ARM64) || defined(__x86_64__) || defined(__aarch64__)
#define BIGDATA_TEST(test_case_name, test_name) TEST_(BigData_ ## test_case_name, test_name, ::testing::Test, Body, CV__TEST_BIGDATA_BODY_IMPL) #define BIGDATA_TEST(test_case_name, test_name) TEST_(BigData_ ## test_case_name, test_name, ::testing::Test, Body, CV__TEST_BIGDATA_BODY_IMPL)
#else #else
#define BIGDATA_TEST(test_case_name, test_name) TEST_(BigData_ ## test_case_name, DISABLED_ ## test_name, ::testing::Test, Body, CV__TEST_BIGDATA_BODY_IMPL) #define BIGDATA_TEST(test_case_name, test_name) TEST_(BigData_ ## test_case_name, DISABLED_ ## test_name, ::testing::Test, Body, CV__TEST_BIGDATA_BODY_IMPL)
......
...@@ -18,4 +18,5 @@ file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) ...@@ -18,4 +18,5 @@ file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
foreach(sample_filename ${all_samples}) foreach(sample_filename ${all_samples})
ocv_define_sample(tgt ${sample_filename} directx) ocv_define_sample(tgt ${sample_filename} directx)
ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS}) ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS})
ocv_target_link_libraries(${tgt} PRIVATE "gdi32")
endforeach() endforeach()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment