imgproc: improved test for boundingRect#25484
Merged
asmorkalov merged 1 commit intoopencv:4.xfrom May 7, 2024
Merged
Conversation
Contributor
|
@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); |
Contributor
There was a problem hiding this comment.
i * 2
step should be one integer (4 bytes) to reproduce alignment issue.
82c4a37 to
0eee06a
Compare
Contributor
|
@opencv-alalek could you take a look again? |
mshabunin
commented
May 2, 2024
modules/imgproc/src/geometry.cpp
Outdated
| if( !is_float ) | ||
| { | ||
| const int32_t* pts = points.ptr<int32_t>(); | ||
| firstval.vali32[0] = pts[0]; |
Contributor
Author
There was a problem hiding this comment.
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 |
Contributor
There was a problem hiding this comment.
Without unions: vx_setall_s64((int64_t)pts[0] | (int64_t)((uint64_t)pts[1] << 32)) ?
Closed
4 tasks
0eee06a to
6d64587
Compare
6d64587 to
c4ce942
Compare
Contributor
Author
|
Hmm.. something was wrong with bit-shift approach, so I decided to use |
opencv-alalek
approved these changes
May 7, 2024
This was referenced May 7, 2024
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.