mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge pull request #24371 from hanliutong:clean-up
Clean up the obsolete API of Universal Intrinsic
This commit is contained in:
@@ -723,7 +723,7 @@ namespace CV__SIMD_NAMESPACE {
|
||||
/** @brief SIMD processing state cleanup call */
|
||||
inline void vx_cleanup() { VXPREFIX(_cleanup)(); }
|
||||
|
||||
#if !CV_SIMD_SCALABLE
|
||||
#if !CV_SIMD_SCALABLE && !(CV_NEON && !defined(CV_FORCE_SIMD128_CPP))
|
||||
// Compatibility layer
|
||||
|
||||
template<typename T> struct VTraits {
|
||||
@@ -1148,6 +1148,74 @@ namespace CV__SIMD_NAMESPACE {
|
||||
|
||||
#endif //!CV_SIMD_SCALABLE
|
||||
|
||||
#if (CV_NEON /* || CV_others */) && !defined(CV_FORCE_SIMD128_CPP)
|
||||
// Compatibility layer for the backend that cleaned up.
|
||||
#define OPENCV_HAL_WRAP_BIN_OP_ADDSUB(_Tpvec) \
|
||||
template<typename... Args> \
|
||||
inline _Tpvec v_add(const _Tpvec& f1, const _Tpvec& f2, const Args&... vf) { \
|
||||
return v_add(v_add(f1, f2), vf...); \
|
||||
}
|
||||
|
||||
OPENCV_HAL_WRAP_BIN_OP_ADDSUB(v_uint8)
|
||||
OPENCV_HAL_WRAP_BIN_OP_ADDSUB(v_uint16)
|
||||
OPENCV_HAL_WRAP_BIN_OP_ADDSUB(v_uint32)
|
||||
OPENCV_HAL_WRAP_BIN_OP_ADDSUB(v_uint64)
|
||||
OPENCV_HAL_WRAP_BIN_OP_ADDSUB(v_int8)
|
||||
OPENCV_HAL_WRAP_BIN_OP_ADDSUB(v_int16)
|
||||
OPENCV_HAL_WRAP_BIN_OP_ADDSUB(v_int32)
|
||||
OPENCV_HAL_WRAP_BIN_OP_ADDSUB(v_int64)
|
||||
OPENCV_HAL_WRAP_BIN_OP_ADDSUB(v_float32)
|
||||
#if CV_SIMD_64F
|
||||
OPENCV_HAL_WRAP_BIN_OP_ADDSUB(v_float64)
|
||||
#endif
|
||||
|
||||
#define OPENCV_HAL_WRAP_BIN_OP_MUL(_Tpvec) \
|
||||
template<typename... Args> \
|
||||
inline _Tpvec v_mul(const _Tpvec& f1, const _Tpvec& f2, const Args&... vf) { \
|
||||
return v_mul(v_mul(f1, f2), vf...); \
|
||||
}
|
||||
OPENCV_HAL_WRAP_BIN_OP_MUL(v_uint8)
|
||||
OPENCV_HAL_WRAP_BIN_OP_MUL(v_int8)
|
||||
OPENCV_HAL_WRAP_BIN_OP_MUL(v_uint16)
|
||||
OPENCV_HAL_WRAP_BIN_OP_MUL(v_uint32)
|
||||
OPENCV_HAL_WRAP_BIN_OP_MUL(v_int16)
|
||||
OPENCV_HAL_WRAP_BIN_OP_MUL(v_int32)
|
||||
OPENCV_HAL_WRAP_BIN_OP_MUL(v_float32)
|
||||
#if CV_SIMD_64F
|
||||
OPENCV_HAL_WRAP_BIN_OP_MUL(v_float64)
|
||||
#endif
|
||||
|
||||
#define OPENCV_HAL_WRAP_EXTRACT(_Tpvec) \
|
||||
inline typename VTraits<_Tpvec>::lane_type v_extract_highest(const _Tpvec& v) \
|
||||
{ \
|
||||
return v_extract_n<VTraits<_Tpvec>::nlanes-1>(v); \
|
||||
}
|
||||
|
||||
OPENCV_HAL_WRAP_EXTRACT(v_uint8)
|
||||
OPENCV_HAL_WRAP_EXTRACT(v_int8)
|
||||
OPENCV_HAL_WRAP_EXTRACT(v_uint16)
|
||||
OPENCV_HAL_WRAP_EXTRACT(v_int16)
|
||||
OPENCV_HAL_WRAP_EXTRACT(v_uint32)
|
||||
OPENCV_HAL_WRAP_EXTRACT(v_int32)
|
||||
OPENCV_HAL_WRAP_EXTRACT(v_uint64)
|
||||
OPENCV_HAL_WRAP_EXTRACT(v_int64)
|
||||
OPENCV_HAL_WRAP_EXTRACT(v_float32)
|
||||
#if CV_SIMD_64F
|
||||
OPENCV_HAL_WRAP_EXTRACT(v_float64)
|
||||
#endif
|
||||
|
||||
#define OPENCV_HAL_WRAP_BROADCAST(_Tpvec) \
|
||||
inline _Tpvec v_broadcast_highest(const _Tpvec& v) \
|
||||
{ \
|
||||
return v_broadcast_element<VTraits<_Tpvec>::nlanes-1>(v); \
|
||||
}
|
||||
|
||||
OPENCV_HAL_WRAP_BROADCAST(v_uint32)
|
||||
OPENCV_HAL_WRAP_BROADCAST(v_int32)
|
||||
OPENCV_HAL_WRAP_BROADCAST(v_float32)
|
||||
|
||||
#endif //CV_NEON
|
||||
|
||||
//! @cond IGNORED
|
||||
|
||||
// backward compatibility
|
||||
|
||||
@@ -131,13 +131,22 @@ OPENCV_HAL_IMPL_NEON_UTILS_SUFFIX_I64(int64x2, int64x1, s64)
|
||||
OPENCV_HAL_IMPL_NEON_UTILS_SUFFIX_F64(float64x2, float64x1,f64)
|
||||
#endif
|
||||
|
||||
//////////// Compatibility layer ////////////
|
||||
template<typename T> struct VTraits {
|
||||
static inline int vlanes() { return T::nlanes; }
|
||||
enum { max_nlanes = T::nlanes, nlanes = T::nlanes };
|
||||
using lane_type = typename T::lane_type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline typename VTraits<T>::lane_type v_get0(const T& v) \
|
||||
{ \
|
||||
return v.get0(); \
|
||||
}
|
||||
//////////// Types ////////////
|
||||
|
||||
struct v_uint8x16
|
||||
{
|
||||
typedef uchar lane_type;
|
||||
enum { nlanes = 16 };
|
||||
|
||||
v_uint8x16() {}
|
||||
explicit v_uint8x16(uint8x16_t v) : val(v) {}
|
||||
v_uint8x16(uchar v0, uchar v1, uchar v2, uchar v3, uchar v4, uchar v5, uchar v6, uchar v7,
|
||||
@@ -146,19 +155,22 @@ struct v_uint8x16
|
||||
uchar v[] = {v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15};
|
||||
val = vld1q_u8(v);
|
||||
}
|
||||
uint8x16_t val;
|
||||
|
||||
private:
|
||||
friend struct VTraits<v_uint8x16>;
|
||||
enum { nlanes = 16 };
|
||||
typedef uchar lane_type;
|
||||
|
||||
friend typename VTraits<v_uint8x16>::lane_type v_get0<v_uint8x16>(const v_uint8x16& v);
|
||||
uchar get0() const
|
||||
{
|
||||
return vgetq_lane_u8(val, 0);
|
||||
}
|
||||
|
||||
uint8x16_t val;
|
||||
};
|
||||
|
||||
struct v_int8x16
|
||||
{
|
||||
typedef schar lane_type;
|
||||
enum { nlanes = 16 };
|
||||
|
||||
v_int8x16() {}
|
||||
explicit v_int8x16(int8x16_t v) : val(v) {}
|
||||
v_int8x16(schar v0, schar v1, schar v2, schar v3, schar v4, schar v5, schar v6, schar v7,
|
||||
@@ -167,19 +179,22 @@ struct v_int8x16
|
||||
schar v[] = {v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15};
|
||||
val = vld1q_s8(v);
|
||||
}
|
||||
int8x16_t val;
|
||||
|
||||
private:
|
||||
friend struct VTraits<v_int8x16>;
|
||||
enum { nlanes = 16 };
|
||||
typedef schar lane_type;
|
||||
|
||||
friend typename VTraits<v_int8x16>::lane_type v_get0<v_int8x16>(const v_int8x16& v);
|
||||
schar get0() const
|
||||
{
|
||||
return vgetq_lane_s8(val, 0);
|
||||
}
|
||||
|
||||
int8x16_t val;
|
||||
};
|
||||
|
||||
struct v_uint16x8
|
||||
{
|
||||
typedef ushort lane_type;
|
||||
enum { nlanes = 8 };
|
||||
|
||||
v_uint16x8() {}
|
||||
explicit v_uint16x8(uint16x8_t v) : val(v) {}
|
||||
v_uint16x8(ushort v0, ushort v1, ushort v2, ushort v3, ushort v4, ushort v5, ushort v6, ushort v7)
|
||||
@@ -187,19 +202,22 @@ struct v_uint16x8
|
||||
ushort v[] = {v0, v1, v2, v3, v4, v5, v6, v7};
|
||||
val = vld1q_u16(v);
|
||||
}
|
||||
uint16x8_t val;
|
||||
|
||||
private:
|
||||
friend struct VTraits<v_uint16x8>;
|
||||
enum { nlanes = 8 };
|
||||
typedef ushort lane_type;
|
||||
|
||||
friend typename VTraits<v_uint16x8>::lane_type v_get0<v_uint16x8>(const v_uint16x8& v);
|
||||
ushort get0() const
|
||||
{
|
||||
return vgetq_lane_u16(val, 0);
|
||||
}
|
||||
|
||||
uint16x8_t val;
|
||||
};
|
||||
|
||||
struct v_int16x8
|
||||
{
|
||||
typedef short lane_type;
|
||||
enum { nlanes = 8 };
|
||||
|
||||
v_int16x8() {}
|
||||
explicit v_int16x8(int16x8_t v) : val(v) {}
|
||||
v_int16x8(short v0, short v1, short v2, short v3, short v4, short v5, short v6, short v7)
|
||||
@@ -207,19 +225,22 @@ struct v_int16x8
|
||||
short v[] = {v0, v1, v2, v3, v4, v5, v6, v7};
|
||||
val = vld1q_s16(v);
|
||||
}
|
||||
int16x8_t val;
|
||||
|
||||
private:
|
||||
friend struct VTraits<v_int16x8>;
|
||||
enum { nlanes = 8 };
|
||||
typedef short lane_type;
|
||||
|
||||
friend typename VTraits<v_int16x8>::lane_type v_get0<v_int16x8>(const v_int16x8& v);
|
||||
short get0() const
|
||||
{
|
||||
return vgetq_lane_s16(val, 0);
|
||||
}
|
||||
|
||||
int16x8_t val;
|
||||
};
|
||||
|
||||
struct v_uint32x4
|
||||
{
|
||||
typedef unsigned lane_type;
|
||||
enum { nlanes = 4 };
|
||||
|
||||
v_uint32x4() {}
|
||||
explicit v_uint32x4(uint32x4_t v) : val(v) {}
|
||||
v_uint32x4(unsigned v0, unsigned v1, unsigned v2, unsigned v3)
|
||||
@@ -227,19 +248,22 @@ struct v_uint32x4
|
||||
unsigned v[] = {v0, v1, v2, v3};
|
||||
val = vld1q_u32(v);
|
||||
}
|
||||
uint32x4_t val;
|
||||
|
||||
private:
|
||||
friend struct VTraits<v_uint32x4>;
|
||||
enum { nlanes = 4 };
|
||||
typedef unsigned lane_type;
|
||||
|
||||
friend typename VTraits<v_uint32x4>::lane_type v_get0<v_uint32x4>(const v_uint32x4& v);
|
||||
unsigned get0() const
|
||||
{
|
||||
return vgetq_lane_u32(val, 0);
|
||||
}
|
||||
|
||||
uint32x4_t val;
|
||||
};
|
||||
|
||||
struct v_int32x4
|
||||
{
|
||||
typedef int lane_type;
|
||||
enum { nlanes = 4 };
|
||||
|
||||
v_int32x4() {}
|
||||
explicit v_int32x4(int32x4_t v) : val(v) {}
|
||||
v_int32x4(int v0, int v1, int v2, int v3)
|
||||
@@ -247,18 +271,22 @@ struct v_int32x4
|
||||
int v[] = {v0, v1, v2, v3};
|
||||
val = vld1q_s32(v);
|
||||
}
|
||||
int32x4_t val;
|
||||
|
||||
private:
|
||||
friend struct VTraits<v_int32x4>;
|
||||
enum { nlanes = 4 };
|
||||
typedef int lane_type;
|
||||
|
||||
friend typename VTraits<v_int32x4>::lane_type v_get0<v_int32x4>(const v_int32x4& v);
|
||||
int get0() const
|
||||
{
|
||||
return vgetq_lane_s32(val, 0);
|
||||
}
|
||||
int32x4_t val;
|
||||
};
|
||||
|
||||
struct v_float32x4
|
||||
{
|
||||
typedef float lane_type;
|
||||
enum { nlanes = 4 };
|
||||
|
||||
v_float32x4() {}
|
||||
explicit v_float32x4(float32x4_t v) : val(v) {}
|
||||
v_float32x4(float v0, float v1, float v2, float v3)
|
||||
@@ -266,18 +294,22 @@ struct v_float32x4
|
||||
float v[] = {v0, v1, v2, v3};
|
||||
val = vld1q_f32(v);
|
||||
}
|
||||
float32x4_t val;
|
||||
|
||||
private:
|
||||
friend struct VTraits<v_float32x4>;
|
||||
enum { nlanes = 4 };
|
||||
typedef float lane_type;
|
||||
|
||||
friend typename VTraits<v_float32x4>::lane_type v_get0<v_float32x4>(const v_float32x4& v);
|
||||
float get0() const
|
||||
{
|
||||
return vgetq_lane_f32(val, 0);
|
||||
}
|
||||
float32x4_t val;
|
||||
};
|
||||
|
||||
struct v_uint64x2
|
||||
{
|
||||
typedef uint64 lane_type;
|
||||
enum { nlanes = 2 };
|
||||
|
||||
v_uint64x2() {}
|
||||
explicit v_uint64x2(uint64x2_t v) : val(v) {}
|
||||
v_uint64x2(uint64 v0, uint64 v1)
|
||||
@@ -285,18 +317,21 @@ struct v_uint64x2
|
||||
uint64 v[] = {v0, v1};
|
||||
val = vld1q_u64(v);
|
||||
}
|
||||
uint64x2_t val;
|
||||
private:
|
||||
friend struct VTraits<v_uint64x2>;
|
||||
enum { nlanes = 2 };
|
||||
typedef uint64 lane_type;
|
||||
|
||||
friend typename VTraits<v_uint64x2>::lane_type v_get0<v_uint64x2>(const v_uint64x2& v);
|
||||
uint64 get0() const
|
||||
{
|
||||
return vgetq_lane_u64(val, 0);
|
||||
}
|
||||
uint64x2_t val;
|
||||
};
|
||||
|
||||
struct v_int64x2
|
||||
{
|
||||
typedef int64 lane_type;
|
||||
enum { nlanes = 2 };
|
||||
|
||||
v_int64x2() {}
|
||||
explicit v_int64x2(int64x2_t v) : val(v) {}
|
||||
v_int64x2(int64 v0, int64 v1)
|
||||
@@ -304,19 +339,23 @@ struct v_int64x2
|
||||
int64 v[] = {v0, v1};
|
||||
val = vld1q_s64(v);
|
||||
}
|
||||
int64x2_t val;
|
||||
|
||||
private:
|
||||
friend struct VTraits<v_int64x2>;
|
||||
enum { nlanes = 2 };
|
||||
typedef int64 lane_type;
|
||||
|
||||
friend typename VTraits<v_int64x2>::lane_type v_get0<v_int64x2>(const v_int64x2& v);
|
||||
int64 get0() const
|
||||
{
|
||||
return vgetq_lane_s64(val, 0);
|
||||
}
|
||||
int64x2_t val;
|
||||
};
|
||||
|
||||
#if CV_SIMD128_64F
|
||||
struct v_float64x2
|
||||
{
|
||||
typedef double lane_type;
|
||||
enum { nlanes = 2 };
|
||||
|
||||
v_float64x2() {}
|
||||
explicit v_float64x2(float64x2_t v) : val(v) {}
|
||||
v_float64x2(double v0, double v1)
|
||||
@@ -324,11 +363,18 @@ struct v_float64x2
|
||||
double v[] = {v0, v1};
|
||||
val = vld1q_f64(v);
|
||||
}
|
||||
|
||||
float64x2_t val;
|
||||
private:
|
||||
friend struct VTraits<v_float64x2>;
|
||||
enum { nlanes = 2 };
|
||||
typedef double lane_type;
|
||||
|
||||
friend typename VTraits<v_float64x2>::lane_type v_get0<v_float64x2>(const v_float64x2& v);
|
||||
double get0() const
|
||||
{
|
||||
return vgetq_lane_f64(val, 0);
|
||||
}
|
||||
float64x2_t val;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -460,71 +506,56 @@ inline v_float32x4 v_matmuladd(const v_float32x4& v, const v_float32x4& m0,
|
||||
}
|
||||
|
||||
#define OPENCV_HAL_IMPL_NEON_BIN_OP(bin_op, _Tpvec, intrin) \
|
||||
inline _Tpvec operator bin_op (const _Tpvec& a, const _Tpvec& b) \
|
||||
inline _Tpvec bin_op (const _Tpvec& a, const _Tpvec& b) \
|
||||
{ \
|
||||
return _Tpvec(intrin(a.val, b.val)); \
|
||||
} \
|
||||
inline _Tpvec& operator bin_op##= (_Tpvec& a, const _Tpvec& b) \
|
||||
{ \
|
||||
a.val = intrin(a.val, b.val); \
|
||||
return a; \
|
||||
}
|
||||
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint8x16, vqaddq_u8)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint8x16, vqsubq_u8)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int8x16, vqaddq_s8)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int8x16, vqsubq_s8)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint16x8, vqaddq_u16)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint16x8, vqsubq_u16)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int16x8, vqaddq_s16)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int16x8, vqsubq_s16)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int32x4, vaddq_s32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int32x4, vsubq_s32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_int32x4, vmulq_s32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint32x4, vaddq_u32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint32x4, vsubq_u32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_uint32x4, vmulq_u32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_float32x4, vaddq_f32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_float32x4, vsubq_f32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_float32x4, vmulq_f32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int64x2, vaddq_s64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int64x2, vsubq_s64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint64x2, vaddq_u64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint64x2, vsubq_u64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_add, v_uint8x16, vqaddq_u8)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_sub, v_uint8x16, vqsubq_u8)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_add, v_int8x16, vqaddq_s8)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_sub, v_int8x16, vqsubq_s8)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_add, v_uint16x8, vqaddq_u16)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_sub, v_uint16x8, vqsubq_u16)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_add, v_int16x8, vqaddq_s16)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_sub, v_int16x8, vqsubq_s16)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_add, v_int32x4, vaddq_s32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_sub, v_int32x4, vsubq_s32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_mul, v_int32x4, vmulq_s32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_add, v_uint32x4, vaddq_u32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_sub, v_uint32x4, vsubq_u32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_mul, v_uint32x4, vmulq_u32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_add, v_float32x4, vaddq_f32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_sub, v_float32x4, vsubq_f32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_mul, v_float32x4, vmulq_f32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_add, v_int64x2, vaddq_s64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_sub, v_int64x2, vsubq_s64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_add, v_uint64x2, vaddq_u64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_sub, v_uint64x2, vsubq_u64)
|
||||
#if CV_SIMD128_64F
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(/, v_float32x4, vdivq_f32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_float64x2, vaddq_f64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_float64x2, vsubq_f64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_float64x2, vmulq_f64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(/, v_float64x2, vdivq_f64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_div, v_float32x4, vdivq_f32)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_add, v_float64x2, vaddq_f64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_sub, v_float64x2, vsubq_f64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_mul, v_float64x2, vmulq_f64)
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_div, v_float64x2, vdivq_f64)
|
||||
#else
|
||||
inline v_float32x4 operator / (const v_float32x4& a, const v_float32x4& b)
|
||||
inline v_float32x4 v_div (const v_float32x4& a, const v_float32x4& b)
|
||||
{
|
||||
float32x4_t reciprocal = vrecpeq_f32(b.val);
|
||||
reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal);
|
||||
reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal);
|
||||
return v_float32x4(vmulq_f32(a.val, reciprocal));
|
||||
}
|
||||
inline v_float32x4& operator /= (v_float32x4& a, const v_float32x4& b)
|
||||
{
|
||||
float32x4_t reciprocal = vrecpeq_f32(b.val);
|
||||
reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal);
|
||||
reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal);
|
||||
a.val = vmulq_f32(a.val, reciprocal);
|
||||
return a;
|
||||
}
|
||||
#endif
|
||||
|
||||
// saturating multiply 8-bit, 16-bit
|
||||
#define OPENCV_HAL_IMPL_NEON_MUL_SAT(_Tpvec, _Tpwvec) \
|
||||
inline _Tpvec operator * (const _Tpvec& a, const _Tpvec& b) \
|
||||
inline _Tpvec v_mul (const _Tpvec& a, const _Tpvec& b) \
|
||||
{ \
|
||||
_Tpwvec c, d; \
|
||||
v_mul_expand(a, b, c, d); \
|
||||
return v_pack(c, d); \
|
||||
} \
|
||||
inline _Tpvec& operator *= (_Tpvec& a, const _Tpvec& b) \
|
||||
{ a = a * b; return a; }
|
||||
}
|
||||
|
||||
OPENCV_HAL_IMPL_NEON_MUL_SAT(v_int8x16, v_int16x8)
|
||||
OPENCV_HAL_IMPL_NEON_MUL_SAT(v_uint8x16, v_uint16x8)
|
||||
@@ -698,7 +729,7 @@ inline v_uint32x4 v_dotprod_expand(const v_uint8x16& a, const v_uint8x16& b)
|
||||
inline v_uint32x4 v_dotprod_expand(const v_uint8x16& a, const v_uint8x16& b,
|
||||
const v_uint32x4& c)
|
||||
{
|
||||
return v_dotprod_expand(a, b) + c;
|
||||
return v_add(v_dotprod_expand(a, b), c);
|
||||
}
|
||||
|
||||
inline v_int32x4 v_dotprod_expand(const v_int8x16& a, const v_int8x16& b)
|
||||
@@ -715,7 +746,7 @@ inline v_int32x4 v_dotprod_expand(const v_int8x16& a, const v_int8x16& b)
|
||||
inline v_int32x4 v_dotprod_expand(const v_int8x16& a, const v_int8x16& b,
|
||||
const v_int32x4& c)
|
||||
{
|
||||
return v_dotprod_expand(a, b) + c;
|
||||
return v_add(v_dotprod_expand(a, b), c);
|
||||
}
|
||||
#endif
|
||||
// 16 >> 64
|
||||
@@ -735,7 +766,7 @@ inline v_uint64x2 v_dotprod_expand(const v_uint16x8& a, const v_uint16x8& b)
|
||||
return v_uint64x2(vaddq_u64(s0, s1));
|
||||
}
|
||||
inline v_uint64x2 v_dotprod_expand(const v_uint16x8& a, const v_uint16x8& b, const v_uint64x2& c)
|
||||
{ return v_dotprod_expand(a, b) + c; }
|
||||
{ return v_add(v_dotprod_expand(a, b), c); }
|
||||
|
||||
inline v_int64x2 v_dotprod_expand(const v_int16x8& a, const v_int16x8& b)
|
||||
{
|
||||
@@ -752,7 +783,7 @@ inline v_int64x2 v_dotprod_expand(const v_int16x8& a, const v_int16x8& b)
|
||||
}
|
||||
inline v_int64x2 v_dotprod_expand(const v_int16x8& a, const v_int16x8& b,
|
||||
const v_int64x2& c)
|
||||
{ return v_dotprod_expand(a, b) + c; }
|
||||
{ return v_add(v_dotprod_expand(a, b), c); }
|
||||
|
||||
// 32 >> 64f
|
||||
#if CV_SIMD128_64F
|
||||
@@ -760,7 +791,7 @@ inline v_float64x2 v_dotprod_expand(const v_int32x4& a, const v_int32x4& b)
|
||||
{ return v_cvt_f64(v_dotprod(a, b)); }
|
||||
inline v_float64x2 v_dotprod_expand(const v_int32x4& a, const v_int32x4& b,
|
||||
const v_float64x2& c)
|
||||
{ return v_dotprod_expand(a, b) + c; }
|
||||
{ return v_add(v_dotprod_expand(a, b), c); }
|
||||
#endif
|
||||
|
||||
//////// Fast Dot Product ////////
|
||||
@@ -850,7 +881,7 @@ inline v_uint32x4 v_dotprod_expand_fast(const v_uint8x16& a, const v_uint8x16& b
|
||||
}
|
||||
inline v_uint32x4 v_dotprod_expand_fast(const v_uint8x16& a, const v_uint8x16& b, const v_uint32x4& c)
|
||||
{
|
||||
return v_dotprod_expand_fast(a, b) + c;
|
||||
return v_add(v_dotprod_expand_fast(a, b), c);
|
||||
}
|
||||
|
||||
inline v_int32x4 v_dotprod_expand_fast(const v_int8x16& a, const v_int8x16& b)
|
||||
@@ -861,7 +892,7 @@ inline v_int32x4 v_dotprod_expand_fast(const v_int8x16& a, const v_int8x16& b)
|
||||
}
|
||||
inline v_int32x4 v_dotprod_expand_fast(const v_int8x16& a, const v_int8x16& b, const v_int32x4& c)
|
||||
{
|
||||
return v_dotprod_expand_fast(a, b) + c;
|
||||
return v_add(v_dotprod_expand_fast(a, b), c);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -875,7 +906,7 @@ inline v_uint64x2 v_dotprod_expand_fast(const v_uint16x8& a, const v_uint16x8& b
|
||||
return v_uint64x2(vaddq_u64(s0, s1));
|
||||
}
|
||||
inline v_uint64x2 v_dotprod_expand_fast(const v_uint16x8& a, const v_uint16x8& b, const v_uint64x2& c)
|
||||
{ return v_dotprod_expand_fast(a, b) + c; }
|
||||
{ return v_add(v_dotprod_expand_fast(a, b), c); }
|
||||
|
||||
inline v_int64x2 v_dotprod_expand_fast(const v_int16x8& a, const v_int16x8& b)
|
||||
{
|
||||
@@ -884,22 +915,22 @@ inline v_int64x2 v_dotprod_expand_fast(const v_int16x8& a, const v_int16x8& b)
|
||||
return v_int64x2(vaddl_s32(vget_low_s32(prod), vget_high_s32(prod)));
|
||||
}
|
||||
inline v_int64x2 v_dotprod_expand_fast(const v_int16x8& a, const v_int16x8& b, const v_int64x2& c)
|
||||
{ return v_dotprod_expand_fast(a, b) + c; }
|
||||
{ return v_add(v_dotprod_expand_fast(a, b), c); }
|
||||
|
||||
// 32 >> 64f
|
||||
#if CV_SIMD128_64F
|
||||
inline v_float64x2 v_dotprod_expand_fast(const v_int32x4& a, const v_int32x4& b)
|
||||
{ return v_cvt_f64(v_dotprod_fast(a, b)); }
|
||||
inline v_float64x2 v_dotprod_expand_fast(const v_int32x4& a, const v_int32x4& b, const v_float64x2& c)
|
||||
{ return v_dotprod_expand_fast(a, b) + c; }
|
||||
{ return v_add(v_dotprod_expand_fast(a, b), c); }
|
||||
#endif
|
||||
|
||||
|
||||
#define OPENCV_HAL_IMPL_NEON_LOGIC_OP(_Tpvec, suffix) \
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(&, _Tpvec, vandq_##suffix) \
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(|, _Tpvec, vorrq_##suffix) \
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(^, _Tpvec, veorq_##suffix) \
|
||||
inline _Tpvec operator ~ (const _Tpvec& a) \
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_and, _Tpvec, vandq_##suffix) \
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_or, _Tpvec, vorrq_##suffix) \
|
||||
OPENCV_HAL_IMPL_NEON_BIN_OP(v_xor, _Tpvec, veorq_##suffix) \
|
||||
inline _Tpvec v_not (const _Tpvec& a) \
|
||||
{ \
|
||||
return _Tpvec(vreinterpretq_##suffix##_u8(vmvnq_u8(vreinterpretq_u8_##suffix(a.val)))); \
|
||||
}
|
||||
@@ -914,21 +945,16 @@ OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_uint64x2, u64)
|
||||
OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_int64x2, s64)
|
||||
|
||||
#define OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(bin_op, intrin) \
|
||||
inline v_float32x4 operator bin_op (const v_float32x4& a, const v_float32x4& b) \
|
||||
inline v_float32x4 bin_op (const v_float32x4& a, const v_float32x4& b) \
|
||||
{ \
|
||||
return v_float32x4(vreinterpretq_f32_s32(intrin(vreinterpretq_s32_f32(a.val), vreinterpretq_s32_f32(b.val)))); \
|
||||
} \
|
||||
inline v_float32x4& operator bin_op##= (v_float32x4& a, const v_float32x4& b) \
|
||||
{ \
|
||||
a.val = vreinterpretq_f32_s32(intrin(vreinterpretq_s32_f32(a.val), vreinterpretq_s32_f32(b.val))); \
|
||||
return a; \
|
||||
}
|
||||
|
||||
OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(&, vandq_s32)
|
||||
OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(|, vorrq_s32)
|
||||
OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(^, veorq_s32)
|
||||
OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(v_and, vandq_s32)
|
||||
OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(v_or, vorrq_s32)
|
||||
OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(v_xor, veorq_s32)
|
||||
|
||||
inline v_float32x4 operator ~ (const v_float32x4& a)
|
||||
inline v_float32x4 v_not (const v_float32x4& a)
|
||||
{
|
||||
return v_float32x4(vreinterpretq_f32_s32(vmvnq_s32(vreinterpretq_s32_f32(a.val))));
|
||||
}
|
||||
@@ -942,7 +968,7 @@ inline v_float32x4 v_sqrt(const v_float32x4& x)
|
||||
inline v_float32x4 v_invsqrt(const v_float32x4& x)
|
||||
{
|
||||
v_float32x4 one = v_setall_f32(1.0f);
|
||||
return one / v_sqrt(x);
|
||||
return v_div(one, v_sqrt(x));
|
||||
}
|
||||
#else
|
||||
inline v_float32x4 v_sqrt(const v_float32x4& x)
|
||||
@@ -975,21 +1001,16 @@ inline v_float32x4 v_abs(v_float32x4 x)
|
||||
|
||||
#if CV_SIMD128_64F
|
||||
#define OPENCV_HAL_IMPL_NEON_DBL_BIT_OP(bin_op, intrin) \
|
||||
inline v_float64x2 operator bin_op (const v_float64x2& a, const v_float64x2& b) \
|
||||
inline v_float64x2 bin_op (const v_float64x2& a, const v_float64x2& b) \
|
||||
{ \
|
||||
return v_float64x2(vreinterpretq_f64_s64(intrin(vreinterpretq_s64_f64(a.val), vreinterpretq_s64_f64(b.val)))); \
|
||||
} \
|
||||
inline v_float64x2& operator bin_op##= (v_float64x2& a, const v_float64x2& b) \
|
||||
{ \
|
||||
a.val = vreinterpretq_f64_s64(intrin(vreinterpretq_s64_f64(a.val), vreinterpretq_s64_f64(b.val))); \
|
||||
return a; \
|
||||
}
|
||||
|
||||
OPENCV_HAL_IMPL_NEON_DBL_BIT_OP(&, vandq_s64)
|
||||
OPENCV_HAL_IMPL_NEON_DBL_BIT_OP(|, vorrq_s64)
|
||||
OPENCV_HAL_IMPL_NEON_DBL_BIT_OP(^, veorq_s64)
|
||||
OPENCV_HAL_IMPL_NEON_DBL_BIT_OP(v_and, vandq_s64)
|
||||
OPENCV_HAL_IMPL_NEON_DBL_BIT_OP(v_or, vorrq_s64)
|
||||
OPENCV_HAL_IMPL_NEON_DBL_BIT_OP(v_xor, veorq_s64)
|
||||
|
||||
inline v_float64x2 operator ~ (const v_float64x2& a)
|
||||
inline v_float64x2 v_not (const v_float64x2& a)
|
||||
{
|
||||
return v_float64x2(vreinterpretq_f64_s32(vmvnq_s32(vreinterpretq_s32_f64(a.val))));
|
||||
}
|
||||
@@ -1002,7 +1023,7 @@ inline v_float64x2 v_sqrt(const v_float64x2& x)
|
||||
inline v_float64x2 v_invsqrt(const v_float64x2& x)
|
||||
{
|
||||
v_float64x2 one = v_setall_f64(1.0f);
|
||||
return one / v_sqrt(x);
|
||||
return v_div(one, v_sqrt(x));
|
||||
}
|
||||
|
||||
inline v_float64x2 v_abs(v_float64x2 x)
|
||||
@@ -1037,17 +1058,17 @@ OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_float64x2, v_max, vmaxq_f64)
|
||||
#endif
|
||||
|
||||
#define OPENCV_HAL_IMPL_NEON_INT_CMP_OP(_Tpvec, cast, suffix, not_suffix) \
|
||||
inline _Tpvec operator == (const _Tpvec& a, const _Tpvec& b) \
|
||||
inline _Tpvec v_eq (const _Tpvec& a, const _Tpvec& b) \
|
||||
{ return _Tpvec(cast(vceqq_##suffix(a.val, b.val))); } \
|
||||
inline _Tpvec operator != (const _Tpvec& a, const _Tpvec& b) \
|
||||
inline _Tpvec v_ne (const _Tpvec& a, const _Tpvec& b) \
|
||||
{ return _Tpvec(cast(vmvnq_##not_suffix(vceqq_##suffix(a.val, b.val)))); } \
|
||||
inline _Tpvec operator < (const _Tpvec& a, const _Tpvec& b) \
|
||||
inline _Tpvec v_lt (const _Tpvec& a, const _Tpvec& b) \
|
||||
{ return _Tpvec(cast(vcltq_##suffix(a.val, b.val))); } \
|
||||
inline _Tpvec operator > (const _Tpvec& a, const _Tpvec& b) \
|
||||
inline _Tpvec v_gt (const _Tpvec& a, const _Tpvec& b) \
|
||||
{ return _Tpvec(cast(vcgtq_##suffix(a.val, b.val))); } \
|
||||
inline _Tpvec operator <= (const _Tpvec& a, const _Tpvec& b) \
|
||||
inline _Tpvec v_le (const _Tpvec& a, const _Tpvec& b) \
|
||||
{ return _Tpvec(cast(vcleq_##suffix(a.val, b.val))); } \
|
||||
inline _Tpvec operator >= (const _Tpvec& a, const _Tpvec& b) \
|
||||
inline _Tpvec v_ge (const _Tpvec& a, const _Tpvec& b) \
|
||||
{ return _Tpvec(cast(vcgeq_##suffix(a.val, b.val))); }
|
||||
|
||||
OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_uint8x16, OPENCV_HAL_NOP, u8, u8)
|
||||
@@ -1065,22 +1086,22 @@ static inline uint64x2_t vmvnq_u64(uint64x2_t a)
|
||||
}
|
||||
//OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_uint64x2, OPENCV_HAL_NOP, u64, u64)
|
||||
//OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_int64x2, vreinterpretq_s64_u64, s64, u64)
|
||||
static inline v_uint64x2 operator == (const v_uint64x2& a, const v_uint64x2& b)
|
||||
static inline v_uint64x2 v_eq (const v_uint64x2& a, const v_uint64x2& b)
|
||||
{ return v_uint64x2(vceqq_u64(a.val, b.val)); }
|
||||
static inline v_uint64x2 operator != (const v_uint64x2& a, const v_uint64x2& b)
|
||||
static inline v_uint64x2 v_ne (const v_uint64x2& a, const v_uint64x2& b)
|
||||
{ return v_uint64x2(vmvnq_u64(vceqq_u64(a.val, b.val))); }
|
||||
static inline v_int64x2 operator == (const v_int64x2& a, const v_int64x2& b)
|
||||
static inline v_int64x2 v_eq (const v_int64x2& a, const v_int64x2& b)
|
||||
{ return v_int64x2(vreinterpretq_s64_u64(vceqq_s64(a.val, b.val))); }
|
||||
static inline v_int64x2 operator != (const v_int64x2& a, const v_int64x2& b)
|
||||
static inline v_int64x2 v_ne (const v_int64x2& a, const v_int64x2& b)
|
||||
{ return v_int64x2(vreinterpretq_s64_u64(vmvnq_u64(vceqq_s64(a.val, b.val)))); }
|
||||
#else
|
||||
static inline v_uint64x2 operator == (const v_uint64x2& a, const v_uint64x2& b)
|
||||
static inline v_uint64x2 v_eq (const v_uint64x2& a, const v_uint64x2& b)
|
||||
{
|
||||
uint32x4_t cmp = vceqq_u32(vreinterpretq_u32_u64(a.val), vreinterpretq_u32_u64(b.val));
|
||||
uint32x4_t swapped = vrev64q_u32(cmp);
|
||||
return v_uint64x2(vreinterpretq_u64_u32(vandq_u32(cmp, swapped)));
|
||||
}
|
||||
static inline v_uint64x2 operator != (const v_uint64x2& a, const v_uint64x2& b)
|
||||
static inline v_uint64x2 v_ne (const v_uint64x2& a, const v_uint64x2& b)
|
||||
{
|
||||
uint32x4_t cmp = vceqq_u32(vreinterpretq_u32_u64(a.val), vreinterpretq_u32_u64(b.val));
|
||||
uint32x4_t swapped = vrev64q_u32(cmp);
|
||||
@@ -1088,13 +1109,13 @@ static inline v_uint64x2 operator != (const v_uint64x2& a, const v_uint64x2& b)
|
||||
uint64x2_t vx = vreinterpretq_u64_u32(vdupq_n_u32(0xFFFFFFFF));
|
||||
return v_uint64x2(veorq_u64(v_eq, vx));
|
||||
}
|
||||
static inline v_int64x2 operator == (const v_int64x2& a, const v_int64x2& b)
|
||||
static inline v_int64x2 v_eq (const v_int64x2& a, const v_int64x2& b)
|
||||
{
|
||||
return v_reinterpret_as_s64(v_reinterpret_as_u64(a) == v_reinterpret_as_u64(b));
|
||||
return v_reinterpret_as_s64(v_eq(v_reinterpret_as_u64(a), v_reinterpret_as_u64(b)));
|
||||
}
|
||||
static inline v_int64x2 operator != (const v_int64x2& a, const v_int64x2& b)
|
||||
static inline v_int64x2 v_ne (const v_int64x2& a, const v_int64x2& b)
|
||||
{
|
||||
return v_reinterpret_as_s64(v_reinterpret_as_u64(a) != v_reinterpret_as_u64(b));
|
||||
return v_reinterpret_as_s64(v_ne(v_reinterpret_as_u64(a), v_reinterpret_as_u64(b)));
|
||||
}
|
||||
#endif
|
||||
#if CV_SIMD128_64F
|
||||
@@ -1207,9 +1228,9 @@ inline v_float64x2 v_muladd(const v_float64x2& a, const v_float64x2& b, const v_
|
||||
|
||||
// trade efficiency for convenience
|
||||
#define OPENCV_HAL_IMPL_NEON_SHIFT_OP(_Tpvec, suffix, _Tps, ssuffix) \
|
||||
inline _Tpvec operator << (const _Tpvec& a, int n) \
|
||||
inline _Tpvec v_shl (const _Tpvec& a, int n) \
|
||||
{ return _Tpvec(vshlq_##suffix(a.val, vdupq_n_##ssuffix((_Tps)n))); } \
|
||||
inline _Tpvec operator >> (const _Tpvec& a, int n) \
|
||||
inline _Tpvec v_shr (const _Tpvec& a, int n) \
|
||||
{ return _Tpvec(vshlq_##suffix(a.val, vdupq_n_##ssuffix((_Tps)-n))); } \
|
||||
template<int n> inline _Tpvec v_shl(const _Tpvec& a) \
|
||||
{ return _Tpvec(vshlq_n_##suffix(a.val, n)); } \
|
||||
@@ -1231,13 +1252,13 @@ OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_int64x2, s64, int64, s64)
|
||||
template<int n> inline _Tpvec v_rotate_right(const _Tpvec& a) \
|
||||
{ return _Tpvec(vextq_##suffix(a.val, vdupq_n_##suffix(0), n)); } \
|
||||
template<int n> inline _Tpvec v_rotate_left(const _Tpvec& a) \
|
||||
{ return _Tpvec(vextq_##suffix(vdupq_n_##suffix(0), a.val, _Tpvec::nlanes - n)); } \
|
||||
{ return _Tpvec(vextq_##suffix(vdupq_n_##suffix(0), a.val, VTraits<_Tpvec>::nlanes - n)); } \
|
||||
template<> inline _Tpvec v_rotate_left<0>(const _Tpvec& a) \
|
||||
{ return a; } \
|
||||
template<int n> inline _Tpvec v_rotate_right(const _Tpvec& a, const _Tpvec& b) \
|
||||
{ return _Tpvec(vextq_##suffix(a.val, b.val, n)); } \
|
||||
template<int n> inline _Tpvec v_rotate_left(const _Tpvec& a, const _Tpvec& b) \
|
||||
{ return _Tpvec(vextq_##suffix(b.val, a.val, _Tpvec::nlanes - n)); } \
|
||||
{ return _Tpvec(vextq_##suffix(b.val, a.val, VTraits<_Tpvec>::nlanes - n)); } \
|
||||
template<> inline _Tpvec v_rotate_left<0>(const _Tpvec& a, const _Tpvec& b) \
|
||||
{ CV_UNUSED(b); return a; }
|
||||
|
||||
|
||||
@@ -358,8 +358,8 @@ static inline void v_store_pair_as(float16_t* ptr, const v_float64& a, const v_f
|
||||
|
||||
static inline void vx_load_as(const double* ptr, v_float32& a)
|
||||
{
|
||||
const int VECSZ = v_float32::nlanes;
|
||||
float buf[VECSZ*2];
|
||||
const int VECSZ = VTraits<v_float32>::vlanes();
|
||||
float buf[VTraits<v_float32>::max_nlanes*2];
|
||||
|
||||
for( int i = 0; i < VECSZ; i++ )
|
||||
buf[i] = saturate_cast<float>(ptr[i]);
|
||||
@@ -369,19 +369,19 @@ static inline void vx_load_as(const double* ptr, v_float32& a)
|
||||
template<typename _Tdvec>
|
||||
static inline void vx_load_pair_as(const double* ptr, _Tdvec& a, _Tdvec& b)
|
||||
{
|
||||
const int VECSZ = _Tdvec::nlanes;
|
||||
typename _Tdvec::lane_type buf[VECSZ*2];
|
||||
const int VECSZ = VTraits<_Tdvec>::vlanes();
|
||||
typename VTraits<_Tdvec>::lane_type buf[VTraits<_Tdvec>::max_nlanes*2];
|
||||
|
||||
for( int i = 0; i < VECSZ*2; i++ )
|
||||
buf[i] = saturate_cast<typename _Tdvec::lane_type>(ptr[i]);
|
||||
buf[i] = saturate_cast<typename VTraits<_Tdvec>::lane_type>(ptr[i]);
|
||||
a = vx_load(buf);
|
||||
b = vx_load(buf + VECSZ);
|
||||
}
|
||||
|
||||
static inline void v_store_as(double* ptr, const v_float32& a)
|
||||
{
|
||||
const int VECSZ = v_float32::nlanes;
|
||||
float buf[VECSZ];
|
||||
const int VECSZ = VTraits<v_float32>::vlanes();
|
||||
float buf[VTraits<v_float32>::max_nlanes];
|
||||
|
||||
v_store(buf, a);
|
||||
for( int i = 0; i < VECSZ; i++ )
|
||||
@@ -391,8 +391,8 @@ static inline void v_store_as(double* ptr, const v_float32& a)
|
||||
template<typename _Tsvec>
|
||||
static inline void v_store_pair_as(double* ptr, const _Tsvec& a, const _Tsvec& b)
|
||||
{
|
||||
const int VECSZ = _Tsvec::nlanes;
|
||||
typename _Tsvec::lane_type buf[VECSZ*2];
|
||||
const int VECSZ = VTraits<_Tsvec>::vlanes();
|
||||
typename VTraits<_Tsvec>::lane_type buf[VTraits<_Tsvec>::max_nlanes*2];
|
||||
|
||||
v_store(buf, a); v_store(buf + VECSZ, b);
|
||||
for( int i = 0; i < VECSZ*2; i++ )
|
||||
|
||||
@@ -93,13 +93,13 @@ struct v_atan_f32
|
||||
{
|
||||
v_float32 ax = v_abs(x);
|
||||
v_float32 ay = v_abs(y);
|
||||
v_float32 c = v_min(ax, ay) / (v_max(ax, ay) + eps);
|
||||
v_float32 cc = c * c;
|
||||
v_float32 a = v_fma(v_fma(v_fma(cc, p7, p5), cc, p3), cc, p1)*c;
|
||||
a = v_select(ax >= ay, a, val90 - a);
|
||||
a = v_select(x < z, val180 - a, a);
|
||||
a = v_select(y < z, val360 - a, a);
|
||||
return a * s;
|
||||
v_float32 c = v_div(v_min(ax, ay), v_add(v_max(ax, ay), this->eps));
|
||||
v_float32 cc = v_mul(c, c);
|
||||
v_float32 a = v_mul(v_fma(v_fma(v_fma(cc, this->p7, this->p5), cc, this->p3), cc, this->p1), c);
|
||||
a = v_select(v_ge(ax, ay), a, v_sub(this->val90, a));
|
||||
a = v_select(v_lt(x, this->z), v_sub(this->val180, a), a);
|
||||
a = v_select(v_lt(y, this->z), v_sub(this->val360, a), a);
|
||||
return v_mul(a, this->s);
|
||||
}
|
||||
|
||||
v_float32 eps;
|
||||
@@ -125,7 +125,7 @@ static void fastAtan32f_(const float *Y, const float *X, float *angle, int len,
|
||||
float scale = angleInDegrees ? 1.f : (float)(CV_PI/180);
|
||||
int i = 0;
|
||||
#if CV_SIMD
|
||||
const int VECSZ = v_float32::nlanes;
|
||||
const int VECSZ = VTraits<v_float32>::vlanes();
|
||||
v_atan_f32 v(scale);
|
||||
|
||||
for( ; i < len; i += VECSZ*2 )
|
||||
@@ -198,7 +198,7 @@ void magnitude32f(const float* x, const float* y, float* mag, int len)
|
||||
int i = 0;
|
||||
|
||||
#if CV_SIMD
|
||||
const int VECSZ = v_float32::nlanes;
|
||||
const int VECSZ = VTraits<v_float32>::vlanes();
|
||||
for( ; i < len; i += VECSZ*2 )
|
||||
{
|
||||
if( i + VECSZ*2 > len )
|
||||
@@ -209,8 +209,8 @@ void magnitude32f(const float* x, const float* y, float* mag, int len)
|
||||
}
|
||||
v_float32 x0 = vx_load(x + i), x1 = vx_load(x + i + VECSZ);
|
||||
v_float32 y0 = vx_load(y + i), y1 = vx_load(y + i + VECSZ);
|
||||
x0 = v_sqrt(v_muladd(x0, x0, y0*y0));
|
||||
x1 = v_sqrt(v_muladd(x1, x1, y1*y1));
|
||||
x0 = v_sqrt(v_muladd(x0, x0, v_mul(y0, y0)));
|
||||
x1 = v_sqrt(v_muladd(x1, x1, v_mul(y1, y1)));
|
||||
v_store(mag + i, x0);
|
||||
v_store(mag + i + VECSZ, x1);
|
||||
}
|
||||
@@ -231,7 +231,7 @@ void magnitude64f(const double* x, const double* y, double* mag, int len)
|
||||
int i = 0;
|
||||
|
||||
#if CV_SIMD_64F
|
||||
const int VECSZ = v_float64::nlanes;
|
||||
const int VECSZ = VTraits<v_float64>::vlanes();
|
||||
for( ; i < len; i += VECSZ*2 )
|
||||
{
|
||||
if( i + VECSZ*2 > len )
|
||||
@@ -242,8 +242,8 @@ void magnitude64f(const double* x, const double* y, double* mag, int len)
|
||||
}
|
||||
v_float64 x0 = vx_load(x + i), x1 = vx_load(x + i + VECSZ);
|
||||
v_float64 y0 = vx_load(y + i), y1 = vx_load(y + i + VECSZ);
|
||||
x0 = v_sqrt(v_muladd(x0, x0, y0*y0));
|
||||
x1 = v_sqrt(v_muladd(x1, x1, y1*y1));
|
||||
x0 = v_sqrt(v_muladd(x0, x0, v_mul(y0, y0)));
|
||||
x1 = v_sqrt(v_muladd(x1, x1, v_mul(y1, y1)));
|
||||
v_store(mag + i, x0);
|
||||
v_store(mag + i + VECSZ, x1);
|
||||
}
|
||||
@@ -265,7 +265,7 @@ void invSqrt32f(const float* src, float* dst, int len)
|
||||
int i = 0;
|
||||
|
||||
#if CV_SIMD
|
||||
const int VECSZ = v_float32::nlanes;
|
||||
const int VECSZ = VTraits<v_float32>::vlanes();
|
||||
for( ; i < len; i += VECSZ*2 )
|
||||
{
|
||||
if( i + VECSZ*2 > len )
|
||||
@@ -293,7 +293,7 @@ void invSqrt64f(const double* src, double* dst, int len)
|
||||
int i = 0;
|
||||
|
||||
#if CV_SIMD_64F
|
||||
const int VECSZ = v_float64::nlanes;
|
||||
const int VECSZ = VTraits<v_float64>::vlanes();
|
||||
for ( ; i < len; i += VECSZ*2)
|
||||
{
|
||||
if( i + VECSZ*2 > len )
|
||||
@@ -321,7 +321,7 @@ void sqrt32f(const float* src, float* dst, int len)
|
||||
int i = 0;
|
||||
|
||||
#if CV_SIMD
|
||||
const int VECSZ = v_float32::nlanes;
|
||||
const int VECSZ = VTraits<v_float32>::vlanes();
|
||||
for( ; i < len; i += VECSZ*2 )
|
||||
{
|
||||
if( i + VECSZ*2 > len )
|
||||
@@ -350,7 +350,7 @@ void sqrt64f(const double* src, double* dst, int len)
|
||||
int i = 0;
|
||||
|
||||
#if CV_SIMD_64F
|
||||
const int VECSZ = v_float64::nlanes;
|
||||
const int VECSZ = VTraits<v_float64>::vlanes();
|
||||
for( ; i < len; i += VECSZ*2 )
|
||||
{
|
||||
if( i + VECSZ*2 > len )
|
||||
@@ -452,7 +452,7 @@ void exp32f( const float *_x, float *y, int n )
|
||||
float postscale = (float)exp_postscale;
|
||||
|
||||
#if CV_SIMD
|
||||
const int VECSZ = v_float32::nlanes;
|
||||
const int VECSZ = VTraits<v_float32>::vlanes();
|
||||
const v_float32 vprescale = vx_setall_f32((float)exp_prescale);
|
||||
const v_float32 vpostscale = vx_setall_f32((float)exp_postscale);
|
||||
const v_float32 vminval = vx_setall_f32(minval);
|
||||
@@ -481,26 +481,26 @@ void exp32f( const float *_x, float *y, int n )
|
||||
xf0 = v_min(v_max(xf0, vminval), vmaxval);
|
||||
xf1 = v_min(v_max(xf1, vminval), vmaxval);
|
||||
|
||||
xf0 *= vprescale;
|
||||
xf1 *= vprescale;
|
||||
xf0 = v_mul(xf0, vprescale);
|
||||
xf1 = v_mul(xf1, vprescale);
|
||||
|
||||
v_int32 xi0 = v_round(xf0);
|
||||
v_int32 xi1 = v_round(xf1);
|
||||
xf0 = (xf0 - v_cvt_f32(xi0))*vpostscale;
|
||||
xf1 = (xf1 - v_cvt_f32(xi1))*vpostscale;
|
||||
xf0 = v_mul(v_sub(xf0, v_cvt_f32(xi0)), vpostscale);
|
||||
xf1 = v_mul(v_sub(xf1, v_cvt_f32(xi1)), vpostscale);
|
||||
|
||||
v_float32 yf0 = v_lut(expTab_f, xi0 & vidxmask);
|
||||
v_float32 yf1 = v_lut(expTab_f, xi1 & vidxmask);
|
||||
v_float32 yf0 = v_lut(expTab_f, v_and(xi0, vidxmask));
|
||||
v_float32 yf1 = v_lut(expTab_f, v_and(xi1, vidxmask));
|
||||
|
||||
v_int32 v0 = vx_setzero_s32(), v127 = vx_setall_s32(127), v255 = vx_setall_s32(255);
|
||||
xi0 = v_min(v_max(v_shr<EXPTAB_SCALE>(xi0) + v127, v0), v255);
|
||||
xi1 = v_min(v_max(v_shr<EXPTAB_SCALE>(xi1) + v127, v0), v255);
|
||||
xi0 = v_min(v_max(v_add(v_shr<6>(xi0), v127), v0), v255);
|
||||
xi1 = v_min(v_max(v_add(v_shr<6>(xi1), v127), v0), v255);
|
||||
|
||||
yf0 *= v_reinterpret_as_f32(v_shl<23>(xi0));
|
||||
yf1 *= v_reinterpret_as_f32(v_shl<23>(xi1));
|
||||
yf0 = v_mul(yf0, v_reinterpret_as_f32(v_shl<23>(xi0)));
|
||||
yf1 = v_mul(yf1, v_reinterpret_as_f32(v_shl<23>(xi1)));
|
||||
|
||||
v_float32 zf0 = xf0 + vA1;
|
||||
v_float32 zf1 = xf1 + vA1;
|
||||
v_float32 zf0 = v_add(xf0, vA1);
|
||||
v_float32 zf1 = v_add(xf1, vA1);
|
||||
|
||||
zf0 = v_fma(zf0, xf0, vA2);
|
||||
zf1 = v_fma(zf1, xf1, vA2);
|
||||
@@ -511,8 +511,8 @@ void exp32f( const float *_x, float *y, int n )
|
||||
zf0 = v_fma(zf0, xf0, vA4);
|
||||
zf1 = v_fma(zf1, xf1, vA4);
|
||||
|
||||
zf0 *= yf0;
|
||||
zf1 *= yf1;
|
||||
zf0 = v_mul(zf0, yf0);
|
||||
zf1 = v_mul(zf1, yf1);
|
||||
|
||||
if( y_aligned )
|
||||
{
|
||||
@@ -566,7 +566,7 @@ void exp64f( const double *_x, double *y, int n )
|
||||
double maxval = (exp_max_val/exp_prescale);
|
||||
|
||||
#if CV_SIMD_64F
|
||||
const int VECSZ = v_float64::nlanes;
|
||||
const int VECSZ = VTraits<v_float64>::vlanes();
|
||||
const v_float64 vprescale = vx_setall_f64(exp_prescale);
|
||||
const v_float64 vpostscale = vx_setall_f64(exp_postscale);
|
||||
const v_float64 vminval = vx_setall_f64(minval);
|
||||
@@ -596,30 +596,30 @@ void exp64f( const double *_x, double *y, int n )
|
||||
xf0 = v_min(v_max(xf0, vminval), vmaxval);
|
||||
xf1 = v_min(v_max(xf1, vminval), vmaxval);
|
||||
|
||||
xf0 *= vprescale;
|
||||
xf1 *= vprescale;
|
||||
xf0 = v_mul(xf0, vprescale);
|
||||
xf1 = v_mul(xf1, vprescale);
|
||||
|
||||
v_int32 xi0 = v_round(xf0);
|
||||
v_int32 xi1 = v_round(xf1);
|
||||
xf0 = (xf0 - v_cvt_f64(xi0))*vpostscale;
|
||||
xf1 = (xf1 - v_cvt_f64(xi1))*vpostscale;
|
||||
xf0 = v_mul(v_sub(xf0, v_cvt_f64(xi0)), vpostscale);
|
||||
xf1 = v_mul(v_sub(xf1, v_cvt_f64(xi1)), vpostscale);
|
||||
|
||||
v_float64 yf0 = v_lut(expTab, xi0 & vidxmask);
|
||||
v_float64 yf1 = v_lut(expTab, xi1 & vidxmask);
|
||||
v_float64 yf0 = v_lut(expTab, v_and(xi0, vidxmask));
|
||||
v_float64 yf1 = v_lut(expTab, v_and(xi1, vidxmask));
|
||||
|
||||
v_int32 v0 = vx_setzero_s32(), v1023 = vx_setall_s32(1023), v2047 = vx_setall_s32(2047);
|
||||
xi0 = v_min(v_max(v_shr<EXPTAB_SCALE>(xi0) + v1023, v0), v2047);
|
||||
xi1 = v_min(v_max(v_shr<EXPTAB_SCALE>(xi1) + v1023, v0), v2047);
|
||||
xi0 = v_min(v_max(v_add(v_shr<6>(xi0), v1023), v0), v2047);
|
||||
xi1 = v_min(v_max(v_add(v_shr<6>(xi1), v1023), v0), v2047);
|
||||
|
||||
v_int64 xq0, xq1, dummy;
|
||||
v_expand(xi0, xq0, dummy);
|
||||
v_expand(xi1, xq1, dummy);
|
||||
|
||||
yf0 *= v_reinterpret_as_f64(v_shl<52>(xq0));
|
||||
yf1 *= v_reinterpret_as_f64(v_shl<52>(xq1));
|
||||
yf0 = v_mul(yf0, v_reinterpret_as_f64(v_shl<52>(xq0)));
|
||||
yf1 = v_mul(yf1, v_reinterpret_as_f64(v_shl<52>(xq1)));
|
||||
|
||||
v_float64 zf0 = xf0 + vA1;
|
||||
v_float64 zf1 = xf1 + vA1;
|
||||
v_float64 zf0 = v_add(xf0, vA1);
|
||||
v_float64 zf1 = v_add(xf1, vA1);
|
||||
|
||||
zf0 = v_fma(zf0, xf0, vA2);
|
||||
zf1 = v_fma(zf1, xf1, vA2);
|
||||
@@ -633,8 +633,8 @@ void exp64f( const double *_x, double *y, int n )
|
||||
zf0 = v_fma(zf0, xf0, vA5);
|
||||
zf1 = v_fma(zf1, xf1, vA5);
|
||||
|
||||
zf0 *= yf0;
|
||||
zf1 *= yf1;
|
||||
zf0 = v_mul(zf0, yf0);
|
||||
zf1 = v_mul(zf1, yf1);
|
||||
|
||||
if( y_aligned )
|
||||
{
|
||||
@@ -696,7 +696,7 @@ void log32f( const float *_x, float *y, int n )
|
||||
const int* x = (const int*)_x;
|
||||
|
||||
#if CV_SIMD
|
||||
const int VECSZ = v_float32::nlanes;
|
||||
const int VECSZ = VTraits<v_float32>::vlanes();
|
||||
const v_float32 vln2 = vx_setall_f32((float)ln_2);
|
||||
const v_float32 v1 = vx_setall_f32(1.f);
|
||||
const v_float32 vshift = vx_setall_f32(-1.f/512);
|
||||
@@ -715,18 +715,18 @@ void log32f( const float *_x, float *y, int n )
|
||||
}
|
||||
|
||||
v_int32 h0 = vx_load(x + i);
|
||||
v_int32 yi0 = (v_shr<23>(h0) & vx_setall_s32(255)) - vx_setall_s32(127);
|
||||
v_int32 xi0 = (h0 & vx_setall_s32(LOGTAB_MASK2_32F)) | vx_setall_s32(127 << 23);
|
||||
v_int32 yi0 = v_sub(v_and(v_shr<23>(h0), vx_setall_s32(255)), vx_setall_s32(127));
|
||||
v_int32 xi0 = v_or(v_and(h0, vx_setall_s32(LOGTAB_MASK2_32F)), vx_setall_s32(127 << 23));
|
||||
|
||||
h0 = v_shr<23 - LOGTAB_SCALE - 1>(h0) & vx_setall_s32(LOGTAB_MASK*2);
|
||||
h0 = v_and(v_shr<23 - 8 - 1>(h0), vx_setall_s32(((1 << 8) - 1) * 2));
|
||||
v_float32 yf0, xf0;
|
||||
|
||||
v_lut_deinterleave(logTab_f, h0, yf0, xf0);
|
||||
|
||||
yf0 = v_fma(v_cvt_f32(yi0), vln2, yf0);
|
||||
|
||||
v_float32 delta = v_select(v_reinterpret_as_f32(h0 == vx_setall_s32(510)), vshift, vx_setall<float>(0));
|
||||
xf0 = v_fma((v_reinterpret_as_f32(xi0) - v1), xf0, delta);
|
||||
v_float32 delta = v_select(v_reinterpret_as_f32(v_eq(h0, vx_setall_s32(510))), vshift, vx_setall<float>(0));
|
||||
xf0 = v_fma((v_sub(v_reinterpret_as_f32(xi0), v1)), xf0, delta);
|
||||
|
||||
v_float32 zf0 = v_fma(xf0, vA0, vA1);
|
||||
zf0 = v_fma(zf0, xf0, vA2);
|
||||
@@ -771,7 +771,7 @@ void log64f( const double *x, double *y, int n )
|
||||
int i = 0;
|
||||
|
||||
#if CV_SIMD_64F
|
||||
const int VECSZ = v_float64::nlanes;
|
||||
const int VECSZ = VTraits<v_float64>::vlanes();
|
||||
const v_float64 vln2 = vx_setall_f64(ln_2);
|
||||
|
||||
const v_float64
|
||||
@@ -791,20 +791,20 @@ void log64f( const double *x, double *y, int n )
|
||||
|
||||
v_int64 h0 = vx_load((const int64*)x + i);
|
||||
v_int32 yi0 = v_pack(v_shr<52>(h0), vx_setzero_s64());
|
||||
yi0 = (yi0 & vx_setall_s32(0x7ff)) - vx_setall_s32(1023);
|
||||
yi0 = v_sub(v_and(yi0, vx_setall_s32(2047)), vx_setall_s32(1023));
|
||||
|
||||
v_int64 xi0 = (h0 & vx_setall_s64(LOGTAB_MASK2_64F)) | vx_setall_s64((int64)1023 << 52);
|
||||
v_int64 xi0 = v_or(v_and(h0, vx_setall_s64(LOGTAB_MASK2_64F)), vx_setall_s64((int64)1023 << 52));
|
||||
h0 = v_shr<52 - LOGTAB_SCALE - 1>(h0);
|
||||
v_int32 idx = v_pack(h0, h0) & vx_setall_s32(LOGTAB_MASK*2);
|
||||
v_int32 idx = v_and(v_pack(h0, h0), vx_setall_s32(((1 << 8) - 1) * 2));
|
||||
|
||||
v_float64 xf0, yf0;
|
||||
v_lut_deinterleave(logTab, idx, yf0, xf0);
|
||||
|
||||
yf0 = v_fma(v_cvt_f64(yi0), vln2, yf0);
|
||||
v_float64 delta = v_cvt_f64(idx == vx_setall_s32(510))*vx_setall_f64(1./512);
|
||||
xf0 = v_fma(v_reinterpret_as_f64(xi0) - vx_setall_f64(1.), xf0, delta);
|
||||
v_float64 delta = v_mul(v_cvt_f64(v_eq(idx, vx_setall_s32(510))), vx_setall_f64(1. / 512));
|
||||
xf0 = v_fma(v_sub(v_reinterpret_as_f64(xi0), vx_setall_f64(1.)), xf0, delta);
|
||||
|
||||
v_float64 xq = xf0*xf0;
|
||||
v_float64 xq = v_mul(xf0, xf0);
|
||||
v_float64 zf0 = v_fma(xq, vA0, vA2);
|
||||
v_float64 zf1 = v_fma(xq, vA1, vA3);
|
||||
zf0 = v_fma(zf0, xq, vA4);
|
||||
|
||||
@@ -1584,7 +1584,7 @@ transform_16u( const ushort* src, ushort* dst, const float* m, int len, int scn,
|
||||
v_float32x4 _m2h = v_rotate_left<1>(_m2l);
|
||||
v_float32x4 _m3h = v_rotate_left<1>(_m3l);
|
||||
v_int16x8 _delta(0, -32768, -32768, -32768, -32768, -32768, -32768, 0);
|
||||
for( ; x <= len*3 - v_uint16x8::nlanes; x += 3*v_uint16x8::nlanes/4 )
|
||||
for( ; x <= len*3 - VTraits<v_uint16x8>::vlanes(); x += 3*VTraits<v_uint16x8>::vlanes()/4 )
|
||||
v_store(dst + x, v_rotate_right<1>(v_reinterpret_as_u16(v_add_wrap(v_pack(
|
||||
v_round(v_matmuladd(v_cvt_f32(v_reinterpret_as_s32(v_load_expand(src + x ))), _m0h, _m1h, _m2h, _m3h)),
|
||||
v_round(v_matmuladd(v_cvt_f32(v_reinterpret_as_s32(v_load_expand(src + x + 3))), _m0l, _m1l, _m2l, _m3l))), _delta))));
|
||||
@@ -1664,10 +1664,10 @@ transform_32f( const float* src, float* dst, const float* m, int len, int scn, i
|
||||
v_float32x4 _m2 = v_load(m + 10);
|
||||
v_float32x4 _m3 = v_load(m + 15);
|
||||
v_float32x4 _m4(m[4], m[9], m[14], m[19]);
|
||||
for( ; x < len*4; x += v_float32x4::nlanes )
|
||||
for( ; x < len*4; x += VTraits<v_float32x4>::vlanes() )
|
||||
{
|
||||
v_float32x4 v_src = v_load(src + x);
|
||||
v_store(dst + x, v_reduce_sum4(v_src * _m0, v_src * _m1, v_src * _m2, v_src * _m3) + _m4);
|
||||
v_store(dst + x, v_add(v_reduce_sum4(v_mul(v_src, _m0), v_mul(v_src, _m1), v_mul(v_src, _m2), v_mul(v_src, _m3)), _m4));
|
||||
}
|
||||
#else // CV_SIMD_WIDTH >= 16 && !CV_SIMD128
|
||||
for( ; x < len*4; x += 4 )
|
||||
@@ -2113,12 +2113,12 @@ MulTransposedR(const Mat& srcmat, const Mat& dstmat, const Mat& deltamat, double
|
||||
for( k = 0; k < size.height; k++, tsrc += srcstep )
|
||||
{
|
||||
v_float64x2 a = v_setall_f64((double)col_buf[k]);
|
||||
s0 += a * v_load(tsrc+0);
|
||||
s1 += a * v_load(tsrc+2);
|
||||
s0 = v_add(s0, v_mul(a, v_load(tsrc + 0)));
|
||||
s1 = v_add(s1, v_mul(a, v_load(tsrc + 2)));
|
||||
}
|
||||
|
||||
v_store((double*)(tdst+j), s0*v_scale);
|
||||
v_store((double*)(tdst+j+2), s1*v_scale);
|
||||
v_store((double*)(tdst+j), v_mul(s0, v_scale));
|
||||
v_store((double*)(tdst+j+2), v_mul(s1, v_scale));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@@ -2174,12 +2174,12 @@ MulTransposedR(const Mat& srcmat, const Mat& dstmat, const Mat& deltamat, double
|
||||
for( k = 0; k < size.height; k++, tsrc+=srcstep, d+=deltastep )
|
||||
{
|
||||
v_float64x2 a = v_setall_f64((double)col_buf[k]);
|
||||
s0 += a * (v_load(tsrc+0) - v_load(d+0));
|
||||
s1 += a * (v_load(tsrc+2) - v_load(d+2));
|
||||
s0 = v_add(s0, v_mul(a, v_sub(v_load(tsrc + 0), v_load(d + 0))));
|
||||
s1 = v_add(s1, v_mul(a, v_sub(v_load(tsrc + 2), v_load(d + 2))));
|
||||
}
|
||||
|
||||
v_store((double*)(tdst+j), s0*v_scale);
|
||||
v_store((double*)(tdst+j+2), s1*v_scale);
|
||||
v_store((double*)(tdst+j), v_mul(s0, v_scale));
|
||||
v_store((double*)(tdst+j+2), v_mul(s1, v_scale));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -2249,8 +2249,7 @@ MulTransposedL(const Mat& srcmat, const Mat& dstmat, const Mat& deltamat, double
|
||||
v_float64x2 v_s = v_setzero_f64();
|
||||
|
||||
for( k = 0; k <= size.width - 4; k += 4 )
|
||||
v_s += (v_load(v_tsrc1+k) * v_load(v_tsrc2+k)) +
|
||||
(v_load(v_tsrc1+k+2) * v_load(v_tsrc2+k+2));
|
||||
v_s = v_add(v_s, v_add(v_mul(v_load(v_tsrc1 + k), v_load(v_tsrc2 + k)), v_mul(v_load(v_tsrc1 + k + 2), v_load(v_tsrc2 + k + 2))));
|
||||
s += v_reduce_sum(v_s);
|
||||
}
|
||||
else
|
||||
@@ -2303,8 +2302,7 @@ MulTransposedL(const Mat& srcmat, const Mat& dstmat, const Mat& deltamat, double
|
||||
v_float64x2 v_s = v_setzero_f64();
|
||||
|
||||
for( k = 0; k <= size.width - 4; k += 4, v_tdelta2 += delta_shift )
|
||||
v_s += ((v_load(v_tsrc2+k) - v_load(v_tdelta2)) * v_load(v_row_buf+k)) +
|
||||
((v_load(v_tsrc2+k+2) - v_load(v_tdelta2+2)) * v_load(v_row_buf+k+2));
|
||||
v_s = v_add(v_s, v_add(v_mul(v_sub(v_load(v_tsrc2 + k), v_load(v_tdelta2)), v_load(v_row_buf + k)), v_mul(v_sub(v_load(v_tsrc2 + k + 2), v_load(v_tdelta2 + 2)), v_load(v_row_buf + k + 2))));
|
||||
s += v_reduce_sum(v_s);
|
||||
|
||||
tdelta2 = (const dT *)(v_tdelta2);
|
||||
@@ -2566,7 +2564,7 @@ double dotProd_32s(const int* src1, const int* src2, int len)
|
||||
v_sum0 = v_dotprod_expand_fast(v_src10, v_src20, v_sum0);
|
||||
v_sum1 = v_dotprod_expand_fast(v_src11, v_src21, v_sum1);
|
||||
}
|
||||
v_sum0 += v_sum1;
|
||||
v_sum0 = v_add(v_sum0, v_sum1);
|
||||
#endif
|
||||
for (; i < len - step; i += step, src1 += step, src2 += step)
|
||||
{
|
||||
|
||||
@@ -356,10 +356,10 @@ void transposeND(InputArray src_, const std::vector<int>& order, OutputArray dst
|
||||
#if CV_SIMD128
|
||||
template<typename V> CV_ALWAYS_INLINE void flipHoriz_single( const uchar* src, size_t sstep, uchar* dst, size_t dstep, Size size, size_t esz )
|
||||
{
|
||||
typedef typename V::lane_type T;
|
||||
typedef typename VTraits<V>::lane_type T;
|
||||
int end = (int)(size.width*esz);
|
||||
int width = (end + 1)/2;
|
||||
int width_1 = width & -v_uint8x16::nlanes;
|
||||
int width_1 = width & -VTraits<v_uint8x16>::vlanes();
|
||||
int i, j;
|
||||
|
||||
#if CV_STRONG_ALIGNMENT
|
||||
@@ -368,15 +368,15 @@ template<typename V> CV_ALWAYS_INLINE void flipHoriz_single( const uchar* src, s
|
||||
|
||||
for( ; size.height--; src += sstep, dst += dstep )
|
||||
{
|
||||
for( i = 0, j = end; i < width_1; i += v_uint8x16::nlanes, j -= v_uint8x16::nlanes )
|
||||
for( i = 0, j = end; i < width_1; i += VTraits<v_uint8x16>::vlanes(), j -= VTraits<v_uint8x16>::vlanes() )
|
||||
{
|
||||
V t0, t1;
|
||||
|
||||
t0 = v_load((T*)((uchar*)src + i));
|
||||
t1 = v_load((T*)((uchar*)src + j - v_uint8x16::nlanes));
|
||||
t1 = v_load((T*)((uchar*)src + j - VTraits<v_uint8x16>::vlanes()));
|
||||
t0 = v_reverse(t0);
|
||||
t1 = v_reverse(t1);
|
||||
v_store((T*)(dst + j - v_uint8x16::nlanes), t0);
|
||||
v_store((T*)(dst + j - VTraits<v_uint8x16>::vlanes()), t0);
|
||||
v_store((T*)(dst + i), t1);
|
||||
}
|
||||
if (isAligned<sizeof(T)>(src, dst))
|
||||
@@ -446,14 +446,14 @@ flipHoriz( const uchar* src, size_t sstep, uchar* dst, size_t dstep, Size size,
|
||||
#if CV_STRONG_ALIGNMENT
|
||||
size_t alignmentMark = ((size_t)src)|((size_t)dst)|sstep|dstep;
|
||||
#endif
|
||||
if (esz == 2 * v_uint8x16::nlanes)
|
||||
if (esz == 2 * (size_t)VTraits<v_uint8x16>::vlanes())
|
||||
{
|
||||
int end = (int)(size.width*esz);
|
||||
int width = end/2;
|
||||
|
||||
for( ; size.height--; src += sstep, dst += dstep )
|
||||
{
|
||||
for( int i = 0, j = end - 2 * v_uint8x16::nlanes; i < width; i += 2 * v_uint8x16::nlanes, j -= 2 * v_uint8x16::nlanes )
|
||||
for( int i = 0, j = end - 2 * VTraits<v_uint8x16>::vlanes(); i < width; i += 2 * VTraits<v_uint8x16>::vlanes(), j -= 2 * VTraits<v_uint8x16>::vlanes() )
|
||||
{
|
||||
#if CV_SIMD256
|
||||
v_uint8x32 t0, t1;
|
||||
@@ -466,25 +466,25 @@ flipHoriz( const uchar* src, size_t sstep, uchar* dst, size_t dstep, Size size,
|
||||
v_uint8x16 t0, t1, t2, t3;
|
||||
|
||||
t0 = v_load((uchar*)src + i);
|
||||
t1 = v_load((uchar*)src + i + v_uint8x16::nlanes);
|
||||
t1 = v_load((uchar*)src + i + VTraits<v_uint8x16>::vlanes());
|
||||
t2 = v_load((uchar*)src + j);
|
||||
t3 = v_load((uchar*)src + j + v_uint8x16::nlanes);
|
||||
t3 = v_load((uchar*)src + j + VTraits<v_uint8x16>::vlanes());
|
||||
v_store(dst + j, t0);
|
||||
v_store(dst + j + v_uint8x16::nlanes, t1);
|
||||
v_store(dst + j + VTraits<v_uint8x16>::vlanes(), t1);
|
||||
v_store(dst + i, t2);
|
||||
v_store(dst + i + v_uint8x16::nlanes, t3);
|
||||
v_store(dst + i + VTraits<v_uint8x16>::vlanes(), t3);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (esz == v_uint8x16::nlanes)
|
||||
else if (esz == (size_t)VTraits<v_uint8x16>::vlanes())
|
||||
{
|
||||
int end = (int)(size.width*esz);
|
||||
int width = end/2;
|
||||
|
||||
for( ; size.height--; src += sstep, dst += dstep )
|
||||
{
|
||||
for( int i = 0, j = end - v_uint8x16::nlanes; i < width; i += v_uint8x16::nlanes, j -= v_uint8x16::nlanes )
|
||||
for( int i = 0, j = end - VTraits<v_uint8x16>::vlanes(); i < width; i += VTraits<v_uint8x16>::vlanes(), j -= VTraits<v_uint8x16>::vlanes() )
|
||||
{
|
||||
v_uint8x16 t0, t1;
|
||||
|
||||
@@ -534,19 +534,19 @@ flipHoriz( const uchar* src, size_t sstep, uchar* dst, size_t dstep, Size size,
|
||||
|
||||
for( ; size.height--; src += sstep, dst += dstep )
|
||||
{
|
||||
for ( int i = 0, j = end; i < width; i += v_uint8x16::nlanes + sizeof(uint64_t), j -= v_uint8x16::nlanes + sizeof(uint64_t) )
|
||||
for ( int i = 0, j = end; i < width; i += VTraits<v_uint8x16>::vlanes() + sizeof(uint64_t), j -= VTraits<v_uint8x16>::vlanes() + sizeof(uint64_t) )
|
||||
{
|
||||
v_uint8x16 t0, t1;
|
||||
uint64_t t2, t3;
|
||||
|
||||
t0 = v_load((uchar*)src + i);
|
||||
t2 = *((uint64_t*)((uchar*)src + i + v_uint8x16::nlanes));
|
||||
t1 = v_load((uchar*)src + j - v_uint8x16::nlanes - sizeof(uint64_t));
|
||||
t2 = *((uint64_t*)((uchar*)src + i + VTraits<v_uint8x16>::vlanes()));
|
||||
t1 = v_load((uchar*)src + j - VTraits<v_uint8x16>::vlanes() - sizeof(uint64_t));
|
||||
t3 = *((uint64_t*)((uchar*)src + j - sizeof(uint64_t)));
|
||||
v_store(dst + j - v_uint8x16::nlanes - sizeof(uint64_t), t0);
|
||||
v_store(dst + j - VTraits<v_uint8x16>::vlanes() - sizeof(uint64_t), t0);
|
||||
*((uint64_t*)(dst + j - sizeof(uint64_t))) = t2;
|
||||
v_store(dst + i, t1);
|
||||
*((uint64_t*)(dst + i + v_uint8x16::nlanes)) = t3;
|
||||
*((uint64_t*)(dst + i + VTraits<v_uint8x16>::vlanes())) = t3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+135
-135
@@ -141,7 +141,7 @@ CV_ALWAYS_INLINE uint64_t v_reduce_min(const v_uint64x2& a)
|
||||
|
||||
CV_ALWAYS_INLINE v_uint64x2 v_select(const v_uint64x2& mask, const v_uint64x2& a, const v_uint64x2& b)
|
||||
{
|
||||
return b ^ ((a ^ b) & mask);
|
||||
return v_xor(b, v_and(v_xor(a, b), mask));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -151,16 +151,16 @@ minMaxIdx_reduce_##suffix( VT &valMin, VT &valMax, IT &idxMin, IT &idxMax, IT &n
|
||||
T &minVal, T &maxVal, size_t &minIdx, size_t &maxIdx, \
|
||||
size_t delta ) \
|
||||
{ \
|
||||
if ( v_check_any(idxMin != none) ) \
|
||||
if ( v_check_any(v_ne(idxMin, none)) ) \
|
||||
{ \
|
||||
minVal = v_reduce_min(valMin); \
|
||||
minIdx = (size_t)v_reduce_min(v_select(v_reinterpret_as_##suffix2(v_setall_##suffix((IR)minVal) == valMin), \
|
||||
minIdx = (size_t)v_reduce_min(v_select(v_reinterpret_as_##suffix2(v_eq(v_setall_##suffix((IR)minVal), valMin)), \
|
||||
idxMin, v_setall_##suffix2(maxLimit))) + delta; \
|
||||
} \
|
||||
if ( v_check_any(idxMax != none) ) \
|
||||
if ( v_check_any(v_ne(idxMax, none)) ) \
|
||||
{ \
|
||||
maxVal = v_reduce_max(valMax); \
|
||||
maxIdx = (size_t)v_reduce_min(v_select(v_reinterpret_as_##suffix2(v_setall_##suffix((IR)maxVal) == valMax), \
|
||||
maxIdx = (size_t)v_reduce_min(v_select(v_reinterpret_as_##suffix2(v_eq(v_setall_##suffix((IR)maxVal), valMax)), \
|
||||
idxMax, v_setall_##suffix2(maxLimit))) + delta; \
|
||||
} \
|
||||
}
|
||||
@@ -210,18 +210,18 @@ static void minMaxIdx_8u(const uchar* src, const uchar* mask, int* minval, int*
|
||||
size_t* minidx, size_t* maxidx, int len, size_t startidx )
|
||||
{
|
||||
#if CV_SIMD128
|
||||
if ( len >= v_uint8x16::nlanes )
|
||||
if ( len >= VTraits<v_uint8x16>::vlanes() )
|
||||
{
|
||||
int j, len0;
|
||||
int minVal, maxVal;
|
||||
size_t minIdx, maxIdx;
|
||||
|
||||
minMaxIdx_init( src, mask, minval, maxval, minidx, maxidx, minVal, maxVal, minIdx, maxIdx,
|
||||
(int)0, (int)UCHAR_MAX, v_uint8x16::nlanes, len, startidx, j, len0 );
|
||||
(int)0, (int)UCHAR_MAX, VTraits<v_uint8x16>::vlanes(), len, startidx, j, len0 );
|
||||
|
||||
if ( j <= len0 - v_uint8x16::nlanes )
|
||||
if ( j <= len0 - VTraits<v_uint8x16>::vlanes() )
|
||||
{
|
||||
v_uint8x16 inc = v_setall_u8(v_uint8x16::nlanes);
|
||||
v_uint8x16 inc = v_setall_u8((uchar)VTraits<v_uint8x16>::vlanes());
|
||||
v_uint8x16 none = v_reinterpret_as_u8(v_setall_s8(-1));
|
||||
v_uint8x16 idxStart(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||
|
||||
@@ -235,31 +235,31 @@ static void minMaxIdx_8u(const uchar* src, const uchar* mask, int* minval, int*
|
||||
|
||||
if ( !mask )
|
||||
{
|
||||
for( ; k < std::min(len0, j + 15 * v_uint8x16::nlanes); k += v_uint8x16::nlanes )
|
||||
for( ; k < std::min(len0, j + 15 * VTraits<v_uint8x16>::vlanes()); k += VTraits<v_uint8x16>::vlanes() )
|
||||
{
|
||||
v_uint8x16 data = v_load(src + k);
|
||||
v_uint8x16 cmpMin = (data < valMin);
|
||||
v_uint8x16 cmpMax = (data > valMax);
|
||||
v_uint8x16 cmpMin = (v_lt(data, valMin));
|
||||
v_uint8x16 cmpMax = (v_gt(data, valMax));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_min(data, valMin);
|
||||
valMax = v_max(data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( ; k < std::min(len0, j + 15 * v_uint8x16::nlanes); k += v_uint8x16::nlanes )
|
||||
for( ; k < std::min(len0, j + 15 * VTraits<v_uint8x16>::vlanes()); k += VTraits<v_uint8x16>::vlanes() )
|
||||
{
|
||||
v_uint8x16 data = v_load(src + k);
|
||||
v_uint8x16 maskVal = v_load(mask + k) != v_setzero_u8();
|
||||
v_uint8x16 cmpMin = (data < valMin) & maskVal;
|
||||
v_uint8x16 cmpMax = (data > valMax) & maskVal;
|
||||
v_uint8x16 maskVal = v_ne(v_load(mask + k), v_setzero_u8());
|
||||
v_uint8x16 cmpMin = v_and(v_lt(data, valMin), maskVal);
|
||||
v_uint8x16 cmpMax = v_and(v_gt(data, valMax), maskVal);
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_select(cmpMin, data, valMin);
|
||||
valMax = v_select(cmpMax, data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,18 +287,18 @@ static void minMaxIdx_8s(const schar* src, const uchar* mask, int* minval, int*
|
||||
size_t* minidx, size_t* maxidx, int len, size_t startidx )
|
||||
{
|
||||
#if CV_SIMD128
|
||||
if ( len >= v_int8x16::nlanes )
|
||||
if ( len >= VTraits<v_int8x16>::vlanes() )
|
||||
{
|
||||
int j, len0;
|
||||
int minVal, maxVal;
|
||||
size_t minIdx, maxIdx;
|
||||
|
||||
minMaxIdx_init( src, mask, minval, maxval, minidx, maxidx, minVal, maxVal, minIdx, maxIdx,
|
||||
(int)SCHAR_MIN, (int)SCHAR_MAX, v_int8x16::nlanes, len, startidx, j, len0 );
|
||||
(int)SCHAR_MIN, (int)SCHAR_MAX, VTraits<v_int8x16>::vlanes(), len, startidx, j, len0 );
|
||||
|
||||
if ( j <= len0 - v_int8x16::nlanes )
|
||||
if ( j <= len0 - VTraits<v_int8x16>::vlanes() )
|
||||
{
|
||||
v_uint8x16 inc = v_setall_u8(v_int8x16::nlanes);
|
||||
v_uint8x16 inc = v_setall_u8((uchar)VTraits<v_int8x16>::vlanes());
|
||||
v_uint8x16 none = v_reinterpret_as_u8(v_setall_s8(-1));
|
||||
v_uint8x16 idxStart(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||
|
||||
@@ -312,31 +312,31 @@ static void minMaxIdx_8s(const schar* src, const uchar* mask, int* minval, int*
|
||||
|
||||
if ( !mask )
|
||||
{
|
||||
for( ; k < std::min(len0, j + 15 * v_int8x16::nlanes); k += v_int8x16::nlanes )
|
||||
for( ; k < std::min(len0, j + 15 * VTraits<v_int8x16>::vlanes()); k += VTraits<v_int8x16>::vlanes() )
|
||||
{
|
||||
v_int8x16 data = v_load(src + k);
|
||||
v_uint8x16 cmpMin = v_reinterpret_as_u8(data < valMin);
|
||||
v_uint8x16 cmpMax = v_reinterpret_as_u8(data > valMax);
|
||||
v_uint8x16 cmpMin = v_reinterpret_as_u8(v_lt(data, valMin));
|
||||
v_uint8x16 cmpMax = v_reinterpret_as_u8(v_gt(data, valMax));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_min(data, valMin);
|
||||
valMax = v_max(data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( ; k < std::min(len0, j + 15 * v_int8x16::nlanes); k += v_int8x16::nlanes )
|
||||
for( ; k < std::min(len0, j + 15 * VTraits<v_int8x16>::vlanes()); k += VTraits<v_int8x16>::vlanes() )
|
||||
{
|
||||
v_int8x16 data = v_load(src + k);
|
||||
v_uint8x16 maskVal = v_load(mask + k) != v_setzero_u8();
|
||||
v_uint8x16 cmpMin = v_reinterpret_as_u8(data < valMin) & maskVal;
|
||||
v_uint8x16 cmpMax = v_reinterpret_as_u8(data > valMax) & maskVal;
|
||||
v_uint8x16 maskVal = v_ne(v_load(mask + k), v_setzero_u8());
|
||||
v_uint8x16 cmpMin = v_and(v_reinterpret_as_u8(v_lt(data, valMin)), maskVal);
|
||||
v_uint8x16 cmpMax = v_and(v_reinterpret_as_u8(v_gt(data, valMax)), maskVal);
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_select(v_reinterpret_as_s8(cmpMin), data, valMin);
|
||||
valMax = v_select(v_reinterpret_as_s8(cmpMax), data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,18 +364,18 @@ static void minMaxIdx_16u(const ushort* src, const uchar* mask, int* minval, int
|
||||
size_t* minidx, size_t* maxidx, int len, size_t startidx )
|
||||
{
|
||||
#if CV_SIMD128
|
||||
if ( len >= v_uint16x8::nlanes )
|
||||
if ( len >= VTraits<v_uint16x8>::vlanes() )
|
||||
{
|
||||
int j, len0;
|
||||
int minVal, maxVal;
|
||||
size_t minIdx, maxIdx;
|
||||
|
||||
minMaxIdx_init( src, mask, minval, maxval, minidx, maxidx, minVal, maxVal, minIdx, maxIdx,
|
||||
(int)0, (int)USHRT_MAX, v_uint16x8::nlanes, len, startidx, j, len0 );
|
||||
(int)0, (int)USHRT_MAX, VTraits<v_uint16x8>::vlanes(), len, startidx, j, len0 );
|
||||
|
||||
if ( j <= len0 - v_uint16x8::nlanes )
|
||||
if ( j <= len0 - VTraits<v_uint16x8>::vlanes() )
|
||||
{
|
||||
v_uint16x8 inc = v_setall_u16(v_uint16x8::nlanes);
|
||||
v_uint16x8 inc = v_setall_u16((uchar)VTraits<v_uint16x8>::vlanes());
|
||||
v_uint16x8 none = v_reinterpret_as_u16(v_setall_s16(-1));
|
||||
v_uint16x8 idxStart(0, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
||||
@@ -389,31 +389,31 @@ static void minMaxIdx_16u(const ushort* src, const uchar* mask, int* minval, int
|
||||
|
||||
if ( !mask )
|
||||
{
|
||||
for( ; k < std::min(len0, j + 8191 * v_uint16x8::nlanes); k += v_uint16x8::nlanes )
|
||||
for( ; k < std::min(len0, j + 8191 * VTraits<v_uint16x8>::vlanes()); k += VTraits<v_uint16x8>::vlanes() )
|
||||
{
|
||||
v_uint16x8 data = v_load(src + k);
|
||||
v_uint16x8 cmpMin = (data < valMin);
|
||||
v_uint16x8 cmpMax = (data > valMax);
|
||||
v_uint16x8 cmpMin = (v_lt(data, valMin));
|
||||
v_uint16x8 cmpMax = (v_gt(data, valMax));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_min(data, valMin);
|
||||
valMax = v_max(data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( ; k < std::min(len0, j + 8191 * v_uint16x8::nlanes); k += v_uint16x8::nlanes )
|
||||
for( ; k < std::min(len0, j + 8191 * VTraits<v_uint16x8>::vlanes()); k += VTraits<v_uint16x8>::vlanes() )
|
||||
{
|
||||
v_uint16x8 data = v_load(src + k);
|
||||
v_uint16x8 maskVal = v_load_expand(mask + k) != v_setzero_u16();
|
||||
v_uint16x8 cmpMin = (data < valMin) & maskVal;
|
||||
v_uint16x8 cmpMax = (data > valMax) & maskVal;
|
||||
v_uint16x8 maskVal = v_ne(v_load_expand(mask + k), v_setzero_u16());
|
||||
v_uint16x8 cmpMin = v_and(v_lt(data, valMin), maskVal);
|
||||
v_uint16x8 cmpMax = v_and(v_gt(data, valMax), maskVal);
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_select(cmpMin, data, valMin);
|
||||
valMax = v_select(cmpMax, data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,18 +441,18 @@ static void minMaxIdx_16s(const short* src, const uchar* mask, int* minval, int*
|
||||
size_t* minidx, size_t* maxidx, int len, size_t startidx )
|
||||
{
|
||||
#if CV_SIMD128
|
||||
if ( len >= v_int16x8::nlanes )
|
||||
if ( len >= VTraits<v_int16x8>::vlanes() )
|
||||
{
|
||||
int j, len0;
|
||||
int minVal, maxVal;
|
||||
size_t minIdx, maxIdx;
|
||||
|
||||
minMaxIdx_init( src, mask, minval, maxval, minidx, maxidx, minVal, maxVal, minIdx, maxIdx,
|
||||
(int)SHRT_MIN, (int)SHRT_MAX, v_int16x8::nlanes, len, startidx, j, len0 );
|
||||
(int)SHRT_MIN, (int)SHRT_MAX, VTraits<v_int16x8>::vlanes(), len, startidx, j, len0 );
|
||||
|
||||
if ( j <= len0 - v_int16x8::nlanes )
|
||||
if ( j <= len0 - VTraits<v_int16x8>::vlanes() )
|
||||
{
|
||||
v_uint16x8 inc = v_setall_u16(v_int16x8::nlanes);
|
||||
v_uint16x8 inc = v_setall_u16((uchar)VTraits<v_int16x8>::vlanes());
|
||||
v_uint16x8 none = v_reinterpret_as_u16(v_setall_s16(-1));
|
||||
v_uint16x8 idxStart(0, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
||||
@@ -466,31 +466,31 @@ static void minMaxIdx_16s(const short* src, const uchar* mask, int* minval, int*
|
||||
|
||||
if ( !mask )
|
||||
{
|
||||
for( ; k < std::min(len0, j + 8191 * v_int16x8::nlanes); k += v_int16x8::nlanes )
|
||||
for( ; k < std::min(len0, j + 8191 * VTraits<v_int16x8>::vlanes()); k += VTraits<v_int16x8>::vlanes() )
|
||||
{
|
||||
v_int16x8 data = v_load(src + k);
|
||||
v_uint16x8 cmpMin = v_reinterpret_as_u16(data < valMin);
|
||||
v_uint16x8 cmpMax = v_reinterpret_as_u16(data > valMax);
|
||||
v_uint16x8 cmpMin = v_reinterpret_as_u16(v_lt(data, valMin));
|
||||
v_uint16x8 cmpMax = v_reinterpret_as_u16(v_gt(data, valMax));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_min(data, valMin);
|
||||
valMax = v_max(data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( ; k < std::min(len0, j + 8191 * v_int16x8::nlanes); k += v_int16x8::nlanes )
|
||||
for( ; k < std::min(len0, j + 8191 * VTraits<v_int16x8>::vlanes()); k += VTraits<v_int16x8>::vlanes() )
|
||||
{
|
||||
v_int16x8 data = v_load(src + k);
|
||||
v_uint16x8 maskVal = v_load_expand(mask + k) != v_setzero_u16();
|
||||
v_uint16x8 cmpMin = v_reinterpret_as_u16(data < valMin) & maskVal;
|
||||
v_uint16x8 cmpMax = v_reinterpret_as_u16(data > valMax) & maskVal;
|
||||
v_uint16x8 maskVal = v_ne(v_load_expand(mask + k), v_setzero_u16());
|
||||
v_uint16x8 cmpMin = v_and(v_reinterpret_as_u16(v_lt(data, valMin)), maskVal);
|
||||
v_uint16x8 cmpMax = v_and(v_reinterpret_as_u16(v_gt(data, valMax)), maskVal);
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_select(v_reinterpret_as_s16(cmpMin), data, valMin);
|
||||
valMax = v_select(v_reinterpret_as_s16(cmpMax), data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,14 +518,14 @@ static void minMaxIdx_32s(const int* src, const uchar* mask, int* minval, int* m
|
||||
size_t* minidx, size_t* maxidx, int len, size_t startidx )
|
||||
{
|
||||
#if CV_SIMD128
|
||||
if ( len >= 2 * v_int32x4::nlanes )
|
||||
if ( len >= 2 * VTraits<v_int32x4>::vlanes() )
|
||||
{
|
||||
int j = 0, len0 = len & -(2 * v_int32x4::nlanes);
|
||||
int j = 0, len0 = len & -(2 * VTraits<v_int32x4>::vlanes());
|
||||
int minVal = *minval, maxVal = *maxval;
|
||||
size_t minIdx = *minidx, maxIdx = *maxidx;
|
||||
|
||||
{
|
||||
v_uint32x4 inc = v_setall_u32(v_int32x4::nlanes);
|
||||
v_uint32x4 inc = v_setall_u32(VTraits<v_int32x4>::vlanes());
|
||||
v_uint32x4 none = v_reinterpret_as_u32(v_setall_s32(-1));
|
||||
v_uint32x4 idxStart(0, 1, 2, 3);
|
||||
|
||||
@@ -539,49 +539,49 @@ static void minMaxIdx_32s(const int* src, const uchar* mask, int* minval, int* m
|
||||
|
||||
if ( !mask )
|
||||
{
|
||||
for( ; k < std::min(len0, j + 32766 * 2 * v_int32x4::nlanes); k += 2 * v_int32x4::nlanes )
|
||||
for( ; k < std::min(len0, j + 32766 * 2 * VTraits<v_int32x4>::vlanes()); k += 2 * VTraits<v_int32x4>::vlanes() )
|
||||
{
|
||||
v_int32x4 data = v_load(src + k);
|
||||
v_uint32x4 cmpMin = v_reinterpret_as_u32(data < valMin);
|
||||
v_uint32x4 cmpMax = v_reinterpret_as_u32(data > valMax);
|
||||
v_uint32x4 cmpMin = v_reinterpret_as_u32(v_lt(data, valMin));
|
||||
v_uint32x4 cmpMax = v_reinterpret_as_u32(v_gt(data, valMax));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_min(data, valMin);
|
||||
valMax = v_max(data, valMax);
|
||||
idx += inc;
|
||||
data = v_load(src + k + v_int32x4::nlanes);
|
||||
cmpMin = v_reinterpret_as_u32(data < valMin);
|
||||
cmpMax = v_reinterpret_as_u32(data > valMax);
|
||||
idx = v_add(idx, inc);
|
||||
data = v_load(src + k + VTraits<v_int32x4>::vlanes());
|
||||
cmpMin = v_reinterpret_as_u32(v_lt(data, valMin));
|
||||
cmpMax = v_reinterpret_as_u32(v_gt(data, valMax));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_min(data, valMin);
|
||||
valMax = v_max(data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( ; k < std::min(len0, j + 32766 * 2 * v_int32x4::nlanes); k += 2 * v_int32x4::nlanes )
|
||||
for( ; k < std::min(len0, j + 32766 * 2 * VTraits<v_int32x4>::vlanes()); k += 2 * VTraits<v_int32x4>::vlanes() )
|
||||
{
|
||||
v_int32x4 data = v_load(src + k);
|
||||
v_uint16x8 maskVal = v_load_expand(mask + k) != v_setzero_u16();
|
||||
v_uint16x8 maskVal = v_ne(v_load_expand(mask + k), v_setzero_u16());
|
||||
v_int32x4 maskVal1, maskVal2;
|
||||
v_expand(v_reinterpret_as_s16(maskVal), maskVal1, maskVal2);
|
||||
v_uint32x4 cmpMin = v_reinterpret_as_u32((data < valMin) & maskVal1);
|
||||
v_uint32x4 cmpMax = v_reinterpret_as_u32((data > valMax) & maskVal1);
|
||||
v_uint32x4 cmpMin = v_reinterpret_as_u32(v_and(v_lt(data, valMin), maskVal1));
|
||||
v_uint32x4 cmpMax = v_reinterpret_as_u32(v_and(v_gt(data, valMax), maskVal1));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_select(v_reinterpret_as_s32(cmpMin), data, valMin);
|
||||
valMax = v_select(v_reinterpret_as_s32(cmpMax), data, valMax);
|
||||
idx += inc;
|
||||
data = v_load(src + k + v_int32x4::nlanes);
|
||||
cmpMin = v_reinterpret_as_u32((data < valMin) & maskVal2);
|
||||
cmpMax = v_reinterpret_as_u32((data > valMax) & maskVal2);
|
||||
idx = v_add(idx, inc);
|
||||
data = v_load(src + k + VTraits<v_int32x4>::vlanes());
|
||||
cmpMin = v_reinterpret_as_u32(v_and(v_lt(data, valMin), maskVal2));
|
||||
cmpMax = v_reinterpret_as_u32(v_and(v_gt(data, valMax), maskVal2));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_select(v_reinterpret_as_s32(cmpMin), data, valMin);
|
||||
valMax = v_select(v_reinterpret_as_s32(cmpMax), data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -609,18 +609,18 @@ static void minMaxIdx_32f(const float* src, const uchar* mask, float* minval, fl
|
||||
size_t* minidx, size_t* maxidx, int len, size_t startidx )
|
||||
{
|
||||
#if CV_SIMD128
|
||||
if ( len >= 2 * v_float32x4::nlanes )
|
||||
if ( len >= 2 * VTraits<v_float32x4>::vlanes() )
|
||||
{
|
||||
int j, len0;
|
||||
float minVal, maxVal;
|
||||
size_t minIdx, maxIdx;
|
||||
|
||||
minMaxIdx_init( src, mask, minval, maxval, minidx, maxidx, minVal, maxVal, minIdx, maxIdx,
|
||||
FLT_MIN, FLT_MAX, 2 * v_float32x4::nlanes, len, startidx, j, len0 );
|
||||
FLT_MIN, FLT_MAX, 2 * VTraits<v_float32x4>::vlanes(), len, startidx, j, len0 );
|
||||
|
||||
if ( j <= len0 - 2 * v_float32x4::nlanes )
|
||||
if ( j <= len0 - 2 * VTraits<v_float32x4>::vlanes() )
|
||||
{
|
||||
v_uint32x4 inc = v_setall_u32(v_float32x4::nlanes);
|
||||
v_uint32x4 inc = v_setall_u32(VTraits<v_float32x4>::vlanes());
|
||||
v_uint32x4 none = v_reinterpret_as_u32(v_setall_s32(-1));
|
||||
v_uint32x4 idxStart(0, 1, 2, 3);
|
||||
|
||||
@@ -634,49 +634,49 @@ static void minMaxIdx_32f(const float* src, const uchar* mask, float* minval, fl
|
||||
|
||||
if ( !mask )
|
||||
{
|
||||
for( ; k < std::min(len0, j + 32766 * 2 * v_float32x4::nlanes); k += 2 * v_float32x4::nlanes )
|
||||
for( ; k < std::min(len0, j + 32766 * 2 * VTraits<v_float32x4>::vlanes()); k += 2 * VTraits<v_float32x4>::vlanes() )
|
||||
{
|
||||
v_float32x4 data = v_load(src + k);
|
||||
v_uint32x4 cmpMin = v_reinterpret_as_u32(data < valMin);
|
||||
v_uint32x4 cmpMax = v_reinterpret_as_u32(data > valMax);
|
||||
v_uint32x4 cmpMin = v_reinterpret_as_u32(v_lt(data, valMin));
|
||||
v_uint32x4 cmpMax = v_reinterpret_as_u32(v_gt(data, valMax));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_min(data, valMin);
|
||||
valMax = v_max(data, valMax);
|
||||
idx += inc;
|
||||
data = v_load(src + k + v_float32x4::nlanes);
|
||||
cmpMin = v_reinterpret_as_u32(data < valMin);
|
||||
cmpMax = v_reinterpret_as_u32(data > valMax);
|
||||
idx = v_add(idx, inc);
|
||||
data = v_load(src + k + VTraits<v_float32x4>::vlanes());
|
||||
cmpMin = v_reinterpret_as_u32(v_lt(data, valMin));
|
||||
cmpMax = v_reinterpret_as_u32(v_gt(data, valMax));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_min(data, valMin);
|
||||
valMax = v_max(data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( ; k < std::min(len0, j + 32766 * 2 * v_float32x4::nlanes); k += 2 * v_float32x4::nlanes )
|
||||
for( ; k < std::min(len0, j + 32766 * 2 * VTraits<v_float32x4>::vlanes()); k += 2 * VTraits<v_float32x4>::vlanes() )
|
||||
{
|
||||
v_float32x4 data = v_load(src + k);
|
||||
v_uint16x8 maskVal = v_load_expand(mask + k) != v_setzero_u16();
|
||||
v_uint16x8 maskVal = v_ne(v_load_expand(mask + k), v_setzero_u16());
|
||||
v_int32x4 maskVal1, maskVal2;
|
||||
v_expand(v_reinterpret_as_s16(maskVal), maskVal1, maskVal2);
|
||||
v_uint32x4 cmpMin = v_reinterpret_as_u32(v_reinterpret_as_s32(data < valMin) & maskVal1);
|
||||
v_uint32x4 cmpMax = v_reinterpret_as_u32(v_reinterpret_as_s32(data > valMax) & maskVal1);
|
||||
v_uint32x4 cmpMin = v_reinterpret_as_u32(v_and(v_reinterpret_as_s32(v_lt(data, valMin)), maskVal1));
|
||||
v_uint32x4 cmpMax = v_reinterpret_as_u32(v_and(v_reinterpret_as_s32(v_gt(data, valMax)), maskVal1));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_select(v_reinterpret_as_f32(cmpMin), data, valMin);
|
||||
valMax = v_select(v_reinterpret_as_f32(cmpMax), data, valMax);
|
||||
idx += inc;
|
||||
data = v_load(src + k + v_float32x4::nlanes);
|
||||
cmpMin = v_reinterpret_as_u32(v_reinterpret_as_s32(data < valMin) & maskVal2);
|
||||
cmpMax = v_reinterpret_as_u32(v_reinterpret_as_s32(data > valMax) & maskVal2);
|
||||
idx = v_add(idx, inc);
|
||||
data = v_load(src + k + VTraits<v_float32x4>::vlanes());
|
||||
cmpMin = v_reinterpret_as_u32(v_and(v_reinterpret_as_s32(v_lt(data, valMin)), maskVal2));
|
||||
cmpMax = v_reinterpret_as_u32(v_and(v_reinterpret_as_s32(v_gt(data, valMax)), maskVal2));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_select(v_reinterpret_as_f32(cmpMin), data, valMin);
|
||||
valMax = v_select(v_reinterpret_as_f32(cmpMax), data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -704,18 +704,18 @@ static void minMaxIdx_64f(const double* src, const uchar* mask, double* minval,
|
||||
size_t* minidx, size_t* maxidx, int len, size_t startidx )
|
||||
{
|
||||
#if CV_SIMD128_64F
|
||||
if ( len >= 4 * v_float64x2::nlanes )
|
||||
if ( len >= 4 * VTraits<v_float64x2>::vlanes() )
|
||||
{
|
||||
int j, len0;
|
||||
double minVal, maxVal;
|
||||
size_t minIdx, maxIdx;
|
||||
|
||||
minMaxIdx_init( src, mask, minval, maxval, minidx, maxidx, minVal, maxVal, minIdx, maxIdx,
|
||||
DBL_MIN, DBL_MAX, 4 * v_float64x2::nlanes, len, startidx, j, len0 );
|
||||
DBL_MIN, DBL_MAX, 4 * VTraits<v_float64x2>::vlanes(), len, startidx, j, len0 );
|
||||
|
||||
if ( j <= len0 - 4 * v_float64x2::nlanes )
|
||||
if ( j <= len0 - 4 * VTraits<v_float64x2>::vlanes() )
|
||||
{
|
||||
v_uint64x2 inc = v_setall_u64(v_float64x2::nlanes);
|
||||
v_uint64x2 inc = v_setall_u64(VTraits<v_float64x2>::vlanes());
|
||||
v_uint64x2 none = v_reinterpret_as_u64(v_setall_s64(-1));
|
||||
v_uint64x2 idxStart(0, 1);
|
||||
|
||||
@@ -729,84 +729,84 @@ static void minMaxIdx_64f(const double* src, const uchar* mask, double* minval,
|
||||
|
||||
if ( !mask )
|
||||
{
|
||||
for( ; k < std::min(len0, j + 32764 * 4 * v_float64x2::nlanes); k += 4 * v_float64x2::nlanes )
|
||||
for( ; k < std::min(len0, j + 32764 * 4 * VTraits<v_float64x2>::vlanes()); k += 4 * VTraits<v_float64x2>::vlanes() )
|
||||
{
|
||||
v_float64x2 data = v_load(src + k);
|
||||
v_uint64x2 cmpMin = v_reinterpret_as_u64(data < valMin);
|
||||
v_uint64x2 cmpMax = v_reinterpret_as_u64(data > valMax);
|
||||
v_uint64x2 cmpMin = v_reinterpret_as_u64(v_lt(data, valMin));
|
||||
v_uint64x2 cmpMax = v_reinterpret_as_u64(v_gt(data, valMax));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_min(data, valMin);
|
||||
valMax = v_max(data, valMax);
|
||||
idx += inc;
|
||||
data = v_load(src + k + v_float64x2::nlanes);
|
||||
cmpMin = v_reinterpret_as_u64(data < valMin);
|
||||
cmpMax = v_reinterpret_as_u64(data > valMax);
|
||||
idx = v_add(idx, inc);
|
||||
data = v_load(src + k + VTraits<v_float64x2>::vlanes());
|
||||
cmpMin = v_reinterpret_as_u64(v_lt(data, valMin));
|
||||
cmpMax = v_reinterpret_as_u64(v_gt(data, valMax));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_min(data, valMin);
|
||||
valMax = v_max(data, valMax);
|
||||
idx += inc;
|
||||
data = v_load(src + k + 2 * v_float64x2::nlanes);
|
||||
cmpMin = v_reinterpret_as_u64(data < valMin);
|
||||
cmpMax = v_reinterpret_as_u64(data > valMax);
|
||||
idx = v_add(idx, inc);
|
||||
data = v_load(src + k + 2 * VTraits<v_float64x2>::vlanes());
|
||||
cmpMin = v_reinterpret_as_u64(v_lt(data, valMin));
|
||||
cmpMax = v_reinterpret_as_u64(v_gt(data, valMax));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_min(data, valMin);
|
||||
valMax = v_max(data, valMax);
|
||||
idx += inc;
|
||||
data = v_load(src + k + 3 * v_float64x2::nlanes);
|
||||
cmpMin = v_reinterpret_as_u64(data < valMin);
|
||||
cmpMax = v_reinterpret_as_u64(data > valMax);
|
||||
idx = v_add(idx, inc);
|
||||
data = v_load(src + k + 3 * VTraits<v_float64x2>::vlanes());
|
||||
cmpMin = v_reinterpret_as_u64(v_lt(data, valMin));
|
||||
cmpMax = v_reinterpret_as_u64(v_gt(data, valMax));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_min(data, valMin);
|
||||
valMax = v_max(data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( ; k < std::min(len0, j + 32764 * 4 * v_float64x2::nlanes); k += 4 * v_float64x2::nlanes )
|
||||
for( ; k < std::min(len0, j + 32764 * 4 * VTraits<v_float64x2>::vlanes()); k += 4 * VTraits<v_float64x2>::vlanes() )
|
||||
{
|
||||
v_float64x2 data = v_load(src + k);
|
||||
v_uint16x8 maskVal = v_load_expand(mask + k) != v_setzero_u16();
|
||||
v_uint16x8 maskVal = v_ne(v_load_expand(mask + k), v_setzero_u16());
|
||||
v_int32x4 maskVal1, maskVal2;
|
||||
v_expand(v_reinterpret_as_s16(maskVal), maskVal1, maskVal2);
|
||||
v_int64x2 maskVal3, maskVal4;
|
||||
v_expand(maskVal1, maskVal3, maskVal4);
|
||||
v_uint64x2 cmpMin = v_reinterpret_as_u64(v_reinterpret_as_s64(data < valMin) & maskVal3);
|
||||
v_uint64x2 cmpMax = v_reinterpret_as_u64(v_reinterpret_as_s64(data > valMax) & maskVal3);
|
||||
v_uint64x2 cmpMin = v_reinterpret_as_u64(v_and(v_reinterpret_as_s64(v_lt(data, valMin)), maskVal3));
|
||||
v_uint64x2 cmpMax = v_reinterpret_as_u64(v_and(v_reinterpret_as_s64(v_gt(data, valMax)), maskVal3));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_select(v_reinterpret_as_f64(cmpMin), data, valMin);
|
||||
valMax = v_select(v_reinterpret_as_f64(cmpMax), data, valMax);
|
||||
idx += inc;
|
||||
data = v_load(src + k + v_float64x2::nlanes);
|
||||
cmpMin = v_reinterpret_as_u64(v_reinterpret_as_s64(data < valMin) & maskVal4);
|
||||
cmpMax = v_reinterpret_as_u64(v_reinterpret_as_s64(data > valMax) & maskVal4);
|
||||
idx = v_add(idx, inc);
|
||||
data = v_load(src + k + VTraits<v_float64x2>::vlanes());
|
||||
cmpMin = v_reinterpret_as_u64(v_and(v_reinterpret_as_s64(v_lt(data, valMin)), maskVal4));
|
||||
cmpMax = v_reinterpret_as_u64(v_and(v_reinterpret_as_s64(v_gt(data, valMax)), maskVal4));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_select(v_reinterpret_as_f64(cmpMin), data, valMin);
|
||||
valMax = v_select(v_reinterpret_as_f64(cmpMax), data, valMax);
|
||||
idx += inc;
|
||||
data = v_load(src + k + 2 * v_float64x2::nlanes);
|
||||
idx = v_add(idx, inc);
|
||||
data = v_load(src + k + 2 * VTraits<v_float64x2>::vlanes());
|
||||
v_expand(maskVal2, maskVal3, maskVal4);
|
||||
cmpMin = v_reinterpret_as_u64(v_reinterpret_as_s64(data < valMin) & maskVal3);
|
||||
cmpMax = v_reinterpret_as_u64(v_reinterpret_as_s64(data > valMax) & maskVal3);
|
||||
cmpMin = v_reinterpret_as_u64(v_and(v_reinterpret_as_s64(v_lt(data, valMin)), maskVal3));
|
||||
cmpMax = v_reinterpret_as_u64(v_and(v_reinterpret_as_s64(v_gt(data, valMax)), maskVal3));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_select(v_reinterpret_as_f64(cmpMin), data, valMin);
|
||||
valMax = v_select(v_reinterpret_as_f64(cmpMax), data, valMax);
|
||||
idx += inc;
|
||||
data = v_load(src + k + 3 * v_float64x2::nlanes);
|
||||
cmpMin = v_reinterpret_as_u64(v_reinterpret_as_s64(data < valMin) & maskVal4);
|
||||
cmpMax = v_reinterpret_as_u64(v_reinterpret_as_s64(data > valMax) & maskVal4);
|
||||
idx = v_add(idx, inc);
|
||||
data = v_load(src + k + 3 * VTraits<v_float64x2>::vlanes());
|
||||
cmpMin = v_reinterpret_as_u64(v_and(v_reinterpret_as_s64(v_lt(data, valMin)), maskVal4));
|
||||
cmpMax = v_reinterpret_as_u64(v_and(v_reinterpret_as_s64(v_gt(data, valMax)), maskVal4));
|
||||
idxMin = v_select(cmpMin, idx, idxMin);
|
||||
idxMax = v_select(cmpMax, idx, idxMax);
|
||||
valMin = v_select(v_reinterpret_as_f64(cmpMin), data, valMin);
|
||||
valMax = v_select(v_reinterpret_as_f64(cmpMax), data, valMax);
|
||||
idx += inc;
|
||||
idx = v_add(idx, inc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1745,13 +1745,8 @@ template<typename R> struct TheTest
|
||||
R a = dataA;
|
||||
R b = dataB;
|
||||
|
||||
#if CV_SIMD_SCALABLE
|
||||
Data<R> dataEQ = v_eq(a, b);
|
||||
Data<R> dataNE = v_ne(a, b);
|
||||
#else
|
||||
Data<R> dataEQ = (a == b);
|
||||
Data<R> dataNE = (a != b);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < VTraits<R>::vlanes(); ++i)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user