veluca93 / fpnge

Demo of a fast PNG encoder.
Apache License 2.0
81 stars 8 forks source link

Add speed/compression runtime option #21

Closed animetosho closed 2 years ago

animetosho commented 2 years ago

As discussed, this removes the defines for speed control, moving it into a runtime option.

This is done via a new parameter, which accepts an options struct. The struct can be filled with a function, given a compression level, allowing for both a (relatively) simple 'level' setting, and being able to configure behaviour more precisely. NULL can be passed as the new parameter to indicate that defaults should be used.
The console application now accepts a -1..-5 flag for the compression level.

CLA response: I release these changes to the public domain subject to the CC0 license (https://creativecommons.org/publicdomain/zero/1.0/).

google-cla[bot] commented 2 years ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

animetosho commented 2 years ago

I realize that things probably didn't change much (in particular not for 1/2/3/4), but what do you think of adding a simple speed/density report for the various options?

There's no such change.
I'm not sure how you'd want to do that, but you're of course welcome to add such a thing.

veluca93 commented 2 years ago

I realize that things probably didn't change much (in particular not for 1/2/3/4), but what do you think of adding a simple speed/density report for the various options?

There's no such change. I'm not sure how you'd want to do that, but you're of course welcome to add such a thing.

The 5 option is new, isn't it? Or did I misunderstand?

animetosho commented 2 years ago

'5' is indeed new, my haphazard test seems to suggest around 99% size at 84% speed.
If you have some normalised benchmark, I could give better results.

veluca93 commented 2 years ago

'5' is indeed new, my haphazard test seems to suggest around 99% size at 84% speed. If you have some normalised benchmark, I could give better results.

Good enough for me for now :)