mirror of
https://github.com/opencv/opencv.git
synced 2025-06-21 10:30:51 +08:00
Merge pull request #13672 from arnaudbrejeon:bug_fix_12961
PyrDown: Fix bug #12961 (#13672) * Force unaligned pointer and create test * More cross-platform solution * MSVC expects a proper order * Remove useless clang macro
This commit is contained in:
parent
3585522b24
commit
d998e70a25
@ -112,6 +112,7 @@ struct PyrDownVec_32s8u
|
|||||||
v_rshr_pack_store<8>(dst + x, t0);
|
v_rshr_pack_store<8>(dst + x, t0);
|
||||||
x += v_uint16::nlanes;
|
x += v_uint16::nlanes;
|
||||||
}
|
}
|
||||||
|
typedef int CV_DECL_ALIGNED(1) unaligned_int;
|
||||||
for ( ; x <= width - v_int32x4::nlanes; x += v_int32x4::nlanes)
|
for ( ; x <= width - v_int32x4::nlanes; x += v_int32x4::nlanes)
|
||||||
{
|
{
|
||||||
v_int32x4 r0, r1, r2, r3, r4, t0;
|
v_int32x4 r0, r1, r2, r3, r4, t0;
|
||||||
@ -122,7 +123,7 @@ struct PyrDownVec_32s8u
|
|||||||
r4 = v_load(row4 + x);
|
r4 = v_load(row4 + x);
|
||||||
t0 = r0 + r4 + (r2 + r2) + ((r1 + r3 + r2) << 2);
|
t0 = r0 + r4 + (r2 + r2) + ((r1 + r3 + r2) << 2);
|
||||||
|
|
||||||
*(int*)(dst + x) = v_reinterpret_as_s32(v_rshr_pack<8>(v_pack_u(t0, t0), v_setzero_u16())).get0();
|
*((unaligned_int*) (dst + x)) = v_reinterpret_as_s32(v_rshr_pack<8>(v_pack_u(t0, t0), v_setzero_u16())).get0();
|
||||||
}
|
}
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
|
@ -2235,4 +2235,13 @@ TEST(Imgproc_Sobel, s16_regression_13506)
|
|||||||
Sobel(src, dst, CV_16S, 0, 1, 5);
|
Sobel(src, dst, CV_16S, 0, 1, 5);
|
||||||
ASSERT_EQ(0.0, cvtest::norm(dst, ref, NORM_INF));
|
ASSERT_EQ(0.0, cvtest::norm(dst, ref, NORM_INF));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Imgproc_Pyrdown, issue_12961)
|
||||||
|
{
|
||||||
|
Mat src(9, 9, CV_8UC1, Scalar::all(0));
|
||||||
|
Mat dst;
|
||||||
|
cv::pyrDown(src, dst);
|
||||||
|
ASSERT_EQ(0.0, cv::norm(dst));
|
||||||
|
}
|
||||||
|
|
||||||
}} // namespace
|
}} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user