Skip to content

Fix unaligned filters + increase test thresholds (5.x)#25379

Merged
asmorkalov merged 2 commits intoopencv:5.xfrom
mshabunin:fix-unaligned-filter-5.x
Apr 10, 2024
Merged

Fix unaligned filters + increase test thresholds (5.x)#25379
asmorkalov merged 2 commits intoopencv:5.xfrom
mshabunin:fix-unaligned-filter-5.x

Conversation

@mshabunin
Copy link
Copy Markdown
Contributor

@mshabunin mshabunin commented Apr 9, 2024

Port of #25364 to 5.x + minor changes in 3d tests to pass on RISC-V platform

Failed tests:

[ RUN      ] AP3P.ctheta1p_nan_23607
/home/ci/opencv/modules/3d/test/test_solvepnp_ransac.cpp:2320: Failure
Expected: (cvtest::norm(res.colRange(0, 2), expected, NORM_INF)) <= (3e-16), actual: 3.33067e-16 vs 3e-16
[  FAILED  ] AP3P.ctheta1p_nan_23607 (1 ms)

[ RUN      ] Rendering/RenderingTest.accuracy/4, where GetParam() = ((320, 240), Flat, CW, Color, CV_32F, CV_32S)
/home/ci/opencv/modules/3d/test/test_rendering.cpp:430: Failure
Expected: (normL2Depth) <= (normL2Threshold), actual: 0.00102317 vs 0.000989
[  FAILED  ] Rendering/RenderingTest.accuracy/4, where GetParam() = ((320, 240), Flat, CW, Color, CV_32F, CV_32S) (22 ms)

[ RUN      ] Rendering/RenderingTest.accuracy/5, where GetParam() = ((320, 240), Shaded, None, Color, CV_32F, CV_32S)
/home/ci/opencv/modules/3d/test/test_rendering.cpp:430: Failure
Expected: (normL2Depth) <= (normL2Threshold), actual: 0.00102317 vs 0.000989
[  FAILED  ] Rendering/RenderingTest.accuracy/5, where GetParam() = ((320, 240), Shaded, None, Color, CV_32F, CV_32S) (22 ms)

[ RUN      ] Rendering/RenderingTest.accuracy/8, where GetParam() = ((320, 240), Flat, CW, Clipping, CV_32F, CV_32S)
/home/ci/opencv/modules/3d/test/test_rendering.cpp:430: Failure
Expected: (normL2Depth) <= (normL2Threshold), actual: 0.00162132 vs 0.0016
[  FAILED  ] Rendering/RenderingTest.accuracy/8, where GetParam() = ((320, 240), Flat, CW, Clipping, CV_32F, CV_32S) (22 ms)

[ RUN      ] Rendering/RenderingTest.accuracy/9, where GetParam() = ((320, 240), Shaded, None, Clipping, CV_32F, CV_32S)
/home/ci/opencv/modules/3d/test/test_rendering.cpp:430: Failure
Expected: (normL2Depth) <= (normL2Threshold), actual: 0.000554117 vs 0.000544
[  FAILED  ] Rendering/RenderingTest.accuracy/9, where GetParam() = ((320, 240), Shaded, None, Clipping, CV_32F, CV_32S) (27 ms)

Related CI PR: opencv/ci-gha-workflow#165

imgproc: fix unaligned memory access in filters and Gaussian blur opencv#25364

* filter/SIMD: removed parts which casted 8u pointers to int causing unaligned memory access on RISC-V platform.
* GaussianBlur/fixed_point: replaced casts from s16 to u32 with union operations

Performance comparison:
- [x] check performance on x86_64 - (4 threads, `-DCPU_BASELINE=AVX2`, GCC 11.4, Ubuntu 22) - [report_imgproc_x86_64.ods](https://github.com/opencv/opencv/files/14904702/report_x86_64.ods)
- [x] check performance on AArch64 - (4 cores of RK3588, GCC 11.4 aarch64, Raspbian) - [report_imgproc_aarch64.ods](https://github.com/opencv/opencv/files/14908437/report_aarch64.ods)

Note: for some reason my performance results are quite unstable, unaffected functions show speedups and slowdowns in many cases. Filter2D and GaussianBlur seem to be OK.

Slightly related PR: opencv/ci-gha-workflow#165
@mshabunin mshabunin added the port/backport done Label for maintainers. Authors of PR can ignore this label Apr 9, 2024
@asmorkalov asmorkalov self-assigned this Apr 10, 2024
@asmorkalov asmorkalov added this to the 5.0 milestone Apr 10, 2024
@asmorkalov
Copy link
Copy Markdown
Contributor

cc @savuor

@asmorkalov asmorkalov merged commit 0e1d326 into opencv:5.x Apr 10, 2024
@mshabunin mshabunin deleted the fix-unaligned-filter-5.x branch June 5, 2024 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

port/backport done Label for maintainers. Authors of PR can ignore this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants