mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #7467 from tomoaki0705:featureCheckSimdUniversal
This commit is contained in:
@@ -1772,6 +1772,17 @@ inline v_float32x4 v_matmul(const v_float32x4& v, const v_float32x4& m0,
|
||||
|
||||
//! @}
|
||||
|
||||
//! @name Check SIMD support
|
||||
//! @{
|
||||
//! @brief Check CPU capability of SIMD operation
|
||||
static inline bool hasSIMD128()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//! @}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#define OPENCV_HAL_INTRIN_NEON_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include "opencv2/core/utility.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
@@ -1216,6 +1217,16 @@ inline v_float16x4 v_cvt_f16(const v_float32x4& a)
|
||||
}
|
||||
#endif
|
||||
|
||||
//! @name Check SIMD support
|
||||
//! @{
|
||||
//! @brief Check CPU capability of SIMD operation
|
||||
static inline bool hasSIMD128()
|
||||
{
|
||||
return checkHardwareSupport(CV_CPU_NEON);
|
||||
}
|
||||
|
||||
//! @}
|
||||
|
||||
//! @endcond
|
||||
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#define OPENCV_HAL_SSE_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include "opencv2/core/utility.hpp"
|
||||
|
||||
#define CV_SIMD128 1
|
||||
#define CV_SIMD128_64F 1
|
||||
@@ -1726,6 +1727,16 @@ inline v_float16x4 v_cvt_f16(const v_float32x4& a)
|
||||
}
|
||||
#endif
|
||||
|
||||
//! @name Check SIMD support
|
||||
//! @{
|
||||
//! @brief Check CPU capability of SIMD operation
|
||||
static inline bool hasSIMD128()
|
||||
{
|
||||
return checkHardwareSupport(CV_CPU_SSE2);
|
||||
}
|
||||
|
||||
//! @}
|
||||
|
||||
//! @endcond
|
||||
|
||||
}
|
||||
|
||||
@@ -1197,7 +1197,7 @@ template <>
|
||||
struct Div_SIMD<uchar>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Div_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Div_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const uchar * src1, const uchar * src2, uchar * dst, int width, double scale) const
|
||||
{
|
||||
@@ -1243,7 +1243,7 @@ template <>
|
||||
struct Div_SIMD<schar>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Div_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Div_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const schar * src1, const schar * src2, schar * dst, int width, double scale) const
|
||||
{
|
||||
@@ -1289,7 +1289,7 @@ template <>
|
||||
struct Div_SIMD<ushort>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Div_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Div_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const ushort * src1, const ushort * src2, ushort * dst, int width, double scale) const
|
||||
{
|
||||
@@ -1334,7 +1334,7 @@ template <>
|
||||
struct Div_SIMD<short>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Div_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Div_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const short * src1, const short * src2, short * dst, int width, double scale) const
|
||||
{
|
||||
@@ -1379,7 +1379,7 @@ template <>
|
||||
struct Div_SIMD<int>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Div_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Div_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const int * src1, const int * src2, int * dst, int width, double scale) const
|
||||
{
|
||||
@@ -1423,7 +1423,7 @@ template <>
|
||||
struct Div_SIMD<float>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Div_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Div_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const float * src1, const float * src2, float * dst, int width, double scale) const
|
||||
{
|
||||
@@ -1463,7 +1463,7 @@ template <>
|
||||
struct Recip_SIMD<uchar>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Recip_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Recip_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const uchar * src2, uchar * dst, int width, double scale) const
|
||||
{
|
||||
@@ -1504,7 +1504,7 @@ template <>
|
||||
struct Recip_SIMD<schar>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Recip_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Recip_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const schar * src2, schar * dst, int width, double scale) const
|
||||
{
|
||||
@@ -1545,7 +1545,7 @@ template <>
|
||||
struct Recip_SIMD<ushort>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Recip_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Recip_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const ushort * src2, ushort * dst, int width, double scale) const
|
||||
{
|
||||
@@ -1585,7 +1585,7 @@ template <>
|
||||
struct Recip_SIMD<short>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Recip_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Recip_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const short * src2, short * dst, int width, double scale) const
|
||||
{
|
||||
@@ -1625,7 +1625,7 @@ template <>
|
||||
struct Recip_SIMD<int>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Recip_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Recip_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const int * src2, int * dst, int width, double scale) const
|
||||
{
|
||||
@@ -1665,7 +1665,7 @@ template <>
|
||||
struct Recip_SIMD<float>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Recip_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Recip_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const float * src2, float * dst, int width, double scale) const
|
||||
{
|
||||
@@ -1702,7 +1702,7 @@ template <>
|
||||
struct Div_SIMD<double>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Div_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Div_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const double * src1, const double * src2, double * dst, int width, double scale) const
|
||||
{
|
||||
@@ -1739,7 +1739,7 @@ template <>
|
||||
struct Recip_SIMD<double>
|
||||
{
|
||||
bool haveSIMD;
|
||||
Recip_SIMD() { haveSIMD = checkHardwareSupport(CV_CPU_SSE2) || checkHardwareSupport(CV_CPU_NEON); }
|
||||
Recip_SIMD() { haveSIMD = hasSIMD128(); }
|
||||
|
||||
int operator() (const double * src2, double * dst, int width, double scale) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user