1006 Commits

Author SHA1 Message Date
John Bowler
2b711a751c LOW_MEMORY and COMPAT bug fixes
The LOW_MEMORY PNG_COMPRESSION option should not be setting HUFFMAN_ONLY or
using a low deflate 'level'; according to the comments in zconf.h only
windowBits and memLevel affect the memory.  pngwutil.c has been changed to use
the same values as HIGH compression.

The COMPAT option turned on the old optimize_cmf code (now in fix_cinfo),
however there was a serious bug in that code; it put the wrong value in z_cmf.
The setting was also not handled correctly in pz_compression_settings.

pngtest now verifies the operation of COMPAT and, as a result, pngtest.png has
been reverted to the libpng 1.6 (etc) version.

IDAT size handling has been improved; if not explicitly set values appropriate
to png_level are now chosen (in addition to the handling for the COMPAT
setting).  HIGH and HIGH_READ_SPEED now create unlimited size IDAT chunks, which
requires buffering the whole of the IDAT data in memory but reflects what other
programs and optimizers do.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-06-07 11:27:23 -07:00
John Bowler
01ff090760 API reduction, PNG compression level
PNG compression level setting API: this allows the various compression settings
controlling deflate, fitlering, and so on to be set via a single setting with
six values.  This is currently documented in png.h ("Write compression
settings").

Internally the compression settings have been tuned both for the overall setting
and for any specific settings made by the original APIs.

APIs to control iCCP chunk compression separately have been added.

contrib/examples/pngcp.c has been modified to accomodate the new compression
setting and to include options for separate control of iCCP chunk compression.

The new ABI, png_setting, has been modified to accomodate a wider range of
settings and most of the old compression control ABIs have been replaced by
function-like macros with the same API which call png_setting.  This is an API
check in 1.7.0 for png_setting (alone).  png_setting now handles all of
png_set_option.  This eliminates 19 ABIs at the cost of adding 1 (png_setting).

CRC and benign error checking has been updated internally to use bit-fields and
the CRC calculation skip when the CRC is not used has been improved slightly to
avoid the initialization of the CRC.  A new png_setting based API allows more
detailed control of benign error/warning messages (this may change, the internal
error handling seems too complex.)  The ERROR_NUMBERS support has been removed
with the intent of implementing proper i18n.

The memcpy-size-0 issue in png_push_fill_buffer has been fixed, with an
appropriate debug() assert if a fill for 0 bytes occurs.

Most PNG_FLAG_ values for png_struct::flags have been eliminated (as a result of
the benign error handling changes).  Only one remains.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-06-07 06:48:52 -07:00
Glenn Randers-Pehrson
5095b2adfb [libpng17] Update CHANGES and ANNOUNCE 2016-05-21 13:26:51 -05:00
John Bowler
4905ed4aae Reenable filter selection (dummy)
This implements the code for row-by-row filter selection but does not provide an
actual implementation; the selection function just chooses the lowest set filter
bit.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-09 13:08:50 -07:00
Glenn Randers-Pehrson
ba356b4e4d [libpng17] Bump version to 1.7.0beta81 2016-05-07 15:45:03 -05:00
Glenn Randers-Pehrson
d23207b866 [libpng17] Imported from libpng-1.7.0beta80.tar 2016-05-07 15:44:55 -05:00
John Bowler
cde9b583a8 Write code update
Implemented better defaulting of zlib settings based on image properties.
Implemented pass-through of png_write_rows when the rows can be used directly (a
common case) optimizing the handling of previous-row buffering.

Removed the METHODICAL filter selection method and disabled the HEURISTIC one;
the first was ridiculously slow (though useful for experiments) the second
doesn't work.  Filter selection is temporarily disabled (it defaults to the
lowest numbered filter in the list; typically 'none').

New handling of compression settings (incomplete), new PNG compression level
(not yet visible in an API).

Back ported 'PNG_FAST_FILTERS' from 1.6 (in png.h).

There are minimal API changes beyond removal of the selection options.  Work is
still to be done to investigate a filter selection mechanism that is at least as
good as the previous one.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-04 17:02:20 -07:00
Glenn Randers-Pehrson
1fd42d849d [libpng17] Bump version to 1.7.0beta80 2016-03-09 12:05:09 -06:00
Glenn Randers-Pehrson
b6a1f48ab2 [libpng17] Imported from libpng-1.7.0beta79.tar 2016-03-09 12:05:00 -06:00
John Bowler
af9ad9545d 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>
2016-02-02 05:58:38 -08:00
Roger Leigh
c39c5640b4 [libpng17] Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
and test.cmake.in (Roger Leigh).
2016-01-29 17:27:39 -06:00
Glenn Randers-Pehrson
dcb3f792d9 [libpng17] Bump version to 1.7.0beta79 2016-01-23 14:57:49 -06:00
Glenn Randers-Pehrson
9a6922896d [libpng17] Imported from libpng-1.7.0beta78.tar 2016-01-23 14:06:48 -06:00
John Bowler
4697cbded6 Simplified API: write-to-memory, overflow handling
This implements an API and provides a number of assist macros to allow an
application which uses the simplified API write to bypass stdio and write
directly to memory.

It also includes some warnings (png.h) and some check code to detect *possible*
overflow in the ROW_STRIDE and simplified image SIZE macros.  This disallows
image width/height/format that *might* overflow.  A quiet API change that limits
in-memory image size (uncompressed) to less that 4GByte and image row size
(stride) to less than 2GByte.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-18 11:50:30 -08:00
Glenn Randers-Pehrson
7912bf3037 [libpng17] Bump version to 1.7.0beta78 2016-01-16 08:00:36 -06:00
Glenn Randers-Pehrson
e4fad63915 [libpng17] Imported from libpng-1.7.0beta77.tar 2016-01-16 08:00:23 -06:00
Glenn Randers-Pehrson
27e11dc8cf [libpng17] Bump version to 1.7.0beta77 2016-01-07 13:08:04 -06:00
Glenn Randers-Pehrson
df4568f84b [libpng17] Imported from libpng-1.7.0beta76.tar 2016-01-07 13:06:57 -06:00
Glenn Randers-Pehrson
43d0aa7218 [libpng17] Removed redundant "option WRITE" from scripts/pnglibconf.dfa 2016-01-02 14:13:49 -06:00
Glenn Randers-Pehrson
745a926a38 [libpng17] Bump version to 1.7.0beta76 2015-12-25 08:48:02 -06:00
Glenn Randers-Pehrson
4b1d9e8c2a [libpng17] Imported from libpng-1.7.0beta75.tar 2015-12-25 08:31:37 -06:00
John Bowler
c75a0a40b4 Revert "Disable 'methodical' filter selection code"
This reverts commit 9c76207dbb86e04fd2f5eef088be72ba4a454a36.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-19 09:50:15 -08:00
Glenn Randers-Pehrson
fad9c9af47 [libpng17] Bump version to 1.7.0beta75 2015-12-19 09:25:12 -06:00
Glenn Randers-Pehrson
5695e897fd [libpng17] Imported from libpng-1.7.0beta74.tar 2015-12-19 09:25:01 -06:00
Glenn Randers-Pehrson
16424d20b5 [libpng17] Update CHANGES and ANNOUNCE 2015-12-18 14:41:17 -06:00
John Bowler
9c76207dbb Disable 'methodical' filter selection code
It is incomplete; it works but does not do anything useful except, maybe, on
really enormous images.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-18 09:17:41 -08:00
Glenn Randers-Pehrson
f3fa5dce47 [libpng17] Bump version to 1.7.0beta74 2015-12-11 16:13:00 -06:00
Glenn Randers-Pehrson
17bfbce61c [libpng17] Imported from libpng-1.7.0beta73.tar 2015-12-11 16:07:31 -06:00
Glenn Randers-Pehrson
26090a5f43 [libpng17] Bump version to 1.7.0beta73 2015-12-08 13:03:30 -06:00
Glenn Randers-Pehrson
bfd8446816 [libpng17] Imported from libpng-1.7.0beta72.tar 2015-12-08 12:56:55 -06:00
Glenn Randers-Pehrson
dcbc357c46 [libpng17] Bump version to 1.7.0beta72 2015-12-05 13:58:01 -06:00
Glenn Randers-Pehrson
8ac1821831 [libpng17] Imported from libpng-1.7.0beta71.tar 2015-12-05 13:52:36 -06:00
Glenn Randers-Pehrson
99436a407e [libpng17] Bump version to 1.7.0beta71 2015-12-03 17:54:53 -06:00
John Bowler
afbaf7150b Merge branch 'libpng17' into libpng17-20151201
MASSIVE merge conflicts; way beyond those reported here:

Conflicts:
	pngstruct.h
	pngwutil.c
	scripts/pnglibconf.h.prebuilt
2015-12-03 13:47:39 -08:00
Glenn Randers-Pehrson
47ed19dfce [libpng17] Bump version to 1.7.0beta71 2015-12-02 22:31:19 -06:00
Glenn Randers-Pehrson
94a5189b1c [libpng17] Imported from libpng-1.7.0beta70.tar 2015-12-02 22:30:47 -06:00
John Bowler
9fce04fcd6 Change option (SUPPORTED) names, dummy code
The filter selection options are made more intuitive (IMO, but I am not an
Intuitive User).  Dummy code added for methodical filter selection.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-02 19:03:28 -08:00
John Bowler
e9d567d9ec Filter heuristic implementation
This implements the heuristic part of filter selction, the methodic testing
approach is still not implemented.  png_set_option methods are incomplete.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-02 17:08:17 -08:00
John Bowler
0f2f0f7bbd Merge branch 'libpng17' into libpng17-20151130 2015-12-01 08:41:45 -08:00
John Bowler
8fe2eac47f Separate png_compress_IDAT into w/c
I.e. write/compress, also remove some trailing spaces and clean up pnglibconf
stuff.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-30 21:00:22 -08:00
Glenn Randers-Pehrson
cb3402221b [libpng17] Updated PNG_ZBUF_SIZE definition in scripts/pnglibconf.h.prebuilt 2015-11-30 17:50:39 -06:00
John Bowler
4792c8a751 compression code unification
Unify the compression code so that inflate calls are localized to a common
routine.  Ground work for filter selection support.  Minor API changes to use
void* not byte* for data parameters.  Unification of some of the compression
code with the decompression code; IDAT_size replaces IDAT_read_size and
zbuffer_size, IDAT reading and writing is no longer controlled by the size of
the compression buffer.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-30 13:39:49 -08:00
Glenn Randers-Pehrson
616ed1197b [libpng17] Bump version to 1.7.0beta70 2015-11-24 13:37:41 -06:00
Glenn Randers-Pehrson
0cb0a45721 [libpng17] Imported from libpng-1.7.0beta69.tar 2015-11-24 09:51:46 -06:00
John Bowler
6803b09cb7 Fixes for !READ_INTERLACE/!READ_PNG interpendencies
The reliance of png_read_png on interlace handling and some minor issues in the
test programs where they failed to correctly check for interlace handling were
exposed by the ability to write interlaced images even if WRITE_INTERLACING is
turned off.  This is fixed here.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-22 21:37:16 -08:00
John Bowler
b69df74b8e Re-remove PNG_WRITE_INTERLACE
Previous change backed out.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-22 20:48:23 -08:00
John Bowler
a42416de9c Merge branch 'libpng17' into libpng17-buffer-enhancements 2015-11-22 20:43:56 -08:00
Glenn Randers-Pehrson
771eb7d01e [libpng17] Update CHANGES, ANNOUNCE, pnglibconf.h.prebuilt 2015-11-22 22:35:35 -06:00
John Bowler
504ebd427d Back out READ/WRITE_INTERLACING changes
Now that the code works consistently so that these just switch off the support
for having libpng do the interlace/deinterlace the old names make more sense,
restoring them avoids cruft in the configuration file and avoids an unnecessary
version specific change.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-22 20:25:24 -08:00
John Bowler
0f2554a5e6 Squashed commit of the following:
commit fc4b42b1d56f95efeb1b9fe42dc35b7d98d246bb
Merge: 74516c7 9eb1413
Author: John Bowler <jbowler@acm.org>
Date:   Sun Nov 22 19:37:54 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 74516c7257f1a28a69985684c5673caa390c700a
Author: John Bowler <jbowler@acm.org>
Date:   Sun Nov 22 19:32:43 2015 -0800

    Make check full pass on gcc/g++ x86_64

    Signed-off-by: John Bowler <jbowler@acm.org>

commit e891e34737fc0bc9ee873a5d56b83c1e777b990c
Author: John Bowler <jbowler@acm.org>
Date:   Sun Nov 22 12:01:37 2015 -0800

    Checkpoint: write buffering changes

    This version fails in pngvalid --size because of an error handling very narrow
    images, otherwise a standard build passes make check.

    Signed-off-by: John Bowler <jbowler@acm.org>

commit 457a046ebdab737eefb477126cf855e49df6de50
Author: John Bowler <jbowler@acm.org>
Date:   Sun Nov 22 06:39:36 2015 -0800

    Fix previous bad merge

commit b4f426c97267317637d43f41fe0b05d1659bc63d
Merge: 07b9b90 a3458a6
Author: John Bowler <jbowler@acm.org>
Date:   Sun Nov 22 06:32:34 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 07b9b90dfd653b744dbc3710b096facf6b4605f6
Merge: ed43306 5592e0b
Author: John Bowler <jbowler@acm.org>
Date:   Sat Nov 21 17:07:23 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit ed43306599f7039a90187862db82273fca3a4c3d
Merge: 772aed7 d3c0359
Author: John Bowler <jbowler@acm.org>
Date:   Tue Nov 17 17:47:26 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 772aed72378df9c8fccc5a4594b095d02d410a9c
Merge: 73ae431 801608f
Author: John Bowler <jbowler@acm.org>
Date:   Mon Nov 16 14:26:38 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 73ae4316cb6db7d7f6756583a1c213c35ca4e3f4
Merge: 687e6e3 c09b3ab
Author: John Bowler <jbowler@acm.org>
Date:   Sun Nov 15 09:31:30 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 687e6e393e9d0220c2a12ec474aa01b83c5e9f25
Merge: fedd6da e916d9b
Author: John Bowler <jbowler@acm.org>
Date:   Thu Nov 5 08:45:14 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit fedd6da8798a14b2e002b0bc1379f5a09a03598a
Merge: 2e2fc5f ea41fd2
Author: John Bowler <jbowler@acm.org>
Date:   Tue Nov 3 21:05:01 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 2e2fc5f6d7678b710c52b7ea081ac4add677d8d5
Merge: 990d5f8 5b05197
Author: John Bowler <jbowler@acm.org>
Date:   Mon Oct 12 08:28:30 2015 -0700

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 990d5f88688635dc0888657b689e30ffe7e7a7b3
Author: John Bowler <jbowler@acm.org>
Date:   Sun Oct 4 17:04:53 2015 -0700

    Read row buffer changes

    The read code now allocates one row buffer of the size of the input PNG row and,
    only if required, one buffer of the size of the output.

    The output buffer is required for the progressive reader (always) and for the
    sequential reader if libpng is de-interlacing an image (because the output row
    is used multiple times if png_read_row is called with a display row parameter.)

    This should reduce memory utilization by libpng significantly, but it has no
    detectable effect on overall performance figures of the test programs, these are
    probably dominated by memory allocations for the whole image within the test
    programs.

    Signed-off-by: John Bowler <jbowler@acm.org>

commit 527bf989bf0e30440f9e07a5544a6ebb1d6fd039
Merge: 50ebbc2 9099254
Author: John Bowler <jbowler@acm.org>
Date:   Sat Oct 3 13:39:17 2015 -0700

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 50ebbc2c9a24cf1a6b428db53d55fbd5af4d6be6
Merge: 21a7f40 2cd6d56
Author: John Bowler <jbowler@acm.org>
Date:   Sat Oct 3 11:16:32 2015 -0700

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 21a7f401ab40c79ead9e35882a8066e2cf1d6902
Merge: b512e1c 15a143e
Author: John Bowler <jbowler@acm.org>
Date:   Wed Sep 30 19:01:23 2015 -0700

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit b512e1c2c5bfe6df8b6dca32f862d325ec22115e
Author: John Bowler <jbowler@acm.org>
Date:   Wed Sep 30 17:33:34 2015 -0700

    Transform rewrite: perform transforms in small chunks

    The intent of this change is to reduce the memory footprint during transform
    sequences by performing transforms in fixed (small) sized blocks of pixels.
    The change is incomplete; the filter code still works row-by-row, so the whole
    tranform also works row-by-row, the intent is to fix this so that everything
    works in small(ish) chunks.

    At present the change has no discernable effect on pngvalid --speed or pngstest
    with (e.g.) rgb-8-1.8.png; user time and (minor) page faults are the same in old
    and new versions.  The same applies to real-world 15MP PNG images; even on these
    the presence of the filter code causes a cyclical progress through memory which
    will interfere with any caching otherwise possible (useful word, 'otherwise'.)

    Signed-off-by: John Bowler <jbowler@acm.org>

commit 781cb3699b92beb0e6bc5e03cef8fba820267082
Author: John Bowler <jbowler@acm.org>
Date:   Wed Sep 30 17:12:53 2015 -0700

    Fix NO_WRITE_INTERLACE in pngvalid.c

    The support for writing interlaced images directly from libpng 1.7 was
    unintentionally disabled (INTERLACE_LAST was defined incorrectly, excluding the
    interlaced images).  This obscured the fact that the transform and error test
    case generators lacked the support for writing interlaced images from libpng.

    Signed-off-by: John Bowler <jbowler@acm.org>

commit 406ee2fd7946a384f1d7713712dc646080c5c52c
Author: John Bowler <jbowler@acm.org>
Date:   Wed Sep 30 17:11:40 2015 -0700

    Add pngvalid --transform --interlace test

    This increases code coverage by generating test cases with smaller length rows
    as a result of the interlacing.  Without this packswap handling was incompletely
    tested.

    Signed-off-by: John Bowler <jbowler@acm.org>

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-22 19:41:41 -08:00