-
-
Notifications
You must be signed in to change notification settings - Fork 56.4k
Add zlib-ng as an alternative zlib implementation #24782
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
279a3dc to
e55a8cd
Compare
在只开启 AVX2 intrinsics 时,png 格式 `imdecodemulti` 和 `imencodemulti` 耗时会减少约 20%。没有启用 name mangling,因为 openexr 会编译不过。经验证,在 Windows 和 Linux 下,zlib 的符号不会导出。 上游 PR:opencv#24782
Zlib-ng is zlib replacement with optimizations for "next generation" systems. Its optimization may benifits image library decode and encode speed such as libpng. In our tests, if using zlib-ng and libpng combination on a x86_64 machine with AVX2, the time of `imdecode` amd `imencode` will drop 20% approximately. This patch enables zlib-ng's optimization if `CV_DISABLE_OPTIMIZATION` is OFF. Since Zlib-ng can dispatch intrinsics on the fly, port work is much easier. Related discussion: opencv#22573
e55a8cd to
0de26fd
Compare
|
Hi, I've updated zlib-ng to 2.1.6. Could you please review this patch? @asmorkalov @opencv-alalek |
|
Gently ping~ |
|
I apologize for the delay. Zlib is used py OpenCV itself, libpng, QT and other our 3rdparties. I'm looking on different options for OpenCV-Python package to re-use the same implementation and exclude conflicts. |
|
ARM v7 build is broken: OS: ubuntu 16.04, GCC 5.4.0, CMake: |
|
Performance numbers for libpng on Intel i5-1135G7, Ubuntu 20.04: |
|
The same configuration with Spng: |
|
Thanks for testing. For Armv7 build failure, opencv's zlib-ng build option is |
|
I made experiments with arm and found out that root CmakeLists.txt in zlib was migrated incorrectly. I'll return back to the PR soon. |
|
Sorry for late response. I encountered some difficulties using qemu-system. So, I tested my patch on raspberry pi 2b which is the latest armv7 device AFAIK. I cannot reproduce the build failure. OS: raspberry pi OS based on debian 11, GCC 10.2.1-6+rpi1, CMake: |
|
@asmorkalov Gently ping. It's been a month since I heard from you last time. Is there anything I can do to make this PR be merged sooner? |
|
I stuck a bit with the NEON issue in some configurations. I'll try to fix it and propose a solution this week. The PR is definitely useful and will be merged. |
|
The compilation issue is compiler dependent. I see the same errors with GCC 5.4 in Ubuntu 16.04, GCC 7.5 and 8.4, but not with GCC 10.2 on Raspberry Pi. |
|
Discussed the PR on the OpenCV Core team meeting. Decided to merge the PR as is. |
Zlib-ng is zlib replacement with optimizations for "next generation" systems. Its optimization may benifits image library decode and encode speed such as libpng. In our tests, if using zlib-ng and libpng combination on a x86_64 machine with AVX2, the time of
imdecodeamdimencodewill drop 20% approximately. This patch enables zlib-ng's optimization ifCV_DISABLE_OPTIMIZATIONis OFF. Since Zlib-ng can dispatch intrinsics on the fly, port work is much easier.Related discussion: #22573
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.