Skip to content

Fixed jpeg-turbo diagnostics and build options in default configuration.#25388

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
asmorkalov:as/jpeg-turbo-diagnostics
Apr 13, 2024
Merged

Fixed jpeg-turbo diagnostics and build options in default configuration.#25388
asmorkalov merged 1 commit intoopencv:4.xfrom
asmorkalov:as/jpeg-turbo-diagnostics

Conversation

@asmorkalov
Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov commented Apr 10, 2024

cmake /opencv.

Before:

--   Media I/O: 
--     ZLib:                        /lib64/libz.so (ver 1.2.7)
--     JPEG:                        libjpeg-turbo (ver 2.1.3-62)
--     WEBP:                        build (ver encoder: 0x020f)
--     PNG:                         /usr/local/lib/libpng.so (ver 1.6.40)
--     TIFF:                        build (ver 42 - 4.6.0)
--     JPEG 2000:                   build (ver 2.5.0)
--     OpenEXR:                     build (ver 2.3.0)

After:

--   Media I/O: 
--     ZLib:                        /lib64/libz.so (ver 1.2.7)
--     JPEG:                        build-libjpeg-turbo (ver 2.1.3-62)
--       SIMD Support Request:      YES
--       SIMD Support:              YES
--     WEBP:                        build (ver encoder: 0x020f)
--     PNG:                         /usr/local/lib/libpng.so (ver 1.6.40)
--     TIFF:                        build (ver 42 - 4.6.0)
--     JPEG 2000:                   build (ver 2.5.0)
--     OpenEXR:                     build (ver 2.3.0)

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@vpisarev
Copy link
Copy Markdown
Contributor

@asmorkalov, can you maybe provide imread() performance numbers before and after your patch? to make sure that the change fixes the problem

@asmorkalov
Copy link
Copy Markdown
Contributor Author

Yes, I'm working on it right now.

@asmorkalov
Copy link
Copy Markdown
Contributor Author

asmorkalov commented Apr 11, 2024

Platform: AMD Ryzen 7 2700X, 64g GB RAM. The test was done in OpenCV-Python build container (mamylinux2014 based) to reproduce package build settings.

Geometric mean (ms)

Name of Test  4.x-1  patched-1 patched-1
                                   vs    
                                 4.x-1   
                               (x-factor)
Decode::JPEG 70.120   36.749      1.91   
Encode::JPEG 111.216  28.581      3.89   
decode::PNG  31.451   30.872      1.02   
encode::PNG  58.192   57.151      1.02

endif()

OCV_OPTION(ENABLE_LIBJPEG_TURBO_SIMD "Include SIMD extensions for libjpeg-turbo, if available for this platform" (NOT CV_DISABLE_OPTIMIZATION)
VISIBLE_IF BUILD_JPEG)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add BUILD_JPEG_TURBO variable instead and check it here? Currently logic is not very obvious, i.e. in order to disable own JPEG library users must provide BUILD_JPEG=OFF and BUILD_JPEG_TURBO_DISABLE=ON.

@asmorkalov
Copy link
Copy Markdown
Contributor Author

The PR has been discussed on the Core team meeting. Decided to merge as is without modifications for now to presume backward compatibility with existing scripts. Also BUILD_XXX variables are not set automatically for JPEG and some other 3rdparties. It's need to be fixed with dedicated PR.

@asmorkalov asmorkalov merged commit 66ab0be into opencv:4.x Apr 13, 2024
@asmorkalov asmorkalov mentioned this pull request Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants