fix android pack build
This commit is contained in:
parent
705e776f09
commit
2ec63e4dd1
@ -369,3 +369,18 @@ if(MSVC)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4589) # Constructor of abstract class 'cv::ORB' ignores initializer for virtual base class 'cv::Algorithm'
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT OPENCV_FP16_DISABLE)
|
||||
try_compile(__VALID_FP16
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/fp16.cpp"
|
||||
COMPILE_DEFINITIONS "-DCHECK_FP16"
|
||||
OUTPUT_VARIABLE TRY_OUT
|
||||
)
|
||||
if(NOT __VALID_FP16)
|
||||
message(STATUS "FP16: Compiler support is not available")
|
||||
else()
|
||||
message(STATUS "FP16: Compiler support is available")
|
||||
set(HAVE_FP16 1)
|
||||
endif()
|
||||
endif()
|
||||
|
33
cmake/checks/fp16.cpp
Normal file
33
cmake/checks/fp16.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined __F16C__ || (defined _MSC_VER && _MSC_VER >= 1700)
|
||||
#include <immintrin.h>
|
||||
int test()
|
||||
{
|
||||
const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
short dst[8];
|
||||
__m128 v_src = _mm_load_ps(src);
|
||||
__m128i v_dst = _mm_cvtps_ph(v_src, 0);
|
||||
_mm_storel_epi64((__m128i*)dst, v_dst);
|
||||
return (int)dst[0];
|
||||
}
|
||||
#elif defined __GNUC__ && (defined __arm__ || defined __aarch64__)
|
||||
#include "arm_neon.h"
|
||||
int test()
|
||||
{
|
||||
const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
short dst[8];
|
||||
float32x4_t v_src = *(float32x4_t*)src;
|
||||
float16x4_t v_dst = vcvt_f16_f32(v_src);
|
||||
*(float16x4_t*)dst = v_dst;
|
||||
return (int)dst[0];
|
||||
}
|
||||
#else
|
||||
#error "FP16 is not supported"
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("%d\n", test());
|
||||
return 0;
|
||||
}
|
@ -203,3 +203,6 @@
|
||||
|
||||
/* Lapack */
|
||||
#cmakedefine HAVE_LAPACK
|
||||
|
||||
/* FP16 */
|
||||
#cmakedefine HAVE_FP16
|
||||
|
@ -193,7 +193,7 @@ enum CpuFeatures {
|
||||
# endif
|
||||
# define CV_POPCNT 1
|
||||
# endif
|
||||
# if defined __F16C__ || (defined _MSC_VER && _MSC_VER >= 1700)
|
||||
# if defined HAVE_FP16 && (defined __F16C__ || (defined _MSC_VER && _MSC_VER >= 1700))
|
||||
# include <immintrin.h>
|
||||
# define CV_FP16 1
|
||||
# endif
|
||||
@ -219,7 +219,7 @@ enum CpuFeatures {
|
||||
|
||||
#if (defined WIN32 || defined _WIN32) && defined(_M_ARM)
|
||||
# include <Intrin.h>
|
||||
# include "arm_neon.h"
|
||||
# include <arm_neon.h>
|
||||
# define CV_NEON 1
|
||||
# define CPU_HAS_NEON_FEATURE (true)
|
||||
#elif defined(__ARM_NEON__) || (defined (__ARM_NEON) && defined(__aarch64__))
|
||||
@ -227,7 +227,11 @@ enum CpuFeatures {
|
||||
# define CV_NEON 1
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__ && ((defined (__arm__) && (__ARM_FP & 0x2)) || defined(__aarch64__))
|
||||
#if defined(__ARM_NEON__) || defined(__aarch64__)
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
#if defined HAVE_FP16 && defined __GNUC__
|
||||
# define CV_FP16 1
|
||||
#endif
|
||||
|
||||
|
@ -4591,6 +4591,8 @@ cvtScaleHalf_<float, short>( const float* src, size_t sstep, short* dst, size_t
|
||||
float16x4_t v_dst = vcvt_f16_f32(v_src);
|
||||
|
||||
*(float16x4_t*)(dst + x) = v_dst;
|
||||
#else
|
||||
#error "Configuration error"
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@ -4643,6 +4645,8 @@ cvtScaleHalf_<short, float>( const short* src, size_t sstep, float* dst, size_t
|
||||
float32x4_t v_dst = vcvt_f32_f16(v_src);
|
||||
|
||||
*(float32x4_t*)(dst + x) = v_dst;
|
||||
#else
|
||||
#error "Configuration error"
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -43,6 +43,23 @@
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels_imgproc.hpp"
|
||||
|
||||
#if CV_NEON && defined(__aarch64__)
|
||||
#include <arm_neon.h>
|
||||
namespace cv {
|
||||
// Workaround with missing definitions of vreinterpretq_u64_f64/vreinterpretq_f64_u64
|
||||
template <typename T> static inline
|
||||
uint64x2_t vreinterpretq_u64_f64(T a)
|
||||
{
|
||||
return (uint64x2_t) a;
|
||||
}
|
||||
template <typename T> static inline
|
||||
float64x2_t vreinterpretq_f64_u64(T a)
|
||||
{
|
||||
return (float64x2_t) a;
|
||||
}
|
||||
} // namespace cv
|
||||
#endif
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user