Skip to content

Add a test related IMWRITE_PNG_COMPRESSION parameter#26973

Merged
asmorkalov merged 5 commits intoopencv:4.xfrom
sturkmen72:png_test
Feb 25, 2025
Merged

Add a test related IMWRITE_PNG_COMPRESSION parameter#26973
asmorkalov merged 5 commits intoopencv:4.xfrom
sturkmen72:png_test

Conversation

@sturkmen72
Copy link
Copy Markdown
Contributor

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

@asmorkalov
Copy link
Copy Markdown
Contributor

Looks good to me in general. Couple of questions:

  • How the expected size is calculated? It will be different for PNG versions and SPNG?
  • Why do you need the same test for 3 images and all compression levels. I propose to reduce the test suite to safe execution time.

@asmorkalov asmorkalov self-assigned this Feb 25, 2025
@sturkmen72
Copy link
Copy Markdown
Contributor Author

Looks good to me in general. Couple of questions:

  • How the expected size is calculated? It will be different for PNG versions and SPNG?

to find expected sizes, i run the test with some values and corrected manually with values that the test pass.

[ RUN      ] Imgcodecs_Png_ImwriteFlags.compression_level/0, where GetParam() = ("gifsuite/gif_big.png", 0, 7262971)
/build/precommit_linux64/4.x/opencv/modules/imgcodecs/test/test_png.cpp:345: Failure
Expected equality of these values:
  buf.size()
    Which is: 7263071
  compression_level_output_size
    Which is: 7262971

PNG and SPNG gives same values. when compiling with zlib-ng the resuls are various.

  • Why do you need the same test for 3 images and all compression levels. I propose to reduce the test suite to safe execution time.

i faced different result on linux and windows for the following file. i intended to test with different files. sure i will reduce the list.

[ RUN      ] Imgcodecs_Png_ImwriteFlags.compression_level/0, where GetParam() = ("gifsuite/gif_big.png", 0, 7262971)
/build/precommit_linux64/4.x/opencv/modules/imgcodecs/test/test_png.cpp:345: Failure
Expected equality of these values:
  buf.size()
    Which is: 7263071
  compression_level_output_size
    Which is: 7262971

@asmorkalov
Copy link
Copy Markdown
Contributor

Tested several libpng versions, SPNG, ARMv7. Works well. To be merged after CI.

@asmorkalov asmorkalov merged commit 39bc5df into opencv:4.x Feb 25, 2025
28 checks passed
@sturkmen72 sturkmen72 deleted the png_test branch February 25, 2025 12:27
@asmorkalov asmorkalov mentioned this pull request Mar 4, 2025
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.

2 participants