353 Commits

Author SHA1 Message Date
John Bowler
6bbc74d880 pngunknown fix for multiple IDAT chunks
Fixes the case where IDAT is treated as unknown and saved; the first IDAT chunk
ends up 'before' IDAT, the rest 'after', pngunknown has to take this into
account since it checks before and after.
2015-11-28 08:42:54 -08:00
John Bowler
14d11b9f35 contrib space removal
Remove all trailing spaces from source files in contrib

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-26 09:55:37 -08:00
John Bowler
e41820cd0b Merge branch 'libpng17' into libpng17-20151124.0001 2015-11-25 16:08:20 -08:00
John Bowler
18211df70b [libpng17] Fix CMINFO bug in contrib/tools/pngfix.c 2015-11-25 16:03:47 -06:00
John Bowler
1775bdeb24 Better filter checking
Improve pngvalid coverage of filter combinations, remove the (new in 1.7) code
which disabled previous-row filters on the first row of an image in some cases.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-24 22:24:18 -08:00
Glenn Randers-Pehrson
0cb0a45721 [libpng17] Imported from libpng-1.7.0beta69.tar 2015-11-24 09:51:46 -06:00
John Bowler
8d93ec2eca pngvalid fixes and backward compat
This fix is to the PNG_MAX_GAMMA_8 handling and png_set_rgb_to_gray, which had
bugs which were likely to expose end cases of rgb-to-gray conversion errors.
This might explain some of the machine math dependencies we are seeing
(*might*).

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-23 18:45:28 -08:00
John Bowler
b0076faf1f Backward compatibility with 1.6
1.6 did not define PNG_READ_PNG_SUPPORTED, ever; it doesn't matter there.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-23 18:14:57 -08: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
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
Glenn Randers-Pehrson
dbd98b8c68 [libpng17] Imported from libpng-1.7.0beta67.tar 2015-11-03 09:55:02 -06:00
John Bowler
13ce05daaf Fix 'pow' macros in pngvalid.c
It is legal for 'pow' to be a macro, therefore the argument list cannot contain
preprocessing directives.  Make sure pow is a function where this happens (this
is a minimal safe fix, the issue only arises in non-performance-critical code.)

Signed-off-by: John Bowler <jbowler@acm.org>
2015-10-03 11:08:03 -07:00
John Bowler
2cd6d56ff6 Merge remote-tracking branch 'local/libpng17' into libpng17 2015-10-03 11:04:31 -07:00
Glenn Randers-Pehrson
2ddd06c392 [libpng17] Imported from libpng-1.7.0beta66.tar 2015-10-02 13:44:50 -05:00
John Bowler
c5bc9b668d Fix (work round) rgb-to-gray issues in libpng 1.6
The previous attempts to ignore the errors in the code aren't quite enough to
deal with the 'channel selection' encoding added to libpng 1.7; abort.
pngvalid.c is changed to drop this encoding in prior versions.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-26 21:43:07 -07:00
John Bowler
eab2c419fa makepng fixes for the palette case
Also allow extra command line arguments; convenient for testing odd things.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-26 16:44:29 -07:00
John Bowler
23324b8559 sBIT code coverage and fixes
Fixes for sBIT handling in the low-bit-depth gray and pngstest cases, extends
sBIT handling to the colormap code in the simplified API which is separately
implemented in pngread.c

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-26 15:24:20 -07:00
Glenn Randers-Pehrson
ed44394ad0 [libpng17] Added "option READ_IMAGE on" to contrib/pngminim/decoder/pngusr.dfa
due to the new PNG_READ_IMAGE_SUPPORTED configuration in libpng-1.7.0beta65.
2015-09-26 07:55:54 -05:00
Glenn Randers-Pehrson
8c94b1295f Merge branch 'libpng17' of https://github.com/jbowler/libpng-1 into libpng17 2015-09-25 18:43:07 -05:00
Glenn Randers-Pehrson
1932e16c21 [libpng17] Restored license output to pngstest.c 2015-09-25 18:37:44 -05:00
John Bowler
a6278e7c87 Merge remote-tracking branch 'glennrp/libpng17' into libpng17 2015-09-25 16:25:11 -07:00
John Bowler
a5b993aaed Enable low-bit-depth gray tests in pngvalid 2015-09-25 16:22:59 -07:00
Glenn Randers-Pehrson
f1eec0ba62 [libng17] Updated CHANGES and ANNOUNCE, restored license info in
pngtest-errors.h
2015-09-25 17:40:48 -05:00
John Bowler
0301cc2627 Update pngstest-errors.h for new make check tests
Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-25 12:20:36 -07:00
John Bowler
2c13de800f Merge remote-tracking branch 'glennrp/libpng17' into libpng17
Changes from Glenn for legal reasons
2015-09-24 17:44:05 -07:00
John Bowler
d394d889e1 png_rgb_to_gray optimization fixes
This fixes the code that optimizes RGB to Gray transformations that only
selected on channel and clarifies the handling of max_depth in the transform
code.  It eliminates some UNTESTED cases and removes the write 'invert alpha'
UNTESTED macro because, while there are no test cases for it, code review
some months after writing it suggests it is ok.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-24 17:33:32 -07:00
Glenn Randers-Pehrson
40d90d34a8 [libpng17] Add copyright and license to contrib/testpngs/makepngs.sh 2015-09-22 16:04:26 -05:00
John Bowler
3f6efbd8e2 Squashed commit of the following:
commit bf51c644f7d29400d884e20def9a0bee74904308
Author: John Bowler <jbowler@acm.org>
Date:   Tue Sep 22 09:05:13 2015 -0700

    Updated contrib/testpngs/*.png

    Corrected copyright/licensing information, corrected filtering.

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

commit 05399c8c82d7b188357dc6fa05a8cdd89426b155
Author: John Bowler <jbowler@acm.org>
Date:   Tue Sep 22 09:04:03 2015 -0700

    makepng.c: correct the first row filter setting

    It needs to include the "UP" filter so that libpng knows to retain the first
    line for the UP filter on the next one.  Without this libpng ended up using NONE
    for the second line.

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

commit 8fae6609c063c7e0a5eeb592f8eec15849617ae9
Author: John Bowler <jbowler@acm.org>
Date:   Mon Sep 21 17:15:45 2015 -0700

    makepng: spelling corrections, single test output

    Corrections to some obvious mistakes, plus one output file.

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

commit a2245a2c54a679d25f8f1609f85654d155936863
Author: John Bowler <jbowler@acm.org>
Date:   Mon Sep 21 13:39:48 2015 -0700

    Updated testpngs files with new Licensing tag

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

commit 46d3f863cace5b7aa769c9b882fca49e2a821138
Author: John Bowler <jbowler@acm.org>
Date:   Mon Sep 21 13:38:34 2015 -0700

    Updated makepng.c

    This supports more test cases and a reduced licence keyword (now licensing).
    The extra text cases require more slack in pngstest.c

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

commit 7c9a08b8bc5e2542184d4abb25c33c516bc0adc7
Author: John Bowler <jbowler@acm.org>
Date:   Sun Sep 20 20:55:19 2015 -0700

    Test PNG files

    These files were generated by contrib/testpngs/makepngs.sh --small with MAKEPNG
    set to the makepng compiled from the current contrib/libtests/makepngs.sh

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

commit c2a8a01b2ac733b8029478d10f700f5ab8a713f2
Author: John Bowler <jbowler@acm.org>
Date:   Sun Sep 20 20:51:06 2015 -0700

    makepng --small

    This patch adds code to 'makepng' to allow the generation of smaller images that
    also give better test case coverage.  It also adds copyright and licence to the
    generated images, reflecting the fact that they are original works of the author
    of the code.  The licence used is the Creative Commons Public Domain one,
    appropriate to a non-source-code work.

    The resultant image were used to generate the updated pngstest-errors.h file in
    a prior commit.

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

commit 8c025bcf3fdfb68fb8b1e5fab4b7deb0f94453f6
Author: John Bowler <jbowler@acm.org>
Date:   Sun Sep 20 20:40:52 2015 -0700

    Simplified API sRGB gamma handling correction

    If a gamma encoded file that has a gamma not matching that of sRGB is passed to
    the simplified API the previous code simply interpreted it as a power law
    encoding.  However old Mac files had a power law correction of 1.45 built in to
    the encoding, even though the display devices were consistent with sRGB.
    Assuming a power law encoding results in substantial differences in the
    interpretation of low 8-bit values; below 10.  For example an Apple '5' which is
    equivalent to an sRGB '17' ends up as the value '8'.

    This patch provides some measure of correction for this by making the gamma
    correction done within the simplified API assume that any encoded data is
    encoded relative to an sRGB-like transfer function; the data is corrected back
    to the PNG-nominal 2.2 value then decoded to linear (if required) using the sRGB
    transfer function.

    This reduces the errors reported by pngstest for such files (colormapped ones)
    but still leaves the issue with files where the standard libpng code does the
    gamma decoding.  To cope with the latter cases the patch also includes a new
    pngstest-errors which allows the result, however this is still a
    work-in-progress; a better solution is possible.

    Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-22 13:46:19 -05:00
John Bowler
bf51c644f7 Updated contrib/testpngs/*.png
Corrected copyright/licensing information, corrected filtering.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-22 09:05:13 -07:00
John Bowler
05399c8c82 makepng.c: correct the first row filter setting
It needs to include the "UP" filter so that libpng knows to retain the first
line for the UP filter on the next one.  Without this libpng ended up using NONE
for the second line.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-22 09:04:03 -07:00
John Bowler
8fae6609c0 makepng: spelling corrections, single test output
Corrections to some obvious mistakes, plus one output file.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-21 17:15:45 -07:00
John Bowler
a2245a2c54 Updated testpngs files with new Licensing tag
Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-21 13:39:48 -07:00
John Bowler
46d3f863ca Updated makepng.c
This supports more test cases and a reduced licence keyword (now licensing).
The extra text cases require more slack in pngstest.c

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-21 13:38:34 -07:00
John Bowler
7c9a08b8bc Test PNG files
These files were generated by contrib/testpngs/makepngs.sh --small with MAKEPNG
set to the makepng compiled from the current contrib/libtests/makepngs.sh

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-20 20:55:19 -07:00
John Bowler
c2a8a01b2a makepng --small
This patch adds code to 'makepng' to allow the generation of smaller images that
also give better test case coverage.  It also adds copyright and licence to the
generated images, reflecting the fact that they are original works of the author
of the code.  The licence used is the Creative Commons Public Domain one,
appropriate to a non-source-code work.

The resultant image were used to generate the updated pngstest-errors.h file in
a prior commit.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-20 20:51:06 -07:00
John Bowler
8c025bcf3f Simplified API sRGB gamma handling correction
If a gamma encoded file that has a gamma not matching that of sRGB is passed to
the simplified API the previous code simply interpreted it as a power law
encoding.  However old Mac files had a power law correction of 1.45 built in to
the encoding, even though the display devices were consistent with sRGB.
Assuming a power law encoding results in substantial differences in the
interpretation of low 8-bit values; below 10.  For example an Apple '5' which is
equivalent to an sRGB '17' ends up as the value '8'.

This patch provides some measure of correction for this by making the gamma
correction done within the simplified API assume that any encoded data is
encoded relative to an sRGB-like transfer function; the data is corrected back
to the PNG-nominal 2.2 value then decoded to linear (if required) using the sRGB
transfer function.

This reduces the errors reported by pngstest for such files (colormapped ones)
but still leaves the issue with files where the standard libpng code does the
gamma decoding.  To cope with the latter cases the patch also includes a new
pngstest-errors which allows the result, however this is still a
work-in-progress; a better solution is possible.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-20 20:40:52 -07:00
Glenn Randers-Pehrson
69f2152c0f [libpng17] Added license info to pngstest-errors.h and its generator. 2015-09-19 20:18:49 -05:00
John Bowler
8a9a3fb4dd pngstest: make error limits version specific
Splitting the machine generated error structs out to a file allows the values to
be updated without changing pngstest.c itself, sine libpng 1.6 and 1.7 have
slightly different error limits this simplifies maintenance.

makepngs.sh has also been updated to more accurately reflect current problems in
libpng 1.7

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-19 16:21:36 -07:00
John Bowler
38647d4b21 [libpng17] Fixed makepng.c so that it compiles with GCC 5.1.0.
Added contrib/testspngs/: a directory for additional test png files
2015-09-18 16:36:57 -05:00
John Bowler
62dff2f97e Merge branch 'libpng17' of /home/jbowler/src/libpng/libpng into libpng17 2015-09-16 21:42:04 -07:00
John Bowler
601ae5387e [libpng17] correct low-depth-gray code and enable tests
The low-bit-depth gray tests were disabled in prior versions of libpng because
of problems which should have been fixed by the recent changes to libpng17,
enabling the tests reveals bugs in those changes which are fixed by this commit.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-16 21:09:10 -07:00
Glenn Randers-Pehrson
36ada4acae [libpng17] Add pngchunk.h to contrib/pngminim makefiles. 2015-09-16 11:09:25 -05:00
Glenn Randers-Pehrson
bfc7affa0d [libpng17] Imported from libpng-1.7.0beta65.tar 2015-09-16 10:19:29 -05:00
Glenn Randers-Pehrson
b00bb570f8 [libpng17] Fix file permission for contrib/tools/intgamma.sh 2015-09-15 18:35:26 -05:00
Glenn Randers-Pehrson
c68de14844 [libpng17] Merge contrib/libtests and contrib/tools with libpng16. 2015-09-15 17:11:43 -05:00
Glenn Randers-Pehrson
cc7fa5e23f [libpng17] Added public domain declaration to contrib/libtests/fakepng.c 2015-09-15 15:21:12 -05:00
John Bowler
c5ead5d2cd Test changes
Most of these are back-portable to earlier versions (contrib/libtests
should just work with earlier versions), however the 1.7 specific
changes in pngvalid mean that it probably won't work against 1.7 without
the commits following this one.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-14 17:57:40 -07:00
John Bowler
ddcca52933 ARM NEON code moved to contrib
This patch contains changes to the build (configure) system and the code
required to support the move.  The patch is provided to isolate the
changes from the others that follow it; the code won't necessarily
compile after this patch (the next changes are required.)

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-14 17:31:51 -07:00
John Bowler
3bd90db79f Rename arm -> contrib/neon
libpng will not compile if ARM NEON support is enabled with this commit;
the commit is provided to isolate the rename of the directory from the
rest of the required changes.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-14 17:18:50 -07:00