-
-
Notifications
You must be signed in to change notification settings - Fork 56.4k
imgproc: improved test for boundingRect #25484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@mshabunin please close PRs with other solutions as soon as your is ready. |
| for (int i = 0; i < 10; ++i) | ||
| { | ||
| SCOPED_TRACE(cv::format("i=%d", i)); | ||
| Mat sub(40, 1, CV_32SC2, data + i * 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i * 2
step should be one integer (4 bytes) to reproduce alignment issue.
82c4a37 to
0eee06a
Compare
|
@opencv-alalek could you take a look again? |
modules/imgproc/src/geometry.cpp
Outdated
| if( !is_float ) | ||
| { | ||
| const int32_t* pts = points.ptr<int32_t>(); | ||
| firstval.vali32[0] = pts[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if using std::memcpy instead of union would be better in this case:
memcpy(&vali64, pts, 2 * sizeof(pts[0]));
modules/imgproc/src/geometry.cpp
Outdated
| firstval.vali32[1] = pts[1]; | ||
| v_int32 minval, maxval; | ||
| minval = maxval = v_reinterpret_as_s32(vx_setall_s64(*pts)); //min[0]=pt.x, min[1]=pt.y, min[2]=pt.x, min[3]=pt.y | ||
| minval = maxval = v_reinterpret_as_s32(vx_setall_s64(firstval.vali64)); //min[0]=pt.x, min[1]=pt.y, min[2]=pt.x, min[3]=pt.y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without unions: vx_setall_s64((int64_t)pts[0] | (int64_t)((uint64_t)pts[1] << 32)) ?
0eee06a to
6d64587
Compare
6d64587 to
c4ce942
Compare
|
Hmm.. something was wrong with bit-shift approach, so I decided to use |
This PR is intended to fix #25265. In order to do it we should:
Test for boundingRect has been converted to modern scheme and parametrized. Also increased test boundaries and added separate alignment test. In order to reproduce the issue one needs to build and run this test on ARMv7 board or emulate using C++ intrinsics with alignment checks (
-DOPENCV_EXTRA_CXX_FLAGS="-DCV_STRONG_ALIGNMENT=1 -DCV_FORCE_SIMD128_CPP=1"). To activate second changed block (#if CV_SIMD_WIDTH > 16) use-DCPU_BASELINE=AVX2.