Prototype implementation of filter selection

This rewrites the code used previously in the heuristics to make it easier to
debug and introduces the 'methodical' method, which is intended to be an
expensive but reliable way of reducing image size.

The code in this commit does not work; the 'methodical' test for success does
not take account of data buffered inside zlib and, anyway, it changes the
results of pngtest so that the test fails.  This commit is just a checkpoint of
the current state; another commit will temporarily disable the 'methodical'
code.

Signed-off-by: John Bowler <jbowler@acm.org>
This commit is contained in:
John Bowler
2015-12-17 17:47:29 -08:00
parent bd0bb3ca7f
commit 61acc4c9ed
7 changed files with 1533 additions and 816 deletions

View File

@@ -520,29 +520,9 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
if (png_ptr != NULL)
{
/* Set the zlib control values to defaults; they can be overridden by the
* application after the struct has been created.
*/
/* Set the IDAT size to the default, the app can change it later. */
png_ptr->IDAT_size = PNG_ZBUF_SIZE;
/* The 'zlib_strategy' setting is irrelevant because png_default_claim in
* pngwutil.c defaults it according to whether or not filters will be
* used, and ignores this setting.
*/
png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY;
png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION;
png_ptr->zlib_mem_level = 8;
png_ptr->zlib_window_bits = 15;
png_ptr->zlib_method = 8;
#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY;
png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION;
png_ptr->zlib_text_mem_level = 8;
png_ptr->zlib_text_window_bits = 15;
png_ptr->zlib_text_method = 8;
#endif /* WRITE_COMPRESSED_TEXT */
/* This is a highly dubious configuration option; by default it is off,
* but it may be appropriate for private builds that are testing
* extensions not conformant to the current specification, or of