Write compression options

More sophisticated defaulting which helps significantly for some files along
with code to make it easier to control the compression defaults and to make the
settings honor the API calls the application makes (previously low windowBits
settings would get reset to higher values.)

Signed-off-by: John Bowler <jbowler@acm.org>
This commit is contained in:
John Bowler
2016-02-02 05:58:38 -08:00
parent 5e88e9c396
commit af9ad9545d
6 changed files with 381 additions and 351 deletions

View File

@@ -304,9 +304,10 @@ setting EXTENSION_HEADER
# The '@' here means to substitute the value when pnglibconf.h is built
setting ZLIB_VERNUM default @ZLIB_VERNUM
setting Z_DEFAULT_COMPRESSION default @Z_DEFAULT_COMPRESSION
# TODO: why aren't these Z_RLE; zlib.h says that Z_RLE, specifically, is
# appropriate for PNG images, maybe it doesn't exist in all versions?
setting Z_DEFAULT_STRATEGY default @Z_FILTERED
# By experiment even if other strategies are favored over the zlib default it
# still comes out best for 47% of files tested; more than filtered, the next
# best, for 38.8% of files tested.
setting Z_DEFAULT_STRATEGY default @Z_DEFAULT_STRATEGY
setting Z_DEFAULT_NOFILTER_STRATEGY default @Z_DEFAULT_STRATEGY
setting TEXT_Z_DEFAULT_COMPRESSION default @Z_DEFAULT_COMPRESSION

View File

@@ -213,7 +213,7 @@
#define PNG_ZLIB_VERNUM 0
#define PNG_Z_DEFAULT_COMPRESSION (-1)
#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
#define PNG_Z_DEFAULT_STRATEGY 1
#define PNG_Z_DEFAULT_STRATEGY 0
#define PNG_sCAL_PRECISION 5
#define PNG_sRGB_PROFILE_CHECKS 2
/* end of settings */