diff --git a/modules/core/include/opencv2/core/hal/intrin_vsx.hpp b/modules/core/include/opencv2/core/hal/intrin_vsx.hpp index 3fff6651e3..8b76dd8487 100644 --- a/modules/core/include/opencv2/core/hal/intrin_vsx.hpp +++ b/modules/core/include/opencv2/core/hal/intrin_vsx.hpp @@ -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 \ 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 @@ -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 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 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 ///////// diff --git a/modules/core/test/test_intrin_utils.hpp b/modules/core/test/test_intrin_utils.hpp index 7a21c9eb56..7579d9cf05 100644 --- a/modules/core/test/test_intrin_utils.hpp +++ b/modules/core/test/test_intrin_utils.hpp @@ -837,17 +837,28 @@ template struct TheTest Data resC = v_rotate_right(a); Data resD = v_rotate_right(a, b); + Data resE = v_rotate_left(a); + Data resF = v_rotate_left(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; } diff --git a/modules/photo/test/test_hdr.cpp b/modules/photo/test/test_hdr.cpp index 9e2aeaa94f..c4bf536278 100644 --- a/modules/photo/test/test_hdr.cpp +++ b/modules/photo/test/test_hdr.cpp @@ -213,7 +213,7 @@ TEST(Photo_MergeRobertson, regression) loadImage(test_path + "merge/robertson.hdr", expected); merge->process(images, result, times); -#ifdef __aarch64__ +#if defined(__aarch64__) || defined(__PPC64__) const float eps = 6.f; #else const float eps = 5.f;