mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
core:ppc Several improvements on VSX(2)
* add v_float64x2 support to v_rotate_* * treat float vector in v_check_any, vec_any_lt as int vector * add test case for v_rotate_left
This commit is contained in:
parent
60e5e213fd
commit
ed19da21ab
@ -589,7 +589,7 @@ inline _Tpvec v_rotate_left(const _Tpvec& a, const _Tpvec& b)
|
||||
return _Tpvec(vec_sld(a.val, b.val, CV_SHIFT));
|
||||
}
|
||||
|
||||
#define OPENCV_IMPL_VSX_ROTATE_64(_Tpvec, suffix, rg1, rg2) \
|
||||
#define OPENCV_IMPL_VSX_ROTATE_64_2RG(_Tpvec, suffix, rg1, rg2) \
|
||||
template<int imm> \
|
||||
inline _Tpvec v_rotate_##suffix(const _Tpvec& a, const _Tpvec& b) \
|
||||
{ \
|
||||
@ -598,11 +598,13 @@ inline _Tpvec v_rotate_##suffix(const _Tpvec& a, const _Tpvec& b) \
|
||||
return imm ? b : a; \
|
||||
}
|
||||
|
||||
OPENCV_IMPL_VSX_ROTATE_64(v_int64x2, right, a, b)
|
||||
OPENCV_IMPL_VSX_ROTATE_64(v_uint64x2, right, a, b)
|
||||
#define OPENCV_IMPL_VSX_ROTATE_64_2RG_LR(_Tpvec) \
|
||||
OPENCV_IMPL_VSX_ROTATE_64_2RG(_Tpvec, left, b, a) \
|
||||
OPENCV_IMPL_VSX_ROTATE_64_2RG(_Tpvec, right, a, b)
|
||||
|
||||
OPENCV_IMPL_VSX_ROTATE_64(v_int64x2, left, b, a)
|
||||
OPENCV_IMPL_VSX_ROTATE_64(v_uint64x2, left, b, a)
|
||||
OPENCV_IMPL_VSX_ROTATE_64_2RG_LR(v_float64x2)
|
||||
OPENCV_IMPL_VSX_ROTATE_64_2RG_LR(v_uint64x2)
|
||||
OPENCV_IMPL_VSX_ROTATE_64_2RG_LR(v_int64x2)
|
||||
|
||||
/* Extract */
|
||||
template<int s, typename _Tpvec>
|
||||
@ -716,26 +718,33 @@ inline int v_signmask(const v_uint64x2& a)
|
||||
inline int v_signmask(const v_float64x2& a)
|
||||
{ return v_signmask(v_reinterpret_as_s64(a)); }
|
||||
|
||||
|
||||
template<typename _Tpvec>
|
||||
inline bool v_check_all(const _Tpvec& a)
|
||||
{ return vec_all_lt(a.val, _Tpvec().val);}
|
||||
inline bool v_check_all(const v_uint8x16 &a)
|
||||
{ return vec_all_lt(a.val, _Tpvec().val); }
|
||||
inline bool v_check_all(const v_uint8x16& a)
|
||||
{ return v_check_all(v_reinterpret_as_s8(a)); }
|
||||
inline bool v_check_all(const v_uint16x8 &a)
|
||||
inline bool v_check_all(const v_uint16x8& a)
|
||||
{ return v_check_all(v_reinterpret_as_s16(a)); }
|
||||
inline bool v_check_all(const v_uint32x4 &a)
|
||||
inline bool v_check_all(const v_uint32x4& a)
|
||||
{ return v_check_all(v_reinterpret_as_s32(a)); }
|
||||
inline bool v_check_all(const v_float32x4& a)
|
||||
{ return v_check_all(v_reinterpret_as_s32(a)); }
|
||||
inline bool v_check_all(const v_float64x2& a)
|
||||
{ return v_check_all(v_reinterpret_as_s64(a)); }
|
||||
|
||||
template<typename _Tpvec>
|
||||
inline bool v_check_any(const _Tpvec& a)
|
||||
{ return vec_any_lt(a.val, _Tpvec().val);}
|
||||
inline bool v_check_any(const v_uint8x16 &a)
|
||||
{ return vec_any_lt(a.val, _Tpvec().val); }
|
||||
inline bool v_check_any(const v_uint8x16& a)
|
||||
{ return v_check_any(v_reinterpret_as_s8(a)); }
|
||||
inline bool v_check_any(const v_uint16x8 &a)
|
||||
inline bool v_check_any(const v_uint16x8& a)
|
||||
{ return v_check_any(v_reinterpret_as_s16(a)); }
|
||||
inline bool v_check_any(const v_uint32x4 &a)
|
||||
inline bool v_check_any(const v_uint32x4& a)
|
||||
{ return v_check_any(v_reinterpret_as_s32(a)); }
|
||||
inline bool v_check_any(const v_float32x4& a)
|
||||
{ return v_check_any(v_reinterpret_as_s32(a)); }
|
||||
inline bool v_check_any(const v_float64x2& a)
|
||||
{ return v_check_any(v_reinterpret_as_s64(a)); }
|
||||
|
||||
////////// Other math /////////
|
||||
|
||||
|
@ -837,17 +837,28 @@ template<typename R> struct TheTest
|
||||
Data<R> resC = v_rotate_right<s>(a);
|
||||
Data<R> resD = v_rotate_right<s>(a, b);
|
||||
|
||||
Data<R> resE = v_rotate_left<s>(a);
|
||||
Data<R> resF = v_rotate_left<s>(a, b);
|
||||
|
||||
for (int i = 0; i < R::nlanes; ++i)
|
||||
{
|
||||
if (i + s >= R::nlanes)
|
||||
{
|
||||
EXPECT_EQ((LaneType)0, resC[i]);
|
||||
EXPECT_EQ(dataB[i - R::nlanes + s], resD[i]);
|
||||
|
||||
EXPECT_EQ((LaneType)0, resE[i - R::nlanes + s]);
|
||||
EXPECT_EQ(dataB[i], resF[i - R::nlanes + s]);
|
||||
}
|
||||
else
|
||||
{
|
||||
EXPECT_EQ(dataA[i + s], resC[i]);
|
||||
}
|
||||
EXPECT_EQ(dataA[i + s], resD[i]);
|
||||
|
||||
EXPECT_EQ(dataA[i], resE[i + s]);
|
||||
EXPECT_EQ(dataA[i], resF[i + s]);
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user